@vertesia/common 1.5.0-dev.20260807.073259Z → 1.5.0-dev.20260901.005903Z
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/access-control.d.ts +0 -14
- package/lib/access-control.d.ts.map +1 -1
- package/lib/access-control.js +0 -23
- package/lib/access-control.js.map +1 -1
- package/lib/account-values.d.ts +0 -10
- package/lib/account-values.d.ts.map +1 -1
- package/lib/account-values.js +0 -44
- package/lib/account-values.js.map +1 -1
- package/lib/api-contract/components.generated.json +40405 -0
- package/lib/api-contract/index.d.ts +186 -0
- package/lib/api-contract/index.d.ts.map +1 -0
- package/lib/api-contract/index.js +554 -0
- package/lib/api-contract/index.js.map +1 -0
- package/lib/api-schemas/agent-communication.d.ts +199 -0
- package/lib/api-schemas/agent-communication.d.ts.map +1 -0
- package/lib/api-schemas/agent-communication.js +150 -0
- package/lib/api-schemas/agent-communication.js.map +1 -0
- package/lib/api-schemas/agent-runs.d.ts +593 -0
- package/lib/api-schemas/agent-runs.d.ts.map +1 -1
- package/lib/api-schemas/agent-runs.js +44 -2
- package/lib/api-schemas/agent-runs.js.map +1 -1
- package/lib/api-schemas/app-lifecycle.d.ts +19 -0
- package/lib/api-schemas/app-lifecycle.d.ts.map +1 -1
- package/lib/api-schemas/app-lifecycle.js +34 -4
- package/lib/api-schemas/app-lifecycle.js.map +1 -1
- package/lib/api-schemas/app-runtime.d.ts +9871 -9257
- package/lib/api-schemas/app-runtime.d.ts.map +1 -1
- package/lib/api-schemas/app-runtime.js +7 -0
- package/lib/api-schemas/app-runtime.js.map +1 -1
- package/lib/api-schemas/apps.d.ts +1 -0
- package/lib/api-schemas/apps.d.ts.map +1 -1
- package/lib/api-schemas/apps.js +4 -3
- package/lib/api-schemas/apps.js.map +1 -1
- package/lib/api-schemas/content-query.d.ts +39 -0
- package/lib/api-schemas/content-query.d.ts.map +1 -0
- package/lib/api-schemas/content-query.js +30 -0
- package/lib/api-schemas/content-query.js.map +1 -0
- package/lib/api-schemas/content.d.ts +835 -29
- package/lib/api-schemas/content.d.ts.map +1 -1
- package/lib/api-schemas/content.js +82 -15
- package/lib/api-schemas/content.js.map +1 -1
- package/lib/api-schemas/dashboard.d.ts +4 -0
- package/lib/api-schemas/dashboard.d.ts.map +1 -1
- package/lib/api-schemas/dashboard.js +3 -0
- package/lib/api-schemas/dashboard.js.map +1 -1
- package/lib/api-schemas/document-processing.d.ts +333 -0
- package/lib/api-schemas/document-processing.d.ts.map +1 -1
- package/lib/api-schemas/events.d.ts +1007 -4
- package/lib/api-schemas/events.d.ts.map +1 -1
- package/lib/api-schemas/events.js +4 -1
- package/lib/api-schemas/events.js.map +1 -1
- package/lib/api-schemas/files.d.ts +17 -0
- package/lib/api-schemas/files.d.ts.map +1 -1
- package/lib/api-schemas/files.js +23 -0
- package/lib/api-schemas/files.js.map +1 -1
- package/lib/api-schemas/group.d.ts +7 -0
- package/lib/api-schemas/group.d.ts.map +1 -1
- package/lib/api-schemas/group.js +9 -0
- package/lib/api-schemas/group.js.map +1 -1
- package/lib/api-schemas/index.d.ts +4 -0
- package/lib/api-schemas/index.d.ts.map +1 -1
- package/lib/api-schemas/index.js +4 -0
- package/lib/api-schemas/index.js.map +1 -1
- package/lib/api-schemas/integrations.d.ts +19 -5
- package/lib/api-schemas/integrations.d.ts.map +1 -1
- package/lib/api-schemas/integrations.js +25 -2
- package/lib/api-schemas/integrations.js.map +1 -1
- package/lib/api-schemas/interaction.d.ts +8399 -1076
- package/lib/api-schemas/interaction.d.ts.map +1 -1
- package/lib/api-schemas/interaction.js +161 -9
- package/lib/api-schemas/interaction.js.map +1 -1
- package/lib/api-schemas/oauth-server.d.ts +131 -3
- package/lib/api-schemas/oauth-server.d.ts.map +1 -1
- package/lib/api-schemas/oauth-server.js +137 -3
- package/lib/api-schemas/oauth-server.js.map +1 -1
- package/lib/api-schemas/process.d.ts +1295 -0
- package/lib/api-schemas/process.d.ts.map +1 -1
- package/lib/api-schemas/process.js +318 -2
- package/lib/api-schemas/process.js.map +1 -1
- package/lib/api-schemas/project-configuration.d.ts +1118 -1
- package/lib/api-schemas/project-configuration.d.ts.map +1 -1
- package/lib/api-schemas/project-configuration.js +6 -2
- package/lib/api-schemas/project-configuration.js.map +1 -1
- package/lib/api-schemas/project.d.ts +1680 -6
- package/lib/api-schemas/project.d.ts.map +1 -1
- package/lib/api-schemas/registry.d.ts +87529 -69142
- package/lib/api-schemas/registry.d.ts.map +1 -1
- package/lib/api-schemas/registry.js +234 -413
- package/lib/api-schemas/registry.js.map +1 -1
- package/lib/api-schemas/schema-primitives.d.ts +4 -0
- package/lib/api-schemas/schema-primitives.d.ts.map +1 -1
- package/lib/api-schemas/schema-primitives.js +10 -0
- package/lib/api-schemas/schema-primitives.js.map +1 -1
- package/lib/api-schemas/store.d.ts +5596 -37
- package/lib/api-schemas/store.d.ts.map +1 -1
- package/lib/api-schemas/store.js +53 -8
- package/lib/api-schemas/store.js.map +1 -1
- package/lib/api-schemas/tools.d.ts +115 -0
- package/lib/api-schemas/tools.d.ts.map +1 -1
- package/lib/api-schemas/tools.js +55 -0
- package/lib/api-schemas/tools.js.map +1 -1
- package/lib/api-schemas/view-execution.d.ts +330 -854
- package/lib/api-schemas/view-execution.d.ts.map +1 -1
- package/lib/api-schemas/view-execution.js +26 -2
- package/lib/api-schemas/view-execution.js.map +1 -1
- package/lib/api-schemas/views.d.ts +452 -2562
- package/lib/api-schemas/views.d.ts.map +1 -1
- package/lib/api-schemas/views.js +119 -3
- package/lib/api-schemas/views.js.map +1 -1
- package/lib/api-schemas/workflow-runs.d.ts +344 -5
- package/lib/api-schemas/workflow-runs.d.ts.map +1 -1
- package/lib/api-schemas/workflow-runs.js +9 -7
- package/lib/api-schemas/workflow-runs.js.map +1 -1
- package/lib/apps.d.ts +8 -145
- package/lib/apps.d.ts.map +1 -1
- package/lib/apps.js +1 -54
- package/lib/apps.js.map +1 -1
- package/lib/ask-user.d.ts +2 -1
- package/lib/ask-user.d.ts.map +1 -1
- package/lib/audit-trail.d.ts +2 -2
- package/lib/audit-trail.d.ts.map +1 -1
- package/lib/audit-trail.js +2 -2
- package/lib/audit-trail.js.map +1 -1
- package/lib/browser-credentials.d.ts +2 -7
- package/lib/browser-credentials.d.ts.map +1 -1
- package/lib/common.d.ts +4 -1
- package/lib/common.d.ts.map +1 -1
- package/lib/content-query.d.ts +5 -0
- package/lib/content-query.d.ts.map +1 -0
- package/lib/content-query.js +2 -0
- package/lib/content-query.js.map +1 -0
- package/lib/data-platform.d.ts +4 -46
- package/lib/data-platform.d.ts.map +1 -1
- package/lib/data-platform.js.map +1 -1
- package/lib/email.d.ts +12 -18
- package/lib/email.d.ts.map +1 -1
- package/lib/email.js.map +1 -1
- package/lib/environment.d.ts +0 -10
- package/lib/environment.d.ts.map +1 -1
- package/lib/environment.js +1 -12
- package/lib/environment.js.map +1 -1
- package/lib/facets.d.ts +0 -4
- package/lib/facets.d.ts.map +1 -1
- package/lib/group.d.ts +2 -12
- package/lib/group.d.ts.map +1 -1
- package/lib/group.js.map +1 -1
- package/lib/index.d.ts +3 -10
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -10
- package/lib/index.js.map +1 -1
- package/lib/integrations.d.ts +1 -27
- package/lib/integrations.d.ts.map +1 -1
- package/lib/integrations.js +0 -6
- package/lib/integrations.js.map +1 -1
- package/lib/interaction.d.ts +10 -222
- package/lib/interaction.d.ts.map +1 -1
- package/lib/interaction.js +0 -31
- package/lib/interaction.js.map +1 -1
- package/lib/meters.d.ts +5 -10
- package/lib/meters.d.ts.map +1 -1
- package/lib/meters.js +1 -9
- package/lib/meters.js.map +1 -1
- package/lib/oauth-scopes.d.ts +2 -16
- package/lib/oauth-scopes.d.ts.map +1 -1
- package/lib/oauth-scopes.js +9 -49
- package/lib/oauth-scopes.js.map +1 -1
- package/lib/oauth-server.d.ts +16 -195
- package/lib/oauth-server.d.ts.map +1 -1
- package/lib/payload.d.ts +2 -5
- package/lib/payload.d.ts.map +1 -1
- package/lib/pending-asks.d.ts +9 -41
- package/lib/pending-asks.d.ts.map +1 -1
- package/lib/platform-event.d.ts +4 -142
- package/lib/platform-event.d.ts.map +1 -1
- package/lib/platform-event.js.map +1 -1
- package/lib/project.d.ts +7 -46
- package/lib/project.d.ts.map +1 -1
- package/lib/project.js +2 -132
- package/lib/project.js.map +1 -1
- package/lib/prompt.d.ts +4 -7
- package/lib/prompt.d.ts.map +1 -1
- package/lib/prompt.js.map +1 -1
- package/lib/query.d.ts +0 -8
- package/lib/query.d.ts.map +1 -1
- package/lib/rate-limiter.d.ts +4 -3
- package/lib/rate-limiter.d.ts.map +1 -1
- package/lib/runs.d.ts +5 -1
- package/lib/runs.d.ts.map +1 -1
- package/lib/schema-for-extraction.d.ts +0 -1
- package/lib/schema-for-extraction.d.ts.map +1 -1
- package/lib/schema-for-extraction.js +1 -1
- package/lib/schema-for-extraction.js.map +1 -1
- package/lib/secrets.d.ts +2 -1
- package/lib/secrets.d.ts.map +1 -1
- package/lib/skill.d.ts +0 -13
- package/lib/skill.d.ts.map +1 -1
- package/lib/store/activity-catalog.d.ts +2 -0
- package/lib/store/activity-catalog.d.ts.map +1 -1
- package/lib/store/agent-approval.d.ts +0 -1
- package/lib/store/agent-approval.d.ts.map +1 -1
- package/lib/store/agent-approval.js +0 -3
- package/lib/store/agent-approval.js.map +1 -1
- package/lib/store/agent-run.d.ts +32 -69
- package/lib/store/agent-run.d.ts.map +1 -1
- package/lib/store/collections.d.ts +2 -6
- package/lib/store/collections.d.ts.map +1 -1
- package/lib/store/collections.js.map +1 -1
- package/lib/store/conversation-state.d.ts +11 -12
- package/lib/store/conversation-state.d.ts.map +1 -1
- package/lib/store/conversation-state.js +0 -18
- package/lib/store/conversation-state.js.map +1 -1
- package/lib/store/doc-analyzer.d.ts +0 -22
- package/lib/store/doc-analyzer.d.ts.map +1 -1
- package/lib/store/dsl-workflow.d.ts +22 -5
- package/lib/store/dsl-workflow.d.ts.map +1 -1
- package/lib/store/dsl-workflow.js.map +1 -1
- package/lib/store/grounded-extraction.d.ts +0 -14
- package/lib/store/grounded-extraction.d.ts.map +1 -1
- package/lib/store/grounded-extraction.js +1 -7
- package/lib/store/grounded-extraction.js.map +1 -1
- package/lib/store/index.d.ts +0 -5
- package/lib/store/index.d.ts.map +1 -1
- package/lib/store/index.js +0 -6
- package/lib/store/index.js.map +1 -1
- package/lib/store/intake-policy-schema.generated.d.ts.map +1 -1
- package/lib/store/intake-policy-schema.generated.js +279 -1
- package/lib/store/intake-policy-schema.generated.js.map +1 -1
- package/lib/store/process.d.ts +43 -1
- package/lib/store/process.d.ts.map +1 -1
- package/lib/store/process.js.map +1 -1
- package/lib/store/rendering.d.ts +3 -5
- package/lib/store/rendering.d.ts.map +1 -1
- package/lib/store/rendering.js +0 -4
- package/lib/store/rendering.js.map +1 -1
- package/lib/store/schedule.d.ts +0 -16
- package/lib/store/schedule.d.ts.map +1 -1
- package/lib/store/schedule.js.map +1 -1
- package/lib/store/signals.d.ts +12 -0
- package/lib/store/signals.d.ts.map +1 -1
- package/lib/store/store.d.ts +80 -94
- package/lib/store/store.d.ts.map +1 -1
- package/lib/store/store.js +5 -25
- package/lib/store/store.js.map +1 -1
- package/lib/store/workflow.d.ts +35 -86
- package/lib/store/workflow.d.ts.map +1 -1
- package/lib/store/workflow.js +0 -47
- package/lib/store/workflow.js.map +1 -1
- package/lib/sts-errors.d.ts +0 -1
- package/lib/sts-errors.d.ts.map +1 -1
- package/lib/sts-token-types.d.ts +2 -8
- package/lib/sts-token-types.d.ts.map +1 -1
- package/lib/sts-token-types.js +1 -19
- package/lib/sts-token-types.js.map +1 -1
- package/lib/tools.d.ts +6 -1
- package/lib/tools.d.ts.map +1 -1
- package/lib/transient-tokens.d.ts +0 -2
- package/lib/transient-tokens.d.ts.map +1 -1
- package/lib/user.d.ts +0 -17
- package/lib/user.d.ts.map +1 -1
- package/lib/user.js.map +1 -1
- package/lib/utils/schemas.d.ts +2 -24
- package/lib/utils/schemas.d.ts.map +1 -1
- package/lib/utils/schemas.js +0 -151
- package/lib/utils/schemas.js.map +1 -1
- package/lib/vertesia-common.js +3 -4
- package/lib/vertesia-common.js.map +1 -1
- package/lib/views.d.ts +23 -27
- package/lib/views.d.ts.map +1 -1
- package/lib/views.js +5 -26
- package/lib/views.js.map +1 -1
- package/lib/workflow-analytics.d.ts +12 -34
- package/lib/workflow-analytics.d.ts.map +1 -1
- package/package.json +12 -6
- package/src/access-control.ts +0 -26
- package/src/account-values.ts +0 -49
- package/src/agent-resources.test.ts +1 -12
- package/src/api-contract/components.contract.test.ts +99 -0
- package/src/api-contract/components.generated.json +40405 -0
- package/src/api-contract/index.ts +664 -0
- package/src/api-schemas/agent-communication.contract.test.ts +90 -0
- package/src/api-schemas/agent-communication.ts +169 -0
- package/src/api-schemas/agent-runs.ts +46 -1
- package/src/api-schemas/api-discriminators.test.ts +101 -0
- package/src/api-schemas/app-lifecycle.ts +39 -4
- package/src/api-schemas/app-runtime.ts +8 -0
- package/src/api-schemas/apps.ts +4 -3
- package/src/api-schemas/content-query.ts +31 -0
- package/src/api-schemas/content.ts +88 -15
- package/src/api-schemas/dashboard.contract.test.ts +16 -5
- package/src/api-schemas/dashboard.ts +3 -0
- package/src/api-schemas/events.ts +9 -1
- package/src/api-schemas/files.ts +27 -0
- package/src/api-schemas/group.ts +10 -0
- package/src/api-schemas/index.ts +4 -0
- package/src/api-schemas/integrations.ts +27 -2
- package/src/api-schemas/interaction.contract.test.ts +204 -1
- package/src/api-schemas/interaction.ts +176 -8
- package/src/api-schemas/llumiverse.contract.test.ts +33 -2
- package/src/api-schemas/oauth-server.ts +152 -3
- package/src/api-schemas/oauth.contract.test.ts +64 -1
- package/src/api-schemas/process.ts +352 -2
- package/src/api-schemas/project-configuration.ts +11 -7
- package/src/api-schemas/project.contract.test.ts +83 -6
- package/src/api-schemas/registry.ts +290 -457
- package/src/api-schemas/schema-primitives.ts +13 -0
- package/src/api-schemas/store.contract.test.ts +30 -1
- package/src/api-schemas/store.ts +58 -11
- package/src/api-schemas/tools.ts +62 -0
- package/src/api-schemas/view-execution.ts +28 -2
- package/src/api-schemas/views.contract.test.ts +119 -0
- package/src/api-schemas/views.ts +142 -3
- package/src/api-schemas/workflow-runs.ts +9 -7
- package/src/api-schemas/zeno-response-contracts.test.ts +344 -0
- package/src/apps.test.ts +2 -40
- package/src/apps.ts +14 -181
- package/src/ask-user.ts +1 -1
- package/src/audit-trail.ts +3 -3
- package/src/browser-credentials.ts +3 -7
- package/src/common.ts +13 -1
- package/src/content-query.ts +5 -0
- package/src/data-platform.ts +4 -51
- package/src/email.ts +24 -18
- package/src/environment.ts +1 -14
- package/src/facets.ts +0 -6
- package/src/group.ts +2 -12
- package/src/index.ts +3 -15
- package/src/integrations.ts +1 -52
- package/src/interaction.ts +12 -271
- package/src/meters.ts +10 -11
- package/src/oauth-scopes.test.ts +15 -0
- package/src/oauth-scopes.ts +10 -64
- package/src/oauth-server.ts +28 -215
- package/src/payload.ts +1 -6
- package/src/pending-asks.ts +17 -42
- package/src/platform-event.ts +3 -156
- package/src/project.ts +12 -160
- package/src/prompt.ts +9 -8
- package/src/query.ts +0 -9
- package/src/rate-limiter.ts +3 -3
- package/src/runs.ts +8 -0
- package/src/schema-for-extraction.ts +1 -1
- package/src/secrets.ts +3 -0
- package/src/skill.ts +0 -15
- package/src/store/activity-catalog.ts +3 -0
- package/src/store/agent-approval.ts +0 -4
- package/src/store/agent-run.ts +39 -93
- package/src/store/collections.ts +3 -6
- package/src/store/conversation-state.ts +12 -25
- package/src/store/doc-analyzer.ts +0 -26
- package/src/store/dsl-workflow.ts +28 -5
- package/src/store/grounded-extraction.ts +0 -18
- package/src/store/index.ts +0 -6
- package/src/store/intake-policy-schema.generated.ts +293 -1
- package/src/store/process.ts +84 -0
- package/src/store/rendering.ts +3 -8
- package/src/store/schedule.ts +0 -19
- package/src/store/signals.ts +14 -0
- package/src/store/store.ts +118 -127
- package/src/store/workflow.ts +32 -120
- package/src/sts-errors.ts +0 -2
- package/src/sts-token-types.ts +3 -28
- package/src/tools.ts +15 -0
- package/src/transient-tokens.ts +0 -2
- package/src/user.ts +0 -20
- package/src/utils/schemas.ts +2 -159
- package/src/views.ts +50 -47
- package/src/workflow-analytics.ts +12 -40
- package/tsconfig.dist.json +4 -1
- package/lib/Progress.d.ts +0 -22
- package/lib/Progress.d.ts.map +0 -1
- package/lib/Progress.js +0 -57
- package/lib/Progress.js.map +0 -1
- package/lib/agent-request-template.d.ts +0 -4
- package/lib/agent-request-template.d.ts.map +0 -1
- package/lib/agent-request-template.js +0 -46
- package/lib/agent-request-template.js.map +0 -1
- package/lib/channels.d.ts +0 -22
- package/lib/channels.d.ts.map +0 -1
- package/lib/channels.js +0 -57
- package/lib/channels.js.map +0 -1
- package/lib/host-utils.d.ts +0 -8
- package/lib/host-utils.d.ts.map +0 -1
- package/lib/host-utils.js +0 -84
- package/lib/host-utils.js.map +0 -1
- package/lib/platform-event-validation.d.ts +0 -45
- package/lib/platform-event-validation.d.ts.map +0 -1
- package/lib/platform-event-validation.js +0 -336
- package/lib/platform-event-validation.js.map +0 -1
- package/lib/store/hive-memory.d.ts +0 -117
- package/lib/store/hive-memory.d.ts.map +0 -1
- package/lib/store/hive-memory.js +0 -2
- package/lib/store/hive-memory.js.map +0 -1
- package/lib/store/object-types.d.ts +0 -24
- package/lib/store/object-types.d.ts.map +0 -1
- package/lib/store/object-types.js +0 -95
- package/lib/store/object-types.js.map +0 -1
- package/lib/store/process-schema.d.ts +0 -561
- package/lib/store/process-schema.d.ts.map +0 -1
- package/lib/store/process-schema.js +0 -561
- package/lib/store/process-schema.js.map +0 -1
- package/lib/store/process-validation.d.ts +0 -17
- package/lib/store/process-validation.d.ts.map +0 -1
- package/lib/store/process-validation.js +0 -515
- package/lib/store/process-validation.js.map +0 -1
- package/lib/store/temporalio.d.ts +0 -17
- package/lib/store/temporalio.d.ts.map +0 -1
- package/lib/store/temporalio.js +0 -41
- package/lib/store/temporalio.js.map +0 -1
- package/lib/view-configuration-validation.d.ts +0 -15
- package/lib/view-configuration-validation.d.ts.map +0 -1
- package/lib/view-configuration-validation.js +0 -63
- package/lib/view-configuration-validation.js.map +0 -1
- package/lib/view-query-validation.d.ts +0 -13
- package/lib/view-query-validation.d.ts.map +0 -1
- package/lib/view-query-validation.js +0 -266
- package/lib/view-query-validation.js.map +0 -1
- package/lib/view-validation-helpers.d.ts +0 -15
- package/lib/view-validation-helpers.d.ts.map +0 -1
- package/lib/view-validation-helpers.js +0 -25
- package/lib/view-validation-helpers.js.map +0 -1
- package/lib/views-schema.d.ts +0 -1992
- package/lib/views-schema.d.ts.map +0 -1
- package/lib/views-schema.js +0 -674
- package/lib/views-schema.js.map +0 -1
- package/lib/views-validation.d.ts +0 -21
- package/lib/views-validation.d.ts.map +0 -1
- package/lib/views-validation.js +0 -164
- package/lib/views-validation.js.map +0 -1
- package/src/Progress.ts +0 -59
- package/src/agent-request-template.test.ts +0 -40
- package/src/agent-request-template.ts +0 -45
- package/src/channels.ts +0 -70
- package/src/host-utils.test.ts +0 -61
- package/src/host-utils.ts +0 -93
- package/src/platform-event-validation.test.ts +0 -251
- package/src/platform-event-validation.ts +0 -372
- package/src/project.test.ts +0 -44
- package/src/store/hive-memory.ts +0 -167
- package/src/store/object-types.ts +0 -123
- package/src/store/process-schema.test.ts +0 -149
- package/src/store/process-schema.ts +0 -564
- package/src/store/process-validation.test.ts +0 -635
- package/src/store/process-validation.ts +0 -646
- package/src/store/temporalio.ts +0 -54
- package/src/view-configuration-validation.ts +0 -74
- package/src/view-query-validation.test.ts +0 -21
- package/src/view-query-validation.ts +0 -319
- package/src/view-validation-helpers.ts +0 -28
- package/src/views-schema.test.ts +0 -372
- package/src/views-schema.ts +0 -689
- package/src/views-validation.ts +0 -234
|
@@ -1,646 +0,0 @@
|
|
|
1
|
-
import type { CatalogInteractionRef } from '../interaction.js';
|
|
2
|
-
import {
|
|
3
|
-
type BranchDefinition,
|
|
4
|
-
type BranchNodeBranchDefinition,
|
|
5
|
-
type NodeDefinition,
|
|
6
|
-
PROCESS_DEFINITION_FORMAT_VERSION,
|
|
7
|
-
type ProcessDefinitionBody,
|
|
8
|
-
} from './process.js';
|
|
9
|
-
|
|
10
|
-
export interface ProcessDefinitionValidationResult {
|
|
11
|
-
valid: boolean;
|
|
12
|
-
errors: string[];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface ProcessDefinitionValidationOptions {
|
|
16
|
-
knownTools?: Iterable<string>;
|
|
17
|
-
knownInteractions?: Iterable<string>;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function getProcessInteractionValidationSelectors(interactions: Iterable<CatalogInteractionRef>): string[] {
|
|
21
|
-
const selectors = new Set<string>();
|
|
22
|
-
for (const interaction of interactions) {
|
|
23
|
-
selectors.add(interaction.id);
|
|
24
|
-
selectors.add(interaction.name);
|
|
25
|
-
if (interaction.type === 'sys') {
|
|
26
|
-
selectors.add(`sys:${interaction.name}`);
|
|
27
|
-
}
|
|
28
|
-
if (interaction.type === 'app' && !interaction.id.startsWith('app:')) {
|
|
29
|
-
selectors.add(`app:${interaction.id}`);
|
|
30
|
-
}
|
|
31
|
-
if (interaction.type === 'stored' || interaction.type === 'draft') {
|
|
32
|
-
selectors.add(`${interaction.name}@draft`);
|
|
33
|
-
selectors.add(`${interaction.id}@draft`);
|
|
34
|
-
if (typeof interaction.version === 'number') {
|
|
35
|
-
selectors.add(`${interaction.name}@${interaction.version}`);
|
|
36
|
-
selectors.add(`${interaction.id}@${interaction.version}`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return [...selectors];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export const MAX_PROCESS_DEFINITION_BYTES = 1024 * 1024;
|
|
44
|
-
export const MAX_PROCESS_GUARD_DEPTH = 64;
|
|
45
|
-
export const MAX_PROCESS_GUARD_NODES = 4096;
|
|
46
|
-
const PROCESS_SCRIPT_RESOURCE_NAME = /^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/;
|
|
47
|
-
const PROCESS_SCRIPT_FILE_PATH = /^[a-zA-Z0-9._-]+(\/[a-zA-Z0-9._-]+)*$/;
|
|
48
|
-
const PROCESS_SCRIPT_PACKAGE =
|
|
49
|
-
/^(?:@[a-zA-Z0-9][a-zA-Z0-9._-]*\/[a-zA-Z0-9][a-zA-Z0-9._-]*|[a-zA-Z0-9][a-zA-Z0-9._-]*)(?:\[[a-zA-Z0-9,._-]+\])?(?:(?:@|[<>=!~^])[^\s;|&$`]*)?$/;
|
|
50
|
-
|
|
51
|
-
export function validateProcessDefinitionBody(
|
|
52
|
-
definition: ProcessDefinitionBody,
|
|
53
|
-
options: ProcessDefinitionValidationOptions = {},
|
|
54
|
-
): void {
|
|
55
|
-
const result = getProcessDefinitionValidationResult(definition, options);
|
|
56
|
-
if (!result.valid) {
|
|
57
|
-
throw new Error(result.errors.join('; '));
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function getProcessDefinitionValidationResult(
|
|
62
|
-
definition: ProcessDefinitionBody,
|
|
63
|
-
options: ProcessDefinitionValidationOptions = {},
|
|
64
|
-
): ProcessDefinitionValidationResult {
|
|
65
|
-
const errors: string[] = [];
|
|
66
|
-
const context = createValidationContext(options);
|
|
67
|
-
const size = new TextEncoder().encode(JSON.stringify(definition)).length;
|
|
68
|
-
if (size > MAX_PROCESS_DEFINITION_BYTES) {
|
|
69
|
-
errors.push(`process definition, including embedded resources, exceeds ${MAX_PROCESS_DEFINITION_BYTES} bytes`);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (!definition.process) {
|
|
73
|
-
errors.push('process is missing');
|
|
74
|
-
}
|
|
75
|
-
if (definition.format_version !== PROCESS_DEFINITION_FORMAT_VERSION) {
|
|
76
|
-
errors.push(`format_version must be ${PROCESS_DEFINITION_FORMAT_VERSION}`);
|
|
77
|
-
}
|
|
78
|
-
if (!definition.initial) {
|
|
79
|
-
errors.push('initial node is missing');
|
|
80
|
-
}
|
|
81
|
-
if (!definition.nodes || Object.keys(definition.nodes).length === 0) {
|
|
82
|
-
errors.push('nodes are missing');
|
|
83
|
-
} else if (definition.initial && !definition.nodes[definition.initial]) {
|
|
84
|
-
errors.push(`initial node "${definition.initial}" does not exist`);
|
|
85
|
-
}
|
|
86
|
-
if (!definition.context?.schema) {
|
|
87
|
-
errors.push('context.schema is missing');
|
|
88
|
-
}
|
|
89
|
-
if (!definition.context?.initial) {
|
|
90
|
-
errors.push('context.initial is missing');
|
|
91
|
-
}
|
|
92
|
-
validateProcessResources(definition, errors);
|
|
93
|
-
|
|
94
|
-
for (const [nodeId, node] of Object.entries(definition.nodes ?? {})) {
|
|
95
|
-
validateNodeDefinition(definition, nodeId, node, errors, context);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return {
|
|
99
|
-
valid: errors.length === 0,
|
|
100
|
-
errors,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function validateNodeDefinition(
|
|
105
|
-
definition: ProcessDefinitionBody,
|
|
106
|
-
nodeId: string,
|
|
107
|
-
node: NodeDefinition,
|
|
108
|
-
errors: string[],
|
|
109
|
-
context: ProcessDefinitionValidationContext,
|
|
110
|
-
) {
|
|
111
|
-
if (!isProcessNodeType(node.type)) {
|
|
112
|
-
errors.push(`node "${nodeId}" has invalid type "${String(node.type)}"`);
|
|
113
|
-
}
|
|
114
|
-
if (node.type === 'human_task') {
|
|
115
|
-
if (!node.task) {
|
|
116
|
-
errors.push(`human_task node "${nodeId}" is missing task`);
|
|
117
|
-
} else if (!node.task.title) {
|
|
118
|
-
errors.push(`human_task node "${nodeId}" task title is missing`);
|
|
119
|
-
} else if (!Array.isArray(node.task.fields)) {
|
|
120
|
-
errors.push(`human_task node "${nodeId}" task fields must be an array`);
|
|
121
|
-
} else {
|
|
122
|
-
const allowedTypes = ['string', 'number', 'boolean', 'select', 'text'];
|
|
123
|
-
(node.task.fields as unknown[]).forEach((field, i) => {
|
|
124
|
-
const path = `human_task node "${nodeId}" task.fields[${i}]`;
|
|
125
|
-
if (!isRecord(field)) {
|
|
126
|
-
errors.push(`${path} must be an object`);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
if (typeof field.name !== 'string' || field.name.length === 0) {
|
|
130
|
-
errors.push(`${path}.name must be a non-empty string (not "id")`);
|
|
131
|
-
}
|
|
132
|
-
if (typeof field.type !== 'string' || !allowedTypes.includes(field.type)) {
|
|
133
|
-
errors.push(`${path}.type must be one of ${allowedTypes.join(', ')}`);
|
|
134
|
-
}
|
|
135
|
-
if (field.type === 'select' && !(Array.isArray(field.options) && field.options.length > 0)) {
|
|
136
|
-
errors.push(`${path} of type "select" requires a non-empty options[] array`);
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
if (node.type === 'tool') {
|
|
142
|
-
validateToolNodeDefinition(nodeId, node, errors, context);
|
|
143
|
-
}
|
|
144
|
-
if (node.type === 'script') {
|
|
145
|
-
validateScriptNodeDefinition(definition, nodeId, node, errors);
|
|
146
|
-
} else {
|
|
147
|
-
if (node.script !== undefined) {
|
|
148
|
-
errors.push(`node "${nodeId}" defines script but has type "${node.type}"`);
|
|
149
|
-
}
|
|
150
|
-
if (node.timeout !== undefined) {
|
|
151
|
-
errors.push(`node "${nodeId}" defines timeout but has type "${node.type}"`);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if ((node.type === 'interaction' || node.type === 'agent') && node.interaction && context.knownInteractions) {
|
|
155
|
-
if (!isKnownSelector(node.interaction, context.knownInteractions)) {
|
|
156
|
-
errors.push(`${node.type} node "${nodeId}" references unknown interaction "${node.interaction}"`);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
if (
|
|
160
|
-
(node.type === 'interaction' || node.type === 'agent') &&
|
|
161
|
-
node.result_schema !== undefined &&
|
|
162
|
-
!isRecord(node.result_schema)
|
|
163
|
-
) {
|
|
164
|
-
errors.push(`${node.type} node "${nodeId}" result_schema must be a JSON Schema object`);
|
|
165
|
-
}
|
|
166
|
-
if (node.type === 'process') {
|
|
167
|
-
if (!node.process && !node.process_definition) {
|
|
168
|
-
errors.push(`process node "${nodeId}" is missing process or process_definition`);
|
|
169
|
-
}
|
|
170
|
-
if (node.run_type && !isProcessNodeRunType(node.run_type)) {
|
|
171
|
-
errors.push(`process node "${nodeId}" has invalid run_type "${String(node.run_type)}"`);
|
|
172
|
-
}
|
|
173
|
-
if (node.returns?.from !== undefined && typeof node.returns.from !== 'string') {
|
|
174
|
-
errors.push(`process node "${nodeId}" returns.from must be a string`);
|
|
175
|
-
}
|
|
176
|
-
if (node.returns?.context !== undefined && !isStringArray(node.returns.context)) {
|
|
177
|
-
errors.push(`process node "${nodeId}" returns.context must be an array of strings`);
|
|
178
|
-
}
|
|
179
|
-
if (node.process_definition) {
|
|
180
|
-
const childResult = getProcessDefinitionValidationResult(node.process_definition, context.options);
|
|
181
|
-
for (const error of childResult.errors) {
|
|
182
|
-
errors.push(`process node "${nodeId}" process_definition: ${error}`);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
if (node.type === 'foreach') {
|
|
187
|
-
if (!node.foreach) {
|
|
188
|
-
errors.push(`foreach node "${nodeId}" is missing foreach`);
|
|
189
|
-
}
|
|
190
|
-
if (!node.node) {
|
|
191
|
-
errors.push(`foreach node "${nodeId}" is missing node`);
|
|
192
|
-
}
|
|
193
|
-
if (
|
|
194
|
-
node.max_concurrency !== undefined &&
|
|
195
|
-
(!Number.isInteger(node.max_concurrency) || node.max_concurrency < 1)
|
|
196
|
-
) {
|
|
197
|
-
errors.push(`foreach node "${nodeId}" max_concurrency must be a positive integer`);
|
|
198
|
-
}
|
|
199
|
-
if (node.item_id !== undefined && typeof node.item_id !== 'string') {
|
|
200
|
-
errors.push(`foreach node "${nodeId}" item_id must be a string`);
|
|
201
|
-
}
|
|
202
|
-
validateCollectDefinition('foreach', nodeId, node.collect, errors);
|
|
203
|
-
if (node.node) {
|
|
204
|
-
validateFanoutChildNodeDefinition(
|
|
205
|
-
definition,
|
|
206
|
-
{
|
|
207
|
-
ownerLabel: `foreach node "${nodeId}"`,
|
|
208
|
-
childPath: `${nodeId}.node`,
|
|
209
|
-
childLabel: `foreach node "${nodeId}" child node`,
|
|
210
|
-
child: node.node,
|
|
211
|
-
},
|
|
212
|
-
errors,
|
|
213
|
-
context,
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
if (node.type === 'branch') {
|
|
218
|
-
if (!Array.isArray(node.branches) || node.branches.length === 0) {
|
|
219
|
-
errors.push(`branch node "${nodeId}" must define at least one branch`);
|
|
220
|
-
}
|
|
221
|
-
if (node.join !== undefined && node.join !== 'all') {
|
|
222
|
-
errors.push(`branch node "${nodeId}" join must be "all"`);
|
|
223
|
-
}
|
|
224
|
-
validateCollectDefinition('branch', nodeId, node.collect, errors);
|
|
225
|
-
const branches = getBranchNodeBranches(node);
|
|
226
|
-
const seenIds = new Set<string>();
|
|
227
|
-
for (const [index, branch] of branches.entries()) {
|
|
228
|
-
if (!branch.id) {
|
|
229
|
-
errors.push(`branch node "${nodeId}" branch at index ${index} is missing id`);
|
|
230
|
-
} else if (seenIds.has(branch.id)) {
|
|
231
|
-
errors.push(`branch node "${nodeId}" has duplicate branch id "${branch.id}"`);
|
|
232
|
-
} else {
|
|
233
|
-
seenIds.add(branch.id);
|
|
234
|
-
}
|
|
235
|
-
if (!branch.node) {
|
|
236
|
-
errors.push(`branch node "${nodeId}" branch "${branch.id || index}" is missing node`);
|
|
237
|
-
continue;
|
|
238
|
-
}
|
|
239
|
-
validateFanoutChildNodeDefinition(
|
|
240
|
-
definition,
|
|
241
|
-
{
|
|
242
|
-
ownerLabel: `branch node "${nodeId}" branch "${branch.id || index}"`,
|
|
243
|
-
childPath: `${nodeId}.branches.${index}.node`,
|
|
244
|
-
childLabel: `branch node "${nodeId}" branch "${branch.id || index}" child node`,
|
|
245
|
-
child: branch.node,
|
|
246
|
-
},
|
|
247
|
-
errors,
|
|
248
|
-
context,
|
|
249
|
-
);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
if (node.failure_policy && !isParallelFailurePolicy(node.failure_policy)) {
|
|
253
|
-
errors.push(`node "${nodeId}" has invalid failure_policy "${String(node.failure_policy)}"`);
|
|
254
|
-
}
|
|
255
|
-
for (const transition of node.transitions ?? []) {
|
|
256
|
-
if (!definition.nodes[transition.to]) {
|
|
257
|
-
errors.push(`node "${nodeId}" has transition to "${transition.to}" which does not exist`);
|
|
258
|
-
}
|
|
259
|
-
if (transition.trigger && !isTransitionTrigger(transition.trigger)) {
|
|
260
|
-
errors.push(`node "${nodeId}" has invalid transition trigger "${transition.trigger}"`);
|
|
261
|
-
}
|
|
262
|
-
if (typeof transition.guard === 'string') {
|
|
263
|
-
errors.push(`node "${nodeId}" transition to "${transition.to}" guard must be a JSON Logic object`);
|
|
264
|
-
} else if (transition.guard) {
|
|
265
|
-
validateGuardRule(`node "${nodeId}" transition to "${transition.to}" guard`, transition.guard, errors);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
for (const [index, branch] of getConditionBranches(node).entries()) {
|
|
270
|
-
if (hasStringConditionProperty(branch, 'condition')) {
|
|
271
|
-
errors.push(
|
|
272
|
-
`node "${nodeId}" branch at index ${index} uses string condition; use JSON Logic in "when" instead`,
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
if (hasStringConditionProperty(branch, 'guard')) {
|
|
276
|
-
errors.push(
|
|
277
|
-
`node "${nodeId}" branch at index ${index} uses string guard; use JSON Logic in "when" instead`,
|
|
278
|
-
);
|
|
279
|
-
}
|
|
280
|
-
if (!definition.nodes[branch.to]) {
|
|
281
|
-
errors.push(`node "${nodeId}" has branch to "${branch.to}" which does not exist`);
|
|
282
|
-
}
|
|
283
|
-
if (typeof branch.when === 'string') {
|
|
284
|
-
errors.push(`node "${nodeId}" branch to "${branch.to}" when must be a JSON Logic object`);
|
|
285
|
-
} else if (branch.when) {
|
|
286
|
-
validateGuardRule(`node "${nodeId}" branch to "${branch.to}" guard`, branch.when, errors);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
interface ProcessDefinitionValidationContext {
|
|
292
|
-
options: ProcessDefinitionValidationOptions;
|
|
293
|
-
knownTools?: ReadonlySet<string>;
|
|
294
|
-
knownInteractions?: ReadonlySet<string>;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
function createValidationContext(options: ProcessDefinitionValidationOptions): ProcessDefinitionValidationContext {
|
|
298
|
-
return {
|
|
299
|
-
options,
|
|
300
|
-
knownTools: options.knownTools ? new Set(options.knownTools) : undefined,
|
|
301
|
-
knownInteractions: options.knownInteractions ? new Set(options.knownInteractions) : undefined,
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
function validateToolNodeDefinition(
|
|
306
|
-
nodeId: string,
|
|
307
|
-
node: NodeDefinition,
|
|
308
|
-
errors: string[],
|
|
309
|
-
context: ProcessDefinitionValidationContext,
|
|
310
|
-
) {
|
|
311
|
-
if (!node.tool) {
|
|
312
|
-
errors.push(`tool node "${nodeId}" is missing tool`);
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
if (context.knownTools && !context.knownTools.has(node.tool)) {
|
|
316
|
-
errors.push(`tool node "${nodeId}" references unknown tool "${node.tool}"`);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
if (node.tool === 'set_context') {
|
|
320
|
-
validateSetContextNode(nodeId, node, errors);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
function validateProcessResources(definition: ProcessDefinitionBody, errors: string[]) {
|
|
325
|
-
for (const [name, resource] of Object.entries(definition.resources?.scripts ?? {})) {
|
|
326
|
-
const label = `script resource "${name}"`;
|
|
327
|
-
if (!PROCESS_SCRIPT_RESOURCE_NAME.test(name)) {
|
|
328
|
-
errors.push(`${label} has an invalid name`);
|
|
329
|
-
}
|
|
330
|
-
if (
|
|
331
|
-
resource.language !== 'python' &&
|
|
332
|
-
resource.language !== 'javascript' &&
|
|
333
|
-
resource.language !== 'typescript'
|
|
334
|
-
) {
|
|
335
|
-
errors.push(`${label} has invalid language "${String(resource.language)}"`);
|
|
336
|
-
}
|
|
337
|
-
if (resource.source?.type !== 'inline') {
|
|
338
|
-
errors.push(`${label} has unsupported source type "${String(resource.source?.type)}"`);
|
|
339
|
-
continue;
|
|
340
|
-
}
|
|
341
|
-
const files = resource.source.files;
|
|
342
|
-
if (!files || Object.keys(files).length === 0) {
|
|
343
|
-
errors.push(`${label} must define at least one file`);
|
|
344
|
-
continue;
|
|
345
|
-
}
|
|
346
|
-
for (const [path, content] of Object.entries(files)) {
|
|
347
|
-
if (!PROCESS_SCRIPT_FILE_PATH.test(path) || path.split('/').includes('..')) {
|
|
348
|
-
errors.push(`${label} has unsafe file path "${path}"`);
|
|
349
|
-
}
|
|
350
|
-
if (typeof content !== 'string') {
|
|
351
|
-
errors.push(`${label} file "${path}" must contain text`);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
if (!Object.hasOwn(files, resource.entrypoint)) {
|
|
355
|
-
errors.push(`${label} entrypoint "${resource.entrypoint}" is not present in files`);
|
|
356
|
-
}
|
|
357
|
-
for (const packageSpec of resource.packages ?? []) {
|
|
358
|
-
if (
|
|
359
|
-
typeof packageSpec !== 'string' ||
|
|
360
|
-
!packageSpec ||
|
|
361
|
-
packageSpec.startsWith('-') ||
|
|
362
|
-
!PROCESS_SCRIPT_PACKAGE.test(packageSpec)
|
|
363
|
-
) {
|
|
364
|
-
errors.push(`${label} has unsafe package specification "${String(packageSpec)}"`);
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
function validateScriptNodeDefinition(
|
|
371
|
-
definition: ProcessDefinitionBody,
|
|
372
|
-
nodeId: string,
|
|
373
|
-
node: NodeDefinition,
|
|
374
|
-
errors: string[],
|
|
375
|
-
) {
|
|
376
|
-
if (!node.script) {
|
|
377
|
-
errors.push(`script node "${nodeId}" is missing script`);
|
|
378
|
-
} else if (!definition.resources?.scripts?.[node.script]) {
|
|
379
|
-
errors.push(`script node "${nodeId}" references unknown script resource "${node.script}"`);
|
|
380
|
-
}
|
|
381
|
-
if (node.timeout !== undefined && (!Number.isInteger(node.timeout) || node.timeout < 1 || node.timeout > 600)) {
|
|
382
|
-
errors.push(`script node "${nodeId}" timeout must be an integer between 1 and 600`);
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
function validateSetContextNode(nodeId: string, node: NodeDefinition, errors: string[]) {
|
|
387
|
-
const input = node.input;
|
|
388
|
-
if (!isRecord(input)) {
|
|
389
|
-
errors.push(`tool node "${nodeId}" set_context input must be an object`);
|
|
390
|
-
return;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
for (const key of Object.keys(input)) {
|
|
394
|
-
if (key !== 'updates' && key !== 'reason' && key !== 'event_id') {
|
|
395
|
-
errors.push(`tool node "${nodeId}" set_context input has unsupported property "${key}"`);
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
if (!isRecord(input.updates)) {
|
|
400
|
-
errors.push(`tool node "${nodeId}" set_context input.updates must be an object`);
|
|
401
|
-
return;
|
|
402
|
-
}
|
|
403
|
-
if (input.reason !== undefined && typeof input.reason !== 'string') {
|
|
404
|
-
errors.push(`tool node "${nodeId}" set_context input.reason must be a string`);
|
|
405
|
-
}
|
|
406
|
-
if (input.event_id !== undefined && typeof input.event_id !== 'string') {
|
|
407
|
-
errors.push(`tool node "${nodeId}" set_context input.event_id must be a string`);
|
|
408
|
-
}
|
|
409
|
-
validateSetContextWrites(nodeId, node, input.updates, errors);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
function validateSetContextWrites(
|
|
413
|
-
nodeId: string,
|
|
414
|
-
node: NodeDefinition,
|
|
415
|
-
updates: Record<string, unknown>,
|
|
416
|
-
errors: string[],
|
|
417
|
-
) {
|
|
418
|
-
const updateKeys = Object.keys(updates);
|
|
419
|
-
if (updateKeys.length === 0) {
|
|
420
|
-
return;
|
|
421
|
-
}
|
|
422
|
-
if (!Array.isArray(node.writes) || node.writes.length === 0) {
|
|
423
|
-
errors.push(`tool node "${nodeId}" set_context updates require declared writes`);
|
|
424
|
-
return;
|
|
425
|
-
}
|
|
426
|
-
for (const key of updateKeys) {
|
|
427
|
-
if (key.startsWith('_')) {
|
|
428
|
-
errors.push(`tool node "${nodeId}" set_context cannot write reserved context field "${key}"`);
|
|
429
|
-
}
|
|
430
|
-
if (!isWriteAllowed(key, node.writes)) {
|
|
431
|
-
errors.push(`tool node "${nodeId}" set_context updates "${key}" but writes does not allow it`);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
function isWriteAllowed(key: string, writes: string[]): boolean {
|
|
437
|
-
return writes.some((write) => key === write || key.startsWith(`${write}.`));
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
function isKnownSelector(selector: string, knownSelectors: ReadonlySet<string>): boolean {
|
|
441
|
-
if (knownSelectors.has(selector)) {
|
|
442
|
-
return true;
|
|
443
|
-
}
|
|
444
|
-
if (!selector.includes('@')) {
|
|
445
|
-
return false;
|
|
446
|
-
}
|
|
447
|
-
return knownSelectors.has(selector.slice(0, selector.lastIndexOf('@')));
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
function hasStringConditionProperty(value: unknown, key: string): boolean {
|
|
451
|
-
return isRecord(value) && typeof value[key] === 'string';
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
function isProcessNodeType(value: string): boolean {
|
|
455
|
-
return (
|
|
456
|
-
value === 'tool' ||
|
|
457
|
-
value === 'interaction' ||
|
|
458
|
-
value === 'agent' ||
|
|
459
|
-
value === 'script' ||
|
|
460
|
-
value === 'process' ||
|
|
461
|
-
value === 'human_task' ||
|
|
462
|
-
value === 'foreach' ||
|
|
463
|
-
value === 'branch' ||
|
|
464
|
-
value === 'condition' ||
|
|
465
|
-
value === 'final'
|
|
466
|
-
);
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
function isProcessNodeRunType(value: string): boolean {
|
|
470
|
-
return value === 'supervised' || value === 'programmatic';
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
function isTransitionTrigger(value: string): boolean {
|
|
474
|
-
return value === 'auto' || value === 'agent' || value === 'user';
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
function isParallelFailurePolicy(value: string): boolean {
|
|
478
|
-
return value === 'fail_fast' || value === 'collect_errors';
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
function isFanoutChildNodeType(value: string): boolean {
|
|
482
|
-
return (
|
|
483
|
-
value === 'tool' || value === 'interaction' || value === 'agent' || value === 'script' || value === 'process'
|
|
484
|
-
);
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
function validateFanoutChildNodeDefinition(
|
|
488
|
-
definition: ProcessDefinitionBody,
|
|
489
|
-
input: {
|
|
490
|
-
ownerLabel: string;
|
|
491
|
-
childPath: string;
|
|
492
|
-
childLabel: string;
|
|
493
|
-
child: NodeDefinition;
|
|
494
|
-
},
|
|
495
|
-
errors: string[],
|
|
496
|
-
context: ProcessDefinitionValidationContext,
|
|
497
|
-
) {
|
|
498
|
-
const { ownerLabel, childPath, childLabel, child } = input;
|
|
499
|
-
if (!isFanoutChildNodeType(child.type)) {
|
|
500
|
-
errors.push(`${ownerLabel} has unsupported child node type "${String(child.type)}"`);
|
|
501
|
-
return;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
if ((child.transitions ?? []).length > 0) {
|
|
505
|
-
errors.push(`${childLabel} must not define transitions`);
|
|
506
|
-
}
|
|
507
|
-
if ((child.branches ?? []).length > 0) {
|
|
508
|
-
errors.push(`${childLabel} must not define branches`);
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
validateNodeDefinition(
|
|
512
|
-
definition,
|
|
513
|
-
childPath,
|
|
514
|
-
{
|
|
515
|
-
...child,
|
|
516
|
-
transitions: undefined,
|
|
517
|
-
branches: undefined,
|
|
518
|
-
},
|
|
519
|
-
errors,
|
|
520
|
-
context,
|
|
521
|
-
);
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
function validateCollectDefinition(
|
|
525
|
-
nodeKind: 'foreach' | 'branch',
|
|
526
|
-
nodeId: string,
|
|
527
|
-
collect: NodeDefinition['collect'],
|
|
528
|
-
errors: string[],
|
|
529
|
-
) {
|
|
530
|
-
if (collect === undefined) {
|
|
531
|
-
return;
|
|
532
|
-
}
|
|
533
|
-
if (typeof collect === 'string') {
|
|
534
|
-
if (!collect) {
|
|
535
|
-
errors.push(`${nodeKind} node "${nodeId}" collect must not be empty`);
|
|
536
|
-
}
|
|
537
|
-
return;
|
|
538
|
-
}
|
|
539
|
-
if (!isRecord(collect)) {
|
|
540
|
-
errors.push(`${nodeKind} node "${nodeId}" collect must be a string or object`);
|
|
541
|
-
return;
|
|
542
|
-
}
|
|
543
|
-
if (typeof collect.into !== 'string' || !collect.into) {
|
|
544
|
-
errors.push(`${nodeKind} node "${nodeId}" collect.into is required`);
|
|
545
|
-
}
|
|
546
|
-
if (collect.mode !== undefined && collect.mode !== 'array') {
|
|
547
|
-
errors.push(`${nodeKind} node "${nodeId}" collect.mode must be "array"`);
|
|
548
|
-
}
|
|
549
|
-
if (collect.include !== undefined) {
|
|
550
|
-
if (!Array.isArray(collect.include)) {
|
|
551
|
-
errors.push(`${nodeKind} node "${nodeId}" collect.include must be an array`);
|
|
552
|
-
return;
|
|
553
|
-
}
|
|
554
|
-
for (const field of collect.include) {
|
|
555
|
-
if (typeof field !== 'string' || !isParallelCollectField(field)) {
|
|
556
|
-
errors.push(`${nodeKind} node "${nodeId}" collect.include has invalid field "${String(field)}"`);
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
function isParallelCollectField(value: string): boolean {
|
|
563
|
-
return (
|
|
564
|
-
value === 'status' ||
|
|
565
|
-
value === 'index' ||
|
|
566
|
-
value === 'item' ||
|
|
567
|
-
value === 'item_id' ||
|
|
568
|
-
value === 'branch_id' ||
|
|
569
|
-
value === 'branch_title' ||
|
|
570
|
-
value === 'output' ||
|
|
571
|
-
value === 'context_update' ||
|
|
572
|
-
value === 'error' ||
|
|
573
|
-
value === 'child_run_id' ||
|
|
574
|
-
value === 'child_workflow_id' ||
|
|
575
|
-
value === 'child_workflow_run_id'
|
|
576
|
-
);
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
function isStringArray(value: unknown): value is string[] {
|
|
580
|
-
return Array.isArray(value) && value.every((item) => typeof item === 'string');
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
function validateGuardRule(label: string, rule: unknown, errors: string[]) {
|
|
584
|
-
const result = inspectGuardRule(rule);
|
|
585
|
-
if (result.depth > MAX_PROCESS_GUARD_DEPTH) {
|
|
586
|
-
errors.push(`${label} exceeds maximum depth ${MAX_PROCESS_GUARD_DEPTH}`);
|
|
587
|
-
}
|
|
588
|
-
if (result.nodes > MAX_PROCESS_GUARD_NODES) {
|
|
589
|
-
errors.push(`${label} exceeds maximum node count ${MAX_PROCESS_GUARD_NODES}`);
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
function inspectGuardRule(rule: unknown): { depth: number; nodes: number } {
|
|
594
|
-
let maxDepth = 0;
|
|
595
|
-
let nodes = 0;
|
|
596
|
-
const stack: { value: unknown; depth: number }[] = [{ value: rule, depth: 1 }];
|
|
597
|
-
while (stack.length > 0) {
|
|
598
|
-
const next = stack.pop();
|
|
599
|
-
if (!next) {
|
|
600
|
-
continue;
|
|
601
|
-
}
|
|
602
|
-
nodes += 1;
|
|
603
|
-
maxDepth = Math.max(maxDepth, next.depth);
|
|
604
|
-
if (nodes > MAX_PROCESS_GUARD_NODES || maxDepth > MAX_PROCESS_GUARD_DEPTH) {
|
|
605
|
-
break;
|
|
606
|
-
}
|
|
607
|
-
if (Array.isArray(next.value)) {
|
|
608
|
-
for (const item of next.value) {
|
|
609
|
-
stack.push({ value: item, depth: next.depth + 1 });
|
|
610
|
-
}
|
|
611
|
-
} else if (isRecord(next.value)) {
|
|
612
|
-
for (const value of Object.values(next.value)) {
|
|
613
|
-
stack.push({ value, depth: next.depth + 1 });
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
return { depth: maxDepth, nodes };
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
621
|
-
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
function getConditionBranches(node: NodeDefinition): BranchDefinition[] {
|
|
625
|
-
return node.type === 'condition' && Array.isArray(node.branches)
|
|
626
|
-
? node.branches.filter(isConditionBranchDefinition)
|
|
627
|
-
: [];
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
function getBranchNodeBranches(node: NodeDefinition): BranchNodeBranchDefinition[] {
|
|
631
|
-
return node.type === 'branch' && Array.isArray(node.branches)
|
|
632
|
-
? node.branches.filter(isBranchNodeBranchDefinition)
|
|
633
|
-
: [];
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
function isConditionBranchDefinition(
|
|
637
|
-
branch: BranchDefinition | BranchNodeBranchDefinition,
|
|
638
|
-
): branch is BranchDefinition {
|
|
639
|
-
return 'to' in branch;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
function isBranchNodeBranchDefinition(
|
|
643
|
-
branch: BranchDefinition | BranchNodeBranchDefinition,
|
|
644
|
-
): branch is BranchNodeBranchDefinition {
|
|
645
|
-
return 'node' in branch;
|
|
646
|
-
}
|
package/src/store/temporalio.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copied from temporalio
|
|
3
|
-
* The temporalio ParentClosePolicy
|
|
4
|
-
*/
|
|
5
|
-
export type ParentClosePolicyType = 'TERMINATE' | 'ABANDON' | 'REQUEST_CANCEL' | undefined;
|
|
6
|
-
interface ParentClosePolicyI {
|
|
7
|
-
TERMINATE: 'TERMINATE';
|
|
8
|
-
ABANDON: 'ABANDON';
|
|
9
|
-
REQUEST_CANCEL: 'REQUEST_CANCEL';
|
|
10
|
-
PARENT_CLOSE_POLICY_UNSPECIFIED: undefined;
|
|
11
|
-
PARENT_CLOSE_POLICY_TERMINATE: 'TERMINATE';
|
|
12
|
-
PARENT_CLOSE_POLICY_ABANDON: 'ABANDON';
|
|
13
|
-
PARENT_CLOSE_POLICY_REQUEST_CANCEL: 'REQUEST_CANCEL';
|
|
14
|
-
}
|
|
15
|
-
export const ParentClosePolicy = {
|
|
16
|
-
/**
|
|
17
|
-
* When the Parent is Closed, the Child is Terminated.
|
|
18
|
-
*
|
|
19
|
-
* @default
|
|
20
|
-
*/
|
|
21
|
-
TERMINATE: 'TERMINATE',
|
|
22
|
-
/**
|
|
23
|
-
* When the Parent is Closed, nothing is done to the Child.
|
|
24
|
-
*/
|
|
25
|
-
ABANDON: 'ABANDON',
|
|
26
|
-
/**
|
|
27
|
-
* When the Parent is Closed, the Child is Cancelled.
|
|
28
|
-
*/
|
|
29
|
-
REQUEST_CANCEL: 'REQUEST_CANCEL',
|
|
30
|
-
/**
|
|
31
|
-
* If a `ParentClosePolicy` is set to this, or is not set at all, the server default value will be used.
|
|
32
|
-
*
|
|
33
|
-
* @deprecated Either leave property `undefined`, or set an explicit policy instead.
|
|
34
|
-
*/
|
|
35
|
-
PARENT_CLOSE_POLICY_UNSPECIFIED: undefined,
|
|
36
|
-
/**
|
|
37
|
-
* When the Parent is Closed, the Child is Terminated.
|
|
38
|
-
*
|
|
39
|
-
* @deprecated Use {@link ParentClosePolicy.TERMINATE} instead.
|
|
40
|
-
*/
|
|
41
|
-
PARENT_CLOSE_POLICY_TERMINATE: 'TERMINATE',
|
|
42
|
-
/**
|
|
43
|
-
* When the Parent is Closed, nothing is done to the Child.
|
|
44
|
-
*
|
|
45
|
-
* @deprecated Use {@link ParentClosePolicy.ABANDON} instead.
|
|
46
|
-
*/
|
|
47
|
-
PARENT_CLOSE_POLICY_ABANDON: 'ABANDON',
|
|
48
|
-
/**
|
|
49
|
-
* When the Parent is Closed, the Child is Cancelled.
|
|
50
|
-
*
|
|
51
|
-
* @deprecated Use {@link ParentClosePolicy.REQUEST_CANCEL} instead.
|
|
52
|
-
*/
|
|
53
|
-
PARENT_CLOSE_POLICY_REQUEST_CANCEL: 'REQUEST_CANCEL',
|
|
54
|
-
} as ParentClosePolicyI;
|