chat-js 1.0.0-alpha.7 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/dist/index.js +7487 -6859
- package/package.json +2 -2
- package/templates/chat-app/AGENTS.md +1 -1
- package/templates/chat-app/agent/agent.ts +0 -2
- package/templates/chat-app/agent/hooks/followup-suggestions.ts +1 -1
- package/templates/chat-app/agent/hooks/projects.ts +1 -1
- package/templates/chat-app/agent/hooks/search.ts +1 -1
- package/templates/chat-app/agent/instructions/projects.ts +1 -1
- package/templates/chat-app/agent/tools/mcp.ts +1 -1
- package/templates/chat-app/app/(auth)/device-login/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/api/files/upload/route.ts +1 -1
- package/templates/chat-app/app/(chat)/chat/{[id] → [chatId]}/page.tsx +4 -4
- package/templates/chat-app/app/(chat)/project/[projectId]/chat/[chatId]/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/project/[projectId]/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/settings/connectors/[connectorId]/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/settings/connectors/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/settings/models/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/share/[id]/page.tsx +1 -1
- package/templates/chat-app/app/api/agent-conversations/route.test.ts +5 -5
- package/templates/chat-app/app/api/agent-conversations/route.ts +2 -2
- package/templates/chat-app/app/api/agent-response-groups/route.test.ts +5 -5
- package/templates/chat-app/app/api/agent-response-groups/route.ts +1 -1
- package/templates/chat-app/app/api/eve/[...path]/route.test.ts +133 -4
- package/templates/chat-app/app/api/eve/[...path]/route.ts +175 -49
- package/templates/chat-app/app/api/eve-guest/route.ts +1 -1
- package/templates/chat-app/app/api/mcp/oauth/callback/route.ts +1 -1
- package/templates/chat-app/app/editor.css +0 -6
- package/templates/chat-app/app/layout.tsx +11 -18
- package/templates/chat-app/app/opengraph-image.png +0 -0
- package/templates/chat-app/chat.config.ts +0 -44
- package/templates/chat-app/chatjs/core/chat/compose.ts +4 -4
- package/templates/chat-app/chatjs/core/chat/contracts.ts +6 -6
- package/templates/chat-app/chatjs/core/gateway/runtime.ts +0 -7
- package/templates/chat-app/chatjs/core/installation/contracts.ts +0 -7
- package/templates/chat-app/chatjs/core/ui/slots.tsx +15 -5
- package/templates/chat-app/chatjs/generated/installed-auth-ui.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-auth.ts +4 -2
- package/templates/chat-app/chatjs/generated/installed-billing.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-chat-ui.ts +28 -24
- package/templates/chat-app/chatjs/generated/installed-chat.ts +12 -12
- package/templates/chat-app/chatjs/generated/installed-cleanup.ts +4 -4
- package/templates/chat-app/chatjs/generated/installed-instrumentation.ts +8 -2
- package/templates/chat-app/chatjs/generated/installed-layout.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-model-visibility.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-navigation.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-routers.ts +18 -19
- package/templates/chat-app/chatjs/generated/installed-session-profiles.ts +5 -3
- package/templates/chat-app/chatjs/generated/installed-sign-out.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-signed-out.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-uploads.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed.ts +2 -0
- package/templates/chat-app/chatjs/plugins/ai-titles/{chat.ts → chat-server.ts} +3 -1
- package/templates/chat-app/chatjs/plugins/ai-titles/generate-title.ts +7 -9
- package/templates/chat-app/chatjs/plugins/ai-titles/{chatjs.json → plugin.json} +3 -4
- package/templates/chat-app/chatjs/plugins/ai-titles/title-queries.ts +4 -4
- package/templates/chat-app/chatjs/plugins/attachment-uploads/{client-plugin.ts → chat-ui.ts} +1 -3
- package/templates/chat-app/chatjs/plugins/attachment-uploads/plugin.json +16 -0
- package/templates/chat-app/chatjs/plugins/credits/billing.ts +3 -1
- package/templates/chat-app/chatjs/plugins/credits/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/credits/{chatjs.json → plugin.json} +4 -13
- package/templates/chat-app/chatjs/plugins/credits/router.ts +4 -2
- package/templates/chat-app/chatjs/plugins/desktop/auth-form.tsx +3 -1
- package/templates/chat-app/chatjs/plugins/desktop/auth-server.ts +3 -1
- package/templates/chat-app/chatjs/plugins/desktop/{client-plugin.ts → layout-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/desktop/navigation.ts +3 -1
- package/templates/chat-app/chatjs/plugins/desktop/{chatjs.json → plugin.json} +4 -16
- package/templates/chat-app/chatjs/plugins/desktop/sign-out.ts +3 -1
- package/templates/chat-app/chatjs/plugins/feedback/chat-server.ts +13 -0
- package/templates/chat-app/chatjs/plugins/feedback/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/feedback/feedback-actions.tsx +4 -4
- package/templates/chat-app/chatjs/plugins/feedback/feedback-queries.ts +11 -11
- package/templates/chat-app/chatjs/plugins/feedback/feedback-schema.ts +2 -2
- package/templates/chat-app/chatjs/plugins/feedback/{chatjs.json → plugin.json} +5 -14
- package/templates/chat-app/chatjs/plugins/feedback/router.ts +9 -7
- package/templates/chat-app/chatjs/plugins/feedback/vote-message.ts +3 -6
- package/templates/chat-app/chatjs/plugins/followup-suggestions/{chat.ts → chat-server.ts} +3 -1
- package/templates/chat-app/chatjs/plugins/followup-suggestions/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/followup-suggestions/followup-queries.ts +2 -2
- package/templates/chat-app/chatjs/plugins/followup-suggestions/{chatjs.json → plugin.json} +5 -17
- package/templates/chat-app/chatjs/plugins/followup-suggestions/router.ts +8 -9
- package/templates/chat-app/chatjs/plugins/followup-suggestions/suggestions.tsx +2 -7
- package/templates/chat-app/chatjs/plugins/followup-suggestions/use-followups.ts +2 -2
- package/templates/chat-app/chatjs/plugins/guest-chat/cleanup.ts +1 -7
- package/templates/chat-app/chatjs/plugins/guest-chat/guest-auth.ts +1 -0
- package/templates/chat-app/chatjs/plugins/guest-chat/instrumentation.ts +6 -0
- package/templates/chat-app/chatjs/plugins/guest-chat/{chatjs.json → plugin.json} +6 -12
- package/templates/chat-app/chatjs/plugins/guest-chat/session-profile.ts +3 -1
- package/templates/chat-app/chatjs/plugins/guest-chat/signed-out.tsx +53 -24
- package/templates/chat-app/chatjs/plugins/image-viewer/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/image-viewer/plugin.json +11 -0
- package/templates/chat-app/chatjs/plugins/mcp/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/mcp/db/encrypted-text.ts +1 -1
- package/templates/chat-app/chatjs/plugins/mcp/{chatjs.json → plugin.json} +5 -13
- package/templates/chat-app/chatjs/plugins/mcp/router.ts +4 -2
- package/templates/chat-app/chatjs/plugins/mcp/routes/connectors-page.tsx +4 -1
- package/templates/chat-app/chatjs/plugins/mcp/setup.ts +2 -2
- package/templates/chat-app/chatjs/plugins/mcp/ui/connectors-settings.tsx +1 -1
- package/templates/chat-app/chatjs/plugins/mcp/ui/mcp-connect-dialog.tsx +1 -1
- package/templates/chat-app/chatjs/plugins/mcp/ui/mcp-create-dialog.tsx +1 -1
- package/templates/chat-app/chatjs/plugins/mcp/{mcp-env.ts → validate-env.ts} +2 -1
- package/templates/chat-app/chatjs/plugins/model-preferences/{client-plugin.ts → chat-ui.ts} +1 -3
- package/templates/chat-app/chatjs/plugins/model-preferences/model-row.tsx +3 -0
- package/templates/chat-app/chatjs/plugins/model-preferences/{use-model-preferences.ts → model-visibility.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/model-preferences/models-settings.tsx +1 -0
- package/templates/chat-app/chatjs/plugins/model-preferences/{chatjs.json → plugin.json} +5 -13
- package/templates/chat-app/chatjs/plugins/model-preferences/router.ts +5 -1
- package/templates/chat-app/chatjs/plugins/projects/{chat.ts → chat-server.ts} +3 -1
- package/templates/chat-app/chatjs/plugins/projects/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/projects/conversation-hook.ts +1 -1
- package/templates/chat-app/chatjs/plugins/projects/db/project-queries.ts +2 -2
- package/templates/chat-app/chatjs/plugins/projects/{chatjs.json → plugin.json} +5 -14
- package/templates/chat-app/chatjs/plugins/projects/router.ts +7 -7
- package/templates/chat-app/chatjs/plugins/projects/routes/project-page.tsx +10 -1
- package/templates/chat-app/chatjs/plugins/projects/ui/chat-contributions.tsx +3 -3
- package/templates/chat-app/chatjs/plugins/projects/ui/delete-project-dialog.tsx +0 -3
- package/templates/chat-app/chatjs/plugins/projects/ui/eve-move-project-dialog.tsx +1 -1
- package/templates/chat-app/chatjs/plugins/projects/ui/project-icon-picker.tsx +1 -0
- package/templates/chat-app/chatjs/plugins/projects/ui/sidebar-projects.tsx +12 -11
- package/templates/chat-app/chatjs/plugins/search/{chat.ts → chat-server.ts} +8 -6
- package/templates/chat-app/chatjs/plugins/search/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/search/{chatjs.json → plugin.json} +5 -14
- package/templates/chat-app/chatjs/plugins/search/router.ts +4 -2
- package/templates/chat-app/chatjs/plugins/search/search-backfill.ts +4 -4
- package/templates/chat-app/chatjs/plugins/search/search-chats.tsx +1 -1
- package/templates/chat-app/chatjs/plugins/search/search-hook.ts +2 -2
- package/templates/chat-app/chatjs/plugins/search/search-queries.ts +13 -13
- package/templates/chat-app/chatjs/plugins/search/search-results-view.tsx +2 -2
- package/templates/chat-app/chatjs/plugins/search/search-schema.ts +3 -3
- package/templates/chat-app/chatjs/plugins/sharing/{chat.ts → chat-server.ts} +3 -1
- package/templates/chat-app/chatjs/plugins/sharing/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/sharing/{chatjs.json → plugin.json} +5 -14
- package/templates/chat-app/chatjs/plugins/sharing/router.ts +4 -2
- package/templates/chat-app/chatjs/plugins/sharing/ui/chat-contributions.tsx +9 -11
- package/templates/chat-app/chatjs/plugins/sharing/ui/share-button.tsx +6 -6
- package/templates/chat-app/chatjs/plugins/sharing/ui/share-dialog.tsx +9 -9
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/plugin.json +12 -0
- package/templates/chat-app/chatjs/plugins/streamdown-math/chat-ui.ts +11 -0
- package/templates/chat-app/chatjs/plugins/streamdown-math/plugin.json +6 -0
- package/templates/chat-app/chatjs/plugins/streamdown-mermaid/chat-ui.ts +10 -0
- package/templates/chat-app/chatjs/plugins/streamdown-mermaid/plugin.json +6 -0
- package/templates/chat-app/chatjs/plugins/video-viewer/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/video-viewer/plugin.json +10 -0
- package/templates/chat-app/chatjs/providers/gateway.ts +49 -55
- package/templates/chat-app/chatjs/tools/attach-workspace-file/tool.ts +2 -2
- package/templates/chat-app/chatjs/tools/generate-image/tool.test.ts +3 -14
- package/templates/chat-app/components/ai-elements/response.tsx +16 -15
- package/templates/chat-app/components/auth-form-view.tsx +35 -43
- package/templates/chat-app/components/chat/chat-composer.tsx +90 -27
- package/templates/chat-app/components/chat/chat-conversation-screen.tsx +3 -3
- package/templates/chat-app/components/chat/chat-navigation.tsx +11 -1
- package/templates/chat-app/components/chat/chat-sidebar.tsx +8 -9
- package/templates/chat-app/components/chat/chat-transcript.tsx +52 -23
- package/templates/chat-app/components/chat-slots.tsx +1 -1
- package/templates/chat-app/components/composer/composer-menu.tsx +5 -4
- package/templates/chat-app/components/composer/prompt-form.tsx +7 -1
- package/templates/chat-app/components/eve/eve-chat-error.tsx +12 -2
- package/templates/chat-app/components/eve/eve-chat-header.tsx +5 -7
- package/templates/chat-app/components/eve/eve-chat-page.tsx +9 -9
- package/templates/chat-app/components/eve/eve-composer.tsx +16 -5
- package/templates/chat-app/components/eve/eve-conversation.tsx +342 -209
- package/templates/chat-app/components/eve/eve-creation-recovery.tsx +53 -3
- package/templates/chat-app/components/eve/eve-deletion-provider.tsx +10 -12
- package/templates/chat-app/components/eve/eve-history-list.tsx +4 -9
- package/templates/chat-app/components/eve/eve-logical-context.tsx +1 -0
- package/templates/chat-app/components/eve/eve-logical-navigation.tsx +3 -3
- package/templates/chat-app/components/eve/eve-message-content.tsx +252 -0
- package/templates/chat-app/components/eve/eve-message-part.tsx +13 -58
- package/templates/chat-app/components/eve/eve-pending-input.tsx +82 -5
- package/templates/chat-app/components/eve/eve-runtime-provider.tsx +74 -15
- package/templates/chat-app/components/eve/use-eve-composer-draft.ts +64 -26
- package/templates/chat-app/components/eve/use-eve-fork.ts +14 -16
- package/templates/chat-app/components/eve/use-logical-commands.ts +3 -3
- package/templates/chat-app/components/eve/use-new-eve-conversation.tsx +42 -7
- package/templates/chat-app/components/model-selection-indicator.tsx +12 -10
- package/templates/chat-app/components/model-selector-view.tsx +211 -186
- package/templates/chat-app/components/new-chat-button.tsx +1 -1
- package/templates/chat-app/components/parallel-responses/model-picker.tsx +5 -1
- package/templates/chat-app/components/parallel-responses/responses.tsx +2 -2
- package/templates/chat-app/components/settings/settings-nav.tsx +1 -1
- package/templates/chat-app/components/settings/settings-navigation-link.tsx +1 -0
- package/templates/chat-app/components/sidebar-top-row.tsx +1 -1
- package/templates/chat-app/components/ui/sidebar.tsx +1 -1
- package/templates/chat-app/components/ui/trace.tsx +1 -1
- package/templates/chat-app/hooks/use-auto-focus.ts +12 -13
- package/templates/chat-app/integrations/routers.ts +1 -1
- package/templates/chat-app/lib/ai/active-gateway.ts +0 -9
- package/templates/chat-app/lib/ai/app-models.test.ts +0 -4
- package/templates/chat-app/lib/ai/app-models.ts +11 -6
- package/templates/chat-app/lib/ai/gateways/registry.ts +4 -31
- package/templates/chat-app/lib/ai/model-catalog.ts +50 -0
- package/templates/chat-app/lib/ai/models.ts +4 -39
- package/templates/chat-app/lib/ai/providers.ts +2 -16
- package/templates/chat-app/lib/chat-after-create.test.ts +1 -1
- package/templates/chat-app/lib/chat-after-create.ts +1 -1
- package/templates/chat-app/lib/config-schema.ts +0 -96
- package/templates/chat-app/lib/db/eve-creation-failure.ts +3 -3
- package/templates/chat-app/lib/db/eve-current-copy.ts +11 -11
- package/templates/chat-app/lib/db/eve-deletion.ts +19 -19
- package/templates/chat-app/lib/db/eve-dispatch.ts +115 -18
- package/templates/chat-app/lib/db/eve-file-purge.ts +4 -4
- package/templates/chat-app/lib/db/eve-files.ts +13 -13
- package/templates/chat-app/lib/db/eve-queries.ts +28 -43
- package/templates/chat-app/lib/db/eve-response-groups.ts +30 -112
- package/templates/chat-app/lib/db/eve-subagents.ts +8 -8
- package/templates/chat-app/lib/db/eve-title.ts +2 -2
- package/templates/chat-app/lib/db/eve-workspace-deletion.ts +3 -3
- package/templates/chat-app/lib/db/eve-workspace-turns.ts +37 -5
- package/templates/chat-app/lib/db/eve-workspaces.ts +3 -3
- package/templates/chat-app/lib/db/migrations/0029_branch_identifiers.sql +23 -0
- package/templates/chat-app/lib/db/migrations/meta/0029_snapshot.json +2547 -0
- package/templates/chat-app/lib/db/migrations/meta/_journal.json +7 -0
- package/templates/chat-app/lib/db/schema.ts +19 -25
- package/templates/chat-app/lib/devtools-disabled.ts +1 -0
- package/templates/chat-app/lib/eve/completed-copy-source.test.ts +12 -2
- package/templates/chat-app/lib/eve/completed-copy-source.ts +5 -2
- package/templates/chat-app/lib/eve/contracts.test.ts +5 -5
- package/templates/chat-app/lib/eve/contracts.ts +1 -1
- package/templates/chat-app/lib/eve/conversation-scope.test.ts +2 -2
- package/templates/chat-app/lib/eve/conversation-scope.ts +4 -4
- package/templates/chat-app/lib/eve/create-conversation-operation.test.ts +1 -1
- package/templates/chat-app/lib/eve/create-response-group.test.ts +3 -3
- package/templates/chat-app/lib/eve/delete-local-conversation.ts +3 -3
- package/templates/chat-app/lib/eve/generated-files.test.ts +1 -1
- package/templates/chat-app/lib/eve/generated-files.ts +2 -2
- package/templates/chat-app/lib/eve/logical-chat.test.ts +17 -17
- package/templates/chat-app/lib/eve/logical-chat.ts +27 -31
- package/templates/chat-app/lib/eve/logical-response-slots.ts +4 -7
- package/templates/chat-app/lib/eve/message-delivery.ts +1 -0
- package/templates/chat-app/lib/eve/model-selection.test.ts +47 -50
- package/templates/chat-app/lib/eve/model-selection.ts +5 -37
- package/templates/chat-app/lib/eve/pending-create.test.ts +46 -7
- package/templates/chat-app/lib/eve/pending-create.ts +36 -4
- package/templates/chat-app/lib/eve/persisted-wire-order.test.ts +2 -2
- package/templates/chat-app/lib/eve/prepare-deletion.ts +3 -3
- package/templates/chat-app/lib/eve/purge-local-resources.ts +3 -3
- package/templates/chat-app/lib/eve/reconcile-workspace-turn.ts +2 -2
- package/templates/chat-app/lib/eve/request-policy.ts +1 -0
- package/templates/chat-app/lib/eve/resolve-creation-request.ts +1 -1
- package/templates/chat-app/lib/eve/response-group-contracts.ts +1 -1
- package/templates/chat-app/lib/eve/response-group-lineage.test.ts +12 -12
- package/templates/chat-app/lib/eve/response-group-lineage.ts +21 -24
- package/templates/chat-app/lib/eve/response-group.test.ts +2 -2
- package/templates/chat-app/lib/eve/response-group.ts +1 -1
- package/templates/chat-app/lib/eve/response-model.ts +11 -1
- package/templates/chat-app/lib/eve/restore-message-attachments.test.ts +1 -1
- package/templates/chat-app/lib/eve/restore-message-attachments.ts +3 -3
- package/templates/chat-app/lib/eve/retire-session.ts +3 -3
- package/templates/chat-app/lib/eve/steer-rejected.ts +7 -0
- package/templates/chat-app/lib/eve/tool-cost.test.ts +18 -6
- package/templates/chat-app/lib/eve/tool-cost.ts +10 -18
- package/templates/chat-app/lib/eve/workspace-turn-evidence.test.ts +27 -0
- package/templates/chat-app/lib/eve/workspace-turn-evidence.ts +20 -13
- package/templates/chat-app/oxfmt.config.ts +0 -2
- package/templates/chat-app/package.json +7 -9
- package/templates/chat-app/playwright.config.ts +5 -1
- package/templates/chat-app/proxy.ts +2 -4
- package/templates/chat-app/scripts/agent-status.ts +6 -19
- package/templates/chat-app/scripts/build-eve.test.ts +56 -0
- package/templates/chat-app/scripts/build-eve.ts +12 -5
- package/templates/chat-app/scripts/check-env.ts +77 -73
- package/templates/chat-app/scripts/environment-validation-report.ts +1 -20
- package/templates/chat-app/scripts/installed-environment-validation.ts +14 -15
- package/templates/chat-app/trpc/init.ts +2 -0
- package/templates/chat-app/trpc/react.tsx +2 -2
- package/templates/chat-app/trpc/routers/_app.test.ts +56 -0
- package/templates/chat-app/trpc/routers/_app.ts +12 -11
- package/templates/chat-app/trpc/routers/eve.router.ts +2 -2
- package/templates/electron/forge.config.ts +1 -19
- package/templates/electron/scripts/write-branding.ts +1 -5
- package/templates/chat-app/app/privacy/page.tsx +0 -153
- package/templates/chat-app/app/terms/page.tsx +0 -270
- package/templates/chat-app/chatjs/core/installation/plugin.ts +0 -13
- package/templates/chat-app/chatjs/plugins/attachment-uploads/chatjs.json +0 -22
- package/templates/chat-app/chatjs/plugins/credits/server-plugin.ts +0 -5
- package/templates/chat-app/chatjs/plugins/feedback/chat.ts +0 -13
- package/templates/chat-app/chatjs/plugins/feedback/server-plugin.ts +0 -8
- package/templates/chat-app/chatjs/plugins/followup-suggestions/server-plugin.ts +0 -8
- package/templates/chat-app/chatjs/plugins/guest-chat/server-plugin.ts +0 -12
- package/templates/chat-app/chatjs/plugins/image-viewer/chatjs.json +0 -17
- package/templates/chat-app/chatjs/plugins/mcp/server-plugin.ts +0 -5
- package/templates/chat-app/chatjs/plugins/model-preferences/server-plugin.ts +0 -8
- package/templates/chat-app/chatjs/plugins/projects/server-plugin.ts +0 -8
- package/templates/chat-app/chatjs/plugins/search/server-plugin.ts +0 -5
- package/templates/chat-app/chatjs/plugins/sharing/server-plugin.ts +0 -5
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/chatjs.json +0 -18
- package/templates/chat-app/chatjs/plugins/video-viewer/chatjs.json +0 -16
- package/templates/chat-app/components/ai-elements/context-hover.radix.tsx +0 -15
- package/templates/chat-app/components/ai-elements/context-hover.tsx +0 -17
- package/templates/chat-app/components/ai-elements/context.tsx +0 -405
- package/templates/chat-app/components/composer/editor.css +0 -96
- package/templates/chat-app/components/lexical-chat-input.tsx +0 -276
- package/templates/chat-app/components/model-selection-indicator.radix.tsx +0 -17
- package/templates/chat-app/components/ui/resizable.tsx +0 -49
- package/templates/chat-app/lib/ai/gateways/fallback-models.ts +0 -29
- package/templates/chat-app/lib/ai/models.generated.ts +0 -4242
- package/templates/chat-app/lib/ai/usage-token-details.test.ts +0 -76
- package/templates/chat-app/lib/ai/usage-token-details.ts +0 -33
- package/templates/chat-app/lib/chat-route.ts +0 -18
- package/templates/chat-app/providers/parse-chat-id-from-pathname.test.ts +0 -126
- package/templates/chat-app/providers/parse-chat-id-from-pathname.ts +0 -51
- package/templates/chat-app/scripts/fetch-models.ts +0 -30
- package/templates/chat-app/scripts/gateway-snapshot-warning.test.ts +0 -9
- /package/templates/chat-app/chatjs/plugins/attachment-uploads/{integration.tsx → uploads.ts} +0 -0
|
@@ -18,7 +18,7 @@ const row = (
|
|
|
18
18
|
forkTurnId: null,
|
|
19
19
|
id,
|
|
20
20
|
operationId,
|
|
21
|
-
|
|
21
|
+
parentBranchId: null,
|
|
22
22
|
sessionId: `session-${id}`,
|
|
23
23
|
...overrides,
|
|
24
24
|
});
|
|
@@ -37,20 +37,20 @@ describe("response group lineage", () => {
|
|
|
37
37
|
createdAt: new Date("2026-01-02"),
|
|
38
38
|
forkKind: "regenerate",
|
|
39
39
|
forkTurnId: "turn_0",
|
|
40
|
-
|
|
40
|
+
parentBranchId: "a",
|
|
41
41
|
}),
|
|
42
42
|
row("a-newest", "regenerate-a-again", {
|
|
43
43
|
createdAt: new Date("2026-01-03"),
|
|
44
44
|
forkKind: "regenerate",
|
|
45
45
|
forkTurnId: "turn_0",
|
|
46
|
-
|
|
46
|
+
parentBranchId: "a-new",
|
|
47
47
|
}),
|
|
48
48
|
];
|
|
49
49
|
const fromOtherSlot = resolveEveResponseGroupLineage("b", conversations, [
|
|
50
50
|
group,
|
|
51
51
|
]);
|
|
52
52
|
expect(fromOtherSlot?.replacements.get("operation-a")).toEqual({
|
|
53
|
-
|
|
53
|
+
branchId: "a-newest",
|
|
54
54
|
sessionId: "session-a-newest",
|
|
55
55
|
});
|
|
56
56
|
expect(
|
|
@@ -58,7 +58,7 @@ describe("response group lineage", () => {
|
|
|
58
58
|
group,
|
|
59
59
|
])?.replacements.get("operation-a")
|
|
60
60
|
).toEqual({
|
|
61
|
-
|
|
61
|
+
branchId: "a-new",
|
|
62
62
|
sessionId: "session-a-new",
|
|
63
63
|
});
|
|
64
64
|
});
|
|
@@ -69,12 +69,12 @@ describe("response group lineage", () => {
|
|
|
69
69
|
row("edit", "edit-operation", {
|
|
70
70
|
forkKind: "edit",
|
|
71
71
|
forkTurnId: "turn_0",
|
|
72
|
-
|
|
72
|
+
parentBranchId: "root",
|
|
73
73
|
}),
|
|
74
74
|
row("later", "later-operation", {
|
|
75
75
|
forkKind: "regenerate",
|
|
76
76
|
forkTurnId: "turn_1",
|
|
77
|
-
|
|
77
|
+
parentBranchId: "root",
|
|
78
78
|
}),
|
|
79
79
|
]) {
|
|
80
80
|
expect(
|
|
@@ -91,13 +91,13 @@ describe("response group lineage", () => {
|
|
|
91
91
|
const candidate = row("imported", "operation-a", {
|
|
92
92
|
forkKind: "comparison",
|
|
93
93
|
forkMessageId: "import:imported:2",
|
|
94
|
-
|
|
94
|
+
parentBranchId: "copy",
|
|
95
95
|
});
|
|
96
96
|
const copy = row("copy", "copy-operation");
|
|
97
97
|
const regenerated = row("regenerated", "regeneration", {
|
|
98
98
|
forkKind: "regenerate",
|
|
99
99
|
forkTurnId: "turn_0",
|
|
100
|
-
|
|
100
|
+
parentBranchId: "imported",
|
|
101
101
|
});
|
|
102
102
|
expect(
|
|
103
103
|
resolveEveResponseGroupLineage(
|
|
@@ -106,7 +106,7 @@ describe("response group lineage", () => {
|
|
|
106
106
|
[group]
|
|
107
107
|
)?.replacements.get("operation-a")
|
|
108
108
|
).toEqual({
|
|
109
|
-
|
|
109
|
+
branchId: "regenerated",
|
|
110
110
|
sessionId: "session-regenerated",
|
|
111
111
|
});
|
|
112
112
|
});
|
|
@@ -115,12 +115,12 @@ describe("response group lineage", () => {
|
|
|
115
115
|
const candidate = row("imported", "operation-a", {
|
|
116
116
|
forkKind: "comparison",
|
|
117
117
|
forkMessageId: "import:imported:2",
|
|
118
|
-
|
|
118
|
+
parentBranchId: copy.id,
|
|
119
119
|
});
|
|
120
120
|
const prefixRegeneration = row("prefix-regeneration", "retry-prefix", {
|
|
121
121
|
forkKind: "regenerate",
|
|
122
122
|
forkMessageId: "import:imported:2",
|
|
123
|
-
|
|
123
|
+
parentBranchId: candidate.id,
|
|
124
124
|
});
|
|
125
125
|
expect(
|
|
126
126
|
resolveEveResponseGroupLineage(
|
|
@@ -9,7 +9,7 @@ interface EveResponseGroupLineageConversation {
|
|
|
9
9
|
forkTurnId: string | null;
|
|
10
10
|
id: string;
|
|
11
11
|
operationId: string;
|
|
12
|
-
|
|
12
|
+
parentBranchId: string | null;
|
|
13
13
|
sessionId: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -19,17 +19,14 @@ type LineageConversation = Readonly<
|
|
|
19
19
|
|
|
20
20
|
interface EveResponseGroupLineage {
|
|
21
21
|
groupId: string;
|
|
22
|
-
replacements: ReadonlyMap<
|
|
23
|
-
string,
|
|
24
|
-
{ conversationId: string; sessionId: string }
|
|
25
|
-
>;
|
|
22
|
+
replacements: ReadonlyMap<string, { branchId: string; sessionId: string }>;
|
|
26
23
|
}
|
|
27
24
|
|
|
28
25
|
const localTurnBoundary = (
|
|
29
26
|
conversation: LineageConversation
|
|
30
27
|
): string | null => {
|
|
31
|
-
const {
|
|
32
|
-
if (
|
|
28
|
+
const { parentBranchId } = conversation;
|
|
29
|
+
if (parentBranchId === null || parentBranchId === "") {
|
|
33
30
|
return "turn_0";
|
|
34
31
|
}
|
|
35
32
|
const { forkMessageId } = conversation;
|
|
@@ -53,7 +50,7 @@ const latestRegeneration = (
|
|
|
53
50
|
original: LineageConversation,
|
|
54
51
|
originalBoundary: string,
|
|
55
52
|
children: ReadonlyMap<string, readonly LineageConversation[]>,
|
|
56
|
-
|
|
53
|
+
selectedBranchId: string,
|
|
57
54
|
conversationsById: ReadonlyMap<string, LineageConversation>
|
|
58
55
|
): LineageConversation | undefined => {
|
|
59
56
|
let latest = original;
|
|
@@ -76,32 +73,32 @@ const latestRegeneration = (
|
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
75
|
}
|
|
79
|
-
return valid.has(
|
|
80
|
-
? conversationsById.get(
|
|
76
|
+
return valid.has(selectedBranchId)
|
|
77
|
+
? conversationsById.get(selectedBranchId)
|
|
81
78
|
: latest;
|
|
82
79
|
};
|
|
83
80
|
|
|
84
81
|
const lineageReplacements = (
|
|
85
|
-
|
|
82
|
+
selectedBranchId: string,
|
|
86
83
|
conversations: readonly LineageConversation[],
|
|
87
84
|
candidateOperationIds: readonly string[],
|
|
88
85
|
conversationsById: ReadonlyMap<string, LineageConversation>
|
|
89
|
-
): Map<string, {
|
|
86
|
+
): Map<string, { branchId: string; sessionId: string }> => {
|
|
90
87
|
const children = new Map<string, LineageConversation[]>();
|
|
91
88
|
for (const conversation of conversations) {
|
|
92
|
-
if (!isNonEmptyString(conversation.
|
|
89
|
+
if (!isNonEmptyString(conversation.parentBranchId)) {
|
|
93
90
|
continue;
|
|
94
91
|
}
|
|
95
|
-
const existing = children.get(conversation.
|
|
92
|
+
const existing = children.get(conversation.parentBranchId);
|
|
96
93
|
if (existing) {
|
|
97
94
|
existing.push(conversation);
|
|
98
95
|
} else {
|
|
99
|
-
children.set(conversation.
|
|
96
|
+
children.set(conversation.parentBranchId, [conversation]);
|
|
100
97
|
}
|
|
101
98
|
}
|
|
102
99
|
const replacements = new Map<
|
|
103
100
|
string,
|
|
104
|
-
{
|
|
101
|
+
{ branchId: string; sessionId: string }
|
|
105
102
|
>();
|
|
106
103
|
for (const operationId of candidateOperationIds) {
|
|
107
104
|
const original = conversations.find(
|
|
@@ -115,12 +112,12 @@ const lineageReplacements = (
|
|
|
115
112
|
original,
|
|
116
113
|
originalBoundary,
|
|
117
114
|
children,
|
|
118
|
-
|
|
115
|
+
selectedBranchId,
|
|
119
116
|
conversationsById
|
|
120
117
|
);
|
|
121
118
|
if (replacement) {
|
|
122
119
|
replacements.set(operationId, {
|
|
123
|
-
|
|
120
|
+
branchId: replacement.id,
|
|
124
121
|
sessionId: replacement.sessionId,
|
|
125
122
|
});
|
|
126
123
|
}
|
|
@@ -130,13 +127,13 @@ const lineageReplacements = (
|
|
|
130
127
|
|
|
131
128
|
/**
|
|
132
129
|
* Resolve comparison ownership without treating edits or later turns as cards.
|
|
133
|
-
* @param {string}
|
|
130
|
+
* @param {string} selectedBranchId Selected conversation whose ancestry determines comparison ownership.
|
|
134
131
|
* @param {readonly LineageConversation[]} conversations Family ancestry and retry conversations available to validate regeneration lineage.
|
|
135
132
|
* @param {readonly { readonly candidateOperationIds: readonly string[]; readonly id: string; }[]} groups Comparison groups with their original candidate operation identities.
|
|
136
133
|
* @returns {EveResponseGroupLineage | undefined} The owning group and valid latest retry replacements, or absence for missing, cyclic, or inapplicable lineage.
|
|
137
134
|
*/
|
|
138
135
|
const resolveEveResponseGroupLineage = (
|
|
139
|
-
|
|
136
|
+
selectedBranchId: string,
|
|
140
137
|
conversations: readonly LineageConversation[],
|
|
141
138
|
groups: readonly {
|
|
142
139
|
readonly candidateOperationIds: readonly string[];
|
|
@@ -148,12 +145,12 @@ const resolveEveResponseGroupLineage = (
|
|
|
148
145
|
);
|
|
149
146
|
const reversedLineage: LineageConversation[] = [];
|
|
150
147
|
const visited = new Set<string>();
|
|
151
|
-
let current = conversationsById.get(
|
|
148
|
+
let current = conversationsById.get(selectedBranchId);
|
|
152
149
|
while (current && !visited.has(current.id)) {
|
|
153
150
|
reversedLineage.push(current);
|
|
154
151
|
visited.add(current.id);
|
|
155
|
-
current = isNonEmptyString(current.
|
|
156
|
-
? conversationsById.get(current.
|
|
152
|
+
current = isNonEmptyString(current.parentBranchId)
|
|
153
|
+
? conversationsById.get(current.parentBranchId)
|
|
157
154
|
: undefined;
|
|
158
155
|
}
|
|
159
156
|
if (reversedLineage.length === 0 || current) {
|
|
@@ -189,7 +186,7 @@ const resolveEveResponseGroupLineage = (
|
|
|
189
186
|
}
|
|
190
187
|
|
|
191
188
|
const replacements = lineageReplacements(
|
|
192
|
-
|
|
189
|
+
selectedBranchId,
|
|
193
190
|
conversations,
|
|
194
191
|
group.candidateOperationIds,
|
|
195
192
|
conversationsById
|
|
@@ -40,7 +40,7 @@ it("marks every multi-model edited candidate with the shared user intent", async
|
|
|
40
40
|
mocks.reserve.mockResolvedValue(group);
|
|
41
41
|
await createEveResponseGroup("owner", {
|
|
42
42
|
...input,
|
|
43
|
-
fork: {
|
|
43
|
+
fork: { branchId: crypto.randomUUID() },
|
|
44
44
|
forkKind: "edit",
|
|
45
45
|
});
|
|
46
46
|
expect(mocks.create).toHaveBeenCalledTimes(2);
|
|
@@ -57,7 +57,7 @@ it("keeps shared-workspace backpressure waiting and retries only the saved order
|
|
|
57
57
|
const shared = {
|
|
58
58
|
...input,
|
|
59
59
|
modelIds: ["one", "two", "three"],
|
|
60
|
-
fork: {
|
|
60
|
+
fork: { branchId: crypto.randomUUID() },
|
|
61
61
|
};
|
|
62
62
|
const reserved = {
|
|
63
63
|
id: crypto.randomUUID(),
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { SessionStreamEvent } from "eve/client";
|
|
2
|
+
import { activeTurn } from "eve/events";
|
|
3
|
+
import type { SessionView } from "eve/events";
|
|
2
4
|
|
|
3
5
|
const responseModelReferences = (
|
|
4
6
|
events: readonly SessionStreamEvent[]
|
|
@@ -43,4 +45,12 @@ const responseModel = (
|
|
|
43
45
|
"The response model is unavailable. Reload before regenerating."
|
|
44
46
|
);
|
|
45
47
|
};
|
|
46
|
-
|
|
48
|
+
const activeResponseModel = (
|
|
49
|
+
view: SessionView,
|
|
50
|
+
models: ReadonlyMap<string, string>
|
|
51
|
+
): string | undefined => {
|
|
52
|
+
const active = activeTurn(view);
|
|
53
|
+
return active === undefined ? undefined : models.get(active.turnId);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export { activeResponseModel, responseModel, responseModelReferences };
|
|
@@ -65,7 +65,7 @@ vi.mock("eve/client", () => ({
|
|
|
65
65
|
return { messages: mocks.messages };
|
|
66
66
|
},
|
|
67
67
|
}));
|
|
68
|
-
const input = {
|
|
68
|
+
const input = { branchId: "conversation", messageId: "message" };
|
|
69
69
|
const replayEvents = [
|
|
70
70
|
{
|
|
71
71
|
data: { messages: [] },
|
|
@@ -142,14 +142,14 @@ const isBoundHistoricalConversation = (
|
|
|
142
142
|
/**
|
|
143
143
|
* Copy trusted native history for editing after validating every historical attachment.
|
|
144
144
|
* @param {string} ownerId Owner whose conversation and file access authorize each copy.
|
|
145
|
-
* @param {Readonly<{
|
|
145
|
+
* @param {Readonly<{ branchId: string; messageId: string }>} input Conversation and user message identifying the native history to restore.
|
|
146
146
|
* @returns {Promise<z.output<typeof draftAttachment>[]>} Owned attachment references copied sequentially from the validated history.
|
|
147
147
|
*/
|
|
148
148
|
export const restoreMessageAttachments = async (
|
|
149
149
|
ownerId: string,
|
|
150
|
-
input: Readonly<{
|
|
150
|
+
input: Readonly<{ branchId: string; messageId: string }>
|
|
151
151
|
): Promise<z.output<typeof draftAttachment>[]> => {
|
|
152
|
-
const conversation = await getEveConversation(ownerId, input.
|
|
152
|
+
const conversation = await getEveConversation(ownerId, input.branchId);
|
|
153
153
|
if (!isBoundHistoricalConversation(conversation)) {
|
|
154
154
|
throw new Error("Conversation is unavailable for editing.");
|
|
155
155
|
}
|
|
@@ -115,12 +115,12 @@ const retireEveSessionForDeletion = async (
|
|
|
115
115
|
/**
|
|
116
116
|
* Revokes family access and settles every bound session before resource erasure starts.
|
|
117
117
|
* @param {string} ownerId Owner whose conversation family is placed into deletion state.
|
|
118
|
-
* @param {string}
|
|
118
|
+
* @param {string} branchId Conversation identifying the family whose bound sessions are retired.
|
|
119
119
|
* @returns {Promise< | NonNullable<Awaited<ReturnType<typeof beginEveConversationDeletion>>> | undefined >} The deletion family after session retirement, or no result when no family is available.
|
|
120
120
|
*/
|
|
121
121
|
const retireEveFamilyForDeletion = async (
|
|
122
122
|
ownerId: string,
|
|
123
|
-
|
|
123
|
+
branchId: string
|
|
124
124
|
): Promise<
|
|
125
125
|
| NonNullable<Awaited<ReturnType<typeof beginEveConversationDeletion>>>
|
|
126
126
|
| undefined
|
|
@@ -128,7 +128,7 @@ const retireEveFamilyForDeletion = async (
|
|
|
128
128
|
assertEveConfigured();
|
|
129
129
|
const lifecycle = requireEveDeletionLifecycle();
|
|
130
130
|
await lifecycle.check();
|
|
131
|
-
const family = await beginEveConversationDeletion(ownerId,
|
|
131
|
+
const family = await beginEveConversationDeletion(ownerId, branchId);
|
|
132
132
|
if (!family) {
|
|
133
133
|
return undefined;
|
|
134
134
|
}
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import { expect, test, vi } from "vitest";
|
|
2
2
|
|
|
3
|
+
import { loadModelCatalog } from "../ai/model-catalog";
|
|
3
4
|
import { createEveToolCost } from "./tool-cost";
|
|
4
5
|
|
|
6
|
+
const { fetchModels } = vi.hoisted(() => ({
|
|
7
|
+
fetchModels: vi.fn().mockResolvedValue([
|
|
8
|
+
{ id: "priced", pricing: { input: "0.000001", output: "0.000002" } },
|
|
9
|
+
{ id: "priced-image", pricing: { image: "0.04" } },
|
|
10
|
+
]),
|
|
11
|
+
}));
|
|
5
12
|
vi.mock("../ai/active-gateway", () => ({
|
|
6
|
-
getActiveGateway: () => ({
|
|
7
|
-
fetchModels: vi.fn().mockResolvedValue([
|
|
8
|
-
{ id: "priced", pricing: { input: "0.000001", output: "0.000002" } },
|
|
9
|
-
{ id: "priced-image", pricing: { image: "0.04" } },
|
|
10
|
-
]),
|
|
11
|
-
}),
|
|
13
|
+
getActiveGateway: () => ({ fetchModels }),
|
|
12
14
|
}));
|
|
15
|
+
|
|
16
|
+
test("uses cached catalog pricing for image and token charges", async () => {
|
|
17
|
+
await loadModelCatalog();
|
|
18
|
+
fetchModels.mockClear();
|
|
19
|
+
const cost = createEveToolCost();
|
|
20
|
+
cost.addImageCost("priced-image", 1, {}, "image");
|
|
21
|
+
cost.addLLMCost("priced", { inputTokens: 100, outputTokens: 200 }, "image");
|
|
22
|
+
expect(await cost.totalUsd()).toBeCloseTo(0.0405);
|
|
23
|
+
expect(fetchModels).not.toHaveBeenCalled();
|
|
24
|
+
});
|
|
13
25
|
test("combines API and nested model usage without rounding each call", async () => {
|
|
14
26
|
const cost = createEveToolCost();
|
|
15
27
|
cost.addAPICost("api", 5);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
import { getActiveGateway } from "@/lib/ai/active-gateway";
|
|
4
|
-
import type { ReadonlyNativeSurface } from "@/lib/readonly-native-surface";
|
|
1
|
+
import type { ModelData } from "@/lib/ai/model-data";
|
|
2
|
+
import { loadModelCatalog } from "@/lib/ai/model-catalog";
|
|
5
3
|
|
|
6
4
|
import { createToolUsage } from "./tool-usage";
|
|
7
5
|
import type { ToolUsage } from "./tool-usage";
|
|
@@ -11,17 +9,12 @@ interface TokenUsage {
|
|
|
11
9
|
outputTokens?: number;
|
|
12
10
|
}
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
const pricingForModel = (
|
|
16
|
-
fetchedModels: readonly {
|
|
17
|
-
readonly id: string;
|
|
18
|
-
readonly pricing: ReadonlyNativeSurface<AiGatewayModel["pricing"]>;
|
|
19
|
-
}[],
|
|
12
|
+
const pricingForModel = async (
|
|
20
13
|
modelId: string
|
|
21
|
-
):
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
): Promise<ModelData["pricing"] | undefined> => {
|
|
15
|
+
const models = await loadModelCatalog();
|
|
16
|
+
return models.find((model) => model.id === modelId)?.pricing;
|
|
17
|
+
};
|
|
25
18
|
|
|
26
19
|
const tokenCost = (
|
|
27
20
|
tokens: number | undefined,
|
|
@@ -79,8 +72,8 @@ export const createEveToolCost = (
|
|
|
79
72
|
if (!Number.isInteger(count) || count < 0) {
|
|
80
73
|
throw new Error("Invalid generated image count.");
|
|
81
74
|
}
|
|
82
|
-
const
|
|
83
|
-
const rate = Number(
|
|
75
|
+
const pricing = await pricingForModel(modelId);
|
|
76
|
+
const rate = Number(pricing?.image);
|
|
84
77
|
if (!Number.isFinite(rate) || rate < 0) {
|
|
85
78
|
throw new Error("Image provider pricing is unavailable.");
|
|
86
79
|
}
|
|
@@ -99,8 +92,7 @@ export const createEveToolCost = (
|
|
|
99
92
|
) {
|
|
100
93
|
throw new Error("Provider usage is unavailable.");
|
|
101
94
|
}
|
|
102
|
-
const
|
|
103
|
-
const pricing = pricingForModel(fetchedModels, modelId);
|
|
95
|
+
const pricing = await pricingForModel(modelId);
|
|
104
96
|
return (
|
|
105
97
|
tokenCost(tokens.inputTokens, pricing?.input) +
|
|
106
98
|
tokenCost(tokens.outputTokens, pricing?.output)
|
|
@@ -112,6 +112,33 @@ it("never releases a branch before its initial delivery is consumed and settled"
|
|
|
112
112
|
);
|
|
113
113
|
});
|
|
114
114
|
|
|
115
|
+
it("releases an unread steer ignored when its active turn was cancelled", () => {
|
|
116
|
+
const steer = { deliveryId: "steer" };
|
|
117
|
+
const stopping: WorkspaceTurnEvent[] = [
|
|
118
|
+
...prefix,
|
|
119
|
+
{ type: "delivery.admitted", data: steer, meta: meta(4) },
|
|
120
|
+
{
|
|
121
|
+
type: "delivery.settled",
|
|
122
|
+
data: { ...steer, outcome: "ignored" },
|
|
123
|
+
meta: meta(5),
|
|
124
|
+
},
|
|
125
|
+
{ ...handled, meta: meta(6) },
|
|
126
|
+
];
|
|
127
|
+
const cancelled: WorkspaceTurnEvent[] = [
|
|
128
|
+
...stopping,
|
|
129
|
+
{
|
|
130
|
+
...settled,
|
|
131
|
+
data: { turnId: "turn-1", outcome: "cancelled" },
|
|
132
|
+
meta: meta(7),
|
|
133
|
+
},
|
|
134
|
+
];
|
|
135
|
+
expect(hasSettledWorkspaceOperation(steer, stopping)).toBe(false);
|
|
136
|
+
expect(hasSettledWorkspaceOperation(steer, cancelled)).toBe(true);
|
|
137
|
+
expect(hasSettledWorkspaceOperation({ deliveryId: "other" }, cancelled)).toBe(
|
|
138
|
+
false
|
|
139
|
+
);
|
|
140
|
+
});
|
|
141
|
+
|
|
115
142
|
it("rejects settlement before consumption or for another turn", () => {
|
|
116
143
|
expect(
|
|
117
144
|
hasSettledWorkspaceOperation(operation, [
|
|
@@ -4,6 +4,13 @@ import { activeTurn, idle } from "eve/events";
|
|
|
4
4
|
|
|
5
5
|
export type WorkspaceTurnEvent = SessionStreamEvent;
|
|
6
6
|
|
|
7
|
+
export const ignoredDeliveryId = (
|
|
8
|
+
event: WorkspaceTurnEvent
|
|
9
|
+
): string | undefined =>
|
|
10
|
+
event.type === "delivery.settled" && event.data.outcome === "ignored"
|
|
11
|
+
? event.data.deliveryId
|
|
12
|
+
: undefined;
|
|
13
|
+
|
|
7
14
|
/** Paused approvals and queued work retain the workspace reservation. */
|
|
8
15
|
export const hasSettledWorkspaceSession = (
|
|
9
16
|
events: readonly WorkspaceTurnEvent[]
|
|
@@ -24,23 +31,23 @@ export const hasSettledWorkspaceOperation = (
|
|
|
24
31
|
},
|
|
25
32
|
events: readonly WorkspaceTurnEvent[]
|
|
26
33
|
): boolean => {
|
|
27
|
-
|
|
34
|
+
const { deliveryId } = operation;
|
|
35
|
+
if (deliveryId === null || !hasSettledWorkspaceSession(events)) {
|
|
28
36
|
return false;
|
|
29
37
|
}
|
|
30
38
|
const consumedIndex = events.findIndex(
|
|
31
39
|
(event) =>
|
|
32
|
-
event.type === "delivery.consumed" &&
|
|
33
|
-
event.data.deliveryId === operation.deliveryId
|
|
40
|
+
event.type === "delivery.consumed" && event.data.deliveryId === deliveryId
|
|
34
41
|
);
|
|
35
42
|
const consumed = events[consumedIndex];
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
if (consumed?.type !== "delivery.consumed") {
|
|
44
|
+
return events.some((event) => ignoredDeliveryId(event) === deliveryId);
|
|
45
|
+
}
|
|
46
|
+
return events
|
|
47
|
+
.slice(consumedIndex + 1)
|
|
48
|
+
.some(
|
|
49
|
+
(event) =>
|
|
50
|
+
event.type === "turn.settled" &&
|
|
51
|
+
event.data.turnId === consumed.data.turnId
|
|
52
|
+
);
|
|
46
53
|
};
|
|
@@ -20,8 +20,6 @@ export default defineConfig({
|
|
|
20
20
|
"**/composer-icons.generated.ts",
|
|
21
21
|
".eve/**",
|
|
22
22
|
"tests/eve-results/**",
|
|
23
|
-
// The model catalog is generator-owned; avoid unrelated snapshot churn.
|
|
24
|
-
"lib/ai/models.generated.ts",
|
|
25
23
|
"**/chatjs/generated/*.ts",
|
|
26
24
|
],
|
|
27
25
|
// Preserve module evaluation order; lint-policy changes must not reorder imports.
|
|
@@ -3,11 +3,16 @@
|
|
|
3
3
|
"version": "0.2.1",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
+
"imports": {
|
|
7
|
+
"#query-devtools": {
|
|
8
|
+
"default": "./lib/devtools-disabled.ts"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
6
11
|
"scripts": {
|
|
7
12
|
"prebuild": "bun run check-env",
|
|
8
13
|
"dev": "bun run check-env && EVE_SANDBOX_IMAGE_TAG=${EVE_SANDBOX_IMAGE_TAG:-0.80.1} next dev",
|
|
9
14
|
"dev:inspect": "bun run check-env && EVE_SANDBOX_IMAGE_TAG=${EVE_SANDBOX_IMAGE_TAG:-0.80.1} next dev --inspect",
|
|
10
|
-
"build": "tsx lib/db/migrate.ts --deployment && bun run eve:build && EVE_SANDBOX_IMAGE_TAG=${EVE_SANDBOX_IMAGE_TAG:-0.80.1} next build",
|
|
15
|
+
"build": "tsx lib/db/migrate.ts --deployment && bun run eve:build --next-host && EVE_SANDBOX_IMAGE_TAG=${EVE_SANDBOX_IMAGE_TAG:-0.80.1} next build",
|
|
11
16
|
"analyze": "next experimental-analyze",
|
|
12
17
|
"start": "EVE_SANDBOX_IMAGE_TAG=${EVE_SANDBOX_IMAGE_TAG:-0.80.1} next start",
|
|
13
18
|
"prod": "bun run build && bun run start",
|
|
@@ -33,8 +38,6 @@
|
|
|
33
38
|
"test:unit": "vitest run",
|
|
34
39
|
"test:types": "rm -rf .next/dev/types && next typegen . && tsc --noEmit",
|
|
35
40
|
"test:worker-bundle": "node scripts/check-worker-typescript.ts",
|
|
36
|
-
"ai:devtools": "bunx @ai-sdk/devtools",
|
|
37
|
-
"fetch:models": "bun scripts/fetch-models.ts && bun format",
|
|
38
41
|
"dev:neon": "bash scripts/with-db.sh bun dev",
|
|
39
42
|
"db:migrate:neon": "bash scripts/with-db.sh bun db:migrate",
|
|
40
43
|
"db:connect": "bun scripts/check-db.ts",
|
|
@@ -45,7 +48,6 @@
|
|
|
45
48
|
"eve:check": "tsx scripts/eve-setup.ts --check"
|
|
46
49
|
},
|
|
47
50
|
"dependencies": {
|
|
48
|
-
"@ai-sdk/devtools": "1.0.75",
|
|
49
51
|
"@ai-sdk/gateway": "4.0.145",
|
|
50
52
|
"@ai-sdk/mcp": "2.0.99",
|
|
51
53
|
"@ai-sdk/provider": "4.0.38",
|
|
@@ -54,7 +56,6 @@
|
|
|
54
56
|
"@better-auth/core": "1.6.2",
|
|
55
57
|
"@better-auth/electron": "1.6.2",
|
|
56
58
|
"@hookform/resolvers": "^5.2.1",
|
|
57
|
-
"@lexical/react": "^0.32.1",
|
|
58
59
|
"@modelcontextprotocol/sdk": "^1.24.3",
|
|
59
60
|
"@shadcn/react": "0.3.1",
|
|
60
61
|
"@streamdown/code": "^1.1.1",
|
|
@@ -63,7 +64,6 @@
|
|
|
63
64
|
"@supabase/storage-js": "2.117.2",
|
|
64
65
|
"@t3-oss/env-nextjs": "^0.13.8",
|
|
65
66
|
"@tanstack/react-query": "^5.104.1",
|
|
66
|
-
"@tanstack/react-query-devtools": "^5.80.3",
|
|
67
67
|
"@trpc/client": "^11.1.2",
|
|
68
68
|
"@trpc/server": "^11.1.2",
|
|
69
69
|
"@trpc/tanstack-react-query": "^11.1.2",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"fast-deep-equal": "^3.1.3",
|
|
88
88
|
"files-sdk": "2.5.0",
|
|
89
89
|
"guarded-fetch": "^0.1.4",
|
|
90
|
-
"
|
|
90
|
+
"katex": "0.16.45",
|
|
91
91
|
"lucide-react": "0.553.0",
|
|
92
92
|
"motion": "^12.23.24",
|
|
93
93
|
"nanoid": "^5.0.8",
|
|
@@ -100,7 +100,6 @@
|
|
|
100
100
|
"react-dom": "19.2.3",
|
|
101
101
|
"react-hook-form": "^7.62.0",
|
|
102
102
|
"react-markdown": "^10.1.0",
|
|
103
|
-
"react-resizable-panels": "^4.15.0",
|
|
104
103
|
"server-only": "^0.0.1",
|
|
105
104
|
"shadcn": "^4.22.1",
|
|
106
105
|
"shiki": "^3.19.0",
|
|
@@ -108,7 +107,6 @@
|
|
|
108
107
|
"streamdown": "^2.5.0",
|
|
109
108
|
"superjson": "^2.2.2",
|
|
110
109
|
"tailwind-merge": "^3.3.1",
|
|
111
|
-
"tokenlens": "^1.3.1",
|
|
112
110
|
"typescript": "6.0.2",
|
|
113
111
|
"usehooks-ts": "^3.1.0",
|
|
114
112
|
"uuid": "^11.1.0",
|
|
@@ -99,7 +99,11 @@ export default defineConfig({
|
|
|
99
99
|
command: "bun dev",
|
|
100
100
|
reuseExistingServer: (process.env.CI ?? "") === "",
|
|
101
101
|
timeout: 120_000,
|
|
102
|
-
|
|
102
|
+
// Let the tests compile pages on demand instead of warming the chat route as a serial step.
|
|
103
|
+
url:
|
|
104
|
+
process.env.CI_PLAYWRIGHT === "true"
|
|
105
|
+
? new URL("/favicon.ico", baseURL).href
|
|
106
|
+
: baseURL,
|
|
103
107
|
},
|
|
104
108
|
/* Opt out of parallel tests on CI. */
|
|
105
109
|
workers: (process.env.CI ?? "") === "" ? undefined : CI_WORKERS,
|
|
@@ -28,9 +28,7 @@ const isPublicPage = (pathname: string): boolean => {
|
|
|
28
28
|
return (
|
|
29
29
|
pathname.startsWith("/models") ||
|
|
30
30
|
pathname.startsWith("/compare") ||
|
|
31
|
-
pathname.startsWith("/share/")
|
|
32
|
-
pathname.startsWith("/privacy") ||
|
|
33
|
-
pathname.startsWith("/terms")
|
|
31
|
+
pathname.startsWith("/share/")
|
|
34
32
|
);
|
|
35
33
|
};
|
|
36
34
|
|
|
@@ -123,6 +121,6 @@ export const config = {
|
|
|
123
121
|
* - compare
|
|
124
122
|
* - docs (Blume documentation)
|
|
125
123
|
*/
|
|
126
|
-
"/((?!api|docs|_next/static|_next/image|favicon.ico|opengraph-image|manifest|models|compare
|
|
124
|
+
"/((?!api|docs|_next/static|_next/image|favicon.ico|opengraph-image|manifest|models|compare|.*[.](?:svg|png|jpg|jpeg|gif|webp|ico|json|webmanifest)$).*)",
|
|
127
125
|
],
|
|
128
126
|
};
|