@agent-native/core 0.6.1 → 0.7.2
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 +43 -3
- package/dist/action.d.ts +8 -0
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js +18 -0
- package/dist/action.js.map +1 -1
- package/dist/agent/production-agent.d.ts +9 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +301 -39
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +20 -1
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/run-store.d.ts +14 -0
- package/dist/agent/run-store.d.ts.map +1 -1
- package/dist/agent/run-store.js +63 -6
- package/dist/agent/run-store.js.map +1 -1
- package/dist/agent/types.d.ts +3 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/cli/create-workspace.d.ts +8 -0
- package/dist/cli/create-workspace.d.ts.map +1 -0
- package/dist/cli/create-workspace.js +18 -0
- package/dist/cli/create-workspace.js.map +1 -0
- package/dist/cli/create.d.ts +35 -7
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +444 -251
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/index.js +59 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/setup-agents.d.ts.map +1 -1
- package/dist/cli/setup-agents.js +0 -2
- package/dist/cli/setup-agents.js.map +1 -1
- package/dist/cli/templates-meta.d.ts +52 -0
- package/dist/cli/templates-meta.d.ts.map +1 -0
- package/dist/cli/templates-meta.js +165 -0
- package/dist/cli/templates-meta.js.map +1 -0
- package/dist/cli/workspacify.d.ts +18 -0
- package/dist/cli/workspacify.d.ts.map +1 -0
- package/dist/cli/workspacify.js +74 -0
- package/dist/cli/workspacify.js.map +1 -0
- package/dist/client/AgentPanel.d.ts +6 -2
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +328 -241
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +2 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +172 -40
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/ConnectBuilderCard.d.ts +21 -0
- package/dist/client/ConnectBuilderCard.d.ts.map +1 -0
- package/dist/client/ConnectBuilderCard.js +196 -0
- package/dist/client/ConnectBuilderCard.js.map +1 -0
- package/dist/client/FeedbackButton.d.ts +15 -0
- package/dist/client/FeedbackButton.d.ts.map +1 -0
- package/dist/client/FeedbackButton.js +72 -0
- package/dist/client/FeedbackButton.js.map +1 -0
- package/dist/client/IframeEmbed.d.ts +17 -0
- package/dist/client/IframeEmbed.d.ts.map +1 -0
- package/dist/client/IframeEmbed.js +108 -0
- package/dist/client/IframeEmbed.js.map +1 -0
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +34 -7
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +34 -15
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/agent-chat.d.ts +6 -0
- package/dist/client/agent-chat.d.ts.map +1 -1
- package/dist/client/agent-chat.js +7 -0
- package/dist/client/agent-chat.js.map +1 -1
- package/dist/client/components/CodeRequiredDialog.d.ts.map +1 -1
- package/dist/client/components/CodeRequiredDialog.js +86 -5
- package/dist/client/components/CodeRequiredDialog.js.map +1 -1
- package/dist/client/composer/MentionPopover.d.ts.map +1 -1
- package/dist/client/composer/MentionPopover.js +42 -26
- package/dist/client/composer/MentionPopover.js.map +1 -1
- package/dist/client/composer/TiptapComposer.d.ts +3 -1
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +24 -5
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/composer/types.d.ts +1 -1
- package/dist/client/composer/types.d.ts.map +1 -1
- package/dist/client/embed.d.ts +28 -0
- package/dist/client/embed.d.ts.map +1 -0
- package/dist/client/embed.js +50 -0
- package/dist/client/embed.js.map +1 -0
- package/dist/client/index.d.ts +4 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +4 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/integrations/IntegrationsPanel.d.ts.map +1 -1
- package/dist/client/integrations/IntegrationsPanel.js +22 -9
- package/dist/client/integrations/IntegrationsPanel.js.map +1 -1
- package/dist/client/onboarding/OnboardingBanner.d.ts +13 -0
- package/dist/client/onboarding/OnboardingBanner.d.ts.map +1 -0
- package/dist/client/onboarding/OnboardingBanner.js +36 -0
- package/dist/client/onboarding/OnboardingBanner.js.map +1 -0
- package/dist/client/onboarding/OnboardingPanel.d.ts +16 -0
- package/dist/client/onboarding/OnboardingPanel.d.ts.map +1 -0
- package/dist/client/onboarding/OnboardingPanel.js +447 -0
- package/dist/client/onboarding/OnboardingPanel.js.map +1 -0
- package/dist/client/onboarding/SetupButton.d.ts +10 -0
- package/dist/client/onboarding/SetupButton.d.ts.map +1 -0
- package/dist/client/onboarding/SetupButton.js +36 -0
- package/dist/client/onboarding/SetupButton.js.map +1 -0
- package/dist/client/onboarding/index.d.ts +12 -0
- package/dist/client/onboarding/index.d.ts.map +1 -0
- package/dist/client/onboarding/index.js +11 -0
- package/dist/client/onboarding/index.js.map +1 -0
- package/dist/client/onboarding/use-onboarding.d.ts +34 -0
- package/dist/client/onboarding/use-onboarding.d.ts.map +1 -0
- package/dist/client/onboarding/use-onboarding.js +101 -0
- package/dist/client/onboarding/use-onboarding.js.map +1 -0
- package/dist/client/org/TeamPage.d.ts +6 -1
- package/dist/client/org/TeamPage.d.ts.map +1 -1
- package/dist/client/org/TeamPage.js +97 -21
- package/dist/client/org/TeamPage.js.map +1 -1
- package/dist/client/resources/ResourceEditor.d.ts.map +1 -1
- package/dist/client/resources/ResourceEditor.js +104 -78
- package/dist/client/resources/ResourceEditor.js.map +1 -1
- package/dist/client/resources/ResourceTree.d.ts +5 -1
- package/dist/client/resources/ResourceTree.d.ts.map +1 -1
- package/dist/client/resources/ResourceTree.js +31 -11
- package/dist/client/resources/ResourceTree.js.map +1 -1
- package/dist/client/resources/ResourcesPanel.d.ts.map +1 -1
- package/dist/client/resources/ResourcesPanel.js +142 -14
- package/dist/client/resources/ResourcesPanel.js.map +1 -1
- package/dist/client/resources/use-resources.d.ts +5 -0
- package/dist/client/resources/use-resources.d.ts.map +1 -1
- package/dist/client/resources/use-resources.js.map +1 -1
- package/dist/client/settings/AgentsSection.d.ts +2 -0
- package/dist/client/settings/AgentsSection.d.ts.map +1 -0
- package/dist/client/settings/AgentsSection.js +201 -0
- package/dist/client/settings/AgentsSection.js.map +1 -0
- package/dist/client/settings/BackgroundAgentSection.d.ts +2 -0
- package/dist/client/settings/BackgroundAgentSection.d.ts.map +1 -0
- package/dist/client/settings/BackgroundAgentSection.js +46 -0
- package/dist/client/settings/BackgroundAgentSection.js.map +1 -0
- package/dist/client/settings/BrowserSection.d.ts +2 -0
- package/dist/client/settings/BrowserSection.d.ts.map +1 -0
- package/dist/client/settings/BrowserSection.js +10 -0
- package/dist/client/settings/BrowserSection.js.map +1 -0
- package/dist/client/settings/ComingSoonSection.d.ts +13 -0
- package/dist/client/settings/ComingSoonSection.d.ts.map +1 -0
- package/dist/client/settings/ComingSoonSection.js +9 -0
- package/dist/client/settings/ComingSoonSection.js.map +1 -0
- package/dist/client/settings/LLMSection.d.ts +2 -0
- package/dist/client/settings/LLMSection.d.ts.map +1 -0
- package/dist/client/settings/LLMSection.js +64 -0
- package/dist/client/settings/LLMSection.js.map +1 -0
- package/dist/client/settings/SettingsPanel.d.ts +8 -0
- package/dist/client/settings/SettingsPanel.d.ts.map +1 -0
- package/dist/client/settings/SettingsPanel.js +111 -0
- package/dist/client/settings/SettingsPanel.js.map +1 -0
- package/dist/client/settings/SettingsSection.d.ts +19 -0
- package/dist/client/settings/SettingsSection.d.ts.map +1 -0
- package/dist/client/settings/SettingsSection.js +10 -0
- package/dist/client/settings/SettingsSection.js.map +1 -0
- package/dist/client/settings/UsageSection.d.ts +2 -0
- package/dist/client/settings/UsageSection.d.ts.map +1 -0
- package/dist/client/settings/UsageSection.js +70 -0
- package/dist/client/settings/UsageSection.js.map +1 -0
- package/dist/client/settings/index.d.ts +3 -0
- package/dist/client/settings/index.d.ts.map +1 -0
- package/dist/client/settings/index.js +3 -0
- package/dist/client/settings/index.js.map +1 -0
- package/dist/client/settings/useBuilderStatus.d.ts +22 -0
- package/dist/client/settings/useBuilderStatus.d.ts.map +1 -0
- package/dist/client/settings/useBuilderStatus.js +41 -0
- package/dist/client/settings/useBuilderStatus.js.map +1 -0
- package/dist/client/use-action.d.ts.map +1 -1
- package/dist/client/use-action.js +67 -4
- package/dist/client/use-action.js.map +1 -1
- package/dist/client/use-db-sync.d.ts +25 -2
- package/dist/client/use-db-sync.d.ts.map +1 -1
- package/dist/client/use-db-sync.js +62 -1
- package/dist/client/use-db-sync.js.map +1 -1
- package/dist/client/use-dev-mode.d.ts.map +1 -1
- package/dist/client/use-dev-mode.js +16 -1
- package/dist/client/use-dev-mode.js.map +1 -1
- package/dist/db/client.d.ts +12 -0
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +89 -2
- package/dist/db/client.js.map +1 -1
- package/dist/db/create-get-db.d.ts +11 -0
- package/dist/db/create-get-db.d.ts.map +1 -1
- package/dist/db/create-get-db.js +47 -3
- package/dist/db/create-get-db.js.map +1 -1
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +62 -5
- package/dist/db/migrations.js.map +1 -1
- package/dist/deploy/build.js +198 -54
- package/dist/deploy/build.js.map +1 -1
- package/dist/deploy/route-discovery.d.ts +5 -0
- package/dist/deploy/route-discovery.d.ts.map +1 -1
- package/dist/deploy/route-discovery.js +38 -7
- package/dist/deploy/route-discovery.js.map +1 -1
- package/dist/deploy/workspace-core.d.ts +28 -0
- package/dist/deploy/workspace-core.d.ts.map +1 -0
- package/dist/deploy/workspace-core.js +223 -0
- package/dist/deploy/workspace-core.js.map +1 -0
- package/dist/deploy/workspace-deploy.d.ts +11 -0
- package/dist/deploy/workspace-deploy.d.ts.map +1 -0
- package/dist/deploy/workspace-deploy.js +148 -0
- package/dist/deploy/workspace-deploy.js.map +1 -0
- package/dist/file-upload/builder.d.ts +11 -0
- package/dist/file-upload/builder.d.ts.map +1 -0
- package/dist/file-upload/builder.js +53 -0
- package/dist/file-upload/builder.js.map +1 -0
- package/dist/file-upload/index.d.ts +4 -0
- package/dist/file-upload/index.d.ts.map +1 -0
- package/dist/file-upload/index.js +3 -0
- package/dist/file-upload/index.js.map +1 -0
- package/dist/file-upload/registry.d.ts +23 -0
- package/dist/file-upload/registry.d.ts.map +1 -0
- package/dist/file-upload/registry.js +52 -0
- package/dist/file-upload/registry.js.map +1 -0
- package/dist/file-upload/types.d.ts +37 -0
- package/dist/file-upload/types.d.ts.map +1 -0
- package/dist/file-upload/types.js +10 -0
- package/dist/file-upload/types.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/integrations/adapters/google-docs.d.ts +89 -0
- package/dist/integrations/adapters/google-docs.d.ts.map +1 -0
- package/dist/integrations/adapters/google-docs.js +261 -0
- package/dist/integrations/adapters/google-docs.js.map +1 -0
- package/dist/integrations/adapters/slack.d.ts.map +1 -1
- package/dist/integrations/adapters/slack.js +34 -0
- package/dist/integrations/adapters/slack.js.map +1 -1
- package/dist/integrations/adapters/telegram.d.ts.map +1 -1
- package/dist/integrations/adapters/telegram.js +32 -0
- package/dist/integrations/adapters/telegram.js.map +1 -1
- package/dist/integrations/google-docs-poller.d.ts +54 -0
- package/dist/integrations/google-docs-poller.d.ts.map +1 -0
- package/dist/integrations/google-docs-poller.js +442 -0
- package/dist/integrations/google-docs-poller.js.map +1 -0
- package/dist/integrations/index.d.ts +2 -0
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +3 -0
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/plugin.d.ts.map +1 -1
- package/dist/integrations/plugin.js +49 -2
- package/dist/integrations/plugin.js.map +1 -1
- package/dist/integrations/types.d.ts +33 -0
- package/dist/integrations/types.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.d.ts +10 -1
- package/dist/integrations/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +13 -3
- package/dist/integrations/webhook-handler.js.map +1 -1
- package/dist/jobs/scheduler.d.ts +3 -0
- package/dist/jobs/scheduler.d.ts.map +1 -1
- package/dist/jobs/scheduler.js +87 -61
- package/dist/jobs/scheduler.js.map +1 -1
- package/dist/jobs/tools.d.ts.map +1 -1
- package/dist/jobs/tools.js +20 -3
- package/dist/jobs/tools.js.map +1 -1
- package/dist/mcp-client/config.d.ts +46 -0
- package/dist/mcp-client/config.d.ts.map +1 -0
- package/dist/mcp-client/config.js +152 -0
- package/dist/mcp-client/config.js.map +1 -0
- package/dist/mcp-client/index.d.ts +17 -0
- package/dist/mcp-client/index.d.ts.map +1 -0
- package/dist/mcp-client/index.js +53 -0
- package/dist/mcp-client/index.js.map +1 -0
- package/dist/mcp-client/manager.d.ts +76 -0
- package/dist/mcp-client/manager.d.ts.map +1 -0
- package/dist/mcp-client/manager.js +212 -0
- package/dist/mcp-client/manager.js.map +1 -0
- package/dist/oauth-tokens/google-refresh.d.ts +31 -0
- package/dist/oauth-tokens/google-refresh.d.ts.map +1 -0
- package/dist/oauth-tokens/google-refresh.js +115 -0
- package/dist/oauth-tokens/google-refresh.js.map +1 -0
- package/dist/oauth-tokens/index.d.ts +1 -0
- package/dist/oauth-tokens/index.d.ts.map +1 -1
- package/dist/oauth-tokens/index.js +1 -0
- package/dist/oauth-tokens/index.js.map +1 -1
- package/dist/oauth-tokens/store.d.ts.map +1 -1
- package/dist/oauth-tokens/store.js +3 -1
- package/dist/oauth-tokens/store.js.map +1 -1
- package/dist/onboarding/default-steps.d.ts +10 -0
- package/dist/onboarding/default-steps.d.ts.map +1 -0
- package/dist/onboarding/default-steps.js +203 -0
- package/dist/onboarding/default-steps.js.map +1 -0
- package/dist/onboarding/index.d.ts +12 -0
- package/dist/onboarding/index.d.ts.map +1 -0
- package/dist/onboarding/index.js +11 -0
- package/dist/onboarding/index.js.map +1 -0
- package/dist/onboarding/plugin.d.ts +19 -0
- package/dist/onboarding/plugin.d.ts.map +1 -0
- package/dist/onboarding/plugin.js +147 -0
- package/dist/onboarding/plugin.js.map +1 -0
- package/dist/onboarding/registry.d.ts +24 -0
- package/dist/onboarding/registry.d.ts.map +1 -0
- package/dist/onboarding/registry.js +40 -0
- package/dist/onboarding/registry.js.map +1 -0
- package/dist/onboarding/types.d.ts +71 -0
- package/dist/onboarding/types.d.ts.map +1 -0
- package/dist/onboarding/types.js +10 -0
- package/dist/onboarding/types.js.map +1 -0
- package/dist/org/context.js +1 -1
- package/dist/org/handlers.d.ts.map +1 -1
- package/dist/org/handlers.js +35 -10
- package/dist/org/handlers.js.map +1 -1
- package/dist/org/plugin.d.ts.map +1 -1
- package/dist/org/plugin.js +37 -22
- package/dist/org/plugin.js.map +1 -1
- package/dist/resources/agents.d.ts +4 -0
- package/dist/resources/agents.d.ts.map +1 -0
- package/dist/resources/agents.js +44 -0
- package/dist/resources/agents.js.map +1 -0
- package/dist/resources/handlers.d.ts +17 -0
- package/dist/resources/handlers.d.ts.map +1 -1
- package/dist/resources/handlers.js +49 -12
- package/dist/resources/handlers.js.map +1 -1
- package/dist/resources/metadata.d.ts +48 -0
- package/dist/resources/metadata.d.ts.map +1 -0
- package/dist/resources/metadata.js +150 -0
- package/dist/resources/metadata.js.map +1 -0
- package/dist/resources/script-helpers.d.ts.map +1 -1
- package/dist/resources/script-helpers.js +3 -2
- package/dist/resources/script-helpers.js.map +1 -1
- package/dist/resources/store.d.ts.map +1 -1
- package/dist/resources/store.js +59 -18
- package/dist/resources/store.js.map +1 -1
- package/dist/scripts/call-agent.d.ts.map +1 -1
- package/dist/scripts/call-agent.js +3 -2
- package/dist/scripts/call-agent.js.map +1 -1
- package/dist/scripts/chat/search-chats.d.ts.map +1 -1
- package/dist/scripts/chat/search-chats.js +2 -1
- package/dist/scripts/chat/search-chats.js.map +1 -1
- package/dist/scripts/core-scripts.d.ts.map +1 -1
- package/dist/scripts/core-scripts.js +2 -0
- package/dist/scripts/core-scripts.js.map +1 -1
- package/dist/scripts/db/patch.d.ts.map +1 -1
- package/dist/scripts/db/patch.js +273 -11
- package/dist/scripts/db/patch.js.map +1 -1
- package/dist/scripts/db/scoping.d.ts.map +1 -1
- package/dist/scripts/db/scoping.js +3 -2
- package/dist/scripts/db/scoping.js.map +1 -1
- package/dist/scripts/docs/index.d.ts +2 -0
- package/dist/scripts/docs/index.d.ts.map +1 -0
- package/dist/scripts/docs/index.js +4 -0
- package/dist/scripts/docs/index.js.map +1 -0
- package/dist/scripts/docs/search.d.ts +13 -0
- package/dist/scripts/docs/search.d.ts.map +1 -0
- package/dist/scripts/docs/search.js +130 -0
- package/dist/scripts/docs/search.js.map +1 -0
- package/dist/scripts/resources/delete-memory.d.ts +7 -0
- package/dist/scripts/resources/delete-memory.d.ts.map +1 -0
- package/dist/scripts/resources/delete-memory.js +49 -0
- package/dist/scripts/resources/delete-memory.js.map +1 -0
- package/dist/scripts/resources/delete.d.ts.map +1 -1
- package/dist/scripts/resources/delete.js +2 -1
- package/dist/scripts/resources/delete.js.map +1 -1
- package/dist/scripts/resources/index.d.ts.map +1 -1
- package/dist/scripts/resources/index.js +2 -0
- package/dist/scripts/resources/index.js.map +1 -1
- package/dist/scripts/resources/list.d.ts.map +1 -1
- package/dist/scripts/resources/list.js +2 -1
- package/dist/scripts/resources/list.js.map +1 -1
- package/dist/scripts/resources/migrate-learnings.d.ts.map +1 -1
- package/dist/scripts/resources/migrate-learnings.js +2 -1
- package/dist/scripts/resources/migrate-learnings.js.map +1 -1
- package/dist/scripts/resources/read.d.ts.map +1 -1
- package/dist/scripts/resources/read.js +2 -1
- package/dist/scripts/resources/read.js.map +1 -1
- package/dist/scripts/resources/save-memory.d.ts +9 -0
- package/dist/scripts/resources/save-memory.d.ts.map +1 -0
- package/dist/scripts/resources/save-memory.js +78 -0
- package/dist/scripts/resources/save-memory.js.map +1 -0
- package/dist/scripts/resources/write.d.ts.map +1 -1
- package/dist/scripts/resources/write.js +2 -1
- package/dist/scripts/resources/write.js.map +1 -1
- package/dist/scripts/utils.d.ts +10 -1
- package/dist/scripts/utils.d.ts.map +1 -1
- package/dist/scripts/utils.js +45 -2
- package/dist/scripts/utils.js.map +1 -1
- package/dist/server/action-discovery.d.ts +5 -0
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +53 -20
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/action-routes.d.ts.map +1 -1
- package/dist/server/action-routes.js +88 -56
- package/dist/server/action-routes.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts +15 -0
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +853 -91
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-discovery.d.ts.map +1 -1
- package/dist/server/agent-discovery.js +13 -25
- package/dist/server/agent-discovery.js.map +1 -1
- package/dist/server/agent-teams.d.ts.map +1 -1
- package/dist/server/agent-teams.js +23 -59
- package/dist/server/agent-teams.js.map +1 -1
- package/dist/server/agents-bundle.d.ts +33 -5
- package/dist/server/agents-bundle.d.ts.map +1 -1
- package/dist/server/agents-bundle.js +108 -64
- package/dist/server/agents-bundle.js.map +1 -1
- package/dist/server/auth.d.ts +7 -0
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +448 -93
- package/dist/server/auth.js.map +1 -1
- package/dist/server/better-auth-instance.d.ts +1 -1
- package/dist/server/better-auth-instance.d.ts.map +1 -1
- package/dist/server/better-auth-instance.js +272 -10
- package/dist/server/better-auth-instance.js.map +1 -1
- package/dist/server/builder-browser.d.ts +61 -0
- package/dist/server/builder-browser.d.ts.map +1 -0
- package/dist/server/builder-browser.js +229 -0
- package/dist/server/builder-browser.js.map +1 -0
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +273 -9
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/credential-provider.d.ts +37 -0
- package/dist/server/credential-provider.d.ts.map +1 -0
- package/dist/server/credential-provider.js +49 -0
- package/dist/server/credential-provider.js.map +1 -0
- package/dist/server/desktop-sso.d.ts +30 -0
- package/dist/server/desktop-sso.d.ts.map +1 -0
- package/dist/server/desktop-sso.js +74 -0
- package/dist/server/desktop-sso.js.map +1 -0
- package/dist/server/email.d.ts +23 -0
- package/dist/server/email.d.ts.map +1 -0
- package/dist/server/email.js +105 -0
- package/dist/server/email.js.map +1 -0
- package/dist/server/framework-request-handler.d.ts.map +1 -1
- package/dist/server/framework-request-handler.js +71 -3
- package/dist/server/framework-request-handler.js.map +1 -1
- package/dist/server/google-auth-plugin.js +1 -1
- package/dist/server/google-oauth.d.ts +1 -1
- package/dist/server/google-oauth.d.ts.map +1 -1
- package/dist/server/google-oauth.js +34 -13
- package/dist/server/google-oauth.js.map +1 -1
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +3 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/local-migration.d.ts +9 -0
- package/dist/server/local-migration.d.ts.map +1 -1
- package/dist/server/local-migration.js +44 -14
- package/dist/server/local-migration.js.map +1 -1
- package/dist/server/oauth-helpers.d.ts +3 -0
- package/dist/server/oauth-helpers.d.ts.map +1 -1
- package/dist/server/oauth-helpers.js +7 -4
- package/dist/server/oauth-helpers.js.map +1 -1
- package/dist/server/onboarding-html.d.ts +6 -0
- package/dist/server/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +323 -28
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/server/poll.d.ts.map +1 -1
- package/dist/server/poll.js +48 -0
- package/dist/server/poll.js.map +1 -1
- package/dist/server/request-context.d.ts +20 -0
- package/dist/server/request-context.d.ts.map +1 -0
- package/dist/server/request-context.js +41 -0
- package/dist/server/request-context.js.map +1 -0
- package/dist/templates/default/.agents/skills/actions/SKILL.md +2 -1
- package/dist/templates/default/.agents/skills/inline-embeds/SKILL.md +88 -0
- package/dist/templates/default/.agents/skills/security/SKILL.md +145 -40
- package/dist/templates/default/.agents/skills/storing-data/SKILL.md +7 -1
- package/dist/templates/default/_gitignore +1 -0
- package/dist/templates/default/app/root.tsx +4 -1
- package/dist/templates/workspace-core/.agents/skills/company-policies/SKILL.md +42 -0
- package/dist/templates/workspace-core/AGENTS.md +62 -0
- package/dist/templates/workspace-core/actions/company-directory.ts +38 -0
- package/dist/templates/workspace-core/package.json +39 -0
- package/dist/templates/workspace-core/src/client/AuthenticatedLayout.tsx +37 -0
- package/dist/templates/workspace-core/src/client/index.ts +26 -0
- package/dist/templates/workspace-core/src/credentials.ts +29 -0
- package/dist/templates/workspace-core/src/index.ts +21 -0
- package/dist/templates/workspace-core/src/server/agent-chat-plugin.ts +30 -0
- package/dist/templates/workspace-core/src/server/auth-plugin.ts +35 -0
- package/dist/templates/workspace-core/src/server/index.ts +22 -0
- package/dist/templates/workspace-core/tailwind.preset.ts +34 -0
- package/dist/templates/workspace-core/tsconfig.json +9 -0
- package/dist/templates/workspace-root/.env.example +37 -0
- package/dist/templates/workspace-root/README.md +62 -0
- package/dist/templates/workspace-root/_gitignore +23 -0
- package/dist/templates/workspace-root/package.json +18 -0
- package/dist/templates/workspace-root/pnpm-workspace.yaml +3 -0
- package/dist/templates/workspace-root/tsconfig.base.json +21 -0
- package/dist/usage/store.d.ts +74 -12
- package/dist/usage/store.d.ts.map +1 -1
- package/dist/usage/store.js +210 -44
- package/dist/usage/store.js.map +1 -1
- package/dist/vite/agents-bundle-plugin.d.ts.map +1 -1
- package/dist/vite/agents-bundle-plugin.js +65 -15
- package/dist/vite/agents-bundle-plugin.js.map +1 -1
- package/dist/vite/client.d.ts +16 -0
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +130 -0
- package/dist/vite/client.js.map +1 -1
- package/docs/content/a2a-protocol.md +223 -0
- package/docs/content/actions.md +129 -0
- package/docs/content/agent-mentions.md +171 -0
- package/docs/content/authentication.md +155 -0
- package/docs/content/cli-adapters.md +244 -0
- package/docs/content/client.md +175 -0
- package/docs/content/context-awareness.md +168 -0
- package/docs/content/creating-templates.md +311 -0
- package/docs/content/database.md +82 -0
- package/docs/content/deployment.md +237 -0
- package/docs/content/enterprise-workspace.md +235 -0
- package/docs/content/faq.md +101 -0
- package/docs/content/file-uploads.md +102 -0
- package/docs/content/frames.md +47 -0
- package/docs/content/getting-started.md +104 -0
- package/docs/content/integrations.md +198 -0
- package/docs/content/key-concepts.md +246 -0
- package/docs/content/mcp-clients.md +110 -0
- package/docs/content/mcp-protocol.md +168 -0
- package/docs/content/onboarding.md +107 -0
- package/docs/content/real-time-collaboration.md +185 -0
- package/docs/content/resources.md +277 -0
- package/docs/content/security.md +158 -0
- package/docs/content/server.md +200 -0
- package/docs/content/skills-guide.md +107 -0
- package/docs/content/what-is-agent-native.md +100 -0
- package/docs/content/workspace-management.md +224 -0
- package/package.json +13 -3
- package/src/templates/default/.agents/skills/actions/SKILL.md +2 -1
- package/src/templates/default/.agents/skills/inline-embeds/SKILL.md +88 -0
- package/src/templates/default/.agents/skills/security/SKILL.md +145 -40
- package/src/templates/default/.agents/skills/storing-data/SKILL.md +7 -1
- package/src/templates/default/_gitignore +1 -0
- package/src/templates/default/app/root.tsx +4 -1
- package/src/templates/workspace-core/.agents/skills/company-policies/SKILL.md +42 -0
- package/src/templates/workspace-core/AGENTS.md +62 -0
- package/src/templates/workspace-core/actions/company-directory.ts +38 -0
- package/src/templates/workspace-core/package.json +39 -0
- package/src/templates/workspace-core/src/client/AuthenticatedLayout.tsx +37 -0
- package/src/templates/workspace-core/src/client/index.ts +26 -0
- package/src/templates/workspace-core/src/credentials.ts +29 -0
- package/src/templates/workspace-core/src/index.ts +21 -0
- package/src/templates/workspace-core/src/server/agent-chat-plugin.ts +30 -0
- package/src/templates/workspace-core/src/server/auth-plugin.ts +35 -0
- package/src/templates/workspace-core/src/server/index.ts +22 -0
- package/src/templates/workspace-core/tailwind.preset.ts +34 -0
- package/src/templates/workspace-core/tsconfig.json +9 -0
- package/src/templates/workspace-root/.env.example +37 -0
- package/src/templates/workspace-root/README.md +62 -0
- package/src/templates/workspace-root/_gitignore +23 -0
- package/src/templates/workspace-root/package.json +18 -0
- package/src/templates/workspace-root/pnpm-workspace.yaml +3 -0
- package/src/templates/workspace-root/tsconfig.base.json +21 -0
- package/dist/templates/templates/default/.agents/skills/actions/SKILL.md +0 -142
- package/dist/templates/templates/default/.agents/skills/agent-engines/SKILL.md +0 -127
- package/dist/templates/templates/default/.agents/skills/capture-learnings/SKILL.md +0 -50
- package/dist/templates/templates/default/.agents/skills/create-skill/SKILL.md +0 -167
- package/dist/templates/templates/default/.agents/skills/delegate-to-agent/SKILL.md +0 -90
- package/dist/templates/templates/default/.agents/skills/frontend-design/SKILL.md +0 -69
- package/dist/templates/templates/default/.agents/skills/real-time-collab/SKILL.md +0 -183
- package/dist/templates/templates/default/.agents/skills/real-time-sync/SKILL.md +0 -112
- package/dist/templates/templates/default/.agents/skills/security/SKILL.md +0 -108
- package/dist/templates/templates/default/.agents/skills/self-modifying-code/SKILL.md +0 -79
- package/dist/templates/templates/default/.agents/skills/storing-data/SKILL.md +0 -110
- package/dist/templates/templates/default/.claude/settings.json +0 -100
- package/dist/templates/templates/default/.env.example +0 -5
- package/dist/templates/templates/default/.ignore +0 -0
- package/dist/templates/templates/default/.prettierrc +0 -5
- package/dist/templates/templates/default/AGENTS.md +0 -110
- package/dist/templates/templates/default/DEVELOPING.md +0 -117
- package/dist/templates/templates/default/_gitignore +0 -37
- package/dist/templates/templates/default/actions/hello.ts +0 -20
- package/dist/templates/templates/default/actions/navigate.ts +0 -53
- package/dist/templates/templates/default/actions/run.ts +0 -2
- package/dist/templates/templates/default/actions/view-screen.ts +0 -39
- package/dist/templates/templates/default/app/entry.client.tsx +0 -4
- package/dist/templates/templates/default/app/entry.server.tsx +0 -56
- package/dist/templates/templates/default/app/global.css +0 -95
- package/dist/templates/templates/default/app/lib/utils.ts +0 -1
- package/dist/templates/templates/default/app/root.tsx +0 -107
- package/dist/templates/templates/default/app/routes/_index.tsx +0 -62
- package/dist/templates/templates/default/app/routes.ts +0 -4
- package/dist/templates/templates/default/app/vite-env.d.ts +0 -6
- package/dist/templates/templates/default/components.json +0 -20
- package/dist/templates/templates/default/data/.gitkeep +0 -0
- package/dist/templates/templates/default/data/sync-config.json +0 -1
- package/dist/templates/templates/default/learnings.defaults.md +0 -5
- package/dist/templates/templates/default/learnings.md +0 -0
- package/dist/templates/templates/default/package.json +0 -46
- package/dist/templates/templates/default/postcss.config.js +0 -6
- package/dist/templates/templates/default/public/icon-180.svg +0 -4
- package/dist/templates/templates/default/public/icon-192.svg +0 -4
- package/dist/templates/templates/default/public/icon-512.svg +0 -4
- package/dist/templates/templates/default/public/manifest.json +0 -13
- package/dist/templates/templates/default/react-router.config.ts +0 -6
- package/dist/templates/templates/default/server/middleware/auth.ts +0 -15
- package/dist/templates/templates/default/server/plugins/.gitkeep +0 -0
- package/dist/templates/templates/default/server/routes/[...page].get.ts +0 -5
- package/dist/templates/templates/default/server/routes/api/hello.get.ts +0 -5
- package/dist/templates/templates/default/shared/api.ts +0 -6
- package/dist/templates/templates/default/ssr-entry.ts +0 -20
- package/dist/templates/templates/default/tailwind.config.ts +0 -7
- package/dist/templates/templates/default/tsconfig.json +0 -11
- package/dist/templates/templates/default/vite.config.ts +0 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
|
-
* AgentPanel — unified agent component with chat and
|
|
3
|
+
* AgentPanel — unified agent component with chat, CLI, and workspace modes.
|
|
4
4
|
*
|
|
5
5
|
* A self-contained panel with no layout opinions — drop it into a sidebar,
|
|
6
6
|
* popover, dialog, full page, or any container. It fills its parent via
|
|
@@ -22,12 +22,15 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
22
22
|
* <AgentPanel className="h-screen" />
|
|
23
23
|
*/
|
|
24
24
|
import ReactDOM from "react-dom";
|
|
25
|
-
import { useState, useEffect, useRef, useCallback, lazy, Suspense, startTransition, } from "react";
|
|
26
|
-
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
25
|
+
import React, { useState, useEffect, useRef, useCallback, useMemo, lazy, Suspense, startTransition, } from "react";
|
|
27
26
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
28
|
-
import { IconMessage, IconTerminal2, IconSettings, IconLayoutSidebarRightCollapse,
|
|
27
|
+
import { IconMessage, IconTerminal2, IconSettings, IconLayoutSidebarRightCollapse, IconLayoutGrid, IconCheck, IconPlus, IconX, IconDotsVertical, IconHistory, IconArrowsMaximize, IconArrowsMinimize, } from "@tabler/icons-react";
|
|
28
|
+
import { FeedbackButton } from "./FeedbackButton.js";
|
|
29
29
|
import { MultiTabAssistantChat, } from "./MultiTabAssistantChat.js";
|
|
30
30
|
import { useDevMode } from "./use-dev-mode.js";
|
|
31
|
+
import { useScreenRefreshKey } from "./use-db-sync.js";
|
|
32
|
+
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
33
|
+
import { useLocation, useNavigate } from "react-router";
|
|
31
34
|
import { cn } from "./utils.js";
|
|
32
35
|
// Lazy-load AgentTerminal to avoid bundling xterm.js when not needed
|
|
33
36
|
const AgentTerminal = lazy(() => import("./terminal/index.js").then((m) => ({ default: m.AgentTerminal })));
|
|
@@ -35,9 +38,18 @@ const AgentTerminal = lazy(() => import("./terminal/index.js").then((m) => ({ de
|
|
|
35
38
|
const ResourcesPanel = lazy(() => import("./resources/ResourcesPanel.js").then((m) => ({
|
|
36
39
|
default: m.ResourcesPanel,
|
|
37
40
|
})));
|
|
38
|
-
// Lazy-load
|
|
39
|
-
const
|
|
40
|
-
default: m.
|
|
41
|
+
// Lazy-load SettingsPanel to avoid bundling when not needed
|
|
42
|
+
const SettingsPanel = lazy(() => import("./settings/index.js").then((m) => ({
|
|
43
|
+
default: m.SettingsPanel,
|
|
44
|
+
})));
|
|
45
|
+
// Lazy-load OnboardingPanel — only pulled in when onboarding is active.
|
|
46
|
+
const OnboardingPanel = lazy(() => import("./onboarding/OnboardingPanel.js").then((m) => ({
|
|
47
|
+
default: m.OnboardingPanel,
|
|
48
|
+
})));
|
|
49
|
+
// Lazy-load SetupButton — the header entry-point that re-opens the
|
|
50
|
+
// onboarding panel after the user has dismissed it.
|
|
51
|
+
const SetupButton = lazy(() => import("./onboarding/SetupButton.js").then((m) => ({
|
|
52
|
+
default: m.SetupButton,
|
|
41
53
|
})));
|
|
42
54
|
const CLI_STORAGE_KEY = "agent-native-cli-command";
|
|
43
55
|
const CLI_DEFAULT = "claude";
|
|
@@ -91,230 +103,24 @@ function useCliSelection(keyPrefix) {
|
|
|
91
103
|
}
|
|
92
104
|
// Detect dev mode at build time (Vite replaces this)
|
|
93
105
|
const IS_DEV = import.meta.env?.DEV === true;
|
|
94
|
-
|
|
95
|
-
const selected = options.find((option) => option.value === value);
|
|
96
|
-
return (_jsxs("div", { className: "space-y-1.5", children: [_jsx("p", { className: "text-[12px] font-medium text-foreground", children: label }), _jsxs(SelectPrimitive.Root, { value: value, onValueChange: onValueChange, children: [_jsxs(SelectPrimitive.Trigger, { className: "flex h-9 w-full items-center justify-between rounded-md border border-border bg-background px-3 text-left text-[12px] text-foreground outline-none transition-colors hover:bg-accent/40 data-[placeholder]:text-muted-foreground", "aria-label": label, style: AGENT_PANEL_CONTROL_STYLE, children: [_jsx(SelectPrimitive.Value, { children: selected?.label ?? value }), _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(IconChevronDown, { size: 14, className: "text-muted-foreground" }) })] }), _jsx(SelectPrimitive.Portal, { children: _jsx(SelectPrimitive.Content, { position: "popper", sideOffset: 6, className: "z-[9999] w-[var(--radix-select-trigger-width)] overflow-hidden rounded-lg border border-border bg-popover shadow-lg", children: _jsx(SelectPrimitive.Viewport, { className: "p-1", children: options.map((option) => (_jsxs(SelectPrimitive.Item, { value: option.value, className: "relative flex w-full cursor-pointer select-none items-start gap-2 rounded-md px-8 py-2.5 text-[12px] outline-none data-[highlighted]:bg-accent/60 data-[state=checked]:bg-accent/40", style: AGENT_PANEL_CONTROL_STYLE, children: [_jsx("span", { className: "absolute left-2 top-2.5 flex h-4 w-4 items-center justify-center text-muted-foreground", children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(IconCheck, { size: 14 }) }) }), _jsxs("div", { className: "flex min-w-0 flex-col", children: [_jsx(SelectPrimitive.ItemText, { children: _jsx("span", { className: "text-foreground", children: option.label }) }), option.description ? (_jsx("span", { className: "mt-0.5 text-[11px] leading-relaxed text-muted-foreground", children: option.description })) : null] })] }, option.value))) }) }) })] })] }));
|
|
97
|
-
}
|
|
106
|
+
// ─── Settings panel components moved to ./settings/ ────────────────────────
|
|
98
107
|
function IconTooltip({ content, children, }) {
|
|
99
108
|
return (_jsx(TooltipPrimitive.Provider, { delayDuration: 250, children: _jsxs(TooltipPrimitive.Root, { children: [_jsx(TooltipPrimitive.Trigger, { asChild: true, children: children }), _jsx(TooltipPrimitive.Portal, { children: _jsxs(TooltipPrimitive.Content, { side: "bottom", sideOffset: 8, className: "z-[230] overflow-hidden rounded-md border border-border bg-popover px-2 py-1 text-[11px] text-foreground shadow-md", children: [content, _jsx(TooltipPrimitive.Arrow, { className: "fill-popover" })] }) })] }) }));
|
|
100
109
|
}
|
|
101
|
-
// ─── Agent Settings Popover ──────────────────────────────────────────────────
|
|
102
|
-
function AgentSettingsPopover({ isDevMode, onToggle, devAppUrl, showEnvToggle = true, }) {
|
|
103
|
-
const [open, setOpen] = useState(false);
|
|
104
|
-
const popoverRef = useRef(null);
|
|
105
|
-
const buttonRef = useRef(null);
|
|
106
|
-
// Close on outside click
|
|
107
|
-
useEffect(() => {
|
|
108
|
-
if (!open)
|
|
109
|
-
return;
|
|
110
|
-
function handleClick(e) {
|
|
111
|
-
const target = e.target;
|
|
112
|
-
// Ignore clicks inside the popover itself or its trigger button
|
|
113
|
-
if (popoverRef.current?.contains(target))
|
|
114
|
-
return;
|
|
115
|
-
if (buttonRef.current?.contains(target))
|
|
116
|
-
return;
|
|
117
|
-
// Ignore clicks inside portaled Radix Select content (rendered outside the popover DOM)
|
|
118
|
-
if (target.closest?.("[data-radix-popper-content-wrapper], [data-radix-select-viewport], [role='listbox']"))
|
|
119
|
-
return;
|
|
120
|
-
setOpen(false);
|
|
121
|
-
}
|
|
122
|
-
document.addEventListener("mousedown", handleClick);
|
|
123
|
-
return () => document.removeEventListener("mousedown", handleClick);
|
|
124
|
-
}, [open]);
|
|
125
|
-
// Close on Escape
|
|
126
|
-
useEffect(() => {
|
|
127
|
-
if (!open)
|
|
128
|
-
return;
|
|
129
|
-
function handleKey(e) {
|
|
130
|
-
if (e.key === "Escape")
|
|
131
|
-
setOpen(false);
|
|
132
|
-
}
|
|
133
|
-
document.addEventListener("keydown", handleKey);
|
|
134
|
-
return () => document.removeEventListener("keydown", handleKey);
|
|
135
|
-
}, [open]);
|
|
136
|
-
const environmentOptions = [
|
|
137
|
-
{
|
|
138
|
-
value: "production",
|
|
139
|
-
label: "Production",
|
|
140
|
-
description: "Restricted to app tools only.",
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
value: "development",
|
|
144
|
-
label: "Development",
|
|
145
|
-
description: "Full access to code editing, shell, and files.",
|
|
146
|
-
},
|
|
147
|
-
];
|
|
148
|
-
// Compute fixed position from the button so the popover escapes all
|
|
149
|
-
// stacking contexts (the CLI terminal otherwise paints over it).
|
|
150
|
-
const [pos, setPos] = useState(null);
|
|
151
|
-
useEffect(() => {
|
|
152
|
-
if (!open || !buttonRef.current)
|
|
153
|
-
return;
|
|
154
|
-
const rect = buttonRef.current.getBoundingClientRect();
|
|
155
|
-
setPos({
|
|
156
|
-
top: rect.bottom + 6,
|
|
157
|
-
right: window.innerWidth - rect.right,
|
|
158
|
-
});
|
|
159
|
-
}, [open]);
|
|
160
|
-
return (_jsxs("div", { className: "relative", children: [_jsx("button", { ref: buttonRef, onClick: () => setOpen(!open), className: cn("flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-accent/50", open && "bg-accent/50 text-foreground"), title: "Agent settings", children: _jsx(IconSettings, { size: 14 }) }), open &&
|
|
161
|
-
pos &&
|
|
162
|
-
ReactDOM.createPortal(_jsx("div", { ref: popoverRef, className: "fixed z-[9990] w-72 rounded-lg border border-border bg-popover shadow-md animate-in fade-in-0 zoom-in-95 duration-100", style: { top: pos.top, right: pos.right }, children: _jsxs("div", { className: "space-y-3 p-3", children: [showEnvToggle && (_jsx(SettingsSelect, { label: "Environment", value: isDevMode ? "development" : "production", options: environmentOptions, onValueChange: (next) => {
|
|
163
|
-
const nextIsDev = next === "development";
|
|
164
|
-
if (nextIsDev !== isDevMode)
|
|
165
|
-
onToggle();
|
|
166
|
-
} })), devAppUrl && (_jsxs("a", { href: devAppUrl, target: "_blank", rel: "noopener noreferrer", className: "flex items-center gap-1.5 text-[11px] text-muted-foreground hover:text-foreground mt-1", children: [_jsx(IconExternalLink, { size: 12 }), "Open app in new tab"] })), _jsx("div", { className: showEnvToggle || devAppUrl
|
|
167
|
-
? "border-t border-border pt-3 mt-3"
|
|
168
|
-
: "", children: _jsx(Suspense, { fallback: null, children: _jsx(IntegrationsPanel, {}) }) }), _jsx("div", { className: "border-t border-border pt-3 mt-3", children: _jsx(AgentsSection, {}) })] }) }), document.body)] }));
|
|
169
|
-
}
|
|
170
|
-
function AgentDetail({ agent, onBack, onDelete, }) {
|
|
171
|
-
const [copied, setCopied] = useState(false);
|
|
172
|
-
const handleCopy = useCallback(async () => {
|
|
173
|
-
await navigator.clipboard.writeText(agent.url);
|
|
174
|
-
setCopied(true);
|
|
175
|
-
setTimeout(() => setCopied(false), 2000);
|
|
176
|
-
}, [agent.url]);
|
|
177
|
-
return (_jsxs("div", { children: [_jsxs("button", { onClick: onBack, className: "flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground mb-2", children: [_jsx(IconChevronLeft, { size: 12 }), "Back"] }), _jsxs("div", { className: "flex items-center gap-2 mb-3", children: [_jsx(IconPlugConnected, { size: 16, className: "text-foreground shrink-0" }), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "text-xs font-medium text-foreground truncate", children: agent.name }), agent.description && (_jsx("div", { className: "text-[10px] text-muted-foreground", children: agent.description }))] })] }), _jsxs("div", { className: "mb-3", children: [_jsx("div", { className: "text-[10px] font-medium text-muted-foreground mb-1", children: "A2A Endpoint" }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("code", { className: "flex-1 truncate rounded bg-muted px-1.5 py-0.5 text-[10px] text-foreground", children: agent.url }), _jsx("button", { onClick: handleCopy, className: "shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent/50", title: "Copy URL", children: copied ? _jsx(IconCheck, { size: 12 }) : _jsx(IconCopy, { size: 12 }) })] })] }), _jsx("div", { className: "rounded-md border border-border bg-muted/30 px-2.5 py-2 text-[10px] text-muted-foreground mb-3", children: "@-mention this agent in chat to send it tasks via the A2A protocol. It will use its own tools and skills to respond." }), _jsx("button", { onClick: () => onDelete(agent.id), className: "w-full rounded-md border border-red-800/50 px-2 py-1.5 text-[11px] font-medium text-red-400 hover:bg-red-900/20", children: "Remove agent" })] }));
|
|
178
|
-
}
|
|
179
|
-
function AgentsSection() {
|
|
180
|
-
const [expanded, setExpanded] = useState(false);
|
|
181
|
-
const [showAdd, setShowAdd] = useState(false);
|
|
182
|
-
const [selectedAgent, setSelectedAgent] = useState(null);
|
|
183
|
-
const [name, setName] = useState("");
|
|
184
|
-
const [url, setUrl] = useState("");
|
|
185
|
-
const [description, setDescription] = useState("");
|
|
186
|
-
const nameRef = useRef(null);
|
|
187
|
-
// Fetch agents from resources
|
|
188
|
-
const [agents, setAgents] = useState([]);
|
|
189
|
-
const [loading, setLoading] = useState(true);
|
|
190
|
-
const fetchAgents = useCallback(async () => {
|
|
191
|
-
try {
|
|
192
|
-
const res = await fetch("/_agent-native/resources?scope=all");
|
|
193
|
-
if (!res.ok)
|
|
194
|
-
return;
|
|
195
|
-
const data = await res.json();
|
|
196
|
-
const agentResources = (data.resources ?? []).filter((r) => r.path.startsWith("agents/") && r.path.endsWith(".json"));
|
|
197
|
-
const parsed = await Promise.all(agentResources.map(async (r) => {
|
|
198
|
-
try {
|
|
199
|
-
const detail = await fetch(`/_agent-native/resources/${r.id}`);
|
|
200
|
-
if (!detail.ok)
|
|
201
|
-
return null;
|
|
202
|
-
const d = await detail.json();
|
|
203
|
-
const config = JSON.parse(d.content);
|
|
204
|
-
return {
|
|
205
|
-
id: r.id,
|
|
206
|
-
path: r.path,
|
|
207
|
-
name: config.name,
|
|
208
|
-
url: config.url,
|
|
209
|
-
description: config.description,
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
catch {
|
|
213
|
-
return null;
|
|
214
|
-
}
|
|
215
|
-
}));
|
|
216
|
-
setAgents(parsed.filter(Boolean));
|
|
217
|
-
}
|
|
218
|
-
finally {
|
|
219
|
-
setLoading(false);
|
|
220
|
-
}
|
|
221
|
-
}, []);
|
|
222
|
-
useEffect(() => {
|
|
223
|
-
fetchAgents();
|
|
224
|
-
}, [fetchAgents]);
|
|
225
|
-
useEffect(() => {
|
|
226
|
-
if (showAdd) {
|
|
227
|
-
setName("");
|
|
228
|
-
setUrl("");
|
|
229
|
-
setDescription("");
|
|
230
|
-
const t = setTimeout(() => nameRef.current?.focus(), 50);
|
|
231
|
-
return () => clearTimeout(t);
|
|
232
|
-
}
|
|
233
|
-
}, [showAdd]);
|
|
234
|
-
const handleAdd = async () => {
|
|
235
|
-
const trimmedName = name.trim();
|
|
236
|
-
const trimmedUrl = url.trim();
|
|
237
|
-
if (!trimmedName || !trimmedUrl)
|
|
238
|
-
return;
|
|
239
|
-
const id = trimmedName.toLowerCase().replace(/[^a-z0-9-]/g, "-");
|
|
240
|
-
const agentJson = JSON.stringify({
|
|
241
|
-
id,
|
|
242
|
-
name: trimmedName,
|
|
243
|
-
description: description.trim() || undefined,
|
|
244
|
-
url: trimmedUrl,
|
|
245
|
-
color: "#6B7280",
|
|
246
|
-
}, null, 2);
|
|
247
|
-
try {
|
|
248
|
-
const res = await fetch("/_agent-native/resources", {
|
|
249
|
-
method: "POST",
|
|
250
|
-
headers: { "Content-Type": "application/json" },
|
|
251
|
-
body: JSON.stringify({
|
|
252
|
-
path: `agents/${id}.json`,
|
|
253
|
-
content: agentJson,
|
|
254
|
-
shared: true,
|
|
255
|
-
}),
|
|
256
|
-
});
|
|
257
|
-
if (res.ok) {
|
|
258
|
-
setShowAdd(false);
|
|
259
|
-
fetchAgents();
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
catch { }
|
|
263
|
-
};
|
|
264
|
-
const handleDelete = async (agentId) => {
|
|
265
|
-
try {
|
|
266
|
-
const res = await fetch(`/_agent-native/resources/${agentId}`, {
|
|
267
|
-
method: "DELETE",
|
|
268
|
-
});
|
|
269
|
-
if (res.ok) {
|
|
270
|
-
setSelectedAgent(null);
|
|
271
|
-
fetchAgents();
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
catch { }
|
|
275
|
-
};
|
|
276
|
-
if (selectedAgent) {
|
|
277
|
-
return (_jsx(AgentDetail, { agent: selectedAgent, onBack: () => setSelectedAgent(null), onDelete: handleDelete }));
|
|
278
|
-
}
|
|
279
|
-
return (_jsxs("div", { children: [_jsxs("div", { className: "flex items-center justify-between mb-1.5", children: [_jsxs("div", { children: [_jsx("div", { className: "text-xs font-medium text-foreground", children: "Agents" }), _jsx("div", { className: "text-[10px] text-muted-foreground", children: loading
|
|
280
|
-
? "Loading..."
|
|
281
|
-
: agents.length > 0
|
|
282
|
-
? `${agents.length} connected via A2A`
|
|
283
|
-
: "Connect agents via A2A protocol" })] }), _jsx("button", { onClick: () => {
|
|
284
|
-
if (expanded || showAdd) {
|
|
285
|
-
setExpanded(false);
|
|
286
|
-
setShowAdd(false);
|
|
287
|
-
}
|
|
288
|
-
else {
|
|
289
|
-
setExpanded(true);
|
|
290
|
-
}
|
|
291
|
-
}, className: "flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent/50", title: expanded ? "Collapse" : "Manage agents", children: expanded || showAdd ? _jsx(IconX, { size: 12 }) : _jsx(IconPlus, { size: 12 }) })] }), (expanded || showAdd) && (_jsxs(_Fragment, { children: [!showAdd && (_jsxs("div", { className: "flex flex-col gap-0.5 mb-1.5", children: [agents.map((agent) => (_jsxs("button", { onClick: () => setSelectedAgent(agent), className: "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-accent/30", children: [_jsx(IconPlugConnected, { size: 13, className: "shrink-0 text-muted-foreground" }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("div", { className: "text-[11px] font-medium text-foreground truncate", children: agent.name }), _jsx("div", { className: "text-[10px] text-muted-foreground/60 truncate", children: agent.url })] })] }, agent.id))), _jsxs("button", { onClick: () => setShowAdd(true), className: "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-[11px] text-muted-foreground hover:text-foreground hover:bg-accent/30", children: [_jsx(IconPlus, { size: 12, className: "shrink-0" }), "Add agent"] })] })), showAdd && (_jsxs("div", { className: "mb-1.5 flex flex-col gap-1.5 rounded-md border border-border bg-background p-2", children: [_jsx("input", { ref: nameRef, value: name, onChange: (e) => setName(e.target.value), onKeyDown: (e) => {
|
|
292
|
-
if (e.key === "Enter")
|
|
293
|
-
handleAdd();
|
|
294
|
-
if (e.key === "Escape")
|
|
295
|
-
setShowAdd(false);
|
|
296
|
-
}, className: "w-full rounded border border-border bg-background px-2 py-1 text-[12px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-accent", placeholder: "Name" }), _jsx("input", { value: url, onChange: (e) => setUrl(e.target.value), onKeyDown: (e) => {
|
|
297
|
-
if (e.key === "Enter")
|
|
298
|
-
handleAdd();
|
|
299
|
-
if (e.key === "Escape")
|
|
300
|
-
setShowAdd(false);
|
|
301
|
-
}, className: "w-full rounded border border-border bg-background px-2 py-1 text-[12px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-accent", placeholder: "URL (e.g. http://localhost:8085)" }), _jsx("input", { value: description, onChange: (e) => setDescription(e.target.value), onKeyDown: (e) => {
|
|
302
|
-
if (e.key === "Enter")
|
|
303
|
-
handleAdd();
|
|
304
|
-
if (e.key === "Escape")
|
|
305
|
-
setShowAdd(false);
|
|
306
|
-
}, className: "w-full rounded border border-border bg-background px-2 py-1 text-[12px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-accent", placeholder: "Description (optional)" }), _jsxs("div", { className: "flex justify-end gap-1.5", children: [_jsx("button", { onClick: () => setShowAdd(false), className: "rounded px-2.5 py-1 text-[11px] font-medium text-muted-foreground hover:text-foreground", children: "Cancel" }), _jsx("button", { onClick: handleAdd, disabled: !name.trim() || !url.trim(), className: "rounded bg-accent px-2.5 py-1 text-[11px] font-medium text-foreground hover:bg-accent/80 disabled:opacity-40 disabled:pointer-events-none", children: "Add" })] })] }))] }))] }));
|
|
307
|
-
}
|
|
308
110
|
function useClientOnly() {
|
|
309
111
|
const [mounted, setMounted] = useState(false);
|
|
310
112
|
useEffect(() => setMounted(true), []);
|
|
311
113
|
return mounted;
|
|
312
114
|
}
|
|
313
|
-
export function AgentPanel({ defaultMode = "chat", className, apiUrl, emptyStateText, suggestions, showHeader = true, onCollapse, devAppUrl, storageKey, }) {
|
|
115
|
+
export function AgentPanel({ defaultMode = "chat", className, apiUrl, emptyStateText, suggestions, showHeader = true, onCollapse, isFullscreen, onToggleFullscreen, devAppUrl, storageKey, }) {
|
|
314
116
|
const mounted = useClientOnly();
|
|
315
117
|
const keyPrefix = storageKey ? `:${storageKey}` : "";
|
|
316
118
|
const execModeKey = `${EXEC_MODE_KEY}${keyPrefix}`;
|
|
317
119
|
const panelModeKey = `agent-native-panel-mode${keyPrefix}`;
|
|
120
|
+
const isMac = useMemo(() => typeof navigator !== "undefined" &&
|
|
121
|
+
/Mac|iPhone|iPad/.test(navigator.userAgent), []);
|
|
122
|
+
const closeTabHint = isMac ? "\u2303W" : "Alt+W";
|
|
123
|
+
const closeAllTabsHint = isMac ? "\u2303\u2325W" : "Ctrl+Alt+W";
|
|
318
124
|
const [execMode, setExecMode] = useState(() => {
|
|
319
125
|
try {
|
|
320
126
|
const saved = localStorage.getItem(execModeKey);
|
|
@@ -337,7 +143,10 @@ export function AgentPanel({ defaultMode = "chat", className, apiUrl, emptyState
|
|
|
337
143
|
const [mode, setMode] = useState(() => {
|
|
338
144
|
try {
|
|
339
145
|
const saved = localStorage.getItem(panelModeKey);
|
|
340
|
-
if (saved === "chat" ||
|
|
146
|
+
if (saved === "chat" ||
|
|
147
|
+
saved === "cli" ||
|
|
148
|
+
saved === "resources" ||
|
|
149
|
+
saved === "settings")
|
|
341
150
|
return saved;
|
|
342
151
|
}
|
|
343
152
|
catch { }
|
|
@@ -362,6 +171,14 @@ export function AgentPanel({ defaultMode = "chat", className, apiUrl, emptyState
|
|
|
362
171
|
window.addEventListener("agent-panel:set-mode", handler);
|
|
363
172
|
return () => window.removeEventListener("agent-panel:set-mode", handler);
|
|
364
173
|
}, [switchMode]);
|
|
174
|
+
// Open settings tab when requested (replaces the old popover open event)
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
function handleOpenSettings() {
|
|
177
|
+
switchMode("settings");
|
|
178
|
+
}
|
|
179
|
+
window.addEventListener("agent-panel:open-settings", handleOpenSettings);
|
|
180
|
+
return () => window.removeEventListener("agent-panel:open-settings", handleOpenSettings);
|
|
181
|
+
}, [switchMode]);
|
|
365
182
|
// CLI terminal tabs (ephemeral — not persisted to SQL)
|
|
366
183
|
const [cliTabs, setCliTabs] = useState(["cli-1"]);
|
|
367
184
|
const [activeCliTab, setActiveCliTab] = useState("cli-1");
|
|
@@ -396,6 +213,35 @@ export function AgentPanel({ defaultMode = "chat", className, apiUrl, emptyState
|
|
|
396
213
|
setCliTabs([id]);
|
|
397
214
|
setActiveCliTab(id);
|
|
398
215
|
}, []);
|
|
216
|
+
// Tab close shortcuts. Avoid Cmd+W (browser/OS) and (on Windows) Ctrl+W.
|
|
217
|
+
// Mac: Ctrl+W → close tab, Ctrl+Alt+W → close all
|
|
218
|
+
// Windows/Linux: Alt+W → close tab, Ctrl+Alt+W → close all
|
|
219
|
+
useEffect(() => {
|
|
220
|
+
const handleKeyDown = (e) => {
|
|
221
|
+
if (e.key.toLowerCase() !== "w" || e.metaKey || e.shiftKey)
|
|
222
|
+
return;
|
|
223
|
+
const isCloseAll = e.ctrlKey && e.altKey;
|
|
224
|
+
const isCloseOne = isMac
|
|
225
|
+
? e.ctrlKey && !e.altKey
|
|
226
|
+
: e.altKey && !e.ctrlKey;
|
|
227
|
+
if (!isCloseAll && !isCloseOne)
|
|
228
|
+
return;
|
|
229
|
+
e.preventDefault();
|
|
230
|
+
if (mode === "chat") {
|
|
231
|
+
window.dispatchEvent(new CustomEvent(isCloseAll
|
|
232
|
+
? "agent-chat:close-all-tabs"
|
|
233
|
+
: "agent-chat:close-current-tab"));
|
|
234
|
+
}
|
|
235
|
+
else if (mode === "cli") {
|
|
236
|
+
if (isCloseAll)
|
|
237
|
+
closeAllCliTabs();
|
|
238
|
+
else if (activeCliTab)
|
|
239
|
+
closeCliTab(activeCliTab);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
243
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
244
|
+
}, [mode, activeCliTab, closeCliTab, closeAllCliTabs, isMac]);
|
|
399
245
|
const availableClis = useAvailableClis();
|
|
400
246
|
const [selectedCli, selectCli] = useCliSelection(keyPrefix);
|
|
401
247
|
const selectedLabel = availableClis.find((c) => c.command === selectedCli)?.label || selectedCli;
|
|
@@ -424,12 +270,14 @@ export function AgentPanel({ defaultMode = "chat", className, apiUrl, emptyState
|
|
|
424
270
|
const showDevToggle = canToggle && isLocalhost;
|
|
425
271
|
const renderModeButtons = useCallback((activeMode) => (_jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [_jsxs("button", { onClick: () => switchMode("chat"), className: cn("flex items-center gap-1 rounded-md px-2 py-1 text-[12px] leading-none", activeMode === "chat"
|
|
426
272
|
? "bg-accent text-foreground"
|
|
427
|
-
: "text-muted-foreground hover:bg-accent/50 hover:text-foreground"), title: "Chat mode", style: AGENT_PANEL_CONTROL_STYLE, children: [_jsx(IconMessage, { size: 14 }), "Chat"] }), _jsxs("button", { onClick: () => switchMode("cli"), className: cn("flex items-center gap-1 rounded-md px-2 py-1 text-[12px] leading-none", activeMode === "cli"
|
|
273
|
+
: "text-muted-foreground hover:bg-accent/50 hover:text-foreground"), title: "Chat mode", style: AGENT_PANEL_CONTROL_STYLE, children: [_jsx(IconMessage, { size: 14 }), "Chat"] }), isDevMode && (_jsxs("button", { onClick: () => switchMode("cli"), className: cn("flex items-center gap-1 rounded-md px-2 py-1 text-[12px] leading-none", activeMode === "cli"
|
|
274
|
+
? "bg-accent text-foreground"
|
|
275
|
+
: "text-muted-foreground hover:bg-accent/50 hover:text-foreground"), title: "CLI terminal mode", style: AGENT_PANEL_CONTROL_STYLE, children: [_jsx(IconTerminal2, { size: 14 }), "CLI"] })), _jsxs("button", { onClick: () => switchMode("resources"), className: cn("flex items-center gap-1 rounded-md px-2 py-1 text-[12px] leading-none", activeMode === "resources"
|
|
428
276
|
? "bg-accent text-foreground"
|
|
429
|
-
: "text-muted-foreground hover:bg-accent/50 hover:text-foreground"), title: "
|
|
277
|
+
: "text-muted-foreground hover:bg-accent/50 hover:text-foreground"), title: "Workspace files, agents, skills, and tasks", style: AGENT_PANEL_CONTROL_STYLE, children: [_jsx(IconLayoutGrid, { size: 14 }), "Workspace"] }), _jsx("button", { onClick: () => switchMode("settings"), className: cn("flex items-center justify-center rounded-md px-1.5 py-1", activeMode === "settings"
|
|
430
278
|
? "bg-accent text-foreground"
|
|
431
|
-
: "text-muted-foreground hover:bg-accent/50 hover:text-foreground"), title: "
|
|
432
|
-
const renderHeaderActions = useCallback(() => (_jsxs("div", { className: "flex shrink-0 items-center gap-1.5", children: [_jsx(IconTooltip, { content: "
|
|
279
|
+
: "text-muted-foreground hover:bg-accent/50 hover:text-foreground"), title: "Setup and configuration", children: _jsx(IconSettings, { size: 14 }) })] })), [isDevMode]);
|
|
280
|
+
const renderHeaderActions = useCallback(() => (_jsxs("div", { className: "flex shrink-0 items-center gap-1.5", children: [isDevMode && (_jsx(Suspense, { fallback: null, children: _jsx(SetupButton, {}) })), _jsx(FeedbackButton, { variant: "icon", side: "bottom", align: "end" }), onToggleFullscreen && (_jsx(IconTooltip, { content: isFullscreen ? "Exit fullscreen" : "Fullscreen", children: _jsx("button", { onClick: onToggleFullscreen, className: "flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent/50", children: isFullscreen ? (_jsx(IconArrowsMinimize, { size: 14 })) : (_jsx(IconArrowsMaximize, { size: 14 })) }) })), onCollapse && (_jsx(IconTooltip, { content: "Collapse sidebar", children: _jsx("button", { onClick: onCollapse, className: "flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent/50", children: _jsx(IconLayoutSidebarRightCollapse, { size: 14 }) }) }))] })), [onCollapse, isDevMode, onToggleFullscreen, isFullscreen]);
|
|
433
281
|
const [tabMenuOpen, setTabMenuOpen] = useState(null);
|
|
434
282
|
const [cliPickerOpen, setCliPickerOpen] = useState(false);
|
|
435
283
|
const cliPickerBtnRef = useRef(null);
|
|
@@ -505,13 +353,13 @@ export function AgentPanel({ defaultMode = "chat", className, apiUrl, emptyState
|
|
|
505
353
|
"bg-accent text-foreground"), children: _jsx(IconDotsVertical, { size: 14 }) }) }), tabMenuOpen === "__chat_global" && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40", onClick: () => setTabMenuOpen(null) }), _jsxs("div", { className: "absolute right-0 top-full mt-1 z-50 w-44 rounded-md border border-border bg-popover py-1 shadow-lg", children: [_jsxs("button", { className: "flex w-full items-center justify-between px-3 py-1.5 text-xs text-foreground hover:bg-accent", onClick: () => {
|
|
506
354
|
closeTab(activeTabId);
|
|
507
355
|
setTabMenuOpen(null);
|
|
508
|
-
}, children: ["Close Tab",
|
|
356
|
+
}, children: ["Close Tab", _jsx("kbd", { className: "text-[10px] text-muted-foreground", children: closeTabHint })] }), _jsx("button", { className: "flex w-full items-center px-3 py-1.5 text-xs text-foreground hover:bg-accent", onClick: () => {
|
|
509
357
|
closeOtherTabs(activeTabId);
|
|
510
358
|
setTabMenuOpen(null);
|
|
511
|
-
}, children: "Close Other Tabs" }),
|
|
359
|
+
}, children: "Close Other Tabs" }), _jsxs("button", { className: "flex w-full items-center justify-between px-3 py-1.5 text-xs text-foreground hover:bg-accent", onClick: () => {
|
|
512
360
|
closeAllTabs();
|
|
513
361
|
setTabMenuOpen(null);
|
|
514
|
-
}, children: "Close All Tabs" })] })] }))] })] })), mode === "cli" && (_jsxs(_Fragment, { children: [_jsx(IconTooltip, { content: "New terminal", children: _jsx("button", { onClick: addCliTab, className: "flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent/50", children: _jsx(IconPlus, { size: 14 }) }) }), availableClis.length > 0 && (_jsxs("div", { className: "relative", children: [_jsx(IconTooltip, { content: `CLI: ${selectedLabel}`, children: _jsx("button", { ref: cliPickerBtnRef, onClick: () => setCliPickerOpen(!cliPickerOpen), className: cn("flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent/50", cliPickerOpen && "bg-accent text-foreground"), children: _jsx(IconSettings, { size: 14 }) }) }), cliPickerOpen &&
|
|
362
|
+
}, children: ["Close All Tabs", _jsx("kbd", { className: "text-[10px] text-muted-foreground", children: closeAllTabsHint })] })] })] }))] })] })), mode === "cli" && (_jsxs(_Fragment, { children: [_jsx(IconTooltip, { content: "New terminal", children: _jsx("button", { onClick: addCliTab, className: "flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent/50", children: _jsx(IconPlus, { size: 14 }) }) }), availableClis.length > 0 && (_jsxs("div", { className: "relative", children: [_jsx(IconTooltip, { content: `CLI: ${selectedLabel}`, children: _jsx("button", { ref: cliPickerBtnRef, onClick: () => setCliPickerOpen(!cliPickerOpen), className: cn("flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent/50", cliPickerOpen && "bg-accent text-foreground"), children: _jsx(IconSettings, { size: 14 }) }) }), cliPickerOpen &&
|
|
515
363
|
ReactDOM.createPortal(_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-[9980]", onClick: () => setCliPickerOpen(false) }), _jsx("div", { className: "fixed z-[9990] w-48 rounded-md border border-border bg-popover py-1 shadow-lg", style: (() => {
|
|
516
364
|
const r = cliPickerBtnRef.current?.getBoundingClientRect();
|
|
517
365
|
if (!r)
|
|
@@ -533,13 +381,13 @@ export function AgentPanel({ defaultMode = "chat", className, apiUrl, emptyState
|
|
|
533
381
|
"bg-accent text-foreground"), children: _jsx(IconDotsVertical, { size: 14 }) }) }), tabMenuOpen === "__cli_global" && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40", onClick: () => setTabMenuOpen(null) }), _jsxs("div", { className: "absolute right-0 top-full mt-1 z-50 w-44 rounded-md border border-border bg-popover py-1 shadow-lg", children: [_jsxs("button", { className: "flex w-full items-center justify-between px-3 py-1.5 text-xs text-foreground hover:bg-accent", onClick: () => {
|
|
534
382
|
closeCliTab(activeCliTab);
|
|
535
383
|
setTabMenuOpen(null);
|
|
536
|
-
}, children: ["Close Tab",
|
|
384
|
+
}, children: ["Close Tab", _jsx("kbd", { className: "text-[10px] text-muted-foreground", children: closeTabHint })] }), _jsx("button", { className: "flex w-full items-center px-3 py-1.5 text-xs text-foreground hover:bg-accent", onClick: () => {
|
|
537
385
|
closeOtherCliTabs(activeCliTab);
|
|
538
386
|
setTabMenuOpen(null);
|
|
539
|
-
}, children: "Close Other Tabs" }),
|
|
387
|
+
}, children: "Close Other Tabs" }), _jsxs("button", { className: "flex w-full items-center justify-between px-3 py-1.5 text-xs text-foreground hover:bg-accent", onClick: () => {
|
|
540
388
|
closeAllCliTabs();
|
|
541
389
|
setTabMenuOpen(null);
|
|
542
|
-
}, children: "Close All Tabs" })] })] }))] })] }))] })] }), mode === "chat" && hasSubTabs && (_jsx("div", { className: "flex items-center px-2 py-0.5 border-b border-border gap-0.5 bg-muted/30", children: _jsxs("div", { className: "flex items-center gap-0.5 min-w-0 overflow-x-auto scrollbar-none flex-1", children: [_jsx("div", { role: "button", tabIndex: 0, onClick: () => setActiveTabId(focusParentId), className: cn("flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium cursor-pointer", activeTabId === focusParentId
|
|
390
|
+
}, children: ["Close All Tabs", _jsx("kbd", { className: "text-[10px] text-muted-foreground", children: closeAllTabsHint })] })] })] }))] })] }))] })] }), mode === "chat" && hasSubTabs && (_jsx("div", { className: "flex items-center px-2 py-0.5 border-b border-border gap-0.5 bg-muted/30", children: _jsxs("div", { className: "flex items-center gap-0.5 min-w-0 overflow-x-auto scrollbar-none flex-1", children: [_jsx("div", { role: "button", tabIndex: 0, onClick: () => setActiveTabId(focusParentId), className: cn("flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium cursor-pointer", activeTabId === focusParentId
|
|
543
391
|
? "bg-accent text-foreground"
|
|
544
392
|
: "text-muted-foreground hover:bg-accent hover:text-foreground"), children: "Main" }), childTabs.map((tab) => (_jsxs("div", { role: "button", tabIndex: 0, ref: tab.id === activeTabId ? activeTabRefCb : undefined, onClick: () => setActiveTabId(tab.id), className: cn("agent-tab relative flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium cursor-pointer max-w-[140px]", tab.id === activeTabId
|
|
545
393
|
? "bg-accent text-foreground"
|
|
@@ -572,20 +420,29 @@ export function AgentPanel({ defaultMode = "chat", className, apiUrl, emptyState
|
|
|
572
420
|
selectedLabel,
|
|
573
421
|
selectCli,
|
|
574
422
|
cliPickerOpen,
|
|
423
|
+
closeTabHint,
|
|
424
|
+
closeAllTabsHint,
|
|
575
425
|
]);
|
|
576
|
-
return (_jsxs("div", { className: cn("agent-panel-root flex flex-1 flex-col min-h-0 h-full text-[13px] leading-[1.2] antialiased", className), style: AGENT_PANEL_ROOT_STYLE, children: [_jsx("style", { dangerouslySetInnerHTML: {
|
|
577
|
-
__html: ".agent-tab-close{opacity:0}.agent-tab:hover .agent-tab-close{opacity:1}"
|
|
578
|
-
|
|
426
|
+
return (_jsxs("div", { className: cn("agent-panel-root flex flex-1 flex-col min-h-0 h-full text-[13px] leading-[1.2] antialiased", className), style: AGENT_PANEL_ROOT_STYLE, "data-agent-fullscreen": isFullscreen ? "true" : undefined, children: [_jsx("style", { dangerouslySetInnerHTML: {
|
|
427
|
+
__html: ".agent-tab-close{opacity:0}.agent-tab:hover .agent-tab-close{opacity:1}" +
|
|
428
|
+
`[data-agent-fullscreen='true'] .agent-thread-content,` +
|
|
429
|
+
`[data-agent-fullscreen='true'] .agent-composer-area{` +
|
|
430
|
+
`max-width:${FULLSCREEN_CONTENT_MAX_PX}px;` +
|
|
431
|
+
`margin-left:auto;margin-right:auto;width:100%;}`,
|
|
432
|
+
} }), mounted && isDevMode && (_jsx(Suspense, { fallback: null, children: _jsx(OnboardingPanel, {}) })), _jsx("div", { className: cn("flex flex-col min-h-0", mode === "chat" ? "flex-1" : "shrink-0"), children: mounted && (_jsx(MultiTabAssistantChat, { apiUrl: apiUrl, showHeader: false, renderHeader: showHeader ? renderChatHeader : undefined, renderOverlay: undefined, contentHidden: mode !== "chat", emptyStateText: emptyStateText, suggestions: suggestions, onSwitchToCli: () => switchMode("cli"), execMode: execMode, onExecModeChange: switchExecMode, storageKey: storageKey })) }), isDevMode
|
|
579
433
|
? cliTabs.map((id) => (_jsx("div", { className: cn("min-h-0 relative", mode === "cli" ? "flex-1" : "hidden"), style: {
|
|
580
434
|
display: mode === "cli" && id === activeCliTab ? undefined : "none",
|
|
581
435
|
}, children: _jsx(Suspense, { fallback: _jsx("div", { className: "flex items-center justify-center h-full text-muted-foreground text-sm", children: "Loading terminal..." }), children: _jsx(AgentTerminal, { command: selectedCli, hideInFrame: false, className: "h-full", style: { background: "transparent" } }) }) }, id)))
|
|
582
|
-
: mode === "cli" && (_jsxs("div", { className: "flex flex-1 flex-col items-center justify-center min-h-0 px-6 gap-3", children: [_jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-muted", children: _jsx(IconTerminal2, { className: "h-5 w-5 text-muted-foreground" }) }), _jsxs("div", { className: "text-center max-w-[260px]", children: [_jsx("p", { className: "text-sm font-medium text-foreground mb-1", children: "CLI requires dev mode" }), _jsxs("p", { className: "text-xs text-muted-foreground leading-relaxed", children: ["Run this app locally with", " ", _jsx("code", { className: "bg-muted px-1 py-0.5 rounded text-[10px]", children: "pnpm dev" }), " ", "or use", " ", _jsx("span", { className: "font-medium text-foreground", children: "Builder.io" }), " ", "to access the CLI terminal."] })] })] })), mode === "resources" && (_jsx("div", { className: "flex-1 min-h-0", children: _jsx(Suspense, { fallback: _jsx("div", { className: "flex h-full flex-col min-h-0", children: _jsx("div", { className: "flex shrink-0 items-center justify-between border-b border-border px-2 py-1.5", children: _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("div", { className: "h-5 w-16 rounded bg-muted animate-pulse" }), _jsx("div", { className: "h-5 w-14 rounded bg-muted animate-pulse" })] }) }) }), children: _jsx(ResourcesPanel, {}) }) }))] }));
|
|
436
|
+
: mode === "cli" && (_jsxs("div", { className: "flex flex-1 flex-col items-center justify-center min-h-0 px-6 gap-3", children: [_jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-muted", children: _jsx(IconTerminal2, { className: "h-5 w-5 text-muted-foreground" }) }), _jsxs("div", { className: "text-center max-w-[260px]", children: [_jsx("p", { className: "text-sm font-medium text-foreground mb-1", children: "CLI requires dev mode" }), _jsxs("p", { className: "text-xs text-muted-foreground leading-relaxed", children: ["Run this app locally with", " ", _jsx("code", { className: "bg-muted px-1 py-0.5 rounded text-[10px]", children: "pnpm dev" }), " ", "or use", " ", _jsx("span", { className: "font-medium text-foreground", children: "Builder.io" }), " ", "to access the CLI terminal."] })] })] })), mode === "resources" && (_jsx("div", { className: "flex-1 min-h-0", children: _jsx(Suspense, { fallback: _jsx("div", { className: "flex h-full flex-col min-h-0", children: _jsx("div", { className: "flex shrink-0 items-center justify-between border-b border-border px-2 py-1.5", children: _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("div", { className: "h-5 w-16 rounded bg-muted animate-pulse" }), _jsx("div", { className: "h-5 w-14 rounded bg-muted animate-pulse" })] }) }) }), children: _jsx(ResourcesPanel, {}) }) })), mode === "settings" && (_jsx("div", { className: "flex flex-col flex-1 min-h-0", children: _jsx(Suspense, { fallback: _jsxs("div", { className: "p-3 space-y-2", children: [_jsx("div", { className: "h-10 w-full rounded-lg bg-muted animate-pulse" }), _jsx("div", { className: "h-10 w-full rounded-lg bg-muted animate-pulse" }), _jsx("div", { className: "h-10 w-full rounded-lg bg-muted animate-pulse" })] }), children: _jsx(SettingsPanel, { isDevMode: isDevMode, onToggleDevMode: () => setDevMode(!isDevMode), showDevToggle: showDevToggle, devAppUrl: devAppUrl }) }) }))] }));
|
|
583
437
|
}
|
|
584
438
|
// ─── Resize handle ──────────────────────────────────────────────────────────
|
|
585
439
|
const SIDEBAR_STORAGE_KEY = "agent-native-sidebar-width";
|
|
586
440
|
const SIDEBAR_OPEN_KEY = "agent-native-sidebar-open";
|
|
441
|
+
const SIDEBAR_FULLSCREEN_KEY = "agent-native-sidebar-fullscreen";
|
|
587
442
|
const SIDEBAR_MIN = 280;
|
|
588
443
|
const SIDEBAR_MAX = 700;
|
|
444
|
+
/** Max width of the centered chat column in fullscreen mode (Claude-style). */
|
|
445
|
+
const FULLSCREEN_CONTENT_MAX_PX = 760;
|
|
589
446
|
function ResizeHandle({ position, onDrag, }) {
|
|
590
447
|
const ref = useRef(null);
|
|
591
448
|
const dragging = useRef(false);
|
|
@@ -651,6 +508,160 @@ function ResizeHandle({ position, onDrag, }) {
|
|
|
651
508
|
}, [position]);
|
|
652
509
|
return (_jsx("div", { ref: ref, className: cn("relative z-20 shrink-0 w-px touch-none select-none transition-colors", "bg-border hover:bg-accent active:bg-accent"), style: { cursor: "col-resize" } }));
|
|
653
510
|
}
|
|
511
|
+
/**
|
|
512
|
+
* Remounts its children whenever the framework's `refresh-screen` tool is
|
|
513
|
+
* invoked. Used inside AgentSidebar so the main content area re-fetches
|
|
514
|
+
* without disturbing the chat sidebar's in-flight state.
|
|
515
|
+
*
|
|
516
|
+
* Two mechanisms work together here:
|
|
517
|
+
*
|
|
518
|
+
* 1. Before the remount, every react-query cache entry is marked stale
|
|
519
|
+
* via `invalidateQueries({ refetchType: "none" })`. This does NOT
|
|
520
|
+
* trigger a refetch on its own, so active queries elsewhere (chat
|
|
521
|
+
* sidebar, left nav) keep their current data — they'll refetch only
|
|
522
|
+
* on their next natural trigger.
|
|
523
|
+
* 2. The React `key` then bumps, unmounting and remounting the subtree.
|
|
524
|
+
* On remount, child components re-subscribe to their queries, see
|
|
525
|
+
* the data is stale, and refetch — regardless of configured
|
|
526
|
+
* `staleTime`. This is what makes the dashboard pick up the agent's
|
|
527
|
+
* edits even when the query uses `staleTime: 30_000` or similar.
|
|
528
|
+
*/
|
|
529
|
+
/**
|
|
530
|
+
* Syncs the current URL (pathname + search + hash) to application_state
|
|
531
|
+
* under `__url__`, and processes one-shot URL-update commands the agent
|
|
532
|
+
* writes to `__set_url__`. Lives inside AgentSidebar so every framework
|
|
533
|
+
* template gets URL visibility + URL-write capability for its agent
|
|
534
|
+
* without per-template wiring.
|
|
535
|
+
*
|
|
536
|
+
* Two directions:
|
|
537
|
+
* UI → state — on route change, write `{ pathname, search, hash,
|
|
538
|
+
* searchParams }` to `__url__`. The production agent reads
|
|
539
|
+
* this and includes it in the auto-injected `<current-url>`
|
|
540
|
+
* block, so the agent always knows what page the user is
|
|
541
|
+
* on, including filter/search params like `?f_date=2026-01`.
|
|
542
|
+
*
|
|
543
|
+
* state → UI — the framework's `set-search-params` / `set-url-path`
|
|
544
|
+
* tools write a command to `__set_url__`. This hook reads
|
|
545
|
+
* the command, applies it via react-router, then deletes
|
|
546
|
+
* the key. The UI reacts in one tick, no page reload.
|
|
547
|
+
*/
|
|
548
|
+
function URLSync() {
|
|
549
|
+
const location = useLocation();
|
|
550
|
+
const navigate = useNavigate();
|
|
551
|
+
const queryClient = useQueryClient();
|
|
552
|
+
// Outbound: write the current URL to app-state whenever it changes.
|
|
553
|
+
React.useEffect(() => {
|
|
554
|
+
const searchParams = {};
|
|
555
|
+
for (const [k, v] of new URLSearchParams(location.search).entries()) {
|
|
556
|
+
searchParams[k] = v;
|
|
557
|
+
}
|
|
558
|
+
const body = {
|
|
559
|
+
pathname: location.pathname,
|
|
560
|
+
search: location.search,
|
|
561
|
+
hash: location.hash,
|
|
562
|
+
searchParams,
|
|
563
|
+
};
|
|
564
|
+
fetch("/_agent-native/application-state/__url__", {
|
|
565
|
+
method: "PUT",
|
|
566
|
+
keepalive: true,
|
|
567
|
+
headers: { "Content-Type": "application/json" },
|
|
568
|
+
body: JSON.stringify(body),
|
|
569
|
+
}).catch(() => { });
|
|
570
|
+
}, [location.pathname, location.search, location.hash]);
|
|
571
|
+
// Inbound: poll for URL-update commands from the agent. We piggyback on
|
|
572
|
+
// the same 2-second cadence useDbSync uses so there's no extra timer.
|
|
573
|
+
const { data: command } = useQuery({
|
|
574
|
+
queryKey: ["__set_url__"],
|
|
575
|
+
queryFn: async () => {
|
|
576
|
+
try {
|
|
577
|
+
const res = await fetch("/_agent-native/application-state/__set_url__");
|
|
578
|
+
if (!res.ok || res.status === 204)
|
|
579
|
+
return null;
|
|
580
|
+
const text = await res.text();
|
|
581
|
+
if (!text)
|
|
582
|
+
return null;
|
|
583
|
+
const data = JSON.parse(text);
|
|
584
|
+
return data ? { ...data, _ts: Date.now() } : null;
|
|
585
|
+
}
|
|
586
|
+
catch {
|
|
587
|
+
return null;
|
|
588
|
+
}
|
|
589
|
+
},
|
|
590
|
+
refetchInterval: 2_000,
|
|
591
|
+
refetchIntervalInBackground: true,
|
|
592
|
+
structuralSharing: false,
|
|
593
|
+
retry: false,
|
|
594
|
+
});
|
|
595
|
+
React.useEffect(() => {
|
|
596
|
+
if (!command)
|
|
597
|
+
return;
|
|
598
|
+
// Delete the one-shot command before applying so duplicate events
|
|
599
|
+
// don't cause repeated navigation.
|
|
600
|
+
fetch("/_agent-native/application-state/__set_url__", {
|
|
601
|
+
method: "DELETE",
|
|
602
|
+
}).catch(() => { });
|
|
603
|
+
const cmd = command;
|
|
604
|
+
try {
|
|
605
|
+
const current = new URL(window.location.href);
|
|
606
|
+
const nextPath = cmd.pathname ?? current.pathname;
|
|
607
|
+
const nextSearch = cmd.mergeSearchParams !== false
|
|
608
|
+
? new URLSearchParams(current.search)
|
|
609
|
+
: new URLSearchParams();
|
|
610
|
+
if (cmd.searchParams) {
|
|
611
|
+
for (const [k, v] of Object.entries(cmd.searchParams)) {
|
|
612
|
+
if (v === null || v === "")
|
|
613
|
+
nextSearch.delete(k);
|
|
614
|
+
else
|
|
615
|
+
nextSearch.set(k, v);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
const nextHash = cmd.hash ?? current.hash;
|
|
619
|
+
const qs = nextSearch.toString();
|
|
620
|
+
const url = nextPath + (qs ? `?${qs}` : "") + (nextHash || "");
|
|
621
|
+
// Skip the navigation if the URL is already at the target state —
|
|
622
|
+
// avoids needless react-router work and any revalidation side-effects
|
|
623
|
+
// that come with it.
|
|
624
|
+
// Mark that the agent just wrote the URL so consumers (e.g. a
|
|
625
|
+
// dashboard restoring saved filter defaults) can skip any auto-
|
|
626
|
+
// restore that would clobber the agent's change. Set this BEFORE
|
|
627
|
+
// the same-URL short-circuit — a no-op nav is still an explicit
|
|
628
|
+
// "agent authored this state" signal that consumers depend on.
|
|
629
|
+
try {
|
|
630
|
+
sessionStorage.setItem("__agentUrlAppliedAt__", String(Date.now()));
|
|
631
|
+
}
|
|
632
|
+
catch {
|
|
633
|
+
// sessionStorage unavailable — not fatal.
|
|
634
|
+
}
|
|
635
|
+
const currentUrl = current.pathname + (current.search || "") + (current.hash || "");
|
|
636
|
+
if (url === currentUrl) {
|
|
637
|
+
queryClient.setQueryData(["__set_url__"], null);
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
// Replace rather than push so repeated agent URL updates don't
|
|
641
|
+
// clutter the history stack and can't trigger extra remounts from
|
|
642
|
+
// router navigation lifecycle.
|
|
643
|
+
navigate(url, { replace: true });
|
|
644
|
+
}
|
|
645
|
+
catch {
|
|
646
|
+
// Malformed command — ignore.
|
|
647
|
+
}
|
|
648
|
+
queryClient.setQueryData(["__set_url__"], null);
|
|
649
|
+
}, [command, navigate, queryClient]);
|
|
650
|
+
return null;
|
|
651
|
+
}
|
|
652
|
+
function ScreenRefreshBoundary({ children }) {
|
|
653
|
+
const key = useScreenRefreshKey();
|
|
654
|
+
const queryClient = useQueryClient();
|
|
655
|
+
const lastKeyRef = React.useRef(key);
|
|
656
|
+
if (key !== lastKeyRef.current) {
|
|
657
|
+
lastKeyRef.current = key;
|
|
658
|
+
// Mark every cached query stale without kicking off a refetch. The
|
|
659
|
+
// subtree-level refetches happen naturally when the new tree mounts
|
|
660
|
+
// below and child components re-subscribe.
|
|
661
|
+
queryClient.invalidateQueries({ refetchType: "none" });
|
|
662
|
+
}
|
|
663
|
+
return _jsx(React.Fragment, { children: children }, key);
|
|
664
|
+
}
|
|
654
665
|
/**
|
|
655
666
|
* Wraps app content with a toggleable agent sidebar.
|
|
656
667
|
* Use AgentToggleButton in your header to open/close it.
|
|
@@ -673,6 +684,29 @@ export function AgentSidebar({ children, emptyStateText = "How can I help you?",
|
|
|
673
684
|
});
|
|
674
685
|
const [presentationMode, setPresentationMode] = useState(false);
|
|
675
686
|
const [width, setWidth] = useState(sidebarWidth);
|
|
687
|
+
const [fullscreen, setFullscreen] = useState(() => {
|
|
688
|
+
// Force-disable on mobile: a Claude-style centered column makes no sense
|
|
689
|
+
// when the sidebar already covers most of the viewport.
|
|
690
|
+
if (typeof window !== "undefined" &&
|
|
691
|
+
window.matchMedia("(max-width: 767px)").matches) {
|
|
692
|
+
return false;
|
|
693
|
+
}
|
|
694
|
+
try {
|
|
695
|
+
return localStorage.getItem(SIDEBAR_FULLSCREEN_KEY) === "true";
|
|
696
|
+
}
|
|
697
|
+
catch {
|
|
698
|
+
return false;
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
// Track mobile viewport so we can switch to overlay mode.
|
|
702
|
+
const [isMobile, setIsMobile] = useState(() => typeof window !== "undefined" &&
|
|
703
|
+
window.matchMedia("(max-width: 767px)").matches);
|
|
704
|
+
useEffect(() => {
|
|
705
|
+
const mq = window.matchMedia("(max-width: 767px)");
|
|
706
|
+
const handler = (e) => setIsMobile(e.matches);
|
|
707
|
+
mq.addEventListener("change", handler);
|
|
708
|
+
return () => mq.removeEventListener("change", handler);
|
|
709
|
+
}, []);
|
|
676
710
|
useEffect(() => {
|
|
677
711
|
try {
|
|
678
712
|
const saved = localStorage.getItem(SIDEBAR_STORAGE_KEY);
|
|
@@ -694,6 +728,16 @@ export function AgentSidebar({ children, emptyStateText = "How can I help you?",
|
|
|
694
728
|
return value;
|
|
695
729
|
});
|
|
696
730
|
}, []);
|
|
731
|
+
const toggleFullscreen = useCallback(() => {
|
|
732
|
+
setFullscreen((prev) => {
|
|
733
|
+
const next = !prev;
|
|
734
|
+
try {
|
|
735
|
+
localStorage.setItem(SIDEBAR_FULLSCREEN_KEY, String(next));
|
|
736
|
+
}
|
|
737
|
+
catch { }
|
|
738
|
+
return next;
|
|
739
|
+
});
|
|
740
|
+
}, []);
|
|
697
741
|
// Track whether the frame is controlling the sidebar (code mode = frame active).
|
|
698
742
|
// Default to true when inside an iframe — assume the frame sidebar is active
|
|
699
743
|
// until told otherwise. This prevents both sidebars flashing after hot reloads.
|
|
@@ -794,17 +838,60 @@ export function AgentSidebar({ children, emptyStateText = "How can I help you?",
|
|
|
794
838
|
});
|
|
795
839
|
}, []);
|
|
796
840
|
const isLeft = position === "left";
|
|
841
|
+
// Fullscreen only applies on desktop — on mobile the existing overlay is
|
|
842
|
+
// already viewport-covering, so the maximize button is hidden and the
|
|
843
|
+
// mounted state ignores any persisted value.
|
|
844
|
+
const effectiveFullscreen = fullscreen && !isMobile;
|
|
845
|
+
// On mobile the sidebar floats as a fixed overlay so the content below isn't
|
|
846
|
+
// squashed. On desktop it participates in the flex layout as before, except
|
|
847
|
+
// in fullscreen mode where it overlays the entire viewport (Claude-style).
|
|
848
|
+
let panelStyle;
|
|
849
|
+
if (isMobile) {
|
|
850
|
+
panelStyle = {
|
|
851
|
+
...AGENT_PANEL_ROOT_STYLE,
|
|
852
|
+
position: "fixed",
|
|
853
|
+
top: 0,
|
|
854
|
+
[isLeft ? "left" : "right"]: 0,
|
|
855
|
+
height: "100%",
|
|
856
|
+
width,
|
|
857
|
+
maxWidth: "85vw",
|
|
858
|
+
maxHeight: "100vh",
|
|
859
|
+
zIndex: 50,
|
|
860
|
+
background: "hsl(var(--background))",
|
|
861
|
+
borderLeft: isLeft ? "none" : "1px solid hsl(var(--border))",
|
|
862
|
+
borderRight: isLeft ? "1px solid hsl(var(--border))" : "none",
|
|
863
|
+
display: open ? "flex" : "none",
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
else if (effectiveFullscreen) {
|
|
867
|
+
panelStyle = {
|
|
868
|
+
...AGENT_PANEL_ROOT_STYLE,
|
|
869
|
+
position: "fixed",
|
|
870
|
+
inset: 0,
|
|
871
|
+
width: "100%",
|
|
872
|
+
maxHeight: "100vh",
|
|
873
|
+
zIndex: 40,
|
|
874
|
+
background: "hsl(var(--background))",
|
|
875
|
+
display: open ? "flex" : "none",
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
else {
|
|
879
|
+
panelStyle = {
|
|
880
|
+
...AGENT_PANEL_ROOT_STYLE,
|
|
881
|
+
width,
|
|
882
|
+
maxHeight: "100vh",
|
|
883
|
+
display: open ? "flex" : "none",
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
// Hide the resize handle when not draggable: mobile (overlay) or fullscreen
|
|
887
|
+
// (no width to drag — the panel covers the viewport).
|
|
888
|
+
const showResizeHandle = !isMobile && !effectiveFullscreen && open;
|
|
797
889
|
// Always render the sidebar panel (even when closed) so MultiTabAssistantChat
|
|
798
890
|
// stays mounted and can receive messages (e.g. from voice dictation) while
|
|
799
891
|
// the sidebar is visually hidden. When the user opens the sidebar they'll see
|
|
800
892
|
// any in-progress or completed conversations.
|
|
801
|
-
const sidebar = (_jsxs(_Fragment, { children: [
|
|
802
|
-
|
|
803
|
-
width,
|
|
804
|
-
maxHeight: "100vh",
|
|
805
|
-
display: open ? "flex" : "none",
|
|
806
|
-
}, children: _jsx(AgentPanel, { emptyStateText: emptyStateText, suggestions: suggestions, onCollapse: () => setOpenPersisted(false) }) }), isLeft ? (open ? (_jsx(ResizeHandle, { position: position, onDrag: handleDrag })) : null) : null] }));
|
|
807
|
-
return (_jsxs("div", { className: "flex min-w-0 flex-1 h-screen overflow-hidden", children: [isLeft && !presentationMode ? sidebar : null, _jsx("div", { className: "flex flex-1 flex-col overflow-auto min-w-0", children: children }), !isLeft && !presentationMode ? sidebar : null] }));
|
|
893
|
+
const sidebar = (_jsxs(_Fragment, { children: [showResizeHandle && !isLeft && (_jsx(ResizeHandle, { position: position, onDrag: handleDrag })), _jsx("div", { className: "agent-sidebar-panel flex shrink-0 flex-col overflow-hidden text-[13px] leading-[1.2] antialiased", style: panelStyle, children: _jsx(AgentPanel, { emptyStateText: emptyStateText, suggestions: suggestions, onCollapse: () => setOpenPersisted(false), isFullscreen: effectiveFullscreen, onToggleFullscreen: isMobile ? undefined : toggleFullscreen }) }), showResizeHandle && isLeft && (_jsx(ResizeHandle, { position: position, onDrag: handleDrag }))] }));
|
|
894
|
+
return (_jsxs("div", { className: "flex min-w-0 flex-1 h-screen overflow-hidden", children: [isMobile && open && !presentationMode && (_jsx("div", { className: "fixed inset-0 z-40 bg-black/40", onClick: () => setOpenPersisted(false) })), _jsx(URLSync, {}), isLeft && !presentationMode ? sidebar : null, _jsx("div", { className: "flex flex-1 flex-col overflow-auto min-w-0", children: _jsx(ScreenRefreshBoundary, { children: children }) }), !isLeft && !presentationMode ? sidebar : null] }));
|
|
808
895
|
}
|
|
809
896
|
/**
|
|
810
897
|
* Focus the agent chat composer input.
|