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,12 +1,12 @@
|
|
|
1
1
|
import type { ArrayParameter, Helper, PendingQuery, Row } from "postgres";
|
|
2
2
|
|
|
3
|
-
// Exact migration boundary of @workflow/world-postgres 5.
|
|
3
|
+
// Exact migration boundary of @workflow/world-postgres 5.1.1 and
|
|
4
4
|
// graphile-worker 0.16.6. New migrations require native acceptance and review of
|
|
5
5
|
// queue envelopes, ownership relationships, triggers, and deletion ordering.
|
|
6
|
-
const workflowMigrationBoundary = "
|
|
6
|
+
const workflowMigrationBoundary = "1790208000000";
|
|
7
7
|
const graphileMigrationBoundary = 18;
|
|
8
8
|
const queueFenceCount = 1;
|
|
9
|
-
const
|
|
9
|
+
const queueTaskCount = 2;
|
|
10
10
|
const fencedTables = [
|
|
11
11
|
"workflow_runs",
|
|
12
12
|
"workflow_events",
|
|
@@ -14,6 +14,9 @@ const fencedTables = [
|
|
|
14
14
|
"workflow_steps",
|
|
15
15
|
"workflow_hooks",
|
|
16
16
|
"workflow_waits",
|
|
17
|
+
"workflow_invocations",
|
|
18
|
+
"workflow_snapshots",
|
|
19
|
+
"workflow_start_hook_admissions",
|
|
17
20
|
"workflow_stream_chunks",
|
|
18
21
|
];
|
|
19
22
|
|
|
@@ -71,11 +74,11 @@ export const assertPostgresLifecycleCompatibility = async (
|
|
|
71
74
|
and a.attnum = any(t.tgattr)) = array['payload', 'task_id']))
|
|
72
75
|
`;
|
|
73
76
|
const tasks = await connection`
|
|
74
|
-
select identifier from workflow.eve_queue_tasks where identifier
|
|
77
|
+
select identifier from workflow.eve_queue_tasks where identifier in ('workflow_flows', 'workflow_flows_executor')
|
|
75
78
|
`;
|
|
76
79
|
if (
|
|
77
80
|
triggers.length !== fencedTables.length + queueFenceCount ||
|
|
78
|
-
tasks.length
|
|
81
|
+
tasks.length !== queueTaskCount
|
|
79
82
|
) {
|
|
80
83
|
throw new Error(
|
|
81
84
|
"Workflow lifecycle fences are missing or disabled, or their definitions are incompatible. Run eve:setup before cleanup."
|
|
@@ -5,6 +5,7 @@ import { readEvePostgresRunInventoryInTransaction } from "./eve-run-inventory";
|
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
|
|
7
7
|
const EMPTY_COUNT = 0;
|
|
8
|
+
const EXPECTED_QUEUE_TASK_COUNT = 2;
|
|
8
9
|
const MIN_IDENTIFIER_LENGTH = 1;
|
|
9
10
|
type PayloadQuery = PostgresLifecycleQuery & {
|
|
10
11
|
readonly array: TransactionSql["array"];
|
|
@@ -33,8 +34,8 @@ const assertPayloadPurgeReady = async (
|
|
|
33
34
|
throw new Error("Fence every run and stream before purging payloads.");
|
|
34
35
|
}
|
|
35
36
|
const configured =
|
|
36
|
-
await query`select identifier from workflow.eve_queue_tasks where identifier
|
|
37
|
-
if (configured.length
|
|
37
|
+
await query`select identifier from workflow.eve_queue_tasks where identifier in (${taskIdentifier}, ${`${taskIdentifier}_executor`})`;
|
|
38
|
+
if (configured.length !== EXPECTED_QUEUE_TASK_COUNT) {
|
|
38
39
|
throw new Error("Install the queue fence before purging payloads.");
|
|
39
40
|
}
|
|
40
41
|
const queue = await readEvePostgresQueueInventory(query, {
|
|
@@ -96,6 +97,9 @@ const erasePayloadInventory = async (
|
|
|
96
97
|
await query`delete from workflow.workflow_steps where run_id in ${query(receipt.runIds)}`;
|
|
97
98
|
await query`delete from workflow.workflow_hooks where run_id in ${query(receipt.runIds)}`;
|
|
98
99
|
await query`delete from workflow.workflow_waits where run_id in ${query(receipt.runIds)}`;
|
|
100
|
+
await query`delete from workflow.workflow_invocations where run_id in ${query(receipt.runIds)}`;
|
|
101
|
+
await query`delete from workflow.workflow_snapshots where run_id in ${query(receipt.runIds)}`;
|
|
102
|
+
await query`delete from workflow.workflow_start_hook_admissions where run_id in ${query(receipt.runIds)}`;
|
|
99
103
|
await query`delete from workflow.workflow_runs where id in ${query(receipt.runIds)}`;
|
|
100
104
|
};
|
|
101
105
|
/**
|
|
@@ -60,7 +60,7 @@ create or replace trigger eve_queue_fence before insert or update of payload, ta
|
|
|
60
60
|
/**
|
|
61
61
|
* Explicit provider migration after installEvePostgresResourceFence. Fences enqueues and replacements, leaving worker bookkeeping and existing job removal available.
|
|
62
62
|
*
|
|
63
|
-
* @param {Sql} connection Postgres connection used to install the queue trigger and register its
|
|
63
|
+
* @param {Sql} connection Postgres connection used to install the queue trigger and register its tasks in one READ COMMITTED transaction.
|
|
64
64
|
* @param {string} taskIdentifier Nonempty provider task identifier (normally workflow_flows) whose queue writes require writable resources.
|
|
65
65
|
* @returns {Promise<void>} Resolves after the trigger and task registration commit; validation, migration or transaction failures reject.
|
|
66
66
|
*/
|
|
@@ -76,7 +76,7 @@ export const installEvePostgresQueueFence = async (
|
|
|
76
76
|
) => {
|
|
77
77
|
await query`select 'workflow.eve_assert_writable(text[])'::regprocedure`;
|
|
78
78
|
await query.unsafe(installSql);
|
|
79
|
-
await query`insert into workflow.eve_queue_tasks(identifier) values (${taskIdentifier}) on conflict do nothing`;
|
|
79
|
+
await query`insert into workflow.eve_queue_tasks(identifier) values (${taskIdentifier}), (${`${taskIdentifier}_executor`}) on conflict do nothing`;
|
|
80
80
|
}
|
|
81
81
|
);
|
|
82
82
|
};
|
|
@@ -25,7 +25,7 @@ const readQueueMessages = async (
|
|
|
25
25
|
convert_from(decode(job.payload->>'data', 'base64'), 'UTF8')::jsonb as body
|
|
26
26
|
from graphile_worker._private_jobs job
|
|
27
27
|
join graphile_worker._private_tasks task on task.id = job.task_id
|
|
28
|
-
where task.identifier
|
|
28
|
+
where task.identifier in (${taskIdentifier}, ${`${taskIdentifier}_executor`})
|
|
29
29
|
), metadata as (
|
|
30
30
|
select id, locked, body,
|
|
31
31
|
case when jsonb_typeof(body->'runId') = 'string'
|
|
@@ -47,7 +47,7 @@ const readQueueMessages = async (
|
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
|
-
* Internal metadata-only inventory for Workflow Postgres
|
|
50
|
+
* Internal metadata-only inventory for Workflow Postgres 5.1.1's Graphile
|
|
51
51
|
* transport. Caller authorizes run IDs and supplies its configured queue task.
|
|
52
52
|
* Includes resilient child creation even when its run row does not exist yet.
|
|
53
53
|
* This read neither locks nor removes jobs; later cleanup must recheck ownership.
|
|
@@ -5,6 +5,7 @@ import { readEvePostgresQueueInventory } from "./eve-queue-inventory";
|
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
|
|
7
7
|
const EMPTY_COUNT = 0;
|
|
8
|
+
const EXPECTED_QUEUE_TASK_COUNT = 2;
|
|
8
9
|
const MIN_IDENTIFIER_LENGTH = 1;
|
|
9
10
|
const MIN_QUEUE_RUNS = 1;
|
|
10
11
|
const MAX_INVENTORY_SIZE = 10_000;
|
|
@@ -72,8 +73,8 @@ const readQueuePurgeScope = async (
|
|
|
72
73
|
): Promise<Set<string>> => {
|
|
73
74
|
await query`select pg_advisory_xact_lock(hashtextextended(${`eve-queue-purge:${scope.taskIdentifier}:${scope.sessionId}`}, 0))`;
|
|
74
75
|
const configured = await query`select identifier from workflow.eve_queue_tasks
|
|
75
|
-
where identifier
|
|
76
|
-
if (configured.length
|
|
76
|
+
where identifier in (${scope.taskIdentifier}, ${`${scope.taskIdentifier}_executor`})`;
|
|
77
|
+
if (configured.length !== EXPECTED_QUEUE_TASK_COUNT) {
|
|
77
78
|
throw new Error("Install the queue fence before removing payloads.");
|
|
78
79
|
}
|
|
79
80
|
const retained = z.array(z.object({ id: z.string() })).parse(
|
|
@@ -33,13 +33,6 @@ create table if not exists workflow.eve_payload_purges (
|
|
|
33
33
|
completed_at timestamptz not null default now(),
|
|
34
34
|
primary key (session_id, task_identifier)
|
|
35
35
|
);
|
|
36
|
-
create table if not exists workflow.eve_sandbox_coverage (
|
|
37
|
-
session_id text primary key,
|
|
38
|
-
app_root text not null,
|
|
39
|
-
run_ids text[] not null,
|
|
40
|
-
sandbox_session_ids text[] not null,
|
|
41
|
-
completed_at timestamptz not null default now()
|
|
42
|
-
);
|
|
43
36
|
create or replace function workflow.eve_assert_writable(resources text[])
|
|
44
37
|
returns void language plpgsql set search_path = pg_catalog as $$
|
|
45
38
|
declare resource_id text; is_fenced boolean;
|
|
@@ -101,7 +94,8 @@ create or replace trigger eve_resource_fence before insert or update
|
|
|
101
94
|
on workflow.workflow_stream_chunks for each row execute function workflow.eve_guard_stream();
|
|
102
95
|
do $$ declare table_name text; begin
|
|
103
96
|
foreach table_name in array array['workflow_events', 'workflow_event_slots',
|
|
104
|
-
'workflow_steps', 'workflow_hooks', 'workflow_waits'
|
|
97
|
+
'workflow_steps', 'workflow_hooks', 'workflow_waits',
|
|
98
|
+
'workflow_invocations', 'workflow_snapshots', 'workflow_start_hook_admissions']
|
|
105
99
|
loop
|
|
106
100
|
execute format('create or replace trigger eve_resource_fence before insert or update on workflow.%I for each row execute function workflow.eve_guard_run_payload()', table_name);
|
|
107
101
|
end loop;
|
|
@@ -141,7 +141,7 @@ const readEvePostgresRunInventoryInTransaction = async (
|
|
|
141
141
|
};
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
|
-
* Read-only adapter for @workflow/world-postgres 5.
|
|
144
|
+
* Read-only adapter for @workflow/world-postgres 5.1.1.
|
|
145
145
|
* The caller must authorize the session before using this internal primitive.
|
|
146
146
|
* This snapshot inventories known run/stream relationships, not queue, sandbox,
|
|
147
147
|
* or blob coverage. It is not a retirement barrier or a purge receipt.
|
|
@@ -13,7 +13,7 @@ const positionRows = z.array(
|
|
|
13
13
|
);
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Metadata-only adapter for
|
|
16
|
+
* Metadata-only adapter for Workflow Postgres 5.1.1.
|
|
17
17
|
* Uses the same default stream name and non-EOF chunk count as getReadable /
|
|
18
18
|
* streams.getInfo. Callers must supply only owner-authorized sessions.
|
|
19
19
|
* Missing streams are omitted, never certified as empty or settled.
|
|
@@ -38,10 +38,15 @@ const readEvePostgresStreamPositions = async (
|
|
|
38
38
|
const rows = positionRows.parse(
|
|
39
39
|
// oxlint-disable-next-line eslint/no-await-in-loop -- Bounded resources: the adapter opens a max: 1 pool and also accepts transaction connections; run one 500-name statement at a time instead of queuing every inventory batch on that connection.
|
|
40
40
|
await connection`
|
|
41
|
+
with chunks as (
|
|
42
|
+
select stream_id, id, eof,
|
|
43
|
+
min(id) filter (where eof) over (partition by stream_id) as first_eof
|
|
44
|
+
from workflow.workflow_stream_chunks
|
|
45
|
+
where stream_id in ${connection(names.slice(offset, offset + STREAM_POSITION_BATCH_SIZE))}
|
|
46
|
+
)
|
|
41
47
|
select stream_id as "streamId",
|
|
42
|
-
count(*) filter (where eof
|
|
43
|
-
from
|
|
44
|
-
where stream_id in ${connection(names.slice(offset, offset + STREAM_POSITION_BATCH_SIZE))}
|
|
48
|
+
count(*) filter (where not eof and (first_eof is null or id < first_eof)) as length
|
|
49
|
+
from chunks
|
|
45
50
|
group by stream_id
|
|
46
51
|
`
|
|
47
52
|
);
|
|
@@ -65,7 +65,8 @@ const prefix = [
|
|
|
65
65
|
];
|
|
66
66
|
const seededPrefix = prefix.map((entry, index) => ({
|
|
67
67
|
...entry,
|
|
68
|
-
id: `
|
|
68
|
+
id: `import:imported:${index}`,
|
|
69
|
+
metadata: { imported: true as const, historyId: String(index) },
|
|
69
70
|
}));
|
|
70
71
|
const original = [
|
|
71
72
|
...prefix,
|
|
@@ -360,7 +361,7 @@ it("places edit and regenerated versions at the selected message, preserving pre
|
|
|
360
361
|
expect(retry.slice(0, 3)).toEqual(root.slice(0, 3));
|
|
361
362
|
expect(snapshot.children.get(root[1])).toEqual([root[2], edit[2]]);
|
|
362
363
|
expect(snapshot.children.get(root[2])).toEqual([root[3], retry[3]]);
|
|
363
|
-
expect(chat.logicalId("edit", "
|
|
364
|
+
expect(chat.logicalId("edit", "import:imported:0")).toBe(root[0]);
|
|
364
365
|
});
|
|
365
366
|
|
|
366
367
|
it("resolves edits of inherited seed messages through their source aliases", () => {
|
|
@@ -375,7 +376,7 @@ it("resolves edits of inherited seed messages through their source aliases", ()
|
|
|
375
376
|
branch("nested", {
|
|
376
377
|
parentConversationId: "edit",
|
|
377
378
|
forkKind: "edit",
|
|
378
|
-
forkMessageId: "
|
|
379
|
+
forkMessageId: "import:imported:0",
|
|
379
380
|
}),
|
|
380
381
|
]);
|
|
381
382
|
chat.observe(
|
|
@@ -110,13 +110,15 @@ const branchPrefix = (
|
|
|
110
110
|
return { prefix: source.slice(0, index), replaced: boundary };
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
const
|
|
113
|
+
const inheritedHistoryId = (
|
|
114
114
|
message: EveMessage,
|
|
115
115
|
prefix: readonly string[],
|
|
116
116
|
nodes: ReadonlyMap<string, LogicalNode>
|
|
117
117
|
): string | undefined => {
|
|
118
|
-
const
|
|
119
|
-
|
|
118
|
+
const historyId = message.metadata?.imported
|
|
119
|
+
? message.metadata.historyId
|
|
120
|
+
: undefined;
|
|
121
|
+
const id = historyId === undefined ? undefined : prefix[Number(historyId)];
|
|
120
122
|
if (id !== undefined && nodes.get(id)?.message.role !== message.role) {
|
|
121
123
|
throw new Error(
|
|
122
124
|
"Copied message roles do not match the saved branch prefix."
|
|
@@ -141,13 +143,11 @@ const projectBranch = (
|
|
|
141
143
|
let hasPrompt = false;
|
|
142
144
|
for (const message of messages) {
|
|
143
145
|
const firstUser =
|
|
144
|
-
!hasPrompt &&
|
|
145
|
-
message.role === "user" &&
|
|
146
|
-
!message.id.startsWith("seed_message_");
|
|
146
|
+
!hasPrompt && message.role === "user" && !message.metadata?.imported;
|
|
147
147
|
if (firstUser) {
|
|
148
148
|
hasPrompt = true;
|
|
149
149
|
}
|
|
150
|
-
const inheritedId =
|
|
150
|
+
const inheritedId = inheritedHistoryId(message, inherited.prefix, nodes);
|
|
151
151
|
const replacementId =
|
|
152
152
|
firstUser && branch.forkKind === "regenerate"
|
|
153
153
|
? inherited.replaced
|
|
@@ -177,7 +177,7 @@ const projectBranch = (
|
|
|
177
177
|
if (needsResponse) {
|
|
178
178
|
return {
|
|
179
179
|
hasLocalMessage: messages
|
|
180
|
-
.filter((message) => !message.
|
|
180
|
+
.filter((message) => !message.metadata?.imported)
|
|
181
181
|
.some((message) => message.role === "assistant"),
|
|
182
182
|
path,
|
|
183
183
|
};
|
|
@@ -58,13 +58,13 @@ it("projects a known receipt by delivery identity, never by identical text", ()
|
|
|
58
58
|
const events = [received(1, "accepted"), received(2, "unknown")];
|
|
59
59
|
const data = project(events);
|
|
60
60
|
const projected = projectEveMessageDisplay(data, events, [
|
|
61
|
-
{ kind: "send", deliveryId: "accepted", selectedTool: "
|
|
61
|
+
{ kind: "send", deliveryId: "accepted", selectedTool: "generateImage" },
|
|
62
62
|
]);
|
|
63
63
|
expect(projected.messages[0]?.metadata?.custom).toEqual({
|
|
64
|
-
chatjs: { selectedTool: "
|
|
64
|
+
chatjs: { selectedTool: "generateImage" },
|
|
65
65
|
});
|
|
66
66
|
expect(projected.messages[1]?.metadata?.custom).toBeUndefined();
|
|
67
|
-
expect(data.messages[0]?.metadata
|
|
67
|
+
expect(data.messages[0]?.metadata).not.toHaveProperty("custom");
|
|
68
68
|
expect(projectEveMessageDisplay(data, events, [])).toBe(data);
|
|
69
69
|
});
|
|
70
70
|
|
|
@@ -74,7 +74,7 @@ it("requires one receipt and one consumption for the exact delivery", () => {
|
|
|
74
74
|
const receipt = {
|
|
75
75
|
kind: "send",
|
|
76
76
|
deliveryId: "accepted",
|
|
77
|
-
selectedTool: "
|
|
77
|
+
selectedTool: "generateImage",
|
|
78
78
|
} as const;
|
|
79
79
|
expect(projectEveMessageDisplay(data, [event], [receipt, receipt])).toBe(
|
|
80
80
|
data
|
|
@@ -99,7 +99,7 @@ it("does not decorate pending optimistic messages even when their id matches", (
|
|
|
99
99
|
const projected = projectEveMessageDisplay(
|
|
100
100
|
data,
|
|
101
101
|
[event],
|
|
102
|
-
[{ kind: "send", deliveryId: "accepted", selectedTool: "
|
|
102
|
+
[{ kind: "send", deliveryId: "accepted", selectedTool: "generateImage" }]
|
|
103
103
|
);
|
|
104
104
|
expect(projected.messages[0]?.metadata?.custom).toBeUndefined();
|
|
105
105
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ConversationState, SessionStreamEvent } from "eve/client";
|
|
2
|
+
import type { ReadonlyEveMessage } from "./readonly-message-types";
|
|
2
3
|
import type { UiToolName } from "@/lib/ai/types";
|
|
3
4
|
import { eveToolMetadata } from "./message-tool-selection";
|
|
4
5
|
|
|
@@ -6,6 +7,11 @@ export interface EveMessageDisplayReceipt {
|
|
|
6
7
|
readonly selectedTool: UiToolName | null;
|
|
7
8
|
readonly kind: "send";
|
|
8
9
|
readonly deliveryId: string;
|
|
10
|
+
readonly history?: readonly {
|
|
11
|
+
readonly role: "user" | "assistant";
|
|
12
|
+
readonly selectedTool?: UiToolName | null;
|
|
13
|
+
readonly modelId?: string;
|
|
14
|
+
}[];
|
|
9
15
|
}
|
|
10
16
|
|
|
11
17
|
/** Only directly returned delivery IDs authorize a selected-tool badge. */
|
|
@@ -15,7 +21,7 @@ export const projectEveMessageDisplay = <
|
|
|
15
21
|
data: Data,
|
|
16
22
|
events: readonly SessionStreamEvent[],
|
|
17
23
|
receipts: readonly EveMessageDisplayReceipt[]
|
|
18
|
-
): Data => {
|
|
24
|
+
): Omit<Data, "messages"> & { messages: readonly ReadonlyEveMessage[] } => {
|
|
19
25
|
const byDelivery = new Map<string, EveMessageDisplayReceipt[]>();
|
|
20
26
|
for (const receipt of receipts) {
|
|
21
27
|
const matches = byDelivery.get(receipt.deliveryId);
|
|
@@ -35,10 +41,17 @@ export const projectEveMessageDisplay = <
|
|
|
35
41
|
(consumed.get(event.data.deliveryId) ?? 0) + 1
|
|
36
42
|
);
|
|
37
43
|
}
|
|
44
|
+
const inherited = new Map<
|
|
45
|
+
string,
|
|
46
|
+
NonNullable<EveMessageDisplayReceipt["history"]>[number]
|
|
47
|
+
>();
|
|
38
48
|
const byMessage = new Map<string, EveMessageDisplayReceipt>();
|
|
39
49
|
for (const [deliveryId, matches] of byDelivery) {
|
|
40
50
|
if (matches.length === 1 && consumed.get(deliveryId) === 1) {
|
|
41
51
|
byMessage.set(`${deliveryId}:user`, matches[0]);
|
|
52
|
+
for (const [index, display] of (matches[0].history ?? []).entries()) {
|
|
53
|
+
inherited.set(`${deliveryId}:imported:${index}`, display);
|
|
54
|
+
}
|
|
42
55
|
}
|
|
43
56
|
}
|
|
44
57
|
if (byMessage.size === 0) {
|
|
@@ -51,6 +64,23 @@ export const projectEveMessageDisplay = <
|
|
|
51
64
|
message.role === "user" && !message.metadata?.optimistic
|
|
52
65
|
? byMessage.get(message.id)
|
|
53
66
|
: undefined;
|
|
67
|
+
const display = message.metadata?.imported
|
|
68
|
+
? inherited.get(message.id)
|
|
69
|
+
: undefined;
|
|
70
|
+
if (display?.role === message.role) {
|
|
71
|
+
return {
|
|
72
|
+
...message,
|
|
73
|
+
metadata: {
|
|
74
|
+
...message.metadata,
|
|
75
|
+
...(display.modelId === undefined
|
|
76
|
+
? {}
|
|
77
|
+
: { modelId: display.modelId }),
|
|
78
|
+
...(display.selectedTool === undefined
|
|
79
|
+
? {}
|
|
80
|
+
: { custom: eveToolMetadata(display.selectedTool) }),
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
54
84
|
return receipt
|
|
55
85
|
? {
|
|
56
86
|
...message,
|
|
@@ -9,9 +9,9 @@ it("restores explicit selections and treats historical messages as automatic", (
|
|
|
9
9
|
).toBeNull();
|
|
10
10
|
expect(
|
|
11
11
|
eveMessageTool({
|
|
12
|
-
metadata: { custom: eveToolMetadata("
|
|
12
|
+
metadata: { custom: eveToolMetadata("generateImage") },
|
|
13
13
|
})
|
|
14
|
-
).toBe("
|
|
14
|
+
).toBe("generateImage");
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
it("does not silently broaden an invalid persisted tool selection", () => {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { DynamicModelContext } from "eve";
|
|
2
2
|
import { conversationOf } from "eve/client";
|
|
3
|
+
import { emptySessionView, foldEvents } from "eve/events";
|
|
3
4
|
import { beforeEach, expect, it, vi } from "vitest";
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
-
observeEveModelAccounting,
|
|
7
|
-
resolveAccountedEveModel,
|
|
8
|
-
} from "./model-accounting";
|
|
6
|
+
import { resolveAccountedEveModel } from "./model-accounting";
|
|
9
7
|
|
|
10
8
|
const mocks = vi.hoisted(() => ({
|
|
11
9
|
authorize: vi.fn(),
|
|
@@ -16,23 +14,6 @@ const mocks = vi.hoisted(() => ({
|
|
|
16
14
|
resolve: vi.fn(),
|
|
17
15
|
scope: vi.fn(),
|
|
18
16
|
}));
|
|
19
|
-
vi.mock("eve/context", () => ({
|
|
20
|
-
defineState: <Value>(
|
|
21
|
-
_name: string,
|
|
22
|
-
initial: () => Value
|
|
23
|
-
): {
|
|
24
|
-
get: () => Value;
|
|
25
|
-
update: (update: (current: Value) => Value) => void;
|
|
26
|
-
} => {
|
|
27
|
-
let value = initial();
|
|
28
|
-
return {
|
|
29
|
-
get: () => value,
|
|
30
|
-
update: (update) => {
|
|
31
|
-
value = update(value);
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
}));
|
|
36
17
|
vi.mock("../db/eve-model-ledger", () => ({
|
|
37
18
|
eveModelLedger: {
|
|
38
19
|
authorize: mocks.authorize,
|
|
@@ -72,6 +53,17 @@ const context: DynamicModelContext = {
|
|
|
72
53
|
id: "root",
|
|
73
54
|
},
|
|
74
55
|
};
|
|
56
|
+
const activeView = foldEvents(emptySessionView(), [
|
|
57
|
+
{
|
|
58
|
+
type: "turn.started",
|
|
59
|
+
meta: { at: "2026-11-02T00:00:00Z", position: { line: 1, index: 0 } },
|
|
60
|
+
data: {
|
|
61
|
+
turnId: "turn_1",
|
|
62
|
+
cause: { type: "delivery", deliveryId: "delivery" },
|
|
63
|
+
follows: null,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
]);
|
|
75
67
|
const resolved = {
|
|
76
68
|
model: {
|
|
77
69
|
doGenerate: vi.fn(
|
|
@@ -99,20 +91,13 @@ const resolved = {
|
|
|
99
91
|
beforeEach(() => {
|
|
100
92
|
vi.resetAllMocks();
|
|
101
93
|
mocks.resolve.mockResolvedValue(resolved);
|
|
102
|
-
observeEveModelAccounting(
|
|
103
|
-
{ data: {}, type: "session.started" },
|
|
104
|
-
{ id: "root" }
|
|
105
|
-
);
|
|
106
94
|
});
|
|
107
95
|
|
|
108
|
-
it("binds
|
|
109
|
-
observeEveModelAccounting(
|
|
110
|
-
{ data: { turnId: "turn_1" }, type: "turn.started" },
|
|
111
|
-
{ id: "root" }
|
|
112
|
-
);
|
|
96
|
+
it("binds a resumed native turn without replaying ChatJS lifecycle hooks", async () => {
|
|
113
97
|
const active = await resolveAccountedEveModel("selected", {
|
|
114
98
|
...context,
|
|
115
99
|
turn: { id: "turn_1", status: "running", input: [] },
|
|
100
|
+
view: activeView,
|
|
116
101
|
});
|
|
117
102
|
await active.model.doGenerate({ prompt: [] });
|
|
118
103
|
expect(mocks.begin).toHaveBeenCalledWith(
|
|
@@ -125,14 +110,6 @@ it("binds an active turn to its provider attempt", async () => {
|
|
|
125
110
|
});
|
|
126
111
|
|
|
127
112
|
it("puts manual compaction outside a closed turn in maintenance, never the upcoming turn", async () => {
|
|
128
|
-
observeEveModelAccounting(
|
|
129
|
-
{ data: { turnId: "turn_1" }, type: "turn.started" },
|
|
130
|
-
{ id: "root" }
|
|
131
|
-
);
|
|
132
|
-
observeEveModelAccounting(
|
|
133
|
-
{ data: { turnId: "turn_1" }, type: "turn.settled" },
|
|
134
|
-
{ id: "root" }
|
|
135
|
-
);
|
|
136
113
|
const manual = await resolveAccountedEveModel("selected", {
|
|
137
114
|
...context,
|
|
138
115
|
turn: { id: "turn_2", status: "running", input: [] },
|
|
@@ -145,10 +122,6 @@ it("puts manual compaction outside a closed turn in maintenance, never the upcom
|
|
|
145
122
|
});
|
|
146
123
|
|
|
147
124
|
it("registers child lineage before invoking the provider", async () => {
|
|
148
|
-
observeEveModelAccounting(
|
|
149
|
-
{ data: { turnId: "turn_1" }, type: "turn.started" },
|
|
150
|
-
{ id: "child", parent: { sessionId: "root", turn: { id: "turn_7" } } }
|
|
151
|
-
);
|
|
152
125
|
mocks.child.mockResolvedValue({
|
|
153
126
|
rootSessionId: "root",
|
|
154
127
|
rootTurnId: "turn_7",
|
|
@@ -156,7 +129,17 @@ it("registers child lineage before invoking the provider", async () => {
|
|
|
156
129
|
const child = await resolveAccountedEveModel("research", {
|
|
157
130
|
...context,
|
|
158
131
|
turn: { id: "turn_1", status: "running", input: [] },
|
|
159
|
-
|
|
132
|
+
view: activeView,
|
|
133
|
+
session: {
|
|
134
|
+
...context.session,
|
|
135
|
+
id: "child",
|
|
136
|
+
parent: {
|
|
137
|
+
sessionId: "root",
|
|
138
|
+
rootSessionId: "root",
|
|
139
|
+
callId: "call",
|
|
140
|
+
turn: { id: "turn_7", sequence: 7 },
|
|
141
|
+
},
|
|
142
|
+
},
|
|
160
143
|
});
|
|
161
144
|
await child.model.doGenerate({ prompt: [] });
|
|
162
145
|
expect(mocks.register).toHaveBeenCalledWith(
|
|
@@ -171,11 +154,11 @@ it("registers child lineage before invoking the provider", async () => {
|
|
|
171
154
|
);
|
|
172
155
|
});
|
|
173
156
|
|
|
174
|
-
it("fails closed before resolving a provider when
|
|
157
|
+
it("fails closed before resolving a provider when owner identity or ownership is missing", async () => {
|
|
175
158
|
await expect(
|
|
176
159
|
resolveAccountedEveModel("selected", {
|
|
177
160
|
...context,
|
|
178
|
-
session: { ...context.session,
|
|
161
|
+
session: { ...context.session, auth: { current: null, initiator: null } },
|
|
179
162
|
})
|
|
180
163
|
).rejects.toThrow("lifecycle");
|
|
181
164
|
mocks.scope.mockRejectedValue(new Error("owner mismatch"));
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { DynamicModelContext } from "eve";
|
|
2
|
-
import
|
|
3
|
-
import { defineState } from "eve/context";
|
|
4
|
-
import { z } from "zod";
|
|
2
|
+
import { turn } from "eve/events";
|
|
5
3
|
|
|
6
4
|
import { eveModelLedger } from "@/lib/db/eve-model-ledger";
|
|
7
5
|
import { registerEveSubagent } from "@/lib/db/eve-subagents";
|
|
@@ -11,49 +9,8 @@ import { wrapEveModel } from "./model-ledger";
|
|
|
11
9
|
import type { ModelCallScope } from "./model-ledger";
|
|
12
10
|
import { resolveEveModel } from "./model-selection";
|
|
13
11
|
|
|
14
|
-
interface AccountingState {
|
|
15
|
-
readonly sessionId: string;
|
|
16
|
-
readonly openTurns: readonly string[];
|
|
17
|
-
readonly parent?: {
|
|
18
|
-
readonly sessionId: string;
|
|
19
|
-
readonly turn: { readonly id: string };
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const accounting = defineState<AccountingState>(
|
|
24
|
-
"chatjs.model-accounting",
|
|
25
|
-
() => ({
|
|
26
|
-
openTurns: [],
|
|
27
|
-
sessionId: "",
|
|
28
|
-
})
|
|
29
|
-
);
|
|
30
12
|
const BINDING_TIMEOUT_MS = 10_000;
|
|
31
13
|
|
|
32
|
-
const observeEveModelAccounting = (
|
|
33
|
-
event: { readonly type: SessionStreamEvent["type"]; readonly data?: unknown },
|
|
34
|
-
session: Pick<AccountingState, "parent"> & { readonly id: string }
|
|
35
|
-
): void => {
|
|
36
|
-
if (event.type === "session.started") {
|
|
37
|
-
accounting.update(() => ({
|
|
38
|
-
openTurns: [],
|
|
39
|
-
parent: session.parent,
|
|
40
|
-
sessionId: session.id,
|
|
41
|
-
}));
|
|
42
|
-
}
|
|
43
|
-
if (event.type === "turn.started" || event.type === "turn.settled") {
|
|
44
|
-
const { turnId } = z.object({ turnId: z.string() }).parse(event.data);
|
|
45
|
-
accounting.update((current) => {
|
|
46
|
-
const remaining =
|
|
47
|
-
current.sessionId === session.id
|
|
48
|
-
? current.openTurns.filter((id) => id !== turnId)
|
|
49
|
-
: [];
|
|
50
|
-
const openTurns =
|
|
51
|
-
event.type === "turn.started" ? [...remaining, turnId] : remaining;
|
|
52
|
-
return { openTurns, parent: session.parent, sessionId: session.id };
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
14
|
const accountEveModel = (
|
|
58
15
|
resolved: Awaited<ReturnType<typeof resolveEveModel>>,
|
|
59
16
|
scope: ModelCallScope
|
|
@@ -63,24 +20,21 @@ const accountEveModel = (
|
|
|
63
20
|
});
|
|
64
21
|
const resolveAccountedEveModel = async (
|
|
65
22
|
requestedId: string | undefined,
|
|
66
|
-
context: Pick<DynamicModelContext, "session" | "turn">
|
|
23
|
+
context: Pick<DynamicModelContext, "session" | "turn" | "view">
|
|
67
24
|
): Promise<Awaited<ReturnType<typeof resolveEveModel>>> => {
|
|
68
|
-
const
|
|
25
|
+
const { parent } = context.session;
|
|
69
26
|
const ownerId = context.session.auth.initiator?.principalId;
|
|
70
27
|
if (typeof ownerId !== "string" || ownerId === "") {
|
|
71
28
|
throw new Error("Model accounting lifecycle binding is unavailable.");
|
|
72
29
|
}
|
|
73
|
-
if (state.sessionId !== context.session.id) {
|
|
74
|
-
throw new Error("Model accounting lifecycle binding is unavailable.");
|
|
75
|
-
}
|
|
76
30
|
// Initial native creation can reach the model before HTTP binding. The scope
|
|
77
31
|
// resolver verifies the native operation receipt; children use trusted lineage.
|
|
78
|
-
await (
|
|
32
|
+
await (parent
|
|
79
33
|
? registerEveSubagent(
|
|
80
34
|
ownerId,
|
|
81
|
-
|
|
35
|
+
parent.sessionId,
|
|
82
36
|
context.session.id,
|
|
83
|
-
|
|
37
|
+
parent.turn.id
|
|
84
38
|
)
|
|
85
39
|
: resolveEveConversationScope(
|
|
86
40
|
ownerId,
|
|
@@ -92,10 +46,10 @@ const resolveAccountedEveModel = async (
|
|
|
92
46
|
ownerId,
|
|
93
47
|
sessionId: context.session.id,
|
|
94
48
|
...(context.turn?.status === "running" &&
|
|
95
|
-
|
|
49
|
+
turn(context.view, context.turn.id)?.status === "running"
|
|
96
50
|
? { turnId: context.turn.id }
|
|
97
51
|
: {}),
|
|
98
52
|
});
|
|
99
53
|
};
|
|
100
54
|
|
|
101
|
-
export { accountEveModel,
|
|
55
|
+
export { accountEveModel, resolveAccountedEveModel };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
completeEveFilePurge,
|
|
3
3
|
prepareEveFamilyFilePurge,
|
|
4
|
-
prepareEveWorkspaceFilePurge,
|
|
5
4
|
releaseEveFamilyFileReferences,
|
|
6
5
|
} from "@/lib/db/eve-file-purge";
|
|
7
6
|
import { createFileUrl } from "@/lib/file-url";
|
|
@@ -24,15 +23,3 @@ export const purgeEveFamilyFiles = async (
|
|
|
24
23
|
}
|
|
25
24
|
await releaseEveFamilyFileReferences(ownerId, rootId);
|
|
26
25
|
};
|
|
27
|
-
|
|
28
|
-
/** Retryable cleanup for an explicitly deleted empty workspace's original uploads. */
|
|
29
|
-
export const purgeEveWorkspaceFiles = async (
|
|
30
|
-
ownerId: string,
|
|
31
|
-
workspaceId: string
|
|
32
|
-
): Promise<void> => {
|
|
33
|
-
const keys = await prepareEveWorkspaceFilePurge(ownerId, workspaceId);
|
|
34
|
-
if (keys.length > NO_FILE_KEYS) {
|
|
35
|
-
await deleteFilesByUrls(keys.map((key) => createFileUrl(key)));
|
|
36
|
-
await completeEveFilePurge(ownerId, keys);
|
|
37
|
-
}
|
|
38
|
-
};
|