@agent-native/dispatch 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -1
- package/dist/actions/apply-dream-proposal.d.ts +3 -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/create-dream-report.d.ts +3 -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-pylon-ticket.d.ts +3 -0
- package/dist/actions/create-pylon-ticket.d.ts.map +1 -0
- package/dist/actions/create-pylon-ticket.js +94 -0
- package/dist/actions/create-pylon-ticket.js.map +1 -0
- package/dist/actions/create-vault-grant.js +1 -1
- package/dist/actions/create-vault-grant.js.map +1 -1
- package/dist/actions/create-vault-secret.d.ts.map +1 -1
- package/dist/actions/create-vault-secret.js +4 -3
- package/dist/actions/create-vault-secret.js.map +1 -1
- package/dist/actions/create-workspace-resource.js +3 -3
- package/dist/actions/create-workspace-resource.js.map +1 -1
- package/dist/actions/delete-workspace-resource.js +1 -1
- package/dist/actions/delete-workspace-resource.js.map +1 -1
- package/dist/actions/ensure-dream-job.d.ts +3 -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-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 +3 -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-resource-effective-context.d.ts +3 -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.js +1 -1
- package/dist/actions/grant-vault-secrets-to-app.js.map +1 -1
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +38 -4
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/list-dream-candidates.d.ts +3 -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 +3 -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.js +1 -1
- package/dist/actions/list-integrations-catalog.js.map +1 -1
- package/dist/actions/list-vault-grants.js +1 -1
- package/dist/actions/list-vault-grants.js.map +1 -1
- package/dist/actions/list-workspace-apps.d.ts.map +1 -1
- package/dist/actions/list-workspace-apps.js +5 -1
- package/dist/actions/list-workspace-apps.js.map +1 -1
- package/dist/actions/list-workspace-resources-for-app.d.ts +3 -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.js +1 -1
- package/dist/actions/list-workspace-resources.js.map +1 -1
- package/dist/actions/navigate.d.ts +1 -0
- package/dist/actions/navigate.d.ts.map +1 -1
- package/dist/actions/navigate.js +2 -1
- package/dist/actions/navigate.js.map +1 -1
- package/dist/actions/preview-dream-proposal.d.ts +3 -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 +3 -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/reject-dream-proposal.d.ts +3 -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/restore-starter-workspace-resources.d.ts +3 -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/send-code-agent-remote-command.d.ts +3 -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/set-dream-settings.d.ts +3 -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-vault-access-settings.d.ts +3 -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.map +1 -1
- package/dist/actions/start-workspace-app-creation.js +6 -0
- package/dist/actions/start-workspace-app-creation.js.map +1 -1
- package/dist/actions/sync-vault-to-app.js +1 -1
- package/dist/actions/sync-vault-to-app.js.map +1 -1
- package/dist/actions/update-workspace-app-metadata.d.ts +3 -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.js +1 -1
- package/dist/actions/update-workspace-resource.js.map +1 -1
- package/dist/actions/view-screen.d.ts.map +1 -1
- package/dist/actions/view-screen.js +77 -4
- package/dist/actions/view-screen.js.map +1 -1
- package/dist/components/app-keys-popover.js +16 -5
- package/dist/components/app-keys-popover.js.map +1 -1
- package/dist/components/approval-value-block.d.ts +7 -0
- package/dist/components/approval-value-block.d.ts.map +1 -0
- package/dist/components/approval-value-block.js +22 -0
- package/dist/components/approval-value-block.js.map +1 -0
- package/dist/components/create-app-popover.d.ts.map +1 -1
- package/dist/components/create-app-popover.js +41 -16
- package/dist/components/create-app-popover.js.map +1 -1
- package/dist/components/dispatch-shell.d.ts +4 -4
- package/dist/components/dispatch-shell.d.ts.map +1 -1
- package/dist/components/dispatch-shell.js +6 -6
- package/dist/components/dispatch-shell.js.map +1 -1
- package/dist/components/layout/Layout.d.ts.map +1 -1
- package/dist/components/layout/Layout.js +18 -4
- package/dist/components/layout/Layout.js.map +1 -1
- package/dist/components/messaging-setup-panel.d.ts.map +1 -1
- package/dist/components/messaging-setup-panel.js +2 -2
- package/dist/components/messaging-setup-panel.js.map +1 -1
- package/dist/components/ui/chart.d.ts +1 -1
- package/dist/components/workspace-app-card.d.ts.map +1 -1
- package/dist/components/workspace-app-card.js +63 -3
- package/dist/components/workspace-app-card.js.map +1 -1
- package/dist/components/workspace-resource-effective-stack.d.ts +11 -0
- package/dist/components/workspace-resource-effective-stack.d.ts.map +1 -0
- package/dist/components/workspace-resource-effective-stack.js +59 -0
- package/dist/components/workspace-resource-effective-stack.js.map +1 -0
- package/dist/components/workspace-resource-impact-preview.d.ts +9 -0
- package/dist/components/workspace-resource-impact-preview.d.ts.map +1 -0
- package/dist/components/workspace-resource-impact-preview.js +39 -0
- package/dist/components/workspace-resource-impact-preview.js.map +1 -0
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +59 -0
- package/dist/db/migrations.js.map +1 -1
- package/dist/db/schema.d.ts +714 -0
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +44 -2
- package/dist/db/schema.js.map +1 -1
- package/dist/hooks/use-navigation-state.d.ts +3 -0
- package/dist/hooks/use-navigation-state.d.ts.map +1 -1
- package/dist/hooks/use-navigation-state.js +35 -8
- package/dist/hooks/use-navigation-state.js.map +1 -1
- package/dist/lib/catch-all-target.d.ts +2 -0
- package/dist/lib/catch-all-target.d.ts.map +1 -0
- package/dist/lib/catch-all-target.js +95 -0
- package/dist/lib/catch-all-target.js.map +1 -0
- package/dist/lib/utils.d.ts +2 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +5 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/workspace-apps.d.ts +9 -0
- package/dist/lib/workspace-apps.d.ts.map +1 -1
- package/dist/lib/workspace-apps.js.map +1 -1
- package/dist/routes/index.d.ts.map +1 -1
- package/dist/routes/index.js +1 -0
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/pages/$appId.d.ts +2 -2
- package/dist/routes/pages/$appId.d.ts.map +1 -1
- package/dist/routes/pages/$appId.js +17 -8
- package/dist/routes/pages/$appId.js.map +1 -1
- package/dist/routes/pages/approval.d.ts.map +1 -1
- package/dist/routes/pages/approval.js +4 -1
- package/dist/routes/pages/approval.js.map +1 -1
- package/dist/routes/pages/approvals.js +1 -1
- package/dist/routes/pages/approvals.js.map +1 -1
- 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 +435 -0
- package/dist/routes/pages/dreams.js.map +1 -0
- package/dist/routes/pages/integrations.d.ts.map +1 -1
- package/dist/routes/pages/integrations.js +20 -15
- package/dist/routes/pages/integrations.js.map +1 -1
- package/dist/routes/pages/new-app.js +1 -1
- package/dist/routes/pages/new-app.js.map +1 -1
- package/dist/routes/pages/overview.d.ts.map +1 -1
- package/dist/routes/pages/overview.js +5 -1
- package/dist/routes/pages/overview.js.map +1 -1
- package/dist/routes/pages/vault.d.ts.map +1 -1
- package/dist/routes/pages/vault.js +23 -5
- package/dist/routes/pages/vault.js.map +1 -1
- package/dist/routes/pages/workspace.d.ts.map +1 -1
- package/dist/routes/pages/workspace.js +187 -35
- package/dist/routes/pages/workspace.js.map +1 -1
- package/dist/server/lib/app-creation-store.d.ts +13 -0
- package/dist/server/lib/app-creation-store.d.ts.map +1 -1
- package/dist/server/lib/app-creation-store.js +298 -11
- package/dist/server/lib/app-creation-store.js.map +1 -1
- package/dist/server/lib/dispatch-integrations.d.ts +1 -1
- package/dist/server/lib/dispatch-integrations.d.ts.map +1 -1
- package/dist/server/lib/dispatch-integrations.js +9 -4
- package/dist/server/lib/dispatch-integrations.js.map +1 -1
- package/dist/server/lib/dispatch-remote-commands.d.ts +83 -0
- package/dist/server/lib/dispatch-remote-commands.d.ts.map +1 -0
- package/dist/server/lib/dispatch-remote-commands.js +256 -0
- package/dist/server/lib/dispatch-remote-commands.js.map +1 -0
- package/dist/server/lib/dispatch-store.d.ts +26 -0
- package/dist/server/lib/dispatch-store.d.ts.map +1 -1
- package/dist/server/lib/dispatch-store.js +17 -1
- package/dist/server/lib/dispatch-store.js.map +1 -1
- 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.map +1 -1
- package/dist/server/lib/env-config.js +5 -0
- package/dist/server/lib/env-config.js.map +1 -1
- package/dist/server/lib/onboarding-steps.d.ts +12 -0
- package/dist/server/lib/onboarding-steps.d.ts.map +1 -0
- package/dist/server/lib/onboarding-steps.js +47 -0
- package/dist/server/lib/onboarding-steps.js.map +1 -0
- package/dist/server/lib/thread-debug-store.d.ts +2 -2
- package/dist/server/lib/vault-store.d.ts +55 -0
- package/dist/server/lib/vault-store.d.ts.map +1 -1
- package/dist/server/lib/vault-store.js +210 -41
- package/dist/server/lib/vault-store.js.map +1 -1
- package/dist/server/lib/workspace-resources-store.d.ts +181 -17
- package/dist/server/lib/workspace-resources-store.d.ts.map +1 -1
- package/dist/server/lib/workspace-resources-store.js +737 -108
- package/dist/server/lib/workspace-resources-store.js.map +1 -1
- package/dist/server/plugins/agent-chat.d.ts.map +1 -1
- package/dist/server/plugins/agent-chat.js +2 -1
- package/dist/server/plugins/agent-chat.js.map +1 -1
- package/dist/server/plugins/core-routes.d.ts.map +1 -1
- package/dist/server/plugins/core-routes.js +4 -0
- package/dist/server/plugins/core-routes.js.map +1 -1
- package/dist/server/plugins/integrations.js +2 -2
- package/dist/server/plugins/integrations.js.map +1 -1
- package/package.json +15 -11
- package/src/actions/apply-dream-proposal.ts +12 -0
- package/src/actions/create-dream-report.ts +76 -0
- package/src/actions/create-pylon-ticket.ts +109 -0
- package/src/actions/create-vault-grant.ts +1 -1
- package/src/actions/create-vault-secret.ts +4 -3
- package/src/actions/create-workspace-resource.ts +3 -3
- package/src/actions/delete-workspace-resource.ts +1 -1
- package/src/actions/ensure-dream-job.ts +76 -0
- package/src/actions/get-dream-settings.ts +12 -0
- package/src/actions/get-dream.ts +14 -0
- package/src/actions/get-vault-access-settings.ts +11 -0
- package/src/actions/get-workspace-resource-effective-context.ts +34 -0
- package/src/actions/grant-vault-secrets-to-app.ts +1 -1
- package/src/actions/index.spec.ts +26 -0
- package/src/actions/index.ts +39 -4
- package/src/actions/list-dream-candidates.ts +77 -0
- package/src/actions/list-dreams.ts +17 -0
- package/src/actions/list-integrations-catalog.ts +1 -1
- package/src/actions/list-vault-grants.ts +1 -1
- package/src/actions/list-workspace-apps.ts +5 -1
- package/src/actions/list-workspace-resources-for-app.ts +13 -0
- package/src/actions/list-workspace-resources.ts +1 -1
- package/src/actions/navigate.ts +2 -1
- package/src/actions/preview-dream-proposal.ts +14 -0
- package/src/actions/preview-workspace-resource-change.ts +25 -0
- package/src/actions/reject-dream-proposal.ts +12 -0
- package/src/actions/restore-starter-workspace-resources.ts +17 -0
- package/src/actions/send-code-agent-remote-command.ts +59 -0
- package/src/actions/set-dream-settings.spec.ts +81 -0
- package/src/actions/set-dream-settings.ts +44 -0
- package/src/actions/set-vault-access-settings.ts +16 -0
- package/src/actions/start-workspace-app-creation.ts +8 -0
- package/src/actions/sync-vault-to-app.ts +1 -1
- package/src/actions/update-workspace-app-metadata.ts +32 -0
- package/src/actions/update-workspace-resource.ts +1 -1
- package/src/actions/view-screen.ts +94 -3
- package/src/components/app-keys-popover.tsx +23 -7
- package/src/components/approval-value-block.spec.tsx +59 -0
- package/src/components/approval-value-block.tsx +33 -0
- package/src/components/create-app-popover.tsx +50 -16
- package/src/components/dispatch-shell.tsx +16 -15
- package/src/components/layout/Layout.tsx +19 -5
- package/src/components/messaging-setup-panel.tsx +54 -39
- package/src/components/workspace-app-card.tsx +268 -1
- package/src/components/workspace-resource-effective-stack.spec.tsx +125 -0
- package/src/components/workspace-resource-effective-stack.tsx +141 -0
- package/src/components/workspace-resource-impact-preview.spec.tsx +147 -0
- package/src/components/workspace-resource-impact-preview.tsx +116 -0
- package/src/db/migrations.ts +59 -0
- package/src/db/schema.ts +46 -2
- package/src/hooks/use-navigation-state.ts +34 -9
- package/src/lib/catch-all-target.spec.ts +218 -0
- package/src/lib/catch-all-target.ts +99 -0
- package/src/lib/utils.ts +6 -1
- package/src/lib/workspace-apps.ts +9 -0
- package/src/routes/index.ts +1 -0
- package/src/routes/pages/$appId.tsx +21 -8
- package/src/routes/pages/approval.tsx +14 -1
- package/src/routes/pages/approvals.tsx +1 -1
- package/src/routes/pages/dream-settings.spec.ts +130 -0
- package/src/routes/pages/dream-settings.ts +103 -0
- package/src/routes/pages/dreams.tsx +1828 -0
- package/src/routes/pages/integrations.tsx +57 -18
- package/src/routes/pages/new-app.tsx +1 -1
- package/src/routes/pages/overview.tsx +11 -3
- package/src/routes/pages/vault.tsx +76 -9
- package/src/routes/pages/workspace.tsx +577 -97
- package/src/server/lib/app-creation-store.spec.ts +61 -2
- package/src/server/lib/app-creation-store.ts +389 -13
- package/src/server/lib/dispatch-integrations.ts +10 -3
- package/src/server/lib/dispatch-remote-commands.spec.ts +167 -0
- package/src/server/lib/dispatch-remote-commands.ts +375 -0
- package/src/server/lib/dispatch-store.ts +37 -1
- package/src/server/lib/dreams-store.spec.ts +1492 -0
- package/src/server/lib/dreams-store.ts +3168 -0
- package/src/server/lib/env-config.ts +5 -0
- package/src/server/lib/onboarding-steps.ts +49 -0
- package/src/server/lib/vault-store.spec.ts +69 -0
- package/src/server/lib/vault-store.ts +266 -49
- package/src/server/lib/workspace-resource-approval-lifecycle.spec.ts +236 -0
- package/src/server/lib/workspace-resources-store.spec.ts +1106 -0
- package/src/server/lib/workspace-resources-store.ts +1001 -134
- package/src/server/plugins/agent-chat.ts +2 -1
- package/src/server/plugins/core-routes.ts +5 -0
- package/src/server/plugins/integrations.ts +2 -2
- package/dist/actions/sync-workspace-resources-to-all.d.ts +0 -3
- package/dist/actions/sync-workspace-resources-to-all.d.ts.map +0 -1
- package/dist/actions/sync-workspace-resources-to-all.js +0 -9
- package/dist/actions/sync-workspace-resources-to-all.js.map +0 -1
- package/dist/actions/sync-workspace-resources-to-app.d.ts +0 -3
- package/dist/actions/sync-workspace-resources-to-app.d.ts.map +0 -1
- package/dist/actions/sync-workspace-resources-to-app.js +0 -11
- package/dist/actions/sync-workspace-resources-to-app.js.map +0 -1
- package/src/actions/sync-workspace-resources-to-all.ts +0 -10
- package/src/actions/sync-workspace-resources-to-app.ts +0 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAuCrE,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,YAAY,CAAC;AAE1D,MAAM,MAAM,eAAe,GAAG,aAAa,CAAC;IAC1C,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,WAAW,eAAe;IAC9B,uEAAuE;IACvE,EAAE,EAAE,MAAM,CAAC;IACX,iFAAiF;IACjF,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,mFAAmF;IACnF,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,gEAAgE;IAChE,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;CACvC;AAED,MAAM,WAAW,uBAAuB;IACtC,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACtC,kFAAkF;IAClF,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/B;AA2LD,wBAAgB,UAAU,CAAC,EACzB,UAAU,EACV,UAAU,GACX,EAAE;IACD,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,UAAU,CAAC,EAAE,uBAAuB,CAAC;CACtC,2CAsHA;AAED,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,UAAU,GACX,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,uBAAuB,CAAC;CACtC,2CAiEA"}
|
|
@@ -4,7 +4,7 @@ import { NavLink, useLocation } from "react-router";
|
|
|
4
4
|
import { AgentSidebar, FeedbackButton, appBasePath, appPath, useActionQuery, } from "@agent-native/core/client";
|
|
5
5
|
import { ExtensionsSidebarSection } from "@agent-native/core/client/extensions";
|
|
6
6
|
import { InvitationBanner, OrgSwitcher } from "@agent-native/core/client/org";
|
|
7
|
-
import { IconArrowUpRight, IconApps, IconChartBar, IconBrandTelegram, IconKey, IconChevronDown, IconLayersSubtract, IconMessages, IconPlugConnected, IconBroadcast, IconFingerprint, IconHistory, IconPuzzle, IconShieldCheck, IconUsersGroup, } from "@tabler/icons-react";
|
|
7
|
+
import { IconArrowUpRight, IconApps, IconBrain, IconChartBar, IconBrandTelegram, IconKey, IconChevronDown, IconLayersSubtract, IconMessages, IconPlugConnected, IconBroadcast, IconFingerprint, IconHistory, IconPuzzle, IconShieldCheck, IconUsersGroup, } from "@tabler/icons-react";
|
|
8
8
|
import { cn } from "../../lib/utils.js";
|
|
9
9
|
import { Sheet, SheetContent, SheetDescription, SheetTitle, } from "../../components/ui/sheet.js";
|
|
10
10
|
import { Header } from "./Header.js";
|
|
@@ -96,6 +96,13 @@ const OPERATIONS_NAV_ITEMS = [
|
|
|
96
96
|
icon: IconHistory,
|
|
97
97
|
section: "operations",
|
|
98
98
|
},
|
|
99
|
+
{
|
|
100
|
+
id: "dreams",
|
|
101
|
+
to: "/dreams",
|
|
102
|
+
label: "Dreams",
|
|
103
|
+
icon: IconBrain,
|
|
104
|
+
section: "operations",
|
|
105
|
+
},
|
|
99
106
|
{
|
|
100
107
|
id: "thread-debug",
|
|
101
108
|
to: "/thread-debug",
|
|
@@ -163,8 +170,15 @@ function dispatchNavLinkTarget(path) {
|
|
|
163
170
|
const basePath = appBasePath();
|
|
164
171
|
if (!basePath)
|
|
165
172
|
return path;
|
|
166
|
-
|
|
167
|
-
|
|
173
|
+
// Mirror the basename calculation entry.client.tsx uses to configure the
|
|
174
|
+
// router (basePath iff the current URL is under that mount, "" otherwise).
|
|
175
|
+
// Reading the live URL directly avoids races with the previous check on
|
|
176
|
+
// `__reactRouterContext.basename`, which could read undefined before the
|
|
177
|
+
// entry script set it — that race produced /dispatch/dispatch/<route>
|
|
178
|
+
// history entries that 404'd on back-button navigation.
|
|
179
|
+
const pathname = window.location.pathname;
|
|
180
|
+
const routerHasBasename = pathname === basePath || pathname.startsWith(`${basePath}/`);
|
|
181
|
+
return routerHasBasename ? path : appPath(path);
|
|
168
182
|
}
|
|
169
183
|
export function NavContent({ onNavigate, extensions, }) {
|
|
170
184
|
const location = useLocation();
|
|
@@ -203,6 +217,6 @@ export function Layout({ children, extensions, }) {
|
|
|
203
217
|
}
|
|
204
218
|
const showHeader = !pageOwnsToolbar(location.pathname);
|
|
205
219
|
const appContent = (_jsxs("div", { className: "flex h-full flex-1 flex-col overflow-hidden", children: [showHeader ? _jsx(Header, { onOpenMobile: () => setMobileOpen(true) }) : null, _jsx(InvitationBanner, {}), _jsx("main", { className: "flex-1 overflow-y-auto", children: showHeader ? (_jsx("div", { className: "mx-auto max-w-7xl space-y-10 px-4 py-6 sm:px-6", children: children })) : (children) })] }));
|
|
206
|
-
return (_jsx(HeaderActionsProvider, { children: _jsxs("div", { className: "flex h-screen w-full overflow-hidden bg-background", children: [_jsx("aside", { className: "hidden lg:flex w-64 shrink-0 flex-col border-r bg-sidebar text-sidebar-foreground", children: _jsx(NavContent, { extensions: extensions }) }), _jsx(Sheet, { open: mobileOpen, onOpenChange: setMobileOpen, children: _jsxs(SheetContent, { side: "left", className: "w-72 p-0 bg-sidebar text-sidebar-foreground [&>button]:hidden", children: [_jsx(SheetTitle, { className: "sr-only", children: "Navigation" }), _jsx(SheetDescription, { className: "sr-only", children: "Workspace navigation links" }), _jsx("div", { className: "flex h-full w-full flex-col", children: _jsx(NavContent, { extensions: extensions, onNavigate: () => setMobileOpen(false) }) })] }) }), _jsx(AgentSidebar, { position: "right", defaultOpen: false, emptyStateText: "Create apps,
|
|
220
|
+
return (_jsx(HeaderActionsProvider, { children: _jsxs("div", { className: "flex h-screen w-full overflow-hidden bg-background", children: [_jsx("aside", { className: "hidden lg:flex w-64 shrink-0 flex-col border-r bg-sidebar text-sidebar-foreground", children: _jsx(NavContent, { extensions: extensions }) }), _jsx(Sheet, { open: mobileOpen, onOpenChange: setMobileOpen, children: _jsxs(SheetContent, { side: "left", className: "w-72 p-0 bg-sidebar text-sidebar-foreground [&>button]:hidden", children: [_jsx(SheetTitle, { className: "sr-only", children: "Navigation" }), _jsx(SheetDescription, { className: "sr-only", children: "Workspace navigation links" }), _jsx("div", { className: "flex h-full w-full flex-col", children: _jsx(NavContent, { extensions: extensions, onNavigate: () => setMobileOpen(false) }) })] }) }), _jsx(AgentSidebar, { position: "right", defaultOpen: false, emptyStateText: "Create apps, manage vault keys, and route work across the workspace.", suggestions: SIDEBAR_SUGGESTIONS, children: appContent })] }) }));
|
|
207
221
|
}
|
|
208
222
|
//# sourceMappingURL=Layout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.js","sourceRoot":"","sources":["../../../src/components/layout/Layout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAsC,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,WAAW,EACX,OAAO,EACP,cAAc,GACf,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,OAAO,EACP,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,WAAW,EACX,UAAU,EACV,eAAe,EACf,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC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,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACvD,MAAM,UAAU,GAAG,CACjB,eAAK,SAAS,EAAC,6CAA6C,aACzD,UAAU,CAAC,CAAC,CAAC,KAAC,MAAM,IAAC,YAAY,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,GAAI,CAAC,CAAC,CAAC,IAAI,EACxE,KAAC,gBAAgB,KAAG,EACpB,eAAM,SAAS,EAAC,wBAAwB,YACrC,UAAU,CAAC,CAAC,CAAC,CACZ,cAAK,SAAS,EAAC,gDAAgD,YAC5D,QAAQ,GACL,CACP,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,GACI,IACH,CACP,CAAC;IAEF,OAAO,CACL,KAAC,qBAAqB,cACpB,eAAK,SAAS,EAAC,oDAAoD,aACjE,gBAAO,SAAS,EAAC,mFAAmF,YAClG,KAAC,UAAU,IAAC,UAAU,EAAE,UAAU,GAAI,GAChC,EAER,KAAC,KAAK,IAAC,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,YAClD,MAAC,YAAY,IACX,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,+DAA+D,aAEzE,KAAC,UAAU,IAAC,SAAS,EAAC,SAAS,2BAAwB,EACvD,KAAC,gBAAgB,IAAC,SAAS,EAAC,SAAS,2CAElB,EACnB,cAAK,SAAS,EAAC,6BAA6B,YAC1C,KAAC,UAAU,IACT,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GACtC,GACE,IACO,GACT,EAMR,KAAC,YAAY,IACX,QAAQ,EAAC,OAAO,EAChB,WAAW,EAAE,KAAK,EAClB,cAAc,EAAC,+DAA+D,EAC9E,WAAW,EAAE,mBAAmB,YAE/B,UAAU,GACE,IACX,GACgB,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import { useState, type ComponentType, type ReactNode } from \"react\";\nimport { NavLink, useLocation } from \"react-router\";\nimport {\n AgentSidebar,\n FeedbackButton,\n appBasePath,\n appPath,\n useActionQuery,\n} from \"@agent-native/core/client\";\nimport { ExtensionsSidebarSection } from \"@agent-native/core/client/extensions\";\nimport { InvitationBanner, OrgSwitcher } from \"@agent-native/core/client/org\";\nimport {\n IconArrowUpRight,\n IconApps,\n IconChartBar,\n IconBrandTelegram,\n IconKey,\n IconChevronDown,\n IconLayersSubtract,\n IconMessages,\n IconPlugConnected,\n IconBroadcast,\n IconFingerprint,\n IconHistory,\n IconPuzzle,\n IconShieldCheck,\n IconUsersGroup,\n} from \"@tabler/icons-react\";\nimport { cn } from \"@/lib/utils\";\nimport {\n Sheet,\n SheetContent,\n SheetDescription,\n SheetTitle,\n} from \"@/components/ui/sheet\";\nimport { Header } from \"./Header\";\nimport { HeaderActionsProvider } from \"./HeaderActions\";\n\nexport type DispatchNavSection = \"primary\" | \"operations\";\n\nexport type DispatchNavIcon = ComponentType<{\n size?: number | string;\n className?: string;\n}>;\n\nexport interface DispatchNavItem {\n /** Stable id used for keys and navigation.view. Avoid built-in ids. */\n id: string;\n /** React Router path for the tab, usually backed by an app/routes/*.tsx file. */\n to: string;\n label: string;\n icon?: DispatchNavIcon;\n /** Defaults to \"operations\", which is where local management tools usually fit. */\n section?: DispatchNavSection;\n /** Override active matching for nested or multi-route tools. */\n match?: (pathname: string) => boolean;\n}\n\nexport interface DispatchExtensionConfig {\n /** Extra sidebar tabs supplied by the generated workspace. */\n navItems?: readonly DispatchNavItem[];\n /** Extra React Query keys to invalidate when Dispatch receives DB sync events. */\n queryKeys?: readonly string[];\n}\n\nconst PRIMARY_NAV_ITEMS = [\n {\n id: \"overview\",\n to: \"/overview\",\n label: \"Overview\",\n icon: IconBroadcast,\n section: \"primary\",\n },\n {\n id: \"apps\",\n to: \"/apps\",\n label: \"Apps\",\n icon: IconApps,\n section: \"primary\",\n },\n {\n id: \"metrics\",\n to: \"/metrics\",\n label: \"Metrics\",\n icon: IconChartBar,\n section: \"primary\",\n },\n {\n id: \"vault\",\n to: \"/vault\",\n label: \"Vault\",\n icon: IconKey,\n section: \"primary\",\n },\n {\n id: \"integrations\",\n to: \"/integrations\",\n label: \"Integrations\",\n icon: IconPuzzle,\n section: \"primary\",\n },\n {\n id: \"agents\",\n to: \"/agents\",\n label: \"Agents\",\n icon: IconPlugConnected,\n section: \"primary\",\n },\n] as const satisfies readonly DispatchNavItem[];\n\nconst OPERATIONS_NAV_ITEMS = [\n {\n id: \"workspace\",\n to: \"/workspace\",\n label: \"Resources\",\n icon: IconLayersSubtract,\n section: \"operations\",\n },\n {\n id: \"messaging\",\n to: \"/messaging\",\n label: \"Messaging\",\n icon: IconBrandTelegram,\n section: \"operations\",\n },\n {\n id: \"destinations\",\n to: \"/destinations\",\n label: \"Destinations\",\n icon: IconArrowUpRight,\n section: \"operations\",\n },\n {\n id: \"identities\",\n to: \"/identities\",\n label: \"Identities\",\n icon: IconFingerprint,\n section: \"operations\",\n },\n {\n id: \"approvals\",\n to: \"/approvals\",\n label: \"Approvals\",\n icon: IconShieldCheck,\n section: \"operations\",\n },\n {\n id: \"audit\",\n to: \"/audit\",\n label: \"Audit\",\n icon: IconHistory,\n section: \"operations\",\n },\n {\n id: \"thread-debug\",\n to: \"/thread-debug\",\n label: \"Thread Debug\",\n icon: IconMessages,\n section: \"operations\",\n },\n {\n id: \"team\",\n to: \"/team\",\n label: \"Team\",\n icon: IconUsersGroup,\n section: \"operations\",\n },\n] as const satisfies readonly DispatchNavItem[];\n\nconst EMPTY_NAV_ITEMS: readonly DispatchNavItem[] = [];\n\nconst SIDEBAR_SUGGESTIONS = [\n \"Build a workspace app for X\",\n \"Route Slack mentions to my analytics app\",\n \"Grant my OpenAI key to this app\",\n];\n\nconst CHROMELESS_PATHS = [\"/approval\"];\n\n// Routes whose page renders its own toolbar (with NotificationsBell + AgentToggleButton).\n// Layout still mounts the sidebar + AgentSidebar, but skips its own Header so\n// there's no double-header.\nfunction pageOwnsToolbar(pathname: string): boolean {\n if (pathname === \"/tools\" || pathname.startsWith(\"/tools/\")) return true;\n if (pathname === \"/extensions\" || pathname.startsWith(\"/extensions/\"))\n return true;\n return false;\n}\n\ninterface WorkspaceInfo {\n name: string | null;\n displayName: string | null;\n appCount: number;\n}\n\nfunction sectionFor(item: DispatchNavItem): DispatchNavSection {\n return item.section ?? \"operations\";\n}\n\nfunction navItemMatchesPath(item: DispatchNavItem, pathname: string): boolean {\n if (item.match) {\n try {\n if (item.match(pathname)) return true;\n } catch {\n return false;\n }\n }\n return pathname === item.to || pathname.startsWith(`${item.to}/`);\n}\n\nfunction navItemsForSection(\n items: readonly DispatchNavItem[],\n section: DispatchNavSection,\n): DispatchNavItem[] {\n return items.filter((item) => sectionFor(item) === section);\n}\n\nfunction localDispatchPath(pathname: string): string {\n const basePath = appBasePath();\n if (!basePath) return pathname;\n if (pathname === basePath) return \"/\";\n if (pathname.startsWith(`${basePath}/`)) {\n return pathname.slice(basePath.length) || \"/\";\n }\n return pathname;\n}\n\nfunction dispatchNavLinkTarget(path: string): string {\n if (typeof window === \"undefined\") return path;\n const basePath = appBasePath();\n if (!basePath) return path;\n const context = (\n window as Window & { __reactRouterContext?: { basename?: string } }\n ).__reactRouterContext;\n return context?.basename === basePath ? path : appPath(path);\n}\n\nexport function NavContent({\n onNavigate,\n extensions,\n}: {\n onNavigate?: () => void;\n extensions?: DispatchExtensionConfig;\n}) {\n const location = useLocation();\n const { data: workspace } = useActionQuery(\n \"get-workspace-info\",\n {},\n { staleTime: 60_000 },\n );\n const ws = workspace as WorkspaceInfo | undefined;\n const workspaceLabel = ws?.displayName ?? ws?.name ?? null;\n const extensionNavItems = extensions?.navItems ?? EMPTY_NAV_ITEMS;\n const primaryNavItems = [\n ...PRIMARY_NAV_ITEMS,\n ...navItemsForSection(extensionNavItems, \"primary\"),\n ];\n const operationsNavItems = [\n ...OPERATIONS_NAV_ITEMS,\n ...navItemsForSection(extensionNavItems, \"operations\"),\n ];\n const localPathname = localDispatchPath(location.pathname);\n const operationsOpen = operationsNavItems.some((item) =>\n navItemMatchesPath(item, localPathname),\n );\n\n const renderNavItem = (item: DispatchNavItem) => {\n const Icon = item.icon;\n return (\n <li key={item.id}>\n <NavLink\n to={dispatchNavLinkTarget(item.to)}\n onClick={onNavigate}\n className={({ isActive }) => {\n const active = isActive || navItemMatchesPath(item, localPathname);\n return cn(\n \"flex h-8 w-full items-center gap-2 rounded-md px-2 text-sm\",\n active\n ? \"bg-sidebar-accent font-medium text-sidebar-accent-foreground\"\n : \"text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\",\n );\n }}\n >\n {Icon ? (\n <Icon size={16} className=\"shrink-0\" />\n ) : (\n <span className=\"h-4 w-4 shrink-0\" aria-hidden=\"true\" />\n )}\n <span className=\"truncate\">{item.label}</span>\n </NavLink>\n </li>\n );\n };\n\n return (\n <>\n <div className=\"border-b px-4 py-3\">\n <div className=\"flex items-center gap-3\">\n <div className=\"flex h-9 w-9 items-center justify-center rounded-xl border bg-card text-foreground\">\n <img\n src={appPath(\"/agent-native-icon-light.svg\")}\n alt=\"\"\n aria-hidden=\"true\"\n className=\"block h-4 w-auto shrink-0 dark:hidden\"\n />\n <img\n src={appPath(\"/agent-native-icon-dark.svg\")}\n alt=\"\"\n aria-hidden=\"true\"\n className=\"hidden h-4 w-auto shrink-0 dark:block\"\n />\n </div>\n <div className=\"min-w-0\">\n <div className=\"truncate text-sm font-semibold text-foreground\">\n {workspaceLabel ?? \"Dispatch\"}\n </div>\n <div className=\"truncate text-xs text-muted-foreground\">\n {workspaceLabel\n ? `Workspace · ${ws?.appCount ?? 0} app${ws?.appCount === 1 ? \"\" : \"s\"}`\n : \"Workspace control plane\"}\n </div>\n </div>\n </div>\n </div>\n\n <div className=\"flex min-h-0 flex-1 flex-col overflow-y-auto\">\n <nav className=\"px-2 py-3\">\n <ul className=\"space-y-0.5\">{primaryNavItems.map(renderNavItem)}</ul>\n </nav>\n\n <div className=\"mt-auto shrink-0\">\n <div className=\"border-t px-2 py-2\">\n <details className=\"group\" open={operationsOpen}>\n <summary className=\"flex h-8 cursor-pointer list-none items-center justify-between rounded-md px-2 text-xs font-medium uppercase text-sidebar-foreground/50 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [&::-webkit-details-marker]:hidden\">\n <span>Operations</span>\n <IconChevronDown\n size={14}\n className=\"transition-transform group-open:rotate-180\"\n />\n </summary>\n <ul className=\"mt-1 space-y-0.5\">\n {operationsNavItems.map(renderNavItem)}\n </ul>\n </details>\n </div>\n\n <div className=\"border-t px-2 py-1\">\n <ExtensionsSidebarSection />\n </div>\n\n <div className=\"border-t px-3 py-2\">\n <OrgSwitcher />\n </div>\n\n <div className=\"border-t px-3 py-2\">\n <FeedbackButton />\n </div>\n </div>\n </div>\n </>\n );\n}\n\nexport function Layout({\n children,\n extensions,\n}: {\n children: ReactNode;\n extensions?: DispatchExtensionConfig;\n}) {\n const location = useLocation();\n const [mobileOpen, setMobileOpen] = useState(false);\n\n if (CHROMELESS_PATHS.some((path) => location.pathname === path)) {\n return <>{children}</>;\n }\n\n const showHeader = !pageOwnsToolbar(location.pathname);\n const appContent = (\n <div className=\"flex h-full flex-1 flex-col overflow-hidden\">\n {showHeader ? <Header onOpenMobile={() => setMobileOpen(true)} /> : null}\n <InvitationBanner />\n <main className=\"flex-1 overflow-y-auto\">\n {showHeader ? (\n <div className=\"mx-auto max-w-7xl space-y-10 px-4 py-6 sm:px-6\">\n {children}\n </div>\n ) : (\n children\n )}\n </main>\n </div>\n );\n\n return (\n <HeaderActionsProvider>\n <div className=\"flex h-screen w-full overflow-hidden bg-background\">\n <aside className=\"hidden lg:flex w-64 shrink-0 flex-col border-r bg-sidebar text-sidebar-foreground\">\n <NavContent extensions={extensions} />\n </aside>\n\n <Sheet open={mobileOpen} onOpenChange={setMobileOpen}>\n <SheetContent\n side=\"left\"\n className=\"w-72 p-0 bg-sidebar text-sidebar-foreground [&>button]:hidden\"\n >\n <SheetTitle className=\"sr-only\">Navigation</SheetTitle>\n <SheetDescription className=\"sr-only\">\n Workspace navigation links\n </SheetDescription>\n <div className=\"flex h-full w-full flex-col\">\n <NavContent\n extensions={extensions}\n onNavigate={() => setMobileOpen(false)}\n />\n </div>\n </SheetContent>\n </Sheet>\n\n {/*\n * Always mount AgentSidebar so home composer's sendToAgentChat\n * fallback can pop it via agent-panel:open.\n */}\n <AgentSidebar\n position=\"right\"\n defaultOpen={false}\n emptyStateText=\"Create apps, grant keys, and route work across the workspace.\"\n suggestions={SIDEBAR_SUGGESTIONS}\n >\n {appContent}\n </AgentSidebar>\n </div>\n </HeaderActionsProvider>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Layout.js","sourceRoot":"","sources":["../../../src/components/layout/Layout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAsC,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,WAAW,EACX,OAAO,EACP,cAAc,GACf,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,OAAO,EACP,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,WAAW,EACX,UAAU,EACV,eAAe,EACf,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,KAAK,EACL,YAAY,EACZ,gBAAgB,EAChB,UAAU,GACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AA6BxD,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B,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import { useState, type ComponentType, type ReactNode } from \"react\";\nimport { NavLink, useLocation } from \"react-router\";\nimport {\n AgentSidebar,\n FeedbackButton,\n appBasePath,\n appPath,\n useActionQuery,\n} from \"@agent-native/core/client\";\nimport { ExtensionsSidebarSection } from \"@agent-native/core/client/extensions\";\nimport { InvitationBanner, OrgSwitcher } from \"@agent-native/core/client/org\";\nimport {\n IconArrowUpRight,\n IconApps,\n IconBrain,\n IconChartBar,\n IconBrandTelegram,\n IconKey,\n IconChevronDown,\n IconLayersSubtract,\n IconMessages,\n IconPlugConnected,\n IconBroadcast,\n IconFingerprint,\n IconHistory,\n IconPuzzle,\n IconShieldCheck,\n IconUsersGroup,\n} from \"@tabler/icons-react\";\nimport { cn } from \"@/lib/utils\";\nimport {\n Sheet,\n SheetContent,\n SheetDescription,\n SheetTitle,\n} from \"@/components/ui/sheet\";\nimport { Header } from \"./Header\";\nimport { HeaderActionsProvider } from \"./HeaderActions\";\n\nexport type DispatchNavSection = \"primary\" | \"operations\";\n\nexport type DispatchNavIcon = ComponentType<{\n size?: number | string;\n className?: string;\n}>;\n\nexport interface DispatchNavItem {\n /** Stable id used for keys and navigation.view. Avoid built-in ids. */\n id: string;\n /** React Router path for the tab, usually backed by an app/routes/*.tsx file. */\n to: string;\n label: string;\n icon?: DispatchNavIcon;\n /** Defaults to \"operations\", which is where local management tools usually fit. */\n section?: DispatchNavSection;\n /** Override active matching for nested or multi-route tools. */\n match?: (pathname: string) => boolean;\n}\n\nexport interface DispatchExtensionConfig {\n /** Extra sidebar tabs supplied by the generated workspace. */\n navItems?: readonly DispatchNavItem[];\n /** Extra React Query keys to invalidate when Dispatch receives DB sync events. */\n queryKeys?: readonly string[];\n}\n\nconst PRIMARY_NAV_ITEMS = [\n {\n id: \"overview\",\n to: \"/overview\",\n label: \"Overview\",\n icon: IconBroadcast,\n section: \"primary\",\n },\n {\n id: \"apps\",\n to: \"/apps\",\n label: \"Apps\",\n icon: IconApps,\n section: \"primary\",\n },\n {\n id: \"metrics\",\n to: \"/metrics\",\n label: \"Metrics\",\n icon: IconChartBar,\n section: \"primary\",\n },\n {\n id: \"vault\",\n to: \"/vault\",\n label: \"Vault\",\n icon: IconKey,\n section: \"primary\",\n },\n {\n id: \"integrations\",\n to: \"/integrations\",\n label: \"Integrations\",\n icon: IconPuzzle,\n section: \"primary\",\n },\n {\n id: \"agents\",\n to: \"/agents\",\n label: \"Agents\",\n icon: IconPlugConnected,\n section: \"primary\",\n },\n] as const satisfies readonly DispatchNavItem[];\n\nconst OPERATIONS_NAV_ITEMS = [\n {\n id: \"workspace\",\n to: \"/workspace\",\n label: \"Resources\",\n icon: IconLayersSubtract,\n section: \"operations\",\n },\n {\n id: \"messaging\",\n to: \"/messaging\",\n label: \"Messaging\",\n icon: IconBrandTelegram,\n section: \"operations\",\n },\n {\n id: \"destinations\",\n to: \"/destinations\",\n label: \"Destinations\",\n icon: IconArrowUpRight,\n section: \"operations\",\n },\n {\n id: \"identities\",\n to: \"/identities\",\n label: \"Identities\",\n icon: IconFingerprint,\n section: \"operations\",\n },\n {\n id: \"approvals\",\n to: \"/approvals\",\n label: \"Approvals\",\n icon: IconShieldCheck,\n section: \"operations\",\n },\n {\n id: \"audit\",\n to: \"/audit\",\n label: \"Audit\",\n icon: IconHistory,\n section: \"operations\",\n },\n {\n id: \"dreams\",\n to: \"/dreams\",\n label: \"Dreams\",\n icon: IconBrain,\n section: \"operations\",\n },\n {\n id: \"thread-debug\",\n to: \"/thread-debug\",\n label: \"Thread Debug\",\n icon: IconMessages,\n section: \"operations\",\n },\n {\n id: \"team\",\n to: \"/team\",\n label: \"Team\",\n icon: IconUsersGroup,\n section: \"operations\",\n },\n] as const satisfies readonly DispatchNavItem[];\n\nconst EMPTY_NAV_ITEMS: readonly DispatchNavItem[] = [];\n\nconst SIDEBAR_SUGGESTIONS = [\n \"Build a workspace app for X\",\n \"Route Slack mentions to my analytics app\",\n \"Grant my OpenAI key to this app\",\n];\n\nconst CHROMELESS_PATHS = [\"/approval\"];\n\n// Routes whose page renders its own toolbar (with NotificationsBell + AgentToggleButton).\n// Layout still mounts the sidebar + AgentSidebar, but skips its own Header so\n// there's no double-header.\nfunction pageOwnsToolbar(pathname: string): boolean {\n if (pathname === \"/tools\" || pathname.startsWith(\"/tools/\")) return true;\n if (pathname === \"/extensions\" || pathname.startsWith(\"/extensions/\"))\n return true;\n return false;\n}\n\ninterface WorkspaceInfo {\n name: string | null;\n displayName: string | null;\n appCount: number;\n}\n\nfunction sectionFor(item: DispatchNavItem): DispatchNavSection {\n return item.section ?? \"operations\";\n}\n\nfunction navItemMatchesPath(item: DispatchNavItem, pathname: string): boolean {\n if (item.match) {\n try {\n if (item.match(pathname)) return true;\n } catch {\n return false;\n }\n }\n return pathname === item.to || pathname.startsWith(`${item.to}/`);\n}\n\nfunction navItemsForSection(\n items: readonly DispatchNavItem[],\n section: DispatchNavSection,\n): DispatchNavItem[] {\n return items.filter((item) => sectionFor(item) === section);\n}\n\nfunction localDispatchPath(pathname: string): string {\n const basePath = appBasePath();\n if (!basePath) return pathname;\n if (pathname === basePath) return \"/\";\n if (pathname.startsWith(`${basePath}/`)) {\n return pathname.slice(basePath.length) || \"/\";\n }\n return pathname;\n}\n\nfunction dispatchNavLinkTarget(path: string): string {\n if (typeof window === \"undefined\") return path;\n const basePath = appBasePath();\n if (!basePath) return path;\n // Mirror the basename calculation entry.client.tsx uses to configure the\n // router (basePath iff the current URL is under that mount, \"\" otherwise).\n // Reading the live URL directly avoids races with the previous check on\n // `__reactRouterContext.basename`, which could read undefined before the\n // entry script set it — that race produced /dispatch/dispatch/<route>\n // history entries that 404'd on back-button navigation.\n const pathname = window.location.pathname;\n const routerHasBasename =\n pathname === basePath || pathname.startsWith(`${basePath}/`);\n return routerHasBasename ? path : appPath(path);\n}\n\nexport function NavContent({\n onNavigate,\n extensions,\n}: {\n onNavigate?: () => void;\n extensions?: DispatchExtensionConfig;\n}) {\n const location = useLocation();\n const { data: workspace } = useActionQuery(\n \"get-workspace-info\",\n {},\n { staleTime: 60_000 },\n );\n const ws = workspace as WorkspaceInfo | undefined;\n const workspaceLabel = ws?.displayName ?? ws?.name ?? null;\n const extensionNavItems = extensions?.navItems ?? EMPTY_NAV_ITEMS;\n const primaryNavItems = [\n ...PRIMARY_NAV_ITEMS,\n ...navItemsForSection(extensionNavItems, \"primary\"),\n ];\n const operationsNavItems = [\n ...OPERATIONS_NAV_ITEMS,\n ...navItemsForSection(extensionNavItems, \"operations\"),\n ];\n const localPathname = localDispatchPath(location.pathname);\n const operationsOpen = operationsNavItems.some((item) =>\n navItemMatchesPath(item, localPathname),\n );\n\n const renderNavItem = (item: DispatchNavItem) => {\n const Icon = item.icon;\n return (\n <li key={item.id}>\n <NavLink\n to={dispatchNavLinkTarget(item.to)}\n onClick={onNavigate}\n className={({ isActive }) => {\n const active = isActive || navItemMatchesPath(item, localPathname);\n return cn(\n \"flex h-8 w-full items-center gap-2 rounded-md px-2 text-sm\",\n active\n ? \"bg-sidebar-accent font-medium text-sidebar-accent-foreground\"\n : \"text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\",\n );\n }}\n >\n {Icon ? (\n <Icon size={16} className=\"shrink-0\" />\n ) : (\n <span className=\"h-4 w-4 shrink-0\" aria-hidden=\"true\" />\n )}\n <span className=\"truncate\">{item.label}</span>\n </NavLink>\n </li>\n );\n };\n\n return (\n <>\n <div className=\"border-b px-4 py-3\">\n <div className=\"flex items-center gap-3\">\n <div className=\"flex h-9 w-9 items-center justify-center rounded-xl border bg-card text-foreground\">\n <img\n src={appPath(\"/agent-native-icon-light.svg\")}\n alt=\"\"\n aria-hidden=\"true\"\n className=\"block h-4 w-auto shrink-0 dark:hidden\"\n />\n <img\n src={appPath(\"/agent-native-icon-dark.svg\")}\n alt=\"\"\n aria-hidden=\"true\"\n className=\"hidden h-4 w-auto shrink-0 dark:block\"\n />\n </div>\n <div className=\"min-w-0\">\n <div className=\"truncate text-sm font-semibold text-foreground\">\n {workspaceLabel ?? \"Dispatch\"}\n </div>\n <div className=\"truncate text-xs text-muted-foreground\">\n {workspaceLabel\n ? `Workspace · ${ws?.appCount ?? 0} app${ws?.appCount === 1 ? \"\" : \"s\"}`\n : \"Workspace control plane\"}\n </div>\n </div>\n </div>\n </div>\n\n <div className=\"flex min-h-0 flex-1 flex-col overflow-y-auto\">\n <nav className=\"px-2 py-3\">\n <ul className=\"space-y-0.5\">{primaryNavItems.map(renderNavItem)}</ul>\n </nav>\n\n <div className=\"mt-auto shrink-0\">\n <div className=\"border-t px-2 py-2\">\n <details className=\"group\" open={operationsOpen}>\n <summary className=\"flex h-8 cursor-pointer list-none items-center justify-between rounded-md px-2 text-xs font-medium uppercase text-sidebar-foreground/50 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [&::-webkit-details-marker]:hidden\">\n <span>Operations</span>\n <IconChevronDown\n size={14}\n className=\"transition-transform group-open:rotate-180\"\n />\n </summary>\n <ul className=\"mt-1 space-y-0.5\">\n {operationsNavItems.map(renderNavItem)}\n </ul>\n </details>\n </div>\n\n <div className=\"border-t px-2 py-1\">\n <ExtensionsSidebarSection />\n </div>\n\n <div className=\"border-t px-3 py-2\">\n <OrgSwitcher />\n </div>\n\n <div className=\"border-t px-3 py-2\">\n <FeedbackButton />\n </div>\n </div>\n </div>\n </>\n );\n}\n\nexport function Layout({\n children,\n extensions,\n}: {\n children: ReactNode;\n extensions?: DispatchExtensionConfig;\n}) {\n const location = useLocation();\n const [mobileOpen, setMobileOpen] = useState(false);\n\n if (CHROMELESS_PATHS.some((path) => location.pathname === path)) {\n return <>{children}</>;\n }\n\n const showHeader = !pageOwnsToolbar(location.pathname);\n const appContent = (\n <div className=\"flex h-full flex-1 flex-col overflow-hidden\">\n {showHeader ? <Header onOpenMobile={() => setMobileOpen(true)} /> : null}\n <InvitationBanner />\n <main className=\"flex-1 overflow-y-auto\">\n {showHeader ? (\n <div className=\"mx-auto max-w-7xl space-y-10 px-4 py-6 sm:px-6\">\n {children}\n </div>\n ) : (\n children\n )}\n </main>\n </div>\n );\n\n return (\n <HeaderActionsProvider>\n <div className=\"flex h-screen w-full overflow-hidden bg-background\">\n <aside className=\"hidden lg:flex w-64 shrink-0 flex-col border-r bg-sidebar text-sidebar-foreground\">\n <NavContent extensions={extensions} />\n </aside>\n\n <Sheet open={mobileOpen} onOpenChange={setMobileOpen}>\n <SheetContent\n side=\"left\"\n className=\"w-72 p-0 bg-sidebar text-sidebar-foreground [&>button]:hidden\"\n >\n <SheetTitle className=\"sr-only\">Navigation</SheetTitle>\n <SheetDescription className=\"sr-only\">\n Workspace navigation links\n </SheetDescription>\n <div className=\"flex h-full w-full flex-col\">\n <NavContent\n extensions={extensions}\n onNavigate={() => setMobileOpen(false)}\n />\n </div>\n </SheetContent>\n </Sheet>\n\n {/*\n * Always mount AgentSidebar so home composer's sendToAgentChat\n * fallback can pop it via agent-panel:open.\n */}\n <AgentSidebar\n position=\"right\"\n defaultOpen={false}\n emptyStateText=\"Create apps, manage vault keys, and route work across the workspace.\"\n suggestions={SIDEBAR_SUGGESTIONS}\n >\n {appContent}\n </AgentSidebar>\n </div>\n </HeaderActionsProvider>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messaging-setup-panel.d.ts","sourceRoot":"","sources":["../../src/components/messaging-setup-panel.tsx"],"names":[],"mappings":"AAuNA,wBAAgB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"messaging-setup-panel.d.ts","sourceRoot":"","sources":["../../src/components/messaging-setup-panel.tsx"],"names":[],"mappings":"AAuNA,wBAAgB,mBAAmB,4CAidlC"}
|
|
@@ -280,7 +280,7 @@ export function MessagingSetupPanel() {
|
|
|
280
280
|
required: true,
|
|
281
281
|
}));
|
|
282
282
|
const canEnable = configured;
|
|
283
|
-
return (_jsxs("section", { className: "rounded-2xl border bg-card p-5", children: [_jsxs("div", { className: "flex items-start justify-between gap-4", children: [_jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-xl border bg-muted/30 text-foreground", children: _jsx(platform.icon, { size: 18 }) }), _jsxs("div", { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("h3", { className: "text-base font-semibold text-foreground", children: platform.label }), _jsx(ConnectionStatus, { configured: configured, enabled: enabled })] }), _jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: platform.description })] })] }), _jsxs("div", { className: "flex items-center gap-
|
|
283
|
+
return (_jsxs("section", { className: "rounded-2xl border bg-card p-5", children: [_jsxs("div", { className: "flex items-start justify-between gap-4", children: [_jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-xl border bg-muted/30 text-foreground", children: _jsx(platform.icon, { size: 18 }) }), _jsxs("div", { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("h3", { className: "text-base font-semibold text-foreground", children: platform.label }), _jsx(ConnectionStatus, { configured: configured, enabled: enabled })] }), _jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: platform.description })] })] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [_jsx(Button, { asChild: true, variant: "ghost", size: "sm", className: "h-7 px-2 text-xs text-muted-foreground", children: _jsxs("a", { href: platform.docsUrl, target: "_blank", rel: "noreferrer", children: ["Docs", _jsx(IconExternalLink, { className: "ml-1 h-3 w-3" })] }) }), platform.externalUrl ? (_jsx(Button, { asChild: true, variant: "ghost", size: "sm", className: "h-7 px-2 text-xs text-muted-foreground", children: _jsxs("a", { href: platform.externalUrl, target: "_blank", rel: "noreferrer", children: [platform.externalLabel ?? "Open", _jsx(IconExternalLink, { className: "ml-1 h-3 w-3" })] }) })) : null] })] }), _jsxs(Collapsible, { className: "mt-5", children: [_jsxs(CollapsibleTrigger, { className: "group flex w-full cursor-pointer items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground", children: [_jsx(IconChevronRight, { className: "h-3.5 w-3.5 transition-transform group-data-[state=open]:rotate-90" }), _jsx("span", { children: "Setup steps" })] }), _jsx(CollapsibleContent, { children: _jsx("div", { className: "mt-2 rounded-xl border bg-muted/20 p-4", children: _jsx("ol", { className: "space-y-2 text-sm text-muted-foreground", children: platform.setupSteps.map((step, index) => (_jsxs("li", { className: "flex gap-2", children: [_jsxs("span", { className: "text-muted-foreground/60", children: [index + 1, "."] }), _jsx("span", { children: step })] }, step))) }) }) })] }), _jsxs("div", { className: "mt-4 space-y-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: "Credentials" }), envLoading ? (_jsx("span", { className: "text-xs text-muted-foreground", children: "Checking..." })) : null] }), _jsx("div", { className: "space-y-3", children: envKeys.map((envKey) => {
|
|
284
284
|
const envStatus = envStatusByKey.get(envKey.key);
|
|
285
285
|
const isConfigured = !!envStatus?.configured;
|
|
286
286
|
const helpText = envKey.helpText ?? envStatus?.helpText;
|
|
@@ -294,7 +294,7 @@ export function MessagingSetupPanel() {
|
|
|
294
294
|
})), placeholder: isPublicValue
|
|
295
295
|
? "agent@yourcompany.com"
|
|
296
296
|
: `Enter ${label}`, autoComplete: "off" })) : null] }, envKey.key));
|
|
297
|
-
}) }), envKeys.some((k) => !envStatusByKey.get(k.key)?.configured) ? (_jsx(Button, { variant: "outline", onClick: () => saveEnvKeys(platform, envKeys.map((k) => k.key)), disabled: savingKeysFor === platform.id, children: savingKeysFor === platform.id ? (_jsxs(_Fragment, { children: [_jsx(IconLoader2, { className: "mr-2 h-4 w-4 animate-spin" }), "Saving..."] })) : ("Save credentials") })) : null] }), status?.webhookUrl ? (_jsxs("div", { className: "mt-4 space-y-2", children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: "Webhook URL" }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("code", { className: "flex-1 truncate rounded-md border bg-muted/30 px-3 py-2 text-xs text-foreground", children: status.webhookUrl }), _jsx(Button, { variant: "outline", size: "icon", onClick: () => copyWebhook(status.webhookUrl), "aria-label": `Copy ${platform.label} webhook URL`, children: copiedWebhook === status.webhookUrl ? (_jsx(IconCheck, { className: "h-4 w-4" })) : (_jsx(IconCopy, { className: "h-4 w-4" })) })] })] })) : null, _jsxs("div", { className: "mt-5 flex flex-wrap gap-2", children: [platform.id === "telegram" && configured ? (_jsx(Button, { variant: "outline", onClick: () => runSetup(platform), disabled: setupPlatform === platform.id, children: setupPlatform === platform.id ? (_jsxs(_Fragment, { children: [_jsx(IconLoader2, { className: "mr-2 h-4 w-4 animate-spin" }), "Setting up..."] })) : ("Set up webhook") })) : null, _jsx(Button, { onClick: () => togglePlatform(platform, enabled), disabled: togglingPlatform === platform.id
|
|
297
|
+
}) }), envKeys.some((k) => !envStatusByKey.get(k.key)?.configured) ? (_jsx(Button, { variant: "outline", onClick: () => saveEnvKeys(platform, envKeys.map((k) => k.key)), disabled: savingKeysFor === platform.id, children: savingKeysFor === platform.id ? (_jsxs(_Fragment, { children: [_jsx(IconLoader2, { className: "mr-2 h-4 w-4 animate-spin" }), "Saving..."] })) : ("Save credentials") })) : null] }), status?.webhookUrl ? (_jsxs("div", { className: "mt-4 space-y-2", children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: "Webhook URL" }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("code", { className: "flex-1 truncate rounded-md border bg-muted/30 px-3 py-2 text-xs text-foreground", children: status.webhookUrl }), _jsx(Button, { variant: "outline", size: "icon", onClick: () => copyWebhook(status.webhookUrl), "aria-label": `Copy ${platform.label} webhook URL`, children: copiedWebhook === status.webhookUrl ? (_jsx(IconCheck, { className: "h-4 w-4" })) : (_jsx(IconCopy, { className: "h-4 w-4" })) })] })] })) : null, _jsxs("div", { className: "mt-5 flex flex-wrap items-center justify-end gap-2 border-t border-border pt-4", children: [platform.id === "telegram" && configured ? (_jsx(Button, { variant: "outline", onClick: () => runSetup(platform), disabled: setupPlatform === platform.id, children: setupPlatform === platform.id ? (_jsxs(_Fragment, { children: [_jsx(IconLoader2, { className: "mr-2 h-4 w-4 animate-spin" }), "Setting up..."] })) : ("Set up webhook") })) : null, !configured && !enabled ? (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("span", { tabIndex: 0, children: _jsx(Button, { disabled: true, children: "Enable" }) }) }), _jsx(TooltipContent, { children: "Save the required credentials first." })] })) : (_jsx(Button, { onClick: () => togglePlatform(platform, enabled), disabled: togglingPlatform === platform.id, children: togglingPlatform === platform.id ? (_jsxs(_Fragment, { children: [_jsx(IconLoader2, { className: "mr-2 h-4 w-4 animate-spin" }), "Saving..."] })) : enabled ? ("Disable") : ("Enable") }))] })] }, platform.id));
|
|
298
298
|
}) }), loading ? (_jsx("div", { className: "rounded-2xl border border-dashed px-4 py-6 text-sm text-muted-foreground", children: "Loading messaging status..." })) : null] }));
|
|
299
299
|
}
|
|
300
300
|
//# sourceMappingURL=messaging-setup-panel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messaging-setup-panel.js","sourceRoot":"","sources":["../../src/components/messaging-setup-panel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAA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AC/B,8BACE,KAAC,WAAW,IAAC,SAAS,EAAC,2BAA2B,GAAG,qBAEpD,CACJ,CAAC,CAAC,CAAC,CACF,gBAAgB,CACjB,GACM,CACV,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,MAAM,IACL,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,EAChD,QAAQ,EACN,gBAAgB,KAAK,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,YAG7D,gBAAgB,KAAK,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAClC,8BACE,KAAC,WAAW,IAAC,SAAS,EAAC,2BAA2B,GAAG,iBAEpD,CACJ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CACZ,SAAS,CACV,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,GACM,IACL,EAEL,CAAC,UAAU,CAAC,CAAC,CAAC,CACb,aAAG,SAAS,EAAC,oCAAoC,+DACA,QAAQ,CAAC,KAAK,SAE3D,CACL,CAAC,CAAC,CAAC,IAAI,KAhOH,QAAQ,CAAC,EAAE,CAiOR,CACX,CAAC;gBACJ,CAAC,CAAC,GACE,EAEL,OAAO,CAAC,CAAC,CAAC,CACT,cAAK,SAAS,EAAC,0EAA0E,4CAEnF,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useMemo, useState } from \"react\";\nimport { toast } from \"sonner\";\nimport {\n IconBrandSlack,\n IconBrandTelegram,\n IconBrandWhatsapp,\n IconCheck,\n IconChevronRight,\n IconCopy,\n IconExternalLink,\n IconInfoCircle,\n IconLoader2,\n IconMail,\n} from \"@tabler/icons-react\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"@/components/ui/collapsible\";\nimport { Input } from \"@/components/ui/input\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport { agentNativePath } from \"@agent-native/core/client\";\n\ninterface EnvStatus {\n key: string;\n label: string;\n required: boolean;\n configured: boolean;\n helpText?: string;\n}\n\ninterface RequiredEnvKey {\n key: string;\n label: string;\n required: boolean;\n helpText?: string;\n}\n\ninterface IntegrationStatus {\n platform: string;\n label: string;\n enabled: boolean;\n configured: boolean;\n webhookUrl?: string;\n requiredEnvKeys?: RequiredEnvKey[];\n}\n\ninterface PlatformDefinition {\n id: \"slack\" | \"telegram\" | \"email\" | \"whatsapp\";\n label: string;\n icon: typeof IconBrandSlack;\n description: string;\n /** Our own docs anchor — keep these on /docs/messaging so users land on\n * the page that explains the platform in plain English. */\n docsUrl: string;\n /** Optional external link (e.g. to the platform's developer console). */\n externalUrl?: string;\n externalLabel?: string;\n setupSteps: string[];\n /** Fallback env keys when the adapter doesn't surface them via\n * `IntegrationStatus.requiredEnvKeys`. The panel prefers adapter-supplied\n * keys when present so optional fields (webhook secrets, etc.) appear\n * automatically. */\n envKeys: string[];\n}\n\nconst PLATFORM_DEFINITIONS: PlatformDefinition[] = [\n {\n id: \"slack\",\n label: \"Slack\",\n icon: IconBrandSlack,\n description: \"Receive mentions and DMs in one workspace-aware dispatch.\",\n docsUrl: \"/docs/messaging#slack\",\n externalUrl: \"https://api.slack.com/apps\",\n externalLabel: \"Open Slack apps\",\n envKeys: [\"SLACK_BOT_TOKEN\", \"SLACK_SIGNING_SECRET\"],\n setupSteps: [\n \"Create or open a Slack app at api.slack.com/apps.\",\n \"Save the bot token and signing secret below — the webhook URL appears once they're saved.\",\n \"Back in Slack, enable Event Subscriptions and paste the webhook URL.\",\n \"Subscribe to app_mention and message.im events, then install the app.\",\n \"Optional but recommended: Basic Information → Display Information → upload an app icon and pick a background color so the bot has a clean avatar in every channel.\",\n ],\n },\n {\n id: \"telegram\",\n label: \"Telegram\",\n icon: IconBrandTelegram,\n description: \"Chat with dispatch through a Telegram bot.\",\n docsUrl: \"/docs/messaging#telegram\",\n externalUrl: \"https://t.me/BotFather\",\n externalLabel: \"Open BotFather\",\n envKeys: [\"TELEGRAM_BOT_TOKEN\"],\n setupSteps: [\n \"Open @BotFather in Telegram and send /newbot.\",\n \"Save the bot token here, then click Set up webhook below.\",\n \"DM the bot in Telegram to test.\",\n ],\n },\n {\n id: \"email\",\n label: \"Email\",\n icon: IconMail,\n description:\n \"Give your agent an email address. People can email it directly or CC it on threads.\",\n docsUrl: \"/docs/messaging#email\",\n externalUrl: \"https://resend.com/webhooks\",\n externalLabel: \"Open Resend webhooks\",\n envKeys: [\"EMAIL_AGENT_ADDRESS\"],\n setupSteps: [\n \"Save your Resend or SendGrid API key (Vault or onboarding).\",\n \"Pick an email address — the easiest is a free <slug>.resend.app address.\",\n \"If using your own domain, add MX records pointing to your provider.\",\n \"Save the address here, then register the webhook URL below in Resend (event: email.received).\",\n ],\n },\n {\n id: \"whatsapp\",\n label: \"WhatsApp\",\n icon: IconBrandWhatsapp,\n description:\n \"Receive WhatsApp messages and reply through a Meta-managed phone number.\",\n docsUrl: \"/docs/messaging#whatsapp\",\n externalUrl: \"https://developers.facebook.com/apps\",\n externalLabel: \"Open Meta developer console\",\n envKeys: [\n \"WHATSAPP_ACCESS_TOKEN\",\n \"WHATSAPP_VERIFY_TOKEN\",\n \"WHATSAPP_PHONE_NUMBER_ID\",\n ],\n setupSteps: [\n \"Create a Meta app and add the WhatsApp product.\",\n \"Save the access token, verify token, and phone number ID below.\",\n \"In Meta's WhatsApp configuration, paste the webhook URL and your verify token.\",\n \"Subscribe to the messages field, then enable here.\",\n ],\n },\n];\n\nfunction HelpTooltip({ content }: { content: string }) {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n className=\"text-muted-foreground/60 hover:text-foreground cursor-pointer\"\n >\n <IconInfoCircle className=\"h-3.5 w-3.5\" />\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"top\" className=\"max-w-64 text-xs leading-relaxed\">\n {content}\n </TooltipContent>\n </Tooltip>\n );\n}\n\nfunction StatusPill({\n tone,\n label,\n}: {\n tone: \"neutral\" | \"success\" | \"warning\";\n label: string;\n}) {\n const toneClass =\n tone === \"success\"\n ? \"border-emerald-500/30 bg-emerald-500/10 text-emerald-300\"\n : tone === \"warning\"\n ? \"border-amber-500/30 bg-amber-500/10 text-amber-300\"\n : \"border-border bg-muted/40 text-muted-foreground\";\n\n return (\n <span\n className={`inline-flex items-center rounded-full border px-2.5 py-1 text-[11px] font-medium ${toneClass}`}\n >\n {label}\n </span>\n );\n}\n\n/** Render a non-secret env value (e.g. EMAIL_AGENT_ADDRESS) as a copyable\n * text block. We can't read the actual value from the backend (env-status\n * only reports `configured: true|false`), so we offer a one-click reveal\n * that hits a server endpoint, falling back to \"saved\" if the value is\n * not exposed. For now we just render a \"Saved — re-enter to change\"\n * placeholder; a future endpoint can return the actual value. */\nfunction PublicValueReveal({ envKey: _envKey }: { envKey: string }) {\n return (\n <div className=\"rounded-md border bg-muted/20 px-3 py-2 text-xs text-muted-foreground\">\n Saved. Re-enter below to change.\n </div>\n );\n}\n\nfunction ConnectionStatus({\n configured,\n enabled,\n}: {\n configured: boolean;\n enabled: boolean;\n}) {\n if (enabled) {\n return <StatusPill tone=\"success\" label=\"Connected\" />;\n }\n if (configured) {\n return <StatusPill tone=\"warning\" label=\"Configured, not enabled\" />;\n }\n return <StatusPill tone=\"neutral\" label=\"Not configured\" />;\n}\n\nexport function MessagingSetupPanel() {\n const [statuses, setStatuses] = useState<IntegrationStatus[]>([]);\n const [loading, setLoading] = useState(true);\n const [envStatuses, setEnvStatuses] = useState<EnvStatus[]>([]);\n const [envLoading, setEnvLoading] = useState(true);\n const [envValues, setEnvValues] = useState<Record<string, string>>({});\n const [savingKeysFor, setSavingKeysFor] = useState<string | null>(null);\n const [togglingPlatform, setTogglingPlatform] = useState<string | null>(null);\n const [setupPlatform, setSetupPlatform] = useState<string | null>(null);\n const [copiedWebhook, setCopiedWebhook] = useState<string | null>(null);\n\n const refreshStatuses = async () => {\n setLoading(true);\n try {\n const res = await fetch(\n agentNativePath(\"/_agent-native/integrations/status\"),\n );\n const rows = res.ok ? await res.json() : [];\n setStatuses(Array.isArray(rows) ? rows : []);\n } finally {\n setLoading(false);\n }\n };\n\n useEffect(() => {\n let active = true;\n fetch(agentNativePath(\"/_agent-native/integrations/status\"))\n .then((res) => (res.ok ? res.json() : []))\n .then((rows) => {\n if (active) {\n setStatuses(Array.isArray(rows) ? rows : []);\n setLoading(false);\n }\n })\n .catch(() => {\n if (active) setLoading(false);\n });\n return () => {\n active = false;\n };\n }, []);\n\n useEffect(() => {\n let active = true;\n fetch(agentNativePath(\"/_agent-native/env-status\"))\n .then((res) => (res.ok ? res.json() : []))\n .then((rows) => {\n if (active) {\n setEnvStatuses(Array.isArray(rows) ? rows : []);\n setEnvLoading(false);\n }\n })\n .catch(() => {\n if (active) setEnvLoading(false);\n });\n return () => {\n active = false;\n };\n }, []);\n\n const envStatusByKey = useMemo(\n () => new Map(envStatuses.map((status) => [status.key, status])),\n [envStatuses],\n );\n const statusByPlatform = useMemo(\n () => new Map(statuses.map((status) => [status.platform, status])),\n [statuses],\n );\n\n const refreshEnvStatus = async () => {\n setEnvLoading(true);\n try {\n const res = await fetch(agentNativePath(\"/_agent-native/env-status\"));\n const rows = res.ok ? await res.json() : [];\n setEnvStatuses(Array.isArray(rows) ? rows : []);\n } finally {\n setEnvLoading(false);\n }\n };\n\n const saveEnvKeys = async (platform: PlatformDefinition, keys: string[]) => {\n const vars = keys\n .map((key) => ({ key, value: envValues[key]?.trim() || \"\" }))\n .filter((item) => item.value);\n\n if (vars.length === 0) {\n toast.error(\"Add the required credentials first.\");\n return;\n }\n\n setSavingKeysFor(platform.id);\n try {\n const res = await fetch(agentNativePath(\"/_agent-native/env-vars\"), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ vars }),\n });\n\n if (!res.ok) {\n const payload = await res.json().catch(() => ({}));\n throw new Error(payload.error || \"Failed to save credentials\");\n }\n\n toast.success(`${platform.label} credentials saved`);\n setEnvValues((current) => {\n const next = { ...current };\n for (const key of keys) delete next[key];\n return next;\n });\n await refreshEnvStatus();\n await refreshStatuses();\n } catch (error) {\n toast.error(\n error instanceof Error ? error.message : \"Failed to save credentials\",\n );\n } finally {\n setSavingKeysFor(null);\n }\n };\n\n const togglePlatform = async (\n platform: PlatformDefinition,\n enabled: boolean,\n ) => {\n setTogglingPlatform(platform.id);\n try {\n const action = enabled ? \"disable\" : \"enable\";\n const res = await fetch(\n `/_agent-native/integrations/${platform.id}/${action}`,\n {\n method: \"POST\",\n },\n );\n if (!res.ok) {\n const payload = await res.json().catch(() => ({}));\n throw new Error(\n payload.error || `Failed to ${action} ${platform.label}`,\n );\n }\n toast.success(\n enabled\n ? `${platform.label} disconnected`\n : `${platform.label} connected`,\n );\n await refreshStatuses();\n } catch (error) {\n toast.error(\n error instanceof Error ? error.message : \"Failed to update integration\",\n );\n } finally {\n setTogglingPlatform(null);\n }\n };\n\n const runSetup = async (platform: PlatformDefinition) => {\n setSetupPlatform(platform.id);\n try {\n const res = await fetch(\n `/_agent-native/integrations/${platform.id}/setup`,\n {\n method: \"POST\",\n },\n );\n if (!res.ok) {\n const payload = await res.json().catch(() => ({}));\n throw new Error(payload.error || `Failed to set up ${platform.label}`);\n }\n toast.success(\n platform.id === \"telegram\"\n ? \"Telegram webhook registered\"\n : `${platform.label} setup complete`,\n );\n await refreshStatuses();\n } catch (error) {\n toast.error(\n error instanceof Error\n ? error.message\n : `Failed to set up ${platform.label}`,\n );\n } finally {\n setSetupPlatform(null);\n }\n };\n\n const copyWebhook = async (webhookUrl: string) => {\n await navigator.clipboard.writeText(webhookUrl);\n setCopiedWebhook(webhookUrl);\n toast.success(\"Webhook URL copied\");\n setTimeout(() => setCopiedWebhook(null), 1500);\n };\n\n return (\n <div className=\"space-y-4\">\n <div className=\"grid gap-4 xl:grid-cols-2\">\n {PLATFORM_DEFINITIONS.map((platform) => {\n const status = statusByPlatform.get(platform.id);\n const configured = !!status?.configured;\n const enabled = !!status?.enabled;\n // Prefer adapter-supplied env keys (includes optional fields like\n // webhook secrets); fall back to the static list.\n const adapterKeys = status?.requiredEnvKeys;\n const envKeys: RequiredEnvKey[] =\n adapterKeys && adapterKeys.length > 0\n ? adapterKeys\n : platform.envKeys.map((key) => ({\n key,\n label: key,\n required: true,\n }));\n const canEnable = configured;\n\n return (\n <section\n key={platform.id}\n className=\"rounded-2xl border bg-card p-5\"\n >\n <div className=\"flex items-start justify-between gap-4\">\n <div className=\"flex items-start gap-3\">\n <div className=\"flex h-10 w-10 items-center justify-center rounded-xl border bg-muted/30 text-foreground\">\n <platform.icon size={18} />\n </div>\n <div>\n <div className=\"flex items-center gap-2\">\n <h3 className=\"text-base font-semibold text-foreground\">\n {platform.label}\n </h3>\n <ConnectionStatus\n configured={configured}\n enabled={enabled}\n />\n </div>\n <p className=\"mt-1 text-sm text-muted-foreground\">\n {platform.description}\n </p>\n </div>\n </div>\n <div className=\"flex items-center gap-3\">\n <a\n href={platform.docsUrl}\n className=\"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground\"\n >\n Docs\n </a>\n {platform.externalUrl ? (\n <a\n href={platform.externalUrl}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground\"\n >\n {platform.externalLabel ?? \"Open\"}\n <IconExternalLink className=\"h-3.5 w-3.5\" />\n </a>\n ) : null}\n </div>\n </div>\n\n <Collapsible className=\"mt-5\">\n <CollapsibleTrigger className=\"group flex w-full cursor-pointer items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground\">\n <IconChevronRight className=\"h-3.5 w-3.5 transition-transform group-data-[state=open]:rotate-90\" />\n <span>Setup steps</span>\n </CollapsibleTrigger>\n <CollapsibleContent>\n <div className=\"mt-2 rounded-xl border bg-muted/20 p-4\">\n <ol className=\"space-y-2 text-sm text-muted-foreground\">\n {platform.setupSteps.map((step, index) => (\n <li key={step} className=\"flex gap-2\">\n <span className=\"text-muted-foreground/60\">\n {index + 1}.\n </span>\n <span>{step}</span>\n </li>\n ))}\n </ol>\n </div>\n </CollapsibleContent>\n </Collapsible>\n\n <div className=\"mt-4 space-y-3\">\n <div className=\"flex items-center gap-2\">\n <div className=\"text-sm font-medium text-foreground\">\n Credentials\n </div>\n {envLoading ? (\n <span className=\"text-xs text-muted-foreground\">\n Checking...\n </span>\n ) : null}\n </div>\n <div className=\"space-y-3\">\n {envKeys.map((envKey) => {\n const envStatus = envStatusByKey.get(envKey.key);\n const isConfigured = !!envStatus?.configured;\n const helpText = envKey.helpText ?? envStatus?.helpText;\n const label =\n envKey.label || envStatus?.label || envKey.key;\n // Email agent address is not a secret — show it plainly\n // so users can copy and share it.\n const isPublicValue = envKey.key === \"EMAIL_AGENT_ADDRESS\";\n return (\n <div key={envKey.key} className=\"space-y-1.5\">\n <div className=\"flex items-center justify-between gap-3\">\n <div className=\"flex items-center gap-1.5\">\n <label className=\"text-xs font-medium text-foreground\">\n {label}\n {!envKey.required ? (\n <span className=\"ml-1 text-muted-foreground\">\n (optional)\n </span>\n ) : null}\n </label>\n {helpText ? (\n <HelpTooltip content={helpText} />\n ) : null}\n </div>\n {isConfigured ? (\n <StatusPill tone=\"success\" label=\"Saved\" />\n ) : (\n <StatusPill\n tone={envKey.required ? \"neutral\" : \"neutral\"}\n label={envKey.required ? \"Missing\" : \"Not set\"}\n />\n )}\n </div>\n {isConfigured && isPublicValue ? (\n <PublicValueReveal envKey={envKey.key} />\n ) : !isConfigured ? (\n <Input\n type={isPublicValue ? \"text\" : \"password\"}\n value={envValues[envKey.key] || \"\"}\n onChange={(event) =>\n setEnvValues((current) => ({\n ...current,\n [envKey.key]: event.target.value,\n }))\n }\n placeholder={\n isPublicValue\n ? \"agent@yourcompany.com\"\n : `Enter ${label}`\n }\n autoComplete=\"off\"\n />\n ) : null}\n </div>\n );\n })}\n </div>\n {envKeys.some((k) => !envStatusByKey.get(k.key)?.configured) ? (\n <Button\n variant=\"outline\"\n onClick={() =>\n saveEnvKeys(\n platform,\n envKeys.map((k) => k.key),\n )\n }\n disabled={savingKeysFor === platform.id}\n >\n {savingKeysFor === platform.id ? (\n <>\n <IconLoader2 className=\"mr-2 h-4 w-4 animate-spin\" />\n Saving...\n </>\n ) : (\n \"Save credentials\"\n )}\n </Button>\n ) : null}\n </div>\n\n {status?.webhookUrl ? (\n <div className=\"mt-4 space-y-2\">\n <div className=\"text-sm font-medium text-foreground\">\n Webhook URL\n </div>\n <div className=\"flex items-center gap-2\">\n <code className=\"flex-1 truncate rounded-md border bg-muted/30 px-3 py-2 text-xs text-foreground\">\n {status.webhookUrl}\n </code>\n <Button\n variant=\"outline\"\n size=\"icon\"\n onClick={() => copyWebhook(status.webhookUrl!)}\n aria-label={`Copy ${platform.label} webhook URL`}\n >\n {copiedWebhook === status.webhookUrl ? (\n <IconCheck className=\"h-4 w-4\" />\n ) : (\n <IconCopy className=\"h-4 w-4\" />\n )}\n </Button>\n </div>\n </div>\n ) : null}\n\n <div className=\"mt-5 flex flex-wrap gap-2\">\n {platform.id === \"telegram\" && configured ? (\n <Button\n variant=\"outline\"\n onClick={() => runSetup(platform)}\n disabled={setupPlatform === platform.id}\n >\n {setupPlatform === platform.id ? (\n <>\n <IconLoader2 className=\"mr-2 h-4 w-4 animate-spin\" />\n Setting up...\n </>\n ) : (\n \"Set up webhook\"\n )}\n </Button>\n ) : null}\n <Button\n onClick={() => togglePlatform(platform, enabled)}\n disabled={\n togglingPlatform === platform.id || (!enabled && !canEnable)\n }\n >\n {togglingPlatform === platform.id ? (\n <>\n <IconLoader2 className=\"mr-2 h-4 w-4 animate-spin\" />\n Saving...\n </>\n ) : enabled ? (\n \"Disable\"\n ) : (\n \"Enable\"\n )}\n </Button>\n </div>\n\n {!configured ? (\n <p className=\"mt-3 text-xs text-muted-foreground\">\n Save the required credentials before enabling {platform.label}\n .\n </p>\n ) : null}\n </section>\n );\n })}\n </div>\n\n {loading ? (\n <div className=\"rounded-2xl border border-dashed px-4 py-6 text-sm text-muted-foreground\">\n Loading messaging status...\n </div>\n ) : null}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"messaging-setup-panel.js","sourceRoot":"","sources":["../../src/components/messaging-setup-panel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AA6C5D,MAAM,oBAAoB,GAAyB;IACjD;QACE,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,2DAA2D;QACxE,OAAO,EAAE,uBAAuB;QAChC,WAAW,EAAE,4BAA4B;QACzC,aAAa,EAAE,iBAAiB;QAChC,OAAO,EAAE,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;QACpD,UAAU,EAAE;YACV,mDAAmD;YACnD,2FAA2F;YAC3F,sEAAsE;YACtE,uEAAuE;YACvE,oKAAoK;SACrK;KACF;IACD;QACE,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,iBAAiB;Q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,eACN,KAAC,cAAc,IAAC,OAAO,kBACrB,eAAM,QAAQ,EAAE,CAAC,YACf,KAAC,MAAM,IAAC,QAAQ,6BAAgB,GAC3B,GACQ,EACjB,KAAC,cAAc,uDAEE,IACT,CACX,CAAC,CAAC,CAAC,CACF,KAAC,MAAM,IACL,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,EAChD,QAAQ,EAAE,gBAAgB,KAAK,QAAQ,CAAC,EAAE,YAEzC,gBAAgB,KAAK,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAClC,8BACE,KAAC,WAAW,IAAC,SAAS,EAAC,2BAA2B,GAAG,iBAEpD,CACJ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CACZ,SAAS,CACV,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,GACM,CACV,IACG,KA/OD,QAAQ,CAAC,EAAE,CAgPR,CACX,CAAC;gBACJ,CAAC,CAAC,GACE,EAEL,OAAO,CAAC,CAAC,CAAC,CACT,cAAK,SAAS,EAAC,0EAA0E,4CAEnF,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useMemo, useState } from \"react\";\nimport { toast } from \"sonner\";\nimport {\n IconBrandSlack,\n IconBrandTelegram,\n IconBrandWhatsapp,\n IconCheck,\n IconChevronRight,\n IconCopy,\n IconExternalLink,\n IconInfoCircle,\n IconLoader2,\n IconMail,\n} from \"@tabler/icons-react\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from \"@/components/ui/collapsible\";\nimport { Input } from \"@/components/ui/input\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport { agentNativePath } from \"@agent-native/core/client\";\n\ninterface EnvStatus {\n key: string;\n label: string;\n required: boolean;\n configured: boolean;\n helpText?: string;\n}\n\ninterface RequiredEnvKey {\n key: string;\n label: string;\n required: boolean;\n helpText?: string;\n}\n\ninterface IntegrationStatus {\n platform: string;\n label: string;\n enabled: boolean;\n configured: boolean;\n webhookUrl?: string;\n requiredEnvKeys?: RequiredEnvKey[];\n}\n\ninterface PlatformDefinition {\n id: \"slack\" | \"telegram\" | \"email\" | \"whatsapp\";\n label: string;\n icon: typeof IconBrandSlack;\n description: string;\n /** Our own docs anchor — keep these on /docs/messaging so users land on\n * the page that explains the platform in plain English. */\n docsUrl: string;\n /** Optional external link (e.g. to the platform's developer console). */\n externalUrl?: string;\n externalLabel?: string;\n setupSteps: string[];\n /** Fallback env keys when the adapter doesn't surface them via\n * `IntegrationStatus.requiredEnvKeys`. The panel prefers adapter-supplied\n * keys when present so optional fields (webhook secrets, etc.) appear\n * automatically. */\n envKeys: string[];\n}\n\nconst PLATFORM_DEFINITIONS: PlatformDefinition[] = [\n {\n id: \"slack\",\n label: \"Slack\",\n icon: IconBrandSlack,\n description: \"Receive mentions and DMs in one workspace-aware dispatch.\",\n docsUrl: \"/docs/messaging#slack\",\n externalUrl: \"https://api.slack.com/apps\",\n externalLabel: \"Open Slack apps\",\n envKeys: [\"SLACK_BOT_TOKEN\", \"SLACK_SIGNING_SECRET\"],\n setupSteps: [\n \"Create or open a Slack app at api.slack.com/apps.\",\n \"Save the bot token and signing secret below — the webhook URL appears once they're saved.\",\n \"Back in Slack, enable Event Subscriptions and paste the webhook URL.\",\n \"Subscribe to app_mention and message.im events, then install the app.\",\n \"Optional but recommended: Basic Information → Display Information → upload an app icon and pick a background color so the bot has a clean avatar in every channel.\",\n ],\n },\n {\n id: \"telegram\",\n label: \"Telegram\",\n icon: IconBrandTelegram,\n description: \"Chat with dispatch through a Telegram bot.\",\n docsUrl: \"/docs/messaging#telegram\",\n externalUrl: \"https://t.me/BotFather\",\n externalLabel: \"Open BotFather\",\n envKeys: [\"TELEGRAM_BOT_TOKEN\"],\n setupSteps: [\n \"Open @BotFather in Telegram and send /newbot.\",\n \"Save the bot token here, then click Set up webhook below.\",\n \"DM the bot in Telegram to test.\",\n ],\n },\n {\n id: \"email\",\n label: \"Email\",\n icon: IconMail,\n description:\n \"Give your agent an email address. People can email it directly or CC it on threads.\",\n docsUrl: \"/docs/messaging#email\",\n externalUrl: \"https://resend.com/webhooks\",\n externalLabel: \"Open Resend webhooks\",\n envKeys: [\"EMAIL_AGENT_ADDRESS\"],\n setupSteps: [\n \"Save your Resend or SendGrid API key (Vault or onboarding).\",\n \"Pick an email address — the easiest is a free <slug>.resend.app address.\",\n \"If using your own domain, add MX records pointing to your provider.\",\n \"Save the address here, then register the webhook URL below in Resend (event: email.received).\",\n ],\n },\n {\n id: \"whatsapp\",\n label: \"WhatsApp\",\n icon: IconBrandWhatsapp,\n description:\n \"Receive WhatsApp messages and reply through a Meta-managed phone number.\",\n docsUrl: \"/docs/messaging#whatsapp\",\n externalUrl: \"https://developers.facebook.com/apps\",\n externalLabel: \"Open Meta developer console\",\n envKeys: [\n \"WHATSAPP_ACCESS_TOKEN\",\n \"WHATSAPP_VERIFY_TOKEN\",\n \"WHATSAPP_PHONE_NUMBER_ID\",\n ],\n setupSteps: [\n \"Create a Meta app and add the WhatsApp product.\",\n \"Save the access token, verify token, and phone number ID below.\",\n \"In Meta's WhatsApp configuration, paste the webhook URL and your verify token.\",\n \"Subscribe to the messages field, then enable here.\",\n ],\n },\n];\n\nfunction HelpTooltip({ content }: { content: string }) {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n className=\"text-muted-foreground/60 hover:text-foreground cursor-pointer\"\n >\n <IconInfoCircle className=\"h-3.5 w-3.5\" />\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"top\" className=\"max-w-64 text-xs leading-relaxed\">\n {content}\n </TooltipContent>\n </Tooltip>\n );\n}\n\nfunction StatusPill({\n tone,\n label,\n}: {\n tone: \"neutral\" | \"success\" | \"warning\";\n label: string;\n}) {\n const toneClass =\n tone === \"success\"\n ? \"border-emerald-500/30 bg-emerald-500/10 text-emerald-300\"\n : tone === \"warning\"\n ? \"border-amber-500/30 bg-amber-500/10 text-amber-300\"\n : \"border-border bg-muted/40 text-muted-foreground\";\n\n return (\n <span\n className={`inline-flex items-center rounded-full border px-2.5 py-1 text-[11px] font-medium ${toneClass}`}\n >\n {label}\n </span>\n );\n}\n\n/** Render a non-secret env value (e.g. EMAIL_AGENT_ADDRESS) as a copyable\n * text block. We can't read the actual value from the backend (env-status\n * only reports `configured: true|false`), so we offer a one-click reveal\n * that hits a server endpoint, falling back to \"saved\" if the value is\n * not exposed. For now we just render a \"Saved — re-enter to change\"\n * placeholder; a future endpoint can return the actual value. */\nfunction PublicValueReveal({ envKey: _envKey }: { envKey: string }) {\n return (\n <div className=\"rounded-md border bg-muted/20 px-3 py-2 text-xs text-muted-foreground\">\n Saved. Re-enter below to change.\n </div>\n );\n}\n\nfunction ConnectionStatus({\n configured,\n enabled,\n}: {\n configured: boolean;\n enabled: boolean;\n}) {\n if (enabled) {\n return <StatusPill tone=\"success\" label=\"Connected\" />;\n }\n if (configured) {\n return <StatusPill tone=\"warning\" label=\"Configured, not enabled\" />;\n }\n return <StatusPill tone=\"neutral\" label=\"Not configured\" />;\n}\n\nexport function MessagingSetupPanel() {\n const [statuses, setStatuses] = useState<IntegrationStatus[]>([]);\n const [loading, setLoading] = useState(true);\n const [envStatuses, setEnvStatuses] = useState<EnvStatus[]>([]);\n const [envLoading, setEnvLoading] = useState(true);\n const [envValues, setEnvValues] = useState<Record<string, string>>({});\n const [savingKeysFor, setSavingKeysFor] = useState<string | null>(null);\n const [togglingPlatform, setTogglingPlatform] = useState<string | null>(null);\n const [setupPlatform, setSetupPlatform] = useState<string | null>(null);\n const [copiedWebhook, setCopiedWebhook] = useState<string | null>(null);\n\n const refreshStatuses = async () => {\n setLoading(true);\n try {\n const res = await fetch(\n agentNativePath(\"/_agent-native/integrations/status\"),\n );\n const rows = res.ok ? await res.json() : [];\n setStatuses(Array.isArray(rows) ? rows : []);\n } finally {\n setLoading(false);\n }\n };\n\n useEffect(() => {\n let active = true;\n fetch(agentNativePath(\"/_agent-native/integrations/status\"))\n .then((res) => (res.ok ? res.json() : []))\n .then((rows) => {\n if (active) {\n setStatuses(Array.isArray(rows) ? rows : []);\n setLoading(false);\n }\n })\n .catch(() => {\n if (active) setLoading(false);\n });\n return () => {\n active = false;\n };\n }, []);\n\n useEffect(() => {\n let active = true;\n fetch(agentNativePath(\"/_agent-native/env-status\"))\n .then((res) => (res.ok ? res.json() : []))\n .then((rows) => {\n if (active) {\n setEnvStatuses(Array.isArray(rows) ? rows : []);\n setEnvLoading(false);\n }\n })\n .catch(() => {\n if (active) setEnvLoading(false);\n });\n return () => {\n active = false;\n };\n }, []);\n\n const envStatusByKey = useMemo(\n () => new Map(envStatuses.map((status) => [status.key, status])),\n [envStatuses],\n );\n const statusByPlatform = useMemo(\n () => new Map(statuses.map((status) => [status.platform, status])),\n [statuses],\n );\n\n const refreshEnvStatus = async () => {\n setEnvLoading(true);\n try {\n const res = await fetch(agentNativePath(\"/_agent-native/env-status\"));\n const rows = res.ok ? await res.json() : [];\n setEnvStatuses(Array.isArray(rows) ? rows : []);\n } finally {\n setEnvLoading(false);\n }\n };\n\n const saveEnvKeys = async (platform: PlatformDefinition, keys: string[]) => {\n const vars = keys\n .map((key) => ({ key, value: envValues[key]?.trim() || \"\" }))\n .filter((item) => item.value);\n\n if (vars.length === 0) {\n toast.error(\"Add the required credentials first.\");\n return;\n }\n\n setSavingKeysFor(platform.id);\n try {\n const res = await fetch(agentNativePath(\"/_agent-native/env-vars\"), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ vars }),\n });\n\n if (!res.ok) {\n const payload = await res.json().catch(() => ({}));\n throw new Error(payload.error || \"Failed to save credentials\");\n }\n\n toast.success(`${platform.label} credentials saved`);\n setEnvValues((current) => {\n const next = { ...current };\n for (const key of keys) delete next[key];\n return next;\n });\n await refreshEnvStatus();\n await refreshStatuses();\n } catch (error) {\n toast.error(\n error instanceof Error ? error.message : \"Failed to save credentials\",\n );\n } finally {\n setSavingKeysFor(null);\n }\n };\n\n const togglePlatform = async (\n platform: PlatformDefinition,\n enabled: boolean,\n ) => {\n setTogglingPlatform(platform.id);\n try {\n const action = enabled ? \"disable\" : \"enable\";\n const res = await fetch(\n `/_agent-native/integrations/${platform.id}/${action}`,\n {\n method: \"POST\",\n },\n );\n if (!res.ok) {\n const payload = await res.json().catch(() => ({}));\n throw new Error(\n payload.error || `Failed to ${action} ${platform.label}`,\n );\n }\n toast.success(\n enabled\n ? `${platform.label} disconnected`\n : `${platform.label} connected`,\n );\n await refreshStatuses();\n } catch (error) {\n toast.error(\n error instanceof Error ? error.message : \"Failed to update integration\",\n );\n } finally {\n setTogglingPlatform(null);\n }\n };\n\n const runSetup = async (platform: PlatformDefinition) => {\n setSetupPlatform(platform.id);\n try {\n const res = await fetch(\n `/_agent-native/integrations/${platform.id}/setup`,\n {\n method: \"POST\",\n },\n );\n if (!res.ok) {\n const payload = await res.json().catch(() => ({}));\n throw new Error(payload.error || `Failed to set up ${platform.label}`);\n }\n toast.success(\n platform.id === \"telegram\"\n ? \"Telegram webhook registered\"\n : `${platform.label} setup complete`,\n );\n await refreshStatuses();\n } catch (error) {\n toast.error(\n error instanceof Error\n ? error.message\n : `Failed to set up ${platform.label}`,\n );\n } finally {\n setSetupPlatform(null);\n }\n };\n\n const copyWebhook = async (webhookUrl: string) => {\n await navigator.clipboard.writeText(webhookUrl);\n setCopiedWebhook(webhookUrl);\n toast.success(\"Webhook URL copied\");\n setTimeout(() => setCopiedWebhook(null), 1500);\n };\n\n return (\n <div className=\"space-y-4\">\n <div className=\"grid gap-4 xl:grid-cols-2\">\n {PLATFORM_DEFINITIONS.map((platform) => {\n const status = statusByPlatform.get(platform.id);\n const configured = !!status?.configured;\n const enabled = !!status?.enabled;\n // Prefer adapter-supplied env keys (includes optional fields like\n // webhook secrets); fall back to the static list.\n const adapterKeys = status?.requiredEnvKeys;\n const envKeys: RequiredEnvKey[] =\n adapterKeys && adapterKeys.length > 0\n ? adapterKeys\n : platform.envKeys.map((key) => ({\n key,\n label: key,\n required: true,\n }));\n const canEnable = configured;\n\n return (\n <section\n key={platform.id}\n className=\"rounded-2xl border bg-card p-5\"\n >\n <div className=\"flex items-start justify-between gap-4\">\n <div className=\"flex items-start gap-3\">\n <div className=\"flex h-10 w-10 items-center justify-center rounded-xl border bg-muted/30 text-foreground\">\n <platform.icon size={18} />\n </div>\n <div>\n <div className=\"flex items-center gap-2\">\n <h3 className=\"text-base font-semibold text-foreground\">\n {platform.label}\n </h3>\n <ConnectionStatus\n configured={configured}\n enabled={enabled}\n />\n </div>\n <p className=\"mt-1 text-sm text-muted-foreground\">\n {platform.description}\n </p>\n </div>\n </div>\n <div className=\"flex shrink-0 items-center gap-1\">\n <Button\n asChild\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 px-2 text-xs text-muted-foreground\"\n >\n <a href={platform.docsUrl} target=\"_blank\" rel=\"noreferrer\">\n Docs\n <IconExternalLink className=\"ml-1 h-3 w-3\" />\n </a>\n </Button>\n {platform.externalUrl ? (\n <Button\n asChild\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 px-2 text-xs text-muted-foreground\"\n >\n <a\n href={platform.externalUrl}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n {platform.externalLabel ?? \"Open\"}\n <IconExternalLink className=\"ml-1 h-3 w-3\" />\n </a>\n </Button>\n ) : null}\n </div>\n </div>\n\n <Collapsible className=\"mt-5\">\n <CollapsibleTrigger className=\"group flex w-full cursor-pointer items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground\">\n <IconChevronRight className=\"h-3.5 w-3.5 transition-transform group-data-[state=open]:rotate-90\" />\n <span>Setup steps</span>\n </CollapsibleTrigger>\n <CollapsibleContent>\n <div className=\"mt-2 rounded-xl border bg-muted/20 p-4\">\n <ol className=\"space-y-2 text-sm text-muted-foreground\">\n {platform.setupSteps.map((step, index) => (\n <li key={step} className=\"flex gap-2\">\n <span className=\"text-muted-foreground/60\">\n {index + 1}.\n </span>\n <span>{step}</span>\n </li>\n ))}\n </ol>\n </div>\n </CollapsibleContent>\n </Collapsible>\n\n <div className=\"mt-4 space-y-3\">\n <div className=\"flex items-center gap-2\">\n <div className=\"text-sm font-medium text-foreground\">\n Credentials\n </div>\n {envLoading ? (\n <span className=\"text-xs text-muted-foreground\">\n Checking...\n </span>\n ) : null}\n </div>\n <div className=\"space-y-3\">\n {envKeys.map((envKey) => {\n const envStatus = envStatusByKey.get(envKey.key);\n const isConfigured = !!envStatus?.configured;\n const helpText = envKey.helpText ?? envStatus?.helpText;\n const label =\n envKey.label || envStatus?.label || envKey.key;\n // Email agent address is not a secret — show it plainly\n // so users can copy and share it.\n const isPublicValue = envKey.key === \"EMAIL_AGENT_ADDRESS\";\n return (\n <div key={envKey.key} className=\"space-y-1.5\">\n <div className=\"flex items-center justify-between gap-3\">\n <div className=\"flex items-center gap-1.5\">\n <label className=\"text-xs font-medium text-foreground\">\n {label}\n {!envKey.required ? (\n <span className=\"ml-1 text-muted-foreground\">\n (optional)\n </span>\n ) : null}\n </label>\n {helpText ? (\n <HelpTooltip content={helpText} />\n ) : null}\n </div>\n {isConfigured ? (\n <StatusPill tone=\"success\" label=\"Saved\" />\n ) : (\n <StatusPill\n tone={envKey.required ? \"neutral\" : \"neutral\"}\n label={envKey.required ? \"Missing\" : \"Not set\"}\n />\n )}\n </div>\n {isConfigured && isPublicValue ? (\n <PublicValueReveal envKey={envKey.key} />\n ) : !isConfigured ? (\n <Input\n type={isPublicValue ? \"text\" : \"password\"}\n value={envValues[envKey.key] || \"\"}\n onChange={(event) =>\n setEnvValues((current) => ({\n ...current,\n [envKey.key]: event.target.value,\n }))\n }\n placeholder={\n isPublicValue\n ? \"agent@yourcompany.com\"\n : `Enter ${label}`\n }\n autoComplete=\"off\"\n />\n ) : null}\n </div>\n );\n })}\n </div>\n {envKeys.some((k) => !envStatusByKey.get(k.key)?.configured) ? (\n <Button\n variant=\"outline\"\n onClick={() =>\n saveEnvKeys(\n platform,\n envKeys.map((k) => k.key),\n )\n }\n disabled={savingKeysFor === platform.id}\n >\n {savingKeysFor === platform.id ? (\n <>\n <IconLoader2 className=\"mr-2 h-4 w-4 animate-spin\" />\n Saving...\n </>\n ) : (\n \"Save credentials\"\n )}\n </Button>\n ) : null}\n </div>\n\n {status?.webhookUrl ? (\n <div className=\"mt-4 space-y-2\">\n <div className=\"text-sm font-medium text-foreground\">\n Webhook URL\n </div>\n <div className=\"flex items-center gap-2\">\n <code className=\"flex-1 truncate rounded-md border bg-muted/30 px-3 py-2 text-xs text-foreground\">\n {status.webhookUrl}\n </code>\n <Button\n variant=\"outline\"\n size=\"icon\"\n onClick={() => copyWebhook(status.webhookUrl!)}\n aria-label={`Copy ${platform.label} webhook URL`}\n >\n {copiedWebhook === status.webhookUrl ? (\n <IconCheck className=\"h-4 w-4\" />\n ) : (\n <IconCopy className=\"h-4 w-4\" />\n )}\n </Button>\n </div>\n </div>\n ) : null}\n\n <div className=\"mt-5 flex flex-wrap items-center justify-end gap-2 border-t border-border pt-4\">\n {platform.id === \"telegram\" && configured ? (\n <Button\n variant=\"outline\"\n onClick={() => runSetup(platform)}\n disabled={setupPlatform === platform.id}\n >\n {setupPlatform === platform.id ? (\n <>\n <IconLoader2 className=\"mr-2 h-4 w-4 animate-spin\" />\n Setting up...\n </>\n ) : (\n \"Set up webhook\"\n )}\n </Button>\n ) : null}\n {!configured && !enabled ? (\n <Tooltip>\n <TooltipTrigger asChild>\n <span tabIndex={0}>\n <Button disabled>Enable</Button>\n </span>\n </TooltipTrigger>\n <TooltipContent>\n Save the required credentials first.\n </TooltipContent>\n </Tooltip>\n ) : (\n <Button\n onClick={() => togglePlatform(platform, enabled)}\n disabled={togglingPlatform === platform.id}\n >\n {togglingPlatform === platform.id ? (\n <>\n <IconLoader2 className=\"mr-2 h-4 w-4 animate-spin\" />\n Saving...\n </>\n ) : enabled ? (\n \"Disable\"\n ) : (\n \"Enable\"\n )}\n </Button>\n )}\n </div>\n </section>\n );\n })}\n </div>\n\n {loading ? (\n <div className=\"rounded-2xl border border-dashed px-4 py-6 text-sm text-muted-foreground\">\n Loading messaging status...\n </div>\n ) : null}\n </div>\n );\n}\n"]}
|
|
@@ -25,7 +25,7 @@ declare const ChartStyle: ({ id, config }: {
|
|
|
25
25
|
config: ChartConfig;
|
|
26
26
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
27
27
|
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
28
|
-
declare const ChartTooltipContent: React.ForwardRefExoticComponent<Omit<Omit<RechartsPrimitive.DefaultTooltipContentProps<string | number, string>, "payload" | "
|
|
28
|
+
declare const ChartTooltipContent: React.ForwardRefExoticComponent<Omit<Omit<RechartsPrimitive.DefaultTooltipContentProps<string | number, string>, "payload" | "label" | "active" | "viewBox" | "coordinate" | "accessibilityLayer"> & {
|
|
29
29
|
active?: boolean;
|
|
30
30
|
allowEscapeViewBox?: import("recharts/types/util/types").AllowInDimension;
|
|
31
31
|
animationDuration?: import("recharts/types/util/types").AnimationDuration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-app-card.d.ts","sourceRoot":"","sources":["../../src/components/workspace-app-card.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workspace-app-card.d.ts","sourceRoot":"","sources":["../../src/components/workspace-app-card.tsx"],"names":[],"mappings":"AAuCA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,sBAAsB,CAAC;AAE9B,wBAAgB,gBAAgB,CAAC,EAC/B,GAAG,EACH,SAAS,GACV,EAAE;IACD,GAAG,EAAE,mBAAmB,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,2CAuOA"}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { useActionMutation, useActionQuery } from "@agent-native/core/client";
|
|
4
|
+
import { IconArrowUpRight, IconChevronDown, IconChevronRight, IconClockHour4, IconDots, IconEdit, IconEye, IconEyeOff, IconFileText, IconWorld, IconTrash, } from "@tabler/icons-react";
|
|
4
5
|
import { toast } from "sonner";
|
|
5
6
|
import { AppKeysPopover } from "../components/app-keys-popover.js";
|
|
7
|
+
import { AppResourceEffectiveStack } from "../components/workspace-resource-effective-stack.js";
|
|
6
8
|
import { Badge } from "../components/ui/badge.js";
|
|
9
|
+
import { Button } from "../components/ui/button.js";
|
|
10
|
+
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "../components/ui/dialog.js";
|
|
7
11
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "../components/ui/dropdown-menu.js";
|
|
12
|
+
import { Input } from "../components/ui/input.js";
|
|
13
|
+
import { Label } from "../components/ui/label.js";
|
|
14
|
+
import { Textarea } from "../components/ui/textarea.js";
|
|
8
15
|
import { cn } from "../lib/utils.js";
|
|
9
16
|
import { isPendingBuilderHref, workspaceAppHref, } from "../lib/workspace-apps.js";
|
|
10
17
|
export function WorkspaceAppCard({ app, className, }) {
|
|
@@ -12,6 +19,16 @@ export function WorkspaceAppCard({ app, className, }) {
|
|
|
12
19
|
const openInNewTab = isPendingBuilderHref(app);
|
|
13
20
|
const isPending = app.status === "pending";
|
|
14
21
|
const isArchived = !!app.archived;
|
|
22
|
+
const audience = app.audience ?? "internal";
|
|
23
|
+
const [editOpen, setEditOpen] = useState(false);
|
|
24
|
+
const [draftName, setDraftName] = useState(app.name);
|
|
25
|
+
const [draftDescription, setDraftDescription] = useState(app.description || "");
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (editOpen)
|
|
28
|
+
return;
|
|
29
|
+
setDraftName(app.name);
|
|
30
|
+
setDraftDescription(app.description || "");
|
|
31
|
+
}, [app.description, app.name, editOpen]);
|
|
15
32
|
const archive = useActionMutation("archive-workspace-app", {
|
|
16
33
|
onError: (err) => toast.error(`Could not hide ${app.name}: ${stringifyError(err)}`),
|
|
17
34
|
});
|
|
@@ -21,6 +38,13 @@ export function WorkspaceAppCard({ app, className, }) {
|
|
|
21
38
|
const removePending = useActionMutation("remove-pending-workspace-app", {
|
|
22
39
|
onError: (err) => toast.error(`Could not remove ${app.name}: ${stringifyError(err)}`),
|
|
23
40
|
});
|
|
41
|
+
const updateMetadata = useActionMutation("update-workspace-app-metadata", {
|
|
42
|
+
onSuccess: () => {
|
|
43
|
+
toast.success(`Updated ${draftName.trim() || app.name}`);
|
|
44
|
+
setEditOpen(false);
|
|
45
|
+
},
|
|
46
|
+
onError: (err) => toast.error(`Could not update ${app.name}: ${stringifyError(err)}`),
|
|
47
|
+
});
|
|
24
48
|
const handleArchive = () => {
|
|
25
49
|
archive.mutate({ appId: app.id });
|
|
26
50
|
toast.success(`Hid ${app.name} from the Apps list`);
|
|
@@ -33,7 +57,43 @@ export function WorkspaceAppCard({ app, className, }) {
|
|
|
33
57
|
removePending.mutate({ appId: app.id });
|
|
34
58
|
toast.success(`Removed pending ${app.name}`);
|
|
35
59
|
};
|
|
36
|
-
|
|
60
|
+
const handleMetadataSubmit = (event) => {
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
const name = draftName.trim();
|
|
63
|
+
if (!name) {
|
|
64
|
+
toast.error("App name is required.");
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
updateMetadata.mutate({
|
|
68
|
+
appId: app.id,
|
|
69
|
+
name,
|
|
70
|
+
description: draftDescription.trim(),
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
return (_jsxs("div", { "aria-disabled": !href, className: cn("group relative rounded-lg border bg-card p-4 transition hover:border-foreground/30 aria-disabled:opacity-60", isArchived && "opacity-70", className), children: [href ? (_jsx("a", { href: href, target: openInNewTab ? "_blank" : undefined, rel: openInNewTab ? "noreferrer" : undefined, "aria-label": `Open ${app.name}`, className: "absolute inset-0 z-0 rounded-lg" })) : null, _jsxs("div", { className: "pointer-events-none relative z-10 flex h-full items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx("h3", { className: "truncate text-sm font-semibold text-foreground", children: app.name }), isPending ? (_jsxs(Badge, { variant: "outline", className: "shrink-0 gap-1 border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300", children: [_jsx(IconClockHour4, { size: 12 }), "Building"] })) : null, isArchived ? (_jsxs(Badge, { variant: "outline", className: "shrink-0 gap-1", children: [_jsx(IconEyeOff, { size: 12 }), "Hidden"] })) : null, audience === "public" ? (_jsxs(Badge, { variant: "outline", className: "shrink-0 gap-1", children: [_jsx(IconWorld, { size: 12 }), "Public"] })) : null] }), _jsx("p", { className: "mt-1 truncate font-mono text-xs text-muted-foreground", children: app.path }), isPending && app.branchName ? (_jsxs("p", { className: "mt-1 truncate text-xs text-muted-foreground", children: ["Branch: ", app.branchName] })) : null, app.description ? (_jsx("p", { className: "mt-2 line-clamp-2 text-xs leading-relaxed text-muted-foreground", children: app.description })) : null] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [!isPending && !isArchived ? (_jsx("div", { className: "pointer-events-auto", children: _jsx(AppResourcesDialog, { app: app }) })) : null, !isPending && !isArchived ? (_jsx("div", { className: "pointer-events-auto", children: _jsx(AppKeysPopover, { appId: app.id, appName: app.name }) })) : null, _jsx("div", { className: "pointer-events-auto", children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("button", { type: "button", "aria-label": `More actions for ${app.name}`, className: "inline-flex h-7 w-7 cursor-pointer items-center justify-center rounded-md text-muted-foreground opacity-0 transition hover:bg-accent hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100 data-[state=open]:opacity-100", onClick: (e) => e.stopPropagation(), children: _jsx(IconDots, { size: 15 }) }) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-44", children: [_jsxs(DropdownMenuItem, { onSelect: (event) => {
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
setEditOpen(true);
|
|
76
|
+
}, children: [_jsx(IconEdit, { size: 14, className: "mr-2" }), "Edit details"] }), isPending ? (_jsxs(DropdownMenuItem, { onSelect: handleRemovePending, className: "text-red-600 focus:text-red-600 dark:text-red-400 dark:focus:text-red-400", children: [_jsx(IconTrash, { size: 14, className: "mr-2" }), "Remove from list"] })) : isArchived ? (_jsxs(DropdownMenuItem, { onSelect: handleUnarchive, children: [_jsx(IconEye, { size: 14, className: "mr-2" }), "Restore to list"] })) : (_jsxs(DropdownMenuItem, { onSelect: handleArchive, children: [_jsx(IconEyeOff, { size: 14, className: "mr-2" }), "Hide from list"] }))] })] }) }), href && !isArchived ? (_jsx(IconArrowUpRight, { size: 16, className: "text-muted-foreground transition group-hover:text-foreground" })) : null] })] }), _jsx(Dialog, { open: editOpen, onOpenChange: setEditOpen, children: _jsxs(DialogContent, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: "Edit app details" }) }), _jsxs("form", { className: "space-y-4", onSubmit: handleMetadataSubmit, children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: `app-name-${app.id}`, children: "Name" }), _jsx(Input, { id: `app-name-${app.id}`, value: draftName, maxLength: 120, onChange: (event) => setDraftName(event.target.value) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: `app-description-${app.id}`, children: "Description" }), _jsx(Textarea, { id: `app-description-${app.id}`, value: draftDescription, maxLength: 500, rows: 4, onChange: (event) => setDraftDescription(event.target.value) })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "outline", onClick: () => setEditOpen(false), children: "Cancel" }), _jsx(Button, { type: "submit", disabled: updateMetadata.isPending, children: updateMetadata.isPending ? "Saving..." : "Save" })] })] })] }) })] }));
|
|
77
|
+
}
|
|
78
|
+
function AppResourcesDialog({ app }) {
|
|
79
|
+
const [open, setOpen] = useState(false);
|
|
80
|
+
const [inspectedResourceId, setInspectedResourceId] = useState(null);
|
|
81
|
+
const { data, isLoading } = useActionQuery("list-workspace-resources-for-app", { appId: app.id }, { enabled: open });
|
|
82
|
+
const resources = (data?.resources ?? []);
|
|
83
|
+
const counts = data?.counts;
|
|
84
|
+
return (_jsxs(Dialog, { open: open, onOpenChange: (nextOpen) => {
|
|
85
|
+
setOpen(nextOpen);
|
|
86
|
+
if (!nextOpen)
|
|
87
|
+
setInspectedResourceId(null);
|
|
88
|
+
}, children: [_jsx(DialogTrigger, { asChild: true, children: _jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "h-7 px-2 text-xs", onClick: (e) => e.stopPropagation(), children: [_jsx(IconFileText, { size: 14, className: "mr-1" }), "Context"] }) }), _jsxs(DialogContent, { className: "max-w-2xl", children: [_jsxs(DialogHeader, { children: [_jsxs(DialogTitle, { children: [app.name, " workspace resources"] }), _jsx(DialogDescription, { children: "Workspace-level resources are inherited at runtime. App shared and personal resources can override them locally." })] }), _jsxs("div", { className: "space-y-4", children: [_jsx("div", { className: "rounded-lg border bg-muted/30 px-3 py-2 text-xs leading-relaxed text-muted-foreground", children: "All-app resources live once at workspace scope and are read by each app agent when it builds context. Nothing is copied into this app." }), _jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsxs(Badge, { variant: "secondary", children: [counts?.total ?? 0, " total"] }), _jsxs(Badge, { variant: "outline", children: [counts?.workspace ?? counts?.global ?? 0, " workspace"] }), _jsxs(Badge, { variant: "outline", children: [counts?.granted ?? 0, " granted"] }), _jsxs(Badge, { variant: "outline", children: [counts?.autoLoaded ?? 0, " auto-loaded"] })] }), isLoading ? (_jsxs("div", { className: "space-y-2", children: [_jsx("div", { className: "h-14 rounded-lg border bg-muted/30" }), _jsx("div", { className: "h-14 rounded-lg border bg-muted/30" }), _jsx("div", { className: "h-14 rounded-lg border bg-muted/30" })] })) : resources.length === 0 ? (_jsx("div", { className: "rounded-lg border border-dashed px-4 py-8 text-center text-sm text-muted-foreground", children: "No workspace or granted resources are visible to this app yet." })) : (_jsx("div", { className: "max-h-[420px] space-y-2 overflow-y-auto pr-1", children: resources.map((resource) => {
|
|
89
|
+
const inspected = inspectedResourceId === resource.id;
|
|
90
|
+
return (_jsxs("div", { className: "rounded-lg border px-3 py-3", children: [_jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("span", { className: "text-sm font-medium text-foreground", children: resource.name }), _jsx(Badge, { variant: "secondary", children: resource.kind }), _jsx(Badge, { variant: "outline", children: resource.source === "workspace"
|
|
91
|
+
? "All apps"
|
|
92
|
+
: "Granted" }), resource.autoLoaded ? (_jsx(Badge, { variant: "outline", children: "Auto-loaded" })) : null] }), _jsx("div", { className: "mt-1 truncate font-mono text-xs text-muted-foreground", children: resource.path })] }), _jsxs("div", { className: "flex shrink-0 flex-col items-end gap-2", children: [resource.source === "grant" ? (_jsx("div", { className: "text-right text-[11px] text-muted-foreground", children: "Selected grant" })) : null, _jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "h-7 px-2 text-xs", onClick: (event) => {
|
|
93
|
+
event.stopPropagation();
|
|
94
|
+
setInspectedResourceId(inspected ? null : resource.id);
|
|
95
|
+
}, children: [inspected ? (_jsx(IconChevronDown, { size: 14, className: "mr-1" })) : (_jsx(IconChevronRight, { size: 14, className: "mr-1" })), "Stack"] })] })] }), resource.description ? (_jsx("p", { className: "mt-2 line-clamp-2 text-xs text-muted-foreground", children: resource.description })) : null, inspected ? (_jsx(AppResourceEffectiveStack, { appId: app.id, resource: resource })) : null] }, resource.id));
|
|
96
|
+
}) }))] }), _jsx(DialogFooter, { children: _jsx(Button, { type: "button", onClick: () => setOpen(false), children: "Done" }) })] })] }));
|
|
37
97
|
}
|
|
38
98
|
function stringifyError(err) {
|
|
39
99
|
if (err instanceof Error)
|