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,22 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
const environmentSchema = z.object({
|
|
4
|
-
VERCEL_TEAM_ID: z.string().optional(),
|
|
5
|
-
VERCEL_PROJECT_ID: z.string().optional(),
|
|
6
|
-
VERCEL_TOKEN: z.string().optional(),
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
const readSandboxEnvironment = (
|
|
10
|
-
environment: Readonly<NodeJS.ProcessEnv> = process.env
|
|
11
|
-
) => environmentSchema.parse(environment);
|
|
12
|
-
|
|
13
|
-
const imageEnvironmentSchema = z.object({
|
|
14
|
-
VERCEL_SANDBOX_IMAGE_JAVASCRIPT: z.string().nonempty().optional(),
|
|
15
|
-
VERCEL_SANDBOX_IMAGE_PYTHON: z.string().nonempty().optional(),
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const readSandboxImageEnvironment = (
|
|
19
|
-
environment: Readonly<NodeJS.ProcessEnv> = process.env
|
|
20
|
-
) => imageEnvironmentSchema.parse(environment);
|
|
21
|
-
|
|
22
|
-
export { readSandboxEnvironment, readSandboxImageEnvironment };
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import type { BaseChart } from "./interactive-charts";
|
|
3
|
-
import Image from "next/image";
|
|
4
|
-
import InteractiveChart from "./interactive-charts";
|
|
5
|
-
import React from "react";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
|
|
8
|
-
const chartLabels = {
|
|
9
|
-
title: z.string().default(""),
|
|
10
|
-
x_label: z.string().optional(),
|
|
11
|
-
y_label: z.string().optional(),
|
|
12
|
-
};
|
|
13
|
-
const series = z.array(
|
|
14
|
-
z.object({
|
|
15
|
-
label: z.string(),
|
|
16
|
-
points: z.array(z.tuple([z.union([z.number(), z.string()]), z.number()])),
|
|
17
|
-
})
|
|
18
|
-
);
|
|
19
|
-
const chartSchema = z.discriminatedUnion("type", [
|
|
20
|
-
z.object({
|
|
21
|
-
...chartLabels,
|
|
22
|
-
elements: series,
|
|
23
|
-
type: z.literal("line"),
|
|
24
|
-
x_scale: z
|
|
25
|
-
.literal("datetime")
|
|
26
|
-
.nullish()
|
|
27
|
-
.transform((value) => value ?? undefined),
|
|
28
|
-
}),
|
|
29
|
-
z.object({
|
|
30
|
-
...chartLabels,
|
|
31
|
-
elements: series,
|
|
32
|
-
type: z.literal("scatter"),
|
|
33
|
-
x_scale: z
|
|
34
|
-
.literal("datetime")
|
|
35
|
-
.nullish()
|
|
36
|
-
.transform((value) => value ?? undefined),
|
|
37
|
-
}),
|
|
38
|
-
z.object({
|
|
39
|
-
...chartLabels,
|
|
40
|
-
elements: z.array(
|
|
41
|
-
z.object({ group: z.string(), label: z.string(), value: z.number() })
|
|
42
|
-
),
|
|
43
|
-
type: z.literal("bar"),
|
|
44
|
-
}),
|
|
45
|
-
]);
|
|
46
|
-
const MIN_PNG_BASE64_LENGTH = 1;
|
|
47
|
-
const pngSchema = z.object({
|
|
48
|
-
base64: z.string().min(MIN_PNG_BASE64_LENGTH),
|
|
49
|
-
format: z.literal("png"),
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
export const CodeExecutionChart = ({
|
|
53
|
-
value,
|
|
54
|
-
}: {
|
|
55
|
-
readonly value: unknown;
|
|
56
|
-
}): React.JSX.Element => {
|
|
57
|
-
const parsedChart = chartSchema.safeParse(value);
|
|
58
|
-
const chart: BaseChart | null = parsedChart.success ? parsedChart.data : null;
|
|
59
|
-
const parsedPng = pngSchema.safeParse(value);
|
|
60
|
-
const pngChart = parsedPng.success ? parsedPng.data : null;
|
|
61
|
-
return (
|
|
62
|
-
<>
|
|
63
|
-
{chart && (
|
|
64
|
-
<div className="pt-1">
|
|
65
|
-
<InteractiveChart chart={chart} />
|
|
66
|
-
</div>
|
|
67
|
-
)}
|
|
68
|
-
|
|
69
|
-
{pngChart && (
|
|
70
|
-
<div className="relative aspect-[4/3] w-full">
|
|
71
|
-
<Image
|
|
72
|
-
alt="Chart output"
|
|
73
|
-
className="rounded-lg object-contain"
|
|
74
|
-
fill
|
|
75
|
-
sizes="(max-width: 768px) 100vw, 768px"
|
|
76
|
-
src={`data:image/png;base64,${pngChart.base64}`}
|
|
77
|
-
unoptimized
|
|
78
|
-
/>
|
|
79
|
-
</div>
|
|
80
|
-
)}
|
|
81
|
-
</>
|
|
82
|
-
);
|
|
83
|
-
};
|
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import type {
|
|
3
|
-
BarSeriesOption,
|
|
4
|
-
EChartsOption,
|
|
5
|
-
LineSeriesOption,
|
|
6
|
-
ScatterSeriesOption,
|
|
7
|
-
} from "echarts";
|
|
8
|
-
import { Card } from "@/components/ui/card";
|
|
9
|
-
import React from "react";
|
|
10
|
-
import ReactECharts from "echarts-for-react/lib/index";
|
|
11
|
-
import { motion } from "motion/react";
|
|
12
|
-
import { useTheme } from "next-themes";
|
|
13
|
-
|
|
14
|
-
const CHART_COLORS = [
|
|
15
|
-
"#22c55e",
|
|
16
|
-
"#3b82f6",
|
|
17
|
-
"#f59e0b",
|
|
18
|
-
"#8b5cf6",
|
|
19
|
-
"#ec4899",
|
|
20
|
-
"#06b6d4",
|
|
21
|
-
"#ef4444",
|
|
22
|
-
"#84cc16",
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
interface LineScatterElement {
|
|
26
|
-
readonly label: string;
|
|
27
|
-
readonly points: readonly (readonly [number | string, number])[];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
interface BarElement {
|
|
31
|
-
readonly group: string;
|
|
32
|
-
readonly label: string;
|
|
33
|
-
readonly value: number;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface BaseChartCommon {
|
|
37
|
-
readonly title: string;
|
|
38
|
-
readonly x_label?: string;
|
|
39
|
-
readonly y_label?: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
type LineChart = BaseChartCommon & {
|
|
43
|
-
readonly type: "line";
|
|
44
|
-
readonly x_scale?: "datetime";
|
|
45
|
-
readonly elements: readonly LineScatterElement[];
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
type ScatterChart = BaseChartCommon & {
|
|
49
|
-
readonly type: "scatter";
|
|
50
|
-
readonly x_scale?: "datetime";
|
|
51
|
-
readonly elements: readonly LineScatterElement[];
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
type BarChart = BaseChartCommon & {
|
|
55
|
-
readonly type: "bar";
|
|
56
|
-
readonly x_scale?: undefined;
|
|
57
|
-
readonly elements: readonly BarElement[];
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
type BaseChart = LineChart | ScatterChart | BarChart;
|
|
61
|
-
|
|
62
|
-
const InteractiveChart = ({
|
|
63
|
-
chart,
|
|
64
|
-
}: {
|
|
65
|
-
readonly chart: BaseChart;
|
|
66
|
-
}): React.JSX.Element => {
|
|
67
|
-
const { resolvedTheme } = useTheme();
|
|
68
|
-
const isDark = resolvedTheme === "dark";
|
|
69
|
-
const textColor = isDark ? "#e5e5e5" : "#262626";
|
|
70
|
-
const gridColor = isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.15)";
|
|
71
|
-
const tooltipBg = isDark ? "#171717" : "#ffffff";
|
|
72
|
-
|
|
73
|
-
const sharedOptions: EChartsOption = {
|
|
74
|
-
backgroundColor: "transparent",
|
|
75
|
-
grid: {
|
|
76
|
-
bottom: 32,
|
|
77
|
-
containLabel: true,
|
|
78
|
-
left: 32,
|
|
79
|
-
right: 32,
|
|
80
|
-
top: 50,
|
|
81
|
-
},
|
|
82
|
-
legend: {
|
|
83
|
-
icon: "circle",
|
|
84
|
-
itemGap: 16,
|
|
85
|
-
itemHeight: 8,
|
|
86
|
-
itemWidth: 8,
|
|
87
|
-
textStyle: { color: textColor },
|
|
88
|
-
top: 8,
|
|
89
|
-
},
|
|
90
|
-
tooltip: {
|
|
91
|
-
backgroundColor: tooltipBg,
|
|
92
|
-
borderWidth: 0,
|
|
93
|
-
className: "echarts-tooltip rounded-lg! border! border-border!",
|
|
94
|
-
padding: [6, 10],
|
|
95
|
-
textStyle: {
|
|
96
|
-
color: textColor,
|
|
97
|
-
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
98
|
-
fontSize: 13,
|
|
99
|
-
},
|
|
100
|
-
trigger: "axis",
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const getChartOptions = (): EChartsOption => {
|
|
105
|
-
const defaultAxisOptions = {
|
|
106
|
-
axisLabel: {
|
|
107
|
-
color: textColor,
|
|
108
|
-
fontSize: 11,
|
|
109
|
-
hideOverlap: true,
|
|
110
|
-
margin: 8,
|
|
111
|
-
},
|
|
112
|
-
axisLine: { lineStyle: { color: gridColor }, show: true },
|
|
113
|
-
axisTick: { show: false },
|
|
114
|
-
nameTextStyle: {
|
|
115
|
-
color: textColor,
|
|
116
|
-
fontSize: 13,
|
|
117
|
-
padding: [0, 0, 0, 0],
|
|
118
|
-
},
|
|
119
|
-
splitLine: {
|
|
120
|
-
lineStyle: { color: gridColor, type: "dashed" },
|
|
121
|
-
show: true,
|
|
122
|
-
},
|
|
123
|
-
} satisfies NonNullable<EChartsOption["xAxis"]>;
|
|
124
|
-
|
|
125
|
-
if (chart.type === "line" || chart.type === "scatter") {
|
|
126
|
-
const series = chart.elements.map(
|
|
127
|
-
(element, index): LineSeriesOption | ScatterSeriesOption => ({
|
|
128
|
-
areaStyle:
|
|
129
|
-
chart.type === "line"
|
|
130
|
-
? {
|
|
131
|
-
color: {
|
|
132
|
-
colorStops: [
|
|
133
|
-
{
|
|
134
|
-
color: `${CHART_COLORS[index % CHART_COLORS.length]}15`,
|
|
135
|
-
offset: 0,
|
|
136
|
-
},
|
|
137
|
-
{ color: "rgba(23, 23, 23, 0)", offset: 1 },
|
|
138
|
-
],
|
|
139
|
-
type: "linear",
|
|
140
|
-
x: 0,
|
|
141
|
-
x2: 0,
|
|
142
|
-
y: 0,
|
|
143
|
-
y2: 1,
|
|
144
|
-
},
|
|
145
|
-
}
|
|
146
|
-
: undefined,
|
|
147
|
-
data: element.points.map(
|
|
148
|
-
(point: readonly [number | string, number]) => {
|
|
149
|
-
const horizontalValue =
|
|
150
|
-
chart.x_scale === "datetime"
|
|
151
|
-
? new Date(point[0]).getTime()
|
|
152
|
-
: point[0];
|
|
153
|
-
return [horizontalValue, point[1]];
|
|
154
|
-
}
|
|
155
|
-
),
|
|
156
|
-
itemStyle: {
|
|
157
|
-
color: CHART_COLORS[index % CHART_COLORS.length],
|
|
158
|
-
},
|
|
159
|
-
lineStyle: {
|
|
160
|
-
color: CHART_COLORS[index % CHART_COLORS.length],
|
|
161
|
-
width: 2,
|
|
162
|
-
},
|
|
163
|
-
name: element.label,
|
|
164
|
-
smooth: true,
|
|
165
|
-
symbolSize: chart.type === "scatter" ? 10 : 0,
|
|
166
|
-
type: chart.type,
|
|
167
|
-
})
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
return {
|
|
171
|
-
...sharedOptions,
|
|
172
|
-
series,
|
|
173
|
-
xAxis: {
|
|
174
|
-
name: chart.x_label,
|
|
175
|
-
nameGap: 40,
|
|
176
|
-
nameLocation: "middle",
|
|
177
|
-
scale: true,
|
|
178
|
-
type: chart.x_scale === "datetime" ? "time" : "value",
|
|
179
|
-
...defaultAxisOptions,
|
|
180
|
-
axisLabel: {
|
|
181
|
-
...defaultAxisOptions.axisLabel,
|
|
182
|
-
formatter:
|
|
183
|
-
chart.x_scale === "datetime"
|
|
184
|
-
? (value: number): string => {
|
|
185
|
-
const date = new Date(value);
|
|
186
|
-
return date.toLocaleDateString("en-US", {
|
|
187
|
-
month: "short",
|
|
188
|
-
year: "numeric",
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
: undefined,
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
yAxis: {
|
|
195
|
-
name: chart.y_label,
|
|
196
|
-
nameGap: 50,
|
|
197
|
-
nameLocation: "middle",
|
|
198
|
-
position: "right",
|
|
199
|
-
scale: true,
|
|
200
|
-
type: "value",
|
|
201
|
-
...defaultAxisOptions,
|
|
202
|
-
},
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if (chart.type === "bar") {
|
|
207
|
-
const data: Record<string, BarElement[]> = {};
|
|
208
|
-
for (const item of chart.elements) {
|
|
209
|
-
const existingGroup = data[item.group];
|
|
210
|
-
if (existingGroup === undefined) {
|
|
211
|
-
data[item.group] = [];
|
|
212
|
-
}
|
|
213
|
-
data[item.group].push(item);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
const series = Object.entries(data).map(
|
|
217
|
-
(
|
|
218
|
-
[group, elements]: readonly [string, readonly BarElement[]],
|
|
219
|
-
index
|
|
220
|
-
): BarSeriesOption => ({
|
|
221
|
-
data: elements.map((element: Readonly<BarElement>) => [
|
|
222
|
-
element.label,
|
|
223
|
-
element.value,
|
|
224
|
-
]),
|
|
225
|
-
emphasis: {
|
|
226
|
-
itemStyle: {
|
|
227
|
-
shadowBlur: 10,
|
|
228
|
-
shadowColor: "rgba(0,0,0,0.3)",
|
|
229
|
-
},
|
|
230
|
-
},
|
|
231
|
-
itemStyle: {
|
|
232
|
-
color: CHART_COLORS[index % CHART_COLORS.length],
|
|
233
|
-
},
|
|
234
|
-
name: group,
|
|
235
|
-
stack: "total",
|
|
236
|
-
type: "bar",
|
|
237
|
-
})
|
|
238
|
-
);
|
|
239
|
-
|
|
240
|
-
return {
|
|
241
|
-
...sharedOptions,
|
|
242
|
-
series,
|
|
243
|
-
xAxis: {
|
|
244
|
-
name: chart.x_label,
|
|
245
|
-
nameGap: 40,
|
|
246
|
-
nameLocation: "middle",
|
|
247
|
-
type: "category",
|
|
248
|
-
...defaultAxisOptions,
|
|
249
|
-
},
|
|
250
|
-
yAxis: {
|
|
251
|
-
name: chart.y_label,
|
|
252
|
-
nameGap: 50,
|
|
253
|
-
nameLocation: "middle",
|
|
254
|
-
position: "right",
|
|
255
|
-
type: "value",
|
|
256
|
-
...defaultAxisOptions,
|
|
257
|
-
},
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
return sharedOptions;
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
return (
|
|
265
|
-
<motion.div
|
|
266
|
-
animate={{ opacity: 1, y: 0 }}
|
|
267
|
-
initial={{ opacity: 0, y: 20 }}
|
|
268
|
-
transition={{ duration: 0.5 }}
|
|
269
|
-
>
|
|
270
|
-
<Card className="border-border bg-card overflow-hidden">
|
|
271
|
-
<div className="p-6">
|
|
272
|
-
{chart.title && (
|
|
273
|
-
<h3 className="text-foreground mb-4 text-lg font-medium">
|
|
274
|
-
{chart.title}
|
|
275
|
-
</h3>
|
|
276
|
-
)}
|
|
277
|
-
<ReactECharts
|
|
278
|
-
notMerge
|
|
279
|
-
option={getChartOptions()}
|
|
280
|
-
style={{ height: "400px", width: "100%" }}
|
|
281
|
-
theme={resolvedTheme === "dark" ? "dark" : undefined}
|
|
282
|
-
/>
|
|
283
|
-
</div>
|
|
284
|
-
</Card>
|
|
285
|
-
</motion.div>
|
|
286
|
-
);
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
export type { BarChart, BaseChart, LineChart, ScatterChart };
|
|
290
|
-
export default InteractiveChart;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Card } from "@/components/ui/card";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import dynamic from "next/dynamic";
|
|
4
|
-
|
|
5
|
-
const ChartSkeleton = (): React.JSX.Element => (
|
|
6
|
-
<Card className="border-border bg-card overflow-hidden">
|
|
7
|
-
<div className="flex h-[400px] items-center justify-center p-6">
|
|
8
|
-
<div className="bg-muted size-8 animate-pulse rounded-md" />
|
|
9
|
-
</div>
|
|
10
|
-
</Card>
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
export type { BaseChart } from "./interactive-chart-impl";
|
|
14
|
-
export default dynamic(
|
|
15
|
-
async () => {
|
|
16
|
-
const { default: InteractiveChart } =
|
|
17
|
-
await import("./interactive-chart-impl");
|
|
18
|
-
return InteractiveChart;
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
loading: () => <ChartSkeleton />,
|
|
22
|
-
ssr: false,
|
|
23
|
-
}
|
|
24
|
-
);
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import type { CodeExecutionContext, CodeExecutionResult } from "./types";
|
|
2
|
-
|
|
3
|
-
const SUCCESS_EXIT_CODE = 0;
|
|
4
|
-
const MISSING_STATUS_LINE_INDEX = -1;
|
|
5
|
-
const STATUS_TRAILER_LINE_COUNT = 1;
|
|
6
|
-
const EXECUTION_STATUS_PREFIX = "__EXECUTION_STATUS__:";
|
|
7
|
-
|
|
8
|
-
const JAVASCRIPT_EXECUTION_TEMPLATE = `
|
|
9
|
-
import { inspect } from "node:util";
|
|
10
|
-
|
|
11
|
-
const __formatOutput = (value) => {
|
|
12
|
-
if (typeof value === "string") {
|
|
13
|
-
return value;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return inspect(value, {
|
|
17
|
-
depth: 4,
|
|
18
|
-
colors: false,
|
|
19
|
-
maxArrayLength: 100,
|
|
20
|
-
breakLength: 120,
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const __run = async () => {
|
|
25
|
-
try {
|
|
26
|
-
const __userCode = __USER_CODE_LITERAL__;
|
|
27
|
-
const __execution = await (0, eval)(
|
|
28
|
-
"(async () => {\\n" +
|
|
29
|
-
__userCode + "\\n" +
|
|
30
|
-
"return { __kind: \\"locals\\"," +
|
|
31
|
-
" result: typeof result !== \\"undefined\\" ? result : undefined," +
|
|
32
|
-
" results: typeof results !== \\"undefined\\" ? results : undefined };\\n" +
|
|
33
|
-
"})()"
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const __result =
|
|
37
|
-
__execution &&
|
|
38
|
-
typeof __execution === "object" &&
|
|
39
|
-
__execution.__kind === "locals"
|
|
40
|
-
? typeof __execution.result !== "undefined"
|
|
41
|
-
? __execution.result
|
|
42
|
-
: typeof __execution.results !== "undefined"
|
|
43
|
-
? __execution.results
|
|
44
|
-
: undefined
|
|
45
|
-
: __execution;
|
|
46
|
-
|
|
47
|
-
if (typeof __result !== "undefined") {
|
|
48
|
-
console.log(__formatOutput(__result));
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
console.log("${EXECUTION_STATUS_PREFIX}" + JSON.stringify({ success: true }));
|
|
52
|
-
} catch (error) {
|
|
53
|
-
const execError = error instanceof Error ? error : new Error(String(error));
|
|
54
|
-
console.log(
|
|
55
|
-
"${EXECUTION_STATUS_PREFIX}" +
|
|
56
|
-
JSON.stringify({
|
|
57
|
-
success: false,
|
|
58
|
-
error: {
|
|
59
|
-
name: execError.name,
|
|
60
|
-
value: execError.message,
|
|
61
|
-
traceback: execError.stack ?? execError.message,
|
|
62
|
-
},
|
|
63
|
-
})
|
|
64
|
-
);
|
|
65
|
-
process.exitCode = 1;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
await __run();
|
|
70
|
-
`;
|
|
71
|
-
|
|
72
|
-
const createWrappedCode = (code: string): string =>
|
|
73
|
-
JAVASCRIPT_EXECUTION_TEMPLATE.replace("__USER_CODE_LITERAL__", (): string =>
|
|
74
|
-
JSON.stringify(code)
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
interface JsExecInfo {
|
|
78
|
-
success?: unknown;
|
|
79
|
-
error?: unknown;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const execInfoFromExitCode = (exitCode: number): JsExecInfo => {
|
|
83
|
-
if (exitCode === SUCCESS_EXIT_CODE) {
|
|
84
|
-
return { success: true };
|
|
85
|
-
}
|
|
86
|
-
return {
|
|
87
|
-
error: {
|
|
88
|
-
name: "SandboxExecutionError",
|
|
89
|
-
traceback: "",
|
|
90
|
-
value: "Execution completed without a valid status trailer",
|
|
91
|
-
},
|
|
92
|
-
success: false,
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
const readExecutionErrorField = (error: unknown, key: string): unknown =>
|
|
97
|
-
Reflect.get(new Object(error), key);
|
|
98
|
-
|
|
99
|
-
const readExecutionError = (info: unknown): unknown => {
|
|
100
|
-
if (info === null) {
|
|
101
|
-
throw new TypeError("Sandbox execution status cannot be null.");
|
|
102
|
-
}
|
|
103
|
-
return readExecutionErrorField(info, "error");
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const decodeExecutionTrailer = (
|
|
107
|
-
raw: string
|
|
108
|
-
): { valid: true; info: unknown } | { valid: false } => {
|
|
109
|
-
try {
|
|
110
|
-
const parsed: unknown = JSON.parse(raw);
|
|
111
|
-
return { info: parsed, valid: true };
|
|
112
|
-
} catch {
|
|
113
|
-
return { valid: false };
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
const findExecutionTrailer = (
|
|
118
|
-
lines: readonly string[]
|
|
119
|
-
): { found: true; index: number; raw: string } | { found: false } => {
|
|
120
|
-
// The final trailer wins over user output that happens to share the prefix.
|
|
121
|
-
const index = lines.findLastIndex((line) =>
|
|
122
|
-
line.startsWith(EXECUTION_STATUS_PREFIX)
|
|
123
|
-
);
|
|
124
|
-
if (index === MISSING_STATUS_LINE_INDEX) {
|
|
125
|
-
return { found: false };
|
|
126
|
-
}
|
|
127
|
-
return {
|
|
128
|
-
found: true,
|
|
129
|
-
index,
|
|
130
|
-
raw: lines[index].slice(EXECUTION_STATUS_PREFIX.length),
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const parseExecutionOutput = async (
|
|
135
|
-
execResult: Readonly<{
|
|
136
|
-
stdout: () => Promise<string>;
|
|
137
|
-
exitCode: number;
|
|
138
|
-
}>
|
|
139
|
-
): Promise<{
|
|
140
|
-
outputText: string;
|
|
141
|
-
execInfo: unknown;
|
|
142
|
-
}> => {
|
|
143
|
-
const stdout = await execResult.stdout();
|
|
144
|
-
const lines = (stdout ?? "").split("\n");
|
|
145
|
-
const trailer = findExecutionTrailer(lines);
|
|
146
|
-
|
|
147
|
-
if (!trailer.found) {
|
|
148
|
-
return {
|
|
149
|
-
execInfo: execInfoFromExitCode(execResult.exitCode),
|
|
150
|
-
outputText: stdout ?? "",
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const decoded = decodeExecutionTrailer(trailer.raw);
|
|
155
|
-
if (!decoded.valid) {
|
|
156
|
-
return {
|
|
157
|
-
execInfo: execInfoFromExitCode(execResult.exitCode),
|
|
158
|
-
outputText: stdout ?? "",
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
lines.splice(trailer.index, STATUS_TRAILER_LINE_COUNT);
|
|
162
|
-
|
|
163
|
-
return {
|
|
164
|
-
execInfo: decoded.info,
|
|
165
|
-
outputText: lines.join("\n").trim(),
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
const formatExecutionMessage = (
|
|
169
|
-
parts: Readonly<{
|
|
170
|
-
outputText: string;
|
|
171
|
-
stderr: string;
|
|
172
|
-
execInfo: unknown;
|
|
173
|
-
}>,
|
|
174
|
-
context: Readonly<{
|
|
175
|
-
log: Readonly<Pick<CodeExecutionContext["log"], "error">>;
|
|
176
|
-
requestId: string;
|
|
177
|
-
}>
|
|
178
|
-
): string => {
|
|
179
|
-
const lines = [parts.outputText, parts.stderr.trim()];
|
|
180
|
-
const executionError = readExecutionError(parts.execInfo);
|
|
181
|
-
const hasExecutionError = Boolean(executionError);
|
|
182
|
-
if (hasExecutionError) {
|
|
183
|
-
lines.push(
|
|
184
|
-
`Error: ${String(readExecutionErrorField(executionError, "name"))}: ${String(readExecutionErrorField(executionError, "value"))}`
|
|
185
|
-
);
|
|
186
|
-
context.log.error(
|
|
187
|
-
{ error: executionError, requestId: context.requestId },
|
|
188
|
-
"javascript execution error"
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
return lines
|
|
192
|
-
.filter((line) => line !== "")
|
|
193
|
-
.join("\n")
|
|
194
|
-
.trim();
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
export const executeJavaScriptInSandbox = async ({
|
|
198
|
-
sandbox,
|
|
199
|
-
code,
|
|
200
|
-
log,
|
|
201
|
-
requestId,
|
|
202
|
-
}: Readonly<
|
|
203
|
-
Pick<CodeExecutionContext, "code" | "requestId"> & {
|
|
204
|
-
sandbox: Readonly<Pick<CodeExecutionContext["sandbox"], "runCommand">>;
|
|
205
|
-
log: Readonly<Pick<CodeExecutionContext["log"], "error">>;
|
|
206
|
-
}
|
|
207
|
-
>): Promise<CodeExecutionResult> => {
|
|
208
|
-
const execResult = await sandbox.runCommand({
|
|
209
|
-
args: ["--input-type=module", "-e", createWrappedCode(code)],
|
|
210
|
-
cmd: "node",
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
const { outputText, execInfo } = await parseExecutionOutput(execResult);
|
|
214
|
-
const stderr = await execResult.stderr();
|
|
215
|
-
return {
|
|
216
|
-
chart: "",
|
|
217
|
-
message: formatExecutionMessage(
|
|
218
|
-
{ execInfo, outputText, stderr },
|
|
219
|
-
{ log, requestId }
|
|
220
|
-
),
|
|
221
|
-
};
|
|
222
|
-
};
|