@vertesia/workflow 0.78.0-dev-28b447d → 0.79.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/activities/advanced/createDocumentTypeFromInteractionRun.js +34 -0
- package/lib/cjs/activities/advanced/createDocumentTypeFromInteractionRun.js.map +1 -0
- package/lib/cjs/activities/advanced/createOrUpdateDocumentFromInteractionRun.js +67 -0
- package/lib/cjs/activities/advanced/createOrUpdateDocumentFromInteractionRun.js.map +1 -0
- package/lib/cjs/activities/advanced/updateDocumentFromInteractionRun.js +20 -0
- package/lib/cjs/activities/advanced/updateDocumentFromInteractionRun.js.map +1 -0
- package/lib/cjs/activities/chunkDocument.js +86 -0
- package/lib/cjs/activities/chunkDocument.js.map +1 -0
- package/lib/cjs/activities/createDocumentFromOther.js +64 -0
- package/lib/cjs/activities/createDocumentFromOther.js.map +1 -0
- package/lib/cjs/activities/executeInteraction.js +189 -0
- package/lib/cjs/activities/executeInteraction.js.map +1 -0
- package/lib/cjs/activities/extractDocumentText.js +156 -0
- package/lib/cjs/activities/extractDocumentText.js.map +1 -0
- package/lib/cjs/activities/generateDocumentProperties.js +84 -0
- package/lib/cjs/activities/generateDocumentProperties.js.map +1 -0
- package/lib/cjs/activities/generateEmbeddings.js +358 -0
- package/lib/cjs/activities/generateEmbeddings.js.map +1 -0
- package/lib/cjs/activities/generateOrAssignContentType.js +126 -0
- package/lib/cjs/activities/generateOrAssignContentType.js.map +1 -0
- package/lib/cjs/activities/getObjectFromStore.js +20 -0
- package/lib/cjs/activities/getObjectFromStore.js.map +1 -0
- package/lib/cjs/activities/handleError.js +22 -0
- package/lib/cjs/activities/handleError.js.map +1 -0
- package/lib/cjs/activities/index-dsl.js +43 -0
- package/lib/cjs/activities/index-dsl.js.map +1 -0
- package/lib/cjs/activities/index.js +21 -0
- package/lib/cjs/activities/index.js.map +1 -0
- package/lib/cjs/activities/media/processPdfWithTextract.js +103 -0
- package/lib/cjs/activities/media/processPdfWithTextract.js.map +1 -0
- package/lib/cjs/activities/media/transcribeMediaWithGladia.js +51 -0
- package/lib/cjs/activities/media/transcribeMediaWithGladia.js.map +1 -0
- package/lib/cjs/activities/notifyWebhook.js +157 -0
- package/lib/cjs/activities/notifyWebhook.js.map +1 -0
- package/lib/cjs/activities/rateLimiter.js +30 -0
- package/lib/cjs/activities/rateLimiter.js.map +1 -0
- package/lib/cjs/activities/renditions/generateImageRendition.js +66 -0
- package/lib/cjs/activities/renditions/generateImageRendition.js.map +1 -0
- package/lib/cjs/activities/renditions/generateVideoRendition.js +200 -0
- package/lib/cjs/activities/renditions/generateVideoRendition.js.map +1 -0
- package/lib/cjs/activities/setDocumentStatus.js +15 -0
- package/lib/cjs/activities/setDocumentStatus.js.map +1 -0
- package/lib/cjs/conversion/TextractProcessor.js +417 -0
- package/lib/cjs/conversion/TextractProcessor.js.map +1 -0
- package/lib/cjs/conversion/image.js +149 -0
- package/lib/cjs/conversion/image.js.map +1 -0
- package/lib/cjs/conversion/markitdown.js +42 -0
- package/lib/cjs/conversion/markitdown.js.map +1 -0
- package/lib/cjs/conversion/mutool.js +147 -0
- package/lib/cjs/conversion/mutool.js.map +1 -0
- package/lib/cjs/conversion/pandoc.js +39 -0
- package/lib/cjs/conversion/pandoc.js.map +1 -0
- package/lib/cjs/dsl/conditions.js +81 -0
- package/lib/cjs/dsl/conditions.js.map +1 -0
- package/lib/cjs/dsl/dsl-workflow.js +338 -0
- package/lib/cjs/dsl/dsl-workflow.js.map +1 -0
- package/lib/cjs/dsl/dslProxyActivities.js +23 -0
- package/lib/cjs/dsl/dslProxyActivities.js.map +1 -0
- package/lib/cjs/dsl/projections.js +59 -0
- package/lib/cjs/dsl/projections.js.map +1 -0
- package/lib/cjs/dsl/setup/ActivityContext.js +120 -0
- package/lib/cjs/dsl/setup/ActivityContext.js.map +1 -0
- package/lib/cjs/dsl/setup/fetch/DataProvider.js +51 -0
- package/lib/cjs/dsl/setup/fetch/DataProvider.js.map +1 -0
- package/lib/cjs/dsl/setup/fetch/index.js +16 -0
- package/lib/cjs/dsl/setup/fetch/index.js.map +1 -0
- package/lib/cjs/dsl/setup/fetch/providers.js +67 -0
- package/lib/cjs/dsl/setup/fetch/providers.js.map +1 -0
- package/lib/cjs/dsl/test/test-child-workflow.js +10 -0
- package/lib/cjs/dsl/test/test-child-workflow.js.map +1 -0
- package/lib/cjs/dsl/validation.js +122 -0
- package/lib/cjs/dsl/validation.js.map +1 -0
- package/lib/cjs/dsl/vars.js +341 -0
- package/lib/cjs/dsl/vars.js.map +1 -0
- package/lib/cjs/dsl/walk.js +100 -0
- package/lib/cjs/dsl/walk.js.map +1 -0
- package/lib/cjs/dsl.js +20 -0
- package/lib/cjs/dsl.js.map +1 -0
- package/lib/cjs/errors.js +57 -0
- package/lib/cjs/errors.js.map +1 -0
- package/lib/cjs/index.js +54 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/iterative-generation/activities/extractToc.js +47 -0
- package/lib/cjs/iterative-generation/activities/extractToc.js.map +1 -0
- package/lib/cjs/iterative-generation/activities/finalizeOutput.js +69 -0
- package/lib/cjs/iterative-generation/activities/finalizeOutput.js.map +1 -0
- package/lib/cjs/iterative-generation/activities/generatePart.js +74 -0
- package/lib/cjs/iterative-generation/activities/generatePart.js.map +1 -0
- package/lib/cjs/iterative-generation/activities/generateToc.js +96 -0
- package/lib/cjs/iterative-generation/activities/generateToc.js.map +1 -0
- package/lib/cjs/iterative-generation/activities/index.js +12 -0
- package/lib/cjs/iterative-generation/activities/index.js.map +1 -0
- package/lib/cjs/iterative-generation/iterativeGenerationWorkflow.js +56 -0
- package/lib/cjs/iterative-generation/iterativeGenerationWorkflow.js.map +1 -0
- package/lib/cjs/iterative-generation/types.js +5 -0
- package/lib/cjs/iterative-generation/types.js.map +1 -0
- package/lib/cjs/iterative-generation/utils.js +121 -0
- package/lib/cjs/iterative-generation/utils.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/result-types.js +10 -0
- package/lib/cjs/result-types.js.map +1 -0
- package/lib/cjs/system/notifyWebhookWorkflow.js +53 -0
- package/lib/cjs/system/notifyWebhookWorkflow.js.map +1 -0
- package/lib/cjs/system/recalculateEmbeddingsWorkflow.js +33 -0
- package/lib/cjs/system/recalculateEmbeddingsWorkflow.js.map +1 -0
- package/lib/cjs/utils/auth.js +15 -0
- package/lib/cjs/utils/auth.js.map +1 -0
- package/lib/cjs/utils/blobs.js +61 -0
- package/lib/cjs/utils/blobs.js.map +1 -0
- package/lib/cjs/utils/chunks.js +14 -0
- package/lib/cjs/utils/chunks.js.map +1 -0
- package/lib/cjs/utils/client.js +29 -0
- package/lib/cjs/utils/client.js.map +1 -0
- package/lib/cjs/utils/expand-vars.js +33 -0
- package/lib/cjs/utils/expand-vars.js.map +1 -0
- package/lib/cjs/utils/memory.js +65 -0
- package/lib/cjs/utils/memory.js.map +1 -0
- package/lib/cjs/utils/renditions.js +88 -0
- package/lib/cjs/utils/renditions.js.map +1 -0
- package/lib/cjs/utils/storage.js +55 -0
- package/lib/cjs/utils/storage.js.map +1 -0
- package/lib/cjs/utils/tokens.js +38 -0
- package/lib/cjs/utils/tokens.js.map +1 -0
- package/lib/cjs/vars.js +20 -0
- package/lib/cjs/vars.js.map +1 -0
- package/lib/cjs/workflows.js +15 -0
- package/lib/cjs/workflows.js.map +1 -0
- package/lib/esm/activities/advanced/createDocumentTypeFromInteractionRun.js +31 -0
- package/lib/esm/activities/advanced/createDocumentTypeFromInteractionRun.js.map +1 -0
- package/lib/esm/activities/advanced/createOrUpdateDocumentFromInteractionRun.js +64 -0
- package/lib/esm/activities/advanced/createOrUpdateDocumentFromInteractionRun.js.map +1 -0
- package/lib/esm/activities/advanced/updateDocumentFromInteractionRun.js +17 -0
- package/lib/esm/activities/advanced/updateDocumentFromInteractionRun.js.map +1 -0
- package/lib/esm/activities/chunkDocument.js +83 -0
- package/lib/esm/activities/chunkDocument.js.map +1 -0
- package/lib/esm/activities/createDocumentFromOther.js +58 -0
- package/lib/esm/activities/createDocumentFromOther.js.map +1 -0
- package/lib/esm/activities/executeInteraction.js +185 -0
- package/lib/esm/activities/executeInteraction.js.map +1 -0
- package/lib/esm/activities/extractDocumentText.js +153 -0
- package/lib/esm/activities/extractDocumentText.js.map +1 -0
- package/lib/esm/activities/generateDocumentProperties.js +81 -0
- package/lib/esm/activities/generateDocumentProperties.js.map +1 -0
- package/lib/esm/activities/generateEmbeddings.js +355 -0
- package/lib/esm/activities/generateEmbeddings.js.map +1 -0
- package/lib/esm/activities/generateOrAssignContentType.js +123 -0
- package/lib/esm/activities/generateOrAssignContentType.js.map +1 -0
- package/lib/esm/activities/getObjectFromStore.js +17 -0
- package/lib/esm/activities/getObjectFromStore.js.map +1 -0
- package/lib/esm/activities/handleError.js +19 -0
- package/lib/esm/activities/handleError.js.map +1 -0
- package/lib/esm/activities/index-dsl.js +21 -0
- package/lib/esm/activities/index-dsl.js.map +1 -0
- package/lib/esm/activities/index.js +5 -0
- package/lib/esm/activities/index.js.map +1 -0
- package/lib/esm/activities/media/processPdfWithTextract.js +99 -0
- package/lib/esm/activities/media/processPdfWithTextract.js.map +1 -0
- package/lib/esm/activities/media/transcribeMediaWithGladia.js +48 -0
- package/lib/esm/activities/media/transcribeMediaWithGladia.js.map +1 -0
- package/lib/esm/activities/notifyWebhook.js +154 -0
- package/lib/esm/activities/notifyWebhook.js.map +1 -0
- package/lib/esm/activities/rateLimiter.js +27 -0
- package/lib/esm/activities/rateLimiter.js.map +1 -0
- package/lib/esm/activities/renditions/generateImageRendition.js +63 -0
- package/lib/esm/activities/renditions/generateImageRendition.js.map +1 -0
- package/lib/esm/activities/renditions/generateVideoRendition.js +194 -0
- package/lib/esm/activities/renditions/generateVideoRendition.js.map +1 -0
- package/lib/esm/activities/setDocumentStatus.js +12 -0
- package/lib/esm/activities/setDocumentStatus.js.map +1 -0
- package/lib/esm/conversion/TextractProcessor.js +410 -0
- package/lib/esm/conversion/TextractProcessor.js.map +1 -0
- package/lib/esm/conversion/image.js +143 -0
- package/lib/esm/conversion/image.js.map +1 -0
- package/lib/esm/conversion/markitdown.js +36 -0
- package/lib/esm/conversion/markitdown.js.map +1 -0
- package/lib/esm/conversion/mutool.js +139 -0
- package/lib/esm/conversion/mutool.js.map +1 -0
- package/lib/esm/conversion/pandoc.js +36 -0
- package/lib/esm/conversion/pandoc.js.map +1 -0
- package/lib/esm/dsl/conditions.js +75 -0
- package/lib/esm/dsl/conditions.js.map +1 -0
- package/lib/esm/dsl/dsl-workflow.js +331 -0
- package/lib/esm/dsl/dsl-workflow.js.map +1 -0
- package/lib/esm/dsl/dslProxyActivities.js +20 -0
- package/lib/esm/dsl/dslProxyActivities.js.map +1 -0
- package/lib/esm/dsl/projections.js +55 -0
- package/lib/esm/dsl/projections.js.map +1 -0
- package/lib/esm/dsl/setup/ActivityContext.js +115 -0
- package/lib/esm/dsl/setup/ActivityContext.js.map +1 -0
- package/lib/esm/dsl/setup/fetch/DataProvider.js +47 -0
- package/lib/esm/dsl/setup/fetch/DataProvider.js.map +1 -0
- package/lib/esm/dsl/setup/fetch/index.js +12 -0
- package/lib/esm/dsl/setup/fetch/index.js.map +1 -0
- package/lib/esm/dsl/setup/fetch/providers.js +61 -0
- package/lib/esm/dsl/setup/fetch/providers.js.map +1 -0
- package/lib/esm/dsl/test/test-child-workflow.js +5 -0
- package/lib/esm/dsl/test/test-child-workflow.js.map +1 -0
- package/lib/esm/dsl/validation.js +118 -0
- package/lib/esm/dsl/validation.js.map +1 -0
- package/lib/esm/dsl/vars.js +335 -0
- package/lib/esm/dsl/vars.js.map +1 -0
- package/lib/esm/dsl/walk.js +96 -0
- package/lib/esm/dsl/walk.js.map +1 -0
- package/lib/esm/dsl.js +4 -0
- package/lib/esm/dsl.js.map +1 -0
- package/lib/esm/errors.js +49 -0
- package/lib/esm/errors.js.map +1 -0
- package/lib/esm/index.js +36 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/iterative-generation/activities/extractToc.js +44 -0
- package/lib/esm/iterative-generation/activities/extractToc.js.map +1 -0
- package/lib/esm/iterative-generation/activities/finalizeOutput.js +66 -0
- package/lib/esm/iterative-generation/activities/finalizeOutput.js.map +1 -0
- package/lib/esm/iterative-generation/activities/generatePart.js +71 -0
- package/lib/esm/iterative-generation/activities/generatePart.js.map +1 -0
- package/lib/esm/iterative-generation/activities/generateToc.js +93 -0
- package/lib/esm/iterative-generation/activities/generateToc.js.map +1 -0
- package/lib/esm/iterative-generation/activities/index.js +5 -0
- package/lib/esm/iterative-generation/activities/index.js.map +1 -0
- package/lib/esm/iterative-generation/iterativeGenerationWorkflow.js +53 -0
- package/lib/esm/iterative-generation/iterativeGenerationWorkflow.js.map +1 -0
- package/lib/esm/iterative-generation/types.js +2 -0
- package/lib/esm/iterative-generation/types.js.map +1 -0
- package/lib/esm/iterative-generation/utils.js +112 -0
- package/lib/esm/iterative-generation/utils.js.map +1 -0
- package/lib/esm/result-types.js +7 -0
- package/lib/esm/result-types.js.map +1 -0
- package/lib/esm/system/notifyWebhookWorkflow.js +50 -0
- package/lib/esm/system/notifyWebhookWorkflow.js.map +1 -0
- package/lib/esm/system/recalculateEmbeddingsWorkflow.js +30 -0
- package/lib/esm/system/recalculateEmbeddingsWorkflow.js.map +1 -0
- package/lib/esm/utils/auth.js +8 -0
- package/lib/esm/utils/auth.js.map +1 -0
- package/lib/esm/utils/blobs.js +51 -0
- package/lib/esm/utils/blobs.js.map +1 -0
- package/lib/esm/utils/chunks.js +9 -0
- package/lib/esm/utils/chunks.js.map +1 -0
- package/lib/esm/utils/client.js +25 -0
- package/lib/esm/utils/client.js.map +1 -0
- package/lib/esm/utils/expand-vars.js +30 -0
- package/lib/esm/utils/expand-vars.js.map +1 -0
- package/lib/esm/utils/memory.js +55 -0
- package/lib/esm/utils/memory.js.map +1 -0
- package/lib/esm/utils/renditions.js +80 -0
- package/lib/esm/utils/renditions.js.map +1 -0
- package/lib/esm/utils/storage.js +46 -0
- package/lib/esm/utils/storage.js.map +1 -0
- package/lib/esm/utils/tokens.js +34 -0
- package/lib/esm/utils/tokens.js.map +1 -0
- package/lib/esm/vars.js +4 -0
- package/lib/esm/vars.js.map +1 -0
- package/lib/esm/workflows.js +8 -0
- package/lib/esm/workflows.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/activities/advanced/createDocumentTypeFromInteractionRun.d.ts +17 -0
- package/lib/types/activities/advanced/createDocumentTypeFromInteractionRun.d.ts.map +1 -0
- package/lib/types/activities/advanced/createOrUpdateDocumentFromInteractionRun.d.ts +39 -0
- package/lib/types/activities/advanced/createOrUpdateDocumentFromInteractionRun.d.ts.map +1 -0
- package/lib/types/activities/advanced/updateDocumentFromInteractionRun.d.ts +19 -0
- package/lib/types/activities/advanced/updateDocumentFromInteractionRun.d.ts.map +1 -0
- package/lib/types/activities/chunkDocument.d.ts +33 -0
- package/lib/types/activities/chunkDocument.d.ts.map +1 -0
- package/lib/types/activities/createDocumentFromOther.d.ts +21 -0
- package/lib/types/activities/createDocumentFromOther.d.ts.map +1 -0
- package/lib/types/activities/executeInteraction.d.ts +61 -0
- package/lib/types/activities/executeInteraction.d.ts.map +1 -0
- package/lib/types/activities/extractDocumentText.d.ts +10 -0
- package/lib/types/activities/extractDocumentText.d.ts.map +1 -0
- package/lib/types/activities/generateDocumentProperties.d.ts +32 -0
- package/lib/types/activities/generateDocumentProperties.d.ts.map +1 -0
- package/lib/types/activities/generateEmbeddings.d.ts +53 -0
- package/lib/types/activities/generateEmbeddings.d.ts.map +1 -0
- package/lib/types/activities/generateOrAssignContentType.d.ts +44 -0
- package/lib/types/activities/generateOrAssignContentType.d.ts.map +1 -0
- package/lib/types/activities/getObjectFromStore.d.ts +14 -0
- package/lib/types/activities/getObjectFromStore.d.ts.map +1 -0
- package/lib/types/activities/handleError.d.ts +6 -0
- package/lib/types/activities/handleError.d.ts.map +1 -0
- package/lib/types/activities/index-dsl.d.ts +20 -0
- package/lib/types/activities/index-dsl.d.ts.map +1 -0
- package/lib/types/activities/index.d.ts +5 -0
- package/lib/types/activities/index.d.ts.map +1 -0
- package/lib/types/activities/media/processPdfWithTextract.d.ts +26 -0
- package/lib/types/activities/media/processPdfWithTextract.d.ts.map +1 -0
- package/lib/types/activities/media/transcribeMediaWithGladia.d.ts +14 -0
- package/lib/types/activities/media/transcribeMediaWithGladia.d.ts.map +1 -0
- package/lib/types/activities/notifyWebhook.d.ts +27 -0
- package/lib/types/activities/notifyWebhook.d.ts.map +1 -0
- package/lib/types/activities/rateLimiter.d.ts +11 -0
- package/lib/types/activities/rateLimiter.d.ts.map +1 -0
- package/lib/types/activities/renditions/generateImageRendition.d.ts +14 -0
- package/lib/types/activities/renditions/generateImageRendition.d.ts.map +1 -0
- package/lib/types/activities/renditions/generateVideoRendition.d.ts +15 -0
- package/lib/types/activities/renditions/generateVideoRendition.d.ts.map +1 -0
- package/lib/types/activities/setDocumentStatus.d.ts +15 -0
- package/lib/types/activities/setDocumentStatus.d.ts.map +1 -0
- package/lib/types/conversion/TextractProcessor.d.ts +45 -0
- package/lib/types/conversion/TextractProcessor.d.ts.map +1 -0
- package/lib/types/conversion/image.d.ts +13 -0
- package/lib/types/conversion/image.d.ts.map +1 -0
- package/lib/types/conversion/markitdown.d.ts +2 -0
- package/lib/types/conversion/markitdown.d.ts.map +1 -0
- package/lib/types/conversion/mutool.d.ts +19 -0
- package/lib/types/conversion/mutool.d.ts.map +1 -0
- package/lib/types/conversion/pandoc.d.ts +2 -0
- package/lib/types/conversion/pandoc.d.ts.map +1 -0
- package/lib/types/dsl/conditions.d.ts +2 -0
- package/lib/types/dsl/conditions.d.ts.map +1 -0
- package/lib/types/dsl/dsl-workflow.d.ts +5 -0
- package/lib/types/dsl/dsl-workflow.d.ts.map +1 -0
- package/lib/types/dsl/dslProxyActivities.d.ts +10 -0
- package/lib/types/dsl/dslProxyActivities.d.ts.map +1 -0
- package/lib/types/dsl/projections.d.ts +4 -0
- package/lib/types/dsl/projections.d.ts.map +1 -0
- package/lib/types/dsl/setup/ActivityContext.d.ts +17 -0
- package/lib/types/dsl/setup/ActivityContext.d.ts.map +1 -0
- package/lib/types/dsl/setup/fetch/DataProvider.d.ts +9 -0
- package/lib/types/dsl/setup/fetch/DataProvider.d.ts.map +1 -0
- package/lib/types/dsl/setup/fetch/index.d.ts +6 -0
- package/lib/types/dsl/setup/fetch/index.d.ts.map +1 -0
- package/lib/types/dsl/setup/fetch/providers.d.ts +25 -0
- package/lib/types/dsl/setup/fetch/providers.d.ts.map +1 -0
- package/lib/types/dsl/test/test-child-workflow.d.ts +4 -0
- package/lib/types/dsl/test/test-child-workflow.d.ts.map +1 -0
- package/lib/types/dsl/validation.d.ts +4 -0
- package/lib/types/dsl/validation.d.ts.map +1 -0
- package/lib/types/dsl/vars.d.ts +48 -0
- package/lib/types/dsl/vars.d.ts.map +1 -0
- package/lib/types/dsl/walk.d.ts +18 -0
- package/lib/types/dsl/walk.d.ts.map +1 -0
- package/lib/types/dsl.d.ts +4 -0
- package/lib/types/dsl.d.ts.map +1 -0
- package/lib/types/errors.d.ts +27 -0
- package/lib/types/errors.d.ts.map +1 -0
- package/lib/types/index.d.ts +35 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/iterative-generation/activities/extractToc.d.ts +10 -0
- package/lib/types/iterative-generation/activities/extractToc.d.ts.map +1 -0
- package/lib/types/iterative-generation/activities/finalizeOutput.d.ts +3 -0
- package/lib/types/iterative-generation/activities/finalizeOutput.d.ts.map +1 -0
- package/lib/types/iterative-generation/activities/generatePart.d.ts +3 -0
- package/lib/types/iterative-generation/activities/generatePart.d.ts.map +1 -0
- package/lib/types/iterative-generation/activities/generateToc.d.ts +4 -0
- package/lib/types/iterative-generation/activities/generateToc.d.ts.map +1 -0
- package/lib/types/iterative-generation/activities/index.d.ts +5 -0
- package/lib/types/iterative-generation/activities/index.d.ts.map +1 -0
- package/lib/types/iterative-generation/iterativeGenerationWorkflow.d.ts +3 -0
- package/lib/types/iterative-generation/iterativeGenerationWorkflow.d.ts.map +1 -0
- package/lib/types/iterative-generation/types.d.ts +79 -0
- package/lib/types/iterative-generation/types.d.ts.map +1 -0
- package/lib/types/iterative-generation/utils.d.ts +27 -0
- package/lib/types/iterative-generation/utils.d.ts.map +1 -0
- package/lib/types/result-types.d.ts +22 -0
- package/lib/types/result-types.d.ts.map +1 -0
- package/lib/types/system/notifyWebhookWorkflow.d.ts +8 -0
- package/lib/types/system/notifyWebhookWorkflow.d.ts.map +1 -0
- package/lib/types/system/recalculateEmbeddingsWorkflow.d.ts +25 -0
- package/lib/types/system/recalculateEmbeddingsWorkflow.d.ts.map +1 -0
- package/lib/types/utils/auth.d.ts +4 -0
- package/lib/types/utils/auth.d.ts.map +1 -0
- package/lib/types/utils/blobs.d.ts +7 -0
- package/lib/types/utils/blobs.d.ts.map +1 -0
- package/lib/types/utils/chunks.d.ts +9 -0
- package/lib/types/utils/chunks.d.ts.map +1 -0
- package/lib/types/utils/client.d.ts +12 -0
- package/lib/types/utils/client.d.ts.map +1 -0
- package/lib/types/utils/expand-vars.d.ts +8 -0
- package/lib/types/utils/expand-vars.d.ts.map +1 -0
- package/lib/types/utils/memory.d.ts +8 -0
- package/lib/types/utils/memory.d.ts.map +1 -0
- package/lib/types/utils/renditions.d.ts +23 -0
- package/lib/types/utils/renditions.d.ts.map +1 -0
- package/lib/types/utils/storage.d.ts +16 -0
- package/lib/types/utils/storage.d.ts.map +1 -0
- package/lib/types/utils/tokens.d.ts +11 -0
- package/lib/types/utils/tokens.d.ts.map +1 -0
- package/lib/types/vars.d.ts +3 -0
- package/lib/types/vars.d.ts.map +1 -0
- package/lib/types/workflows.d.ts +8 -0
- package/lib/types/workflows.d.ts.map +1 -0
- package/lib/workflows-bundle.js +13145 -0
- package/package.json +127 -127
- package/src/activities/notifyWebhook.test.ts +18 -14
- package/src/activities/notifyWebhook.ts +149 -14
- package/src/dsl/setup/ActivityContext.ts +12 -45
- package/src/dsl/workflow-exec-child.test.ts +3 -3
- package/src/dsl/workflow-fetch.test.ts +1 -1
- package/src/dsl/workflow-import.test.ts +1 -1
- package/src/dsl/workflow.test.ts +1 -1
- package/src/iterative-generation/activities/extractToc.ts +12 -26
- package/src/iterative-generation/activities/finalizeOutput.ts +29 -52
- package/src/iterative-generation/activities/generatePart.ts +23 -64
- package/src/iterative-generation/activities/generateToc.ts +65 -78
- package/src/system/notifyWebhookWorkflow.ts +15 -6
- package/src/utils/blobs.ts +1 -3
- package/src/utils/client.ts +8 -22
|
@@ -6,32 +6,16 @@ import {
|
|
|
6
6
|
Project,
|
|
7
7
|
WorkflowExecutionPayload,
|
|
8
8
|
} from "@vertesia/common";
|
|
9
|
-
import {
|
|
10
|
-
DocumentNotFoundError,
|
|
11
|
-
WorkflowParamNotFoundError,
|
|
12
|
-
} from "../../errors.js";
|
|
9
|
+
import { DocumentNotFoundError, WorkflowParamNotFoundError } from "../../errors.js";
|
|
13
10
|
import { getProjectFromToken } from "../../utils/auth.js";
|
|
14
11
|
import { getVertesiaClient } from "../../utils/client.js";
|
|
15
12
|
import { Vars } from "../vars.js";
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
registerFetchProviderFactory,
|
|
19
|
-
} from "./fetch/index.js";
|
|
20
|
-
import {
|
|
21
|
-
DocumentProvider,
|
|
22
|
-
DocumentTypeProvider,
|
|
23
|
-
InteractionRunProvider,
|
|
24
|
-
} from "./fetch/providers.js";
|
|
13
|
+
import { getFetchProvider, registerFetchProviderFactory } from "./fetch/index.js";
|
|
14
|
+
import { DocumentProvider, DocumentTypeProvider, InteractionRunProvider } from "./fetch/providers.js";
|
|
25
15
|
|
|
26
16
|
registerFetchProviderFactory(DocumentProvider.ID, DocumentProvider.factory);
|
|
27
|
-
registerFetchProviderFactory(
|
|
28
|
-
|
|
29
|
-
DocumentTypeProvider.factory,
|
|
30
|
-
);
|
|
31
|
-
registerFetchProviderFactory(
|
|
32
|
-
InteractionRunProvider.ID,
|
|
33
|
-
InteractionRunProvider.factory,
|
|
34
|
-
);
|
|
17
|
+
registerFetchProviderFactory(DocumentTypeProvider.ID, DocumentTypeProvider.factory);
|
|
18
|
+
registerFetchProviderFactory(InteractionRunProvider.ID, InteractionRunProvider.factory);
|
|
35
19
|
|
|
36
20
|
export class ActivityContext<ParamsT extends Record<string, any>> {
|
|
37
21
|
client: VertesiaClient;
|
|
@@ -56,10 +40,7 @@ export class ActivityContext<ParamsT extends Record<string, any>> {
|
|
|
56
40
|
log.error("No objectId found in payload");
|
|
57
41
|
throw new WorkflowParamNotFoundError(
|
|
58
42
|
"objectIds[0]",
|
|
59
|
-
(
|
|
60
|
-
this
|
|
61
|
-
.payload as WorkflowExecutionPayload as DSLWorkflowExecutionPayload
|
|
62
|
-
).workflow,
|
|
43
|
+
(this.payload as WorkflowExecutionPayload as DSLWorkflowExecutionPayload).workflow,
|
|
63
44
|
);
|
|
64
45
|
}
|
|
65
46
|
return objectId;
|
|
@@ -75,10 +56,7 @@ export class ActivityContext<ParamsT extends Record<string, any>> {
|
|
|
75
56
|
log.error("No runId found in activityInfo");
|
|
76
57
|
throw new WorkflowParamNotFoundError(
|
|
77
58
|
"runId",
|
|
78
|
-
(
|
|
79
|
-
this
|
|
80
|
-
.payload as WorkflowExecutionPayload as DSLWorkflowExecutionPayload
|
|
81
|
-
).workflow,
|
|
59
|
+
(this.payload as WorkflowExecutionPayload as DSLWorkflowExecutionPayload).workflow,
|
|
82
60
|
);
|
|
83
61
|
}
|
|
84
62
|
return runId;
|
|
@@ -90,10 +68,7 @@ export class ActivityContext<ParamsT extends Record<string, any>> {
|
|
|
90
68
|
log.error("No workflowId found in activityInfo");
|
|
91
69
|
throw new WorkflowParamNotFoundError(
|
|
92
70
|
"workflowId",
|
|
93
|
-
(
|
|
94
|
-
this
|
|
95
|
-
.payload as WorkflowExecutionPayload as DSLWorkflowExecutionPayload
|
|
96
|
-
).workflow,
|
|
71
|
+
(this.payload as WorkflowExecutionPayload as DSLWorkflowExecutionPayload).workflow,
|
|
97
72
|
);
|
|
98
73
|
}
|
|
99
74
|
return workflowId;
|
|
@@ -127,7 +102,7 @@ export async function setupActivity<ParamsT extends Record<string, any>>(
|
|
|
127
102
|
});
|
|
128
103
|
}
|
|
129
104
|
|
|
130
|
-
const client =
|
|
105
|
+
const client = getVertesiaClient(payload);
|
|
131
106
|
const fetchSpecs = payload.activity.fetch;
|
|
132
107
|
if (fetchSpecs) {
|
|
133
108
|
const keys = Object.keys(fetchSpecs);
|
|
@@ -143,10 +118,7 @@ export async function setupActivity<ParamsT extends Record<string, any>>(
|
|
|
143
118
|
|
|
144
119
|
const provider = getFetchProvider(client, fetchSpec);
|
|
145
120
|
|
|
146
|
-
log.info(
|
|
147
|
-
`Fetching data for ${key} with provider ${provider.name}`,
|
|
148
|
-
{ fetchSpec },
|
|
149
|
-
);
|
|
121
|
+
log.info(`Fetching data for ${key} with provider ${provider.name}`, { fetchSpec });
|
|
150
122
|
const result = await provider.fetch(fetchSpec);
|
|
151
123
|
if (result && result.length > 0) {
|
|
152
124
|
if (fetchSpec.limit === 1) {
|
|
@@ -155,9 +127,7 @@ export async function setupActivity<ParamsT extends Record<string, any>>(
|
|
|
155
127
|
vars.setValue(key, result);
|
|
156
128
|
}
|
|
157
129
|
} else if (fetchSpec.on_not_found === "throw") {
|
|
158
|
-
throw new DocumentNotFoundError(
|
|
159
|
-
"No documents found for: " + JSON.stringify(fetchSpec),
|
|
160
|
-
);
|
|
130
|
+
throw new DocumentNotFoundError("No documents found for: " + JSON.stringify(fetchSpec));
|
|
161
131
|
} else {
|
|
162
132
|
vars.setValue(key, null);
|
|
163
133
|
}
|
|
@@ -171,10 +141,7 @@ export async function setupActivity<ParamsT extends Record<string, any>>(
|
|
|
171
141
|
return new ActivityContext<ParamsT>(payload, client, params);
|
|
172
142
|
}
|
|
173
143
|
|
|
174
|
-
async function _fetchProject(
|
|
175
|
-
client: VertesiaClient,
|
|
176
|
-
payload: WorkflowExecutionPayload,
|
|
177
|
-
) {
|
|
144
|
+
async function _fetchProject(client: VertesiaClient, payload: WorkflowExecutionPayload) {
|
|
178
145
|
const project = await getProjectFromToken(payload.auth_token);
|
|
179
146
|
return project ? await client.projects.retrieve(project.id) : undefined;
|
|
180
147
|
}
|
|
@@ -159,7 +159,7 @@ describe('DSL Workflow with child workflows', () => {
|
|
|
159
159
|
account_id: '123',
|
|
160
160
|
project_id: '123',
|
|
161
161
|
wf_rule_name: 'test',
|
|
162
|
-
auth_token:
|
|
162
|
+
auth_token: 'test',
|
|
163
163
|
config: {
|
|
164
164
|
studio_url: process.env.CP_STUDIO_URL || "http://localhost:8081",
|
|
165
165
|
store_url: process.env.CP_STORE_URL || "http://localhost:8082",
|
|
@@ -203,7 +203,7 @@ describe('DSL Workflow with child workflows', () => {
|
|
|
203
203
|
account_id: '123',
|
|
204
204
|
project_id: '123',
|
|
205
205
|
wf_rule_name: 'test',
|
|
206
|
-
auth_token:
|
|
206
|
+
auth_token: 'test',
|
|
207
207
|
config: {
|
|
208
208
|
studio_url: process.env.CP_STUDIO_URL || "http://localhost:8081",
|
|
209
209
|
store_url: process.env.CP_STORE_URL || "http://localhost:8082",
|
|
@@ -247,7 +247,7 @@ describe('DSL Workflow with child workflows', () => {
|
|
|
247
247
|
account_id: '123',
|
|
248
248
|
project_id: '123',
|
|
249
249
|
wf_rule_name: 'test',
|
|
250
|
-
auth_token:
|
|
250
|
+
auth_token: 'test',
|
|
251
251
|
config: {
|
|
252
252
|
studio_url: process.env.CP_STUDIO_URL || "http://localhost:8081",
|
|
253
253
|
store_url: process.env.CP_STORE_URL || "http://localhost:8082",
|
|
@@ -107,7 +107,7 @@ describe('DSL Workflow', () => {
|
|
|
107
107
|
project_id: '123',
|
|
108
108
|
timestamp: Date.now(),
|
|
109
109
|
wf_rule_name: 'test',
|
|
110
|
-
auth_token:
|
|
110
|
+
auth_token: 'test',
|
|
111
111
|
config: {
|
|
112
112
|
studio_url: process.env.CP_STUDIO_URL || "http://localhost:8081",
|
|
113
113
|
store_url: process.env.CP_STORE_URL || "http://localhost:8082",
|
|
@@ -61,7 +61,7 @@ describe('DSL Workflow import vars', () => {
|
|
|
61
61
|
project_id: '123',
|
|
62
62
|
timestamp: Date.now(),
|
|
63
63
|
wf_rule_name: 'test',
|
|
64
|
-
auth_token:
|
|
64
|
+
auth_token: 'test',
|
|
65
65
|
config: {
|
|
66
66
|
studio_url: process.env.CP_STUDIO_URL || "http://localhost:8081",
|
|
67
67
|
store_url: process.env.CP_STORE_URL || "http://localhost:8082",
|
package/src/dsl/workflow.test.ts
CHANGED
|
@@ -91,7 +91,7 @@ describe('DSL Workflow', () => {
|
|
|
91
91
|
project_id: '123',
|
|
92
92
|
timestamp: Date.now(),
|
|
93
93
|
wf_rule_name: 'test',
|
|
94
|
-
auth_token:
|
|
94
|
+
auth_token: 'test',
|
|
95
95
|
config: {
|
|
96
96
|
studio_url: process.env.CP_STUDIO_URL || "http://localhost:8081",
|
|
97
97
|
store_url: process.env.CP_STORE_URL || "http://localhost:8082",
|
|
@@ -2,16 +2,8 @@ import { log } from "@temporalio/activity";
|
|
|
2
2
|
import { WorkflowExecutionPayload } from "@vertesia/common";
|
|
3
3
|
import { parse as parseYaml } from "yaml";
|
|
4
4
|
import { getVertesiaClient } from "../../utils/client.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
loadMemoryPack,
|
|
8
|
-
} from "../../utils/memory.js";
|
|
9
|
-
import {
|
|
10
|
-
IterativeGenerationPayload,
|
|
11
|
-
OutputMemoryMeta,
|
|
12
|
-
Toc,
|
|
13
|
-
TocIndex,
|
|
14
|
-
} from "../types.js";
|
|
5
|
+
import { buildAndPublishMemoryPack, loadMemoryPack } from "../../utils/memory.js";
|
|
6
|
+
import { IterativeGenerationPayload, OutputMemoryMeta, Toc, TocIndex } from "../types.js";
|
|
15
7
|
import { tocIndex } from "../utils.js";
|
|
16
8
|
|
|
17
9
|
/**
|
|
@@ -20,12 +12,10 @@ import { tocIndex } from "../utils.js";
|
|
|
20
12
|
*
|
|
21
13
|
* @param payload
|
|
22
14
|
*/
|
|
23
|
-
export async function it_gen_extractToc(
|
|
24
|
-
payload: WorkflowExecutionPayload,
|
|
25
|
-
): Promise<TocIndex | null> {
|
|
15
|
+
export async function it_gen_extractToc(payload: WorkflowExecutionPayload): Promise<TocIndex | null> {
|
|
26
16
|
const vars = payload.vars as IterativeGenerationPayload;
|
|
27
17
|
const memory = vars.memory;
|
|
28
|
-
const client =
|
|
18
|
+
const client = getVertesiaClient(payload);
|
|
29
19
|
|
|
30
20
|
const inMemory = await loadMemoryPack(client, `${memory}/input`);
|
|
31
21
|
let tocJson: string | null = null;
|
|
@@ -47,17 +37,13 @@ export async function it_gen_extractToc(
|
|
|
47
37
|
|
|
48
38
|
log.info(`Found a TOC in the input memory pack`);
|
|
49
39
|
|
|
50
|
-
await buildAndPublishMemoryPack(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
previouslyGenerated: "",
|
|
58
|
-
} as OutputMemoryMeta;
|
|
59
|
-
},
|
|
60
|
-
);
|
|
40
|
+
await buildAndPublishMemoryPack(client, `${vars.memory}/output`, async () => {
|
|
41
|
+
return {
|
|
42
|
+
toc,
|
|
43
|
+
lastProcessedPart: undefined, // the part index (a number array)
|
|
44
|
+
previouslyGenerated: ""
|
|
45
|
+
} as OutputMemoryMeta
|
|
46
|
+
});
|
|
61
47
|
|
|
62
48
|
return tocIndex(toc);
|
|
63
|
-
}
|
|
49
|
+
}
|
|
@@ -2,24 +2,14 @@ import { log } from "@temporalio/activity";
|
|
|
2
2
|
import { WorkflowExecutionPayload } from "@vertesia/common";
|
|
3
3
|
import { getVertesiaClient } from "../../utils/client.js";
|
|
4
4
|
import { expandVars } from "../../utils/expand-vars.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
loadMemoryPack,
|
|
8
|
-
} from "../../utils/memory.js";
|
|
9
|
-
import {
|
|
10
|
-
IterativeGenerationPayload,
|
|
11
|
-
Section,
|
|
12
|
-
SECTION_ID_PLACEHOLDER,
|
|
13
|
-
TocSection,
|
|
14
|
-
} from "../types.js";
|
|
5
|
+
import { buildAndPublishMemoryPack, loadMemoryPack } from "../../utils/memory.js";
|
|
6
|
+
import { IterativeGenerationPayload, Section, SECTION_ID_PLACEHOLDER, TocSection } from "../types.js";
|
|
15
7
|
|
|
16
|
-
export async function it_gen_finalizeOutput(
|
|
17
|
-
payload: WorkflowExecutionPayload,
|
|
18
|
-
): Promise<string> {
|
|
8
|
+
export async function it_gen_finalizeOutput(payload: WorkflowExecutionPayload): Promise<string> {
|
|
19
9
|
const vars = payload.vars as IterativeGenerationPayload;
|
|
20
10
|
|
|
21
11
|
const memory = vars.memory;
|
|
22
|
-
const client =
|
|
12
|
+
const client = getVertesiaClient(payload);
|
|
23
13
|
const inMemory = await loadMemoryPack(client, `${memory}/input`);
|
|
24
14
|
const outMemory = await loadMemoryPack(client, `${memory}/output`);
|
|
25
15
|
|
|
@@ -45,56 +35,43 @@ export async function it_gen_finalizeOutput(
|
|
|
45
35
|
}
|
|
46
36
|
const sections = JSON.parse(content) as Section[];
|
|
47
37
|
|
|
48
|
-
await buildAndPublishMemoryPack(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
// save sections to files
|
|
63
|
-
for (const section of sections) {
|
|
64
|
-
let content = section.content;
|
|
65
|
-
if (vars.section_file_header) {
|
|
66
|
-
content =
|
|
67
|
-
getSectionFileHeader(
|
|
68
|
-
section,
|
|
69
|
-
vars.section_file_header,
|
|
70
|
-
) +
|
|
71
|
-
"\n\n" +
|
|
72
|
-
content;
|
|
73
|
-
}
|
|
74
|
-
copyText(
|
|
75
|
-
content,
|
|
76
|
-
getSectionFileName(section, vars.section_file_pattern),
|
|
77
|
-
);
|
|
38
|
+
await buildAndPublishMemoryPack(client, `${memory}/output`, async ({ copyText }) => {
|
|
39
|
+
// copy the input toc file if any
|
|
40
|
+
if (toc) {
|
|
41
|
+
copyText(toc, tocName);
|
|
42
|
+
}
|
|
43
|
+
// copy the raw JSON content
|
|
44
|
+
copyText(content, "content.json");
|
|
45
|
+
if (vars.section_file_pattern) {
|
|
46
|
+
log.info(`Saving sections to files using pattern: ${vars.section_file_pattern}`);
|
|
47
|
+
// save sections to files
|
|
48
|
+
for (const section of sections) {
|
|
49
|
+
let content = section.content;
|
|
50
|
+
if (vars.section_file_header) {
|
|
51
|
+
content = getSectionFileHeader(section, vars.section_file_header) + '\n\n' + content;
|
|
78
52
|
}
|
|
53
|
+
copyText(content, getSectionFileName(section, vars.section_file_pattern));
|
|
79
54
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
);
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
...inMeta,
|
|
58
|
+
vars
|
|
59
|
+
};
|
|
60
|
+
});
|
|
86
61
|
|
|
87
62
|
return `Processing done. Extracted files to: ${vars.section_file_pattern}`;
|
|
88
63
|
}
|
|
89
64
|
|
|
65
|
+
|
|
66
|
+
|
|
90
67
|
function getSectionFileHeader(section: TocSection, header: string): string {
|
|
91
68
|
const date = new Date().toISOString();
|
|
92
69
|
return expandVars(header, {
|
|
93
70
|
section,
|
|
94
|
-
date
|
|
71
|
+
date
|
|
95
72
|
});
|
|
96
73
|
}
|
|
97
74
|
|
|
98
75
|
function getSectionFileName(section: TocSection, pattern: string): string {
|
|
99
76
|
return pattern.replace(SECTION_ID_PLACEHOLDER, section.id);
|
|
100
|
-
}
|
|
77
|
+
}
|
|
@@ -2,50 +2,30 @@ import { ApplicationFailure } from "@temporalio/workflow";
|
|
|
2
2
|
import { WorkflowExecutionPayload } from "@vertesia/common";
|
|
3
3
|
import { MemoryPack } from "@vertesia/memory";
|
|
4
4
|
import { getVertesiaClient } from "../../utils/client.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
loadMemoryPack,
|
|
8
|
-
} from "../../utils/memory.js";
|
|
9
|
-
import {
|
|
10
|
-
IterativeGenerationPayload,
|
|
11
|
-
OutputMemoryMeta,
|
|
12
|
-
Section,
|
|
13
|
-
TocPart,
|
|
14
|
-
TocSection,
|
|
15
|
-
} from "../types.js";
|
|
5
|
+
import { buildAndPublishMemoryPack, loadMemoryPack } from "../../utils/memory.js";
|
|
6
|
+
import { IterativeGenerationPayload, OutputMemoryMeta, Section, TocPart, TocSection } from "../types.js";
|
|
16
7
|
import { executeWithVars, expectMemoryIsConsistent } from "../utils.js";
|
|
17
8
|
import { completionResultToString } from "@llumiverse/common";
|
|
18
9
|
|
|
19
|
-
export async function it_gen_generatePart(
|
|
20
|
-
payload: WorkflowExecutionPayload,
|
|
21
|
-
path: number[],
|
|
22
|
-
) {
|
|
10
|
+
export async function it_gen_generatePart(payload: WorkflowExecutionPayload, path: number[]) {
|
|
23
11
|
const vars = payload.vars as IterativeGenerationPayload;
|
|
24
|
-
const client =
|
|
12
|
+
const client = getVertesiaClient(payload);
|
|
25
13
|
const memory = vars.memory;
|
|
26
14
|
|
|
27
15
|
const [sectionIndex, partIndex] = path;
|
|
28
16
|
const outMemory = await loadMemoryPack(client, `${memory}/output`);
|
|
29
|
-
const meta =
|
|
17
|
+
const meta = await outMemory.getMetadata() as OutputMemoryMeta;
|
|
30
18
|
|
|
31
19
|
// the section we build is the section at the given index
|
|
32
20
|
const section: TocSection = meta.toc.sections[sectionIndex];
|
|
33
21
|
if (!section) {
|
|
34
|
-
throw ApplicationFailure.nonRetryable(
|
|
35
|
-
"Section not found in the TOC",
|
|
36
|
-
"SectionNotFound",
|
|
37
|
-
{ memory, path },
|
|
38
|
-
);
|
|
22
|
+
throw ApplicationFailure.nonRetryable('Section not found in the TOC', 'SectionNotFound', { memory, path });
|
|
39
23
|
}
|
|
40
24
|
let part: TocPart | undefined;
|
|
41
25
|
if (partIndex !== undefined) {
|
|
42
26
|
part = section.parts?.[partIndex];
|
|
43
27
|
if (!part) {
|
|
44
|
-
throw ApplicationFailure.nonRetryable(
|
|
45
|
-
"Part not found in the TOC section",
|
|
46
|
-
"PartNotFound",
|
|
47
|
-
{ memory, path },
|
|
48
|
-
);
|
|
28
|
+
throw ApplicationFailure.nonRetryable('Part not found in the TOC section', 'PartNotFound', { memory, path });
|
|
49
29
|
}
|
|
50
30
|
}
|
|
51
31
|
|
|
@@ -53,26 +33,17 @@ export async function it_gen_generatePart(
|
|
|
53
33
|
|
|
54
34
|
const content = await loadGeneratedContent(outMemory);
|
|
55
35
|
|
|
56
|
-
let previously_generated = getPreviouslyGeneratedContent(
|
|
57
|
-
content,
|
|
58
|
-
!part,
|
|
59
|
-
vars.remembrance_strategy,
|
|
60
|
-
);
|
|
36
|
+
let previously_generated = getPreviouslyGeneratedContent(content, !part, vars.remembrance_strategy);
|
|
61
37
|
|
|
62
|
-
if (!part) {
|
|
63
|
-
// a new section
|
|
38
|
+
if (!part) { // a new section
|
|
64
39
|
content.push({
|
|
65
40
|
id: section.id,
|
|
66
41
|
name: section.name,
|
|
67
42
|
description: section.description,
|
|
68
|
-
content:
|
|
69
|
-
})
|
|
43
|
+
content: ''
|
|
44
|
+
})
|
|
70
45
|
} else if (!content.length) {
|
|
71
|
-
throw ApplicationFailure.nonRetryable(
|
|
72
|
-
"content.json is empty while generating a part",
|
|
73
|
-
"InvalidIterationState",
|
|
74
|
-
{ memory, path },
|
|
75
|
-
);
|
|
46
|
+
throw ApplicationFailure.nonRetryable('content.json is empty while generating a part', 'InvalidIterationState', { memory, path });
|
|
76
47
|
}
|
|
77
48
|
|
|
78
49
|
const interaction = vars.iterative_interaction || vars.interaction;
|
|
@@ -83,42 +54,30 @@ export async function it_gen_generatePart(
|
|
|
83
54
|
section: section.name,
|
|
84
55
|
part: part?.name,
|
|
85
56
|
path: path,
|
|
86
|
-
}
|
|
57
|
+
}
|
|
87
58
|
});
|
|
88
59
|
|
|
89
60
|
const result = r.result.map(completionResultToString).join('\n');
|
|
90
61
|
content[content.length - 1].content += result;
|
|
91
62
|
meta.lastProcessedPart = path;
|
|
92
|
-
await buildAndPublishMemoryPack(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
copyText(JSON.stringify(content, null, 2), "content.json");
|
|
97
|
-
return meta;
|
|
98
|
-
},
|
|
99
|
-
);
|
|
63
|
+
await buildAndPublishMemoryPack(client, `${memory}/output`, async ({ copyText }) => {
|
|
64
|
+
copyText(JSON.stringify(content, null, 2), "content.json");
|
|
65
|
+
return meta;
|
|
66
|
+
});
|
|
100
67
|
}
|
|
101
68
|
|
|
102
69
|
async function loadGeneratedContent(memory: MemoryPack): Promise<Section[]> {
|
|
103
|
-
const content = await memory.getEntryText(
|
|
70
|
+
const content = await memory.getEntryText('content.json');
|
|
104
71
|
return content ? JSON.parse(content) : [];
|
|
105
72
|
}
|
|
106
73
|
|
|
107
|
-
function getPreviouslyGeneratedContent(
|
|
108
|
-
sections: Section[],
|
|
109
|
-
isNewSection: boolean,
|
|
110
|
-
strategy?: "document" | "section" | "none",
|
|
111
|
-
): string {
|
|
74
|
+
function getPreviouslyGeneratedContent(sections: Section[], isNewSection: boolean, strategy?: "document" | "section" | "none"): string {
|
|
112
75
|
switch (strategy) {
|
|
113
76
|
case "document":
|
|
114
|
-
return sections
|
|
115
|
-
.map((section: Section) => section.content || "")
|
|
116
|
-
.join("\n\n");
|
|
77
|
+
return sections.map((section: Section) => section.content || '').join('\n\n');
|
|
117
78
|
case "none":
|
|
118
|
-
return
|
|
79
|
+
return '';
|
|
119
80
|
default:
|
|
120
|
-
return isNewSection
|
|
121
|
-
? ""
|
|
122
|
-
: sections[sections.length - 1]?.content || "";
|
|
81
|
+
return isNewSection ? '' : sections[sections.length - 1]?.content || '';
|
|
123
82
|
}
|
|
124
|
-
}
|
|
83
|
+
}
|