chat-js 1.0.0-alpha.2 → 1.0.0-alpha.4
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 +6 -4
- package/dist/index.js +2627 -2667
- package/package.json +10 -4
- package/templates/chat-app/.env.example +2 -8
- package/templates/chat-app/agent/agent.ts +8 -38
- package/templates/chat-app/agent/channels/eve.ts +37 -17
- package/templates/chat-app/agent/hooks/activity.ts +2 -1
- package/templates/chat-app/agent/hooks/billing.ts +11 -8
- package/templates/chat-app/agent/hooks/conversation.ts +2 -2
- package/templates/chat-app/agent/hooks/tool-selection.ts +7 -1
- package/templates/chat-app/agent/instructions/chat.ts +14 -10
- package/templates/chat-app/agent/sandbox.ts +2 -4
- package/templates/chat-app/agent/tools/installed.ts +19 -1
- package/templates/chat-app/app/(chat)/layout.tsx +10 -8
- package/templates/chat-app/app/api/agent-conversations/[id]/route.test.ts +1 -1
- package/templates/chat-app/app/api/agent-conversations/[id]/route.ts +1 -5
- package/templates/chat-app/app/api/agent-conversations/route.test.ts +31 -2
- package/templates/chat-app/app/api/agent-conversations/route.ts +10 -1
- package/templates/chat-app/app/api/agent-workspaces/[id]/route.test.ts +5 -31
- package/templates/chat-app/app/api/agent-workspaces/[id]/route.ts +2 -10
- package/templates/chat-app/app/api/eve/[...path]/route.test.ts +2 -2
- package/templates/chat-app/app/apple-icon.png +0 -0
- package/templates/chat-app/app/favicon.ico +0 -0
- package/templates/chat-app/app/icon.svg +1 -3
- package/templates/chat-app/app/opengraph-image.alt.txt +1 -0
- package/templates/chat-app/app/opengraph-image.png +0 -0
- package/templates/chat-app/chat.config.ts +0 -18
- package/templates/chat-app/chatjs/core/chat/compose.ts +35 -11
- package/templates/chat-app/chatjs/core/chat/contracts.ts +6 -0
- package/templates/chat-app/chatjs/core/installation/contracts.ts +1 -4
- package/templates/chat-app/chatjs/core/session/contracts.ts +19 -4
- package/templates/chat-app/chatjs/generated/composer-tools.ts +5 -12
- package/templates/chat-app/chatjs/generated/installed-chat-ui.ts +11 -5
- package/templates/chat-app/chatjs/generated/installed-config.ts +5 -13
- package/templates/chat-app/chatjs/generated/installed-instrumentation.ts +1 -2
- package/templates/chat-app/chatjs/generated/installed-layout.ts +1 -7
- package/templates/chat-app/chatjs/generated/installed-tools.ts +3 -3
- package/templates/chat-app/chatjs/generated/installed.ts +3 -3
- package/templates/chat-app/chatjs/generated/providers.ts +5 -11
- package/templates/chat-app/chatjs/generated/tool-availability.ts +3 -7
- package/templates/chat-app/chatjs/generated/tool-definitions.ts +3 -4
- package/templates/chat-app/chatjs/generated/tool-requirements.ts +40 -0
- package/templates/chat-app/chatjs/generated/tools.ts +7 -28
- package/templates/chat-app/chatjs/generated/ui.ts +3 -13
- package/templates/chat-app/chatjs/plugins/ai-titles/generate-title.ts +0 -2
- package/templates/chat-app/chatjs/plugins/attachment-uploads/chatjs.json +0 -1
- package/templates/chat-app/chatjs/plugins/guest-chat/session-profile.ts +2 -0
- package/templates/chat-app/chatjs/plugins/guest-chat/signed-out.tsx +70 -34
- package/templates/chat-app/chatjs/plugins/image-viewer/chatjs.json +17 -0
- package/templates/chat-app/chatjs/plugins/image-viewer/client-plugin.ts +9 -0
- package/templates/chat-app/{components → chatjs/plugins/image-viewer}/image-modal.tsx +3 -87
- package/templates/chat-app/chatjs/plugins/image-viewer/viewer-action.tsx +47 -0
- package/templates/chat-app/chatjs/plugins/mcp/composer.tsx +1 -6
- package/templates/chat-app/chatjs/plugins/projects/ui/chat-contributions.tsx +22 -2
- package/templates/chat-app/chatjs/plugins/projects/ui/sidebar-project-item.tsx +48 -33
- package/templates/chat-app/chatjs/plugins/projects/ui/sidebar-projects.tsx +41 -22
- package/templates/chat-app/chatjs/plugins/search/chat.ts +4 -0
- package/templates/chat-app/chatjs/plugins/search/search-chats.tsx +9 -3
- package/templates/chat-app/chatjs/plugins/search/search-hook.ts +5 -6
- package/templates/chat-app/chatjs/plugins/search/search-results-view.tsx +1 -1
- package/templates/chat-app/chatjs/plugins/search/search-text.ts +21 -15
- package/templates/chat-app/chatjs/plugins/search/sidebar-item.tsx +7 -1
- package/templates/chat-app/chatjs/plugins/sharing/ui/share-button.tsx +13 -3
- package/templates/chat-app/chatjs/plugins/sharing/ui/shared-page.tsx +23 -39
- package/templates/chat-app/chatjs/plugins/sharing/ui/transcript-messages.tsx +2 -2
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/chatjs.json +18 -0
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/client-plugin.ts +9 -0
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/load.ts +120 -0
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/preview.tsx +72 -0
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/viewer-action.tsx +97 -0
- package/templates/chat-app/chatjs/plugins/video-viewer/chatjs.json +16 -0
- package/templates/chat-app/chatjs/plugins/video-viewer/client-plugin.ts +9 -0
- package/templates/chat-app/chatjs/plugins/video-viewer/viewer-action.tsx +64 -0
- package/templates/chat-app/chatjs/tools/_shared/lib/define-tool-renderer.test.ts +16 -22
- package/templates/chat-app/chatjs/tools/attach-workspace-file/attach-conversation-file.ts +34 -0
- package/templates/chat-app/chatjs/tools/attach-workspace-file/attach.ts +106 -0
- package/templates/chat-app/chatjs/tools/attach-workspace-file/chatjs.json +19 -0
- package/templates/chat-app/chatjs/tools/attach-workspace-file/import.ts +71 -0
- package/templates/chat-app/chatjs/tools/attach-workspace-file/renderer.tsx +19 -0
- package/templates/chat-app/chatjs/tools/attach-workspace-file/schemas.ts +51 -0
- package/templates/chat-app/chatjs/tools/attach-workspace-file/tool.ts +62 -0
- package/templates/chat-app/chatjs/tools/deep-research/chatjs.json +18 -4
- package/templates/chat-app/chatjs/tools/deep-research/progress-panel.tsx +2 -31
- package/templates/chat-app/chatjs/tools/deep-research/renderer.tsx +7 -19
- package/templates/chat-app/chatjs/tools/deep-research/schemas.ts +1 -46
- package/templates/chat-app/chatjs/tools/deep-research/task.tsx +0 -41
- package/templates/chat-app/chatjs/tools/deep-research/tasks.tsx +2 -7
- package/templates/chat-app/chatjs/tools/generate-image/chatjs.json +4 -1
- package/templates/chat-app/chatjs/tools/generate-image/image-generation.ts +0 -1
- package/templates/chat-app/chatjs/tools/generate-image/renderer.tsx +39 -51
- package/templates/chat-app/chatjs/tools/generate-video/chatjs.json +4 -1
- package/templates/chat-app/chatjs/tools/generate-video/renderer.tsx +22 -11
- package/templates/chat-app/components/ai-elements/response.tsx +1 -1
- package/templates/chat-app/components/app-sidebar.tsx +26 -86
- package/templates/chat-app/components/artifact-actions.tsx +19 -0
- package/templates/chat-app/components/artifact-download-action.tsx +59 -0
- package/templates/chat-app/components/attachment-card.tsx +15 -9
- package/templates/chat-app/components/chat/chat-account.tsx +189 -0
- package/templates/chat-app/components/{controlled-chat-composer.tsx → chat/chat-composer.tsx} +6 -6
- package/templates/chat-app/components/chat/chat-conversation-screen.tsx +75 -0
- package/templates/chat-app/components/chat/chat-conversation.tsx +35 -0
- package/templates/chat-app/components/chat/chat-header.tsx +52 -0
- package/templates/chat-app/components/chat/chat-message-editor.tsx +24 -0
- package/templates/chat-app/components/chat/chat-navigation.tsx +11 -0
- package/templates/chat-app/components/chat/chat-sidebar.tsx +134 -0
- package/templates/chat-app/components/{eve/eve-messages.tsx → chat/chat-transcript.tsx} +7 -28
- package/templates/chat-app/components/chat/chat-workspace.tsx +19 -0
- package/templates/chat-app/components/chat/connected-chat-sidebar.tsx +8 -0
- package/templates/chat-app/components/chat-header-view.tsx +14 -13
- package/templates/chat-app/components/chat-slots.tsx +13 -3
- package/templates/chat-app/components/composer/active-tool.tsx +3 -1
- package/templates/chat-app/components/composer/composer-menu.tsx +4 -2
- package/templates/chat-app/components/composer/control.ts +4 -1
- package/templates/chat-app/components/composer/prompt-form.tsx +1 -1
- package/templates/chat-app/components/composer/tool-availability.tsx +8 -0
- package/templates/chat-app/components/composer/tool-controls.tsx +17 -50
- package/templates/chat-app/components/composer/tool-display.ts +3 -2
- package/templates/chat-app/components/eve/bash-output.tsx +33 -0
- package/templates/chat-app/components/eve/eve-chat-page.tsx +5 -26
- package/templates/chat-app/components/eve/eve-composer.tsx +11 -8
- package/templates/chat-app/components/eve/eve-conversation.tsx +237 -309
- package/templates/chat-app/components/eve/eve-deletion-provider.tsx +1 -1
- package/templates/chat-app/components/eve/eve-history-list.tsx +7 -3
- package/templates/chat-app/components/eve/eve-message-part.tsx +28 -22
- package/templates/chat-app/components/eve/eve-pending-input.tsx +54 -1
- package/templates/chat-app/components/eve/eve-runtime-provider.tsx +0 -5
- package/templates/chat-app/components/eve/new-conversation-view.tsx +7 -3
- package/templates/chat-app/components/file-artifact-card.tsx +37 -0
- package/templates/chat-app/components/header-actions.tsx +9 -2
- package/templates/chat-app/components/image-actions.tsx +93 -0
- package/templates/chat-app/components/internal-link.tsx +15 -2
- package/templates/chat-app/components/keyboard-shortcuts.tsx +8 -2
- package/templates/chat-app/components/part/tool-activity.tsx +1 -1
- package/templates/chat-app/components/part/tool-data.tsx +1 -1
- package/templates/chat-app/components/sidebar-user-nav.tsx +35 -198
- package/templates/chat-app/components/video-player.tsx +43 -0
- package/templates/chat-app/composer-controls.ts +0 -4
- package/templates/chat-app/docs/guest-sessions.md +1 -1
- package/templates/chat-app/instrumentation.ts +2 -6
- package/templates/chat-app/integrations/chat/models.ts +10 -0
- package/templates/chat-app/integrations/tools/catalog.ts +0 -3
- package/templates/chat-app/lib/ai/app-models.test.ts +13 -1
- package/templates/chat-app/lib/ai/app-models.ts +13 -3
- package/templates/chat-app/lib/ai/tool-context.ts +1 -14
- package/templates/chat-app/lib/ai/tool-renderer-registry.ts +10 -5
- package/templates/chat-app/lib/db/eve-current-copy.ts +13 -95
- package/templates/chat-app/lib/db/eve-deletion.ts +2 -61
- package/templates/chat-app/lib/db/eve-dispatch.ts +64 -18
- package/templates/chat-app/lib/db/eve-file-purge.ts +11 -145
- package/templates/chat-app/lib/db/eve-files.ts +11 -9
- package/templates/chat-app/lib/db/eve-orphaned-files.ts +3 -22
- package/templates/chat-app/lib/db/eve-queries.ts +32 -16
- package/templates/chat-app/lib/db/eve-workspace-deletion.ts +149 -0
- package/templates/chat-app/lib/db/migrate.ts +30 -0
- package/templates/chat-app/lib/db/migrations/0024_abandoned_toxin.sql +67 -0
- package/templates/chat-app/lib/db/migrations/0025_cloudy_thunderbolt.sql +1 -0
- package/templates/chat-app/lib/db/migrations/0026_loving_mesmero.sql +3 -0
- package/templates/chat-app/lib/db/migrations/0027_misty_stephen_strange.sql +1 -0
- package/templates/chat-app/lib/db/migrations/0028_faithful_hannibal_king.sql +12 -0
- package/templates/chat-app/lib/db/migrations/meta/0024_snapshot.json +4119 -0
- package/templates/chat-app/lib/db/migrations/meta/0025_snapshot.json +3988 -0
- package/templates/chat-app/lib/db/migrations/meta/0026_snapshot.json +3686 -0
- package/templates/chat-app/lib/db/migrations/meta/0027_snapshot.json +3596 -0
- package/templates/chat-app/lib/db/migrations/meta/0028_snapshot.json +2554 -0
- package/templates/chat-app/lib/db/migrations/meta/_journal.json +35 -0
- package/templates/chat-app/lib/db/schema.ts +1 -360
- package/templates/chat-app/lib/env-schema.ts +0 -7
- package/templates/chat-app/lib/eve/application-model.ts +56 -0
- package/templates/chat-app/lib/eve/bash-result.ts +22 -0
- package/templates/chat-app/lib/eve/branch-history.test.ts +59 -0
- package/templates/chat-app/lib/eve/branch-history.ts +19 -0
- package/templates/chat-app/lib/eve/channel-files.test.ts +14 -11
- package/templates/chat-app/lib/eve/channel-files.ts +2 -12
- package/templates/chat-app/lib/eve/completed-copy-source.test.ts +81 -17
- package/templates/chat-app/lib/eve/completed-copy-source.ts +2 -6
- package/templates/chat-app/lib/eve/connection-options.ts +7 -7
- package/templates/chat-app/lib/eve/contracts.test.ts +1 -1
- package/templates/chat-app/lib/eve/copy-seed.test.ts +17 -28
- package/templates/chat-app/lib/eve/copy-seed.ts +8 -34
- package/templates/chat-app/lib/eve/copy-transcript.test.ts +143 -47
- package/templates/chat-app/lib/eve/copy-transcript.ts +20 -101
- package/templates/chat-app/lib/eve/create-conversation-operation.test.ts +11 -31
- package/templates/chat-app/lib/eve/create-conversation-operation.ts +0 -10
- package/templates/chat-app/lib/eve/delete-local-conversation.test.ts +12 -20
- package/templates/chat-app/lib/eve/delete-local-conversation.ts +2 -8
- package/templates/chat-app/lib/eve/environment.test.ts +7 -0
- package/templates/chat-app/lib/eve/environment.ts +11 -0
- package/templates/chat-app/lib/eve/execute-conversation-creation.ts +3 -55
- package/templates/chat-app/lib/eve/gateway-auth.test.ts +2 -21
- package/templates/chat-app/lib/eve/gateway-auth.ts +7 -13
- 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/installed-tools.test.ts +16 -9
- package/templates/chat-app/lib/eve/lifecycle/postgres/compatibility.ts +8 -5
- package/templates/chat-app/lib/eve/lifecycle/postgres/eve-payload-purge.ts +6 -2
- package/templates/chat-app/lib/eve/lifecycle/postgres/eve-queue-fence.ts +2 -2
- package/templates/chat-app/lib/eve/lifecycle/postgres/eve-queue-inventory.ts +2 -2
- package/templates/chat-app/lib/eve/lifecycle/postgres/eve-queue-purge.ts +3 -2
- package/templates/chat-app/lib/eve/lifecycle/postgres/eve-resource-fence.ts +2 -8
- package/templates/chat-app/lib/eve/lifecycle/postgres/eve-run-inventory.ts +1 -1
- package/templates/chat-app/lib/eve/lifecycle/postgres/eve-stream-positions.ts +9 -4
- package/templates/chat-app/lib/eve/logical-chat.test.ts +4 -3
- package/templates/chat-app/lib/eve/logical-chat.ts +8 -8
- package/templates/chat-app/lib/eve/message-delivery.test.ts +1 -1
- package/templates/chat-app/lib/eve/message-display.test.ts +5 -5
- package/templates/chat-app/lib/eve/message-display.ts +31 -1
- package/templates/chat-app/lib/eve/message-tool-selection.test.ts +2 -2
- package/templates/chat-app/lib/eve/model-accounting.test.ts +28 -45
- package/templates/chat-app/lib/eve/model-accounting.ts +8 -54
- package/templates/chat-app/lib/eve/purge-files.ts +0 -13
- package/templates/chat-app/lib/eve/purge-local-resources.ts +4 -47
- package/templates/chat-app/lib/eve/readonly-message-types.ts +8 -3
- package/templates/chat-app/lib/eve/reconcile-workspace-turn.ts +2 -37
- package/templates/chat-app/lib/eve/response-group-lineage.test.ts +3 -3
- package/templates/chat-app/lib/eve/retire-session.test.ts +25 -8
- package/templates/chat-app/lib/eve/retire-session.ts +10 -4
- package/templates/chat-app/lib/eve/selected-tools.ts +7 -18
- package/templates/chat-app/lib/eve/server.test.ts +29 -3
- package/templates/chat-app/lib/eve/session-profile.test.ts +12 -9
- package/templates/chat-app/lib/eve/session-profile.ts +7 -4
- package/templates/chat-app/lib/eve/shared-messages.test.ts +3 -4
- package/templates/chat-app/lib/eve/shared-messages.ts +5 -2
- package/templates/chat-app/lib/eve/tool-accounting.test.ts +131 -0
- package/templates/chat-app/lib/eve/tool-accounting.ts +96 -0
- package/templates/chat-app/lib/eve/tool-availability.ts +4 -1
- package/templates/chat-app/lib/eve/tool-configuration.ts +29 -0
- package/templates/chat-app/lib/eve/tool-result.ts +1 -1
- package/templates/chat-app/lib/eve/turn-tools.ts +3 -12
- package/templates/chat-app/lib/eve/usage.test.ts +54 -39
- package/templates/chat-app/lib/eve/usage.ts +9 -1
- package/templates/chat-app/lib/eve/workspace-turn-evidence.test.ts +8 -6
- package/templates/chat-app/lib/eve/workspace-turn-evidence.ts +0 -5
- package/templates/chat-app/lib/required-credentials.test.ts +2 -2
- package/templates/chat-app/lib/tool-readiness.test.ts +69 -0
- package/templates/chat-app/lib/tool-readiness.ts +43 -0
- package/templates/chat-app/logo.svg +1 -1
- package/templates/chat-app/next.config.ts +1 -5
- package/templates/chat-app/oxlint.config.ts +3 -6
- package/templates/chat-app/package.json +4 -16
- package/templates/chat-app/providers/chat-models-provider.tsx +3 -3
- package/templates/chat-app/providers/default-model-provider.tsx +4 -4
- package/templates/chat-app/providers/session-context.ts +24 -0
- package/templates/chat-app/providers/session-provider.tsx +4 -21
- package/templates/chat-app/scripts/agent-status.ts +124 -0
- package/templates/chat-app/scripts/check-env.ts +0 -10
- package/templates/chat-app/scripts/dev-supervisor.mts +3 -30
- package/templates/chat-app/scripts/eve-setup.ts +3 -0
- package/templates/chat-app/tests/helpers/eve-dynamic-context.ts +2 -0
- package/templates/chat-app/tools/platform/research-updates-schema.ts +1 -20
- package/templates/chat-app/trpc/context.tsx +8 -0
- package/templates/chat-app/trpc/react.tsx +3 -4
- package/templates/chat-app/trpc/routers/eve.router.ts +2 -74
- package/templates/chat-app/vendor/workflow-world-postgres-5.1.1.tgz +0 -0
- package/templates/electron/icon.png +0 -0
- package/templates/electron/package.json +2 -1
- package/templates/electron/src/application.test.ts +347 -0
- package/templates/electron/src/application.ts +849 -0
- package/templates/electron/src/lib/auth-cookies.ts +1 -1
- package/templates/electron/src/main.test.ts +175 -0
- package/templates/electron/src/main.ts +5 -745
- package/templates/electron/src/squirrel-startup.ts +61 -0
- package/templates/chat-app/agent/hooks/persistent-sandbox.ts +0 -14
- package/templates/chat-app/app/api/agent-conversation-copies/route.test.ts +0 -190
- package/templates/chat-app/app/api/agent-conversation-copies/route.ts +0 -105
- package/templates/chat-app/chatjs/core/documents/compose-views.ts +0 -12
- package/templates/chat-app/chatjs/core/documents/contracts.ts +0 -91
- package/templates/chat-app/chatjs/core/documents/document-definition.test.ts +0 -60
- package/templates/chat-app/chatjs/core/documents/document-definition.ts +0 -55
- package/templates/chat-app/chatjs/core/documents/ui.ts +0 -67
- package/templates/chat-app/chatjs/generated/code-executor.ts +0 -6
- package/templates/chat-app/chatjs/generated/document-run.ts +0 -12
- package/templates/chat-app/chatjs/generated/document-ui.ts +0 -7
- package/templates/chat-app/chatjs/generated/documents.ts +0 -6
- package/templates/chat-app/chatjs/plugins/langfuse/chatjs.json +0 -14
- package/templates/chat-app/chatjs/plugins/langfuse/credentials.ts +0 -22
- package/templates/chat-app/chatjs/plugins/langfuse/instrumentation.ts +0 -22
- package/templates/chat-app/chatjs/plugins/langfuse/server-plugin.ts +0 -5
- package/templates/chat-app/chatjs/plugins/vercel-analytics/chatjs.json +0 -15
- package/templates/chat-app/chatjs/plugins/vercel-analytics/client-plugin.ts +0 -9
- package/templates/chat-app/chatjs/plugins/vercel-analytics/component.tsx +0 -5
- package/templates/chat-app/chatjs/plugins/vercel-speed-insights/chatjs.json +0 -15
- package/templates/chat-app/chatjs/plugins/vercel-speed-insights/client-plugin.ts +0 -9
- package/templates/chat-app/chatjs/plugins/vercel-speed-insights/component.tsx +0 -4
- package/templates/chat-app/chatjs/providers/sandbox/adapter.ts +0 -232
- package/templates/chat-app/chatjs/providers/sandbox/options.ts +0 -13
- package/templates/chat-app/chatjs/providers/sandbox/persistent.ts +0 -258
- package/templates/chat-app/chatjs/providers/sandbox/provider.ts +0 -27
- package/templates/chat-app/chatjs/providers/sandbox/vercel-sandbox-env.ts +0 -22
- package/templates/chat-app/chatjs/tools/_shared/code-execution/code-execution-chart.tsx +0 -83
- package/templates/chat-app/chatjs/tools/_shared/code-execution/interactive-chart-impl.tsx +0 -290
- package/templates/chat-app/chatjs/tools/_shared/code-execution/interactive-charts.tsx +0 -24
- package/templates/chat-app/chatjs/tools/_shared/code-execution/javascript.ts +0 -222
- package/templates/chat-app/chatjs/tools/_shared/code-execution/python.ts +0 -381
- package/templates/chat-app/chatjs/tools/_shared/code-execution/types.ts +0 -27
- package/templates/chat-app/chatjs/tools/code-documents/assistant-actions.ts +0 -16
- package/templates/chat-app/chatjs/tools/code-documents/chatjs.json +0 -20
- package/templates/chat-app/chatjs/tools/code-documents/configuration-schema.ts +0 -7
- package/templates/chat-app/chatjs/tools/code-documents/definition.ts +0 -9
- package/templates/chat-app/chatjs/tools/code-documents/document.tsx +0 -33
- package/templates/chat-app/chatjs/tools/code-documents/editor.tsx +0 -144
- package/templates/chat-app/chatjs/tools/code-documents/guidelines.ts +0 -15
- package/templates/chat-app/chatjs/tools/code-documents/tool.ts +0 -54
- package/templates/chat-app/chatjs/tools/code-execution/chatjs.json +0 -21
- package/templates/chat-app/chatjs/tools/code-execution/python.test.ts +0 -207
- package/templates/chat-app/chatjs/tools/code-execution/renderer.test.tsx +0 -142
- package/templates/chat-app/chatjs/tools/code-execution/renderer.tsx +0 -68
- package/templates/chat-app/chatjs/tools/code-execution/schemas.ts +0 -23
- package/templates/chat-app/chatjs/tools/code-execution/tool.ts +0 -93
- package/templates/chat-app/chatjs/tools/deep-research/agent.ts +0 -18
- package/templates/chat-app/chatjs/tools/deep-research/availability.ts +0 -23
- package/templates/chat-app/chatjs/tools/deep-research/configuration-schema.ts +0 -36
- package/templates/chat-app/chatjs/tools/deep-research/configuration.ts +0 -22
- package/templates/chat-app/chatjs/tools/deep-research/prompts.ts +0 -280
- package/templates/chat-app/chatjs/tools/deep-research/search-updates.ts +0 -76
- package/templates/chat-app/chatjs/tools/deep-research/steps.ts +0 -92
- package/templates/chat-app/chatjs/tools/delete-document/availability.ts +0 -13
- package/templates/chat-app/chatjs/tools/delete-document/chatjs.json +0 -9
- package/templates/chat-app/chatjs/tools/delete-document/execute.ts +0 -78
- package/templates/chat-app/chatjs/tools/delete-document/schemas.ts +0 -18
- package/templates/chat-app/chatjs/tools/delete-document/tool.ts +0 -49
- package/templates/chat-app/chatjs/tools/get-weather/chatjs.json +0 -14
- package/templates/chat-app/chatjs/tools/get-weather/definition.ts +0 -10
- package/templates/chat-app/chatjs/tools/get-weather/renderer.test.tsx +0 -57
- package/templates/chat-app/chatjs/tools/get-weather/renderer.tsx +0 -290
- package/templates/chat-app/chatjs/tools/get-weather/schemas.ts +0 -51
- package/templates/chat-app/chatjs/tools/get-weather/tool.ts +0 -34
- package/templates/chat-app/chatjs/tools/read-document/chatjs.json +0 -8
- package/templates/chat-app/chatjs/tools/read-document/tool.ts +0 -27
- package/templates/chat-app/chatjs/tools/retrieve-url/chatjs.json +0 -11
- package/templates/chat-app/chatjs/tools/retrieve-url/renderer.tsx +0 -200
- package/templates/chat-app/chatjs/tools/retrieve-url/retrieve-url-env.ts +0 -11
- package/templates/chat-app/chatjs/tools/retrieve-url/schemas.ts +0 -24
- package/templates/chat-app/chatjs/tools/retrieve-url/tool.test.ts +0 -144
- package/templates/chat-app/chatjs/tools/retrieve-url/tool.ts +0 -169
- package/templates/chat-app/chatjs/tools/saved-code-execution/chatjs.json +0 -12
- package/templates/chat-app/chatjs/tools/saved-code-execution/document-runs.ts +0 -31
- package/templates/chat-app/chatjs/tools/saved-code-execution/document.tsx +0 -84
- package/templates/chat-app/chatjs/tools/saved-code-execution/execute.ts +0 -126
- package/templates/chat-app/chatjs/tools/saved-code-execution/renderer.tsx +0 -30
- package/templates/chat-app/chatjs/tools/saved-code-execution/result.tsx +0 -42
- package/templates/chat-app/chatjs/tools/saved-code-execution/schemas.ts +0 -82
- package/templates/chat-app/chatjs/tools/saved-code-execution/tool.ts +0 -12
- package/templates/chat-app/chatjs/tools/sheet-documents/assistant-actions.ts +0 -22
- package/templates/chat-app/chatjs/tools/sheet-documents/chatjs.json +0 -20
- package/templates/chat-app/chatjs/tools/sheet-documents/configuration-schema.ts +0 -10
- package/templates/chat-app/chatjs/tools/sheet-documents/definition.ts +0 -9
- package/templates/chat-app/chatjs/tools/sheet-documents/document.tsx +0 -41
- package/templates/chat-app/chatjs/tools/sheet-documents/editor.tsx +0 -180
- package/templates/chat-app/chatjs/tools/sheet-documents/guidelines.ts +0 -5
- package/templates/chat-app/chatjs/tools/sheet-documents/tool.ts +0 -54
- package/templates/chat-app/chatjs/tools/tavily-search/chatjs.json +0 -19
- package/templates/chat-app/chatjs/tools/tavily-search/renderer.tsx +0 -25
- package/templates/chat-app/chatjs/tools/tavily-search/schemas.ts +0 -39
- package/templates/chat-app/chatjs/tools/tavily-search/tavily-search-env.ts +0 -11
- package/templates/chat-app/chatjs/tools/tavily-search/tool.test.ts +0 -114
- package/templates/chat-app/chatjs/tools/tavily-search/tool.ts +0 -143
- package/templates/chat-app/chatjs/tools/text-documents/assistant-actions.ts +0 -12
- package/templates/chat-app/chatjs/tools/text-documents/chatjs.json +0 -20
- package/templates/chat-app/chatjs/tools/text-documents/comparison.tsx +0 -72
- package/templates/chat-app/chatjs/tools/text-documents/configuration-schema.ts +0 -7
- package/templates/chat-app/chatjs/tools/text-documents/definition.ts +0 -9
- package/templates/chat-app/chatjs/tools/text-documents/diffview.tsx +0 -214
- package/templates/chat-app/chatjs/tools/text-documents/document.tsx +0 -46
- package/templates/chat-app/chatjs/tools/text-documents/editor-config.ts +0 -53
- package/templates/chat-app/chatjs/tools/text-documents/editor.tsx +0 -139
- package/templates/chat-app/chatjs/tools/text-documents/guidelines.ts +0 -7
- package/templates/chat-app/chatjs/tools/text-documents/tool.ts +0 -54
- package/templates/chat-app/chatjs/tools/word-count/chatjs.json +0 -14
- package/templates/chat-app/chatjs/tools/word-count/definition.ts +0 -10
- package/templates/chat-app/chatjs/tools/word-count/renderer.tsx +0 -64
- package/templates/chat-app/chatjs/tools/word-count/schemas.ts +0 -13
- package/templates/chat-app/chatjs/tools/word-count/tool.ts +0 -45
- package/templates/chat-app/components/chat/chat-layout.tsx +0 -129
- package/templates/chat-app/components/chat-sidebar-view.tsx +0 -53
- package/templates/chat-app/components/document-skeleton.tsx +0 -33
- package/templates/chat-app/components/eve/eve-artifact-layout.tsx +0 -722
- package/templates/chat-app/components/eve/eve-copy-button.tsx +0 -165
- package/templates/chat-app/components/eve/eve-document-actions.tsx +0 -124
- package/templates/chat-app/components/eve/eve-document-assistant-actions.tsx +0 -157
- package/templates/chat-app/components/eve/eve-document-body.tsx +0 -29
- package/templates/chat-app/components/eve/eve-document-context.tsx +0 -12
- package/templates/chat-app/components/eve/eve-document-preview.tsx +0 -128
- package/templates/chat-app/components/eve/eve-document-tool.tsx +0 -190
- package/templates/chat-app/components/eve/eve-history.tsx +0 -25
- package/templates/chat-app/components/eve/use-document-draft.ts +0 -281
- package/templates/chat-app/components/favicon-group.tsx +0 -50
- package/templates/chat-app/components/part/document-common.tsx +0 -152
- package/templates/chat-app/components/part/web-search.tsx +0 -75
- package/templates/chat-app/components/sandbox.tsx +0 -43
- package/templates/chat-app/components/source-badge.tsx +0 -50
- package/templates/chat-app/components/sources.tsx +0 -140
- package/templates/chat-app/hooks/use-artifact.tsx +0 -180
- package/templates/chat-app/integrations/documents/definitions.ts +0 -4
- package/templates/chat-app/integrations/documents/run.ts +0 -1
- package/templates/chat-app/integrations/documents/ui.ts +0 -4
- package/templates/chat-app/integrations/providers/sandbox.ts +0 -10
- package/templates/chat-app/integrations/tools/code-executor.ts +0 -1
- package/templates/chat-app/lib/ai/telemetry.ts +0 -4
- package/templates/chat-app/lib/artifacts/artifact-kind.ts +0 -8
- package/templates/chat-app/lib/artifacts/types.ts +0 -19
- package/templates/chat-app/lib/db/eve-code-sandboxes.ts +0 -197
- package/templates/chat-app/lib/db/eve-document-retention.ts +0 -36
- package/templates/chat-app/lib/db/eve-documents.ts +0 -700
- package/templates/chat-app/lib/eve/code-executor.ts +0 -32
- package/templates/chat-app/lib/eve/code-sandbox-name.test.ts +0 -60
- package/templates/chat-app/lib/eve/code-sandbox-name.ts +0 -56
- package/templates/chat-app/lib/eve/code-sandbox-ownership.ts +0 -88
- package/templates/chat-app/lib/eve/copy-input.ts +0 -11
- package/templates/chat-app/lib/eve/create-native-copy.ts +0 -38
- package/templates/chat-app/lib/eve/document-assistant-actions.test.ts +0 -48
- package/templates/chat-app/lib/eve/document-assistant-actions.ts +0 -22
- package/templates/chat-app/lib/eve/document-kind-lifecycle.test.ts +0 -148
- package/templates/chat-app/lib/eve/document-tools.ts +0 -164
- package/templates/chat-app/lib/eve/lifecycle/postgres/eve-sandbox-coverage-proof.ts +0 -140
- package/templates/chat-app/lib/eve/persistent-sandbox-store.ts +0 -621
- package/templates/chat-app/lib/eve/persistent-sandbox.test.ts +0 -209
- package/templates/chat-app/lib/eve/persistent-sandbox.ts +0 -328
- package/templates/chat-app/lib/eve/purge-code-sandboxes.test.ts +0 -125
- package/templates/chat-app/lib/eve/purge-code-sandboxes.ts +0 -83
- package/templates/chat-app/lib/eve/request-copy.test.ts +0 -95
- package/templates/chat-app/lib/eve/request-copy.ts +0 -129
- package/templates/chat-app/lib/eve/research-progress.test.ts +0 -95
- package/templates/chat-app/lib/eve/research-progress.ts +0 -42
- package/templates/chat-app/lib/eve/sandbox-environment.test.ts +0 -49
- package/templates/chat-app/lib/eve/sandbox-environment.ts +0 -29
- package/templates/chat-app/lib/eve/save-copy-operation.ts +0 -33
- package/templates/chat-app/lib/eve/save-document.ts +0 -87
- package/templates/chat-app/lib/eve/verify-local-coverage.ts +0 -84
- package/templates/chat-app/lib/eve/workspace-attachments.ts +0 -173
- package/templates/chat-app/lib/sandbox/runtime.ts +0 -12
- package/templates/chat-app/scripts/persistent-sandbox-cleanup.ts +0 -128
- package/templates/chat-app/scripts/stop-persistent-sandboxes.ts +0 -24
- package/templates/chat-app/tests/artifacts.e2e.ts +0 -7
- package/templates/chat-app/tools/platform/documents/types.ts +0 -11
- package/templates/chat-app/tools/platform/search-presentation.ts +0 -138
- package/templates/chat-app/tools/platform/steps/multi-query-web-search.test.ts +0 -45
- package/templates/chat-app/tools/platform/steps/multi-query-web-search.ts +0 -142
- package/templates/chat-app/tools/platform/steps/search-utils.ts +0 -26
- package/templates/chat-app/vendor/workflow-world-postgres-5.0.0-beta.40.tgz +0 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AccountMenuTrigger,
|
|
5
|
+
AccountMenuContent,
|
|
6
|
+
} from "@/components/sidebar-menus";
|
|
7
|
+
import { MenuLink } from "@/components/navigation-links";
|
|
8
|
+
import {
|
|
9
|
+
ChevronsUpDown,
|
|
10
|
+
LogIn,
|
|
11
|
+
LogOut,
|
|
12
|
+
Moon,
|
|
13
|
+
Settings,
|
|
14
|
+
Sun,
|
|
15
|
+
} from "lucide-react";
|
|
16
|
+
import React from "react";
|
|
17
|
+
|
|
18
|
+
import type { JSX as ReactJSX } from "react";
|
|
19
|
+
|
|
20
|
+
import type { SessionContextValue } from "@/providers/session-context";
|
|
21
|
+
|
|
22
|
+
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
|
|
23
|
+
|
|
24
|
+
import {
|
|
25
|
+
DropdownMenu,
|
|
26
|
+
DropdownMenuGroup,
|
|
27
|
+
DropdownMenuItem,
|
|
28
|
+
DropdownMenuLabel,
|
|
29
|
+
DropdownMenuSeparator,
|
|
30
|
+
} from "@/components/ui/dropdown-menu";
|
|
31
|
+
import {
|
|
32
|
+
SidebarMenu,
|
|
33
|
+
SidebarMenuButton,
|
|
34
|
+
SidebarMenuItem,
|
|
35
|
+
useSidebar,
|
|
36
|
+
} from "@/components/ui/sidebar";
|
|
37
|
+
import { AccountSummary } from "@/components/chat-slots";
|
|
38
|
+
|
|
39
|
+
import { cn } from "@/lib/utils";
|
|
40
|
+
|
|
41
|
+
const USER_INITIALS_LENGTH = 2;
|
|
42
|
+
|
|
43
|
+
export const ChatAccount = ({
|
|
44
|
+
user,
|
|
45
|
+
isPending,
|
|
46
|
+
theme,
|
|
47
|
+
onThemeChange,
|
|
48
|
+
onSignIn,
|
|
49
|
+
onSignOut,
|
|
50
|
+
}: {
|
|
51
|
+
readonly user: NonNullable<SessionContextValue["data"]>["user"] | undefined;
|
|
52
|
+
readonly isPending: boolean;
|
|
53
|
+
readonly theme: string | undefined;
|
|
54
|
+
readonly onThemeChange: (theme: string) => void;
|
|
55
|
+
readonly onSignIn: () => void;
|
|
56
|
+
readonly onSignOut: () => void;
|
|
57
|
+
}): ReactJSX.Element => {
|
|
58
|
+
const { isMobile, state } = useSidebar();
|
|
59
|
+
const isDesktopCollapsed = !isMobile && state === "collapsed";
|
|
60
|
+
if (isPending) {
|
|
61
|
+
return (
|
|
62
|
+
<SidebarMenu>
|
|
63
|
+
<SidebarMenuItem>
|
|
64
|
+
<div
|
|
65
|
+
aria-hidden="true"
|
|
66
|
+
className="flex h-12 items-center gap-2 rounded-md p-2"
|
|
67
|
+
>
|
|
68
|
+
<div className="bg-sidebar-accent size-8 animate-pulse rounded-lg" />
|
|
69
|
+
<div className="grid flex-1 gap-1 group-data-[collapsible=icon]:hidden">
|
|
70
|
+
<div className="bg-sidebar-accent h-3 w-20 animate-pulse rounded" />
|
|
71
|
+
<div className="bg-sidebar-accent h-3 w-28 animate-pulse rounded" />
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</SidebarMenuItem>
|
|
75
|
+
</SidebarMenu>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (!user) {
|
|
80
|
+
return (
|
|
81
|
+
<SidebarMenu>
|
|
82
|
+
<SidebarMenuItem>
|
|
83
|
+
<SidebarMenuButton
|
|
84
|
+
onClick={() => {
|
|
85
|
+
onSignIn();
|
|
86
|
+
}}
|
|
87
|
+
>
|
|
88
|
+
<LogIn className="size-4" />
|
|
89
|
+
<span>Sign in</span>
|
|
90
|
+
</SidebarMenuButton>
|
|
91
|
+
</SidebarMenuItem>
|
|
92
|
+
</SidebarMenu>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const displayName = user.name || user.email || "User";
|
|
97
|
+
const userInitials = displayName.slice(0, USER_INITIALS_LENGTH).toUpperCase();
|
|
98
|
+
const { image: userImage } = user;
|
|
99
|
+
const avatarImageSrc =
|
|
100
|
+
typeof userImage === "string" && userImage !== ""
|
|
101
|
+
? userImage
|
|
102
|
+
: `https://avatar.vercel.sh/${user.email}`;
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<SidebarMenu>
|
|
106
|
+
<SidebarMenuItem>
|
|
107
|
+
<DropdownMenu>
|
|
108
|
+
<AccountMenuTrigger collapsed={isDesktopCollapsed}>
|
|
109
|
+
<Avatar
|
|
110
|
+
className={cn(
|
|
111
|
+
"size-8 rounded-lg",
|
|
112
|
+
isDesktopCollapsed && "size-6"
|
|
113
|
+
)}
|
|
114
|
+
>
|
|
115
|
+
<AvatarImage alt={displayName} src={avatarImageSrc} />
|
|
116
|
+
<AvatarFallback className="rounded-lg">
|
|
117
|
+
{userInitials}
|
|
118
|
+
</AvatarFallback>
|
|
119
|
+
</Avatar>
|
|
120
|
+
<div
|
|
121
|
+
className={cn(
|
|
122
|
+
"grid flex-1 text-left text-sm leading-tight",
|
|
123
|
+
isDesktopCollapsed && "hidden"
|
|
124
|
+
)}
|
|
125
|
+
>
|
|
126
|
+
<span className="truncate font-medium">
|
|
127
|
+
{user.name || user.email}
|
|
128
|
+
</span>
|
|
129
|
+
<AccountSummary />
|
|
130
|
+
</div>
|
|
131
|
+
<ChevronsUpDown
|
|
132
|
+
className={cn("ml-auto size-4", isDesktopCollapsed && "hidden")}
|
|
133
|
+
/>
|
|
134
|
+
</AccountMenuTrigger>
|
|
135
|
+
<AccountMenuContent side={isMobile ? "bottom" : "right"}>
|
|
136
|
+
<DropdownMenuGroup>
|
|
137
|
+
<DropdownMenuLabel className="p-0 font-normal">
|
|
138
|
+
<div className="flex items-center gap-2 px-1 py-1.5 text-left text-sm">
|
|
139
|
+
<Avatar className="h-8 w-8 rounded-lg">
|
|
140
|
+
<AvatarImage alt={displayName} src={avatarImageSrc} />
|
|
141
|
+
<AvatarFallback className="rounded-lg">
|
|
142
|
+
{userInitials}
|
|
143
|
+
</AvatarFallback>
|
|
144
|
+
</Avatar>
|
|
145
|
+
<div className="grid flex-1 text-left text-sm leading-tight">
|
|
146
|
+
<span className="truncate font-semibold">
|
|
147
|
+
{user.name || user.email}
|
|
148
|
+
</span>
|
|
149
|
+
<span className="truncate text-xs">{user.email}</span>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
</DropdownMenuLabel>
|
|
153
|
+
</DropdownMenuGroup>
|
|
154
|
+
<DropdownMenuSeparator />
|
|
155
|
+
<DropdownMenuGroup>
|
|
156
|
+
<MenuLink href="/settings">
|
|
157
|
+
<Settings className="mr-2 size-4" />
|
|
158
|
+
Settings
|
|
159
|
+
</MenuLink>
|
|
160
|
+
<DropdownMenuItem
|
|
161
|
+
onClick={() => {
|
|
162
|
+
onThemeChange(theme === "light" ? "dark" : "light");
|
|
163
|
+
}}
|
|
164
|
+
>
|
|
165
|
+
{theme === "light" ? (
|
|
166
|
+
<Moon className="mr-2 size-4" />
|
|
167
|
+
) : (
|
|
168
|
+
<Sun className="mr-2 size-4" />
|
|
169
|
+
)}
|
|
170
|
+
Toggle Theme
|
|
171
|
+
</DropdownMenuItem>
|
|
172
|
+
</DropdownMenuGroup>
|
|
173
|
+
<DropdownMenuSeparator />
|
|
174
|
+
<DropdownMenuGroup>
|
|
175
|
+
<DropdownMenuItem
|
|
176
|
+
onClick={() => {
|
|
177
|
+
onSignOut();
|
|
178
|
+
}}
|
|
179
|
+
>
|
|
180
|
+
<LogOut className="mr-2 size-4" />
|
|
181
|
+
Log out
|
|
182
|
+
</DropdownMenuItem>
|
|
183
|
+
</DropdownMenuGroup>
|
|
184
|
+
</AccountMenuContent>
|
|
185
|
+
</DropdownMenu>
|
|
186
|
+
</SidebarMenuItem>
|
|
187
|
+
</SidebarMenu>
|
|
188
|
+
);
|
|
189
|
+
};
|
package/templates/chat-app/components/{controlled-chat-composer.tsx → chat/chat-composer.tsx}
RENAMED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
import type { ComponentProps, JSX as ReactJSX } from "react";
|
|
4
4
|
|
|
5
|
-
import { PromptForm } from "
|
|
5
|
+
import { PromptForm } from "../composer/prompt-form";
|
|
6
6
|
import {
|
|
7
7
|
InputGroup,
|
|
8
8
|
InputGroupAddon,
|
|
9
9
|
InputGroupButton,
|
|
10
|
-
} from "
|
|
10
|
+
} from "@/components/ui/input-group";
|
|
11
11
|
import { ArrowUpIcon, Loader2Icon, SquareIcon } from "lucide-react";
|
|
12
12
|
|
|
13
13
|
import type { ChatStatus } from "ai";
|
|
14
14
|
|
|
15
|
-
import { LexicalChatInput } from "
|
|
15
|
+
import { LexicalChatInput } from "../lexical-chat-input";
|
|
16
16
|
|
|
17
17
|
import React from "react";
|
|
18
|
-
import type { ReadonlyReactNode } from "
|
|
18
|
+
import type { ReadonlyReactNode } from "@/lib/readonly-react-node";
|
|
19
19
|
|
|
20
|
-
import { useIsMobile } from "
|
|
20
|
+
import { useIsMobile } from "@/hooks/use-mobile";
|
|
21
21
|
|
|
22
22
|
const MAX_DRAFT_LENGTH = 16_000;
|
|
23
23
|
|
|
@@ -88,7 +88,7 @@ const ComposerAction = ({
|
|
|
88
88
|
* @param {ComponentProps<typeof LexicalChatInput>["onPaste"] | undefined} onPaste Runtime-owned onPaste value.
|
|
89
89
|
* @returns {React.JSX.Element} The composed message interface.
|
|
90
90
|
*/
|
|
91
|
-
export const
|
|
91
|
+
export const ChatComposer = ({
|
|
92
92
|
draft,
|
|
93
93
|
onDraftChange,
|
|
94
94
|
onSubmit,
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
4
|
+
import { ChatWelcomeView } from "./chat-welcome-view";
|
|
5
|
+
import { ChatTranscript } from "./chat-transcript";
|
|
6
|
+
import {
|
|
7
|
+
ChatConversation,
|
|
8
|
+
ChatConversationBody,
|
|
9
|
+
ChatConversationFooter,
|
|
10
|
+
} from "./chat-conversation";
|
|
11
|
+
import { EveThinkingMessage } from "../eve/eve-thinking-message";
|
|
12
|
+
import {
|
|
13
|
+
MessageScroller,
|
|
14
|
+
MessageScrollerProvider,
|
|
15
|
+
MessageScrollerViewport,
|
|
16
|
+
MessageScrollerContent,
|
|
17
|
+
MessageScrollerButton,
|
|
18
|
+
} from "@/components/ui/message-scroller";
|
|
19
|
+
|
|
20
|
+
/** One transcript and placement contract. Runtime-owned recovery and composer
|
|
21
|
+
* controllers occupy fixed slots; callers cannot replace message rendering. */
|
|
22
|
+
export const ChatConversationScreen = ({
|
|
23
|
+
conversationId,
|
|
24
|
+
welcome = false,
|
|
25
|
+
header,
|
|
26
|
+
transcript,
|
|
27
|
+
status,
|
|
28
|
+
composer,
|
|
29
|
+
notices,
|
|
30
|
+
leading,
|
|
31
|
+
trailing,
|
|
32
|
+
}: {
|
|
33
|
+
readonly conversationId: string;
|
|
34
|
+
readonly welcome?: boolean;
|
|
35
|
+
readonly header?: ReactNode;
|
|
36
|
+
readonly transcript: ComponentProps<typeof ChatTranscript>;
|
|
37
|
+
readonly status: string;
|
|
38
|
+
readonly composer: ReactNode;
|
|
39
|
+
readonly notices?: ReactNode;
|
|
40
|
+
readonly leading?: ReactNode;
|
|
41
|
+
readonly trailing?: ReactNode;
|
|
42
|
+
}) => (
|
|
43
|
+
<ChatConversation>
|
|
44
|
+
{header}
|
|
45
|
+
{welcome ? (
|
|
46
|
+
<ChatWelcomeView>
|
|
47
|
+
{composer}
|
|
48
|
+
{notices}
|
|
49
|
+
</ChatWelcomeView>
|
|
50
|
+
) : (
|
|
51
|
+
<ChatConversationBody>
|
|
52
|
+
<MessageScrollerProvider autoScroll key={conversationId}>
|
|
53
|
+
<MessageScroller className="flex-1">
|
|
54
|
+
<MessageScrollerViewport preserveScrollOnPrepend>
|
|
55
|
+
<MessageScrollerContent className="mx-auto w-full max-w-3xl p-4">
|
|
56
|
+
{leading}
|
|
57
|
+
<ChatTranscript {...transcript} />
|
|
58
|
+
<EveThinkingMessage
|
|
59
|
+
messages={transcript.messages}
|
|
60
|
+
status={status}
|
|
61
|
+
/>
|
|
62
|
+
{trailing}
|
|
63
|
+
</MessageScrollerContent>
|
|
64
|
+
</MessageScrollerViewport>
|
|
65
|
+
<MessageScrollerButton />
|
|
66
|
+
</MessageScroller>
|
|
67
|
+
</MessageScrollerProvider>
|
|
68
|
+
<ChatConversationFooter>
|
|
69
|
+
{notices}
|
|
70
|
+
{composer}
|
|
71
|
+
</ChatConversationFooter>
|
|
72
|
+
</ChatConversationBody>
|
|
73
|
+
)}
|
|
74
|
+
</ChatConversation>
|
|
75
|
+
);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { cn } from "@/lib/utils";
|
|
3
|
+
|
|
4
|
+
export const ChatConversation = ({
|
|
5
|
+
className,
|
|
6
|
+
...props
|
|
7
|
+
}: ComponentProps<"section">) => (
|
|
8
|
+
<section
|
|
9
|
+
data-slot="chat-conversation"
|
|
10
|
+
className={cn("flex h-full min-h-0 flex-col", className)}
|
|
11
|
+
{...props}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const ChatConversationBody = ({
|
|
16
|
+
className,
|
|
17
|
+
...props
|
|
18
|
+
}: ComponentProps<"div">) => (
|
|
19
|
+
<div
|
|
20
|
+
data-slot="chat-conversation-body"
|
|
21
|
+
className={cn("flex min-h-0 flex-1 flex-col", className)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export const ChatConversationFooter = ({
|
|
27
|
+
className,
|
|
28
|
+
...props
|
|
29
|
+
}: ComponentProps<"div">) => (
|
|
30
|
+
<div
|
|
31
|
+
data-slot="chat-conversation-footer"
|
|
32
|
+
className={cn("mx-auto w-full max-w-3xl space-y-3 p-4", className)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { cn } from "@/lib/utils";
|
|
3
|
+
|
|
4
|
+
export const ChatHeader = ({
|
|
5
|
+
className,
|
|
6
|
+
...props
|
|
7
|
+
}: ComponentProps<"header">) => (
|
|
8
|
+
<header
|
|
9
|
+
data-slot="chat-header"
|
|
10
|
+
className={cn(
|
|
11
|
+
"bg-background sticky top-0 flex items-center justify-between gap-2 px-2 py-1.5 md:px-2",
|
|
12
|
+
className
|
|
13
|
+
)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
export const ChatHeaderLeading = ({
|
|
19
|
+
className,
|
|
20
|
+
...props
|
|
21
|
+
}: ComponentProps<"div">) => (
|
|
22
|
+
<div
|
|
23
|
+
data-slot="chat-header-leading"
|
|
24
|
+
className={cn(
|
|
25
|
+
"flex flex-1 items-center justify-between gap-2 overflow-hidden",
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export const ChatHeaderTitle = ({
|
|
33
|
+
className,
|
|
34
|
+
...props
|
|
35
|
+
}: ComponentProps<"div">) => (
|
|
36
|
+
<div
|
|
37
|
+
data-slot="chat-header-title"
|
|
38
|
+
className={cn("flex min-w-0 items-center gap-2", className)}
|
|
39
|
+
{...props}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
export const ChatHeaderActions = ({
|
|
44
|
+
className,
|
|
45
|
+
...props
|
|
46
|
+
}: ComponentProps<"div">) => (
|
|
47
|
+
<div
|
|
48
|
+
data-slot="chat-header-actions"
|
|
49
|
+
className={cn("flex items-center gap-2", className)}
|
|
50
|
+
{...props}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
/** Shared edit presentation; the runtime owns branching and draft recovery. */
|
|
4
|
+
export const ChatMessageEditor = ({
|
|
5
|
+
composer,
|
|
6
|
+
error,
|
|
7
|
+
}: {
|
|
8
|
+
readonly composer: ReactNode;
|
|
9
|
+
readonly error?: string;
|
|
10
|
+
}) => (
|
|
11
|
+
<div className="w-full">
|
|
12
|
+
<p className="text-muted-foreground mb-2 text-sm">
|
|
13
|
+
Replace this message in a new branch. Later messages are not included. All
|
|
14
|
+
branches share workspace files and the installed environment. Forking does
|
|
15
|
+
not roll files back.
|
|
16
|
+
</p>
|
|
17
|
+
{composer}
|
|
18
|
+
{error !== undefined && error !== "" && (
|
|
19
|
+
<p className="text-destructive text-sm" role="alert">
|
|
20
|
+
{error}
|
|
21
|
+
</p>
|
|
22
|
+
)}
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
|
|
5
|
+
/** Embed the application without replacing its links or navigation controls. */
|
|
6
|
+
export const ChatNavigationContext = createContext<{
|
|
7
|
+
readonly pathname: string;
|
|
8
|
+
readonly navigate: (href: string) => void;
|
|
9
|
+
} | null>(null);
|
|
10
|
+
|
|
11
|
+
export const useChatNavigation = () => useContext(ChatNavigationContext);
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Suspense, use } from "react";
|
|
3
|
+
import { Skeleton } from "@/components/ui/skeleton";
|
|
4
|
+
import type { ComponentProps } from "react";
|
|
5
|
+
import { ChatAccount } from "./chat-account";
|
|
6
|
+
import { EveHistoryList } from "../eve/eve-history-list";
|
|
7
|
+
import {
|
|
8
|
+
Sidebar,
|
|
9
|
+
SidebarHeader,
|
|
10
|
+
SidebarContent,
|
|
11
|
+
SidebarFooter,
|
|
12
|
+
SidebarSeparator,
|
|
13
|
+
SidebarMenu,
|
|
14
|
+
SidebarMenuItem,
|
|
15
|
+
SidebarGroup,
|
|
16
|
+
} from "@/components/ui/sidebar";
|
|
17
|
+
import { ScrollArea } from "@/components/ui/scroll-area";
|
|
18
|
+
import { SidebarTopRow } from "@/components/sidebar-top-row";
|
|
19
|
+
import { NewChatButton } from "@/components/new-chat-button";
|
|
20
|
+
import {
|
|
21
|
+
SidebarSections,
|
|
22
|
+
SidebarHeaderItems,
|
|
23
|
+
ModelSettingsLink,
|
|
24
|
+
} from "@/components/chat-slots";
|
|
25
|
+
|
|
26
|
+
type Owner = string | undefined;
|
|
27
|
+
type InitialHistory = ComponentProps<typeof EveHistoryList>["initialPage"];
|
|
28
|
+
interface SidebarData {
|
|
29
|
+
readonly ownerId: Owner;
|
|
30
|
+
readonly history: InitialHistory;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const HeaderItems = ({
|
|
34
|
+
owner,
|
|
35
|
+
onChatSelect,
|
|
36
|
+
}: {
|
|
37
|
+
readonly owner: Owner | Promise<Owner>;
|
|
38
|
+
readonly onChatSelect?: (id: string) => void;
|
|
39
|
+
}) => {
|
|
40
|
+
const ownerId =
|
|
41
|
+
typeof owner === "string" || owner === undefined ? owner : use(owner);
|
|
42
|
+
return (
|
|
43
|
+
<SidebarHeaderItems
|
|
44
|
+
key={ownerId ?? "anonymous"}
|
|
45
|
+
ownerId={ownerId}
|
|
46
|
+
onChatSelect={onChatSelect}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
const History = ({
|
|
51
|
+
data,
|
|
52
|
+
}: {
|
|
53
|
+
readonly data: SidebarData | Promise<SidebarData>;
|
|
54
|
+
}) => {
|
|
55
|
+
const resolved = "then" in data ? use(data) : data;
|
|
56
|
+
return resolved.ownerId === undefined ? null : (
|
|
57
|
+
<EveHistoryList
|
|
58
|
+
key={resolved.ownerId}
|
|
59
|
+
ownerId={resolved.ownerId}
|
|
60
|
+
initialPage={resolved.history}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
const HistorySkeleton = () => (
|
|
65
|
+
<SidebarGroup>
|
|
66
|
+
<div className="flex flex-col gap-2 px-2">
|
|
67
|
+
<Skeleton className="h-7 w-full" />
|
|
68
|
+
<Skeleton className="h-7 w-5/6" />
|
|
69
|
+
<Skeleton className="h-7 w-4/5" />
|
|
70
|
+
<Skeleton className="h-7 w-full" />
|
|
71
|
+
</div>
|
|
72
|
+
</SidebarGroup>
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
/** Standard application composition. Inputs describe data and effects; application markup is owned here. */
|
|
76
|
+
export const ChatSidebar = ({
|
|
77
|
+
direction = "ltr",
|
|
78
|
+
ownerId,
|
|
79
|
+
history,
|
|
80
|
+
account,
|
|
81
|
+
conversationId,
|
|
82
|
+
onProjectSelect,
|
|
83
|
+
onChatSelect,
|
|
84
|
+
}: {
|
|
85
|
+
readonly direction?: "ltr" | "rtl";
|
|
86
|
+
readonly ownerId?: Owner | Promise<Owner>;
|
|
87
|
+
readonly history: SidebarData | Promise<SidebarData>;
|
|
88
|
+
readonly account: ComponentProps<typeof ChatAccount>;
|
|
89
|
+
readonly onChatSelect?: (id: string) => void;
|
|
90
|
+
readonly conversationId?: string;
|
|
91
|
+
readonly onProjectSelect?: (id: string) => void;
|
|
92
|
+
}) => (
|
|
93
|
+
<Sidebar
|
|
94
|
+
className="grid max-h-dvh grid-rows-[auto_1fr_auto] border-x-0"
|
|
95
|
+
side={direction === "rtl" ? "right" : "left"}
|
|
96
|
+
dir={direction}
|
|
97
|
+
collapsible="icon"
|
|
98
|
+
>
|
|
99
|
+
<SidebarHeader className="shrink-0">
|
|
100
|
+
<SidebarMenu>
|
|
101
|
+
<div className="flex flex-row items-center justify-between">
|
|
102
|
+
<SidebarTopRow />
|
|
103
|
+
</div>
|
|
104
|
+
<NewChatButton />
|
|
105
|
+
<Suspense
|
|
106
|
+
fallback={
|
|
107
|
+
<SidebarMenuItem>
|
|
108
|
+
<Skeleton className="h-8 w-full" />
|
|
109
|
+
</SidebarMenuItem>
|
|
110
|
+
}
|
|
111
|
+
>
|
|
112
|
+
<HeaderItems owner={ownerId} onChatSelect={onChatSelect} />
|
|
113
|
+
</Suspense>
|
|
114
|
+
<ModelSettingsLink surface="sidebar" />
|
|
115
|
+
</SidebarMenu>
|
|
116
|
+
</SidebarHeader>
|
|
117
|
+
<SidebarSeparator />
|
|
118
|
+
<ScrollArea className="relative flex-1 overflow-y-auto">
|
|
119
|
+
<SidebarContent className="max-w-(--sidebar-width) pr-2 group-data-[collapsible=icon]:hidden">
|
|
120
|
+
<SidebarSections
|
|
121
|
+
conversationId={conversationId}
|
|
122
|
+
onProjectSelect={onProjectSelect}
|
|
123
|
+
/>
|
|
124
|
+
<Suspense fallback={<HistorySkeleton />}>
|
|
125
|
+
<History data={history} />
|
|
126
|
+
</Suspense>
|
|
127
|
+
</SidebarContent>
|
|
128
|
+
</ScrollArea>
|
|
129
|
+
<SidebarSeparator />
|
|
130
|
+
<SidebarFooter>
|
|
131
|
+
<ChatAccount {...account} />
|
|
132
|
+
</SidebarFooter>
|
|
133
|
+
</Sidebar>
|
|
134
|
+
);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { isDocumentResult } from "@/chatjs/core/documents/contracts";
|
|
4
|
-
|
|
5
3
|
import { hasText } from "@/components/text-value";
|
|
6
4
|
|
|
7
5
|
import type { Answer } from "eve/events";
|
|
@@ -22,9 +20,8 @@ import type {
|
|
|
22
20
|
} from "@/lib/eve/readonly-message-types";
|
|
23
21
|
import type { ReadonlyReactNode } from "@/lib/readonly-react-node";
|
|
24
22
|
|
|
25
|
-
import { EveAttachment } from "
|
|
26
|
-
import {
|
|
27
|
-
import { EveMessagePart } from "./eve-message-part";
|
|
23
|
+
import { EveAttachment } from "../eve/eve-attachment";
|
|
24
|
+
import { EveMessagePart } from "../eve/eve-message-part";
|
|
28
25
|
import { MessageActions } from "@/components/chat-slots";
|
|
29
26
|
|
|
30
27
|
const messagePartIdentity = (part: ReadonlyEveMessagePart): string => {
|
|
@@ -52,7 +49,7 @@ const messagePartIdentity = (part: ReadonlyEveMessagePart): string => {
|
|
|
52
49
|
}
|
|
53
50
|
};
|
|
54
51
|
|
|
55
|
-
interface
|
|
52
|
+
interface ChatTranscriptProps {
|
|
56
53
|
readonly conversationId?: string;
|
|
57
54
|
readonly messageKey?: (message: ReadonlyEveMessage) => string;
|
|
58
55
|
readonly messages: readonly ReadonlyEveMessage[];
|
|
@@ -84,13 +81,12 @@ interface EveMessagesProps {
|
|
|
84
81
|
}
|
|
85
82
|
|
|
86
83
|
interface MessageRowProps extends Omit<
|
|
87
|
-
|
|
84
|
+
ChatTranscriptProps,
|
|
88
85
|
"messages" | "messageKey"
|
|
89
86
|
> {
|
|
90
87
|
readonly message: ReadonlyEveMessage;
|
|
91
88
|
readonly userMessage: ReadonlyEveMessage | undefined;
|
|
92
89
|
readonly isLast: boolean;
|
|
93
|
-
readonly latestDocumentCallId: string | undefined;
|
|
94
90
|
readonly actionsDisabled: boolean;
|
|
95
91
|
}
|
|
96
92
|
|
|
@@ -241,7 +237,6 @@ const EveMessageRow = ({
|
|
|
241
237
|
message,
|
|
242
238
|
userMessage,
|
|
243
239
|
isLast,
|
|
244
|
-
latestDocumentCallId,
|
|
245
240
|
conversationId,
|
|
246
241
|
isReadonly,
|
|
247
242
|
disabled,
|
|
@@ -332,35 +327,20 @@ const EveMessageRow = ({
|
|
|
332
327
|
messageId={message.id}
|
|
333
328
|
part={part}
|
|
334
329
|
respond={respond}
|
|
335
|
-
previewDocument={
|
|
336
|
-
part.type === "tool" && part.callId === latestDocumentCallId
|
|
337
|
-
}
|
|
338
330
|
/>
|
|
339
331
|
))}
|
|
340
332
|
</ChatMessageView>
|
|
341
333
|
);
|
|
342
334
|
};
|
|
343
335
|
|
|
344
|
-
//
|
|
345
|
-
export const
|
|
336
|
+
// Production and Create render the same EVE parts and installed tool surfaces.
|
|
337
|
+
export const ChatTranscript = ({
|
|
346
338
|
messages,
|
|
347
339
|
messageKey,
|
|
348
340
|
disabled,
|
|
349
341
|
actionsDisabled = disabled,
|
|
350
342
|
...props
|
|
351
|
-
}:
|
|
352
|
-
const latestDocumentCallId = messages
|
|
353
|
-
.flatMap(
|
|
354
|
-
(message: Readonly<{ parts: readonly ReadonlyEveMessagePart[] }>) =>
|
|
355
|
-
message.parts
|
|
356
|
-
)
|
|
357
|
-
.filter((part: ReadonlyEveMessagePart) => part.type === "tool")
|
|
358
|
-
.findLast(
|
|
359
|
-
(part) =>
|
|
360
|
-
documentDefinitions.operations.has(part.name) ||
|
|
361
|
-
part.name === "readDocument" ||
|
|
362
|
-
(part.state === "completed" && isDocumentResult(part.output))
|
|
363
|
-
)?.callId;
|
|
343
|
+
}: ChatTranscriptProps): ReactJSX.Element[] => {
|
|
364
344
|
const precedingUsers: (ReadonlyEveMessage | undefined)[] = [];
|
|
365
345
|
let precedingUser: ReadonlyEveMessage | undefined;
|
|
366
346
|
for (const message of messages) {
|
|
@@ -380,7 +360,6 @@ export const EveMessages = ({
|
|
|
380
360
|
message={message}
|
|
381
361
|
userMessage={precedingUsers[index]}
|
|
382
362
|
isLast={message.id === messages.at(-1)?.id}
|
|
383
|
-
latestDocumentCallId={latestDocumentCallId}
|
|
384
363
|
disabled={disabled}
|
|
385
364
|
actionsDisabled={actionsDisabled}
|
|
386
365
|
/>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar";
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
export const ChatWorkspace = (
|
|
7
|
+
props: ComponentProps<typeof SidebarProvider>
|
|
8
|
+
) => <SidebarProvider data-slot="chat-workspace" {...props} />;
|
|
9
|
+
|
|
10
|
+
export const ChatWorkspaceContent = ({
|
|
11
|
+
className,
|
|
12
|
+
...props
|
|
13
|
+
}: ComponentProps<typeof SidebarInset>) => (
|
|
14
|
+
<SidebarInset
|
|
15
|
+
data-slot="chat-workspace-content"
|
|
16
|
+
className={cn("[--header-height:calc(var(--spacing)*13)]", className)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
import { ChatSidebar } from "./chat-sidebar";
|
|
4
|
+
import { useAccountControl } from "../sidebar-user-nav";
|
|
5
|
+
|
|
6
|
+
export const ConnectedChatSidebar = (
|
|
7
|
+
props: Omit<ComponentProps<typeof ChatSidebar>, "account">
|
|
8
|
+
) => <ChatSidebar {...props} account={useAccountControl()} />;
|