@vertesia/workflow 0.78.0 → 0.79.1
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 +8 -7
- package/lib/cjs/activities/advanced/createDocumentTypeFromInteractionRun.js.map +1 -1
- package/lib/cjs/activities/advanced/createOrUpdateDocumentFromInteractionRun.js +10 -9
- package/lib/cjs/activities/advanced/createOrUpdateDocumentFromInteractionRun.js.map +1 -1
- package/lib/cjs/activities/advanced/updateDocumentFromInteractionRun.js +2 -1
- package/lib/cjs/activities/advanced/updateDocumentFromInteractionRun.js.map +1 -1
- package/lib/cjs/activities/chunkDocument.js +2 -1
- package/lib/cjs/activities/chunkDocument.js.map +1 -1
- package/lib/cjs/activities/executeInteraction.js +11 -7
- package/lib/cjs/activities/executeInteraction.js.map +1 -1
- package/lib/cjs/activities/generateDocumentProperties.js +11 -6
- package/lib/cjs/activities/generateDocumentProperties.js.map +1 -1
- package/lib/cjs/activities/generateOrAssignContentType.js +12 -10
- package/lib/cjs/activities/generateOrAssignContentType.js.map +1 -1
- package/lib/cjs/activities/index-dsl.js +5 -3
- package/lib/cjs/activities/index-dsl.js.map +1 -1
- package/lib/cjs/activities/media/prepareVideo.js +429 -0
- package/lib/cjs/activities/media/prepareVideo.js.map +1 -0
- package/lib/cjs/activities/media/transcribeMediaWithGladia.js +48 -15
- package/lib/cjs/activities/media/transcribeMediaWithGladia.js.map +1 -1
- package/lib/cjs/activities/notifyWebhook.js +137 -12
- package/lib/cjs/activities/notifyWebhook.js.map +1 -1
- package/lib/cjs/activities/rateLimiter.js +30 -0
- package/lib/cjs/activities/rateLimiter.js.map +1 -0
- package/lib/cjs/conversion/image.js +4 -2
- package/lib/cjs/conversion/image.js.map +1 -1
- package/lib/cjs/dsl/dsl-workflow.js +66 -0
- package/lib/cjs/dsl/dsl-workflow.js.map +1 -1
- package/lib/cjs/dsl/setup/ActivityContext.js +7 -4
- package/lib/cjs/dsl/setup/ActivityContext.js.map +1 -1
- package/lib/cjs/errors.js +22 -1
- package/lib/cjs/errors.js.map +1 -1
- package/lib/cjs/index.js +2 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/iterative-generation/activities/extractToc.js +2 -2
- package/lib/cjs/iterative-generation/activities/extractToc.js.map +1 -1
- package/lib/cjs/iterative-generation/activities/finalizeOutput.js +7 -4
- package/lib/cjs/iterative-generation/activities/finalizeOutput.js.map +1 -1
- package/lib/cjs/iterative-generation/activities/generatePart.js +18 -13
- package/lib/cjs/iterative-generation/activities/generatePart.js.map +1 -1
- package/lib/cjs/iterative-generation/activities/generateToc.js +50 -55
- package/lib/cjs/iterative-generation/activities/generateToc.js.map +1 -1
- package/lib/cjs/iterative-generation/utils.js.map +1 -1
- package/lib/cjs/system/notifyWebhookWorkflow.js +10 -3
- package/lib/cjs/system/notifyWebhookWorkflow.js.map +1 -1
- package/lib/cjs/utils/blobs.js +4 -1
- package/lib/cjs/utils/blobs.js.map +1 -1
- package/lib/cjs/utils/client.js +3 -1
- package/lib/cjs/utils/client.js.map +1 -1
- package/lib/esm/activities/advanced/createDocumentTypeFromInteractionRun.js +8 -7
- package/lib/esm/activities/advanced/createDocumentTypeFromInteractionRun.js.map +1 -1
- package/lib/esm/activities/advanced/createOrUpdateDocumentFromInteractionRun.js +10 -9
- package/lib/esm/activities/advanced/createOrUpdateDocumentFromInteractionRun.js.map +1 -1
- package/lib/esm/activities/advanced/updateDocumentFromInteractionRun.js +2 -1
- package/lib/esm/activities/advanced/updateDocumentFromInteractionRun.js.map +1 -1
- package/lib/esm/activities/chunkDocument.js +2 -1
- package/lib/esm/activities/chunkDocument.js.map +1 -1
- package/lib/esm/activities/executeInteraction.js +12 -8
- package/lib/esm/activities/executeInteraction.js.map +1 -1
- package/lib/esm/activities/generateDocumentProperties.js +11 -6
- package/lib/esm/activities/generateDocumentProperties.js.map +1 -1
- package/lib/esm/activities/generateOrAssignContentType.js +12 -10
- package/lib/esm/activities/generateOrAssignContentType.js.map +1 -1
- package/lib/esm/activities/index-dsl.js +2 -1
- package/lib/esm/activities/index-dsl.js.map +1 -1
- package/lib/esm/activities/media/prepareVideo.js +390 -0
- package/lib/esm/activities/media/prepareVideo.js.map +1 -0
- package/lib/esm/activities/media/transcribeMediaWithGladia.js +50 -17
- package/lib/esm/activities/media/transcribeMediaWithGladia.js.map +1 -1
- package/lib/esm/activities/notifyWebhook.js +137 -12
- package/lib/esm/activities/notifyWebhook.js.map +1 -1
- package/lib/esm/activities/rateLimiter.js +27 -0
- package/lib/esm/activities/rateLimiter.js.map +1 -0
- package/lib/esm/conversion/image.js +4 -2
- package/lib/esm/conversion/image.js.map +1 -1
- package/lib/esm/dsl/dsl-workflow.js +68 -2
- package/lib/esm/dsl/dsl-workflow.js.map +1 -1
- package/lib/esm/dsl/setup/ActivityContext.js +10 -7
- package/lib/esm/dsl/setup/ActivityContext.js.map +1 -1
- package/lib/esm/errors.js +19 -0
- package/lib/esm/errors.js.map +1 -1
- package/lib/esm/index.js +2 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/iterative-generation/activities/extractToc.js +3 -3
- package/lib/esm/iterative-generation/activities/extractToc.js.map +1 -1
- package/lib/esm/iterative-generation/activities/finalizeOutput.js +9 -6
- package/lib/esm/iterative-generation/activities/finalizeOutput.js.map +1 -1
- package/lib/esm/iterative-generation/activities/generatePart.js +19 -14
- package/lib/esm/iterative-generation/activities/generatePart.js.map +1 -1
- package/lib/esm/iterative-generation/activities/generateToc.js +50 -55
- package/lib/esm/iterative-generation/activities/generateToc.js.map +1 -1
- package/lib/esm/iterative-generation/utils.js.map +1 -1
- package/lib/esm/system/notifyWebhookWorkflow.js +11 -4
- package/lib/esm/system/notifyWebhookWorkflow.js.map +1 -1
- package/lib/esm/utils/blobs.js +4 -1
- package/lib/esm/utils/blobs.js.map +1 -1
- package/lib/esm/utils/client.js +4 -2
- package/lib/esm/utils/client.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/activities/advanced/createDocumentTypeFromInteractionRun.d.ts.map +1 -1
- package/lib/types/activities/advanced/createOrUpdateDocumentFromInteractionRun.d.ts +1 -1
- package/lib/types/activities/advanced/createOrUpdateDocumentFromInteractionRun.d.ts.map +1 -1
- package/lib/types/activities/advanced/updateDocumentFromInteractionRun.d.ts.map +1 -1
- package/lib/types/activities/chunkDocument.d.ts.map +1 -1
- package/lib/types/activities/executeInteraction.d.ts +5 -1
- package/lib/types/activities/executeInteraction.d.ts.map +1 -1
- package/lib/types/activities/generateDocumentProperties.d.ts.map +1 -1
- package/lib/types/activities/generateOrAssignContentType.d.ts.map +1 -1
- package/lib/types/activities/index-dsl.d.ts +2 -1
- package/lib/types/activities/index-dsl.d.ts.map +1 -1
- package/lib/types/activities/media/prepareVideo.d.ts +30 -0
- package/lib/types/activities/media/prepareVideo.d.ts.map +1 -0
- package/lib/types/activities/media/transcribeMediaWithGladia.d.ts.map +1 -1
- package/lib/types/activities/notifyWebhook.d.ts +14 -3
- package/lib/types/activities/notifyWebhook.d.ts.map +1 -1
- package/lib/types/activities/rateLimiter.d.ts +11 -0
- package/lib/types/activities/rateLimiter.d.ts.map +1 -0
- package/lib/types/conversion/image.d.ts.map +1 -1
- package/lib/types/dsl/dsl-workflow.d.ts.map +1 -1
- package/lib/types/dsl/setup/ActivityContext.d.ts.map +1 -1
- package/lib/types/errors.d.ts +10 -0
- package/lib/types/errors.d.ts.map +1 -1
- package/lib/types/index.d.ts +2 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/iterative-generation/activities/extractToc.d.ts.map +1 -1
- package/lib/types/iterative-generation/activities/finalizeOutput.d.ts.map +1 -1
- package/lib/types/iterative-generation/activities/generatePart.d.ts.map +1 -1
- package/lib/types/iterative-generation/activities/generateToc.d.ts.map +1 -1
- package/lib/types/iterative-generation/utils.d.ts +3 -4
- package/lib/types/iterative-generation/utils.d.ts.map +1 -1
- package/lib/types/system/notifyWebhookWorkflow.d.ts +3 -2
- package/lib/types/system/notifyWebhookWorkflow.d.ts.map +1 -1
- package/lib/types/utils/blobs.d.ts.map +1 -1
- package/lib/types/utils/client.d.ts +2 -6
- package/lib/types/utils/client.d.ts.map +1 -1
- package/lib/workflows-bundle.js +8413 -5201
- package/package.json +128 -120
- package/src/activities/advanced/createDocumentTypeFromInteractionRun.ts +9 -8
- package/src/activities/advanced/createOrUpdateDocumentFromInteractionRun.ts +11 -9
- package/src/activities/advanced/updateDocumentFromInteractionRun.ts +2 -1
- package/src/activities/chunkDocument.ts +3 -1
- package/src/activities/executeInteraction.ts +23 -14
- package/src/activities/generateDocumentProperties.ts +12 -7
- package/src/activities/generateOrAssignContentType.ts +16 -11
- package/src/activities/index-dsl.ts +2 -1
- package/src/activities/media/prepareVideo.ts +622 -0
- package/src/activities/media/transcribeMediaWithGladia.ts +52 -21
- package/src/activities/notifyWebhook.test.ts +121 -19
- package/src/activities/notifyWebhook.ts +165 -16
- package/src/activities/rateLimiter.ts +41 -0
- package/src/conversion/image.ts +6 -3
- package/src/dsl/dsl-workflow.ts +86 -0
- package/src/dsl/workflow-exec-child.test.ts +1 -0
- package/src/dsl/workflow.test.ts +1 -0
- package/src/errors.ts +28 -0
- package/src/index.ts +2 -1
- package/src/iterative-generation/activities/generatePart.ts +1 -1
- package/src/iterative-generation/activities/generateToc.ts +7 -2
- package/src/iterative-generation/utils.ts +4 -5
- package/src/system/notifyWebhookWorkflow.ts +15 -6
- package/lib/cjs/activities/identifyTextSections.js +0 -48
- package/lib/cjs/activities/identifyTextSections.js.map +0 -1
- package/lib/esm/activities/identifyTextSections.js +0 -45
- package/lib/esm/activities/identifyTextSections.js.map +0 -1
- package/lib/types/activities/identifyTextSections.d.ts +0 -12
- package/lib/types/activities/identifyTextSections.d.ts.map +0 -1
- package/src/activities/identifyTextSections.ts +0 -71
package/package.json
CHANGED
|
@@ -1,128 +1,136 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
"repository": {
|
|
15
|
-
"type": "git",
|
|
16
|
-
"url": "https://github.com/vertesia/composableai.git",
|
|
17
|
-
"directory": "zeno/workflow"
|
|
18
|
-
},
|
|
19
|
-
"license": "Apache-2.0",
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"@smithy/types": "^3.7.2",
|
|
22
|
-
"@temporalio/proto": "^1.11.5",
|
|
23
|
-
"@temporalio/testing": "^1.11.5",
|
|
24
|
-
"@temporalio/worker": "^1.11.5",
|
|
25
|
-
"@types/jsonwebtoken": "^9.0.7",
|
|
26
|
-
"@types/node": "^22.5.1",
|
|
27
|
-
"@types/papaparse": "^5.3.15",
|
|
28
|
-
"@types/tmp": "^0.2.6",
|
|
29
|
-
"ts-dual-module": "^0.6.3",
|
|
30
|
-
"vitest": "^3.0.9"
|
|
31
|
-
},
|
|
32
|
-
"dependencies": {
|
|
33
|
-
"@aws-sdk/client-s3": "^3.693.0",
|
|
34
|
-
"@aws-sdk/client-textract": "^3.693.0",
|
|
35
|
-
"@aws-sdk/credential-providers": "^3.693.0",
|
|
36
|
-
"@temporalio/activity": "^1.11.5",
|
|
37
|
-
"@temporalio/workflow": "^1.11.5",
|
|
38
|
-
"@types/json-schema": "^7.0.15",
|
|
39
|
-
"fast-deep-equal": "^3.1.3",
|
|
40
|
-
"jsonwebtoken": "^9.0.2",
|
|
41
|
-
"mime": "^4.0.0",
|
|
42
|
-
"ms": "3.0.0-canary.1",
|
|
43
|
-
"node-web-stream-adapters": "^0.2.1",
|
|
44
|
-
"p-limit": "^6.2.0",
|
|
45
|
-
"papaparse": "^5.4.1",
|
|
46
|
-
"seedrandom": "^3.0.5",
|
|
47
|
-
"sharp": "^0.33.4",
|
|
48
|
-
"tiktoken": "^1.0.15",
|
|
49
|
-
"tmp": "^0.2.3",
|
|
50
|
-
"tmp-promise": "^3.0.3",
|
|
51
|
-
"yaml": "^2.6.0",
|
|
52
|
-
"@vertesia/client": "0.78.0",
|
|
53
|
-
"@llumiverse/common": "0.22.0",
|
|
54
|
-
"@vertesia/api-fetch-client": "0.78.0",
|
|
55
|
-
"@vertesia/common": "0.78.0",
|
|
56
|
-
"@vertesia/memory": "0.49.0"
|
|
57
|
-
},
|
|
58
|
-
"ts_dual_module": {
|
|
59
|
-
"outDir": "lib",
|
|
60
|
-
"exports": {
|
|
61
|
-
"activities": "./activities/index.js",
|
|
62
|
-
"dsl-activities": "./activities/index-dsl.js",
|
|
63
|
-
"workflows": "./workflows",
|
|
64
|
-
"workflows-bundle": "./workflows-bundle.js",
|
|
65
|
-
"vars": "./vars"
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
"exports": {
|
|
69
|
-
".": {
|
|
70
|
-
"types": "./lib/types/index.d.ts",
|
|
71
|
-
"import": "./lib/esm/index.js",
|
|
72
|
-
"require": "./lib/cjs/index.js"
|
|
2
|
+
"name": "@vertesia/workflow",
|
|
3
|
+
"version": "0.79.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Vertesia workflow DSL",
|
|
6
|
+
"main": "./lib/esm/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib",
|
|
9
|
+
"src"
|
|
10
|
+
],
|
|
11
|
+
"bin": {
|
|
12
|
+
"bundle-workflows": "./bin/bundle-workflows.mjs"
|
|
73
13
|
},
|
|
74
|
-
"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
14
|
+
"scripts": {
|
|
15
|
+
"test": "vitest run",
|
|
16
|
+
"build": "pnpm exec tsmod build && node ./bin/bundle-workflows.mjs lib/esm/workflows.js lib/workflows-bundle.js",
|
|
17
|
+
"clean": "rm -rf ./lib tsconfig.tsbuildinfo"
|
|
78
18
|
},
|
|
79
|
-
"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/vertesia/composableai.git",
|
|
22
|
+
"directory": "zeno/workflow"
|
|
83
23
|
},
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
24
|
+
"license": "Apache-2.0",
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@smithy/types": "^3.7.2",
|
|
27
|
+
"@temporalio/proto": "^1.11.5",
|
|
28
|
+
"@temporalio/testing": "^1.11.5",
|
|
29
|
+
"@temporalio/worker": "^1.11.5",
|
|
30
|
+
"@types/jsonwebtoken": "^9.0.7",
|
|
31
|
+
"@types/node": "^22.5.1",
|
|
32
|
+
"@types/papaparse": "^5.3.15",
|
|
33
|
+
"@types/tmp": "^0.2.6",
|
|
34
|
+
"ts-dual-module": "^0.6.3",
|
|
35
|
+
"vitest": "^3.0.9"
|
|
88
36
|
},
|
|
89
|
-
"
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@aws-sdk/client-s3": "^3.693.0",
|
|
39
|
+
"@aws-sdk/client-textract": "^3.693.0",
|
|
40
|
+
"@aws-sdk/credential-providers": "^3.693.0",
|
|
41
|
+
"@llumiverse/common": "workspace:*",
|
|
42
|
+
"@temporalio/activity": "^1.11.5",
|
|
43
|
+
"@temporalio/workflow": "^1.11.5",
|
|
44
|
+
"@types/json-schema": "^7.0.15",
|
|
45
|
+
"@vertesia/api-fetch-client": "workspace:*",
|
|
46
|
+
"@vertesia/client": "workspace:*",
|
|
47
|
+
"@vertesia/common": "workspace:*",
|
|
48
|
+
"@vertesia/memory": "workspace:*",
|
|
49
|
+
"fast-deep-equal": "^3.1.3",
|
|
50
|
+
"jsonwebtoken": "^9.0.2",
|
|
51
|
+
"mime": "^4.0.0",
|
|
52
|
+
"ms": "3.0.0-canary.1",
|
|
53
|
+
"node-web-stream-adapters": "^0.2.1",
|
|
54
|
+
"p-limit": "^6.2.0",
|
|
55
|
+
"papaparse": "^5.4.1",
|
|
56
|
+
"seedrandom": "^3.0.5",
|
|
57
|
+
"sharp": "^0.33.4",
|
|
58
|
+
"tiktoken": "^1.0.15",
|
|
59
|
+
"tmp": "^0.2.3",
|
|
60
|
+
"tmp-promise": "^3.0.3",
|
|
61
|
+
"yaml": "^2.6.0"
|
|
93
62
|
},
|
|
94
|
-
"
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
63
|
+
"ts_dual_module": {
|
|
64
|
+
"outDir": "lib",
|
|
65
|
+
"exports": {
|
|
66
|
+
"activities": "./activities/index.js",
|
|
67
|
+
"dsl-activities": "./activities/index-dsl.js",
|
|
68
|
+
"workflows": "./workflows",
|
|
69
|
+
"workflows-bundle": "./workflows-bundle.js",
|
|
70
|
+
"vars": "./vars"
|
|
71
|
+
}
|
|
98
72
|
},
|
|
99
|
-
"
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
"./
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
73
|
+
"exports": {
|
|
74
|
+
".": {
|
|
75
|
+
"types": "./lib/types/index.d.ts",
|
|
76
|
+
"import": "./lib/esm/index.js",
|
|
77
|
+
"require": "./lib/cjs/index.js"
|
|
78
|
+
},
|
|
79
|
+
"./vars": {
|
|
80
|
+
"types": "./lib/types/vars.d.ts",
|
|
81
|
+
"import": "./lib/esm/vars.js",
|
|
82
|
+
"require": "./lib/cjs/vars.js"
|
|
83
|
+
},
|
|
84
|
+
"./activities": {
|
|
85
|
+
"types": "./lib/types/activities/index.d.ts",
|
|
86
|
+
"import": "./lib/esm/activities/index.js",
|
|
87
|
+
"require": "./lib/cjs/activities/index.js"
|
|
88
|
+
},
|
|
89
|
+
"./dsl-activities": {
|
|
90
|
+
"types": "./lib/types/activities/index-dsl.d.ts",
|
|
91
|
+
"import": "./lib/esm/activities/index-dsl.js",
|
|
92
|
+
"require": "./lib/cjs/activities/index-dsl.js"
|
|
93
|
+
},
|
|
94
|
+
"./workflows": {
|
|
95
|
+
"types": "./lib/types/workflows.d.ts",
|
|
96
|
+
"import": "./lib/esm/workflows.js",
|
|
97
|
+
"require": "./lib/cjs/workflows.js"
|
|
98
|
+
},
|
|
99
|
+
"./dsl": {
|
|
100
|
+
"types": "./lib/types/dsl.d.ts",
|
|
101
|
+
"import": "./lib/esm/dsl.js",
|
|
102
|
+
"require": "./lib/cjs/dsl.js"
|
|
103
|
+
},
|
|
104
|
+
"./workflows-bundle": {
|
|
105
|
+
"import": "./lib/workflows-bundle.js"
|
|
106
|
+
},
|
|
107
|
+
"./errors": {
|
|
108
|
+
"types": "./lib/types/errors.d.ts",
|
|
109
|
+
"import": "./lib/esm/errors.js",
|
|
110
|
+
"require": "./lib/cjs/errors.js"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"types": "./lib/types/index.d.ts",
|
|
114
|
+
"typesVersions": {
|
|
115
|
+
"*": {
|
|
116
|
+
"activities": [
|
|
117
|
+
"./lib/types/activities/index.d.ts"
|
|
118
|
+
],
|
|
119
|
+
"dsl-activities": [
|
|
120
|
+
"./lib/types/activities/index-dsl.d.ts"
|
|
121
|
+
],
|
|
122
|
+
"workflows": [
|
|
123
|
+
"./lib/types/workflows.d.ts"
|
|
124
|
+
],
|
|
125
|
+
"dsl": [
|
|
126
|
+
"./lib/types/dsl.d.ts"
|
|
127
|
+
],
|
|
128
|
+
"vars": [
|
|
129
|
+
"./lib/types/dsl/vars.d.ts"
|
|
130
|
+
],
|
|
131
|
+
"errors": [
|
|
132
|
+
"./lib/types/errors.d.ts"
|
|
133
|
+
]
|
|
134
|
+
}
|
|
121
135
|
}
|
|
122
|
-
|
|
123
|
-
"scripts": {
|
|
124
|
-
"test": "vitest run",
|
|
125
|
-
"build": "pnpm exec tsmod build && node ./bin/bundle-workflows.mjs lib/esm/workflows.js lib/workflows-bundle.js",
|
|
126
|
-
"clean": "rm -rf ./lib tsconfig.tsbuildinfo"
|
|
127
|
-
}
|
|
128
|
-
}
|
|
136
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { CreateContentObjectTypePayload, DSLActivityExecutionPayload, DSLActivitySpec, ExecutionRun } from "@vertesia/common";
|
|
2
1
|
import { log } from "@temporalio/activity";
|
|
2
|
+
import { InteractionOutput } from "@vertesia/client";
|
|
3
|
+
import { CreateContentObjectTypePayload, DSLActivityExecutionPayload, DSLActivitySpec, ExecutionRun } from "@vertesia/common";
|
|
3
4
|
import { projectResult } from "../../dsl/projections.js";
|
|
4
5
|
import { setupActivity } from "../../dsl/setup/ActivityContext.js";
|
|
5
6
|
import { ActivityParamNotFoundError } from "../../errors.js";
|
|
@@ -28,18 +29,18 @@ export async function createDocumentTypeFromInteractionRun(payload: DSLActivityE
|
|
|
28
29
|
throw new ActivityParamNotFoundError("run", payload.activity);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
const
|
|
32
|
+
const jsonResult = InteractionOutput.from(params.run.result).object();
|
|
32
33
|
|
|
33
|
-
if (!
|
|
34
|
-
log.error("No name generated for type: " + JSON.stringify(
|
|
34
|
+
if (!jsonResult.document_type) {
|
|
35
|
+
log.error("No name generated for type: " + JSON.stringify(jsonResult), jsonResult);
|
|
35
36
|
throw new Error("No name generated for type");
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
log.info("Generated schema for type",
|
|
39
|
+
log.info("Generated schema for type", jsonResult.metadata_schema);
|
|
39
40
|
const typeData: CreateContentObjectTypePayload = {
|
|
40
|
-
name:
|
|
41
|
-
object_schema:
|
|
42
|
-
is_chunkable: !!
|
|
41
|
+
name: jsonResult.document_type,
|
|
42
|
+
object_schema: jsonResult.metadata_schema,
|
|
43
|
+
is_chunkable: !!jsonResult.is_chunkable,
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
const type = await client.types.create(typeData);
|
|
@@ -68,28 +68,30 @@ export async function createOrUpdateDocumentFromInteractionRun(payload: DSLActiv
|
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
const result = run.result;
|
|
71
|
-
const resultIsObject = typeof result === 'object';
|
|
72
71
|
const inputData = run.parameters;
|
|
73
72
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
// Try to parse result as JSON, fallback to text if not valid JSON
|
|
74
|
+
let jsonResult: any = null;
|
|
75
|
+
try {
|
|
76
|
+
jsonResult = result.object();
|
|
77
|
+
} catch (e) {
|
|
78
|
+
log.info("Result is not valid JSON, will use text content instead", { error: e instanceof Error ? e.message : String(e) });
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
const name = jsonResult?.['name'] || jsonResult?.["title"] || inputData['name'] || params.fallback_name || undefined;
|
|
82
|
+
|
|
81
83
|
const docPayload = {
|
|
82
84
|
name,
|
|
83
85
|
parent: params.parent ?? undefined,
|
|
84
|
-
properties:
|
|
85
|
-
text: !
|
|
86
|
+
properties: jsonResult ? jsonResult : {},
|
|
87
|
+
text: !jsonResult ? result.text() : undefined,
|
|
86
88
|
type: type?.id,
|
|
87
89
|
status: ContentObjectStatus.completed,
|
|
88
90
|
generation_run_info: {
|
|
89
91
|
id: run.id,
|
|
90
92
|
date: new Date().toISOString(),
|
|
91
93
|
model: run.modelId,
|
|
92
|
-
target:
|
|
94
|
+
target: jsonResult ? 'properties' : 'text'
|
|
93
95
|
}
|
|
94
96
|
};
|
|
95
97
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { InteractionOutput } from "@vertesia/client";
|
|
1
2
|
import { DSLActivityExecutionPayload, DSLActivitySpec, ExecutionRun } from "@vertesia/common";
|
|
2
3
|
import { setupActivity } from "../../dsl/setup/ActivityContext.js";
|
|
3
4
|
import { ActivityParamNotFoundError } from "../../errors.js";
|
|
@@ -22,7 +23,7 @@ export async function updateDocumentFromInteractionRun(payload: DSLActivityExecu
|
|
|
22
23
|
throw new ActivityParamNotFoundError("run", payload.activity);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
const docProps = params.run.result;
|
|
26
|
+
const docProps = InteractionOutput.from(params.run.result).object();
|
|
26
27
|
|
|
27
28
|
if (!docProps) {
|
|
28
29
|
return { status: "failed", error: "no-props" };
|
|
@@ -82,7 +82,9 @@ export async function chunkDocument(payload: DSLActivityExecutionPayload<ChunkDo
|
|
|
82
82
|
content: instrumented
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
const
|
|
85
|
+
const jsonResult = res.result.object();
|
|
86
|
+
|
|
87
|
+
const parts = jsonResult.parts as DocPart[];
|
|
86
88
|
if (!parts || parts.length === 0) {
|
|
87
89
|
log.warn('No parts found for object ID: ' + objectId, res);
|
|
88
90
|
return { id: objectId, status: "failed", parts: [], message: "no parts found" }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Modalities, ModelOptions } from "@llumiverse/common";
|
|
1
|
+
import { CompletionResult, Modalities, ModelOptions } from "@llumiverse/common";
|
|
2
2
|
import { activityInfo, log } from "@temporalio/activity";
|
|
3
3
|
import { VertesiaClient } from "@vertesia/client";
|
|
4
4
|
import { NodeStreamSource } from "@vertesia/client/node";
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "@vertesia/common";
|
|
14
14
|
import { projectResult } from "../dsl/projections.js";
|
|
15
15
|
import { setupActivity } from "../dsl/setup/ActivityContext.js";
|
|
16
|
-
import { ActivityParamInvalidError, ActivityParamNotFoundError } from "../errors.js";
|
|
16
|
+
import { ActivityParamInvalidError, ActivityParamNotFoundError, ResourceExhaustedError } from "../errors.js";
|
|
17
17
|
import { TruncateSpec, truncByMaxTokens } from "../utils/tokens.js";
|
|
18
18
|
import { Readable } from "stream";
|
|
19
19
|
|
|
@@ -98,6 +98,11 @@ export interface InteractionExecutionParams {
|
|
|
98
98
|
* Options to control generation
|
|
99
99
|
*/
|
|
100
100
|
model_options?: ModelOptions;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* activity won't be retried if it fails due to resource exhaustion (429)
|
|
104
|
+
*/
|
|
105
|
+
exit_on_resource_exhaustion?: boolean;
|
|
101
106
|
}
|
|
102
107
|
|
|
103
108
|
/**
|
|
@@ -150,52 +155,56 @@ export async function executeInteraction(payload: DSLActivityExecutionPayload<Ex
|
|
|
150
155
|
prompt_data,
|
|
151
156
|
payload.debug_mode,
|
|
152
157
|
);
|
|
153
|
-
|
|
158
|
+
|
|
159
|
+
let completionResult: CompletionResult[] = res.result;
|
|
160
|
+
|
|
154
161
|
// Handle image uploads if the result contains base64 images
|
|
155
162
|
if (res.output_modality === Modalities.image) {
|
|
156
|
-
const images = res.result.images;
|
|
163
|
+
const images = res.result.images();
|
|
157
164
|
const uploadedImages = await Promise.all(
|
|
158
165
|
images.map((image: string, index: number) => {
|
|
159
166
|
// Extract base64 data and create buffer
|
|
160
167
|
const base64Data = image.replace(/^data:image\/[a-z]+;base64,/, "");
|
|
161
168
|
const buffer = Buffer.from(base64Data, 'base64');
|
|
162
|
-
|
|
169
|
+
|
|
163
170
|
// Generate filename
|
|
164
171
|
const { runId } = activityInfo().workflowExecution;
|
|
165
172
|
const { activityId } = activityInfo();
|
|
166
173
|
const filename = `generated-image-${runId}-${activityId}-${index}.png`;
|
|
167
|
-
|
|
174
|
+
|
|
168
175
|
// Create a readable stream from the buffer
|
|
169
176
|
const stream = Readable.from(buffer);
|
|
170
|
-
|
|
177
|
+
|
|
171
178
|
const source = new NodeStreamSource(
|
|
172
179
|
stream,
|
|
173
180
|
filename,
|
|
174
181
|
"image/png",
|
|
175
182
|
);
|
|
176
|
-
|
|
183
|
+
|
|
177
184
|
return client.files.uploadFile(source);
|
|
178
185
|
})
|
|
179
186
|
);
|
|
180
|
-
|
|
187
|
+
completionResult = uploadedImages.map(file => ({ type: "image", value: file }));
|
|
181
188
|
}
|
|
182
189
|
|
|
183
190
|
return projectResult(payload, params, res, {
|
|
184
191
|
runId: res.id,
|
|
185
192
|
status: res.status,
|
|
186
|
-
result:
|
|
193
|
+
result: completionResult,
|
|
187
194
|
});
|
|
188
195
|
|
|
189
196
|
} catch (error: any) {
|
|
190
|
-
log.error(
|
|
191
|
-
if (error.
|
|
197
|
+
log.error(`Failed to execute interaction ${interactionName}`, { error });
|
|
198
|
+
if (error.statusCode === 429 && params.exit_on_resource_exhaustion) {
|
|
199
|
+
throw new ResourceExhaustedError(error.statusCode, "Resource exhausted - rate limit exceeded");
|
|
200
|
+
} else if (error.message.includes("Failed to validate merged prompt schema")) {
|
|
192
201
|
//issue with the input data, don't retry
|
|
193
202
|
throw new ActivityParamInvalidError("prompt_data", payload.activity, error.message);
|
|
194
203
|
} else if (error.message.includes("modelId: Path `modelId` is required")) {
|
|
195
204
|
//issue with the input data, don't retry
|
|
196
205
|
throw new ActivityParamInvalidError("model", payload.activity, error.message);
|
|
197
206
|
} else {
|
|
198
|
-
throw error;
|
|
207
|
+
throw new Error(`Interaction Execution failed ${interactionName}: ${error.message}`);
|
|
199
208
|
}
|
|
200
209
|
}
|
|
201
210
|
}
|
|
@@ -270,7 +279,7 @@ export async function executeInteractionFromActivity(
|
|
|
270
279
|
})
|
|
271
280
|
.catch((err) => {
|
|
272
281
|
log.error(`Error executing interaction ${interactionName}`, { err });
|
|
273
|
-
throw
|
|
282
|
+
throw err;
|
|
274
283
|
});
|
|
275
284
|
|
|
276
285
|
if (debug) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { log } from "@temporalio/activity";
|
|
2
2
|
import { DSLActivityExecutionPayload, DSLActivitySpec } from "@vertesia/common";
|
|
3
3
|
import { setupActivity } from "../dsl/setup/ActivityContext.js";
|
|
4
|
-
import { TruncateSpec } from "../utils/tokens.js";
|
|
4
|
+
import { TruncateSpec, truncByMaxTokens } from "../utils/tokens.js";
|
|
5
5
|
import { InteractionExecutionParams, executeInteractionFromActivity } from "./executeInteraction.js";
|
|
6
6
|
|
|
7
7
|
const INT_EXTRACT_INFORMATION = "sys:ExtractInformation";
|
|
@@ -55,8 +55,12 @@ export async function generateDocumentProperties(
|
|
|
55
55
|
return undefined;
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
+
const content = doc.text
|
|
59
|
+
? truncByMaxTokens(doc.text, params.truncate || 30000)
|
|
60
|
+
: undefined;
|
|
61
|
+
|
|
58
62
|
const promptData = {
|
|
59
|
-
content:
|
|
63
|
+
content: content,
|
|
60
64
|
image: getImageRef() ?? undefined,
|
|
61
65
|
human_context: project?.configuration?.human_context ?? undefined,
|
|
62
66
|
};
|
|
@@ -84,11 +88,12 @@ export async function generateDocumentProperties(
|
|
|
84
88
|
return undefined;
|
|
85
89
|
}
|
|
86
90
|
let text = "";
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
const jsonResult = infoRes.result.object();
|
|
92
|
+
if (jsonResult.title) {
|
|
93
|
+
text += jsonResult.title + "\n";
|
|
89
94
|
}
|
|
90
|
-
if (
|
|
91
|
-
text +=
|
|
95
|
+
if (jsonResult.description) {
|
|
96
|
+
text += jsonResult.description;
|
|
92
97
|
}
|
|
93
98
|
if (text) {
|
|
94
99
|
return text;
|
|
@@ -100,7 +105,7 @@ export async function generateDocumentProperties(
|
|
|
100
105
|
log.info(`Extracted information from object ${objectId} with type ${type.name}`, { runId: infoRes.id });
|
|
101
106
|
await client.objects.update(doc.id, {
|
|
102
107
|
properties: {
|
|
103
|
-
...infoRes.result,
|
|
108
|
+
...infoRes.result.object(),
|
|
104
109
|
etag: doc.text_etag,
|
|
105
110
|
},
|
|
106
111
|
text: getText(),
|
|
@@ -119,7 +119,7 @@ export async function generateOrAssignContentType(
|
|
|
119
119
|
|
|
120
120
|
log.info(
|
|
121
121
|
"Execute SelectDocumentType interaction on content with \nexisting types - passing full types: " +
|
|
122
|
-
|
|
122
|
+
existing_types.filter((t) => !t.tags?.includes("system")),
|
|
123
123
|
);
|
|
124
124
|
|
|
125
125
|
const res = await executeInteractionFromActivity(
|
|
@@ -133,12 +133,15 @@ export async function generateOrAssignContentType(
|
|
|
133
133
|
},
|
|
134
134
|
);
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
const jsonResult = res.result.object();
|
|
137
|
+
|
|
138
|
+
log.info("Selected Content Type Result: " + JSON.stringify(jsonResult));
|
|
139
|
+
|
|
137
140
|
|
|
138
141
|
//if type is not identified or not present in the database, generate a new type
|
|
139
142
|
let selectedType: { id: string; name: string } | undefined = undefined;
|
|
140
143
|
|
|
141
|
-
selectedType = types.find((t) => t.name ===
|
|
144
|
+
selectedType = types.find((t) => t.name === jsonResult.document_type);
|
|
142
145
|
|
|
143
146
|
if (!selectedType) {
|
|
144
147
|
log.warn("Document type not identified: starting type generation");
|
|
@@ -153,7 +156,7 @@ export async function generateOrAssignContentType(
|
|
|
153
156
|
|
|
154
157
|
if (!selectedType) {
|
|
155
158
|
log.error("Type not found: ", res.result);
|
|
156
|
-
throw new Error("Type not found: " +
|
|
159
|
+
throw new Error("Type not found: " + jsonResult.document_type);
|
|
157
160
|
}
|
|
158
161
|
|
|
159
162
|
//update object with selected type
|
|
@@ -193,18 +196,20 @@ async function generateNewType(
|
|
|
193
196
|
},
|
|
194
197
|
);
|
|
195
198
|
|
|
196
|
-
|
|
199
|
+
const jsonResult = genTypeRes.result.object();
|
|
200
|
+
|
|
201
|
+
if (!jsonResult.document_type) {
|
|
197
202
|
log.error("No name generated for type", genTypeRes);
|
|
198
203
|
throw new Error("No name generated for type");
|
|
199
204
|
}
|
|
200
205
|
|
|
201
|
-
log.info("Generated schema for type",
|
|
206
|
+
log.info("Generated schema for type", jsonResult.metadata_schema);
|
|
202
207
|
const typeData: CreateContentObjectTypePayload = {
|
|
203
|
-
name:
|
|
204
|
-
description:
|
|
205
|
-
object_schema:
|
|
206
|
-
is_chunkable:
|
|
207
|
-
table_layout:
|
|
208
|
+
name: jsonResult.document_type,
|
|
209
|
+
description: jsonResult.document_type_description,
|
|
210
|
+
object_schema: jsonResult.metadata_schema,
|
|
211
|
+
is_chunkable: jsonResult.is_chunkable,
|
|
212
|
+
table_layout: jsonResult.table_layout,
|
|
208
213
|
};
|
|
209
214
|
|
|
210
215
|
const type = await client.types.create(typeData);
|
|
@@ -15,6 +15,7 @@ export { getObjectFromStore } from "./getObjectFromStore.js";
|
|
|
15
15
|
export { handleDslError } from "./handleError.js";
|
|
16
16
|
export { convertPdfToStructuredText } from "./media/processPdfWithTextract.js";
|
|
17
17
|
export { transcribeMedia } from "./media/transcribeMediaWithGladia.js";
|
|
18
|
+
export { prepareVideo } from "./media/prepareVideo.js";
|
|
18
19
|
export { notifyWebhook } from "./notifyWebhook.js";
|
|
19
20
|
export { setDocumentStatus } from "./setDocumentStatus.js";
|
|
20
|
-
export {
|
|
21
|
+
export { checkRateLimit } from "./rateLimiter.js";
|