@jami-studio/dispatch 0.13.14
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 +134 -0
- package/dist/actions/apply-dream-proposal.d.ts +29 -0
- package/dist/actions/apply-dream-proposal.d.ts.map +1 -0
- package/dist/actions/apply-dream-proposal.js +11 -0
- package/dist/actions/apply-dream-proposal.js.map +1 -0
- package/dist/actions/approve-dispatch-change.d.ts +22 -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 +20 -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/archive-workspace-app.d.ts +7 -0
- package/dist/actions/archive-workspace-app.d.ts.map +1 -0
- package/dist/actions/archive-workspace-app.js +15 -0
- package/dist/actions/archive-workspace-app.js.map +1 -0
- package/dist/actions/ask_app.d.ts +10 -0
- package/dist/actions/ask_app.d.ts.map +1 -0
- package/dist/actions/ask_app.js +12 -0
- package/dist/actions/ask_app.js.map +1 -0
- package/dist/actions/create-dream-report.d.ts +59 -0
- package/dist/actions/create-dream-report.d.ts.map +1 -0
- package/dist/actions/create-dream-report.js +67 -0
- package/dist/actions/create-dream-report.js.map +1 -0
- package/dist/actions/create-link-token.d.ts +10 -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-pylon-ticket.d.ts +17 -0
- package/dist/actions/create-pylon-ticket.d.ts.map +1 -0
- package/dist/actions/create-pylon-ticket.js +95 -0
- package/dist/actions/create-pylon-ticket.js.map +1 -0
- package/dist/actions/create-vault-grant.d.ts +17 -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 +21 -0
- package/dist/actions/create-vault-secret.d.ts.map +1 -0
- package/dist/actions/create-vault-secret.js +26 -0
- package/dist/actions/create-vault-secret.js.map +1 -0
- package/dist/actions/create-workspace-resource-grant.d.ts +16 -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 +40 -0
- package/dist/actions/create-workspace-resource.d.ts.map +1 -0
- package/dist/actions/create-workspace-resource.js +22 -0
- package/dist/actions/create-workspace-resource.js.map +1 -0
- package/dist/actions/create_embed_session.d.ts +13 -0
- package/dist/actions/create_embed_session.d.ts.map +1 -0
- package/dist/actions/create_embed_session.js +28 -0
- package/dist/actions/create_embed_session.js.map +1 -0
- package/dist/actions/delete-destination.d.ts +34 -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-staged-dataset.d.ts +8 -0
- package/dist/actions/delete-staged-dataset.d.ts.map +1 -0
- package/dist/actions/delete-staged-dataset.js +31 -0
- package/dist/actions/delete-staged-dataset.js.map +1 -0
- package/dist/actions/delete-vault-secret.d.ts +17 -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 +35 -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 +19 -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/ensure-dream-job.d.ts +33 -0
- package/dist/actions/ensure-dream-job.d.ts.map +1 -0
- package/dist/actions/ensure-dream-job.js +73 -0
- package/dist/actions/ensure-dream-job.js.map +1 -0
- package/dist/actions/get-agent-thread-debug.d.ts +55 -0
- package/dist/actions/get-agent-thread-debug.d.ts.map +1 -0
- package/dist/actions/get-agent-thread-debug.js +24 -0
- package/dist/actions/get-agent-thread-debug.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-dream-settings.d.ts +3 -0
- package/dist/actions/get-dream-settings.d.ts.map +1 -0
- package/dist/actions/get-dream-settings.js +11 -0
- package/dist/actions/get-dream-settings.js.map +1 -0
- package/dist/actions/get-dream.d.ts +48 -0
- package/dist/actions/get-dream.d.ts.map +1 -0
- package/dist/actions/get-dream.js +13 -0
- package/dist/actions/get-dream.js.map +1 -0
- package/dist/actions/get-vault-access-settings.d.ts +3 -0
- package/dist/actions/get-vault-access-settings.d.ts.map +1 -0
- package/dist/actions/get-vault-access-settings.js +10 -0
- package/dist/actions/get-vault-access-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/get-workspace-resource-effective-context.d.ts +8 -0
- package/dist/actions/get-workspace-resource-effective-context.d.ts.map +1 -0
- package/dist/actions/get-workspace-resource-effective-context.js +27 -0
- package/dist/actions/get-workspace-resource-effective-context.js.map +1 -0
- package/dist/actions/grant-vault-secrets-to-app.d.ts +27 -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/grant-workspace-resources-to-app.d.ts +17 -0
- package/dist/actions/grant-workspace-resources-to-app.d.ts.map +1 -0
- package/dist/actions/grant-workspace-resources-to-app.js +15 -0
- package/dist/actions/grant-workspace-resources-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 +183 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/actions/list-agent-thread-sources.d.ts +9 -0
- package/dist/actions/list-agent-thread-sources.d.ts.map +1 -0
- package/dist/actions/list-agent-thread-sources.js +11 -0
- package/dist/actions/list-agent-thread-sources.js.map +1 -0
- package/dist/actions/list-available-workspace-templates.d.ts +3 -0
- package/dist/actions/list-available-workspace-templates.d.ts.map +1 -0
- package/dist/actions/list-available-workspace-templates.js +10 -0
- package/dist/actions/list-available-workspace-templates.js.map +1 -0
- package/dist/actions/list-connected-agents.d.ts +13 -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 +15 -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 +20 -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 +16 -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 +61 -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-dispatch-usage-metrics.d.ts +5 -0
- package/dist/actions/list-dispatch-usage-metrics.d.ts.map +1 -0
- package/dist/actions/list-dispatch-usage-metrics.js +18 -0
- package/dist/actions/list-dispatch-usage-metrics.js.map +1 -0
- package/dist/actions/list-dream-candidates.d.ts +24 -0
- package/dist/actions/list-dream-candidates.d.ts.map +1 -0
- package/dist/actions/list-dream-candidates.js +68 -0
- package/dist/actions/list-dream-candidates.js.map +1 -0
- package/dist/actions/list-dreams.d.ts +29 -0
- package/dist/actions/list-dreams.d.ts.map +1 -0
- package/dist/actions/list-dreams.js +17 -0
- package/dist/actions/list-dreams.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 +29 -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-mcp-app-access.d.ts +14 -0
- package/dist/actions/list-mcp-app-access.d.ts.map +1 -0
- package/dist/actions/list-mcp-app-access.js +25 -0
- package/dist/actions/list-mcp-app-access.js.map +1 -0
- package/dist/actions/list-staged-datasets.d.ts +13 -0
- package/dist/actions/list-staged-datasets.d.ts.map +1 -0
- package/dist/actions/list-staged-datasets.js +33 -0
- package/dist/actions/list-staged-datasets.js.map +1 -0
- package/dist/actions/list-vault-audit.d.ts +16 -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 +17 -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 +18 -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 +9 -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 +13 -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 +6 -0
- package/dist/actions/list-workspace-apps.d.ts.map +1 -0
- package/dist/actions/list-workspace-apps.js +28 -0
- package/dist/actions/list-workspace-apps.js.map +1 -0
- package/dist/actions/list-workspace-resource-grants.d.ts +16 -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-resource-options.d.ts +5 -0
- package/dist/actions/list-workspace-resource-options.d.ts.map +1 -0
- package/dist/actions/list-workspace-resource-options.js +15 -0
- package/dist/actions/list-workspace-resource-options.js.map +1 -0
- package/dist/actions/list-workspace-resources-for-app.d.ts +15 -0
- package/dist/actions/list-workspace-resources-for-app.d.ts.map +1 -0
- package/dist/actions/list-workspace-resources-for-app.js +12 -0
- package/dist/actions/list-workspace-resources-for-app.js.map +1 -0
- package/dist/actions/list-workspace-resources.d.ts +18 -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/list_apps.d.ts +14 -0
- package/dist/actions/list_apps.d.ts.map +1 -0
- package/dist/actions/list_apps.js +26 -0
- package/dist/actions/list_apps.js.map +1 -0
- package/dist/actions/navigate.d.ts +23 -0
- package/dist/actions/navigate.d.ts.map +1 -0
- package/dist/actions/navigate.js +53 -0
- package/dist/actions/navigate.js.map +1 -0
- package/dist/actions/open_app.d.ts +20 -0
- package/dist/actions/open_app.d.ts.map +1 -0
- package/dist/actions/open_app.js +123 -0
- package/dist/actions/open_app.js.map +1 -0
- package/dist/actions/preview-dream-proposal.d.ts +43 -0
- package/dist/actions/preview-dream-proposal.d.ts.map +1 -0
- package/dist/actions/preview-dream-proposal.js +13 -0
- package/dist/actions/preview-dream-proposal.js.map +1 -0
- package/dist/actions/preview-workspace-resource-change.d.ts +8 -0
- package/dist/actions/preview-workspace-resource-change.d.ts.map +1 -0
- package/dist/actions/preview-workspace-resource-change.js +24 -0
- package/dist/actions/preview-workspace-resource-change.js.map +1 -0
- package/dist/actions/provider-api-catalog.d.ts +24 -0
- package/dist/actions/provider-api-catalog.d.ts.map +1 -0
- package/dist/actions/provider-api-catalog.js +22 -0
- package/dist/actions/provider-api-catalog.js.map +1 -0
- package/dist/actions/provider-api-docs.d.ts +22 -0
- package/dist/actions/provider-api-docs.d.ts.map +1 -0
- package/dist/actions/provider-api-docs.js +57 -0
- package/dist/actions/provider-api-docs.js.map +1 -0
- package/dist/actions/provider-api-register.d.ts +85 -0
- package/dist/actions/provider-api-register.d.ts.map +1 -0
- package/dist/actions/provider-api-register.js +160 -0
- package/dist/actions/provider-api-register.js.map +1 -0
- package/dist/actions/provider-api-request.d.ts +35 -0
- package/dist/actions/provider-api-request.d.ts.map +1 -0
- package/dist/actions/provider-api-request.js +168 -0
- package/dist/actions/provider-api-request.js.map +1 -0
- package/dist/actions/query-staged-dataset.d.ts +28 -0
- package/dist/actions/query-staged-dataset.d.ts.map +1 -0
- package/dist/actions/query-staged-dataset.js +105 -0
- package/dist/actions/query-staged-dataset.js.map +1 -0
- package/dist/actions/reject-dispatch-change.d.ts +23 -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/reject-dream-proposal.d.ts +27 -0
- package/dist/actions/reject-dream-proposal.d.ts.map +1 -0
- package/dist/actions/reject-dream-proposal.js +12 -0
- package/dist/actions/reject-dream-proposal.js.map +1 -0
- package/dist/actions/remove-pending-workspace-app.d.ts +7 -0
- package/dist/actions/remove-pending-workspace-app.d.ts.map +1 -0
- package/dist/actions/remove-pending-workspace-app.js +15 -0
- package/dist/actions/remove-pending-workspace-app.js.map +1 -0
- package/dist/actions/request-vault-secret.d.ts +20 -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/restore-starter-workspace-resources.d.ts +9 -0
- package/dist/actions/restore-starter-workspace-resources.d.ts.map +1 -0
- package/dist/actions/restore-starter-workspace-resources.js +14 -0
- package/dist/actions/restore-starter-workspace-resources.js.map +1 -0
- package/dist/actions/revoke-vault-grant.d.ts +16 -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 +15 -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/scaffold-workspace-app.d.ts +10 -0
- package/dist/actions/scaffold-workspace-app.d.ts.map +1 -0
- package/dist/actions/scaffold-workspace-app.js +40 -0
- package/dist/actions/scaffold-workspace-app.js.map +1 -0
- package/dist/actions/search-agent-threads.d.ts +32 -0
- package/dist/actions/search-agent-threads.d.ts.map +1 -0
- package/dist/actions/search-agent-threads.js +25 -0
- package/dist/actions/search-agent-threads.js.map +1 -0
- package/dist/actions/send-code-agent-remote-command.d.ts +34 -0
- package/dist/actions/send-code-agent-remote-command.d.ts.map +1 -0
- package/dist/actions/send-code-agent-remote-command.js +53 -0
- package/dist/actions/send-code-agent-remote-command.js.map +1 -0
- package/dist/actions/send-platform-message.d.ts +14 -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 +5 -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 +23 -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/set-dream-settings.d.ts +17 -0
- package/dist/actions/set-dream-settings.d.ts.map +1 -0
- package/dist/actions/set-dream-settings.js +41 -0
- package/dist/actions/set-dream-settings.js.map +1 -0
- package/dist/actions/set-mcp-app-access.d.ts +17 -0
- package/dist/actions/set-mcp-app-access.d.ts.map +1 -0
- package/dist/actions/set-mcp-app-access.js +46 -0
- package/dist/actions/set-mcp-app-access.js.map +1 -0
- package/dist/actions/set-vault-access-settings.d.ts +5 -0
- package/dist/actions/set-vault-access-settings.d.ts.map +1 -0
- package/dist/actions/set-vault-access-settings.js +13 -0
- package/dist/actions/set-vault-access-settings.js.map +1 -0
- package/dist/actions/start-workspace-app-creation.d.ts +54 -0
- package/dist/actions/start-workspace-app-creation.d.ts.map +1 -0
- package/dist/actions/start-workspace-app-creation.js +42 -0
- package/dist/actions/start-workspace-app-creation.js.map +1 -0
- package/dist/actions/sync-vault-to-app.d.ts +32 -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/unarchive-workspace-app.d.ts +7 -0
- package/dist/actions/unarchive-workspace-app.d.ts.map +1 -0
- package/dist/actions/unarchive-workspace-app.js +15 -0
- package/dist/actions/unarchive-workspace-app.js.map +1 -0
- package/dist/actions/update-vault-secret.d.ts +22 -0
- package/dist/actions/update-vault-secret.d.ts.map +1 -0
- package/dist/actions/update-vault-secret.js +43 -0
- package/dist/actions/update-vault-secret.js.map +1 -0
- package/dist/actions/update-workspace-app-metadata.d.ts +7 -0
- package/dist/actions/update-workspace-app-metadata.d.ts.map +1 -0
- package/dist/actions/update-workspace-app-metadata.js +30 -0
- package/dist/actions/update-workspace-app-metadata.js.map +1 -0
- package/dist/actions/update-workspace-resource.d.ts +39 -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 +39 -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 +217 -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 +128 -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 +96 -0
- package/dist/components/app-keys-popover.js.map +1 -0
- package/dist/components/approval-value-block.d.ts +7 -0
- package/dist/components/approval-value-block.d.ts.map +1 -0
- package/dist/components/approval-value-block.js +22 -0
- package/dist/components/approval-value-block.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 +268 -0
- package/dist/components/create-app-popover.js.map +1 -0
- package/dist/components/dispatch-control-plane.d.ts +2 -0
- package/dist/components/dispatch-control-plane.d.ts.map +1 -0
- package/dist/components/dispatch-control-plane.js +63 -0
- package/dist/components/dispatch-control-plane.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 +17 -0
- package/dist/components/dispatch-shell.js.map +1 -0
- package/dist/components/index.d.ts +13 -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 +52 -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 +36 -0
- package/dist/components/layout/Layout.d.ts.map +1 -0
- package/dist/components/layout/Layout.js +476 -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 +299 -0
- package/dist/components/messaging-setup-panel.js.map +1 -0
- package/dist/components/task-queue-health.d.ts +2 -0
- package/dist/components/task-queue-health.d.ts.map +1 -0
- package/dist/components/task-queue-health.js +49 -0
- package/dist/components/task-queue-health.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 +26 -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/components/workspace-app-card.d.ts +6 -0
- package/dist/components/workspace-app-card.d.ts.map +1 -0
- package/dist/components/workspace-app-card.js +105 -0
- package/dist/components/workspace-app-card.js.map +1 -0
- package/dist/components/workspace-resource-effective-stack.d.ts +11 -0
- package/dist/components/workspace-resource-effective-stack.d.ts.map +1 -0
- package/dist/components/workspace-resource-effective-stack.js +59 -0
- package/dist/components/workspace-resource-effective-stack.js.map +1 -0
- package/dist/components/workspace-resource-impact-preview.d.ts +9 -0
- package/dist/components/workspace-resource-impact-preview.d.ts.map +1 -0
- package/dist/components/workspace-resource-impact-preview.js +39 -0
- package/dist/components/workspace-resource-impact-preview.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 +225 -0
- package/dist/db/migrations.js.map +1 -0
- package/dist/db/schema.d.ts +3058 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +190 -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 +14 -0
- package/dist/hooks/use-navigation-state.d.ts.map +1 -0
- package/dist/hooks/use-navigation-state.js +257 -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/automation-display.d.ts +13 -0
- package/dist/lib/automation-display.d.ts.map +1 -0
- package/dist/lib/automation-display.js +62 -0
- package/dist/lib/automation-display.js.map +1 -0
- package/dist/lib/automations.d.ts +28 -0
- package/dist/lib/automations.d.ts.map +1 -0
- package/dist/lib/automations.js +27 -0
- package/dist/lib/automations.js.map +1 -0
- package/dist/lib/catch-all-target.d.ts +17 -0
- package/dist/lib/catch-all-target.d.ts.map +1 -0
- package/dist/lib/catch-all-target.js +103 -0
- package/dist/lib/catch-all-target.js.map +1 -0
- package/dist/lib/overview-chat.d.ts +4 -0
- package/dist/lib/overview-chat.d.ts.map +1 -0
- package/dist/lib/overview-chat.js +21 -0
- package/dist/lib/overview-chat.js.map +1 -0
- package/dist/lib/task-queue.d.ts +19 -0
- package/dist/lib/task-queue.d.ts.map +1 -0
- package/dist/lib/task-queue.js +54 -0
- package/dist/lib/task-queue.js.map +1 -0
- package/dist/lib/thread-link-preview.d.ts +23 -0
- package/dist/lib/thread-link-preview.d.ts.map +1 -0
- package/dist/lib/thread-link-preview.js +150 -0
- package/dist/lib/thread-link-preview.js.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +6 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/workspace-apps.d.ts +25 -0
- package/dist/lib/workspace-apps.d.ts.map +1 -0
- package/dist/lib/workspace-apps.js +9 -0
- package/dist/lib/workspace-apps.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 +64 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/routes/pages/$appId.d.ts +8 -0
- package/dist/routes/pages/$appId.d.ts.map +1 -0
- package/dist/routes/pages/$appId.js +103 -0
- package/dist/routes/pages/$appId.js.map +1 -0
- package/dist/routes/pages/_index.d.ts +22 -0
- package/dist/routes/pages/_index.d.ts.map +1 -0
- package/dist/routes/pages/_index.js +48 -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 +89 -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 +51 -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 +29 -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 +90 -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/automations.d.ts +5 -0
- package/dist/routes/pages/automations.d.ts.map +1 -0
- package/dist/routes/pages/automations.js +106 -0
- package/dist/routes/pages/automations.js.map +1 -0
- package/dist/routes/pages/chat.d.ts +5 -0
- package/dist/routes/pages/chat.d.ts.map +1 -0
- package/dist/routes/pages/chat.js +115 -0
- package/dist/routes/pages/chat.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 +90 -0
- package/dist/routes/pages/destinations.js.map +1 -0
- package/dist/routes/pages/dream-settings.d.ts +34 -0
- package/dist/routes/pages/dream-settings.d.ts.map +1 -0
- package/dist/routes/pages/dream-settings.js +68 -0
- package/dist/routes/pages/dream-settings.js.map +1 -0
- package/dist/routes/pages/dreams.d.ts +5 -0
- package/dist/routes/pages/dreams.d.ts.map +1 -0
- package/dist/routes/pages/dreams.js +436 -0
- package/dist/routes/pages/dreams.js.map +1 -0
- package/dist/routes/pages/extensions.$id.d.ts +5 -0
- package/dist/routes/pages/extensions.$id.d.ts.map +1 -0
- package/dist/routes/pages/extensions.$id.js +9 -0
- package/dist/routes/pages/extensions.$id.js.map +1 -0
- package/dist/routes/pages/extensions._index.d.ts +5 -0
- package/dist/routes/pages/extensions._index.d.ts.map +1 -0
- package/dist/routes/pages/extensions._index.js +9 -0
- package/dist/routes/pages/extensions._index.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 +152 -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/metrics.d.ts +5 -0
- package/dist/routes/pages/metrics.d.ts.map +1 -0
- package/dist/routes/pages/metrics.js +175 -0
- package/dist/routes/pages/metrics.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 +11 -0
- package/dist/routes/pages/new-app.js.map +1 -0
- package/dist/routes/pages/overview.d.ts +18 -0
- package/dist/routes/pages/overview.d.ts.map +1 -0
- package/dist/routes/pages/overview.js +19 -0
- package/dist/routes/pages/overview.js.map +1 -0
- package/dist/routes/pages/settings.d.ts +5 -0
- package/dist/routes/pages/settings.d.ts.map +1 -0
- package/dist/routes/pages/settings.js +18 -0
- package/dist/routes/pages/settings.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 +9 -0
- package/dist/routes/pages/team.js.map +1 -0
- package/dist/routes/pages/thread-debug.d.ts +5 -0
- package/dist/routes/pages/thread-debug.d.ts.map +1 -0
- package/dist/routes/pages/thread-debug.js +161 -0
- package/dist/routes/pages/thread-debug.js.map +1 -0
- package/dist/routes/pages/tools.$id.d.ts +5 -0
- package/dist/routes/pages/tools.$id.d.ts.map +1 -0
- package/dist/routes/pages/tools.$id.js +9 -0
- package/dist/routes/pages/tools.$id.js.map +1 -0
- package/dist/routes/pages/tools._index.d.ts +5 -0
- package/dist/routes/pages/tools._index.d.ts.map +1 -0
- package/dist/routes/pages/tools._index.js +9 -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 +194 -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 +327 -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 +156 -0
- package/dist/server/lib/app-creation-store.d.ts.map +1 -0
- package/dist/server/lib/app-creation-store.js +1507 -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 +244 -0
- package/dist/server/lib/dispatch-integrations.js.map +1 -0
- package/dist/server/lib/dispatch-remote-commands.d.ts +83 -0
- package/dist/server/lib/dispatch-remote-commands.d.ts.map +1 -0
- package/dist/server/lib/dispatch-remote-commands.js +256 -0
- package/dist/server/lib/dispatch-remote-commands.js.map +1 -0
- package/dist/server/lib/dispatch-store.d.ts +339 -0
- package/dist/server/lib/dispatch-store.d.ts.map +1 -0
- package/dist/server/lib/dispatch-store.js +685 -0
- package/dist/server/lib/dispatch-store.js.map +1 -0
- package/dist/server/lib/dreams-store.d.ts +398 -0
- package/dist/server/lib/dreams-store.d.ts.map +1 -0
- package/dist/server/lib/dreams-store.js +2330 -0
- package/dist/server/lib/dreams-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 +48 -0
- package/dist/server/lib/env-config.js.map +1 -0
- package/dist/server/lib/mcp-access-store.d.ts +16 -0
- package/dist/server/lib/mcp-access-store.d.ts.map +1 -0
- package/dist/server/lib/mcp-access-store.js +64 -0
- package/dist/server/lib/mcp-access-store.js.map +1 -0
- package/dist/server/lib/mcp-gateway.d.ts +51 -0
- package/dist/server/lib/mcp-gateway.d.ts.map +1 -0
- package/dist/server/lib/mcp-gateway.js +477 -0
- package/dist/server/lib/mcp-gateway.js.map +1 -0
- package/dist/server/lib/onboarding-steps.d.ts +12 -0
- package/dist/server/lib/onboarding-steps.d.ts.map +1 -0
- package/dist/server/lib/onboarding-steps.js +47 -0
- package/dist/server/lib/onboarding-steps.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 +136 -0
- package/dist/server/lib/pre-auth-routing.js.map +1 -0
- package/dist/server/lib/provider-api.d.ts +27 -0
- package/dist/server/lib/provider-api.d.ts.map +1 -0
- package/dist/server/lib/provider-api.js +49 -0
- package/dist/server/lib/provider-api.js.map +1 -0
- package/dist/server/lib/thread-debug-store.d.ts +109 -0
- package/dist/server/lib/thread-debug-store.d.ts.map +1 -0
- package/dist/server/lib/thread-debug-store.js +590 -0
- package/dist/server/lib/thread-debug-store.js.map +1 -0
- package/dist/server/lib/thread-link-preview.d.ts +3 -0
- package/dist/server/lib/thread-link-preview.d.ts.map +1 -0
- package/dist/server/lib/thread-link-preview.js +28 -0
- package/dist/server/lib/thread-link-preview.js.map +1 -0
- package/dist/server/lib/usage-metrics-store.d.ts +96 -0
- package/dist/server/lib/usage-metrics-store.d.ts.map +1 -0
- package/dist/server/lib/usage-metrics-store.js +422 -0
- package/dist/server/lib/usage-metrics-store.js.map +1 -0
- package/dist/server/lib/vault-store.d.ts +344 -0
- package/dist/server/lib/vault-store.d.ts.map +1 -0
- package/dist/server/lib/vault-store.js +874 -0
- package/dist/server/lib/vault-store.js.map +1 -0
- package/dist/server/lib/workspace-resources-store.d.ts +358 -0
- package/dist/server/lib/workspace-resources-store.d.ts.map +1 -0
- package/dist/server/lib/workspace-resources-store.js +991 -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 +67 -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 +10 -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 +67 -0
- package/dist/server/plugins/integrations.js.map +1 -0
- package/package.json +113 -0
- package/src/actions/apply-dream-proposal.ts +13 -0
- package/src/actions/approve-dispatch-change.ts +12 -0
- package/src/actions/approve-vault-request.ts +24 -0
- package/src/actions/archive-workspace-app.ts +17 -0
- package/src/actions/ask_app.ts +14 -0
- package/src/actions/create-dream-report.ts +77 -0
- package/src/actions/create-link-token.ts +13 -0
- package/src/actions/create-pylon-ticket.ts +111 -0
- package/src/actions/create-vault-grant.ts +16 -0
- package/src/actions/create-vault-secret.ts +28 -0
- package/src/actions/create-workspace-resource-grant.ts +16 -0
- package/src/actions/create-workspace-resource.ts +30 -0
- package/src/actions/create_embed_session.ts +30 -0
- package/src/actions/delete-destination.ts +12 -0
- package/src/actions/delete-staged-dataset.ts +40 -0
- package/src/actions/delete-vault-secret.ts +13 -0
- package/src/actions/delete-workspace-resource.ts +13 -0
- package/src/actions/deny-vault-request.ts +13 -0
- package/src/actions/ensure-dream-job.ts +77 -0
- package/src/actions/get-agent-thread-debug.ts +26 -0
- package/src/actions/get-app-creation-settings.ts +12 -0
- package/src/actions/get-dispatch-settings.ts +11 -0
- package/src/actions/get-dream-settings.ts +13 -0
- package/src/actions/get-dream.ts +15 -0
- package/src/actions/get-vault-access-settings.ts +12 -0
- package/src/actions/get-workspace-info.ts +12 -0
- package/src/actions/get-workspace-resource-effective-context.ts +35 -0
- package/src/actions/grant-vault-secrets-to-app.ts +21 -0
- package/src/actions/grant-workspace-resources-to-app.ts +17 -0
- package/src/actions/index.spec.ts +32 -0
- package/src/actions/index.ts +186 -0
- package/src/actions/list-agent-thread-sources.ts +13 -0
- package/src/actions/list-available-workspace-templates.ts +12 -0
- package/src/actions/list-connected-agents.ts +103 -0
- package/src/actions/list-destinations.ts +11 -0
- package/src/actions/list-dispatch-approvals.ts +11 -0
- package/src/actions/list-dispatch-audit.ts +13 -0
- package/src/actions/list-dispatch-overview.ts +19 -0
- package/src/actions/list-dispatch-usage-metrics.ts +20 -0
- package/src/actions/list-dream-candidates.ts +78 -0
- package/src/actions/list-dreams.ts +18 -0
- package/src/actions/list-integrations-catalog.ts +12 -0
- package/src/actions/list-linked-identities.ts +11 -0
- package/src/actions/list-mcp-app-access.ts +27 -0
- package/src/actions/list-staged-datasets.ts +37 -0
- package/src/actions/list-vault-audit.ts +17 -0
- package/src/actions/list-vault-grants.ts +15 -0
- package/src/actions/list-vault-requests.ts +17 -0
- package/src/actions/list-vault-secret-options.ts +21 -0
- package/src/actions/list-vault-secrets.ts +27 -0
- package/src/actions/list-workspace-apps.ts +30 -0
- package/src/actions/list-workspace-resource-grants.ts +15 -0
- package/src/actions/list-workspace-resource-options.ts +17 -0
- package/src/actions/list-workspace-resources-for-app.ts +14 -0
- package/src/actions/list-workspace-resources.ts +17 -0
- package/src/actions/list_apps.ts +28 -0
- package/src/actions/navigate.ts +53 -0
- package/src/actions/open_app.spec.ts +106 -0
- package/src/actions/open_app.ts +152 -0
- package/src/actions/preview-dream-proposal.ts +15 -0
- package/src/actions/preview-workspace-resource-change.ts +26 -0
- package/src/actions/provider-api-catalog.ts +27 -0
- package/src/actions/provider-api-docs.ts +73 -0
- package/src/actions/provider-api-register.ts +198 -0
- package/src/actions/provider-api-request.ts +231 -0
- package/src/actions/query-staged-dataset.ts +126 -0
- package/src/actions/reject-dispatch-change.ts +13 -0
- package/src/actions/reject-dream-proposal.ts +13 -0
- package/src/actions/remove-pending-workspace-app.ts +17 -0
- package/src/actions/request-vault-secret.ts +17 -0
- package/src/actions/restore-starter-workspace-resources.ts +18 -0
- package/src/actions/revoke-vault-grant.ts +12 -0
- package/src/actions/revoke-workspace-resource-grant.ts +16 -0
- package/src/actions/scaffold-workspace-app.spec.ts +33 -0
- package/src/actions/scaffold-workspace-app.ts +50 -0
- package/src/actions/search-agent-threads.ts +31 -0
- package/src/actions/send-code-agent-remote-command.ts +60 -0
- package/src/actions/send-platform-message.ts +101 -0
- package/src/actions/set-app-creation-settings.ts +20 -0
- package/src/actions/set-dispatch-approval-policy.ts +25 -0
- package/src/actions/set-dream-settings.spec.ts +81 -0
- package/src/actions/set-dream-settings.ts +45 -0
- package/src/actions/set-mcp-app-access.ts +60 -0
- package/src/actions/set-vault-access-settings.ts +17 -0
- package/src/actions/start-workspace-app-creation.ts +49 -0
- package/src/actions/sync-vault-to-app.ts +15 -0
- package/src/actions/unarchive-workspace-app.ts +17 -0
- package/src/actions/update-vault-secret.ts +49 -0
- package/src/actions/update-workspace-app-metadata.ts +33 -0
- package/src/actions/update-workspace-resource.ts +20 -0
- package/src/actions/upsert-destination.ts +30 -0
- package/src/actions/view-screen.ts +249 -0
- package/src/components/agents-panel.tsx +358 -0
- package/src/components/app-keys-popover.tsx +258 -0
- package/src/components/approval-value-block.spec.tsx +60 -0
- package/src/components/approval-value-block.tsx +33 -0
- package/src/components/create-app-popover.tsx +598 -0
- package/src/components/dispatch-control-plane.tsx +228 -0
- package/src/components/dispatch-shell.tsx +53 -0
- package/src/components/index.ts +17 -0
- package/src/components/layout/Header.tsx +93 -0
- package/src/components/layout/HeaderActions.tsx +84 -0
- package/src/components/layout/Layout.tsx +981 -0
- package/src/components/messaging-setup-panel.tsx +677 -0
- package/src/components/task-queue-health.tsx +166 -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 +128 -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 +777 -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/components/workspace-app-card.tsx +450 -0
- package/src/components/workspace-resource-effective-stack.spec.tsx +126 -0
- package/src/components/workspace-resource-effective-stack.tsx +142 -0
- package/src/components/workspace-resource-impact-preview.spec.tsx +148 -0
- package/src/components/workspace-resource-impact-preview.tsx +117 -0
- package/src/config.ts +35 -0
- package/src/db/index.ts +13 -0
- package/src/db/migrations.spec.ts +80 -0
- package/src/db/migrations.ts +224 -0
- package/src/db/schema.ts +204 -0
- package/src/hooks/use-mobile.tsx +21 -0
- package/src/hooks/use-navigation-state.spec.ts +45 -0
- package/src/hooks/use-navigation-state.ts +295 -0
- package/src/hooks/use-toast.ts +188 -0
- package/src/index.ts +19 -0
- package/src/lib/automation-display.spec.ts +95 -0
- package/src/lib/automation-display.ts +70 -0
- package/src/lib/automations.ts +60 -0
- package/src/lib/catch-all-target.spec.ts +156 -0
- package/src/lib/catch-all-target.ts +125 -0
- package/src/lib/overview-chat.spec.ts +63 -0
- package/src/lib/overview-chat.ts +26 -0
- package/src/lib/task-queue.spec.ts +57 -0
- package/src/lib/task-queue.ts +72 -0
- package/src/lib/thread-link-preview.ts +160 -0
- package/src/lib/utils.ts +6 -0
- package/src/lib/workspace-apps.ts +31 -0
- package/src/routes/index.ts +64 -0
- package/src/routes/pages/$appId.tsx +193 -0
- package/src/routes/pages/_index.tsx +60 -0
- package/src/routes/pages/agents.tsx +216 -0
- package/src/routes/pages/approval.tsx +287 -0
- package/src/routes/pages/approvals.tsx +158 -0
- package/src/routes/pages/apps.$appId.tsx +124 -0
- package/src/routes/pages/apps.tsx +396 -0
- package/src/routes/pages/audit.tsx +42 -0
- package/src/routes/pages/automations.tsx +280 -0
- package/src/routes/pages/chat.tsx +194 -0
- package/src/routes/pages/destinations.tsx +274 -0
- package/src/routes/pages/dream-settings.spec.ts +131 -0
- package/src/routes/pages/dream-settings.ts +103 -0
- package/src/routes/pages/dreams.tsx +1837 -0
- package/src/routes/pages/extensions.$id.tsx +9 -0
- package/src/routes/pages/extensions._index.tsx +9 -0
- package/src/routes/pages/identities.tsx +92 -0
- package/src/routes/pages/integrations.tsx +451 -0
- package/src/routes/pages/messaging.tsx +17 -0
- package/src/routes/pages/metrics.tsx +777 -0
- package/src/routes/pages/new-app.tsx +19 -0
- package/src/routes/pages/overview.tsx +22 -0
- package/src/routes/pages/settings.tsx +122 -0
- package/src/routes/pages/team.tsx +9 -0
- package/src/routes/pages/thread-debug.tsx +690 -0
- package/src/routes/pages/tools.$id.tsx +9 -0
- package/src/routes/pages/tools._index.tsx +9 -0
- package/src/routes/pages/vault.tsx +874 -0
- package/src/routes/pages/workspace.tsx +1162 -0
- package/src/server/index.ts +79 -0
- package/src/server/lib/app-creation-store.spec.ts +379 -0
- package/src/server/lib/app-creation-store.ts +1933 -0
- package/src/server/lib/dispatch-integrations.spec.ts +277 -0
- package/src/server/lib/dispatch-integrations.ts +302 -0
- package/src/server/lib/dispatch-remote-commands.spec.ts +168 -0
- package/src/server/lib/dispatch-remote-commands.ts +375 -0
- package/src/server/lib/dispatch-store.ts +927 -0
- package/src/server/lib/dreams-store.spec.ts +1492 -0
- package/src/server/lib/dreams-store.ts +3187 -0
- package/src/server/lib/env-config.ts +49 -0
- package/src/server/lib/mcp-access-store.spec.ts +59 -0
- package/src/server/lib/mcp-access-store.ts +104 -0
- package/src/server/lib/mcp-gateway.spec.ts +693 -0
- package/src/server/lib/mcp-gateway.ts +627 -0
- package/src/server/lib/onboarding-steps.ts +50 -0
- package/src/server/lib/pre-auth-routing.ts +159 -0
- package/src/server/lib/provider-api.ts +69 -0
- package/src/server/lib/thread-debug-store.ts +784 -0
- package/src/server/lib/thread-link-preview.spec.ts +127 -0
- package/src/server/lib/thread-link-preview.ts +32 -0
- package/src/server/lib/usage-metrics-store.spec.ts +102 -0
- package/src/server/lib/usage-metrics-store.ts +659 -0
- package/src/server/lib/vault-store.spec.ts +189 -0
- package/src/server/lib/vault-store.ts +1234 -0
- package/src/server/lib/workspace-resource-approval-lifecycle.spec.ts +227 -0
- package/src/server/lib/workspace-resources-store.spec.ts +1108 -0
- package/src/server/lib/workspace-resources-store.ts +1396 -0
- package/src/server/plugins/agent-chat.ts +69 -0
- package/src/server/plugins/auth.ts +35 -0
- package/src/server/plugins/core-routes.ts +12 -0
- package/src/server/plugins/db.ts +7 -0
- package/src/server/plugins/integrations.ts +77 -0
- package/src/styles/dispatch-css.spec.ts +65 -0
- package/src/styles/dispatch.css +108 -0
|
@@ -0,0 +1,1507 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { getDbExec } from "@agent-native/core/db";
|
|
6
|
+
import { getBuilderBranchProjectId, getRequestContext, isIntegrationCallerRequest, resolveBuilderBranchProjectId, resolveBuilderCredentials, runBuilderAgent, } from "@agent-native/core/server";
|
|
7
|
+
import { getSetting, putSetting } from "@agent-native/core/settings";
|
|
8
|
+
import { assertValidWorkspaceAppId } from "@agent-native/core/shared";
|
|
9
|
+
import { identityKeyForIncoming } from "./dispatch-integrations.js";
|
|
10
|
+
import { currentOrgId, currentOwnerEmail, recordAudit, resolveLinkedOwner, } from "./dispatch-store.js";
|
|
11
|
+
import { createRequest, listSecrets } from "./vault-store.js";
|
|
12
|
+
import { grantWorkspaceResourcesToApp, listWorkspaceResourceOptions, } from "./workspace-resources-store.js";
|
|
13
|
+
const SETTINGS_KEY = "dispatch-app-creation-settings";
|
|
14
|
+
const WORKSPACE_APP_METADATA_SETTINGS_KEY = "workspace-app-metadata";
|
|
15
|
+
const WORKSPACE_APPS_ENV_KEY = "AGENT_NATIVE_WORKSPACE_APPS_JSON";
|
|
16
|
+
const WORKSPACE_APPS_MANIFEST_FILE = "workspace-apps.json";
|
|
17
|
+
const WORKSPACE_APPS_GATEWAY_PATH = "/_workspace/apps";
|
|
18
|
+
const WORKSPACE_APPS_GATEWAY_TIMEOUT_MS = 1_000;
|
|
19
|
+
const MAX_PENDING_APPS = 50;
|
|
20
|
+
const PENDING_WORKSPACE_APP_TTL_MS = 7 * 24 * 60 * 60 * 1_000;
|
|
21
|
+
const AGENT_CARD_PATH = "/.well-known/agent-card.json";
|
|
22
|
+
const AGENT_CARD_FETCH_TIMEOUT_MS = 1_500;
|
|
23
|
+
const DEFAULT_WORKSPACE_APP_AUDIENCE = "internal";
|
|
24
|
+
function readJson(file) {
|
|
25
|
+
try {
|
|
26
|
+
return JSON.parse(fs.readFileSync(file, "utf8"));
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function findWorkspaceRoot(startDir = process.cwd()) {
|
|
33
|
+
let dir = path.resolve(startDir);
|
|
34
|
+
for (let i = 0; i < 20; i++) {
|
|
35
|
+
const pkg = readJson(path.join(dir, "package.json"));
|
|
36
|
+
if (typeof pkg?.["agent-native"]?.workspaceCore === "string") {
|
|
37
|
+
return dir;
|
|
38
|
+
}
|
|
39
|
+
const parent = path.dirname(dir);
|
|
40
|
+
if (parent === dir)
|
|
41
|
+
break;
|
|
42
|
+
dir = parent;
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
function titleCase(value) {
|
|
47
|
+
return value
|
|
48
|
+
.split(/[-_\s]+/)
|
|
49
|
+
.filter(Boolean)
|
|
50
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
51
|
+
.join(" ");
|
|
52
|
+
}
|
|
53
|
+
function normalizeWhitespace(value) {
|
|
54
|
+
return value.replace(/\s+/g, " ").trim();
|
|
55
|
+
}
|
|
56
|
+
function ensureSentence(value) {
|
|
57
|
+
if (!value)
|
|
58
|
+
return value;
|
|
59
|
+
const capitalized = value.charAt(0).toUpperCase() + value.slice(1);
|
|
60
|
+
return /[.!?]$/.test(capitalized) ? capitalized : `${capitalized}.`;
|
|
61
|
+
}
|
|
62
|
+
function clipSentence(value, max = 180) {
|
|
63
|
+
if (value.length <= max)
|
|
64
|
+
return value;
|
|
65
|
+
const clipped = value
|
|
66
|
+
.slice(0, max - 1)
|
|
67
|
+
.replace(/\s+\S*$/, "")
|
|
68
|
+
.trim();
|
|
69
|
+
return `${clipped || value.slice(0, max - 1).trim()}…`;
|
|
70
|
+
}
|
|
71
|
+
export function generateWorkspaceAppDescription(prompt, appId) {
|
|
72
|
+
const cleaned = normalizeWhitespace(prompt)
|
|
73
|
+
.replace(/^(please\s+)?(build|create|make|generate|scaffold)\s+(me\s+|us\s+)?/i, "")
|
|
74
|
+
.replace(/^(an?\s+)?(workspace\s+)?(agent-native\s+)?(app|tool)\s+(that|to|for)\s+/i, "")
|
|
75
|
+
.replace(/^(an?\s+)?(dashboard|workspace|agent)\s+(that|to|for)\s+/i, "");
|
|
76
|
+
if (!cleaned)
|
|
77
|
+
return `Workspace app for ${titleCase(appId)}.`;
|
|
78
|
+
return clipSentence(ensureSentence(cleaned));
|
|
79
|
+
}
|
|
80
|
+
function scopedSettingsKey() {
|
|
81
|
+
const orgId = currentOrgId();
|
|
82
|
+
if (orgId)
|
|
83
|
+
return `${SETTINGS_KEY}:org:${orgId}`;
|
|
84
|
+
return `${SETTINGS_KEY}:user:${currentOwnerEmail()}`;
|
|
85
|
+
}
|
|
86
|
+
function workspaceAppMetadataSettingsKey() {
|
|
87
|
+
const orgId = currentOrgId();
|
|
88
|
+
if (orgId)
|
|
89
|
+
return `${WORKSPACE_APP_METADATA_SETTINGS_KEY}:org:${orgId}`;
|
|
90
|
+
return `${WORKSPACE_APP_METADATA_SETTINGS_KEY}:user:${currentOwnerEmail()}`;
|
|
91
|
+
}
|
|
92
|
+
function cleanOptionalString(value) {
|
|
93
|
+
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
94
|
+
}
|
|
95
|
+
function normalizeContextPart(value) {
|
|
96
|
+
return value.trim().replace(/\s+/g, " ");
|
|
97
|
+
}
|
|
98
|
+
function pendingWorkspaceAppContext() {
|
|
99
|
+
const branch = cleanOptionalString(process.env.BRANCH) ??
|
|
100
|
+
cleanOptionalString(process.env.HEAD) ??
|
|
101
|
+
cleanOptionalString(process.env.VERCEL_GIT_COMMIT_REF) ??
|
|
102
|
+
cleanOptionalString(process.env.CF_PAGES_BRANCH) ??
|
|
103
|
+
cleanOptionalString(process.env.RENDER_GIT_BRANCH) ??
|
|
104
|
+
cleanOptionalString(process.env.FLY_BRANCH);
|
|
105
|
+
if (branch) {
|
|
106
|
+
const normalized = normalizeContextPart(branch);
|
|
107
|
+
return { id: `branch:${normalized}`, label: `Branch: ${normalized}` };
|
|
108
|
+
}
|
|
109
|
+
const origin = cleanOptionalString(process.env.DEPLOY_PRIME_URL) ??
|
|
110
|
+
cleanOptionalString(process.env.DEPLOY_URL) ??
|
|
111
|
+
cleanOptionalString(process.env.URL) ??
|
|
112
|
+
cleanOptionalString(process.env.APP_URL) ??
|
|
113
|
+
cleanOptionalString(process.env.BETTER_AUTH_URL) ??
|
|
114
|
+
cleanOptionalString(process.env.WORKSPACE_GATEWAY_URL);
|
|
115
|
+
if (!origin)
|
|
116
|
+
return null;
|
|
117
|
+
try {
|
|
118
|
+
const parsed = new URL(origin);
|
|
119
|
+
return {
|
|
120
|
+
id: `origin:${parsed.origin}`,
|
|
121
|
+
label: parsed.hostname,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
const normalized = normalizeContextPart(origin);
|
|
126
|
+
return { id: `origin:${normalized}`, label: normalized };
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async function readSettingsRecord() {
|
|
130
|
+
const raw = await getSetting(scopedSettingsKey()).catch(() => null);
|
|
131
|
+
return raw && typeof raw === "object" && !Array.isArray(raw)
|
|
132
|
+
? raw
|
|
133
|
+
: {};
|
|
134
|
+
}
|
|
135
|
+
function cleanOptionalText(value) {
|
|
136
|
+
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
137
|
+
}
|
|
138
|
+
function parseWorkspaceAppMetadataSettings(raw) {
|
|
139
|
+
const record = raw && typeof raw === "object" && !Array.isArray(raw)
|
|
140
|
+
? raw
|
|
141
|
+
: {};
|
|
142
|
+
const rawApps = record.apps &&
|
|
143
|
+
typeof record.apps === "object" &&
|
|
144
|
+
!Array.isArray(record.apps)
|
|
145
|
+
? record.apps
|
|
146
|
+
: {};
|
|
147
|
+
const apps = {};
|
|
148
|
+
for (const [id, value] of Object.entries(rawApps)) {
|
|
149
|
+
if (!id.trim() || !value || typeof value !== "object")
|
|
150
|
+
continue;
|
|
151
|
+
const item = value;
|
|
152
|
+
const override = {};
|
|
153
|
+
const name = cleanOptionalText(item.name);
|
|
154
|
+
const description = cleanOptionalText(item.description);
|
|
155
|
+
const sourcePrompt = cleanOptionalText(item.sourcePrompt);
|
|
156
|
+
const updatedAt = cleanOptionalText(item.updatedAt);
|
|
157
|
+
const updatedBy = cleanOptionalText(item.updatedBy);
|
|
158
|
+
if (name)
|
|
159
|
+
override.name = name;
|
|
160
|
+
if (description)
|
|
161
|
+
override.description = description;
|
|
162
|
+
if (item.generated === true)
|
|
163
|
+
override.generated = true;
|
|
164
|
+
if (sourcePrompt)
|
|
165
|
+
override.sourcePrompt = sourcePrompt;
|
|
166
|
+
if (updatedAt)
|
|
167
|
+
override.updatedAt = updatedAt;
|
|
168
|
+
if (updatedBy)
|
|
169
|
+
override.updatedBy = updatedBy;
|
|
170
|
+
if (Object.keys(override).length > 0)
|
|
171
|
+
apps[id.trim()] = override;
|
|
172
|
+
}
|
|
173
|
+
return { apps };
|
|
174
|
+
}
|
|
175
|
+
async function readWorkspaceAppMetadataSettings() {
|
|
176
|
+
const raw = await getSetting(workspaceAppMetadataSettingsKey()).catch(() => null);
|
|
177
|
+
return parseWorkspaceAppMetadataSettings(raw);
|
|
178
|
+
}
|
|
179
|
+
async function writeWorkspaceAppMetadataOverride(input) {
|
|
180
|
+
const key = workspaceAppMetadataSettingsKey();
|
|
181
|
+
const current = parseWorkspaceAppMetadataSettings(await getSetting(key).catch(() => null));
|
|
182
|
+
const appId = input.appId.trim();
|
|
183
|
+
const existing = current.apps[appId] ?? {};
|
|
184
|
+
const next = {
|
|
185
|
+
...existing,
|
|
186
|
+
updatedAt: new Date().toISOString(),
|
|
187
|
+
};
|
|
188
|
+
const name = cleanOptionalText(input.name);
|
|
189
|
+
const description = cleanOptionalText(input.description);
|
|
190
|
+
const sourcePrompt = cleanOptionalText(input.sourcePrompt);
|
|
191
|
+
const updatedBy = cleanOptionalText(input.updatedBy);
|
|
192
|
+
if (name)
|
|
193
|
+
next.name = name;
|
|
194
|
+
else
|
|
195
|
+
delete next.name;
|
|
196
|
+
if (description)
|
|
197
|
+
next.description = description;
|
|
198
|
+
else
|
|
199
|
+
delete next.description;
|
|
200
|
+
if (input.generated === true)
|
|
201
|
+
next.generated = true;
|
|
202
|
+
else if (input.generated === false)
|
|
203
|
+
delete next.generated;
|
|
204
|
+
if (sourcePrompt)
|
|
205
|
+
next.sourcePrompt = sourcePrompt;
|
|
206
|
+
if (updatedBy)
|
|
207
|
+
next.updatedBy = updatedBy;
|
|
208
|
+
current.apps[appId] = next;
|
|
209
|
+
await putSetting(key, { apps: current.apps });
|
|
210
|
+
return current;
|
|
211
|
+
}
|
|
212
|
+
function applyWorkspaceAppMetadataOverride(app, settings) {
|
|
213
|
+
const override = settings.apps[app.id];
|
|
214
|
+
if (!override)
|
|
215
|
+
return app;
|
|
216
|
+
const name = cleanOptionalText(override.name);
|
|
217
|
+
const description = cleanOptionalText(override.description);
|
|
218
|
+
const generated = override.generated === true;
|
|
219
|
+
const shouldApplyName = !!name && !generated;
|
|
220
|
+
const shouldApplyDescription = !!description && (!generated || !cleanOptionalText(app.description));
|
|
221
|
+
if (!shouldApplyName && !shouldApplyDescription)
|
|
222
|
+
return app;
|
|
223
|
+
return {
|
|
224
|
+
...app,
|
|
225
|
+
...(shouldApplyName ? { name } : {}),
|
|
226
|
+
...(shouldApplyDescription ? { description } : {}),
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
function workspaceAppUrl(appPath) {
|
|
230
|
+
const base = process.env.WORKSPACE_GATEWAY_URL ||
|
|
231
|
+
process.env.APP_URL ||
|
|
232
|
+
process.env.URL ||
|
|
233
|
+
process.env.DEPLOY_URL ||
|
|
234
|
+
process.env.BETTER_AUTH_URL ||
|
|
235
|
+
null;
|
|
236
|
+
if (!base)
|
|
237
|
+
return null;
|
|
238
|
+
try {
|
|
239
|
+
return new URL(appPath, `${base.replace(/\/$/, "")}/`).toString();
|
|
240
|
+
}
|
|
241
|
+
catch {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function workspaceAppLink(appPath, explicitUrl) {
|
|
246
|
+
const urlValue = typeof explicitUrl === "string" ? explicitUrl.trim() : "";
|
|
247
|
+
if (!urlValue)
|
|
248
|
+
return workspaceAppUrl(appPath);
|
|
249
|
+
if (urlValue.startsWith("/"))
|
|
250
|
+
return workspaceAppUrl(urlValue) ?? urlValue;
|
|
251
|
+
try {
|
|
252
|
+
return new URL(urlValue).toString();
|
|
253
|
+
}
|
|
254
|
+
catch {
|
|
255
|
+
return urlValue;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
function normalizeWorkspaceAppAudience(value) {
|
|
259
|
+
return value === "public" ? "public" : DEFAULT_WORKSPACE_APP_AUDIENCE;
|
|
260
|
+
}
|
|
261
|
+
function normalizeWorkspaceAppPathList(value) {
|
|
262
|
+
let rawPaths = [];
|
|
263
|
+
if (Array.isArray(value)) {
|
|
264
|
+
rawPaths = value;
|
|
265
|
+
}
|
|
266
|
+
else if (typeof value === "string") {
|
|
267
|
+
const trimmed = value.trim();
|
|
268
|
+
if (!trimmed)
|
|
269
|
+
return [];
|
|
270
|
+
try {
|
|
271
|
+
const parsed = JSON.parse(trimmed);
|
|
272
|
+
rawPaths = Array.isArray(parsed) ? parsed : [trimmed];
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
rawPaths = trimmed.split(",");
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
const paths = rawPaths
|
|
279
|
+
.map((entry) => (typeof entry === "string" ? entry.trim() : ""))
|
|
280
|
+
.filter((entry) => entry.startsWith("/"))
|
|
281
|
+
.map((entry) => entry.length > 1 && entry.endsWith("/") ? entry.slice(0, -1) : entry);
|
|
282
|
+
return Array.from(new Set(paths));
|
|
283
|
+
}
|
|
284
|
+
function workspaceAppAudienceFromPackageJson(pkg) {
|
|
285
|
+
if (!pkg || typeof pkg !== "object" || Array.isArray(pkg))
|
|
286
|
+
return undefined;
|
|
287
|
+
const record = pkg;
|
|
288
|
+
const config = record["agent-native"] ?? record.agentNative;
|
|
289
|
+
const nested = config && typeof config === "object" && !Array.isArray(config)
|
|
290
|
+
? config
|
|
291
|
+
: {};
|
|
292
|
+
const raw = nested.workspaceApp?.audience ??
|
|
293
|
+
nested.workspace?.audience ??
|
|
294
|
+
nested.audience ??
|
|
295
|
+
record.workspaceAppAudience;
|
|
296
|
+
if (raw === undefined)
|
|
297
|
+
return undefined;
|
|
298
|
+
return normalizeWorkspaceAppAudience(raw);
|
|
299
|
+
}
|
|
300
|
+
function workspaceAppRouteAccessFromPackageJson(pkg) {
|
|
301
|
+
if (!pkg || typeof pkg !== "object" || Array.isArray(pkg)) {
|
|
302
|
+
return { publicPaths: [], protectedPaths: [] };
|
|
303
|
+
}
|
|
304
|
+
const record = pkg;
|
|
305
|
+
const config = record["agent-native"] ?? record.agentNative;
|
|
306
|
+
const nested = config && typeof config === "object" && !Array.isArray(config)
|
|
307
|
+
? config
|
|
308
|
+
: {};
|
|
309
|
+
return {
|
|
310
|
+
publicPaths: normalizeWorkspaceAppPathList(nested.workspaceApp?.publicPaths ??
|
|
311
|
+
nested.workspaceApp?.publicPagePaths ??
|
|
312
|
+
nested.workspace?.publicPaths ??
|
|
313
|
+
nested.publicPaths ??
|
|
314
|
+
record.workspaceAppPublicPaths),
|
|
315
|
+
protectedPaths: normalizeWorkspaceAppPathList(nested.workspaceApp?.protectedPaths ??
|
|
316
|
+
nested.workspaceApp?.privatePaths ??
|
|
317
|
+
nested.workspaceApp?.authRequiredPaths ??
|
|
318
|
+
nested.workspace?.protectedPaths ??
|
|
319
|
+
nested.protectedPaths ??
|
|
320
|
+
record.workspaceAppProtectedPaths),
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
function parseWorkspaceAppsManifest(parsed) {
|
|
324
|
+
const rawApps = Array.isArray(parsed?.apps)
|
|
325
|
+
? parsed.apps
|
|
326
|
+
: Array.isArray(parsed)
|
|
327
|
+
? parsed
|
|
328
|
+
: null;
|
|
329
|
+
if (!rawApps)
|
|
330
|
+
return null;
|
|
331
|
+
const apps = rawApps
|
|
332
|
+
.map((entry) => {
|
|
333
|
+
if (!entry || typeof entry !== "object")
|
|
334
|
+
return null;
|
|
335
|
+
const id = typeof entry.id === "string" ? entry.id.trim() : "";
|
|
336
|
+
const pathValue = typeof entry.path === "string" ? entry.path.trim() : "";
|
|
337
|
+
if (!id || !pathValue.startsWith("/"))
|
|
338
|
+
return null;
|
|
339
|
+
return {
|
|
340
|
+
id,
|
|
341
|
+
name: typeof entry.name === "string" && entry.name.trim()
|
|
342
|
+
? entry.name.trim()
|
|
343
|
+
: titleCase(id),
|
|
344
|
+
description: typeof entry.description === "string" ? entry.description : "",
|
|
345
|
+
path: pathValue,
|
|
346
|
+
url: workspaceAppLink(pathValue, entry.url),
|
|
347
|
+
isDispatch: typeof entry.isDispatch === "boolean"
|
|
348
|
+
? entry.isDispatch
|
|
349
|
+
: id === "dispatch",
|
|
350
|
+
audience: entry.audience === undefined
|
|
351
|
+
? DEFAULT_WORKSPACE_APP_AUDIENCE
|
|
352
|
+
: normalizeWorkspaceAppAudience(entry.audience),
|
|
353
|
+
publicPaths: normalizeWorkspaceAppPathList(entry.publicPaths),
|
|
354
|
+
protectedPaths: normalizeWorkspaceAppPathList(entry.protectedPaths),
|
|
355
|
+
status: "ready",
|
|
356
|
+
};
|
|
357
|
+
})
|
|
358
|
+
.filter((app) => app !== null)
|
|
359
|
+
.sort(sortWorkspaceApps);
|
|
360
|
+
return apps.length ? apps : null;
|
|
361
|
+
}
|
|
362
|
+
function parseDateMs(value) {
|
|
363
|
+
if (!value)
|
|
364
|
+
return null;
|
|
365
|
+
const ms = Date.parse(value);
|
|
366
|
+
return Number.isFinite(ms) ? ms : null;
|
|
367
|
+
}
|
|
368
|
+
function pendingWorkspaceAppExpiresAt(createdAt) {
|
|
369
|
+
const createdMs = parseDateMs(createdAt) ?? Date.now();
|
|
370
|
+
return new Date(createdMs + PENDING_WORKSPACE_APP_TTL_MS).toISOString();
|
|
371
|
+
}
|
|
372
|
+
function isPendingWorkspaceAppExpired(app) {
|
|
373
|
+
const expiresMs = parseDateMs(app.expiresAt) ??
|
|
374
|
+
(parseDateMs(app.createdAt) ?? Date.now()) + PENDING_WORKSPACE_APP_TTL_MS;
|
|
375
|
+
return expiresMs <= Date.now();
|
|
376
|
+
}
|
|
377
|
+
function pendingWorkspaceAppMatchesCurrentContext(app) {
|
|
378
|
+
if (isPendingWorkspaceAppExpired(app))
|
|
379
|
+
return false;
|
|
380
|
+
const currentContext = pendingWorkspaceAppContext();
|
|
381
|
+
if (!app.contextId)
|
|
382
|
+
return true;
|
|
383
|
+
return app.contextId === currentContext?.id;
|
|
384
|
+
}
|
|
385
|
+
function pendingWorkspaceAppContextRank(app) {
|
|
386
|
+
const currentContext = pendingWorkspaceAppContext();
|
|
387
|
+
if (app.contextId && app.contextId === currentContext?.id)
|
|
388
|
+
return 2;
|
|
389
|
+
if (!app.contextId)
|
|
390
|
+
return 1;
|
|
391
|
+
return 0;
|
|
392
|
+
}
|
|
393
|
+
function dedupePendingWorkspaceAppsForCurrentContext(apps) {
|
|
394
|
+
const byId = new Map();
|
|
395
|
+
for (const app of apps) {
|
|
396
|
+
const existing = byId.get(app.id);
|
|
397
|
+
if (!existing ||
|
|
398
|
+
pendingWorkspaceAppContextRank(app) >
|
|
399
|
+
pendingWorkspaceAppContextRank(existing)) {
|
|
400
|
+
byId.set(app.id, app);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return Array.from(byId.values());
|
|
404
|
+
}
|
|
405
|
+
function sortWorkspaceApps(a, b) {
|
|
406
|
+
if (a.id === "dispatch")
|
|
407
|
+
return -1;
|
|
408
|
+
if (b.id === "dispatch")
|
|
409
|
+
return 1;
|
|
410
|
+
if (a.status === "pending" && b.status !== "pending")
|
|
411
|
+
return 1;
|
|
412
|
+
if (a.status !== "pending" && b.status === "pending")
|
|
413
|
+
return -1;
|
|
414
|
+
return a.name.localeCompare(b.name);
|
|
415
|
+
}
|
|
416
|
+
function parsePendingWorkspaceApps(value) {
|
|
417
|
+
if (!Array.isArray(value))
|
|
418
|
+
return [];
|
|
419
|
+
return value
|
|
420
|
+
.map((entry) => {
|
|
421
|
+
if (!entry || typeof entry !== "object")
|
|
422
|
+
return null;
|
|
423
|
+
const record = entry;
|
|
424
|
+
const id = typeof record.id === "string" ? record.id.trim() : "";
|
|
425
|
+
const pathValue = typeof record.path === "string" ? record.path.trim() : "";
|
|
426
|
+
if (!id || !pathValue.startsWith("/"))
|
|
427
|
+
return null;
|
|
428
|
+
const now = new Date().toISOString();
|
|
429
|
+
const createdAt = cleanOptionalString(record.createdAt) ?? now;
|
|
430
|
+
return {
|
|
431
|
+
id,
|
|
432
|
+
name: typeof record.name === "string" && record.name.trim()
|
|
433
|
+
? record.name.trim()
|
|
434
|
+
: titleCase(id),
|
|
435
|
+
description: typeof record.description === "string"
|
|
436
|
+
? record.description
|
|
437
|
+
: "Builder is creating this app. The workspace path becomes live after the branch is merged and deployed.",
|
|
438
|
+
path: pathValue,
|
|
439
|
+
builderUrl: typeof record.builderUrl === "string" && record.builderUrl.trim()
|
|
440
|
+
? record.builderUrl.trim()
|
|
441
|
+
: null,
|
|
442
|
+
branchName: typeof record.branchName === "string" && record.branchName.trim()
|
|
443
|
+
? record.branchName.trim()
|
|
444
|
+
: null,
|
|
445
|
+
projectId: typeof record.projectId === "string" && record.projectId.trim()
|
|
446
|
+
? record.projectId.trim()
|
|
447
|
+
: null,
|
|
448
|
+
contextId: cleanOptionalString(record.contextId),
|
|
449
|
+
contextLabel: cleanOptionalString(record.contextLabel),
|
|
450
|
+
...(record.audience === undefined
|
|
451
|
+
? {}
|
|
452
|
+
: { audience: normalizeWorkspaceAppAudience(record.audience) }),
|
|
453
|
+
createdAt,
|
|
454
|
+
updatedAt: typeof record.updatedAt === "string" && record.updatedAt.trim()
|
|
455
|
+
? record.updatedAt.trim()
|
|
456
|
+
: now,
|
|
457
|
+
expiresAt: cleanOptionalString(record.expiresAt) ??
|
|
458
|
+
pendingWorkspaceAppExpiresAt(createdAt),
|
|
459
|
+
};
|
|
460
|
+
})
|
|
461
|
+
.filter((app) => !!app)
|
|
462
|
+
.slice(0, MAX_PENDING_APPS);
|
|
463
|
+
}
|
|
464
|
+
async function listPendingWorkspaceApps() {
|
|
465
|
+
const raw = await readSettingsRecord();
|
|
466
|
+
return parsePendingWorkspaceApps(raw.pendingApps);
|
|
467
|
+
}
|
|
468
|
+
function parseArchivedAppIds(value) {
|
|
469
|
+
if (!Array.isArray(value))
|
|
470
|
+
return [];
|
|
471
|
+
const ids = value
|
|
472
|
+
.map((entry) => (typeof entry === "string" ? entry.trim() : ""))
|
|
473
|
+
.filter(Boolean);
|
|
474
|
+
return Array.from(new Set(ids));
|
|
475
|
+
}
|
|
476
|
+
async function listArchivedAppIds() {
|
|
477
|
+
const raw = await readSettingsRecord();
|
|
478
|
+
return parseArchivedAppIds(raw.archivedAppIds);
|
|
479
|
+
}
|
|
480
|
+
export async function archiveWorkspaceApp(input) {
|
|
481
|
+
const appId = input.appId.trim();
|
|
482
|
+
if (!appId)
|
|
483
|
+
throw new Error("appId is required");
|
|
484
|
+
const raw = await readSettingsRecord();
|
|
485
|
+
const current = parseArchivedAppIds(raw.archivedAppIds);
|
|
486
|
+
if (!current.includes(appId))
|
|
487
|
+
current.push(appId);
|
|
488
|
+
await putSetting(scopedSettingsKey(), { ...raw, archivedAppIds: current });
|
|
489
|
+
await recordAudit({
|
|
490
|
+
action: "workspace-app.archived",
|
|
491
|
+
targetType: "workspace-app",
|
|
492
|
+
targetId: appId,
|
|
493
|
+
summary: "Hid workspace app from the Apps list",
|
|
494
|
+
});
|
|
495
|
+
return { archivedAppIds: current };
|
|
496
|
+
}
|
|
497
|
+
export async function unarchiveWorkspaceApp(input) {
|
|
498
|
+
const appId = input.appId.trim();
|
|
499
|
+
if (!appId)
|
|
500
|
+
throw new Error("appId is required");
|
|
501
|
+
const raw = await readSettingsRecord();
|
|
502
|
+
const current = parseArchivedAppIds(raw.archivedAppIds).filter((id) => id !== appId);
|
|
503
|
+
await putSetting(scopedSettingsKey(), { ...raw, archivedAppIds: current });
|
|
504
|
+
await recordAudit({
|
|
505
|
+
action: "workspace-app.unarchived",
|
|
506
|
+
targetType: "workspace-app",
|
|
507
|
+
targetId: appId,
|
|
508
|
+
summary: "Restored workspace app to the Apps list",
|
|
509
|
+
});
|
|
510
|
+
return { archivedAppIds: current };
|
|
511
|
+
}
|
|
512
|
+
export async function removePendingWorkspaceApp(input) {
|
|
513
|
+
const appId = input.appId.trim();
|
|
514
|
+
if (!appId)
|
|
515
|
+
throw new Error("appId is required");
|
|
516
|
+
const raw = await readSettingsRecord();
|
|
517
|
+
const pending = parsePendingWorkspaceApps(raw.pendingApps);
|
|
518
|
+
const next = pending.filter((app) => app.id !== appId || !pendingWorkspaceAppMatchesCurrentContext(app));
|
|
519
|
+
const removed = next.length !== pending.length;
|
|
520
|
+
if (!removed)
|
|
521
|
+
return { removed: false };
|
|
522
|
+
await putSetting(scopedSettingsKey(), { ...raw, pendingApps: next });
|
|
523
|
+
await recordAudit({
|
|
524
|
+
action: "workspace-app.pending-removed",
|
|
525
|
+
targetType: "workspace-app",
|
|
526
|
+
targetId: appId,
|
|
527
|
+
summary: "Removed pending Builder app from the Apps list",
|
|
528
|
+
});
|
|
529
|
+
return { removed: true };
|
|
530
|
+
}
|
|
531
|
+
function pendingAppToSummary(app) {
|
|
532
|
+
return {
|
|
533
|
+
id: app.id,
|
|
534
|
+
name: app.name,
|
|
535
|
+
description: app.description,
|
|
536
|
+
path: app.path,
|
|
537
|
+
url: app.builderUrl,
|
|
538
|
+
isDispatch: false,
|
|
539
|
+
audience: app.audience ?? DEFAULT_WORKSPACE_APP_AUDIENCE,
|
|
540
|
+
publicPaths: [],
|
|
541
|
+
protectedPaths: [],
|
|
542
|
+
status: "pending",
|
|
543
|
+
statusLabel: "Pending Builder branch",
|
|
544
|
+
builderUrl: app.builderUrl,
|
|
545
|
+
branchName: app.branchName,
|
|
546
|
+
createdAt: app.createdAt,
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
async function appendPendingWorkspaceApps(apps) {
|
|
550
|
+
const readyIds = new Set(apps.map((app) => app.id));
|
|
551
|
+
const pendingApps = dedupePendingWorkspaceAppsForCurrentContext((await listPendingWorkspaceApps())
|
|
552
|
+
.filter(pendingWorkspaceAppMatchesCurrentContext)
|
|
553
|
+
.filter((app) => !readyIds.has(app.id))).map(pendingAppToSummary);
|
|
554
|
+
return [...apps, ...pendingApps].sort(sortWorkspaceApps);
|
|
555
|
+
}
|
|
556
|
+
function agentCardUrlForApp(appUrl) {
|
|
557
|
+
if (!appUrl)
|
|
558
|
+
return null;
|
|
559
|
+
const trimmed = appUrl.replace(/\/+$/, "");
|
|
560
|
+
if (!trimmed)
|
|
561
|
+
return null;
|
|
562
|
+
try {
|
|
563
|
+
return new URL(`${trimmed}${AGENT_CARD_PATH}`).toString();
|
|
564
|
+
}
|
|
565
|
+
catch {
|
|
566
|
+
return `${trimmed}${AGENT_CARD_PATH}`;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
function stringField(record, key) {
|
|
570
|
+
const value = record[key];
|
|
571
|
+
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
572
|
+
}
|
|
573
|
+
function numberOfSkills(card) {
|
|
574
|
+
return Array.isArray(card.skills) ? card.skills.length : null;
|
|
575
|
+
}
|
|
576
|
+
async function fetchAgentCardMetadata(app) {
|
|
577
|
+
const agentCardUrl = agentCardUrlForApp(app.url);
|
|
578
|
+
if (!agentCardUrl) {
|
|
579
|
+
return {
|
|
580
|
+
agentCardUrl: null,
|
|
581
|
+
agentCardReachable: false,
|
|
582
|
+
a2aEndpointUrl: null,
|
|
583
|
+
agentName: null,
|
|
584
|
+
agentSkillsCount: null,
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
const controller = new AbortController();
|
|
588
|
+
const timeout = setTimeout(() => controller.abort(), AGENT_CARD_FETCH_TIMEOUT_MS);
|
|
589
|
+
try {
|
|
590
|
+
const response = await fetch(agentCardUrl, {
|
|
591
|
+
headers: { accept: "application/json" },
|
|
592
|
+
signal: controller.signal,
|
|
593
|
+
});
|
|
594
|
+
if (!response.ok) {
|
|
595
|
+
return {
|
|
596
|
+
agentCardUrl,
|
|
597
|
+
agentCardReachable: false,
|
|
598
|
+
a2aEndpointUrl: null,
|
|
599
|
+
agentName: null,
|
|
600
|
+
agentSkillsCount: null,
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
const parsed = await response.json().catch(() => null);
|
|
604
|
+
const card = parsed && typeof parsed === "object" && !Array.isArray(parsed)
|
|
605
|
+
? parsed
|
|
606
|
+
: null;
|
|
607
|
+
if (!card) {
|
|
608
|
+
return {
|
|
609
|
+
agentCardUrl,
|
|
610
|
+
agentCardReachable: false,
|
|
611
|
+
a2aEndpointUrl: null,
|
|
612
|
+
agentName: null,
|
|
613
|
+
agentSkillsCount: null,
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
return {
|
|
617
|
+
agentCardUrl,
|
|
618
|
+
agentCardReachable: true,
|
|
619
|
+
a2aEndpointUrl: stringField(card, "url") ?? stringField(card, "endpointUrl"),
|
|
620
|
+
agentName: stringField(card, "name"),
|
|
621
|
+
agentSkillsCount: numberOfSkills(card),
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
catch {
|
|
625
|
+
return {
|
|
626
|
+
agentCardUrl,
|
|
627
|
+
agentCardReachable: false,
|
|
628
|
+
a2aEndpointUrl: null,
|
|
629
|
+
agentName: null,
|
|
630
|
+
agentSkillsCount: null,
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
finally {
|
|
634
|
+
clearTimeout(timeout);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
async function maybeIncludeAgentCards(apps, options) {
|
|
638
|
+
if (!options.includeAgentCards)
|
|
639
|
+
return apps;
|
|
640
|
+
return Promise.all(apps.map(async (app) => {
|
|
641
|
+
if (app.status === "pending")
|
|
642
|
+
return app;
|
|
643
|
+
const metadata = await fetchAgentCardMetadata(app);
|
|
644
|
+
return { ...app, ...metadata };
|
|
645
|
+
}));
|
|
646
|
+
}
|
|
647
|
+
async function recordPendingWorkspaceApp(input) {
|
|
648
|
+
const now = new Date().toISOString();
|
|
649
|
+
const context = pendingWorkspaceAppContext();
|
|
650
|
+
const raw = await readSettingsRecord();
|
|
651
|
+
const pendingApps = parsePendingWorkspaceApps(raw.pendingApps);
|
|
652
|
+
const contextId = context?.id ?? null;
|
|
653
|
+
const samePendingEntry = (app) => app.id === input.appId &&
|
|
654
|
+
(app.contextId === contextId || (!!contextId && !app.contextId));
|
|
655
|
+
const existing = pendingApps
|
|
656
|
+
.filter((app) => !isPendingWorkspaceAppExpired(app))
|
|
657
|
+
.find(samePendingEntry);
|
|
658
|
+
const next = {
|
|
659
|
+
id: input.appId,
|
|
660
|
+
name: titleCase(input.appId),
|
|
661
|
+
description: input.description ||
|
|
662
|
+
"Builder is creating this app. The workspace path becomes live after the branch is merged and deployed.",
|
|
663
|
+
path: `/${input.appId}`,
|
|
664
|
+
builderUrl: input.builderUrl?.trim() || null,
|
|
665
|
+
branchName: input.branchName?.trim() || null,
|
|
666
|
+
projectId: input.projectId,
|
|
667
|
+
contextId: context?.id ?? null,
|
|
668
|
+
contextLabel: context?.label ?? null,
|
|
669
|
+
createdAt: existing?.createdAt || now,
|
|
670
|
+
updatedAt: now,
|
|
671
|
+
expiresAt: pendingWorkspaceAppExpiresAt(existing?.createdAt || now),
|
|
672
|
+
};
|
|
673
|
+
await putSetting(scopedSettingsKey(), {
|
|
674
|
+
...raw,
|
|
675
|
+
pendingApps: [
|
|
676
|
+
next,
|
|
677
|
+
...pendingApps.filter((app) => !samePendingEntry(app)),
|
|
678
|
+
].slice(0, MAX_PENDING_APPS),
|
|
679
|
+
});
|
|
680
|
+
await writeWorkspaceAppMetadataOverride({
|
|
681
|
+
appId: input.appId,
|
|
682
|
+
description: input.description,
|
|
683
|
+
generated: true,
|
|
684
|
+
sourcePrompt: input.sourcePrompt,
|
|
685
|
+
updatedBy: currentOwnerEmail(),
|
|
686
|
+
});
|
|
687
|
+
await recordAudit({
|
|
688
|
+
action: "workspace-app.pending",
|
|
689
|
+
targetType: "workspace-app",
|
|
690
|
+
targetId: input.appId,
|
|
691
|
+
summary: "Started Builder branch for workspace app creation",
|
|
692
|
+
metadata: {
|
|
693
|
+
builderBranchUrlConfigured: !!next.builderUrl,
|
|
694
|
+
branchName: next.branchName,
|
|
695
|
+
projectIdConfigured: !!next.projectId,
|
|
696
|
+
contextLabel: next.contextLabel,
|
|
697
|
+
},
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
function readWorkspaceAppsFromEnv() {
|
|
701
|
+
const raw = process.env[WORKSPACE_APPS_ENV_KEY];
|
|
702
|
+
if (!raw)
|
|
703
|
+
return null;
|
|
704
|
+
try {
|
|
705
|
+
return parseWorkspaceAppsManifest(JSON.parse(raw));
|
|
706
|
+
}
|
|
707
|
+
catch {
|
|
708
|
+
return null;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
async function readWorkspaceAppsFromGateway() {
|
|
712
|
+
const base = process.env.WORKSPACE_GATEWAY_URL;
|
|
713
|
+
if (!base)
|
|
714
|
+
return null;
|
|
715
|
+
const controller = new AbortController();
|
|
716
|
+
const timeout = setTimeout(() => controller.abort(), WORKSPACE_APPS_GATEWAY_TIMEOUT_MS);
|
|
717
|
+
try {
|
|
718
|
+
const response = await fetch(new URL(WORKSPACE_APPS_GATEWAY_PATH, `${base.replace(/\/$/, "")}/`), {
|
|
719
|
+
headers: { accept: "application/json" },
|
|
720
|
+
signal: controller.signal,
|
|
721
|
+
});
|
|
722
|
+
if (!response.ok)
|
|
723
|
+
return null;
|
|
724
|
+
return parseWorkspaceAppsManifest(await response.json().catch(() => null));
|
|
725
|
+
}
|
|
726
|
+
catch {
|
|
727
|
+
return null;
|
|
728
|
+
}
|
|
729
|
+
finally {
|
|
730
|
+
clearTimeout(timeout);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
function workspaceAppsManifestCandidates() {
|
|
734
|
+
const candidates = [];
|
|
735
|
+
try {
|
|
736
|
+
candidates.push(path.join(process.cwd(), ".agent-native", WORKSPACE_APPS_MANIFEST_FILE), path.join(process.cwd(), WORKSPACE_APPS_MANIFEST_FILE));
|
|
737
|
+
}
|
|
738
|
+
catch {
|
|
739
|
+
// Some edge runtimes do not expose process.cwd().
|
|
740
|
+
}
|
|
741
|
+
try {
|
|
742
|
+
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
|
743
|
+
candidates.push(path.join(moduleDir, ".agent-native", WORKSPACE_APPS_MANIFEST_FILE), path.join(moduleDir, WORKSPACE_APPS_MANIFEST_FILE));
|
|
744
|
+
}
|
|
745
|
+
catch {
|
|
746
|
+
// Some edge runtimes expose non-file module URLs. The env manifest still
|
|
747
|
+
// works there, so skip file-relative candidates.
|
|
748
|
+
}
|
|
749
|
+
return candidates;
|
|
750
|
+
}
|
|
751
|
+
function readWorkspaceAppsFromManifestFile() {
|
|
752
|
+
for (const file of workspaceAppsManifestCandidates()) {
|
|
753
|
+
if (!fs.existsSync(file))
|
|
754
|
+
continue;
|
|
755
|
+
const apps = parseWorkspaceAppsManifest(readJson(file));
|
|
756
|
+
if (apps)
|
|
757
|
+
return apps;
|
|
758
|
+
}
|
|
759
|
+
return null;
|
|
760
|
+
}
|
|
761
|
+
function readWorkspaceAppsFromFilesystem(workspaceRoot) {
|
|
762
|
+
const appsDir = path.join(workspaceRoot, "apps");
|
|
763
|
+
if (!fs.existsSync(appsDir))
|
|
764
|
+
return null;
|
|
765
|
+
const apps = fs
|
|
766
|
+
.readdirSync(appsDir, { withFileTypes: true })
|
|
767
|
+
.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."))
|
|
768
|
+
.map((entry) => {
|
|
769
|
+
const appDir = path.join(appsDir, entry.name);
|
|
770
|
+
const pkg = readJson(path.join(appDir, "package.json"));
|
|
771
|
+
if (!pkg)
|
|
772
|
+
return null;
|
|
773
|
+
const routeAccess = workspaceAppRouteAccessFromPackageJson(pkg);
|
|
774
|
+
return {
|
|
775
|
+
id: entry.name,
|
|
776
|
+
name: pkg.displayName || titleCase(entry.name),
|
|
777
|
+
description: pkg.description || "",
|
|
778
|
+
path: `/${entry.name}`,
|
|
779
|
+
url: workspaceAppUrl(`/${entry.name}`),
|
|
780
|
+
isDispatch: entry.name === "dispatch",
|
|
781
|
+
audience: workspaceAppAudienceFromPackageJson(pkg) ??
|
|
782
|
+
DEFAULT_WORKSPACE_APP_AUDIENCE,
|
|
783
|
+
publicPaths: routeAccess.publicPaths,
|
|
784
|
+
protectedPaths: routeAccess.protectedPaths,
|
|
785
|
+
status: "ready",
|
|
786
|
+
};
|
|
787
|
+
})
|
|
788
|
+
.filter((app) => !!app)
|
|
789
|
+
.sort(sortWorkspaceApps);
|
|
790
|
+
return apps.length ? apps : null;
|
|
791
|
+
}
|
|
792
|
+
export function getEnvBuilderProjectId() {
|
|
793
|
+
return (process.env.DISPATCH_BUILDER_PROJECT_ID ||
|
|
794
|
+
process.env.BUILDER_BRANCH_PROJECT_ID ||
|
|
795
|
+
process.env.BUILDER_PROJECT_ID ||
|
|
796
|
+
null);
|
|
797
|
+
}
|
|
798
|
+
/**
|
|
799
|
+
* Read the workspace's identity from the workspace root's package.json. Used to
|
|
800
|
+
* surface "Workspace: <name>" in the Dispatch UI so first-time users can see
|
|
801
|
+
* the container their apps live inside (rather than only seeing app names like
|
|
802
|
+
* "starter" / "dispatch" with no parent context).
|
|
803
|
+
*/
|
|
804
|
+
export function getWorkspaceInfo() {
|
|
805
|
+
const rootPath = findWorkspaceRoot();
|
|
806
|
+
if (!rootPath) {
|
|
807
|
+
return { name: null, displayName: null, rootPath: null, appCount: 0 };
|
|
808
|
+
}
|
|
809
|
+
const pkg = readJson(path.join(rootPath, "package.json"));
|
|
810
|
+
const rawName = typeof pkg?.name === "string" ? pkg.name.trim() : "";
|
|
811
|
+
// Strip a leading "@scope/" if the workspace root happens to be scoped.
|
|
812
|
+
const name = rawName.replace(/^@[^/]+\//, "") || null;
|
|
813
|
+
// Honor an explicit `displayName` in the workspace package.json before
|
|
814
|
+
// falling back to a title-cased version of the slug. Users naming a
|
|
815
|
+
// workspace "On-Call Todo Manager" via `displayName` should see that
|
|
816
|
+
// exact label rather than `On Call Todo Manager`.
|
|
817
|
+
const rawDisplay = typeof pkg?.displayName === "string" ? pkg.displayName.trim() : "";
|
|
818
|
+
const displayName = rawDisplay || (name ? titleCase(name) : null);
|
|
819
|
+
let appCount = 0;
|
|
820
|
+
const appsDir = path.join(rootPath, "apps");
|
|
821
|
+
if (fs.existsSync(appsDir)) {
|
|
822
|
+
try {
|
|
823
|
+
appCount = fs
|
|
824
|
+
.readdirSync(appsDir, { withFileTypes: true })
|
|
825
|
+
.filter((entry) => entry.isDirectory()).length;
|
|
826
|
+
}
|
|
827
|
+
catch {
|
|
828
|
+
appCount = 0;
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
return {
|
|
832
|
+
name,
|
|
833
|
+
displayName,
|
|
834
|
+
rootPath,
|
|
835
|
+
appCount,
|
|
836
|
+
};
|
|
837
|
+
}
|
|
838
|
+
async function applyArchivedAndPending(apps, options) {
|
|
839
|
+
const [withPending, archivedIds, metadataSettings] = await Promise.all([
|
|
840
|
+
appendPendingWorkspaceApps(apps),
|
|
841
|
+
listArchivedAppIds(),
|
|
842
|
+
readWorkspaceAppMetadataSettings(),
|
|
843
|
+
]);
|
|
844
|
+
const archivedSet = new Set(archivedIds);
|
|
845
|
+
const annotated = withPending.map((app) => {
|
|
846
|
+
const withMetadata = applyWorkspaceAppMetadataOverride(app, metadataSettings);
|
|
847
|
+
return archivedSet.has(app.id)
|
|
848
|
+
? { ...withMetadata, archived: true }
|
|
849
|
+
: withMetadata;
|
|
850
|
+
});
|
|
851
|
+
return options.includeArchived
|
|
852
|
+
? filterAppsByAudience(annotated, options.audience)
|
|
853
|
+
: filterAppsByAudience(annotated.filter((app) => !app.archived), options.audience);
|
|
854
|
+
}
|
|
855
|
+
function filterAppsByAudience(apps, audience) {
|
|
856
|
+
if (!audience || audience === "all")
|
|
857
|
+
return apps;
|
|
858
|
+
return apps.filter((app) => (app.audience ?? DEFAULT_WORKSPACE_APP_AUDIENCE) ===
|
|
859
|
+
normalizeWorkspaceAppAudience(audience));
|
|
860
|
+
}
|
|
861
|
+
export async function updateWorkspaceAppMetadata(input) {
|
|
862
|
+
await assertCanManageAppCreationSettings();
|
|
863
|
+
const appId = input.appId.trim();
|
|
864
|
+
assertValidWorkspaceAppId(appId);
|
|
865
|
+
const apps = await listWorkspaceApps({
|
|
866
|
+
includeAgentCards: false,
|
|
867
|
+
includeArchived: true,
|
|
868
|
+
});
|
|
869
|
+
const app = apps.find((candidate) => candidate.id === appId);
|
|
870
|
+
if (!app)
|
|
871
|
+
throw new Error(`Workspace app "${appId}" was not found.`);
|
|
872
|
+
// Treat undefined/null as "field omitted, leave existing value alone"; an
|
|
873
|
+
// explicit empty string clears the override (the app reverts to its
|
|
874
|
+
// built-in name / no description). Without this, a partial update that
|
|
875
|
+
// only touches one field silently wipes the other.
|
|
876
|
+
const name = input.name == null ? app.name : input.name.trim();
|
|
877
|
+
const description = input.description == null
|
|
878
|
+
? (app.description ?? undefined)
|
|
879
|
+
: input.description.trim();
|
|
880
|
+
await writeWorkspaceAppMetadataOverride({
|
|
881
|
+
appId,
|
|
882
|
+
name,
|
|
883
|
+
description,
|
|
884
|
+
generated: false,
|
|
885
|
+
updatedBy: currentOwnerEmail(),
|
|
886
|
+
});
|
|
887
|
+
await recordAudit({
|
|
888
|
+
action: "workspace-app.metadata-updated",
|
|
889
|
+
targetType: "workspace-app",
|
|
890
|
+
targetId: appId,
|
|
891
|
+
summary: `Updated workspace app details for ${name}`,
|
|
892
|
+
metadata: {
|
|
893
|
+
name,
|
|
894
|
+
descriptionConfigured: !!description,
|
|
895
|
+
},
|
|
896
|
+
});
|
|
897
|
+
const updated = (await listWorkspaceApps({
|
|
898
|
+
includeAgentCards: false,
|
|
899
|
+
includeArchived: true,
|
|
900
|
+
})).find((candidate) => candidate.id === appId);
|
|
901
|
+
return updated ?? { ...app, name, description };
|
|
902
|
+
}
|
|
903
|
+
export async function listWorkspaceApps(options = {}) {
|
|
904
|
+
const gatewayApps = await readWorkspaceAppsFromGateway();
|
|
905
|
+
if (gatewayApps) {
|
|
906
|
+
return maybeIncludeAgentCards(await applyArchivedAndPending(gatewayApps, options), options);
|
|
907
|
+
}
|
|
908
|
+
const workspaceRoot = findWorkspaceRoot();
|
|
909
|
+
const localFilesystemApps = workspaceRoot && isLocalAppCreationRuntime()
|
|
910
|
+
? readWorkspaceAppsFromFilesystem(workspaceRoot)
|
|
911
|
+
: null;
|
|
912
|
+
if (localFilesystemApps) {
|
|
913
|
+
return maybeIncludeAgentCards(await applyArchivedAndPending(localFilesystemApps, options), options);
|
|
914
|
+
}
|
|
915
|
+
const manifestApps = readWorkspaceAppsFromEnv() ?? readWorkspaceAppsFromManifestFile();
|
|
916
|
+
if (manifestApps) {
|
|
917
|
+
return maybeIncludeAgentCards(await applyArchivedAndPending(manifestApps, options), options);
|
|
918
|
+
}
|
|
919
|
+
if (!workspaceRoot) {
|
|
920
|
+
return maybeIncludeAgentCards(await applyArchivedAndPending([
|
|
921
|
+
{
|
|
922
|
+
id: "dispatch",
|
|
923
|
+
name: "Dispatch",
|
|
924
|
+
description: "Workspace control plane",
|
|
925
|
+
path: "/dispatch",
|
|
926
|
+
url: workspaceAppUrl("/dispatch"),
|
|
927
|
+
isDispatch: true,
|
|
928
|
+
audience: DEFAULT_WORKSPACE_APP_AUDIENCE,
|
|
929
|
+
publicPaths: [],
|
|
930
|
+
protectedPaths: [],
|
|
931
|
+
status: "ready",
|
|
932
|
+
},
|
|
933
|
+
], options), options);
|
|
934
|
+
}
|
|
935
|
+
const apps = readWorkspaceAppsFromFilesystem(workspaceRoot) ?? [];
|
|
936
|
+
return maybeIncludeAgentCards(await applyArchivedAndPending(apps, options), options);
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* First-party templates the user can scaffold into this workspace via the
|
|
940
|
+
* Apps page tiles. Inlined here (rather than importing from
|
|
941
|
+
* `@agent-native/shared-app-config`) because the published `@agent-native/dispatch`
|
|
942
|
+
* package has no `workspace:*` runtime dependencies. Keep in sync with
|
|
943
|
+
* `packages/core/src/cli/templates-meta.ts`.
|
|
944
|
+
*/
|
|
945
|
+
const ADDABLE_TEMPLATES = [
|
|
946
|
+
{
|
|
947
|
+
name: "mail",
|
|
948
|
+
label: "Mail",
|
|
949
|
+
hint: "Email client with keyboard shortcuts and AI triage",
|
|
950
|
+
icon: "Mail",
|
|
951
|
+
color: "#3B82F6",
|
|
952
|
+
colorRgb: "59 130 246",
|
|
953
|
+
core: true,
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
name: "calendar",
|
|
957
|
+
label: "Calendar",
|
|
958
|
+
hint: "Manage events, sync, and public booking",
|
|
959
|
+
icon: "CalendarMonth",
|
|
960
|
+
color: "#8B5CF6",
|
|
961
|
+
colorRgb: "139 92 246",
|
|
962
|
+
core: true,
|
|
963
|
+
},
|
|
964
|
+
{
|
|
965
|
+
name: "content",
|
|
966
|
+
label: "Content",
|
|
967
|
+
hint: "Write and organize with agent assistance",
|
|
968
|
+
icon: "FileText",
|
|
969
|
+
color: "#10B981",
|
|
970
|
+
colorRgb: "16 185 129",
|
|
971
|
+
core: true,
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
name: "slides",
|
|
975
|
+
label: "Slides",
|
|
976
|
+
hint: "Generate and edit React presentations",
|
|
977
|
+
icon: "Presentation",
|
|
978
|
+
color: "#EC4899",
|
|
979
|
+
colorRgb: "236 72 153",
|
|
980
|
+
core: true,
|
|
981
|
+
},
|
|
982
|
+
{
|
|
983
|
+
name: "clips",
|
|
984
|
+
label: "Clips",
|
|
985
|
+
hint: "Screen recording, meeting notes, and voice dictation",
|
|
986
|
+
icon: "ScreenShare",
|
|
987
|
+
color: "#625DF5",
|
|
988
|
+
colorRgb: "98 93 245",
|
|
989
|
+
core: true,
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
name: "brain",
|
|
993
|
+
label: "Brain",
|
|
994
|
+
hint: "Cited company knowledge from Slack, meetings, transcripts, and decisions",
|
|
995
|
+
icon: "Brain",
|
|
996
|
+
color: "#8B5CF6",
|
|
997
|
+
colorRgb: "139 92 246",
|
|
998
|
+
core: true,
|
|
999
|
+
},
|
|
1000
|
+
{
|
|
1001
|
+
name: "assets",
|
|
1002
|
+
label: "Assets",
|
|
1003
|
+
hint: "Upload, organize, search, and generate on-brand images and videos",
|
|
1004
|
+
icon: "Photo",
|
|
1005
|
+
color: "#0F766E",
|
|
1006
|
+
colorRgb: "15 118 110",
|
|
1007
|
+
core: true,
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
name: "analytics",
|
|
1011
|
+
label: "Analytics",
|
|
1012
|
+
hint: "Connect data sources, prompt for charts",
|
|
1013
|
+
icon: "ChartBar",
|
|
1014
|
+
color: "#F59E0B",
|
|
1015
|
+
colorRgb: "245 158 11",
|
|
1016
|
+
core: true,
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
name: "forms",
|
|
1020
|
+
label: "Forms",
|
|
1021
|
+
hint: "Create, edit, and manage forms",
|
|
1022
|
+
icon: "ClipboardList",
|
|
1023
|
+
color: "#06B6D4",
|
|
1024
|
+
colorRgb: "6 182 212",
|
|
1025
|
+
core: true,
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
name: "contracts",
|
|
1029
|
+
label: "Contracts",
|
|
1030
|
+
hint: "Review assumptions, feedback, and proof for coding-agent work",
|
|
1031
|
+
icon: "Contract",
|
|
1032
|
+
color: "#4F46E5",
|
|
1033
|
+
colorRgb: "79 70 229",
|
|
1034
|
+
core: false,
|
|
1035
|
+
},
|
|
1036
|
+
{
|
|
1037
|
+
name: "design",
|
|
1038
|
+
label: "Design",
|
|
1039
|
+
hint: "Create and edit visual designs with agent assistance",
|
|
1040
|
+
icon: "Brush",
|
|
1041
|
+
color: "#F472B6",
|
|
1042
|
+
colorRgb: "244 114 182",
|
|
1043
|
+
core: true,
|
|
1044
|
+
},
|
|
1045
|
+
{
|
|
1046
|
+
name: "videos",
|
|
1047
|
+
label: "Video",
|
|
1048
|
+
hint: "Video editing with Remotion",
|
|
1049
|
+
icon: "Video",
|
|
1050
|
+
color: "#EF4444",
|
|
1051
|
+
colorRgb: "239 68 68",
|
|
1052
|
+
core: false,
|
|
1053
|
+
},
|
|
1054
|
+
];
|
|
1055
|
+
export async function listAvailableWorkspaceTemplates() {
|
|
1056
|
+
if (!isLocalAppCreationRuntime())
|
|
1057
|
+
return [];
|
|
1058
|
+
const installed = new Set((await listWorkspaceApps({ includeArchived: true })).map((app) => app.id));
|
|
1059
|
+
return ADDABLE_TEMPLATES.filter((tpl) => !installed.has(tpl.name));
|
|
1060
|
+
}
|
|
1061
|
+
const SCAFFOLD_TIMEOUT_MS = 90_000;
|
|
1062
|
+
export async function scaffoldWorkspaceAppFromTemplate(input) {
|
|
1063
|
+
if (!isLocalAppCreationRuntime()) {
|
|
1064
|
+
throw new Error("Scaffolding from Dispatch is only available in local development. " +
|
|
1065
|
+
"Use the Builder branch flow on a deployed workspace.");
|
|
1066
|
+
}
|
|
1067
|
+
const template = input.template.trim();
|
|
1068
|
+
if (!template)
|
|
1069
|
+
throw new Error("template is required");
|
|
1070
|
+
if (!ADDABLE_TEMPLATES.some((tpl) => tpl.name === template)) {
|
|
1071
|
+
throw new Error(`Unknown template "${template}".`);
|
|
1072
|
+
}
|
|
1073
|
+
const appId = (input.appId?.trim() || template).toLowerCase();
|
|
1074
|
+
assertValidWorkspaceAppId(appId);
|
|
1075
|
+
const workspaceRoot = findWorkspaceRoot();
|
|
1076
|
+
if (!workspaceRoot) {
|
|
1077
|
+
throw new Error("No agent-native workspace detected for scaffolding.");
|
|
1078
|
+
}
|
|
1079
|
+
const appDir = path.join(workspaceRoot, "apps", appId);
|
|
1080
|
+
if (fs.existsSync(appDir)) {
|
|
1081
|
+
throw new Error(`apps/${appId} already exists.`);
|
|
1082
|
+
}
|
|
1083
|
+
const output = await runScaffoldCli({
|
|
1084
|
+
cwd: workspaceRoot,
|
|
1085
|
+
args: ["add-app", appId, "--template", template],
|
|
1086
|
+
});
|
|
1087
|
+
await recordAudit({
|
|
1088
|
+
action: "workspace-app.scaffolded",
|
|
1089
|
+
targetType: "workspace-app",
|
|
1090
|
+
targetId: appId,
|
|
1091
|
+
summary: `Scaffolded apps/${appId} from ${template}`,
|
|
1092
|
+
metadata: { template },
|
|
1093
|
+
});
|
|
1094
|
+
return { appId, template, output };
|
|
1095
|
+
}
|
|
1096
|
+
function runScaffoldCli(input) {
|
|
1097
|
+
return new Promise((resolve, reject) => {
|
|
1098
|
+
const child = spawn("pnpm", ["exec", "agent-native", ...input.args], {
|
|
1099
|
+
cwd: input.cwd,
|
|
1100
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
1101
|
+
env: { ...process.env, CI: "1", FORCE_COLOR: "0" },
|
|
1102
|
+
});
|
|
1103
|
+
let stdout = "";
|
|
1104
|
+
let stderr = "";
|
|
1105
|
+
child.stdout?.on("data", (chunk) => {
|
|
1106
|
+
stdout += String(chunk);
|
|
1107
|
+
});
|
|
1108
|
+
child.stderr?.on("data", (chunk) => {
|
|
1109
|
+
stderr += String(chunk);
|
|
1110
|
+
});
|
|
1111
|
+
const timer = setTimeout(() => {
|
|
1112
|
+
child.kill("SIGTERM");
|
|
1113
|
+
reject(new Error(`Scaffold timed out after ${Math.round(SCAFFOLD_TIMEOUT_MS / 1000)}s`));
|
|
1114
|
+
}, SCAFFOLD_TIMEOUT_MS);
|
|
1115
|
+
timer.unref();
|
|
1116
|
+
child.on("error", (err) => {
|
|
1117
|
+
clearTimeout(timer);
|
|
1118
|
+
reject(err);
|
|
1119
|
+
});
|
|
1120
|
+
child.on("exit", (code) => {
|
|
1121
|
+
clearTimeout(timer);
|
|
1122
|
+
if (code === 0) {
|
|
1123
|
+
resolve([stdout, stderr].filter(Boolean).join("\n").trim());
|
|
1124
|
+
return;
|
|
1125
|
+
}
|
|
1126
|
+
const detail = (stderr || stdout || "").trim() || `exit code ${code}`;
|
|
1127
|
+
reject(new Error(`Scaffold failed: ${detail}`));
|
|
1128
|
+
});
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
export async function getAppCreationSettings() {
|
|
1132
|
+
const envBuilderProjectId = getEnvBuilderProjectId();
|
|
1133
|
+
const resolvedBuilderProjectId = await resolveBuilderBranchProjectId();
|
|
1134
|
+
const raw = await readSettingsRecord();
|
|
1135
|
+
const savedBuilderProjectId = typeof raw?.builderProjectId === "string" && raw.builderProjectId.trim()
|
|
1136
|
+
? raw.builderProjectId.trim()
|
|
1137
|
+
: null;
|
|
1138
|
+
const builderProjectId = envBuilderProjectId || savedBuilderProjectId;
|
|
1139
|
+
const enableBuilder = process.env.ENABLE_BUILDER === "true" || process.env.ENABLE_BUILDER === "1";
|
|
1140
|
+
const effectiveBuilderProjectId = builderProjectId ||
|
|
1141
|
+
resolvedBuilderProjectId ||
|
|
1142
|
+
(enableBuilder ? getBuilderBranchProjectId() : null);
|
|
1143
|
+
return {
|
|
1144
|
+
builderProjectId: effectiveBuilderProjectId,
|
|
1145
|
+
builderProjectIdSource: envBuilderProjectId
|
|
1146
|
+
? "env"
|
|
1147
|
+
: savedBuilderProjectId
|
|
1148
|
+
? "dispatch"
|
|
1149
|
+
: effectiveBuilderProjectId
|
|
1150
|
+
? "default"
|
|
1151
|
+
: "unset",
|
|
1152
|
+
envBuilderProjectId,
|
|
1153
|
+
savedBuilderProjectId,
|
|
1154
|
+
builderBranchingEnabled: !!effectiveBuilderProjectId,
|
|
1155
|
+
};
|
|
1156
|
+
}
|
|
1157
|
+
export async function setAppCreationSettings(input) {
|
|
1158
|
+
await assertCanManageAppCreationSettings();
|
|
1159
|
+
const builderProjectId = input.builderProjectId?.trim() || null;
|
|
1160
|
+
const raw = await readSettingsRecord();
|
|
1161
|
+
await putSetting(scopedSettingsKey(), { ...raw, builderProjectId });
|
|
1162
|
+
await recordAudit({
|
|
1163
|
+
action: "settings.updated",
|
|
1164
|
+
targetType: "dispatch-app-creation-settings",
|
|
1165
|
+
targetId: SETTINGS_KEY,
|
|
1166
|
+
summary: builderProjectId
|
|
1167
|
+
? "Updated default Builder project for app creation"
|
|
1168
|
+
: "Cleared default Builder project for app creation",
|
|
1169
|
+
metadata: { builderProjectIdConfigured: !!builderProjectId },
|
|
1170
|
+
});
|
|
1171
|
+
return getAppCreationSettings();
|
|
1172
|
+
}
|
|
1173
|
+
function slugify(value) {
|
|
1174
|
+
return value
|
|
1175
|
+
.toLowerCase()
|
|
1176
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
1177
|
+
.replace(/^-+|-+$/g, "")
|
|
1178
|
+
.replace(/^[^a-z]+/, "")
|
|
1179
|
+
.slice(0, 64);
|
|
1180
|
+
}
|
|
1181
|
+
function isLocalAppCreationRuntime() {
|
|
1182
|
+
if (process.env.NODE_ENV === "production")
|
|
1183
|
+
return false;
|
|
1184
|
+
if (process.env.NETLIFY ||
|
|
1185
|
+
process.env.VERCEL ||
|
|
1186
|
+
process.env.CF_PAGES ||
|
|
1187
|
+
process.env.DEPLOY_URL ||
|
|
1188
|
+
process.env.URL ||
|
|
1189
|
+
process.env.RENDER ||
|
|
1190
|
+
process.env.FLY_APP_NAME) {
|
|
1191
|
+
return false;
|
|
1192
|
+
}
|
|
1193
|
+
return true;
|
|
1194
|
+
}
|
|
1195
|
+
function isSyntheticIntegrationOwner(ownerEmail) {
|
|
1196
|
+
return (ownerEmail.startsWith("integration@") ||
|
|
1197
|
+
ownerEmail.endsWith("@integration.local"));
|
|
1198
|
+
}
|
|
1199
|
+
async function requestOwnerRole() {
|
|
1200
|
+
const orgId = currentOrgId();
|
|
1201
|
+
const ownerEmail = currentOwnerEmail();
|
|
1202
|
+
if (!orgId)
|
|
1203
|
+
return null;
|
|
1204
|
+
try {
|
|
1205
|
+
const { rows } = await getDbExec().execute({
|
|
1206
|
+
sql: `SELECT role FROM org_members WHERE org_id = ? AND LOWER(email) = ? LIMIT 1`,
|
|
1207
|
+
args: [orgId, ownerEmail.toLowerCase()],
|
|
1208
|
+
});
|
|
1209
|
+
const role = rows[0]?.role;
|
|
1210
|
+
return typeof role === "string" ? role : null;
|
|
1211
|
+
}
|
|
1212
|
+
catch {
|
|
1213
|
+
return null;
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
async function assertCanManageAppCreationSettings() {
|
|
1217
|
+
const orgId = currentOrgId();
|
|
1218
|
+
if (!orgId)
|
|
1219
|
+
return;
|
|
1220
|
+
const role = await requestOwnerRole();
|
|
1221
|
+
if (role !== "owner" && role !== "admin") {
|
|
1222
|
+
throw new Error("Only organization owners and admins can update app creation settings.");
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
async function isCurrentIntegrationExplicitlyLinked() {
|
|
1226
|
+
const incoming = getRequestContext()?.integration?.incoming;
|
|
1227
|
+
if (!incoming)
|
|
1228
|
+
return true;
|
|
1229
|
+
const externalUserId = identityKeyForIncoming(incoming);
|
|
1230
|
+
const linkedOwner = await resolveLinkedOwner(incoming.platform, externalUserId, {
|
|
1231
|
+
allowAnyOrgFallback: true,
|
|
1232
|
+
}).catch(() => null);
|
|
1233
|
+
return linkedOwner === currentOwnerEmail();
|
|
1234
|
+
}
|
|
1235
|
+
async function defaultOwnerAppCreationAllowed() {
|
|
1236
|
+
const defaultOwner = process.env.DISPATCH_DEFAULT_OWNER_EMAIL?.trim();
|
|
1237
|
+
if (!defaultOwner || defaultOwner !== currentOwnerEmail())
|
|
1238
|
+
return false;
|
|
1239
|
+
if (await isCurrentIntegrationExplicitlyLinked())
|
|
1240
|
+
return true;
|
|
1241
|
+
return (process.env.DISPATCH_ALLOW_DEFAULT_OWNER_APP_CREATION === "true" ||
|
|
1242
|
+
process.env.DISPATCH_ALLOW_DEFAULT_OWNER_APP_CREATION === "1" ||
|
|
1243
|
+
process.env.ENABLE_BUILDER === "true" ||
|
|
1244
|
+
process.env.ENABLE_BUILDER === "1");
|
|
1245
|
+
}
|
|
1246
|
+
function normalizeBuilderRunString(value, fieldName) {
|
|
1247
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
1248
|
+
throw new Error(`Builder app creation returned a blank ${fieldName}`);
|
|
1249
|
+
}
|
|
1250
|
+
const trimmed = value.trim();
|
|
1251
|
+
if (/[-]/.test(trimmed)) {
|
|
1252
|
+
throw new Error(`Builder app creation returned a malformed ${fieldName}`);
|
|
1253
|
+
}
|
|
1254
|
+
return trimmed;
|
|
1255
|
+
}
|
|
1256
|
+
function normalizeBuilderRunUrl(value) {
|
|
1257
|
+
const urlString = normalizeBuilderRunString(value, "url");
|
|
1258
|
+
let parsed;
|
|
1259
|
+
try {
|
|
1260
|
+
parsed = new URL(urlString);
|
|
1261
|
+
}
|
|
1262
|
+
catch {
|
|
1263
|
+
throw new Error("Builder app creation returned a malformed url");
|
|
1264
|
+
}
|
|
1265
|
+
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") {
|
|
1266
|
+
throw new Error("Builder app creation returned a malformed url");
|
|
1267
|
+
}
|
|
1268
|
+
if (parsed.hostname !== "builder.io" &&
|
|
1269
|
+
!parsed.hostname.endsWith(".builder.io")) {
|
|
1270
|
+
throw new Error("Builder app creation returned a non-Builder url");
|
|
1271
|
+
}
|
|
1272
|
+
return parsed.toString();
|
|
1273
|
+
}
|
|
1274
|
+
function normalizeBuilderRunResult(result) {
|
|
1275
|
+
const record = result && typeof result === "object" && !Array.isArray(result)
|
|
1276
|
+
? result
|
|
1277
|
+
: {};
|
|
1278
|
+
return {
|
|
1279
|
+
branchName: normalizeBuilderRunString(record.branchName, "branchName"),
|
|
1280
|
+
url: normalizeBuilderRunUrl(record.url),
|
|
1281
|
+
status: typeof record.status === "string" && record.status.trim()
|
|
1282
|
+
? record.status.trim()
|
|
1283
|
+
: "processing",
|
|
1284
|
+
};
|
|
1285
|
+
}
|
|
1286
|
+
async function remoteAppCreationAuthorization() {
|
|
1287
|
+
const ownerEmail = currentOwnerEmail();
|
|
1288
|
+
const isIntegrationCaller = isIntegrationCallerRequest();
|
|
1289
|
+
const defaultOwner = process.env.DISPATCH_DEFAULT_OWNER_EMAIL?.trim();
|
|
1290
|
+
if (isIntegrationCaller && defaultOwner && defaultOwner === ownerEmail) {
|
|
1291
|
+
if (await defaultOwnerAppCreationAllowed())
|
|
1292
|
+
return { ok: true };
|
|
1293
|
+
return {
|
|
1294
|
+
ok: false,
|
|
1295
|
+
message: "Messaging-triggered app creation is using the deployment default Dispatch owner. " +
|
|
1296
|
+
"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.",
|
|
1297
|
+
};
|
|
1298
|
+
}
|
|
1299
|
+
if (!isSyntheticIntegrationOwner(ownerEmail))
|
|
1300
|
+
return { ok: true };
|
|
1301
|
+
const source = isIntegrationCaller
|
|
1302
|
+
? "Messaging-triggered"
|
|
1303
|
+
: "Synthetic integration";
|
|
1304
|
+
return {
|
|
1305
|
+
ok: false,
|
|
1306
|
+
message: `${source} app creation needs a trusted Dispatch owner before Builder can start a branch. ` +
|
|
1307
|
+
"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.",
|
|
1308
|
+
};
|
|
1309
|
+
}
|
|
1310
|
+
function buildWorkspaceAppPrompt(input) {
|
|
1311
|
+
const appId = slugify(input.appId || "") ||
|
|
1312
|
+
slugify(input.prompt.replace(/\b(build|create|make|an?|the|app|tool)\b/gi, " ")) ||
|
|
1313
|
+
"new-app";
|
|
1314
|
+
const appDescription = input.description?.trim() ||
|
|
1315
|
+
generateWorkspaceAppDescription(input.prompt, appId);
|
|
1316
|
+
const selectedKeys = input.selectedKeys || [];
|
|
1317
|
+
const selectedResources = input.selectedResources || [];
|
|
1318
|
+
const resourceList = selectedResources.length
|
|
1319
|
+
? selectedResources
|
|
1320
|
+
.map((resource) => `- ${resource.name} (${resource.kind}, ${resource.path})`)
|
|
1321
|
+
.join("\n")
|
|
1322
|
+
: "none";
|
|
1323
|
+
return {
|
|
1324
|
+
appId,
|
|
1325
|
+
prompt: [
|
|
1326
|
+
"Create a new agent-native app in this workspace.",
|
|
1327
|
+
"",
|
|
1328
|
+
`App name: ${appId}`,
|
|
1329
|
+
`App description: ${appDescription}`,
|
|
1330
|
+
`Template to start from: ${input.template || "starter"}`,
|
|
1331
|
+
`User prompt: ${input.prompt.trim()}`,
|
|
1332
|
+
"If the user mentions a product or company such as Granola, Loom, Superhuman, Linear, or Notion, treat it as product inspiration unless they explicitly ask to connect to that service. Do not invent or require third-party API keys like GRANOLA_API_KEY just because a product is named.",
|
|
1333
|
+
selectedKeys.length
|
|
1334
|
+
? `Dispatch vault keys selected for this app: ${selectedKeys.join(", ")}`
|
|
1335
|
+
: "Dispatch vault keys selected for this app: none",
|
|
1336
|
+
`Dispatch workspace resources selected for this app:\n${resourceList}`,
|
|
1337
|
+
`Dispatch workspace resources with scope=all are global. After the app exists, sync workspace resources to appId "${appId}" so global skills, guardrail instructions, and reference resources reach the new app even when no per-app resources were selected.`,
|
|
1338
|
+
"",
|
|
1339
|
+
`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.`,
|
|
1340
|
+
`Important routing rule: from outside the app, link to /${appId}; inside apps/${appId}, React Router routes are app-local. Use <Link to="/review"> and navigate("/review"), not "/${appId}/review"; APP_BASE_PATH supplies the mounted prefix, and hardcoding it causes doubled URLs like /${appId}/${appId}/review.`,
|
|
1341
|
+
"Existing first-party apps are neighbors, not implementation details for this app. If the user prompt mentions Mail, Calendar, Analytics, Dispatch, or other templates, treat them as existing hosted/connected apps that this app can link to or call through A2A/default connected agents. For example, Mail, Calendar, and Analytics already exist at https://mail.jami.studio, https://calendar.jami.studio, and https://analytics.jami.studio.",
|
|
1342
|
+
`Do not clone first-party templates, create wrapper apps, or scaffold child apps/routes for Mail, Calendar, Analytics, etc. inside apps/${appId} just so this app can access them. If the request is a cross-app dashboard or overview, build only the new dashboard/overview app and delegate to the existing apps for domain work.`,
|
|
1343
|
+
"Only create another first-party app copy when the user explicitly asks for a customized fork/copy of that app; otherwise keep using the hosted/shared app so improvements to the base template keep flowing to users.",
|
|
1344
|
+
selectedKeys.length
|
|
1345
|
+
? `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.`
|
|
1346
|
+
: "Do not grant or request any Dispatch vault keys unless the user asks later.",
|
|
1347
|
+
selectedResources.length
|
|
1348
|
+
? `Dispatch will create workspace resource grants for the selected resources for appId "${appId}". After the app exists, sync workspace resources so the app receives both global and selected shared resources.`
|
|
1349
|
+
: "Do not grant any selected-only Dispatch workspace resources unless the user asks later.",
|
|
1350
|
+
"",
|
|
1351
|
+
"Agent-native rules (these are the framework's contract — not optional):",
|
|
1352
|
+
`- 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.`,
|
|
1353
|
+
`- 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 via useActionQuery / useActionMutation. If you must raw-fetch framework action endpoints, use agentNativePath("/_agent-native/actions/<name>") so mounted apps call the right URL. Don't add /api/* routes for CRUD.`,
|
|
1354
|
+
"- 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.",
|
|
1355
|
+
"- Use Tabler Icons (@tabler/icons-react) for every icon. Never use emojis as icons.",
|
|
1356
|
+
`- 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.`,
|
|
1357
|
+
"- 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.",
|
|
1358
|
+
"",
|
|
1359
|
+
"Branch readiness requirements before handing off:",
|
|
1360
|
+
"- 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.",
|
|
1361
|
+
`- Save a concise, human-readable app description in apps/${appId}/package.json "description" so Dispatch, A2A discovery, and connected agents can describe what this app does. Use the description above or improve it based on the prompt.`,
|
|
1362
|
+
"- 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.",
|
|
1363
|
+
"- Update pnpm-lock.yaml when adding or changing dependencies so Netlify can install the branch reliably.",
|
|
1364
|
+
"- 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.",
|
|
1365
|
+
"- Verify the app's agent card/A2A metadata is ready so Dispatch can discover and delegate to the app after deployment. Every sibling workspace app should be usable over A2A by default through call-agent.",
|
|
1366
|
+
"- Give the app agent context that sibling workspace apps are available over A2A with names and descriptions from the workspace app registry; do not hardcode a stale app list.",
|
|
1367
|
+
"- Include a final verification note covering the registry entry, manifest/deploy metadata, relative same-origin routing, and agent-card readiness.",
|
|
1368
|
+
`When it is ready, start or update the workspace dev server and navigate the user to /${appId}.`,
|
|
1369
|
+
].join("\n"),
|
|
1370
|
+
};
|
|
1371
|
+
}
|
|
1372
|
+
async function requestSelectedVaultKeys(input) {
|
|
1373
|
+
if (input.selectedKeys.length === 0)
|
|
1374
|
+
return;
|
|
1375
|
+
await Promise.allSettled(input.selectedKeys.map((credentialKey) => Promise.resolve().then(() => createRequest({
|
|
1376
|
+
appId: input.appId,
|
|
1377
|
+
credentialKey,
|
|
1378
|
+
reason: `Requested during workspace app creation for ${input.appId}.`,
|
|
1379
|
+
}))));
|
|
1380
|
+
}
|
|
1381
|
+
async function selectedWorkspaceResourcesForIds(resourceIds) {
|
|
1382
|
+
if (!resourceIds?.length)
|
|
1383
|
+
return [];
|
|
1384
|
+
const requested = new Set(resourceIds);
|
|
1385
|
+
const resources = await listWorkspaceResourceOptions();
|
|
1386
|
+
return resources.filter((resource) => requested.has(resource.id));
|
|
1387
|
+
}
|
|
1388
|
+
async function grantSelectedWorkspaceResources(input) {
|
|
1389
|
+
if (input.resourceIds.length === 0)
|
|
1390
|
+
return;
|
|
1391
|
+
await grantWorkspaceResourcesToApp(input);
|
|
1392
|
+
}
|
|
1393
|
+
export async function startWorkspaceAppCreation(input) {
|
|
1394
|
+
const initial = buildWorkspaceAppPrompt({
|
|
1395
|
+
prompt: input.prompt,
|
|
1396
|
+
appId: input.appId,
|
|
1397
|
+
description: input.description,
|
|
1398
|
+
template: input.template,
|
|
1399
|
+
});
|
|
1400
|
+
assertValidWorkspaceAppId(initial.appId);
|
|
1401
|
+
const isLocal = isLocalAppCreationRuntime();
|
|
1402
|
+
if (!isLocal) {
|
|
1403
|
+
const authorization = await remoteAppCreationAuthorization();
|
|
1404
|
+
if (authorization.ok === false) {
|
|
1405
|
+
return {
|
|
1406
|
+
mode: "builder-unavailable",
|
|
1407
|
+
appId: initial.appId,
|
|
1408
|
+
message: authorization.message,
|
|
1409
|
+
};
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
const selectedKeys = input.secretIds?.length
|
|
1413
|
+
? (await listSecrets())
|
|
1414
|
+
.filter((secret) => input.secretIds?.includes(secret.id))
|
|
1415
|
+
.map((secret) => secret.credentialKey)
|
|
1416
|
+
: [];
|
|
1417
|
+
const selectedResources = await selectedWorkspaceResourcesForIds(input.resourceIds);
|
|
1418
|
+
const built = buildWorkspaceAppPrompt({
|
|
1419
|
+
prompt: input.prompt,
|
|
1420
|
+
appId: input.appId,
|
|
1421
|
+
description: input.description,
|
|
1422
|
+
template: input.template,
|
|
1423
|
+
selectedKeys,
|
|
1424
|
+
selectedResources,
|
|
1425
|
+
});
|
|
1426
|
+
const prompt = built.prompt;
|
|
1427
|
+
const appDescription = input.description?.trim() ||
|
|
1428
|
+
generateWorkspaceAppDescription(input.prompt, built.appId);
|
|
1429
|
+
if (isLocal) {
|
|
1430
|
+
await requestSelectedVaultKeys({
|
|
1431
|
+
appId: built.appId,
|
|
1432
|
+
selectedKeys,
|
|
1433
|
+
});
|
|
1434
|
+
await grantSelectedWorkspaceResources({
|
|
1435
|
+
appId: built.appId,
|
|
1436
|
+
resourceIds: selectedResources.map((resource) => resource.id),
|
|
1437
|
+
});
|
|
1438
|
+
return {
|
|
1439
|
+
mode: "local-agent",
|
|
1440
|
+
appId: built.appId,
|
|
1441
|
+
prompt,
|
|
1442
|
+
message: "Use the local code agent to create this app in the workspace, then open it from /dispatch/apps.",
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1445
|
+
const settings = await getAppCreationSettings();
|
|
1446
|
+
if (!settings.builderProjectId) {
|
|
1447
|
+
return {
|
|
1448
|
+
mode: "coming-soon",
|
|
1449
|
+
appId: built.appId,
|
|
1450
|
+
message: "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.",
|
|
1451
|
+
};
|
|
1452
|
+
}
|
|
1453
|
+
let result;
|
|
1454
|
+
try {
|
|
1455
|
+
const builderCreds = await resolveBuilderCredentials().catch(() => null);
|
|
1456
|
+
const builderUserId = builderCreds?.userId || undefined;
|
|
1457
|
+
result = normalizeBuilderRunResult(await runBuilderAgent({
|
|
1458
|
+
prompt,
|
|
1459
|
+
projectId: settings.builderProjectId,
|
|
1460
|
+
...(builderUserId
|
|
1461
|
+
? { userId: builderUserId }
|
|
1462
|
+
: { userEmail: currentOwnerEmail() }),
|
|
1463
|
+
}));
|
|
1464
|
+
}
|
|
1465
|
+
catch (err) {
|
|
1466
|
+
const detail = err instanceof Error && err.message
|
|
1467
|
+
? err.message
|
|
1468
|
+
: "Builder could not start the app branch";
|
|
1469
|
+
return {
|
|
1470
|
+
mode: "builder-unavailable",
|
|
1471
|
+
appId: built.appId,
|
|
1472
|
+
projectId: settings.builderProjectId,
|
|
1473
|
+
message: `Builder app creation is configured for project ${settings.builderProjectId}, ` +
|
|
1474
|
+
`but it could not start yet: ${detail}. Connect Builder for this user, ` +
|
|
1475
|
+
`link the messaging identity to that user, or configure deployment-managed Builder credentials for this workspace.`,
|
|
1476
|
+
};
|
|
1477
|
+
}
|
|
1478
|
+
await recordPendingWorkspaceApp({
|
|
1479
|
+
appId: built.appId,
|
|
1480
|
+
projectId: settings.builderProjectId,
|
|
1481
|
+
description: appDescription,
|
|
1482
|
+
sourcePrompt: input.prompt,
|
|
1483
|
+
branchName: result.branchName,
|
|
1484
|
+
builderUrl: result.url,
|
|
1485
|
+
});
|
|
1486
|
+
await requestSelectedVaultKeys({
|
|
1487
|
+
appId: built.appId,
|
|
1488
|
+
selectedKeys,
|
|
1489
|
+
});
|
|
1490
|
+
await grantSelectedWorkspaceResources({
|
|
1491
|
+
appId: built.appId,
|
|
1492
|
+
resourceIds: selectedResources.map((resource) => resource.id),
|
|
1493
|
+
});
|
|
1494
|
+
return {
|
|
1495
|
+
mode: "builder",
|
|
1496
|
+
appId: built.appId,
|
|
1497
|
+
path: `/${built.appId}`,
|
|
1498
|
+
projectId: settings.builderProjectId,
|
|
1499
|
+
branchName: result.branchName,
|
|
1500
|
+
url: result.url,
|
|
1501
|
+
workspaceUrl: workspaceAppUrl(`/${built.appId}`),
|
|
1502
|
+
status: result.status,
|
|
1503
|
+
message: `Builder started a branch for /${built.appId}. Use the Builder branch URL to track creation now. ` +
|
|
1504
|
+
`The workspace path will be live after that branch is merged and the workspace deploy finishes, so it may 404 until then.`,
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1507
|
+
//# sourceMappingURL=app-creation-store.js.map
|