@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,1234 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
|
|
3
|
+
import { and, desc, eq, isNull, or } from "@agent-native/core/db/schema";
|
|
4
|
+
import { ssrfSafeFetch } from "@agent-native/core/extensions/url-safety";
|
|
5
|
+
import {
|
|
6
|
+
deleteAppSecret,
|
|
7
|
+
listAppSecretsForScope,
|
|
8
|
+
writeAppSecret,
|
|
9
|
+
type SecretScope,
|
|
10
|
+
} from "@agent-native/core/secrets";
|
|
11
|
+
import { discoverAgents } from "@agent-native/core/server/agent-discovery";
|
|
12
|
+
import {
|
|
13
|
+
getOrgSetting,
|
|
14
|
+
getUserSetting,
|
|
15
|
+
putOrgSetting,
|
|
16
|
+
putUserSetting,
|
|
17
|
+
} from "@agent-native/core/settings";
|
|
18
|
+
|
|
19
|
+
import { getDb, schema } from "../../db/index.js";
|
|
20
|
+
import {
|
|
21
|
+
currentOwnerEmail,
|
|
22
|
+
currentOrgId,
|
|
23
|
+
recordAudit,
|
|
24
|
+
} from "./dispatch-store.js";
|
|
25
|
+
|
|
26
|
+
const VAULT_ACCESS_SETTINGS_KEY = "dispatch-vault-access-settings";
|
|
27
|
+
const VAULT_SYNC_DESCRIPTION_PREFIX = "Synced from Dispatch vault:";
|
|
28
|
+
|
|
29
|
+
export type VaultAccessMode = "all-apps" | "manual";
|
|
30
|
+
|
|
31
|
+
export interface VaultAccessSettings {
|
|
32
|
+
mode: VaultAccessMode;
|
|
33
|
+
scope: "org" | "user";
|
|
34
|
+
scopeId: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Caller-supplied access context for vault operations.
|
|
39
|
+
*
|
|
40
|
+
* Every getSecret / updateSecret / deleteSecret / createGrant call must
|
|
41
|
+
* pass the ctx of the *current request* so the row is scoped to that
|
|
42
|
+
* caller's tenant. Looking up a vault secret by id alone is unsafe — UUIDs
|
|
43
|
+
* are not authorization. A row matches the ctx if either the caller owns
|
|
44
|
+
* it or it lives in the caller's active org.
|
|
45
|
+
*/
|
|
46
|
+
export interface VaultCtx {
|
|
47
|
+
ownerEmail: string;
|
|
48
|
+
orgId: string | null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Build a VaultCtx from the current request. Throws if the request is
|
|
53
|
+
* unauthenticated — the previous behavior of falling back to "local@localhost"
|
|
54
|
+
* leaked rows across tenants when a misconfigured environment skipped auth.
|
|
55
|
+
*/
|
|
56
|
+
export function requireVaultCtx(): VaultCtx {
|
|
57
|
+
const ownerEmail = currentOwnerEmail();
|
|
58
|
+
if (!ownerEmail) {
|
|
59
|
+
throw new Error("Vault operation requires an authenticated user");
|
|
60
|
+
}
|
|
61
|
+
return { ownerEmail, orgId: currentOrgId() };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** WHERE clause that limits a vault row to the caller's ownership scope. */
|
|
65
|
+
function ctxScope<T extends { ownerEmail: any; orgId: any }>(
|
|
66
|
+
table: T,
|
|
67
|
+
ctx: VaultCtx,
|
|
68
|
+
) {
|
|
69
|
+
if (!ctx.orgId) {
|
|
70
|
+
return and(eq(table.ownerEmail, ctx.ownerEmail), isNull(table.orgId));
|
|
71
|
+
}
|
|
72
|
+
return or(eq(table.ownerEmail, ctx.ownerEmail), eq(table.orgId, ctx.orgId));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Build a ctx that scopes to a specific row's owner/org (used when a
|
|
76
|
+
* request approver acts on behalf of the original requester so the
|
|
77
|
+
* created secret lands in the request's org). */
|
|
78
|
+
function ctxForRow(row: {
|
|
79
|
+
ownerEmail: string;
|
|
80
|
+
orgId: string | null;
|
|
81
|
+
}): VaultCtx {
|
|
82
|
+
return { ownerEmail: row.ownerEmail, orgId: row.orgId };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function ctxForSecretRow(row: VaultSecretRow, fallback: VaultCtx): VaultCtx {
|
|
86
|
+
return row.ownerEmail ? ctxForRow(row) : fallback;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function id() {
|
|
90
|
+
return crypto.randomUUID();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function now() {
|
|
94
|
+
return Date.now();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function safeJson(value: unknown) {
|
|
98
|
+
return JSON.stringify(value ?? null);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function workspaceBaseOrigins(): Set<string> {
|
|
102
|
+
const out = new Set<string>();
|
|
103
|
+
for (const value of [
|
|
104
|
+
process.env.WORKSPACE_GATEWAY_URL,
|
|
105
|
+
process.env.APP_URL,
|
|
106
|
+
process.env.URL,
|
|
107
|
+
process.env.DEPLOY_URL,
|
|
108
|
+
process.env.BETTER_AUTH_URL,
|
|
109
|
+
]) {
|
|
110
|
+
if (!value) continue;
|
|
111
|
+
try {
|
|
112
|
+
out.add(new URL(value).origin);
|
|
113
|
+
} catch {
|
|
114
|
+
// Ignore malformed deploy metadata.
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function isTrustedEnvVarSyncAgentUrl(agentUrl: string): boolean {
|
|
121
|
+
let parsed: URL;
|
|
122
|
+
try {
|
|
123
|
+
parsed = new URL(agentUrl);
|
|
124
|
+
} catch {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
const hostname = parsed.hostname.toLowerCase();
|
|
128
|
+
if (
|
|
129
|
+
hostname === "localhost" ||
|
|
130
|
+
hostname === "127.0.0.1" ||
|
|
131
|
+
hostname === "::1" ||
|
|
132
|
+
hostname.endsWith(".localhost")
|
|
133
|
+
) {
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
return workspaceBaseOrigins().has(parsed.origin);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function scopedFilter<T extends { ownerEmail: any; orgId: any }>(table: T) {
|
|
140
|
+
return ctxScope(table, requireVaultCtx());
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function normalizeCredentialKey(value: string) {
|
|
144
|
+
return value.trim();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function vaultAccessScope() {
|
|
148
|
+
const orgId = currentOrgId();
|
|
149
|
+
if (orgId) return { scope: "org" as const, scopeId: orgId };
|
|
150
|
+
return { scope: "user" as const, scopeId: currentOwnerEmail() };
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function parseVaultAccessMode(value: unknown): VaultAccessMode {
|
|
154
|
+
return value === "manual" ? "manual" : "all-apps";
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export async function getVaultAccessSettings(): Promise<VaultAccessSettings> {
|
|
158
|
+
const scope = vaultAccessScope();
|
|
159
|
+
const raw =
|
|
160
|
+
scope.scope === "org"
|
|
161
|
+
? await getOrgSetting(scope.scopeId, VAULT_ACCESS_SETTINGS_KEY)
|
|
162
|
+
: await getUserSetting(scope.scopeId, VAULT_ACCESS_SETTINGS_KEY);
|
|
163
|
+
return {
|
|
164
|
+
...scope,
|
|
165
|
+
mode: parseVaultAccessMode(raw?.mode),
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export async function setVaultAccessSettings(input: {
|
|
170
|
+
mode: VaultAccessMode;
|
|
171
|
+
}): Promise<VaultAccessSettings> {
|
|
172
|
+
const scope = vaultAccessScope();
|
|
173
|
+
const next = { mode: parseVaultAccessMode(input.mode) };
|
|
174
|
+
if (scope.scope === "org") {
|
|
175
|
+
await putOrgSetting(scope.scopeId, VAULT_ACCESS_SETTINGS_KEY, next);
|
|
176
|
+
} else {
|
|
177
|
+
await putUserSetting(scope.scopeId, VAULT_ACCESS_SETTINGS_KEY, next);
|
|
178
|
+
}
|
|
179
|
+
await recordAudit({
|
|
180
|
+
action: "vault.access-settings.updated",
|
|
181
|
+
targetType: "vault-settings",
|
|
182
|
+
targetId: VAULT_ACCESS_SETTINGS_KEY,
|
|
183
|
+
summary:
|
|
184
|
+
next.mode === "all-apps"
|
|
185
|
+
? "Set vault access to all workspace apps"
|
|
186
|
+
: "Set vault access to manual per-app grants",
|
|
187
|
+
metadata: next,
|
|
188
|
+
});
|
|
189
|
+
return getVaultAccessSettings();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// ─── Vault Audit ──────────────────────────────────────────────────
|
|
193
|
+
|
|
194
|
+
export async function recordVaultAudit(input: {
|
|
195
|
+
action: string;
|
|
196
|
+
secretId?: string | null;
|
|
197
|
+
appId?: string | null;
|
|
198
|
+
summary: string;
|
|
199
|
+
metadata?: unknown;
|
|
200
|
+
actor?: string;
|
|
201
|
+
}) {
|
|
202
|
+
const db = getDb();
|
|
203
|
+
await db.insert(schema.vaultAuditLog).values({
|
|
204
|
+
id: id(),
|
|
205
|
+
ownerEmail: currentOwnerEmail(),
|
|
206
|
+
orgId: currentOrgId(),
|
|
207
|
+
secretId: input.secretId || null,
|
|
208
|
+
appId: input.appId || null,
|
|
209
|
+
action: input.action,
|
|
210
|
+
actor: input.actor || currentOwnerEmail(),
|
|
211
|
+
summary: input.summary,
|
|
212
|
+
metadata: input.metadata ? safeJson(input.metadata) : null,
|
|
213
|
+
createdAt: now(),
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export async function listVaultAudit(limit = 50) {
|
|
218
|
+
const db = getDb();
|
|
219
|
+
return db
|
|
220
|
+
.select()
|
|
221
|
+
.from(schema.vaultAuditLog)
|
|
222
|
+
.where(scopedFilter(schema.vaultAuditLog))
|
|
223
|
+
.orderBy(desc(schema.vaultAuditLog.createdAt))
|
|
224
|
+
.limit(limit);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// ─── Secrets ──────────────────────────────────────────────────────
|
|
228
|
+
|
|
229
|
+
export async function listSecrets() {
|
|
230
|
+
const db = getDb();
|
|
231
|
+
return db
|
|
232
|
+
.select()
|
|
233
|
+
.from(schema.vaultSecrets)
|
|
234
|
+
.where(scopedFilter(schema.vaultSecrets))
|
|
235
|
+
.orderBy(desc(schema.vaultSecrets.updatedAt));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export async function getSecret(secretId: string, ctx: VaultCtx) {
|
|
239
|
+
const db = getDb();
|
|
240
|
+
const [row] = await db
|
|
241
|
+
.select()
|
|
242
|
+
.from(schema.vaultSecrets)
|
|
243
|
+
.where(
|
|
244
|
+
and(
|
|
245
|
+
eq(schema.vaultSecrets.id, secretId),
|
|
246
|
+
ctxScope(schema.vaultSecrets, ctx),
|
|
247
|
+
),
|
|
248
|
+
)
|
|
249
|
+
.limit(1);
|
|
250
|
+
return row ?? null;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export async function createSecret(
|
|
254
|
+
input: {
|
|
255
|
+
credentialKey: string;
|
|
256
|
+
value: string;
|
|
257
|
+
name: string;
|
|
258
|
+
provider?: string | null;
|
|
259
|
+
description?: string | null;
|
|
260
|
+
},
|
|
261
|
+
ctx: VaultCtx = requireVaultCtx(),
|
|
262
|
+
) {
|
|
263
|
+
const db = getDb();
|
|
264
|
+
const timestamp = now();
|
|
265
|
+
const credentialKey = normalizeCredentialKey(input.credentialKey);
|
|
266
|
+
if (!credentialKey) throw new Error("Credential key is required");
|
|
267
|
+
const existing = await db
|
|
268
|
+
.select()
|
|
269
|
+
.from(schema.vaultSecrets)
|
|
270
|
+
.where(
|
|
271
|
+
and(
|
|
272
|
+
eq(schema.vaultSecrets.credentialKey, credentialKey),
|
|
273
|
+
ctxScope(schema.vaultSecrets, ctx),
|
|
274
|
+
),
|
|
275
|
+
)
|
|
276
|
+
.orderBy(desc(schema.vaultSecrets.updatedAt))
|
|
277
|
+
.limit(1);
|
|
278
|
+
|
|
279
|
+
if (existing[0]) {
|
|
280
|
+
await db
|
|
281
|
+
.update(schema.vaultSecrets)
|
|
282
|
+
.set({
|
|
283
|
+
name: input.name,
|
|
284
|
+
credentialKey,
|
|
285
|
+
value: input.value,
|
|
286
|
+
provider: input.provider || null,
|
|
287
|
+
description: input.description || null,
|
|
288
|
+
updatedAt: timestamp,
|
|
289
|
+
})
|
|
290
|
+
.where(
|
|
291
|
+
and(
|
|
292
|
+
eq(schema.vaultSecrets.id, existing[0].id),
|
|
293
|
+
ctxScope(schema.vaultSecrets, ctx),
|
|
294
|
+
),
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
await recordVaultAudit({
|
|
298
|
+
action: "secret.updated",
|
|
299
|
+
secretId: existing[0].id,
|
|
300
|
+
summary: `Updated secret "${input.name}" (${credentialKey})`,
|
|
301
|
+
metadata: { credentialKey, provider: input.provider },
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
await recordAudit({
|
|
305
|
+
action: "vault.secret.updated",
|
|
306
|
+
targetType: "vault-secret",
|
|
307
|
+
targetId: existing[0].id,
|
|
308
|
+
summary: `Updated vault secret "${input.name}" (${credentialKey})`,
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
const updated = await getSecret(existing[0].id, ctx);
|
|
312
|
+
if (updated) {
|
|
313
|
+
await syncSecretsToCredentialStore(
|
|
314
|
+
[updated],
|
|
315
|
+
ctxForSecretRow(updated, ctx),
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
return updated;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
const secretId = id();
|
|
322
|
+
const actor = ctx.ownerEmail;
|
|
323
|
+
|
|
324
|
+
await db.insert(schema.vaultSecrets).values({
|
|
325
|
+
id: secretId,
|
|
326
|
+
ownerEmail: actor,
|
|
327
|
+
orgId: ctx.orgId,
|
|
328
|
+
name: input.name,
|
|
329
|
+
credentialKey,
|
|
330
|
+
value: input.value,
|
|
331
|
+
provider: input.provider || null,
|
|
332
|
+
description: input.description || null,
|
|
333
|
+
createdBy: actor,
|
|
334
|
+
createdAt: timestamp,
|
|
335
|
+
updatedAt: timestamp,
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
await recordVaultAudit({
|
|
339
|
+
action: "secret.created",
|
|
340
|
+
secretId,
|
|
341
|
+
summary: `Created secret "${input.name}" (${credentialKey})`,
|
|
342
|
+
metadata: { credentialKey, provider: input.provider },
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
await recordAudit({
|
|
346
|
+
action: "vault.secret.created",
|
|
347
|
+
targetType: "vault-secret",
|
|
348
|
+
targetId: secretId,
|
|
349
|
+
summary: `Created vault secret "${input.name}" (${credentialKey})`,
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
const created = await getSecret(secretId, ctx);
|
|
353
|
+
if (created) {
|
|
354
|
+
await syncSecretsToCredentialStore(
|
|
355
|
+
[created],
|
|
356
|
+
ctxForSecretRow(created, ctx),
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
return created;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export async function updateSecret(
|
|
363
|
+
secretId: string,
|
|
364
|
+
input:
|
|
365
|
+
| string
|
|
366
|
+
| {
|
|
367
|
+
credentialKey?: string;
|
|
368
|
+
value?: string;
|
|
369
|
+
name?: string;
|
|
370
|
+
provider?: string | null;
|
|
371
|
+
description?: string | null;
|
|
372
|
+
},
|
|
373
|
+
ctx: VaultCtx = requireVaultCtx(),
|
|
374
|
+
) {
|
|
375
|
+
const db = getDb();
|
|
376
|
+
const existing = await getSecret(secretId, ctx);
|
|
377
|
+
if (!existing) throw new Error("Secret not found");
|
|
378
|
+
const patch = typeof input === "string" ? { value: input } : input;
|
|
379
|
+
const credentialKey =
|
|
380
|
+
patch.credentialKey !== undefined
|
|
381
|
+
? normalizeCredentialKey(patch.credentialKey)
|
|
382
|
+
: existing.credentialKey;
|
|
383
|
+
if (!credentialKey) throw new Error("Credential key is required");
|
|
384
|
+
const name = patch.name !== undefined ? patch.name.trim() : existing.name;
|
|
385
|
+
if (!name) throw new Error("Secret name is required");
|
|
386
|
+
const value = patch.value !== undefined ? patch.value : existing.value;
|
|
387
|
+
if (!value) throw new Error("Secret value is required");
|
|
388
|
+
const provider =
|
|
389
|
+
patch.provider !== undefined ? patch.provider || null : existing.provider;
|
|
390
|
+
const description =
|
|
391
|
+
patch.description !== undefined
|
|
392
|
+
? patch.description || null
|
|
393
|
+
: existing.description;
|
|
394
|
+
|
|
395
|
+
if (credentialKey !== existing.credentialKey) {
|
|
396
|
+
const conflict = await db
|
|
397
|
+
.select({ id: schema.vaultSecrets.id })
|
|
398
|
+
.from(schema.vaultSecrets)
|
|
399
|
+
.where(
|
|
400
|
+
and(
|
|
401
|
+
eq(schema.vaultSecrets.credentialKey, credentialKey),
|
|
402
|
+
ctxScope(schema.vaultSecrets, ctx),
|
|
403
|
+
),
|
|
404
|
+
)
|
|
405
|
+
.limit(1);
|
|
406
|
+
if (conflict[0] && conflict[0].id !== secretId) {
|
|
407
|
+
throw new Error(`Credential key "${credentialKey}" is already in use`);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
await db
|
|
412
|
+
.update(schema.vaultSecrets)
|
|
413
|
+
.set({
|
|
414
|
+
name,
|
|
415
|
+
credentialKey,
|
|
416
|
+
value,
|
|
417
|
+
provider,
|
|
418
|
+
description,
|
|
419
|
+
updatedAt: now(),
|
|
420
|
+
})
|
|
421
|
+
.where(
|
|
422
|
+
and(
|
|
423
|
+
eq(schema.vaultSecrets.id, secretId),
|
|
424
|
+
ctxScope(schema.vaultSecrets, ctx),
|
|
425
|
+
),
|
|
426
|
+
);
|
|
427
|
+
|
|
428
|
+
const auditMetadata = {
|
|
429
|
+
name,
|
|
430
|
+
previousName: name !== existing.name ? existing.name : undefined,
|
|
431
|
+
credentialKey,
|
|
432
|
+
previousCredentialKey:
|
|
433
|
+
credentialKey !== existing.credentialKey
|
|
434
|
+
? existing.credentialKey
|
|
435
|
+
: undefined,
|
|
436
|
+
provider,
|
|
437
|
+
previousProvider:
|
|
438
|
+
provider !== existing.provider ? existing.provider : undefined,
|
|
439
|
+
description,
|
|
440
|
+
previousDescription:
|
|
441
|
+
description !== existing.description ? existing.description : undefined,
|
|
442
|
+
valueChanged: value !== existing.value ? true : undefined,
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
await recordVaultAudit({
|
|
446
|
+
action: "secret.updated",
|
|
447
|
+
secretId,
|
|
448
|
+
summary: `Updated secret "${name}" (${credentialKey})`,
|
|
449
|
+
metadata: auditMetadata,
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
await recordAudit({
|
|
453
|
+
action: "vault.secret.updated",
|
|
454
|
+
targetType: "vault-secret",
|
|
455
|
+
targetId: secretId,
|
|
456
|
+
summary: `Updated vault secret "${name}" (${credentialKey})`,
|
|
457
|
+
metadata: auditMetadata,
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
const updated = await getSecret(secretId, ctx);
|
|
461
|
+
if (updated) {
|
|
462
|
+
await syncSecretsToCredentialStore(
|
|
463
|
+
[updated],
|
|
464
|
+
ctxForSecretRow(updated, ctx),
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
if (updated && credentialKey !== existing.credentialKey) {
|
|
468
|
+
await cleanupSyncedCredentialKeysIfUnused(ctxForRow(existing), [
|
|
469
|
+
existing.credentialKey,
|
|
470
|
+
]);
|
|
471
|
+
} else if (updated && patch.credentialKey !== undefined) {
|
|
472
|
+
await cleanupSyncedCredentialKeysIfUnused(ctxForSecretRow(updated, ctx));
|
|
473
|
+
}
|
|
474
|
+
return updated;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
export async function deleteSecret(
|
|
478
|
+
secretId: string,
|
|
479
|
+
ctx: VaultCtx = requireVaultCtx(),
|
|
480
|
+
) {
|
|
481
|
+
const db = getDb();
|
|
482
|
+
const existing = await getSecret(secretId, ctx);
|
|
483
|
+
if (!existing) throw new Error("Secret not found");
|
|
484
|
+
|
|
485
|
+
// Revoke all active grants first
|
|
486
|
+
const grants = await listGrants({ secretId });
|
|
487
|
+
for (const grant of grants) {
|
|
488
|
+
if (grant.status === "active") {
|
|
489
|
+
await revokeGrant(grant.id, ctx);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
await db
|
|
494
|
+
.delete(schema.vaultSecrets)
|
|
495
|
+
.where(
|
|
496
|
+
and(
|
|
497
|
+
eq(schema.vaultSecrets.id, secretId),
|
|
498
|
+
ctxScope(schema.vaultSecrets, ctx),
|
|
499
|
+
),
|
|
500
|
+
);
|
|
501
|
+
await cleanupSyncedCredentialKeysIfUnused(ctxForRow(existing), [
|
|
502
|
+
existing.credentialKey,
|
|
503
|
+
]);
|
|
504
|
+
|
|
505
|
+
await recordVaultAudit({
|
|
506
|
+
action: "secret.deleted",
|
|
507
|
+
secretId,
|
|
508
|
+
summary: `Deleted secret "${existing.name}" (${existing.credentialKey})`,
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
await recordAudit({
|
|
512
|
+
action: "vault.secret.deleted",
|
|
513
|
+
targetType: "vault-secret",
|
|
514
|
+
targetId: secretId,
|
|
515
|
+
summary: `Deleted vault secret "${existing.name}" (${existing.credentialKey})`,
|
|
516
|
+
});
|
|
517
|
+
|
|
518
|
+
return existing;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// ─── Grants ──────────────────────────────────────────────────────
|
|
522
|
+
|
|
523
|
+
export async function listGrants(filter?: {
|
|
524
|
+
secretId?: string;
|
|
525
|
+
appId?: string;
|
|
526
|
+
}) {
|
|
527
|
+
const db = getDb();
|
|
528
|
+
const conditions = [scopedFilter(schema.vaultGrants)];
|
|
529
|
+
if (filter?.secretId) {
|
|
530
|
+
conditions.push(eq(schema.vaultGrants.secretId, filter.secretId) as any);
|
|
531
|
+
}
|
|
532
|
+
if (filter?.appId) {
|
|
533
|
+
conditions.push(eq(schema.vaultGrants.appId, filter.appId) as any);
|
|
534
|
+
}
|
|
535
|
+
return db
|
|
536
|
+
.select()
|
|
537
|
+
.from(schema.vaultGrants)
|
|
538
|
+
.where(and(...conditions))
|
|
539
|
+
.orderBy(desc(schema.vaultGrants.updatedAt));
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
export async function getGrant(
|
|
543
|
+
grantId: string,
|
|
544
|
+
ctx: VaultCtx = requireVaultCtx(),
|
|
545
|
+
) {
|
|
546
|
+
const db = getDb();
|
|
547
|
+
const [row] = await db
|
|
548
|
+
.select()
|
|
549
|
+
.from(schema.vaultGrants)
|
|
550
|
+
.where(
|
|
551
|
+
and(
|
|
552
|
+
eq(schema.vaultGrants.id, grantId),
|
|
553
|
+
ctxScope(schema.vaultGrants, ctx),
|
|
554
|
+
),
|
|
555
|
+
)
|
|
556
|
+
.limit(1);
|
|
557
|
+
return row ?? null;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
export async function createGrant(
|
|
561
|
+
secretId: string,
|
|
562
|
+
appId: string,
|
|
563
|
+
ctx: VaultCtx = requireVaultCtx(),
|
|
564
|
+
) {
|
|
565
|
+
const db = getDb();
|
|
566
|
+
const secret = await getSecret(secretId, ctx);
|
|
567
|
+
if (!secret) throw new Error("Secret not found");
|
|
568
|
+
|
|
569
|
+
const timestamp = now();
|
|
570
|
+
const grantId = id();
|
|
571
|
+
const actor = ctx.ownerEmail;
|
|
572
|
+
|
|
573
|
+
await db.insert(schema.vaultGrants).values({
|
|
574
|
+
id: grantId,
|
|
575
|
+
ownerEmail: actor,
|
|
576
|
+
orgId: ctx.orgId,
|
|
577
|
+
secretId,
|
|
578
|
+
appId,
|
|
579
|
+
grantedBy: actor,
|
|
580
|
+
status: "active",
|
|
581
|
+
syncedAt: null,
|
|
582
|
+
createdAt: timestamp,
|
|
583
|
+
updatedAt: timestamp,
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
await recordVaultAudit({
|
|
587
|
+
action: "grant.created",
|
|
588
|
+
secretId,
|
|
589
|
+
appId,
|
|
590
|
+
summary: `Granted "${secret.name}" (${secret.credentialKey}) to ${appId}`,
|
|
591
|
+
metadata: { grantId },
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
await recordAudit({
|
|
595
|
+
action: "vault.grant.created",
|
|
596
|
+
targetType: "vault-grant",
|
|
597
|
+
targetId: grantId,
|
|
598
|
+
summary: `Granted vault secret "${secret.name}" to ${appId}`,
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
return getGrant(grantId);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
export async function grantSecretsToApp(
|
|
605
|
+
secretIds: string[],
|
|
606
|
+
appId: string,
|
|
607
|
+
ctx: VaultCtx = requireVaultCtx(),
|
|
608
|
+
) {
|
|
609
|
+
const access = await getVaultAccessSettings();
|
|
610
|
+
const uniqueSecretIds = Array.from(new Set(secretIds));
|
|
611
|
+
if (access.mode === "all-apps") {
|
|
612
|
+
return {
|
|
613
|
+
appId,
|
|
614
|
+
accessMode: access.mode,
|
|
615
|
+
created: [],
|
|
616
|
+
skipped: uniqueSecretIds,
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
const existingActive = (await listGrants({ appId })).filter(
|
|
620
|
+
(grant) => grant.status === "active",
|
|
621
|
+
);
|
|
622
|
+
const existingSecretIds = new Set(
|
|
623
|
+
existingActive.map((grant) => grant.secretId),
|
|
624
|
+
);
|
|
625
|
+
const created = [];
|
|
626
|
+
const skipped: string[] = [];
|
|
627
|
+
|
|
628
|
+
for (const secretId of uniqueSecretIds) {
|
|
629
|
+
if (existingSecretIds.has(secretId)) {
|
|
630
|
+
skipped.push(secretId);
|
|
631
|
+
continue;
|
|
632
|
+
}
|
|
633
|
+
const grant = await createGrant(secretId, appId, ctx);
|
|
634
|
+
if (grant) {
|
|
635
|
+
created.push(grant);
|
|
636
|
+
existingSecretIds.add(secretId);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
return { appId, accessMode: access.mode, created, skipped };
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
export async function revokeGrant(
|
|
644
|
+
grantId: string,
|
|
645
|
+
ctx: VaultCtx = requireVaultCtx(),
|
|
646
|
+
) {
|
|
647
|
+
const db = getDb();
|
|
648
|
+
const grant = await getGrant(grantId, ctx);
|
|
649
|
+
if (!grant) throw new Error("Grant not found");
|
|
650
|
+
|
|
651
|
+
const secret = await getSecret(grant.secretId, ctx);
|
|
652
|
+
|
|
653
|
+
await db
|
|
654
|
+
.update(schema.vaultGrants)
|
|
655
|
+
.set({ status: "revoked", updatedAt: now() })
|
|
656
|
+
.where(
|
|
657
|
+
and(
|
|
658
|
+
eq(schema.vaultGrants.id, grantId),
|
|
659
|
+
ctxScope(schema.vaultGrants, ctx),
|
|
660
|
+
),
|
|
661
|
+
);
|
|
662
|
+
|
|
663
|
+
await recordVaultAudit({
|
|
664
|
+
action: "grant.revoked",
|
|
665
|
+
secretId: grant.secretId,
|
|
666
|
+
appId: grant.appId,
|
|
667
|
+
summary: `Revoked ${secret?.credentialKey || grant.secretId} from ${grant.appId}`,
|
|
668
|
+
metadata: { grantId },
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
await recordAudit({
|
|
672
|
+
action: "vault.grant.revoked",
|
|
673
|
+
targetType: "vault-grant",
|
|
674
|
+
targetId: grantId,
|
|
675
|
+
summary: `Revoked vault secret "${secret?.name || grant.secretId}" from ${grant.appId}`,
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
return getGrant(grantId, ctx);
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
// ─── Shared Credential Store Sync ─────────────────────────────────
|
|
682
|
+
|
|
683
|
+
type VaultSecretRow = typeof schema.vaultSecrets.$inferSelect;
|
|
684
|
+
|
|
685
|
+
export function credentialStoreScopeForVaultCtx(ctx: VaultCtx): {
|
|
686
|
+
scope: Extract<SecretScope, "org" | "workspace">;
|
|
687
|
+
scopeId: string;
|
|
688
|
+
} {
|
|
689
|
+
if (ctx.orgId) return { scope: "org", scopeId: ctx.orgId };
|
|
690
|
+
return { scope: "workspace", scopeId: `solo:${ctx.ownerEmail}` };
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
export async function syncSecretsToCredentialStore(
|
|
694
|
+
secrets: VaultSecretRow[],
|
|
695
|
+
ctx: VaultCtx,
|
|
696
|
+
) {
|
|
697
|
+
const target = credentialStoreScopeForVaultCtx(ctx);
|
|
698
|
+
const syncedKeys: string[] = [];
|
|
699
|
+
|
|
700
|
+
for (const secret of secrets) {
|
|
701
|
+
if (!secret.credentialKey || !secret.value) continue;
|
|
702
|
+
await writeAppSecret({
|
|
703
|
+
key: secret.credentialKey,
|
|
704
|
+
value: secret.value,
|
|
705
|
+
scope: target.scope,
|
|
706
|
+
scopeId: target.scopeId,
|
|
707
|
+
description: `${VAULT_SYNC_DESCRIPTION_PREFIX} ${secret.name}`,
|
|
708
|
+
});
|
|
709
|
+
syncedKeys.push(secret.credentialKey);
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
return { ...target, keys: syncedKeys };
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
export async function cleanupSyncedCredentialKeysIfUnused(
|
|
716
|
+
ctx: VaultCtx,
|
|
717
|
+
candidateKeys?: string[],
|
|
718
|
+
) {
|
|
719
|
+
const db = getDb();
|
|
720
|
+
const target = credentialStoreScopeForVaultCtx(ctx);
|
|
721
|
+
const keys = candidateKeys
|
|
722
|
+
? candidateKeys
|
|
723
|
+
: (await listAppSecretsForScope(target.scope, target.scopeId))
|
|
724
|
+
.filter((secret) =>
|
|
725
|
+
secret.description?.startsWith(VAULT_SYNC_DESCRIPTION_PREFIX),
|
|
726
|
+
)
|
|
727
|
+
.map((secret) => secret.key);
|
|
728
|
+
|
|
729
|
+
for (const key of new Set(keys.filter(Boolean))) {
|
|
730
|
+
const stillUsesKey = await db
|
|
731
|
+
.select({ id: schema.vaultSecrets.id })
|
|
732
|
+
.from(schema.vaultSecrets)
|
|
733
|
+
.where(
|
|
734
|
+
and(
|
|
735
|
+
eq(schema.vaultSecrets.credentialKey, key),
|
|
736
|
+
ctxScope(schema.vaultSecrets, ctx),
|
|
737
|
+
),
|
|
738
|
+
)
|
|
739
|
+
.limit(1);
|
|
740
|
+
if (!stillUsesKey[0]) {
|
|
741
|
+
await deleteAppSecret({
|
|
742
|
+
key,
|
|
743
|
+
scope: target.scope,
|
|
744
|
+
scopeId: target.scopeId,
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
// ─── Sync ──────────────────────────────────────────────────────
|
|
751
|
+
|
|
752
|
+
export async function syncGrantsToApp(
|
|
753
|
+
appId: string,
|
|
754
|
+
ctx: VaultCtx = requireVaultCtx(),
|
|
755
|
+
) {
|
|
756
|
+
const db = getDb();
|
|
757
|
+
const access = await getVaultAccessSettings();
|
|
758
|
+
const agents = await discoverAgents("dispatch");
|
|
759
|
+
const agent = agents.find((a) => a.id === appId);
|
|
760
|
+
if (!agent) throw new Error(`App "${appId}" not found in agent registry`);
|
|
761
|
+
|
|
762
|
+
const secretsToSync: VaultSecretRow[] = [];
|
|
763
|
+
const activeGrants =
|
|
764
|
+
access.mode === "manual"
|
|
765
|
+
? (await listGrants({ appId })).filter((g) => g.status === "active")
|
|
766
|
+
: [];
|
|
767
|
+
|
|
768
|
+
if (access.mode === "all-apps") {
|
|
769
|
+
const secrets = await listSecrets();
|
|
770
|
+
for (const secret of secrets) {
|
|
771
|
+
secretsToSync.push(secret);
|
|
772
|
+
}
|
|
773
|
+
} else {
|
|
774
|
+
for (const grant of activeGrants) {
|
|
775
|
+
const secret = await getSecret(grant.secretId, ctx);
|
|
776
|
+
if (secret) {
|
|
777
|
+
secretsToSync.push(secret);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
if (secretsToSync.length === 0) {
|
|
783
|
+
return { appId, accessMode: access.mode, synced: 0, keys: [] };
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
const credentialStoreSync = await syncSecretsToCredentialStore(
|
|
787
|
+
secretsToSync,
|
|
788
|
+
ctx,
|
|
789
|
+
);
|
|
790
|
+
const vars = secretsToSync.map((secret) => ({
|
|
791
|
+
key: secret.credentialKey,
|
|
792
|
+
value: secret.value,
|
|
793
|
+
}));
|
|
794
|
+
let envVarSync:
|
|
795
|
+
| { status: "synced"; keys: string[] }
|
|
796
|
+
| { status: "skipped"; reason: string }
|
|
797
|
+
| { status: "failed"; reason: string };
|
|
798
|
+
|
|
799
|
+
// Best-effort push to the app's env-vars endpoint for local/dev apps that
|
|
800
|
+
// still read process.env directly. Production/shared-DB apps intentionally
|
|
801
|
+
// reject env writes; the encrypted app_secrets sync above is the canonical
|
|
802
|
+
// path for request-scoped credentials.
|
|
803
|
+
if (!isTrustedEnvVarSyncAgentUrl(agent.url)) {
|
|
804
|
+
envVarSync = {
|
|
805
|
+
status: "skipped",
|
|
806
|
+
reason: "env-var sync is limited to localhost or workspace-owned apps",
|
|
807
|
+
};
|
|
808
|
+
} else {
|
|
809
|
+
try {
|
|
810
|
+
const res = await ssrfSafeFetch(
|
|
811
|
+
`${agent.url}/_agent-native/env-vars`,
|
|
812
|
+
{
|
|
813
|
+
method: "POST",
|
|
814
|
+
headers: { "Content-Type": "application/json" },
|
|
815
|
+
body: JSON.stringify({ vars }),
|
|
816
|
+
signal: AbortSignal.timeout(10_000),
|
|
817
|
+
},
|
|
818
|
+
{ maxRedirects: 3 },
|
|
819
|
+
);
|
|
820
|
+
|
|
821
|
+
if (res.ok) {
|
|
822
|
+
const result = await res.json();
|
|
823
|
+
envVarSync = { status: "synced", keys: result.saved || [] };
|
|
824
|
+
} else {
|
|
825
|
+
const err = await res.text().catch(() => "Unknown error");
|
|
826
|
+
envVarSync = { status: "skipped", reason: err };
|
|
827
|
+
}
|
|
828
|
+
} catch (err) {
|
|
829
|
+
envVarSync = {
|
|
830
|
+
status: "failed",
|
|
831
|
+
reason: err instanceof Error ? err.message : String(err),
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
const syncedKeys = credentialStoreSync.keys;
|
|
837
|
+
const timestamp = now();
|
|
838
|
+
|
|
839
|
+
// Update syncedAt on grants that were successfully pushed to the shared
|
|
840
|
+
// credential store. All-apps mode has no explicit grant rows to update.
|
|
841
|
+
for (const grant of activeGrants) {
|
|
842
|
+
const secret = await getSecret(grant.secretId, ctx);
|
|
843
|
+
if (secret && syncedKeys.includes(secret.credentialKey)) {
|
|
844
|
+
await db
|
|
845
|
+
.update(schema.vaultGrants)
|
|
846
|
+
.set({ syncedAt: timestamp, updatedAt: timestamp })
|
|
847
|
+
.where(eq(schema.vaultGrants.id, grant.id));
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
await recordVaultAudit({
|
|
852
|
+
action: "secret.synced",
|
|
853
|
+
appId,
|
|
854
|
+
summary: `Synced ${syncedKeys.length} secret(s) to ${appId}: ${syncedKeys.join(", ")}`,
|
|
855
|
+
metadata: {
|
|
856
|
+
syncedKeys,
|
|
857
|
+
accessMode: access.mode,
|
|
858
|
+
credentialStore: {
|
|
859
|
+
scope: credentialStoreSync.scope,
|
|
860
|
+
scopeId: credentialStoreSync.scopeId,
|
|
861
|
+
},
|
|
862
|
+
envVars: envVarSync,
|
|
863
|
+
},
|
|
864
|
+
});
|
|
865
|
+
|
|
866
|
+
return {
|
|
867
|
+
appId,
|
|
868
|
+
accessMode: access.mode,
|
|
869
|
+
synced: syncedKeys.length,
|
|
870
|
+
keys: syncedKeys,
|
|
871
|
+
credentialStore: {
|
|
872
|
+
scope: credentialStoreSync.scope,
|
|
873
|
+
scopeId: credentialStoreSync.scopeId,
|
|
874
|
+
synced: credentialStoreSync.keys.length,
|
|
875
|
+
},
|
|
876
|
+
envVars: envVarSync,
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
// ─── Requests ──────────────────────────────────────────────────────
|
|
881
|
+
|
|
882
|
+
export async function listRequests(filter?: { status?: string }) {
|
|
883
|
+
const db = getDb();
|
|
884
|
+
const conditions = [scopedFilter(schema.vaultRequests)];
|
|
885
|
+
if (filter?.status) {
|
|
886
|
+
conditions.push(eq(schema.vaultRequests.status, filter.status) as any);
|
|
887
|
+
}
|
|
888
|
+
return db
|
|
889
|
+
.select()
|
|
890
|
+
.from(schema.vaultRequests)
|
|
891
|
+
.where(and(...conditions))
|
|
892
|
+
.orderBy(desc(schema.vaultRequests.updatedAt));
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
export async function getRequest(
|
|
896
|
+
requestId: string,
|
|
897
|
+
ctx: VaultCtx = requireVaultCtx(),
|
|
898
|
+
) {
|
|
899
|
+
const db = getDb();
|
|
900
|
+
const [row] = await db
|
|
901
|
+
.select()
|
|
902
|
+
.from(schema.vaultRequests)
|
|
903
|
+
.where(
|
|
904
|
+
and(
|
|
905
|
+
eq(schema.vaultRequests.id, requestId),
|
|
906
|
+
ctxScope(schema.vaultRequests, ctx),
|
|
907
|
+
),
|
|
908
|
+
)
|
|
909
|
+
.limit(1);
|
|
910
|
+
return row ?? null;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
export async function createRequest(input: {
|
|
914
|
+
credentialKey: string;
|
|
915
|
+
appId: string;
|
|
916
|
+
reason?: string | null;
|
|
917
|
+
}) {
|
|
918
|
+
const db = getDb();
|
|
919
|
+
const timestamp = now();
|
|
920
|
+
const requestId = id();
|
|
921
|
+
const actor = currentOwnerEmail();
|
|
922
|
+
|
|
923
|
+
await db.insert(schema.vaultRequests).values({
|
|
924
|
+
id: requestId,
|
|
925
|
+
ownerEmail: actor,
|
|
926
|
+
orgId: currentOrgId(),
|
|
927
|
+
credentialKey: input.credentialKey,
|
|
928
|
+
appId: input.appId,
|
|
929
|
+
reason: input.reason || null,
|
|
930
|
+
requestedBy: actor,
|
|
931
|
+
status: "pending",
|
|
932
|
+
reviewedBy: null,
|
|
933
|
+
reviewedAt: null,
|
|
934
|
+
createdAt: timestamp,
|
|
935
|
+
updatedAt: timestamp,
|
|
936
|
+
});
|
|
937
|
+
|
|
938
|
+
await recordVaultAudit({
|
|
939
|
+
action: "request.created",
|
|
940
|
+
appId: input.appId,
|
|
941
|
+
summary: `${actor} requested ${input.credentialKey} for ${input.appId}`,
|
|
942
|
+
metadata: { requestId, reason: input.reason },
|
|
943
|
+
});
|
|
944
|
+
|
|
945
|
+
await notifyAdminsOfRequest(requestId, input);
|
|
946
|
+
|
|
947
|
+
return getRequest(requestId);
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
export async function approveRequest(
|
|
951
|
+
requestId: string,
|
|
952
|
+
secretValue: string,
|
|
953
|
+
secretName?: string,
|
|
954
|
+
ctx: VaultCtx = requireVaultCtx(),
|
|
955
|
+
) {
|
|
956
|
+
const db = getDb();
|
|
957
|
+
const request = await getRequest(requestId, ctx);
|
|
958
|
+
if (!request) throw new Error("Request not found");
|
|
959
|
+
if (request.status !== "pending") {
|
|
960
|
+
throw new Error("Only pending requests can be approved");
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
const timestamp = now();
|
|
964
|
+
const reviewer = ctx.ownerEmail;
|
|
965
|
+
|
|
966
|
+
// Update request status — scoped to caller's tenant.
|
|
967
|
+
await db
|
|
968
|
+
.update(schema.vaultRequests)
|
|
969
|
+
.set({
|
|
970
|
+
status: "approved",
|
|
971
|
+
reviewedBy: reviewer,
|
|
972
|
+
reviewedAt: timestamp,
|
|
973
|
+
updatedAt: timestamp,
|
|
974
|
+
})
|
|
975
|
+
.where(
|
|
976
|
+
and(
|
|
977
|
+
eq(schema.vaultRequests.id, requestId),
|
|
978
|
+
ctxScope(schema.vaultRequests, ctx),
|
|
979
|
+
),
|
|
980
|
+
);
|
|
981
|
+
|
|
982
|
+
// Secret + grant must land in the REQUEST's tenant, not the approver's
|
|
983
|
+
// (the approver may be acting on behalf of another user in the same org).
|
|
984
|
+
const requestCtx = ctxForRow(request);
|
|
985
|
+
|
|
986
|
+
// Check if secret already exists in the request's tenant for this key.
|
|
987
|
+
const existingSecrets = await db
|
|
988
|
+
.select()
|
|
989
|
+
.from(schema.vaultSecrets)
|
|
990
|
+
.where(
|
|
991
|
+
and(
|
|
992
|
+
eq(schema.vaultSecrets.credentialKey, request.credentialKey),
|
|
993
|
+
ctxScope(schema.vaultSecrets, requestCtx),
|
|
994
|
+
),
|
|
995
|
+
);
|
|
996
|
+
let secret = existingSecrets[0] ?? null;
|
|
997
|
+
|
|
998
|
+
if (!secret) {
|
|
999
|
+
secret = await createSecret(
|
|
1000
|
+
{
|
|
1001
|
+
credentialKey: request.credentialKey,
|
|
1002
|
+
value: secretValue,
|
|
1003
|
+
name: secretName || request.credentialKey,
|
|
1004
|
+
},
|
|
1005
|
+
requestCtx,
|
|
1006
|
+
);
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
if (secret) {
|
|
1010
|
+
// Create the grant in the request's tenant as well.
|
|
1011
|
+
await createGrant(secret.id, request.appId, requestCtx);
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
await recordVaultAudit({
|
|
1015
|
+
action: "request.approved",
|
|
1016
|
+
appId: request.appId,
|
|
1017
|
+
summary: `Approved ${request.credentialKey} for ${request.appId} (requested by ${request.requestedBy})`,
|
|
1018
|
+
metadata: { requestId, reviewer },
|
|
1019
|
+
});
|
|
1020
|
+
|
|
1021
|
+
return getRequest(requestId, ctx);
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
export async function denyRequest(
|
|
1025
|
+
requestId: string,
|
|
1026
|
+
reason?: string | null,
|
|
1027
|
+
ctx: VaultCtx = requireVaultCtx(),
|
|
1028
|
+
) {
|
|
1029
|
+
const db = getDb();
|
|
1030
|
+
const request = await getRequest(requestId, ctx);
|
|
1031
|
+
if (!request) throw new Error("Request not found");
|
|
1032
|
+
if (request.status !== "pending") {
|
|
1033
|
+
throw new Error("Only pending requests can be denied");
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
const timestamp = now();
|
|
1037
|
+
const reviewer = ctx.ownerEmail;
|
|
1038
|
+
|
|
1039
|
+
await db
|
|
1040
|
+
.update(schema.vaultRequests)
|
|
1041
|
+
.set({
|
|
1042
|
+
status: "denied",
|
|
1043
|
+
reviewedBy: reviewer,
|
|
1044
|
+
reviewedAt: timestamp,
|
|
1045
|
+
updatedAt: timestamp,
|
|
1046
|
+
})
|
|
1047
|
+
.where(
|
|
1048
|
+
and(
|
|
1049
|
+
eq(schema.vaultRequests.id, requestId),
|
|
1050
|
+
ctxScope(schema.vaultRequests, ctx),
|
|
1051
|
+
),
|
|
1052
|
+
);
|
|
1053
|
+
|
|
1054
|
+
await recordVaultAudit({
|
|
1055
|
+
action: "request.denied",
|
|
1056
|
+
appId: request.appId,
|
|
1057
|
+
summary: `Denied ${request.credentialKey} for ${request.appId} (requested by ${request.requestedBy})`,
|
|
1058
|
+
metadata: { requestId, reviewer, reason },
|
|
1059
|
+
});
|
|
1060
|
+
|
|
1061
|
+
return getRequest(requestId, ctx);
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
// ─── Integrations Catalog ────────────────────────────────────────
|
|
1065
|
+
|
|
1066
|
+
export interface IntegrationEntry {
|
|
1067
|
+
key: string;
|
|
1068
|
+
label: string;
|
|
1069
|
+
required: boolean;
|
|
1070
|
+
configured: boolean;
|
|
1071
|
+
vaultGranted: boolean;
|
|
1072
|
+
vaultSecretId?: string;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
export interface AppIntegrations {
|
|
1076
|
+
appId: string;
|
|
1077
|
+
appName: string;
|
|
1078
|
+
url: string;
|
|
1079
|
+
color: string;
|
|
1080
|
+
integrations: IntegrationEntry[];
|
|
1081
|
+
vaultAccessMode: VaultAccessMode;
|
|
1082
|
+
reachable: boolean;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
export async function listIntegrationsCatalog(): Promise<AppIntegrations[]> {
|
|
1086
|
+
const access = await getVaultAccessSettings();
|
|
1087
|
+
const agents = await discoverAgents("dispatch");
|
|
1088
|
+
const grants = await listGrants();
|
|
1089
|
+
const secrets = await listSecrets();
|
|
1090
|
+
|
|
1091
|
+
const secretByKey = new Map(secrets.map((s) => [s.credentialKey, s]));
|
|
1092
|
+
|
|
1093
|
+
const results: AppIntegrations[] = [];
|
|
1094
|
+
|
|
1095
|
+
for (const agent of agents) {
|
|
1096
|
+
try {
|
|
1097
|
+
const res = await ssrfSafeFetch(
|
|
1098
|
+
`${agent.url}/_agent-native/env-status`,
|
|
1099
|
+
{
|
|
1100
|
+
signal: AbortSignal.timeout(3000),
|
|
1101
|
+
},
|
|
1102
|
+
{ maxRedirects: 3 },
|
|
1103
|
+
);
|
|
1104
|
+
if (!res.ok) {
|
|
1105
|
+
results.push({
|
|
1106
|
+
appId: agent.id,
|
|
1107
|
+
appName: agent.name,
|
|
1108
|
+
url: agent.url,
|
|
1109
|
+
color: agent.color,
|
|
1110
|
+
integrations: [],
|
|
1111
|
+
vaultAccessMode: access.mode,
|
|
1112
|
+
reachable: false,
|
|
1113
|
+
});
|
|
1114
|
+
continue;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
const envStatus: Array<{
|
|
1118
|
+
key: string;
|
|
1119
|
+
label: string;
|
|
1120
|
+
required: boolean;
|
|
1121
|
+
configured: boolean;
|
|
1122
|
+
}> = await res.json();
|
|
1123
|
+
|
|
1124
|
+
const appGrants = grants.filter(
|
|
1125
|
+
(g) => g.appId === agent.id && g.status === "active",
|
|
1126
|
+
);
|
|
1127
|
+
const grantedSecretIds = new Set(appGrants.map((g) => g.secretId));
|
|
1128
|
+
|
|
1129
|
+
const integrations: IntegrationEntry[] = envStatus.map((env) => {
|
|
1130
|
+
const matchingSecret = secretByKey.get(env.key);
|
|
1131
|
+
return {
|
|
1132
|
+
key: env.key,
|
|
1133
|
+
label: env.label,
|
|
1134
|
+
required: env.required,
|
|
1135
|
+
configured: env.configured,
|
|
1136
|
+
vaultGranted:
|
|
1137
|
+
!!matchingSecret &&
|
|
1138
|
+
(access.mode === "all-apps" ||
|
|
1139
|
+
grantedSecretIds.has(matchingSecret.id)),
|
|
1140
|
+
vaultSecretId: matchingSecret?.id,
|
|
1141
|
+
};
|
|
1142
|
+
});
|
|
1143
|
+
|
|
1144
|
+
results.push({
|
|
1145
|
+
appId: agent.id,
|
|
1146
|
+
appName: agent.name,
|
|
1147
|
+
url: agent.url,
|
|
1148
|
+
color: agent.color,
|
|
1149
|
+
integrations,
|
|
1150
|
+
vaultAccessMode: access.mode,
|
|
1151
|
+
reachable: true,
|
|
1152
|
+
});
|
|
1153
|
+
} catch {
|
|
1154
|
+
results.push({
|
|
1155
|
+
appId: agent.id,
|
|
1156
|
+
appName: agent.name,
|
|
1157
|
+
url: agent.url,
|
|
1158
|
+
color: agent.color,
|
|
1159
|
+
integrations: [],
|
|
1160
|
+
vaultAccessMode: access.mode,
|
|
1161
|
+
reachable: false,
|
|
1162
|
+
});
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
return results;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
// ─── Vault Overview (for dashboard) ──────────────────────────────
|
|
1170
|
+
|
|
1171
|
+
export async function listVaultOverview() {
|
|
1172
|
+
const [secrets, grants, requests, access] = await Promise.all([
|
|
1173
|
+
listSecrets(),
|
|
1174
|
+
listGrants(),
|
|
1175
|
+
listRequests(),
|
|
1176
|
+
getVaultAccessSettings(),
|
|
1177
|
+
]);
|
|
1178
|
+
const manualGrantCount = grants.filter((g) => g.status === "active").length;
|
|
1179
|
+
|
|
1180
|
+
return {
|
|
1181
|
+
accessMode: access.mode,
|
|
1182
|
+
secretCount: secrets.length,
|
|
1183
|
+
activeGrantCount:
|
|
1184
|
+
access.mode === "all-apps" ? secrets.length : manualGrantCount,
|
|
1185
|
+
manualGrantCount,
|
|
1186
|
+
pendingRequestCount: requests.filter((r) => r.status === "pending").length,
|
|
1187
|
+
};
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
// ─── SendGrid Notifications ──────────────────────────────────────
|
|
1191
|
+
|
|
1192
|
+
async function notifyAdminsOfRequest(
|
|
1193
|
+
requestId: string,
|
|
1194
|
+
input: { credentialKey: string; appId: string; reason?: string | null },
|
|
1195
|
+
) {
|
|
1196
|
+
const apiKey = process.env.SENDGRID_API_KEY;
|
|
1197
|
+
const from = process.env.SENDGRID_FROM_EMAIL;
|
|
1198
|
+
const appUrl = process.env.APP_URL;
|
|
1199
|
+
if (!apiKey || !from || !appUrl) return;
|
|
1200
|
+
|
|
1201
|
+
// Use approval policy approver emails as admin notification targets
|
|
1202
|
+
const { getApprovalPolicy } = await import("./dispatch-store.js");
|
|
1203
|
+
const policy = await getApprovalPolicy();
|
|
1204
|
+
if (policy.approverEmails.length === 0) return;
|
|
1205
|
+
|
|
1206
|
+
const body = [
|
|
1207
|
+
`Secret request: ${input.credentialKey} for ${input.appId}`,
|
|
1208
|
+
input.reason ? `Reason: ${input.reason}` : "",
|
|
1209
|
+
`Requested by: ${currentOwnerEmail()}`,
|
|
1210
|
+
"",
|
|
1211
|
+
`Review it here: ${appUrl}/vault`,
|
|
1212
|
+
]
|
|
1213
|
+
.filter(Boolean)
|
|
1214
|
+
.join("\n");
|
|
1215
|
+
|
|
1216
|
+
await fetch("https://api.sendgrid.com/v3/mail/send", {
|
|
1217
|
+
method: "POST",
|
|
1218
|
+
headers: {
|
|
1219
|
+
Authorization: `Bearer ${apiKey}`,
|
|
1220
|
+
"Content-Type": "application/json",
|
|
1221
|
+
},
|
|
1222
|
+
body: JSON.stringify({
|
|
1223
|
+
personalizations: [
|
|
1224
|
+
{
|
|
1225
|
+
to: policy.approverEmails.map((email) => ({ email })),
|
|
1226
|
+
subject: `Vault request: ${input.credentialKey} for ${input.appId}`,
|
|
1227
|
+
},
|
|
1228
|
+
],
|
|
1229
|
+
from: { email: from },
|
|
1230
|
+
content: [{ type: "text/plain", value: body }],
|
|
1231
|
+
custom_args: { requestId },
|
|
1232
|
+
}),
|
|
1233
|
+
}).catch(() => {});
|
|
1234
|
+
}
|