@vertesia/workflow 0.81.1 → 1.0.0-dev.20260203.130115Z
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/bin/bundle-workflows.mjs +13 -0
- package/package.json +16 -16
- package/src/activities/advanced/createOrUpdateDocumentFromInteractionRun.ts +1 -1
- package/src/activities/advanced/updateDocumentFromInteractionRun.ts +1 -1
- package/src/activities/copyParentArtifacts.ts +162 -0
- package/src/activities/extractDocumentText.ts +4 -1
- package/src/activities/generateDocumentProperties.ts +1 -1
- package/src/activities/generateEmbeddings.ts +52 -9
- package/src/activities/index-dsl.ts +3 -1
- package/src/activities/media/prepareAudio.ts +334 -0
- package/src/activities/mergeChildArtifacts.ts +189 -0
- package/src/activities/setDocumentStatus.ts +12 -4
- package/src/dsl/dsl-workflow.ts +11 -1
- package/src/errors.ts +15 -0
- package/src/index.ts +1 -0
- package/lib/cjs/activities/advanced/createDocumentTypeFromInteractionRun.js +0 -33
- package/lib/cjs/activities/advanced/createDocumentTypeFromInteractionRun.js.map +0 -1
- package/lib/cjs/activities/advanced/createOrUpdateDocumentFromInteractionRun.js +0 -73
- package/lib/cjs/activities/advanced/createOrUpdateDocumentFromInteractionRun.js.map +0 -1
- package/lib/cjs/activities/advanced/updateDocumentFromInteractionRun.js +0 -19
- package/lib/cjs/activities/advanced/updateDocumentFromInteractionRun.js.map +0 -1
- package/lib/cjs/activities/chunkDocument.js +0 -85
- package/lib/cjs/activities/chunkDocument.js.map +0 -1
- package/lib/cjs/activities/createDocumentFromOther.js +0 -64
- package/lib/cjs/activities/createDocumentFromOther.js.map +0 -1
- package/lib/cjs/activities/executeInteraction.js +0 -194
- package/lib/cjs/activities/executeInteraction.js.map +0 -1
- package/lib/cjs/activities/extractDocumentText.js +0 -156
- package/lib/cjs/activities/extractDocumentText.js.map +0 -1
- package/lib/cjs/activities/generateDocumentProperties.js +0 -83
- package/lib/cjs/activities/generateDocumentProperties.js.map +0 -1
- package/lib/cjs/activities/generateEmbeddings.js +0 -228
- package/lib/cjs/activities/generateEmbeddings.js.map +0 -1
- package/lib/cjs/activities/generateOrAssignContentType.js +0 -125
- package/lib/cjs/activities/generateOrAssignContentType.js.map +0 -1
- package/lib/cjs/activities/getObjectFromStore.js +0 -20
- package/lib/cjs/activities/getObjectFromStore.js.map +0 -1
- package/lib/cjs/activities/handleError.js +0 -22
- package/lib/cjs/activities/handleError.js.map +0 -1
- package/lib/cjs/activities/index-dsl.js +0 -47
- package/lib/cjs/activities/index-dsl.js.map +0 -1
- package/lib/cjs/activities/index.js +0 -21
- package/lib/cjs/activities/index.js.map +0 -1
- package/lib/cjs/activities/media/prepareVideo.js +0 -429
- package/lib/cjs/activities/media/prepareVideo.js.map +0 -1
- package/lib/cjs/activities/media/processPdfWithTextract.js +0 -103
- package/lib/cjs/activities/media/processPdfWithTextract.js.map +0 -1
- package/lib/cjs/activities/media/saveGladiaTranscription.js +0 -81
- package/lib/cjs/activities/media/saveGladiaTranscription.js.map +0 -1
- package/lib/cjs/activities/media/transcribeMediaWithGladia.js +0 -82
- package/lib/cjs/activities/media/transcribeMediaWithGladia.js.map +0 -1
- package/lib/cjs/activities/notifyWebhook.js +0 -158
- package/lib/cjs/activities/notifyWebhook.js.map +0 -1
- package/lib/cjs/activities/rateLimiter.js +0 -30
- package/lib/cjs/activities/rateLimiter.js.map +0 -1
- package/lib/cjs/activities/renditions/generateImageRendition.js +0 -66
- package/lib/cjs/activities/renditions/generateImageRendition.js.map +0 -1
- package/lib/cjs/activities/renditions/generateVideoRendition.js +0 -200
- package/lib/cjs/activities/renditions/generateVideoRendition.js.map +0 -1
- package/lib/cjs/activities/setDocumentStatus.js +0 -15
- package/lib/cjs/activities/setDocumentStatus.js.map +0 -1
- package/lib/cjs/conversion/TextractProcessor.js +0 -417
- package/lib/cjs/conversion/TextractProcessor.js.map +0 -1
- package/lib/cjs/conversion/image.js +0 -149
- package/lib/cjs/conversion/image.js.map +0 -1
- package/lib/cjs/conversion/markitdown.js +0 -42
- package/lib/cjs/conversion/markitdown.js.map +0 -1
- package/lib/cjs/conversion/mutool.js +0 -147
- package/lib/cjs/conversion/mutool.js.map +0 -1
- package/lib/cjs/conversion/pandoc.js +0 -39
- package/lib/cjs/conversion/pandoc.js.map +0 -1
- package/lib/cjs/dsl/conditions.js +0 -81
- package/lib/cjs/dsl/conditions.js.map +0 -1
- package/lib/cjs/dsl/dsl-workflow.js +0 -343
- package/lib/cjs/dsl/dsl-workflow.js.map +0 -1
- package/lib/cjs/dsl/dslProxyActivities.js +0 -23
- package/lib/cjs/dsl/dslProxyActivities.js.map +0 -1
- package/lib/cjs/dsl/projections.js +0 -59
- package/lib/cjs/dsl/projections.js.map +0 -1
- package/lib/cjs/dsl/setup/ActivityContext.js +0 -122
- package/lib/cjs/dsl/setup/ActivityContext.js.map +0 -1
- package/lib/cjs/dsl/setup/fetch/DataProvider.js +0 -51
- package/lib/cjs/dsl/setup/fetch/DataProvider.js.map +0 -1
- package/lib/cjs/dsl/setup/fetch/index.js +0 -16
- package/lib/cjs/dsl/setup/fetch/index.js.map +0 -1
- package/lib/cjs/dsl/setup/fetch/providers.js +0 -67
- package/lib/cjs/dsl/setup/fetch/providers.js.map +0 -1
- package/lib/cjs/dsl/test/test-child-workflow.js +0 -10
- package/lib/cjs/dsl/test/test-child-workflow.js.map +0 -1
- package/lib/cjs/dsl/validation.js +0 -122
- package/lib/cjs/dsl/validation.js.map +0 -1
- package/lib/cjs/dsl/vars.js +0 -341
- package/lib/cjs/dsl/vars.js.map +0 -1
- package/lib/cjs/dsl/walk.js +0 -100
- package/lib/cjs/dsl/walk.js.map +0 -1
- package/lib/cjs/dsl.js +0 -20
- package/lib/cjs/dsl.js.map +0 -1
- package/lib/cjs/errors.js +0 -70
- package/lib/cjs/errors.js.map +0 -1
- package/lib/cjs/index.js +0 -55
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/iterative-generation/activities/extractToc.js +0 -47
- package/lib/cjs/iterative-generation/activities/extractToc.js.map +0 -1
- package/lib/cjs/iterative-generation/activities/finalizeOutput.js +0 -72
- package/lib/cjs/iterative-generation/activities/finalizeOutput.js.map +0 -1
- package/lib/cjs/iterative-generation/activities/generatePart.js +0 -78
- package/lib/cjs/iterative-generation/activities/generatePart.js.map +0 -1
- package/lib/cjs/iterative-generation/activities/generateToc.js +0 -86
- package/lib/cjs/iterative-generation/activities/generateToc.js.map +0 -1
- package/lib/cjs/iterative-generation/activities/index.js +0 -12
- package/lib/cjs/iterative-generation/activities/index.js.map +0 -1
- package/lib/cjs/iterative-generation/iterativeGenerationWorkflow.js +0 -56
- package/lib/cjs/iterative-generation/iterativeGenerationWorkflow.js.map +0 -1
- package/lib/cjs/iterative-generation/types.js +0 -5
- package/lib/cjs/iterative-generation/types.js.map +0 -1
- package/lib/cjs/iterative-generation/utils.js +0 -121
- package/lib/cjs/iterative-generation/utils.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/result-types.js +0 -10
- package/lib/cjs/result-types.js.map +0 -1
- package/lib/cjs/system/notifyWebhookWorkflow.js +0 -53
- package/lib/cjs/system/notifyWebhookWorkflow.js.map +0 -1
- package/lib/cjs/system/recalculateEmbeddingsWorkflow.js +0 -33
- package/lib/cjs/system/recalculateEmbeddingsWorkflow.js.map +0 -1
- package/lib/cjs/utils/auth.js +0 -15
- package/lib/cjs/utils/auth.js.map +0 -1
- package/lib/cjs/utils/blobs.js +0 -64
- package/lib/cjs/utils/blobs.js.map +0 -1
- package/lib/cjs/utils/chunks.js +0 -14
- package/lib/cjs/utils/chunks.js.map +0 -1
- package/lib/cjs/utils/client.js +0 -31
- package/lib/cjs/utils/client.js.map +0 -1
- package/lib/cjs/utils/expand-vars.js +0 -33
- package/lib/cjs/utils/expand-vars.js.map +0 -1
- package/lib/cjs/utils/memory.js +0 -65
- package/lib/cjs/utils/memory.js.map +0 -1
- package/lib/cjs/utils/renditions.js +0 -88
- package/lib/cjs/utils/renditions.js.map +0 -1
- package/lib/cjs/utils/storage.js +0 -54
- package/lib/cjs/utils/storage.js.map +0 -1
- package/lib/cjs/utils/tokens.js +0 -38
- package/lib/cjs/utils/tokens.js.map +0 -1
- package/lib/cjs/vars.js +0 -20
- package/lib/cjs/vars.js.map +0 -1
- package/lib/cjs/workflows.js +0 -15
- package/lib/cjs/workflows.js.map +0 -1
- package/lib/esm/activities/advanced/createDocumentTypeFromInteractionRun.js +0 -30
- package/lib/esm/activities/advanced/createDocumentTypeFromInteractionRun.js.map +0 -1
- package/lib/esm/activities/advanced/createOrUpdateDocumentFromInteractionRun.js +0 -70
- package/lib/esm/activities/advanced/createOrUpdateDocumentFromInteractionRun.js.map +0 -1
- package/lib/esm/activities/advanced/updateDocumentFromInteractionRun.js +0 -16
- package/lib/esm/activities/advanced/updateDocumentFromInteractionRun.js.map +0 -1
- package/lib/esm/activities/chunkDocument.js +0 -82
- package/lib/esm/activities/chunkDocument.js.map +0 -1
- package/lib/esm/activities/createDocumentFromOther.js +0 -58
- package/lib/esm/activities/createDocumentFromOther.js.map +0 -1
- package/lib/esm/activities/executeInteraction.js +0 -190
- package/lib/esm/activities/executeInteraction.js.map +0 -1
- package/lib/esm/activities/extractDocumentText.js +0 -153
- package/lib/esm/activities/extractDocumentText.js.map +0 -1
- package/lib/esm/activities/generateDocumentProperties.js +0 -80
- package/lib/esm/activities/generateDocumentProperties.js.map +0 -1
- package/lib/esm/activities/generateEmbeddings.js +0 -225
- package/lib/esm/activities/generateEmbeddings.js.map +0 -1
- package/lib/esm/activities/generateOrAssignContentType.js +0 -122
- package/lib/esm/activities/generateOrAssignContentType.js.map +0 -1
- package/lib/esm/activities/getObjectFromStore.js +0 -17
- package/lib/esm/activities/getObjectFromStore.js.map +0 -1
- package/lib/esm/activities/handleError.js +0 -19
- package/lib/esm/activities/handleError.js.map +0 -1
- package/lib/esm/activities/index-dsl.js +0 -23
- package/lib/esm/activities/index-dsl.js.map +0 -1
- package/lib/esm/activities/index.js +0 -5
- package/lib/esm/activities/index.js.map +0 -1
- package/lib/esm/activities/media/prepareVideo.js +0 -390
- package/lib/esm/activities/media/prepareVideo.js.map +0 -1
- package/lib/esm/activities/media/processPdfWithTextract.js +0 -99
- package/lib/esm/activities/media/processPdfWithTextract.js.map +0 -1
- package/lib/esm/activities/media/saveGladiaTranscription.js +0 -78
- package/lib/esm/activities/media/saveGladiaTranscription.js.map +0 -1
- package/lib/esm/activities/media/transcribeMediaWithGladia.js +0 -79
- package/lib/esm/activities/media/transcribeMediaWithGladia.js.map +0 -1
- package/lib/esm/activities/notifyWebhook.js +0 -155
- package/lib/esm/activities/notifyWebhook.js.map +0 -1
- package/lib/esm/activities/rateLimiter.js +0 -27
- package/lib/esm/activities/rateLimiter.js.map +0 -1
- package/lib/esm/activities/renditions/generateImageRendition.js +0 -63
- package/lib/esm/activities/renditions/generateImageRendition.js.map +0 -1
- package/lib/esm/activities/renditions/generateVideoRendition.js +0 -194
- package/lib/esm/activities/renditions/generateVideoRendition.js.map +0 -1
- package/lib/esm/activities/setDocumentStatus.js +0 -12
- package/lib/esm/activities/setDocumentStatus.js.map +0 -1
- package/lib/esm/conversion/TextractProcessor.js +0 -410
- package/lib/esm/conversion/TextractProcessor.js.map +0 -1
- package/lib/esm/conversion/image.js +0 -143
- package/lib/esm/conversion/image.js.map +0 -1
- package/lib/esm/conversion/markitdown.js +0 -36
- package/lib/esm/conversion/markitdown.js.map +0 -1
- package/lib/esm/conversion/mutool.js +0 -139
- package/lib/esm/conversion/mutool.js.map +0 -1
- package/lib/esm/conversion/pandoc.js +0 -36
- package/lib/esm/conversion/pandoc.js.map +0 -1
- package/lib/esm/dsl/conditions.js +0 -75
- package/lib/esm/dsl/conditions.js.map +0 -1
- package/lib/esm/dsl/dsl-workflow.js +0 -336
- package/lib/esm/dsl/dsl-workflow.js.map +0 -1
- package/lib/esm/dsl/dslProxyActivities.js +0 -20
- package/lib/esm/dsl/dslProxyActivities.js.map +0 -1
- package/lib/esm/dsl/projections.js +0 -55
- package/lib/esm/dsl/projections.js.map +0 -1
- package/lib/esm/dsl/setup/ActivityContext.js +0 -117
- package/lib/esm/dsl/setup/ActivityContext.js.map +0 -1
- package/lib/esm/dsl/setup/fetch/DataProvider.js +0 -47
- package/lib/esm/dsl/setup/fetch/DataProvider.js.map +0 -1
- package/lib/esm/dsl/setup/fetch/index.js +0 -12
- package/lib/esm/dsl/setup/fetch/index.js.map +0 -1
- package/lib/esm/dsl/setup/fetch/providers.js +0 -61
- package/lib/esm/dsl/setup/fetch/providers.js.map +0 -1
- package/lib/esm/dsl/test/test-child-workflow.js +0 -5
- package/lib/esm/dsl/test/test-child-workflow.js.map +0 -1
- package/lib/esm/dsl/validation.js +0 -118
- package/lib/esm/dsl/validation.js.map +0 -1
- package/lib/esm/dsl/vars.js +0 -335
- package/lib/esm/dsl/vars.js.map +0 -1
- package/lib/esm/dsl/walk.js +0 -96
- package/lib/esm/dsl/walk.js.map +0 -1
- package/lib/esm/dsl.js +0 -4
- package/lib/esm/dsl.js.map +0 -1
- package/lib/esm/errors.js +0 -61
- package/lib/esm/errors.js.map +0 -1
- package/lib/esm/index.js +0 -37
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/iterative-generation/activities/extractToc.js +0 -44
- package/lib/esm/iterative-generation/activities/extractToc.js.map +0 -1
- package/lib/esm/iterative-generation/activities/finalizeOutput.js +0 -69
- package/lib/esm/iterative-generation/activities/finalizeOutput.js.map +0 -1
- package/lib/esm/iterative-generation/activities/generatePart.js +0 -75
- package/lib/esm/iterative-generation/activities/generatePart.js.map +0 -1
- package/lib/esm/iterative-generation/activities/generateToc.js +0 -83
- package/lib/esm/iterative-generation/activities/generateToc.js.map +0 -1
- package/lib/esm/iterative-generation/activities/index.js +0 -5
- package/lib/esm/iterative-generation/activities/index.js.map +0 -1
- package/lib/esm/iterative-generation/iterativeGenerationWorkflow.js +0 -53
- package/lib/esm/iterative-generation/iterativeGenerationWorkflow.js.map +0 -1
- package/lib/esm/iterative-generation/types.js +0 -2
- package/lib/esm/iterative-generation/types.js.map +0 -1
- package/lib/esm/iterative-generation/utils.js +0 -112
- package/lib/esm/iterative-generation/utils.js.map +0 -1
- package/lib/esm/result-types.js +0 -7
- package/lib/esm/result-types.js.map +0 -1
- package/lib/esm/system/notifyWebhookWorkflow.js +0 -50
- package/lib/esm/system/notifyWebhookWorkflow.js.map +0 -1
- package/lib/esm/system/recalculateEmbeddingsWorkflow.js +0 -30
- package/lib/esm/system/recalculateEmbeddingsWorkflow.js.map +0 -1
- package/lib/esm/utils/auth.js +0 -8
- package/lib/esm/utils/auth.js.map +0 -1
- package/lib/esm/utils/blobs.js +0 -54
- package/lib/esm/utils/blobs.js.map +0 -1
- package/lib/esm/utils/chunks.js +0 -9
- package/lib/esm/utils/chunks.js.map +0 -1
- package/lib/esm/utils/client.js +0 -27
- package/lib/esm/utils/client.js.map +0 -1
- package/lib/esm/utils/expand-vars.js +0 -30
- package/lib/esm/utils/expand-vars.js.map +0 -1
- package/lib/esm/utils/memory.js +0 -55
- package/lib/esm/utils/memory.js.map +0 -1
- package/lib/esm/utils/renditions.js +0 -80
- package/lib/esm/utils/renditions.js.map +0 -1
- package/lib/esm/utils/storage.js +0 -45
- package/lib/esm/utils/storage.js.map +0 -1
- package/lib/esm/utils/tokens.js +0 -34
- package/lib/esm/utils/tokens.js.map +0 -1
- package/lib/esm/vars.js +0 -4
- package/lib/esm/vars.js.map +0 -1
- package/lib/esm/workflows.js +0 -8
- package/lib/esm/workflows.js.map +0 -1
- package/lib/types/activities/advanced/createDocumentTypeFromInteractionRun.d.ts +0 -17
- package/lib/types/activities/advanced/createDocumentTypeFromInteractionRun.d.ts.map +0 -1
- package/lib/types/activities/advanced/createOrUpdateDocumentFromInteractionRun.d.ts +0 -39
- package/lib/types/activities/advanced/createOrUpdateDocumentFromInteractionRun.d.ts.map +0 -1
- package/lib/types/activities/advanced/updateDocumentFromInteractionRun.d.ts +0 -19
- package/lib/types/activities/advanced/updateDocumentFromInteractionRun.d.ts.map +0 -1
- package/lib/types/activities/chunkDocument.d.ts +0 -33
- package/lib/types/activities/chunkDocument.d.ts.map +0 -1
- package/lib/types/activities/createDocumentFromOther.d.ts +0 -21
- package/lib/types/activities/createDocumentFromOther.d.ts.map +0 -1
- package/lib/types/activities/executeInteraction.d.ts +0 -61
- package/lib/types/activities/executeInteraction.d.ts.map +0 -1
- package/lib/types/activities/extractDocumentText.d.ts +0 -10
- package/lib/types/activities/extractDocumentText.d.ts.map +0 -1
- package/lib/types/activities/generateDocumentProperties.d.ts +0 -32
- package/lib/types/activities/generateDocumentProperties.d.ts.map +0 -1
- package/lib/types/activities/generateEmbeddings.d.ts +0 -53
- package/lib/types/activities/generateEmbeddings.d.ts.map +0 -1
- package/lib/types/activities/generateOrAssignContentType.d.ts +0 -44
- package/lib/types/activities/generateOrAssignContentType.d.ts.map +0 -1
- package/lib/types/activities/getObjectFromStore.d.ts +0 -14
- package/lib/types/activities/getObjectFromStore.d.ts.map +0 -1
- package/lib/types/activities/handleError.d.ts +0 -6
- package/lib/types/activities/handleError.d.ts.map +0 -1
- package/lib/types/activities/index-dsl.d.ts +0 -23
- package/lib/types/activities/index-dsl.d.ts.map +0 -1
- package/lib/types/activities/index.d.ts +0 -5
- package/lib/types/activities/index.d.ts.map +0 -1
- package/lib/types/activities/media/prepareVideo.d.ts +0 -30
- package/lib/types/activities/media/prepareVideo.d.ts.map +0 -1
- package/lib/types/activities/media/processPdfWithTextract.d.ts +0 -26
- package/lib/types/activities/media/processPdfWithTextract.d.ts.map +0 -1
- package/lib/types/activities/media/saveGladiaTranscription.d.ts +0 -14
- package/lib/types/activities/media/saveGladiaTranscription.d.ts.map +0 -1
- package/lib/types/activities/media/transcribeMediaWithGladia.d.ts +0 -19
- package/lib/types/activities/media/transcribeMediaWithGladia.d.ts.map +0 -1
- package/lib/types/activities/notifyWebhook.d.ts +0 -27
- package/lib/types/activities/notifyWebhook.d.ts.map +0 -1
- package/lib/types/activities/rateLimiter.d.ts +0 -11
- package/lib/types/activities/rateLimiter.d.ts.map +0 -1
- package/lib/types/activities/renditions/generateImageRendition.d.ts +0 -14
- package/lib/types/activities/renditions/generateImageRendition.d.ts.map +0 -1
- package/lib/types/activities/renditions/generateVideoRendition.d.ts +0 -15
- package/lib/types/activities/renditions/generateVideoRendition.d.ts.map +0 -1
- package/lib/types/activities/setDocumentStatus.d.ts +0 -15
- package/lib/types/activities/setDocumentStatus.d.ts.map +0 -1
- package/lib/types/conversion/TextractProcessor.d.ts +0 -45
- package/lib/types/conversion/TextractProcessor.d.ts.map +0 -1
- package/lib/types/conversion/image.d.ts +0 -13
- package/lib/types/conversion/image.d.ts.map +0 -1
- package/lib/types/conversion/markitdown.d.ts +0 -2
- package/lib/types/conversion/markitdown.d.ts.map +0 -1
- package/lib/types/conversion/mutool.d.ts +0 -19
- package/lib/types/conversion/mutool.d.ts.map +0 -1
- package/lib/types/conversion/pandoc.d.ts +0 -2
- package/lib/types/conversion/pandoc.d.ts.map +0 -1
- package/lib/types/dsl/conditions.d.ts +0 -2
- package/lib/types/dsl/conditions.d.ts.map +0 -1
- package/lib/types/dsl/dsl-workflow.d.ts +0 -5
- package/lib/types/dsl/dsl-workflow.d.ts.map +0 -1
- package/lib/types/dsl/dslProxyActivities.d.ts +0 -10
- package/lib/types/dsl/dslProxyActivities.d.ts.map +0 -1
- package/lib/types/dsl/projections.d.ts +0 -4
- package/lib/types/dsl/projections.d.ts.map +0 -1
- package/lib/types/dsl/setup/ActivityContext.d.ts +0 -17
- package/lib/types/dsl/setup/ActivityContext.d.ts.map +0 -1
- package/lib/types/dsl/setup/fetch/DataProvider.d.ts +0 -9
- package/lib/types/dsl/setup/fetch/DataProvider.d.ts.map +0 -1
- package/lib/types/dsl/setup/fetch/index.d.ts +0 -6
- package/lib/types/dsl/setup/fetch/index.d.ts.map +0 -1
- package/lib/types/dsl/setup/fetch/providers.d.ts +0 -25
- package/lib/types/dsl/setup/fetch/providers.d.ts.map +0 -1
- package/lib/types/dsl/test/test-child-workflow.d.ts +0 -4
- package/lib/types/dsl/test/test-child-workflow.d.ts.map +0 -1
- package/lib/types/dsl/validation.d.ts +0 -4
- package/lib/types/dsl/validation.d.ts.map +0 -1
- package/lib/types/dsl/vars.d.ts +0 -48
- package/lib/types/dsl/vars.d.ts.map +0 -1
- package/lib/types/dsl/walk.d.ts +0 -18
- package/lib/types/dsl/walk.d.ts.map +0 -1
- package/lib/types/dsl.d.ts +0 -4
- package/lib/types/dsl.d.ts.map +0 -1
- package/lib/types/errors.d.ts +0 -33
- package/lib/types/errors.d.ts.map +0 -1
- package/lib/types/index.d.ts +0 -36
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/iterative-generation/activities/extractToc.d.ts +0 -10
- package/lib/types/iterative-generation/activities/extractToc.d.ts.map +0 -1
- package/lib/types/iterative-generation/activities/finalizeOutput.d.ts +0 -3
- package/lib/types/iterative-generation/activities/finalizeOutput.d.ts.map +0 -1
- package/lib/types/iterative-generation/activities/generatePart.d.ts +0 -3
- package/lib/types/iterative-generation/activities/generatePart.d.ts.map +0 -1
- package/lib/types/iterative-generation/activities/generateToc.d.ts +0 -4
- package/lib/types/iterative-generation/activities/generateToc.d.ts.map +0 -1
- package/lib/types/iterative-generation/activities/index.d.ts +0 -5
- package/lib/types/iterative-generation/activities/index.d.ts.map +0 -1
- package/lib/types/iterative-generation/iterativeGenerationWorkflow.d.ts +0 -3
- package/lib/types/iterative-generation/iterativeGenerationWorkflow.d.ts.map +0 -1
- package/lib/types/iterative-generation/types.d.ts +0 -79
- package/lib/types/iterative-generation/types.d.ts.map +0 -1
- package/lib/types/iterative-generation/utils.d.ts +0 -26
- package/lib/types/iterative-generation/utils.d.ts.map +0 -1
- package/lib/types/result-types.d.ts +0 -22
- package/lib/types/result-types.d.ts.map +0 -1
- package/lib/types/system/notifyWebhookWorkflow.d.ts +0 -8
- package/lib/types/system/notifyWebhookWorkflow.d.ts.map +0 -1
- package/lib/types/system/recalculateEmbeddingsWorkflow.d.ts +0 -25
- package/lib/types/system/recalculateEmbeddingsWorkflow.d.ts.map +0 -1
- package/lib/types/utils/auth.d.ts +0 -4
- package/lib/types/utils/auth.d.ts.map +0 -1
- package/lib/types/utils/blobs.d.ts +0 -7
- package/lib/types/utils/blobs.d.ts.map +0 -1
- package/lib/types/utils/chunks.d.ts +0 -9
- package/lib/types/utils/chunks.d.ts.map +0 -1
- package/lib/types/utils/client.d.ts +0 -8
- package/lib/types/utils/client.d.ts.map +0 -1
- package/lib/types/utils/expand-vars.d.ts +0 -8
- package/lib/types/utils/expand-vars.d.ts.map +0 -1
- package/lib/types/utils/memory.d.ts +0 -8
- package/lib/types/utils/memory.d.ts.map +0 -1
- package/lib/types/utils/renditions.d.ts +0 -23
- package/lib/types/utils/renditions.d.ts.map +0 -1
- package/lib/types/utils/storage.d.ts +0 -16
- package/lib/types/utils/storage.d.ts.map +0 -1
- package/lib/types/utils/tokens.d.ts +0 -11
- package/lib/types/utils/tokens.d.ts.map +0 -1
- package/lib/types/vars.d.ts +0 -3
- package/lib/types/vars.d.ts.map +0 -1
- package/lib/types/workflows.d.ts +0 -8
- package/lib/types/workflows.d.ts.map +0 -1
- package/lib/workflows-bundle.js +0 -16226
package/bin/bundle-workflows.mjs
CHANGED
|
@@ -7,6 +7,19 @@ import path from 'path';
|
|
|
7
7
|
async function bundle(wsPath, bundlePath) {
|
|
8
8
|
const { code } = await bundleWorkflowCode({
|
|
9
9
|
workflowsPath: path.resolve(wsPath),
|
|
10
|
+
webpackConfigHook: (config) => {
|
|
11
|
+
// Fix for Temporal's VM sandbox environment:
|
|
12
|
+
// 1. publicPath: '' - disable auto-detection (no document.currentScript)
|
|
13
|
+
// 2. chunkLoading: 'import' - use import() instead of JSONP (no 'self' global)
|
|
14
|
+
// 3. globalObject: 'globalThis' - use globalThis instead of self/window
|
|
15
|
+
config.output = {
|
|
16
|
+
...config.output,
|
|
17
|
+
publicPath: '',
|
|
18
|
+
chunkLoading: 'import',
|
|
19
|
+
globalObject: 'globalThis',
|
|
20
|
+
};
|
|
21
|
+
return config;
|
|
22
|
+
},
|
|
10
23
|
});
|
|
11
24
|
const codePath = path.resolve(bundlePath);
|
|
12
25
|
await writeFile(codePath, code);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertesia/workflow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-dev.20260203.130115Z",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vertesia workflow DSL",
|
|
6
6
|
"main": "./lib/esm/index.js",
|
|
@@ -17,38 +17,38 @@
|
|
|
17
17
|
"@temporalio/proto": "^1.11.5",
|
|
18
18
|
"@temporalio/testing": "^1.11.5",
|
|
19
19
|
"@temporalio/worker": "^1.11.5",
|
|
20
|
-
"@types/jsonwebtoken": "^9.0.
|
|
21
|
-
"@types/node": "^22.5
|
|
22
|
-
"@types/papaparse": "^5.
|
|
20
|
+
"@types/jsonwebtoken": "^9.0.10",
|
|
21
|
+
"@types/node": "^22.13.5",
|
|
22
|
+
"@types/papaparse": "^5.5.1",
|
|
23
23
|
"@types/tmp": "^0.2.6",
|
|
24
24
|
"ts-dual-module": "^0.6.3",
|
|
25
|
-
"vitest": "^
|
|
25
|
+
"vitest": "^4.0.16"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aws-sdk/client-s3": "^3.
|
|
29
|
-
"@aws-sdk/client-textract": "^3.
|
|
30
|
-
"@aws-sdk/credential-providers": "^3.
|
|
28
|
+
"@aws-sdk/client-s3": "^3.948.0",
|
|
29
|
+
"@aws-sdk/client-textract": "^3.948.0",
|
|
30
|
+
"@aws-sdk/credential-providers": "^3.948.0",
|
|
31
31
|
"@temporalio/activity": "^1.11.5",
|
|
32
32
|
"@temporalio/workflow": "^1.11.5",
|
|
33
33
|
"@types/json-schema": "^7.0.15",
|
|
34
34
|
"fast-deep-equal": "^3.1.3",
|
|
35
|
-
"jsonwebtoken": "^9.0.
|
|
35
|
+
"jsonwebtoken": "^9.0.3",
|
|
36
36
|
"mime": "^4.0.0",
|
|
37
37
|
"ms": "3.0.0-canary.1",
|
|
38
38
|
"node-web-stream-adapters": "^0.2.1",
|
|
39
39
|
"p-limit": "^6.2.0",
|
|
40
|
-
"papaparse": "^5.
|
|
40
|
+
"papaparse": "^5.5.3",
|
|
41
41
|
"seedrandom": "^3.0.5",
|
|
42
42
|
"sharp": "^0.33.4",
|
|
43
|
-
"tiktoken": "^1.0.
|
|
43
|
+
"tiktoken": "^1.0.22",
|
|
44
44
|
"tmp": "^0.2.4",
|
|
45
45
|
"tmp-promise": "^3.0.3",
|
|
46
46
|
"yaml": "^2.6.0",
|
|
47
|
-
"@
|
|
48
|
-
"@vertesia/
|
|
49
|
-
"@vertesia/client": "0.
|
|
50
|
-
"@
|
|
51
|
-
"@vertesia/
|
|
47
|
+
"@llumiverse/common": "1.0.0-dev.20260202.145450Z",
|
|
48
|
+
"@vertesia/api-fetch-client": "1.0.0-dev.20260203.130115Z",
|
|
49
|
+
"@vertesia/client": "1.0.0-dev.20260203.130115Z",
|
|
50
|
+
"@vertesia/common": "1.0.0-dev.20260203.130115Z",
|
|
51
|
+
"@vertesia/memory": "1.0.0-dev.20260203.130115Z"
|
|
52
52
|
},
|
|
53
53
|
"ts_dual_module": {
|
|
54
54
|
"outDir": "lib",
|
|
@@ -107,7 +107,7 @@ export async function createOrUpdateDocumentFromInteractionRun(payload: DSLActiv
|
|
|
107
107
|
let doc = undefined;
|
|
108
108
|
if (params.update_existing_id) {
|
|
109
109
|
log.info(`Updating existing document ${params.update_existing_id}`);
|
|
110
|
-
doc = await client.objects.update(params.update_existing_id, docPayload);
|
|
110
|
+
doc = await client.objects.update(params.update_existing_id, docPayload, { suppressWorkflows: true });
|
|
111
111
|
} else {
|
|
112
112
|
log.info(`Creating new document of type ${objectTypeName}`);
|
|
113
113
|
doc = await client.objects.create(docPayload);
|
|
@@ -29,7 +29,7 @@ export async function updateDocumentFromInteractionRun(payload: DSLActivityExecu
|
|
|
29
29
|
return { status: "failed", error: "no-props" };
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
await client.objects.update(objectId, docProps);
|
|
32
|
+
await client.objects.update(objectId, docProps, { suppressWorkflows: true });
|
|
33
33
|
|
|
34
34
|
return { status: "success" };
|
|
35
35
|
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { log, activityInfo } from "@temporalio/activity";
|
|
2
|
+
import { NodeStreamSource } from "@vertesia/client/node";
|
|
3
|
+
import { DSLActivityExecutionPayload, DSLActivitySpec } from "@vertesia/common";
|
|
4
|
+
import { Readable } from "stream";
|
|
5
|
+
import { setupActivity } from "../dsl/setup/ActivityContext.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Directories in the agent workspace to copy from parent to child.
|
|
9
|
+
*/
|
|
10
|
+
const WORKSPACE_DIRECTORIES = ['scripts', 'files', 'skills', 'docs', 'out'];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Files that should never be copied (child has its own).
|
|
14
|
+
*/
|
|
15
|
+
const EXCLUDED_FILES = ['conversation.json', 'tools.json'];
|
|
16
|
+
|
|
17
|
+
export interface CopyParentArtifactsParams {
|
|
18
|
+
parent_run_id: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface CopyParentArtifacts extends DSLActivitySpec<CopyParentArtifactsParams> {
|
|
22
|
+
name: 'copyParentArtifacts';
|
|
23
|
+
projection?: never;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Copy workspace artifacts from parent workflow's agent space to current workflow's agent space.
|
|
28
|
+
*
|
|
29
|
+
* Copies: scripts/, files/, skills/, docs/, out/
|
|
30
|
+
* Excludes: conversation.json, tools.json
|
|
31
|
+
*/
|
|
32
|
+
export async function copyParentArtifacts(
|
|
33
|
+
payload: DSLActivityExecutionPayload<CopyParentArtifactsParams>
|
|
34
|
+
): Promise<{ copied: number; files: string[] }> {
|
|
35
|
+
const { client, params } = await setupActivity<CopyParentArtifactsParams>(payload);
|
|
36
|
+
const childRunId = activityInfo().workflowExecution.runId;
|
|
37
|
+
const parentRunId = params.parent_run_id;
|
|
38
|
+
|
|
39
|
+
log.info(`Copying artifacts from parent ${parentRunId} to child ${childRunId}`);
|
|
40
|
+
|
|
41
|
+
// List all files in parent's agent space
|
|
42
|
+
const parentFiles = await client.files.listArtifacts(parentRunId);
|
|
43
|
+
|
|
44
|
+
if (parentFiles.length === 0) {
|
|
45
|
+
log.info("No artifacts in parent agent space");
|
|
46
|
+
return { copied: 0, files: [] };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const copiedFiles: string[] = [];
|
|
50
|
+
|
|
51
|
+
for (const fullPath of parentFiles) {
|
|
52
|
+
const relativePath = extractRelativePath(fullPath, parentRunId);
|
|
53
|
+
if (!relativePath) continue;
|
|
54
|
+
|
|
55
|
+
// Only copy workspace directories
|
|
56
|
+
const dir = relativePath.split('/')[0];
|
|
57
|
+
if (!WORKSPACE_DIRECTORIES.includes(dir)) continue;
|
|
58
|
+
|
|
59
|
+
// Skip excluded files
|
|
60
|
+
const fileName = relativePath.split('/').pop() || '';
|
|
61
|
+
if (EXCLUDED_FILES.includes(fileName)) continue;
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
await copyArtifact(client, parentRunId, childRunId, relativePath);
|
|
65
|
+
copiedFiles.push(relativePath);
|
|
66
|
+
} catch (err: any) {
|
|
67
|
+
log.warn(`Failed to copy ${relativePath}: ${err.message}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
log.info(`Copied ${copiedFiles.length} artifacts from parent`);
|
|
72
|
+
return { copied: copiedFiles.length, files: copiedFiles };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Extract relative path from full artifact storage path.
|
|
77
|
+
* Storage paths can be: "store_xxx/agents/{runId}/..." or "agents/{runId}/..."
|
|
78
|
+
*/
|
|
79
|
+
function extractRelativePath(fullPath: string, runId: string): string | null {
|
|
80
|
+
// Look for the pattern: agents/{runId}/
|
|
81
|
+
const marker = `/agents/${runId}/`;
|
|
82
|
+
const idx = fullPath.lastIndexOf(marker);
|
|
83
|
+
if (idx >= 0) {
|
|
84
|
+
return fullPath.slice(idx + marker.length);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Also try without leading slash
|
|
88
|
+
const legacyPrefix = `agents/${runId}/`;
|
|
89
|
+
if (fullPath.startsWith(legacyPrefix)) {
|
|
90
|
+
return fullPath.slice(legacyPrefix.length);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// If path contains the runId, try to extract after it
|
|
94
|
+
const runIdIdx = fullPath.indexOf(runId);
|
|
95
|
+
if (runIdIdx >= 0) {
|
|
96
|
+
const afterRunId = fullPath.slice(runIdIdx + runId.length);
|
|
97
|
+
if (afterRunId.startsWith('/')) {
|
|
98
|
+
return afterRunId.slice(1);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Copy a single artifact from parent to child agent space
|
|
107
|
+
*/
|
|
108
|
+
async function copyArtifact(
|
|
109
|
+
client: any,
|
|
110
|
+
parentRunId: string,
|
|
111
|
+
childRunId: string,
|
|
112
|
+
relativePath: string
|
|
113
|
+
): Promise<void> {
|
|
114
|
+
// Download from parent's agent space
|
|
115
|
+
const stream = await client.files.downloadArtifact(parentRunId, relativePath);
|
|
116
|
+
|
|
117
|
+
// Convert web stream to node stream for upload
|
|
118
|
+
const nodeStream = Readable.fromWeb(stream as any);
|
|
119
|
+
|
|
120
|
+
// Determine mime type from extension
|
|
121
|
+
const mimeType = getMimeType(relativePath);
|
|
122
|
+
const fileName = relativePath.split('/').pop() || relativePath;
|
|
123
|
+
|
|
124
|
+
// Upload to child's agent space at the same relative path
|
|
125
|
+
const source = new NodeStreamSource(
|
|
126
|
+
nodeStream,
|
|
127
|
+
fileName,
|
|
128
|
+
mimeType
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
await client.files.uploadArtifact(childRunId, relativePath, source);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Get mime type from file extension
|
|
136
|
+
*/
|
|
137
|
+
function getMimeType(filePath: string): string {
|
|
138
|
+
const ext = filePath.split('.').pop()?.toLowerCase();
|
|
139
|
+
const mimeTypes: Record<string, string> = {
|
|
140
|
+
'json': 'application/json',
|
|
141
|
+
'txt': 'text/plain',
|
|
142
|
+
'md': 'text/markdown',
|
|
143
|
+
'html': 'text/html',
|
|
144
|
+
'csv': 'text/csv',
|
|
145
|
+
'png': 'image/png',
|
|
146
|
+
'jpg': 'image/jpeg',
|
|
147
|
+
'jpeg': 'image/jpeg',
|
|
148
|
+
'gif': 'image/gif',
|
|
149
|
+
'svg': 'image/svg+xml',
|
|
150
|
+
'pdf': 'application/pdf',
|
|
151
|
+
'xml': 'application/xml',
|
|
152
|
+
'zip': 'application/zip',
|
|
153
|
+
'js': 'application/javascript',
|
|
154
|
+
'ts': 'application/typescript',
|
|
155
|
+
'py': 'text/x-python',
|
|
156
|
+
'sh': 'text/x-shellscript',
|
|
157
|
+
'bash': 'text/x-shellscript',
|
|
158
|
+
'yaml': 'text/yaml',
|
|
159
|
+
'yml': 'text/yaml',
|
|
160
|
+
};
|
|
161
|
+
return mimeTypes[ext || ''] || 'application/octet-stream';
|
|
162
|
+
}
|
|
@@ -67,7 +67,10 @@ export async function extractDocumentText(
|
|
|
67
67
|
|
|
68
68
|
let txt: string;
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
// Normalize mime type by stripping charset and other parameters (e.g., "text/html; charset=UTF-8" -> "text/html")
|
|
71
|
+
const mimeType = doc.content.type.split(';')[0].trim();
|
|
72
|
+
|
|
73
|
+
switch (mimeType) {
|
|
71
74
|
case "application/pdf":
|
|
72
75
|
txt = await mutoolPdfToText(fileBuffer);
|
|
73
76
|
break;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EmbeddingsResult } from "@llumiverse/common";
|
|
2
2
|
import { log } from "@temporalio/activity";
|
|
3
|
-
import { VertesiaClient } from "@vertesia/client";
|
|
3
|
+
import { VertesiaClient, ZenoClientNotFoundError } from "@vertesia/client";
|
|
4
4
|
import {
|
|
5
5
|
ContentObject,
|
|
6
6
|
DSLActivityExecutionPayload,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "@vertesia/common";
|
|
12
12
|
import { setupActivity } from "../dsl/setup/ActivityContext.js";
|
|
13
13
|
import { DocumentNotFoundError } from "../errors.js";
|
|
14
|
-
import { fetchBlobAsBase64 } from "../utils/blobs.js";
|
|
14
|
+
import { fetchBlobAsBase64, md5 } from "../utils/blobs.js";
|
|
15
15
|
import { DocPart } from "../utils/chunks.js";
|
|
16
16
|
import { countTokens } from "../utils/tokens.js";
|
|
17
17
|
|
|
@@ -94,10 +94,18 @@ export async function generateEmbeddings(
|
|
|
94
94
|
);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
let document;
|
|
98
|
+
try {
|
|
99
|
+
document = await client.objects.retrieve(
|
|
100
|
+
objectId,
|
|
101
|
+
"+text +parts +embeddings +tokens +properties",
|
|
102
|
+
);
|
|
103
|
+
} catch (error) {
|
|
104
|
+
if (error instanceof ZenoClientNotFoundError) {
|
|
105
|
+
throw new DocumentNotFoundError(`Document not found: ${objectId}`, [objectId]);
|
|
106
|
+
}
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
101
109
|
|
|
102
110
|
if (!document) {
|
|
103
111
|
throw new DocumentNotFoundError("Document not found", [objectId]);
|
|
@@ -116,6 +124,7 @@ export async function generateEmbeddings(
|
|
|
116
124
|
config,
|
|
117
125
|
document,
|
|
118
126
|
type,
|
|
127
|
+
force,
|
|
119
128
|
});
|
|
120
129
|
break;
|
|
121
130
|
case SupportedEmbeddingTypes.properties:
|
|
@@ -124,6 +133,7 @@ export async function generateEmbeddings(
|
|
|
124
133
|
config,
|
|
125
134
|
document,
|
|
126
135
|
type,
|
|
136
|
+
force,
|
|
127
137
|
});
|
|
128
138
|
break;
|
|
129
139
|
case SupportedEmbeddingTypes.image:
|
|
@@ -132,6 +142,7 @@ export async function generateEmbeddings(
|
|
|
132
142
|
config,
|
|
133
143
|
document,
|
|
134
144
|
type,
|
|
145
|
+
force,
|
|
135
146
|
});
|
|
136
147
|
break;
|
|
137
148
|
default:
|
|
@@ -155,7 +166,7 @@ interface ExecuteGenerateEmbeddingsParams {
|
|
|
155
166
|
}
|
|
156
167
|
|
|
157
168
|
async function generateTextEmbeddings(
|
|
158
|
-
{ document, client, type, config }: ExecuteGenerateEmbeddingsParams
|
|
169
|
+
{ document, client, type, config, force }: ExecuteGenerateEmbeddingsParams
|
|
159
170
|
) {
|
|
160
171
|
|
|
161
172
|
if (!document) {
|
|
@@ -186,6 +197,21 @@ async function generateTextEmbeddings(
|
|
|
186
197
|
|
|
187
198
|
const { environment } = config;
|
|
188
199
|
|
|
200
|
+
// Compute text etag for comparison
|
|
201
|
+
const textEtag = document.text_etag ?? (document.text ? md5(document.text) : undefined);
|
|
202
|
+
|
|
203
|
+
// Skip if embeddings already exist with matching etag (unless force=true)
|
|
204
|
+
const existingEmbedding = document.embeddings?.[type];
|
|
205
|
+
if (!force && existingEmbedding?.etag && textEtag && existingEmbedding.etag === textEtag) {
|
|
206
|
+
log.info(`Skipping ${type} embeddings for document ${document.id} - etag unchanged`);
|
|
207
|
+
return {
|
|
208
|
+
id: document.id,
|
|
209
|
+
type,
|
|
210
|
+
status: "skipped",
|
|
211
|
+
message: "embeddings already exist with matching etag",
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
|
|
189
215
|
// Count tokens if needed, do not rely on existing token count
|
|
190
216
|
let tokenCount : number | undefined = undefined;
|
|
191
217
|
if (type === SupportedEmbeddingTypes.text && document.text) {
|
|
@@ -232,7 +258,7 @@ async function generateTextEmbeddings(
|
|
|
232
258
|
await client.objects.setEmbedding(document.id, type, {
|
|
233
259
|
values: res.values,
|
|
234
260
|
model: res.model,
|
|
235
|
-
etag:
|
|
261
|
+
etag: textEtag,
|
|
236
262
|
});
|
|
237
263
|
|
|
238
264
|
return {
|
|
@@ -249,6 +275,7 @@ async function generateImageEmbeddings({
|
|
|
249
275
|
client,
|
|
250
276
|
type,
|
|
251
277
|
config,
|
|
278
|
+
force,
|
|
252
279
|
}: ExecuteGenerateEmbeddingsParams) {
|
|
253
280
|
log.info("Generating image embeddings for document " + document.id, {
|
|
254
281
|
content: document.content,
|
|
@@ -264,6 +291,22 @@ async function generateImageEmbeddings({
|
|
|
264
291
|
message: "content is not an image",
|
|
265
292
|
};
|
|
266
293
|
}
|
|
294
|
+
|
|
295
|
+
// Use content etag for image change detection
|
|
296
|
+
const contentEtag = document.content?.etag;
|
|
297
|
+
|
|
298
|
+
// Skip if embeddings already exist with matching etag (unless force=true)
|
|
299
|
+
const existingEmbedding = document.embeddings?.[type];
|
|
300
|
+
if (!force && existingEmbedding?.etag && contentEtag && existingEmbedding.etag === contentEtag) {
|
|
301
|
+
log.info(`Skipping ${type} embeddings for document ${document.id} - content etag unchanged`);
|
|
302
|
+
return {
|
|
303
|
+
id: document.id,
|
|
304
|
+
type,
|
|
305
|
+
status: "skipped",
|
|
306
|
+
message: "embeddings already exist with matching etag",
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
|
|
267
310
|
const { environment, model } = config;
|
|
268
311
|
|
|
269
312
|
const resRnd = await client.store.objects.getRendition(document.id, {
|
|
@@ -317,7 +360,7 @@ async function generateImageEmbeddings({
|
|
|
317
360
|
{
|
|
318
361
|
values: res.values,
|
|
319
362
|
model: res.model,
|
|
320
|
-
etag:
|
|
363
|
+
etag: contentEtag,
|
|
321
364
|
},
|
|
322
365
|
);
|
|
323
366
|
|
|
@@ -12,13 +12,15 @@ export { generateOrAssignContentType } from "./generateOrAssignContentType.js";
|
|
|
12
12
|
export { getObjectFromStore } from "./getObjectFromStore.js";
|
|
13
13
|
export { handleDslError } from "./handleError.js";
|
|
14
14
|
export { prepareVideo } from "./media/prepareVideo.js";
|
|
15
|
+
export { prepareAudio } from "./media/prepareAudio.js";
|
|
15
16
|
export { convertPdfToStructuredText } from "./media/processPdfWithTextract.js";
|
|
16
17
|
export { saveGladiaTranscription } from "./media/saveGladiaTranscription.js";
|
|
17
18
|
export { transcribeMedia } from "./media/transcribeMediaWithGladia.js";
|
|
18
19
|
export type { TranscriptMediaResult } from "./media/transcribeMediaWithGladia.js";
|
|
19
20
|
export { notifyWebhook } from "./notifyWebhook.js";
|
|
20
21
|
export { checkRateLimit } from "./rateLimiter.js";
|
|
22
|
+
export { copyParentArtifacts } from "./copyParentArtifacts.js";
|
|
23
|
+
export { mergeChildArtifacts } from "./mergeChildArtifacts.js";
|
|
21
24
|
export { generateImageRendition } from "./renditions/generateImageRendition.js";
|
|
22
25
|
export { generateVideoRendition } from "./renditions/generateVideoRendition.js";
|
|
23
26
|
export { setDocumentStatus } from "./setDocumentStatus.js";
|
|
24
|
-
|