@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,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module marketplace
|
|
3
|
+
*
|
|
4
|
+
* Flow Weaver Marketplace — discover, install, and publish reusable
|
|
5
|
+
* node types, workflows, and patterns via npm.
|
|
6
|
+
*/
|
|
7
|
+
export { generateManifest, writeManifest, readManifest, } from './manifest.js';
|
|
8
|
+
export { validatePackage } from './validator.js';
|
|
9
|
+
export { searchPackages, listInstalledPackages, getInstalledPackageManifest, } from './registry.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest generation — converts parsed ASTs into a flowweaver.manifest.json file.
|
|
3
|
+
*
|
|
4
|
+
* The manifest mirrors AST types so the editor can consume it directly
|
|
5
|
+
* without re-parsing source files.
|
|
6
|
+
*/
|
|
7
|
+
import type { TMarketplaceManifest } from './types.js';
|
|
8
|
+
export interface GenerateManifestOptions {
|
|
9
|
+
/** Root directory of the marketplace package */
|
|
10
|
+
directory: string;
|
|
11
|
+
/** Source directory to scan (default: "src") */
|
|
12
|
+
srcDir?: string;
|
|
13
|
+
/** Dist directory for compiled output paths (default: "dist") */
|
|
14
|
+
distDir?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface GenerateManifestResult {
|
|
17
|
+
manifest: TMarketplaceManifest;
|
|
18
|
+
/** Source files that were parsed */
|
|
19
|
+
parsedFiles: string[];
|
|
20
|
+
/** Parse errors encountered */
|
|
21
|
+
errors: string[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Generate a marketplace manifest by parsing all annotated source files
|
|
25
|
+
* in the package directory.
|
|
26
|
+
*/
|
|
27
|
+
export declare function generateManifest(options: GenerateManifestOptions): Promise<GenerateManifestResult>;
|
|
28
|
+
/** Write manifest JSON to disk. */
|
|
29
|
+
export declare function writeManifest(directory: string, manifest: TMarketplaceManifest): string;
|
|
30
|
+
/** Read manifest JSON from disk. */
|
|
31
|
+
export declare function readManifest(directory: string): TMarketplaceManifest | null;
|
|
32
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest generation — converts parsed ASTs into a flowweaver.manifest.json file.
|
|
3
|
+
*
|
|
4
|
+
* The manifest mirrors AST types so the editor can consume it directly
|
|
5
|
+
* without re-parsing source files.
|
|
6
|
+
*/
|
|
7
|
+
import * as fs from 'fs';
|
|
8
|
+
import * as path from 'path';
|
|
9
|
+
import { glob } from 'glob';
|
|
10
|
+
import { AnnotationParser } from '../parser.js';
|
|
11
|
+
// ── Port mapping ─────────────────────────────────────────────────────────────
|
|
12
|
+
function toManifestPort(port) {
|
|
13
|
+
return {
|
|
14
|
+
dataType: port.dataType,
|
|
15
|
+
...(port.description && { description: port.description }),
|
|
16
|
+
...(port.optional && { optional: true }),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function toManifestPortFromPattern(port) {
|
|
20
|
+
return {
|
|
21
|
+
dataType: port.dataType ?? 'ANY',
|
|
22
|
+
...(port.description && { description: port.description }),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function toManifestPorts(ports) {
|
|
26
|
+
const result = {};
|
|
27
|
+
for (const [name, def] of Object.entries(ports)) {
|
|
28
|
+
result[name] = toManifestPort(def);
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
// ── AST → Manifest mapping ──────────────────────────────────────────────────
|
|
33
|
+
function nodeTypeToManifest(nt, relativeFile) {
|
|
34
|
+
return {
|
|
35
|
+
name: nt.name,
|
|
36
|
+
...(nt.description && { description: nt.description }),
|
|
37
|
+
file: relativeFile,
|
|
38
|
+
functionName: nt.functionName,
|
|
39
|
+
isAsync: nt.isAsync,
|
|
40
|
+
inputs: toManifestPorts(nt.inputs),
|
|
41
|
+
outputs: toManifestPorts(nt.outputs),
|
|
42
|
+
...(nt.visuals && {
|
|
43
|
+
visuals: {
|
|
44
|
+
...(nt.visuals.color && { color: nt.visuals.color }),
|
|
45
|
+
...(nt.visuals.icon && { icon: nt.visuals.icon }),
|
|
46
|
+
...(nt.visuals.tags && { tags: nt.visuals.tags }),
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function workflowToManifest(wf, relativeFile) {
|
|
52
|
+
return {
|
|
53
|
+
name: wf.name,
|
|
54
|
+
...(wf.description && { description: wf.description }),
|
|
55
|
+
file: relativeFile,
|
|
56
|
+
functionName: wf.functionName,
|
|
57
|
+
startPorts: toManifestPorts(wf.startPorts),
|
|
58
|
+
exitPorts: toManifestPorts(wf.exitPorts),
|
|
59
|
+
nodeCount: wf.instances.length,
|
|
60
|
+
connectionCount: wf.connections.length,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function patternToManifest(pat, relativeFile) {
|
|
64
|
+
const inputPorts = {};
|
|
65
|
+
for (const [name, def] of Object.entries(pat.inputPorts)) {
|
|
66
|
+
inputPorts[name] = toManifestPortFromPattern(def);
|
|
67
|
+
}
|
|
68
|
+
const outputPorts = {};
|
|
69
|
+
for (const [name, def] of Object.entries(pat.outputPorts)) {
|
|
70
|
+
outputPorts[name] = toManifestPortFromPattern(def);
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
name: pat.name,
|
|
74
|
+
...(pat.description && { description: pat.description }),
|
|
75
|
+
file: relativeFile,
|
|
76
|
+
inputPorts,
|
|
77
|
+
outputPorts,
|
|
78
|
+
nodeCount: pat.instances.length,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Generate a marketplace manifest by parsing all annotated source files
|
|
83
|
+
* in the package directory.
|
|
84
|
+
*/
|
|
85
|
+
export async function generateManifest(options) {
|
|
86
|
+
const { directory, srcDir = 'src', distDir = 'dist' } = options;
|
|
87
|
+
// Read package.json
|
|
88
|
+
const pkgPath = path.join(directory, 'package.json');
|
|
89
|
+
if (!fs.existsSync(pkgPath)) {
|
|
90
|
+
return {
|
|
91
|
+
manifest: emptyManifest('unknown', '0.0.0'),
|
|
92
|
+
parsedFiles: [],
|
|
93
|
+
errors: ['package.json not found'],
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
97
|
+
const srcRoot = path.join(directory, srcDir);
|
|
98
|
+
// Find all TypeScript files in src/
|
|
99
|
+
const pattern = path.join(srcRoot, '**/*.ts').replace(/\\/g, '/');
|
|
100
|
+
const files = await glob(pattern, { absolute: true });
|
|
101
|
+
const tsFiles = files.filter((f) => !f.endsWith('.d.ts') && !f.includes('node_modules'));
|
|
102
|
+
const parser = new AnnotationParser();
|
|
103
|
+
const allNodeTypes = [];
|
|
104
|
+
const allWorkflows = [];
|
|
105
|
+
const allPatterns = [];
|
|
106
|
+
const errors = [];
|
|
107
|
+
const parsedFiles = [];
|
|
108
|
+
for (const file of tsFiles) {
|
|
109
|
+
try {
|
|
110
|
+
const result = parser.parse(file);
|
|
111
|
+
parsedFiles.push(file);
|
|
112
|
+
// Map source paths to dist paths: src/foo/bar.ts → dist/foo/bar.js
|
|
113
|
+
const relFromSrc = path.relative(srcRoot, file);
|
|
114
|
+
const distRelative = path.join(distDir, relFromSrc.replace(/\.ts$/, '.js'));
|
|
115
|
+
// Collect standalone node types (not embedded in workflows)
|
|
116
|
+
for (const nt of result.nodeTypes) {
|
|
117
|
+
allNodeTypes.push(nodeTypeToManifest(nt, distRelative));
|
|
118
|
+
}
|
|
119
|
+
// Collect workflows
|
|
120
|
+
for (const wf of result.workflows) {
|
|
121
|
+
allWorkflows.push(workflowToManifest(wf, distRelative));
|
|
122
|
+
}
|
|
123
|
+
// Collect patterns
|
|
124
|
+
for (const pat of result.patterns) {
|
|
125
|
+
allPatterns.push(patternToManifest(pat, distRelative));
|
|
126
|
+
}
|
|
127
|
+
if (result.errors.length > 0) {
|
|
128
|
+
errors.push(...result.errors.map((e) => `${file}: ${e}`));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
errors.push(`Failed to parse ${file}: ${err instanceof Error ? err.message : String(err)}`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
const manifest = {
|
|
136
|
+
manifestVersion: 1,
|
|
137
|
+
name: pkg.name ?? 'unknown',
|
|
138
|
+
version: pkg.version ?? '0.0.0',
|
|
139
|
+
...(pkg.description && { description: pkg.description }),
|
|
140
|
+
...(pkg.flowWeaver?.engineVersion && { engineVersion: pkg.flowWeaver.engineVersion }),
|
|
141
|
+
...(pkg.flowWeaver?.categories && { categories: pkg.flowWeaver.categories }),
|
|
142
|
+
nodeTypes: allNodeTypes,
|
|
143
|
+
workflows: allWorkflows,
|
|
144
|
+
patterns: allPatterns,
|
|
145
|
+
...(Object.keys(pkg.dependencies ?? {}).length > 0 && {
|
|
146
|
+
dependencies: {
|
|
147
|
+
npm: pkg.dependencies,
|
|
148
|
+
},
|
|
149
|
+
}),
|
|
150
|
+
};
|
|
151
|
+
return { manifest, parsedFiles, errors };
|
|
152
|
+
}
|
|
153
|
+
/** Write manifest JSON to disk. */
|
|
154
|
+
export function writeManifest(directory, manifest) {
|
|
155
|
+
const outPath = path.join(directory, 'flowweaver.manifest.json');
|
|
156
|
+
fs.writeFileSync(outPath, JSON.stringify(manifest, null, 2) + '\n', 'utf-8');
|
|
157
|
+
return outPath;
|
|
158
|
+
}
|
|
159
|
+
/** Read manifest JSON from disk. */
|
|
160
|
+
export function readManifest(directory) {
|
|
161
|
+
const manifestPath = path.join(directory, 'flowweaver.manifest.json');
|
|
162
|
+
if (!fs.existsSync(manifestPath))
|
|
163
|
+
return null;
|
|
164
|
+
return JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
|
|
165
|
+
}
|
|
166
|
+
function emptyManifest(name, version) {
|
|
167
|
+
return {
|
|
168
|
+
manifestVersion: 1,
|
|
169
|
+
name,
|
|
170
|
+
version,
|
|
171
|
+
nodeTypes: [],
|
|
172
|
+
workflows: [],
|
|
173
|
+
patterns: [],
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry integration — npm search API + local package scanning.
|
|
3
|
+
*
|
|
4
|
+
* Uses the npm registry search endpoint filtered by the
|
|
5
|
+
* `flowweaver-marketplace-pack` keyword for discovery, and scans
|
|
6
|
+
* `node_modules/` for locally installed packages.
|
|
7
|
+
*/
|
|
8
|
+
import type { TMarketplaceManifest, TMarketplacePackageInfo, TInstalledPackage } from './types.js';
|
|
9
|
+
export interface SearchOptions {
|
|
10
|
+
/** Search query text */
|
|
11
|
+
query?: string;
|
|
12
|
+
/** Maximum number of results (default: 20) */
|
|
13
|
+
limit?: number;
|
|
14
|
+
/** Custom registry search URL (default: public npm registry). Supports private registries like Verdaccio, GitHub Packages, etc. */
|
|
15
|
+
registryUrl?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Search the npm registry for marketplace packages.
|
|
19
|
+
*/
|
|
20
|
+
export declare function searchPackages(options?: SearchOptions): Promise<TMarketplacePackageInfo[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Scan node_modules for installed marketplace packages by looking for
|
|
23
|
+
* `flowweaver.manifest.json` files in matching package directories.
|
|
24
|
+
*/
|
|
25
|
+
export declare function listInstalledPackages(projectDir: string): Promise<TInstalledPackage[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Read the manifest for a specific installed package.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getInstalledPackageManifest(projectDir: string, packageName: string): TMarketplaceManifest | null;
|
|
30
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry integration — npm search API + local package scanning.
|
|
3
|
+
*
|
|
4
|
+
* Uses the npm registry search endpoint filtered by the
|
|
5
|
+
* `flowweaver-marketplace-pack` keyword for discovery, and scans
|
|
6
|
+
* `node_modules/` for locally installed packages.
|
|
7
|
+
*/
|
|
8
|
+
import * as fs from 'fs';
|
|
9
|
+
import * as path from 'path';
|
|
10
|
+
import { glob } from 'glob';
|
|
11
|
+
const MARKETPLACE_KEYWORD = 'flowweaver-marketplace-pack';
|
|
12
|
+
const NPM_SEARCH_URL = 'https://registry.npmjs.org/-/v1/search';
|
|
13
|
+
const PACK_NAME_RE = /^(@[^/]+\/)?flowweaver-pack-.+$/;
|
|
14
|
+
/**
|
|
15
|
+
* Search the npm registry for marketplace packages.
|
|
16
|
+
*/
|
|
17
|
+
export async function searchPackages(options = {}) {
|
|
18
|
+
const { query, limit = 20, registryUrl } = options;
|
|
19
|
+
// Build search query: always filter by marketplace keyword
|
|
20
|
+
const textParts = [
|
|
21
|
+
`keywords:${MARKETPLACE_KEYWORD}`,
|
|
22
|
+
...(query ? [query] : []),
|
|
23
|
+
];
|
|
24
|
+
const url = new URL(registryUrl ?? NPM_SEARCH_URL);
|
|
25
|
+
url.searchParams.set('text', textParts.join(' '));
|
|
26
|
+
url.searchParams.set('size', String(limit));
|
|
27
|
+
const response = await fetch(url.toString());
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
throw new Error(`npm search failed: ${response.status} ${response.statusText}`);
|
|
30
|
+
}
|
|
31
|
+
const data = (await response.json());
|
|
32
|
+
return data.objects
|
|
33
|
+
.filter((obj) => PACK_NAME_RE.test(obj.package.name))
|
|
34
|
+
.map((obj) => ({
|
|
35
|
+
name: obj.package.name,
|
|
36
|
+
version: obj.package.version,
|
|
37
|
+
description: obj.package.description,
|
|
38
|
+
keywords: obj.package.keywords,
|
|
39
|
+
publisher: obj.package.publisher?.username,
|
|
40
|
+
official: obj.package.name.startsWith('@synergenius/'),
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
// ── Local scanning ───────────────────────────────────────────────────────────
|
|
44
|
+
/**
|
|
45
|
+
* Scan node_modules for installed marketplace packages by looking for
|
|
46
|
+
* `flowweaver.manifest.json` files in matching package directories.
|
|
47
|
+
*/
|
|
48
|
+
export async function listInstalledPackages(projectDir) {
|
|
49
|
+
const nodeModules = path.join(projectDir, 'node_modules');
|
|
50
|
+
if (!fs.existsSync(nodeModules))
|
|
51
|
+
return [];
|
|
52
|
+
// Look for flowweaver-pack-* and @*/flowweaver-pack-* directories
|
|
53
|
+
const patterns = [
|
|
54
|
+
path.join(nodeModules, 'flowweaver-pack-*', 'flowweaver.manifest.json'),
|
|
55
|
+
path.join(nodeModules, '@*', 'flowweaver-pack-*', 'flowweaver.manifest.json'),
|
|
56
|
+
];
|
|
57
|
+
const results = [];
|
|
58
|
+
for (const pattern of patterns) {
|
|
59
|
+
const manifestPaths = await glob(pattern.replace(/\\/g, '/'), { absolute: true });
|
|
60
|
+
for (const manifestPath of manifestPaths) {
|
|
61
|
+
try {
|
|
62
|
+
const pkgDir = path.dirname(manifestPath);
|
|
63
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
|
|
64
|
+
// Also read package.json for accurate version
|
|
65
|
+
const pkgJsonPath = path.join(pkgDir, 'package.json');
|
|
66
|
+
let version = manifest.version;
|
|
67
|
+
if (fs.existsSync(pkgJsonPath)) {
|
|
68
|
+
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'));
|
|
69
|
+
version = pkg.version ?? manifest.version;
|
|
70
|
+
}
|
|
71
|
+
results.push({
|
|
72
|
+
name: manifest.name,
|
|
73
|
+
version,
|
|
74
|
+
manifest,
|
|
75
|
+
path: pkgDir,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
// Skip malformed manifests
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return results;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Read the manifest for a specific installed package.
|
|
87
|
+
*/
|
|
88
|
+
export function getInstalledPackageManifest(projectDir, packageName) {
|
|
89
|
+
const packageDir = path.join(projectDir, 'node_modules', packageName);
|
|
90
|
+
const manifestPath = path.join(packageDir, 'flowweaver.manifest.json');
|
|
91
|
+
if (!fs.existsSync(manifestPath))
|
|
92
|
+
return null;
|
|
93
|
+
try {
|
|
94
|
+
return JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marketplace types for Flow Weaver package distribution.
|
|
3
|
+
*
|
|
4
|
+
* Packages follow the naming convention `flowweaver-pack-*` and use
|
|
5
|
+
* npm as the distribution backbone. The manifest is auto-generated
|
|
6
|
+
* from source annotations via the parser.
|
|
7
|
+
*/
|
|
8
|
+
import type { TDataType } from '../ast/types.js';
|
|
9
|
+
/** Auto-generated manifest describing a marketplace package's contents. */
|
|
10
|
+
export type TMarketplaceManifest = {
|
|
11
|
+
/** Manifest schema version (currently 1) */
|
|
12
|
+
manifestVersion: 1;
|
|
13
|
+
/** npm package name */
|
|
14
|
+
name: string;
|
|
15
|
+
/** Semver version */
|
|
16
|
+
version: string;
|
|
17
|
+
/** Human-readable description */
|
|
18
|
+
description?: string;
|
|
19
|
+
/** Minimum Flow Weaver engine version required */
|
|
20
|
+
engineVersion?: string;
|
|
21
|
+
/** Discovery categories */
|
|
22
|
+
categories?: string[];
|
|
23
|
+
/** Node types included in this package */
|
|
24
|
+
nodeTypes: TManifestNodeType[];
|
|
25
|
+
/** Workflows included in this package */
|
|
26
|
+
workflows: TManifestWorkflow[];
|
|
27
|
+
/** Patterns included in this package */
|
|
28
|
+
patterns: TManifestPattern[];
|
|
29
|
+
/** External dependency information */
|
|
30
|
+
dependencies?: {
|
|
31
|
+
/** Flow Weaver peer dependency constraints */
|
|
32
|
+
flowweaver?: Record<string, string>;
|
|
33
|
+
/** npm runtime dependencies */
|
|
34
|
+
npm?: Record<string, string>;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export type TManifestPort = {
|
|
38
|
+
dataType: TDataType;
|
|
39
|
+
description?: string;
|
|
40
|
+
optional?: boolean;
|
|
41
|
+
};
|
|
42
|
+
export type TManifestNodeType = {
|
|
43
|
+
/** Node type name */
|
|
44
|
+
name: string;
|
|
45
|
+
/** Human-readable description */
|
|
46
|
+
description?: string;
|
|
47
|
+
/** Relative path to compiled file */
|
|
48
|
+
file: string;
|
|
49
|
+
/** Function name in the source */
|
|
50
|
+
functionName: string;
|
|
51
|
+
/** Whether the function is async */
|
|
52
|
+
isAsync: boolean;
|
|
53
|
+
/** Input port definitions */
|
|
54
|
+
inputs: Record<string, TManifestPort>;
|
|
55
|
+
/** Output port definitions */
|
|
56
|
+
outputs: Record<string, TManifestPort>;
|
|
57
|
+
/** Visual customization */
|
|
58
|
+
visuals?: {
|
|
59
|
+
color?: string;
|
|
60
|
+
icon?: string;
|
|
61
|
+
tags?: Array<{
|
|
62
|
+
label: string;
|
|
63
|
+
color?: string;
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export type TManifestWorkflow = {
|
|
68
|
+
/** Workflow name */
|
|
69
|
+
name: string;
|
|
70
|
+
/** Human-readable description */
|
|
71
|
+
description?: string;
|
|
72
|
+
/** Relative path to compiled file */
|
|
73
|
+
file: string;
|
|
74
|
+
/** Function name in the source */
|
|
75
|
+
functionName: string;
|
|
76
|
+
/** Start (input) ports */
|
|
77
|
+
startPorts: Record<string, TManifestPort>;
|
|
78
|
+
/** Exit (output) ports */
|
|
79
|
+
exitPorts: Record<string, TManifestPort>;
|
|
80
|
+
/** Number of node instances */
|
|
81
|
+
nodeCount: number;
|
|
82
|
+
/** Number of connections */
|
|
83
|
+
connectionCount: number;
|
|
84
|
+
};
|
|
85
|
+
export type TManifestPattern = {
|
|
86
|
+
/** Pattern name */
|
|
87
|
+
name: string;
|
|
88
|
+
/** Human-readable description */
|
|
89
|
+
description?: string;
|
|
90
|
+
/** Relative path to source file */
|
|
91
|
+
file: string;
|
|
92
|
+
/** Input ports (IN pseudo-node connections) */
|
|
93
|
+
inputPorts: Record<string, TManifestPort>;
|
|
94
|
+
/** Output ports (OUT pseudo-node connections) */
|
|
95
|
+
outputPorts: Record<string, TManifestPort>;
|
|
96
|
+
/** Number of internal nodes */
|
|
97
|
+
nodeCount: number;
|
|
98
|
+
};
|
|
99
|
+
export type TValidationSeverity = 'error' | 'warning';
|
|
100
|
+
export type TValidationIssue = {
|
|
101
|
+
/** Unique rule identifier (e.g., PKG-001, UNIT-002) */
|
|
102
|
+
code: string;
|
|
103
|
+
/** error = must fix, warning = should fix */
|
|
104
|
+
severity: TValidationSeverity;
|
|
105
|
+
/** Human-readable description */
|
|
106
|
+
message: string;
|
|
107
|
+
};
|
|
108
|
+
export type TPackageValidationResult = {
|
|
109
|
+
/** Whether the package passed all error-level checks */
|
|
110
|
+
valid: boolean;
|
|
111
|
+
/** All issues found during validation */
|
|
112
|
+
issues: TValidationIssue[];
|
|
113
|
+
};
|
|
114
|
+
/** A marketplace package discovered via npm search or local scan. */
|
|
115
|
+
export type TMarketplacePackageInfo = {
|
|
116
|
+
/** npm package name */
|
|
117
|
+
name: string;
|
|
118
|
+
/** Latest version */
|
|
119
|
+
version: string;
|
|
120
|
+
/** Package description */
|
|
121
|
+
description?: string;
|
|
122
|
+
/** npm weekly download count */
|
|
123
|
+
downloads?: number;
|
|
124
|
+
/** npm publisher username */
|
|
125
|
+
publisher?: string;
|
|
126
|
+
/** Package keywords */
|
|
127
|
+
keywords?: string[];
|
|
128
|
+
/** Whether this is an official @synergenius package */
|
|
129
|
+
official: boolean;
|
|
130
|
+
};
|
|
131
|
+
/** An installed marketplace package with its resolved manifest. */
|
|
132
|
+
export type TInstalledPackage = {
|
|
133
|
+
/** npm package name */
|
|
134
|
+
name: string;
|
|
135
|
+
/** Installed version */
|
|
136
|
+
version: string;
|
|
137
|
+
/** Resolved manifest */
|
|
138
|
+
manifest: TMarketplaceManifest;
|
|
139
|
+
/** Absolute path to the package in node_modules */
|
|
140
|
+
path: string;
|
|
141
|
+
};
|
|
142
|
+
export type TMarketInitConfig = {
|
|
143
|
+
/** Package name (e.g., flowweaver-pack-openai) */
|
|
144
|
+
name: string;
|
|
145
|
+
/** Target directory */
|
|
146
|
+
directory: string;
|
|
147
|
+
/** Package description */
|
|
148
|
+
description?: string;
|
|
149
|
+
/** Author name */
|
|
150
|
+
author?: string;
|
|
151
|
+
/** Run npm install after scaffolding */
|
|
152
|
+
install: boolean;
|
|
153
|
+
};
|
|
154
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marketplace types for Flow Weaver package distribution.
|
|
3
|
+
*
|
|
4
|
+
* Packages follow the naming convention `flowweaver-pack-*` and use
|
|
5
|
+
* npm as the distribution backbone. The manifest is auto-generated
|
|
6
|
+
* from source annotations via the parser.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package validation — checks that a marketplace package meets
|
|
3
|
+
* all requirements before publishing.
|
|
4
|
+
*/
|
|
5
|
+
import type { TMarketplaceManifest } from './types.js';
|
|
6
|
+
import type { TPackageValidationResult } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Validate a marketplace package directory.
|
|
9
|
+
*
|
|
10
|
+
* Checks package.json fields, manifest contents, and individual workflow validity.
|
|
11
|
+
*/
|
|
12
|
+
export declare function validatePackage(directory: string, manifest: TMarketplaceManifest): Promise<TPackageValidationResult>;
|
|
13
|
+
//# sourceMappingURL=validator.d.ts.map
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package validation — checks that a marketplace package meets
|
|
3
|
+
* all requirements before publishing.
|
|
4
|
+
*/
|
|
5
|
+
import * as fs from 'fs';
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
import { parseWorkflow, validateWorkflow } from '../api/index.js';
|
|
8
|
+
// ── Helpers ──────────────────────────────────────────────────────────────────
|
|
9
|
+
function issue(code, severity, message) {
|
|
10
|
+
return { code, severity, message };
|
|
11
|
+
}
|
|
12
|
+
const PACK_NAME_RE = /^(@[^/]+\/)?flowweaver-pack-.+$/;
|
|
13
|
+
const MARKETPLACE_KEYWORD = 'flowweaver-marketplace-pack';
|
|
14
|
+
// ── Package-level rules ──────────────────────────────────────────────────────
|
|
15
|
+
function validatePackageJson(pkg, directory) {
|
|
16
|
+
const issues = [];
|
|
17
|
+
// PKG-005: Name must match flowweaver-pack-* or @*/flowweaver-pack-*
|
|
18
|
+
const name = pkg.name;
|
|
19
|
+
if (!name || !PACK_NAME_RE.test(name)) {
|
|
20
|
+
issues.push(issue('PKG-005', 'error', `Package name must match "flowweaver-pack-*" or "@<scope>/flowweaver-pack-*", got "${name ?? ''}"`));
|
|
21
|
+
}
|
|
22
|
+
// PKG-001: keywords must include flowweaver-marketplace-pack
|
|
23
|
+
const keywords = (pkg.keywords ?? []);
|
|
24
|
+
if (!keywords.includes(MARKETPLACE_KEYWORD)) {
|
|
25
|
+
issues.push(issue('PKG-001', 'error', `"keywords" must include "${MARKETPLACE_KEYWORD}"`));
|
|
26
|
+
}
|
|
27
|
+
// PKG-002: flowWeaver.engineVersion must be set
|
|
28
|
+
const fw = pkg.flowWeaver;
|
|
29
|
+
if (!fw?.engineVersion) {
|
|
30
|
+
issues.push(issue('PKG-002', 'error', '"flowWeaver.engineVersion" must be set in package.json'));
|
|
31
|
+
}
|
|
32
|
+
// PKG-003: peerDependencies must include @synergenius/flow-weaver
|
|
33
|
+
const peers = (pkg.peerDependencies ?? {});
|
|
34
|
+
if (!peers['@synergenius/flow-weaver']) {
|
|
35
|
+
issues.push(issue('PKG-003', 'error', '"peerDependencies" must include "@synergenius/flow-weaver"'));
|
|
36
|
+
}
|
|
37
|
+
// PKG-004: Must not be private
|
|
38
|
+
if (pkg.private === true) {
|
|
39
|
+
issues.push(issue('PKG-004', 'error', 'Package must not be "private: true"'));
|
|
40
|
+
}
|
|
41
|
+
// PKG-007: README.md should exist
|
|
42
|
+
if (!fs.existsSync(path.join(directory, 'README.md'))) {
|
|
43
|
+
issues.push(issue('PKG-007', 'warning', 'README.md should exist'));
|
|
44
|
+
}
|
|
45
|
+
return issues;
|
|
46
|
+
}
|
|
47
|
+
// ── Manifest-level rules ─────────────────────────────────────────────────────
|
|
48
|
+
function validateManifestContents(manifest) {
|
|
49
|
+
const issues = [];
|
|
50
|
+
const totalUnits = manifest.nodeTypes.length + manifest.workflows.length + manifest.patterns.length;
|
|
51
|
+
// PKG-006: Must contain at least one unit
|
|
52
|
+
if (totalUnits === 0) {
|
|
53
|
+
issues.push(issue('PKG-006', 'error', 'Package must contain at least one node type, workflow, or pattern'));
|
|
54
|
+
}
|
|
55
|
+
// UNIT-002: Node type names must be unique within the package
|
|
56
|
+
const ntNames = new Set();
|
|
57
|
+
for (const nt of manifest.nodeTypes) {
|
|
58
|
+
if (ntNames.has(nt.name)) {
|
|
59
|
+
issues.push(issue('UNIT-002', 'error', `Duplicate node type name: "${nt.name}"`));
|
|
60
|
+
}
|
|
61
|
+
ntNames.add(nt.name);
|
|
62
|
+
}
|
|
63
|
+
// PKG-008: All node types should have descriptions
|
|
64
|
+
for (const nt of manifest.nodeTypes) {
|
|
65
|
+
if (!nt.description) {
|
|
66
|
+
issues.push(issue('PKG-008', 'warning', `Node type "${nt.name}" should have a description`));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// PKG-009: All node types should have visuals
|
|
70
|
+
for (const nt of manifest.nodeTypes) {
|
|
71
|
+
if (!nt.visuals || (!nt.visuals.color && !nt.visuals.icon && !nt.visuals.tags)) {
|
|
72
|
+
issues.push(issue('PKG-009', 'warning', `Node type "${nt.name}" should have visuals (color, icon, or tags)`));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// UNIT-003: Patterns must have at least one IN or OUT port
|
|
76
|
+
for (const pat of manifest.patterns) {
|
|
77
|
+
const inCount = Object.keys(pat.inputPorts).length;
|
|
78
|
+
const outCount = Object.keys(pat.outputPorts).length;
|
|
79
|
+
if (inCount === 0 && outCount === 0) {
|
|
80
|
+
issues.push(issue('UNIT-003', 'error', `Pattern "${pat.name}" must have at least one IN or OUT port`));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return issues;
|
|
84
|
+
}
|
|
85
|
+
// ── Workflow validation (UNIT-001) ───────────────────────────────────────────
|
|
86
|
+
async function validateWorkflows(manifest, directory) {
|
|
87
|
+
const issues = [];
|
|
88
|
+
for (const wf of manifest.workflows) {
|
|
89
|
+
// Resolve source file from dist path back to src
|
|
90
|
+
const srcFile = path.join(directory, wf.file.replace(/^dist\//, 'src/').replace(/\.js$/, '.ts'));
|
|
91
|
+
if (!fs.existsSync(srcFile))
|
|
92
|
+
continue;
|
|
93
|
+
try {
|
|
94
|
+
const parseResult = await parseWorkflow(srcFile, { workflowName: wf.functionName });
|
|
95
|
+
if (parseResult.errors.length > 0)
|
|
96
|
+
continue; // Parse errors reported by pack command
|
|
97
|
+
const result = validateWorkflow(parseResult.ast);
|
|
98
|
+
if (result.errors.length > 0) {
|
|
99
|
+
issues.push(issue('UNIT-001', 'error', `Workflow "${wf.name}" has validation errors: ${result.errors.map((e) => e.message).join('; ')}`));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
// If parsing fails entirely, the pack command will already have reported the error
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return issues;
|
|
107
|
+
}
|
|
108
|
+
// ── Public API ───────────────────────────────────────────────────────────────
|
|
109
|
+
/**
|
|
110
|
+
* Validate a marketplace package directory.
|
|
111
|
+
*
|
|
112
|
+
* Checks package.json fields, manifest contents, and individual workflow validity.
|
|
113
|
+
*/
|
|
114
|
+
export async function validatePackage(directory, manifest) {
|
|
115
|
+
const pkgPath = path.join(directory, 'package.json');
|
|
116
|
+
if (!fs.existsSync(pkgPath)) {
|
|
117
|
+
return {
|
|
118
|
+
valid: false,
|
|
119
|
+
issues: [issue('PKG-000', 'error', 'package.json not found')],
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
123
|
+
const issues = [
|
|
124
|
+
...validatePackageJson(pkg, directory),
|
|
125
|
+
...validateManifestContents(manifest),
|
|
126
|
+
...(await validateWorkflows(manifest, directory)),
|
|
127
|
+
];
|
|
128
|
+
const valid = !issues.some((i) => i.severity === 'error');
|
|
129
|
+
return { valid, issues };
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=validator.js.map
|