chat-js 1.0.0-alpha.7 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/dist/index.js +7487 -6859
- package/package.json +2 -2
- package/templates/chat-app/AGENTS.md +1 -1
- package/templates/chat-app/agent/agent.ts +0 -2
- package/templates/chat-app/agent/hooks/followup-suggestions.ts +1 -1
- package/templates/chat-app/agent/hooks/projects.ts +1 -1
- package/templates/chat-app/agent/hooks/search.ts +1 -1
- package/templates/chat-app/agent/instructions/projects.ts +1 -1
- package/templates/chat-app/agent/tools/mcp.ts +1 -1
- package/templates/chat-app/app/(auth)/device-login/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/api/files/upload/route.ts +1 -1
- package/templates/chat-app/app/(chat)/chat/{[id] → [chatId]}/page.tsx +4 -4
- package/templates/chat-app/app/(chat)/project/[projectId]/chat/[chatId]/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/project/[projectId]/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/settings/connectors/[connectorId]/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/settings/connectors/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/settings/models/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/share/[id]/page.tsx +1 -1
- package/templates/chat-app/app/api/agent-conversations/route.test.ts +5 -5
- package/templates/chat-app/app/api/agent-conversations/route.ts +2 -2
- package/templates/chat-app/app/api/agent-response-groups/route.test.ts +5 -5
- package/templates/chat-app/app/api/agent-response-groups/route.ts +1 -1
- package/templates/chat-app/app/api/eve/[...path]/route.test.ts +133 -4
- package/templates/chat-app/app/api/eve/[...path]/route.ts +175 -49
- package/templates/chat-app/app/api/eve-guest/route.ts +1 -1
- package/templates/chat-app/app/api/mcp/oauth/callback/route.ts +1 -1
- package/templates/chat-app/app/editor.css +0 -6
- package/templates/chat-app/app/layout.tsx +11 -18
- package/templates/chat-app/app/opengraph-image.png +0 -0
- package/templates/chat-app/chat.config.ts +0 -44
- package/templates/chat-app/chatjs/core/chat/compose.ts +4 -4
- package/templates/chat-app/chatjs/core/chat/contracts.ts +6 -6
- package/templates/chat-app/chatjs/core/gateway/runtime.ts +0 -7
- package/templates/chat-app/chatjs/core/installation/contracts.ts +0 -7
- package/templates/chat-app/chatjs/core/ui/slots.tsx +15 -5
- package/templates/chat-app/chatjs/generated/installed-auth-ui.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-auth.ts +4 -2
- package/templates/chat-app/chatjs/generated/installed-billing.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-chat-ui.ts +28 -24
- package/templates/chat-app/chatjs/generated/installed-chat.ts +12 -12
- package/templates/chat-app/chatjs/generated/installed-cleanup.ts +4 -4
- package/templates/chat-app/chatjs/generated/installed-instrumentation.ts +8 -2
- package/templates/chat-app/chatjs/generated/installed-layout.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-model-visibility.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-navigation.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-routers.ts +18 -19
- package/templates/chat-app/chatjs/generated/installed-session-profiles.ts +5 -3
- package/templates/chat-app/chatjs/generated/installed-sign-out.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-signed-out.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-uploads.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed.ts +2 -0
- package/templates/chat-app/chatjs/plugins/ai-titles/{chat.ts → chat-server.ts} +3 -1
- package/templates/chat-app/chatjs/plugins/ai-titles/generate-title.ts +7 -9
- package/templates/chat-app/chatjs/plugins/ai-titles/{chatjs.json → plugin.json} +3 -4
- package/templates/chat-app/chatjs/plugins/ai-titles/title-queries.ts +4 -4
- package/templates/chat-app/chatjs/plugins/attachment-uploads/{client-plugin.ts → chat-ui.ts} +1 -3
- package/templates/chat-app/chatjs/plugins/attachment-uploads/plugin.json +16 -0
- package/templates/chat-app/chatjs/plugins/credits/billing.ts +3 -1
- package/templates/chat-app/chatjs/plugins/credits/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/credits/{chatjs.json → plugin.json} +4 -13
- package/templates/chat-app/chatjs/plugins/credits/router.ts +4 -2
- package/templates/chat-app/chatjs/plugins/desktop/auth-form.tsx +3 -1
- package/templates/chat-app/chatjs/plugins/desktop/auth-server.ts +3 -1
- package/templates/chat-app/chatjs/plugins/desktop/{client-plugin.ts → layout-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/desktop/navigation.ts +3 -1
- package/templates/chat-app/chatjs/plugins/desktop/{chatjs.json → plugin.json} +4 -16
- package/templates/chat-app/chatjs/plugins/desktop/sign-out.ts +3 -1
- package/templates/chat-app/chatjs/plugins/feedback/chat-server.ts +13 -0
- package/templates/chat-app/chatjs/plugins/feedback/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/feedback/feedback-actions.tsx +4 -4
- package/templates/chat-app/chatjs/plugins/feedback/feedback-queries.ts +11 -11
- package/templates/chat-app/chatjs/plugins/feedback/feedback-schema.ts +2 -2
- package/templates/chat-app/chatjs/plugins/feedback/{chatjs.json → plugin.json} +5 -14
- package/templates/chat-app/chatjs/plugins/feedback/router.ts +9 -7
- package/templates/chat-app/chatjs/plugins/feedback/vote-message.ts +3 -6
- package/templates/chat-app/chatjs/plugins/followup-suggestions/{chat.ts → chat-server.ts} +3 -1
- package/templates/chat-app/chatjs/plugins/followup-suggestions/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/followup-suggestions/followup-queries.ts +2 -2
- package/templates/chat-app/chatjs/plugins/followup-suggestions/{chatjs.json → plugin.json} +5 -17
- package/templates/chat-app/chatjs/plugins/followup-suggestions/router.ts +8 -9
- package/templates/chat-app/chatjs/plugins/followup-suggestions/suggestions.tsx +2 -7
- package/templates/chat-app/chatjs/plugins/followup-suggestions/use-followups.ts +2 -2
- package/templates/chat-app/chatjs/plugins/guest-chat/cleanup.ts +1 -7
- package/templates/chat-app/chatjs/plugins/guest-chat/guest-auth.ts +1 -0
- package/templates/chat-app/chatjs/plugins/guest-chat/instrumentation.ts +6 -0
- package/templates/chat-app/chatjs/plugins/guest-chat/{chatjs.json → plugin.json} +6 -12
- package/templates/chat-app/chatjs/plugins/guest-chat/session-profile.ts +3 -1
- package/templates/chat-app/chatjs/plugins/guest-chat/signed-out.tsx +53 -24
- package/templates/chat-app/chatjs/plugins/image-viewer/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/image-viewer/plugin.json +11 -0
- package/templates/chat-app/chatjs/plugins/mcp/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/mcp/db/encrypted-text.ts +1 -1
- package/templates/chat-app/chatjs/plugins/mcp/{chatjs.json → plugin.json} +5 -13
- package/templates/chat-app/chatjs/plugins/mcp/router.ts +4 -2
- package/templates/chat-app/chatjs/plugins/mcp/routes/connectors-page.tsx +4 -1
- package/templates/chat-app/chatjs/plugins/mcp/setup.ts +2 -2
- package/templates/chat-app/chatjs/plugins/mcp/ui/connectors-settings.tsx +1 -1
- package/templates/chat-app/chatjs/plugins/mcp/ui/mcp-connect-dialog.tsx +1 -1
- package/templates/chat-app/chatjs/plugins/mcp/ui/mcp-create-dialog.tsx +1 -1
- package/templates/chat-app/chatjs/plugins/mcp/{mcp-env.ts → validate-env.ts} +2 -1
- package/templates/chat-app/chatjs/plugins/model-preferences/{client-plugin.ts → chat-ui.ts} +1 -3
- package/templates/chat-app/chatjs/plugins/model-preferences/model-row.tsx +3 -0
- package/templates/chat-app/chatjs/plugins/model-preferences/{use-model-preferences.ts → model-visibility.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/model-preferences/models-settings.tsx +1 -0
- package/templates/chat-app/chatjs/plugins/model-preferences/{chatjs.json → plugin.json} +5 -13
- package/templates/chat-app/chatjs/plugins/model-preferences/router.ts +5 -1
- package/templates/chat-app/chatjs/plugins/projects/{chat.ts → chat-server.ts} +3 -1
- package/templates/chat-app/chatjs/plugins/projects/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/projects/conversation-hook.ts +1 -1
- package/templates/chat-app/chatjs/plugins/projects/db/project-queries.ts +2 -2
- package/templates/chat-app/chatjs/plugins/projects/{chatjs.json → plugin.json} +5 -14
- package/templates/chat-app/chatjs/plugins/projects/router.ts +7 -7
- package/templates/chat-app/chatjs/plugins/projects/routes/project-page.tsx +10 -1
- package/templates/chat-app/chatjs/plugins/projects/ui/chat-contributions.tsx +3 -3
- package/templates/chat-app/chatjs/plugins/projects/ui/delete-project-dialog.tsx +0 -3
- package/templates/chat-app/chatjs/plugins/projects/ui/eve-move-project-dialog.tsx +1 -1
- package/templates/chat-app/chatjs/plugins/projects/ui/project-icon-picker.tsx +1 -0
- package/templates/chat-app/chatjs/plugins/projects/ui/sidebar-projects.tsx +12 -11
- package/templates/chat-app/chatjs/plugins/search/{chat.ts → chat-server.ts} +8 -6
- package/templates/chat-app/chatjs/plugins/search/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/search/{chatjs.json → plugin.json} +5 -14
- package/templates/chat-app/chatjs/plugins/search/router.ts +4 -2
- package/templates/chat-app/chatjs/plugins/search/search-backfill.ts +4 -4
- package/templates/chat-app/chatjs/plugins/search/search-chats.tsx +1 -1
- package/templates/chat-app/chatjs/plugins/search/search-hook.ts +2 -2
- package/templates/chat-app/chatjs/plugins/search/search-queries.ts +13 -13
- package/templates/chat-app/chatjs/plugins/search/search-results-view.tsx +2 -2
- package/templates/chat-app/chatjs/plugins/search/search-schema.ts +3 -3
- package/templates/chat-app/chatjs/plugins/sharing/{chat.ts → chat-server.ts} +3 -1
- package/templates/chat-app/chatjs/plugins/sharing/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/sharing/{chatjs.json → plugin.json} +5 -14
- package/templates/chat-app/chatjs/plugins/sharing/router.ts +4 -2
- package/templates/chat-app/chatjs/plugins/sharing/ui/chat-contributions.tsx +9 -11
- package/templates/chat-app/chatjs/plugins/sharing/ui/share-button.tsx +6 -6
- package/templates/chat-app/chatjs/plugins/sharing/ui/share-dialog.tsx +9 -9
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/plugin.json +12 -0
- package/templates/chat-app/chatjs/plugins/streamdown-math/chat-ui.ts +11 -0
- package/templates/chat-app/chatjs/plugins/streamdown-math/plugin.json +6 -0
- package/templates/chat-app/chatjs/plugins/streamdown-mermaid/chat-ui.ts +10 -0
- package/templates/chat-app/chatjs/plugins/streamdown-mermaid/plugin.json +6 -0
- package/templates/chat-app/chatjs/plugins/video-viewer/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/video-viewer/plugin.json +10 -0
- package/templates/chat-app/chatjs/providers/gateway.ts +49 -55
- package/templates/chat-app/chatjs/tools/attach-workspace-file/tool.ts +2 -2
- package/templates/chat-app/chatjs/tools/generate-image/tool.test.ts +3 -14
- package/templates/chat-app/components/ai-elements/response.tsx +16 -15
- package/templates/chat-app/components/auth-form-view.tsx +35 -43
- package/templates/chat-app/components/chat/chat-composer.tsx +90 -27
- package/templates/chat-app/components/chat/chat-conversation-screen.tsx +3 -3
- package/templates/chat-app/components/chat/chat-navigation.tsx +11 -1
- package/templates/chat-app/components/chat/chat-sidebar.tsx +8 -9
- package/templates/chat-app/components/chat/chat-transcript.tsx +52 -23
- package/templates/chat-app/components/chat-slots.tsx +1 -1
- package/templates/chat-app/components/composer/composer-menu.tsx +5 -4
- package/templates/chat-app/components/composer/prompt-form.tsx +7 -1
- package/templates/chat-app/components/eve/eve-chat-error.tsx +12 -2
- package/templates/chat-app/components/eve/eve-chat-header.tsx +5 -7
- package/templates/chat-app/components/eve/eve-chat-page.tsx +9 -9
- package/templates/chat-app/components/eve/eve-composer.tsx +16 -5
- package/templates/chat-app/components/eve/eve-conversation.tsx +342 -209
- package/templates/chat-app/components/eve/eve-creation-recovery.tsx +53 -3
- package/templates/chat-app/components/eve/eve-deletion-provider.tsx +10 -12
- package/templates/chat-app/components/eve/eve-history-list.tsx +4 -9
- package/templates/chat-app/components/eve/eve-logical-context.tsx +1 -0
- package/templates/chat-app/components/eve/eve-logical-navigation.tsx +3 -3
- package/templates/chat-app/components/eve/eve-message-content.tsx +252 -0
- package/templates/chat-app/components/eve/eve-message-part.tsx +13 -58
- package/templates/chat-app/components/eve/eve-pending-input.tsx +82 -5
- package/templates/chat-app/components/eve/eve-runtime-provider.tsx +74 -15
- package/templates/chat-app/components/eve/use-eve-composer-draft.ts +64 -26
- package/templates/chat-app/components/eve/use-eve-fork.ts +14 -16
- package/templates/chat-app/components/eve/use-logical-commands.ts +3 -3
- package/templates/chat-app/components/eve/use-new-eve-conversation.tsx +42 -7
- package/templates/chat-app/components/model-selection-indicator.tsx +12 -10
- package/templates/chat-app/components/model-selector-view.tsx +211 -186
- package/templates/chat-app/components/new-chat-button.tsx +1 -1
- package/templates/chat-app/components/parallel-responses/model-picker.tsx +5 -1
- package/templates/chat-app/components/parallel-responses/responses.tsx +2 -2
- package/templates/chat-app/components/settings/settings-nav.tsx +1 -1
- package/templates/chat-app/components/settings/settings-navigation-link.tsx +1 -0
- package/templates/chat-app/components/sidebar-top-row.tsx +1 -1
- package/templates/chat-app/components/ui/sidebar.tsx +1 -1
- package/templates/chat-app/components/ui/trace.tsx +1 -1
- package/templates/chat-app/hooks/use-auto-focus.ts +12 -13
- package/templates/chat-app/integrations/routers.ts +1 -1
- package/templates/chat-app/lib/ai/active-gateway.ts +0 -9
- package/templates/chat-app/lib/ai/app-models.test.ts +0 -4
- package/templates/chat-app/lib/ai/app-models.ts +11 -6
- package/templates/chat-app/lib/ai/gateways/registry.ts +4 -31
- package/templates/chat-app/lib/ai/model-catalog.ts +50 -0
- package/templates/chat-app/lib/ai/models.ts +4 -39
- package/templates/chat-app/lib/ai/providers.ts +2 -16
- package/templates/chat-app/lib/chat-after-create.test.ts +1 -1
- package/templates/chat-app/lib/chat-after-create.ts +1 -1
- package/templates/chat-app/lib/config-schema.ts +0 -96
- package/templates/chat-app/lib/db/eve-creation-failure.ts +3 -3
- package/templates/chat-app/lib/db/eve-current-copy.ts +11 -11
- package/templates/chat-app/lib/db/eve-deletion.ts +19 -19
- package/templates/chat-app/lib/db/eve-dispatch.ts +115 -18
- package/templates/chat-app/lib/db/eve-file-purge.ts +4 -4
- package/templates/chat-app/lib/db/eve-files.ts +13 -13
- package/templates/chat-app/lib/db/eve-queries.ts +28 -43
- package/templates/chat-app/lib/db/eve-response-groups.ts +30 -112
- package/templates/chat-app/lib/db/eve-subagents.ts +8 -8
- package/templates/chat-app/lib/db/eve-title.ts +2 -2
- package/templates/chat-app/lib/db/eve-workspace-deletion.ts +3 -3
- package/templates/chat-app/lib/db/eve-workspace-turns.ts +37 -5
- package/templates/chat-app/lib/db/eve-workspaces.ts +3 -3
- package/templates/chat-app/lib/db/migrations/0029_branch_identifiers.sql +23 -0
- package/templates/chat-app/lib/db/migrations/meta/0029_snapshot.json +2547 -0
- package/templates/chat-app/lib/db/migrations/meta/_journal.json +7 -0
- package/templates/chat-app/lib/db/schema.ts +19 -25
- package/templates/chat-app/lib/devtools-disabled.ts +1 -0
- package/templates/chat-app/lib/eve/completed-copy-source.test.ts +12 -2
- package/templates/chat-app/lib/eve/completed-copy-source.ts +5 -2
- package/templates/chat-app/lib/eve/contracts.test.ts +5 -5
- package/templates/chat-app/lib/eve/contracts.ts +1 -1
- package/templates/chat-app/lib/eve/conversation-scope.test.ts +2 -2
- package/templates/chat-app/lib/eve/conversation-scope.ts +4 -4
- package/templates/chat-app/lib/eve/create-conversation-operation.test.ts +1 -1
- package/templates/chat-app/lib/eve/create-response-group.test.ts +3 -3
- package/templates/chat-app/lib/eve/delete-local-conversation.ts +3 -3
- package/templates/chat-app/lib/eve/generated-files.test.ts +1 -1
- package/templates/chat-app/lib/eve/generated-files.ts +2 -2
- package/templates/chat-app/lib/eve/logical-chat.test.ts +17 -17
- package/templates/chat-app/lib/eve/logical-chat.ts +27 -31
- package/templates/chat-app/lib/eve/logical-response-slots.ts +4 -7
- package/templates/chat-app/lib/eve/message-delivery.ts +1 -0
- package/templates/chat-app/lib/eve/model-selection.test.ts +47 -50
- package/templates/chat-app/lib/eve/model-selection.ts +5 -37
- package/templates/chat-app/lib/eve/pending-create.test.ts +46 -7
- package/templates/chat-app/lib/eve/pending-create.ts +36 -4
- package/templates/chat-app/lib/eve/persisted-wire-order.test.ts +2 -2
- package/templates/chat-app/lib/eve/prepare-deletion.ts +3 -3
- package/templates/chat-app/lib/eve/purge-local-resources.ts +3 -3
- package/templates/chat-app/lib/eve/reconcile-workspace-turn.ts +2 -2
- package/templates/chat-app/lib/eve/request-policy.ts +1 -0
- package/templates/chat-app/lib/eve/resolve-creation-request.ts +1 -1
- package/templates/chat-app/lib/eve/response-group-contracts.ts +1 -1
- package/templates/chat-app/lib/eve/response-group-lineage.test.ts +12 -12
- package/templates/chat-app/lib/eve/response-group-lineage.ts +21 -24
- package/templates/chat-app/lib/eve/response-group.test.ts +2 -2
- package/templates/chat-app/lib/eve/response-group.ts +1 -1
- package/templates/chat-app/lib/eve/response-model.ts +11 -1
- package/templates/chat-app/lib/eve/restore-message-attachments.test.ts +1 -1
- package/templates/chat-app/lib/eve/restore-message-attachments.ts +3 -3
- package/templates/chat-app/lib/eve/retire-session.ts +3 -3
- package/templates/chat-app/lib/eve/steer-rejected.ts +7 -0
- package/templates/chat-app/lib/eve/tool-cost.test.ts +18 -6
- package/templates/chat-app/lib/eve/tool-cost.ts +10 -18
- package/templates/chat-app/lib/eve/workspace-turn-evidence.test.ts +27 -0
- package/templates/chat-app/lib/eve/workspace-turn-evidence.ts +20 -13
- package/templates/chat-app/oxfmt.config.ts +0 -2
- package/templates/chat-app/package.json +7 -9
- package/templates/chat-app/playwright.config.ts +5 -1
- package/templates/chat-app/proxy.ts +2 -4
- package/templates/chat-app/scripts/agent-status.ts +6 -19
- package/templates/chat-app/scripts/build-eve.test.ts +56 -0
- package/templates/chat-app/scripts/build-eve.ts +12 -5
- package/templates/chat-app/scripts/check-env.ts +77 -73
- package/templates/chat-app/scripts/environment-validation-report.ts +1 -20
- package/templates/chat-app/scripts/installed-environment-validation.ts +14 -15
- package/templates/chat-app/trpc/init.ts +2 -0
- package/templates/chat-app/trpc/react.tsx +2 -2
- package/templates/chat-app/trpc/routers/_app.test.ts +56 -0
- package/templates/chat-app/trpc/routers/_app.ts +12 -11
- package/templates/chat-app/trpc/routers/eve.router.ts +2 -2
- package/templates/electron/forge.config.ts +1 -19
- package/templates/electron/scripts/write-branding.ts +1 -5
- package/templates/chat-app/app/privacy/page.tsx +0 -153
- package/templates/chat-app/app/terms/page.tsx +0 -270
- package/templates/chat-app/chatjs/core/installation/plugin.ts +0 -13
- package/templates/chat-app/chatjs/plugins/attachment-uploads/chatjs.json +0 -22
- package/templates/chat-app/chatjs/plugins/credits/server-plugin.ts +0 -5
- package/templates/chat-app/chatjs/plugins/feedback/chat.ts +0 -13
- package/templates/chat-app/chatjs/plugins/feedback/server-plugin.ts +0 -8
- package/templates/chat-app/chatjs/plugins/followup-suggestions/server-plugin.ts +0 -8
- package/templates/chat-app/chatjs/plugins/guest-chat/server-plugin.ts +0 -12
- package/templates/chat-app/chatjs/plugins/image-viewer/chatjs.json +0 -17
- package/templates/chat-app/chatjs/plugins/mcp/server-plugin.ts +0 -5
- package/templates/chat-app/chatjs/plugins/model-preferences/server-plugin.ts +0 -8
- package/templates/chat-app/chatjs/plugins/projects/server-plugin.ts +0 -8
- package/templates/chat-app/chatjs/plugins/search/server-plugin.ts +0 -5
- package/templates/chat-app/chatjs/plugins/sharing/server-plugin.ts +0 -5
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/chatjs.json +0 -18
- package/templates/chat-app/chatjs/plugins/video-viewer/chatjs.json +0 -16
- package/templates/chat-app/components/ai-elements/context-hover.radix.tsx +0 -15
- package/templates/chat-app/components/ai-elements/context-hover.tsx +0 -17
- package/templates/chat-app/components/ai-elements/context.tsx +0 -405
- package/templates/chat-app/components/composer/editor.css +0 -96
- package/templates/chat-app/components/lexical-chat-input.tsx +0 -276
- package/templates/chat-app/components/model-selection-indicator.radix.tsx +0 -17
- package/templates/chat-app/components/ui/resizable.tsx +0 -49
- package/templates/chat-app/lib/ai/gateways/fallback-models.ts +0 -29
- package/templates/chat-app/lib/ai/models.generated.ts +0 -4242
- package/templates/chat-app/lib/ai/usage-token-details.test.ts +0 -76
- package/templates/chat-app/lib/ai/usage-token-details.ts +0 -33
- package/templates/chat-app/lib/chat-route.ts +0 -18
- package/templates/chat-app/providers/parse-chat-id-from-pathname.test.ts +0 -126
- package/templates/chat-app/providers/parse-chat-id-from-pathname.ts +0 -51
- package/templates/chat-app/scripts/fetch-models.ts +0 -30
- package/templates/chat-app/scripts/gateway-snapshot-warning.test.ts +0 -9
- /package/templates/chat-app/chatjs/plugins/attachment-uploads/{integration.tsx → uploads.ts} +0 -0
|
@@ -15,10 +15,13 @@ import { CreationRejectedError } from "@/lib/eve/create-conversation";
|
|
|
15
15
|
import { eveMessageTitle } from "@/lib/eve/message-input";
|
|
16
16
|
import {
|
|
17
17
|
moveRejectedContextCreation,
|
|
18
|
+
readCreationFollowUp,
|
|
18
19
|
readCreationRequest,
|
|
20
|
+
saveCreationFollowUp,
|
|
19
21
|
} from "@/lib/eve/pending-create";
|
|
20
22
|
import type { CreationScope } from "@/lib/eve/pending-create";
|
|
21
23
|
import { resolveCreationRequest } from "@/lib/eve/resolve-creation-request";
|
|
24
|
+
import { useEveRuntime } from "./eve-logical-context";
|
|
22
25
|
|
|
23
26
|
const recoveryStatus = (
|
|
24
27
|
loaded: boolean,
|
|
@@ -57,10 +60,30 @@ const matchesSavedRequest = (
|
|
|
57
60
|
);
|
|
58
61
|
};
|
|
59
62
|
|
|
63
|
+
const emptyRecoveryMessage = (
|
|
64
|
+
{
|
|
65
|
+
loaded,
|
|
66
|
+
pending,
|
|
67
|
+
rejected,
|
|
68
|
+
failure,
|
|
69
|
+
}: {
|
|
70
|
+
readonly loaded: boolean;
|
|
71
|
+
readonly pending: ReturnType<typeof readCreationRequest>;
|
|
72
|
+
readonly rejected: boolean;
|
|
73
|
+
readonly failure: string;
|
|
74
|
+
},
|
|
75
|
+
message: string | undefined,
|
|
76
|
+
initialFailure: string
|
|
77
|
+
): string | undefined =>
|
|
78
|
+
loaded && !pending && !rejected && !failure && !initialFailure
|
|
79
|
+
? message
|
|
80
|
+
: undefined;
|
|
81
|
+
|
|
60
82
|
export const EveCreationRecovery = ({
|
|
61
83
|
ownerId,
|
|
62
84
|
operationId,
|
|
63
85
|
firstMessage,
|
|
86
|
+
missingRequestMessage,
|
|
64
87
|
scope,
|
|
65
88
|
initiallyRejected = false,
|
|
66
89
|
initialFailure = "",
|
|
@@ -68,6 +91,7 @@ export const EveCreationRecovery = ({
|
|
|
68
91
|
}: {
|
|
69
92
|
readonly ownerId: string;
|
|
70
93
|
readonly operationId?: string;
|
|
94
|
+
readonly missingRequestMessage?: string;
|
|
71
95
|
readonly firstMessage: string;
|
|
72
96
|
readonly scope?: Readonly<CreationScope>;
|
|
73
97
|
readonly initiallyRejected?: boolean;
|
|
@@ -78,6 +102,7 @@ export const EveCreationRecovery = ({
|
|
|
78
102
|
const contextLabel = context?.label ?? "context";
|
|
79
103
|
const [, startEventAction] = React.useTransition();
|
|
80
104
|
const router = useRouter();
|
|
105
|
+
const openRuntime = useEveRuntime();
|
|
81
106
|
const lock = useRef(false);
|
|
82
107
|
const [busy, setBusy] = useState(false);
|
|
83
108
|
const store = useMemo(
|
|
@@ -115,11 +140,12 @@ export const EveCreationRecovery = ({
|
|
|
115
140
|
),
|
|
116
141
|
[ownerId, operationId, scope, initiallyRejected]
|
|
117
142
|
);
|
|
118
|
-
const
|
|
143
|
+
const recovery = useSyncExternalStore(
|
|
119
144
|
store.subscribe,
|
|
120
145
|
store.getSnapshot,
|
|
121
146
|
store.getServerSnapshot
|
|
122
147
|
);
|
|
148
|
+
const { pending, rejected, loaded, failure } = recovery;
|
|
123
149
|
const { setRejected, setFailure } = useMemo(
|
|
124
150
|
() => ({
|
|
125
151
|
setRejected: (value: boolean): void => {
|
|
@@ -143,13 +169,28 @@ export const EveCreationRecovery = ({
|
|
|
143
169
|
await withTaskCleanup(
|
|
144
170
|
async () => {
|
|
145
171
|
try {
|
|
146
|
-
const
|
|
172
|
+
const followUpDraft = readCreationFollowUp(
|
|
173
|
+
sessionStorage,
|
|
174
|
+
ownerId,
|
|
175
|
+
scope
|
|
176
|
+
);
|
|
177
|
+
const binding = await resolveCreationRequest(
|
|
147
178
|
sessionStorage,
|
|
148
179
|
ownerId,
|
|
149
180
|
pending,
|
|
150
181
|
scope
|
|
151
182
|
);
|
|
152
|
-
|
|
183
|
+
if (hasText(followUpDraft)) {
|
|
184
|
+
await openRuntime({
|
|
185
|
+
...binding,
|
|
186
|
+
operation: pending,
|
|
187
|
+
ownerId,
|
|
188
|
+
getFollowUpDraft: () => followUpDraft,
|
|
189
|
+
});
|
|
190
|
+
saveCreationFollowUp(sessionStorage, ownerId, "", scope);
|
|
191
|
+
} else {
|
|
192
|
+
globalThis.location.assign(`/chat/${binding.id}`);
|
|
193
|
+
}
|
|
153
194
|
} catch (error) {
|
|
154
195
|
if (
|
|
155
196
|
error instanceof CreationRejectedError &&
|
|
@@ -190,6 +231,15 @@ export const EveCreationRecovery = ({
|
|
|
190
231
|
}
|
|
191
232
|
};
|
|
192
233
|
|
|
234
|
+
const emptyMessage = emptyRecoveryMessage(
|
|
235
|
+
recovery,
|
|
236
|
+
missingRequestMessage,
|
|
237
|
+
initialFailure
|
|
238
|
+
);
|
|
239
|
+
if (hasText(emptyMessage)) {
|
|
240
|
+
return <p className="text-muted-foreground text-sm">{emptyMessage}</p>;
|
|
241
|
+
}
|
|
242
|
+
|
|
193
243
|
const status = recoveryStatus(
|
|
194
244
|
loaded,
|
|
195
245
|
pending !== undefined,
|
|
@@ -11,7 +11,7 @@ import React, { createContext, useCallback, useContext, useState } from "react";
|
|
|
11
11
|
import type { JSX as ReactJSX } from "react";
|
|
12
12
|
|
|
13
13
|
import { useSidebar } from "@/components/ui/sidebar";
|
|
14
|
-
import {
|
|
14
|
+
import { useActiveChatId } from "@/components/chat/chat-navigation";
|
|
15
15
|
import type { ReadonlyReactNode } from "@/lib/readonly-react-node";
|
|
16
16
|
import { useTRPC } from "@/trpc/react";
|
|
17
17
|
|
|
@@ -43,7 +43,7 @@ const EveDeletionProvider = ({
|
|
|
43
43
|
readonly children: ReadonlyReactNode;
|
|
44
44
|
}): ReactJSX.Element => {
|
|
45
45
|
const [conversation, setConversation] = useState<Conversation>();
|
|
46
|
-
const
|
|
46
|
+
const activeChatId = useActiveChatId();
|
|
47
47
|
const router = useRouter();
|
|
48
48
|
const cache = useQueryClient();
|
|
49
49
|
const trpc = useTRPC();
|
|
@@ -58,13 +58,13 @@ const EveDeletionProvider = ({
|
|
|
58
58
|
const changed = async (rootId: string): Promise<void> => {
|
|
59
59
|
await withTaskCleanup(
|
|
60
60
|
async () => {
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
if (hasText(activeChatId)) {
|
|
62
|
+
const response = await fetch(
|
|
63
|
+
`/api/agent-conversations/${activeChatId}`,
|
|
64
|
+
{
|
|
65
|
+
signal: AbortSignal.timeout(10_000),
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
68
|
const status: unknown = await response.json();
|
|
69
69
|
if (
|
|
70
70
|
response.ok &&
|
|
@@ -73,9 +73,7 @@ const EveDeletionProvider = ({
|
|
|
73
73
|
"rootId" in status &&
|
|
74
74
|
status.rootId === rootId
|
|
75
75
|
) {
|
|
76
|
-
router.replace(
|
|
77
|
-
pluginRoute(conversation?.parentHref ?? route.parentHref)
|
|
78
|
-
);
|
|
76
|
+
router.replace(pluginRoute(conversation?.parentHref ?? "/"));
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
79
|
},
|
|
@@ -8,8 +8,7 @@ import {
|
|
|
8
8
|
useQueryClient,
|
|
9
9
|
} from "@tanstack/react-query";
|
|
10
10
|
import { isToday, isYesterday, subMonths, subWeeks } from "date-fns";
|
|
11
|
-
import {
|
|
12
|
-
import { useChatNavigation } from "../chat/chat-navigation";
|
|
11
|
+
import { useActiveChatId } from "../chat/chat-navigation";
|
|
13
12
|
import type { JSX as ReactJSX } from "react";
|
|
14
13
|
import React, { useEffect, useRef } from "react";
|
|
15
14
|
|
|
@@ -24,7 +23,6 @@ import {
|
|
|
24
23
|
import type { listEveConversations } from "@/lib/db/eve-queries";
|
|
25
24
|
import { pendingEveMetadataMutations } from "@/lib/eve/optimistic-metadata";
|
|
26
25
|
import type { ReadonlyNativeSurface } from "@/lib/readonly-native-surface";
|
|
27
|
-
import { parseChatIdFromPathname } from "@/providers/parse-chat-id-from-pathname";
|
|
28
26
|
import { useTRPC } from "@/trpc/react";
|
|
29
27
|
|
|
30
28
|
import { useEveDeletion } from "./eve-deletion-provider";
|
|
@@ -107,14 +105,11 @@ export const EveHistoryList = ({
|
|
|
107
105
|
>
|
|
108
106
|
) => page.items
|
|
109
107
|
) ?? [];
|
|
110
|
-
const
|
|
111
|
-
const navigation = useChatNavigation();
|
|
112
|
-
const route = parseChatIdFromPathname(navigation?.pathname ?? pathname);
|
|
113
|
-
const routeId = route.id;
|
|
108
|
+
const routeId = useActiveChatId();
|
|
114
109
|
const selectedIdentity = useQuery(
|
|
115
110
|
trpc.eve.get.queryOptions(
|
|
116
111
|
{ id: routeId ?? "" },
|
|
117
|
-
{ enabled:
|
|
112
|
+
{ enabled: routeId !== null }
|
|
118
113
|
)
|
|
119
114
|
);
|
|
120
115
|
const hadPendingTitle = useRef(false);
|
|
@@ -206,7 +201,7 @@ export const EveHistoryList = ({
|
|
|
206
201
|
): React.JSX.Element => (
|
|
207
202
|
<div className="[&:not(:first-child)]:mt-6" key={group.label}>
|
|
208
203
|
{group.label && (
|
|
209
|
-
<div className="text-sidebar-foreground/
|
|
204
|
+
<div className="text-sidebar-foreground/65 px-2 py-1 text-xs">
|
|
210
205
|
{group.label}
|
|
211
206
|
</div>
|
|
212
207
|
)}
|
|
@@ -29,6 +29,7 @@ export interface OpenRequest {
|
|
|
29
29
|
readonly chatId?: string;
|
|
30
30
|
readonly title?: string;
|
|
31
31
|
readonly operation?: { readonly message: ReadonlyEveMessageInput };
|
|
32
|
+
readonly getFollowUpDraft?: () => string;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
export const EveRuntimeContext = createContext<
|
|
@@ -6,16 +6,16 @@ import { MessageSiblingsView } from "@/components/message-siblings-view";
|
|
|
6
6
|
import { useLogicalChat } from "./eve-logical-context";
|
|
7
7
|
|
|
8
8
|
export const EveLogicalVersions = ({
|
|
9
|
-
|
|
9
|
+
branchId,
|
|
10
10
|
messageId,
|
|
11
11
|
disabled,
|
|
12
12
|
}: {
|
|
13
|
-
readonly
|
|
13
|
+
readonly branchId: string;
|
|
14
14
|
readonly messageId: string;
|
|
15
15
|
readonly disabled: boolean;
|
|
16
16
|
}): ReactJSX.Element => {
|
|
17
17
|
const { controller } = useLogicalChat();
|
|
18
|
-
const { ids, index } = controller.siblings(
|
|
18
|
+
const { ids, index } = controller.siblings(branchId, messageId);
|
|
19
19
|
const select = (offset: number): void => {
|
|
20
20
|
const id = ids[index + offset];
|
|
21
21
|
if (!disabled && id) {
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { call, callState, part as contentPart, turn } from "eve/events";
|
|
4
|
+
import type { Answer, Interaction, SessionView } from "eve/events";
|
|
5
|
+
import { Fragment, useState } from "react";
|
|
6
|
+
import type { ReactNode } from "react";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
Trace,
|
|
10
|
+
TraceCollapsible,
|
|
11
|
+
TraceCollapsibleContent,
|
|
12
|
+
TraceCollapsibleTrigger,
|
|
13
|
+
TraceDescription,
|
|
14
|
+
TraceLine,
|
|
15
|
+
TraceTitle,
|
|
16
|
+
} from "@/components/ui/trace";
|
|
17
|
+
import type { ReadonlyEveMessagePart } from "@/lib/eve/readonly-message-types";
|
|
18
|
+
import { EveMessagePart } from "./eve-message-part";
|
|
19
|
+
import { EveInteraction } from "./eve-pending-input";
|
|
20
|
+
|
|
21
|
+
type ActivityPart = Extract<
|
|
22
|
+
ReadonlyEveMessagePart,
|
|
23
|
+
{ type: "reasoning" | "tool" }
|
|
24
|
+
>;
|
|
25
|
+
interface MessagePart<Part = ReadonlyEveMessagePart> {
|
|
26
|
+
readonly key: string;
|
|
27
|
+
readonly part: Part;
|
|
28
|
+
}
|
|
29
|
+
type MessageBlock =
|
|
30
|
+
| { readonly kind: "activity"; readonly steps: MessagePart<ActivityPart>[] }
|
|
31
|
+
| {
|
|
32
|
+
readonly kind: "part";
|
|
33
|
+
readonly entry: MessagePart;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const inlineDeliverableTools = new Set([
|
|
37
|
+
"attach_workspace_file",
|
|
38
|
+
"generateImage",
|
|
39
|
+
"generateVideo",
|
|
40
|
+
]);
|
|
41
|
+
|
|
42
|
+
const messageBlocks = (parts: readonly MessagePart[]): MessageBlock[] => {
|
|
43
|
+
const blocks: MessageBlock[] = [];
|
|
44
|
+
for (const { key, part } of parts) {
|
|
45
|
+
// Published files and generated media stay visible when activity is collapsed.
|
|
46
|
+
const isActivity =
|
|
47
|
+
part.type === "reasoning" ||
|
|
48
|
+
(part.type === "tool" &&
|
|
49
|
+
!(part.state === "completed" && inlineDeliverableTools.has(part.name)));
|
|
50
|
+
if (isActivity) {
|
|
51
|
+
const last = blocks.at(-1);
|
|
52
|
+
if (last?.kind === "activity") {
|
|
53
|
+
last.steps.push({ key, part });
|
|
54
|
+
} else {
|
|
55
|
+
blocks.push({ kind: "activity", steps: [{ key, part }] });
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
blocks.push({ kind: "part", entry: { key, part } });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return blocks;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const stepState = (part: ActivityPart, view: SessionView | undefined) =>
|
|
65
|
+
part.type === "tool" && view !== undefined
|
|
66
|
+
? (callState(view, part.callId) ?? part.state)
|
|
67
|
+
: part.state;
|
|
68
|
+
|
|
69
|
+
const duration = (
|
|
70
|
+
steps: readonly MessagePart<ActivityPart>[],
|
|
71
|
+
view: SessionView | undefined
|
|
72
|
+
): string => {
|
|
73
|
+
if (view === undefined) {
|
|
74
|
+
return "";
|
|
75
|
+
}
|
|
76
|
+
const times = steps.flatMap(({ part }) => {
|
|
77
|
+
const observation =
|
|
78
|
+
part.type === "tool"
|
|
79
|
+
? call(view, part.callId)
|
|
80
|
+
: contentPart(view, part.id ?? "");
|
|
81
|
+
if (observation?.startedAt === undefined) {
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
84
|
+
return [
|
|
85
|
+
Date.parse(observation.startedAt),
|
|
86
|
+
Date.parse(observation.endedAt ?? observation.startedAt),
|
|
87
|
+
];
|
|
88
|
+
});
|
|
89
|
+
const seconds = Math.round((Math.max(...times) - Math.min(...times)) / 1000);
|
|
90
|
+
if (!Number.isFinite(seconds) || seconds < 1) {
|
|
91
|
+
return "";
|
|
92
|
+
}
|
|
93
|
+
if (seconds < 60) {
|
|
94
|
+
return ` for ${seconds}s`;
|
|
95
|
+
}
|
|
96
|
+
return ` for ${Math.floor(seconds / 60)}m ${seconds % 60}s`;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const ActivityGroup = ({
|
|
100
|
+
steps,
|
|
101
|
+
view,
|
|
102
|
+
children,
|
|
103
|
+
}: {
|
|
104
|
+
readonly steps: readonly MessagePart<ActivityPart>[];
|
|
105
|
+
readonly view?: SessionView;
|
|
106
|
+
readonly children: ReactNode;
|
|
107
|
+
}): ReactNode => {
|
|
108
|
+
const [open, setOpen] = useState<boolean>();
|
|
109
|
+
if (steps.length === 1) {
|
|
110
|
+
return children;
|
|
111
|
+
}
|
|
112
|
+
const states = steps.map(({ part }) => stepState(part, view));
|
|
113
|
+
const working = states.some(
|
|
114
|
+
(state) =>
|
|
115
|
+
state === "streaming" || state === "running" || state === "requested"
|
|
116
|
+
);
|
|
117
|
+
const waiting = states.some(
|
|
118
|
+
(state) => state === "approval" || state === "blocked"
|
|
119
|
+
);
|
|
120
|
+
const failures = states.filter((state) => state === "failed").length;
|
|
121
|
+
const settledStatus = failures > 0 ? "error" : undefined;
|
|
122
|
+
let title = `Worked${duration(steps, view)}`;
|
|
123
|
+
if (working) {
|
|
124
|
+
title = "Working";
|
|
125
|
+
} else if (waiting) {
|
|
126
|
+
title = "Waiting for you";
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<Trace>
|
|
131
|
+
<TraceCollapsible
|
|
132
|
+
open={open ?? (working || waiting)}
|
|
133
|
+
onOpenChange={setOpen}
|
|
134
|
+
>
|
|
135
|
+
<TraceCollapsibleTrigger>
|
|
136
|
+
<TraceLine status={working ? "running" : settledStatus}>
|
|
137
|
+
<TraceTitle>{title}</TraceTitle>
|
|
138
|
+
<TraceDescription>
|
|
139
|
+
{failures
|
|
140
|
+
? `${failures} of ${steps.length} failed`
|
|
141
|
+
: `${steps.length} steps`}
|
|
142
|
+
</TraceDescription>
|
|
143
|
+
</TraceLine>
|
|
144
|
+
</TraceCollapsibleTrigger>
|
|
145
|
+
<TraceCollapsibleContent className="space-y-2">
|
|
146
|
+
{children}
|
|
147
|
+
</TraceCollapsibleContent>
|
|
148
|
+
</TraceCollapsible>
|
|
149
|
+
</Trace>
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const callInteractions = (
|
|
154
|
+
part: ReadonlyEveMessagePart,
|
|
155
|
+
byCall: ReadonlyMap<string, readonly Interaction[]>
|
|
156
|
+
): readonly Interaction[] => {
|
|
157
|
+
if (part.type !== "tool") {
|
|
158
|
+
return [];
|
|
159
|
+
}
|
|
160
|
+
const interactions = byCall.get(part.callId) ?? [];
|
|
161
|
+
const latest = part.interaction;
|
|
162
|
+
if (latest === undefined) {
|
|
163
|
+
return interactions;
|
|
164
|
+
}
|
|
165
|
+
if (
|
|
166
|
+
!interactions.some(
|
|
167
|
+
({ interactionId }) => interactionId === latest.interactionId
|
|
168
|
+
)
|
|
169
|
+
) {
|
|
170
|
+
return [...interactions, latest];
|
|
171
|
+
}
|
|
172
|
+
return interactions.map((interaction) =>
|
|
173
|
+
interaction.interactionId === latest.interactionId &&
|
|
174
|
+
interaction.status === "open" &&
|
|
175
|
+
latest.status === "open" &&
|
|
176
|
+
interaction.answer === undefined
|
|
177
|
+
? latest
|
|
178
|
+
: interaction
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export const EveMessageContent = ({
|
|
183
|
+
parts,
|
|
184
|
+
messageId,
|
|
185
|
+
isReadonly,
|
|
186
|
+
inputDisabled,
|
|
187
|
+
respond,
|
|
188
|
+
view,
|
|
189
|
+
interactionsByCall,
|
|
190
|
+
}: {
|
|
191
|
+
readonly parts: readonly MessagePart[];
|
|
192
|
+
readonly messageId: string;
|
|
193
|
+
readonly isReadonly: boolean;
|
|
194
|
+
readonly inputDisabled: boolean;
|
|
195
|
+
readonly respond: (response: Answer) => void;
|
|
196
|
+
readonly view?: SessionView;
|
|
197
|
+
readonly interactionsByCall: ReadonlyMap<string, readonly Interaction[]>;
|
|
198
|
+
}) => {
|
|
199
|
+
const renderInteraction = (interaction: Interaction, key: string) => (
|
|
200
|
+
<EveInteraction
|
|
201
|
+
key={key}
|
|
202
|
+
interaction={interaction}
|
|
203
|
+
disabled={
|
|
204
|
+
inputDisabled ||
|
|
205
|
+
(view !== undefined &&
|
|
206
|
+
turn(view, interaction.turnId)?.outcome === "cancelled")
|
|
207
|
+
}
|
|
208
|
+
respond={respond}
|
|
209
|
+
/>
|
|
210
|
+
);
|
|
211
|
+
return messageBlocks(parts).map((block) => {
|
|
212
|
+
if (block.kind === "part") {
|
|
213
|
+
const { key, part } = block.entry;
|
|
214
|
+
return part.type === "interaction" ? (
|
|
215
|
+
renderInteraction(part, key)
|
|
216
|
+
) : (
|
|
217
|
+
<Fragment key={key}>
|
|
218
|
+
<EveMessagePart
|
|
219
|
+
messageId={messageId}
|
|
220
|
+
isReadonly={isReadonly}
|
|
221
|
+
part={part}
|
|
222
|
+
/>
|
|
223
|
+
{callInteractions(part, interactionsByCall).map((interaction) =>
|
|
224
|
+
renderInteraction(interaction, interaction.interactionId)
|
|
225
|
+
)}
|
|
226
|
+
</Fragment>
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const { steps } = block;
|
|
231
|
+
return (
|
|
232
|
+
<Fragment key={steps[0]?.key}>
|
|
233
|
+
<ActivityGroup steps={steps} view={view}>
|
|
234
|
+
{steps.map(({ key, part }) => (
|
|
235
|
+
<EveMessagePart
|
|
236
|
+
key={key}
|
|
237
|
+
messageId={messageId}
|
|
238
|
+
isReadonly={isReadonly}
|
|
239
|
+
part={part}
|
|
240
|
+
compact={steps.length > 1}
|
|
241
|
+
/>
|
|
242
|
+
))}
|
|
243
|
+
</ActivityGroup>
|
|
244
|
+
{steps
|
|
245
|
+
.flatMap(({ part }) => callInteractions(part, interactionsByCall))
|
|
246
|
+
.map((interaction) =>
|
|
247
|
+
renderInteraction(interaction, interaction.interactionId)
|
|
248
|
+
)}
|
|
249
|
+
</Fragment>
|
|
250
|
+
);
|
|
251
|
+
});
|
|
252
|
+
};
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
import { eveToolUIState } from "@/lib/eve/tool-ui-state";
|
|
3
3
|
|
|
4
4
|
import React from "react";
|
|
5
|
-
import type { Answer } from "eve/events";
|
|
6
5
|
import { Response } from "@/components/ai-elements/response";
|
|
7
6
|
import { ToolInput, ToolOutput } from "@/components/part/tool-data";
|
|
8
7
|
import { ToolActivity } from "@/components/part/tool-activity";
|
|
9
8
|
import { ReasoningPart } from "@/components/part/message-reasoning";
|
|
10
|
-
import { EvePendingInput } from "./eve-pending-input";
|
|
11
9
|
import { eveMcpResult } from "@/lib/eve/mcp-result";
|
|
12
10
|
import { getEveInstalledToolRenderer } from "@/lib/ai/tool-renderer-registry";
|
|
13
11
|
import type { ReadonlyEveMessagePart } from "@/lib/eve/readonly-message-types";
|
|
@@ -47,32 +45,15 @@ const toolStatus = (
|
|
|
47
45
|
|
|
48
46
|
const ToolFallback = ({
|
|
49
47
|
part,
|
|
50
|
-
|
|
51
|
-
respond,
|
|
48
|
+
compact,
|
|
52
49
|
}: {
|
|
53
50
|
readonly part: Extract<ReadonlyEveMessagePart, { type: "tool" }>;
|
|
54
|
-
readonly
|
|
55
|
-
readonly respond: (response: Answer) => void;
|
|
51
|
+
readonly compact: boolean;
|
|
56
52
|
}): React.JSX.Element => {
|
|
57
|
-
const request = part.interaction
|
|
58
|
-
? {
|
|
59
|
-
...part.interaction.request,
|
|
60
|
-
interactionId: part.interaction.interactionId,
|
|
61
|
-
}
|
|
62
|
-
: undefined;
|
|
63
53
|
let content: React.ReactNode = (
|
|
64
54
|
<p className="text-muted-foreground text-sm">{toolStatus(part)}</p>
|
|
65
55
|
);
|
|
66
|
-
if (part.
|
|
67
|
-
content = (
|
|
68
|
-
<EvePendingInput
|
|
69
|
-
disabled={disabled}
|
|
70
|
-
key={request.interactionId}
|
|
71
|
-
request={request}
|
|
72
|
-
respond={respond}
|
|
73
|
-
/>
|
|
74
|
-
);
|
|
75
|
-
} else if (part.state === "failed") {
|
|
56
|
+
if (part.state === "failed") {
|
|
76
57
|
content = <ToolOutput errorText={part.error?.message ?? "Tool failed"} />;
|
|
77
58
|
} else if (part.state === "completed" && part.output !== undefined) {
|
|
78
59
|
const bash =
|
|
@@ -90,7 +71,7 @@ const ToolFallback = ({
|
|
|
90
71
|
<ToolActivity
|
|
91
72
|
title={part.name}
|
|
92
73
|
state={eveToolUIState(part.state)}
|
|
93
|
-
defaultOpen
|
|
74
|
+
defaultOpen={!compact}
|
|
94
75
|
>
|
|
95
76
|
{part.name === "bash" &&
|
|
96
77
|
typeof part.input === "object" &&
|
|
@@ -99,28 +80,26 @@ const ToolFallback = ({
|
|
|
99
80
|
typeof part.input.command === "string" ? (
|
|
100
81
|
<CodeSnippet code={part.input.command} language="bash" />
|
|
101
82
|
) : (
|
|
102
|
-
<ToolInput
|
|
83
|
+
<ToolInput
|
|
84
|
+
input={part.state === "streaming" ? part.inputText : part.input}
|
|
85
|
+
/>
|
|
103
86
|
)}
|
|
104
87
|
{content}
|
|
105
88
|
</ToolActivity>
|
|
106
89
|
);
|
|
107
90
|
};
|
|
108
91
|
|
|
109
|
-
// This renderer handles all streamed EVE part variants and their recovery states.
|
|
110
|
-
|
|
111
92
|
export const EveMessagePart = ({
|
|
112
93
|
messageId,
|
|
113
94
|
isReadonly,
|
|
114
95
|
part,
|
|
115
|
-
|
|
116
|
-
inputDisabled,
|
|
96
|
+
compact = false,
|
|
117
97
|
}: {
|
|
118
98
|
readonly messageId: string;
|
|
119
99
|
readonly isReadonly: boolean;
|
|
120
|
-
readonly part: ReadonlyEveMessagePart
|
|
121
|
-
readonly
|
|
122
|
-
|
|
123
|
-
}): React.JSX.Element | null => {
|
|
100
|
+
readonly part: Exclude<ReadonlyEveMessagePart, { type: "interaction" }>;
|
|
101
|
+
readonly compact?: boolean;
|
|
102
|
+
}): React.JSX.Element => {
|
|
124
103
|
if (part.type === "text") {
|
|
125
104
|
return <Response>{part.text}</Response>;
|
|
126
105
|
}
|
|
@@ -135,26 +114,8 @@ export const EveMessagePart = ({
|
|
|
135
114
|
/>
|
|
136
115
|
);
|
|
137
116
|
}
|
|
138
|
-
if (part.type === "interaction") {
|
|
139
|
-
return part.status === "open" ? (
|
|
140
|
-
<EvePendingInput
|
|
141
|
-
request={{ ...part.request, interactionId: part.interactionId }}
|
|
142
|
-
disabled={inputDisabled || isReadonly}
|
|
143
|
-
respond={respond}
|
|
144
|
-
/>
|
|
145
|
-
) : null;
|
|
146
|
-
}
|
|
147
|
-
if (part.type !== "tool") {
|
|
148
|
-
return <p>Unsupported content in this conversation.</p>;
|
|
149
|
-
}
|
|
150
117
|
if (part.state === "approval" || part.state === "blocked") {
|
|
151
|
-
return
|
|
152
|
-
<ToolFallback
|
|
153
|
-
part={part}
|
|
154
|
-
disabled={inputDisabled || isReadonly}
|
|
155
|
-
respond={respond}
|
|
156
|
-
/>
|
|
157
|
-
);
|
|
118
|
+
return <ToolFallback part={part} compact={compact} />;
|
|
158
119
|
}
|
|
159
120
|
if (hasStructuredToolRenderer(part)) {
|
|
160
121
|
return (
|
|
@@ -172,11 +133,5 @@ export const EveMessagePart = ({
|
|
|
172
133
|
) {
|
|
173
134
|
return <EveMcpResult part={part} />;
|
|
174
135
|
}
|
|
175
|
-
return
|
|
176
|
-
<ToolFallback
|
|
177
|
-
part={part}
|
|
178
|
-
disabled={inputDisabled || isReadonly}
|
|
179
|
-
respond={respond}
|
|
180
|
-
/>
|
|
181
|
-
);
|
|
136
|
+
return <ToolFallback part={part} compact={compact} />;
|
|
182
137
|
};
|