@vertesia/common 1.2.0 → 1.4.0-dev.20260614.160504Z
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/access-control.d.ts +144 -0
- package/lib/access-control.d.ts.map +1 -0
- package/lib/{esm/access-control.js → access-control.js} +35 -0
- 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} +34 -4
- 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} +19 -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} +15 -2
- package/lib/group.d.ts.map +1 -0
- package/lib/group.js +3 -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} +64 -4
- 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} +278 -49
- 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 +18 -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 +67 -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} +13 -7
- 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 +20 -20
- package/src/Progress.ts +9 -7
- package/src/access-control.ts +124 -55
- 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 +43 -11
- 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 +14 -3
- 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 +80 -5
- package/src/payload.ts +6 -6
- package/src/pending-asks.ts +8 -1
- package/src/principal-context.ts +27 -0
- package/src/project.ts +408 -101
- 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 +21 -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 +119 -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 +25 -35
- 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 -58
- 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 +0 -3
- 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 +0 -79
- 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/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,548 @@
|
|
|
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
|
+
|
|
47
|
+
export function validateProcessDefinitionBody(
|
|
48
|
+
definition: ProcessDefinitionBody,
|
|
49
|
+
options: ProcessDefinitionValidationOptions = {},
|
|
50
|
+
): void {
|
|
51
|
+
const result = getProcessDefinitionValidationResult(definition, options);
|
|
52
|
+
if (!result.valid) {
|
|
53
|
+
throw new Error(result.errors.join('; '));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function getProcessDefinitionValidationResult(
|
|
58
|
+
definition: ProcessDefinitionBody,
|
|
59
|
+
options: ProcessDefinitionValidationOptions = {},
|
|
60
|
+
): ProcessDefinitionValidationResult {
|
|
61
|
+
const errors: string[] = [];
|
|
62
|
+
const context = createValidationContext(options);
|
|
63
|
+
const size = new TextEncoder().encode(JSON.stringify(definition)).length;
|
|
64
|
+
if (size > MAX_PROCESS_DEFINITION_BYTES) {
|
|
65
|
+
errors.push(`process definition exceeds ${MAX_PROCESS_DEFINITION_BYTES} bytes`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (!definition.process) {
|
|
69
|
+
errors.push('process is missing');
|
|
70
|
+
}
|
|
71
|
+
if (definition.format_version !== PROCESS_DEFINITION_FORMAT_VERSION) {
|
|
72
|
+
errors.push(`format_version must be ${PROCESS_DEFINITION_FORMAT_VERSION}`);
|
|
73
|
+
}
|
|
74
|
+
if (!definition.initial) {
|
|
75
|
+
errors.push('initial node is missing');
|
|
76
|
+
}
|
|
77
|
+
if (!definition.nodes || Object.keys(definition.nodes).length === 0) {
|
|
78
|
+
errors.push('nodes are missing');
|
|
79
|
+
} else if (definition.initial && !definition.nodes[definition.initial]) {
|
|
80
|
+
errors.push(`initial node "${definition.initial}" does not exist`);
|
|
81
|
+
}
|
|
82
|
+
if (!definition.context?.schema) {
|
|
83
|
+
errors.push('context.schema is missing');
|
|
84
|
+
}
|
|
85
|
+
if (!definition.context?.initial) {
|
|
86
|
+
errors.push('context.initial is missing');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
for (const [nodeId, node] of Object.entries(definition.nodes ?? {})) {
|
|
90
|
+
validateNodeDefinition(definition, nodeId, node, errors, context);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
valid: errors.length === 0,
|
|
95
|
+
errors,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function validateNodeDefinition(
|
|
100
|
+
definition: ProcessDefinitionBody,
|
|
101
|
+
nodeId: string,
|
|
102
|
+
node: NodeDefinition,
|
|
103
|
+
errors: string[],
|
|
104
|
+
context: ProcessDefinitionValidationContext,
|
|
105
|
+
) {
|
|
106
|
+
if (!isProcessNodeType(node.type)) {
|
|
107
|
+
errors.push(`node "${nodeId}" has invalid type "${String(node.type)}"`);
|
|
108
|
+
}
|
|
109
|
+
if (node.type === 'human_task') {
|
|
110
|
+
if (!node.task) {
|
|
111
|
+
errors.push(`human_task node "${nodeId}" is missing task`);
|
|
112
|
+
} else if (!node.task.title) {
|
|
113
|
+
errors.push(`human_task node "${nodeId}" task title is missing`);
|
|
114
|
+
} else if (!Array.isArray(node.task.fields)) {
|
|
115
|
+
errors.push(`human_task node "${nodeId}" task fields must be an array`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (node.type === 'tool') {
|
|
119
|
+
validateToolNodeDefinition(nodeId, node, errors, context);
|
|
120
|
+
}
|
|
121
|
+
if ((node.type === 'interaction' || node.type === 'agent') && node.interaction && context.knownInteractions) {
|
|
122
|
+
if (!isKnownSelector(node.interaction, context.knownInteractions)) {
|
|
123
|
+
errors.push(`${node.type} node "${nodeId}" references unknown interaction "${node.interaction}"`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (
|
|
127
|
+
(node.type === 'interaction' || node.type === 'agent') &&
|
|
128
|
+
node.result_schema !== undefined &&
|
|
129
|
+
!isRecord(node.result_schema)
|
|
130
|
+
) {
|
|
131
|
+
errors.push(`${node.type} node "${nodeId}" result_schema must be a JSON Schema object`);
|
|
132
|
+
}
|
|
133
|
+
if (node.type === 'process') {
|
|
134
|
+
if (!node.process && !node.process_definition) {
|
|
135
|
+
errors.push(`process node "${nodeId}" is missing process or process_definition`);
|
|
136
|
+
}
|
|
137
|
+
if (node.run_type && !isProcessNodeRunType(node.run_type)) {
|
|
138
|
+
errors.push(`process node "${nodeId}" has invalid run_type "${String(node.run_type)}"`);
|
|
139
|
+
}
|
|
140
|
+
if (node.returns?.from !== undefined && typeof node.returns.from !== 'string') {
|
|
141
|
+
errors.push(`process node "${nodeId}" returns.from must be a string`);
|
|
142
|
+
}
|
|
143
|
+
if (node.returns?.context !== undefined && !isStringArray(node.returns.context)) {
|
|
144
|
+
errors.push(`process node "${nodeId}" returns.context must be an array of strings`);
|
|
145
|
+
}
|
|
146
|
+
if (node.process_definition) {
|
|
147
|
+
const childResult = getProcessDefinitionValidationResult(node.process_definition, context.options);
|
|
148
|
+
for (const error of childResult.errors) {
|
|
149
|
+
errors.push(`process node "${nodeId}" process_definition: ${error}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (node.type === 'foreach') {
|
|
154
|
+
if (!node.foreach) {
|
|
155
|
+
errors.push(`foreach node "${nodeId}" is missing foreach`);
|
|
156
|
+
}
|
|
157
|
+
if (!node.node) {
|
|
158
|
+
errors.push(`foreach node "${nodeId}" is missing node`);
|
|
159
|
+
}
|
|
160
|
+
if (
|
|
161
|
+
node.max_concurrency !== undefined &&
|
|
162
|
+
(!Number.isInteger(node.max_concurrency) || node.max_concurrency < 1)
|
|
163
|
+
) {
|
|
164
|
+
errors.push(`foreach node "${nodeId}" max_concurrency must be a positive integer`);
|
|
165
|
+
}
|
|
166
|
+
if (node.item_id !== undefined && typeof node.item_id !== 'string') {
|
|
167
|
+
errors.push(`foreach node "${nodeId}" item_id must be a string`);
|
|
168
|
+
}
|
|
169
|
+
validateCollectDefinition('foreach', nodeId, node.collect, errors);
|
|
170
|
+
if (node.node) {
|
|
171
|
+
validateFanoutChildNodeDefinition(
|
|
172
|
+
definition,
|
|
173
|
+
{
|
|
174
|
+
ownerLabel: `foreach node "${nodeId}"`,
|
|
175
|
+
childPath: `${nodeId}.node`,
|
|
176
|
+
childLabel: `foreach node "${nodeId}" child node`,
|
|
177
|
+
child: node.node,
|
|
178
|
+
},
|
|
179
|
+
errors,
|
|
180
|
+
context,
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (node.type === 'branch') {
|
|
185
|
+
if (!Array.isArray(node.branches) || node.branches.length === 0) {
|
|
186
|
+
errors.push(`branch node "${nodeId}" must define at least one branch`);
|
|
187
|
+
}
|
|
188
|
+
if (node.join !== undefined && node.join !== 'all') {
|
|
189
|
+
errors.push(`branch node "${nodeId}" join must be "all"`);
|
|
190
|
+
}
|
|
191
|
+
validateCollectDefinition('branch', nodeId, node.collect, errors);
|
|
192
|
+
const branches = getBranchNodeBranches(node);
|
|
193
|
+
const seenIds = new Set<string>();
|
|
194
|
+
for (const [index, branch] of branches.entries()) {
|
|
195
|
+
if (!branch.id) {
|
|
196
|
+
errors.push(`branch node "${nodeId}" branch at index ${index} is missing id`);
|
|
197
|
+
} else if (seenIds.has(branch.id)) {
|
|
198
|
+
errors.push(`branch node "${nodeId}" has duplicate branch id "${branch.id}"`);
|
|
199
|
+
} else {
|
|
200
|
+
seenIds.add(branch.id);
|
|
201
|
+
}
|
|
202
|
+
if (!branch.node) {
|
|
203
|
+
errors.push(`branch node "${nodeId}" branch "${branch.id || index}" is missing node`);
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
validateFanoutChildNodeDefinition(
|
|
207
|
+
definition,
|
|
208
|
+
{
|
|
209
|
+
ownerLabel: `branch node "${nodeId}" branch "${branch.id || index}"`,
|
|
210
|
+
childPath: `${nodeId}.branches.${index}.node`,
|
|
211
|
+
childLabel: `branch node "${nodeId}" branch "${branch.id || index}" child node`,
|
|
212
|
+
child: branch.node,
|
|
213
|
+
},
|
|
214
|
+
errors,
|
|
215
|
+
context,
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (node.failure_policy && !isParallelFailurePolicy(node.failure_policy)) {
|
|
220
|
+
errors.push(`node "${nodeId}" has invalid failure_policy "${String(node.failure_policy)}"`);
|
|
221
|
+
}
|
|
222
|
+
for (const transition of node.transitions ?? []) {
|
|
223
|
+
if (!definition.nodes[transition.to]) {
|
|
224
|
+
errors.push(`node "${nodeId}" has transition to "${transition.to}" which does not exist`);
|
|
225
|
+
}
|
|
226
|
+
if (transition.trigger && !isTransitionTrigger(transition.trigger)) {
|
|
227
|
+
errors.push(`node "${nodeId}" has invalid transition trigger "${transition.trigger}"`);
|
|
228
|
+
}
|
|
229
|
+
if (typeof transition.guard === 'string') {
|
|
230
|
+
errors.push(`node "${nodeId}" transition to "${transition.to}" guard must be a JSON Logic object`);
|
|
231
|
+
} else if (transition.guard) {
|
|
232
|
+
validateGuardRule(`node "${nodeId}" transition to "${transition.to}" guard`, transition.guard, errors);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
for (const [index, branch] of getConditionBranches(node).entries()) {
|
|
237
|
+
if (hasStringConditionProperty(branch, 'condition')) {
|
|
238
|
+
errors.push(
|
|
239
|
+
`node "${nodeId}" branch at index ${index} uses string condition; use JSON Logic in "when" instead`,
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
if (hasStringConditionProperty(branch, 'guard')) {
|
|
243
|
+
errors.push(
|
|
244
|
+
`node "${nodeId}" branch at index ${index} uses string guard; use JSON Logic in "when" instead`,
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
if (!definition.nodes[branch.to]) {
|
|
248
|
+
errors.push(`node "${nodeId}" has branch to "${branch.to}" which does not exist`);
|
|
249
|
+
}
|
|
250
|
+
if (typeof branch.when === 'string') {
|
|
251
|
+
errors.push(`node "${nodeId}" branch to "${branch.to}" when must be a JSON Logic object`);
|
|
252
|
+
} else if (branch.when) {
|
|
253
|
+
validateGuardRule(`node "${nodeId}" branch to "${branch.to}" guard`, branch.when, errors);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
interface ProcessDefinitionValidationContext {
|
|
259
|
+
options: ProcessDefinitionValidationOptions;
|
|
260
|
+
knownTools?: ReadonlySet<string>;
|
|
261
|
+
knownInteractions?: ReadonlySet<string>;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function createValidationContext(options: ProcessDefinitionValidationOptions): ProcessDefinitionValidationContext {
|
|
265
|
+
return {
|
|
266
|
+
options,
|
|
267
|
+
knownTools: options.knownTools ? new Set(options.knownTools) : undefined,
|
|
268
|
+
knownInteractions: options.knownInteractions ? new Set(options.knownInteractions) : undefined,
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function validateToolNodeDefinition(
|
|
273
|
+
nodeId: string,
|
|
274
|
+
node: NodeDefinition,
|
|
275
|
+
errors: string[],
|
|
276
|
+
context: ProcessDefinitionValidationContext,
|
|
277
|
+
) {
|
|
278
|
+
if (!node.tool) {
|
|
279
|
+
errors.push(`tool node "${nodeId}" is missing tool`);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (context.knownTools && !context.knownTools.has(node.tool)) {
|
|
283
|
+
errors.push(`tool node "${nodeId}" references unknown tool "${node.tool}"`);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (node.tool === 'set_context') {
|
|
287
|
+
validateSetContextNode(nodeId, node, errors);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function validateSetContextNode(nodeId: string, node: NodeDefinition, errors: string[]) {
|
|
292
|
+
const input = node.input;
|
|
293
|
+
if (!isRecord(input)) {
|
|
294
|
+
errors.push(`tool node "${nodeId}" set_context input must be an object`);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
for (const key of Object.keys(input)) {
|
|
299
|
+
if (key !== 'updates' && key !== 'reason' && key !== 'event_id') {
|
|
300
|
+
errors.push(`tool node "${nodeId}" set_context input has unsupported property "${key}"`);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if (!isRecord(input.updates)) {
|
|
305
|
+
errors.push(`tool node "${nodeId}" set_context input.updates must be an object`);
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
if (input.reason !== undefined && typeof input.reason !== 'string') {
|
|
309
|
+
errors.push(`tool node "${nodeId}" set_context input.reason must be a string`);
|
|
310
|
+
}
|
|
311
|
+
if (input.event_id !== undefined && typeof input.event_id !== 'string') {
|
|
312
|
+
errors.push(`tool node "${nodeId}" set_context input.event_id must be a string`);
|
|
313
|
+
}
|
|
314
|
+
validateSetContextWrites(nodeId, node, input.updates, errors);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function validateSetContextWrites(
|
|
318
|
+
nodeId: string,
|
|
319
|
+
node: NodeDefinition,
|
|
320
|
+
updates: Record<string, unknown>,
|
|
321
|
+
errors: string[],
|
|
322
|
+
) {
|
|
323
|
+
const updateKeys = Object.keys(updates);
|
|
324
|
+
if (updateKeys.length === 0) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
if (!Array.isArray(node.writes) || node.writes.length === 0) {
|
|
328
|
+
errors.push(`tool node "${nodeId}" set_context updates require declared writes`);
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
for (const key of updateKeys) {
|
|
332
|
+
if (key.startsWith('_')) {
|
|
333
|
+
errors.push(`tool node "${nodeId}" set_context cannot write reserved context field "${key}"`);
|
|
334
|
+
}
|
|
335
|
+
if (!isWriteAllowed(key, node.writes)) {
|
|
336
|
+
errors.push(`tool node "${nodeId}" set_context updates "${key}" but writes does not allow it`);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function isWriteAllowed(key: string, writes: string[]): boolean {
|
|
342
|
+
return writes.some((write) => key === write || key.startsWith(`${write}.`));
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
function isKnownSelector(selector: string, knownSelectors: ReadonlySet<string>): boolean {
|
|
346
|
+
if (knownSelectors.has(selector)) {
|
|
347
|
+
return true;
|
|
348
|
+
}
|
|
349
|
+
if (!selector.includes('@')) {
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
352
|
+
return knownSelectors.has(selector.slice(0, selector.lastIndexOf('@')));
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
function hasStringConditionProperty(value: unknown, key: string): boolean {
|
|
356
|
+
return isRecord(value) && typeof value[key] === 'string';
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function isProcessNodeType(value: string): boolean {
|
|
360
|
+
return (
|
|
361
|
+
value === 'tool' ||
|
|
362
|
+
value === 'interaction' ||
|
|
363
|
+
value === 'agent' ||
|
|
364
|
+
value === 'process' ||
|
|
365
|
+
value === 'human_task' ||
|
|
366
|
+
value === 'foreach' ||
|
|
367
|
+
value === 'branch' ||
|
|
368
|
+
value === 'condition' ||
|
|
369
|
+
value === 'final'
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
function isProcessNodeRunType(value: string): boolean {
|
|
374
|
+
return value === 'supervised' || value === 'programmatic';
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function isTransitionTrigger(value: string): boolean {
|
|
378
|
+
return value === 'auto' || value === 'agent' || value === 'user';
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function isParallelFailurePolicy(value: string): boolean {
|
|
382
|
+
return value === 'fail_fast' || value === 'collect_errors';
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
function isFanoutChildNodeType(value: string): boolean {
|
|
386
|
+
return value === 'tool' || value === 'interaction' || value === 'agent' || value === 'process';
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
function validateFanoutChildNodeDefinition(
|
|
390
|
+
definition: ProcessDefinitionBody,
|
|
391
|
+
input: {
|
|
392
|
+
ownerLabel: string;
|
|
393
|
+
childPath: string;
|
|
394
|
+
childLabel: string;
|
|
395
|
+
child: NodeDefinition;
|
|
396
|
+
},
|
|
397
|
+
errors: string[],
|
|
398
|
+
context: ProcessDefinitionValidationContext,
|
|
399
|
+
) {
|
|
400
|
+
const { ownerLabel, childPath, childLabel, child } = input;
|
|
401
|
+
if (!isFanoutChildNodeType(child.type)) {
|
|
402
|
+
errors.push(`${ownerLabel} has unsupported child node type "${String(child.type)}"`);
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
if ((child.transitions ?? []).length > 0) {
|
|
407
|
+
errors.push(`${childLabel} must not define transitions`);
|
|
408
|
+
}
|
|
409
|
+
if ((child.branches ?? []).length > 0) {
|
|
410
|
+
errors.push(`${childLabel} must not define branches`);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
validateNodeDefinition(
|
|
414
|
+
definition,
|
|
415
|
+
childPath,
|
|
416
|
+
{
|
|
417
|
+
...child,
|
|
418
|
+
transitions: undefined,
|
|
419
|
+
branches: undefined,
|
|
420
|
+
},
|
|
421
|
+
errors,
|
|
422
|
+
context,
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
function validateCollectDefinition(
|
|
427
|
+
nodeKind: 'foreach' | 'branch',
|
|
428
|
+
nodeId: string,
|
|
429
|
+
collect: NodeDefinition['collect'],
|
|
430
|
+
errors: string[],
|
|
431
|
+
) {
|
|
432
|
+
if (collect === undefined) {
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
if (typeof collect === 'string') {
|
|
436
|
+
if (!collect) {
|
|
437
|
+
errors.push(`${nodeKind} node "${nodeId}" collect must not be empty`);
|
|
438
|
+
}
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
if (!isRecord(collect)) {
|
|
442
|
+
errors.push(`${nodeKind} node "${nodeId}" collect must be a string or object`);
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
if (typeof collect.into !== 'string' || !collect.into) {
|
|
446
|
+
errors.push(`${nodeKind} node "${nodeId}" collect.into is required`);
|
|
447
|
+
}
|
|
448
|
+
if (collect.mode !== undefined && collect.mode !== 'array') {
|
|
449
|
+
errors.push(`${nodeKind} node "${nodeId}" collect.mode must be "array"`);
|
|
450
|
+
}
|
|
451
|
+
if (collect.include !== undefined) {
|
|
452
|
+
if (!Array.isArray(collect.include)) {
|
|
453
|
+
errors.push(`${nodeKind} node "${nodeId}" collect.include must be an array`);
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
for (const field of collect.include) {
|
|
457
|
+
if (typeof field !== 'string' || !isParallelCollectField(field)) {
|
|
458
|
+
errors.push(`${nodeKind} node "${nodeId}" collect.include has invalid field "${String(field)}"`);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
function isParallelCollectField(value: string): boolean {
|
|
465
|
+
return (
|
|
466
|
+
value === 'status' ||
|
|
467
|
+
value === 'index' ||
|
|
468
|
+
value === 'item' ||
|
|
469
|
+
value === 'item_id' ||
|
|
470
|
+
value === 'branch_id' ||
|
|
471
|
+
value === 'branch_title' ||
|
|
472
|
+
value === 'output' ||
|
|
473
|
+
value === 'context_update' ||
|
|
474
|
+
value === 'error' ||
|
|
475
|
+
value === 'child_run_id' ||
|
|
476
|
+
value === 'child_workflow_id' ||
|
|
477
|
+
value === 'child_workflow_run_id'
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
function isStringArray(value: unknown): value is string[] {
|
|
482
|
+
return Array.isArray(value) && value.every((item) => typeof item === 'string');
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
function validateGuardRule(label: string, rule: unknown, errors: string[]) {
|
|
486
|
+
const result = inspectGuardRule(rule);
|
|
487
|
+
if (result.depth > MAX_PROCESS_GUARD_DEPTH) {
|
|
488
|
+
errors.push(`${label} exceeds maximum depth ${MAX_PROCESS_GUARD_DEPTH}`);
|
|
489
|
+
}
|
|
490
|
+
if (result.nodes > MAX_PROCESS_GUARD_NODES) {
|
|
491
|
+
errors.push(`${label} exceeds maximum node count ${MAX_PROCESS_GUARD_NODES}`);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
function inspectGuardRule(rule: unknown): { depth: number; nodes: number } {
|
|
496
|
+
let maxDepth = 0;
|
|
497
|
+
let nodes = 0;
|
|
498
|
+
const stack: { value: unknown; depth: number }[] = [{ value: rule, depth: 1 }];
|
|
499
|
+
while (stack.length > 0) {
|
|
500
|
+
const next = stack.pop();
|
|
501
|
+
if (!next) {
|
|
502
|
+
continue;
|
|
503
|
+
}
|
|
504
|
+
nodes += 1;
|
|
505
|
+
maxDepth = Math.max(maxDepth, next.depth);
|
|
506
|
+
if (nodes > MAX_PROCESS_GUARD_NODES || maxDepth > MAX_PROCESS_GUARD_DEPTH) {
|
|
507
|
+
break;
|
|
508
|
+
}
|
|
509
|
+
if (Array.isArray(next.value)) {
|
|
510
|
+
for (const item of next.value) {
|
|
511
|
+
stack.push({ value: item, depth: next.depth + 1 });
|
|
512
|
+
}
|
|
513
|
+
} else if (isRecord(next.value)) {
|
|
514
|
+
for (const value of Object.values(next.value)) {
|
|
515
|
+
stack.push({ value, depth: next.depth + 1 });
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
return { depth: maxDepth, nodes };
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
523
|
+
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
function getConditionBranches(node: NodeDefinition): BranchDefinition[] {
|
|
527
|
+
return node.type === 'condition' && Array.isArray(node.branches)
|
|
528
|
+
? node.branches.filter(isConditionBranchDefinition)
|
|
529
|
+
: [];
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
function getBranchNodeBranches(node: NodeDefinition): BranchNodeBranchDefinition[] {
|
|
533
|
+
return node.type === 'branch' && Array.isArray(node.branches)
|
|
534
|
+
? node.branches.filter(isBranchNodeBranchDefinition)
|
|
535
|
+
: [];
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
function isConditionBranchDefinition(
|
|
539
|
+
branch: BranchDefinition | BranchNodeBranchDefinition,
|
|
540
|
+
): branch is BranchDefinition {
|
|
541
|
+
return 'to' in branch;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
function isBranchNodeBranchDefinition(
|
|
545
|
+
branch: BranchDefinition | BranchNodeBranchDefinition,
|
|
546
|
+
): branch is BranchNodeBranchDefinition {
|
|
547
|
+
return 'node' in branch;
|
|
548
|
+
}
|