@synergenius/flow-weaver 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +122 -0
- package/README.md +315 -0
- package/dist/annotation-generator.d.ts +45 -0
- package/dist/annotation-generator.js +557 -0
- package/dist/api/builder.d.ts +223 -0
- package/dist/api/builder.js +345 -0
- package/dist/api/compile.d.ts +92 -0
- package/dist/api/compile.js +149 -0
- package/dist/api/extract-types.d.ts +29 -0
- package/dist/api/extract-types.js +57 -0
- package/dist/api/generate-in-place.d.ts +73 -0
- package/dist/api/generate-in-place.js +1353 -0
- package/dist/api/generate.d.ts +83 -0
- package/dist/api/generate.js +510 -0
- package/dist/api/helpers.d.ts +248 -0
- package/dist/api/helpers.js +285 -0
- package/dist/api/index.d.ts +46 -0
- package/dist/api/index.js +45 -0
- package/dist/api/inline-runtime.d.ts +27 -0
- package/dist/api/inline-runtime.js +551 -0
- package/dist/api/manipulation/connections.d.ts +79 -0
- package/dist/api/manipulation/connections.js +151 -0
- package/dist/api/manipulation/index.d.ts +34 -0
- package/dist/api/manipulation/index.js +41 -0
- package/dist/api/manipulation/node-types.d.ts +123 -0
- package/dist/api/manipulation/node-types.js +200 -0
- package/dist/api/manipulation/nodes.d.ts +144 -0
- package/dist/api/manipulation/nodes.js +333 -0
- package/dist/api/manipulation/ports.d.ts +59 -0
- package/dist/api/manipulation/ports.js +228 -0
- package/dist/api/manipulation/scopes.d.ts +52 -0
- package/dist/api/manipulation/scopes.js +156 -0
- package/dist/api/manipulation/validation.d.ts +6 -0
- package/dist/api/manipulation/validation.js +6 -0
- package/dist/api/manipulation/workflow.d.ts +81 -0
- package/dist/api/manipulation/workflow.js +116 -0
- package/dist/api/manipulation.d.ts +8 -0
- package/dist/api/manipulation.js +8 -0
- package/dist/api/parse.d.ts +48 -0
- package/dist/api/parse.js +110 -0
- package/dist/api/patterns.d.ts +112 -0
- package/dist/api/patterns.js +306 -0
- package/dist/api/query.d.ts +429 -0
- package/dist/api/query.js +816 -0
- package/dist/api/templates.d.ts +98 -0
- package/dist/api/templates.js +117 -0
- package/dist/api/transform.d.ts +31 -0
- package/dist/api/transform.js +40 -0
- package/dist/api/validate.d.ts +25 -0
- package/dist/api/validate.js +39 -0
- package/dist/api/workflow-file-operations.d.ts +29 -0
- package/dist/api/workflow-file-operations.js +180 -0
- package/dist/ast/builder.d.ts +210 -0
- package/dist/ast/builder.js +395 -0
- package/dist/ast/index.d.ts +5 -0
- package/dist/ast/index.js +5 -0
- package/dist/ast/serialization-node.d.ts +6 -0
- package/dist/ast/serialization-node.js +30 -0
- package/dist/ast/serialization.d.ts +43 -0
- package/dist/ast/serialization.js +134 -0
- package/dist/ast/types.d.ts +852 -0
- package/dist/ast/types.js +2 -0
- package/dist/ast/workflow-utils.d.ts +54 -0
- package/dist/ast/workflow-utils.js +114 -0
- package/dist/body-generator.d.ts +31 -0
- package/dist/body-generator.js +35 -0
- package/dist/built-in-nodes/delay.d.ts +11 -0
- package/dist/built-in-nodes/delay.js +29 -0
- package/dist/built-in-nodes/index.d.ts +5 -0
- package/dist/built-in-nodes/index.js +4 -0
- package/dist/built-in-nodes/invoke-workflow.d.ts +13 -0
- package/dist/built-in-nodes/invoke-workflow.js +25 -0
- package/dist/built-in-nodes/mock-types.d.ts +18 -0
- package/dist/built-in-nodes/mock-types.js +12 -0
- package/dist/built-in-nodes/wait-for-event.d.ts +13 -0
- package/dist/built-in-nodes/wait-for-event.js +25 -0
- package/dist/chevrotain-parser/connect-parser.d.ts +24 -0
- package/dist/chevrotain-parser/connect-parser.js +98 -0
- package/dist/chevrotain-parser/grammar-diagrams.d.ts +29 -0
- package/dist/chevrotain-parser/grammar-diagrams.js +264 -0
- package/dist/chevrotain-parser/index.d.ts +25 -0
- package/dist/chevrotain-parser/index.js +27 -0
- package/dist/chevrotain-parser/map-parser.d.ts +33 -0
- package/dist/chevrotain-parser/map-parser.js +130 -0
- package/dist/chevrotain-parser/node-parser.d.ts +36 -0
- package/dist/chevrotain-parser/node-parser.js +466 -0
- package/dist/chevrotain-parser/path-parser.d.ts +28 -0
- package/dist/chevrotain-parser/path-parser.js +118 -0
- package/dist/chevrotain-parser/port-parser.d.ts +36 -0
- package/dist/chevrotain-parser/port-parser.js +442 -0
- package/dist/chevrotain-parser/position-parser.d.ts +20 -0
- package/dist/chevrotain-parser/position-parser.js +83 -0
- package/dist/chevrotain-parser/scope-parser.d.ts +19 -0
- package/dist/chevrotain-parser/scope-parser.js +104 -0
- package/dist/chevrotain-parser/tokens.d.ts +78 -0
- package/dist/chevrotain-parser/tokens.js +384 -0
- package/dist/chevrotain-parser/trigger-cancel-parser.d.ts +50 -0
- package/dist/chevrotain-parser/trigger-cancel-parser.js +282 -0
- package/dist/cli/commands/changelog.d.ts +13 -0
- package/dist/cli/commands/changelog.js +135 -0
- package/dist/cli/commands/compile.d.ts +64 -0
- package/dist/cli/commands/compile.js +278 -0
- package/dist/cli/commands/create.d.ts +33 -0
- package/dist/cli/commands/create.js +147 -0
- package/dist/cli/commands/describe.d.ts +68 -0
- package/dist/cli/commands/describe.js +377 -0
- package/dist/cli/commands/dev.d.ts +32 -0
- package/dist/cli/commands/dev.js +384 -0
- package/dist/cli/commands/diagram.d.ts +13 -0
- package/dist/cli/commands/diagram.js +33 -0
- package/dist/cli/commands/diff.d.ts +11 -0
- package/dist/cli/commands/diff.js +59 -0
- package/dist/cli/commands/doctor.d.ts +57 -0
- package/dist/cli/commands/doctor.js +719 -0
- package/dist/cli/commands/export.d.ts +57 -0
- package/dist/cli/commands/export.js +163 -0
- package/dist/cli/commands/grammar.d.ts +9 -0
- package/dist/cli/commands/grammar.js +39 -0
- package/dist/cli/commands/init.d.ts +59 -0
- package/dist/cli/commands/init.js +435 -0
- package/dist/cli/commands/listen.d.ts +16 -0
- package/dist/cli/commands/listen.js +39 -0
- package/dist/cli/commands/market.d.ts +52 -0
- package/dist/cli/commands/market.js +436 -0
- package/dist/cli/commands/migrate.d.ts +13 -0
- package/dist/cli/commands/migrate.js +89 -0
- package/dist/cli/commands/openapi.d.ts +37 -0
- package/dist/cli/commands/openapi.js +67 -0
- package/dist/cli/commands/pattern.d.ts +34 -0
- package/dist/cli/commands/pattern.js +185 -0
- package/dist/cli/commands/plugin.d.ts +16 -0
- package/dist/cli/commands/plugin.js +176 -0
- package/dist/cli/commands/run.d.ts +49 -0
- package/dist/cli/commands/run.js +191 -0
- package/dist/cli/commands/serve.d.ts +45 -0
- package/dist/cli/commands/serve.js +81 -0
- package/dist/cli/commands/templates.d.ts +8 -0
- package/dist/cli/commands/templates.js +54 -0
- package/dist/cli/commands/ui.d.ts +16 -0
- package/dist/cli/commands/ui.js +130 -0
- package/dist/cli/commands/validate.d.ts +12 -0
- package/dist/cli/commands/validate.js +247 -0
- package/dist/cli/commands/watch.d.ts +9 -0
- package/dist/cli/commands/watch.js +70 -0
- package/dist/cli/flow-weaver.mjs +92924 -0
- package/dist/cli/index.d.ts +9 -0
- package/dist/cli/index.js +742 -0
- package/dist/cli/templates/ai/mock-provider.d.ts +7 -0
- package/dist/cli/templates/ai/mock-provider.js +64 -0
- package/dist/cli/templates/ai/types.d.ts +47 -0
- package/dist/cli/templates/ai/types.js +5 -0
- package/dist/cli/templates/approvals/index.d.ts +15 -0
- package/dist/cli/templates/approvals/index.js +241 -0
- package/dist/cli/templates/index.d.ts +102 -0
- package/dist/cli/templates/index.js +101 -0
- package/dist/cli/templates/nodes/agent-router.d.ts +3 -0
- package/dist/cli/templates/nodes/agent-router.js +114 -0
- package/dist/cli/templates/nodes/aggregator.d.ts +7 -0
- package/dist/cli/templates/nodes/aggregator.js +63 -0
- package/dist/cli/templates/nodes/conversation-memory.d.ts +3 -0
- package/dist/cli/templates/nodes/conversation-memory.js +85 -0
- package/dist/cli/templates/nodes/http.d.ts +7 -0
- package/dist/cli/templates/nodes/http.js +80 -0
- package/dist/cli/templates/nodes/human-approval.d.ts +3 -0
- package/dist/cli/templates/nodes/human-approval.js +110 -0
- package/dist/cli/templates/nodes/json-extractor.d.ts +3 -0
- package/dist/cli/templates/nodes/json-extractor.js +119 -0
- package/dist/cli/templates/nodes/llm-call.d.ts +3 -0
- package/dist/cli/templates/nodes/llm-call.js +106 -0
- package/dist/cli/templates/nodes/prompt-template.d.ts +3 -0
- package/dist/cli/templates/nodes/prompt-template.js +52 -0
- package/dist/cli/templates/nodes/rag-retriever.d.ts +3 -0
- package/dist/cli/templates/nodes/rag-retriever.js +128 -0
- package/dist/cli/templates/nodes/tool-executor.d.ts +3 -0
- package/dist/cli/templates/nodes/tool-executor.js +108 -0
- package/dist/cli/templates/nodes/transformer.d.ts +7 -0
- package/dist/cli/templates/nodes/transformer.js +68 -0
- package/dist/cli/templates/nodes/validator.d.ts +7 -0
- package/dist/cli/templates/nodes/validator.js +62 -0
- package/dist/cli/templates/providers/index.d.ts +14 -0
- package/dist/cli/templates/providers/index.js +239 -0
- package/dist/cli/templates/shared/approval-types.d.ts +9 -0
- package/dist/cli/templates/shared/approval-types.js +31 -0
- package/dist/cli/templates/shared/llm-types.d.ts +15 -0
- package/dist/cli/templates/shared/llm-types.js +104 -0
- package/dist/cli/templates/workflows/aggregator.d.ts +7 -0
- package/dist/cli/templates/workflows/aggregator.js +104 -0
- package/dist/cli/templates/workflows/ai-agent-durable.d.ts +8 -0
- package/dist/cli/templates/workflows/ai-agent-durable.js +338 -0
- package/dist/cli/templates/workflows/ai-agent.d.ts +31 -0
- package/dist/cli/templates/workflows/ai-agent.js +326 -0
- package/dist/cli/templates/workflows/ai-chat.d.ts +7 -0
- package/dist/cli/templates/workflows/ai-chat.js +169 -0
- package/dist/cli/templates/workflows/ai-pipeline-durable.d.ts +8 -0
- package/dist/cli/templates/workflows/ai-pipeline-durable.js +330 -0
- package/dist/cli/templates/workflows/ai-rag.d.ts +7 -0
- package/dist/cli/templates/workflows/ai-rag.js +186 -0
- package/dist/cli/templates/workflows/ai-react.d.ts +7 -0
- package/dist/cli/templates/workflows/ai-react.js +294 -0
- package/dist/cli/templates/workflows/conditional.d.ts +12 -0
- package/dist/cli/templates/workflows/conditional.js +142 -0
- package/dist/cli/templates/workflows/error-handler.d.ts +7 -0
- package/dist/cli/templates/workflows/error-handler.js +147 -0
- package/dist/cli/templates/workflows/foreach.d.ts +7 -0
- package/dist/cli/templates/workflows/foreach.js +143 -0
- package/dist/cli/templates/workflows/sequential.d.ts +7 -0
- package/dist/cli/templates/workflows/sequential.js +198 -0
- package/dist/cli/templates/workflows/webhook.d.ts +7 -0
- package/dist/cli/templates/workflows/webhook.js +161 -0
- package/dist/cli/utils/logger.d.ts +15 -0
- package/dist/cli/utils/logger.js +46 -0
- package/dist/constants.d.ts +100 -0
- package/dist/constants.js +125 -0
- package/dist/defaults.d.ts +3 -0
- package/dist/defaults.js +3 -0
- package/dist/deployment/config/defaults.d.ts +29 -0
- package/dist/deployment/config/defaults.js +98 -0
- package/dist/deployment/config/loader.d.ts +24 -0
- package/dist/deployment/config/loader.js +236 -0
- package/dist/deployment/config/types.d.ts +117 -0
- package/dist/deployment/config/types.js +5 -0
- package/dist/deployment/core/adapters.d.ts +90 -0
- package/dist/deployment/core/adapters.js +251 -0
- package/dist/deployment/core/executor.d.ts +62 -0
- package/dist/deployment/core/executor.js +197 -0
- package/dist/deployment/core/formatters.d.ts +57 -0
- package/dist/deployment/core/formatters.js +170 -0
- package/dist/deployment/index.d.ts +31 -0
- package/dist/deployment/index.js +48 -0
- package/dist/deployment/openapi/generator.d.ts +146 -0
- package/dist/deployment/openapi/generator.js +347 -0
- package/dist/deployment/openapi/schema-converter.d.ts +49 -0
- package/dist/deployment/openapi/schema-converter.js +192 -0
- package/dist/deployment/targets/base.d.ts +316 -0
- package/dist/deployment/targets/base.js +823 -0
- package/dist/deployment/targets/cloudflare.d.ts +23 -0
- package/dist/deployment/targets/cloudflare.js +1125 -0
- package/dist/deployment/targets/inngest.d.ts +38 -0
- package/dist/deployment/targets/inngest.js +926 -0
- package/dist/deployment/targets/lambda.d.ts +23 -0
- package/dist/deployment/targets/lambda.js +1289 -0
- package/dist/deployment/targets/vercel.d.ts +23 -0
- package/dist/deployment/targets/vercel.js +886 -0
- package/dist/deployment/types.d.ts +183 -0
- package/dist/deployment/types.js +8 -0
- package/dist/diagram/geometry.d.ts +26 -0
- package/dist/diagram/geometry.js +850 -0
- package/dist/diagram/index.d.ts +16 -0
- package/dist/diagram/index.js +42 -0
- package/dist/diagram/layout.d.ts +11 -0
- package/dist/diagram/layout.js +143 -0
- package/dist/diagram/orthogonal-router.d.ts +79 -0
- package/dist/diagram/orthogonal-router.js +568 -0
- package/dist/diagram/renderer.d.ts +3 -0
- package/dist/diagram/renderer.js +207 -0
- package/dist/diagram/theme.d.ts +20 -0
- package/dist/diagram/theme.js +189 -0
- package/dist/diagram/types.d.ts +70 -0
- package/dist/diagram/types.js +2 -0
- package/dist/diff/WorkflowDiffer.d.ts +13 -0
- package/dist/diff/WorkflowDiffer.js +429 -0
- package/dist/diff/formatDiff.d.ts +10 -0
- package/dist/diff/formatDiff.js +220 -0
- package/dist/diff/impact.d.ts +29 -0
- package/dist/diff/impact.js +119 -0
- package/dist/diff/index.d.ts +10 -0
- package/dist/diff/index.js +9 -0
- package/dist/diff/types.d.ts +138 -0
- package/dist/diff/types.js +35 -0
- package/dist/doc-metadata/extractors/annotations.d.ts +56 -0
- package/dist/doc-metadata/extractors/annotations.js +337 -0
- package/dist/doc-metadata/extractors/cli-commands.d.ts +17 -0
- package/dist/doc-metadata/extractors/cli-commands.js +355 -0
- package/dist/doc-metadata/extractors/mcp-tools.d.ts +16 -0
- package/dist/doc-metadata/extractors/mcp-tools.js +689 -0
- package/dist/doc-metadata/extractors/plugin-api.d.ts +19 -0
- package/dist/doc-metadata/extractors/plugin-api.js +279 -0
- package/dist/doc-metadata/index.d.ts +5 -0
- package/dist/doc-metadata/index.js +4 -0
- package/dist/doc-metadata/types.d.ts +120 -0
- package/dist/doc-metadata/types.js +5 -0
- package/dist/editor-completions/annotationValues.d.ts +12 -0
- package/dist/editor-completions/annotationValues.js +138 -0
- package/dist/editor-completions/contextParser.d.ts +40 -0
- package/dist/editor-completions/contextParser.js +410 -0
- package/dist/editor-completions/dataTypes.d.ts +16 -0
- package/dist/editor-completions/dataTypes.js +95 -0
- package/dist/editor-completions/goToDefinition.d.ts +27 -0
- package/dist/editor-completions/goToDefinition.js +112 -0
- package/dist/editor-completions/index.d.ts +39 -0
- package/dist/editor-completions/index.js +181 -0
- package/dist/editor-completions/jsDocAnnotations.d.ts +29 -0
- package/dist/editor-completions/jsDocAnnotations.js +357 -0
- package/dist/editor-completions/modifierCompletions.d.ts +17 -0
- package/dist/editor-completions/modifierCompletions.js +197 -0
- package/dist/editor-completions/types.d.ts +119 -0
- package/dist/editor-completions/types.js +8 -0
- package/dist/export/index.d.ts +68 -0
- package/dist/export/index.js +1074 -0
- package/dist/export/templates.d.ts +24 -0
- package/dist/export/templates.js +186 -0
- package/dist/friendly-errors.d.ts +35 -0
- package/dist/friendly-errors.js +375 -0
- package/dist/function-like.d.ts +38 -0
- package/dist/function-like.js +83 -0
- package/dist/generated-branding.d.ts +16 -0
- package/dist/generated-branding.js +22 -0
- package/dist/generator/async-detection.d.ts +27 -0
- package/dist/generator/async-detection.js +56 -0
- package/dist/generator/code-utils.d.ts +76 -0
- package/dist/generator/code-utils.js +410 -0
- package/dist/generator/control-flow.d.ts +54 -0
- package/dist/generator/control-flow.js +284 -0
- package/dist/generator/inngest.d.ts +53 -0
- package/dist/generator/inngest.js +1126 -0
- package/dist/generator/scope-function-generator.d.ts +78 -0
- package/dist/generator/scope-function-generator.js +360 -0
- package/dist/generator/unified.d.ts +42 -0
- package/dist/generator/unified.js +1504 -0
- package/dist/generator.d.ts +54 -0
- package/dist/generator.js +100 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +89 -0
- package/dist/jsdoc-parser.d.ts +308 -0
- package/dist/jsdoc-parser.js +923 -0
- package/dist/jsdoc-port-sync/constants.d.ts +41 -0
- package/dist/jsdoc-port-sync/constants.js +103 -0
- package/dist/jsdoc-port-sync/diff.d.ts +76 -0
- package/dist/jsdoc-port-sync/diff.js +319 -0
- package/dist/jsdoc-port-sync/index.d.ts +42 -0
- package/dist/jsdoc-port-sync/index.js +45 -0
- package/dist/jsdoc-port-sync/port-parser.d.ts +68 -0
- package/dist/jsdoc-port-sync/port-parser.js +579 -0
- package/dist/jsdoc-port-sync/rename.d.ts +21 -0
- package/dist/jsdoc-port-sync/rename.js +256 -0
- package/dist/jsdoc-port-sync/signature-parser.d.ts +104 -0
- package/dist/jsdoc-port-sync/signature-parser.js +559 -0
- package/dist/jsdoc-port-sync/sync.d.ts +36 -0
- package/dist/jsdoc-port-sync/sync.js +644 -0
- package/dist/jsdoc-port-sync.d.ts +10 -0
- package/dist/jsdoc-port-sync.js +10 -0
- package/dist/marketplace/index.d.ts +11 -0
- package/dist/marketplace/index.js +10 -0
- package/dist/marketplace/manifest.d.ts +32 -0
- package/dist/marketplace/manifest.js +176 -0
- package/dist/marketplace/registry.d.ts +30 -0
- package/dist/marketplace/registry.js +100 -0
- package/dist/marketplace/types.d.ts +154 -0
- package/dist/marketplace/types.js +9 -0
- package/dist/marketplace/validator.d.ts +13 -0
- package/dist/marketplace/validator.js +131 -0
- package/dist/mcp/auto-registration.d.ts +3 -0
- package/dist/mcp/auto-registration.js +62 -0
- package/dist/mcp/editor-connection.d.ts +50 -0
- package/dist/mcp/editor-connection.js +125 -0
- package/dist/mcp/event-buffer.d.ts +62 -0
- package/dist/mcp/event-buffer.js +150 -0
- package/dist/mcp/index.d.ts +12 -0
- package/dist/mcp/index.js +11 -0
- package/dist/mcp/resources.d.ts +14 -0
- package/dist/mcp/resources.js +55 -0
- package/dist/mcp/response-utils.d.ts +63 -0
- package/dist/mcp/response-utils.js +89 -0
- package/dist/mcp/server.d.ts +4 -0
- package/dist/mcp/server.js +99 -0
- package/dist/mcp/tools-diagram.d.ts +8 -0
- package/dist/mcp/tools-diagram.js +53 -0
- package/dist/mcp/tools-editor.d.ts +5 -0
- package/dist/mcp/tools-editor.js +190 -0
- package/dist/mcp/tools-export.d.ts +9 -0
- package/dist/mcp/tools-export.js +180 -0
- package/dist/mcp/tools-marketplace.d.ts +9 -0
- package/dist/mcp/tools-marketplace.js +132 -0
- package/dist/mcp/tools-pattern.d.ts +3 -0
- package/dist/mcp/tools-pattern.js +783 -0
- package/dist/mcp/tools-query.d.ts +3 -0
- package/dist/mcp/tools-query.js +364 -0
- package/dist/mcp/tools-template.d.ts +10 -0
- package/dist/mcp/tools-template.js +119 -0
- package/dist/mcp/types.d.ts +70 -0
- package/dist/mcp/types.js +8 -0
- package/dist/mcp/workflow-executor.d.ts +47 -0
- package/dist/mcp/workflow-executor.js +133 -0
- package/dist/migration/registry.d.ts +30 -0
- package/dist/migration/registry.js +29 -0
- package/dist/node-types-generator.d.ts +49 -0
- package/dist/node-types-generator.js +139 -0
- package/dist/npm-packages.d.ts +56 -0
- package/dist/npm-packages.js +255 -0
- package/dist/parser.d.ts +204 -0
- package/dist/parser.js +2100 -0
- package/dist/plugin/PluginPanel.d.ts +12 -0
- package/dist/plugin/PluginPanel.js +5 -0
- package/dist/plugin/index.d.ts +13 -0
- package/dist/plugin/index.js +14 -0
- package/dist/plugin/types.d.ts +75 -0
- package/dist/plugin/types.js +8 -0
- package/dist/resolve-package-types.d.ts +17 -0
- package/dist/resolve-package-types.js +123 -0
- package/dist/runtime/CancellationError.d.ts +11 -0
- package/dist/runtime/CancellationError.js +20 -0
- package/dist/runtime/ExecutionContext.d.ts +146 -0
- package/dist/runtime/ExecutionContext.js +235 -0
- package/dist/runtime/builtin-functions.d.ts +8 -0
- package/dist/runtime/builtin-functions.js +549 -0
- package/dist/runtime/events.d.ts +50 -0
- package/dist/runtime/events.js +2 -0
- package/dist/runtime/function-registry.d.ts +59 -0
- package/dist/runtime/function-registry.js +66 -0
- package/dist/runtime/index.d.ts +7 -0
- package/dist/runtime/index.js +7 -0
- package/dist/runtime/parameter-resolver.d.ts +62 -0
- package/dist/runtime/parameter-resolver.js +113 -0
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.js +6 -0
- package/dist/server/types.d.ts +93 -0
- package/dist/server/types.js +5 -0
- package/dist/server/webhook-server.d.ts +50 -0
- package/dist/server/webhook-server.js +269 -0
- package/dist/server/workflow-registry.d.ts +61 -0
- package/dist/server/workflow-registry.js +202 -0
- package/dist/shared-project.d.ts +9 -0
- package/dist/shared-project.js +28 -0
- package/dist/sugar-optimizer.d.ts +40 -0
- package/dist/sugar-optimizer.js +387 -0
- package/dist/testing/assertions.d.ts +51 -0
- package/dist/testing/assertions.js +127 -0
- package/dist/testing/index.d.ts +30 -0
- package/dist/testing/index.js +24 -0
- package/dist/testing/mock-approval.d.ts +81 -0
- package/dist/testing/mock-approval.js +98 -0
- package/dist/testing/mock-llm.d.ts +124 -0
- package/dist/testing/mock-llm.js +119 -0
- package/dist/testing/recorder.d.ts +72 -0
- package/dist/testing/recorder.js +70 -0
- package/dist/testing/replayer.d.ts +56 -0
- package/dist/testing/replayer.js +143 -0
- package/dist/testing/token-tracker.d.ts +71 -0
- package/dist/testing/token-tracker.js +94 -0
- package/dist/type-checker.d.ts +42 -0
- package/dist/type-checker.js +190 -0
- package/dist/type-mappings.d.ts +29 -0
- package/dist/type-mappings.js +125 -0
- package/dist/types/branded-ports.d.ts +151 -0
- package/dist/types/branded-ports.js +121 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +5 -0
- package/dist/types.d.ts +139 -0
- package/dist/types.js +15 -0
- package/dist/utils/error-utils.d.ts +15 -0
- package/dist/utils/error-utils.js +27 -0
- package/dist/utils/lru-cache.d.ts +15 -0
- package/dist/utils/lru-cache.js +40 -0
- package/dist/utils/port-ordering.d.ts +26 -0
- package/dist/utils/port-ordering.js +88 -0
- package/dist/utils/port-tag-utils.d.ts +23 -0
- package/dist/utils/port-tag-utils.js +41 -0
- package/dist/utils/string-distance.d.ts +14 -0
- package/dist/utils/string-distance.js +56 -0
- package/dist/validation/agent-detection.d.ts +33 -0
- package/dist/validation/agent-detection.js +115 -0
- package/dist/validation/agent-rules.d.ts +48 -0
- package/dist/validation/agent-rules.js +262 -0
- package/dist/validator.d.ts +92 -0
- package/dist/validator.js +970 -0
- package/package.json +109 -0
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkflowDiffer - Semantic diff for workflows.
|
|
3
|
+
* Compares semantic fields, ignores visual/metadata fields.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Create connection key for comparison (ignores metadata/sourceLocation)
|
|
7
|
+
*/
|
|
8
|
+
function connectionKey(conn) {
|
|
9
|
+
return `${conn.from.node}:${conn.from.port}:${conn.from.scope ?? ''}->${conn.to.node}:${conn.to.port}:${conn.to.scope ?? ''}`;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Deep equality for port definitions (semantic fields only)
|
|
13
|
+
*/
|
|
14
|
+
function portDefinitionEquals(a, b) {
|
|
15
|
+
return (a.dataType === b.dataType &&
|
|
16
|
+
a.tsType === b.tsType &&
|
|
17
|
+
a.optional === b.optional &&
|
|
18
|
+
JSON.stringify(a.default) === JSON.stringify(b.default) &&
|
|
19
|
+
a.expression === b.expression &&
|
|
20
|
+
a.scope === b.scope &&
|
|
21
|
+
a.mergeStrategy === b.mergeStrategy);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Compare port maps and return changes
|
|
25
|
+
*/
|
|
26
|
+
function comparePortMaps(beforePorts, afterPorts, direction) {
|
|
27
|
+
const changes = [];
|
|
28
|
+
const beforeKeys = new Set(Object.keys(beforePorts));
|
|
29
|
+
const afterKeys = new Set(Object.keys(afterPorts));
|
|
30
|
+
// Added ports
|
|
31
|
+
for (const key of afterKeys) {
|
|
32
|
+
if (!beforeKeys.has(key)) {
|
|
33
|
+
changes.push({
|
|
34
|
+
portName: key,
|
|
35
|
+
direction,
|
|
36
|
+
type: 'ADDED',
|
|
37
|
+
after: afterPorts[key],
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// Removed ports
|
|
42
|
+
for (const key of beforeKeys) {
|
|
43
|
+
if (!afterKeys.has(key)) {
|
|
44
|
+
changes.push({
|
|
45
|
+
portName: key,
|
|
46
|
+
direction,
|
|
47
|
+
type: 'REMOVED',
|
|
48
|
+
before: beforePorts[key],
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Modified ports
|
|
53
|
+
for (const key of beforeKeys) {
|
|
54
|
+
if (afterKeys.has(key) && !portDefinitionEquals(beforePorts[key], afterPorts[key])) {
|
|
55
|
+
changes.push({
|
|
56
|
+
portName: key,
|
|
57
|
+
direction,
|
|
58
|
+
type: 'MODIFIED',
|
|
59
|
+
before: beforePorts[key],
|
|
60
|
+
after: afterPorts[key],
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return changes;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Compare node types semantically
|
|
68
|
+
*/
|
|
69
|
+
function compareNodeType(before, after) {
|
|
70
|
+
const changes = {};
|
|
71
|
+
let hasChanges = false;
|
|
72
|
+
// Compare functionName
|
|
73
|
+
if (before.functionName !== after.functionName) {
|
|
74
|
+
changes.functionName = { type: 'MODIFIED', before: before.functionName, after: after.functionName };
|
|
75
|
+
hasChanges = true;
|
|
76
|
+
}
|
|
77
|
+
// Compare executeWhen
|
|
78
|
+
if (before.executeWhen !== after.executeWhen) {
|
|
79
|
+
changes.executeWhen = { type: 'MODIFIED', before: before.executeWhen, after: after.executeWhen };
|
|
80
|
+
hasChanges = true;
|
|
81
|
+
}
|
|
82
|
+
// Compare branchingStrategy
|
|
83
|
+
if (before.branchingStrategy !== after.branchingStrategy) {
|
|
84
|
+
changes.branchingStrategy = { type: 'MODIFIED', before: before.branchingStrategy, after: after.branchingStrategy };
|
|
85
|
+
hasChanges = true;
|
|
86
|
+
}
|
|
87
|
+
// Compare isAsync
|
|
88
|
+
if (before.isAsync !== after.isAsync) {
|
|
89
|
+
changes.isAsync = { type: 'MODIFIED', before: before.isAsync, after: after.isAsync };
|
|
90
|
+
hasChanges = true;
|
|
91
|
+
}
|
|
92
|
+
// Compare scope
|
|
93
|
+
if (before.scope !== after.scope) {
|
|
94
|
+
changes.scope = { type: 'MODIFIED', before: before.scope, after: after.scope };
|
|
95
|
+
hasChanges = true;
|
|
96
|
+
}
|
|
97
|
+
// Compare variant
|
|
98
|
+
if (before.variant !== after.variant) {
|
|
99
|
+
changes.variant = { type: 'MODIFIED', before: before.variant, after: after.variant };
|
|
100
|
+
hasChanges = true;
|
|
101
|
+
}
|
|
102
|
+
// Compare inputs
|
|
103
|
+
const inputChanges = comparePortMaps(before.inputs, after.inputs, 'INPUT');
|
|
104
|
+
if (inputChanges.length > 0) {
|
|
105
|
+
changes.inputs = inputChanges;
|
|
106
|
+
hasChanges = true;
|
|
107
|
+
}
|
|
108
|
+
// Compare outputs
|
|
109
|
+
const outputChanges = comparePortMaps(before.outputs, after.outputs, 'OUTPUT');
|
|
110
|
+
if (outputChanges.length > 0) {
|
|
111
|
+
changes.outputs = outputChanges;
|
|
112
|
+
hasChanges = true;
|
|
113
|
+
}
|
|
114
|
+
if (!hasChanges)
|
|
115
|
+
return null;
|
|
116
|
+
return {
|
|
117
|
+
name: before.name,
|
|
118
|
+
changeType: 'MODIFIED',
|
|
119
|
+
changes,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Compare instance UI data
|
|
124
|
+
*/
|
|
125
|
+
function compareInstanceUI(beforeUI, afterUI) {
|
|
126
|
+
if (!beforeUI && !afterUI)
|
|
127
|
+
return null;
|
|
128
|
+
const uiChanges = {};
|
|
129
|
+
let hasUIChanges = false;
|
|
130
|
+
const beforeLabel = beforeUI?.label ?? '';
|
|
131
|
+
const afterLabel = afterUI?.label ?? '';
|
|
132
|
+
if (beforeLabel !== afterLabel) {
|
|
133
|
+
uiChanges.label = { type: 'MODIFIED', before: beforeLabel, after: afterLabel };
|
|
134
|
+
hasUIChanges = true;
|
|
135
|
+
}
|
|
136
|
+
const beforeX = beforeUI?.x ?? 0;
|
|
137
|
+
const beforeY = beforeUI?.y ?? 0;
|
|
138
|
+
const afterX = afterUI?.x ?? 0;
|
|
139
|
+
const afterY = afterUI?.y ?? 0;
|
|
140
|
+
if (beforeX !== afterX || beforeY !== afterY) {
|
|
141
|
+
uiChanges.position = {
|
|
142
|
+
type: 'MODIFIED',
|
|
143
|
+
before: { x: beforeX, y: beforeY },
|
|
144
|
+
after: { x: afterX, y: afterY },
|
|
145
|
+
};
|
|
146
|
+
hasUIChanges = true;
|
|
147
|
+
}
|
|
148
|
+
const beforeWidth = beforeUI?.width ?? 0;
|
|
149
|
+
const beforeHeight = beforeUI?.height ?? 0;
|
|
150
|
+
const afterWidth = afterUI?.width ?? 0;
|
|
151
|
+
const afterHeight = afterUI?.height ?? 0;
|
|
152
|
+
if (beforeWidth !== afterWidth || beforeHeight !== afterHeight) {
|
|
153
|
+
uiChanges.size = {
|
|
154
|
+
type: 'MODIFIED',
|
|
155
|
+
before: { width: beforeWidth, height: beforeHeight },
|
|
156
|
+
after: { width: afterWidth, height: afterHeight },
|
|
157
|
+
};
|
|
158
|
+
hasUIChanges = true;
|
|
159
|
+
}
|
|
160
|
+
const beforeMinimized = beforeUI?.minimized ?? false;
|
|
161
|
+
const afterMinimized = afterUI?.minimized ?? false;
|
|
162
|
+
if (beforeMinimized !== afterMinimized) {
|
|
163
|
+
uiChanges.minimized = { type: 'MODIFIED', before: beforeMinimized, after: afterMinimized };
|
|
164
|
+
hasUIChanges = true;
|
|
165
|
+
}
|
|
166
|
+
return hasUIChanges ? uiChanges : null;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Compare instances semantically
|
|
170
|
+
*/
|
|
171
|
+
function compareInstance(before, after, beforeUI, afterUI) {
|
|
172
|
+
const changes = {};
|
|
173
|
+
let hasChanges = false;
|
|
174
|
+
// Compare nodeType
|
|
175
|
+
if (before.nodeType !== after.nodeType) {
|
|
176
|
+
changes.nodeType = { type: 'MODIFIED', before: before.nodeType, after: after.nodeType };
|
|
177
|
+
hasChanges = true;
|
|
178
|
+
}
|
|
179
|
+
// Compare parent
|
|
180
|
+
const beforeParent = before.parent ?? null;
|
|
181
|
+
const afterParent = after.parent ?? null;
|
|
182
|
+
if (JSON.stringify(beforeParent) !== JSON.stringify(afterParent)) {
|
|
183
|
+
changes.parent = { type: 'MODIFIED', before: beforeParent, after: afterParent };
|
|
184
|
+
hasChanges = true;
|
|
185
|
+
}
|
|
186
|
+
// Compare config (only semantic fields: pullExecution, portConfigs)
|
|
187
|
+
const beforeConfig = before.config;
|
|
188
|
+
const afterConfig = after.config;
|
|
189
|
+
const configChanges = {};
|
|
190
|
+
let hasConfigChanges = false;
|
|
191
|
+
// pullExecution
|
|
192
|
+
const beforePullExec = beforeConfig?.pullExecution;
|
|
193
|
+
const afterPullExec = afterConfig?.pullExecution;
|
|
194
|
+
if (JSON.stringify(beforePullExec) !== JSON.stringify(afterPullExec)) {
|
|
195
|
+
configChanges.pullExecution = { type: 'MODIFIED', before: beforePullExec, after: afterPullExec };
|
|
196
|
+
hasConfigChanges = true;
|
|
197
|
+
}
|
|
198
|
+
// portConfigs
|
|
199
|
+
const beforePortConfigs = beforeConfig?.portConfigs;
|
|
200
|
+
const afterPortConfigs = afterConfig?.portConfigs;
|
|
201
|
+
if (JSON.stringify(beforePortConfigs) !== JSON.stringify(afterPortConfigs)) {
|
|
202
|
+
configChanges.portConfigs = { type: 'MODIFIED', before: beforePortConfigs, after: afterPortConfigs };
|
|
203
|
+
hasConfigChanges = true;
|
|
204
|
+
}
|
|
205
|
+
if (hasConfigChanges) {
|
|
206
|
+
changes.config = configChanges;
|
|
207
|
+
hasChanges = true;
|
|
208
|
+
}
|
|
209
|
+
// Compare UI data
|
|
210
|
+
const uiChanges = compareInstanceUI(beforeUI, afterUI);
|
|
211
|
+
if (uiChanges) {
|
|
212
|
+
changes.ui = uiChanges;
|
|
213
|
+
hasChanges = true;
|
|
214
|
+
}
|
|
215
|
+
if (!hasChanges)
|
|
216
|
+
return null;
|
|
217
|
+
return {
|
|
218
|
+
id: before.id,
|
|
219
|
+
changeType: 'MODIFIED',
|
|
220
|
+
changes,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Compare workflow ports (startPorts or exitPorts)
|
|
225
|
+
*/
|
|
226
|
+
function compareWorkflowPorts(beforePorts, afterPorts) {
|
|
227
|
+
const result = {
|
|
228
|
+
added: [],
|
|
229
|
+
removed: [],
|
|
230
|
+
modified: [],
|
|
231
|
+
};
|
|
232
|
+
const beforeKeys = new Set(Object.keys(beforePorts));
|
|
233
|
+
const afterKeys = new Set(Object.keys(afterPorts));
|
|
234
|
+
// Added
|
|
235
|
+
for (const key of afterKeys) {
|
|
236
|
+
if (!beforeKeys.has(key)) {
|
|
237
|
+
result.added.push({ name: key, definition: afterPorts[key] });
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
// Removed
|
|
241
|
+
for (const key of beforeKeys) {
|
|
242
|
+
if (!afterKeys.has(key)) {
|
|
243
|
+
result.removed.push({ name: key, definition: beforePorts[key] });
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
// Modified
|
|
247
|
+
for (const key of beforeKeys) {
|
|
248
|
+
if (afterKeys.has(key) && !portDefinitionEquals(beforePorts[key], afterPorts[key])) {
|
|
249
|
+
result.modified.push({
|
|
250
|
+
name: key,
|
|
251
|
+
before: beforePorts[key],
|
|
252
|
+
after: afterPorts[key],
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return result;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Calculate overall impact level
|
|
260
|
+
*/
|
|
261
|
+
function calculateImpact(diff) {
|
|
262
|
+
// CRITICAL: Removed connections to Exit or from Start
|
|
263
|
+
const criticalConnections = diff.connections.some(c => c.changeType === 'REMOVED' && (c.from.node === 'Start' || c.to.node === 'Exit'));
|
|
264
|
+
if (criticalConnections)
|
|
265
|
+
return 'CRITICAL';
|
|
266
|
+
// CRITICAL: Removed start/exit ports
|
|
267
|
+
if (diff.startPorts.removed.length > 0 || diff.exitPorts.removed.length > 0) {
|
|
268
|
+
return 'CRITICAL';
|
|
269
|
+
}
|
|
270
|
+
// BREAKING: Removed node types, instances, or connections
|
|
271
|
+
if (diff.summary.nodeTypesRemoved > 0 ||
|
|
272
|
+
diff.summary.instancesRemoved > 0 ||
|
|
273
|
+
diff.summary.connectionsRemoved > 0) {
|
|
274
|
+
return 'BREAKING';
|
|
275
|
+
}
|
|
276
|
+
// BREAKING: Port dataType changes
|
|
277
|
+
const hasBreakingPortChanges = diff.nodeTypes.some(nt => {
|
|
278
|
+
const inputChanges = nt.changes.inputs?.some(p => p.type === 'REMOVED' || (p.type === 'MODIFIED' && p.before?.dataType !== p.after?.dataType));
|
|
279
|
+
const outputChanges = nt.changes.outputs?.some(p => p.type === 'REMOVED' || (p.type === 'MODIFIED' && p.before?.dataType !== p.after?.dataType));
|
|
280
|
+
return inputChanges || outputChanges;
|
|
281
|
+
});
|
|
282
|
+
if (hasBreakingPortChanges)
|
|
283
|
+
return 'BREAKING';
|
|
284
|
+
// MINOR: Added nodes, instances, connections, or ports
|
|
285
|
+
if (diff.summary.nodeTypesAdded > 0 ||
|
|
286
|
+
diff.summary.instancesAdded > 0 ||
|
|
287
|
+
diff.summary.connectionsAdded > 0 ||
|
|
288
|
+
diff.startPorts.added.length > 0 ||
|
|
289
|
+
diff.exitPorts.added.length > 0) {
|
|
290
|
+
return 'MINOR';
|
|
291
|
+
}
|
|
292
|
+
// MINOR: Modified nodes or instances
|
|
293
|
+
if (diff.summary.nodeTypesModified > 0 || diff.summary.instancesModified > 0) {
|
|
294
|
+
return 'MINOR';
|
|
295
|
+
}
|
|
296
|
+
// COSMETIC: No semantic changes
|
|
297
|
+
return 'COSMETIC';
|
|
298
|
+
}
|
|
299
|
+
export class WorkflowDiffer {
|
|
300
|
+
/**
|
|
301
|
+
* Compare two workflows and return semantic diff
|
|
302
|
+
*/
|
|
303
|
+
static compare(before, after) {
|
|
304
|
+
const nodeTypes = [];
|
|
305
|
+
const instances = [];
|
|
306
|
+
const connections = [];
|
|
307
|
+
const scopes = [];
|
|
308
|
+
// Build lookup maps
|
|
309
|
+
const beforeNodeTypes = new Map(before.nodeTypes.map(nt => [nt.name, nt]));
|
|
310
|
+
const afterNodeTypes = new Map(after.nodeTypes.map(nt => [nt.name, nt]));
|
|
311
|
+
const beforeInstances = new Map(before.instances.map(i => [i.id, i]));
|
|
312
|
+
const afterInstances = new Map(after.instances.map(i => [i.id, i]));
|
|
313
|
+
const beforeConnections = new Map(before.connections.map(c => [connectionKey(c), c]));
|
|
314
|
+
const afterConnections = new Map(after.connections.map(c => [connectionKey(c), c]));
|
|
315
|
+
const beforeScopes = before.scopes ?? {};
|
|
316
|
+
const afterScopes = after.scopes ?? {};
|
|
317
|
+
// Build UI lookup maps
|
|
318
|
+
const beforeUIInstances = new Map((before.ui?.instances ?? []).map(ui => [ui.name, ui]));
|
|
319
|
+
const afterUIInstances = new Map((after.ui?.instances ?? []).map(ui => [ui.name, ui]));
|
|
320
|
+
// Compare node types
|
|
321
|
+
for (const [name, nt] of afterNodeTypes) {
|
|
322
|
+
if (!beforeNodeTypes.has(name)) {
|
|
323
|
+
nodeTypes.push({ name, changeType: 'ADDED', changes: {} });
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
const diff = compareNodeType(beforeNodeTypes.get(name), nt);
|
|
327
|
+
if (diff)
|
|
328
|
+
nodeTypes.push(diff);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
for (const [name] of beforeNodeTypes) {
|
|
332
|
+
if (!afterNodeTypes.has(name)) {
|
|
333
|
+
nodeTypes.push({ name, changeType: 'REMOVED', changes: {} });
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
// Compare instances
|
|
337
|
+
for (const [id, inst] of afterInstances) {
|
|
338
|
+
if (!beforeInstances.has(id)) {
|
|
339
|
+
instances.push({ id, changeType: 'ADDED', changes: {} });
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
const diff = compareInstance(beforeInstances.get(id), inst, beforeUIInstances.get(id), afterUIInstances.get(id));
|
|
343
|
+
if (diff)
|
|
344
|
+
instances.push(diff);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
for (const [id] of beforeInstances) {
|
|
348
|
+
if (!afterInstances.has(id)) {
|
|
349
|
+
instances.push({ id, changeType: 'REMOVED', changes: {} });
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
// Compare connections
|
|
353
|
+
for (const [key, conn] of afterConnections) {
|
|
354
|
+
if (!beforeConnections.has(key)) {
|
|
355
|
+
connections.push({
|
|
356
|
+
changeType: 'ADDED',
|
|
357
|
+
from: { node: conn.from.node, port: conn.from.port, scope: conn.from.scope },
|
|
358
|
+
to: { node: conn.to.node, port: conn.to.port, scope: conn.to.scope },
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
for (const [key, conn] of beforeConnections) {
|
|
363
|
+
if (!afterConnections.has(key)) {
|
|
364
|
+
connections.push({
|
|
365
|
+
changeType: 'REMOVED',
|
|
366
|
+
from: { node: conn.from.node, port: conn.from.port, scope: conn.from.scope },
|
|
367
|
+
to: { node: conn.to.node, port: conn.to.port, scope: conn.to.scope },
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
// Compare scopes
|
|
372
|
+
const allScopeNames = new Set([...Object.keys(beforeScopes), ...Object.keys(afterScopes)]);
|
|
373
|
+
for (const name of allScopeNames) {
|
|
374
|
+
const beforeMembers = beforeScopes[name];
|
|
375
|
+
const afterMembers = afterScopes[name];
|
|
376
|
+
if (!beforeMembers) {
|
|
377
|
+
scopes.push({ name, changeType: 'ADDED', after: afterMembers });
|
|
378
|
+
}
|
|
379
|
+
else if (!afterMembers) {
|
|
380
|
+
scopes.push({ name, changeType: 'REMOVED', before: beforeMembers });
|
|
381
|
+
}
|
|
382
|
+
else if (JSON.stringify(beforeMembers.sort()) !== JSON.stringify(afterMembers.sort())) {
|
|
383
|
+
scopes.push({ name, changeType: 'MODIFIED', before: beforeMembers, after: afterMembers });
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
// Compare start/exit ports
|
|
387
|
+
const startPorts = compareWorkflowPorts(before.startPorts, after.startPorts);
|
|
388
|
+
const exitPorts = compareWorkflowPorts(before.exitPorts, after.exitPorts);
|
|
389
|
+
// Calculate summary
|
|
390
|
+
const modifiedInstances = instances.filter(i => i.changeType === 'MODIFIED');
|
|
391
|
+
const summary = {
|
|
392
|
+
nodeTypesAdded: nodeTypes.filter(nt => nt.changeType === 'ADDED').length,
|
|
393
|
+
nodeTypesRemoved: nodeTypes.filter(nt => nt.changeType === 'REMOVED').length,
|
|
394
|
+
nodeTypesModified: nodeTypes.filter(nt => nt.changeType === 'MODIFIED').length,
|
|
395
|
+
instancesAdded: instances.filter(i => i.changeType === 'ADDED').length,
|
|
396
|
+
instancesRemoved: instances.filter(i => i.changeType === 'REMOVED').length,
|
|
397
|
+
instancesModified: modifiedInstances.filter(i => i.changes.nodeType || i.changes.config || i.changes.parent).length,
|
|
398
|
+
instancesUIModified: modifiedInstances.filter(i => i.changes.ui).length,
|
|
399
|
+
connectionsAdded: connections.filter(c => c.changeType === 'ADDED').length,
|
|
400
|
+
connectionsRemoved: connections.filter(c => c.changeType === 'REMOVED').length,
|
|
401
|
+
};
|
|
402
|
+
// Check if identical
|
|
403
|
+
const identical = nodeTypes.length === 0 &&
|
|
404
|
+
instances.length === 0 &&
|
|
405
|
+
connections.length === 0 &&
|
|
406
|
+
scopes.length === 0 &&
|
|
407
|
+
startPorts.added.length === 0 &&
|
|
408
|
+
startPorts.removed.length === 0 &&
|
|
409
|
+
startPorts.modified.length === 0 &&
|
|
410
|
+
exitPorts.added.length === 0 &&
|
|
411
|
+
exitPorts.removed.length === 0 &&
|
|
412
|
+
exitPorts.modified.length === 0;
|
|
413
|
+
const partialDiff = {
|
|
414
|
+
identical,
|
|
415
|
+
summary,
|
|
416
|
+
nodeTypes,
|
|
417
|
+
instances,
|
|
418
|
+
connections,
|
|
419
|
+
startPorts,
|
|
420
|
+
exitPorts,
|
|
421
|
+
scopes,
|
|
422
|
+
};
|
|
423
|
+
return {
|
|
424
|
+
...partialDiff,
|
|
425
|
+
impact: identical ? 'COSMETIC' : calculateImpact(partialDiff),
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
//# sourceMappingURL=WorkflowDiffer.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Human-readable diff formatter for workflow diffs.
|
|
3
|
+
*/
|
|
4
|
+
import type { TWorkflowDiff } from './types.js';
|
|
5
|
+
export type TDiffFormat = 'text' | 'json' | 'compact';
|
|
6
|
+
/**
|
|
7
|
+
* Format a workflow diff for display
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatDiff(diff: TWorkflowDiff, format?: TDiffFormat): string;
|
|
10
|
+
//# sourceMappingURL=formatDiff.d.ts.map
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Human-readable diff formatter for workflow diffs.
|
|
3
|
+
*/
|
|
4
|
+
import { IMPACT_DESCRIPTIONS, getImpactReasons } from './impact.js';
|
|
5
|
+
/**
|
|
6
|
+
* Format a workflow diff for display
|
|
7
|
+
*/
|
|
8
|
+
export function formatDiff(diff, format = 'text') {
|
|
9
|
+
switch (format) {
|
|
10
|
+
case 'json':
|
|
11
|
+
return JSON.stringify(diff, null, 2);
|
|
12
|
+
case 'compact':
|
|
13
|
+
return formatCompact(diff);
|
|
14
|
+
case 'text':
|
|
15
|
+
default:
|
|
16
|
+
return formatText(diff);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Compact single-line format
|
|
21
|
+
*/
|
|
22
|
+
function formatCompact(diff) {
|
|
23
|
+
if (diff.identical) {
|
|
24
|
+
return 'No changes';
|
|
25
|
+
}
|
|
26
|
+
const parts = [];
|
|
27
|
+
const { summary } = diff;
|
|
28
|
+
if (summary.nodeTypesAdded > 0)
|
|
29
|
+
parts.push(`+${summary.nodeTypesAdded} types`);
|
|
30
|
+
if (summary.nodeTypesRemoved > 0)
|
|
31
|
+
parts.push(`-${summary.nodeTypesRemoved} types`);
|
|
32
|
+
if (summary.nodeTypesModified > 0)
|
|
33
|
+
parts.push(`~${summary.nodeTypesModified} types`);
|
|
34
|
+
if (summary.instancesAdded > 0)
|
|
35
|
+
parts.push(`+${summary.instancesAdded} nodes`);
|
|
36
|
+
if (summary.instancesRemoved > 0)
|
|
37
|
+
parts.push(`-${summary.instancesRemoved} nodes`);
|
|
38
|
+
if (summary.instancesModified > 0)
|
|
39
|
+
parts.push(`~${summary.instancesModified} nodes`);
|
|
40
|
+
if (summary.connectionsAdded > 0)
|
|
41
|
+
parts.push(`+${summary.connectionsAdded} conns`);
|
|
42
|
+
if (summary.connectionsRemoved > 0)
|
|
43
|
+
parts.push(`-${summary.connectionsRemoved} conns`);
|
|
44
|
+
return `[${diff.impact}] ${parts.join(', ')}`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Full text format
|
|
48
|
+
*/
|
|
49
|
+
function formatText(diff) {
|
|
50
|
+
const lines = [];
|
|
51
|
+
// Header
|
|
52
|
+
lines.push('═══════════════════════════════════════════════════════════════');
|
|
53
|
+
lines.push(` WORKFLOW DIFF - Impact: ${diff.impact}`);
|
|
54
|
+
lines.push('═══════════════════════════════════════════════════════════════');
|
|
55
|
+
lines.push('');
|
|
56
|
+
if (diff.identical) {
|
|
57
|
+
lines.push(' ✓ Workflows are semantically identical');
|
|
58
|
+
lines.push('');
|
|
59
|
+
return lines.join('\n');
|
|
60
|
+
}
|
|
61
|
+
// Impact description
|
|
62
|
+
lines.push(` ${IMPACT_DESCRIPTIONS[diff.impact]}`);
|
|
63
|
+
lines.push('');
|
|
64
|
+
// Summary
|
|
65
|
+
lines.push(' SUMMARY');
|
|
66
|
+
lines.push(' ───────────────────────────────────────────────────────────');
|
|
67
|
+
lines.push(` Node Types: +${diff.summary.nodeTypesAdded} added, -${diff.summary.nodeTypesRemoved} removed, ~${diff.summary.nodeTypesModified} modified`);
|
|
68
|
+
lines.push(` Instances: +${diff.summary.instancesAdded} added, -${diff.summary.instancesRemoved} removed, ~${diff.summary.instancesModified} modified`);
|
|
69
|
+
lines.push(` Connections: +${diff.summary.connectionsAdded} added, -${diff.summary.connectionsRemoved} removed`);
|
|
70
|
+
lines.push('');
|
|
71
|
+
// Node Types
|
|
72
|
+
if (diff.nodeTypes.length > 0) {
|
|
73
|
+
lines.push(' NODE TYPES');
|
|
74
|
+
lines.push(' ───────────────────────────────────────────────────────────');
|
|
75
|
+
for (const nt of diff.nodeTypes) {
|
|
76
|
+
lines.push(formatNodeType(nt));
|
|
77
|
+
}
|
|
78
|
+
lines.push('');
|
|
79
|
+
}
|
|
80
|
+
// Instances
|
|
81
|
+
if (diff.instances.length > 0) {
|
|
82
|
+
lines.push(' INSTANCES');
|
|
83
|
+
lines.push(' ───────────────────────────────────────────────────────────');
|
|
84
|
+
for (const inst of diff.instances) {
|
|
85
|
+
lines.push(formatInstance(inst));
|
|
86
|
+
}
|
|
87
|
+
lines.push('');
|
|
88
|
+
}
|
|
89
|
+
// Connections
|
|
90
|
+
if (diff.connections.length > 0) {
|
|
91
|
+
lines.push(' CONNECTIONS');
|
|
92
|
+
lines.push(' ───────────────────────────────────────────────────────────');
|
|
93
|
+
for (const conn of diff.connections) {
|
|
94
|
+
lines.push(formatConnection(conn));
|
|
95
|
+
}
|
|
96
|
+
lines.push('');
|
|
97
|
+
}
|
|
98
|
+
// Start/Exit Ports
|
|
99
|
+
const hasPortChanges = diff.startPorts.added.length > 0 ||
|
|
100
|
+
diff.startPorts.removed.length > 0 ||
|
|
101
|
+
diff.startPorts.modified.length > 0 ||
|
|
102
|
+
diff.exitPorts.added.length > 0 ||
|
|
103
|
+
diff.exitPorts.removed.length > 0 ||
|
|
104
|
+
diff.exitPorts.modified.length > 0;
|
|
105
|
+
if (hasPortChanges) {
|
|
106
|
+
lines.push(' WORKFLOW PORTS');
|
|
107
|
+
lines.push(' ───────────────────────────────────────────────────────────');
|
|
108
|
+
if (diff.startPorts.added.length > 0) {
|
|
109
|
+
lines.push(` + Start ports added: ${diff.startPorts.added.map(p => p.name).join(', ')}`);
|
|
110
|
+
}
|
|
111
|
+
if (diff.startPorts.removed.length > 0) {
|
|
112
|
+
lines.push(` - Start ports removed: ${diff.startPorts.removed.map(p => p.name).join(', ')}`);
|
|
113
|
+
}
|
|
114
|
+
if (diff.startPorts.modified.length > 0) {
|
|
115
|
+
lines.push(` ~ Start ports modified: ${diff.startPorts.modified.map(p => p.name).join(', ')}`);
|
|
116
|
+
}
|
|
117
|
+
if (diff.exitPorts.added.length > 0) {
|
|
118
|
+
lines.push(` + Exit ports added: ${diff.exitPorts.added.map(p => p.name).join(', ')}`);
|
|
119
|
+
}
|
|
120
|
+
if (diff.exitPorts.removed.length > 0) {
|
|
121
|
+
lines.push(` - Exit ports removed: ${diff.exitPorts.removed.map(p => p.name).join(', ')}`);
|
|
122
|
+
}
|
|
123
|
+
if (diff.exitPorts.modified.length > 0) {
|
|
124
|
+
lines.push(` ~ Exit ports modified: ${diff.exitPorts.modified.map(p => p.name).join(', ')}`);
|
|
125
|
+
}
|
|
126
|
+
lines.push('');
|
|
127
|
+
}
|
|
128
|
+
// Scopes
|
|
129
|
+
if (diff.scopes.length > 0) {
|
|
130
|
+
lines.push(' SCOPES');
|
|
131
|
+
lines.push(' ───────────────────────────────────────────────────────────');
|
|
132
|
+
for (const scope of diff.scopes) {
|
|
133
|
+
const symbol = scope.changeType === 'ADDED' ? '+' : scope.changeType === 'REMOVED' ? '-' : '~';
|
|
134
|
+
lines.push(` ${symbol} ${scope.name}`);
|
|
135
|
+
}
|
|
136
|
+
lines.push('');
|
|
137
|
+
}
|
|
138
|
+
// Reasons
|
|
139
|
+
const reasons = getImpactReasons(diff);
|
|
140
|
+
if (reasons.length > 0) {
|
|
141
|
+
lines.push(' CHANGE DETAILS');
|
|
142
|
+
lines.push(' ───────────────────────────────────────────────────────────');
|
|
143
|
+
for (const reason of reasons) {
|
|
144
|
+
lines.push(` • ${reason}`);
|
|
145
|
+
}
|
|
146
|
+
lines.push('');
|
|
147
|
+
}
|
|
148
|
+
return lines.join('\n');
|
|
149
|
+
}
|
|
150
|
+
function formatNodeType(nt) {
|
|
151
|
+
const symbol = nt.changeType === 'ADDED' ? '+' : nt.changeType === 'REMOVED' ? '-' : '~';
|
|
152
|
+
let line = ` ${symbol} ${nt.name}`;
|
|
153
|
+
if (nt.changeType === 'MODIFIED') {
|
|
154
|
+
const details = [];
|
|
155
|
+
if (nt.changes.functionName)
|
|
156
|
+
details.push(`functionName: ${nt.changes.functionName.before} → ${nt.changes.functionName.after}`);
|
|
157
|
+
if (nt.changes.isAsync)
|
|
158
|
+
details.push(`async: ${nt.changes.isAsync.before} → ${nt.changes.isAsync.after}`);
|
|
159
|
+
if (nt.changes.executeWhen)
|
|
160
|
+
details.push(`executeWhen: ${nt.changes.executeWhen.before} → ${nt.changes.executeWhen.after}`);
|
|
161
|
+
if (nt.changes.inputs) {
|
|
162
|
+
const added = nt.changes.inputs.filter(p => p.type === 'ADDED').map(p => p.portName);
|
|
163
|
+
const removed = nt.changes.inputs.filter(p => p.type === 'REMOVED').map(p => p.portName);
|
|
164
|
+
const modified = nt.changes.inputs.filter(p => p.type === 'MODIFIED').map(p => p.portName);
|
|
165
|
+
if (added.length > 0)
|
|
166
|
+
details.push(`+inputs: ${added.join(', ')}`);
|
|
167
|
+
if (removed.length > 0)
|
|
168
|
+
details.push(`-inputs: ${removed.join(', ')}`);
|
|
169
|
+
if (modified.length > 0)
|
|
170
|
+
details.push(`~inputs: ${modified.join(', ')}`);
|
|
171
|
+
}
|
|
172
|
+
if (nt.changes.outputs) {
|
|
173
|
+
const added = nt.changes.outputs.filter(p => p.type === 'ADDED').map(p => p.portName);
|
|
174
|
+
const removed = nt.changes.outputs.filter(p => p.type === 'REMOVED').map(p => p.portName);
|
|
175
|
+
const modified = nt.changes.outputs.filter(p => p.type === 'MODIFIED').map(p => p.portName);
|
|
176
|
+
if (added.length > 0)
|
|
177
|
+
details.push(`+outputs: ${added.join(', ')}`);
|
|
178
|
+
if (removed.length > 0)
|
|
179
|
+
details.push(`-outputs: ${removed.join(', ')}`);
|
|
180
|
+
if (modified.length > 0)
|
|
181
|
+
details.push(`~outputs: ${modified.join(', ')}`);
|
|
182
|
+
}
|
|
183
|
+
if (details.length > 0) {
|
|
184
|
+
line += ` (${details.join('; ')})`;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return line;
|
|
188
|
+
}
|
|
189
|
+
function formatInstance(inst) {
|
|
190
|
+
const symbol = inst.changeType === 'ADDED' ? '+' : inst.changeType === 'REMOVED' ? '-' : '~';
|
|
191
|
+
let line = ` ${symbol} ${inst.id}`;
|
|
192
|
+
if (inst.changeType === 'MODIFIED') {
|
|
193
|
+
const details = [];
|
|
194
|
+
if (inst.changes.nodeType) {
|
|
195
|
+
details.push(`type: ${inst.changes.nodeType.before} → ${inst.changes.nodeType.after}`);
|
|
196
|
+
}
|
|
197
|
+
if (inst.changes.parent) {
|
|
198
|
+
const before = inst.changes.parent.before ? `${inst.changes.parent.before.id}.${inst.changes.parent.before.scope}` : 'none';
|
|
199
|
+
const after = inst.changes.parent.after ? `${inst.changes.parent.after.id}.${inst.changes.parent.after.scope}` : 'none';
|
|
200
|
+
details.push(`parent: ${before} → ${after}`);
|
|
201
|
+
}
|
|
202
|
+
if (inst.changes.config?.pullExecution) {
|
|
203
|
+
details.push(`pullExecution changed`);
|
|
204
|
+
}
|
|
205
|
+
if (inst.changes.config?.portConfigs) {
|
|
206
|
+
details.push(`portConfigs changed`);
|
|
207
|
+
}
|
|
208
|
+
if (details.length > 0) {
|
|
209
|
+
line += ` (${details.join('; ')})`;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return line;
|
|
213
|
+
}
|
|
214
|
+
function formatConnection(conn) {
|
|
215
|
+
const symbol = conn.changeType === 'ADDED' ? '+' : '-';
|
|
216
|
+
const fromScope = conn.from.scope ? `:${conn.from.scope}` : '';
|
|
217
|
+
const toScope = conn.to.scope ? `:${conn.to.scope}` : '';
|
|
218
|
+
return ` ${symbol} ${conn.from.node}.${conn.from.port}${fromScope} → ${conn.to.node}.${conn.to.port}${toScope}`;
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=formatDiff.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Impact assessment utilities for workflow diffs.
|
|
3
|
+
*/
|
|
4
|
+
import type { TWorkflowDiff, TImpactLevel, TNodeTypeDiff, TConnectionDiff } from './types.js';
|
|
5
|
+
/** Impact level descriptions */
|
|
6
|
+
export declare const IMPACT_DESCRIPTIONS: Record<TImpactLevel, string>;
|
|
7
|
+
/** Impact level colors for CLI/UI */
|
|
8
|
+
export declare const IMPACT_COLORS: Record<TImpactLevel, string>;
|
|
9
|
+
/**
|
|
10
|
+
* Get detailed impact reasons from a diff
|
|
11
|
+
*/
|
|
12
|
+
export declare function getImpactReasons(diff: TWorkflowDiff): string[];
|
|
13
|
+
/**
|
|
14
|
+
* Check if a diff has breaking changes
|
|
15
|
+
*/
|
|
16
|
+
export declare function hasBreakingChanges(diff: TWorkflowDiff): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Get changed node types grouped by change type
|
|
19
|
+
*/
|
|
20
|
+
export declare function getNodeTypeChanges(diff: TWorkflowDiff): {
|
|
21
|
+
added: TNodeTypeDiff[];
|
|
22
|
+
removed: TNodeTypeDiff[];
|
|
23
|
+
modified: TNodeTypeDiff[];
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Get critical connections (to/from Start/Exit)
|
|
27
|
+
*/
|
|
28
|
+
export declare function getCriticalConnections(diff: TWorkflowDiff): TConnectionDiff[];
|
|
29
|
+
//# sourceMappingURL=impact.d.ts.map
|