chat-js 1.0.0-alpha.2 → 1.0.0-alpha.3
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 +4 -4
- package/dist/index.js +2625 -2666
- package/package.json +8 -3
- 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
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
const documentExecutionInput = z.object({
|
|
4
|
-
documentId: z.uuid(),
|
|
5
|
-
revisionId: z.uuid(),
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
const chartLabels = {
|
|
9
|
-
title: z.string(),
|
|
10
|
-
x_label: z.string().optional(),
|
|
11
|
-
y_label: z.string().optional(),
|
|
12
|
-
};
|
|
13
|
-
const point = z.tuple([z.union([z.number(), z.string()]), z.number()]);
|
|
14
|
-
const series = z.object({
|
|
15
|
-
label: z.string(),
|
|
16
|
-
points: z.array(point),
|
|
17
|
-
});
|
|
18
|
-
const barElement = z.object({
|
|
19
|
-
group: z.string(),
|
|
20
|
-
label: z.string(),
|
|
21
|
-
value: z.number(),
|
|
22
|
-
});
|
|
23
|
-
const lineChart = z.object({
|
|
24
|
-
...chartLabels,
|
|
25
|
-
elements: z.array(series),
|
|
26
|
-
type: z.literal("line"),
|
|
27
|
-
x_scale: z.literal("datetime").nullish(),
|
|
28
|
-
});
|
|
29
|
-
const scatterChart = z.object({
|
|
30
|
-
...chartLabels,
|
|
31
|
-
elements: z.array(series),
|
|
32
|
-
type: z.literal("scatter"),
|
|
33
|
-
x_scale: z.literal("datetime").nullish(),
|
|
34
|
-
});
|
|
35
|
-
const barChart = z.object({
|
|
36
|
-
...chartLabels,
|
|
37
|
-
elements: z.array(barElement),
|
|
38
|
-
type: z.literal("bar"),
|
|
39
|
-
});
|
|
40
|
-
const chart = z.discriminatedUnion("type", [lineChart, scatterChart, barChart]);
|
|
41
|
-
const encodedChart = z.object({ base64: z.string(), format: z.string() });
|
|
42
|
-
|
|
43
|
-
/** The saved-code runner owns its output contract independently of installed renderers. */
|
|
44
|
-
const eveCodeExecutionResult = z.object({
|
|
45
|
-
chart: z.union([z.string(), encodedChart, chart]),
|
|
46
|
-
message: z.string(),
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
const documentExecutionResult = eveCodeExecutionResult.extend(
|
|
50
|
-
documentExecutionInput.shape
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
const LAST_EXTENSION_INDEX = -1;
|
|
54
|
-
const executionLanguageByExtension: ReadonlyMap<
|
|
55
|
-
string,
|
|
56
|
-
"python" | "javascript"
|
|
57
|
-
> = new Map([
|
|
58
|
-
["py", "python"],
|
|
59
|
-
["js", "javascript"],
|
|
60
|
-
["mjs", "javascript"],
|
|
61
|
-
["cjs", "javascript"],
|
|
62
|
-
]);
|
|
63
|
-
const documentExecutionLanguage = (
|
|
64
|
-
title: string
|
|
65
|
-
): "python" | "javascript" | undefined => {
|
|
66
|
-
if (!title.includes(".")) {
|
|
67
|
-
return "python";
|
|
68
|
-
}
|
|
69
|
-
const extension = (
|
|
70
|
-
title.split(".").at(LAST_EXTENSION_INDEX) ?? ""
|
|
71
|
-
).toLowerCase();
|
|
72
|
-
if (!(typeof extension === "string" && extension !== "")) {
|
|
73
|
-
return "python";
|
|
74
|
-
}
|
|
75
|
-
return executionLanguageByExtension.get(extension);
|
|
76
|
-
};
|
|
77
|
-
export {
|
|
78
|
-
documentExecutionInput,
|
|
79
|
-
documentExecutionResult,
|
|
80
|
-
documentExecutionLanguage,
|
|
81
|
-
eveCodeExecutionResult,
|
|
82
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { defineTool } from "eve/tools";
|
|
2
|
-
import { documentExecutionInput } from "./schemas";
|
|
3
|
-
import { executeEveCodeDocument } from "./execute";
|
|
4
|
-
import { toolResultToModelOutput } from "@/lib/eve/tool-model-output";
|
|
5
|
-
|
|
6
|
-
export const runCodeDocument = defineTool({
|
|
7
|
-
description:
|
|
8
|
-
"Run the exact saved Python or JavaScript code document revision in this conversation. Supply its document and revision IDs. Do not copy, rewrite, or substitute its source code.",
|
|
9
|
-
execute: executeEveCodeDocument,
|
|
10
|
-
inputSchema: documentExecutionInput,
|
|
11
|
-
toModelOutput: toolResultToModelOutput,
|
|
12
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { DocumentAssistantAction } from "@/chatjs/core/documents/contracts";
|
|
2
|
-
import { config } from "@/lib/config";
|
|
3
|
-
import { installedDocumentKinds } from "@/integrations/tools/catalog";
|
|
4
|
-
|
|
5
|
-
const documentAssistantActions = (): DocumentAssistantAction[] => [
|
|
6
|
-
{
|
|
7
|
-
instruction: "Format and clean the spreadsheet data.",
|
|
8
|
-
label: "Format and clean data",
|
|
9
|
-
modelId: config.ai.tools.sheet.format,
|
|
10
|
-
},
|
|
11
|
-
...(installedDocumentKinds.has("code")
|
|
12
|
-
? [
|
|
13
|
-
{
|
|
14
|
-
instruction:
|
|
15
|
-
"Analyze and visualize the spreadsheet data by creating a new Python code document.",
|
|
16
|
-
label: "Analyze and visualize data",
|
|
17
|
-
modelId: config.ai.tools.sheet.analyze,
|
|
18
|
-
},
|
|
19
|
-
]
|
|
20
|
-
: []),
|
|
21
|
-
];
|
|
22
|
-
export { documentAssistantActions };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"config": { "key": "sheet" },
|
|
3
|
-
"documentKind": "sheet",
|
|
4
|
-
"envRequirements": [],
|
|
5
|
-
"id": "sheet-documents",
|
|
6
|
-
"kind": "tool",
|
|
7
|
-
"requiresTools": ["readDocument"],
|
|
8
|
-
"tools": [
|
|
9
|
-
{
|
|
10
|
-
"composer": { "icon": "Edit3", "name": "Canvas", "shortName": "Canvas" },
|
|
11
|
-
"toolExport": "createSheetDocument"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"composer": { "icon": "Edit3", "name": "Canvas", "shortName": "Canvas" },
|
|
15
|
-
"toolExport": "editSheetDocument"
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
"contractVersion": 2,
|
|
19
|
-
"uiBase": "base"
|
|
20
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { languageModelSchema, modelRoles } from "@/lib/config-models";
|
|
3
|
-
|
|
4
|
-
const configSchema = z
|
|
5
|
-
.strictObject({
|
|
6
|
-
analyze: languageModelSchema.default(modelRoles.balanced),
|
|
7
|
-
format: languageModelSchema.default(modelRoles.balanced),
|
|
8
|
-
})
|
|
9
|
-
.prefault({});
|
|
10
|
-
export { configSchema };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type { DocumentDefinition } from "@/chatjs/core/documents/document-definition";
|
|
3
|
-
|
|
4
|
-
export const documentDefinition = {
|
|
5
|
-
kind: "sheet",
|
|
6
|
-
contentSchema: z.string().max(2_000_000),
|
|
7
|
-
createTool: "createSheetDocument",
|
|
8
|
-
editTool: "editSheetDocument",
|
|
9
|
-
} as const satisfies DocumentDefinition;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import type { DocumentBodyProps, DocumentUi } from "@/chatjs/core/documents/ui";
|
|
3
|
-
import { parse, unparse } from "papaparse";
|
|
4
|
-
import { documentDefinition } from "./definition";
|
|
5
|
-
import { documentAssistantActions } from "./assistant-actions";
|
|
6
|
-
import React from "react";
|
|
7
|
-
import type { ReadonlyNativeSurface } from "@/lib/readonly-native-surface";
|
|
8
|
-
import dynamic from "next/dynamic";
|
|
9
|
-
|
|
10
|
-
const SpreadsheetEditor = dynamic(
|
|
11
|
-
async () => {
|
|
12
|
-
const { SpreadsheetEditor: Editor } = await import("./editor");
|
|
13
|
-
return Editor;
|
|
14
|
-
},
|
|
15
|
-
{ ssr: false }
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
export const documentUi: DocumentUi = {
|
|
19
|
-
copyLabel: "Copy as .csv",
|
|
20
|
-
copySuccessMessage: "Copied csv to clipboard!",
|
|
21
|
-
copyIconSize: 16,
|
|
22
|
-
copyButtonClassName: "hover:bg-accent h-fit p-2",
|
|
23
|
-
definition: documentDefinition,
|
|
24
|
-
assistantActions: documentAssistantActions,
|
|
25
|
-
Body: ({ editorProps }: ReadonlyNativeSurface<DocumentBodyProps>) => (
|
|
26
|
-
<div className="min-h-0 flex-1 overflow-hidden">
|
|
27
|
-
<SpreadsheetEditor
|
|
28
|
-
{...editorProps}
|
|
29
|
-
saveContent={editorProps.onSaveContent}
|
|
30
|
-
/>
|
|
31
|
-
</div>
|
|
32
|
-
),
|
|
33
|
-
copyContent: (content) => {
|
|
34
|
-
const parsed = parse<string[]>(content, { skipEmptyLines: true });
|
|
35
|
-
return unparse(
|
|
36
|
-
parsed.data.filter((row: readonly string[]) =>
|
|
37
|
-
row.some((cell) => cell.trim() !== "")
|
|
38
|
-
)
|
|
39
|
-
);
|
|
40
|
-
},
|
|
41
|
-
};
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import "react-data-grid/lib/styles.css";
|
|
4
|
-
import React, { memo, useMemo, useState } from "react";
|
|
5
|
-
import { parse, unparse } from "papaparse";
|
|
6
|
-
import type { CellClickArgs, CellMouseEvent } from "react-data-grid";
|
|
7
|
-
import DataGrid, { textEditor } from "react-data-grid";
|
|
8
|
-
import type { ReadonlyNativeSurface } from "@/lib/readonly-native-surface";
|
|
9
|
-
import { cn } from "@/lib/utils";
|
|
10
|
-
import { useTheme } from "next-themes";
|
|
11
|
-
|
|
12
|
-
interface SheetEditorProps {
|
|
13
|
-
content: string;
|
|
14
|
-
currentVersionIndex: number;
|
|
15
|
-
isCurrentVersion: boolean;
|
|
16
|
-
isReadonly?: boolean;
|
|
17
|
-
saveContent: (content: string, isCurrentVersion: boolean) => void;
|
|
18
|
-
status: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const MIN_ROWS = 50;
|
|
22
|
-
const MIN_COLS = 26;
|
|
23
|
-
|
|
24
|
-
const PureSpreadsheetEditor = ({
|
|
25
|
-
content,
|
|
26
|
-
saveContent,
|
|
27
|
-
status: _status,
|
|
28
|
-
isCurrentVersion: _isCurrentVersion,
|
|
29
|
-
isReadonly,
|
|
30
|
-
}: ReadonlyNativeSurface<SheetEditorProps>): React.JSX.Element => {
|
|
31
|
-
const { resolvedTheme } = useTheme();
|
|
32
|
-
|
|
33
|
-
const parseData = useMemo(() => {
|
|
34
|
-
if (!content) {
|
|
35
|
-
return Array.from({ length: MIN_ROWS }, () =>
|
|
36
|
-
Array.from({ length: MIN_COLS }, (): string => "")
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
const result = parse<string[]>(content, { skipEmptyLines: true });
|
|
40
|
-
|
|
41
|
-
const paddedData = result.data.map(
|
|
42
|
-
(row: ReadonlyNativeSurface<string[]>): string[] => {
|
|
43
|
-
const paddedRow = [...row];
|
|
44
|
-
while (paddedRow.length < MIN_COLS) {
|
|
45
|
-
paddedRow.push("");
|
|
46
|
-
}
|
|
47
|
-
return paddedRow;
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
while (paddedData.length < MIN_ROWS) {
|
|
52
|
-
paddedData.push(Array.from({ length: MIN_COLS }, (): string => ""));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return paddedData;
|
|
56
|
-
}, [content]);
|
|
57
|
-
|
|
58
|
-
const columns = useMemo(() => {
|
|
59
|
-
const rowNumberColumn = {
|
|
60
|
-
cellClass: "border-t border-r bg-background text-foreground",
|
|
61
|
-
frozen: true,
|
|
62
|
-
headerCellClass: "border-t border-r bg-muted text-foreground",
|
|
63
|
-
key: "rowNumber",
|
|
64
|
-
name: "",
|
|
65
|
-
renderCell: ({ rowIdx }: Readonly<{ rowIdx: number }>): number =>
|
|
66
|
-
rowIdx + 1,
|
|
67
|
-
width: 50,
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const dataColumns = Array.from({ length: MIN_COLS }, (_, i) => ({
|
|
71
|
-
cellClass: cn("bg-background text-foreground border-t", {
|
|
72
|
-
"border-l": i !== 0,
|
|
73
|
-
}),
|
|
74
|
-
headerCellClass: cn("bg-muted text-foreground border-t", {
|
|
75
|
-
"border-l": i !== 0,
|
|
76
|
-
}),
|
|
77
|
-
key: i.toString(),
|
|
78
|
-
name: String.fromCodePoint(65 + i),
|
|
79
|
-
renderEditCell: isReadonly === true ? undefined : textEditor,
|
|
80
|
-
width: 120,
|
|
81
|
-
}));
|
|
82
|
-
|
|
83
|
-
return [rowNumberColumn, ...dataColumns];
|
|
84
|
-
}, [isReadonly]);
|
|
85
|
-
|
|
86
|
-
const initialRows = useMemo(
|
|
87
|
-
() =>
|
|
88
|
-
parseData.map(
|
|
89
|
-
(row: ReadonlyNativeSurface<string[]>, rowIndex: number) => {
|
|
90
|
-
const rowData: Record<string, string | number> = {
|
|
91
|
-
id: rowIndex,
|
|
92
|
-
rowNumber: rowIndex + 1,
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
for (const [colIndex, col] of columns.slice(1).entries()) {
|
|
96
|
-
rowData[col.key] = row[colIndex] || "";
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return rowData;
|
|
100
|
-
}
|
|
101
|
-
),
|
|
102
|
-
[parseData, columns]
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
const [localRows, setLocalRows] =
|
|
106
|
-
useState<ReadonlyNativeSurface<Record<string, string | number>[]>>(
|
|
107
|
-
initialRows
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
const [previousRows, setPreviousRows] = useState(initialRows);
|
|
111
|
-
if (previousRows !== initialRows) {
|
|
112
|
-
setPreviousRows(initialRows);
|
|
113
|
-
setLocalRows(initialRows);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const handleRowsChange = (
|
|
117
|
-
newRows: ReadonlyNativeSurface<Record<string, string | number>[]>
|
|
118
|
-
): void => {
|
|
119
|
-
if (isReadonly === true) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
setLocalRows(newRows);
|
|
124
|
-
|
|
125
|
-
const updatedData = newRows.map(
|
|
126
|
-
(row: ReadonlyNativeSurface<Record<string, string | number>>) =>
|
|
127
|
-
columns
|
|
128
|
-
.slice(1)
|
|
129
|
-
.map((col: ReadonlyNativeSurface<(typeof columns)[number]>) => {
|
|
130
|
-
const value = row[col.key];
|
|
131
|
-
if (typeof value === "number") {
|
|
132
|
-
return value === 0 || Number.isNaN(value) ? "" : value;
|
|
133
|
-
}
|
|
134
|
-
return value ?? "";
|
|
135
|
-
})
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
const newCsvContent = unparse(updatedData);
|
|
139
|
-
saveContent(newCsvContent, true);
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
return (
|
|
143
|
-
<DataGrid
|
|
144
|
-
className={resolvedTheme === "dark" ? "rdg-dark" : "rdg-light"}
|
|
145
|
-
columns={columns}
|
|
146
|
-
defaultColumnOptions={{
|
|
147
|
-
resizable: true,
|
|
148
|
-
sortable: true,
|
|
149
|
-
}}
|
|
150
|
-
enableVirtualization
|
|
151
|
-
onCellClick={(
|
|
152
|
-
args: ReadonlyNativeSurface<
|
|
153
|
-
CellClickArgs<Record<string, string | number>>
|
|
154
|
-
>,
|
|
155
|
-
event: Readonly<Pick<CellMouseEvent, "preventGridDefault">>
|
|
156
|
-
): void => {
|
|
157
|
-
if (args.column.key !== "rowNumber" && !(isReadonly === true)) {
|
|
158
|
-
event.preventGridDefault();
|
|
159
|
-
args.selectCell(true);
|
|
160
|
-
}
|
|
161
|
-
}}
|
|
162
|
-
onRowsChange={isReadonly === true ? undefined : handleRowsChange}
|
|
163
|
-
rows={localRows}
|
|
164
|
-
style={{ height: "100%" }}
|
|
165
|
-
/>
|
|
166
|
-
);
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
const areEqual = (
|
|
170
|
-
prevProps: ReadonlyNativeSurface<SheetEditorProps>,
|
|
171
|
-
nextProps: ReadonlyNativeSurface<SheetEditorProps>
|
|
172
|
-
): boolean =>
|
|
173
|
-
prevProps.currentVersionIndex === nextProps.currentVersionIndex &&
|
|
174
|
-
prevProps.isCurrentVersion === nextProps.isCurrentVersion &&
|
|
175
|
-
!(prevProps.status === "streaming" && nextProps.status === "streaming") &&
|
|
176
|
-
prevProps.content === nextProps.content &&
|
|
177
|
-
prevProps.saveContent === nextProps.saveContent &&
|
|
178
|
-
prevProps.isReadonly === nextProps.isReadonly;
|
|
179
|
-
|
|
180
|
-
export const SpreadsheetEditor = memo(PureSpreadsheetEditor, areEqual);
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export const sheetGuidelines = `
|
|
2
|
-
IMPORTANT CSV FORMATTING RULES:
|
|
3
|
-
- NEVER use commas (,) within cell contents as they will break the CSV format
|
|
4
|
-
- For numbers over 999, do not use any thousand separators (write as: 10000 not 10,000)
|
|
5
|
-
- Use semicolons (;) or spaces to separate multiple items in a cell`;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
eveDocumentCreateInput,
|
|
3
|
-
eveDocumentEditInput,
|
|
4
|
-
eveDocumentWriteResult,
|
|
5
|
-
} from "@/chatjs/core/documents/contracts";
|
|
6
|
-
import type { ToolContext } from "eve/tools";
|
|
7
|
-
import { defineTool } from "eve/tools";
|
|
8
|
-
import { executeEveDocumentTool } from "@/lib/eve/document-tools";
|
|
9
|
-
import { sheetGuidelines } from "./guidelines";
|
|
10
|
-
import type { z } from "zod";
|
|
11
|
-
|
|
12
|
-
type CreateSheetDocumentInput = Readonly<
|
|
13
|
-
Omit<z.infer<typeof eveDocumentCreateInput>, "fileIds"> & {
|
|
14
|
-
fileIds: readonly string[];
|
|
15
|
-
}
|
|
16
|
-
>;
|
|
17
|
-
|
|
18
|
-
type EditSheetDocumentInput = Readonly<
|
|
19
|
-
Omit<z.infer<typeof eveDocumentEditInput>, "fileIds"> & {
|
|
20
|
-
fileIds: readonly string[];
|
|
21
|
-
}
|
|
22
|
-
>;
|
|
23
|
-
|
|
24
|
-
type ReadonlyDocumentToolContext = Readonly<
|
|
25
|
-
Pick<ToolContext, "callId" | "session"> & {
|
|
26
|
-
abortSignal: Readonly<AbortSignal>;
|
|
27
|
-
}
|
|
28
|
-
>;
|
|
29
|
-
|
|
30
|
-
const createSheetDocument = defineTool({
|
|
31
|
-
description: `Create a new sheet document in this conversation. Supply the complete content and a descriptive title. ${sheetGuidelines}`,
|
|
32
|
-
execute: async (
|
|
33
|
-
input: CreateSheetDocumentInput,
|
|
34
|
-
context: ReadonlyDocumentToolContext
|
|
35
|
-
) =>
|
|
36
|
-
eveDocumentWriteResult.parse(
|
|
37
|
-
await executeEveDocumentTool("createSheetDocument", input, context)
|
|
38
|
-
),
|
|
39
|
-
inputSchema: eveDocumentCreateInput,
|
|
40
|
-
outputSchema: eveDocumentWriteResult,
|
|
41
|
-
});
|
|
42
|
-
const editSheetDocument = defineTool({
|
|
43
|
-
description: `Edit an existing sheet document in this conversation. Read the document first and supply its revision ID. Supply the complete replacement content. ${sheetGuidelines}`,
|
|
44
|
-
execute: async (
|
|
45
|
-
input: EditSheetDocumentInput,
|
|
46
|
-
context: ReadonlyDocumentToolContext
|
|
47
|
-
) =>
|
|
48
|
-
eveDocumentWriteResult.parse(
|
|
49
|
-
await executeEveDocumentTool("editSheetDocument", input, context)
|
|
50
|
-
),
|
|
51
|
-
inputSchema: eveDocumentEditInput,
|
|
52
|
-
outputSchema: eveDocumentWriteResult,
|
|
53
|
-
});
|
|
54
|
-
export { createSheetDocument, editSheetDocument };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"envRequirements": [{ "options": [["TAVILY_API_KEY"]] }],
|
|
3
|
-
"id": "tavily-search",
|
|
4
|
-
"kind": "tool",
|
|
5
|
-
"requiresTools": [],
|
|
6
|
-
"slot": "webSearch",
|
|
7
|
-
"tools": [
|
|
8
|
-
{
|
|
9
|
-
"composer": {
|
|
10
|
-
"icon": "Globe",
|
|
11
|
-
"name": "Web Search",
|
|
12
|
-
"shortName": "Search"
|
|
13
|
-
},
|
|
14
|
-
"rendererExport": "WebSearchRenderer",
|
|
15
|
-
"toolExport": "webSearch"
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
"contractVersion": 1
|
|
19
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { webSearchInput, webSearchResult } from "./schemas";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import type { ReadonlyNativeSurface } from "@/lib/readonly-native-surface";
|
|
5
|
-
import type { ToolRendererProps } from "@/chatjs/core/tools/define-renderer";
|
|
6
|
-
import { WebSearch } from "@/components/part/web-search";
|
|
7
|
-
import { defineToolRenderer } from "@/chatjs/core/tools/define-renderer";
|
|
8
|
-
|
|
9
|
-
const WebSearchView = ({
|
|
10
|
-
tool,
|
|
11
|
-
messageId,
|
|
12
|
-
}: ReadonlyNativeSurface<{
|
|
13
|
-
tool: ToolRendererProps<
|
|
14
|
-
typeof webSearchInput,
|
|
15
|
-
typeof webSearchResult
|
|
16
|
-
>["tool"];
|
|
17
|
-
messageId: string;
|
|
18
|
-
isReadonly: boolean;
|
|
19
|
-
}>): React.JSX.Element => <WebSearch messageId={messageId} part={tool} />;
|
|
20
|
-
|
|
21
|
-
export const WebSearchRenderer = defineToolRenderer({
|
|
22
|
-
inputSchema: webSearchInput,
|
|
23
|
-
outputSchema: webSearchResult,
|
|
24
|
-
render: WebSearchView,
|
|
25
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { searchQueriesSchema } from "@/tools/platform/search-presentation";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
|
|
4
|
-
const webSearchInput = z.object({
|
|
5
|
-
exclude_domains: z
|
|
6
|
-
.array(z.string())
|
|
7
|
-
.describe(
|
|
8
|
-
"Domains to exclude from all results. Pass null for no exclusions."
|
|
9
|
-
)
|
|
10
|
-
.nullable(),
|
|
11
|
-
searchDepth: z
|
|
12
|
-
.enum(["basic", "advanced"])
|
|
13
|
-
.describe('Search depth to use. Pass null for "basic".')
|
|
14
|
-
.nullable(),
|
|
15
|
-
search_queries: searchQueriesSchema,
|
|
16
|
-
topics: z
|
|
17
|
-
.array(z.enum(["general", "news"]))
|
|
18
|
-
.describe(
|
|
19
|
-
"Array of topic types to search for. Pass null for general search."
|
|
20
|
-
)
|
|
21
|
-
.nullable(),
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const searchResult = z.object({
|
|
25
|
-
content: z.string(),
|
|
26
|
-
title: z.string(),
|
|
27
|
-
url: z.string(),
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const searchQuery = z.object({ maxResults: z.number(), query: z.string() });
|
|
31
|
-
const queryResults = z.object({
|
|
32
|
-
query: searchQuery,
|
|
33
|
-
results: z.array(searchResult),
|
|
34
|
-
});
|
|
35
|
-
const webSearchResult = z.object({
|
|
36
|
-
error: z.string().optional(),
|
|
37
|
-
searches: z.array(queryResults),
|
|
38
|
-
});
|
|
39
|
-
export { webSearchInput, webSearchResult };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
const environmentSchema = z.object({
|
|
4
|
-
TAVILY_API_KEY: z.string().optional(),
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
const readToolEnvironment = (
|
|
8
|
-
environment: Readonly<NodeJS.ProcessEnv> = process.env
|
|
9
|
-
) => environmentSchema.parse(environment);
|
|
10
|
-
|
|
11
|
-
export { readToolEnvironment };
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, expect, test, vi } from "vitest";
|
|
2
|
-
import { testToolContext } from "@/tests/helpers/eve-tool-context";
|
|
3
|
-
import { webSearch } from "./tool";
|
|
4
|
-
import { webSearchInput } from "./schemas";
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
|
|
7
|
-
const { search } = vi.hoisted(() => ({ search: vi.fn() }));
|
|
8
|
-
vi.mock("@tavily/core", (): { tavily: () => { search: typeof search } } => ({
|
|
9
|
-
tavily: (): { search: typeof search } => ({ search }),
|
|
10
|
-
}));
|
|
11
|
-
beforeEach(() => vi.stubEnv("TAVILY_API_KEY", "test-key"));
|
|
12
|
-
afterEach(() => vi.unstubAllEnvs());
|
|
13
|
-
|
|
14
|
-
vi.mock("@/lib/id", () => ({ generateUUID: (): string => "search-update" }));
|
|
15
|
-
|
|
16
|
-
const collect = async <SearchValue>(
|
|
17
|
-
value:
|
|
18
|
-
| Readonly<SearchValue>
|
|
19
|
-
| Readonly<Promise<SearchValue>>
|
|
20
|
-
| Readonly<AsyncIterable<SearchValue>>
|
|
21
|
-
): Promise<SearchValue[]> => {
|
|
22
|
-
const result = await value;
|
|
23
|
-
if (
|
|
24
|
-
typeof result !== "object" ||
|
|
25
|
-
result === null ||
|
|
26
|
-
!(Symbol.asyncIterator in result)
|
|
27
|
-
) {
|
|
28
|
-
throw new Error("Expected streaming search results");
|
|
29
|
-
}
|
|
30
|
-
return await Array.fromAsync(result);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
test("native search streams sources and seals a final cost receipt", async () => {
|
|
34
|
-
search.mockResolvedValue({
|
|
35
|
-
results: [
|
|
36
|
-
{ content: "Evidence", title: "Source", url: "https://example.com" },
|
|
37
|
-
],
|
|
38
|
-
});
|
|
39
|
-
const results = await collect(
|
|
40
|
-
webSearch.execute(
|
|
41
|
-
{
|
|
42
|
-
exclude_domains: ["excluded.com"],
|
|
43
|
-
searchDepth: "advanced",
|
|
44
|
-
search_queries: [{ maxResults: 3, query: "news" }],
|
|
45
|
-
topics: ["news"],
|
|
46
|
-
},
|
|
47
|
-
testToolContext({ callId: "call" })
|
|
48
|
-
)
|
|
49
|
-
);
|
|
50
|
-
const finalResult = results.at(-1);
|
|
51
|
-
if (!finalResult) {
|
|
52
|
-
throw new Error("Expected a final search result");
|
|
53
|
-
}
|
|
54
|
-
expect(search).toHaveBeenCalledWith(
|
|
55
|
-
"news",
|
|
56
|
-
expect.objectContaining({
|
|
57
|
-
days: 7,
|
|
58
|
-
excludeDomains: ["excluded.com"],
|
|
59
|
-
maxResults: 3,
|
|
60
|
-
searchDepth: "advanced",
|
|
61
|
-
topic: "news",
|
|
62
|
-
})
|
|
63
|
-
);
|
|
64
|
-
expect(finalResult).toMatchObject({
|
|
65
|
-
output: { searches: [{ results: [{ title: "Source" }] }] },
|
|
66
|
-
status: "success",
|
|
67
|
-
usage: { costUsd: 0.05 },
|
|
68
|
-
});
|
|
69
|
-
expect(finalResult.updates).toContainEqual(
|
|
70
|
-
expect.objectContaining({
|
|
71
|
-
results: [expect.objectContaining({ source: "web", title: "Source" })],
|
|
72
|
-
status: "completed",
|
|
73
|
-
toolCallId: "call",
|
|
74
|
-
type: "web",
|
|
75
|
-
})
|
|
76
|
-
);
|
|
77
|
-
expect(results.length).toBeGreaterThan(1);
|
|
78
|
-
});
|
|
79
|
-
test("strict fields remain required while explicit nulls apply defaults", async () => {
|
|
80
|
-
search.mockResolvedValue({ results: [] });
|
|
81
|
-
const json = z.toJSONSchema(webSearchInput);
|
|
82
|
-
expect(json.required).toEqual(
|
|
83
|
-
expect.arrayContaining([
|
|
84
|
-
"search_queries",
|
|
85
|
-
"topics",
|
|
86
|
-
"searchDepth",
|
|
87
|
-
"exclude_domains",
|
|
88
|
-
])
|
|
89
|
-
);
|
|
90
|
-
expect(
|
|
91
|
-
webSearchInput.safeParse({ search_queries: [{ query: "defaults" }] })
|
|
92
|
-
.success
|
|
93
|
-
).toBe(false);
|
|
94
|
-
await collect(
|
|
95
|
-
webSearch.execute(
|
|
96
|
-
{
|
|
97
|
-
exclude_domains: null,
|
|
98
|
-
searchDepth: null,
|
|
99
|
-
search_queries: [{ maxResults: null, query: "defaults" }],
|
|
100
|
-
topics: null,
|
|
101
|
-
},
|
|
102
|
-
testToolContext()
|
|
103
|
-
)
|
|
104
|
-
);
|
|
105
|
-
expect(search).toHaveBeenCalledWith(
|
|
106
|
-
"defaults",
|
|
107
|
-
expect.objectContaining({
|
|
108
|
-
excludeDomains: [],
|
|
109
|
-
maxResults: 5,
|
|
110
|
-
searchDepth: "basic",
|
|
111
|
-
topic: "general",
|
|
112
|
-
})
|
|
113
|
-
);
|
|
114
|
-
});
|