@vertesia/common 1.3.0 → 1.4.0-dev.20260615.042033Z
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/LICENSE +198 -10
- package/lib/{types/Progress.d.ts → Progress.d.ts} +1 -0
- package/lib/Progress.d.ts.map +1 -0
- package/lib/{esm/Progress.js → Progress.js} +2 -2
- package/lib/Progress.js.map +1 -0
- package/lib/{types/access-control.d.ts → access-control.d.ts} +15 -5
- package/lib/access-control.d.ts.map +1 -0
- package/lib/{esm/access-control.js → access-control.js} +10 -7
- package/lib/access-control.js.map +1 -0
- package/lib/agent-request-template.d.ts +4 -0
- package/lib/agent-request-template.d.ts.map +1 -0
- package/lib/agent-request-template.js +46 -0
- package/lib/agent-request-template.js.map +1 -0
- package/lib/{types/analytics.d.ts → analytics.d.ts} +3 -2
- package/lib/analytics.d.ts.map +1 -0
- package/lib/{cjs/analytics.js.map → analytics.js.map} +1 -1
- package/lib/{types/apikey.d.ts → apikey.d.ts} +21 -5
- package/lib/apikey.d.ts.map +1 -0
- package/lib/{esm/apikey.js → apikey.js} +1 -0
- package/lib/apikey.js.map +1 -0
- package/lib/{types/apps.d.ts → apps.d.ts} +430 -35
- package/lib/apps.d.ts.map +1 -0
- package/lib/apps.js +158 -0
- package/lib/apps.js.map +1 -0
- package/lib/{types/ask-user.d.ts → ask-user.d.ts} +1 -0
- package/lib/ask-user.d.ts.map +1 -0
- package/lib/{esm/ask-user.js.map → ask-user.js.map} +1 -1
- package/lib/{types/audit-trail.d.ts → audit-trail.d.ts} +2 -1
- package/lib/audit-trail.d.ts.map +1 -0
- package/lib/audit-trail.js +3 -0
- package/lib/audit-trail.js.map +1 -0
- package/lib/browser-credentials.d.ts +123 -0
- package/lib/browser-credentials.d.ts.map +1 -0
- package/lib/browser-credentials.js +2 -0
- package/lib/browser-credentials.js.map +1 -0
- package/lib/{types/channels.d.ts → channels.d.ts} +3 -2
- package/lib/channels.d.ts.map +1 -0
- package/lib/{esm/channels.js → channels.js} +3 -3
- package/lib/channels.js.map +1 -0
- package/lib/{types/common.d.ts → common.d.ts} +18 -10
- package/lib/common.d.ts.map +1 -0
- package/lib/common.js.map +1 -0
- package/lib/{types/cost-analytics.d.ts → cost-analytics.d.ts} +2 -3
- package/lib/cost-analytics.d.ts.map +1 -0
- package/lib/cost-analytics.js.map +1 -0
- package/lib/{types/data-platform.d.ts → data-platform.d.ts} +134 -7
- package/lib/data-platform.d.ts.map +1 -0
- package/lib/data-platform.js.map +1 -0
- package/lib/{types/email.d.ts → email.d.ts} +6 -2
- package/lib/email.d.ts.map +1 -0
- package/lib/{esm/email.js → email.js} +2 -2
- package/lib/email.js.map +1 -0
- package/lib/embeddings.d.ts +65 -0
- package/lib/embeddings.d.ts.map +1 -0
- package/lib/embeddings.js +2 -0
- package/lib/embeddings.js.map +1 -0
- package/lib/{types/environment.d.ts → environment.d.ts} +18 -5
- package/lib/environment.d.ts.map +1 -0
- package/lib/{esm/environment.js → environment.js} +17 -7
- package/lib/environment.js.map +1 -0
- package/lib/{types/facets.d.ts → facets.d.ts} +6 -5
- package/lib/facets.d.ts.map +1 -0
- package/lib/facets.js.map +1 -0
- package/lib/{types/group.d.ts → group.d.ts} +5 -4
- package/lib/group.d.ts.map +1 -0
- package/lib/group.js.map +1 -0
- package/lib/host-utils.d.ts +8 -0
- package/lib/host-utils.d.ts.map +1 -0
- package/lib/host-utils.js +84 -0
- package/lib/host-utils.js.map +1 -0
- package/lib/{types/index.d.ts → index.d.ts} +19 -10
- package/lib/index.d.ts.map +1 -0
- package/lib/{esm/index.js → index.js} +18 -10
- package/lib/index.js.map +1 -0
- package/lib/integrations.d.ts +151 -0
- package/lib/integrations.d.ts.map +1 -0
- package/lib/{esm/integrations.js → integrations.js} +6 -0
- package/lib/integrations.js.map +1 -0
- package/lib/{types/interaction.d.ts → interaction.d.ts} +99 -56
- package/lib/interaction.d.ts.map +1 -0
- package/lib/{esm/interaction.js → interaction.js} +3 -3
- package/lib/interaction.js.map +1 -0
- package/lib/json-schema.d.ts +2 -0
- package/lib/json-schema.d.ts.map +1 -0
- package/lib/{cjs/json-schema.js.map → json-schema.js.map} +1 -1
- package/lib/json.d.ts +2 -0
- package/lib/json.d.ts.map +1 -0
- package/lib/json.js.map +1 -0
- package/lib/{types/meters.d.ts → meters.d.ts} +2 -1
- package/lib/meters.d.ts.map +1 -0
- package/lib/meters.js.map +1 -0
- package/lib/model_utility.d.ts +2 -0
- package/lib/model_utility.d.ts.map +1 -0
- package/lib/model_utility.js +2 -0
- package/lib/model_utility.js.map +1 -0
- package/lib/oauth-scopes.d.ts +18 -0
- package/lib/oauth-scopes.d.ts.map +1 -0
- package/lib/oauth-scopes.js +57 -0
- package/lib/oauth-scopes.js.map +1 -0
- package/lib/{types/oauth-server.d.ts → oauth-server.d.ts} +50 -7
- package/lib/oauth-server.d.ts.map +1 -0
- package/lib/{cjs/oauth-server.js.map → oauth-server.js.map} +1 -1
- package/lib/{types/oauth.d.ts → oauth.d.ts} +1 -0
- package/lib/oauth.d.ts.map +1 -0
- package/lib/oauth.js.map +1 -0
- package/lib/{types/payload.d.ts → payload.d.ts} +5 -4
- package/lib/payload.d.ts.map +1 -0
- package/lib/{cjs/payload.js.map → payload.js.map} +1 -1
- package/lib/{types/pending-asks.d.ts → pending-asks.d.ts} +8 -1
- package/lib/pending-asks.d.ts.map +1 -0
- package/lib/pending-asks.js.map +1 -0
- package/lib/principal-context.d.ts +27 -0
- package/lib/principal-context.d.ts.map +1 -0
- package/lib/principal-context.js +2 -0
- package/lib/principal-context.js.map +1 -0
- package/lib/{types/project.d.ts → project.d.ts} +253 -22
- package/lib/project.d.ts.map +1 -0
- package/lib/project.js +230 -0
- package/lib/project.js.map +1 -0
- package/lib/{types/prompt.d.ts → prompt.d.ts} +16 -9
- package/lib/prompt.d.ts.map +1 -0
- package/lib/prompt.js.map +1 -0
- package/lib/{types/query.d.ts → query.d.ts} +11 -8
- package/lib/query.d.ts.map +1 -0
- package/lib/query.js.map +1 -0
- package/lib/{types/rate-limiter.d.ts → rate-limiter.d.ts} +1 -0
- package/lib/rate-limiter.d.ts.map +1 -0
- package/lib/rate-limiter.js.map +1 -0
- package/lib/{types/refs.d.ts → refs.d.ts} +1 -0
- package/lib/refs.d.ts.map +1 -0
- package/lib/refs.js.map +1 -0
- package/lib/roles.d.ts +19 -0
- package/lib/roles.d.ts.map +1 -0
- package/lib/roles.js +228 -0
- package/lib/roles.js.map +1 -0
- package/lib/{types/runs.d.ts → runs.d.ts} +3 -2
- package/lib/runs.d.ts.map +1 -0
- package/lib/runs.js.map +1 -0
- package/lib/secrets.d.ts +47 -0
- package/lib/secrets.d.ts.map +1 -0
- package/lib/secrets.js +2 -0
- package/lib/secrets.js.map +1 -0
- package/lib/{types/skill.d.ts → skill.d.ts} +2 -1
- package/lib/skill.d.ts.map +1 -0
- package/lib/skill.js.map +1 -0
- package/lib/{types/store → store}/activity-catalog.d.ts +2 -1
- package/lib/store/activity-catalog.d.ts.map +1 -0
- package/lib/store/activity-catalog.js.map +1 -0
- package/lib/{types/store → store}/agent-run.d.ts +206 -35
- package/lib/store/agent-run.d.ts.map +1 -0
- package/lib/store/agent-run.js.map +1 -0
- package/lib/{types/store → store}/collections.d.ts +10 -9
- package/lib/store/collections.d.ts.map +1 -0
- package/lib/store/collections.js.map +1 -0
- package/lib/{types/store → store}/common.d.ts +1 -0
- package/lib/store/common.d.ts.map +1 -0
- package/lib/{cjs → store}/common.js.map +1 -1
- package/lib/{types/store → store}/conversation-state.d.ts +36 -5
- package/lib/store/conversation-state.d.ts.map +1 -0
- package/lib/{esm/store → store}/conversation-state.js +3 -0
- package/lib/store/conversation-state.js.map +1 -0
- package/lib/{types/store → store}/doc-analyzer.d.ts +20 -14
- package/lib/store/doc-analyzer.d.ts.map +1 -0
- package/lib/{cjs/store → store}/doc-analyzer.js.map +1 -1
- package/lib/{types/store → store}/dsl-workflow.d.ts +42 -24
- package/lib/store/dsl-workflow.d.ts.map +1 -0
- package/lib/store/dsl-workflow.js +8 -0
- package/lib/store/dsl-workflow.js.map +1 -0
- package/lib/{types/store → store}/hive-memory.d.ts +2 -1
- package/lib/store/hive-memory.d.ts.map +1 -0
- package/lib/{cjs/store → store}/hive-memory.js.map +1 -1
- package/lib/store/index.d.ts +20 -0
- package/lib/store/index.d.ts.map +1 -0
- package/lib/store/index.js +20 -0
- package/lib/store/index.js.map +1 -0
- package/lib/{types/store → store}/object-types.d.ts +2 -1
- package/lib/store/object-types.d.ts.map +1 -0
- package/lib/store/object-types.js +95 -0
- package/lib/store/object-types.js.map +1 -0
- package/lib/store/process-schema.d.ts +481 -0
- package/lib/store/process-schema.d.ts.map +1 -0
- package/lib/store/process-schema.js +482 -0
- package/lib/store/process-schema.js.map +1 -0
- package/lib/store/process-validation.d.ts +17 -0
- package/lib/store/process-validation.d.ts.map +1 -0
- package/lib/store/process-validation.js +428 -0
- package/lib/store/process-validation.js.map +1 -0
- package/lib/store/process.d.ts +261 -0
- package/lib/store/process.d.ts.map +1 -0
- package/lib/store/process.js +2 -0
- package/lib/store/process.js.map +1 -0
- package/lib/{types/store → store}/rendering.d.ts +5 -4
- package/lib/store/rendering.d.ts.map +1 -0
- package/lib/{esm/store → store}/rendering.js +6 -6
- package/lib/store/rendering.js.map +1 -0
- package/lib/{types/store → store}/schedule.d.ts +4 -3
- package/lib/store/schedule.d.ts.map +1 -0
- package/lib/store/schedule.js.map +1 -0
- package/lib/{types/store → store}/signals.d.ts +2 -1
- package/lib/store/signals.d.ts.map +1 -0
- package/lib/{cjs/store → store}/signals.js.map +1 -1
- package/lib/{types/store → store}/store.d.ts +63 -38
- package/lib/store/store.d.ts.map +1 -0
- package/lib/{esm/store → store}/store.js +17 -8
- package/lib/store/store.js.map +1 -0
- package/lib/store/task.d.ts +63 -0
- package/lib/store/task.d.ts.map +1 -0
- package/lib/store/task.js +5 -0
- package/lib/store/task.js.map +1 -0
- package/lib/store/temporalio.d.ts +17 -0
- package/lib/store/temporalio.d.ts.map +1 -0
- package/lib/{esm/store → store}/temporalio.js +6 -6
- package/lib/store/temporalio.js.map +1 -0
- package/lib/{types/store → store}/workflow.d.ts +87 -33
- package/lib/store/workflow.d.ts.map +1 -0
- package/lib/{esm/store → store}/workflow.js +36 -37
- package/lib/store/workflow.js.map +1 -0
- package/lib/{types/sts-token-types.d.ts → sts-token-types.d.ts} +29 -2
- package/lib/sts-token-types.d.ts.map +1 -0
- package/lib/{esm/sts-token-types.js → sts-token-types.js} +0 -4
- package/lib/sts-token-types.js.map +1 -0
- package/lib/{types/tenant.d.ts → tenant.d.ts} +1 -0
- package/lib/tenant.d.ts.map +1 -0
- package/lib/tenant.js.map +1 -0
- package/lib/{types/tool-execution.d.ts → tool-execution.d.ts} +3 -2
- package/lib/tool-execution.d.ts.map +1 -0
- package/lib/tool-execution.js.map +1 -0
- package/lib/tools.d.ts +101 -0
- package/lib/tools.d.ts.map +1 -0
- package/lib/tools.js +2 -0
- package/lib/tools.js.map +1 -0
- package/lib/{types/training.d.ts → training.d.ts} +10 -9
- package/lib/training.d.ts.map +1 -0
- package/lib/training.js.map +1 -0
- package/lib/{types/transient-tokens.d.ts → transient-tokens.d.ts} +3 -2
- package/lib/transient-tokens.d.ts.map +1 -0
- package/lib/transient-tokens.js.map +1 -0
- package/lib/{types/user.d.ts → user.d.ts} +6 -9
- package/lib/user.d.ts.map +1 -0
- package/lib/{esm/user.js → user.js} +2 -2
- package/lib/user.js.map +1 -0
- package/lib/{types/utils → utils}/auth.d.ts +2 -1
- package/lib/utils/auth.d.ts.map +1 -0
- package/lib/{esm/utils → utils}/auth.js +1 -1
- package/lib/utils/auth.js.map +1 -0
- package/lib/{types/utils → utils}/schemas.d.ts +5 -4
- package/lib/utils/schemas.d.ts.map +1 -0
- package/lib/{esm/utils → utils}/schemas.js +24 -22
- package/lib/utils/schemas.js.map +1 -0
- package/lib/{types/utils → utils}/type-helpers.d.ts +1 -0
- package/lib/utils/type-helpers.d.ts.map +1 -0
- package/lib/{cjs/utils → utils}/type-helpers.js.map +1 -1
- package/lib/{types/versions.d.ts → versions.d.ts} +1 -0
- package/lib/versions.d.ts.map +1 -0
- package/lib/versions.js.map +1 -0
- package/lib/vertesia-common.js +1 -1
- package/lib/vertesia-common.js.map +1 -1
- package/lib/{types/workflow-analytics.d.ts → workflow-analytics.d.ts} +10 -3
- package/lib/workflow-analytics.d.ts.map +1 -0
- package/lib/workflow-analytics.js.map +1 -0
- package/package.json +19 -19
- package/src/Progress.ts +9 -7
- package/src/access-control.ts +66 -70
- package/src/agent-request-template.test.ts +40 -0
- package/src/agent-request-template.ts +45 -0
- package/src/analytics.ts +11 -16
- package/src/apikey.ts +28 -12
- package/src/apps.test.ts +37 -0
- package/src/apps.ts +562 -78
- package/src/audit-trail.ts +3 -5
- package/src/browser-credentials.ts +133 -0
- package/src/channels.ts +5 -5
- package/src/common.ts +17 -11
- package/src/cost-analytics.ts +10 -4
- package/src/data-platform.ts +142 -7
- package/src/email.ts +7 -4
- package/src/embeddings.ts +76 -0
- package/src/environment.ts +44 -25
- package/src/facets.ts +19 -21
- package/src/group.ts +4 -5
- package/src/host-utils.test.ts +61 -0
- package/src/host-utils.ts +93 -0
- package/src/index.ts +18 -10
- package/src/integrations.ts +134 -26
- package/src/interaction.ts +185 -141
- package/src/json-schema.ts +1 -1
- package/src/json.ts +6 -3
- package/src/meters.ts +6 -9
- package/src/model_utility.ts +1 -1
- package/src/oauth-scopes.ts +72 -0
- package/src/oauth-server.ts +65 -8
- package/src/payload.ts +6 -6
- package/src/pending-asks.ts +8 -1
- package/src/principal-context.ts +27 -0
- package/src/project.ts +383 -75
- package/src/prompt.ts +30 -27
- package/src/query.ts +19 -17
- package/src/rate-limiter.ts +1 -1
- package/src/refs.ts +19 -24
- package/src/roles.test.ts +30 -0
- package/src/roles.ts +251 -0
- package/src/runs.ts +14 -15
- package/src/secrets.ts +60 -0
- package/src/skill.ts +1 -2
- package/src/store/activity-catalog.ts +13 -1
- package/src/store/agent-run.ts +269 -42
- package/src/store/collections.ts +13 -13
- package/src/store/common.ts +1 -2
- package/src/store/conversation-state.ts +42 -5
- package/src/store/doc-analyzer.ts +22 -14
- package/src/store/dsl-workflow.ts +54 -29
- package/src/store/hive-memory.ts +10 -10
- package/src/store/index.ts +19 -17
- package/src/store/ms.d.ts +34 -3
- package/src/store/object-types.ts +75 -79
- package/src/store/process-schema.test.ts +106 -0
- package/src/store/process-schema.ts +485 -0
- package/src/store/process-validation.test.ts +432 -0
- package/src/store/process-validation.ts +548 -0
- package/src/store/process.ts +305 -0
- package/src/store/rendering.ts +12 -12
- package/src/store/schedule.ts +3 -3
- package/src/store/signals.ts +1 -1
- package/src/store/store.ts +115 -89
- package/src/store/task.ts +71 -0
- package/src/store/temporalio.ts +14 -14
- package/src/store/workflow.test.ts +16 -14
- package/src/store/workflow.ts +177 -119
- package/src/sts-token-types.ts +30 -4
- package/src/tool-execution.ts +2 -2
- package/src/tools.ts +103 -0
- package/src/training.ts +25 -27
- package/src/transient-tokens.ts +4 -7
- package/src/user.ts +18 -37
- package/src/utils/auth.ts +2 -2
- package/src/utils/schemas.ts +36 -31
- package/src/utils/type-helpers.ts +2 -4
- package/src/workflow-analytics.ts +15 -18
- package/lib/cjs/Progress.js +0 -61
- package/lib/cjs/Progress.js.map +0 -1
- package/lib/cjs/access-control.js +0 -91
- package/lib/cjs/access-control.js.map +0 -1
- package/lib/cjs/analytics.js +0 -3
- package/lib/cjs/apikey.js +0 -17
- package/lib/cjs/apikey.js.map +0 -1
- package/lib/cjs/apps.js +0 -89
- package/lib/cjs/apps.js.map +0 -1
- package/lib/cjs/ask-user.js +0 -8
- package/lib/cjs/ask-user.js.map +0 -1
- package/lib/cjs/audit-trail.js +0 -10
- package/lib/cjs/audit-trail.js.map +0 -1
- package/lib/cjs/channels.js +0 -63
- package/lib/cjs/channels.js.map +0 -1
- package/lib/cjs/common.js +0 -3
- package/lib/cjs/cost-analytics.js +0 -13
- package/lib/cjs/cost-analytics.js.map +0 -1
- package/lib/cjs/data-platform.js +0 -127
- package/lib/cjs/data-platform.js.map +0 -1
- package/lib/cjs/email.js +0 -20
- package/lib/cjs/email.js.map +0 -1
- package/lib/cjs/environment.js +0 -44
- package/lib/cjs/environment.js.map +0 -1
- package/lib/cjs/facets.js +0 -3
- package/lib/cjs/facets.js.map +0 -1
- package/lib/cjs/group.js +0 -6
- package/lib/cjs/group.js.map +0 -1
- package/lib/cjs/index.js +0 -60
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/integrations.js +0 -16
- package/lib/cjs/integrations.js.map +0 -1
- package/lib/cjs/interaction.js +0 -101
- package/lib/cjs/interaction.js.map +0 -1
- package/lib/cjs/json-schema.js +0 -3
- package/lib/cjs/json.js +0 -3
- package/lib/cjs/json.js.map +0 -1
- package/lib/cjs/meters.js +0 -13
- package/lib/cjs/meters.js.map +0 -1
- package/lib/cjs/model_utility.js +0 -6
- package/lib/cjs/model_utility.js.map +0 -1
- package/lib/cjs/oauth-server.js +0 -3
- package/lib/cjs/oauth.js +0 -7
- package/lib/cjs/oauth.js.map +0 -1
- package/lib/cjs/openapi.js +0 -3
- package/lib/cjs/openapi.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/payload.js +0 -3
- package/lib/cjs/pending-asks.js +0 -7
- package/lib/cjs/pending-asks.js.map +0 -1
- package/lib/cjs/project.js +0 -143
- package/lib/cjs/project.js.map +0 -1
- package/lib/cjs/prompt.js +0 -21
- package/lib/cjs/prompt.js.map +0 -1
- package/lib/cjs/query.js +0 -3
- package/lib/cjs/query.js.map +0 -1
- package/lib/cjs/rate-limiter.js +0 -6
- package/lib/cjs/rate-limiter.js.map +0 -1
- package/lib/cjs/refs.js +0 -14
- package/lib/cjs/refs.js.map +0 -1
- package/lib/cjs/runs.js +0 -3
- package/lib/cjs/runs.js.map +0 -1
- package/lib/cjs/skill.js +0 -14
- package/lib/cjs/skill.js.map +0 -1
- package/lib/cjs/store/activity-catalog.js +0 -3
- package/lib/cjs/store/activity-catalog.js.map +0 -1
- package/lib/cjs/store/agent-run.js +0 -16
- package/lib/cjs/store/agent-run.js.map +0 -1
- package/lib/cjs/store/collections.js +0 -9
- package/lib/cjs/store/collections.js.map +0 -1
- package/lib/cjs/store/common.js +0 -3
- package/lib/cjs/store/common.js.map +0 -1
- package/lib/cjs/store/conversation-state.js +0 -19
- package/lib/cjs/store/conversation-state.js.map +0 -1
- package/lib/cjs/store/doc-analyzer.js +0 -3
- package/lib/cjs/store/dsl-workflow.js +0 -5
- package/lib/cjs/store/dsl-workflow.js.map +0 -1
- package/lib/cjs/store/hive-memory.js +0 -3
- package/lib/cjs/store/index.js +0 -33
- package/lib/cjs/store/index.js.map +0 -1
- package/lib/cjs/store/object-types.js +0 -98
- package/lib/cjs/store/object-types.js.map +0 -1
- package/lib/cjs/store/rendering.js +0 -26
- package/lib/cjs/store/rendering.js.map +0 -1
- package/lib/cjs/store/schedule.js +0 -32
- package/lib/cjs/store/schedule.js.map +0 -1
- package/lib/cjs/store/signals.js +0 -3
- package/lib/cjs/store/store.js +0 -182
- package/lib/cjs/store/store.js.map +0 -1
- package/lib/cjs/store/temporalio.js +0 -44
- package/lib/cjs/store/temporalio.js.map +0 -1
- package/lib/cjs/store/worker.js +0 -3
- package/lib/cjs/store/worker.js.map +0 -1
- package/lib/cjs/store/workflow.js +0 -306
- package/lib/cjs/store/workflow.js.map +0 -1
- package/lib/cjs/sts-token-types.js +0 -32
- package/lib/cjs/sts-token-types.js.map +0 -1
- package/lib/cjs/tenant.js +0 -3
- package/lib/cjs/tenant.js.map +0 -1
- package/lib/cjs/tool-execution.js +0 -6
- package/lib/cjs/tool-execution.js.map +0 -1
- package/lib/cjs/training.js +0 -14
- package/lib/cjs/training.js.map +0 -1
- package/lib/cjs/transient-tokens.js +0 -9
- package/lib/cjs/transient-tokens.js.map +0 -1
- package/lib/cjs/user.js +0 -26
- package/lib/cjs/user.js.map +0 -1
- package/lib/cjs/utils/auth.js +0 -15
- package/lib/cjs/utils/auth.js.map +0 -1
- package/lib/cjs/utils/schemas.js +0 -182
- package/lib/cjs/utils/schemas.js.map +0 -1
- package/lib/cjs/utils/type-helpers.js +0 -3
- package/lib/cjs/versions.js +0 -10
- package/lib/cjs/versions.js.map +0 -1
- package/lib/cjs/workflow-analytics.js +0 -52
- package/lib/cjs/workflow-analytics.js.map +0 -1
- package/lib/esm/Progress.js.map +0 -1
- package/lib/esm/access-control.js.map +0 -1
- package/lib/esm/analytics.js.map +0 -1
- package/lib/esm/apikey.js.map +0 -1
- package/lib/esm/apps.js +0 -79
- package/lib/esm/apps.js.map +0 -1
- package/lib/esm/audit-trail.js +0 -7
- package/lib/esm/audit-trail.js.map +0 -1
- package/lib/esm/channels.js.map +0 -1
- package/lib/esm/common.js.map +0 -1
- package/lib/esm/cost-analytics.js.map +0 -1
- package/lib/esm/data-platform.js.map +0 -1
- package/lib/esm/email.js.map +0 -1
- package/lib/esm/environment.js.map +0 -1
- package/lib/esm/facets.js.map +0 -1
- package/lib/esm/group.js.map +0 -1
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/integrations.js.map +0 -1
- package/lib/esm/interaction.js.map +0 -1
- package/lib/esm/json-schema.js.map +0 -1
- package/lib/esm/json.js.map +0 -1
- package/lib/esm/meters.js.map +0 -1
- package/lib/esm/model_utility.js +0 -2
- package/lib/esm/model_utility.js.map +0 -1
- package/lib/esm/oauth-server.js.map +0 -1
- package/lib/esm/oauth.js.map +0 -1
- package/lib/esm/openapi.js +0 -2
- package/lib/esm/openapi.js.map +0 -1
- package/lib/esm/payload.js.map +0 -1
- package/lib/esm/pending-asks.js.map +0 -1
- package/lib/esm/project.js +0 -138
- package/lib/esm/project.js.map +0 -1
- package/lib/esm/prompt.js.map +0 -1
- package/lib/esm/query.js.map +0 -1
- package/lib/esm/rate-limiter.js.map +0 -1
- package/lib/esm/refs.js.map +0 -1
- package/lib/esm/runs.js.map +0 -1
- package/lib/esm/skill.js.map +0 -1
- package/lib/esm/store/activity-catalog.js.map +0 -1
- package/lib/esm/store/agent-run.js.map +0 -1
- package/lib/esm/store/collections.js.map +0 -1
- package/lib/esm/store/common.js.map +0 -1
- package/lib/esm/store/conversation-state.js.map +0 -1
- package/lib/esm/store/doc-analyzer.js.map +0 -1
- package/lib/esm/store/dsl-workflow.js +0 -2
- package/lib/esm/store/dsl-workflow.js.map +0 -1
- package/lib/esm/store/hive-memory.js.map +0 -1
- package/lib/esm/store/index.js +0 -17
- package/lib/esm/store/index.js.map +0 -1
- package/lib/esm/store/object-types.js +0 -95
- package/lib/esm/store/object-types.js.map +0 -1
- package/lib/esm/store/rendering.js.map +0 -1
- package/lib/esm/store/schedule.js.map +0 -1
- package/lib/esm/store/signals.js.map +0 -1
- package/lib/esm/store/store.js.map +0 -1
- package/lib/esm/store/temporalio.js.map +0 -1
- package/lib/esm/store/worker.js +0 -2
- package/lib/esm/store/worker.js.map +0 -1
- package/lib/esm/store/workflow.js.map +0 -1
- package/lib/esm/sts-token-types.js.map +0 -1
- package/lib/esm/tenant.js.map +0 -1
- package/lib/esm/tool-execution.js.map +0 -1
- package/lib/esm/training.js.map +0 -1
- package/lib/esm/transient-tokens.js.map +0 -1
- package/lib/esm/user.js.map +0 -1
- package/lib/esm/utils/auth.js.map +0 -1
- package/lib/esm/utils/schemas.js.map +0 -1
- package/lib/esm/utils/type-helpers.js.map +0 -1
- package/lib/esm/versions.js.map +0 -1
- package/lib/esm/workflow-analytics.js.map +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/lib/types/Progress.d.ts.map +0 -1
- package/lib/types/access-control.d.ts.map +0 -1
- package/lib/types/analytics.d.ts.map +0 -1
- package/lib/types/apikey.d.ts.map +0 -1
- package/lib/types/apps.d.ts.map +0 -1
- package/lib/types/ask-user.d.ts.map +0 -1
- package/lib/types/audit-trail.d.ts.map +0 -1
- package/lib/types/channels.d.ts.map +0 -1
- package/lib/types/common.d.ts.map +0 -1
- package/lib/types/cost-analytics.d.ts.map +0 -1
- package/lib/types/data-platform.d.ts.map +0 -1
- package/lib/types/email.d.ts.map +0 -1
- package/lib/types/environment.d.ts.map +0 -1
- package/lib/types/facets.d.ts.map +0 -1
- package/lib/types/group.d.ts.map +0 -1
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/integrations.d.ts +0 -83
- package/lib/types/integrations.d.ts.map +0 -1
- package/lib/types/interaction.d.ts.map +0 -1
- package/lib/types/json-schema.d.ts +0 -1
- package/lib/types/json-schema.d.ts.map +0 -1
- package/lib/types/json.d.ts +0 -1
- package/lib/types/json.d.ts.map +0 -1
- package/lib/types/meters.d.ts.map +0 -1
- package/lib/types/model_utility.d.ts +0 -1
- package/lib/types/model_utility.d.ts.map +0 -1
- package/lib/types/oauth-server.d.ts.map +0 -1
- package/lib/types/oauth.d.ts.map +0 -1
- package/lib/types/openapi.d.ts +0 -90
- package/lib/types/openapi.d.ts.map +0 -1
- package/lib/types/payload.d.ts.map +0 -1
- package/lib/types/pending-asks.d.ts.map +0 -1
- package/lib/types/project.d.ts.map +0 -1
- package/lib/types/prompt.d.ts.map +0 -1
- package/lib/types/query.d.ts.map +0 -1
- package/lib/types/rate-limiter.d.ts.map +0 -1
- package/lib/types/refs.d.ts.map +0 -1
- package/lib/types/runs.d.ts.map +0 -1
- package/lib/types/skill.d.ts.map +0 -1
- package/lib/types/store/activity-catalog.d.ts.map +0 -1
- package/lib/types/store/agent-run.d.ts.map +0 -1
- package/lib/types/store/collections.d.ts.map +0 -1
- package/lib/types/store/common.d.ts.map +0 -1
- package/lib/types/store/conversation-state.d.ts.map +0 -1
- package/lib/types/store/doc-analyzer.d.ts.map +0 -1
- package/lib/types/store/dsl-workflow.d.ts.map +0 -1
- package/lib/types/store/hive-memory.d.ts.map +0 -1
- package/lib/types/store/index.d.ts +0 -16
- package/lib/types/store/index.d.ts.map +0 -1
- package/lib/types/store/object-types.d.ts.map +0 -1
- package/lib/types/store/rendering.d.ts.map +0 -1
- package/lib/types/store/schedule.d.ts.map +0 -1
- package/lib/types/store/signals.d.ts.map +0 -1
- package/lib/types/store/store.d.ts.map +0 -1
- package/lib/types/store/temporalio.d.ts +0 -16
- package/lib/types/store/temporalio.d.ts.map +0 -1
- package/lib/types/store/worker.d.ts +0 -18
- package/lib/types/store/worker.d.ts.map +0 -1
- package/lib/types/store/workflow.d.ts.map +0 -1
- package/lib/types/sts-token-types.d.ts.map +0 -1
- package/lib/types/tenant.d.ts.map +0 -1
- package/lib/types/tool-execution.d.ts.map +0 -1
- package/lib/types/training.d.ts.map +0 -1
- package/lib/types/transient-tokens.d.ts.map +0 -1
- package/lib/types/user.d.ts.map +0 -1
- package/lib/types/utils/auth.d.ts.map +0 -1
- package/lib/types/utils/schemas.d.ts.map +0 -1
- package/lib/types/utils/type-helpers.d.ts.map +0 -1
- package/lib/types/versions.d.ts.map +0 -1
- package/lib/types/workflow-analytics.d.ts.map +0 -1
- package/src/openapi.ts +0 -102
- package/src/store/worker.ts +0 -19
- /package/lib/{esm/analytics.js → analytics.js} +0 -0
- /package/lib/{esm/ask-user.js → ask-user.js} +0 -0
- /package/lib/{esm/common.js → common.js} +0 -0
- /package/lib/{esm/cost-analytics.js → cost-analytics.js} +0 -0
- /package/lib/{esm/data-platform.js → data-platform.js} +0 -0
- /package/lib/{esm/facets.js → facets.js} +0 -0
- /package/lib/{esm/group.js → group.js} +0 -0
- /package/lib/{esm/json-schema.js → json-schema.js} +0 -0
- /package/lib/{esm/json.js → json.js} +0 -0
- /package/lib/{esm/meters.js → meters.js} +0 -0
- /package/lib/{esm/oauth-server.js → oauth-server.js} +0 -0
- /package/lib/{esm/oauth.js → oauth.js} +0 -0
- /package/lib/{esm/payload.js → payload.js} +0 -0
- /package/lib/{esm/pending-asks.js → pending-asks.js} +0 -0
- /package/lib/{esm/prompt.js → prompt.js} +0 -0
- /package/lib/{esm/query.js → query.js} +0 -0
- /package/lib/{esm/rate-limiter.js → rate-limiter.js} +0 -0
- /package/lib/{esm/refs.js → refs.js} +0 -0
- /package/lib/{esm/runs.js → runs.js} +0 -0
- /package/lib/{esm/skill.js → skill.js} +0 -0
- /package/lib/{esm/store → store}/activity-catalog.js +0 -0
- /package/lib/{esm/store → store}/agent-run.js +0 -0
- /package/lib/{esm/store → store}/collections.js +0 -0
- /package/lib/{esm/store → store}/common.js +0 -0
- /package/lib/{esm/store → store}/doc-analyzer.js +0 -0
- /package/lib/{esm/store → store}/hive-memory.js +0 -0
- /package/lib/{esm/store → store}/schedule.js +0 -0
- /package/lib/{esm/store → store}/signals.js +0 -0
- /package/lib/{esm/tenant.js → tenant.js} +0 -0
- /package/lib/{esm/tool-execution.js → tool-execution.js} +0 -0
- /package/lib/{esm/training.js → training.js} +0 -0
- /package/lib/{esm/transient-tokens.js → transient-tokens.js} +0 -0
- /package/lib/{esm/utils → utils}/type-helpers.js +0 -0
- /package/lib/{esm/versions.js → versions.js} +0 -0
- /package/lib/{esm/workflow-analytics.js → workflow-analytics.js} +0 -0
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { PROCESS_DEFINITION_FORMAT_VERSION, type ProcessDefinitionBody } from './process.js';
|
|
3
|
+
import {
|
|
4
|
+
getProcessDefinitionValidationResult,
|
|
5
|
+
getProcessInteractionValidationSelectors,
|
|
6
|
+
MAX_PROCESS_GUARD_DEPTH,
|
|
7
|
+
MAX_PROCESS_GUARD_NODES,
|
|
8
|
+
validateProcessDefinitionBody,
|
|
9
|
+
} from './process-validation.js';
|
|
10
|
+
|
|
11
|
+
function validDefinition(): ProcessDefinitionBody {
|
|
12
|
+
return {
|
|
13
|
+
format_version: PROCESS_DEFINITION_FORMAT_VERSION,
|
|
14
|
+
process: 'approval',
|
|
15
|
+
initial: 'review',
|
|
16
|
+
metadata: {
|
|
17
|
+
provenance: {
|
|
18
|
+
bpmn: {
|
|
19
|
+
process_id: 'ApprovalProcess',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
context: {
|
|
24
|
+
schema: {
|
|
25
|
+
type: 'object',
|
|
26
|
+
properties: {
|
|
27
|
+
approved: { type: 'boolean' },
|
|
28
|
+
},
|
|
29
|
+
required: ['approved'],
|
|
30
|
+
additionalProperties: false,
|
|
31
|
+
},
|
|
32
|
+
initial: { approved: false },
|
|
33
|
+
},
|
|
34
|
+
nodes: {
|
|
35
|
+
review: {
|
|
36
|
+
type: 'human_task',
|
|
37
|
+
task: {
|
|
38
|
+
title: 'Review',
|
|
39
|
+
fields: [{ name: 'approved', type: 'boolean', required: true }],
|
|
40
|
+
},
|
|
41
|
+
transitions: [{ to: 'approved', trigger: 'user', metadata: { edge_kind: 'default' } }],
|
|
42
|
+
},
|
|
43
|
+
approved: {
|
|
44
|
+
type: 'final',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
describe('process definition validation', () => {
|
|
51
|
+
it('accepts a structurally valid definition', () => {
|
|
52
|
+
expect(() => validateProcessDefinitionBody(validDefinition())).not.toThrow();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('rejects missing transition targets', () => {
|
|
56
|
+
const definition = validDefinition();
|
|
57
|
+
definition.nodes.review.transitions = [{ to: 'missing' }];
|
|
58
|
+
|
|
59
|
+
expect(() => validateProcessDefinitionBody(definition)).toThrow(
|
|
60
|
+
'node "review" has transition to "missing" which does not exist',
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('rejects missing branch targets', () => {
|
|
65
|
+
const definition = validDefinition();
|
|
66
|
+
definition.nodes.review.type = 'condition';
|
|
67
|
+
definition.nodes.review.task = undefined;
|
|
68
|
+
definition.nodes.review.transitions = undefined;
|
|
69
|
+
definition.nodes.review.branches = [{ to: 'missing', default: true }];
|
|
70
|
+
|
|
71
|
+
expect(() => validateProcessDefinitionBody(definition)).toThrow(
|
|
72
|
+
'node "review" has branch to "missing" which does not exist',
|
|
73
|
+
);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('rejects unsupported foreach child node types', () => {
|
|
77
|
+
const definition = validDefinition();
|
|
78
|
+
definition.initial = 'fanout';
|
|
79
|
+
definition.context.schema = {
|
|
80
|
+
type: 'object',
|
|
81
|
+
properties: {
|
|
82
|
+
items: { type: 'array', items: { type: 'string' } },
|
|
83
|
+
},
|
|
84
|
+
additionalProperties: true,
|
|
85
|
+
};
|
|
86
|
+
definition.context.initial = { items: [] };
|
|
87
|
+
definition.nodes = {
|
|
88
|
+
fanout: {
|
|
89
|
+
type: 'foreach',
|
|
90
|
+
foreach: 'items',
|
|
91
|
+
node: {
|
|
92
|
+
type: 'human_task',
|
|
93
|
+
task: {
|
|
94
|
+
title: 'Review',
|
|
95
|
+
fields: [],
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
transitions: [{ to: 'approved' }],
|
|
99
|
+
},
|
|
100
|
+
approved: {
|
|
101
|
+
type: 'final',
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
expect(() => validateProcessDefinitionBody(definition)).toThrow(
|
|
106
|
+
'foreach node "fanout" has unsupported child node type "human_task"',
|
|
107
|
+
);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('accepts process nodes as standalone nodes and foreach children', () => {
|
|
111
|
+
const child = validDefinition();
|
|
112
|
+
child.process = 'child_approval';
|
|
113
|
+
|
|
114
|
+
const definition = validDefinition();
|
|
115
|
+
definition.initial = 'fanout';
|
|
116
|
+
definition.context.schema = {
|
|
117
|
+
type: 'object',
|
|
118
|
+
properties: {
|
|
119
|
+
items: { type: 'array', items: { type: 'object' } },
|
|
120
|
+
results: { type: 'array' },
|
|
121
|
+
},
|
|
122
|
+
additionalProperties: true,
|
|
123
|
+
};
|
|
124
|
+
definition.context.initial = { items: [] };
|
|
125
|
+
definition.nodes = {
|
|
126
|
+
fanout: {
|
|
127
|
+
type: 'foreach',
|
|
128
|
+
foreach: 'items',
|
|
129
|
+
as: 'item',
|
|
130
|
+
item_id: '{{item.id}}',
|
|
131
|
+
max_concurrency: 10,
|
|
132
|
+
collect: {
|
|
133
|
+
into: 'results',
|
|
134
|
+
include: ['status', 'index', 'item_id', 'output', 'child_run_id'],
|
|
135
|
+
},
|
|
136
|
+
node: {
|
|
137
|
+
type: 'process',
|
|
138
|
+
process_definition: child,
|
|
139
|
+
input: { invoice: '{{item}}' },
|
|
140
|
+
returns: { from: 'context.approved' },
|
|
141
|
+
},
|
|
142
|
+
transitions: [{ to: 'approved' }],
|
|
143
|
+
},
|
|
144
|
+
approved: {
|
|
145
|
+
type: 'final',
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
expect(() => validateProcessDefinitionBody(definition)).not.toThrow();
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('rejects fanout child nodes that define their own transitions', () => {
|
|
153
|
+
const child = validDefinition();
|
|
154
|
+
child.process = 'child_approval';
|
|
155
|
+
|
|
156
|
+
const definition = validDefinition();
|
|
157
|
+
definition.initial = 'fanout';
|
|
158
|
+
definition.context.schema = {
|
|
159
|
+
type: 'object',
|
|
160
|
+
properties: {
|
|
161
|
+
items: { type: 'array', items: { type: 'object' } },
|
|
162
|
+
},
|
|
163
|
+
additionalProperties: true,
|
|
164
|
+
};
|
|
165
|
+
definition.context.initial = { items: [] };
|
|
166
|
+
definition.nodes = {
|
|
167
|
+
fanout: {
|
|
168
|
+
type: 'foreach',
|
|
169
|
+
foreach: 'items',
|
|
170
|
+
node: {
|
|
171
|
+
type: 'process',
|
|
172
|
+
process_definition: child,
|
|
173
|
+
transitions: [{ to: 'approved' }],
|
|
174
|
+
},
|
|
175
|
+
transitions: [{ to: 'approved' }],
|
|
176
|
+
},
|
|
177
|
+
approved: {
|
|
178
|
+
type: 'final',
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
expect(() => validateProcessDefinitionBody(definition)).toThrow(
|
|
183
|
+
'foreach node "fanout" child node must not define transitions',
|
|
184
|
+
);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('rejects process nodes without a referenced or inline process', () => {
|
|
188
|
+
const definition = validDefinition();
|
|
189
|
+
definition.nodes.review = {
|
|
190
|
+
type: 'process',
|
|
191
|
+
transitions: [{ to: 'approved' }],
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
expect(() => validateProcessDefinitionBody(definition)).toThrow(
|
|
195
|
+
'process node "review" is missing process or process_definition',
|
|
196
|
+
);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('rejects set_context nodes that omit the updates envelope', () => {
|
|
200
|
+
const definition = validDefinition();
|
|
201
|
+
definition.nodes.review = {
|
|
202
|
+
type: 'tool',
|
|
203
|
+
tool: 'set_context',
|
|
204
|
+
input: {
|
|
205
|
+
approved: true,
|
|
206
|
+
},
|
|
207
|
+
writes: ['approved'],
|
|
208
|
+
transitions: [{ to: 'approved' }],
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
const result = getProcessDefinitionValidationResult(definition);
|
|
212
|
+
|
|
213
|
+
expect(result.valid).toBe(false);
|
|
214
|
+
expect(result.errors).toContain('tool node "review" set_context input has unsupported property "approved"');
|
|
215
|
+
expect(result.errors).toContain('tool node "review" set_context input.updates must be an object');
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
it('accepts set_context nodes with the updates envelope', () => {
|
|
219
|
+
const definition = validDefinition();
|
|
220
|
+
definition.nodes.review = {
|
|
221
|
+
type: 'tool',
|
|
222
|
+
tool: 'set_context',
|
|
223
|
+
input: {
|
|
224
|
+
updates: {
|
|
225
|
+
approved: true,
|
|
226
|
+
},
|
|
227
|
+
reason: 'mark approved in validation test',
|
|
228
|
+
},
|
|
229
|
+
writes: ['approved'],
|
|
230
|
+
transitions: [{ to: 'approved' }],
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
expect(() => validateProcessDefinitionBody(definition)).not.toThrow();
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
it('rejects set_context nodes that write undeclared or internal fields', () => {
|
|
237
|
+
const definition = validDefinition();
|
|
238
|
+
definition.nodes.review = {
|
|
239
|
+
type: 'tool',
|
|
240
|
+
tool: 'set_context',
|
|
241
|
+
input: {
|
|
242
|
+
updates: {
|
|
243
|
+
approved: true,
|
|
244
|
+
_current_node: 'approved',
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
writes: ['decision'],
|
|
248
|
+
transitions: [{ to: 'approved' }],
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
const result = getProcessDefinitionValidationResult(definition);
|
|
252
|
+
|
|
253
|
+
expect(result.valid).toBe(false);
|
|
254
|
+
expect(result.errors).toContain(
|
|
255
|
+
'tool node "review" set_context updates "approved" but writes does not allow it',
|
|
256
|
+
);
|
|
257
|
+
expect(result.errors).toContain(
|
|
258
|
+
'tool node "review" set_context cannot write reserved context field "_current_node"',
|
|
259
|
+
);
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
it('rejects unknown tools when a runtime tool catalog is provided', () => {
|
|
263
|
+
const definition = validDefinition();
|
|
264
|
+
definition.nodes.review = {
|
|
265
|
+
type: 'tool',
|
|
266
|
+
tool: 'missing_tool',
|
|
267
|
+
input: {},
|
|
268
|
+
transitions: [{ to: 'approved' }],
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
const result = getProcessDefinitionValidationResult(definition, { knownTools: ['set_context'] });
|
|
272
|
+
|
|
273
|
+
expect(result.valid).toBe(false);
|
|
274
|
+
expect(result.errors).toContain('tool node "review" references unknown tool "missing_tool"');
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
it('rejects unknown interactions when a runtime interaction catalog is provided', () => {
|
|
278
|
+
const definition = validDefinition();
|
|
279
|
+
definition.nodes.review = {
|
|
280
|
+
type: 'interaction',
|
|
281
|
+
interaction: 'sys:MissingInteraction',
|
|
282
|
+
writes: ['approved'],
|
|
283
|
+
transitions: [{ to: 'approved' }],
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
const result = getProcessDefinitionValidationResult(definition, { knownInteractions: ['sys:GeneralAgent'] });
|
|
287
|
+
|
|
288
|
+
expect(result.valid).toBe(false);
|
|
289
|
+
expect(result.errors).toContain(
|
|
290
|
+
'interaction node "review" references unknown interaction "sys:MissingInteraction"',
|
|
291
|
+
);
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
it('rejects non-object result_schema on agent and interaction nodes', () => {
|
|
295
|
+
const definition = validDefinition();
|
|
296
|
+
definition.nodes.review = {
|
|
297
|
+
type: 'agent',
|
|
298
|
+
interaction: 'sys:GeneralAgent',
|
|
299
|
+
writes: ['approved'],
|
|
300
|
+
transitions: [{ to: 'approved' }],
|
|
301
|
+
};
|
|
302
|
+
Object.assign(definition.nodes.review, { result_schema: 'not a schema' });
|
|
303
|
+
|
|
304
|
+
const result = getProcessDefinitionValidationResult(definition);
|
|
305
|
+
|
|
306
|
+
expect(result.valid).toBe(false);
|
|
307
|
+
expect(result.errors).toContain('agent node "review" result_schema must be a JSON Schema object');
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
it('builds interaction selectors used by process validation', () => {
|
|
311
|
+
const selectors = getProcessInteractionValidationSelectors([
|
|
312
|
+
{ type: 'sys', id: 'sys:GeneralAgent', name: 'GeneralAgent', title: 'General agent', tags: [] },
|
|
313
|
+
{
|
|
314
|
+
type: 'stored',
|
|
315
|
+
id: '65f000000000000000000001',
|
|
316
|
+
name: 'contract-risk',
|
|
317
|
+
version: 3,
|
|
318
|
+
title: 'Contract risk',
|
|
319
|
+
tags: [],
|
|
320
|
+
},
|
|
321
|
+
{ type: 'app', id: 'claims/score', name: 'score_claim', title: 'Score claim', tags: [] },
|
|
322
|
+
]);
|
|
323
|
+
|
|
324
|
+
expect(selectors).toContain('sys:GeneralAgent');
|
|
325
|
+
expect(selectors).toContain('GeneralAgent');
|
|
326
|
+
expect(selectors).toContain('contract-risk@draft');
|
|
327
|
+
expect(selectors).toContain('65f000000000000000000001@3');
|
|
328
|
+
expect(selectors).toContain('app:claims/score');
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
it('rejects string branch conditions so broken definitions do not save', () => {
|
|
332
|
+
const definition = validDefinition();
|
|
333
|
+
const branchWithStringCondition = {
|
|
334
|
+
to: 'approved',
|
|
335
|
+
condition: 'context.approved == true',
|
|
336
|
+
};
|
|
337
|
+
definition.nodes.review.type = 'condition';
|
|
338
|
+
definition.nodes.review.task = undefined;
|
|
339
|
+
definition.nodes.review.transitions = undefined;
|
|
340
|
+
definition.nodes.review.branches = [branchWithStringCondition];
|
|
341
|
+
|
|
342
|
+
const result = getProcessDefinitionValidationResult(definition);
|
|
343
|
+
|
|
344
|
+
expect(result.valid).toBe(false);
|
|
345
|
+
expect(result.errors).toContain(
|
|
346
|
+
'node "review" branch at index 0 uses string condition; use JSON Logic in "when" instead',
|
|
347
|
+
);
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
it('rejects invalid foreach fanout controls', () => {
|
|
351
|
+
const definition = validDefinition();
|
|
352
|
+
definition.initial = 'fanout';
|
|
353
|
+
definition.context.schema = {
|
|
354
|
+
type: 'object',
|
|
355
|
+
properties: {
|
|
356
|
+
items: { type: 'array' },
|
|
357
|
+
},
|
|
358
|
+
additionalProperties: true,
|
|
359
|
+
};
|
|
360
|
+
definition.context.initial = { items: [] };
|
|
361
|
+
definition.nodes = {
|
|
362
|
+
fanout: {
|
|
363
|
+
type: 'foreach',
|
|
364
|
+
foreach: 'items',
|
|
365
|
+
max_concurrency: 0,
|
|
366
|
+
collect: {
|
|
367
|
+
into: '',
|
|
368
|
+
include: ['status'],
|
|
369
|
+
},
|
|
370
|
+
node: {
|
|
371
|
+
type: 'process',
|
|
372
|
+
process: '64f000000000000000000000',
|
|
373
|
+
},
|
|
374
|
+
transitions: [{ to: 'approved' }],
|
|
375
|
+
},
|
|
376
|
+
approved: {
|
|
377
|
+
type: 'final',
|
|
378
|
+
},
|
|
379
|
+
};
|
|
380
|
+
Object.assign(definition.nodes.fanout.collect ?? {}, { include: ['bogus'] });
|
|
381
|
+
|
|
382
|
+
const result = getProcessDefinitionValidationResult(definition);
|
|
383
|
+
|
|
384
|
+
expect(result.valid).toBe(false);
|
|
385
|
+
expect(result.errors).toContain('foreach node "fanout" max_concurrency must be a positive integer');
|
|
386
|
+
expect(result.errors).toContain('foreach node "fanout" collect.into is required');
|
|
387
|
+
expect(result.errors).toContain('foreach node "fanout" collect.include has invalid field "bogus"');
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
it('reports all structural errors without importing runtime schema validators', () => {
|
|
391
|
+
const definition = {
|
|
392
|
+
format_version: PROCESS_DEFINITION_FORMAT_VERSION,
|
|
393
|
+
process: '',
|
|
394
|
+
initial: 'missing',
|
|
395
|
+
context: {
|
|
396
|
+
schema: {},
|
|
397
|
+
initial: {},
|
|
398
|
+
},
|
|
399
|
+
nodes: {
|
|
400
|
+
review: {
|
|
401
|
+
type: 'human_task',
|
|
402
|
+
},
|
|
403
|
+
},
|
|
404
|
+
} satisfies ProcessDefinitionBody;
|
|
405
|
+
|
|
406
|
+
const result = getProcessDefinitionValidationResult(definition);
|
|
407
|
+
|
|
408
|
+
expect(result.valid).toBe(false);
|
|
409
|
+
expect(result.errors).toContain('initial node "missing" does not exist');
|
|
410
|
+
expect(result.errors).toContain('human_task node "review" is missing task');
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
it('rejects overly deep guard rules', () => {
|
|
414
|
+
const definition = validDefinition();
|
|
415
|
+
let guard: Record<string, unknown> = { var: 'approved' };
|
|
416
|
+
for (let index = 0; index < MAX_PROCESS_GUARD_DEPTH; index += 1) {
|
|
417
|
+
guard = { '!': [guard] };
|
|
418
|
+
}
|
|
419
|
+
definition.nodes.review.transitions = [{ to: 'approved', guard }];
|
|
420
|
+
|
|
421
|
+
expect(() => validateProcessDefinitionBody(definition)).toThrow('exceeds maximum depth');
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
it('rejects overly large guard rules', () => {
|
|
425
|
+
const definition = validDefinition();
|
|
426
|
+
definition.nodes.review.transitions = [
|
|
427
|
+
{ to: 'approved', guard: { and: Array.from({ length: MAX_PROCESS_GUARD_NODES + 1 }, () => true) } },
|
|
428
|
+
];
|
|
429
|
+
|
|
430
|
+
expect(() => validateProcessDefinitionBody(definition)).toThrow('exceeds maximum node count');
|
|
431
|
+
});
|
|
432
|
+
});
|