@agent-native/core 0.117.1 → 0.118.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/corpus/README.md +3 -3
- package/corpus/core/CHANGELOG.md +40 -0
- package/corpus/core/docs/content/custom-design-system.mdx +445 -0
- package/corpus/core/docs/content/toolkit-ui.mdx +16 -0
- package/corpus/core/package.json +2 -1
- package/corpus/core/src/a2a/types.ts +1 -0
- package/corpus/core/src/agent/types.ts +1 -1
- package/corpus/core/src/cli/context-xray-local.ts +1 -1
- package/corpus/core/src/client/AgentPanel.tsx +90 -107
- package/corpus/core/src/client/AssistantChat.tsx +30 -13
- package/corpus/core/src/client/CommandMenu.tsx +68 -178
- package/corpus/core/src/client/agent-chat-adapter.ts +3 -1
- package/corpus/core/src/client/app-providers.tsx +1 -1
- package/corpus/core/src/client/chat/message-components.tsx +116 -10
- package/corpus/core/src/client/chat/tool-call-display.tsx +26 -5
- package/corpus/core/src/client/chat/widgets/InlineExtensionWidget.tsx +14 -40
- package/corpus/core/src/client/components/ui/message-scroller.tsx +15 -1
- package/corpus/core/src/client/extensions/ExtensionViewer.tsx +4 -4
- package/corpus/core/src/client/extensions/ExtensionsSidebarSection.tsx +11 -11
- package/corpus/core/src/client/extensions/agent-native-extension-runtime.ts +1 -1
- package/corpus/core/src/client/extensions/delete-extension.ts +2 -2
- package/corpus/core/src/client/i18n.tsx +22 -0
- package/corpus/core/src/client/index.ts +17 -0
- package/corpus/core/src/client/org/OrgSwitcher.tsx +25 -1
- package/corpus/core/src/client/org/TeamPage.tsx +257 -153
- package/corpus/core/src/client/progress/RunsTray.tsx +89 -88
- package/corpus/core/src/client/resources/McpConnectionSuggestion.tsx +5 -2
- package/corpus/core/src/client/resources/McpIntegrationDialog.tsx +34 -13
- package/corpus/core/src/client/resources/mcp-integration-catalog.ts +13 -0
- package/corpus/core/src/client/settings/DemoModeSection.tsx +6 -18
- package/corpus/core/src/client/settings/SecretsSection.tsx +97 -52
- package/corpus/core/src/client/settings/SettingsPanel.tsx +302 -254
- package/corpus/core/src/client/settings/SettingsTabsPage.tsx +23 -2
- package/corpus/core/src/client/settings/VoiceTranscriptionSection.tsx +7 -18
- package/corpus/core/src/client/settings/index.ts +7 -0
- package/corpus/core/src/client/settings/useSettingsPanelController.ts +155 -0
- package/corpus/core/src/client/setup-connections/BuilderConnectCard.tsx +116 -51
- package/corpus/core/src/client/setup-connections/index.ts +10 -0
- package/corpus/core/src/client/setup-connections/useBuilderConnectCardController.ts +82 -0
- package/corpus/core/src/client/sharing/ShareButton.tsx +71 -592
- package/corpus/core/src/client/sharing/ShareDialog.tsx +299 -633
- package/corpus/core/src/client/sharing/index.ts +42 -0
- package/corpus/core/src/client/sharing/share-controller-helpers.ts +318 -0
- package/corpus/core/src/client/sharing/useShareButtonController.ts +600 -0
- package/corpus/core/src/client/sharing/useShareDialogController.ts +559 -0
- package/corpus/core/src/client/sse-event-processor.ts +23 -0
- package/corpus/core/src/client/tool-display.ts +71 -0
- package/corpus/core/src/client/use-agent-engine-configured.ts +12 -19
- package/corpus/core/src/client/use-chat-threads.ts +33 -12
- package/corpus/core/src/db/client.ts +13 -10
- package/corpus/core/src/extensions/actions.ts +13 -5
- package/corpus/core/src/extensions/local.ts +1 -0
- package/corpus/core/src/extensions/routes.ts +10 -5
- package/corpus/core/src/extensions/schema.ts +5 -0
- package/corpus/core/src/extensions/slots/store.ts +14 -4
- package/corpus/core/src/extensions/store.ts +55 -19
- package/corpus/core/src/extensions/theme.ts +1 -1
- package/corpus/core/src/file-upload/registry.ts +9 -0
- package/corpus/core/src/index.browser.ts +5 -0
- package/corpus/core/src/index.ts +1 -0
- package/corpus/core/src/localization/default-messages.ts +28 -6
- package/corpus/core/src/mcp-client/oauth-routes.ts +16 -2
- package/corpus/core/src/scripts/call-agent.ts +5 -1
- package/corpus/core/src/server/action-discovery.ts +8 -0
- package/corpus/core/src/server/better-auth-instance.ts +7 -2
- package/corpus/core/src/server/email-template.ts +18 -0
- package/corpus/core/src/server/email-templates.ts +3 -0
- package/corpus/core/src/server/email.ts +40 -4
- package/corpus/core/src/server/realtime-voice.ts +1 -1
- package/corpus/core/src/sharing/actions/share-resource.ts +1 -0
- package/corpus/core/src/styles/agent-native.css +0 -24
- package/corpus/core/src/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/corpus/core/src/templates/default/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/corpus/core/src/templates/default/.agents/skills/frontend-design/SKILL.md +22 -2
- package/corpus/core/src/templates/default/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/corpus/core/src/templates/default/app/components/ui/toolkit-provider.tsx +10 -0
- package/corpus/core/src/templates/default/app/design-system.ts +3 -0
- package/corpus/core/src/templates/default/app/global.css +1 -1
- package/corpus/core/src/templates/default/app/i18n/ar-SA.ts +6 -6
- package/corpus/core/src/templates/default/app/i18n/de-DE.ts +6 -6
- package/corpus/core/src/templates/default/app/i18n/en-US.ts +6 -6
- package/corpus/core/src/templates/default/app/i18n/es-ES.ts +6 -6
- package/corpus/core/src/templates/default/app/i18n/fr-FR.ts +6 -6
- package/corpus/core/src/templates/default/app/i18n/hi-IN.ts +6 -6
- package/corpus/core/src/templates/default/app/i18n/ja-JP.ts +6 -6
- package/corpus/core/src/templates/default/app/i18n/ko-KR.ts +6 -6
- package/corpus/core/src/templates/default/app/i18n/pt-BR.ts +6 -6
- package/corpus/core/src/templates/default/app/i18n/zh-CN.ts +7 -7
- package/corpus/core/src/templates/default/app/i18n/zh-TW.ts +7 -7
- package/corpus/core/src/templates/default/app/root.tsx +5 -2
- package/corpus/core/src/templates/default/package.json +1 -0
- package/corpus/core/src/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/corpus/core/src/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/corpus/core/src/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/corpus/core/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +22 -2
- package/corpus/core/src/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/corpus/core/src/user-profile/actions/get-user-profile.ts +16 -0
- package/corpus/core/src/user-profile/actions/update-user-profile.ts +24 -0
- package/corpus/core/src/user-profile/index.ts +5 -0
- package/corpus/core/src/user-profile/shared.ts +14 -0
- package/corpus/core/src/user-profile/store.ts +50 -0
- package/corpus/core/src/vite/client.ts +39 -0
- package/corpus/templates/analytics/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/corpus/templates/analytics/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/corpus/templates/analytics/.agents/skills/frontend-design/SKILL.md +22 -2
- package/corpus/templates/analytics/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/corpus/templates/analytics/app/components/ui/toolkit-provider.tsx +6 -1
- package/corpus/templates/analytics/app/design-system.ts +3 -0
- package/corpus/templates/assets/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/corpus/templates/assets/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/corpus/templates/assets/.agents/skills/frontend-design/SKILL.md +22 -2
- package/corpus/templates/assets/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/corpus/templates/assets/app/components/layout/Sidebar.tsx +2 -2
- package/corpus/templates/assets/app/components/ui/alert.tsx +1 -0
- package/corpus/templates/assets/app/components/ui/toolkit-provider.tsx +6 -1
- package/corpus/templates/assets/app/design-system.ts +3 -0
- package/corpus/templates/assets/app/global.css +1 -1
- package/corpus/templates/assets/app/routes/brand-kits.$id_.presets.$presetId.tsx +26 -30
- package/corpus/templates/assets/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
- package/corpus/templates/brain/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/corpus/templates/brain/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/corpus/templates/brain/.agents/skills/frontend-design/SKILL.md +22 -2
- package/corpus/templates/brain/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/corpus/templates/brain/app/components/ui/dialog.tsx +1 -0
- package/corpus/templates/brain/app/components/ui/toolkit-provider.tsx +6 -1
- package/corpus/templates/brain/app/design-system.ts +3 -0
- package/corpus/templates/brain/app/global.css +2 -2
- package/corpus/templates/brain/app/lib/brain.ts +2 -2
- package/corpus/templates/brain/app/root.tsx +2 -2
- package/corpus/templates/brain/app/routes/sources.tsx +8 -8
- package/corpus/templates/brain/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
- package/corpus/templates/calendar/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/corpus/templates/calendar/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/corpus/templates/calendar/.agents/skills/frontend-design/SKILL.md +22 -2
- package/corpus/templates/calendar/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +6 -2
- package/corpus/templates/calendar/app/components/ui/toolkit-provider.tsx +6 -1
- package/corpus/templates/calendar/app/design-system.ts +3 -0
- package/corpus/templates/calendar/app/global.css +1 -1
- package/corpus/templates/calendar/app/root.tsx +2 -2
- package/corpus/templates/calendar/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
- package/corpus/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/corpus/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/corpus/templates/chat/.agents/skills/frontend-design/SKILL.md +22 -2
- package/corpus/templates/chat/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/corpus/templates/chat/app/components/layout/Sidebar.tsx +2 -2
- package/corpus/templates/chat/app/components/ui/toolkit-provider.tsx +6 -1
- package/corpus/templates/chat/app/design-system.ts +3 -0
- package/corpus/templates/chat/app/global.css +1 -1
- package/corpus/templates/chat/app/root.tsx +2 -2
- package/corpus/templates/chat/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
- package/corpus/templates/clips/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/corpus/templates/clips/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/corpus/templates/clips/.agents/skills/frontend-design/SKILL.md +22 -2
- package/corpus/templates/clips/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/corpus/templates/clips/actions/export-to-brain.ts +1 -1
- package/corpus/templates/clips/actions/invite-member.ts +1 -0
- package/corpus/templates/clips/app/components/library/library-layout.tsx +2 -2
- package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +20 -11
- package/corpus/templates/clips/app/components/ui/toolkit-provider.tsx +6 -1
- package/corpus/templates/clips/app/design-system.ts +3 -0
- package/corpus/templates/clips/app/global.css +1 -1
- package/corpus/templates/clips/app/root.tsx +7 -2
- package/corpus/templates/clips/app/routes/_app.library._index.tsx +1 -1
- package/corpus/templates/clips/app/routes/record.tsx +2 -88
- package/corpus/templates/clips/changelog/2026-07-22-builder-connected-recordings-start-resumable-upload-sessions.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-22-clip-thumbnails-now-come-from-the-recording-instead-of-the-p.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-22-clips-emails-now-render-the-agent-native-logo-in-gmail-and-o.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-22-dismissed-zoom-and-teams-meeting-note-prompts-now-stay-dismi.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-22-fixed-windows-recordings-aborting-during-the-countdown.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-22-permissions-and-rewind-controls-are-now-grouped-with-clearer.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-22-quieter-permissions-and-rewind-controls.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-22-the-desktop-popover-opens-centered-under-the-menu-bar-icon-o.md +6 -0
- package/corpus/templates/clips/desktop/src/app.tsx +100 -62
- package/corpus/templates/clips/desktop/src/lib/meeting-notification-dismissal.ts +31 -0
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +4 -167
- package/corpus/templates/clips/desktop/src/overlays/meeting-notification.tsx +10 -1
- package/corpus/templates/clips/desktop/src/styles.css +111 -36
- package/corpus/templates/clips/desktop/src-tauri/src/adhoc_meetings_watcher.rs +67 -4
- package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +11 -2
- package/corpus/templates/clips/desktop/src-tauri/src/meetings_watcher.rs +51 -0
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen/custom_capture.rs +5 -1
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +0 -189
- package/corpus/templates/clips/desktop/src-tauri/src/notifications.rs +62 -0
- package/corpus/templates/clips/desktop/src-tauri/src/shortcuts.rs +37 -2
- package/corpus/templates/clips/desktop/src-tauri/src/tray.rs +18 -0
- package/corpus/templates/clips/server/plugins/db.ts +6 -2
- package/corpus/templates/content/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/corpus/templates/content/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/corpus/templates/content/.agents/skills/frontend-design/SKILL.md +22 -2
- package/corpus/templates/content/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/corpus/templates/content/app/components/editor/DocumentToolbar.tsx +41 -59
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +41 -41
- package/corpus/templates/content/app/components/editor/database/GalleryView.tsx +2 -1
- package/corpus/templates/content/app/components/editor/database/ListView.tsx +2 -1
- package/corpus/templates/content/app/components/editor/database/TimelineView.tsx +9 -9
- package/corpus/templates/content/app/components/editor/database/sidebar.tsx +7 -7
- package/corpus/templates/content/app/components/editor/database-sources/BuilderSourceReviewDialog.tsx +11 -11
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +3 -3
- package/corpus/templates/content/app/components/ui/checkbox.tsx +1 -0
- package/corpus/templates/content/app/components/ui/collapsible.tsx +1 -0
- package/corpus/templates/content/app/components/ui/toolkit-provider.tsx +6 -1
- package/corpus/templates/content/app/design-system.ts +3 -0
- package/corpus/templates/content/app/global.css +30 -4
- package/corpus/templates/content/app/root.tsx +2 -2
- package/corpus/templates/content/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
- package/corpus/templates/content/changelog/2026-07-22-page-actions-are-grouped-into-the-three-dots-menu-for-a-clea.md +6 -0
- package/corpus/templates/crm/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/corpus/templates/crm/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/corpus/templates/crm/app/components/crm/CreateCrmRecordDialog.tsx +10 -10
- package/corpus/templates/crm/app/components/crm/CrmDashboardPanel.tsx +1 -6
- package/corpus/templates/crm/app/components/crm/CrmSignalsPanel.tsx +3 -2
- package/corpus/templates/crm/app/components/crm/IntelligenceSettings.tsx +13 -12
- package/corpus/templates/crm/app/components/crm/RecordActions.tsx +17 -17
- package/corpus/templates/crm/app/components/crm/RecordGrid.tsx +8 -8
- package/corpus/templates/crm/app/components/crm/RecordWorkspace.tsx +3 -8
- package/corpus/templates/crm/app/components/crm/SavedViewDataProgram.tsx +2 -1
- package/corpus/templates/crm/app/components/crm/Surface.tsx +3 -2
- package/corpus/templates/crm/app/components/crm/WorkOverview.tsx +2 -2
- package/corpus/templates/crm/app/components/layout/CrmLayout.tsx +7 -7
- package/corpus/templates/crm/app/components/layout/CrmSidebar.tsx +1 -1
- package/corpus/templates/crm/app/components/ui/alert-dialog.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/badge.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/button.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/card.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/dialog.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/input.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/label.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/select.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/sheet.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/skeleton.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/switch.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/table.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/tabs.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/textarea.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/toolkit-provider.tsx +17 -0
- package/corpus/templates/crm/app/design-system.ts +3 -0
- package/corpus/templates/crm/app/global.css +1 -1
- package/corpus/templates/crm/app/root.tsx +9 -6
- package/corpus/templates/crm/app/routes/dashboard.tsx +1 -1
- package/corpus/templates/crm/app/routes/proposals.tsx +13 -13
- package/corpus/templates/crm/app/routes/setup.tsx +9 -9
- package/corpus/templates/crm/app/routes/tasks.tsx +14 -14
- package/corpus/templates/crm/app/routes/views.tsx +16 -16
- package/corpus/templates/design/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/corpus/templates/design/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/corpus/templates/design/.agents/skills/frontend-design/SKILL.md +22 -2
- package/corpus/templates/design/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +19 -1
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +12 -1
- package/corpus/templates/design/app/components/design/EditPanel.tsx +177 -52
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +179 -59
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +74 -27
- package/corpus/templates/design/app/components/design/multi-screen/types.ts +2 -0
- package/corpus/templates/design/app/components/editor/PromptDialog.tsx +8 -8
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +2 -2
- package/corpus/templates/design/app/components/ui/command.tsx +1 -0
- package/corpus/templates/design/app/components/ui/toolkit-provider.tsx +6 -1
- package/corpus/templates/design/app/design-system.ts +3 -0
- package/corpus/templates/design/app/global.css +1 -1
- package/corpus/templates/design/app/hooks/use-navigation-state.ts +6 -5
- package/corpus/templates/design/app/root.tsx +2 -2
- package/corpus/templates/design/changelog/2026-07-22-design-owners-can-keep-editing-their-designs-after-switching.md +6 -0
- package/corpus/templates/design/changelog/2026-07-22-inspector-tabs-keep-their-text-labels-at-narrow-widths.md +6 -0
- package/corpus/templates/design/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
- package/corpus/templates/design/changelog/2026-07-22-narrow-breakpoint-previews-keep-their-device-labels-readable.md +6 -0
- package/corpus/templates/design/changelog/2026-07-22-removed-the-draft-status-chip-from-the-design-editor.md +6 -0
- package/corpus/templates/design/changelog/2026-07-22-responsive-breakpoint-controls-stay-within-narrow-sidebars.md +6 -0
- package/corpus/templates/design/changelog/2026-07-22-responsive-peers-now-use-a-softer-selection-highlight-withou.md +6 -0
- package/corpus/templates/design/changelog/2026-07-22-rotate-from-context-menu.md +6 -0
- package/corpus/templates/design/changelog/2026-07-22-the-selection-outline-now-stays-attached-while-moving-screen.md +6 -0
- package/corpus/templates/design/changelog/2026-07-22-view-only-designs-now-support-figma-style-layer-inspection-w.md +6 -0
- package/corpus/templates/design/server/db/index.ts +4 -0
- package/corpus/templates/dispatch/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/corpus/templates/dispatch/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/corpus/templates/dispatch/.agents/skills/frontend-design/SKILL.md +22 -2
- package/corpus/templates/dispatch/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/corpus/templates/dispatch/app/components/ui/button.tsx +1 -0
- package/corpus/templates/dispatch/app/components/ui/toolkit-provider.tsx +17 -0
- package/corpus/templates/dispatch/app/design-system.ts +3 -0
- package/corpus/templates/dispatch/app/dispatch-extensions.tsx +2 -2
- package/corpus/templates/dispatch/app/global.css +1 -1
- package/corpus/templates/dispatch/app/root.tsx +12 -9
- package/corpus/templates/dispatch/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
- package/corpus/templates/dispatch/package.json +1 -0
- package/corpus/templates/forms/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/corpus/templates/forms/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/corpus/templates/forms/.agents/skills/frontend-design/SKILL.md +22 -2
- package/corpus/templates/forms/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/corpus/templates/forms/app/components/layout/Layout.tsx +1 -1
- package/corpus/templates/forms/app/components/layout/Sidebar.tsx +3 -3
- package/corpus/templates/forms/app/components/ui/toolkit-provider.tsx +6 -1
- package/corpus/templates/forms/app/design-system.ts +3 -0
- package/corpus/templates/forms/app/global.css +1 -1
- package/corpus/templates/forms/app/hooks/use-forms.ts +55 -2
- package/corpus/templates/forms/app/i18n/en-US.ts +2 -0
- package/corpus/templates/forms/app/pages/FormBuilderPage.tsx +3 -3
- package/corpus/templates/forms/app/pages/FormsListPage.tsx +23 -6
- package/corpus/templates/forms/app/root.tsx +2 -2
- package/corpus/templates/forms/changelog/2026-07-22-forms-now-archive-with-optimistic-feedback.md +6 -0
- package/corpus/templates/forms/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
- package/corpus/templates/forms/server/plugins/agent-chat.ts +1 -1
- package/corpus/templates/macros/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/corpus/templates/macros/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/corpus/templates/macros/.agents/skills/frontend-design/SKILL.md +22 -2
- package/corpus/templates/macros/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/corpus/templates/macros/app/components/layout/AppLayout.tsx +2 -2
- package/corpus/templates/macros/app/components/ui/toolkit-provider.tsx +6 -1
- package/corpus/templates/macros/app/design-system.ts +3 -0
- package/corpus/templates/macros/app/root.tsx +2 -2
- package/corpus/templates/macros/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
- package/corpus/templates/mail/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/corpus/templates/mail/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/corpus/templates/mail/.agents/skills/frontend-design/SKILL.md +22 -2
- package/corpus/templates/mail/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/corpus/templates/mail/app/components/email/EmailThread.tsx +134 -93
- package/corpus/templates/mail/app/components/email/email-iframe-document.ts +8 -2
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +3 -3
- package/corpus/templates/mail/app/components/layout/CommandPalette.tsx +2 -2
- package/corpus/templates/mail/app/components/ui/textarea.tsx +1 -21
- package/corpus/templates/mail/app/components/ui/toolkit-provider.tsx +6 -1
- package/corpus/templates/mail/app/design-system.ts +3 -0
- package/corpus/templates/mail/app/global.css +1 -1
- package/corpus/templates/mail/changelog/2026-07-22-email-messages-no-longer-flash-with-an-unstyled-page-while-l.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
- package/corpus/templates/plan/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/corpus/templates/plan/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/corpus/templates/plan/.agents/skills/frontend-design/SKILL.md +22 -2
- package/corpus/templates/plan/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +2 -2
- package/corpus/templates/plan/app/components/plan/PlanContentRenderer.tsx +1 -1
- package/corpus/templates/plan/app/components/ui/toolkit-provider.tsx +6 -1
- package/corpus/templates/plan/app/design-system.ts +3 -0
- package/corpus/templates/plan/app/global.css +1 -1
- package/corpus/templates/plan/app/root.tsx +2 -2
- package/corpus/templates/plan/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
- package/corpus/templates/slides/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/corpus/templates/slides/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/corpus/templates/slides/.agents/skills/frontend-design/SKILL.md +22 -2
- package/corpus/templates/slides/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/corpus/templates/slides/app/components/layout/Sidebar.tsx +2 -2
- package/corpus/templates/slides/app/components/ui/toolkit-provider.tsx +6 -1
- package/corpus/templates/slides/app/design-system.ts +3 -0
- package/corpus/templates/slides/app/root.tsx +2 -2
- package/corpus/templates/slides/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-22-slides-no-longer-fail-intermittently-on-fresh-server-instances.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-22-uploaded-screenshots-can-now-be-analyzed-and-recreated-as-ed.md +6 -0
- package/corpus/templates/slides/server/lib/chat-attachments.ts +7 -3
- package/corpus/templates/slides/server/plugins/db.ts +44 -17
- package/corpus/templates/tasks/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/corpus/templates/tasks/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/corpus/templates/tasks/.agents/skills/frontend-design/SKILL.md +22 -2
- package/corpus/templates/tasks/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/corpus/templates/tasks/app/components/ui/toolkit-provider.tsx +17 -0
- package/corpus/templates/tasks/app/design-system.ts +3 -0
- package/corpus/templates/tasks/app/global.css +1 -1
- package/corpus/templates/tasks/app/root.tsx +5 -2
- package/corpus/toolkit/CHANGELOG.md +14 -0
- package/corpus/toolkit/agent-native.eject.json +71 -0
- package/corpus/toolkit/package.json +31 -1
- package/corpus/toolkit/src/chat-history/ChatHistoryRail.tsx +100 -39
- package/corpus/toolkit/src/chat-history/index.ts +9 -0
- package/corpus/toolkit/src/chat-history/useChatHistoryRailController.ts +76 -0
- package/corpus/toolkit/src/chat-history.css +2 -0
- package/corpus/toolkit/src/composer/ComposerPlusMenu.tsx +11 -8
- package/corpus/toolkit/src/composer/PromptComposer.tsx +27 -6
- package/corpus/toolkit/src/composer/useRealtimeVoiceMode.tsx +107 -22
- package/corpus/toolkit/src/conformance/__fixtures__/css-in-js-adapter.tsx +401 -0
- package/corpus/toolkit/src/conformance/index.ts +3 -0
- package/corpus/toolkit/src/conformance/runner.tsx +710 -0
- package/corpus/toolkit/src/conformance/types.ts +45 -0
- package/corpus/toolkit/src/conformance/version.ts +22 -0
- package/corpus/toolkit/src/design-system/components.tsx +146 -0
- package/corpus/toolkit/src/design-system/context.tsx +31 -0
- package/corpus/toolkit/src/design-system/default-adapter.tsx +915 -0
- package/corpus/toolkit/src/design-system/definition.ts +14 -0
- package/corpus/toolkit/src/design-system/error-boundary.tsx +37 -0
- package/corpus/toolkit/src/design-system/index.ts +7 -0
- package/corpus/toolkit/src/design-system/theme.ts +145 -0
- package/corpus/toolkit/src/design-system/types.ts +363 -0
- package/corpus/toolkit/src/provider.tsx +98 -5
- package/corpus/toolkit/src/ui/button.tsx +95 -6
- package/corpus/toolkit/src/ui/dialog.tsx +48 -23
- package/corpus/toolkit/src/ui/popover.tsx +16 -2
- package/corpus/toolkit/src/ui/select.tsx +7 -3
- package/corpus/toolkit/src/ui/sidebar.tsx +47 -48
- package/corpus/toolkit/src/ui/tooltip.tsx +7 -3
- package/dist/a2a/types.d.ts +1 -1
- package/dist/a2a/types.d.ts.map +1 -1
- package/dist/a2a/types.js.map +1 -1
- package/dist/agent/types.d.ts +1 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/cli/context-xray-local.js +1 -1
- package/dist/cli/context-xray-local.js.map +1 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +14 -14
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +26 -15
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/CommandMenu.d.ts.map +1 -1
- package/dist/client/CommandMenu.js +18 -106
- package/dist/client/CommandMenu.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +2 -1
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/app-providers.d.ts.map +1 -1
- package/dist/client/app-providers.js +1 -1
- package/dist/client/app-providers.js.map +1 -1
- package/dist/client/chat/message-components.d.ts +9 -1
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +62 -7
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/chat/tool-call-display.d.ts.map +1 -1
- package/dist/client/chat/tool-call-display.js +20 -5
- package/dist/client/chat/tool-call-display.js.map +1 -1
- package/dist/client/chat/widgets/InlineExtensionWidget.d.ts.map +1 -1
- package/dist/client/chat/widgets/InlineExtensionWidget.js +9 -12
- package/dist/client/chat/widgets/InlineExtensionWidget.js.map +1 -1
- package/dist/client/components/ui/message-scroller.d.ts +1 -1
- package/dist/client/components/ui/message-scroller.d.ts.map +1 -1
- package/dist/client/components/ui/message-scroller.js +4 -3
- package/dist/client/components/ui/message-scroller.js.map +1 -1
- package/dist/client/extensions/ExtensionViewer.js +2 -2
- package/dist/client/extensions/ExtensionViewer.js.map +1 -1
- package/dist/client/extensions/ExtensionsSidebarSection.js +11 -11
- package/dist/client/extensions/ExtensionsSidebarSection.js.map +1 -1
- package/dist/client/extensions/agent-native-extension-runtime.js +1 -1
- package/dist/client/extensions/agent-native-extension-runtime.js.map +1 -1
- package/dist/client/extensions/delete-extension.d.ts +1 -1
- package/dist/client/extensions/delete-extension.d.ts.map +1 -1
- package/dist/client/extensions/delete-extension.js +1 -1
- package/dist/client/extensions/delete-extension.js.map +1 -1
- package/dist/client/i18n.d.ts.map +1 -1
- package/dist/client/i18n.js +9 -0
- package/dist/client/i18n.js.map +1 -1
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -2
- package/dist/client/index.js.map +1 -1
- package/dist/client/org/OrgSwitcher.d.ts +3 -1
- package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
- package/dist/client/org/OrgSwitcher.js +12 -4
- package/dist/client/org/OrgSwitcher.js.map +1 -1
- package/dist/client/org/TeamPage.d.ts.map +1 -1
- package/dist/client/org/TeamPage.js +41 -33
- package/dist/client/org/TeamPage.js.map +1 -1
- package/dist/client/progress/RunsTray.d.ts.map +1 -1
- package/dist/client/progress/RunsTray.js +9 -10
- package/dist/client/progress/RunsTray.js.map +1 -1
- package/dist/client/resources/McpConnectionSuggestion.d.ts.map +1 -1
- package/dist/client/resources/McpConnectionSuggestion.js +5 -4
- package/dist/client/resources/McpConnectionSuggestion.js.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.d.ts.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.js +10 -8
- package/dist/client/resources/McpIntegrationDialog.js.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.d.ts +1 -0
- package/dist/client/resources/mcp-integration-catalog.d.ts.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.js +13 -0
- package/dist/client/resources/mcp-integration-catalog.js.map +1 -1
- package/dist/client/settings/DemoModeSection.d.ts.map +1 -1
- package/dist/client/settings/DemoModeSection.js +2 -5
- package/dist/client/settings/DemoModeSection.js.map +1 -1
- package/dist/client/settings/SecretsSection.d.ts.map +1 -1
- package/dist/client/settings/SecretsSection.js +18 -6
- package/dist/client/settings/SecretsSection.js.map +1 -1
- package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
- package/dist/client/settings/SettingsPanel.js +87 -119
- package/dist/client/settings/SettingsPanel.js.map +1 -1
- package/dist/client/settings/SettingsTabsPage.d.ts.map +1 -1
- package/dist/client/settings/SettingsTabsPage.js +16 -1
- package/dist/client/settings/SettingsTabsPage.js.map +1 -1
- package/dist/client/settings/VoiceTranscriptionSection.d.ts.map +1 -1
- package/dist/client/settings/VoiceTranscriptionSection.js +2 -5
- package/dist/client/settings/VoiceTranscriptionSection.js.map +1 -1
- package/dist/client/settings/index.d.ts +1 -0
- package/dist/client/settings/index.d.ts.map +1 -1
- package/dist/client/settings/index.js +1 -0
- package/dist/client/settings/index.js.map +1 -1
- package/dist/client/settings/useSettingsPanelController.d.ts +22 -0
- package/dist/client/settings/useSettingsPanelController.d.ts.map +1 -0
- package/dist/client/settings/useSettingsPanelController.js +103 -0
- package/dist/client/settings/useSettingsPanelController.js.map +1 -0
- package/dist/client/setup-connections/BuilderConnectCard.d.ts +14 -6
- package/dist/client/setup-connections/BuilderConnectCard.d.ts.map +1 -1
- package/dist/client/setup-connections/BuilderConnectCard.js +24 -16
- package/dist/client/setup-connections/BuilderConnectCard.js.map +1 -1
- package/dist/client/setup-connections/index.d.ts +2 -1
- package/dist/client/setup-connections/index.d.ts.map +1 -1
- package/dist/client/setup-connections/index.js +2 -1
- package/dist/client/setup-connections/index.js.map +1 -1
- package/dist/client/setup-connections/useBuilderConnectCardController.d.ts +34 -0
- package/dist/client/setup-connections/useBuilderConnectCardController.d.ts.map +1 -0
- package/dist/client/setup-connections/useBuilderConnectCardController.js +39 -0
- package/dist/client/setup-connections/useBuilderConnectCardController.js.map +1 -0
- package/dist/client/sharing/ShareButton.d.ts +5 -5
- package/dist/client/sharing/ShareButton.d.ts.map +1 -1
- package/dist/client/sharing/ShareButton.js +19 -464
- package/dist/client/sharing/ShareButton.js.map +1 -1
- package/dist/client/sharing/ShareDialog.d.ts +6 -6
- package/dist/client/sharing/ShareDialog.d.ts.map +1 -1
- package/dist/client/sharing/ShareDialog.js +69 -283
- package/dist/client/sharing/ShareDialog.js.map +1 -1
- package/dist/client/sharing/index.d.ts +3 -0
- package/dist/client/sharing/index.d.ts.map +1 -1
- package/dist/client/sharing/index.js +3 -0
- package/dist/client/sharing/index.js.map +1 -1
- package/dist/client/sharing/share-controller-helpers.d.ts +70 -0
- package/dist/client/sharing/share-controller-helpers.d.ts.map +1 -0
- package/dist/client/sharing/share-controller-helpers.js +224 -0
- package/dist/client/sharing/share-controller-helpers.js.map +1 -0
- package/dist/client/sharing/useShareButtonController.d.ts +91 -0
- package/dist/client/sharing/useShareButtonController.d.ts.map +1 -0
- package/dist/client/sharing/useShareButtonController.js +397 -0
- package/dist/client/sharing/useShareButtonController.js.map +1 -0
- package/dist/client/sharing/useShareDialogController.d.ts +109 -0
- package/dist/client/sharing/useShareDialogController.d.ts.map +1 -0
- package/dist/client/sharing/useShareDialogController.js +348 -0
- package/dist/client/sharing/useShareDialogController.js.map +1 -0
- package/dist/client/sse-event-processor.d.ts.map +1 -1
- package/dist/client/sse-event-processor.js +21 -0
- package/dist/client/sse-event-processor.js.map +1 -1
- package/dist/client/tool-display.d.ts +16 -0
- package/dist/client/tool-display.d.ts.map +1 -1
- package/dist/client/tool-display.js +52 -0
- package/dist/client/tool-display.js.map +1 -1
- package/dist/client/use-agent-engine-configured.d.ts +3 -2
- package/dist/client/use-agent-engine-configured.d.ts.map +1 -1
- package/dist/client/use-agent-engine-configured.js +7 -19
- package/dist/client/use-agent-engine-configured.js.map +1 -1
- package/dist/client/use-chat-threads.d.ts.map +1 -1
- package/dist/client/use-chat-threads.js +21 -8
- package/dist/client/use-chat-threads.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/db/client.d.ts +7 -7
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +13 -10
- package/dist/db/client.js.map +1 -1
- package/dist/extensions/actions.d.ts.map +1 -1
- package/dist/extensions/actions.js +8 -5
- package/dist/extensions/actions.js.map +1 -1
- package/dist/extensions/local.d.ts.map +1 -1
- package/dist/extensions/local.js +1 -0
- package/dist/extensions/local.js.map +1 -1
- package/dist/extensions/routes.d.ts.map +1 -1
- package/dist/extensions/routes.js +9 -4
- package/dist/extensions/routes.js.map +1 -1
- package/dist/extensions/schema.d.ts +23 -2
- package/dist/extensions/schema.d.ts.map +1 -1
- package/dist/extensions/schema.js +5 -0
- package/dist/extensions/schema.js.map +1 -1
- package/dist/extensions/slots/store.d.ts +1 -1
- package/dist/extensions/slots/store.d.ts.map +1 -1
- package/dist/extensions/slots/store.js +4 -4
- package/dist/extensions/slots/store.js.map +1 -1
- package/dist/extensions/store.d.ts +1 -0
- package/dist/extensions/store.d.ts.map +1 -1
- package/dist/extensions/store.js +38 -21
- package/dist/extensions/store.js.map +1 -1
- package/dist/extensions/theme.js +1 -1
- package/dist/extensions/theme.js.map +1 -1
- package/dist/file-upload/registry.d.ts.map +1 -1
- package/dist/file-upload/registry.js +9 -0
- package/dist/file-upload/registry.js.map +1 -1
- package/dist/index.browser.d.ts +1 -0
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +1 -0
- package/dist/index.browser.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/localization/default-messages.d.ts +20 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +26 -6
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/mcp-client/oauth-routes.d.ts +2 -0
- package/dist/mcp-client/oauth-routes.d.ts.map +1 -1
- package/dist/mcp-client/oauth-routes.js +12 -2
- package/dist/mcp-client/oauth-routes.js.map +1 -1
- package/dist/observability/routes.d.ts +3 -3
- package/dist/provider-api/actions/custom-provider-registration.d.ts +3 -3
- package/dist/provider-api/actions/provider-api.d.ts +11 -11
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/scripts/call-agent.d.ts.map +1 -1
- package/dist/scripts/call-agent.js +5 -1
- package/dist/scripts/call-agent.js.map +1 -1
- package/dist/secrets/routes.d.ts +6 -6
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +8 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/better-auth-instance.d.ts +7 -2
- package/dist/server/better-auth-instance.d.ts.map +1 -1
- package/dist/server/better-auth-instance.js.map +1 -1
- package/dist/server/email-template.d.ts +3 -0
- package/dist/server/email-template.d.ts.map +1 -1
- package/dist/server/email-template.js +13 -0
- package/dist/server/email-template.js.map +1 -1
- package/dist/server/email-templates.d.ts.map +1 -1
- package/dist/server/email-templates.js +3 -0
- package/dist/server/email-templates.js.map +1 -1
- package/dist/server/email.d.ts.map +1 -1
- package/dist/server/email.js +27 -4
- package/dist/server/email.js.map +1 -1
- package/dist/server/realtime-voice.js +1 -1
- package/dist/server/realtime-voice.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/sharing/actions/share-resource.js +1 -0
- package/dist/sharing/actions/share-resource.js.map +1 -1
- package/dist/styles/agent-native.css +0 -24
- package/dist/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/dist/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/dist/templates/chat/.agents/skills/frontend-design/SKILL.md +22 -2
- package/dist/templates/chat/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/dist/templates/chat/app/components/layout/Sidebar.tsx +2 -2
- package/dist/templates/chat/app/components/ui/toolkit-provider.tsx +6 -1
- package/dist/templates/chat/app/design-system.ts +3 -0
- package/dist/templates/chat/app/global.css +1 -1
- package/dist/templates/chat/app/root.tsx +2 -2
- package/dist/templates/chat/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
- package/dist/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/dist/templates/default/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/dist/templates/default/.agents/skills/frontend-design/SKILL.md +22 -2
- package/dist/templates/default/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/dist/templates/default/app/components/ui/toolkit-provider.tsx +10 -0
- package/dist/templates/default/app/design-system.ts +3 -0
- package/dist/templates/default/app/global.css +1 -1
- package/dist/templates/default/app/i18n/ar-SA.ts +6 -6
- package/dist/templates/default/app/i18n/de-DE.ts +6 -6
- package/dist/templates/default/app/i18n/en-US.ts +6 -6
- package/dist/templates/default/app/i18n/es-ES.ts +6 -6
- package/dist/templates/default/app/i18n/fr-FR.ts +6 -6
- package/dist/templates/default/app/i18n/hi-IN.ts +6 -6
- package/dist/templates/default/app/i18n/ja-JP.ts +6 -6
- package/dist/templates/default/app/i18n/ko-KR.ts +6 -6
- package/dist/templates/default/app/i18n/pt-BR.ts +6 -6
- package/dist/templates/default/app/i18n/zh-CN.ts +7 -7
- package/dist/templates/default/app/i18n/zh-TW.ts +7 -7
- package/dist/templates/default/app/root.tsx +5 -2
- package/dist/templates/default/package.json +1 -0
- package/dist/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/dist/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/dist/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +22 -2
- package/dist/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/dist/user-profile/actions/get-user-profile.d.ts +4 -0
- package/dist/user-profile/actions/get-user-profile.d.ts.map +1 -0
- package/dist/user-profile/actions/get-user-profile.js +14 -0
- package/dist/user-profile/actions/get-user-profile.js.map +1 -0
- package/dist/user-profile/actions/update-user-profile.d.ts +6 -0
- package/dist/user-profile/actions/update-user-profile.d.ts.map +1 -0
- package/dist/user-profile/actions/update-user-profile.js +20 -0
- package/dist/user-profile/actions/update-user-profile.js.map +1 -0
- package/dist/user-profile/index.d.ts +2 -0
- package/dist/user-profile/index.d.ts.map +1 -0
- package/dist/user-profile/index.js +2 -0
- package/dist/user-profile/index.js.map +1 -0
- package/dist/user-profile/shared.d.ts +7 -0
- package/dist/user-profile/shared.d.ts.map +1 -0
- package/dist/user-profile/shared.js +6 -0
- package/dist/user-profile/shared.js.map +1 -0
- package/dist/user-profile/store.d.ts +4 -0
- package/dist/user-profile/store.d.ts.map +1 -0
- package/dist/user-profile/store.js +38 -0
- package/dist/user-profile/store.js.map +1 -0
- package/dist/vite/client.d.ts +3 -0
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +31 -0
- package/dist/vite/client.js.map +1 -1
- package/docs/content/custom-design-system.mdx +445 -0
- package/docs/content/toolkit-ui.mdx +16 -0
- package/package.json +3 -2
- package/src/a2a/types.ts +1 -0
- package/src/agent/types.ts +1 -1
- package/src/cli/context-xray-local.ts +1 -1
- package/src/client/AgentPanel.tsx +90 -107
- package/src/client/AssistantChat.tsx +30 -13
- package/src/client/CommandMenu.tsx +68 -178
- package/src/client/agent-chat-adapter.ts +3 -1
- package/src/client/app-providers.tsx +1 -1
- package/src/client/chat/message-components.tsx +116 -10
- package/src/client/chat/tool-call-display.tsx +26 -5
- package/src/client/chat/widgets/InlineExtensionWidget.tsx +14 -40
- package/src/client/components/ui/message-scroller.tsx +15 -1
- package/src/client/extensions/ExtensionViewer.tsx +4 -4
- package/src/client/extensions/ExtensionsSidebarSection.tsx +11 -11
- package/src/client/extensions/agent-native-extension-runtime.ts +1 -1
- package/src/client/extensions/delete-extension.ts +2 -2
- package/src/client/i18n.tsx +22 -0
- package/src/client/index.ts +17 -0
- package/src/client/org/OrgSwitcher.tsx +25 -1
- package/src/client/org/TeamPage.tsx +257 -153
- package/src/client/progress/RunsTray.tsx +89 -88
- package/src/client/resources/McpConnectionSuggestion.tsx +5 -2
- package/src/client/resources/McpIntegrationDialog.tsx +34 -13
- package/src/client/resources/mcp-integration-catalog.ts +13 -0
- package/src/client/settings/DemoModeSection.tsx +6 -18
- package/src/client/settings/SecretsSection.tsx +97 -52
- package/src/client/settings/SettingsPanel.tsx +302 -254
- package/src/client/settings/SettingsTabsPage.tsx +23 -2
- package/src/client/settings/VoiceTranscriptionSection.tsx +7 -18
- package/src/client/settings/index.ts +7 -0
- package/src/client/settings/useSettingsPanelController.ts +155 -0
- package/src/client/setup-connections/BuilderConnectCard.tsx +116 -51
- package/src/client/setup-connections/index.ts +10 -0
- package/src/client/setup-connections/useBuilderConnectCardController.ts +82 -0
- package/src/client/sharing/ShareButton.tsx +71 -592
- package/src/client/sharing/ShareDialog.tsx +299 -633
- package/src/client/sharing/index.ts +42 -0
- package/src/client/sharing/share-controller-helpers.ts +318 -0
- package/src/client/sharing/useShareButtonController.ts +600 -0
- package/src/client/sharing/useShareDialogController.ts +559 -0
- package/src/client/sse-event-processor.ts +23 -0
- package/src/client/tool-display.ts +71 -0
- package/src/client/use-agent-engine-configured.ts +12 -19
- package/src/client/use-chat-threads.ts +33 -12
- package/src/db/client.ts +13 -10
- package/src/extensions/actions.ts +13 -5
- package/src/extensions/local.ts +1 -0
- package/src/extensions/routes.ts +10 -5
- package/src/extensions/schema.ts +5 -0
- package/src/extensions/slots/store.ts +14 -4
- package/src/extensions/store.ts +55 -19
- package/src/extensions/theme.ts +1 -1
- package/src/file-upload/registry.ts +9 -0
- package/src/index.browser.ts +5 -0
- package/src/index.ts +1 -0
- package/src/localization/default-messages.ts +28 -6
- package/src/mcp-client/oauth-routes.ts +16 -2
- package/src/scripts/call-agent.ts +5 -1
- package/src/server/action-discovery.ts +8 -0
- package/src/server/better-auth-instance.ts +7 -2
- package/src/server/email-template.ts +18 -0
- package/src/server/email-templates.ts +3 -0
- package/src/server/email.ts +40 -4
- package/src/server/realtime-voice.ts +1 -1
- package/src/sharing/actions/share-resource.ts +1 -0
- package/src/styles/agent-native.css +0 -24
- package/src/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/src/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/src/templates/chat/.agents/skills/frontend-design/SKILL.md +22 -2
- package/src/templates/chat/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/src/templates/chat/app/components/layout/Sidebar.tsx +2 -2
- package/src/templates/chat/app/components/ui/toolkit-provider.tsx +6 -1
- package/src/templates/chat/app/design-system.ts +3 -0
- package/src/templates/chat/app/global.css +1 -1
- package/src/templates/chat/app/root.tsx +2 -2
- package/src/templates/chat/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
- package/src/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/src/templates/default/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/src/templates/default/.agents/skills/frontend-design/SKILL.md +22 -2
- package/src/templates/default/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/src/templates/default/app/components/ui/toolkit-provider.tsx +10 -0
- package/src/templates/default/app/design-system.ts +3 -0
- package/src/templates/default/app/global.css +1 -1
- package/src/templates/default/app/i18n/ar-SA.ts +6 -6
- package/src/templates/default/app/i18n/de-DE.ts +6 -6
- package/src/templates/default/app/i18n/en-US.ts +6 -6
- package/src/templates/default/app/i18n/es-ES.ts +6 -6
- package/src/templates/default/app/i18n/fr-FR.ts +6 -6
- package/src/templates/default/app/i18n/hi-IN.ts +6 -6
- package/src/templates/default/app/i18n/ja-JP.ts +6 -6
- package/src/templates/default/app/i18n/ko-KR.ts +6 -6
- package/src/templates/default/app/i18n/pt-BR.ts +6 -6
- package/src/templates/default/app/i18n/zh-CN.ts +7 -7
- package/src/templates/default/app/i18n/zh-TW.ts +7 -7
- package/src/templates/default/app/root.tsx +5 -2
- package/src/templates/default/package.json +1 -0
- package/src/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/src/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +43 -2
- package/src/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +86 -11
- package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +22 -2
- package/src/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +28 -4
- package/src/user-profile/actions/get-user-profile.ts +16 -0
- package/src/user-profile/actions/update-user-profile.ts +24 -0
- package/src/user-profile/index.ts +5 -0
- package/src/user-profile/shared.ts +14 -0
- package/src/user-profile/store.ts +50 -0
- package/src/vite/client.ts +39 -0
- package/corpus/templates/analytics/app/components/ui/calendar.tsx +0 -70
- package/corpus/templates/analytics/app/components/ui/chart.tsx +0 -386
- package/corpus/templates/calendar/app/components/ui/sonner.tsx +0 -58
- package/corpus/templates/forms/app/components/ui/calendar.tsx +0 -214
- package/corpus/templates/forms/app/components/ui/chart.tsx +0 -379
- package/corpus/templates/forms/app/components/ui/command.tsx +0 -153
- package/corpus/templates/forms/app/components/ui/context-menu.tsx +0 -198
- package/corpus/templates/forms/app/components/ui/menubar.tsx +0 -254
- package/corpus/templates/macros/app/components/ui/menubar.tsx +0 -238
- package/corpus/templates/macros/app/components/ui/progress.tsx +0 -26
- package/corpus/templates/mail/app/components/ui/calendar.tsx +0 -211
- package/corpus/templates/mail/app/components/ui/chart.tsx +0 -379
- package/corpus/templates/mail/app/components/ui/command.tsx +0 -153
- package/corpus/templates/mail/app/components/ui/context-menu.tsx +0 -198
- package/corpus/templates/mail/app/components/ui/menubar.tsx +0 -254
- package/corpus/templates/tasks/app/components/ui/accordion.tsx +0 -56
- package/corpus/templates/tasks/app/components/ui/aspect-ratio.tsx +0 -5
- package/corpus/templates/tasks/app/components/ui/breadcrumb.tsx +0 -115
- package/corpus/templates/tasks/app/components/ui/calendar.tsx +0 -70
- package/corpus/templates/tasks/app/components/ui/carousel.tsx +0 -260
- package/corpus/templates/tasks/app/components/ui/chart.tsx +0 -379
- package/corpus/templates/tasks/app/components/ui/form.tsx +0 -177
- package/corpus/templates/tasks/app/components/ui/hover-card.tsx +0 -27
- package/corpus/templates/tasks/app/components/ui/input-otp.tsx +0 -69
- package/corpus/templates/tasks/app/components/ui/menubar.tsx +0 -254
- package/corpus/templates/tasks/app/components/ui/navigation-menu.tsx +0 -128
- package/corpus/templates/tasks/app/components/ui/pagination.tsx +0 -121
- package/corpus/templates/tasks/app/components/ui/resizable.tsx +0 -43
- package/corpus/templates/tasks/app/components/ui/sidebar.tsx +0 -782
- package/corpus/templates/tasks/app/components/ui/toggle.tsx +0 -43
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
export declare function humanizeToolName(toolName: string | undefined): string;
|
|
2
2
|
export declare function runningToolLabel(toolName: string | undefined): string;
|
|
3
3
|
export declare function humanizeToolLabelText(label: string, toolName: string | undefined): string;
|
|
4
|
+
type ToolDisplayPart = {
|
|
5
|
+
type?: string;
|
|
6
|
+
toolCallId?: string;
|
|
7
|
+
toolName?: string;
|
|
8
|
+
argsText?: string;
|
|
9
|
+
args?: Record<string, unknown>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* `call-agent` emits both its ordinary tool row and a richer `agent:<name>`
|
|
13
|
+
* progress row. Keep the ordinary part in message state for tool completion
|
|
14
|
+
* and history, but let presentation code suppress it once the richer row is
|
|
15
|
+
* available.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isCallAgentToolCallShadowed(parts: readonly ToolDisplayPart[], index: number): boolean;
|
|
18
|
+
export declare function shadowedCallAgentToolCallIds(parts: readonly ToolDisplayPart[]): Set<string>;
|
|
19
|
+
export {};
|
|
4
20
|
//# sourceMappingURL=tool-display.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-display.d.ts","sourceRoot":"","sources":["../../src/client/tool-display.ts"],"names":[],"mappings":"AAMA,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAoBrE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAErE;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,MAAM,CAKR"}
|
|
1
|
+
{"version":3,"file":"tool-display.d.ts","sourceRoot":"","sources":["../../src/client/tool-display.ts"],"names":[],"mappings":"AAMA,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAoBrE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAErE;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,MAAM,CAKR;AAED,KAAK,eAAe,GAAG;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAqBF;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,SAAS,eAAe,EAAE,EACjC,KAAK,EAAE,MAAM,GACZ,OAAO,CAqBT;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,SAAS,eAAe,EAAE,GAChC,GAAG,CAAC,MAAM,CAAC,CAQb"}
|
|
@@ -33,4 +33,56 @@ export function humanizeToolLabelText(label, toolName) {
|
|
|
33
33
|
return text;
|
|
34
34
|
return text.split(tool).join(humanizeToolName(tool));
|
|
35
35
|
}
|
|
36
|
+
function normalizedAgentName(value) {
|
|
37
|
+
if (typeof value !== "string")
|
|
38
|
+
return null;
|
|
39
|
+
const name = value.trim().toLowerCase();
|
|
40
|
+
return name || null;
|
|
41
|
+
}
|
|
42
|
+
function callAgentTarget(part) {
|
|
43
|
+
const parsedTarget = normalizedAgentName(part.args?.agent);
|
|
44
|
+
if (parsedTarget)
|
|
45
|
+
return parsedTarget;
|
|
46
|
+
if (!part.argsText)
|
|
47
|
+
return null;
|
|
48
|
+
try {
|
|
49
|
+
const args = JSON.parse(part.argsText);
|
|
50
|
+
return normalizedAgentName(args.agent);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* `call-agent` emits both its ordinary tool row and a richer `agent:<name>`
|
|
58
|
+
* progress row. Keep the ordinary part in message state for tool completion
|
|
59
|
+
* and history, but let presentation code suppress it once the richer row is
|
|
60
|
+
* available.
|
|
61
|
+
*/
|
|
62
|
+
export function isCallAgentToolCallShadowed(parts, index) {
|
|
63
|
+
const part = parts[index];
|
|
64
|
+
if (part?.type !== "tool-call" || part.toolName !== "call-agent") {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
const agentRows = parts.filter((candidate) => {
|
|
68
|
+
if (candidate.type !== "tool-call" ||
|
|
69
|
+
!candidate.toolName?.startsWith("agent:")) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
return true;
|
|
73
|
+
});
|
|
74
|
+
const target = callAgentTarget(part);
|
|
75
|
+
if (!target)
|
|
76
|
+
return agentRows.length > 0;
|
|
77
|
+
return agentRows.some((candidate) => normalizedAgentName(candidate.toolName?.slice(6)) === target);
|
|
78
|
+
}
|
|
79
|
+
export function shadowedCallAgentToolCallIds(parts) {
|
|
80
|
+
const ids = new Set();
|
|
81
|
+
parts.forEach((part, index) => {
|
|
82
|
+
if (part.toolCallId && isCallAgentToolCallShadowed(parts, index)) {
|
|
83
|
+
ids.add(part.toolCallId);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
return ids;
|
|
87
|
+
}
|
|
36
88
|
//# sourceMappingURL=tool-display.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-display.js","sourceRoot":"","sources":["../../src/client/tool-display.ts"],"names":[],"mappings":"AAAA,MAAM,kBAAkB,GAA2B;IACjD,aAAa,EAAE,eAAe;IAC9B,qBAAqB,EAAE,qBAAqB;IAC5C,aAAa,EAAE,aAAa;CAC7B,CAAC;AAEF,MAAM,UAAU,gBAAgB,CAAC,QAA4B;IAC3D,MAAM,GAAG,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACpC,IAAI,CAAC,GAAG;QAAE,OAAO,MAAM,CAAC;IACxB,MAAM,WAAW,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC5C,IAAI,WAAW;QAAE,OAAO,WAAW,CAAC;IAEpC,IAAI,IAAI,GAAG,GAAG,CAAC;IACf,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC;IACzC,CAAC;IAED,IAAI,GAAG,IAAI;SACR,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;SAClB,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC;SACtC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;SACtB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,IAAI,EAAE,CAAC;IAEV,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,QAA4B;IAC3D,OAAO,WAAW,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,KAAa,EACb,QAA4B;IAE5B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC1B,MAAM,IAAI,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACrC,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;AACvD,CAAC","sourcesContent":["const TOOL_DISPLAY_NAMES: Record<string, string> = {\n \"delete-file\": \"remove screen\",\n \"get-design-snapshot\": \"get screen snapshot\",\n \"edit-design\": \"edit screen\",\n};\n\nexport function humanizeToolName(toolName: string | undefined): string {\n const raw = (toolName ?? \"\").trim();\n if (!raw) return \"tool\";\n const displayName = TOOL_DISPLAY_NAMES[raw];\n if (displayName) return displayName;\n\n let name = raw;\n if (name.startsWith(\"mcp__\")) {\n const parts = name.split(\"__\").filter(Boolean);\n name = parts[parts.length - 1] ?? name;\n }\n\n name = name\n .replace(/^_+/, \"\")\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .replace(/[-_]+/g, \" \")\n .replace(/\\s+/g, \" \")\n .trim();\n\n return (name || \"tool\").toLowerCase();\n}\n\nexport function runningToolLabel(toolName: string | undefined): string {\n return `Running ${humanizeToolName(toolName)}`;\n}\n\nexport function humanizeToolLabelText(\n label: string,\n toolName: string | undefined,\n): string {\n const text = label.trim();\n const tool = (toolName ?? \"\").trim();\n if (!tool) return text;\n return text.split(tool).join(humanizeToolName(tool));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tool-display.js","sourceRoot":"","sources":["../../src/client/tool-display.ts"],"names":[],"mappings":"AAAA,MAAM,kBAAkB,GAA2B;IACjD,aAAa,EAAE,eAAe;IAC9B,qBAAqB,EAAE,qBAAqB;IAC5C,aAAa,EAAE,aAAa;CAC7B,CAAC;AAEF,MAAM,UAAU,gBAAgB,CAAC,QAA4B;IAC3D,MAAM,GAAG,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACpC,IAAI,CAAC,GAAG;QAAE,OAAO,MAAM,CAAC;IACxB,MAAM,WAAW,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAC5C,IAAI,WAAW;QAAE,OAAO,WAAW,CAAC;IAEpC,IAAI,IAAI,GAAG,GAAG,CAAC;IACf,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAA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,EAAE,KAAK,EAAE,EAAE;QAC5B,IAAI,IAAI,CAAC,UAAU,IAAI,2BAA2B,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC;YACjE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["const TOOL_DISPLAY_NAMES: Record<string, string> = {\n \"delete-file\": \"remove screen\",\n \"get-design-snapshot\": \"get screen snapshot\",\n \"edit-design\": \"edit screen\",\n};\n\nexport function humanizeToolName(toolName: string | undefined): string {\n const raw = (toolName ?? \"\").trim();\n if (!raw) return \"tool\";\n const displayName = TOOL_DISPLAY_NAMES[raw];\n if (displayName) return displayName;\n\n let name = raw;\n if (name.startsWith(\"mcp__\")) {\n const parts = name.split(\"__\").filter(Boolean);\n name = parts[parts.length - 1] ?? name;\n }\n\n name = name\n .replace(/^_+/, \"\")\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .replace(/[-_]+/g, \" \")\n .replace(/\\s+/g, \" \")\n .trim();\n\n return (name || \"tool\").toLowerCase();\n}\n\nexport function runningToolLabel(toolName: string | undefined): string {\n return `Running ${humanizeToolName(toolName)}`;\n}\n\nexport function humanizeToolLabelText(\n label: string,\n toolName: string | undefined,\n): string {\n const text = label.trim();\n const tool = (toolName ?? \"\").trim();\n if (!tool) return text;\n return text.split(tool).join(humanizeToolName(tool));\n}\n\ntype ToolDisplayPart = {\n type?: string;\n toolCallId?: string;\n toolName?: string;\n argsText?: string;\n args?: Record<string, unknown>;\n};\n\nfunction normalizedAgentName(value: unknown): string | null {\n if (typeof value !== \"string\") return null;\n const name = value.trim().toLowerCase();\n return name || null;\n}\n\nfunction callAgentTarget(part: ToolDisplayPart): string | null {\n const parsedTarget = normalizedAgentName(part.args?.agent);\n if (parsedTarget) return parsedTarget;\n if (!part.argsText) return null;\n\n try {\n const args = JSON.parse(part.argsText) as Record<string, unknown>;\n return normalizedAgentName(args.agent);\n } catch {\n return null;\n }\n}\n\n/**\n * `call-agent` emits both its ordinary tool row and a richer `agent:<name>`\n * progress row. Keep the ordinary part in message state for tool completion\n * and history, but let presentation code suppress it once the richer row is\n * available.\n */\nexport function isCallAgentToolCallShadowed(\n parts: readonly ToolDisplayPart[],\n index: number,\n): boolean {\n const part = parts[index];\n if (part?.type !== \"tool-call\" || part.toolName !== \"call-agent\") {\n return false;\n }\n\n const agentRows = parts.filter((candidate) => {\n if (\n candidate.type !== \"tool-call\" ||\n !candidate.toolName?.startsWith(\"agent:\")\n ) {\n return false;\n }\n return true;\n });\n const target = callAgentTarget(part);\n if (!target) return agentRows.length > 0;\n\n return agentRows.some(\n (candidate) => normalizedAgentName(candidate.toolName?.slice(6)) === target,\n );\n}\n\nexport function shadowedCallAgentToolCallIds(\n parts: readonly ToolDisplayPart[],\n): Set<string> {\n const ids = new Set<string>();\n parts.forEach((part, index) => {\n if (part.toolCallId && isCallAgentToolCallShadowed(parts, index)) {\n ids.add(part.toolCallId);\n }\n });\n return ids;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** `unknown` until the first check resolves, so callers don't flash the gate. */
|
|
2
|
-
export type AgentEngineConfiguredState = "unknown" | "configured" | "missing";
|
|
2
|
+
export type AgentEngineConfiguredState = "unknown" | "configured" | "missing" | "unavailable";
|
|
3
3
|
export interface UseAgentEngineConfiguredResult {
|
|
4
4
|
/** True once we know nothing can run the agent (no key / Builder / BYOK). */
|
|
5
5
|
missing: boolean;
|
|
@@ -24,7 +24,8 @@ export declare function fetchAgentEngineConfiguredState(enabled?: boolean, optio
|
|
|
24
24
|
* composer and app prompt boxes. Checks the env-key / Builder / BYOK status
|
|
25
25
|
* endpoints on mount, re-checks on `agent-engine:configured-changed`, and folds
|
|
26
26
|
* in the adapter's `agent-chat:missing-api-key` signal. Pass `enabled = false`
|
|
27
|
-
* to short-circuit to configured;
|
|
27
|
+
* to short-circuit to configured; unavailable checks can be retried by firing
|
|
28
|
+
* `agent-engine:configured-changed`.
|
|
28
29
|
*/
|
|
29
30
|
export declare function useAgentEngineConfigured(enabled?: boolean, options?: UseAgentEngineConfiguredOptions): UseAgentEngineConfiguredResult;
|
|
30
31
|
//# sourceMappingURL=use-agent-engine-configured.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-agent-engine-configured.d.ts","sourceRoot":"","sources":["../../src/client/use-agent-engine-configured.ts"],"names":[],"mappings":"AAOA,iFAAiF;AACjF,MAAM,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"use-agent-engine-configured.d.ts","sourceRoot":"","sources":["../../src/client/use-agent-engine-configured.ts"],"names":[],"mappings":"AAOA,iFAAiF;AACjF,MAAM,MAAM,0BAA0B,GAClC,SAAS,GACT,YAAY,GACZ,SAAS,GACT,aAAa,CAAC;AAElB,MAAM,WAAW,8BAA8B;IAC7C,6EAA6E;IAC7E,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,0BAA0B,CAAC;CACnC;AAED,MAAM,WAAW,sCAAsC;IACrD;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,+BAA+B;IAC9C,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAgED,wBAAsB,+BAA+B,CACnD,OAAO,UAAO,EACd,OAAO,CAAC,EAAE,sCAAsC,GAC/C,OAAO,CAAC,0BAA0B,CAAC,CA2CrC;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,UAAO,EACd,OAAO,CAAC,EAAE,+BAA+B,GACxC,8BAA8B,CA+ChC"}
|
|
@@ -3,7 +3,6 @@ import { PROVIDER_ENV_VARS } from "../agent/engine/provider-env-vars.js";
|
|
|
3
3
|
import { agentNativePath } from "./api-path.js";
|
|
4
4
|
const PROVIDER_ENV_VAR_SET = new Set(PROVIDER_ENV_VARS);
|
|
5
5
|
const DEFAULT_STATUS_CHECK_TIMEOUT_MS = 2500;
|
|
6
|
-
const UNKNOWN_STATUS_RETRY_MS = 2000;
|
|
7
6
|
async function fetchStatusJson(path, timeoutMs) {
|
|
8
7
|
const controller = typeof AbortController !== "undefined" ? new AbortController() : null;
|
|
9
8
|
let timeoutId;
|
|
@@ -58,11 +57,10 @@ export async function fetchAgentEngineConfiguredState(enabled = true, options) {
|
|
|
58
57
|
fetchStatusJson("/_agent-native/builder/status", timeoutMs),
|
|
59
58
|
fetchStatusJson("/_agent-native/agent-engine/status", timeoutMs),
|
|
60
59
|
]);
|
|
61
|
-
// All three failed —
|
|
62
|
-
//
|
|
63
|
-
// setup without a fresh authoritative status response.
|
|
60
|
+
// All three failed — surface a retryable unavailable state instead of
|
|
61
|
+
// leaving the composer in an infinite checking loop.
|
|
64
62
|
if (envKeys == null && builderStatus == null && engineStatus == null) {
|
|
65
|
-
return "
|
|
63
|
+
return "unavailable";
|
|
66
64
|
}
|
|
67
65
|
const envKeysKnown = Array.isArray(envKeys);
|
|
68
66
|
const builderStatusKnown = hasConfiguredFlag(builderStatus);
|
|
@@ -83,39 +81,31 @@ export async function fetchAgentEngineConfiguredState(enabled = true, options) {
|
|
|
83
81
|
if (engineStatusKnown)
|
|
84
82
|
return "missing";
|
|
85
83
|
// Compatibility fallback for older hosts without the canonical route.
|
|
86
|
-
return envKeysKnown && builderStatusKnown ? "missing" : "
|
|
84
|
+
return envKeysKnown && builderStatusKnown ? "missing" : "unavailable";
|
|
87
85
|
}
|
|
88
86
|
/**
|
|
89
87
|
* Shared "can the agent run?" gate — the single source of truth for the sidebar
|
|
90
88
|
* composer and app prompt boxes. Checks the env-key / Builder / BYOK status
|
|
91
89
|
* endpoints on mount, re-checks on `agent-engine:configured-changed`, and folds
|
|
92
90
|
* in the adapter's `agent-chat:missing-api-key` signal. Pass `enabled = false`
|
|
93
|
-
* to short-circuit to configured;
|
|
91
|
+
* to short-circuit to configured; unavailable checks can be retried by firing
|
|
92
|
+
* `agent-engine:configured-changed`.
|
|
94
93
|
*/
|
|
95
94
|
export function useAgentEngineConfigured(enabled = true, options) {
|
|
96
95
|
const [state, setState] = useState("unknown");
|
|
97
96
|
useEffect(() => {
|
|
98
97
|
let cancelled = false;
|
|
99
|
-
let retryId;
|
|
100
98
|
// Monotonic call counter: overlapping checks (mount + a
|
|
101
99
|
// `agent-engine:configured-changed` fired right after a key is saved) can
|
|
102
100
|
// resolve out of order; only the latest call may write state, or a slow
|
|
103
101
|
// stale "missing" response would overwrite the fresh "configured" one.
|
|
104
102
|
let requestSeq = 0;
|
|
105
103
|
const check = async (options) => {
|
|
106
|
-
if (retryId !== undefined) {
|
|
107
|
-
clearTimeout(retryId);
|
|
108
|
-
retryId = undefined;
|
|
109
|
-
}
|
|
110
104
|
const seq = ++requestSeq;
|
|
111
105
|
const nextState = await fetchAgentEngineConfiguredState(enabled, options);
|
|
112
106
|
if (cancelled || seq !== requestSeq)
|
|
113
107
|
return;
|
|
114
|
-
|
|
115
|
-
retryId = setTimeout(() => void check(), UNKNOWN_STATUS_RETRY_MS);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
setState(nextState);
|
|
108
|
+
setState(nextState === "unknown" ? "unavailable" : nextState);
|
|
119
109
|
};
|
|
120
110
|
const onConfiguredChanged = () => {
|
|
121
111
|
void check();
|
|
@@ -136,8 +126,6 @@ export function useAgentEngineConfigured(enabled = true, options) {
|
|
|
136
126
|
window.addEventListener("agent-chat:missing-api-key", onMissing);
|
|
137
127
|
return () => {
|
|
138
128
|
cancelled = true;
|
|
139
|
-
if (retryId !== undefined)
|
|
140
|
-
clearTimeout(retryId);
|
|
141
129
|
window.removeEventListener("agent-engine:configured-changed", onConfiguredChanged);
|
|
142
130
|
window.removeEventListener("agent-chat:missing-api-key", onMissing);
|
|
143
131
|
};
|
|
@@ -1 +1 @@
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,CAAC,SAAS,CAAC,CAAC;QACtB,CAAC,CAAC;QACF,MAAM,mBAAmB,GAAG,GAAG,EAAE;YAC/B,KAAK,KAAK,EAAE,CAAC;QACf,CAAC,CAAC;QACF,MAAM,SAAS,GAAG,CAAC,KAAY,EAAE,EAAE;YACjC,IAAI,CAAC,2BAA2B,CAAC,KAAK,EAAE,OAAO,CAAC;gBAAE,OAAO;YACzD,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,QAAQ,CAAC,YAAY,CAAC,CAAC;gBACvB,OAAO;YACT,CAAC;YACD,KAAK,KAAK,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;QACxC,CAAC,CAAC;QAEF,KAAK,KAAK,EAAE,CAAC;QACb,MAAM,CAAC,gBAAgB,CACrB,iCAAiC,EACjC,mBAAmB,CACpB,CAAC;QACF,4EAA4E;QAC5E,uDAAuD;QACvD,MAAM,CAAC,gBAAgB,CAAC,4BAA4B,EAAE,SAAS,CAAC,CAAC;QACjE,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;YACjB,IAAI,OAAO,KAAK,SAAS;gBAAE,YAAY,CAAC,OAAO,CAAC,CAAC;YACjD,MAAM,CAAC,mBAAmB,CACxB,iCAAiC,EACjC,mBAAmB,CACpB,CAAC;YACF,MAAM,CAAC,mBAAmB,CAAC,4BAA4B,EAAE,SAAS,CAAC,CAAC;QACtE,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEjD,OAAO,EAAE,OAAO,EAAE,KAAK,KAAK,SAAS,EAAE,KAAK,EAAE,CAAC;AACjD,CAAC","sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport { PROVIDER_ENV_VARS } from \"../agent/engine/provider-env-vars.js\";\nimport { agentNativePath } from \"./api-path.js\";\n\nconst PROVIDER_ENV_VAR_SET = new Set(PROVIDER_ENV_VARS);\n\n/** `unknown` until the first check resolves, so callers don't flash the gate. */\nexport type AgentEngineConfiguredState = \"unknown\" | \"configured\" | \"missing\";\n\nexport interface UseAgentEngineConfiguredResult {\n /** True once we know nothing can run the agent (no key / Builder / BYOK). */\n missing: boolean;\n state: AgentEngineConfiguredState;\n}\n\nexport interface FetchAgentEngineConfiguredStateOptions {\n /**\n * Legacy hint from explicit missing-key stream events. Kept for API\n * compatibility, but missing state still requires authoritative status\n * responses so transient endpoint failures do not clobber connected state.\n */\n missingFallback?: boolean;\n timeoutMs?: number;\n}\n\nexport interface UseAgentEngineConfiguredOptions {\n tabId?: string | null;\n threadId?: string | null;\n}\n\nconst DEFAULT_STATUS_CHECK_TIMEOUT_MS = 2500;\nconst UNKNOWN_STATUS_RETRY_MS = 2000;\n\nasync function fetchStatusJson(\n path: string,\n timeoutMs: number,\n): Promise<unknown | null> {\n const controller =\n typeof AbortController !== \"undefined\" ? new AbortController() : null;\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n const timeout = new Promise<null>((resolve) => {\n timeoutId = setTimeout(() => {\n controller?.abort();\n resolve(null);\n }, timeoutMs);\n });\n\n // Never serve a stale status from the HTTP cache: this is re-fetched right\n // after a provider connects, and a cached \"missing\" would keep the composer\n // gate and error banner pinned even though a provider is now configured.\n const request = fetch(agentNativePath(path), {\n cache: \"no-store\",\n ...(controller ? { signal: controller.signal } : {}),\n })\n .then((r) => (r.ok ? r.json() : null))\n .catch(() => null)\n .finally(() => {\n if (timeoutId !== undefined) clearTimeout(timeoutId);\n });\n\n return Promise.race([request, timeout]);\n}\n\nfunction hasConfiguredFlag(value: unknown): value is { configured: boolean } {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"configured\" in value &&\n typeof (value as { configured?: unknown }).configured === \"boolean\"\n );\n}\n\nfunction missingKeyEventMatchesScope(\n event: Event,\n options: UseAgentEngineConfiguredOptions | undefined,\n): boolean {\n const detail = (event as CustomEvent).detail as\n | { tabId?: unknown; threadId?: unknown }\n | undefined;\n const eventTabId = typeof detail?.tabId === \"string\" ? detail.tabId : null;\n const eventThreadId =\n typeof detail?.threadId === \"string\" ? detail.threadId : null;\n if (!eventTabId && !eventThreadId) return true;\n\n const tabId = options?.tabId ?? null;\n const threadId = options?.threadId ?? null;\n if (!tabId && !threadId) return true;\n return (\n (eventTabId != null && eventTabId === tabId) ||\n (eventThreadId != null && eventThreadId === threadId)\n );\n}\n\nexport async function fetchAgentEngineConfiguredState(\n enabled = true,\n options?: FetchAgentEngineConfiguredStateOptions,\n): Promise<AgentEngineConfiguredState> {\n if (!enabled) return \"configured\";\n\n const timeoutMs =\n typeof options?.timeoutMs === \"number\" && options.timeoutMs > 0\n ? options.timeoutMs\n : DEFAULT_STATUS_CHECK_TIMEOUT_MS;\n const [envKeys, builderStatus, engineStatus] = await Promise.all([\n fetchStatusJson(\"/_agent-native/env-status\", timeoutMs),\n fetchStatusJson(\"/_agent-native/builder/status\", timeoutMs),\n fetchStatusJson(\"/_agent-native/agent-engine/status\", timeoutMs),\n ]);\n\n // All three failed — likely a flaky network; keep the caller in unknown.\n // Even an explicit missing-key stream event should not pin the composer into\n // setup without a fresh authoritative status response.\n if (envKeys == null && builderStatus == null && engineStatus == null) {\n return \"unknown\";\n }\n\n const envKeysKnown = Array.isArray(envKeys);\n const builderStatusKnown = hasConfiguredFlag(builderStatus);\n const engineStatusKnown = hasConfiguredFlag(engineStatus);\n const keys = envKeysKnown\n ? (envKeys as Array<{\n key: string;\n configured: boolean;\n }>)\n : [];\n const llmKeys = keys.filter((k) => PROVIDER_ENV_VAR_SET.has(k.key));\n const anyConfigured =\n llmKeys.some((k) => k.configured) ||\n (builderStatusKnown && builderStatus.configured) ||\n (engineStatusKnown && engineStatus.configured);\n if (anyConfigured) return \"configured\";\n\n // The engine status route is the canonical readiness check: it resolves\n // Builder, scoped BYOK secrets, deployment credentials, and custom engines.\n // Once it has answered `configured: false`, a slow legacy env/Builder status\n // request must not leave the composer permissively stuck in `unknown`.\n if (engineStatusKnown) return \"missing\";\n\n // Compatibility fallback for older hosts without the canonical route.\n return envKeysKnown && builderStatusKnown ? \"missing\" : \"unknown\";\n}\n\n/**\n * Shared \"can the agent run?\" gate — the single source of truth for the sidebar\n * composer and app prompt boxes. Checks the env-key / Builder / BYOK status\n * endpoints on mount, re-checks on `agent-engine:configured-changed`, and folds\n * in the adapter's `agent-chat:missing-api-key` signal. Pass `enabled = false`\n * to short-circuit to configured; flaky requests stay `unknown`.\n */\nexport function useAgentEngineConfigured(\n enabled = true,\n options?: UseAgentEngineConfiguredOptions,\n): UseAgentEngineConfiguredResult {\n const [state, setState] = useState<AgentEngineConfiguredState>(\"unknown\");\n\n useEffect(() => {\n let cancelled = false;\n let retryId: ReturnType<typeof setTimeout> | undefined;\n // Monotonic call counter: overlapping checks (mount + a\n // `agent-engine:configured-changed` fired right after a key is saved) can\n // resolve out of order; only the latest call may write state, or a slow\n // stale \"missing\" response would overwrite the fresh \"configured\" one.\n let requestSeq = 0;\n const check = async (options?: { missingFallback?: boolean }) => {\n if (retryId !== undefined) {\n clearTimeout(retryId);\n retryId = undefined;\n }\n const seq = ++requestSeq;\n const nextState = await fetchAgentEngineConfiguredState(enabled, options);\n if (cancelled || seq !== requestSeq) return;\n if (nextState === \"unknown\") {\n retryId = setTimeout(() => void check(), UNKNOWN_STATUS_RETRY_MS);\n return;\n }\n setState(nextState);\n };\n const onConfiguredChanged = () => {\n void check();\n };\n const onMissing = (event: Event) => {\n if (!missingKeyEventMatchesScope(event, options)) return;\n if (!enabled) {\n setState(\"configured\");\n return;\n }\n void check({ missingFallback: true });\n };\n\n void check();\n window.addEventListener(\n \"agent-engine:configured-changed\",\n onConfiguredChanged,\n );\n // A stale failed stream can arrive after a reconnect succeeds. Re-check the\n // current status before pinning the composer in setup.\n window.addEventListener(\"agent-chat:missing-api-key\", onMissing);\n return () => {\n cancelled = true;\n if (retryId !== undefined) clearTimeout(retryId);\n window.removeEventListener(\n \"agent-engine:configured-changed\",\n onConfiguredChanged,\n );\n window.removeEventListener(\"agent-chat:missing-api-key\", onMissing);\n };\n }, [enabled, options?.tabId, options?.threadId]);\n\n return { missing: state === \"missing\", state };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"use-agent-engine-configured.js","sourceRoot":"","sources":["../../src/client/use-agent-engine-configured.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,iBAAiB,CAAC,CAAC;AA8BxD,MAAM,+BAA+B,GAAG,IAAI,CAAC;AAE7C,KAAK,UAAU,eAAe,CAC5B,IAAY,EACZ,SAAiB;IAEjB,MAAM,UAAU,GACd,OAAO,eAAe,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,eAAe,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACxE,IAAI,SAAoD,CAAC;IACzD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QAC5C,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;YAC1B,UAAU,EAAE,KAAK,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,EAAE,SAAS,CAAC,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,2EAA2E;IAC3E,4EAA4E;IAC5E,yEAAyE;IACzE,MAAM,OAAO,GAAG,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE;QAC3C,KAAK,EAAE,UAAU;QACjB,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACrD,CAAC;SACC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,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AC,KAAK,EAAE,OAAO,CAAC;gBAAE,OAAO;YACzD,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,QAAQ,CAAC,YAAY,CAAC,CAAC;gBACvB,OAAO;YACT,CAAC;YACD,KAAK,KAAK,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;QACxC,CAAC,CAAC;QAEF,KAAK,KAAK,EAAE,CAAC;QACb,MAAM,CAAC,gBAAgB,CACrB,iCAAiC,EACjC,mBAAmB,CACpB,CAAC;QACF,4EAA4E;QAC5E,uDAAuD;QACvD,MAAM,CAAC,gBAAgB,CAAC,4BAA4B,EAAE,SAAS,CAAC,CAAC;QACjE,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;YACjB,MAAM,CAAC,mBAAmB,CACxB,iCAAiC,EACjC,mBAAmB,CACpB,CAAC;YACF,MAAM,CAAC,mBAAmB,CAAC,4BAA4B,EAAE,SAAS,CAAC,CAAC;QACtE,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEjD,OAAO,EAAE,OAAO,EAAE,KAAK,KAAK,SAAS,EAAE,KAAK,EAAE,CAAC;AACjD,CAAC","sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport { PROVIDER_ENV_VARS } from \"../agent/engine/provider-env-vars.js\";\nimport { agentNativePath } from \"./api-path.js\";\n\nconst PROVIDER_ENV_VAR_SET = new Set(PROVIDER_ENV_VARS);\n\n/** `unknown` until the first check resolves, so callers don't flash the gate. */\nexport type AgentEngineConfiguredState =\n | \"unknown\"\n | \"configured\"\n | \"missing\"\n | \"unavailable\";\n\nexport interface UseAgentEngineConfiguredResult {\n /** True once we know nothing can run the agent (no key / Builder / BYOK). */\n missing: boolean;\n state: AgentEngineConfiguredState;\n}\n\nexport interface FetchAgentEngineConfiguredStateOptions {\n /**\n * Legacy hint from explicit missing-key stream events. Kept for API\n * compatibility, but missing state still requires authoritative status\n * responses so transient endpoint failures do not clobber connected state.\n */\n missingFallback?: boolean;\n timeoutMs?: number;\n}\n\nexport interface UseAgentEngineConfiguredOptions {\n tabId?: string | null;\n threadId?: string | null;\n}\n\nconst DEFAULT_STATUS_CHECK_TIMEOUT_MS = 2500;\n\nasync function fetchStatusJson(\n path: string,\n timeoutMs: number,\n): Promise<unknown | null> {\n const controller =\n typeof AbortController !== \"undefined\" ? new AbortController() : null;\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n const timeout = new Promise<null>((resolve) => {\n timeoutId = setTimeout(() => {\n controller?.abort();\n resolve(null);\n }, timeoutMs);\n });\n\n // Never serve a stale status from the HTTP cache: this is re-fetched right\n // after a provider connects, and a cached \"missing\" would keep the composer\n // gate and error banner pinned even though a provider is now configured.\n const request = fetch(agentNativePath(path), {\n cache: \"no-store\",\n ...(controller ? { signal: controller.signal } : {}),\n })\n .then((r) => (r.ok ? r.json() : null))\n .catch(() => null)\n .finally(() => {\n if (timeoutId !== undefined) clearTimeout(timeoutId);\n });\n\n return Promise.race([request, timeout]);\n}\n\nfunction hasConfiguredFlag(value: unknown): value is { configured: boolean } {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"configured\" in value &&\n typeof (value as { configured?: unknown }).configured === \"boolean\"\n );\n}\n\nfunction missingKeyEventMatchesScope(\n event: Event,\n options: UseAgentEngineConfiguredOptions | undefined,\n): boolean {\n const detail = (event as CustomEvent).detail as\n | { tabId?: unknown; threadId?: unknown }\n | undefined;\n const eventTabId = typeof detail?.tabId === \"string\" ? detail.tabId : null;\n const eventThreadId =\n typeof detail?.threadId === \"string\" ? detail.threadId : null;\n if (!eventTabId && !eventThreadId) return true;\n\n const tabId = options?.tabId ?? null;\n const threadId = options?.threadId ?? null;\n if (!tabId && !threadId) return true;\n return (\n (eventTabId != null && eventTabId === tabId) ||\n (eventThreadId != null && eventThreadId === threadId)\n );\n}\n\nexport async function fetchAgentEngineConfiguredState(\n enabled = true,\n options?: FetchAgentEngineConfiguredStateOptions,\n): Promise<AgentEngineConfiguredState> {\n if (!enabled) return \"configured\";\n\n const timeoutMs =\n typeof options?.timeoutMs === \"number\" && options.timeoutMs > 0\n ? options.timeoutMs\n : DEFAULT_STATUS_CHECK_TIMEOUT_MS;\n const [envKeys, builderStatus, engineStatus] = await Promise.all([\n fetchStatusJson(\"/_agent-native/env-status\", timeoutMs),\n fetchStatusJson(\"/_agent-native/builder/status\", timeoutMs),\n fetchStatusJson(\"/_agent-native/agent-engine/status\", timeoutMs),\n ]);\n\n // All three failed — surface a retryable unavailable state instead of\n // leaving the composer in an infinite checking loop.\n if (envKeys == null && builderStatus == null && engineStatus == null) {\n return \"unavailable\";\n }\n\n const envKeysKnown = Array.isArray(envKeys);\n const builderStatusKnown = hasConfiguredFlag(builderStatus);\n const engineStatusKnown = hasConfiguredFlag(engineStatus);\n const keys = envKeysKnown\n ? (envKeys as Array<{\n key: string;\n configured: boolean;\n }>)\n : [];\n const llmKeys = keys.filter((k) => PROVIDER_ENV_VAR_SET.has(k.key));\n const anyConfigured =\n llmKeys.some((k) => k.configured) ||\n (builderStatusKnown && builderStatus.configured) ||\n (engineStatusKnown && engineStatus.configured);\n if (anyConfigured) return \"configured\";\n\n // The engine status route is the canonical readiness check: it resolves\n // Builder, scoped BYOK secrets, deployment credentials, and custom engines.\n // Once it has answered `configured: false`, a slow legacy env/Builder status\n // request must not leave the composer permissively stuck in `unknown`.\n if (engineStatusKnown) return \"missing\";\n\n // Compatibility fallback for older hosts without the canonical route.\n return envKeysKnown && builderStatusKnown ? \"missing\" : \"unavailable\";\n}\n\n/**\n * Shared \"can the agent run?\" gate — the single source of truth for the sidebar\n * composer and app prompt boxes. Checks the env-key / Builder / BYOK status\n * endpoints on mount, re-checks on `agent-engine:configured-changed`, and folds\n * in the adapter's `agent-chat:missing-api-key` signal. Pass `enabled = false`\n * to short-circuit to configured; unavailable checks can be retried by firing\n * `agent-engine:configured-changed`.\n */\nexport function useAgentEngineConfigured(\n enabled = true,\n options?: UseAgentEngineConfiguredOptions,\n): UseAgentEngineConfiguredResult {\n const [state, setState] = useState<AgentEngineConfiguredState>(\"unknown\");\n\n useEffect(() => {\n let cancelled = false;\n // Monotonic call counter: overlapping checks (mount + a\n // `agent-engine:configured-changed` fired right after a key is saved) can\n // resolve out of order; only the latest call may write state, or a slow\n // stale \"missing\" response would overwrite the fresh \"configured\" one.\n let requestSeq = 0;\n const check = async (options?: { missingFallback?: boolean }) => {\n const seq = ++requestSeq;\n const nextState = await fetchAgentEngineConfiguredState(enabled, options);\n if (cancelled || seq !== requestSeq) return;\n setState(nextState === \"unknown\" ? \"unavailable\" : nextState);\n };\n const onConfiguredChanged = () => {\n void check();\n };\n const onMissing = (event: Event) => {\n if (!missingKeyEventMatchesScope(event, options)) return;\n if (!enabled) {\n setState(\"configured\");\n return;\n }\n void check({ missingFallback: true });\n };\n\n void check();\n window.addEventListener(\n \"agent-engine:configured-changed\",\n onConfiguredChanged,\n );\n // A stale failed stream can arrive after a reconnect succeeds. Re-check the\n // current status before pinning the composer in setup.\n window.addEventListener(\"agent-chat:missing-api-key\", onMissing);\n return () => {\n cancelled = true;\n window.removeEventListener(\n \"agent-engine:configured-changed\",\n onConfiguredChanged,\n );\n window.removeEventListener(\"agent-chat:missing-api-key\", onMissing);\n };\n }, [enabled, options?.tabId, options?.threadId]);\n\n return { missing: state === \"missing\", state };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-chat-threads.d.ts","sourceRoot":"","sources":["../../src/client/use-chat-threads.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,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,OAAO,CAAC,OAAO,CAAC;2BAwO7C,MAAM,mBACC,kBAAkB,GAAG,IAAI,KACzC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;yBAvInB,MAAM,QACJ;QACJ,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,WAAW,CAAC,EAAE,iBAAiB,CAAC;KACjC;8BAoGc,MAAM,WAAW,MAAM,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;2BAgInD,MAAM,KAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;2BAxoBP,OAAO,CAAC,IAAI,CAAC;oCAwpBxC,MAAM,KAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;sCAgB7C,MAAM,KAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;sCAkB5C,MAAM,KAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;;;;;sBA5UzD,MAAM;EAyXd"}
|
|
@@ -217,6 +217,17 @@ export function useChatThreads(apiUrl = agentNativePath("/_agent-native/agent-ch
|
|
|
217
217
|
const fetchedRef = useRef(false);
|
|
218
218
|
const activeThreadIdRef = useRef(activeThreadId);
|
|
219
219
|
activeThreadIdRef.current = activeThreadId;
|
|
220
|
+
const persistActiveThreadId = useCallback((id) => {
|
|
221
|
+
try {
|
|
222
|
+
const threadScope = readKnownThreadScope(id);
|
|
223
|
+
const targetKey = threadScope === undefined
|
|
224
|
+
? activeThreadKey
|
|
225
|
+
: activeThreadStorageKey(storageKey, threadScope);
|
|
226
|
+
localStorage.setItem(targetKey, id);
|
|
227
|
+
localStorage.setItem(activeThreadSeenStorageKey(targetKey), String(Date.now()));
|
|
228
|
+
}
|
|
229
|
+
catch { }
|
|
230
|
+
}, [activeThreadKey, readKnownThreadScope, storageKey]);
|
|
220
231
|
// Persist active thread ID — and rehydrate on scope flips. When the user
|
|
221
232
|
// navigates from deck A to deck B, `activeThreadKey` changes; we re-read B's
|
|
222
233
|
// scoped thread only if the currently visible chat is itself scoped to a
|
|
@@ -262,6 +273,9 @@ export function useChatThreads(apiUrl = agentNativePath("/_agent-native/agent-ch
|
|
|
262
273
|
setActiveThreadId(nextActiveThreadId);
|
|
263
274
|
return;
|
|
264
275
|
}
|
|
276
|
+
if (!activeThreadId && !restoreActiveThread && !routeControlsActiveThread) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
265
279
|
try {
|
|
266
280
|
if (routeControlsActiveThread && !routeThreadId) {
|
|
267
281
|
localStorage.removeItem(activeThreadKey);
|
|
@@ -269,12 +283,7 @@ export function useChatThreads(apiUrl = agentNativePath("/_agent-native/agent-ch
|
|
|
269
283
|
return;
|
|
270
284
|
}
|
|
271
285
|
if (activeThreadId) {
|
|
272
|
-
|
|
273
|
-
if (threadScope === undefined)
|
|
274
|
-
return;
|
|
275
|
-
const targetKey = activeThreadStorageKey(storageKey, threadScope);
|
|
276
|
-
localStorage.setItem(targetKey, activeThreadId);
|
|
277
|
-
localStorage.setItem(activeThreadSeenStorageKey(targetKey), String(Date.now()));
|
|
286
|
+
persistActiveThreadId(activeThreadId);
|
|
278
287
|
}
|
|
279
288
|
else {
|
|
280
289
|
localStorage.removeItem(activeThreadKey);
|
|
@@ -288,7 +297,9 @@ export function useChatThreads(apiUrl = agentNativePath("/_agent-native/agent-ch
|
|
|
288
297
|
activeThreadSeenKey,
|
|
289
298
|
addOptimisticThread,
|
|
290
299
|
autoCreate,
|
|
300
|
+
persistActiveThreadId,
|
|
291
301
|
readKnownThreadScope,
|
|
302
|
+
restoreActiveThread,
|
|
292
303
|
routeControlsActiveThread,
|
|
293
304
|
routeThreadId,
|
|
294
305
|
storageKey,
|
|
@@ -505,9 +516,10 @@ export function useChatThreads(apiUrl = agentNativePath("/_agent-native/agent-ch
|
|
|
505
516
|
const id = preferredId || createLocalThreadId();
|
|
506
517
|
newlyCreatedRef.current.add(id);
|
|
507
518
|
addOptimisticThread(id, scopeRef.current ?? null);
|
|
519
|
+
persistActiveThreadId(id);
|
|
508
520
|
setActiveThreadId(id);
|
|
509
521
|
return Promise.resolve(id);
|
|
510
|
-
}, [addOptimisticThread]);
|
|
522
|
+
}, [addOptimisticThread, persistActiveThreadId]);
|
|
511
523
|
useEffect(() => {
|
|
512
524
|
if (!routeControlsActiveThread)
|
|
513
525
|
return;
|
|
@@ -695,8 +707,9 @@ export function useChatThreads(apiUrl = agentNativePath("/_agent-native/agent-ch
|
|
|
695
707
|
}, [apiUrl, clearUserRenamedThread, fetchThreads, markUserRenamedThread]);
|
|
696
708
|
const isNewThread = useCallback((id) => newlyCreatedRef.current.has(id), []);
|
|
697
709
|
const switchThread = useCallback((id) => {
|
|
710
|
+
persistActiveThreadId(id);
|
|
698
711
|
setActiveThreadId(id);
|
|
699
|
-
}, []);
|
|
712
|
+
}, [persistActiveThreadId]);
|
|
700
713
|
const removeThread = useCallback(async (id) => {
|
|
701
714
|
try {
|
|
702
715
|
await fetch(`${apiUrl}/threads/${encodeURIComponent(id)}`, {
|