chat-js 1.0.0-alpha.2 → 1.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/index.js +2627 -2667
- package/package.json +10 -4
- package/templates/chat-app/.env.example +2 -8
- package/templates/chat-app/agent/agent.ts +8 -38
- package/templates/chat-app/agent/channels/eve.ts +37 -17
- package/templates/chat-app/agent/hooks/activity.ts +2 -1
- package/templates/chat-app/agent/hooks/billing.ts +11 -8
- package/templates/chat-app/agent/hooks/conversation.ts +2 -2
- package/templates/chat-app/agent/hooks/tool-selection.ts +7 -1
- package/templates/chat-app/agent/instructions/chat.ts +14 -10
- package/templates/chat-app/agent/sandbox.ts +2 -4
- package/templates/chat-app/agent/tools/installed.ts +19 -1
- package/templates/chat-app/app/(chat)/layout.tsx +10 -8
- package/templates/chat-app/app/api/agent-conversations/[id]/route.test.ts +1 -1
- package/templates/chat-app/app/api/agent-conversations/[id]/route.ts +1 -5
- package/templates/chat-app/app/api/agent-conversations/route.test.ts +31 -2
- package/templates/chat-app/app/api/agent-conversations/route.ts +10 -1
- package/templates/chat-app/app/api/agent-workspaces/[id]/route.test.ts +5 -31
- package/templates/chat-app/app/api/agent-workspaces/[id]/route.ts +2 -10
- package/templates/chat-app/app/api/eve/[...path]/route.test.ts +2 -2
- package/templates/chat-app/app/apple-icon.png +0 -0
- package/templates/chat-app/app/favicon.ico +0 -0
- package/templates/chat-app/app/icon.svg +1 -3
- package/templates/chat-app/app/opengraph-image.alt.txt +1 -0
- package/templates/chat-app/app/opengraph-image.png +0 -0
- package/templates/chat-app/chat.config.ts +0 -18
- package/templates/chat-app/chatjs/core/chat/compose.ts +35 -11
- package/templates/chat-app/chatjs/core/chat/contracts.ts +6 -0
- package/templates/chat-app/chatjs/core/installation/contracts.ts +1 -4
- package/templates/chat-app/chatjs/core/session/contracts.ts +19 -4
- package/templates/chat-app/chatjs/generated/composer-tools.ts +5 -12
- package/templates/chat-app/chatjs/generated/installed-chat-ui.ts +11 -5
- package/templates/chat-app/chatjs/generated/installed-config.ts +5 -13
- package/templates/chat-app/chatjs/generated/installed-instrumentation.ts +1 -2
- package/templates/chat-app/chatjs/generated/installed-layout.ts +1 -7
- package/templates/chat-app/chatjs/generated/installed-tools.ts +3 -3
- package/templates/chat-app/chatjs/generated/installed.ts +3 -3
- package/templates/chat-app/chatjs/generated/providers.ts +5 -11
- package/templates/chat-app/chatjs/generated/tool-availability.ts +3 -7
- package/templates/chat-app/chatjs/generated/tool-definitions.ts +3 -4
- package/templates/chat-app/chatjs/generated/tool-requirements.ts +40 -0
- package/templates/chat-app/chatjs/generated/tools.ts +7 -28
- package/templates/chat-app/chatjs/generated/ui.ts +3 -13
- package/templates/chat-app/chatjs/plugins/ai-titles/generate-title.ts +0 -2
- package/templates/chat-app/chatjs/plugins/attachment-uploads/chatjs.json +0 -1
- package/templates/chat-app/chatjs/plugins/guest-chat/session-profile.ts +2 -0
- package/templates/chat-app/chatjs/plugins/guest-chat/signed-out.tsx +70 -34
- package/templates/chat-app/chatjs/plugins/image-viewer/chatjs.json +17 -0
- package/templates/chat-app/chatjs/plugins/image-viewer/client-plugin.ts +9 -0
- package/templates/chat-app/{components → chatjs/plugins/image-viewer}/image-modal.tsx +3 -87
- package/templates/chat-app/chatjs/plugins/image-viewer/viewer-action.tsx +47 -0
- package/templates/chat-app/chatjs/plugins/mcp/composer.tsx +1 -6
- package/templates/chat-app/chatjs/plugins/projects/ui/chat-contributions.tsx +22 -2
- package/templates/chat-app/chatjs/plugins/projects/ui/sidebar-project-item.tsx +48 -33
- package/templates/chat-app/chatjs/plugins/projects/ui/sidebar-projects.tsx +41 -22
- package/templates/chat-app/chatjs/plugins/search/chat.ts +4 -0
- package/templates/chat-app/chatjs/plugins/search/search-chats.tsx +9 -3
- package/templates/chat-app/chatjs/plugins/search/search-hook.ts +5 -6
- package/templates/chat-app/chatjs/plugins/search/search-results-view.tsx +1 -1
- package/templates/chat-app/chatjs/plugins/search/search-text.ts +21 -15
- package/templates/chat-app/chatjs/plugins/search/sidebar-item.tsx +7 -1
- package/templates/chat-app/chatjs/plugins/sharing/ui/share-button.tsx +13 -3
- package/templates/chat-app/chatjs/plugins/sharing/ui/shared-page.tsx +23 -39
- package/templates/chat-app/chatjs/plugins/sharing/ui/transcript-messages.tsx +2 -2
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/chatjs.json +18 -0
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/client-plugin.ts +9 -0
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/load.ts +120 -0
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/preview.tsx +72 -0
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/viewer-action.tsx +97 -0
- package/templates/chat-app/chatjs/plugins/video-viewer/chatjs.json +16 -0
- package/templates/chat-app/chatjs/plugins/video-viewer/client-plugin.ts +9 -0
- package/templates/chat-app/chatjs/plugins/video-viewer/viewer-action.tsx +64 -0
- package/templates/chat-app/chatjs/tools/_shared/lib/define-tool-renderer.test.ts +16 -22
- package/templates/chat-app/chatjs/tools/attach-workspace-file/attach-conversation-file.ts +34 -0
- package/templates/chat-app/chatjs/tools/attach-workspace-file/attach.ts +106 -0
- package/templates/chat-app/chatjs/tools/attach-workspace-file/chatjs.json +19 -0
- package/templates/chat-app/chatjs/tools/attach-workspace-file/import.ts +71 -0
- package/templates/chat-app/chatjs/tools/attach-workspace-file/renderer.tsx +19 -0
- package/templates/chat-app/chatjs/tools/attach-workspace-file/schemas.ts +51 -0
- package/templates/chat-app/chatjs/tools/attach-workspace-file/tool.ts +62 -0
- package/templates/chat-app/chatjs/tools/deep-research/chatjs.json +18 -4
- package/templates/chat-app/chatjs/tools/deep-research/progress-panel.tsx +2 -31
- package/templates/chat-app/chatjs/tools/deep-research/renderer.tsx +7 -19
- package/templates/chat-app/chatjs/tools/deep-research/schemas.ts +1 -46
- package/templates/chat-app/chatjs/tools/deep-research/task.tsx +0 -41
- package/templates/chat-app/chatjs/tools/deep-research/tasks.tsx +2 -7
- package/templates/chat-app/chatjs/tools/generate-image/chatjs.json +4 -1
- package/templates/chat-app/chatjs/tools/generate-image/image-generation.ts +0 -1
- package/templates/chat-app/chatjs/tools/generate-image/renderer.tsx +39 -51
- package/templates/chat-app/chatjs/tools/generate-video/chatjs.json +4 -1
- package/templates/chat-app/chatjs/tools/generate-video/renderer.tsx +22 -11
- package/templates/chat-app/components/ai-elements/response.tsx +1 -1
- package/templates/chat-app/components/app-sidebar.tsx +26 -86
- package/templates/chat-app/components/artifact-actions.tsx +19 -0
- package/templates/chat-app/components/artifact-download-action.tsx +59 -0
- package/templates/chat-app/components/attachment-card.tsx +15 -9
- package/templates/chat-app/components/chat/chat-account.tsx +189 -0
- package/templates/chat-app/components/{controlled-chat-composer.tsx → chat/chat-composer.tsx} +6 -6
- package/templates/chat-app/components/chat/chat-conversation-screen.tsx +75 -0
- package/templates/chat-app/components/chat/chat-conversation.tsx +35 -0
- package/templates/chat-app/components/chat/chat-header.tsx +52 -0
- package/templates/chat-app/components/chat/chat-message-editor.tsx +24 -0
- package/templates/chat-app/components/chat/chat-navigation.tsx +11 -0
- package/templates/chat-app/components/chat/chat-sidebar.tsx +134 -0
- package/templates/chat-app/components/{eve/eve-messages.tsx → chat/chat-transcript.tsx} +7 -28
- package/templates/chat-app/components/chat/chat-workspace.tsx +19 -0
- package/templates/chat-app/components/chat/connected-chat-sidebar.tsx +8 -0
- package/templates/chat-app/components/chat-header-view.tsx +14 -13
- package/templates/chat-app/components/chat-slots.tsx +13 -3
- package/templates/chat-app/components/composer/active-tool.tsx +3 -1
- package/templates/chat-app/components/composer/composer-menu.tsx +4 -2
- package/templates/chat-app/components/composer/control.ts +4 -1
- package/templates/chat-app/components/composer/prompt-form.tsx +1 -1
- package/templates/chat-app/components/composer/tool-availability.tsx +8 -0
- package/templates/chat-app/components/composer/tool-controls.tsx +17 -50
- package/templates/chat-app/components/composer/tool-display.ts +3 -2
- package/templates/chat-app/components/eve/bash-output.tsx +33 -0
- package/templates/chat-app/components/eve/eve-chat-page.tsx +5 -26
- package/templates/chat-app/components/eve/eve-composer.tsx +11 -8
- package/templates/chat-app/components/eve/eve-conversation.tsx +237 -309
- package/templates/chat-app/components/eve/eve-deletion-provider.tsx +1 -1
- package/templates/chat-app/components/eve/eve-history-list.tsx +7 -3
- package/templates/chat-app/components/eve/eve-message-part.tsx +28 -22
- package/templates/chat-app/components/eve/eve-pending-input.tsx +54 -1
- package/templates/chat-app/components/eve/eve-runtime-provider.tsx +0 -5
- package/templates/chat-app/components/eve/new-conversation-view.tsx +7 -3
- package/templates/chat-app/components/file-artifact-card.tsx +37 -0
- package/templates/chat-app/components/header-actions.tsx +9 -2
- package/templates/chat-app/components/image-actions.tsx +93 -0
- package/templates/chat-app/components/internal-link.tsx +15 -2
- package/templates/chat-app/components/keyboard-shortcuts.tsx +8 -2
- package/templates/chat-app/components/part/tool-activity.tsx +1 -1
- package/templates/chat-app/components/part/tool-data.tsx +1 -1
- package/templates/chat-app/components/sidebar-user-nav.tsx +35 -198
- package/templates/chat-app/components/video-player.tsx +43 -0
- package/templates/chat-app/composer-controls.ts +0 -4
- package/templates/chat-app/docs/guest-sessions.md +1 -1
- package/templates/chat-app/instrumentation.ts +2 -6
- package/templates/chat-app/integrations/chat/models.ts +10 -0
- package/templates/chat-app/integrations/tools/catalog.ts +0 -3
- package/templates/chat-app/lib/ai/app-models.test.ts +13 -1
- package/templates/chat-app/lib/ai/app-models.ts +13 -3
- package/templates/chat-app/lib/ai/tool-context.ts +1 -14
- package/templates/chat-app/lib/ai/tool-renderer-registry.ts +10 -5
- package/templates/chat-app/lib/db/eve-current-copy.ts +13 -95
- package/templates/chat-app/lib/db/eve-deletion.ts +2 -61
- package/templates/chat-app/lib/db/eve-dispatch.ts +64 -18
- package/templates/chat-app/lib/db/eve-file-purge.ts +11 -145
- package/templates/chat-app/lib/db/eve-files.ts +11 -9
- package/templates/chat-app/lib/db/eve-orphaned-files.ts +3 -22
- package/templates/chat-app/lib/db/eve-queries.ts +32 -16
- package/templates/chat-app/lib/db/eve-workspace-deletion.ts +149 -0
- package/templates/chat-app/lib/db/migrate.ts +30 -0
- package/templates/chat-app/lib/db/migrations/0024_abandoned_toxin.sql +67 -0
- package/templates/chat-app/lib/db/migrations/0025_cloudy_thunderbolt.sql +1 -0
- package/templates/chat-app/lib/db/migrations/0026_loving_mesmero.sql +3 -0
- package/templates/chat-app/lib/db/migrations/0027_misty_stephen_strange.sql +1 -0
- package/templates/chat-app/lib/db/migrations/0028_faithful_hannibal_king.sql +12 -0
- package/templates/chat-app/lib/db/migrations/meta/0024_snapshot.json +4119 -0
- package/templates/chat-app/lib/db/migrations/meta/0025_snapshot.json +3988 -0
- package/templates/chat-app/lib/db/migrations/meta/0026_snapshot.json +3686 -0
- package/templates/chat-app/lib/db/migrations/meta/0027_snapshot.json +3596 -0
- package/templates/chat-app/lib/db/migrations/meta/0028_snapshot.json +2554 -0
- package/templates/chat-app/lib/db/migrations/meta/_journal.json +35 -0
- package/templates/chat-app/lib/db/schema.ts +1 -360
- package/templates/chat-app/lib/env-schema.ts +0 -7
- package/templates/chat-app/lib/eve/application-model.ts +56 -0
- package/templates/chat-app/lib/eve/bash-result.ts +22 -0
- package/templates/chat-app/lib/eve/branch-history.test.ts +59 -0
- package/templates/chat-app/lib/eve/branch-history.ts +19 -0
- package/templates/chat-app/lib/eve/channel-files.test.ts +14 -11
- package/templates/chat-app/lib/eve/channel-files.ts +2 -12
- package/templates/chat-app/lib/eve/completed-copy-source.test.ts +81 -17
- package/templates/chat-app/lib/eve/completed-copy-source.ts +2 -6
- package/templates/chat-app/lib/eve/connection-options.ts +7 -7
- package/templates/chat-app/lib/eve/contracts.test.ts +1 -1
- package/templates/chat-app/lib/eve/copy-seed.test.ts +17 -28
- package/templates/chat-app/lib/eve/copy-seed.ts +8 -34
- package/templates/chat-app/lib/eve/copy-transcript.test.ts +143 -47
- package/templates/chat-app/lib/eve/copy-transcript.ts +20 -101
- package/templates/chat-app/lib/eve/create-conversation-operation.test.ts +11 -31
- package/templates/chat-app/lib/eve/create-conversation-operation.ts +0 -10
- package/templates/chat-app/lib/eve/delete-local-conversation.test.ts +12 -20
- package/templates/chat-app/lib/eve/delete-local-conversation.ts +2 -8
- package/templates/chat-app/lib/eve/environment.test.ts +7 -0
- package/templates/chat-app/lib/eve/environment.ts +11 -0
- package/templates/chat-app/lib/eve/execute-conversation-creation.ts +3 -55
- package/templates/chat-app/lib/eve/gateway-auth.test.ts +2 -21
- package/templates/chat-app/lib/eve/gateway-auth.ts +7 -13
- package/templates/chat-app/lib/eve/generated-files.test.ts +1 -1
- package/templates/chat-app/lib/eve/generated-files.ts +2 -2
- package/templates/chat-app/lib/eve/installed-tools.test.ts +16 -9
- package/templates/chat-app/lib/eve/lifecycle/postgres/compatibility.ts +8 -5
- package/templates/chat-app/lib/eve/lifecycle/postgres/eve-payload-purge.ts +6 -2
- package/templates/chat-app/lib/eve/lifecycle/postgres/eve-queue-fence.ts +2 -2
- package/templates/chat-app/lib/eve/lifecycle/postgres/eve-queue-inventory.ts +2 -2
- package/templates/chat-app/lib/eve/lifecycle/postgres/eve-queue-purge.ts +3 -2
- package/templates/chat-app/lib/eve/lifecycle/postgres/eve-resource-fence.ts +2 -8
- package/templates/chat-app/lib/eve/lifecycle/postgres/eve-run-inventory.ts +1 -1
- package/templates/chat-app/lib/eve/lifecycle/postgres/eve-stream-positions.ts +9 -4
- package/templates/chat-app/lib/eve/logical-chat.test.ts +4 -3
- package/templates/chat-app/lib/eve/logical-chat.ts +8 -8
- package/templates/chat-app/lib/eve/message-delivery.test.ts +1 -1
- package/templates/chat-app/lib/eve/message-display.test.ts +5 -5
- package/templates/chat-app/lib/eve/message-display.ts +31 -1
- package/templates/chat-app/lib/eve/message-tool-selection.test.ts +2 -2
- package/templates/chat-app/lib/eve/model-accounting.test.ts +28 -45
- package/templates/chat-app/lib/eve/model-accounting.ts +8 -54
- package/templates/chat-app/lib/eve/purge-files.ts +0 -13
- package/templates/chat-app/lib/eve/purge-local-resources.ts +4 -47
- package/templates/chat-app/lib/eve/readonly-message-types.ts +8 -3
- package/templates/chat-app/lib/eve/reconcile-workspace-turn.ts +2 -37
- package/templates/chat-app/lib/eve/response-group-lineage.test.ts +3 -3
- package/templates/chat-app/lib/eve/retire-session.test.ts +25 -8
- package/templates/chat-app/lib/eve/retire-session.ts +10 -4
- package/templates/chat-app/lib/eve/selected-tools.ts +7 -18
- package/templates/chat-app/lib/eve/server.test.ts +29 -3
- package/templates/chat-app/lib/eve/session-profile.test.ts +12 -9
- package/templates/chat-app/lib/eve/session-profile.ts +7 -4
- package/templates/chat-app/lib/eve/shared-messages.test.ts +3 -4
- package/templates/chat-app/lib/eve/shared-messages.ts +5 -2
- package/templates/chat-app/lib/eve/tool-accounting.test.ts +131 -0
- package/templates/chat-app/lib/eve/tool-accounting.ts +96 -0
- package/templates/chat-app/lib/eve/tool-availability.ts +4 -1
- package/templates/chat-app/lib/eve/tool-configuration.ts +29 -0
- package/templates/chat-app/lib/eve/tool-result.ts +1 -1
- package/templates/chat-app/lib/eve/turn-tools.ts +3 -12
- package/templates/chat-app/lib/eve/usage.test.ts +54 -39
- package/templates/chat-app/lib/eve/usage.ts +9 -1
- package/templates/chat-app/lib/eve/workspace-turn-evidence.test.ts +8 -6
- package/templates/chat-app/lib/eve/workspace-turn-evidence.ts +0 -5
- package/templates/chat-app/lib/required-credentials.test.ts +2 -2
- package/templates/chat-app/lib/tool-readiness.test.ts +69 -0
- package/templates/chat-app/lib/tool-readiness.ts +43 -0
- package/templates/chat-app/logo.svg +1 -1
- package/templates/chat-app/next.config.ts +1 -5
- package/templates/chat-app/oxlint.config.ts +3 -6
- package/templates/chat-app/package.json +4 -16
- package/templates/chat-app/providers/chat-models-provider.tsx +3 -3
- package/templates/chat-app/providers/default-model-provider.tsx +4 -4
- package/templates/chat-app/providers/session-context.ts +24 -0
- package/templates/chat-app/providers/session-provider.tsx +4 -21
- package/templates/chat-app/scripts/agent-status.ts +124 -0
- package/templates/chat-app/scripts/check-env.ts +0 -10
- package/templates/chat-app/scripts/dev-supervisor.mts +3 -30
- package/templates/chat-app/scripts/eve-setup.ts +3 -0
- package/templates/chat-app/tests/helpers/eve-dynamic-context.ts +2 -0
- package/templates/chat-app/tools/platform/research-updates-schema.ts +1 -20
- package/templates/chat-app/trpc/context.tsx +8 -0
- package/templates/chat-app/trpc/react.tsx +3 -4
- package/templates/chat-app/trpc/routers/eve.router.ts +2 -74
- package/templates/chat-app/vendor/workflow-world-postgres-5.1.1.tgz +0 -0
- package/templates/electron/icon.png +0 -0
- package/templates/electron/package.json +2 -1
- package/templates/electron/src/application.test.ts +347 -0
- package/templates/electron/src/application.ts +849 -0
- package/templates/electron/src/lib/auth-cookies.ts +1 -1
- package/templates/electron/src/main.test.ts +175 -0
- package/templates/electron/src/main.ts +5 -745
- package/templates/electron/src/squirrel-startup.ts +61 -0
- package/templates/chat-app/agent/hooks/persistent-sandbox.ts +0 -14
- package/templates/chat-app/app/api/agent-conversation-copies/route.test.ts +0 -190
- package/templates/chat-app/app/api/agent-conversation-copies/route.ts +0 -105
- package/templates/chat-app/chatjs/core/documents/compose-views.ts +0 -12
- package/templates/chat-app/chatjs/core/documents/contracts.ts +0 -91
- package/templates/chat-app/chatjs/core/documents/document-definition.test.ts +0 -60
- package/templates/chat-app/chatjs/core/documents/document-definition.ts +0 -55
- package/templates/chat-app/chatjs/core/documents/ui.ts +0 -67
- package/templates/chat-app/chatjs/generated/code-executor.ts +0 -6
- package/templates/chat-app/chatjs/generated/document-run.ts +0 -12
- package/templates/chat-app/chatjs/generated/document-ui.ts +0 -7
- package/templates/chat-app/chatjs/generated/documents.ts +0 -6
- package/templates/chat-app/chatjs/plugins/langfuse/chatjs.json +0 -14
- package/templates/chat-app/chatjs/plugins/langfuse/credentials.ts +0 -22
- package/templates/chat-app/chatjs/plugins/langfuse/instrumentation.ts +0 -22
- package/templates/chat-app/chatjs/plugins/langfuse/server-plugin.ts +0 -5
- package/templates/chat-app/chatjs/plugins/vercel-analytics/chatjs.json +0 -15
- package/templates/chat-app/chatjs/plugins/vercel-analytics/client-plugin.ts +0 -9
- package/templates/chat-app/chatjs/plugins/vercel-analytics/component.tsx +0 -5
- package/templates/chat-app/chatjs/plugins/vercel-speed-insights/chatjs.json +0 -15
- package/templates/chat-app/chatjs/plugins/vercel-speed-insights/client-plugin.ts +0 -9
- package/templates/chat-app/chatjs/plugins/vercel-speed-insights/component.tsx +0 -4
- package/templates/chat-app/chatjs/providers/sandbox/adapter.ts +0 -232
- package/templates/chat-app/chatjs/providers/sandbox/options.ts +0 -13
- package/templates/chat-app/chatjs/providers/sandbox/persistent.ts +0 -258
- package/templates/chat-app/chatjs/providers/sandbox/provider.ts +0 -27
- package/templates/chat-app/chatjs/providers/sandbox/vercel-sandbox-env.ts +0 -22
- package/templates/chat-app/chatjs/tools/_shared/code-execution/code-execution-chart.tsx +0 -83
- package/templates/chat-app/chatjs/tools/_shared/code-execution/interactive-chart-impl.tsx +0 -290
- package/templates/chat-app/chatjs/tools/_shared/code-execution/interactive-charts.tsx +0 -24
- package/templates/chat-app/chatjs/tools/_shared/code-execution/javascript.ts +0 -222
- package/templates/chat-app/chatjs/tools/_shared/code-execution/python.ts +0 -381
- package/templates/chat-app/chatjs/tools/_shared/code-execution/types.ts +0 -27
- package/templates/chat-app/chatjs/tools/code-documents/assistant-actions.ts +0 -16
- package/templates/chat-app/chatjs/tools/code-documents/chatjs.json +0 -20
- package/templates/chat-app/chatjs/tools/code-documents/configuration-schema.ts +0 -7
- package/templates/chat-app/chatjs/tools/code-documents/definition.ts +0 -9
- package/templates/chat-app/chatjs/tools/code-documents/document.tsx +0 -33
- package/templates/chat-app/chatjs/tools/code-documents/editor.tsx +0 -144
- package/templates/chat-app/chatjs/tools/code-documents/guidelines.ts +0 -15
- package/templates/chat-app/chatjs/tools/code-documents/tool.ts +0 -54
- package/templates/chat-app/chatjs/tools/code-execution/chatjs.json +0 -21
- package/templates/chat-app/chatjs/tools/code-execution/python.test.ts +0 -207
- package/templates/chat-app/chatjs/tools/code-execution/renderer.test.tsx +0 -142
- package/templates/chat-app/chatjs/tools/code-execution/renderer.tsx +0 -68
- package/templates/chat-app/chatjs/tools/code-execution/schemas.ts +0 -23
- package/templates/chat-app/chatjs/tools/code-execution/tool.ts +0 -93
- package/templates/chat-app/chatjs/tools/deep-research/agent.ts +0 -18
- package/templates/chat-app/chatjs/tools/deep-research/availability.ts +0 -23
- package/templates/chat-app/chatjs/tools/deep-research/configuration-schema.ts +0 -36
- package/templates/chat-app/chatjs/tools/deep-research/configuration.ts +0 -22
- package/templates/chat-app/chatjs/tools/deep-research/prompts.ts +0 -280
- package/templates/chat-app/chatjs/tools/deep-research/search-updates.ts +0 -76
- package/templates/chat-app/chatjs/tools/deep-research/steps.ts +0 -92
- package/templates/chat-app/chatjs/tools/delete-document/availability.ts +0 -13
- package/templates/chat-app/chatjs/tools/delete-document/chatjs.json +0 -9
- package/templates/chat-app/chatjs/tools/delete-document/execute.ts +0 -78
- package/templates/chat-app/chatjs/tools/delete-document/schemas.ts +0 -18
- package/templates/chat-app/chatjs/tools/delete-document/tool.ts +0 -49
- package/templates/chat-app/chatjs/tools/get-weather/chatjs.json +0 -14
- package/templates/chat-app/chatjs/tools/get-weather/definition.ts +0 -10
- package/templates/chat-app/chatjs/tools/get-weather/renderer.test.tsx +0 -57
- package/templates/chat-app/chatjs/tools/get-weather/renderer.tsx +0 -290
- package/templates/chat-app/chatjs/tools/get-weather/schemas.ts +0 -51
- package/templates/chat-app/chatjs/tools/get-weather/tool.ts +0 -34
- package/templates/chat-app/chatjs/tools/read-document/chatjs.json +0 -8
- package/templates/chat-app/chatjs/tools/read-document/tool.ts +0 -27
- package/templates/chat-app/chatjs/tools/retrieve-url/chatjs.json +0 -11
- package/templates/chat-app/chatjs/tools/retrieve-url/renderer.tsx +0 -200
- package/templates/chat-app/chatjs/tools/retrieve-url/retrieve-url-env.ts +0 -11
- package/templates/chat-app/chatjs/tools/retrieve-url/schemas.ts +0 -24
- package/templates/chat-app/chatjs/tools/retrieve-url/tool.test.ts +0 -144
- package/templates/chat-app/chatjs/tools/retrieve-url/tool.ts +0 -169
- package/templates/chat-app/chatjs/tools/saved-code-execution/chatjs.json +0 -12
- package/templates/chat-app/chatjs/tools/saved-code-execution/document-runs.ts +0 -31
- package/templates/chat-app/chatjs/tools/saved-code-execution/document.tsx +0 -84
- package/templates/chat-app/chatjs/tools/saved-code-execution/execute.ts +0 -126
- package/templates/chat-app/chatjs/tools/saved-code-execution/renderer.tsx +0 -30
- package/templates/chat-app/chatjs/tools/saved-code-execution/result.tsx +0 -42
- package/templates/chat-app/chatjs/tools/saved-code-execution/schemas.ts +0 -82
- package/templates/chat-app/chatjs/tools/saved-code-execution/tool.ts +0 -12
- package/templates/chat-app/chatjs/tools/sheet-documents/assistant-actions.ts +0 -22
- package/templates/chat-app/chatjs/tools/sheet-documents/chatjs.json +0 -20
- package/templates/chat-app/chatjs/tools/sheet-documents/configuration-schema.ts +0 -10
- package/templates/chat-app/chatjs/tools/sheet-documents/definition.ts +0 -9
- package/templates/chat-app/chatjs/tools/sheet-documents/document.tsx +0 -41
- package/templates/chat-app/chatjs/tools/sheet-documents/editor.tsx +0 -180
- package/templates/chat-app/chatjs/tools/sheet-documents/guidelines.ts +0 -5
- package/templates/chat-app/chatjs/tools/sheet-documents/tool.ts +0 -54
- package/templates/chat-app/chatjs/tools/tavily-search/chatjs.json +0 -19
- package/templates/chat-app/chatjs/tools/tavily-search/renderer.tsx +0 -25
- package/templates/chat-app/chatjs/tools/tavily-search/schemas.ts +0 -39
- package/templates/chat-app/chatjs/tools/tavily-search/tavily-search-env.ts +0 -11
- package/templates/chat-app/chatjs/tools/tavily-search/tool.test.ts +0 -114
- package/templates/chat-app/chatjs/tools/tavily-search/tool.ts +0 -143
- package/templates/chat-app/chatjs/tools/text-documents/assistant-actions.ts +0 -12
- package/templates/chat-app/chatjs/tools/text-documents/chatjs.json +0 -20
- package/templates/chat-app/chatjs/tools/text-documents/comparison.tsx +0 -72
- package/templates/chat-app/chatjs/tools/text-documents/configuration-schema.ts +0 -7
- package/templates/chat-app/chatjs/tools/text-documents/definition.ts +0 -9
- package/templates/chat-app/chatjs/tools/text-documents/diffview.tsx +0 -214
- package/templates/chat-app/chatjs/tools/text-documents/document.tsx +0 -46
- package/templates/chat-app/chatjs/tools/text-documents/editor-config.ts +0 -53
- package/templates/chat-app/chatjs/tools/text-documents/editor.tsx +0 -139
- package/templates/chat-app/chatjs/tools/text-documents/guidelines.ts +0 -7
- package/templates/chat-app/chatjs/tools/text-documents/tool.ts +0 -54
- package/templates/chat-app/chatjs/tools/word-count/chatjs.json +0 -14
- package/templates/chat-app/chatjs/tools/word-count/definition.ts +0 -10
- package/templates/chat-app/chatjs/tools/word-count/renderer.tsx +0 -64
- package/templates/chat-app/chatjs/tools/word-count/schemas.ts +0 -13
- package/templates/chat-app/chatjs/tools/word-count/tool.ts +0 -45
- package/templates/chat-app/components/chat/chat-layout.tsx +0 -129
- package/templates/chat-app/components/chat-sidebar-view.tsx +0 -53
- package/templates/chat-app/components/document-skeleton.tsx +0 -33
- package/templates/chat-app/components/eve/eve-artifact-layout.tsx +0 -722
- package/templates/chat-app/components/eve/eve-copy-button.tsx +0 -165
- package/templates/chat-app/components/eve/eve-document-actions.tsx +0 -124
- package/templates/chat-app/components/eve/eve-document-assistant-actions.tsx +0 -157
- package/templates/chat-app/components/eve/eve-document-body.tsx +0 -29
- package/templates/chat-app/components/eve/eve-document-context.tsx +0 -12
- package/templates/chat-app/components/eve/eve-document-preview.tsx +0 -128
- package/templates/chat-app/components/eve/eve-document-tool.tsx +0 -190
- package/templates/chat-app/components/eve/eve-history.tsx +0 -25
- package/templates/chat-app/components/eve/use-document-draft.ts +0 -281
- package/templates/chat-app/components/favicon-group.tsx +0 -50
- package/templates/chat-app/components/part/document-common.tsx +0 -152
- package/templates/chat-app/components/part/web-search.tsx +0 -75
- package/templates/chat-app/components/sandbox.tsx +0 -43
- package/templates/chat-app/components/source-badge.tsx +0 -50
- package/templates/chat-app/components/sources.tsx +0 -140
- package/templates/chat-app/hooks/use-artifact.tsx +0 -180
- package/templates/chat-app/integrations/documents/definitions.ts +0 -4
- package/templates/chat-app/integrations/documents/run.ts +0 -1
- package/templates/chat-app/integrations/documents/ui.ts +0 -4
- package/templates/chat-app/integrations/providers/sandbox.ts +0 -10
- package/templates/chat-app/integrations/tools/code-executor.ts +0 -1
- package/templates/chat-app/lib/ai/telemetry.ts +0 -4
- package/templates/chat-app/lib/artifacts/artifact-kind.ts +0 -8
- package/templates/chat-app/lib/artifacts/types.ts +0 -19
- package/templates/chat-app/lib/db/eve-code-sandboxes.ts +0 -197
- package/templates/chat-app/lib/db/eve-document-retention.ts +0 -36
- package/templates/chat-app/lib/db/eve-documents.ts +0 -700
- package/templates/chat-app/lib/eve/code-executor.ts +0 -32
- package/templates/chat-app/lib/eve/code-sandbox-name.test.ts +0 -60
- package/templates/chat-app/lib/eve/code-sandbox-name.ts +0 -56
- package/templates/chat-app/lib/eve/code-sandbox-ownership.ts +0 -88
- package/templates/chat-app/lib/eve/copy-input.ts +0 -11
- package/templates/chat-app/lib/eve/create-native-copy.ts +0 -38
- package/templates/chat-app/lib/eve/document-assistant-actions.test.ts +0 -48
- package/templates/chat-app/lib/eve/document-assistant-actions.ts +0 -22
- package/templates/chat-app/lib/eve/document-kind-lifecycle.test.ts +0 -148
- package/templates/chat-app/lib/eve/document-tools.ts +0 -164
- package/templates/chat-app/lib/eve/lifecycle/postgres/eve-sandbox-coverage-proof.ts +0 -140
- package/templates/chat-app/lib/eve/persistent-sandbox-store.ts +0 -621
- package/templates/chat-app/lib/eve/persistent-sandbox.test.ts +0 -209
- package/templates/chat-app/lib/eve/persistent-sandbox.ts +0 -328
- package/templates/chat-app/lib/eve/purge-code-sandboxes.test.ts +0 -125
- package/templates/chat-app/lib/eve/purge-code-sandboxes.ts +0 -83
- package/templates/chat-app/lib/eve/request-copy.test.ts +0 -95
- package/templates/chat-app/lib/eve/request-copy.ts +0 -129
- package/templates/chat-app/lib/eve/research-progress.test.ts +0 -95
- package/templates/chat-app/lib/eve/research-progress.ts +0 -42
- package/templates/chat-app/lib/eve/sandbox-environment.test.ts +0 -49
- package/templates/chat-app/lib/eve/sandbox-environment.ts +0 -29
- package/templates/chat-app/lib/eve/save-copy-operation.ts +0 -33
- package/templates/chat-app/lib/eve/save-document.ts +0 -87
- package/templates/chat-app/lib/eve/verify-local-coverage.ts +0 -84
- package/templates/chat-app/lib/eve/workspace-attachments.ts +0 -173
- package/templates/chat-app/lib/sandbox/runtime.ts +0 -12
- package/templates/chat-app/scripts/persistent-sandbox-cleanup.ts +0 -128
- package/templates/chat-app/scripts/stop-persistent-sandboxes.ts +0 -24
- package/templates/chat-app/tests/artifacts.e2e.ts +0 -7
- package/templates/chat-app/tools/platform/documents/types.ts +0 -11
- package/templates/chat-app/tools/platform/search-presentation.ts +0 -138
- package/templates/chat-app/tools/platform/steps/multi-query-web-search.test.ts +0 -45
- package/templates/chat-app/tools/platform/steps/multi-query-web-search.ts +0 -142
- package/templates/chat-app/tools/platform/steps/search-utils.ts +0 -26
- package/templates/chat-app/vendor/workflow-world-postgres-5.0.0-beta.40.tgz +0 -0
|
@@ -1,700 +0,0 @@
|
|
|
1
|
-
import { chat } from "@/integrations/chat/server";
|
|
2
|
-
import { eveDeletionScope } from "./eve-deletion-scope";
|
|
3
|
-
import { unretainedEveDocumentRevisionIds } from "./eve-document-retention";
|
|
4
|
-
import { isNonEmptyString } from "@/lib/is-non-empty-string";
|
|
5
|
-
import { and, eq, inArray, sql } from "drizzle-orm";
|
|
6
|
-
import type { ReadonlyNativeSurface } from "@/lib/readonly-native-surface";
|
|
7
|
-
import type { SQL } from "drizzle-orm";
|
|
8
|
-
import { z } from "zod";
|
|
9
|
-
|
|
10
|
-
import { artifactKind } from "@/lib/artifacts/artifact-kind";
|
|
11
|
-
import { documentFileIds } from "@/chatjs/core/documents/contracts";
|
|
12
|
-
import { isFileStorageKey } from "@/lib/file-url";
|
|
13
|
-
|
|
14
|
-
import { db } from "./client";
|
|
15
|
-
import {
|
|
16
|
-
eveConversation,
|
|
17
|
-
eveDocumentCheckpoint,
|
|
18
|
-
eveDocumentCheckpointEntry,
|
|
19
|
-
eveDocumentHead,
|
|
20
|
-
eveDocumentRevision,
|
|
21
|
-
eveFileReference,
|
|
22
|
-
eveImportedDocumentCheckpoint,
|
|
23
|
-
eveImportedDocumentCheckpointEntry,
|
|
24
|
-
eveNamedDocumentCheckpoint,
|
|
25
|
-
eveNamedDocumentCheckpointEntry,
|
|
26
|
-
eveStoredFile,
|
|
27
|
-
} from "./schema";
|
|
28
|
-
|
|
29
|
-
const FIRST_ROW_INDEX = 0;
|
|
30
|
-
const MINIMUM_TEXT_LENGTH = 1;
|
|
31
|
-
const MAXIMUM_CONTENT_LENGTH = 2_000_000;
|
|
32
|
-
const MAXIMUM_OPERATION_ID_LENGTH = 512;
|
|
33
|
-
const MAXIMUM_TITLE_LENGTH = 1000;
|
|
34
|
-
|
|
35
|
-
const revisionInput = z.object({
|
|
36
|
-
content: z.string().max(MAXIMUM_CONTENT_LENGTH),
|
|
37
|
-
conversationId: z.uuid(),
|
|
38
|
-
documentId: z.uuid(),
|
|
39
|
-
expectedRevisionId: z.uuid().nullable(),
|
|
40
|
-
fileIds: documentFileIds,
|
|
41
|
-
kind: artifactKind,
|
|
42
|
-
operationId: z
|
|
43
|
-
.string()
|
|
44
|
-
.min(MINIMUM_TEXT_LENGTH)
|
|
45
|
-
.max(MAXIMUM_OPERATION_ID_LENGTH),
|
|
46
|
-
ownerId: z.string().min(MINIMUM_TEXT_LENGTH),
|
|
47
|
-
title: z.string().min(MINIMUM_TEXT_LENGTH).max(MAXIMUM_TITLE_LENGTH),
|
|
48
|
-
turnIndex: z.number().int().nonnegative().nullable(),
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
type DocumentTransaction = Parameters<Parameters<typeof db.transaction>[0]>[0];
|
|
52
|
-
|
|
53
|
-
// Native transaction methods shared by locked document write operations.
|
|
54
|
-
type DocumentWriteTransaction = Readonly<
|
|
55
|
-
Pick<DocumentTransaction, "execute" | "insert" | "select">
|
|
56
|
-
>;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Caller holds the owner family lock and has authorized the document revision.
|
|
60
|
-
* @param {DocumentTransaction} tx - Caller transaction holding the owner family lock.
|
|
61
|
-
* @param {string} ownerId - Owner required for every active document file.
|
|
62
|
-
* @param {string} conversationId - Conversation that retains the document references.
|
|
63
|
-
* @param {readonly string[]} fileIds - Storage keys referenced by the authorized revision.
|
|
64
|
-
*/
|
|
65
|
-
const retainEveDocumentFiles = async (
|
|
66
|
-
tx: Readonly<Pick<DocumentTransaction, "insert" | "select">>,
|
|
67
|
-
ownerId: string,
|
|
68
|
-
conversationId: string,
|
|
69
|
-
fileIds: readonly string[]
|
|
70
|
-
): Promise<void> => {
|
|
71
|
-
const candidates = [...new Set(fileIds)];
|
|
72
|
-
if (candidates.some((id) => !isFileStorageKey(id))) {
|
|
73
|
-
throw new Error("Invalid document file reference.");
|
|
74
|
-
}
|
|
75
|
-
if (candidates.length === 0) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const files = await tx
|
|
79
|
-
.select({ key: eveStoredFile.key })
|
|
80
|
-
.from(eveStoredFile)
|
|
81
|
-
.where(
|
|
82
|
-
and(
|
|
83
|
-
eq(eveStoredFile.ownerId, ownerId),
|
|
84
|
-
eq(eveStoredFile.state, "active"),
|
|
85
|
-
inArray(eveStoredFile.key, candidates)
|
|
86
|
-
)
|
|
87
|
-
);
|
|
88
|
-
if (files.length !== candidates.length) {
|
|
89
|
-
throw new Error("Document references an unavailable or unowned file.");
|
|
90
|
-
}
|
|
91
|
-
await tx
|
|
92
|
-
.insert(eveFileReference)
|
|
93
|
-
.values(files.map(({ key }) => ({ conversationId, key, ownerId })))
|
|
94
|
-
.onConflictDoNothing();
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Erase document rows after retirement and resource inventory have completed.
|
|
99
|
-
* The deletion coordinator must retain file references before calling this.
|
|
100
|
-
* This does not erase native history, blobs, metadata, or accounting, and never
|
|
101
|
-
* marks the conversation deleted.
|
|
102
|
-
* @param {string} ownerId - Owner whose entire conversation family is already retiring.
|
|
103
|
-
* @param {string} rootId - Chat identity selecting the family pending deletion.
|
|
104
|
-
* @returns {Promise<void>} Completion after document rows are erased in the locked transaction.
|
|
105
|
-
*/
|
|
106
|
-
const purgeEveFamilyDocuments = async (
|
|
107
|
-
ownerId: string,
|
|
108
|
-
rootId: string
|
|
109
|
-
): Promise<void> => {
|
|
110
|
-
await db.transaction(
|
|
111
|
-
async (
|
|
112
|
-
tx: Readonly<Pick<DocumentTransaction, "delete" | "execute" | "select">>
|
|
113
|
-
) => {
|
|
114
|
-
await tx.execute(
|
|
115
|
-
sql`select pg_advisory_xact_lock(hashtextextended(${`eve-family:${ownerId}`}, 0))`
|
|
116
|
-
);
|
|
117
|
-
const family = await tx
|
|
118
|
-
.select({
|
|
119
|
-
id: eveConversation.id,
|
|
120
|
-
state: eveConversation.state,
|
|
121
|
-
})
|
|
122
|
-
.from(eveConversation)
|
|
123
|
-
.where(
|
|
124
|
-
and(
|
|
125
|
-
eq(eveConversation.ownerId, ownerId),
|
|
126
|
-
eveDeletionScope(ownerId, rootId)
|
|
127
|
-
)
|
|
128
|
-
)
|
|
129
|
-
.orderBy(eveConversation.id);
|
|
130
|
-
if (
|
|
131
|
-
family.length === 0 ||
|
|
132
|
-
family.some(
|
|
133
|
-
(row) => row.state !== "deleting" && row.state !== "deleted"
|
|
134
|
-
)
|
|
135
|
-
) {
|
|
136
|
-
throw new Error(
|
|
137
|
-
"The entire conversation family must be pending deletion."
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
const ids = family.map((row) => row.id);
|
|
141
|
-
for (const id of ids) {
|
|
142
|
-
// oxlint-disable-next-line eslint/no-await-in-loop -- Acquire each family document advisory lock before deleting checkpoint rows; document writers retain those locks through commit.
|
|
143
|
-
await tx.execute(
|
|
144
|
-
sql`select pg_advisory_xact_lock(hashtextextended(${`eve-document:${id}`}, 0))`
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
await tx
|
|
148
|
-
.delete(eveImportedDocumentCheckpointEntry)
|
|
149
|
-
.where(
|
|
150
|
-
and(
|
|
151
|
-
eq(eveImportedDocumentCheckpointEntry.ownerId, ownerId),
|
|
152
|
-
inArray(eveImportedDocumentCheckpointEntry.conversationId, ids)
|
|
153
|
-
)
|
|
154
|
-
);
|
|
155
|
-
await tx
|
|
156
|
-
.delete(eveImportedDocumentCheckpoint)
|
|
157
|
-
.where(
|
|
158
|
-
and(
|
|
159
|
-
eq(eveImportedDocumentCheckpoint.ownerId, ownerId),
|
|
160
|
-
inArray(eveImportedDocumentCheckpoint.conversationId, ids)
|
|
161
|
-
)
|
|
162
|
-
);
|
|
163
|
-
await tx
|
|
164
|
-
.delete(eveNamedDocumentCheckpointEntry)
|
|
165
|
-
.where(
|
|
166
|
-
and(
|
|
167
|
-
eq(eveNamedDocumentCheckpointEntry.ownerId, ownerId),
|
|
168
|
-
inArray(eveNamedDocumentCheckpointEntry.conversationId, ids)
|
|
169
|
-
)
|
|
170
|
-
);
|
|
171
|
-
await tx
|
|
172
|
-
.delete(eveNamedDocumentCheckpoint)
|
|
173
|
-
.where(
|
|
174
|
-
and(
|
|
175
|
-
eq(eveNamedDocumentCheckpoint.ownerId, ownerId),
|
|
176
|
-
inArray(eveNamedDocumentCheckpoint.conversationId, ids)
|
|
177
|
-
)
|
|
178
|
-
);
|
|
179
|
-
// Remove this member's pointers before computing surviving ancestry.
|
|
180
|
-
await tx
|
|
181
|
-
.delete(eveDocumentCheckpointEntry)
|
|
182
|
-
.where(
|
|
183
|
-
and(
|
|
184
|
-
eq(eveDocumentCheckpointEntry.ownerId, ownerId),
|
|
185
|
-
inArray(eveDocumentCheckpointEntry.conversationId, ids)
|
|
186
|
-
)
|
|
187
|
-
);
|
|
188
|
-
await tx
|
|
189
|
-
.delete(eveDocumentCheckpoint)
|
|
190
|
-
.where(
|
|
191
|
-
and(
|
|
192
|
-
eq(eveDocumentCheckpoint.ownerId, ownerId),
|
|
193
|
-
inArray(eveDocumentCheckpoint.conversationId, ids)
|
|
194
|
-
)
|
|
195
|
-
);
|
|
196
|
-
await tx
|
|
197
|
-
.delete(eveDocumentHead)
|
|
198
|
-
.where(
|
|
199
|
-
and(
|
|
200
|
-
eq(eveDocumentHead.ownerId, ownerId),
|
|
201
|
-
inArray(eveDocumentHead.conversationId, ids)
|
|
202
|
-
)
|
|
203
|
-
);
|
|
204
|
-
await tx
|
|
205
|
-
.delete(eveDocumentRevision)
|
|
206
|
-
.where(
|
|
207
|
-
and(
|
|
208
|
-
eq(eveDocumentRevision.ownerId, ownerId),
|
|
209
|
-
inArray(
|
|
210
|
-
eveDocumentRevision.id,
|
|
211
|
-
unretainedEveDocumentRevisionIds(ownerId, ids)
|
|
212
|
-
)
|
|
213
|
-
)
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
);
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
const ancestorIds = (
|
|
220
|
-
ownerId: string,
|
|
221
|
-
documentId: string,
|
|
222
|
-
headId: string
|
|
223
|
-
): SQL =>
|
|
224
|
-
sql`(with recursive ancestry as (
|
|
225
|
-
select "id", "parentRevisionId" from "EveDocumentRevision" where "id" = ${headId} and "ownerId" = ${ownerId} and "documentId" = ${documentId}
|
|
226
|
-
union
|
|
227
|
-
select revision."id", revision."parentRevisionId" from "EveDocumentRevision" revision join ancestry on revision."id" = ancestry."parentRevisionId"
|
|
228
|
-
) select "id" from ancestry)`;
|
|
229
|
-
|
|
230
|
-
const orderRevisionHistory = <
|
|
231
|
-
Revision extends {
|
|
232
|
-
readonly id: string;
|
|
233
|
-
readonly parentRevisionId: string | null;
|
|
234
|
-
},
|
|
235
|
-
>(
|
|
236
|
-
revisions: readonly Revision[],
|
|
237
|
-
headId: string
|
|
238
|
-
): Revision[] => {
|
|
239
|
-
const byId = new Map(revisions.map((revision) => [revision.id, revision]));
|
|
240
|
-
const history: Revision[] = [];
|
|
241
|
-
let revisionId: string | null = headId;
|
|
242
|
-
while (revisionId !== null && revisionId !== "") {
|
|
243
|
-
const revision = byId.get(revisionId);
|
|
244
|
-
if (!revision) {
|
|
245
|
-
throw new Error("Document history could not be loaded.");
|
|
246
|
-
}
|
|
247
|
-
byId.delete(revisionId);
|
|
248
|
-
history.push(revision);
|
|
249
|
-
revisionId = revision.parentRevisionId;
|
|
250
|
-
}
|
|
251
|
-
return history.toReversed();
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
const assertRevisionReplay = (
|
|
255
|
-
replay: typeof eveDocumentRevision.$inferSelect,
|
|
256
|
-
input: z.infer<typeof revisionInput>
|
|
257
|
-
): void => {
|
|
258
|
-
if (
|
|
259
|
-
replay.documentId !== input.documentId ||
|
|
260
|
-
replay.ownerId !== input.ownerId ||
|
|
261
|
-
replay.parentRevisionId !== input.expectedRevisionId ||
|
|
262
|
-
replay.turnIndex !== input.turnIndex ||
|
|
263
|
-
replay.title !== input.title ||
|
|
264
|
-
replay.content !== input.content ||
|
|
265
|
-
JSON.stringify(replay.fileIds) !== JSON.stringify(input.fileIds) ||
|
|
266
|
-
replay.kind !== input.kind
|
|
267
|
-
) {
|
|
268
|
-
throw new Error("Document operation changed during replay.");
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Save a revision and move only this conversation's head, atomically and replay-safely.
|
|
274
|
-
* @param {z.input<typeof revisionInput>} value - Revision payload with the expected head and immutable operation ID.
|
|
275
|
-
* @param {AbortSignal | undefined} signal - Cancellation checked before admission and before transaction commit.
|
|
276
|
-
* @returns {Promise<typeof eveDocumentRevision.$inferSelect>} New revision or the persisted revision for an identical operation replay.
|
|
277
|
-
*/
|
|
278
|
-
const saveEveDocumentRevision = async (
|
|
279
|
-
value: ReadonlyNativeSurface<z.input<typeof revisionInput>>,
|
|
280
|
-
signal?: ReadonlyNativeSurface<AbortSignal>
|
|
281
|
-
): Promise<typeof eveDocumentRevision.$inferSelect> => {
|
|
282
|
-
if (signal) {
|
|
283
|
-
signal.throwIfAborted();
|
|
284
|
-
}
|
|
285
|
-
const input = revisionInput.parse(value);
|
|
286
|
-
return await db.transaction(async (tx: DocumentWriteTransaction) => {
|
|
287
|
-
await tx.execute(
|
|
288
|
-
sql`select pg_advisory_xact_lock(hashtextextended(${`eve-family:${input.ownerId}`}, 0))`
|
|
289
|
-
);
|
|
290
|
-
await tx.execute(
|
|
291
|
-
sql`select pg_advisory_xact_lock(hashtextextended(${`eve-document:${input.conversationId}`}, 0))`
|
|
292
|
-
);
|
|
293
|
-
if (signal) {
|
|
294
|
-
signal.throwIfAborted();
|
|
295
|
-
}
|
|
296
|
-
const conversationRows = await tx
|
|
297
|
-
.select()
|
|
298
|
-
.from(eveConversation)
|
|
299
|
-
.where(
|
|
300
|
-
and(
|
|
301
|
-
eq(eveConversation.id, input.conversationId),
|
|
302
|
-
eq(eveConversation.ownerId, input.ownerId),
|
|
303
|
-
eq(eveConversation.state, "bound")
|
|
304
|
-
)
|
|
305
|
-
);
|
|
306
|
-
const conversation = conversationRows.at(FIRST_ROW_INDEX);
|
|
307
|
-
if (!conversation) {
|
|
308
|
-
throw new Error("Conversation not found.");
|
|
309
|
-
}
|
|
310
|
-
const replayRows = await tx
|
|
311
|
-
.select()
|
|
312
|
-
.from(eveDocumentRevision)
|
|
313
|
-
.where(
|
|
314
|
-
and(
|
|
315
|
-
eq(eveDocumentRevision.conversationId, input.conversationId),
|
|
316
|
-
eq(eveDocumentRevision.operationId, input.operationId)
|
|
317
|
-
)
|
|
318
|
-
);
|
|
319
|
-
const replay = replayRows.at(FIRST_ROW_INDEX);
|
|
320
|
-
if (replay) {
|
|
321
|
-
assertRevisionReplay(replay, input);
|
|
322
|
-
return replay;
|
|
323
|
-
}
|
|
324
|
-
const headRows = await tx
|
|
325
|
-
.select()
|
|
326
|
-
.from(eveDocumentHead)
|
|
327
|
-
.where(
|
|
328
|
-
and(
|
|
329
|
-
eq(eveDocumentHead.conversationId, input.conversationId),
|
|
330
|
-
eq(eveDocumentHead.documentId, input.documentId)
|
|
331
|
-
)
|
|
332
|
-
);
|
|
333
|
-
const head = headRows.at(FIRST_ROW_INDEX);
|
|
334
|
-
if ((head?.revisionId ?? null) !== input.expectedRevisionId) {
|
|
335
|
-
throw new Error("Document changed. Reload before saving.");
|
|
336
|
-
}
|
|
337
|
-
if (head) {
|
|
338
|
-
const previousRows = await tx
|
|
339
|
-
.select()
|
|
340
|
-
.from(eveDocumentRevision)
|
|
341
|
-
.where(eq(eveDocumentRevision.id, head.revisionId));
|
|
342
|
-
const previous = previousRows.at(FIRST_ROW_INDEX);
|
|
343
|
-
if (
|
|
344
|
-
!previous ||
|
|
345
|
-
previous.kind !== input.kind ||
|
|
346
|
-
(previous.turnIndex ?? -1) >
|
|
347
|
-
(input.turnIndex ?? Number.POSITIVE_INFINITY)
|
|
348
|
-
) {
|
|
349
|
-
throw new Error("Invalid document revision.");
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
await retainEveDocumentFiles(
|
|
353
|
-
tx,
|
|
354
|
-
input.ownerId,
|
|
355
|
-
input.conversationId,
|
|
356
|
-
input.fileIds
|
|
357
|
-
);
|
|
358
|
-
if (
|
|
359
|
-
input.turnIndex === null &&
|
|
360
|
-
!isNonEmptyString(input.expectedRevisionId)
|
|
361
|
-
) {
|
|
362
|
-
throw new Error("Manual edits require an existing document.");
|
|
363
|
-
}
|
|
364
|
-
if (signal) {
|
|
365
|
-
signal.throwIfAborted();
|
|
366
|
-
}
|
|
367
|
-
const [revision] = await tx
|
|
368
|
-
.insert(eveDocumentRevision)
|
|
369
|
-
.values({
|
|
370
|
-
content: input.content,
|
|
371
|
-
conversationId: input.conversationId,
|
|
372
|
-
documentId: input.documentId,
|
|
373
|
-
fileIds: input.fileIds,
|
|
374
|
-
kind: input.kind,
|
|
375
|
-
operationId: input.operationId,
|
|
376
|
-
ownerId: input.ownerId,
|
|
377
|
-
parentRevisionId: input.expectedRevisionId,
|
|
378
|
-
title: input.title,
|
|
379
|
-
turnIndex: input.turnIndex,
|
|
380
|
-
})
|
|
381
|
-
.returning();
|
|
382
|
-
await tx
|
|
383
|
-
.insert(eveDocumentHead)
|
|
384
|
-
.values({
|
|
385
|
-
conversationId: input.conversationId,
|
|
386
|
-
documentId: input.documentId,
|
|
387
|
-
ownerId: input.ownerId,
|
|
388
|
-
revisionId: revision.id,
|
|
389
|
-
})
|
|
390
|
-
.onConflictDoUpdate({
|
|
391
|
-
set: { revisionId: revision.id },
|
|
392
|
-
target: [eveDocumentHead.conversationId, eveDocumentHead.documentId],
|
|
393
|
-
});
|
|
394
|
-
if (signal) {
|
|
395
|
-
signal.throwIfAborted();
|
|
396
|
-
}
|
|
397
|
-
return revision;
|
|
398
|
-
});
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* Traverse the selected revision's ancestry, never all revisions with the same document ID.
|
|
403
|
-
* @param {string} ownerId - Owner authorized to inspect the selected conversation.
|
|
404
|
-
* @param {string} conversationId - Conversation whose current document head selects ancestry.
|
|
405
|
-
* @param {string} documentId - Document identity scoped to that conversation head.
|
|
406
|
-
* @param {Pick<typeof db, "select">} reader - Existing transaction when capturing a consistent fork; defaults to the database.
|
|
407
|
-
* @returns {Promise< Pick< typeof eveDocumentRevision.$inferSelect, "createdAt" | "id" | "kind" | "parentRevisionId" | "title" | "turnIndex" >[] >} Oldest-to-newest revision summaries, or no summaries when no head exists.
|
|
408
|
-
*/
|
|
409
|
-
const getEveDocumentHistory = async (
|
|
410
|
-
ownerId: string,
|
|
411
|
-
conversationId: string,
|
|
412
|
-
documentId: string,
|
|
413
|
-
reader: Pick<typeof db, "select"> = db
|
|
414
|
-
): Promise<
|
|
415
|
-
Pick<
|
|
416
|
-
typeof eveDocumentRevision.$inferSelect,
|
|
417
|
-
"createdAt" | "id" | "kind" | "parentRevisionId" | "title" | "turnIndex"
|
|
418
|
-
>[]
|
|
419
|
-
> => {
|
|
420
|
-
const headRows = await reader
|
|
421
|
-
.select({ revisionId: eveDocumentHead.revisionId })
|
|
422
|
-
.from(eveDocumentHead)
|
|
423
|
-
.innerJoin(
|
|
424
|
-
eveConversation,
|
|
425
|
-
and(
|
|
426
|
-
eq(eveConversation.id, eveDocumentHead.conversationId),
|
|
427
|
-
eq(eveConversation.ownerId, ownerId)
|
|
428
|
-
)
|
|
429
|
-
)
|
|
430
|
-
.where(
|
|
431
|
-
and(
|
|
432
|
-
eq(eveDocumentHead.conversationId, conversationId),
|
|
433
|
-
eq(eveDocumentHead.documentId, documentId),
|
|
434
|
-
eq(eveDocumentHead.ownerId, ownerId)
|
|
435
|
-
)
|
|
436
|
-
);
|
|
437
|
-
const head = headRows.at(FIRST_ROW_INDEX);
|
|
438
|
-
if (!head) {
|
|
439
|
-
return [];
|
|
440
|
-
}
|
|
441
|
-
const revisions = await reader
|
|
442
|
-
.select({
|
|
443
|
-
createdAt: eveDocumentRevision.createdAt,
|
|
444
|
-
id: eveDocumentRevision.id,
|
|
445
|
-
kind: eveDocumentRevision.kind,
|
|
446
|
-
parentRevisionId: eveDocumentRevision.parentRevisionId,
|
|
447
|
-
title: eveDocumentRevision.title,
|
|
448
|
-
turnIndex: eveDocumentRevision.turnIndex,
|
|
449
|
-
})
|
|
450
|
-
.from(eveDocumentRevision)
|
|
451
|
-
.where(
|
|
452
|
-
inArray(
|
|
453
|
-
eveDocumentRevision.id,
|
|
454
|
-
ancestorIds(ownerId, documentId, head.revisionId)
|
|
455
|
-
)
|
|
456
|
-
);
|
|
457
|
-
return orderRevisionHistory(revisions, head.revisionId);
|
|
458
|
-
};
|
|
459
|
-
|
|
460
|
-
const readDocumentRevision = async (
|
|
461
|
-
ownerId: string,
|
|
462
|
-
documentId: string,
|
|
463
|
-
revisionId: string
|
|
464
|
-
): Promise<typeof eveDocumentRevision.$inferSelect | null> => {
|
|
465
|
-
const revisions = await db
|
|
466
|
-
.select()
|
|
467
|
-
.from(eveDocumentRevision)
|
|
468
|
-
.where(
|
|
469
|
-
and(
|
|
470
|
-
eq(eveDocumentRevision.id, revisionId),
|
|
471
|
-
eq(eveDocumentRevision.ownerId, ownerId),
|
|
472
|
-
eq(eveDocumentRevision.documentId, documentId)
|
|
473
|
-
)
|
|
474
|
-
);
|
|
475
|
-
return revisions.at(FIRST_ROW_INDEX) ?? null;
|
|
476
|
-
};
|
|
477
|
-
/**
|
|
478
|
-
* Content is loaded only for the selected, accessible revision.
|
|
479
|
-
* @param {string} ownerId - Owner authorized to traverse the selected conversation ancestry.
|
|
480
|
-
* @param {string} conversationId - Conversation whose current head scopes the history lookup.
|
|
481
|
-
* @param {string} documentId - Document identity within that conversation.
|
|
482
|
-
* @param {string | undefined} revisionId - Requested ancestor revision; omission or empty text selects the latest.
|
|
483
|
-
* @returns {Promise<typeof eveDocumentRevision.$inferSelect | null>} Persisted revision content, or no revision when the selected ancestry is unavailable.
|
|
484
|
-
*/
|
|
485
|
-
const getEveDocumentRevision = async (
|
|
486
|
-
ownerId: string,
|
|
487
|
-
conversationId: string,
|
|
488
|
-
documentId: string,
|
|
489
|
-
revisionId?: string
|
|
490
|
-
): Promise<typeof eveDocumentRevision.$inferSelect | null> => {
|
|
491
|
-
const history = await getEveDocumentHistory(
|
|
492
|
-
ownerId,
|
|
493
|
-
conversationId,
|
|
494
|
-
documentId
|
|
495
|
-
);
|
|
496
|
-
const selected =
|
|
497
|
-
(revisionId ?? "") === ""
|
|
498
|
-
? history.at(-1)
|
|
499
|
-
: history.find(
|
|
500
|
-
(revision: ReadonlyNativeSurface<(typeof history)[number]>) =>
|
|
501
|
-
revision.id === revisionId
|
|
502
|
-
);
|
|
503
|
-
if (!selected) {
|
|
504
|
-
return null;
|
|
505
|
-
}
|
|
506
|
-
return await readDocumentRevision(ownerId, documentId, selected.id);
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
/**
|
|
510
|
-
* Public readers receive document content, never storage ownership or operation metadata.
|
|
511
|
-
* @param {string | undefined} viewerId - Authenticated viewer, or no identity for a public reader.
|
|
512
|
-
* @param {string} conversationId - Bound conversation whose visibility is checked before and after reading.
|
|
513
|
-
* @param {string} documentId - Document identity scoped to that conversation ancestry.
|
|
514
|
-
* @param {string | undefined} revisionId - Requested ancestor revision; omission or empty text selects the latest.
|
|
515
|
-
* @returns {Promise< | { canEdit: boolean; history: Awaited<ReturnType<typeof getEveDocumentHistory>>; revision: Pick< typeof eveDocumentRevision.$inferSelect, "content" | "createdAt" | "documentId" | "id" | "kind" | "title" >; } | undefined >} Safe content and history with edit permission, or no result when access is unavailable.
|
|
516
|
-
*/
|
|
517
|
-
const getAccessibleEveDocument = async (
|
|
518
|
-
viewerId: string | undefined,
|
|
519
|
-
conversationId: string,
|
|
520
|
-
documentId: string,
|
|
521
|
-
revisionId?: string
|
|
522
|
-
): Promise<
|
|
523
|
-
| {
|
|
524
|
-
canEdit: boolean;
|
|
525
|
-
history: Awaited<ReturnType<typeof getEveDocumentHistory>>;
|
|
526
|
-
revision: Pick<
|
|
527
|
-
typeof eveDocumentRevision.$inferSelect,
|
|
528
|
-
"content" | "createdAt" | "documentId" | "id" | "kind" | "title"
|
|
529
|
-
>;
|
|
530
|
-
}
|
|
531
|
-
| undefined
|
|
532
|
-
> => {
|
|
533
|
-
const conversationRows = await db
|
|
534
|
-
.select()
|
|
535
|
-
.from(eveConversation)
|
|
536
|
-
.where(
|
|
537
|
-
and(
|
|
538
|
-
eq(eveConversation.id, conversationId),
|
|
539
|
-
eq(eveConversation.state, "bound"),
|
|
540
|
-
sql`(${eveConversation.ownerId} = ${viewerId ?? null} or ${chat.publicReadFilter()})`
|
|
541
|
-
)
|
|
542
|
-
);
|
|
543
|
-
const conversation = conversationRows.at(FIRST_ROW_INDEX);
|
|
544
|
-
if (!conversation) {
|
|
545
|
-
return undefined;
|
|
546
|
-
}
|
|
547
|
-
const history = await getEveDocumentHistory(
|
|
548
|
-
conversation.ownerId,
|
|
549
|
-
conversationId,
|
|
550
|
-
documentId
|
|
551
|
-
);
|
|
552
|
-
const selected =
|
|
553
|
-
(revisionId ?? "") === ""
|
|
554
|
-
? history.at(-1)
|
|
555
|
-
: history.find(
|
|
556
|
-
(item: ReadonlyNativeSurface<(typeof history)[number]>) =>
|
|
557
|
-
item.id === revisionId
|
|
558
|
-
);
|
|
559
|
-
const revision = selected
|
|
560
|
-
? await readDocumentRevision(conversation.ownerId, documentId, selected.id)
|
|
561
|
-
: undefined;
|
|
562
|
-
if (!revision) {
|
|
563
|
-
return undefined;
|
|
564
|
-
}
|
|
565
|
-
// Recheck visibility after the potentially slow ancestry/content read.
|
|
566
|
-
const currentRows = await db
|
|
567
|
-
.select()
|
|
568
|
-
.from(eveConversation)
|
|
569
|
-
.where(
|
|
570
|
-
and(
|
|
571
|
-
eq(eveConversation.id, conversationId),
|
|
572
|
-
eq(eveConversation.state, "bound"),
|
|
573
|
-
sql`(${eveConversation.ownerId} = ${viewerId ?? null} or ${chat.publicReadFilter()})`
|
|
574
|
-
)
|
|
575
|
-
);
|
|
576
|
-
const current = currentRows.at(FIRST_ROW_INDEX);
|
|
577
|
-
if (!current) {
|
|
578
|
-
return undefined;
|
|
579
|
-
}
|
|
580
|
-
return {
|
|
581
|
-
canEdit: current.ownerId === viewerId,
|
|
582
|
-
history,
|
|
583
|
-
revision: {
|
|
584
|
-
content: revision.content,
|
|
585
|
-
createdAt: revision.createdAt,
|
|
586
|
-
documentId: revision.documentId,
|
|
587
|
-
id: revision.id,
|
|
588
|
-
kind: revision.kind,
|
|
589
|
-
title: revision.title,
|
|
590
|
-
},
|
|
591
|
-
};
|
|
592
|
-
};
|
|
593
|
-
|
|
594
|
-
/**
|
|
595
|
-
* Remove only this conversation's current pointer; snapshots and other branches retain their revisions.
|
|
596
|
-
* @param {{ documentId: string; expectedRevisionId: string; title: string }} input - Approved document identity, expected revision and title to recheck.
|
|
597
|
-
* @param {{ ownerId: string; conversationId: string }} scope - Authorized conversation and owner receiving the pointer removal.
|
|
598
|
-
* @param {AbortSignal} signal - Cancellation checked while the deletion transaction is locked.
|
|
599
|
-
* @returns {Promise<{ documentId: string; result: string; status: "success"; title: string; }>} Successful removal metadata, including the revision title that was revalidated.
|
|
600
|
-
*/
|
|
601
|
-
const removeEveDocumentFromConversation = async (
|
|
602
|
-
input: Readonly<{
|
|
603
|
-
documentId: string;
|
|
604
|
-
expectedRevisionId: string;
|
|
605
|
-
title: string;
|
|
606
|
-
}>,
|
|
607
|
-
scope: Readonly<{ ownerId: string; conversationId: string }>,
|
|
608
|
-
signal: ReadonlyNativeSurface<AbortSignal>
|
|
609
|
-
): Promise<{
|
|
610
|
-
documentId: string;
|
|
611
|
-
result: string;
|
|
612
|
-
status: "success";
|
|
613
|
-
title: string;
|
|
614
|
-
}> =>
|
|
615
|
-
await db.transaction(
|
|
616
|
-
async (
|
|
617
|
-
tx: Readonly<Pick<DocumentTransaction, "delete" | "execute" | "select">>
|
|
618
|
-
) => {
|
|
619
|
-
await tx.execute(
|
|
620
|
-
sql`select pg_advisory_xact_lock(hashtextextended(${`eve-family:${scope.ownerId}`}, 0))`
|
|
621
|
-
);
|
|
622
|
-
await tx.execute(
|
|
623
|
-
sql`select pg_advisory_xact_lock(hashtextextended(${`eve-document:${scope.conversationId}`}, 0))`
|
|
624
|
-
);
|
|
625
|
-
signal.throwIfAborted();
|
|
626
|
-
const conversationRows = await tx
|
|
627
|
-
.select()
|
|
628
|
-
.from(eveConversation)
|
|
629
|
-
.where(
|
|
630
|
-
and(
|
|
631
|
-
eq(eveConversation.id, scope.conversationId),
|
|
632
|
-
eq(eveConversation.ownerId, scope.ownerId),
|
|
633
|
-
eq(eveConversation.state, "bound")
|
|
634
|
-
)
|
|
635
|
-
);
|
|
636
|
-
const conversation = conversationRows.at(FIRST_ROW_INDEX);
|
|
637
|
-
if (!conversation) {
|
|
638
|
-
throw new Error("Conversation not found.");
|
|
639
|
-
}
|
|
640
|
-
const revisionRows = await tx
|
|
641
|
-
.select()
|
|
642
|
-
.from(eveDocumentRevision)
|
|
643
|
-
.where(
|
|
644
|
-
and(
|
|
645
|
-
eq(eveDocumentRevision.id, input.expectedRevisionId),
|
|
646
|
-
eq(eveDocumentRevision.documentId, input.documentId),
|
|
647
|
-
eq(eveDocumentRevision.ownerId, scope.ownerId)
|
|
648
|
-
)
|
|
649
|
-
);
|
|
650
|
-
const revision = revisionRows.at(FIRST_ROW_INDEX);
|
|
651
|
-
if (!revision) {
|
|
652
|
-
throw new Error("Document not found.");
|
|
653
|
-
}
|
|
654
|
-
if (revision.title !== input.title) {
|
|
655
|
-
throw new Error("Document changed. Request approval again.");
|
|
656
|
-
}
|
|
657
|
-
const headRows = await tx
|
|
658
|
-
.select()
|
|
659
|
-
.from(eveDocumentHead)
|
|
660
|
-
.where(
|
|
661
|
-
and(
|
|
662
|
-
eq(eveDocumentHead.conversationId, scope.conversationId),
|
|
663
|
-
eq(eveDocumentHead.documentId, input.documentId),
|
|
664
|
-
eq(eveDocumentHead.ownerId, scope.ownerId)
|
|
665
|
-
)
|
|
666
|
-
);
|
|
667
|
-
const head = headRows.at(FIRST_ROW_INDEX);
|
|
668
|
-
if (head && head.revisionId !== input.expectedRevisionId) {
|
|
669
|
-
throw new Error("Document changed. Request approval again.");
|
|
670
|
-
}
|
|
671
|
-
// An absent head is already removed; a retry must not erase a newly saved revision.
|
|
672
|
-
await tx
|
|
673
|
-
.delete(eveDocumentHead)
|
|
674
|
-
.where(
|
|
675
|
-
and(
|
|
676
|
-
eq(eveDocumentHead.conversationId, scope.conversationId),
|
|
677
|
-
eq(eveDocumentHead.documentId, input.documentId),
|
|
678
|
-
eq(eveDocumentHead.ownerId, scope.ownerId),
|
|
679
|
-
eq(eveDocumentHead.revisionId, input.expectedRevisionId)
|
|
680
|
-
)
|
|
681
|
-
);
|
|
682
|
-
signal.throwIfAborted();
|
|
683
|
-
return {
|
|
684
|
-
documentId: input.documentId,
|
|
685
|
-
result:
|
|
686
|
-
"Document removed from this conversation. Historical snapshots and other branches are unchanged.",
|
|
687
|
-
status: "success" as const,
|
|
688
|
-
title: revision.title,
|
|
689
|
-
};
|
|
690
|
-
}
|
|
691
|
-
);
|
|
692
|
-
|
|
693
|
-
export {
|
|
694
|
-
getAccessibleEveDocument,
|
|
695
|
-
getEveDocumentHistory,
|
|
696
|
-
getEveDocumentRevision,
|
|
697
|
-
purgeEveFamilyDocuments,
|
|
698
|
-
removeEveDocumentFromConversation,
|
|
699
|
-
saveEveDocumentRevision,
|
|
700
|
-
};
|