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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chat-js",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "CLI for creating and extending ChatJS apps",
|
|
6
6
|
"keywords": [
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"test:gateways": "bun run template:sync && bun test --timeout 180000 ./test/gateway-selection.test.ts",
|
|
47
47
|
"test:types": "tsc --noEmit",
|
|
48
48
|
"lint": "oxlint . && oxfmt --check .",
|
|
49
|
-
"format": "oxfmt --write ."
|
|
49
|
+
"format": "oxfmt --write .",
|
|
50
|
+
"test:native-agent": "bun test/native-agent-acceptance.ts"
|
|
50
51
|
},
|
|
51
52
|
"dependencies": {
|
|
52
53
|
"@chat-js/gateways": "0.2.0",
|
|
53
|
-
"@chat-js/sandboxes": "0.2.0",
|
|
54
54
|
"@clack/prompts": "^1.0.1",
|
|
55
55
|
"commander": "^14.0.0",
|
|
56
56
|
"files-sdk": "2.5.0",
|
|
@@ -61,11 +61,16 @@
|
|
|
61
61
|
"zod": "^4.3.6"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
+
"@aws-sdk/client-s3": "3.1146.0",
|
|
64
65
|
"@chat-js/registry-validation": "workspace:*",
|
|
65
66
|
"@types/bun": "latest",
|
|
66
67
|
"@types/node": "22.13.10",
|
|
68
|
+
"@vercel/sandbox": "3.3.0",
|
|
69
|
+
"eve": "npm:@chat-js/eve@1.0.0-rc.6-chatjs.1",
|
|
67
70
|
"next": "16.3.0",
|
|
71
|
+
"playwright": "^1.59.1",
|
|
68
72
|
"png2icons": "^2.0.1",
|
|
73
|
+
"postgres": "3.4.9",
|
|
69
74
|
"tsx": "^4.19.1"
|
|
70
75
|
}
|
|
71
76
|
}
|
|
@@ -27,8 +27,8 @@ WORKFLOW_POSTGRES_URL=
|
|
|
27
27
|
# Private-network workers also require HTTPS.
|
|
28
28
|
# Optional: defaults to VERCEL_URL, APP_URL, or localhost with PORT.
|
|
29
29
|
EVE_INTERNAL_ORIGIN=
|
|
30
|
-
# Protected Vercel
|
|
31
|
-
# Vercel
|
|
30
|
+
# Protected Vercel deployments use the current invocation's project OIDC identity.
|
|
31
|
+
# Keep Vercel OIDC enabled; the app forwards it only to its own deployment.
|
|
32
32
|
# Guest admissions enforce configured credits and request limits.
|
|
33
33
|
# Retention additionally requires a cleanup schedule and verified lifecycle support.
|
|
34
34
|
|
|
@@ -75,13 +75,7 @@ CRON_SECRET=
|
|
|
75
75
|
|
|
76
76
|
# <chatjs-installed-capabilities>
|
|
77
77
|
# Credentials for the demo's installed tools and features. Fill applicable alternatives.
|
|
78
|
-
TAVILY_API_KEY=
|
|
79
|
-
FIRECRAWL_API_KEY=
|
|
80
78
|
MCP_ENCRYPTION_KEY=
|
|
81
|
-
LANGFUSE_PUBLIC_KEY=
|
|
82
|
-
LANGFUSE_SECRET_KEY=
|
|
83
|
-
# Optional Langfuse endpoint, when Langfuse is installed:
|
|
84
|
-
# LANGFUSE_BASE_URL=https://cloud.langfuse.com
|
|
85
79
|
# Vercel Sandbox alternative to runtime OIDC:
|
|
86
80
|
VERCEL_TEAM_ID=
|
|
87
81
|
VERCEL_PROJECT_ID=
|
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { defineAgent } from "eve";
|
|
2
|
+
import { applicationModel } from "../lib/eve/application-model";
|
|
3
|
+
import { config } from "../lib/config";
|
|
4
4
|
import { configureWorkflowEnvironment } from "../lib/eve/environment";
|
|
5
|
-
import { defineState } from "eve/context";
|
|
6
|
-
|
|
7
|
-
import { resolveAccountedEveModel } from "../lib/eve/model-accounting";
|
|
8
|
-
import type { DynamicModelContext } from "eve";
|
|
9
|
-
import { installedToolAvailabilityMiddleware } from "../lib/eve/tool-availability";
|
|
10
5
|
import { resolveWorkflowWorld } from "../lib/eve/world-config";
|
|
11
|
-
import { wrapLanguageModel } from "ai";
|
|
12
6
|
|
|
13
7
|
configureWorkflowEnvironment(process.env);
|
|
14
8
|
|
|
15
|
-
const selectedModel = defineState<{ modelId?: string }>(
|
|
16
|
-
"chatjs.turn-model",
|
|
17
|
-
() => ({})
|
|
18
|
-
);
|
|
19
|
-
|
|
20
9
|
export default defineAgent({
|
|
10
|
+
model: applicationModel(config.ai.workflows.chat),
|
|
11
|
+
reasoning: "provider-default",
|
|
12
|
+
defaultTools: true,
|
|
13
|
+
approval: ({ toolAnnotations }) =>
|
|
14
|
+
toolAnnotations?.readOnlyHint === true ? "approved" : "user-approval",
|
|
21
15
|
build: {
|
|
22
|
-
// Graphile's optional TypeScript config loader should load the compiler only
|
|
23
|
-
// when needed, instead of retaining its source in the eager worker bundle.
|
|
24
16
|
externalDependencies: [
|
|
25
17
|
"pino",
|
|
26
18
|
"pino-pretty",
|
|
@@ -28,27 +20,5 @@ export default defineAgent({
|
|
|
28
20
|
"typescript",
|
|
29
21
|
],
|
|
30
22
|
},
|
|
31
|
-
// ChatJS owns tool selection, execution, rendered results, and usage accounting.
|
|
32
|
-
defaultTools: false,
|
|
33
23
|
experimental: { workflow: { world: resolveWorkflowWorld() } },
|
|
34
|
-
model: defineDynamic(async (context: DynamicModelContext) => {
|
|
35
|
-
if (!isAccountSession(context.session)) {
|
|
36
|
-
return await requireSessionProfile(context.session).resolveModel();
|
|
37
|
-
}
|
|
38
|
-
const modelId = context.session.auth.current?.attributes.modelId;
|
|
39
|
-
if (typeof modelId === "string") {
|
|
40
|
-
selectedModel.update(() => ({ modelId }));
|
|
41
|
-
}
|
|
42
|
-
const resolved = await resolveAccountedEveModel(
|
|
43
|
-
selectedModel.get().modelId,
|
|
44
|
-
context
|
|
45
|
-
);
|
|
46
|
-
return {
|
|
47
|
-
...resolved,
|
|
48
|
-
model: wrapLanguageModel({
|
|
49
|
-
middleware: installedToolAvailabilityMiddleware(context.session),
|
|
50
|
-
model: resolved.model,
|
|
51
|
-
}),
|
|
52
|
-
};
|
|
53
|
-
}),
|
|
54
24
|
});
|
|
@@ -1,27 +1,47 @@
|
|
|
1
|
-
import { sessionProfiles } from "../../integrations/chat/session-profiles";
|
|
2
1
|
import { eveChannel } from "eve/channels/eve";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import { fetchEveChannelFile } from "../../lib/eve/channel-files";
|
|
6
|
-
import { resolveEveCurrentCopySeed } from "../../lib/db/eve-current-copy";
|
|
7
|
-
import { authenticateEveGateway } from "../../lib/eve/gateway-auth";
|
|
2
|
+
import { nativeBranchHistory } from "../../lib/eve/branch-history";
|
|
8
3
|
|
|
9
4
|
export default eveChannel({
|
|
10
5
|
auth: [
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
async (request) => {
|
|
7
|
+
const { authenticateEveGateway } =
|
|
8
|
+
await import("../../lib/eve/gateway-auth");
|
|
9
|
+
return await authenticateEveGateway(request);
|
|
10
|
+
},
|
|
11
|
+
async (request) => {
|
|
12
|
+
const { sessionProfiles } =
|
|
13
|
+
await import("../../integrations/chat/session-profiles");
|
|
14
|
+
for (const profile of sessionProfiles) {
|
|
15
|
+
// oxlint-disable-next-line eslint/no-await-in-loop -- Authenticators run in order and stop at the first match, as in the native channel auth chain.
|
|
16
|
+
const identity = await profile.authenticate?.(request);
|
|
17
|
+
if (identity) {
|
|
18
|
+
return identity;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
},
|
|
13
23
|
],
|
|
14
|
-
fetchFile:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
fetchFile: async (...args) => {
|
|
25
|
+
const { fetchEveChannelFile } = await import("../../lib/eve/channel-files");
|
|
26
|
+
return await fetchEveChannelFile(...args);
|
|
27
|
+
},
|
|
28
|
+
onMessage: async ({ eve }) => {
|
|
29
|
+
const reservationId = eve.caller?.attributes?.chatjsReservationId;
|
|
30
|
+
if (eve.sessionId !== undefined || typeof reservationId !== "string") {
|
|
31
|
+
return { auth: eve.caller };
|
|
32
|
+
}
|
|
33
|
+
if (!eve.caller) {
|
|
34
|
+
throw new Error("Branch history requires an authenticated owner.");
|
|
21
35
|
}
|
|
36
|
+
const { resolveEveBranchHistory } =
|
|
37
|
+
await import("../../lib/db/eve-current-copy");
|
|
38
|
+
const capture = await resolveEveBranchHistory(
|
|
39
|
+
eve.caller.principalId,
|
|
40
|
+
reservationId
|
|
41
|
+
);
|
|
22
42
|
return {
|
|
23
|
-
|
|
24
|
-
|
|
43
|
+
auth: eve.caller,
|
|
44
|
+
...(capture === null ? {} : { history: nativeBranchHistory(capture) }),
|
|
25
45
|
};
|
|
26
46
|
},
|
|
27
47
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isAccountSession } from "../../lib/eve/session-identity";
|
|
2
2
|
import { defineHook } from "eve/hooks";
|
|
3
3
|
|
|
4
|
-
import { ingestEveActivity } from "../../lib/eve/activity";
|
|
4
|
+
import type { ingestEveActivity } from "../../lib/eve/activity";
|
|
5
5
|
|
|
6
6
|
export default defineHook({
|
|
7
7
|
events: {
|
|
@@ -23,6 +23,7 @@ export default defineHook({
|
|
|
23
23
|
if (!isAccountSession(context.session)) {
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
+
const { ingestEveActivity } = await import("../../lib/eve/activity");
|
|
26
27
|
const ownerId = context.session.auth.initiator?.principalId;
|
|
27
28
|
if (typeof ownerId === "string" && ownerId !== "") {
|
|
28
29
|
await ingestEveActivity(
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import { isAccountSession } from "../../lib/eve/session-identity";
|
|
2
|
-
import {
|
|
3
|
-
getEveSubagent,
|
|
4
|
-
registerEveSubagent,
|
|
5
|
-
} from "../../lib/db/eve-subagents";
|
|
6
2
|
import type { HookContext } from "eve/hooks";
|
|
7
3
|
import { defineHook } from "eve/hooks";
|
|
8
4
|
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
import { ingestEveUsage } from "../../lib/eve/usage";
|
|
5
|
+
import type { ingestEveUsage } from "../../lib/eve/usage";
|
|
12
6
|
|
|
13
7
|
export default defineHook({
|
|
14
8
|
events: {
|
|
15
9
|
"*": async (
|
|
16
10
|
event: Parameters<typeof ingestEveUsage>[2],
|
|
17
11
|
context: Readonly<{
|
|
12
|
+
view: HookContext["view"];
|
|
18
13
|
session: Readonly<
|
|
19
14
|
Pick<HookContext["session"], "id" | "auth" | "parent">
|
|
20
15
|
>;
|
|
@@ -23,7 +18,15 @@ export default defineHook({
|
|
|
23
18
|
if (!isAccountSession(context.session)) {
|
|
24
19
|
return;
|
|
25
20
|
}
|
|
26
|
-
|
|
21
|
+
const { billing } = await import("../../integrations/billing");
|
|
22
|
+
if (billing.debit === undefined) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const [{ ingestEveUsage }, { getEveSubagent, registerEveSubagent }] =
|
|
26
|
+
await Promise.all([
|
|
27
|
+
import("../../lib/eve/usage"),
|
|
28
|
+
import("../../lib/db/eve-subagents"),
|
|
29
|
+
]);
|
|
27
30
|
const ownerId = context.session.auth.initiator?.principalId;
|
|
28
31
|
if (typeof ownerId !== "string" || ownerId === "") {
|
|
29
32
|
throw new Error("Eve billing requires an authenticated owner.");
|
|
@@ -2,8 +2,6 @@ import { isAccountSession } from "../../lib/eve/session-identity";
|
|
|
2
2
|
import type { HookContext } from "eve/hooks";
|
|
3
3
|
import { defineHook } from "eve/hooks";
|
|
4
4
|
|
|
5
|
-
import { resolveEveConversationScope } from "../../lib/eve/conversation-scope";
|
|
6
|
-
|
|
7
5
|
const conversationScopeTimeoutMilliseconds = 10_000;
|
|
8
6
|
|
|
9
7
|
export default defineHook({
|
|
@@ -19,6 +17,8 @@ export default defineHook({
|
|
|
19
17
|
if (!isAccountSession(context.session)) {
|
|
20
18
|
return;
|
|
21
19
|
}
|
|
20
|
+
const { resolveEveConversationScope } =
|
|
21
|
+
await import("../../lib/eve/conversation-scope");
|
|
22
22
|
await resolveEveConversationScope(
|
|
23
23
|
context.session.auth.initiator?.principalId,
|
|
24
24
|
context.session.parent?.rootSessionId ?? context.session.id,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assertToolConfigured } from "../../lib/eve/tool-configuration";
|
|
1
2
|
import { isAccountSession } from "../../lib/eve/session-identity";
|
|
2
3
|
import { eveTurnAccount, eveTurnTool } from "../../lib/eve/turn-tools";
|
|
3
4
|
import type { HookContext } from "eve/hooks";
|
|
@@ -14,9 +15,14 @@ export default defineHook({
|
|
|
14
15
|
}>
|
|
15
16
|
) => {
|
|
16
17
|
eveTurnAccount.update(() => isAccountSession(context.session));
|
|
17
|
-
const supplied = context.session
|
|
18
|
+
const supplied = isAccountSession(context.session)
|
|
19
|
+
? context.session.auth.current?.attributes.selectedTool
|
|
20
|
+
: undefined;
|
|
18
21
|
const selected =
|
|
19
22
|
supplied === undefined ? null : frontendToolsSchema.parse(supplied);
|
|
23
|
+
if (selected !== null && isAccountSession(context.session)) {
|
|
24
|
+
assertToolConfigured(selected);
|
|
25
|
+
}
|
|
20
26
|
eveTurnTool.update(() => selected);
|
|
21
27
|
},
|
|
22
28
|
},
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import type { DynamicContext } from "eve";
|
|
2
1
|
import { isAccountSession } from "../../lib/eve/session-identity";
|
|
3
|
-
import { requireSessionProfile } from "../../lib/eve/session-profile";
|
|
4
2
|
import { defineDynamic, defineInstructions } from "eve/instructions";
|
|
5
|
-
|
|
6
3
|
import { systemPrompt } from "../../lib/ai/prompts";
|
|
7
4
|
|
|
8
|
-
export default defineDynamic((context
|
|
9
|
-
|
|
10
|
-
content:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
export default defineDynamic(async (context) => {
|
|
6
|
+
if (isAccountSession(context.session)) {
|
|
7
|
+
return defineInstructions({ content: systemPrompt() });
|
|
8
|
+
}
|
|
9
|
+
if (
|
|
10
|
+
context.session.auth.initiator?.authenticator?.startsWith("chatjs-") !==
|
|
11
|
+
true
|
|
12
|
+
) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const { findSessionProfile } = await import("../../lib/eve/session-profile");
|
|
16
|
+
const content = findSessionProfile(context.session)?.instructions;
|
|
17
|
+
return content === undefined ? null : defineInstructions({ content });
|
|
18
|
+
});
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { defineSandbox } from "eve/sandbox";
|
|
2
|
-
import { createAppSandboxEnvironment } from "../lib/eve/sandbox-environment";
|
|
3
|
-
|
|
4
|
-
export const environment = createAppSandboxEnvironment();
|
|
1
|
+
import { DefaultSandbox, defineSandbox } from "eve/sandbox";
|
|
5
2
|
|
|
3
|
+
export const environment = DefaultSandbox.environment();
|
|
6
4
|
export default defineSandbox(async () => await environment.open());
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { missingToolConfiguration } from "../../lib/eve/tool-configuration";
|
|
1
2
|
import type { DynamicContext } from "eve";
|
|
3
|
+
import type { SessionProfile } from "../../chatjs/core/session/contracts";
|
|
2
4
|
import { isAccountSession } from "../../lib/eve/session-identity";
|
|
3
5
|
import { defineDynamic } from "eve/tools";
|
|
4
6
|
|
|
@@ -9,7 +11,23 @@ import { tools } from "../../integrations/tools/execution";
|
|
|
9
11
|
|
|
10
12
|
export default defineDynamic(async (context: DynamicContext) => {
|
|
11
13
|
if (!isAccountSession(context.session)) {
|
|
12
|
-
|
|
14
|
+
let profile: SessionProfile | undefined;
|
|
15
|
+
if (
|
|
16
|
+
context.session.auth.initiator?.authenticator?.startsWith("chatjs-") ===
|
|
17
|
+
true
|
|
18
|
+
) {
|
|
19
|
+
const { findSessionProfile } =
|
|
20
|
+
await import("../../lib/eve/session-profile");
|
|
21
|
+
profile = findSessionProfile(context.session);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return Object.fromEntries(
|
|
25
|
+
Object.entries(tools).filter(
|
|
26
|
+
([name]) =>
|
|
27
|
+
(profile?.toolNames === undefined || profile.toolNames.has(name)) &&
|
|
28
|
+
missingToolConfiguration(name).length === 0
|
|
29
|
+
)
|
|
30
|
+
);
|
|
13
31
|
}
|
|
14
32
|
const images = eveImageContext(await context.messages());
|
|
15
33
|
eveToolImageContext.update(() => images);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { webModels } from "@/integrations/chat/models";
|
|
1
2
|
import { cookies, headers } from "next/headers";
|
|
2
3
|
import React, { Suspense } from "react";
|
|
3
4
|
|
|
@@ -7,7 +8,10 @@ import { ChatLoadingShell } from "@/components/chat-loading-shell";
|
|
|
7
8
|
import { EveDeletionProvider } from "@/components/eve/eve-deletion-provider";
|
|
8
9
|
import { EveRuntimeProvider } from "@/components/eve/eve-runtime-provider";
|
|
9
10
|
import { KeyboardShortcuts } from "@/components/keyboard-shortcuts";
|
|
10
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
ChatWorkspace,
|
|
13
|
+
ChatWorkspaceContent,
|
|
14
|
+
} from "@/components/chat/chat-workspace";
|
|
11
15
|
import type { AppModelId } from "@/lib/ai/app-model-id";
|
|
12
16
|
import { config } from "@/lib/config";
|
|
13
17
|
import { isPlaywrightTestEnvironment } from "@/lib/constants";
|
|
@@ -22,13 +26,11 @@ import { HydrateClient } from "@/trpc/server";
|
|
|
22
26
|
|
|
23
27
|
import { auth } from "@/lib/auth";
|
|
24
28
|
|
|
25
|
-
const sidebarInsetClassName = "[--header-height:calc(var(--spacing)*13)]";
|
|
26
|
-
|
|
27
29
|
const resolveDefaultModel = (
|
|
28
30
|
cookieModel: string | undefined,
|
|
29
31
|
chatModels: readonly { readonly id: string }[]
|
|
30
32
|
): AppModelId => {
|
|
31
|
-
const configuredModel = config.ai.workflows.chat;
|
|
33
|
+
const configuredModel = webModels.model ?? config.ai.workflows.chat;
|
|
32
34
|
let defaultModel: AppModelId = cookieModel ?? configuredModel;
|
|
33
35
|
|
|
34
36
|
if (typeof cookieModel === "string" && cookieModel !== "") {
|
|
@@ -91,21 +93,21 @@ const ChatLayout = async ({
|
|
|
91
93
|
const content = (
|
|
92
94
|
<>
|
|
93
95
|
<AppSidebar />
|
|
94
|
-
<
|
|
96
|
+
<ChatWorkspaceContent className="h-dvh min-w-0">
|
|
95
97
|
<Suspense fallback={<ChatLoadingShell />}>
|
|
96
98
|
<ChatLayoutDynamic>{children}</ChatLayoutDynamic>
|
|
97
99
|
</Suspense>
|
|
98
|
-
</
|
|
100
|
+
</ChatWorkspaceContent>
|
|
99
101
|
</>
|
|
100
102
|
);
|
|
101
103
|
return (
|
|
102
104
|
<TRPCReactProvider>
|
|
103
105
|
<SessionProvider>
|
|
104
|
-
<
|
|
106
|
+
<ChatWorkspace defaultOpen={defaultOpen}>
|
|
105
107
|
<ChatPlugins>
|
|
106
108
|
<EveDeletionProvider>{content}</EveDeletionProvider>
|
|
107
109
|
</ChatPlugins>
|
|
108
|
-
</
|
|
110
|
+
</ChatWorkspace>
|
|
109
111
|
</SessionProvider>
|
|
110
112
|
</TRPCReactProvider>
|
|
111
113
|
);
|
|
@@ -55,7 +55,7 @@ it("runs owner-authorized family deletion with a server-controlled worker root",
|
|
|
55
55
|
expect(response.status).toBe(HTTP_STATUS.ok);
|
|
56
56
|
expect(await response.json()).toEqual({ rootId: id, status: "deleted" });
|
|
57
57
|
expect(response.headers.get("cache-control")).toBe("no-store");
|
|
58
|
-
expect(mocks.remove).toHaveBeenCalledWith("owner", id
|
|
58
|
+
expect(mocks.remove).toHaveBeenCalledWith("owner", id);
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
it("hides unavailable and foreign bindings without cleanup", async () => {
|
|
@@ -135,11 +135,7 @@ const DELETE = async (
|
|
|
135
135
|
{ headers, status: 503 }
|
|
136
136
|
);
|
|
137
137
|
}
|
|
138
|
-
const deleted = await deleteLocalEveConversationFamily(
|
|
139
|
-
ownerId,
|
|
140
|
-
id,
|
|
141
|
-
process.cwd()
|
|
142
|
-
);
|
|
138
|
+
const deleted = await deleteLocalEveConversationFamily(ownerId, id);
|
|
143
139
|
if (!deleted) {
|
|
144
140
|
return new Response(null, { headers, status: 404 });
|
|
145
141
|
}
|
|
@@ -13,9 +13,13 @@ const mocks = vi.hoisted(() => ({
|
|
|
13
13
|
after: vi.fn<(callback: () => void | Promise<void>) => void>(),
|
|
14
14
|
create: vi.fn(),
|
|
15
15
|
afterCreate: vi.fn(),
|
|
16
|
+
afterBranch: vi.fn(),
|
|
16
17
|
principal: vi.fn(),
|
|
17
18
|
}));
|
|
18
19
|
vi.mock("next/server", () => ({ after: mocks.after }));
|
|
20
|
+
vi.mock("@/integrations/chat/server", () => ({
|
|
21
|
+
chat: { afterBranch: mocks.afterBranch },
|
|
22
|
+
}));
|
|
19
23
|
vi.mock("@/lib/env", () => ({
|
|
20
24
|
env: { APP_URL: "http://localhost:3790" },
|
|
21
25
|
}));
|
|
@@ -35,9 +39,9 @@ const input = {
|
|
|
35
39
|
operationId: "00000000-0000-4000-8000-000000000001",
|
|
36
40
|
};
|
|
37
41
|
|
|
38
|
-
const request = (): Request =>
|
|
42
|
+
const request = (body: unknown = input): Request =>
|
|
39
43
|
new Request("http://localhost:3790/api/agent-conversations", {
|
|
40
|
-
body: JSON.stringify(
|
|
44
|
+
body: JSON.stringify(body),
|
|
41
45
|
headers: {
|
|
42
46
|
"content-type": "application/json",
|
|
43
47
|
origin: "http://localhost:3790",
|
|
@@ -95,6 +99,31 @@ test("defers root plugin work until after the creation response", async () => {
|
|
|
95
99
|
});
|
|
96
100
|
});
|
|
97
101
|
|
|
102
|
+
test("runs the branch callback after returning the bound session", async () => {
|
|
103
|
+
const conversationId = "00000000-0000-4000-8000-000000000002";
|
|
104
|
+
mocks.create.mockResolvedValue(
|
|
105
|
+
Response.json({ id: conversationId, sessionId: "branch-session" })
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
const response = await POST(
|
|
109
|
+
request({
|
|
110
|
+
...input,
|
|
111
|
+
fork: { conversationId: "00000000-0000-4000-8000-000000000003" },
|
|
112
|
+
})
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
expect(response.status).toBe(HTTP_STATUS.ok);
|
|
116
|
+
expect(mocks.afterBranch).not.toHaveBeenCalled();
|
|
117
|
+
const [[afterResponseCallback]] = mocks.after.mock.calls;
|
|
118
|
+
await afterResponseCallback();
|
|
119
|
+
expect(mocks.afterBranch).toHaveBeenCalledExactlyOnceWith({
|
|
120
|
+
ownerId: "account",
|
|
121
|
+
conversationId,
|
|
122
|
+
sessionId: "branch-session",
|
|
123
|
+
});
|
|
124
|
+
expect(mocks.afterCreate).not.toHaveBeenCalled();
|
|
125
|
+
});
|
|
126
|
+
|
|
98
127
|
test("signed-out callers cannot create account conversations", async () => {
|
|
99
128
|
mocks.principal.mockResolvedValue(null);
|
|
100
129
|
const response = await POST(request());
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReadonlyNativeSurface } from "@/lib/readonly-native-surface";
|
|
2
2
|
import { after } from "next/server";
|
|
3
|
+
import { chat } from "@/integrations/chat/server";
|
|
3
4
|
import { env } from "@/lib/env";
|
|
4
5
|
import {
|
|
5
6
|
conversationBinding,
|
|
@@ -33,7 +34,7 @@ export const POST = async (
|
|
|
33
34
|
principal.ownerId,
|
|
34
35
|
input.data
|
|
35
36
|
);
|
|
36
|
-
if (response.ok
|
|
37
|
+
if (response.ok) {
|
|
37
38
|
const binding = conversationBinding.safeParse(
|
|
38
39
|
await response
|
|
39
40
|
.clone()
|
|
@@ -42,6 +43,14 @@ export const POST = async (
|
|
|
42
43
|
);
|
|
43
44
|
if (binding.success) {
|
|
44
45
|
after(async () => {
|
|
46
|
+
if (input.data.fork) {
|
|
47
|
+
await chat.afterBranch({
|
|
48
|
+
ownerId: principal.ownerId,
|
|
49
|
+
conversationId: binding.data.id,
|
|
50
|
+
sessionId: binding.data.sessionId,
|
|
51
|
+
});
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
45
54
|
await runChatAfterCreate({
|
|
46
55
|
conversationId: binding.data.id,
|
|
47
56
|
message: input.data.message,
|
|
@@ -5,22 +5,14 @@ const mocks = vi.hoisted(() => ({
|
|
|
5
5
|
principal: vi.fn(),
|
|
6
6
|
read: vi.fn(),
|
|
7
7
|
cleanup: vi.fn(),
|
|
8
|
-
provider: vi.fn(),
|
|
9
|
-
files: vi.fn(),
|
|
10
8
|
}));
|
|
11
9
|
vi.mock("@/lib/eve/principal", () => ({
|
|
12
10
|
resolveEvePrincipal: mocks.principal,
|
|
13
11
|
}));
|
|
14
12
|
vi.mock("@/lib/db/eve-workspaces", () => ({ readOwnedWorkspace: mocks.read }));
|
|
15
|
-
vi.mock("@/lib/eve
|
|
13
|
+
vi.mock("@/lib/db/eve-workspace-deletion", () => ({
|
|
16
14
|
cleanupWorkspaceIfUnused: mocks.cleanup,
|
|
17
15
|
}));
|
|
18
|
-
vi.mock("@/lib/eve/purge-files", () => ({
|
|
19
|
-
purgeEveWorkspaceFiles: mocks.files,
|
|
20
|
-
}));
|
|
21
|
-
vi.mock("@/lib/sandbox/runtime", () => ({
|
|
22
|
-
getPersistentSandboxProvider: mocks.provider,
|
|
23
|
-
}));
|
|
24
16
|
vi.mock("@/lib/env", () => ({ env: { APP_URL: "http://localhost:3790" } }));
|
|
25
17
|
const id = "9f12cf31-8b45-41ae-a174-59b5276f0fe4";
|
|
26
18
|
const context = { params: Promise.resolve({ id }) };
|
|
@@ -55,38 +47,20 @@ it("hides foreign workspace IDs and rejects malformed IDs", async () => {
|
|
|
55
47
|
expect(invalid.status).toBe(400);
|
|
56
48
|
expect(mocks.cleanup).not.toHaveBeenCalled();
|
|
57
49
|
});
|
|
58
|
-
it.each(["attached conversations", "
|
|
50
|
+
it.each(["attached conversations", "pending operation"])(
|
|
59
51
|
"refuses deletion for %s without leaking internal details",
|
|
60
52
|
async (reason) => {
|
|
61
53
|
mocks.cleanup.mockRejectedValue(new Error(`private ${reason}`));
|
|
62
54
|
const result = await DELETE(request(), context);
|
|
63
55
|
expect(result.status).toBe(409);
|
|
64
56
|
expect(await result.text()).not.toContain("private");
|
|
65
|
-
expect(mocks.cleanup).toHaveBeenCalledWith(
|
|
66
|
-
"owner",
|
|
67
|
-
id,
|
|
68
|
-
mocks.provider,
|
|
69
|
-
true
|
|
70
|
-
);
|
|
57
|
+
expect(mocks.cleanup).toHaveBeenCalledWith("owner", id, true);
|
|
71
58
|
}
|
|
72
59
|
);
|
|
73
|
-
it("deletes an empty workspace and allows replay
|
|
60
|
+
it("deletes an empty workspace and allows replay", async () => {
|
|
74
61
|
const result = await DELETE(request(), context);
|
|
75
62
|
expect(result.status).toBe(200);
|
|
76
63
|
expect(await result.json()).toEqual({ workspaceId: id, status: "deleted" });
|
|
77
64
|
expect(result.headers.get("cache-control")).toBe("no-store");
|
|
78
|
-
expect(mocks.cleanup).toHaveBeenCalledWith("owner", id,
|
|
79
|
-
expect(mocks.provider).not.toHaveBeenCalled();
|
|
80
|
-
expect(mocks.files).toHaveBeenCalledWith("owner", id);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it("keeps deletion retryable when original blob cleanup fails after sandbox cleanup", async () => {
|
|
84
|
-
mocks.files.mockRejectedValueOnce(new Error("private storage failure"));
|
|
85
|
-
const failed = await DELETE(request(), context);
|
|
86
|
-
expect(failed.status).toBe(409);
|
|
87
|
-
expect(await failed.text()).not.toContain("private");
|
|
88
|
-
const retry = await DELETE(request(), context);
|
|
89
|
-
expect(retry.status).toBe(200);
|
|
90
|
-
expect(mocks.cleanup).toHaveBeenCalledTimes(2);
|
|
91
|
-
expect(mocks.files).toHaveBeenCalledTimes(2);
|
|
65
|
+
expect(mocks.cleanup).toHaveBeenCalledWith("owner", id, true);
|
|
92
66
|
});
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { readOwnedWorkspace } from "@/lib/db/eve-workspaces";
|
|
3
|
-
import { purgeEveWorkspaceFiles } from "@/lib/eve/purge-files";
|
|
4
3
|
import { env } from "@/lib/env";
|
|
5
4
|
import { resolveEvePrincipal } from "@/lib/eve/principal";
|
|
6
5
|
import { sameOrigin } from "@/lib/eve/request-policy";
|
|
7
|
-
import { cleanupWorkspaceIfUnused } from "@/lib/eve
|
|
8
|
-
import { getPersistentSandboxProvider } from "@/lib/sandbox/runtime";
|
|
6
|
+
import { cleanupWorkspaceIfUnused } from "@/lib/db/eve-workspace-deletion";
|
|
9
7
|
|
|
10
8
|
const headers = { "cache-control": "no-store" };
|
|
11
9
|
|
|
@@ -30,13 +28,7 @@ export const DELETE = async (
|
|
|
30
28
|
return new Response(null, { headers, status: 404 });
|
|
31
29
|
}
|
|
32
30
|
try {
|
|
33
|
-
await cleanupWorkspaceIfUnused(
|
|
34
|
-
principal.ownerId,
|
|
35
|
-
id,
|
|
36
|
-
getPersistentSandboxProvider,
|
|
37
|
-
true
|
|
38
|
-
);
|
|
39
|
-
await purgeEveWorkspaceFiles(principal.ownerId, id);
|
|
31
|
+
await cleanupWorkspaceIfUnused(principal.ownerId, id, true);
|
|
40
32
|
return Response.json({ workspaceId: id, status: "deleted" }, { headers });
|
|
41
33
|
} catch {
|
|
42
34
|
return Response.json(
|
|
@@ -66,7 +66,7 @@ const request = (headers: Readonly<Record<string, string>> = {}): Request =>
|
|
|
66
66
|
body: JSON.stringify({
|
|
67
67
|
message: "original",
|
|
68
68
|
modelId: "model",
|
|
69
|
-
selectedTool: "
|
|
69
|
+
selectedTool: "generateImage",
|
|
70
70
|
}),
|
|
71
71
|
headers: {
|
|
72
72
|
"content-type": "application/json",
|
|
@@ -125,7 +125,7 @@ test("keeps app correlation out of the native message body", async () => {
|
|
|
125
125
|
method: "POST",
|
|
126
126
|
}),
|
|
127
127
|
"model",
|
|
128
|
-
"
|
|
128
|
+
"generateImage"
|
|
129
129
|
);
|
|
130
130
|
});
|
|
131
131
|
|
|
Binary file
|
|
Binary file
|