@agent-native/dispatch 0.0.0-beta-20260819155526
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 +146 -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 +29 -0
- package/dist/actions/ask_app.d.ts.map +1 -0
- package/dist/actions/ask_app.js +23 -0
- package/dist/actions/ask_app.js.map +1 -0
- package/dist/actions/ask_app_status.d.ts +27 -0
- package/dist/actions/ask_app_status.d.ts.map +1 -0
- package/dist/actions/ask_app_status.js +14 -0
- package/dist/actions/ask_app_status.js.map +1 -0
- package/dist/actions/connect-external-agent.d.ts +18 -0
- package/dist/actions/connect-external-agent.d.ts.map +1 -0
- package/dist/actions/connect-external-agent.js +68 -0
- package/dist/actions/connect-external-agent.js.map +1 -0
- package/dist/actions/create-browser-chat-session.d.ts +15 -0
- package/dist/actions/create-browser-chat-session.d.ts.map +1 -0
- package/dist/actions/create-browser-chat-session.js +75 -0
- package/dist/actions/create-browser-chat-session.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 +29 -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/create_workspace_app_embed_session.d.ts +19 -0
- package/dist/actions/create_workspace_app_embed_session.d.ts.map +1 -0
- package/dist/actions/create_workspace_app_embed_session.js +89 -0
- package/dist/actions/create_workspace_app_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 +10 -0
- package/dist/actions/delete-staged-dataset.d.ts.map +1 -0
- package/dist/actions/delete-staged-dataset.js +8 -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 +72 -0
- package/dist/actions/get-agent-thread-debug.d.ts.map +1 -0
- package/dist/actions/get-agent-thread-debug.js +37 -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/import-agent-pack.d.ts +96 -0
- package/dist/actions/import-agent-pack.d.ts.map +1 -0
- package/dist/actions/import-agent-pack.js +116 -0
- package/dist/actions/import-agent-pack.js.map +1 -0
- package/dist/actions/import-agent.d.ts +60 -0
- package/dist/actions/import-agent.d.ts.map +1 -0
- package/dist/actions/import-agent.js +82 -0
- package/dist/actions/import-agent.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 +207 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/actions/list-agent-pack.d.ts +36 -0
- package/dist/actions/list-agent-pack.d.ts.map +1 -0
- package/dist/actions/list-agent-pack.js +32 -0
- package/dist/actions/list-agent-pack.js.map +1 -0
- package/dist/actions/list-agent-run-failures.d.ts +65 -0
- package/dist/actions/list-agent-run-failures.d.ts.map +1 -0
- package/dist/actions/list-agent-run-failures.js +42 -0
- package/dist/actions/list-agent-run-failures.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 +14 -0
- package/dist/actions/list-connected-agents.d.ts.map +1 -0
- package/dist/actions/list-connected-agents.js +87 -0
- package/dist/actions/list-connected-agents.js.map +1 -0
- package/dist/actions/list-curated-workspace-templates.d.ts +3 -0
- package/dist/actions/list-curated-workspace-templates.d.ts.map +1 -0
- package/dist/actions/list-curated-workspace-templates.js +10 -0
- package/dist/actions/list-curated-workspace-templates.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 +7 -0
- package/dist/actions/list-dispatch-usage-metrics.d.ts.map +1 -0
- package/dist/actions/list-dispatch-usage-metrics.js +28 -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 +8 -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 +12 -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 +7 -0
- package/dist/actions/list-workspace-apps.d.ts.map +1 -0
- package/dist/actions/list-workspace-apps.js +31 -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 +22 -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 +22 -0
- package/dist/actions/list-workspace-resources.js.map +1 -0
- package/dist/actions/list_apps.d.ts +15 -0
- package/dist/actions/list_apps.d.ts.map +1 -0
- package/dist/actions/list_apps.js +34 -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 +28 -0
- package/dist/actions/provider-api-catalog.d.ts.map +1 -0
- package/dist/actions/provider-api-catalog.js +8 -0
- package/dist/actions/provider-api-catalog.js.map +1 -0
- package/dist/actions/provider-api-docs.d.ts +41 -0
- package/dist/actions/provider-api-docs.d.ts.map +1 -0
- package/dist/actions/provider-api-docs.js +12 -0
- package/dist/actions/provider-api-docs.js.map +1 -0
- package/dist/actions/provider-api-register.d.ts +109 -0
- package/dist/actions/provider-api-register.d.ts.map +1 -0
- package/dist/actions/provider-api-register.js +33 -0
- package/dist/actions/provider-api-register.js.map +1 -0
- package/dist/actions/provider-api-request.d.ts +67 -0
- package/dist/actions/provider-api-request.d.ts.map +1 -0
- package/dist/actions/provider-api-request.js +13 -0
- package/dist/actions/provider-api-request.js.map +1 -0
- package/dist/actions/query-staged-dataset.d.ts +45 -0
- package/dist/actions/query-staged-dataset.d.ts.map +1 -0
- package/dist/actions/query-staged-dataset.js +8 -0
- package/dist/actions/query-staged-dataset.js.map +1 -0
- package/dist/actions/read-slack-thread-context.d.ts +29 -0
- package/dist/actions/read-slack-thread-context.d.ts.map +1 -0
- package/dist/actions/read-slack-thread-context.js +138 -0
- package/dist/actions/read-slack-thread-context.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/remix-workspace-template.d.ts +48 -0
- package/dist/actions/remix-workspace-template.d.ts.map +1 -0
- package/dist/actions/remix-workspace-template.js +79 -0
- package/dist/actions/remix-workspace-template.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/resolve-integration-source-context.d.ts +5 -0
- package/dist/actions/resolve-integration-source-context.d.ts.map +1 -0
- package/dist/actions/resolve-integration-source-context.js +30 -0
- package/dist/actions/resolve-integration-source-context.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 +41 -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 +15 -0
- package/dist/actions/send-platform-message.d.ts.map +1 -0
- package/dist/actions/send-platform-message.js +96 -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 +43 -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 +10 -0
- package/dist/actions/start-workspace-app-creation.d.ts.map +1 -0
- package/dist/actions/start-workspace-app-creation.js +43 -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 +332 -0
- package/dist/actions/view-screen.js.map +1 -0
- package/dist/client/transactional-emails.d.ts +57 -0
- package/dist/client/transactional-emails.d.ts.map +1 -0
- package/dist/client/transactional-emails.js +116 -0
- package/dist/client/transactional-emails.js.map +1 -0
- package/dist/components/action-query-error.d.ts +8 -0
- package/dist/components/action-query-error.d.ts.map +1 -0
- package/dist/components/action-query-error.js +10 -0
- package/dist/components/action-query-error.js.map +1 -0
- package/dist/components/admin-navigation.d.ts +16 -0
- package/dist/components/admin-navigation.d.ts.map +1 -0
- package/dist/components/admin-navigation.js +193 -0
- package/dist/components/admin-navigation.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 +133 -0
- package/dist/components/agents-panel.js.map +1 -0
- package/dist/components/app-icon.d.ts +10 -0
- package/dist/components/app-icon.d.ts.map +1 -0
- package/dist/components/app-icon.js +107 -0
- package/dist/components/app-icon.js.map +1 -0
- package/dist/components/app-keys-popover.d.ts +15 -0
- package/dist/components/app-keys-popover.d.ts.map +1 -0
- package/dist/components/app-keys-popover.js +115 -0
- package/dist/components/app-keys-popover.js.map +1 -0
- package/dist/components/app-list-row.d.ts +12 -0
- package/dist/components/app-list-row.d.ts.map +1 -0
- package/dist/components/app-list-row.js +11 -0
- package/dist/components/app-list-row.js.map +1 -0
- package/dist/components/app-open-actions.d.ts +2 -0
- package/dist/components/app-open-actions.d.ts.map +1 -0
- package/dist/components/app-open-actions.js +2 -0
- package/dist/components/app-open-actions.js.map +1 -0
- package/dist/components/app-row-settings.d.ts +6 -0
- package/dist/components/app-row-settings.d.ts.map +1 -0
- package/dist/components/app-row-settings.js +11 -0
- package/dist/components/app-row-settings.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/automation-run-history-dialog.d.ts +9 -0
- package/dist/components/automation-run-history-dialog.d.ts.map +1 -0
- package/dist/components/automation-run-history-dialog.js +63 -0
- package/dist/components/automation-run-history-dialog.js.map +1 -0
- package/dist/components/connected-app-card.d.ts +6 -0
- package/dist/components/connected-app-card.d.ts.map +1 -0
- package/dist/components/connected-app-card.js +13 -0
- package/dist/components/connected-app-card.js.map +1 -0
- package/dist/components/create-app-popover.d.ts +29 -0
- package/dist/components/create-app-popover.d.ts.map +1 -0
- package/dist/components/create-app-popover.js +262 -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 +114 -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 +21 -0
- package/dist/components/dispatch-shell.js.map +1 -0
- package/dist/components/docs-link.d.ts +16 -0
- package/dist/components/docs-link.d.ts.map +1 -0
- package/dist/components/docs-link.js +34 -0
- package/dist/components/docs-link.js.map +1 -0
- package/dist/components/index.d.ts +17 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +16 -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 +61 -0
- package/dist/components/layout/Header.js.map +1 -0
- package/dist/components/layout/HeaderActions.d.ts +2 -0
- package/dist/components/layout/HeaderActions.d.ts.map +1 -0
- package/dist/components/layout/HeaderActions.js +2 -0
- package/dist/components/layout/HeaderActions.js.map +1 -0
- package/dist/components/layout/Layout.d.ts +60 -0
- package/dist/components/layout/Layout.d.ts.map +1 -0
- package/dist/components/layout/Layout.js +1302 -0
- package/dist/components/layout/Layout.js.map +1 -0
- package/dist/components/layout/workspace-apps-rail.d.ts +5 -0
- package/dist/components/layout/workspace-apps-rail.d.ts.map +1 -0
- package/dist/components/layout/workspace-apps-rail.js +56 -0
- package/dist/components/layout/workspace-apps-rail.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 +414 -0
- package/dist/components/messaging-setup-panel.js.map +1 -0
- package/dist/components/other-apps-section.d.ts +33 -0
- package/dist/components/other-apps-section.d.ts.map +1 -0
- package/dist/components/other-apps-section.js +66 -0
- package/dist/components/other-apps-section.js.map +1 -0
- package/dist/components/simple-agents-panel.d.ts +12 -0
- package/dist/components/simple-agents-panel.d.ts.map +1 -0
- package/dist/components/simple-agents-panel.js +438 -0
- package/dist/components/simple-agents-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 +58 -0
- package/dist/components/task-queue-health.js.map +1 -0
- package/dist/components/transactional-email-activity.d.ts +24 -0
- package/dist/components/transactional-email-activity.d.ts.map +1 -0
- package/dist/components/transactional-email-activity.js +31 -0
- package/dist/components/transactional-email-activity.js.map +1 -0
- package/dist/components/transactional-email-metrics.d.ts +40 -0
- package/dist/components/transactional-email-metrics.d.ts.map +1 -0
- package/dist/components/transactional-email-metrics.js +44 -0
- package/dist/components/transactional-email-metrics.js.map +1 -0
- package/dist/components/transactional-email-preview.d.ts +7 -0
- package/dist/components/transactional-email-preview.d.ts.map +1 -0
- package/dist/components/transactional-email-preview.js +41 -0
- package/dist/components/transactional-email-preview.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 +2 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +2 -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 +2 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +2 -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 +8 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +11 -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 +2 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +2 -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/usage-alerts-panel.d.ts +11 -0
- package/dist/components/usage-alerts-panel.d.ts.map +1 -0
- package/dist/components/usage-alerts-panel.js +125 -0
- package/dist/components/usage-alerts-panel.js.map +1 -0
- package/dist/components/workspace-app-card.d.ts +8 -0
- package/dist/components/workspace-app-card.d.ts.map +1 -0
- package/dist/components/workspace-app-card.js +198 -0
- package/dist/components/workspace-app-card.js.map +1 -0
- package/dist/components/workspace-app-host.d.ts +50 -0
- package/dist/components/workspace-app-host.d.ts.map +1 -0
- package/dist/components/workspace-app-host.js +386 -0
- package/dist/components/workspace-app-host.js.map +1 -0
- package/dist/components/workspace-app-search.d.ts +10 -0
- package/dist/components/workspace-app-search.d.ts.map +1 -0
- package/dist/components/workspace-app-search.js +27 -0
- package/dist/components/workspace-app-search.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 +65 -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 +44 -0
- package/dist/components/workspace-resource-impact-preview.js.map +1 -0
- package/dist/components/workspace-template-card.d.ts +58 -0
- package/dist/components/workspace-template-card.d.ts.map +1 -0
- package/dist/components/workspace-template-card.js +113 -0
- package/dist/components/workspace-template-card.js.map +1 -0
- package/dist/config.d.ts +40 -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 +35 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/migrations.d.ts +3 -0
- package/dist/db/migrations.d.ts.map +1 -0
- package/dist/db/migrations.js +250 -0
- package/dist/db/migrations.js.map +1 -0
- package/dist/db/schema.d.ts +3059 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +194 -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 +2 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/hooks/use-navigation-state.d.ts +25 -0
- package/dist/hooks/use-navigation-state.d.ts.map +1 -0
- package/dist/hooks/use-navigation-state.js +353 -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/agent-pack.d.ts +31 -0
- package/dist/lib/agent-pack.d.ts.map +1 -0
- package/dist/lib/agent-pack.js +149 -0
- package/dist/lib/agent-pack.js.map +1 -0
- package/dist/lib/automation-display.d.ts +22 -0
- package/dist/lib/automation-display.d.ts.map +1 -0
- package/dist/lib/automation-display.js +88 -0
- package/dist/lib/automation-display.js.map +1 -0
- package/dist/lib/automations.d.ts +32 -0
- package/dist/lib/automations.d.ts.map +1 -0
- package/dist/lib/automations.js +28 -0
- package/dist/lib/automations.js.map +1 -0
- package/dist/lib/browser-chat-bridge.d.ts +8 -0
- package/dist/lib/browser-chat-bridge.d.ts.map +1 -0
- package/dist/lib/browser-chat-bridge.js +48 -0
- package/dist/lib/browser-chat-bridge.js.map +1 -0
- package/dist/lib/browser-chat-protocol.d.ts +33 -0
- package/dist/lib/browser-chat-protocol.d.ts.map +1 -0
- package/dist/lib/browser-chat-protocol.js +82 -0
- package/dist/lib/browser-chat-protocol.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/embed-session-recovery.d.ts +3 -0
- package/dist/lib/embed-session-recovery.d.ts.map +1 -0
- package/dist/lib/embed-session-recovery.js +18 -0
- package/dist/lib/embed-session-recovery.js.map +1 -0
- package/dist/lib/other-apps.d.ts +16 -0
- package/dist/lib/other-apps.d.ts.map +1 -0
- package/dist/lib/other-apps.js +36 -0
- package/dist/lib/other-apps.js.map +1 -0
- package/dist/lib/overview-chat.d.ts +9 -0
- package/dist/lib/overview-chat.d.ts.map +1 -0
- package/dist/lib/overview-chat.js +16 -0
- package/dist/lib/overview-chat.js.map +1 -0
- package/dist/lib/simple-agent-profile.d.ts +36 -0
- package/dist/lib/simple-agent-profile.d.ts.map +1 -0
- package/dist/lib/simple-agent-profile.js +183 -0
- package/dist/lib/simple-agent-profile.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-app-layout.d.ts +19 -0
- package/dist/lib/workspace-app-layout.d.ts.map +1 -0
- package/dist/lib/workspace-app-layout.js +75 -0
- package/dist/lib/workspace-app-layout.js.map +1 -0
- package/dist/lib/workspace-apps.d.ts +72 -0
- package/dist/lib/workspace-apps.d.ts.map +1 -0
- package/dist/lib/workspace-apps.js +228 -0
- package/dist/lib/workspace-apps.js.map +1 -0
- package/dist/lib/workspace-apps.test.d.ts +2 -0
- package/dist/lib/workspace-apps.test.d.ts.map +1 -0
- package/dist/lib/workspace-apps.test.js +105 -0
- package/dist/lib/workspace-apps.test.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 +89 -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 +126 -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 +53 -0
- package/dist/routes/pages/_index.js.map +1 -0
- package/dist/routes/pages/_index.test.d.ts +2 -0
- package/dist/routes/pages/_index.test.d.ts.map +1 -0
- package/dist/routes/pages/_index.test.js +29 -0
- package/dist/routes/pages/_index.test.js.map +1 -0
- package/dist/routes/pages/admin._index.d.ts +5 -0
- package/dist/routes/pages/admin._index.d.ts.map +1 -0
- package/dist/routes/pages/admin._index.js +44 -0
- package/dist/routes/pages/admin._index.js.map +1 -0
- package/dist/routes/pages/admin.d.ts +5 -0
- package/dist/routes/pages/admin.d.ts.map +1 -0
- package/dist/routes/pages/admin.js +10 -0
- package/dist/routes/pages/admin.js.map +1 -0
- package/dist/routes/pages/agent-integrations.d.ts +5 -0
- package/dist/routes/pages/agent-integrations.d.ts.map +1 -0
- package/dist/routes/pages/agent-integrations.js +15 -0
- package/dist/routes/pages/agent-integrations.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 +96 -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 +58 -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 +55 -0
- package/dist/routes/pages/approvals.js.map +1 -0
- package/dist/routes/pages/apps.$appId.d.ts +6 -0
- package/dist/routes/pages/apps.$appId.d.ts.map +1 -0
- package/dist/routes/pages/apps.$appId.js +15 -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 +113 -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 +14 -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 +124 -0
- package/dist/routes/pages/automations.js.map +1 -0
- package/dist/routes/pages/browser-chat.d.ts +5 -0
- package/dist/routes/pages/browser-chat.d.ts.map +1 -0
- package/dist/routes/pages/browser-chat.js +43 -0
- package/dist/routes/pages/browser-chat.js.map +1 -0
- package/dist/routes/pages/browser-connect.d.ts +5 -0
- package/dist/routes/pages/browser-connect.d.ts.map +1 -0
- package/dist/routes/pages/browser-connect.js +72 -0
- package/dist/routes/pages/browser-connect.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 +192 -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 +96 -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 +455 -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 +20 -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 +196 -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 +305 -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 +12 -0
- package/dist/routes/pages/new-app.js.map +1 -0
- package/dist/routes/pages/operations.d.ts +5 -0
- package/dist/routes/pages/operations.d.ts.map +1 -0
- package/dist/routes/pages/operations.js +53 -0
- package/dist/routes/pages/operations.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 +57 -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 +563 -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/transactional-email.$appId.$id.d.ts +5 -0
- package/dist/routes/pages/transactional-email.$appId.$id.d.ts.map +1 -0
- package/dist/routes/pages/transactional-email.$appId.$id.js +147 -0
- package/dist/routes/pages/transactional-email.$appId.$id.js.map +1 -0
- package/dist/routes/pages/transactional-email.d.ts +5 -0
- package/dist/routes/pages/transactional-email.d.ts.map +1 -0
- package/dist/routes/pages/transactional-email.js +143 -0
- package/dist/routes/pages/transactional-email.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 +214 -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 +336 -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 +71 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/lib/agent-pack-store.d.ts +24 -0
- package/dist/server/lib/agent-pack-store.d.ts.map +1 -0
- package/dist/server/lib/agent-pack-store.js +22 -0
- package/dist/server/lib/agent-pack-store.js.map +1 -0
- package/dist/server/lib/app-creation-store.d.ts +164 -0
- package/dist/server/lib/app-creation-store.d.ts.map +1 -0
- package/dist/server/lib/app-creation-store.js +1975 -0
- package/dist/server/lib/app-creation-store.js.map +1 -0
- package/dist/server/lib/browser-extension-allowlist.d.ts +9 -0
- package/dist/server/lib/browser-extension-allowlist.d.ts.map +1 -0
- package/dist/server/lib/browser-extension-allowlist.js +39 -0
- package/dist/server/lib/browser-extension-allowlist.js.map +1 -0
- package/dist/server/lib/curated-workspace-templates.d.ts +22 -0
- package/dist/server/lib/curated-workspace-templates.d.ts.map +1 -0
- package/dist/server/lib/curated-workspace-templates.js +137 -0
- package/dist/server/lib/curated-workspace-templates.js.map +1 -0
- package/dist/server/lib/dispatch-integrations.d.ts +16 -0
- package/dist/server/lib/dispatch-integrations.d.ts.map +1 -0
- package/dist/server/lib/dispatch-integrations.js +411 -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-routing.d.ts +6 -0
- package/dist/server/lib/dispatch-routing.d.ts.map +1 -0
- package/dist/server/lib/dispatch-routing.js +30 -0
- package/dist/server/lib/dispatch-routing.js.map +1 -0
- package/dist/server/lib/dispatch-store.d.ts +342 -0
- package/dist/server/lib/dispatch-store.d.ts.map +1 -0
- package/dist/server/lib/dispatch-store.js +725 -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 +98 -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 +92 -0
- package/dist/server/lib/mcp-access-store.js.map +1 -0
- package/dist/server/lib/mcp-gateway.d.ts +90 -0
- package/dist/server/lib/mcp-gateway.d.ts.map +1 -0
- package/dist/server/lib/mcp-gateway.js +1036 -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 +72 -0
- package/dist/server/lib/onboarding-steps.js.map +1 -0
- package/dist/server/lib/provider-api.d.ts +29 -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 +194 -0
- package/dist/server/lib/thread-debug-store.d.ts.map +1 -0
- package/dist/server/lib/thread-debug-store.js +849 -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 +113 -0
- package/dist/server/lib/usage-metrics-store.d.ts.map +1 -0
- package/dist/server/lib/usage-metrics-store.js +580 -0
- package/dist/server/lib/usage-metrics-store.js.map +1 -0
- package/dist/server/lib/vault-boot-resync.d.ts +23 -0
- package/dist/server/lib/vault-boot-resync.d.ts.map +1 -0
- package/dist/server/lib/vault-boot-resync.js +44 -0
- package/dist/server/lib/vault-boot-resync.js.map +1 -0
- package/dist/server/lib/vault-store.d.ts +381 -0
- package/dist/server/lib/vault-store.d.ts.map +1 -0
- package/dist/server/lib/vault-store.js +1106 -0
- package/dist/server/lib/vault-store.js.map +1 -0
- package/dist/server/lib/workspace-app-action-auth.d.ts +9 -0
- package/dist/server/lib/workspace-app-action-auth.d.ts.map +1 -0
- package/dist/server/lib/workspace-app-action-auth.js +102 -0
- package/dist/server/lib/workspace-app-action-auth.js.map +1 -0
- package/dist/server/lib/workspace-app-chat-proxy.d.ts +52 -0
- package/dist/server/lib/workspace-app-chat-proxy.d.ts.map +1 -0
- package/dist/server/lib/workspace-app-chat-proxy.js +306 -0
- package/dist/server/lib/workspace-app-chat-proxy.js.map +1 -0
- package/dist/server/lib/workspace-resources-store.d.ts +372 -0
- package/dist/server/lib/workspace-resources-store.d.ts.map +1 -0
- package/dist/server/lib/workspace-resources-store.js +1000 -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 +94 -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 +31 -0
- package/dist/server/plugins/auth.js.map +1 -0
- package/dist/server/plugins/core-routes.d.ts +4 -0
- package/dist/server/plugins/core-routes.d.ts.map +1 -0
- package/dist/server/plugins/core-routes.js +18 -0
- package/dist/server/plugins/core-routes.js.map +1 -0
- package/dist/server/plugins/db.d.ts +11 -0
- package/dist/server/plugins/db.d.ts.map +1 -0
- package/dist/server/plugins/db.js +18 -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 +72 -0
- package/dist/server/plugins/integrations.js.map +1 -0
- package/dist/shared/app-roles.d.ts +9 -0
- package/dist/shared/app-roles.d.ts.map +1 -0
- package/dist/shared/app-roles.js +7 -0
- package/dist/shared/app-roles.js.map +1 -0
- package/dist/shared/chat-first-pane.d.ts +8 -0
- package/dist/shared/chat-first-pane.d.ts.map +1 -0
- package/dist/shared/chat-first-pane.js +8 -0
- package/dist/shared/chat-first-pane.js.map +1 -0
- package/dist/shared/feature-flags.d.ts +8 -0
- package/dist/shared/feature-flags.d.ts.map +1 -0
- package/dist/shared/feature-flags.js +17 -0
- package/dist/shared/feature-flags.js.map +1 -0
- package/dist/shared/workspace-app-chat.d.ts +23 -0
- package/dist/shared/workspace-app-chat.d.ts.map +1 -0
- package/dist/shared/workspace-app-chat.js +45 -0
- package/dist/shared/workspace-app-chat.js.map +1 -0
- package/dist/shared/workspace-sso.d.ts +48 -0
- package/dist/shared/workspace-sso.d.ts.map +1 -0
- package/dist/shared/workspace-sso.js +142 -0
- package/dist/shared/workspace-sso.js.map +1 -0
- package/package.json +118 -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 +26 -0
- package/src/actions/ask_app_status.ts +16 -0
- package/src/actions/connect-external-agent.ts +92 -0
- package/src/actions/create-browser-chat-session.spec.ts +122 -0
- package/src/actions/create-browser-chat-session.ts +99 -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 +37 -0
- package/src/actions/create_embed_session.ts +30 -0
- package/src/actions/create_workspace_app_embed_session.spec.ts +122 -0
- package/src/actions/create_workspace_app_embed_session.ts +102 -0
- package/src/actions/delete-destination.ts +12 -0
- package/src/actions/delete-staged-dataset.ts +10 -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 +41 -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/import-agent-pack.ts +146 -0
- package/src/actions/import-agent.ts +102 -0
- package/src/actions/index.spec.ts +59 -0
- package/src/actions/index.ts +210 -0
- package/src/actions/list-agent-pack.ts +43 -0
- package/src/actions/list-agent-run-failures.ts +50 -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.spec.ts +73 -0
- package/src/actions/list-connected-agents.ts +112 -0
- package/src/actions/list-curated-workspace-templates.spec.ts +36 -0
- package/src/actions/list-curated-workspace-templates.ts +12 -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 +30 -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 +10 -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 +14 -0
- package/src/actions/list-vault-secrets.ts +27 -0
- package/src/actions/list-workspace-apps.ts +33 -0
- package/src/actions/list-workspace-resource-grants.ts +15 -0
- package/src/actions/list-workspace-resource-options.ts +24 -0
- package/src/actions/list-workspace-resources-for-app.ts +14 -0
- package/src/actions/list-workspace-resources.ts +24 -0
- package/src/actions/list_apps.spec.ts +52 -0
- package/src/actions/list_apps.ts +36 -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-audit.spec.ts +51 -0
- package/src/actions/provider-api-catalog.ts +14 -0
- package/src/actions/provider-api-docs.ts +24 -0
- package/src/actions/provider-api-register.spec.ts +193 -0
- package/src/actions/provider-api-register.ts +35 -0
- package/src/actions/provider-api-request.ts +28 -0
- package/src/actions/query-staged-dataset.ts +10 -0
- package/src/actions/read-slack-thread-context.spec.ts +134 -0
- package/src/actions/read-slack-thread-context.ts +171 -0
- package/src/actions/reject-dispatch-change.ts +13 -0
- package/src/actions/reject-dream-proposal.ts +13 -0
- package/src/actions/remix-workspace-template.spec.ts +145 -0
- package/src/actions/remix-workspace-template.ts +106 -0
- package/src/actions/remove-pending-workspace-app.ts +17 -0
- package/src/actions/request-vault-secret.ts +17 -0
- package/src/actions/resolve-integration-source-context.spec.ts +78 -0
- package/src/actions/resolve-integration-source-context.ts +37 -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 +57 -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.spec.ts +129 -0
- package/src/actions/send-platform-message.ts +150 -0
- package/src/actions/set-app-creation-settings.ts +22 -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.spec.ts +73 -0
- package/src/actions/set-mcp-app-access.ts +56 -0
- package/src/actions/set-vault-access-settings.ts +17 -0
- package/src/actions/start-workspace-app-creation.ts +55 -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.spec.ts +212 -0
- package/src/actions/view-screen.ts +398 -0
- package/src/client/transactional-emails.spec.ts +91 -0
- package/src/client/transactional-emails.ts +201 -0
- package/src/components/action-query-error.spec.tsx +56 -0
- package/src/components/action-query-error.tsx +32 -0
- package/src/components/admin-navigation.tsx +329 -0
- package/src/components/agents-panel.tsx +383 -0
- package/src/components/app-icon.spec.tsx +44 -0
- package/src/components/app-icon.tsx +177 -0
- package/src/components/app-keys-popover.spec.tsx +146 -0
- package/src/components/app-keys-popover.tsx +300 -0
- package/src/components/app-list-row.tsx +40 -0
- package/src/components/app-open-actions.tsx +5 -0
- package/src/components/app-row-settings.tsx +54 -0
- package/src/components/approval-value-block.spec.tsx +60 -0
- package/src/components/approval-value-block.tsx +33 -0
- package/src/components/automation-run-history-dialog.tsx +247 -0
- package/src/components/connected-app-card.tsx +39 -0
- package/src/components/create-app-popover.spec.tsx +376 -0
- package/src/components/create-app-popover.tsx +677 -0
- package/src/components/dispatch-control-plane.spec.tsx +344 -0
- package/src/components/dispatch-control-plane.tsx +416 -0
- package/src/components/dispatch-shell.tsx +59 -0
- package/src/components/docs-link.tsx +52 -0
- package/src/components/index.ts +21 -0
- package/src/components/layout/Header.tsx +100 -0
- package/src/components/layout/HeaderActions.tsx +1 -0
- package/src/components/layout/Layout.app-chat.spec.ts +31 -0
- package/src/components/layout/Layout.spec.tsx +549 -0
- package/src/components/layout/Layout.tsx +2532 -0
- package/src/components/layout/workspace-apps-rail.tsx +132 -0
- package/src/components/messaging-setup-panel.spec.tsx +261 -0
- package/src/components/messaging-setup-panel.tsx +1131 -0
- package/src/components/other-apps-section.tsx +223 -0
- package/src/components/simple-agents-panel.spec.tsx +153 -0
- package/src/components/simple-agents-panel.tsx +1311 -0
- package/src/components/task-queue-health.tsx +175 -0
- package/src/components/transactional-email-activity.tsx +102 -0
- package/src/components/transactional-email-metrics.tsx +127 -0
- package/src/components/transactional-email-preview.tsx +88 -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 +56 -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 +1 -0
- package/src/components/ui/drawer.tsx +128 -0
- package/src/components/ui/dropdown-menu.tsx +1 -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 +31 -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 +1 -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/usage-alerts-panel.tsx +445 -0
- package/src/components/workspace-app-card.spec.tsx +408 -0
- package/src/components/workspace-app-card.tsx +711 -0
- package/src/components/workspace-app-chat-rail.spec.tsx +182 -0
- package/src/components/workspace-app-host.spec.tsx +688 -0
- package/src/components/workspace-app-host.tsx +756 -0
- package/src/components/workspace-app-search.tsx +96 -0
- package/src/components/workspace-resource-effective-stack.spec.tsx +126 -0
- package/src/components/workspace-resource-effective-stack.tsx +159 -0
- package/src/components/workspace-resource-impact-preview.spec.tsx +148 -0
- package/src/components/workspace-resource-impact-preview.tsx +128 -0
- package/src/components/workspace-template-card.spec.tsx +228 -0
- package/src/components/workspace-template-card.tsx +363 -0
- package/src/config.ts +42 -0
- package/src/db/index.ts +40 -0
- package/src/db/migrations.spec.ts +84 -0
- package/src/db/migrations.ts +251 -0
- package/src/db/schema.ts +209 -0
- package/src/hooks/use-mobile.tsx +1 -0
- package/src/hooks/use-navigation-state.spec.ts +166 -0
- package/src/hooks/use-navigation-state.ts +400 -0
- package/src/hooks/use-toast.ts +188 -0
- package/src/index.ts +19 -0
- package/src/lib/agent-pack.spec.ts +47 -0
- package/src/lib/agent-pack.ts +226 -0
- package/src/lib/automation-display.spec.ts +149 -0
- package/src/lib/automation-display.ts +108 -0
- package/src/lib/automations.spec.ts +64 -0
- package/src/lib/automations.ts +66 -0
- package/src/lib/browser-chat-bridge.spec.ts +151 -0
- package/src/lib/browser-chat-bridge.ts +79 -0
- package/src/lib/browser-chat-protocol.spec.ts +113 -0
- package/src/lib/browser-chat-protocol.ts +124 -0
- package/src/lib/catch-all-target.spec.ts +156 -0
- package/src/lib/catch-all-target.ts +125 -0
- package/src/lib/embed-session-recovery.spec.ts +63 -0
- package/src/lib/embed-session-recovery.ts +26 -0
- package/src/lib/other-apps.spec.ts +133 -0
- package/src/lib/other-apps.ts +57 -0
- package/src/lib/overview-chat.spec.ts +51 -0
- package/src/lib/overview-chat.ts +29 -0
- package/src/lib/simple-agent-profile.spec.ts +77 -0
- package/src/lib/simple-agent-profile.ts +247 -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-app-layout.spec.ts +47 -0
- package/src/lib/workspace-app-layout.ts +121 -0
- package/src/lib/workspace-apps.spec.ts +175 -0
- package/src/lib/workspace-apps.test.ts +151 -0
- package/src/lib/workspace-apps.ts +306 -0
- package/src/routes/index.spec.ts +39 -0
- package/src/routes/index.ts +95 -0
- package/src/routes/pages/$appId.spec.tsx +115 -0
- package/src/routes/pages/$appId.tsx +240 -0
- package/src/routes/pages/_index.test.ts +34 -0
- package/src/routes/pages/_index.tsx +65 -0
- package/src/routes/pages/admin._index.tsx +107 -0
- package/src/routes/pages/admin.tsx +15 -0
- package/src/routes/pages/agent-integrations.tsx +24 -0
- package/src/routes/pages/agents.tsx +251 -0
- package/src/routes/pages/approval.tsx +301 -0
- package/src/routes/pages/approvals.tsx +198 -0
- package/src/routes/pages/apps.$appId.spec.tsx +66 -0
- package/src/routes/pages/apps.$appId.tsx +22 -0
- package/src/routes/pages/apps.tsx +431 -0
- package/src/routes/pages/audit.tsx +71 -0
- package/src/routes/pages/automations.tsx +363 -0
- package/src/routes/pages/browser-chat.spec.tsx +121 -0
- package/src/routes/pages/browser-chat.tsx +89 -0
- package/src/routes/pages/browser-connect.spec.tsx +137 -0
- package/src/routes/pages/browser-connect.tsx +143 -0
- package/src/routes/pages/chat.spec.tsx +183 -0
- package/src/routes/pages/chat.tsx +335 -0
- package/src/routes/pages/destinations.tsx +309 -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 +1812 -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 +106 -0
- package/src/routes/pages/integrations.tsx +541 -0
- package/src/routes/pages/messaging.tsx +17 -0
- package/src/routes/pages/metrics.tsx +1135 -0
- package/src/routes/pages/new-app.tsx +20 -0
- package/src/routes/pages/operations.tsx +132 -0
- package/src/routes/pages/overview.tsx +22 -0
- package/src/routes/pages/settings.tsx +196 -0
- package/src/routes/pages/team.tsx +9 -0
- package/src/routes/pages/thread-debug.spec.tsx +370 -0
- package/src/routes/pages/thread-debug.tsx +1923 -0
- package/src/routes/pages/tools.$id.tsx +9 -0
- package/src/routes/pages/tools._index.tsx +9 -0
- package/src/routes/pages/transactional-email.$appId.$id.tsx +369 -0
- package/src/routes/pages/transactional-email.tsx +575 -0
- package/src/routes/pages/vault.tsx +978 -0
- package/src/routes/pages/workspace.tsx +1213 -0
- package/src/server/index.ts +86 -0
- package/src/server/lib/agent-pack-store.ts +35 -0
- package/src/server/lib/app-creation-store.spec.ts +1018 -0
- package/src/server/lib/app-creation-store.ts +2567 -0
- package/src/server/lib/approval-fencing.spec.ts +489 -0
- package/src/server/lib/browser-extension-allowlist.spec.ts +76 -0
- package/src/server/lib/browser-extension-allowlist.ts +58 -0
- package/src/server/lib/curated-workspace-templates.spec.ts +56 -0
- package/src/server/lib/curated-workspace-templates.ts +187 -0
- package/src/server/lib/dispatch-integrations.spec.ts +428 -0
- package/src/server/lib/dispatch-integrations.ts +528 -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-routing.spec.ts +44 -0
- package/src/server/lib/dispatch-routing.ts +42 -0
- package/src/server/lib/dispatch-store.ts +1008 -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 +99 -0
- package/src/server/lib/mcp-access-store.spec.ts +171 -0
- package/src/server/lib/mcp-access-store.ts +138 -0
- package/src/server/lib/mcp-gateway.spec.ts +1583 -0
- package/src/server/lib/mcp-gateway.ts +1388 -0
- package/src/server/lib/onboarding-steps.ts +82 -0
- package/src/server/lib/provider-api.ts +69 -0
- package/src/server/lib/thread-debug-store.spec.ts +439 -0
- package/src/server/lib/thread-debug-store.ts +1170 -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 +240 -0
- package/src/server/lib/usage-metrics-store.ts +879 -0
- package/src/server/lib/vault-boot-resync.spec.ts +68 -0
- package/src/server/lib/vault-boot-resync.ts +50 -0
- package/src/server/lib/vault-store.spec.ts +541 -0
- package/src/server/lib/vault-store.ts +1540 -0
- package/src/server/lib/workspace-app-action-auth.spec.ts +212 -0
- package/src/server/lib/workspace-app-action-auth.ts +122 -0
- package/src/server/lib/workspace-app-chat-proxy.spec.ts +322 -0
- package/src/server/lib/workspace-app-chat-proxy.ts +389 -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 +1403 -0
- package/src/server/plugins/agent-chat.spec.ts +43 -0
- package/src/server/plugins/agent-chat.ts +99 -0
- package/src/server/plugins/auth.spec.ts +45 -0
- package/src/server/plugins/auth.ts +36 -0
- package/src/server/plugins/core-routes.ts +29 -0
- package/src/server/plugins/db.ts +20 -0
- package/src/server/plugins/integrations.ts +82 -0
- package/src/shared/app-roles.ts +8 -0
- package/src/shared/chat-first-pane.ts +7 -0
- package/src/shared/feature-flags.ts +20 -0
- package/src/shared/workspace-app-chat.ts +45 -0
- package/src/shared/workspace-sso.ts +173 -0
- package/src/styles/dispatch-css.spec.ts +87 -0
- package/src/styles/dispatch.css +146 -0
|
@@ -0,0 +1,2532 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CHAT_FIRST_MODE_CHANGED_EVENT,
|
|
3
|
+
AgentChatSurface,
|
|
4
|
+
chatFirstSurfaceTabId,
|
|
5
|
+
AgentSidebar,
|
|
6
|
+
ChatFirstSurfacePanelToggle,
|
|
7
|
+
closeChatFirstSessionWatch,
|
|
8
|
+
emitChatFirstSessionWatch,
|
|
9
|
+
getChatFirstSurfaceTabsStore,
|
|
10
|
+
focusAgentChat,
|
|
11
|
+
navigateWithAgentChatViewTransition,
|
|
12
|
+
readChatFirstAppLayout,
|
|
13
|
+
readChatFirstMode,
|
|
14
|
+
resolveChatFirstBrowserTarget,
|
|
15
|
+
resolveChatFirstAppTarget,
|
|
16
|
+
subscribeChatFirstOpenBrowser,
|
|
17
|
+
subscribeChatFirstOpenApp,
|
|
18
|
+
writeChatFirstAppLayout,
|
|
19
|
+
useChatFirstSessionWatch,
|
|
20
|
+
useChatFirstSurfacePanel,
|
|
21
|
+
useChatFirstSurfaceResize,
|
|
22
|
+
useChatFirstSurfaceTabs,
|
|
23
|
+
type ChatFirstAppRegistration,
|
|
24
|
+
type ChatFirstAppLayoutPreference,
|
|
25
|
+
type ChatFirstAppResolution,
|
|
26
|
+
type ChatFirstAppSurfacePlacement,
|
|
27
|
+
type ChatFirstOpenBrowserDetail,
|
|
28
|
+
type ChatFirstOpenAppDetail,
|
|
29
|
+
type ChatFirstSessionReference,
|
|
30
|
+
type ChatFirstSurfaceTab,
|
|
31
|
+
type ChatFirstSurfaceKind,
|
|
32
|
+
useAgentChatHomeHandoff,
|
|
33
|
+
useAgentChatHomeHandoffLinks,
|
|
34
|
+
useChatThreads,
|
|
35
|
+
type ChatThreadSummary,
|
|
36
|
+
} from "@agent-native/core/client/agent-chat";
|
|
37
|
+
import { appBasePath, appPath } from "@agent-native/core/client/api-path";
|
|
38
|
+
import {
|
|
39
|
+
readClientAppState,
|
|
40
|
+
writeClientAppState,
|
|
41
|
+
} from "@agent-native/core/client/application-state";
|
|
42
|
+
import {
|
|
43
|
+
ChatFirstAgentsPane,
|
|
44
|
+
ChatFirstAppPane,
|
|
45
|
+
ChatFirstAppsRail,
|
|
46
|
+
ChatFirstBrowserPane,
|
|
47
|
+
ChatFirstChatHistory,
|
|
48
|
+
ChatFirstPrimaryNavigation,
|
|
49
|
+
ChatFirstSessionWatchPane,
|
|
50
|
+
ChatFirstSurfacePanel,
|
|
51
|
+
ChatFirstSurfaceContent,
|
|
52
|
+
ChatFirstSurfaceTabs,
|
|
53
|
+
defaultChatFirstCopy,
|
|
54
|
+
type ChatFirstAgentActivity,
|
|
55
|
+
type ChatFirstAppItem,
|
|
56
|
+
type ChatFirstCopy,
|
|
57
|
+
type ChatFirstEmbedTarget,
|
|
58
|
+
type ChatFirstPrimaryTab,
|
|
59
|
+
} from "@agent-native/core/client/chat-first";
|
|
60
|
+
import { writeClipboardText } from "@agent-native/core/client/clipboard";
|
|
61
|
+
import {
|
|
62
|
+
useActionMutation,
|
|
63
|
+
useActionQuery,
|
|
64
|
+
} from "@agent-native/core/client/hooks";
|
|
65
|
+
import { useT } from "@agent-native/core/client/i18n";
|
|
66
|
+
import { openCommandMenu } from "@agent-native/core/client/navigation";
|
|
67
|
+
import { InvitationBanner, OrgSwitcher } from "@agent-native/core/client/org";
|
|
68
|
+
import { FeedbackButton } from "@agent-native/core/client/ui";
|
|
69
|
+
import { SidebarFooterActions } from "@agent-native/toolkit/app-shell";
|
|
70
|
+
import {
|
|
71
|
+
ChatHistoryRail,
|
|
72
|
+
type ChatHistoryItem,
|
|
73
|
+
} from "@agent-native/toolkit/chat-history";
|
|
74
|
+
import {
|
|
75
|
+
IconApps,
|
|
76
|
+
IconBrandSlack,
|
|
77
|
+
IconBrandTelegram,
|
|
78
|
+
IconCopy,
|
|
79
|
+
IconEye,
|
|
80
|
+
IconHierarchy2,
|
|
81
|
+
IconMessageQuestion,
|
|
82
|
+
IconBroadcast,
|
|
83
|
+
IconLayoutSidebarLeftCollapse,
|
|
84
|
+
IconLayoutSidebarLeftExpand,
|
|
85
|
+
IconSettings,
|
|
86
|
+
IconShield,
|
|
87
|
+
IconSearch,
|
|
88
|
+
IconWorld,
|
|
89
|
+
IconDeviceDesktop,
|
|
90
|
+
IconPlus,
|
|
91
|
+
} from "@tabler/icons-react";
|
|
92
|
+
import {
|
|
93
|
+
createContext,
|
|
94
|
+
useEffect,
|
|
95
|
+
useMemo,
|
|
96
|
+
useRef,
|
|
97
|
+
useState,
|
|
98
|
+
useContext,
|
|
99
|
+
useCallback,
|
|
100
|
+
type ComponentType,
|
|
101
|
+
type ReactNode,
|
|
102
|
+
} from "react";
|
|
103
|
+
import { Link, useLocation, useNavigate } from "react-router";
|
|
104
|
+
import { toast } from "sonner";
|
|
105
|
+
|
|
106
|
+
import { cn } from "../../lib/utils";
|
|
107
|
+
import {
|
|
108
|
+
isDispatchWorkspaceAppId,
|
|
109
|
+
isPathMountedWorkspaceApp,
|
|
110
|
+
isWorkspaceAppVisibleInDefaultLaunchers,
|
|
111
|
+
isWorkspaceSsoApp,
|
|
112
|
+
mergeChatFirstWorkspaceApps,
|
|
113
|
+
navigateToWorkspaceApp,
|
|
114
|
+
workspaceAppIdFromRoute,
|
|
115
|
+
workspaceAppDirectHref,
|
|
116
|
+
workspaceAppRoute,
|
|
117
|
+
type WorkspaceAppSummary,
|
|
118
|
+
} from "../../lib/workspace-apps";
|
|
119
|
+
import { CHAT_FIRST_PANE_STATE_KEY } from "../../shared/chat-first-pane";
|
|
120
|
+
import { AppIcon } from "../app-icon";
|
|
121
|
+
import { CreateAppPopover } from "../create-app-popover";
|
|
122
|
+
import {
|
|
123
|
+
DropdownMenu,
|
|
124
|
+
DropdownMenuContent,
|
|
125
|
+
DropdownMenuItem,
|
|
126
|
+
DropdownMenuTrigger,
|
|
127
|
+
} from "../ui/dropdown-menu";
|
|
128
|
+
import { Sheet, SheetContent, SheetDescription, SheetTitle } from "../ui/sheet";
|
|
129
|
+
import { Skeleton } from "../ui/skeleton";
|
|
130
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip";
|
|
131
|
+
import {
|
|
132
|
+
WorkspaceAppChatRail,
|
|
133
|
+
WorkspaceAppFrame,
|
|
134
|
+
WorkspaceAppKeepAlive,
|
|
135
|
+
} from "../workspace-app-host";
|
|
136
|
+
import { Header } from "./Header";
|
|
137
|
+
import { HeaderActionsProvider } from "./HeaderActions";
|
|
138
|
+
|
|
139
|
+
export { buildChatFirstEmbedSessionInput } from "../workspace-app-host";
|
|
140
|
+
|
|
141
|
+
export type DispatchNavSection = "primary" | "operations";
|
|
142
|
+
|
|
143
|
+
export type DispatchNavIcon = ComponentType<{
|
|
144
|
+
size?: number | string;
|
|
145
|
+
className?: string;
|
|
146
|
+
}>;
|
|
147
|
+
|
|
148
|
+
export interface DispatchNavItem {
|
|
149
|
+
/** Stable id used for keys and navigation.view. Avoid built-in ids. */
|
|
150
|
+
id: string;
|
|
151
|
+
/** React Router path for the tab, usually backed by an app/routes/*.tsx file. */
|
|
152
|
+
to: string;
|
|
153
|
+
label: string;
|
|
154
|
+
icon?: DispatchNavIcon;
|
|
155
|
+
/** Defaults to "operations", which renders under the Admin control plane. */
|
|
156
|
+
section?: DispatchNavSection;
|
|
157
|
+
/** Override active matching for nested or multi-route tools. */
|
|
158
|
+
match?: (pathname: string) => boolean;
|
|
159
|
+
/** Canonical path inside the Admin shell for management tabs. */
|
|
160
|
+
adminTo?: string;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface DispatchExtensionConfig {
|
|
164
|
+
/** Opt into the Codex/T3-like chat-first shell for chat routes. */
|
|
165
|
+
chatFirst?: boolean;
|
|
166
|
+
/** Extra sidebar tabs supplied by the generated workspace. */
|
|
167
|
+
navItems?: readonly DispatchNavItem[];
|
|
168
|
+
/** Extra React Query keys to invalidate when Dispatch receives DB sync events. */
|
|
169
|
+
queryKeys?: readonly string[];
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const PRIMARY_NAV_ITEMS = [
|
|
173
|
+
{
|
|
174
|
+
id: "overview",
|
|
175
|
+
to: "/overview",
|
|
176
|
+
label: "Overview",
|
|
177
|
+
icon: IconBroadcast,
|
|
178
|
+
section: "primary",
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
id: "chat",
|
|
182
|
+
to: "/chat",
|
|
183
|
+
label: "Chat",
|
|
184
|
+
icon: IconMessageQuestion,
|
|
185
|
+
section: "primary",
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
id: "apps",
|
|
189
|
+
to: "/apps",
|
|
190
|
+
label: "Apps",
|
|
191
|
+
icon: IconApps,
|
|
192
|
+
section: "primary",
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
id: "agents",
|
|
196
|
+
to: "/agents",
|
|
197
|
+
label: "Agents",
|
|
198
|
+
icon: IconHierarchy2,
|
|
199
|
+
section: "primary",
|
|
200
|
+
},
|
|
201
|
+
] as const satisfies readonly DispatchNavItem[];
|
|
202
|
+
|
|
203
|
+
const BOTTOM_NAV_ITEMS = [
|
|
204
|
+
{
|
|
205
|
+
id: "admin",
|
|
206
|
+
to: "/admin",
|
|
207
|
+
label: "Admin",
|
|
208
|
+
icon: IconShield,
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
id: "settings",
|
|
212
|
+
to: "/settings",
|
|
213
|
+
label: "Settings",
|
|
214
|
+
icon: IconSettings,
|
|
215
|
+
},
|
|
216
|
+
] as const satisfies readonly DispatchNavItem[];
|
|
217
|
+
|
|
218
|
+
const EMPTY_NAV_ITEMS: readonly DispatchNavItem[] = [];
|
|
219
|
+
const DISPATCH_SIDEBAR_LABEL = "Dispatch";
|
|
220
|
+
|
|
221
|
+
const CHROMELESS_PATHS = ["/approval", "/browser-chat", "/browser-connect"];
|
|
222
|
+
const SIDEBAR_COLLAPSE_KEY = "dispatch.sidebar.collapsed";
|
|
223
|
+
const CHAT_HISTORY_SOURCE_KEY = "dispatch.chat-history.source";
|
|
224
|
+
|
|
225
|
+
interface DispatchChatFirstPane {
|
|
226
|
+
appId: string;
|
|
227
|
+
placement?: ChatFirstAppSurfacePlacement;
|
|
228
|
+
path?: string;
|
|
229
|
+
view?: string;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
interface ChatFirstGrantedAppSummary {
|
|
233
|
+
id: string;
|
|
234
|
+
name: string;
|
|
235
|
+
url?: string | null;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
interface ChatFirstGrantedAppsResult {
|
|
239
|
+
apps: ChatFirstGrantedAppSummary[];
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
interface DispatchAgentThreadSummary {
|
|
243
|
+
id: string;
|
|
244
|
+
title: string;
|
|
245
|
+
preview?: string;
|
|
246
|
+
snippet?: string;
|
|
247
|
+
updatedAt?: number;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
interface SearchAgentThreadsResult {
|
|
251
|
+
threads: DispatchAgentThreadSummary[];
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const DispatchExtensionsContext = createContext<
|
|
255
|
+
DispatchExtensionConfig | undefined
|
|
256
|
+
>(undefined);
|
|
257
|
+
|
|
258
|
+
export function useDispatchExtensions(): DispatchExtensionConfig | undefined {
|
|
259
|
+
return useContext(DispatchExtensionsContext);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// Routes whose page renders its own toolbar.
|
|
263
|
+
// Layout still mounts the sidebar + AgentSidebar, but skips its own Header so
|
|
264
|
+
// there's no double-header.
|
|
265
|
+
function pageOwnsToolbar(pathname: string): boolean {
|
|
266
|
+
if (pathname === "/tools" || pathname.startsWith("/tools/")) return true;
|
|
267
|
+
if (pathname === "/extensions" || pathname.startsWith("/extensions/"))
|
|
268
|
+
return true;
|
|
269
|
+
if (pathname.startsWith("/apps/")) return true;
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
function sectionFor(item: DispatchNavItem): DispatchNavSection {
|
|
274
|
+
return item.section ?? "operations";
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function navItemMatchesPath(item: DispatchNavItem, pathname: string): boolean {
|
|
278
|
+
if (item.match) {
|
|
279
|
+
try {
|
|
280
|
+
if (item.match(pathname)) return true;
|
|
281
|
+
} catch {
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return pathname === item.to || pathname.startsWith(`${item.to}/`);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function navItemsForSection(
|
|
289
|
+
items: readonly DispatchNavItem[],
|
|
290
|
+
section: DispatchNavSection,
|
|
291
|
+
): DispatchNavItem[] {
|
|
292
|
+
return items.filter((item) => sectionFor(item) === section);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
function localDispatchPath(pathname: string): string {
|
|
296
|
+
const basePath = appBasePath();
|
|
297
|
+
if (!basePath) return pathname;
|
|
298
|
+
if (pathname === basePath) return "/";
|
|
299
|
+
if (pathname.startsWith(`${basePath}/`)) {
|
|
300
|
+
return pathname.slice(basePath.length) || "/";
|
|
301
|
+
}
|
|
302
|
+
return pathname;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export function isElectronEmbeddedSearch(search: string): boolean {
|
|
306
|
+
return new URLSearchParams(search).get("electron") === "1";
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export function shouldAutoCollapseDispatchSidebar(pathname: string): boolean {
|
|
310
|
+
return localDispatchPath(pathname).startsWith("/apps/");
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
function chatFirstPrimaryTabForPath(
|
|
314
|
+
pathname: string,
|
|
315
|
+
): ChatFirstPrimaryTab | undefined {
|
|
316
|
+
if (pathname === "/chat" || pathname.startsWith("/chat/")) {
|
|
317
|
+
return "new-chat";
|
|
318
|
+
}
|
|
319
|
+
if (
|
|
320
|
+
pathname === "/integrations" ||
|
|
321
|
+
pathname.startsWith("/integrations/") ||
|
|
322
|
+
pathname === "/admin/integrations" ||
|
|
323
|
+
pathname.startsWith("/admin/integrations/")
|
|
324
|
+
) {
|
|
325
|
+
return "integrations";
|
|
326
|
+
}
|
|
327
|
+
if (
|
|
328
|
+
pathname === "/automations" ||
|
|
329
|
+
pathname.startsWith("/automations/") ||
|
|
330
|
+
pathname === "/admin/automations" ||
|
|
331
|
+
pathname.startsWith("/admin/automations/")
|
|
332
|
+
) {
|
|
333
|
+
return "scheduled";
|
|
334
|
+
}
|
|
335
|
+
return undefined;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function dispatchNavLinkTarget(path: string): string {
|
|
339
|
+
if (typeof window === "undefined") return path;
|
|
340
|
+
const basePath = appBasePath();
|
|
341
|
+
if (!basePath) return path;
|
|
342
|
+
// Mirror the basename calculation entry.client.tsx uses to configure the
|
|
343
|
+
// router (basePath iff the current URL is under that mount, "" otherwise).
|
|
344
|
+
// Reading the live URL directly avoids races with the previous check on
|
|
345
|
+
// `__reactRouterContext.basename`, which could read undefined before the
|
|
346
|
+
// entry script set it — that race produced /dispatch/dispatch/<route>
|
|
347
|
+
// history entries that 404'd on back-button navigation.
|
|
348
|
+
const pathname = window.location.pathname;
|
|
349
|
+
const routerHasBasename =
|
|
350
|
+
pathname === basePath || pathname.startsWith(`${basePath}/`);
|
|
351
|
+
return routerHasBasename ? path : appPath(path);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
function chatFirstResolutionMessage(
|
|
355
|
+
reason: Exclude<ChatFirstAppResolution, { status: "ready" }>["reason"],
|
|
356
|
+
): string {
|
|
357
|
+
switch (reason) {
|
|
358
|
+
case "empty-detail":
|
|
359
|
+
return "The agent did not provide an app target to open.";
|
|
360
|
+
case "invalid-url":
|
|
361
|
+
return "The requested app route was not registered for this workspace app.";
|
|
362
|
+
case "unknown-app":
|
|
363
|
+
return "That app is not available in this workspace.";
|
|
364
|
+
}
|
|
365
|
+
return "The requested app could not be opened.";
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function chatFirstBrowserResolutionMessage(
|
|
369
|
+
reason: "empty-detail" | "invalid-url",
|
|
370
|
+
): string {
|
|
371
|
+
return reason === "empty-detail"
|
|
372
|
+
? "The agent did not provide a browser URL to open."
|
|
373
|
+
: "The requested browser URL is not a safe HTTP(S) address.";
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const DISPATCH_CHAT_FIRST_COPY_KEYS: Record<string, string> = {
|
|
377
|
+
workspaceApps: "chatFirstWorkspaceApps",
|
|
378
|
+
createWorkspaceApp: "chatFirstCreateWorkspaceApp",
|
|
379
|
+
openApp: "chatFirstOpenApp",
|
|
380
|
+
appsLoadError: "chatFirstAppsLoadError",
|
|
381
|
+
noWorkspaceApps: "chatFirstNoWorkspaceApps",
|
|
382
|
+
createApp: "chatFirstCreateApp",
|
|
383
|
+
retry: "chatFirstRetry",
|
|
384
|
+
dismiss: "chatFirstDismiss",
|
|
385
|
+
unpinApp: "chatFirstUnpinApp",
|
|
386
|
+
pinApp: "chatFirstPinApp",
|
|
387
|
+
removePinned: "chatFirstRemovePinned",
|
|
388
|
+
pinTop: "chatFirstPinTop",
|
|
389
|
+
openSideSurfaces: "chatFirstOpenSideSurfaces",
|
|
390
|
+
closeTab: "chatFirstCloseTab",
|
|
391
|
+
close: "chatFirstClose",
|
|
392
|
+
closeOthers: "chatFirstCloseOthers",
|
|
393
|
+
closeToRight: "chatFirstCloseToRight",
|
|
394
|
+
closeAll: "chatFirstCloseAll",
|
|
395
|
+
unavailable: "chatFirstUnavailable",
|
|
396
|
+
openActivity: "chatFirstOpenActivity",
|
|
397
|
+
deferred: "chatFirstDeferred",
|
|
398
|
+
browserBack: "chatFirstBrowserBack",
|
|
399
|
+
browserForward: "chatFirstBrowserForward",
|
|
400
|
+
browserReload: "chatFirstBrowserReload",
|
|
401
|
+
browserAddress: "chatFirstBrowserAddress",
|
|
402
|
+
browserOpenExternal: "chatFirstBrowserOpenExternal",
|
|
403
|
+
browserClose: "chatFirstBrowserClose",
|
|
404
|
+
browserPage: "chatFirstBrowserPage",
|
|
405
|
+
browserInvalidUrl: "chatFirstBrowserInvalidUrl",
|
|
406
|
+
browserPreviewStarting: "chatFirstBrowserPreviewStarting",
|
|
407
|
+
browserPreviewError: "chatFirstBrowserPreviewError",
|
|
408
|
+
appUnavailable: "chatFirstAppUnavailable",
|
|
409
|
+
appLoading: "chatFirstLoadingApp",
|
|
410
|
+
agentActivityEyebrow: "chatFirstAgentActivityEyebrow",
|
|
411
|
+
agentActivityTitle: "chatFirstAgentActivityTitle",
|
|
412
|
+
agentActivityDescription: "chatFirstAgentActivityDescription",
|
|
413
|
+
refreshAgentActivity: "chatFirstRefreshAgentActivity",
|
|
414
|
+
noAgentSessions: "chatFirstNoAgentSessions",
|
|
415
|
+
startAgentSession: "chatFirstStartAgentSession",
|
|
416
|
+
watchSession: "chatFirstWatchSession",
|
|
417
|
+
copySessionId: "chatFirstCopySessionId",
|
|
418
|
+
copySessionIdFor: "chatFirstCopySessionIdFor",
|
|
419
|
+
sessionIdCopied: "chatFirstSessionIdCopied",
|
|
420
|
+
sessionIdShort: "chatFirstSessionIdShort",
|
|
421
|
+
copied: "chatFirstCopied",
|
|
422
|
+
agentActivityStatusQueued: "chatFirstAgentActivityStatusQueued",
|
|
423
|
+
agentActivityStatusRunning: "chatFirstAgentActivityStatusRunning",
|
|
424
|
+
agentActivityStatusPaused: "chatFirstAgentActivityStatusPaused",
|
|
425
|
+
agentActivityStatusNeedsApproval: "chatFirstAgentActivityStatusNeedsApproval",
|
|
426
|
+
agentActivityStatusCompleted: "chatFirstAgentActivityStatusCompleted",
|
|
427
|
+
agentActivityStatusErrored: "chatFirstAgentActivityStatusErrored",
|
|
428
|
+
agentActivityStatusRecent: "chatFirstAgentActivityStatusRecent",
|
|
429
|
+
agentActivityStatusUnknown: "chatFirstAgentActivityStatusUnknown",
|
|
430
|
+
watchingSession: "chatFirstWatchingSession",
|
|
431
|
+
session: "chatFirstSession",
|
|
432
|
+
stopWatchingSession: "chatFirstStopWatchingSession",
|
|
433
|
+
stopWatching: "chatFirstStopWatching",
|
|
434
|
+
watchedSession: "chatFirstWatchedSession",
|
|
435
|
+
agentsTitle: "chatFirstAgentsTitle",
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
const DISPATCH_CHAT_FIRST_SURFACE_COPY_KEYS: Record<
|
|
439
|
+
string,
|
|
440
|
+
{ label: string; reason: string }
|
|
441
|
+
> = {
|
|
442
|
+
browser: {
|
|
443
|
+
label: "chatFirstSurfaceBrowserLabel",
|
|
444
|
+
reason: "chatFirstSurfaceBrowserReason",
|
|
445
|
+
},
|
|
446
|
+
terminal: {
|
|
447
|
+
label: "chatFirstSurfaceTerminalLabel",
|
|
448
|
+
reason: "chatFirstSurfaceTerminalReason",
|
|
449
|
+
},
|
|
450
|
+
files: {
|
|
451
|
+
label: "chatFirstSurfaceFilesLabel",
|
|
452
|
+
reason: "chatFirstSurfaceFilesReason",
|
|
453
|
+
},
|
|
454
|
+
diff: {
|
|
455
|
+
label: "chatFirstSurfaceDiffLabel",
|
|
456
|
+
reason: "chatFirstSurfaceDiffReason",
|
|
457
|
+
},
|
|
458
|
+
"side-chat": {
|
|
459
|
+
label: "chatFirstSurfaceSideChatLabel",
|
|
460
|
+
reason: "chatFirstSurfaceSideChatReason",
|
|
461
|
+
},
|
|
462
|
+
agents: {
|
|
463
|
+
label: "chatFirstSurfaceAgentsLabel",
|
|
464
|
+
reason: "chatFirstSurfaceAgentsReason",
|
|
465
|
+
},
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
function createDispatchChatFirstCopy(
|
|
469
|
+
t: (key: string, options?: Record<string, unknown>) => string,
|
|
470
|
+
): ChatFirstCopy {
|
|
471
|
+
return (key, values) => {
|
|
472
|
+
if (key.startsWith("surface.")) {
|
|
473
|
+
const [, kind, field] = key.split(".");
|
|
474
|
+
const surface = DISPATCH_CHAT_FIRST_SURFACE_COPY_KEYS[kind];
|
|
475
|
+
const translationKey =
|
|
476
|
+
surface && (field === "label" || field === "reason")
|
|
477
|
+
? surface[field]
|
|
478
|
+
: undefined;
|
|
479
|
+
if (translationKey) {
|
|
480
|
+
return t(`dispatch.pages.${translationKey}`, {
|
|
481
|
+
...(values ?? {}),
|
|
482
|
+
defaultValue: defaultChatFirstCopy(key, values),
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
const translationKey = DISPATCH_CHAT_FIRST_COPY_KEYS[key];
|
|
487
|
+
if (!translationKey) return defaultChatFirstCopy(key, values);
|
|
488
|
+
return t(`dispatch.pages.${translationKey}`, {
|
|
489
|
+
...(values ?? {}),
|
|
490
|
+
defaultValue: defaultChatFirstCopy(key, values),
|
|
491
|
+
});
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
function chatThreadPath(threadId: string | null): string {
|
|
496
|
+
return threadId ? `/chat/${encodeURIComponent(threadId)}` : "/chat";
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
function persistedChatFirstPane(value: unknown): DispatchChatFirstPane | null {
|
|
500
|
+
if (!value || typeof value !== "object") return null;
|
|
501
|
+
const record = value as Record<string, unknown>;
|
|
502
|
+
if (typeof record.appId !== "string" || !record.appId.trim()) return null;
|
|
503
|
+
return {
|
|
504
|
+
appId: record.appId,
|
|
505
|
+
...(record.placement === "main" || record.placement === "side"
|
|
506
|
+
? { placement: record.placement }
|
|
507
|
+
: {}),
|
|
508
|
+
...(typeof record.path === "string" ? { path: record.path } : {}),
|
|
509
|
+
...(typeof record.view === "string" ? { view: record.view } : {}),
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
function threadIdFromPath(pathname: string): string | null {
|
|
514
|
+
const match = pathname.match(/^\/chat\/([^/]+)/);
|
|
515
|
+
if (!match) return null;
|
|
516
|
+
try {
|
|
517
|
+
const value = decodeURIComponent(match[1]).trim();
|
|
518
|
+
return value || null;
|
|
519
|
+
} catch {
|
|
520
|
+
return null;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
export function formatThreadAge(updatedAt: number, now = Date.now()) {
|
|
525
|
+
const diffMs = Math.max(0, now - updatedAt);
|
|
526
|
+
const minutes = Math.floor(diffMs / 60_000);
|
|
527
|
+
if (minutes < 1) return "now";
|
|
528
|
+
if (minutes < 60) return `${minutes}m`;
|
|
529
|
+
const hours = Math.floor(minutes / 60);
|
|
530
|
+
if (hours < 24) return `${hours}h`;
|
|
531
|
+
const days = Math.floor(hours / 24);
|
|
532
|
+
if (days < 14) return `${days}d`;
|
|
533
|
+
if (days < 365) return `${Math.floor(days / 7)}w`;
|
|
534
|
+
return `${Math.floor(days / 365)}y`;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
function threadTitle(thread: ChatThreadSummary, fallback: string) {
|
|
538
|
+
return thread.title || thread.preview || fallback;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
function threadSourceIcon(platform: string | undefined): ReactNode {
|
|
542
|
+
const normalized = platform?.trim().toLowerCase();
|
|
543
|
+
if (!normalized) return null;
|
|
544
|
+
if (normalized === "slack") {
|
|
545
|
+
return <IconBrandSlack size={13} aria-hidden="true" />;
|
|
546
|
+
}
|
|
547
|
+
if (normalized === "telegram") {
|
|
548
|
+
return <IconBrandTelegram size={13} aria-hidden="true" />;
|
|
549
|
+
}
|
|
550
|
+
return <IconWorld size={13} aria-hidden="true" />;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
function readChatHistoryIncludesExternal(): boolean {
|
|
554
|
+
if (typeof window === "undefined") return false;
|
|
555
|
+
try {
|
|
556
|
+
return localStorage.getItem(CHAT_HISTORY_SOURCE_KEY) === "all";
|
|
557
|
+
} catch {
|
|
558
|
+
// coercion-ok: localStorage is optional browser persistence.
|
|
559
|
+
return false;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
function threadUpdatedAt(thread: ChatThreadSummary) {
|
|
564
|
+
return Number.isFinite(thread.updatedAt)
|
|
565
|
+
? thread.updatedAt
|
|
566
|
+
: Number.isFinite(thread.createdAt)
|
|
567
|
+
? thread.createdAt
|
|
568
|
+
: 0;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
function DispatchChatsSection({
|
|
572
|
+
onNavigate,
|
|
573
|
+
showNewChat = false,
|
|
574
|
+
prelude,
|
|
575
|
+
chatFirstMode = false,
|
|
576
|
+
chatFirstEmbedded = false,
|
|
577
|
+
collapsed = false,
|
|
578
|
+
chatFirstNavigation,
|
|
579
|
+
}: {
|
|
580
|
+
onNavigate?: () => void;
|
|
581
|
+
showNewChat?: boolean;
|
|
582
|
+
prelude?: ReactNode;
|
|
583
|
+
chatFirstMode?: boolean;
|
|
584
|
+
chatFirstEmbedded?: boolean;
|
|
585
|
+
collapsed?: boolean;
|
|
586
|
+
chatFirstNavigation?: {
|
|
587
|
+
activeTab?: ChatFirstPrimaryTab;
|
|
588
|
+
onNewChat?: () => void;
|
|
589
|
+
onOpenIntegrations: () => void;
|
|
590
|
+
onOpenScheduled: () => void;
|
|
591
|
+
};
|
|
592
|
+
}) {
|
|
593
|
+
const t = useT();
|
|
594
|
+
const chatFirstCopy = useMemo(() => createDispatchChatFirstCopy(t), [t]);
|
|
595
|
+
const navigate = useNavigate();
|
|
596
|
+
const location = useLocation();
|
|
597
|
+
const [includeExternal, setIncludeExternal] = useState(false);
|
|
598
|
+
const [historyPreferenceReady, setHistoryPreferenceReady] = useState(false);
|
|
599
|
+
const historyModeRef = useRef(includeExternal);
|
|
600
|
+
const {
|
|
601
|
+
threads,
|
|
602
|
+
activeThreadId,
|
|
603
|
+
isLoading: chatsLoading,
|
|
604
|
+
threadsLoadError,
|
|
605
|
+
createThread,
|
|
606
|
+
switchThread,
|
|
607
|
+
renameThread,
|
|
608
|
+
refreshThreads,
|
|
609
|
+
} = useChatThreads(undefined, "dispatch", undefined, {
|
|
610
|
+
autoCreate: false,
|
|
611
|
+
includeExternal,
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
const visibleThreads = useMemo(
|
|
615
|
+
() =>
|
|
616
|
+
threads
|
|
617
|
+
.filter(
|
|
618
|
+
(thread) => thread.messageCount > 0 || thread.id === activeThreadId,
|
|
619
|
+
)
|
|
620
|
+
.sort((a, b) => threadUpdatedAt(b) - threadUpdatedAt(a))
|
|
621
|
+
.slice(0, 8),
|
|
622
|
+
[activeThreadId, threads],
|
|
623
|
+
);
|
|
624
|
+
const localPathname = localDispatchPath(location.pathname);
|
|
625
|
+
const displayedActiveThreadId =
|
|
626
|
+
threadIdFromPath(localPathname) ??
|
|
627
|
+
(localPathname === "/chat" ? null : activeThreadId);
|
|
628
|
+
const chatItems: ChatHistoryItem[] = visibleThreads.map((thread) => {
|
|
629
|
+
const title = threadTitle(thread, t("dispatch.sidebar.newChat"));
|
|
630
|
+
const sourceIcon = threadSourceIcon(thread.source?.platform);
|
|
631
|
+
const sourceLabel = thread.source?.platform
|
|
632
|
+
? thread.source.platform[0].toUpperCase() +
|
|
633
|
+
thread.source.platform.slice(1)
|
|
634
|
+
: null;
|
|
635
|
+
return {
|
|
636
|
+
id: thread.id,
|
|
637
|
+
title: (
|
|
638
|
+
<span
|
|
639
|
+
className="flex min-w-0 items-center gap-1"
|
|
640
|
+
title={sourceLabel ? `${sourceLabel}: ${title}` : title}
|
|
641
|
+
>
|
|
642
|
+
{sourceIcon ? (
|
|
643
|
+
<span
|
|
644
|
+
className="shrink-0 text-sidebar-foreground/55"
|
|
645
|
+
aria-label={sourceLabel ?? "Connected source"}
|
|
646
|
+
>
|
|
647
|
+
{sourceIcon}
|
|
648
|
+
</span>
|
|
649
|
+
) : null}
|
|
650
|
+
<span className="truncate">{title}</span>
|
|
651
|
+
</span>
|
|
652
|
+
),
|
|
653
|
+
titleText: title,
|
|
654
|
+
timestamp:
|
|
655
|
+
thread.id === displayedActiveThreadId
|
|
656
|
+
? ""
|
|
657
|
+
: formatThreadAge(threadUpdatedAt(thread)),
|
|
658
|
+
};
|
|
659
|
+
});
|
|
660
|
+
const chatHistoryError = threadsLoadError ? (
|
|
661
|
+
<button
|
|
662
|
+
type="button"
|
|
663
|
+
onClick={() => void refreshThreads()}
|
|
664
|
+
className="flex w-full items-center justify-between gap-2 rounded-md px-2 py-1.5 text-xs text-sidebar-foreground/65 transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"
|
|
665
|
+
>
|
|
666
|
+
<span>Could not load chats</span>
|
|
667
|
+
<span className="font-medium">Retry</span>
|
|
668
|
+
</button>
|
|
669
|
+
) : undefined;
|
|
670
|
+
|
|
671
|
+
useEffect(() => {
|
|
672
|
+
setIncludeExternal(readChatHistoryIncludesExternal());
|
|
673
|
+
setHistoryPreferenceReady(true);
|
|
674
|
+
}, []);
|
|
675
|
+
|
|
676
|
+
useEffect(() => {
|
|
677
|
+
if (!historyPreferenceReady) return;
|
|
678
|
+
try {
|
|
679
|
+
localStorage.setItem(
|
|
680
|
+
CHAT_HISTORY_SOURCE_KEY,
|
|
681
|
+
includeExternal ? "all" : "local",
|
|
682
|
+
);
|
|
683
|
+
} catch {} // coercion-ok: localStorage is optional browser persistence.
|
|
684
|
+
if (historyModeRef.current !== includeExternal) {
|
|
685
|
+
historyModeRef.current = includeExternal;
|
|
686
|
+
refreshThreads();
|
|
687
|
+
}
|
|
688
|
+
}, [historyPreferenceReady, includeExternal, refreshThreads]);
|
|
689
|
+
|
|
690
|
+
useEffect(() => {
|
|
691
|
+
const refresh = () => refreshThreads();
|
|
692
|
+
const handleRunning = (event: Event) => {
|
|
693
|
+
const detail = (event as CustomEvent).detail as
|
|
694
|
+
| { isRunning?: unknown }
|
|
695
|
+
| undefined;
|
|
696
|
+
if (detail?.isRunning === false) refreshThreads();
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
window.addEventListener("agent-chat:threads-updated", refresh);
|
|
700
|
+
window.addEventListener("agentNative.chatRunning", handleRunning);
|
|
701
|
+
window.addEventListener("focus", refresh);
|
|
702
|
+
return () => {
|
|
703
|
+
window.removeEventListener("agent-chat:threads-updated", refresh);
|
|
704
|
+
window.removeEventListener("agentNative.chatRunning", handleRunning);
|
|
705
|
+
window.removeEventListener("focus", refresh);
|
|
706
|
+
};
|
|
707
|
+
}, [refreshThreads]);
|
|
708
|
+
|
|
709
|
+
function openThread(threadId: string, options?: { isNew?: boolean }) {
|
|
710
|
+
switchThread(threadId);
|
|
711
|
+
navigateWithAgentChatViewTransition(
|
|
712
|
+
navigate,
|
|
713
|
+
dispatchNavLinkTarget(
|
|
714
|
+
options?.isNew ? "/chat" : chatThreadPath(threadId),
|
|
715
|
+
),
|
|
716
|
+
);
|
|
717
|
+
onNavigate?.();
|
|
718
|
+
window.requestAnimationFrame(() => {
|
|
719
|
+
window.dispatchEvent(
|
|
720
|
+
new CustomEvent("agent-chat:open-thread", {
|
|
721
|
+
detail: { threadId, newThread: options?.isNew === true },
|
|
722
|
+
}),
|
|
723
|
+
);
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
async function handleNewChat() {
|
|
728
|
+
const threadId = await createThread();
|
|
729
|
+
if (threadId) openThread(threadId, { isNew: true });
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
const collapsedChatFirst = collapsed && chatFirstMode;
|
|
733
|
+
|
|
734
|
+
return (
|
|
735
|
+
<div
|
|
736
|
+
className={cn(
|
|
737
|
+
"min-w-0 space-y-0.5",
|
|
738
|
+
showNewChat && "dispatch-chat-first-chats",
|
|
739
|
+
)}
|
|
740
|
+
>
|
|
741
|
+
{showNewChat && chatFirstNavigation ? (
|
|
742
|
+
<nav className={cn("space-y-0.5 py-2", collapsed ? "px-1.5" : "px-2")}>
|
|
743
|
+
<ChatFirstPrimaryNavigation
|
|
744
|
+
copy={chatFirstCopy}
|
|
745
|
+
onNewChat={() => {
|
|
746
|
+
chatFirstNavigation.onNewChat?.();
|
|
747
|
+
void handleNewChat();
|
|
748
|
+
}}
|
|
749
|
+
onOpenIntegrations={chatFirstNavigation.onOpenIntegrations}
|
|
750
|
+
onOpenScheduled={chatFirstNavigation.onOpenScheduled}
|
|
751
|
+
onSearch={openCommandMenu}
|
|
752
|
+
activeTab={chatFirstNavigation.activeTab}
|
|
753
|
+
collapsed={collapsed}
|
|
754
|
+
/>
|
|
755
|
+
</nav>
|
|
756
|
+
) : null}
|
|
757
|
+
{prelude}
|
|
758
|
+
{!collapsedChatFirst && !chatFirstMode ? (
|
|
759
|
+
<div className="flex justify-end px-2 pt-0.5">
|
|
760
|
+
<Tooltip>
|
|
761
|
+
<TooltipTrigger asChild>
|
|
762
|
+
<button
|
|
763
|
+
type="button"
|
|
764
|
+
data-dispatch-chat-source-toggle
|
|
765
|
+
aria-pressed={includeExternal}
|
|
766
|
+
aria-label={
|
|
767
|
+
includeExternal
|
|
768
|
+
? t("dispatch.sidebar.showLocalChats", {
|
|
769
|
+
defaultValue: "Show local chats",
|
|
770
|
+
})
|
|
771
|
+
: t("dispatch.sidebar.showAllChats", {
|
|
772
|
+
defaultValue: "Show all chats",
|
|
773
|
+
})
|
|
774
|
+
}
|
|
775
|
+
onClick={() => setIncludeExternal((current) => !current)}
|
|
776
|
+
className="flex size-6 items-center justify-center rounded-md text-sidebar-foreground/55 transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"
|
|
777
|
+
>
|
|
778
|
+
{includeExternal ? (
|
|
779
|
+
<IconWorld size={14} aria-hidden="true" />
|
|
780
|
+
) : (
|
|
781
|
+
<IconDeviceDesktop size={14} aria-hidden="true" />
|
|
782
|
+
)}
|
|
783
|
+
</button>
|
|
784
|
+
</TooltipTrigger>
|
|
785
|
+
<TooltipContent side="right">
|
|
786
|
+
{includeExternal
|
|
787
|
+
? t("dispatch.sidebar.showLocalChats", {
|
|
788
|
+
defaultValue: "Show local chats",
|
|
789
|
+
})
|
|
790
|
+
: t("dispatch.sidebar.showAllChats", {
|
|
791
|
+
defaultValue: "Show all chats",
|
|
792
|
+
})}
|
|
793
|
+
</TooltipContent>
|
|
794
|
+
</Tooltip>
|
|
795
|
+
</div>
|
|
796
|
+
) : null}
|
|
797
|
+
{!collapsedChatFirst &&
|
|
798
|
+
!chatFirstMode &&
|
|
799
|
+
chatsLoading &&
|
|
800
|
+
visibleThreads.length === 0 &&
|
|
801
|
+
Array.from({ length: 3 }).map((_, index) => (
|
|
802
|
+
<div
|
|
803
|
+
key={`chat-skeleton-${index}`}
|
|
804
|
+
className="flex items-center gap-2 px-3 py-1"
|
|
805
|
+
>
|
|
806
|
+
<Skeleton className="size-3.5 shrink-0 rounded-sm" />
|
|
807
|
+
<Skeleton className="h-3 w-3/4 rounded" />
|
|
808
|
+
</div>
|
|
809
|
+
))}
|
|
810
|
+
{!collapsedChatFirst &&
|
|
811
|
+
chatFirstMode &&
|
|
812
|
+
(chatsLoading || visibleThreads.length > 0) ? (
|
|
813
|
+
<ChatFirstChatHistory
|
|
814
|
+
items={chatItems}
|
|
815
|
+
activeId={displayedActiveThreadId}
|
|
816
|
+
loading={chatsLoading && visibleThreads.length === 0}
|
|
817
|
+
loadingLabel={
|
|
818
|
+
<div className="space-y-1 px-2 py-1">
|
|
819
|
+
{[0, 1, 2].map((index) => (
|
|
820
|
+
<div key={index} className="flex items-center gap-2 px-1 py-1">
|
|
821
|
+
<Skeleton className="size-3.5 shrink-0 rounded-sm" />
|
|
822
|
+
<Skeleton className="h-3 w-3/4 rounded" />
|
|
823
|
+
</div>
|
|
824
|
+
))}
|
|
825
|
+
</div>
|
|
826
|
+
}
|
|
827
|
+
label={t("dispatch.sidebar.chats", { defaultValue: "Chats" })}
|
|
828
|
+
error={chatHistoryError}
|
|
829
|
+
onSelect={(threadId) => openThread(threadId)}
|
|
830
|
+
renameMaxLength={160}
|
|
831
|
+
onRename={(threadId, title) => void renameThread(threadId, title)}
|
|
832
|
+
labels={{
|
|
833
|
+
options: (item) =>
|
|
834
|
+
t("dispatch.sidebar.chatOptions", {
|
|
835
|
+
title: item.titleText ?? "",
|
|
836
|
+
}),
|
|
837
|
+
renameInput: (item) =>
|
|
838
|
+
t("dispatch.sidebar.renameThread", {
|
|
839
|
+
title: item.titleText ?? "",
|
|
840
|
+
}),
|
|
841
|
+
rename: t("dispatch.sidebar.renameChat"),
|
|
842
|
+
}}
|
|
843
|
+
renderAdditionalRowActions={(item, closeMenu) => (
|
|
844
|
+
<>
|
|
845
|
+
<button
|
|
846
|
+
type="button"
|
|
847
|
+
role="menuitem"
|
|
848
|
+
className="an-chat-history-row__menu-item"
|
|
849
|
+
onClick={() => {
|
|
850
|
+
closeMenu();
|
|
851
|
+
void writeClipboardText(item.id).then((copied) => {
|
|
852
|
+
toast[copied ? "success" : "error"](
|
|
853
|
+
copied
|
|
854
|
+
? "Session ID copied"
|
|
855
|
+
: "Could not copy the session ID",
|
|
856
|
+
);
|
|
857
|
+
});
|
|
858
|
+
}}
|
|
859
|
+
>
|
|
860
|
+
<IconCopy size={13} strokeWidth={1.8} />
|
|
861
|
+
<span>Copy session ID</span>
|
|
862
|
+
</button>
|
|
863
|
+
{!chatFirstEmbedded ? (
|
|
864
|
+
<button
|
|
865
|
+
type="button"
|
|
866
|
+
role="menuitem"
|
|
867
|
+
className="an-chat-history-row__menu-item"
|
|
868
|
+
onClick={() => {
|
|
869
|
+
closeMenu();
|
|
870
|
+
emitChatFirstSessionWatch({
|
|
871
|
+
sessionId: item.id,
|
|
872
|
+
title: item.titleText,
|
|
873
|
+
kind: "agent-chat",
|
|
874
|
+
sourceSessionId: displayedActiveThreadId ?? undefined,
|
|
875
|
+
});
|
|
876
|
+
}}
|
|
877
|
+
>
|
|
878
|
+
<IconEye size={13} strokeWidth={1.8} />
|
|
879
|
+
<span>Watch and message session</span>
|
|
880
|
+
</button>
|
|
881
|
+
) : null}
|
|
882
|
+
</>
|
|
883
|
+
)}
|
|
884
|
+
className="min-w-0 px-2"
|
|
885
|
+
/>
|
|
886
|
+
) : !collapsedChatFirst ? (
|
|
887
|
+
<ChatHistoryRail
|
|
888
|
+
items={chatItems}
|
|
889
|
+
activeId={displayedActiveThreadId}
|
|
890
|
+
onSelect={(threadId) => openThread(threadId)}
|
|
891
|
+
onNewChat={() => void handleNewChat()}
|
|
892
|
+
railLabels={{
|
|
893
|
+
newChat: t("dispatch.sidebar.newChat"),
|
|
894
|
+
showMore: t("dispatch.sidebar.chats"),
|
|
895
|
+
showLess: t("dispatch.sidebar.chats"),
|
|
896
|
+
}}
|
|
897
|
+
error={chatHistoryError}
|
|
898
|
+
renameMaxLength={160}
|
|
899
|
+
onRename={(threadId, title) => void renameThread(threadId, title)}
|
|
900
|
+
labels={{
|
|
901
|
+
options: (item) =>
|
|
902
|
+
t("dispatch.sidebar.chatOptions", {
|
|
903
|
+
title: item.titleText ?? "",
|
|
904
|
+
}),
|
|
905
|
+
renameInput: (item) =>
|
|
906
|
+
t("dispatch.sidebar.renameThread", {
|
|
907
|
+
title: item.titleText ?? "",
|
|
908
|
+
}),
|
|
909
|
+
rename: t("dispatch.sidebar.renameChat"),
|
|
910
|
+
}}
|
|
911
|
+
renderAdditionalRowActions={(item, closeMenu) => (
|
|
912
|
+
<>
|
|
913
|
+
<button
|
|
914
|
+
type="button"
|
|
915
|
+
role="menuitem"
|
|
916
|
+
className="an-chat-history-row__menu-item"
|
|
917
|
+
onClick={() => {
|
|
918
|
+
closeMenu();
|
|
919
|
+
void writeClipboardText(item.id).then((copied) => {
|
|
920
|
+
toast[copied ? "success" : "error"](
|
|
921
|
+
copied
|
|
922
|
+
? "Session ID copied"
|
|
923
|
+
: "Could not copy the session ID",
|
|
924
|
+
);
|
|
925
|
+
});
|
|
926
|
+
}}
|
|
927
|
+
>
|
|
928
|
+
<IconCopy size={13} strokeWidth={1.8} />
|
|
929
|
+
<span>Copy session ID</span>
|
|
930
|
+
</button>
|
|
931
|
+
{chatFirstMode && !chatFirstEmbedded ? (
|
|
932
|
+
<button
|
|
933
|
+
type="button"
|
|
934
|
+
role="menuitem"
|
|
935
|
+
className="an-chat-history-row__menu-item"
|
|
936
|
+
onClick={() => {
|
|
937
|
+
closeMenu();
|
|
938
|
+
emitChatFirstSessionWatch({
|
|
939
|
+
sessionId: item.id,
|
|
940
|
+
title: item.titleText,
|
|
941
|
+
kind: "agent-chat",
|
|
942
|
+
sourceSessionId: displayedActiveThreadId ?? undefined,
|
|
943
|
+
});
|
|
944
|
+
}}
|
|
945
|
+
>
|
|
946
|
+
<IconEye size={13} strokeWidth={1.8} />
|
|
947
|
+
<span>Watch and message session</span>
|
|
948
|
+
</button>
|
|
949
|
+
) : null}
|
|
950
|
+
</>
|
|
951
|
+
)}
|
|
952
|
+
className="min-w-0 px-2"
|
|
953
|
+
/>
|
|
954
|
+
) : null}
|
|
955
|
+
</div>
|
|
956
|
+
);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
export function NavContent({
|
|
960
|
+
onNavigate,
|
|
961
|
+
extensions,
|
|
962
|
+
chatFirstMode = false,
|
|
963
|
+
chatFirstEmbedded = false,
|
|
964
|
+
collapsed = false,
|
|
965
|
+
collapsible = false,
|
|
966
|
+
onCollapsedChange,
|
|
967
|
+
chatFirstAppLayout,
|
|
968
|
+
onChatFirstAppLayoutChange,
|
|
969
|
+
chatFirstApps = [],
|
|
970
|
+
chatFirstAppsLoading = false,
|
|
971
|
+
chatFirstAppsError,
|
|
972
|
+
chatFirstActiveAppId,
|
|
973
|
+
chatFirstActivePrimaryTab,
|
|
974
|
+
onChatFirstNewChat,
|
|
975
|
+
onChatFirstAppOpen,
|
|
976
|
+
onChatFirstAppsRetry,
|
|
977
|
+
}: {
|
|
978
|
+
onNavigate?: () => void;
|
|
979
|
+
extensions?: DispatchExtensionConfig;
|
|
980
|
+
chatFirstMode?: boolean;
|
|
981
|
+
chatFirstEmbedded?: boolean;
|
|
982
|
+
collapsed?: boolean;
|
|
983
|
+
collapsible?: boolean;
|
|
984
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
985
|
+
chatFirstAppLayout?: ChatFirstAppLayoutPreference;
|
|
986
|
+
onChatFirstAppLayoutChange?: (layout: ChatFirstAppLayoutPreference) => void;
|
|
987
|
+
chatFirstApps?: readonly ChatFirstAppItem[];
|
|
988
|
+
chatFirstAppsLoading?: boolean;
|
|
989
|
+
chatFirstAppsError?: string | null;
|
|
990
|
+
chatFirstActiveAppId?: string;
|
|
991
|
+
chatFirstActivePrimaryTab?: ChatFirstPrimaryTab;
|
|
992
|
+
onChatFirstNewChat?: () => void;
|
|
993
|
+
onChatFirstAppOpen?: (app: ChatFirstAppItem) => void;
|
|
994
|
+
onChatFirstAppsRetry?: () => void;
|
|
995
|
+
}) {
|
|
996
|
+
const t = useT();
|
|
997
|
+
const chatFirstCopy = useMemo(() => createDispatchChatFirstCopy(t), [t]);
|
|
998
|
+
const location = useLocation();
|
|
999
|
+
const navigate = useNavigate();
|
|
1000
|
+
const extensionNavItems = extensions?.navItems ?? EMPTY_NAV_ITEMS;
|
|
1001
|
+
const primaryNavItems = [
|
|
1002
|
+
...PRIMARY_NAV_ITEMS,
|
|
1003
|
+
...navItemsForSection(extensionNavItems, "primary"),
|
|
1004
|
+
];
|
|
1005
|
+
const localPathname = localDispatchPath(location.pathname);
|
|
1006
|
+
const navLabel = (item: DispatchNavItem) => {
|
|
1007
|
+
const key =
|
|
1008
|
+
item.id === "thread-debug"
|
|
1009
|
+
? "threadDebug"
|
|
1010
|
+
: item.id === "workspace"
|
|
1011
|
+
? "resources"
|
|
1012
|
+
: item.id;
|
|
1013
|
+
return t(`dispatch.nav.${key}`, { defaultValue: item.label });
|
|
1014
|
+
};
|
|
1015
|
+
|
|
1016
|
+
const collapseButton = collapsible ? (
|
|
1017
|
+
<Tooltip>
|
|
1018
|
+
<TooltipTrigger asChild>
|
|
1019
|
+
<button
|
|
1020
|
+
type="button"
|
|
1021
|
+
onClick={() => onCollapsedChange?.(!collapsed)}
|
|
1022
|
+
aria-label={
|
|
1023
|
+
collapsed
|
|
1024
|
+
? t("sidebar.expandSidebar")
|
|
1025
|
+
: t("sidebar.collapseSidebar")
|
|
1026
|
+
}
|
|
1027
|
+
className="flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-sidebar-foreground/65 transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"
|
|
1028
|
+
>
|
|
1029
|
+
{collapsed ? (
|
|
1030
|
+
<IconLayoutSidebarLeftExpand className="h-4 w-4 rtl:-scale-x-100" />
|
|
1031
|
+
) : (
|
|
1032
|
+
<IconLayoutSidebarLeftCollapse className="h-4 w-4 rtl:-scale-x-100" />
|
|
1033
|
+
)}
|
|
1034
|
+
</button>
|
|
1035
|
+
</TooltipTrigger>
|
|
1036
|
+
<TooltipContent side="right">
|
|
1037
|
+
{collapsed ? t("sidebar.expandSidebar") : t("sidebar.collapseSidebar")}
|
|
1038
|
+
</TooltipContent>
|
|
1039
|
+
</Tooltip>
|
|
1040
|
+
) : null;
|
|
1041
|
+
const searchButton = (
|
|
1042
|
+
<Tooltip>
|
|
1043
|
+
<TooltipTrigger asChild>
|
|
1044
|
+
<button
|
|
1045
|
+
type="button"
|
|
1046
|
+
onClick={openCommandMenu}
|
|
1047
|
+
aria-label={t("sidebar.search")}
|
|
1048
|
+
className="flex h-8 w-8 items-center justify-center rounded-md text-sidebar-foreground/65 transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"
|
|
1049
|
+
>
|
|
1050
|
+
<IconSearch className="h-4 w-4" />
|
|
1051
|
+
</button>
|
|
1052
|
+
</TooltipTrigger>
|
|
1053
|
+
<TooltipContent side="right">{t("sidebar.search")}</TooltipContent>
|
|
1054
|
+
</Tooltip>
|
|
1055
|
+
);
|
|
1056
|
+
const feedbackButton = (
|
|
1057
|
+
<FeedbackButton
|
|
1058
|
+
variant={collapsed ? "icon" : "sidebar"}
|
|
1059
|
+
side="right"
|
|
1060
|
+
className={collapsed ? "size-8" : "min-w-0"}
|
|
1061
|
+
/>
|
|
1062
|
+
);
|
|
1063
|
+
const chatFirstCreateAppTrigger = (
|
|
1064
|
+
<CreateAppPopover
|
|
1065
|
+
align="start"
|
|
1066
|
+
trigger={
|
|
1067
|
+
<button
|
|
1068
|
+
type="button"
|
|
1069
|
+
className="flex size-6 items-center justify-center rounded text-sidebar-foreground/55 hover:bg-sidebar-accent hover:text-sidebar-foreground"
|
|
1070
|
+
aria-label={chatFirstCopy("createWorkspaceApp")}
|
|
1071
|
+
title={chatFirstCopy("createWorkspaceApp")}
|
|
1072
|
+
>
|
|
1073
|
+
<IconPlus size={14} aria-hidden="true" />
|
|
1074
|
+
</button>
|
|
1075
|
+
}
|
|
1076
|
+
/>
|
|
1077
|
+
);
|
|
1078
|
+
|
|
1079
|
+
const chatFirstAppsRail = (
|
|
1080
|
+
<ChatFirstAppsRail
|
|
1081
|
+
apps={chatFirstApps}
|
|
1082
|
+
activeAppId={chatFirstActiveAppId}
|
|
1083
|
+
collapsed={collapsed}
|
|
1084
|
+
loading={chatFirstAppsLoading}
|
|
1085
|
+
error={chatFirstAppsError}
|
|
1086
|
+
layout={chatFirstAppLayout}
|
|
1087
|
+
onLayoutChange={onChatFirstAppLayoutChange}
|
|
1088
|
+
onRetry={onChatFirstAppsRetry}
|
|
1089
|
+
onOpenApp={(app) => {
|
|
1090
|
+
onChatFirstAppOpen?.(app);
|
|
1091
|
+
onNavigate?.();
|
|
1092
|
+
}}
|
|
1093
|
+
onOpenAllApps={() => {
|
|
1094
|
+
navigate(dispatchNavLinkTarget("/apps"));
|
|
1095
|
+
onNavigate?.();
|
|
1096
|
+
}}
|
|
1097
|
+
createAppTrigger={chatFirstCreateAppTrigger}
|
|
1098
|
+
renderIcon={(app, options) => (
|
|
1099
|
+
<AppIcon
|
|
1100
|
+
id={app.id}
|
|
1101
|
+
name={app.name}
|
|
1102
|
+
size="sm"
|
|
1103
|
+
monochrome={options?.isInactive}
|
|
1104
|
+
className="size-7 rounded-lg"
|
|
1105
|
+
/>
|
|
1106
|
+
)}
|
|
1107
|
+
copy={chatFirstCopy}
|
|
1108
|
+
/>
|
|
1109
|
+
);
|
|
1110
|
+
|
|
1111
|
+
const renderNavItem = (item: DispatchNavItem) => {
|
|
1112
|
+
const Icon = item.icon;
|
|
1113
|
+
const itemMatchesLocalPath = navItemMatchesPath(item, localPathname);
|
|
1114
|
+
const label = navLabel(item);
|
|
1115
|
+
return (
|
|
1116
|
+
<li key={item.id}>
|
|
1117
|
+
{collapsed ? (
|
|
1118
|
+
<Tooltip>
|
|
1119
|
+
<TooltipTrigger asChild>
|
|
1120
|
+
<Link
|
|
1121
|
+
to={dispatchNavLinkTarget(item.to)}
|
|
1122
|
+
onClick={(event) => {
|
|
1123
|
+
if (
|
|
1124
|
+
item.id === "chat" &&
|
|
1125
|
+
localPathname !== "/chat" &&
|
|
1126
|
+
!event.metaKey &&
|
|
1127
|
+
!event.ctrlKey &&
|
|
1128
|
+
!event.shiftKey &&
|
|
1129
|
+
!event.altKey
|
|
1130
|
+
) {
|
|
1131
|
+
event.preventDefault();
|
|
1132
|
+
navigateWithAgentChatViewTransition(
|
|
1133
|
+
navigate,
|
|
1134
|
+
dispatchNavLinkTarget("/chat"),
|
|
1135
|
+
);
|
|
1136
|
+
onNavigate?.();
|
|
1137
|
+
return;
|
|
1138
|
+
}
|
|
1139
|
+
onNavigate?.();
|
|
1140
|
+
}}
|
|
1141
|
+
aria-label={label}
|
|
1142
|
+
aria-current={itemMatchesLocalPath ? "page" : undefined}
|
|
1143
|
+
className={cn(
|
|
1144
|
+
"flex size-9 items-center justify-center rounded-md text-sm",
|
|
1145
|
+
itemMatchesLocalPath
|
|
1146
|
+
? "bg-sidebar-accent font-medium text-sidebar-accent-foreground"
|
|
1147
|
+
: "text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
1148
|
+
)}
|
|
1149
|
+
>
|
|
1150
|
+
{Icon ? (
|
|
1151
|
+
<Icon size={16} className="shrink-0" />
|
|
1152
|
+
) : (
|
|
1153
|
+
<span className="h-4 w-4 shrink-0" aria-hidden="true" />
|
|
1154
|
+
)}
|
|
1155
|
+
</Link>
|
|
1156
|
+
</TooltipTrigger>
|
|
1157
|
+
<TooltipContent side="right">{label}</TooltipContent>
|
|
1158
|
+
</Tooltip>
|
|
1159
|
+
) : (
|
|
1160
|
+
<Link
|
|
1161
|
+
to={dispatchNavLinkTarget(item.to)}
|
|
1162
|
+
onClick={(event) => {
|
|
1163
|
+
if (
|
|
1164
|
+
item.id === "chat" &&
|
|
1165
|
+
localPathname !== "/chat" &&
|
|
1166
|
+
!event.metaKey &&
|
|
1167
|
+
!event.ctrlKey &&
|
|
1168
|
+
!event.shiftKey &&
|
|
1169
|
+
!event.altKey
|
|
1170
|
+
) {
|
|
1171
|
+
event.preventDefault();
|
|
1172
|
+
navigateWithAgentChatViewTransition(
|
|
1173
|
+
navigate,
|
|
1174
|
+
dispatchNavLinkTarget("/chat"),
|
|
1175
|
+
);
|
|
1176
|
+
onNavigate?.();
|
|
1177
|
+
return;
|
|
1178
|
+
}
|
|
1179
|
+
onNavigate?.();
|
|
1180
|
+
}}
|
|
1181
|
+
aria-current={itemMatchesLocalPath ? "page" : undefined}
|
|
1182
|
+
className={cn(
|
|
1183
|
+
"flex h-8 w-full items-center gap-2 rounded-md px-2 text-sm",
|
|
1184
|
+
itemMatchesLocalPath
|
|
1185
|
+
? "bg-sidebar-accent font-medium text-sidebar-accent-foreground"
|
|
1186
|
+
: "text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
1187
|
+
)}
|
|
1188
|
+
>
|
|
1189
|
+
{Icon ? (
|
|
1190
|
+
<Icon size={16} className="shrink-0" />
|
|
1191
|
+
) : (
|
|
1192
|
+
<span className="h-4 w-4 shrink-0" aria-hidden="true" />
|
|
1193
|
+
)}
|
|
1194
|
+
<span className="truncate">{label}</span>
|
|
1195
|
+
</Link>
|
|
1196
|
+
)}
|
|
1197
|
+
{!collapsed && item.id === "chat" && itemMatchesLocalPath ? (
|
|
1198
|
+
<DispatchChatsSection
|
|
1199
|
+
onNavigate={onNavigate}
|
|
1200
|
+
chatFirstMode={chatFirstMode}
|
|
1201
|
+
chatFirstEmbedded={chatFirstEmbedded}
|
|
1202
|
+
/>
|
|
1203
|
+
) : null}
|
|
1204
|
+
</li>
|
|
1205
|
+
);
|
|
1206
|
+
};
|
|
1207
|
+
|
|
1208
|
+
const bottomNavigation = (
|
|
1209
|
+
<nav className={cn("py-1", collapsed ? "px-1.5" : "px-2")}>
|
|
1210
|
+
<ul
|
|
1211
|
+
className={cn(
|
|
1212
|
+
collapsed ? "flex flex-col items-center gap-1" : "space-y-0.5",
|
|
1213
|
+
)}
|
|
1214
|
+
>
|
|
1215
|
+
{BOTTOM_NAV_ITEMS.map(renderNavItem)}
|
|
1216
|
+
</ul>
|
|
1217
|
+
</nav>
|
|
1218
|
+
);
|
|
1219
|
+
const organizationPicker = (
|
|
1220
|
+
<div
|
|
1221
|
+
className={cn("py-2", collapsed ? "flex justify-center px-1" : "px-3")}
|
|
1222
|
+
>
|
|
1223
|
+
<OrgSwitcher compact={collapsed} reserveSpace currentAppId="dispatch" />
|
|
1224
|
+
</div>
|
|
1225
|
+
);
|
|
1226
|
+
const sidebarFooterActions = (
|
|
1227
|
+
<SidebarFooterActions
|
|
1228
|
+
collapsed={collapsed}
|
|
1229
|
+
feedback={feedbackButton}
|
|
1230
|
+
search={searchButton}
|
|
1231
|
+
collapse={collapseButton}
|
|
1232
|
+
/>
|
|
1233
|
+
);
|
|
1234
|
+
|
|
1235
|
+
return (
|
|
1236
|
+
<>
|
|
1237
|
+
<div
|
|
1238
|
+
className={cn(
|
|
1239
|
+
"flex h-12 shrink-0 items-center border-b border-sidebar-border",
|
|
1240
|
+
collapsed ? "justify-center px-0" : "px-4",
|
|
1241
|
+
)}
|
|
1242
|
+
>
|
|
1243
|
+
<Link
|
|
1244
|
+
to={dispatchNavLinkTarget("/overview")}
|
|
1245
|
+
aria-label={`${DISPATCH_SIDEBAR_LABEL} overview`}
|
|
1246
|
+
data-dispatch-logo
|
|
1247
|
+
className={cn(
|
|
1248
|
+
"flex items-center rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",
|
|
1249
|
+
collapsed ? "justify-center" : "gap-2",
|
|
1250
|
+
)}
|
|
1251
|
+
>
|
|
1252
|
+
<img
|
|
1253
|
+
src={appPath("/agent-native-icon-light.svg")}
|
|
1254
|
+
alt=""
|
|
1255
|
+
aria-hidden="true"
|
|
1256
|
+
width={35}
|
|
1257
|
+
height={20}
|
|
1258
|
+
className={cn(
|
|
1259
|
+
"block shrink-0 object-contain object-center dark:hidden",
|
|
1260
|
+
collapsed ? "h-4 w-7" : "h-5 w-[35px]",
|
|
1261
|
+
)}
|
|
1262
|
+
/>
|
|
1263
|
+
<img
|
|
1264
|
+
src={appPath("/agent-native-icon-dark.svg")}
|
|
1265
|
+
alt=""
|
|
1266
|
+
aria-hidden="true"
|
|
1267
|
+
width={35}
|
|
1268
|
+
height={20}
|
|
1269
|
+
className={cn(
|
|
1270
|
+
"hidden shrink-0 object-contain object-center dark:block",
|
|
1271
|
+
collapsed ? "h-4 w-7" : "h-5 w-[35px]",
|
|
1272
|
+
)}
|
|
1273
|
+
/>
|
|
1274
|
+
{!collapsed && (
|
|
1275
|
+
<div className="min-w-0 flex-1">
|
|
1276
|
+
<div
|
|
1277
|
+
data-dispatch-sidebar-label
|
|
1278
|
+
className="truncate text-lg font-bold tracking-tight text-foreground"
|
|
1279
|
+
>
|
|
1280
|
+
{DISPATCH_SIDEBAR_LABEL}
|
|
1281
|
+
</div>
|
|
1282
|
+
</div>
|
|
1283
|
+
)}
|
|
1284
|
+
</Link>
|
|
1285
|
+
</div>
|
|
1286
|
+
|
|
1287
|
+
{chatFirstMode ? (
|
|
1288
|
+
<div className="flex min-h-0 flex-1 flex-col overflow-y-auto">
|
|
1289
|
+
<DispatchChatsSection
|
|
1290
|
+
onNavigate={onNavigate}
|
|
1291
|
+
showNewChat
|
|
1292
|
+
chatFirstMode
|
|
1293
|
+
chatFirstEmbedded={chatFirstEmbedded}
|
|
1294
|
+
collapsed={collapsed}
|
|
1295
|
+
chatFirstNavigation={{
|
|
1296
|
+
activeTab: chatFirstActivePrimaryTab,
|
|
1297
|
+
onNewChat: onChatFirstNewChat,
|
|
1298
|
+
onOpenIntegrations: () => {
|
|
1299
|
+
navigate(dispatchNavLinkTarget("/admin/integrations"));
|
|
1300
|
+
onNavigate?.();
|
|
1301
|
+
},
|
|
1302
|
+
onOpenScheduled: () => {
|
|
1303
|
+
navigate(dispatchNavLinkTarget("/admin/automations"));
|
|
1304
|
+
onNavigate?.();
|
|
1305
|
+
},
|
|
1306
|
+
}}
|
|
1307
|
+
prelude={chatFirstAppsRail}
|
|
1308
|
+
/>
|
|
1309
|
+
</div>
|
|
1310
|
+
) : null}
|
|
1311
|
+
<div
|
|
1312
|
+
className={cn(
|
|
1313
|
+
"flex min-h-0 flex-1 flex-col overflow-y-auto",
|
|
1314
|
+
chatFirstMode && "hidden",
|
|
1315
|
+
)}
|
|
1316
|
+
>
|
|
1317
|
+
<nav className={cn("py-2", collapsed ? "px-1.5" : "px-2")}>
|
|
1318
|
+
<ul
|
|
1319
|
+
className={cn(
|
|
1320
|
+
collapsed ? "flex flex-col items-center gap-1" : "space-y-0.5",
|
|
1321
|
+
)}
|
|
1322
|
+
>
|
|
1323
|
+
{primaryNavItems.map(renderNavItem)}
|
|
1324
|
+
</ul>
|
|
1325
|
+
</nav>
|
|
1326
|
+
|
|
1327
|
+
<div className="mt-auto shrink-0">
|
|
1328
|
+
{bottomNavigation}
|
|
1329
|
+
{organizationPicker}
|
|
1330
|
+
</div>
|
|
1331
|
+
{sidebarFooterActions}
|
|
1332
|
+
</div>
|
|
1333
|
+
{chatFirstMode ? (
|
|
1334
|
+
<div className="mt-auto shrink-0">
|
|
1335
|
+
{bottomNavigation}
|
|
1336
|
+
{organizationPicker}
|
|
1337
|
+
{sidebarFooterActions}
|
|
1338
|
+
</div>
|
|
1339
|
+
) : null}
|
|
1340
|
+
</>
|
|
1341
|
+
);
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
export function Layout({
|
|
1345
|
+
children,
|
|
1346
|
+
extensions,
|
|
1347
|
+
agentPageHref,
|
|
1348
|
+
}: {
|
|
1349
|
+
children: ReactNode;
|
|
1350
|
+
extensions?: DispatchExtensionConfig;
|
|
1351
|
+
agentPageHref?: string;
|
|
1352
|
+
}) {
|
|
1353
|
+
const t = useT();
|
|
1354
|
+
const location = useLocation();
|
|
1355
|
+
const navigate = useNavigate();
|
|
1356
|
+
const [mobileOpen, setMobileOpen] = useState(false);
|
|
1357
|
+
const [sidebarCollapsed, setSidebarCollapsed] = useState(() => {
|
|
1358
|
+
if (typeof window === "undefined") return false;
|
|
1359
|
+
try {
|
|
1360
|
+
return window.localStorage.getItem(SIDEBAR_COLLAPSE_KEY) === "1";
|
|
1361
|
+
} catch {
|
|
1362
|
+
return false;
|
|
1363
|
+
}
|
|
1364
|
+
});
|
|
1365
|
+
const localPathname = localDispatchPath(location.pathname);
|
|
1366
|
+
const [electronEmbedded] = useState(() =>
|
|
1367
|
+
typeof window !== "undefined"
|
|
1368
|
+
? isElectronEmbeddedSearch(window.location.search)
|
|
1369
|
+
: false,
|
|
1370
|
+
);
|
|
1371
|
+
const isChatRoute =
|
|
1372
|
+
localPathname === "/chat" || localPathname.startsWith("/chat/");
|
|
1373
|
+
const chatFirstSurfaceScope = threadIdFromPath(localPathname) ?? "new";
|
|
1374
|
+
const isWorkspaceAppRoute = shouldAutoCollapseDispatchSidebar(
|
|
1375
|
+
location.pathname,
|
|
1376
|
+
);
|
|
1377
|
+
const workspaceAppId = isWorkspaceAppRoute
|
|
1378
|
+
? workspaceAppIdFromRoute(localPathname)
|
|
1379
|
+
: null;
|
|
1380
|
+
const workspaceAppRouteActive = Boolean(workspaceAppId);
|
|
1381
|
+
const isWorkspaceAppHostRoute =
|
|
1382
|
+
isWorkspaceAppRoute &&
|
|
1383
|
+
typeof window !== "undefined" &&
|
|
1384
|
+
new URLSearchParams(window.location.search).get("embedded") === "1";
|
|
1385
|
+
const [chatFirstPreference, setChatFirstPreference] = useState(() =>
|
|
1386
|
+
readChatFirstMode(),
|
|
1387
|
+
);
|
|
1388
|
+
const chatFirstEmbedded =
|
|
1389
|
+
typeof window !== "undefined" &&
|
|
1390
|
+
new URLSearchParams(window.location.search).get("chatFirst") === "1";
|
|
1391
|
+
const chatFirstMode =
|
|
1392
|
+
extensions?.chatFirst === true || chatFirstPreference || chatFirstEmbedded;
|
|
1393
|
+
const chatFirstHasActiveChat = chatFirstSurfaceScope !== "new";
|
|
1394
|
+
useEffect(() => {
|
|
1395
|
+
if (!electronEmbedded || typeof window === "undefined") return;
|
|
1396
|
+
const url = new URL(window.location.href);
|
|
1397
|
+
if (isElectronEmbeddedSearch(url.search)) return;
|
|
1398
|
+
url.searchParams.set("electron", "1");
|
|
1399
|
+
window.history.replaceState(
|
|
1400
|
+
window.history.state,
|
|
1401
|
+
"",
|
|
1402
|
+
`${url.pathname}${url.search}${url.hash}`,
|
|
1403
|
+
);
|
|
1404
|
+
}, [electronEmbedded, location.pathname, location.search]);
|
|
1405
|
+
const [chatFirstAppLayout, setChatFirstAppLayout] =
|
|
1406
|
+
useState<ChatFirstAppLayoutPreference>(() => readChatFirstAppLayout());
|
|
1407
|
+
const chatFirstAppLayoutHydratedRef = useRef(false);
|
|
1408
|
+
const chatFirstAppsQuery = useActionQuery<WorkspaceAppSummary[]>(
|
|
1409
|
+
"list-workspace-apps",
|
|
1410
|
+
{ includeAgentCards: false, includeArchived: true },
|
|
1411
|
+
{ enabled: chatFirstMode },
|
|
1412
|
+
);
|
|
1413
|
+
const chatFirstGrantedAppsQuery = useActionQuery<ChatFirstGrantedAppsResult>(
|
|
1414
|
+
"list_apps",
|
|
1415
|
+
{},
|
|
1416
|
+
{ enabled: chatFirstMode },
|
|
1417
|
+
);
|
|
1418
|
+
const chatFirstWorkspaceApps = useMemo(
|
|
1419
|
+
() => mergeChatFirstWorkspaceApps(chatFirstAppsQuery.data),
|
|
1420
|
+
[chatFirstAppsQuery.data],
|
|
1421
|
+
);
|
|
1422
|
+
const chatFirstAppRegistrations = useMemo<ChatFirstAppRegistration[]>(() => {
|
|
1423
|
+
const registrations = new Map<string, ChatFirstAppRegistration>();
|
|
1424
|
+
for (const app of chatFirstWorkspaceApps) {
|
|
1425
|
+
registrations.set(app.id.toLowerCase(), {
|
|
1426
|
+
id: app.id,
|
|
1427
|
+
name: app.name,
|
|
1428
|
+
path: app.path,
|
|
1429
|
+
url: app.url,
|
|
1430
|
+
enabled: app.status !== "pending" && app.archived !== true,
|
|
1431
|
+
});
|
|
1432
|
+
}
|
|
1433
|
+
for (const app of chatFirstGrantedAppsQuery.data?.apps ?? []) {
|
|
1434
|
+
const id = app.id.trim();
|
|
1435
|
+
if (!id || registrations.has(id.toLowerCase())) continue;
|
|
1436
|
+
registrations.set(id.toLowerCase(), {
|
|
1437
|
+
id,
|
|
1438
|
+
name: app.name,
|
|
1439
|
+
url: app.url,
|
|
1440
|
+
enabled: true,
|
|
1441
|
+
});
|
|
1442
|
+
}
|
|
1443
|
+
return [...registrations.values()];
|
|
1444
|
+
}, [chatFirstGrantedAppsQuery.data?.apps, chatFirstWorkspaceApps]);
|
|
1445
|
+
const chatFirstAppItems = useMemo<ChatFirstAppItem[]>(
|
|
1446
|
+
() =>
|
|
1447
|
+
chatFirstAppRegistrations
|
|
1448
|
+
.filter(
|
|
1449
|
+
(app) => app.enabled && isWorkspaceAppVisibleInDefaultLaunchers(app),
|
|
1450
|
+
)
|
|
1451
|
+
.map((app) => ({
|
|
1452
|
+
id: app.id,
|
|
1453
|
+
name: app.name ?? app.id,
|
|
1454
|
+
})),
|
|
1455
|
+
[chatFirstAppRegistrations],
|
|
1456
|
+
);
|
|
1457
|
+
const openChatFirstApp = useCallback(
|
|
1458
|
+
(app: ChatFirstAppItem) => {
|
|
1459
|
+
if (isDispatchWorkspaceAppId(app.id)) return;
|
|
1460
|
+
const registration = chatFirstAppRegistrations.find(
|
|
1461
|
+
(candidate) => candidate.id.toLowerCase() === app.id.toLowerCase(),
|
|
1462
|
+
);
|
|
1463
|
+
const directHref =
|
|
1464
|
+
registration &&
|
|
1465
|
+
!isWorkspaceSsoApp(registration) &&
|
|
1466
|
+
isPathMountedWorkspaceApp(registration)
|
|
1467
|
+
? workspaceAppDirectHref(registration, "/")
|
|
1468
|
+
: null;
|
|
1469
|
+
if (directHref) {
|
|
1470
|
+
navigateToWorkspaceApp(directHref);
|
|
1471
|
+
return;
|
|
1472
|
+
}
|
|
1473
|
+
navigate(dispatchNavLinkTarget(workspaceAppRoute(app.id)));
|
|
1474
|
+
},
|
|
1475
|
+
[chatFirstAppRegistrations, navigate],
|
|
1476
|
+
);
|
|
1477
|
+
const chatFirstCopy = useMemo(() => createDispatchChatFirstCopy(t), [t]);
|
|
1478
|
+
const [chatFirstPane, setChatFirstPane] =
|
|
1479
|
+
useState<DispatchChatFirstPane | null>(null);
|
|
1480
|
+
const [chatFirstNotice, setChatFirstNotice] = useState<string | null>(null);
|
|
1481
|
+
const chatFirstSessionWatch = useChatFirstSessionWatch();
|
|
1482
|
+
const chatFirstSurfaceTabs = useChatFirstSurfaceTabs(chatFirstSurfaceScope);
|
|
1483
|
+
const chatFirstSurfaceTabsStore = getChatFirstSurfaceTabsStore(
|
|
1484
|
+
chatFirstSurfaceScope,
|
|
1485
|
+
);
|
|
1486
|
+
const chatFirstAgentsQuery = useActionQuery<SearchAgentThreadsResult>(
|
|
1487
|
+
"search-agent-threads",
|
|
1488
|
+
{ sourceId: "current", limit: 12 },
|
|
1489
|
+
{
|
|
1490
|
+
enabled:
|
|
1491
|
+
chatFirstMode &&
|
|
1492
|
+
isChatRoute &&
|
|
1493
|
+
chatFirstSurfaceTabs.activeTabId?.startsWith("agents:") === true,
|
|
1494
|
+
},
|
|
1495
|
+
);
|
|
1496
|
+
const chatFirstSurfacePanel = useChatFirstSurfacePanel(chatFirstSurfaceScope);
|
|
1497
|
+
const { setOpen: setChatFirstSurfacePanelOpen } = chatFirstSurfacePanel;
|
|
1498
|
+
const chatFirstSurfaceResize = useChatFirstSurfaceResize(
|
|
1499
|
+
chatFirstSurfaceScope,
|
|
1500
|
+
);
|
|
1501
|
+
const chatFirstPaneHydratedRef = useRef(false);
|
|
1502
|
+
const pendingChatFirstOpenAppRef = useRef<ChatFirstOpenAppDetail | null>(
|
|
1503
|
+
null,
|
|
1504
|
+
);
|
|
1505
|
+
const previousChatFirstSurfaceScopeRef = useRef(chatFirstSurfaceScope);
|
|
1506
|
+
const previousChatFirstSurfaceTabCountRef = useRef<number | null>(null);
|
|
1507
|
+
const activeChatFirstSurfaceTab = useMemo(
|
|
1508
|
+
() =>
|
|
1509
|
+
chatFirstSurfaceTabs.tabs.find(
|
|
1510
|
+
(tab) => tab.id === chatFirstSurfaceTabs.activeTabId,
|
|
1511
|
+
) ?? null,
|
|
1512
|
+
[chatFirstSurfaceTabs],
|
|
1513
|
+
);
|
|
1514
|
+
const chatFirstAppTakesMain =
|
|
1515
|
+
chatFirstMode &&
|
|
1516
|
+
isChatRoute &&
|
|
1517
|
+
activeChatFirstSurfaceTab?.kind === "app" &&
|
|
1518
|
+
activeChatFirstSurfaceTab.placement === "main";
|
|
1519
|
+
const chatFirstAppSelected =
|
|
1520
|
+
chatFirstMode && activeChatFirstSurfaceTab?.kind === "app";
|
|
1521
|
+
const chatFirstActivePrimaryTab = chatFirstAppSelected
|
|
1522
|
+
? activeChatFirstSurfaceTab?.kind === "app" &&
|
|
1523
|
+
activeChatFirstSurfaceTab.appId === "dispatch"
|
|
1524
|
+
? chatFirstPrimaryTabForPath(activeChatFirstSurfaceTab.path ?? "")
|
|
1525
|
+
: undefined
|
|
1526
|
+
: chatFirstPrimaryTabForPath(localPathname);
|
|
1527
|
+
const chatFirstActiveAppId = isWorkspaceAppRoute
|
|
1528
|
+
? (workspaceAppIdFromRoute(localPathname) ?? undefined)
|
|
1529
|
+
: chatFirstAppSelected && activeChatFirstSurfaceTab?.kind === "app"
|
|
1530
|
+
? activeChatFirstSurfaceTab.appId
|
|
1531
|
+
: undefined;
|
|
1532
|
+
const chatFirstAgentActivities = useMemo<ChatFirstAgentActivity[]>(
|
|
1533
|
+
() =>
|
|
1534
|
+
(chatFirstAgentsQuery.data?.threads ?? []).map((thread) => ({
|
|
1535
|
+
sessionId: thread.id,
|
|
1536
|
+
title:
|
|
1537
|
+
thread.title || chatFirstCopy("agentsTitle", { name: thread.id }),
|
|
1538
|
+
subtitle: thread.snippet || thread.preview || chatFirstCopy("session"),
|
|
1539
|
+
status: "recent",
|
|
1540
|
+
...(thread.updatedAt ? { updatedAt: thread.updatedAt } : {}),
|
|
1541
|
+
})),
|
|
1542
|
+
[chatFirstAgentsQuery.data, chatFirstCopy],
|
|
1543
|
+
);
|
|
1544
|
+
const persistChatFirstPane = useCallback(
|
|
1545
|
+
(pane: DispatchChatFirstPane | null) => {
|
|
1546
|
+
setChatFirstPane(pane);
|
|
1547
|
+
void writeClientAppState(CHAT_FIRST_PANE_STATE_KEY, pane).catch(() => {
|
|
1548
|
+
setChatFirstNotice(
|
|
1549
|
+
"The app pane opened locally, but its focus could not be synced.",
|
|
1550
|
+
);
|
|
1551
|
+
});
|
|
1552
|
+
},
|
|
1553
|
+
[],
|
|
1554
|
+
);
|
|
1555
|
+
useEffect(() => {
|
|
1556
|
+
if (!chatFirstMode || isChatRoute) return;
|
|
1557
|
+
persistChatFirstPane(null);
|
|
1558
|
+
closeChatFirstSessionWatch();
|
|
1559
|
+
chatFirstSurfaceTabsStore.closeAll();
|
|
1560
|
+
}, [
|
|
1561
|
+
chatFirstMode,
|
|
1562
|
+
chatFirstSurfaceTabsStore,
|
|
1563
|
+
isChatRoute,
|
|
1564
|
+
persistChatFirstPane,
|
|
1565
|
+
]);
|
|
1566
|
+
const openChatFirstPane = useCallback(
|
|
1567
|
+
(
|
|
1568
|
+
pane: DispatchChatFirstPane,
|
|
1569
|
+
placement: ChatFirstAppSurfacePlacement = "side",
|
|
1570
|
+
) => {
|
|
1571
|
+
if (placement === "side" && !chatFirstHasActiveChat) return;
|
|
1572
|
+
setSidebarCollapsed(true);
|
|
1573
|
+
setChatFirstNotice(null);
|
|
1574
|
+
closeChatFirstSessionWatch();
|
|
1575
|
+
if (!isChatRoute) {
|
|
1576
|
+
navigateWithAgentChatViewTransition(
|
|
1577
|
+
navigate,
|
|
1578
|
+
dispatchNavLinkTarget("/chat"),
|
|
1579
|
+
);
|
|
1580
|
+
}
|
|
1581
|
+
const app = chatFirstAppRegistrations.find(
|
|
1582
|
+
(candidate) => candidate.id === pane.appId,
|
|
1583
|
+
);
|
|
1584
|
+
chatFirstSurfaceTabsStore.open({
|
|
1585
|
+
id: chatFirstSurfaceTabId(
|
|
1586
|
+
"app",
|
|
1587
|
+
`${pane.appId}:${pane.path ?? pane.view ?? "/"}`,
|
|
1588
|
+
),
|
|
1589
|
+
kind: "app",
|
|
1590
|
+
title: app?.name ?? pane.appId,
|
|
1591
|
+
appId: pane.appId,
|
|
1592
|
+
placement,
|
|
1593
|
+
...(pane.path ? { path: pane.path } : {}),
|
|
1594
|
+
...(pane.view ? { view: pane.view } : {}),
|
|
1595
|
+
});
|
|
1596
|
+
setChatFirstSurfacePanelOpen(true);
|
|
1597
|
+
persistChatFirstPane({ ...pane, placement });
|
|
1598
|
+
},
|
|
1599
|
+
[
|
|
1600
|
+
chatFirstAppRegistrations,
|
|
1601
|
+
chatFirstSurfaceTabsStore,
|
|
1602
|
+
chatFirstHasActiveChat,
|
|
1603
|
+
persistChatFirstPane,
|
|
1604
|
+
isChatRoute,
|
|
1605
|
+
navigate,
|
|
1606
|
+
setChatFirstSurfacePanelOpen,
|
|
1607
|
+
],
|
|
1608
|
+
);
|
|
1609
|
+
const openChatFirstSurface = useCallback(
|
|
1610
|
+
(kind: ChatFirstSurfaceKind) => {
|
|
1611
|
+
if (kind === "browser") {
|
|
1612
|
+
persistChatFirstPane(null);
|
|
1613
|
+
closeChatFirstSessionWatch();
|
|
1614
|
+
chatFirstSurfaceTabsStore.open({
|
|
1615
|
+
id: chatFirstSurfaceTabId("browser", "homepage"),
|
|
1616
|
+
kind: "browser",
|
|
1617
|
+
title: "Browser",
|
|
1618
|
+
url: "https://www.google.com/",
|
|
1619
|
+
});
|
|
1620
|
+
return;
|
|
1621
|
+
}
|
|
1622
|
+
if (kind !== "agents") return;
|
|
1623
|
+
persistChatFirstPane(null);
|
|
1624
|
+
closeChatFirstSessionWatch();
|
|
1625
|
+
chatFirstSurfaceTabsStore.open({
|
|
1626
|
+
id: chatFirstSurfaceTabId("agents", "activity"),
|
|
1627
|
+
kind: "agents",
|
|
1628
|
+
title: "Agents",
|
|
1629
|
+
});
|
|
1630
|
+
},
|
|
1631
|
+
[chatFirstSurfaceTabsStore, persistChatFirstPane],
|
|
1632
|
+
);
|
|
1633
|
+
const resolveChatFirstOpenBrowser = useCallback(
|
|
1634
|
+
(detail: ChatFirstOpenBrowserDetail) => {
|
|
1635
|
+
const resolution = resolveChatFirstBrowserTarget(detail);
|
|
1636
|
+
if (resolution.status === "unresolved") {
|
|
1637
|
+
setChatFirstNotice(
|
|
1638
|
+
chatFirstBrowserResolutionMessage(resolution.reason),
|
|
1639
|
+
);
|
|
1640
|
+
return;
|
|
1641
|
+
}
|
|
1642
|
+
if (resolution.target.openExternally && typeof window !== "undefined") {
|
|
1643
|
+
try {
|
|
1644
|
+
// Builder's Visual Editor rejects iframe ancestors with CSP/X-Frame-
|
|
1645
|
+
// Options. Prefer the real browser tab; the browser pane below is a
|
|
1646
|
+
// visible fallback when popup policy blocks this non-click event.
|
|
1647
|
+
if (
|
|
1648
|
+
window.open(resolution.target.url, "_blank", "noopener,noreferrer")
|
|
1649
|
+
) {
|
|
1650
|
+
return;
|
|
1651
|
+
}
|
|
1652
|
+
} catch (error) {
|
|
1653
|
+
console.warn(
|
|
1654
|
+
"[chat-first] external browser open failed; keeping link fallback",
|
|
1655
|
+
error,
|
|
1656
|
+
);
|
|
1657
|
+
// Fall through to the non-iframe browser pane below.
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
persistChatFirstPane(null);
|
|
1661
|
+
closeChatFirstSessionWatch();
|
|
1662
|
+
setChatFirstNotice(null);
|
|
1663
|
+
chatFirstSurfaceTabsStore.open({
|
|
1664
|
+
id: chatFirstSurfaceTabId("browser", resolution.target.url),
|
|
1665
|
+
kind: "browser",
|
|
1666
|
+
title: resolution.target.title ?? "Browser",
|
|
1667
|
+
url: resolution.target.url,
|
|
1668
|
+
});
|
|
1669
|
+
},
|
|
1670
|
+
[chatFirstSurfaceTabsStore, persistChatFirstPane],
|
|
1671
|
+
);
|
|
1672
|
+
const resolveChatFirstOpenApp = useCallback(
|
|
1673
|
+
(detail: ChatFirstOpenAppDetail) => {
|
|
1674
|
+
if (chatFirstAppsQuery.isLoading || chatFirstGrantedAppsQuery.isLoading) {
|
|
1675
|
+
pendingChatFirstOpenAppRef.current = detail;
|
|
1676
|
+
return;
|
|
1677
|
+
}
|
|
1678
|
+
if (chatFirstAppsQuery.isError) {
|
|
1679
|
+
pendingChatFirstOpenAppRef.current = null;
|
|
1680
|
+
setChatFirstNotice(
|
|
1681
|
+
"Workspace apps could not be loaded, so the requested app was not opened.",
|
|
1682
|
+
);
|
|
1683
|
+
return;
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
const resolution = resolveChatFirstAppTarget(
|
|
1687
|
+
detail,
|
|
1688
|
+
chatFirstAppRegistrations,
|
|
1689
|
+
{
|
|
1690
|
+
currentOrigin:
|
|
1691
|
+
typeof window === "undefined" ? undefined : window.location.origin,
|
|
1692
|
+
},
|
|
1693
|
+
);
|
|
1694
|
+
pendingChatFirstOpenAppRef.current = null;
|
|
1695
|
+
if (resolution.status === "unresolved") {
|
|
1696
|
+
setChatFirstNotice(chatFirstResolutionMessage(resolution.reason));
|
|
1697
|
+
return;
|
|
1698
|
+
}
|
|
1699
|
+
if (isDispatchWorkspaceAppId(resolution.target.appId)) {
|
|
1700
|
+
closeChatFirstSessionWatch();
|
|
1701
|
+
chatFirstSurfaceTabsStore.closeAll();
|
|
1702
|
+
setChatFirstSurfacePanelOpen(false);
|
|
1703
|
+
persistChatFirstPane(null);
|
|
1704
|
+
if (resolution.target.path) {
|
|
1705
|
+
navigateWithAgentChatViewTransition(
|
|
1706
|
+
navigate,
|
|
1707
|
+
dispatchNavLinkTarget(resolution.target.path),
|
|
1708
|
+
);
|
|
1709
|
+
}
|
|
1710
|
+
return;
|
|
1711
|
+
}
|
|
1712
|
+
openChatFirstPane(resolution.target);
|
|
1713
|
+
},
|
|
1714
|
+
[
|
|
1715
|
+
chatFirstAppRegistrations,
|
|
1716
|
+
chatFirstAppsQuery.isError,
|
|
1717
|
+
chatFirstAppsQuery.isLoading,
|
|
1718
|
+
chatFirstGrantedAppsQuery.isLoading,
|
|
1719
|
+
chatFirstSurfaceTabsStore,
|
|
1720
|
+
closeChatFirstSessionWatch,
|
|
1721
|
+
openChatFirstPane,
|
|
1722
|
+
navigate,
|
|
1723
|
+
persistChatFirstPane,
|
|
1724
|
+
setChatFirstSurfacePanelOpen,
|
|
1725
|
+
],
|
|
1726
|
+
);
|
|
1727
|
+
const chatHomeHandoffActive = useAgentChatHomeHandoff({
|
|
1728
|
+
storageKey: "dispatch",
|
|
1729
|
+
activePath: localPathname,
|
|
1730
|
+
enabled: !isChatRoute,
|
|
1731
|
+
});
|
|
1732
|
+
const chatHandoffLinkOptions = {
|
|
1733
|
+
storageKey: "dispatch",
|
|
1734
|
+
isChatPath: (pathname: string) =>
|
|
1735
|
+
pathname === "/chat" || pathname.startsWith("/chat/"),
|
|
1736
|
+
requireActiveHandoff: true,
|
|
1737
|
+
};
|
|
1738
|
+
useAgentChatHomeHandoffLinks(chatHandoffLinkOptions);
|
|
1739
|
+
|
|
1740
|
+
useEffect(() => {
|
|
1741
|
+
const handleModeChange = (event: Event) => {
|
|
1742
|
+
const enabled = (event as CustomEvent<{ enabled?: unknown }>).detail
|
|
1743
|
+
?.enabled;
|
|
1744
|
+
setChatFirstPreference(enabled === true);
|
|
1745
|
+
};
|
|
1746
|
+
window.addEventListener(CHAT_FIRST_MODE_CHANGED_EVENT, handleModeChange);
|
|
1747
|
+
return () =>
|
|
1748
|
+
window.removeEventListener(
|
|
1749
|
+
CHAT_FIRST_MODE_CHANGED_EVENT,
|
|
1750
|
+
handleModeChange,
|
|
1751
|
+
);
|
|
1752
|
+
}, []);
|
|
1753
|
+
|
|
1754
|
+
useEffect(() => {
|
|
1755
|
+
if (
|
|
1756
|
+
!chatFirstMode ||
|
|
1757
|
+
!isChatRoute ||
|
|
1758
|
+
chatFirstAppLayoutHydratedRef.current
|
|
1759
|
+
) {
|
|
1760
|
+
return;
|
|
1761
|
+
}
|
|
1762
|
+
chatFirstAppLayoutHydratedRef.current = true;
|
|
1763
|
+
void readClientAppState<unknown>("chat-first-app-layout")
|
|
1764
|
+
.then((value) => {
|
|
1765
|
+
if (!value || typeof value !== "object") return;
|
|
1766
|
+
const candidate = value as Partial<ChatFirstAppLayoutPreference>;
|
|
1767
|
+
const ids = (input: unknown) =>
|
|
1768
|
+
Array.isArray(input)
|
|
1769
|
+
? input.filter(
|
|
1770
|
+
(id): id is string =>
|
|
1771
|
+
typeof id === "string" && id.trim().length > 0,
|
|
1772
|
+
)
|
|
1773
|
+
: [];
|
|
1774
|
+
setChatFirstAppLayout({
|
|
1775
|
+
pinnedIds: [...new Set(ids(candidate.pinnedIds))],
|
|
1776
|
+
orderedIds: [...new Set(ids(candidate.orderedIds))],
|
|
1777
|
+
});
|
|
1778
|
+
})
|
|
1779
|
+
.catch(() => {
|
|
1780
|
+
// Device-local layout remains the fallback when workspace state is unavailable.
|
|
1781
|
+
});
|
|
1782
|
+
}, [chatFirstMode, isChatRoute]);
|
|
1783
|
+
|
|
1784
|
+
const persistChatFirstAppLayout = useCallback(
|
|
1785
|
+
(layout: ChatFirstAppLayoutPreference) => {
|
|
1786
|
+
setChatFirstAppLayout(layout);
|
|
1787
|
+
void writeClientAppState("chat-first-app-layout", layout).catch(() => {
|
|
1788
|
+
setChatFirstNotice(
|
|
1789
|
+
"App order changed locally, but workspace state could not be synced.",
|
|
1790
|
+
);
|
|
1791
|
+
});
|
|
1792
|
+
},
|
|
1793
|
+
[],
|
|
1794
|
+
);
|
|
1795
|
+
|
|
1796
|
+
useEffect(() => {
|
|
1797
|
+
if (!chatFirstMode) {
|
|
1798
|
+
setChatFirstPane(null);
|
|
1799
|
+
closeChatFirstSessionWatch();
|
|
1800
|
+
chatFirstSurfaceTabsStore.closeAll();
|
|
1801
|
+
setChatFirstNotice(null);
|
|
1802
|
+
pendingChatFirstOpenAppRef.current = null;
|
|
1803
|
+
chatFirstPaneHydratedRef.current = false;
|
|
1804
|
+
return;
|
|
1805
|
+
}
|
|
1806
|
+
const unsubscribeApp = subscribeChatFirstOpenApp(resolveChatFirstOpenApp);
|
|
1807
|
+
const unsubscribeBrowser = subscribeChatFirstOpenBrowser(
|
|
1808
|
+
resolveChatFirstOpenBrowser,
|
|
1809
|
+
);
|
|
1810
|
+
return () => {
|
|
1811
|
+
unsubscribeApp();
|
|
1812
|
+
unsubscribeBrowser();
|
|
1813
|
+
};
|
|
1814
|
+
}, [
|
|
1815
|
+
chatFirstMode,
|
|
1816
|
+
isChatRoute,
|
|
1817
|
+
chatFirstSurfaceTabsStore,
|
|
1818
|
+
resolveChatFirstOpenApp,
|
|
1819
|
+
resolveChatFirstOpenBrowser,
|
|
1820
|
+
]);
|
|
1821
|
+
|
|
1822
|
+
useEffect(() => {
|
|
1823
|
+
if (
|
|
1824
|
+
!chatFirstMode ||
|
|
1825
|
+
!isChatRoute ||
|
|
1826
|
+
chatFirstPaneHydratedRef.current ||
|
|
1827
|
+
chatFirstAppsQuery.isLoading ||
|
|
1828
|
+
chatFirstAppsQuery.isError
|
|
1829
|
+
) {
|
|
1830
|
+
return;
|
|
1831
|
+
}
|
|
1832
|
+
chatFirstPaneHydratedRef.current = true;
|
|
1833
|
+
if (chatFirstPane) return;
|
|
1834
|
+
let active = true;
|
|
1835
|
+
void readClientAppState<unknown>(CHAT_FIRST_PANE_STATE_KEY)
|
|
1836
|
+
.then((value) => {
|
|
1837
|
+
if (!active) return;
|
|
1838
|
+
const persisted = persistedChatFirstPane(value);
|
|
1839
|
+
if (!persisted) return;
|
|
1840
|
+
const resolution = resolveChatFirstAppTarget(
|
|
1841
|
+
{
|
|
1842
|
+
app: persisted.appId,
|
|
1843
|
+
path: persisted.path,
|
|
1844
|
+
view: persisted.view,
|
|
1845
|
+
},
|
|
1846
|
+
chatFirstAppRegistrations,
|
|
1847
|
+
{
|
|
1848
|
+
currentOrigin:
|
|
1849
|
+
typeof window === "undefined"
|
|
1850
|
+
? undefined
|
|
1851
|
+
: window.location.origin,
|
|
1852
|
+
},
|
|
1853
|
+
);
|
|
1854
|
+
if (resolution.status === "ready") {
|
|
1855
|
+
openChatFirstPane(resolution.target, persisted.placement);
|
|
1856
|
+
}
|
|
1857
|
+
})
|
|
1858
|
+
.catch(() => {
|
|
1859
|
+
if (active) {
|
|
1860
|
+
setChatFirstNotice(
|
|
1861
|
+
"The last app pane could not be restored from workspace state.",
|
|
1862
|
+
);
|
|
1863
|
+
}
|
|
1864
|
+
});
|
|
1865
|
+
return () => {
|
|
1866
|
+
active = false;
|
|
1867
|
+
};
|
|
1868
|
+
}, [
|
|
1869
|
+
chatFirstAppsQuery.isError,
|
|
1870
|
+
chatFirstAppsQuery.isLoading,
|
|
1871
|
+
chatFirstAppRegistrations,
|
|
1872
|
+
chatFirstMode,
|
|
1873
|
+
chatFirstPane,
|
|
1874
|
+
isChatRoute,
|
|
1875
|
+
openChatFirstPane,
|
|
1876
|
+
]);
|
|
1877
|
+
|
|
1878
|
+
useEffect(() => {
|
|
1879
|
+
if (previousChatFirstSurfaceScopeRef.current === chatFirstSurfaceScope) {
|
|
1880
|
+
return;
|
|
1881
|
+
}
|
|
1882
|
+
previousChatFirstSurfaceScopeRef.current = chatFirstSurfaceScope;
|
|
1883
|
+
persistChatFirstPane(null);
|
|
1884
|
+
setChatFirstNotice(null);
|
|
1885
|
+
pendingChatFirstOpenAppRef.current = null;
|
|
1886
|
+
chatFirstPaneHydratedRef.current = true;
|
|
1887
|
+
chatFirstSurfaceTabsStore.closeAll();
|
|
1888
|
+
setChatFirstSurfacePanelOpen(false);
|
|
1889
|
+
closeChatFirstSessionWatch();
|
|
1890
|
+
}, [
|
|
1891
|
+
chatFirstSurfaceScope,
|
|
1892
|
+
chatFirstSurfaceTabsStore,
|
|
1893
|
+
persistChatFirstPane,
|
|
1894
|
+
setChatFirstSurfacePanelOpen,
|
|
1895
|
+
]);
|
|
1896
|
+
|
|
1897
|
+
useEffect(() => {
|
|
1898
|
+
const tabCount = chatFirstSurfaceTabs.tabs.length;
|
|
1899
|
+
const previousTabCount = previousChatFirstSurfaceTabCountRef.current;
|
|
1900
|
+
if (!chatFirstMode || !chatFirstHasActiveChat) {
|
|
1901
|
+
setChatFirstSurfacePanelOpen(false);
|
|
1902
|
+
} else if (
|
|
1903
|
+
tabCount > 0 &&
|
|
1904
|
+
(previousTabCount === null || previousTabCount === 0)
|
|
1905
|
+
) {
|
|
1906
|
+
setChatFirstSurfacePanelOpen(true);
|
|
1907
|
+
} else if (
|
|
1908
|
+
tabCount === 0 &&
|
|
1909
|
+
previousTabCount !== null &&
|
|
1910
|
+
previousTabCount > 0
|
|
1911
|
+
) {
|
|
1912
|
+
setChatFirstSurfacePanelOpen(false);
|
|
1913
|
+
}
|
|
1914
|
+
previousChatFirstSurfaceTabCountRef.current = tabCount;
|
|
1915
|
+
}, [
|
|
1916
|
+
chatFirstMode,
|
|
1917
|
+
chatFirstHasActiveChat,
|
|
1918
|
+
setChatFirstSurfacePanelOpen,
|
|
1919
|
+
chatFirstSurfaceTabs.tabs.length,
|
|
1920
|
+
isChatRoute,
|
|
1921
|
+
]);
|
|
1922
|
+
|
|
1923
|
+
useEffect(() => {
|
|
1924
|
+
const activeTab = activeChatFirstSurfaceTab;
|
|
1925
|
+
if (
|
|
1926
|
+
activeTab?.kind === "side-chat" &&
|
|
1927
|
+
activeTab.session &&
|
|
1928
|
+
!chatFirstSessionWatch.target
|
|
1929
|
+
) {
|
|
1930
|
+
emitChatFirstSessionWatch(activeTab.session);
|
|
1931
|
+
}
|
|
1932
|
+
}, [activeChatFirstSurfaceTab, chatFirstSessionWatch.target]);
|
|
1933
|
+
|
|
1934
|
+
useEffect(() => {
|
|
1935
|
+
const pending = pendingChatFirstOpenAppRef.current;
|
|
1936
|
+
if (
|
|
1937
|
+
!pending ||
|
|
1938
|
+
chatFirstAppsQuery.isLoading ||
|
|
1939
|
+
chatFirstGrantedAppsQuery.isLoading
|
|
1940
|
+
)
|
|
1941
|
+
return;
|
|
1942
|
+
resolveChatFirstOpenApp(pending);
|
|
1943
|
+
}, [
|
|
1944
|
+
chatFirstAppsQuery.data,
|
|
1945
|
+
chatFirstAppsQuery.isError,
|
|
1946
|
+
chatFirstAppsQuery.isLoading,
|
|
1947
|
+
chatFirstGrantedAppsQuery.data,
|
|
1948
|
+
chatFirstGrantedAppsQuery.isLoading,
|
|
1949
|
+
resolveChatFirstOpenApp,
|
|
1950
|
+
]);
|
|
1951
|
+
|
|
1952
|
+
useEffect(() => {
|
|
1953
|
+
const target = chatFirstSessionWatch.target;
|
|
1954
|
+
if (!target || !chatFirstMode || !isChatRoute) return;
|
|
1955
|
+
setChatFirstPane(null);
|
|
1956
|
+
chatFirstSurfaceTabsStore.open({
|
|
1957
|
+
id: chatFirstSurfaceTabId("side-chat", target.sessionId),
|
|
1958
|
+
kind: "side-chat",
|
|
1959
|
+
title: target.title ? `Watch · ${target.title}` : "Watched session",
|
|
1960
|
+
session: target,
|
|
1961
|
+
});
|
|
1962
|
+
}, [
|
|
1963
|
+
chatFirstMode,
|
|
1964
|
+
chatFirstSessionWatch.target,
|
|
1965
|
+
chatFirstSurfaceTabsStore,
|
|
1966
|
+
isChatRoute,
|
|
1967
|
+
]);
|
|
1968
|
+
|
|
1969
|
+
useEffect(() => {
|
|
1970
|
+
if (!isWorkspaceAppRoute) return;
|
|
1971
|
+
setSidebarCollapsed(true);
|
|
1972
|
+
}, [isWorkspaceAppRoute, localPathname]);
|
|
1973
|
+
|
|
1974
|
+
useEffect(() => {
|
|
1975
|
+
if (!workspaceAppRouteActive && !chatFirstAppTakesMain) return;
|
|
1976
|
+
|
|
1977
|
+
const handleWorkspaceAppMessage = (event: MessageEvent) => {
|
|
1978
|
+
if (event.data?.type !== "agentNative.toggleSidebar") return;
|
|
1979
|
+
const frame = [
|
|
1980
|
+
...document.querySelectorAll<HTMLIFrameElement>(
|
|
1981
|
+
"[data-dispatch-workspace-app-frame]",
|
|
1982
|
+
),
|
|
1983
|
+
].find(
|
|
1984
|
+
(candidate) =>
|
|
1985
|
+
candidate
|
|
1986
|
+
.closest("[data-chat-first-surface-content]")
|
|
1987
|
+
?.getAttribute("aria-hidden") !== "true",
|
|
1988
|
+
);
|
|
1989
|
+
if (!(frame instanceof HTMLIFrameElement)) return;
|
|
1990
|
+
if (event.source !== frame.contentWindow) return;
|
|
1991
|
+
|
|
1992
|
+
const open = event.data.data?.open;
|
|
1993
|
+
if (open === true) {
|
|
1994
|
+
window.dispatchEvent(new Event("agent-panel:open"));
|
|
1995
|
+
} else if (open === false) {
|
|
1996
|
+
window.dispatchEvent(new Event("agent-panel:close"));
|
|
1997
|
+
} else {
|
|
1998
|
+
window.dispatchEvent(new Event("agent-panel:toggle"));
|
|
1999
|
+
}
|
|
2000
|
+
};
|
|
2001
|
+
|
|
2002
|
+
window.addEventListener("message", handleWorkspaceAppMessage);
|
|
2003
|
+
return () =>
|
|
2004
|
+
window.removeEventListener("message", handleWorkspaceAppMessage);
|
|
2005
|
+
}, [chatFirstAppTakesMain, workspaceAppRouteActive]);
|
|
2006
|
+
|
|
2007
|
+
useEffect(() => {
|
|
2008
|
+
if (typeof window === "undefined" || isWorkspaceAppHostRoute) return;
|
|
2009
|
+
try {
|
|
2010
|
+
window.localStorage.setItem(
|
|
2011
|
+
SIDEBAR_COLLAPSE_KEY,
|
|
2012
|
+
sidebarCollapsed ? "1" : "0",
|
|
2013
|
+
);
|
|
2014
|
+
} catch {
|
|
2015
|
+
// Ignore storage failures; the in-memory preference still works.
|
|
2016
|
+
}
|
|
2017
|
+
}, [isWorkspaceAppHostRoute, sidebarCollapsed]);
|
|
2018
|
+
|
|
2019
|
+
const activateChatFirstSurfaceTab = useCallback(
|
|
2020
|
+
(tab: (typeof chatFirstSurfaceTabs.tabs)[number]) => {
|
|
2021
|
+
chatFirstSurfaceTabsStore.activate(tab.id);
|
|
2022
|
+
if (tab.kind === "app" && tab.appId) {
|
|
2023
|
+
closeChatFirstSessionWatch();
|
|
2024
|
+
persistChatFirstPane({
|
|
2025
|
+
appId: tab.appId,
|
|
2026
|
+
placement: tab.placement,
|
|
2027
|
+
...(tab.path ? { path: tab.path } : {}),
|
|
2028
|
+
...(tab.view ? { view: tab.view } : {}),
|
|
2029
|
+
});
|
|
2030
|
+
return;
|
|
2031
|
+
}
|
|
2032
|
+
if (tab.kind === "browser" && tab.url) {
|
|
2033
|
+
persistChatFirstPane(null);
|
|
2034
|
+
closeChatFirstSessionWatch();
|
|
2035
|
+
return;
|
|
2036
|
+
}
|
|
2037
|
+
if (tab.kind === "side-chat" && tab.session) {
|
|
2038
|
+
persistChatFirstPane(null);
|
|
2039
|
+
emitChatFirstSessionWatch(tab.session);
|
|
2040
|
+
return;
|
|
2041
|
+
}
|
|
2042
|
+
if (tab.kind === "agents") {
|
|
2043
|
+
persistChatFirstPane(null);
|
|
2044
|
+
closeChatFirstSessionWatch();
|
|
2045
|
+
}
|
|
2046
|
+
},
|
|
2047
|
+
[
|
|
2048
|
+
chatFirstSurfaceTabs.tabs,
|
|
2049
|
+
chatFirstSurfaceTabsStore,
|
|
2050
|
+
persistChatFirstPane,
|
|
2051
|
+
],
|
|
2052
|
+
);
|
|
2053
|
+
|
|
2054
|
+
const closeChatFirstSurfaceTab = useCallback(
|
|
2055
|
+
(tab: (typeof chatFirstSurfaceTabs.tabs)[number]) => {
|
|
2056
|
+
const isActive = chatFirstSurfaceTabs.activeTabId === tab.id;
|
|
2057
|
+
if (tab.kind === "app" && isActive) persistChatFirstPane(null);
|
|
2058
|
+
if (tab.kind === "side-chat" && isActive) {
|
|
2059
|
+
closeChatFirstSessionWatch();
|
|
2060
|
+
}
|
|
2061
|
+
chatFirstSurfaceTabsStore.close(tab.id);
|
|
2062
|
+
},
|
|
2063
|
+
[chatFirstSurfaceTabs, chatFirstSurfaceTabsStore, persistChatFirstPane],
|
|
2064
|
+
);
|
|
2065
|
+
|
|
2066
|
+
const closeAllChatFirstSurfaceTabs = useCallback(() => {
|
|
2067
|
+
persistChatFirstPane(null);
|
|
2068
|
+
closeChatFirstSessionWatch();
|
|
2069
|
+
chatFirstSurfaceTabsStore.closeAll();
|
|
2070
|
+
}, [chatFirstSurfaceTabsStore, persistChatFirstPane]);
|
|
2071
|
+
|
|
2072
|
+
const renderChatFirstWatchChat = useCallback(
|
|
2073
|
+
(target: ChatFirstSessionReference) => (
|
|
2074
|
+
<AgentChatSurface
|
|
2075
|
+
mode="page"
|
|
2076
|
+
className="h-full min-h-0 w-full"
|
|
2077
|
+
defaultMode="chat"
|
|
2078
|
+
storageKey={`dispatch-session-watch:${target.sessionId}`}
|
|
2079
|
+
restoreActiveThread={false}
|
|
2080
|
+
threadUrlSync={{
|
|
2081
|
+
routeThreadId: target.sessionId,
|
|
2082
|
+
getPath: chatThreadPath,
|
|
2083
|
+
navigate: () => undefined,
|
|
2084
|
+
}}
|
|
2085
|
+
showHeader={false}
|
|
2086
|
+
showTabBar={false}
|
|
2087
|
+
showPageNewChatButton={false}
|
|
2088
|
+
chatOnly
|
|
2089
|
+
dynamicSuggestions={false}
|
|
2090
|
+
suggestions={[]}
|
|
2091
|
+
suppressInlineOpenApp={chatFirstMode}
|
|
2092
|
+
emptyStateDisplay="hidden"
|
|
2093
|
+
composerPlaceholder={t(
|
|
2094
|
+
"dispatch.pages.chatFirstSessionMessagePlaceholder",
|
|
2095
|
+
)}
|
|
2096
|
+
/>
|
|
2097
|
+
),
|
|
2098
|
+
[chatFirstMode, t],
|
|
2099
|
+
);
|
|
2100
|
+
|
|
2101
|
+
const renderChatFirstSurfaceTab = useCallback(
|
|
2102
|
+
(tab: ChatFirstSurfaceTab) => {
|
|
2103
|
+
if (tab.kind === "app") {
|
|
2104
|
+
const registration = tab.appId
|
|
2105
|
+
? (chatFirstAppRegistrations.find(
|
|
2106
|
+
(candidate) => candidate.id === tab.appId,
|
|
2107
|
+
) ?? null)
|
|
2108
|
+
: null;
|
|
2109
|
+
if (!registration) {
|
|
2110
|
+
return (
|
|
2111
|
+
<ChatFirstAppPane
|
|
2112
|
+
app={null}
|
|
2113
|
+
status={chatFirstAppsQuery.isLoading ? "loading" : "unresolved"}
|
|
2114
|
+
renderEmbed={() => null}
|
|
2115
|
+
copy={chatFirstCopy}
|
|
2116
|
+
/>
|
|
2117
|
+
);
|
|
2118
|
+
}
|
|
2119
|
+
const embedPath = tab.path ?? registration.path ?? "/";
|
|
2120
|
+
if (!embedPath.startsWith("/")) {
|
|
2121
|
+
return (
|
|
2122
|
+
<ChatFirstAppPane
|
|
2123
|
+
app={{
|
|
2124
|
+
id: registration.id,
|
|
2125
|
+
name: registration.name ?? registration.id,
|
|
2126
|
+
}}
|
|
2127
|
+
status="error"
|
|
2128
|
+
errorMessage={chatFirstCopy("appUnavailable")}
|
|
2129
|
+
renderEmbed={() => null}
|
|
2130
|
+
copy={chatFirstCopy}
|
|
2131
|
+
/>
|
|
2132
|
+
);
|
|
2133
|
+
}
|
|
2134
|
+
return (
|
|
2135
|
+
<WorkspaceAppFrame
|
|
2136
|
+
app={{
|
|
2137
|
+
id: registration.id,
|
|
2138
|
+
name: registration.name ?? registration.id,
|
|
2139
|
+
path: registration.path,
|
|
2140
|
+
url: registration.url,
|
|
2141
|
+
}}
|
|
2142
|
+
embedPath={embedPath}
|
|
2143
|
+
chatSidebar
|
|
2144
|
+
copy={chatFirstCopy}
|
|
2145
|
+
/>
|
|
2146
|
+
);
|
|
2147
|
+
}
|
|
2148
|
+
if (tab.kind === "browser" && tab.url) {
|
|
2149
|
+
return (
|
|
2150
|
+
<ChatFirstBrowserPane
|
|
2151
|
+
url={tab.url}
|
|
2152
|
+
title={tab.title}
|
|
2153
|
+
onClose={() => closeChatFirstSurfaceTab(tab)}
|
|
2154
|
+
renderEmbed={({ url, title, key }: ChatFirstEmbedTarget) => (
|
|
2155
|
+
<iframe
|
|
2156
|
+
key={key}
|
|
2157
|
+
src={url}
|
|
2158
|
+
title={title ?? chatFirstCopy("browserPage")}
|
|
2159
|
+
referrerPolicy="no-referrer"
|
|
2160
|
+
allow="clipboard-read; clipboard-write"
|
|
2161
|
+
className="h-full w-full border-0 bg-background"
|
|
2162
|
+
/>
|
|
2163
|
+
)}
|
|
2164
|
+
copy={chatFirstCopy}
|
|
2165
|
+
/>
|
|
2166
|
+
);
|
|
2167
|
+
}
|
|
2168
|
+
if (tab.kind === "side-chat") {
|
|
2169
|
+
const target =
|
|
2170
|
+
tab.session ??
|
|
2171
|
+
(tab.id === chatFirstSurfaceTabs.activeTabId
|
|
2172
|
+
? chatFirstSessionWatch.target
|
|
2173
|
+
: null);
|
|
2174
|
+
return target ? (
|
|
2175
|
+
<ChatFirstSessionWatchPane
|
|
2176
|
+
target={target}
|
|
2177
|
+
onClose={() => closeChatFirstSurfaceTab(tab)}
|
|
2178
|
+
renderChat={renderChatFirstWatchChat}
|
|
2179
|
+
copy={chatFirstCopy}
|
|
2180
|
+
/>
|
|
2181
|
+
) : null;
|
|
2182
|
+
}
|
|
2183
|
+
if (tab.kind === "agents") {
|
|
2184
|
+
return (
|
|
2185
|
+
<ChatFirstAgentsPane
|
|
2186
|
+
activities={chatFirstAgentActivities}
|
|
2187
|
+
loading={chatFirstAgentsQuery.isLoading}
|
|
2188
|
+
error={
|
|
2189
|
+
chatFirstAgentsQuery.isError
|
|
2190
|
+
? chatFirstAgentsQuery.error.message
|
|
2191
|
+
: null
|
|
2192
|
+
}
|
|
2193
|
+
onRefresh={() => void chatFirstAgentsQuery.refetch()}
|
|
2194
|
+
onWatch={(activity) =>
|
|
2195
|
+
emitChatFirstSessionWatch({
|
|
2196
|
+
sessionId: activity.sessionId,
|
|
2197
|
+
title: activity.title,
|
|
2198
|
+
kind: "agent-chat",
|
|
2199
|
+
...(activity.goalId ? { goalId: activity.goalId } : {}),
|
|
2200
|
+
})
|
|
2201
|
+
}
|
|
2202
|
+
copy={chatFirstCopy}
|
|
2203
|
+
/>
|
|
2204
|
+
);
|
|
2205
|
+
}
|
|
2206
|
+
return null;
|
|
2207
|
+
},
|
|
2208
|
+
[
|
|
2209
|
+
chatFirstAgentActivities,
|
|
2210
|
+
chatFirstAgentsQuery.error,
|
|
2211
|
+
chatFirstAgentsQuery.isError,
|
|
2212
|
+
chatFirstAgentsQuery.isLoading,
|
|
2213
|
+
chatFirstAppsQuery.isLoading,
|
|
2214
|
+
chatFirstCopy,
|
|
2215
|
+
chatFirstSessionWatch.target,
|
|
2216
|
+
chatFirstSurfaceTabs.activeTabId,
|
|
2217
|
+
chatFirstAppRegistrations,
|
|
2218
|
+
closeChatFirstSurfaceTab,
|
|
2219
|
+
renderChatFirstWatchChat,
|
|
2220
|
+
],
|
|
2221
|
+
);
|
|
2222
|
+
|
|
2223
|
+
if (CHROMELESS_PATHS.some((path) => localPathname === path)) {
|
|
2224
|
+
return <>{children}</>;
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
if (electronEmbedded) {
|
|
2228
|
+
return (
|
|
2229
|
+
<DispatchExtensionsContext.Provider value={extensions}>
|
|
2230
|
+
<HeaderActionsProvider>
|
|
2231
|
+
<div
|
|
2232
|
+
data-dispatch-electron-control-plane
|
|
2233
|
+
className="flex h-screen w-full overflow-hidden bg-background"
|
|
2234
|
+
>
|
|
2235
|
+
<div className="relative flex min-w-0 flex-1 flex-col overflow-hidden">
|
|
2236
|
+
<Header showAgentToggle={false} />
|
|
2237
|
+
<InvitationBanner />
|
|
2238
|
+
<main className="flex-1 overflow-y-auto">
|
|
2239
|
+
<div className="mx-auto max-w-7xl space-y-10 px-4 py-6 sm:px-6">
|
|
2240
|
+
{children}
|
|
2241
|
+
</div>
|
|
2242
|
+
</main>
|
|
2243
|
+
</div>
|
|
2244
|
+
</div>
|
|
2245
|
+
</HeaderActionsProvider>
|
|
2246
|
+
</DispatchExtensionsContext.Provider>
|
|
2247
|
+
);
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
if (isWorkspaceAppHostRoute) {
|
|
2251
|
+
return (
|
|
2252
|
+
<DispatchExtensionsContext.Provider value={extensions}>
|
|
2253
|
+
<HeaderActionsProvider>
|
|
2254
|
+
<div
|
|
2255
|
+
data-dispatch-workspace-app-chrome-less
|
|
2256
|
+
className="h-screen w-full overflow-hidden bg-background"
|
|
2257
|
+
>
|
|
2258
|
+
{children}
|
|
2259
|
+
</div>
|
|
2260
|
+
</HeaderActionsProvider>
|
|
2261
|
+
</DispatchExtensionsContext.Provider>
|
|
2262
|
+
);
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
const showHeader = !isChatRoute && !pageOwnsToolbar(localPathname);
|
|
2266
|
+
function openAskAgentFullscreen() {
|
|
2267
|
+
focusAgentChat();
|
|
2268
|
+
navigateWithAgentChatViewTransition(
|
|
2269
|
+
navigate,
|
|
2270
|
+
dispatchNavLinkTarget("/chat"),
|
|
2271
|
+
);
|
|
2272
|
+
}
|
|
2273
|
+
const sidebarSuggestions = [
|
|
2274
|
+
t("dispatch.sidebar.suggestionBuildApp"),
|
|
2275
|
+
t("dispatch.sidebar.suggestionRouteSlack"),
|
|
2276
|
+
t("dispatch.sidebar.suggestionGrantKey"),
|
|
2277
|
+
];
|
|
2278
|
+
const appContent = (
|
|
2279
|
+
<div className="relative flex h-full min-w-0 flex-1 flex-col overflow-hidden">
|
|
2280
|
+
{showHeader ? <Header onOpenMobile={() => setMobileOpen(true)} /> : null}
|
|
2281
|
+
<InvitationBanner />
|
|
2282
|
+
{isChatRoute && chatFirstMode && chatFirstHasActiveChat ? (
|
|
2283
|
+
<ChatFirstSurfacePanelToggle
|
|
2284
|
+
open={chatFirstSurfacePanel.open}
|
|
2285
|
+
onToggle={chatFirstSurfacePanel.toggle}
|
|
2286
|
+
className="absolute right-3 top-2 z-[4]"
|
|
2287
|
+
/>
|
|
2288
|
+
) : null}
|
|
2289
|
+
{isChatRoute && chatFirstMode && chatFirstNotice ? (
|
|
2290
|
+
<div
|
|
2291
|
+
className="dispatch-chat-first-notice"
|
|
2292
|
+
role="status"
|
|
2293
|
+
aria-live="polite"
|
|
2294
|
+
>
|
|
2295
|
+
<span>{chatFirstNotice}</span>
|
|
2296
|
+
<button
|
|
2297
|
+
type="button"
|
|
2298
|
+
onClick={() => setChatFirstNotice(null)}
|
|
2299
|
+
aria-label="Dismiss app notice"
|
|
2300
|
+
>
|
|
2301
|
+
Dismiss
|
|
2302
|
+
</button>
|
|
2303
|
+
</div>
|
|
2304
|
+
) : null}
|
|
2305
|
+
<main
|
|
2306
|
+
className={cn(
|
|
2307
|
+
"flex-1",
|
|
2308
|
+
isChatRoute || isWorkspaceAppRoute
|
|
2309
|
+
? "min-h-0 overflow-hidden"
|
|
2310
|
+
: "overflow-y-auto",
|
|
2311
|
+
)}
|
|
2312
|
+
>
|
|
2313
|
+
{showHeader ? (
|
|
2314
|
+
<div className="mx-auto max-w-7xl space-y-10 px-4 py-6 sm:px-6">
|
|
2315
|
+
{children}
|
|
2316
|
+
</div>
|
|
2317
|
+
) : (
|
|
2318
|
+
children
|
|
2319
|
+
)}
|
|
2320
|
+
</main>
|
|
2321
|
+
</div>
|
|
2322
|
+
);
|
|
2323
|
+
const chatFirstSurfaceTabsBar =
|
|
2324
|
+
activeChatFirstSurfaceTab?.kind === "app" ? null : (
|
|
2325
|
+
<ChatFirstSurfaceTabs
|
|
2326
|
+
tabs={chatFirstSurfaceTabs.tabs}
|
|
2327
|
+
activeTabId={chatFirstSurfaceTabs.activeTabId}
|
|
2328
|
+
onActivate={activateChatFirstSurfaceTab}
|
|
2329
|
+
onClose={closeChatFirstSurfaceTab}
|
|
2330
|
+
onCloseOthers={(tab) => {
|
|
2331
|
+
activateChatFirstSurfaceTab(tab);
|
|
2332
|
+
chatFirstSurfaceTabsStore.closeOthers(tab.id);
|
|
2333
|
+
}}
|
|
2334
|
+
onCloseToRight={(tab) => {
|
|
2335
|
+
const targetIndex = chatFirstSurfaceTabs.tabs.findIndex(
|
|
2336
|
+
(candidate) => candidate.id === tab.id,
|
|
2337
|
+
);
|
|
2338
|
+
const activeIndex = chatFirstSurfaceTabs.tabs.findIndex(
|
|
2339
|
+
(candidate) => candidate.id === chatFirstSurfaceTabs.activeTabId,
|
|
2340
|
+
);
|
|
2341
|
+
if (activeIndex > targetIndex) activateChatFirstSurfaceTab(tab);
|
|
2342
|
+
chatFirstSurfaceTabsStore.closeToRight(tab.id);
|
|
2343
|
+
}}
|
|
2344
|
+
onCloseAll={closeAllChatFirstSurfaceTabs}
|
|
2345
|
+
onOpenSurface={openChatFirstSurface}
|
|
2346
|
+
apps={chatFirstAppItems}
|
|
2347
|
+
onOpenApp={(app) => openChatFirstPane({ appId: app.id }, "side")}
|
|
2348
|
+
renderAppIcon={(app) => (
|
|
2349
|
+
<AppIcon
|
|
2350
|
+
id={app.id}
|
|
2351
|
+
name={app.name}
|
|
2352
|
+
size="sm"
|
|
2353
|
+
className="size-7 rounded-lg"
|
|
2354
|
+
/>
|
|
2355
|
+
)}
|
|
2356
|
+
copy={chatFirstCopy}
|
|
2357
|
+
/>
|
|
2358
|
+
);
|
|
2359
|
+
const chatFirstSurfaceContent =
|
|
2360
|
+
chatFirstSurfaceTabs.tabs.length > 0 ? (
|
|
2361
|
+
<ChatFirstSurfaceContent
|
|
2362
|
+
tabs={chatFirstSurfaceTabs.tabs}
|
|
2363
|
+
activeTabId={chatFirstSurfaceTabs.activeTabId}
|
|
2364
|
+
renderTab={renderChatFirstSurfaceTab}
|
|
2365
|
+
/>
|
|
2366
|
+
) : null;
|
|
2367
|
+
const workspaceAppChatName =
|
|
2368
|
+
(workspaceAppId
|
|
2369
|
+
? chatFirstAppRegistrations.find(
|
|
2370
|
+
(app) => app.id.toLowerCase() === workspaceAppId.toLowerCase(),
|
|
2371
|
+
)?.name
|
|
2372
|
+
: null) ??
|
|
2373
|
+
workspaceAppId ??
|
|
2374
|
+
"Workspace app";
|
|
2375
|
+
const workspaceAppContent =
|
|
2376
|
+
workspaceAppRouteActive && workspaceAppId ? (
|
|
2377
|
+
<WorkspaceAppChatRail
|
|
2378
|
+
appId={workspaceAppId}
|
|
2379
|
+
appName={workspaceAppChatName}
|
|
2380
|
+
agentPageHref={agentPageHref}
|
|
2381
|
+
onFullscreenRequest={openAskAgentFullscreen}
|
|
2382
|
+
>
|
|
2383
|
+
<WorkspaceAppKeepAlive activeAppId={workspaceAppId} />
|
|
2384
|
+
</WorkspaceAppChatRail>
|
|
2385
|
+
) : (
|
|
2386
|
+
<WorkspaceAppKeepAlive
|
|
2387
|
+
activeAppId={workspaceAppRouteActive ? workspaceAppId : null}
|
|
2388
|
+
/>
|
|
2389
|
+
);
|
|
2390
|
+
const content = isChatRoute ? (
|
|
2391
|
+
<div
|
|
2392
|
+
className={cn(
|
|
2393
|
+
"agent-layout-main-surface flex h-full min-w-0 flex-1 overflow-hidden",
|
|
2394
|
+
chatFirstMode && "dispatch-chat-first-surface",
|
|
2395
|
+
)}
|
|
2396
|
+
>
|
|
2397
|
+
{chatFirstAppTakesMain ? (
|
|
2398
|
+
<div
|
|
2399
|
+
className="flex min-w-0 flex-1 flex-col overflow-hidden"
|
|
2400
|
+
data-dispatch-chat-first-main-app
|
|
2401
|
+
>
|
|
2402
|
+
{chatFirstSurfaceContent}
|
|
2403
|
+
</div>
|
|
2404
|
+
) : (
|
|
2405
|
+
<>
|
|
2406
|
+
{appContent}
|
|
2407
|
+
{chatFirstMode &&
|
|
2408
|
+
chatFirstHasActiveChat &&
|
|
2409
|
+
chatFirstSurfacePanel.open ? (
|
|
2410
|
+
<ChatFirstSurfacePanel
|
|
2411
|
+
width={chatFirstSurfaceResize.width}
|
|
2412
|
+
onResizePointerDown={chatFirstSurfaceResize.onPointerDown}
|
|
2413
|
+
copy={chatFirstCopy}
|
|
2414
|
+
>
|
|
2415
|
+
{chatFirstSurfaceTabsBar}
|
|
2416
|
+
{chatFirstSurfaceContent}
|
|
2417
|
+
</ChatFirstSurfacePanel>
|
|
2418
|
+
) : null}
|
|
2419
|
+
</>
|
|
2420
|
+
)}
|
|
2421
|
+
</div>
|
|
2422
|
+
) : workspaceAppRouteActive ? null : isWorkspaceAppRoute ? (
|
|
2423
|
+
appContent
|
|
2424
|
+
) : (
|
|
2425
|
+
<AgentSidebar
|
|
2426
|
+
position="right"
|
|
2427
|
+
defaultOpen={false}
|
|
2428
|
+
agentPageHref={agentPageHref}
|
|
2429
|
+
chatViewTransition
|
|
2430
|
+
storageKey="dispatch"
|
|
2431
|
+
openOnChatRunning={chatHomeHandoffActive}
|
|
2432
|
+
onFullscreenRequest={openAskAgentFullscreen}
|
|
2433
|
+
emptyStateText={t("dispatch.sidebar.emptyAgentText")}
|
|
2434
|
+
suggestions={sidebarSuggestions}
|
|
2435
|
+
>
|
|
2436
|
+
{appContent}
|
|
2437
|
+
</AgentSidebar>
|
|
2438
|
+
);
|
|
2439
|
+
|
|
2440
|
+
return (
|
|
2441
|
+
<DispatchExtensionsContext.Provider value={extensions}>
|
|
2442
|
+
<HeaderActionsProvider>
|
|
2443
|
+
<div className="agent-layout-shell flex h-screen w-full overflow-hidden bg-background">
|
|
2444
|
+
<aside
|
|
2445
|
+
data-collapsed={sidebarCollapsed ? "true" : "false"}
|
|
2446
|
+
className={cn(
|
|
2447
|
+
"agent-layout-left-drawer hidden shrink-0 flex-col border-e !border-e-sidebar-border bg-sidebar text-sidebar-foreground transition-[width] duration-200 ease-out lg:flex",
|
|
2448
|
+
sidebarCollapsed ? "w-14" : "w-56",
|
|
2449
|
+
)}
|
|
2450
|
+
>
|
|
2451
|
+
<NavContent
|
|
2452
|
+
extensions={extensions}
|
|
2453
|
+
chatFirstMode={chatFirstMode}
|
|
2454
|
+
chatFirstEmbedded={chatFirstEmbedded}
|
|
2455
|
+
collapsed={sidebarCollapsed}
|
|
2456
|
+
chatFirstAppLayout={chatFirstAppLayout}
|
|
2457
|
+
onChatFirstAppLayoutChange={persistChatFirstAppLayout}
|
|
2458
|
+
chatFirstApps={chatFirstAppItems}
|
|
2459
|
+
chatFirstAppsLoading={chatFirstAppsQuery.isLoading}
|
|
2460
|
+
chatFirstAppsError={
|
|
2461
|
+
chatFirstAppsQuery.isError
|
|
2462
|
+
? chatFirstCopy("appsLoadError")
|
|
2463
|
+
: null
|
|
2464
|
+
}
|
|
2465
|
+
chatFirstActiveAppId={chatFirstActiveAppId}
|
|
2466
|
+
chatFirstActivePrimaryTab={chatFirstActivePrimaryTab}
|
|
2467
|
+
onChatFirstNewChat={() => {
|
|
2468
|
+
closeChatFirstSessionWatch();
|
|
2469
|
+
chatFirstSurfaceTabsStore.closeAll();
|
|
2470
|
+
setChatFirstSurfacePanelOpen(false);
|
|
2471
|
+
}}
|
|
2472
|
+
onChatFirstAppOpen={(app) => {
|
|
2473
|
+
if (isDispatchWorkspaceAppId(app.id)) return;
|
|
2474
|
+
setSidebarCollapsed(true);
|
|
2475
|
+
openChatFirstApp(app);
|
|
2476
|
+
}}
|
|
2477
|
+
onChatFirstAppsRetry={() => void chatFirstAppsQuery.refetch()}
|
|
2478
|
+
collapsible
|
|
2479
|
+
onCollapsedChange={setSidebarCollapsed}
|
|
2480
|
+
/>
|
|
2481
|
+
</aside>
|
|
2482
|
+
|
|
2483
|
+
<Sheet open={mobileOpen} onOpenChange={setMobileOpen}>
|
|
2484
|
+
<SheetContent
|
|
2485
|
+
side="left"
|
|
2486
|
+
className="w-72 bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
|
|
2487
|
+
>
|
|
2488
|
+
<SheetTitle className="sr-only">
|
|
2489
|
+
{t("dispatch.nav.navigation")}
|
|
2490
|
+
</SheetTitle>
|
|
2491
|
+
<SheetDescription className="sr-only">
|
|
2492
|
+
{t("dispatch.nav.navigationDescription")}
|
|
2493
|
+
</SheetDescription>
|
|
2494
|
+
<div className="flex h-full w-full flex-col">
|
|
2495
|
+
<NavContent
|
|
2496
|
+
extensions={extensions}
|
|
2497
|
+
chatFirstMode={chatFirstMode}
|
|
2498
|
+
chatFirstEmbedded={chatFirstEmbedded}
|
|
2499
|
+
collapsed={false}
|
|
2500
|
+
chatFirstAppLayout={chatFirstAppLayout}
|
|
2501
|
+
onChatFirstAppLayoutChange={persistChatFirstAppLayout}
|
|
2502
|
+
chatFirstApps={chatFirstAppItems}
|
|
2503
|
+
chatFirstAppsLoading={chatFirstAppsQuery.isLoading}
|
|
2504
|
+
chatFirstAppsError={
|
|
2505
|
+
chatFirstAppsQuery.isError
|
|
2506
|
+
? chatFirstCopy("appsLoadError")
|
|
2507
|
+
: null
|
|
2508
|
+
}
|
|
2509
|
+
chatFirstActiveAppId={chatFirstActiveAppId}
|
|
2510
|
+
chatFirstActivePrimaryTab={chatFirstActivePrimaryTab}
|
|
2511
|
+
onChatFirstNewChat={() => {
|
|
2512
|
+
closeChatFirstSessionWatch();
|
|
2513
|
+
chatFirstSurfaceTabsStore.closeAll();
|
|
2514
|
+
setChatFirstSurfacePanelOpen(false);
|
|
2515
|
+
}}
|
|
2516
|
+
onChatFirstAppOpen={openChatFirstApp}
|
|
2517
|
+
onChatFirstAppsRetry={() => void chatFirstAppsQuery.refetch()}
|
|
2518
|
+
onNavigate={() => setMobileOpen(false)}
|
|
2519
|
+
/>
|
|
2520
|
+
</div>
|
|
2521
|
+
</SheetContent>
|
|
2522
|
+
</Sheet>
|
|
2523
|
+
|
|
2524
|
+
<div className="relative min-w-0 flex-1 overflow-hidden">
|
|
2525
|
+
{content}
|
|
2526
|
+
{workspaceAppContent}
|
|
2527
|
+
</div>
|
|
2528
|
+
</div>
|
|
2529
|
+
</HeaderActionsProvider>
|
|
2530
|
+
</DispatchExtensionsContext.Provider>
|
|
2531
|
+
);
|
|
2532
|
+
}
|