@weavelogic/knowledge-graph-agent 0.2.0 → 0.4.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/README.md +972 -303
- package/dist/_virtual/_commonjsHelpers.js +7 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/additionalItems.js +5 -0
- package/dist/_virtual/additionalItems.js.map +1 -0
- package/dist/_virtual/additionalProperties.js +5 -0
- package/dist/_virtual/additionalProperties.js.map +1 -0
- package/dist/_virtual/ajv.js +6 -0
- package/dist/_virtual/ajv.js.map +1 -0
- package/dist/_virtual/ajv2.js +5 -0
- package/dist/_virtual/ajv2.js.map +1 -0
- package/dist/_virtual/allOf.js +5 -0
- package/dist/_virtual/allOf.js.map +1 -0
- package/dist/_virtual/anyOf.js +5 -0
- package/dist/_virtual/anyOf.js.map +1 -0
- package/dist/_virtual/applicability.js +5 -0
- package/dist/_virtual/applicability.js.map +1 -0
- package/dist/_virtual/boolSchema.js +5 -0
- package/dist/_virtual/boolSchema.js.map +1 -0
- package/dist/_virtual/code.js +5 -0
- package/dist/_virtual/code.js.map +1 -0
- package/dist/_virtual/code2.js +5 -0
- package/dist/_virtual/code2.js.map +1 -0
- package/dist/_virtual/const.js +5 -0
- package/dist/_virtual/const.js.map +1 -0
- package/dist/_virtual/contains.js +5 -0
- package/dist/_virtual/contains.js.map +1 -0
- package/dist/_virtual/core.js +5 -0
- package/dist/_virtual/core.js.map +1 -0
- package/dist/_virtual/dataType.js +5 -0
- package/dist/_virtual/dataType.js.map +1 -0
- package/dist/_virtual/defaults.js +5 -0
- package/dist/_virtual/defaults.js.map +1 -0
- package/dist/_virtual/dependencies.js +5 -0
- package/dist/_virtual/dependencies.js.map +1 -0
- package/dist/_virtual/draft7.js +5 -0
- package/dist/_virtual/draft7.js.map +1 -0
- package/dist/_virtual/enum.js +5 -0
- package/dist/_virtual/enum.js.map +1 -0
- package/dist/_virtual/equal.js +5 -0
- package/dist/_virtual/equal.js.map +1 -0
- package/dist/_virtual/errors.js +5 -0
- package/dist/_virtual/errors.js.map +1 -0
- package/dist/_virtual/format.js +5 -0
- package/dist/_virtual/format.js.map +1 -0
- package/dist/_virtual/formats.js +5 -0
- package/dist/_virtual/formats.js.map +1 -0
- package/dist/_virtual/id.js +5 -0
- package/dist/_virtual/id.js.map +1 -0
- package/dist/_virtual/if.js +5 -0
- package/dist/_virtual/if.js.map +1 -0
- package/dist/_virtual/index.js +8 -0
- package/dist/_virtual/index.js.map +1 -0
- package/dist/_virtual/index10.js +5 -0
- package/dist/_virtual/index10.js.map +1 -0
- package/dist/_virtual/index11.js +5 -0
- package/dist/_virtual/index11.js.map +1 -0
- package/dist/_virtual/index12.js +5 -0
- package/dist/_virtual/index12.js.map +1 -0
- package/dist/_virtual/index2.js +5 -0
- package/dist/_virtual/index2.js.map +1 -0
- package/dist/_virtual/index3.js +5 -0
- package/dist/_virtual/index3.js.map +1 -0
- package/dist/_virtual/index4.js +5 -0
- package/dist/_virtual/index4.js.map +1 -0
- package/dist/_virtual/index5.js +5 -0
- package/dist/_virtual/index5.js.map +1 -0
- package/dist/_virtual/index6.js +5 -0
- package/dist/_virtual/index6.js.map +1 -0
- package/dist/_virtual/index7.js +5 -0
- package/dist/_virtual/index7.js.map +1 -0
- package/dist/_virtual/index8.js +5 -0
- package/dist/_virtual/index8.js.map +1 -0
- package/dist/_virtual/index9.js +5 -0
- package/dist/_virtual/index9.js.map +1 -0
- package/dist/_virtual/items.js +5 -0
- package/dist/_virtual/items.js.map +1 -0
- package/dist/_virtual/items2020.js +5 -0
- package/dist/_virtual/items2020.js.map +1 -0
- package/dist/_virtual/keyword.js +5 -0
- package/dist/_virtual/keyword.js.map +1 -0
- package/dist/_virtual/limit.js +5 -0
- package/dist/_virtual/limit.js.map +1 -0
- package/dist/_virtual/limitItems.js +5 -0
- package/dist/_virtual/limitItems.js.map +1 -0
- package/dist/_virtual/limitLength.js +5 -0
- package/dist/_virtual/limitLength.js.map +1 -0
- package/dist/_virtual/limitNumber.js +5 -0
- package/dist/_virtual/limitNumber.js.map +1 -0
- package/dist/_virtual/limitProperties.js +5 -0
- package/dist/_virtual/limitProperties.js.map +1 -0
- package/dist/_virtual/metadata.js +5 -0
- package/dist/_virtual/metadata.js.map +1 -0
- package/dist/_virtual/multipleOf.js +5 -0
- package/dist/_virtual/multipleOf.js.map +1 -0
- package/dist/_virtual/names.js +5 -0
- package/dist/_virtual/names.js.map +1 -0
- package/dist/_virtual/not.js +5 -0
- package/dist/_virtual/not.js.map +1 -0
- package/dist/_virtual/oneOf.js +5 -0
- package/dist/_virtual/oneOf.js.map +1 -0
- package/dist/_virtual/pattern.js +5 -0
- package/dist/_virtual/pattern.js.map +1 -0
- package/dist/_virtual/patternProperties.js +5 -0
- package/dist/_virtual/patternProperties.js.map +1 -0
- package/dist/_virtual/prefixItems.js +5 -0
- package/dist/_virtual/prefixItems.js.map +1 -0
- package/dist/_virtual/properties.js +5 -0
- package/dist/_virtual/properties.js.map +1 -0
- package/dist/_virtual/propertyNames.js +5 -0
- package/dist/_virtual/propertyNames.js.map +1 -0
- package/dist/_virtual/ref.js +5 -0
- package/dist/_virtual/ref.js.map +1 -0
- package/dist/_virtual/ref_error.js +5 -0
- package/dist/_virtual/ref_error.js.map +1 -0
- package/dist/_virtual/required.js +5 -0
- package/dist/_virtual/required.js.map +1 -0
- package/dist/_virtual/resolve.js +5 -0
- package/dist/_virtual/resolve.js.map +1 -0
- package/dist/_virtual/rules.js +5 -0
- package/dist/_virtual/rules.js.map +1 -0
- package/dist/_virtual/scope.js +5 -0
- package/dist/_virtual/scope.js.map +1 -0
- package/dist/_virtual/subschema.js +5 -0
- package/dist/_virtual/subschema.js.map +1 -0
- package/dist/_virtual/thenElse.js +5 -0
- package/dist/_virtual/thenElse.js.map +1 -0
- package/dist/_virtual/types.js +5 -0
- package/dist/_virtual/types.js.map +1 -0
- package/dist/_virtual/ucs2length.js +5 -0
- package/dist/_virtual/ucs2length.js.map +1 -0
- package/dist/_virtual/uniqueItems.js +5 -0
- package/dist/_virtual/uniqueItems.js.map +1 -0
- package/dist/_virtual/uri.js +5 -0
- package/dist/_virtual/uri.js.map +1 -0
- package/dist/_virtual/util.js +5 -0
- package/dist/_virtual/util.js.map +1 -0
- package/dist/_virtual/validation_error.js +5 -0
- package/dist/_virtual/validation_error.js.map +1 -0
- package/dist/agents/analyst-agent.d.ts +230 -0
- package/dist/agents/analyst-agent.d.ts.map +1 -0
- package/dist/agents/analyst-agent.js +793 -0
- package/dist/agents/analyst-agent.js.map +1 -0
- package/dist/agents/architect-agent.d.ts +248 -0
- package/dist/agents/architect-agent.d.ts.map +1 -0
- package/dist/agents/architect-agent.js +685 -0
- package/dist/agents/architect-agent.js.map +1 -0
- package/dist/agents/base-agent.d.ts +169 -0
- package/dist/agents/base-agent.d.ts.map +1 -0
- package/dist/agents/base-agent.js +441 -0
- package/dist/agents/base-agent.js.map +1 -0
- package/dist/agents/coder-agent.d.ts +191 -0
- package/dist/agents/coder-agent.d.ts.map +1 -0
- package/dist/agents/coder-agent.js +1008 -0
- package/dist/agents/coder-agent.js.map +1 -0
- package/dist/agents/index.d.ts +18 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +40 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/registry.d.ts +213 -0
- package/dist/agents/registry.d.ts.map +1 -0
- package/dist/agents/registry.js +419 -0
- package/dist/agents/registry.js.map +1 -0
- package/dist/agents/researcher-agent.d.ts +226 -0
- package/dist/agents/researcher-agent.d.ts.map +1 -0
- package/dist/agents/researcher-agent.js +572 -0
- package/dist/agents/researcher-agent.js.map +1 -0
- package/dist/agents/rules-engine.d.ts +320 -0
- package/dist/agents/rules-engine.d.ts.map +1 -0
- package/dist/agents/rules-engine.js +552 -0
- package/dist/agents/rules-engine.js.map +1 -0
- package/dist/agents/tester-agent.d.ts +219 -0
- package/dist/agents/tester-agent.d.ts.map +1 -0
- package/dist/agents/tester-agent.js +683 -0
- package/dist/agents/tester-agent.js.map +1 -0
- package/dist/agents/types.d.ts +425 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +57 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/audit/config.d.ts +150 -0
- package/dist/audit/config.d.ts.map +1 -0
- package/dist/audit/config.js +111 -0
- package/dist/audit/config.js.map +1 -0
- package/dist/audit/index.d.ts +38 -0
- package/dist/audit/index.d.ts.map +1 -0
- package/dist/audit/services/audit-chain.d.ts +276 -0
- package/dist/audit/services/audit-chain.d.ts.map +1 -0
- package/dist/audit/services/audit-chain.js +502 -0
- package/dist/audit/services/audit-chain.js.map +1 -0
- package/dist/audit/services/index.d.ts +11 -0
- package/dist/audit/services/index.d.ts.map +1 -0
- package/dist/audit/services/syndication.d.ts +334 -0
- package/dist/audit/services/syndication.d.ts.map +1 -0
- package/dist/audit/services/syndication.js +589 -0
- package/dist/audit/services/syndication.js.map +1 -0
- package/dist/audit/types.d.ts +453 -0
- package/dist/audit/types.d.ts.map +1 -0
- package/dist/caching/index.d.ts +55 -0
- package/dist/caching/index.d.ts.map +1 -0
- package/dist/caching/index.js +206 -0
- package/dist/caching/index.js.map +1 -0
- package/dist/caching/lru-cache.d.ts +254 -0
- package/dist/caching/lru-cache.d.ts.map +1 -0
- package/dist/caching/types.d.ts +95 -0
- package/dist/caching/types.d.ts.map +1 -0
- package/dist/chunking/chunker.d.ts +94 -0
- package/dist/chunking/chunker.d.ts.map +1 -0
- package/dist/chunking/index.d.ts +125 -0
- package/dist/chunking/index.d.ts.map +1 -0
- package/dist/chunking/index.js +283 -0
- package/dist/chunking/index.js.map +1 -0
- package/dist/chunking/types.d.ts +92 -0
- package/dist/chunking/types.d.ts.map +1 -0
- package/dist/cli/commands/audit.d.ts +21 -0
- package/dist/cli/commands/audit.d.ts.map +1 -0
- package/dist/cli/commands/audit.js +621 -0
- package/dist/cli/commands/audit.js.map +1 -0
- package/dist/cli/commands/commit.d.ts +11 -0
- package/dist/cli/commands/commit.d.ts.map +1 -0
- package/dist/cli/commands/commit.js +379 -0
- package/dist/cli/commands/commit.js.map +1 -0
- package/dist/cli/commands/config.d.ts +8 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +107 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/cultivate.d.ts +16 -0
- package/dist/cli/commands/cultivate.d.ts.map +1 -0
- package/dist/cli/commands/cultivate.js +254 -0
- package/dist/cli/commands/cultivate.js.map +1 -0
- package/dist/cli/commands/diagnostics.d.ts +8 -0
- package/dist/cli/commands/diagnostics.d.ts.map +1 -0
- package/dist/cli/commands/diagnostics.js +140 -0
- package/dist/cli/commands/diagnostics.js.map +1 -0
- package/dist/cli/commands/generate.d.ts +13 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/init-primitives.d.ts +19 -0
- package/dist/cli/commands/init-primitives.d.ts.map +1 -0
- package/dist/cli/commands/init-primitives.js +208 -0
- package/dist/cli/commands/init-primitives.js.map +1 -0
- package/dist/cli/commands/sop.d.ts +14 -0
- package/dist/cli/commands/sop.d.ts.map +1 -0
- package/dist/cli/commands/sop.js +598 -0
- package/dist/cli/commands/sop.js.map +1 -0
- package/dist/cli/commands/vector.d.ts +14 -0
- package/dist/cli/commands/vector.d.ts.map +1 -0
- package/dist/cli/commands/vector.js +429 -0
- package/dist/cli/commands/vector.js.map +1 -0
- package/dist/cli/commands/workflow.d.ts +12 -0
- package/dist/cli/commands/workflow.d.ts.map +1 -0
- package/dist/cli/commands/workflow.js +471 -0
- package/dist/cli/commands/workflow.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +66 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/config/index.d.ts +153 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +141 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/manager.d.ts +136 -0
- package/dist/config/manager.d.ts.map +1 -0
- package/dist/config/types.d.ts +127 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/core/cache.d.ts +185 -0
- package/dist/core/cache.d.ts.map +1 -0
- package/dist/core/cache.js +435 -0
- package/dist/core/cache.js.map +1 -0
- package/dist/cultivation/deep-analyzer.d.ts +129 -0
- package/dist/cultivation/deep-analyzer.d.ts.map +1 -0
- package/dist/cultivation/deep-analyzer.js +322 -0
- package/dist/cultivation/deep-analyzer.js.map +1 -0
- package/dist/cultivation/index.d.ts +13 -0
- package/dist/cultivation/index.d.ts.map +1 -0
- package/dist/cultivation/seed-generator.d.ts +92 -0
- package/dist/cultivation/seed-generator.d.ts.map +1 -0
- package/dist/cultivation/seed-generator.js +1033 -0
- package/dist/cultivation/seed-generator.js.map +1 -0
- package/dist/cultivation/types.d.ts +230 -0
- package/dist/cultivation/types.d.ts.map +1 -0
- package/dist/database/schemas/index.d.ts +85 -0
- package/dist/database/schemas/index.d.ts.map +1 -0
- package/dist/generators/claude-md.d.ts +7 -0
- package/dist/generators/claude-md.d.ts.map +1 -1
- package/dist/generators/claude-md.js.map +1 -1
- package/dist/generators/docs-init.d.ts +6 -0
- package/dist/generators/docs-init.d.ts.map +1 -1
- package/dist/generators/docs-init.js.map +1 -1
- package/dist/health/checks.d.ts +135 -0
- package/dist/health/checks.d.ts.map +1 -0
- package/dist/health/index.d.ts +119 -0
- package/dist/health/index.d.ts.map +1 -0
- package/dist/health/index.js +191 -0
- package/dist/health/index.js.map +1 -0
- package/dist/health/monitor.d.ts +146 -0
- package/dist/health/monitor.d.ts.map +1 -0
- package/dist/health/types.d.ts +135 -0
- package/dist/health/types.d.ts.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +182 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/auto-commit.d.ts +175 -0
- package/dist/integrations/auto-commit.d.ts.map +1 -0
- package/dist/integrations/auto-commit.js +399 -0
- package/dist/integrations/auto-commit.js.map +1 -0
- package/dist/integrations/git.d.ts +299 -0
- package/dist/integrations/git.d.ts.map +1 -0
- package/dist/integrations/git.js +465 -0
- package/dist/integrations/git.js.map +1 -0
- package/dist/mcp-server/bin.d.ts +11 -0
- package/dist/mcp-server/bin.d.ts.map +1 -0
- package/dist/mcp-server/handlers/index.d.ts +57 -0
- package/dist/mcp-server/handlers/index.d.ts.map +1 -0
- package/dist/mcp-server/handlers/index.js +235 -0
- package/dist/mcp-server/handlers/index.js.map +1 -0
- package/dist/mcp-server/index.d.ts +28 -0
- package/dist/mcp-server/index.d.ts.map +1 -0
- package/dist/mcp-server/server.d.ts +133 -0
- package/dist/mcp-server/server.d.ts.map +1 -0
- package/dist/mcp-server/server.js +280 -0
- package/dist/mcp-server/server.js.map +1 -0
- package/dist/mcp-server/tools/agents/index.d.ts +10 -0
- package/dist/mcp-server/tools/agents/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/agents/list.d.ts +19 -0
- package/dist/mcp-server/tools/agents/list.d.ts.map +1 -0
- package/dist/mcp-server/tools/agents/spawn.d.ts +19 -0
- package/dist/mcp-server/tools/agents/spawn.d.ts.map +1 -0
- package/dist/mcp-server/tools/audit/checkpoint.d.ts +58 -0
- package/dist/mcp-server/tools/audit/checkpoint.d.ts.map +1 -0
- package/dist/mcp-server/tools/audit/checkpoint.js +73 -0
- package/dist/mcp-server/tools/audit/checkpoint.js.map +1 -0
- package/dist/mcp-server/tools/audit/index.d.ts +53 -0
- package/dist/mcp-server/tools/audit/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/audit/index.js +12 -0
- package/dist/mcp-server/tools/audit/index.js.map +1 -0
- package/dist/mcp-server/tools/audit/query.d.ts +58 -0
- package/dist/mcp-server/tools/audit/query.d.ts.map +1 -0
- package/dist/mcp-server/tools/audit/query.js +125 -0
- package/dist/mcp-server/tools/audit/query.js.map +1 -0
- package/dist/mcp-server/tools/audit/sync.d.ts +58 -0
- package/dist/mcp-server/tools/audit/sync.d.ts.map +1 -0
- package/dist/mcp-server/tools/audit/sync.js +126 -0
- package/dist/mcp-server/tools/audit/sync.js.map +1 -0
- package/dist/mcp-server/tools/graph/generate.d.ts +21 -0
- package/dist/mcp-server/tools/graph/generate.d.ts.map +1 -0
- package/dist/mcp-server/tools/graph/index.d.ts +11 -0
- package/dist/mcp-server/tools/graph/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/graph/query.d.ts +22 -0
- package/dist/mcp-server/tools/graph/query.d.ts.map +1 -0
- package/dist/mcp-server/tools/graph/stats.d.ts +22 -0
- package/dist/mcp-server/tools/graph/stats.d.ts.map +1 -0
- package/dist/mcp-server/tools/health.d.ts +21 -0
- package/dist/mcp-server/tools/health.d.ts.map +1 -0
- package/dist/mcp-server/tools/index.d.ts +16 -0
- package/dist/mcp-server/tools/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/registry.d.ts +90 -0
- package/dist/mcp-server/tools/registry.d.ts.map +1 -0
- package/dist/mcp-server/tools/registry.js +753 -0
- package/dist/mcp-server/tools/registry.js.map +1 -0
- package/dist/mcp-server/tools/search/index.d.ts +10 -0
- package/dist/mcp-server/tools/search/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/search/nodes.d.ts +22 -0
- package/dist/mcp-server/tools/search/nodes.d.ts.map +1 -0
- package/dist/mcp-server/tools/search/tags.d.ts +22 -0
- package/dist/mcp-server/tools/search/tags.d.ts.map +1 -0
- package/dist/mcp-server/tools/vector/index.d.ts +12 -0
- package/dist/mcp-server/tools/vector/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/vector/index.js +12 -0
- package/dist/mcp-server/tools/vector/index.js.map +1 -0
- package/dist/mcp-server/tools/vector/search.d.ts +41 -0
- package/dist/mcp-server/tools/vector/search.d.ts.map +1 -0
- package/dist/mcp-server/tools/vector/search.js +224 -0
- package/dist/mcp-server/tools/vector/search.js.map +1 -0
- package/dist/mcp-server/tools/vector/trajectory.d.ts +39 -0
- package/dist/mcp-server/tools/vector/trajectory.d.ts.map +1 -0
- package/dist/mcp-server/tools/vector/trajectory.js +170 -0
- package/dist/mcp-server/tools/vector/trajectory.js.map +1 -0
- package/dist/mcp-server/tools/vector/upsert.d.ts +44 -0
- package/dist/mcp-server/tools/vector/upsert.d.ts.map +1 -0
- package/dist/mcp-server/tools/vector/upsert.js +175 -0
- package/dist/mcp-server/tools/vector/upsert.js.map +1 -0
- package/dist/mcp-server/tools/workflow/index.d.ts +29 -0
- package/dist/mcp-server/tools/workflow/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/workflow/index.js +12 -0
- package/dist/mcp-server/tools/workflow/index.js.map +1 -0
- package/dist/mcp-server/tools/workflow/list.d.ts +41 -0
- package/dist/mcp-server/tools/workflow/list.d.ts.map +1 -0
- package/dist/mcp-server/tools/workflow/list.js +195 -0
- package/dist/mcp-server/tools/workflow/list.js.map +1 -0
- package/dist/mcp-server/tools/workflow/start.d.ts +40 -0
- package/dist/mcp-server/tools/workflow/start.d.ts.map +1 -0
- package/dist/mcp-server/tools/workflow/start.js +165 -0
- package/dist/mcp-server/tools/workflow/start.js.map +1 -0
- package/dist/mcp-server/tools/workflow/status.d.ts +38 -0
- package/dist/mcp-server/tools/workflow/status.d.ts.map +1 -0
- package/dist/mcp-server/tools/workflow/status.js +97 -0
- package/dist/mcp-server/tools/workflow/status.js.map +1 -0
- package/dist/mcp-server/types/index.d.ts +286 -0
- package/dist/mcp-server/types/index.d.ts.map +1 -0
- package/dist/memory/index.d.ts +10 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/vault-sync.d.ts +212 -0
- package/dist/memory/vault-sync.d.ts.map +1 -0
- package/dist/memory/vault-sync.js +463 -0
- package/dist/memory/vault-sync.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +296 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +71 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js +26 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +407 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +1332 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js +71 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js.map +1 -0
- package/dist/node_modules/ajv/dist/ajv.js +84 -0
- package/dist/node_modules/ajv/dist/ajv.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/codegen/code.js +160 -0
- package/dist/node_modules/ajv/dist/compile/codegen/code.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/codegen/index.js +728 -0
- package/dist/node_modules/ajv/dist/compile/codegen/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/codegen/scope.js +152 -0
- package/dist/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/errors.js +131 -0
- package/dist/node_modules/ajv/dist/compile/errors.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/index.js +234 -0
- package/dist/node_modules/ajv/dist/compile/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/names.js +44 -0
- package/dist/node_modules/ajv/dist/compile/names.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/ref_error.js +22 -0
- package/dist/node_modules/ajv/dist/compile/ref_error.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/resolve.js +163 -0
- package/dist/node_modules/ajv/dist/compile/resolve.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/rules.js +35 -0
- package/dist/node_modules/ajv/dist/compile/rules.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/util.js +173 -0
- package/dist/node_modules/ajv/dist/compile/util.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/applicability.js +27 -0
- package/dist/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js +58 -0
- package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/dataType.js +193 -0
- package/dist/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/defaults.js +43 -0
- package/dist/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/index.js +522 -0
- package/dist/node_modules/ajv/dist/compile/validate/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/keyword.js +126 -0
- package/dist/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/subschema.js +89 -0
- package/dist/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -0
- package/dist/node_modules/ajv/dist/core.js +628 -0
- package/dist/node_modules/ajv/dist/core.js.map +1 -0
- package/dist/node_modules/ajv/dist/refs/data.json.js +24 -0
- package/dist/node_modules/ajv/dist/refs/data.json.js.map +1 -0
- package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js +25 -0
- package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/equal.js +16 -0
- package/dist/node_modules/ajv/dist/runtime/equal.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/ucs2length.js +30 -0
- package/dist/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/uri.js +16 -0
- package/dist/node_modules/ajv/dist/runtime/uri.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/validation_error.js +20 -0
- package/dist/node_modules/ajv/dist/runtime/validation_error.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +59 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +114 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js +32 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +22 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js +100 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +103 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js +75 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js +68 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js +64 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js +43 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js +36 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +64 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +81 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +22 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js +66 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +49 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +23 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/code.js +140 -0
- package/dist/node_modules/ajv/dist/vocabularies/code.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/id.js +19 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/index.js +27 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/ref.js +132 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js +114 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js +18 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/draft7.js +31 -0
- package/dist/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/format.js +95 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/index.js +16 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/metadata.js +27 -0
- package/dist/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/const.js +36 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js +56 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/index.js +52 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js +34 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js +39 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +37 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +34 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +33 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js +34 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/required.js +89 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +75 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -0
- package/dist/node_modules/ajv-formats/dist/formats.js +209 -0
- package/dist/node_modules/ajv-formats/dist/formats.js.map +1 -0
- package/dist/node_modules/ajv-formats/dist/index.js +51 -0
- package/dist/node_modules/ajv-formats/dist/index.js.map +1 -0
- package/dist/node_modules/ajv-formats/dist/limit.js +80 -0
- package/dist/node_modules/ajv-formats/dist/limit.js.map +1 -0
- package/dist/node_modules/fast-deep-equal/index.js +39 -0
- package/dist/node_modules/fast-deep-equal/index.js.map +1 -0
- package/dist/node_modules/fast-uri/index.js +261 -0
- package/dist/node_modules/fast-uri/index.js.map +1 -0
- package/dist/node_modules/fast-uri/lib/schemes.js +215 -0
- package/dist/node_modules/fast-uri/lib/schemes.js.map +1 -0
- package/dist/node_modules/fast-uri/lib/utils.js +261 -0
- package/dist/node_modules/fast-uri/lib/utils.js.map +1 -0
- package/dist/node_modules/json-schema-traverse/index.js +92 -0
- package/dist/node_modules/json-schema-traverse/index.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/errors.js +37 -0
- package/dist/node_modules/zod/v4/classic/errors.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/iso.js +43 -0
- package/dist/node_modules/zod/v4/classic/iso.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/parse.js +13 -0
- package/dist/node_modules/zod/v4/classic/parse.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/schemas.js +688 -0
- package/dist/node_modules/zod/v4/classic/schemas.js.map +1 -0
- package/dist/node_modules/zod/v4/core/api.js +492 -0
- package/dist/node_modules/zod/v4/core/api.js.map +1 -0
- package/dist/node_modules/zod/v4/core/checks.js +405 -0
- package/dist/node_modules/zod/v4/core/checks.js.map +1 -0
- package/dist/node_modules/zod/v4/core/core.js +58 -0
- package/dist/node_modules/zod/v4/core/core.js.map +1 -0
- package/dist/node_modules/zod/v4/core/doc.js +38 -0
- package/dist/node_modules/zod/v4/core/doc.js.map +1 -0
- package/dist/node_modules/zod/v4/core/errors.js +82 -0
- package/dist/node_modules/zod/v4/core/errors.js.map +1 -0
- package/dist/node_modules/zod/v4/core/parse.js +60 -0
- package/dist/node_modules/zod/v4/core/parse.js.map +1 -0
- package/dist/node_modules/zod/v4/core/regexes.js +87 -0
- package/dist/node_modules/zod/v4/core/regexes.js.map +1 -0
- package/dist/node_modules/zod/v4/core/registries.js +52 -0
- package/dist/node_modules/zod/v4/core/registries.js.map +1 -0
- package/dist/node_modules/zod/v4/core/schemas.js +1283 -0
- package/dist/node_modules/zod/v4/core/schemas.js.map +1 -0
- package/dist/node_modules/zod/v4/core/util.js +341 -0
- package/dist/node_modules/zod/v4/core/util.js.map +1 -0
- package/dist/node_modules/zod/v4/core/versions.js +9 -0
- package/dist/node_modules/zod/v4/core/versions.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +2 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js.map +1 -0
- package/dist/reasoning/index.d.ts +74 -0
- package/dist/reasoning/index.d.ts.map +1 -0
- package/dist/reasoning/index.js +124 -0
- package/dist/reasoning/index.js.map +1 -0
- package/dist/reasoning/tracker.d.ts +210 -0
- package/dist/reasoning/tracker.d.ts.map +1 -0
- package/dist/reasoning/types.d.ts +146 -0
- package/dist/reasoning/types.d.ts.map +1 -0
- package/dist/recovery/backup.d.ts +110 -0
- package/dist/recovery/backup.d.ts.map +1 -0
- package/dist/recovery/index.d.ts +70 -0
- package/dist/recovery/index.d.ts.map +1 -0
- package/dist/recovery/index.js +186 -0
- package/dist/recovery/index.js.map +1 -0
- package/dist/recovery/integrity.d.ts +74 -0
- package/dist/recovery/integrity.d.ts.map +1 -0
- package/dist/recovery/types.d.ts +94 -0
- package/dist/recovery/types.d.ts.map +1 -0
- package/dist/services/index.d.ts +130 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +134 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/manager.d.ts +140 -0
- package/dist/services/manager.d.ts.map +1 -0
- package/dist/services/types.d.ts +106 -0
- package/dist/services/types.d.ts.map +1 -0
- package/dist/services/watchers.d.ts +95 -0
- package/dist/services/watchers.d.ts.map +1 -0
- package/dist/sops/compliance-checker.d.ts +83 -0
- package/dist/sops/compliance-checker.d.ts.map +1 -0
- package/dist/sops/compliance-checker.js +399 -0
- package/dist/sops/compliance-checker.js.map +1 -0
- package/dist/sops/gap-analyzer.d.ts +124 -0
- package/dist/sops/gap-analyzer.d.ts.map +1 -0
- package/dist/sops/gap-analyzer.js +313 -0
- package/dist/sops/gap-analyzer.js.map +1 -0
- package/dist/sops/index.d.ts +14 -0
- package/dist/sops/index.d.ts.map +1 -0
- package/dist/sops/overlay-manager.d.ts +115 -0
- package/dist/sops/overlay-manager.d.ts.map +1 -0
- package/dist/sops/overlay-manager.js +394 -0
- package/dist/sops/overlay-manager.js.map +1 -0
- package/dist/sops/registry.d.ts +73 -0
- package/dist/sops/registry.d.ts.map +1 -0
- package/dist/sops/registry.js +919 -0
- package/dist/sops/registry.js.map +1 -0
- package/dist/sops/types.d.ts +377 -0
- package/dist/sops/types.d.ts.map +1 -0
- package/dist/sops/types.js +46 -0
- package/dist/sops/types.js.map +1 -0
- package/dist/utils/error-recovery.d.ts +230 -0
- package/dist/utils/error-recovery.d.ts.map +1 -0
- package/dist/utils/error-recovery.js +228 -0
- package/dist/utils/error-recovery.js.map +1 -0
- package/dist/utils/error-taxonomy.d.ts +149 -0
- package/dist/utils/error-taxonomy.d.ts.map +1 -0
- package/dist/utils/error-taxonomy.js +260 -0
- package/dist/utils/error-taxonomy.js.map +1 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +139 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +311 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/vector/config.d.ts +300 -0
- package/dist/vector/config.d.ts.map +1 -0
- package/dist/vector/config.js +124 -0
- package/dist/vector/config.js.map +1 -0
- package/dist/vector/index.d.ts +50 -0
- package/dist/vector/index.d.ts.map +1 -0
- package/dist/vector/services/index.d.ts +13 -0
- package/dist/vector/services/index.d.ts.map +1 -0
- package/dist/vector/services/trajectory-tracker.d.ts +405 -0
- package/dist/vector/services/trajectory-tracker.d.ts.map +1 -0
- package/dist/vector/services/trajectory-tracker.js +445 -0
- package/dist/vector/services/trajectory-tracker.js.map +1 -0
- package/dist/vector/services/vector-store.d.ts +339 -0
- package/dist/vector/services/vector-store.d.ts.map +1 -0
- package/dist/vector/services/vector-store.js +748 -0
- package/dist/vector/services/vector-store.js.map +1 -0
- package/dist/vector/types.d.ts +677 -0
- package/dist/vector/types.d.ts.map +1 -0
- package/dist/workflow/adapters/goap-adapter.d.ts +196 -0
- package/dist/workflow/adapters/goap-adapter.d.ts.map +1 -0
- package/dist/workflow/adapters/goap-adapter.js +706 -0
- package/dist/workflow/adapters/goap-adapter.js.map +1 -0
- package/dist/workflow/adapters/index.d.ts +10 -0
- package/dist/workflow/adapters/index.d.ts.map +1 -0
- package/dist/workflow/config.d.ts +135 -0
- package/dist/workflow/config.d.ts.map +1 -0
- package/dist/workflow/config.js +92 -0
- package/dist/workflow/config.js.map +1 -0
- package/dist/workflow/handlers/index.d.ts +9 -0
- package/dist/workflow/handlers/index.d.ts.map +1 -0
- package/dist/workflow/handlers/webhook-handlers.d.ts +397 -0
- package/dist/workflow/handlers/webhook-handlers.d.ts.map +1 -0
- package/dist/workflow/handlers/webhook-handlers.js +454 -0
- package/dist/workflow/handlers/webhook-handlers.js.map +1 -0
- package/dist/workflow/index.d.ts +42 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/services/index.d.ts +9 -0
- package/dist/workflow/services/index.d.ts.map +1 -0
- package/dist/workflow/services/workflow-service.d.ts +318 -0
- package/dist/workflow/services/workflow-service.d.ts.map +1 -0
- package/dist/workflow/services/workflow-service.js +577 -0
- package/dist/workflow/services/workflow-service.js.map +1 -0
- package/dist/workflow/types.d.ts +470 -0
- package/dist/workflow/types.d.ts.map +1 -0
- package/dist/workflow/workflows/realtime-collab.d.ts +245 -0
- package/dist/workflow/workflows/realtime-collab.d.ts.map +1 -0
- package/dist/workflows/index.d.ts +11 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/registry.d.ts +118 -0
- package/dist/workflows/registry.d.ts.map +1 -0
- package/dist/workflows/registry.js +575 -0
- package/dist/workflows/registry.js.map +1 -0
- package/dist/workflows/types.d.ts +322 -0
- package/dist/workflows/types.d.ts.map +1 -0
- package/dist/workflows/types.js +16 -0
- package/dist/workflows/types.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
class WebhookRegistry {
|
|
2
|
+
handlers = /* @__PURE__ */ new Map();
|
|
3
|
+
config;
|
|
4
|
+
/**
|
|
5
|
+
* Create a new webhook registry
|
|
6
|
+
* @param config - Registry configuration
|
|
7
|
+
*/
|
|
8
|
+
constructor(config = {}) {
|
|
9
|
+
this.config = {
|
|
10
|
+
maxPayloadSize: config.maxPayloadSize ?? 1024 * 1024,
|
|
11
|
+
// 1MB default
|
|
12
|
+
rateLimit: config.rateLimit ?? 100,
|
|
13
|
+
...config
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Register a handler for an event type
|
|
18
|
+
*
|
|
19
|
+
* @param eventType - The event type to listen for
|
|
20
|
+
* @param handler - Handler function to call when event occurs
|
|
21
|
+
* @returns Unsubscribe function to remove the handler
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const unsubscribe = registry.on('file:created', async (event) => {
|
|
26
|
+
* if (event.type === 'file:created') {
|
|
27
|
+
* await processNewFile(event.path);
|
|
28
|
+
* }
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
on(eventType, handler) {
|
|
33
|
+
const handlers = this.handlers.get(eventType) ?? [];
|
|
34
|
+
handlers.push(handler);
|
|
35
|
+
this.handlers.set(eventType, handlers);
|
|
36
|
+
return () => {
|
|
37
|
+
const currentHandlers = this.handlers.get(eventType) ?? [];
|
|
38
|
+
const index = currentHandlers.indexOf(handler);
|
|
39
|
+
if (index > -1) {
|
|
40
|
+
currentHandlers.splice(index, 1);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Remove all handlers for an event type
|
|
46
|
+
*
|
|
47
|
+
* @param eventType - The event type to clear handlers for
|
|
48
|
+
*/
|
|
49
|
+
off(eventType) {
|
|
50
|
+
this.handlers.delete(eventType);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Remove all handlers for all event types
|
|
54
|
+
*/
|
|
55
|
+
clear() {
|
|
56
|
+
this.handlers.clear();
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get the number of handlers registered for an event type
|
|
60
|
+
*
|
|
61
|
+
* @param eventType - The event type to check
|
|
62
|
+
* @returns Number of registered handlers
|
|
63
|
+
*/
|
|
64
|
+
listenerCount(eventType) {
|
|
65
|
+
return this.handlers.get(eventType)?.length ?? 0;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Emit an event to all registered handlers
|
|
69
|
+
*
|
|
70
|
+
* Handlers are called in parallel. Errors in individual handlers
|
|
71
|
+
* are caught and logged but do not prevent other handlers from running.
|
|
72
|
+
*
|
|
73
|
+
* @param event - The event to emit
|
|
74
|
+
* @param context - Optional context to pass to handlers
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* await registry.emit({
|
|
79
|
+
* type: 'node:updated',
|
|
80
|
+
* event: {
|
|
81
|
+
* nodeId: 'doc-123',
|
|
82
|
+
* userId: 'user-456',
|
|
83
|
+
* changes: { title: 'Updated Title' },
|
|
84
|
+
* timestamp: Date.now()
|
|
85
|
+
* }
|
|
86
|
+
* });
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
async emit(event, context) {
|
|
90
|
+
const handlers = this.handlers.get(event.type) ?? [];
|
|
91
|
+
await Promise.all(
|
|
92
|
+
handlers.map(
|
|
93
|
+
(handler) => handler(event, context).catch((error) => {
|
|
94
|
+
console.error(`[Webhook] Handler error for ${event.type}:`, error);
|
|
95
|
+
})
|
|
96
|
+
)
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Validate incoming webhook payload
|
|
101
|
+
*
|
|
102
|
+
* Checks that the payload is properly structured and optionally
|
|
103
|
+
* verifies the signature if a secret is configured.
|
|
104
|
+
*
|
|
105
|
+
* @param payload - Raw payload data
|
|
106
|
+
* @param signature - Optional signature for verification
|
|
107
|
+
* @returns Validation result with parsed event if valid
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* const result = registry.validatePayload(
|
|
112
|
+
* { type: 'file:created', path: '/test.md', timestamp: Date.now() },
|
|
113
|
+
* 'sha256=abc123...'
|
|
114
|
+
* );
|
|
115
|
+
*
|
|
116
|
+
* if (result.valid && result.event) {
|
|
117
|
+
* await registry.emit(result.event);
|
|
118
|
+
* } else {
|
|
119
|
+
* console.error('Invalid webhook:', result.error);
|
|
120
|
+
* }
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
validatePayload(payload, signature) {
|
|
124
|
+
if (!payload || typeof payload !== "object") {
|
|
125
|
+
return { valid: false, error: "Invalid payload: must be an object" };
|
|
126
|
+
}
|
|
127
|
+
const data = payload;
|
|
128
|
+
if (!data.type || typeof data.type !== "string") {
|
|
129
|
+
return { valid: false, error: "Invalid payload: missing type field" };
|
|
130
|
+
}
|
|
131
|
+
if (this.config.secret && signature) {
|
|
132
|
+
const isValidSignature = this.verifySignature(payload, signature);
|
|
133
|
+
if (!isValidSignature) {
|
|
134
|
+
return { valid: false, error: "Invalid signature" };
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
try {
|
|
138
|
+
const event = this.parseEvent(data);
|
|
139
|
+
return { valid: true, event };
|
|
140
|
+
} catch (error) {
|
|
141
|
+
return {
|
|
142
|
+
valid: false,
|
|
143
|
+
error: `Failed to parse event: ${error instanceof Error ? error.message : String(error)}`
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Get current configuration
|
|
149
|
+
* @returns A copy of the current configuration
|
|
150
|
+
*/
|
|
151
|
+
getConfig() {
|
|
152
|
+
return { ...this.config };
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Verify webhook signature
|
|
156
|
+
* @param payload - The payload to verify
|
|
157
|
+
* @param signature - The signature to check against
|
|
158
|
+
* @returns Whether the signature is valid
|
|
159
|
+
*/
|
|
160
|
+
verifySignature(payload, signature) {
|
|
161
|
+
if (!this.config.secret) return true;
|
|
162
|
+
const crypto = globalThis.crypto;
|
|
163
|
+
if (!crypto?.subtle) {
|
|
164
|
+
console.warn("[Webhook] Crypto not available for signature verification");
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Parse raw data into typed event
|
|
171
|
+
* @param data - Raw event data
|
|
172
|
+
* @returns Typed workflow trigger event
|
|
173
|
+
* @throws Error if event type is unknown or data is malformed
|
|
174
|
+
*/
|
|
175
|
+
parseEvent(data) {
|
|
176
|
+
switch (data.type) {
|
|
177
|
+
case "file:created":
|
|
178
|
+
case "file:changed":
|
|
179
|
+
case "file:deleted":
|
|
180
|
+
return {
|
|
181
|
+
type: data.type,
|
|
182
|
+
path: String(data.path ?? ""),
|
|
183
|
+
timestamp: Number(data.timestamp) || Date.now(),
|
|
184
|
+
...data.changes ? { changes: String(data.changes) } : {}
|
|
185
|
+
};
|
|
186
|
+
case "node:updated":
|
|
187
|
+
return {
|
|
188
|
+
type: "node:updated",
|
|
189
|
+
event: {
|
|
190
|
+
nodeId: String(data.event?.nodeId ?? ""),
|
|
191
|
+
userId: String(data.event?.userId ?? ""),
|
|
192
|
+
changes: data.event?.changes ?? {},
|
|
193
|
+
timestamp: Number(data.event?.timestamp) || Date.now()
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
case "gap:detected":
|
|
197
|
+
return {
|
|
198
|
+
type: "gap:detected",
|
|
199
|
+
event: {
|
|
200
|
+
docPath: String(data.event?.docPath ?? ""),
|
|
201
|
+
gaps: data.event?.gaps ?? [],
|
|
202
|
+
confidence: Number(data.event?.confidence) || 0,
|
|
203
|
+
detectedAt: Number(data.event?.detectedAt) || Date.now()
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
case "workflow:complete": {
|
|
207
|
+
const eventData = data.event;
|
|
208
|
+
const outcomeValue = eventData?.outcome;
|
|
209
|
+
const validOutcomes = ["success", "failure", "timeout"];
|
|
210
|
+
const outcome = typeof outcomeValue === "string" && validOutcomes.includes(outcomeValue) ? outcomeValue : "success";
|
|
211
|
+
return {
|
|
212
|
+
type: "workflow:complete",
|
|
213
|
+
event: {
|
|
214
|
+
workflowId: String(eventData?.workflowId ?? ""),
|
|
215
|
+
outcome,
|
|
216
|
+
duration: Number(eventData?.duration) || 0,
|
|
217
|
+
artifacts: Array.isArray(eventData?.artifacts) ? eventData.artifacts.map(String) : []
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
case "timeout:inactivity":
|
|
222
|
+
return {
|
|
223
|
+
type: "timeout:inactivity",
|
|
224
|
+
lastActivity: Number(data.lastActivity) || 0,
|
|
225
|
+
threshold: Number(data.threshold) || 3e5
|
|
226
|
+
};
|
|
227
|
+
default:
|
|
228
|
+
throw new Error(`Unknown event type: ${data.type}`);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
class FileWatcherIntegration {
|
|
233
|
+
registry;
|
|
234
|
+
watchPaths = /* @__PURE__ */ new Set();
|
|
235
|
+
lastActivityMap = /* @__PURE__ */ new Map();
|
|
236
|
+
inactivityTimers = /* @__PURE__ */ new Map();
|
|
237
|
+
inactivityThreshold;
|
|
238
|
+
/**
|
|
239
|
+
* Create a new file watcher integration
|
|
240
|
+
* @param registry - Webhook registry to emit events to
|
|
241
|
+
* @param options - Configuration options
|
|
242
|
+
*/
|
|
243
|
+
constructor(registry, options = {}) {
|
|
244
|
+
this.registry = registry;
|
|
245
|
+
this.inactivityThreshold = options.inactivityThreshold ?? 5 * 60 * 1e3;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Add a path to watch
|
|
249
|
+
*
|
|
250
|
+
* Files created, changed, or deleted under this path will
|
|
251
|
+
* trigger workflow events. Inactivity detection starts immediately.
|
|
252
|
+
*
|
|
253
|
+
* @param path - Absolute path to watch
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```typescript
|
|
257
|
+
* watcher.watch('/path/to/docs');
|
|
258
|
+
* watcher.watch('/path/to/templates');
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
watch(path) {
|
|
262
|
+
this.watchPaths.add(path);
|
|
263
|
+
this.resetInactivityTimer(path);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Stop watching a path
|
|
267
|
+
*
|
|
268
|
+
* Clears inactivity timer and removes path from watch list.
|
|
269
|
+
*
|
|
270
|
+
* @param path - Path to stop watching
|
|
271
|
+
*/
|
|
272
|
+
unwatch(path) {
|
|
273
|
+
this.watchPaths.delete(path);
|
|
274
|
+
const timer = this.inactivityTimers.get(path);
|
|
275
|
+
if (timer) {
|
|
276
|
+
clearTimeout(timer);
|
|
277
|
+
this.inactivityTimers.delete(path);
|
|
278
|
+
}
|
|
279
|
+
this.lastActivityMap.delete(path);
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Stop watching all paths and clear all timers
|
|
283
|
+
*/
|
|
284
|
+
unwatchAll() {
|
|
285
|
+
for (const path of Array.from(this.watchPaths)) {
|
|
286
|
+
this.unwatch(path);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Handle file created event
|
|
291
|
+
*
|
|
292
|
+
* @param path - Path to the created file
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```typescript
|
|
296
|
+
* // Called by file system watcher
|
|
297
|
+
* fsWatcher.on('add', (path) => {
|
|
298
|
+
* watcher.onFileCreated(path);
|
|
299
|
+
* });
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
302
|
+
async onFileCreated(path) {
|
|
303
|
+
if (!this.shouldProcess(path)) return;
|
|
304
|
+
this.updateActivity(path);
|
|
305
|
+
await this.registry.emit({
|
|
306
|
+
type: "file:created",
|
|
307
|
+
path,
|
|
308
|
+
timestamp: Date.now()
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Handle file changed event
|
|
313
|
+
*
|
|
314
|
+
* @param path - Path to the changed file
|
|
315
|
+
* @param changes - Optional description of changes (e.g., diff)
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```typescript
|
|
319
|
+
* // Called by file system watcher
|
|
320
|
+
* fsWatcher.on('change', (path) => {
|
|
321
|
+
* const diff = computeDiff(path);
|
|
322
|
+
* watcher.onFileChanged(path, diff);
|
|
323
|
+
* });
|
|
324
|
+
* ```
|
|
325
|
+
*/
|
|
326
|
+
async onFileChanged(path, changes) {
|
|
327
|
+
if (!this.shouldProcess(path)) return;
|
|
328
|
+
this.updateActivity(path);
|
|
329
|
+
await this.registry.emit({
|
|
330
|
+
type: "file:changed",
|
|
331
|
+
path,
|
|
332
|
+
timestamp: Date.now(),
|
|
333
|
+
changes
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Handle file deleted event
|
|
338
|
+
*
|
|
339
|
+
* @param path - Path to the deleted file
|
|
340
|
+
*/
|
|
341
|
+
async onFileDeleted(path) {
|
|
342
|
+
if (!this.shouldProcess(path)) return;
|
|
343
|
+
this.updateActivity(path);
|
|
344
|
+
await this.registry.emit({
|
|
345
|
+
type: "file:deleted",
|
|
346
|
+
path,
|
|
347
|
+
timestamp: Date.now()
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Get all watched paths
|
|
352
|
+
* @returns Array of watched paths
|
|
353
|
+
*/
|
|
354
|
+
getWatchedPaths() {
|
|
355
|
+
return Array.from(this.watchPaths);
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Get last activity timestamp for a path
|
|
359
|
+
* @param path - Path to check
|
|
360
|
+
* @returns Timestamp of last activity, or undefined if not tracked
|
|
361
|
+
*/
|
|
362
|
+
getLastActivity(path) {
|
|
363
|
+
return this.lastActivityMap.get(path);
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Get the inactivity threshold
|
|
367
|
+
* @returns Inactivity threshold in milliseconds
|
|
368
|
+
*/
|
|
369
|
+
getInactivityThreshold() {
|
|
370
|
+
return this.inactivityThreshold;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Set the inactivity threshold
|
|
374
|
+
*
|
|
375
|
+
* Updates the threshold and resets all active timers with the new value.
|
|
376
|
+
*
|
|
377
|
+
* @param threshold - New threshold in milliseconds
|
|
378
|
+
*/
|
|
379
|
+
setInactivityThreshold(threshold) {
|
|
380
|
+
this.inactivityThreshold = threshold;
|
|
381
|
+
for (const path of Array.from(this.watchPaths)) {
|
|
382
|
+
this.resetInactivityTimer(path);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Check if path should be processed
|
|
387
|
+
* @param path - Path to check
|
|
388
|
+
* @returns Whether the path is being watched
|
|
389
|
+
*/
|
|
390
|
+
shouldProcess(path) {
|
|
391
|
+
for (const watchPath of Array.from(this.watchPaths)) {
|
|
392
|
+
if (path === watchPath || path.startsWith(watchPath + "/")) {
|
|
393
|
+
return true;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return false;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Update activity timestamp and reset inactivity timer
|
|
400
|
+
* @param path - Path where activity occurred
|
|
401
|
+
*/
|
|
402
|
+
updateActivity(path) {
|
|
403
|
+
const parentPath = this.findWatchedParent(path);
|
|
404
|
+
if (parentPath) {
|
|
405
|
+
this.lastActivityMap.set(parentPath, Date.now());
|
|
406
|
+
this.resetInactivityTimer(parentPath);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Find the watched parent path for a given path
|
|
411
|
+
* @param path - Path to find parent for
|
|
412
|
+
* @returns Watched parent path, or undefined if not found
|
|
413
|
+
*/
|
|
414
|
+
findWatchedParent(path) {
|
|
415
|
+
for (const watchPath of Array.from(this.watchPaths)) {
|
|
416
|
+
if (path === watchPath || path.startsWith(watchPath + "/")) {
|
|
417
|
+
return watchPath;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return void 0;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Reset the inactivity timer for a path
|
|
424
|
+
* @param path - Path to reset timer for
|
|
425
|
+
*/
|
|
426
|
+
resetInactivityTimer(path) {
|
|
427
|
+
const existingTimer = this.inactivityTimers.get(path);
|
|
428
|
+
if (existingTimer) {
|
|
429
|
+
clearTimeout(existingTimer);
|
|
430
|
+
}
|
|
431
|
+
const timer = setTimeout(async () => {
|
|
432
|
+
const lastActivity = this.lastActivityMap.get(path) ?? 0;
|
|
433
|
+
await this.registry.emit({
|
|
434
|
+
type: "timeout:inactivity",
|
|
435
|
+
lastActivity,
|
|
436
|
+
threshold: this.inactivityThreshold
|
|
437
|
+
});
|
|
438
|
+
}, this.inactivityThreshold);
|
|
439
|
+
this.inactivityTimers.set(path, timer);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
function createWebhookRegistry(config) {
|
|
443
|
+
return new WebhookRegistry(config);
|
|
444
|
+
}
|
|
445
|
+
function createFileWatcherIntegration(registry, options) {
|
|
446
|
+
return new FileWatcherIntegration(registry, options);
|
|
447
|
+
}
|
|
448
|
+
export {
|
|
449
|
+
FileWatcherIntegration,
|
|
450
|
+
WebhookRegistry,
|
|
451
|
+
createFileWatcherIntegration,
|
|
452
|
+
createWebhookRegistry
|
|
453
|
+
};
|
|
454
|
+
//# sourceMappingURL=webhook-handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-handlers.js","sources":["../../../src/workflow/handlers/webhook-handlers.ts"],"sourcesContent":["/**\n * Webhook Handlers\n *\n * Handles incoming webhooks and hooks for workflow triggers.\n * Integrates with the existing file watcher system.\n *\n * @module workflow/handlers/webhook-handlers\n */\n\nimport type {\n NodeUpdateEvent,\n GapDetectedEvent,\n WorkflowCompleteEvent,\n} from '../types.js';\n\n// Re-export types for convenience\nexport type { NodeUpdateEvent, GapDetectedEvent, WorkflowCompleteEvent };\n\n/**\n * Event types that can trigger workflows\n */\nexport type WorkflowTriggerEvent =\n | { type: 'file:created'; path: string; timestamp: number }\n | { type: 'file:changed'; path: string; timestamp: number; changes?: string }\n | { type: 'file:deleted'; path: string; timestamp: number }\n | { type: 'node:updated'; event: NodeUpdateEvent }\n | { type: 'gap:detected'; event: GapDetectedEvent }\n | { type: 'workflow:complete'; event: WorkflowCompleteEvent }\n | { type: 'timeout:inactivity'; lastActivity: number; threshold: number };\n\n/**\n * Webhook handler configuration\n */\nexport interface WebhookConfig {\n /** Secret for validating webhook signatures */\n secret?: string;\n /** Maximum payload size in bytes */\n maxPayloadSize?: number;\n /** Allowed origins for CORS */\n allowedOrigins?: string[];\n /** Rate limit per minute */\n rateLimit?: number;\n}\n\n/**\n * Webhook validation result\n */\nexport interface WebhookValidation {\n /** Whether the webhook payload is valid */\n valid: boolean;\n /** Error message if invalid */\n error?: string;\n /** Parsed event if valid */\n event?: WorkflowTriggerEvent;\n}\n\n/**\n * Handler function type for processing workflow trigger events\n * @template T - Context type passed to handlers\n */\nexport type WebhookHandler<T = unknown> = (\n event: WorkflowTriggerEvent,\n context: T\n) => Promise<void>;\n\n/**\n * Webhook handler registry\n *\n * Manages registration and dispatch of webhook event handlers.\n * Supports multiple handlers per event type and provides\n * payload validation with optional signature verification.\n *\n * @example\n * ```typescript\n * const registry = new WebhookRegistry({ secret: 'my-secret' });\n *\n * // Register handler\n * const unsubscribe = registry.on('file:changed', async (event) => {\n * console.log('File changed:', event.path);\n * });\n *\n * // Emit event\n * await registry.emit({\n * type: 'file:changed',\n * path: '/docs/readme.md',\n * timestamp: Date.now()\n * });\n *\n * // Cleanup\n * unsubscribe();\n * ```\n */\nexport class WebhookRegistry {\n private handlers: Map<string, WebhookHandler[]> = new Map();\n private config: WebhookConfig;\n\n /**\n * Create a new webhook registry\n * @param config - Registry configuration\n */\n constructor(config: WebhookConfig = {}) {\n this.config = {\n maxPayloadSize: config.maxPayloadSize ?? 1024 * 1024, // 1MB default\n rateLimit: config.rateLimit ?? 100,\n ...config,\n };\n }\n\n /**\n * Register a handler for an event type\n *\n * @param eventType - The event type to listen for\n * @param handler - Handler function to call when event occurs\n * @returns Unsubscribe function to remove the handler\n *\n * @example\n * ```typescript\n * const unsubscribe = registry.on('file:created', async (event) => {\n * if (event.type === 'file:created') {\n * await processNewFile(event.path);\n * }\n * });\n * ```\n */\n on(eventType: WorkflowTriggerEvent['type'], handler: WebhookHandler): () => void {\n const handlers = this.handlers.get(eventType) ?? [];\n handlers.push(handler);\n this.handlers.set(eventType, handlers);\n\n // Return unsubscribe function\n return () => {\n const currentHandlers = this.handlers.get(eventType) ?? [];\n const index = currentHandlers.indexOf(handler);\n if (index > -1) {\n currentHandlers.splice(index, 1);\n }\n };\n }\n\n /**\n * Remove all handlers for an event type\n *\n * @param eventType - The event type to clear handlers for\n */\n off(eventType: WorkflowTriggerEvent['type']): void {\n this.handlers.delete(eventType);\n }\n\n /**\n * Remove all handlers for all event types\n */\n clear(): void {\n this.handlers.clear();\n }\n\n /**\n * Get the number of handlers registered for an event type\n *\n * @param eventType - The event type to check\n * @returns Number of registered handlers\n */\n listenerCount(eventType: WorkflowTriggerEvent['type']): number {\n return this.handlers.get(eventType)?.length ?? 0;\n }\n\n /**\n * Emit an event to all registered handlers\n *\n * Handlers are called in parallel. Errors in individual handlers\n * are caught and logged but do not prevent other handlers from running.\n *\n * @param event - The event to emit\n * @param context - Optional context to pass to handlers\n *\n * @example\n * ```typescript\n * await registry.emit({\n * type: 'node:updated',\n * event: {\n * nodeId: 'doc-123',\n * userId: 'user-456',\n * changes: { title: 'Updated Title' },\n * timestamp: Date.now()\n * }\n * });\n * ```\n */\n async emit<T>(event: WorkflowTriggerEvent, context?: T): Promise<void> {\n const handlers = this.handlers.get(event.type) ?? [];\n\n await Promise.all(\n handlers.map((handler) =>\n handler(event, context).catch((error: unknown) => {\n console.error(`[Webhook] Handler error for ${event.type}:`, error);\n })\n )\n );\n }\n\n /**\n * Validate incoming webhook payload\n *\n * Checks that the payload is properly structured and optionally\n * verifies the signature if a secret is configured.\n *\n * @param payload - Raw payload data\n * @param signature - Optional signature for verification\n * @returns Validation result with parsed event if valid\n *\n * @example\n * ```typescript\n * const result = registry.validatePayload(\n * { type: 'file:created', path: '/test.md', timestamp: Date.now() },\n * 'sha256=abc123...'\n * );\n *\n * if (result.valid && result.event) {\n * await registry.emit(result.event);\n * } else {\n * console.error('Invalid webhook:', result.error);\n * }\n * ```\n */\n validatePayload(payload: unknown, signature?: string): WebhookValidation {\n // Check payload exists\n if (!payload || typeof payload !== 'object') {\n return { valid: false, error: 'Invalid payload: must be an object' };\n }\n\n const data = payload as Record<string, unknown>;\n\n // Check required type field\n if (!data.type || typeof data.type !== 'string') {\n return { valid: false, error: 'Invalid payload: missing type field' };\n }\n\n // Validate signature if secret configured\n if (this.config.secret && signature) {\n const isValidSignature = this.verifySignature(payload, signature);\n if (!isValidSignature) {\n return { valid: false, error: 'Invalid signature' };\n }\n }\n\n // Parse event based on type\n try {\n const event = this.parseEvent(data);\n return { valid: true, event };\n } catch (error) {\n return {\n valid: false,\n error: `Failed to parse event: ${error instanceof Error ? error.message : String(error)}`,\n };\n }\n }\n\n /**\n * Get current configuration\n * @returns A copy of the current configuration\n */\n getConfig(): Readonly<WebhookConfig> {\n return { ...this.config };\n }\n\n /**\n * Verify webhook signature\n * @param payload - The payload to verify\n * @param signature - The signature to check against\n * @returns Whether the signature is valid\n */\n private verifySignature(payload: unknown, signature: string): boolean {\n if (!this.config.secret) return true;\n\n // Simple HMAC verification (in production, use crypto.timingSafeEqual)\n const crypto = globalThis.crypto;\n if (!crypto?.subtle) {\n console.warn('[Webhook] Crypto not available for signature verification');\n return true;\n }\n\n // For now, return true - implement proper HMAC in production\n // TODO: Implement HMAC-SHA256 signature verification\n void signature; // Suppress unused variable warning\n return true;\n }\n\n /**\n * Parse raw data into typed event\n * @param data - Raw event data\n * @returns Typed workflow trigger event\n * @throws Error if event type is unknown or data is malformed\n */\n private parseEvent(data: Record<string, unknown>): WorkflowTriggerEvent {\n switch (data.type) {\n case 'file:created':\n case 'file:changed':\n case 'file:deleted':\n return {\n type: data.type as 'file:created' | 'file:changed' | 'file:deleted',\n path: String(data.path ?? ''),\n timestamp: Number(data.timestamp) || Date.now(),\n ...(data.changes ? { changes: String(data.changes) } : {}),\n } as WorkflowTriggerEvent;\n\n case 'node:updated':\n return {\n type: 'node:updated',\n event: {\n nodeId: String((data.event as Record<string, unknown>)?.nodeId ?? ''),\n userId: String((data.event as Record<string, unknown>)?.userId ?? ''),\n changes:\n ((data.event as Record<string, unknown>)?.changes as Record<string, unknown>) ?? {},\n timestamp: Number((data.event as Record<string, unknown>)?.timestamp) || Date.now(),\n },\n };\n\n case 'gap:detected':\n return {\n type: 'gap:detected',\n event: {\n docPath: String((data.event as Record<string, unknown>)?.docPath ?? ''),\n gaps: ((data.event as Record<string, unknown>)?.gaps as string[]) ?? [],\n confidence: Number((data.event as Record<string, unknown>)?.confidence) || 0,\n detectedAt: Number((data.event as Record<string, unknown>)?.detectedAt) || Date.now(),\n },\n };\n\n case 'workflow:complete': {\n const eventData = data.event as Record<string, unknown>;\n const outcomeValue = eventData?.outcome;\n const validOutcomes = ['success', 'failure', 'timeout'] as const;\n const outcome: 'success' | 'failure' | 'timeout' =\n typeof outcomeValue === 'string' && validOutcomes.includes(outcomeValue as typeof validOutcomes[number])\n ? (outcomeValue as 'success' | 'failure' | 'timeout')\n : 'success';\n\n return {\n type: 'workflow:complete',\n event: {\n workflowId: String(eventData?.workflowId ?? ''),\n outcome,\n duration: Number(eventData?.duration) || 0,\n artifacts: Array.isArray(eventData?.artifacts)\n ? (eventData.artifacts as unknown[]).map(String)\n : [],\n },\n };\n }\n\n case 'timeout:inactivity':\n return {\n type: 'timeout:inactivity',\n lastActivity: Number(data.lastActivity) || 0,\n threshold: Number(data.threshold) || 300000,\n };\n\n default:\n throw new Error(`Unknown event type: ${data.type}`);\n }\n }\n}\n\n/**\n * File watcher integration\n *\n * Converts file system events to workflow trigger events and\n * manages inactivity detection for watched paths.\n *\n * @example\n * ```typescript\n * const registry = createWebhookRegistry();\n * const watcher = createFileWatcherIntegration(registry, {\n * inactivityThreshold: 10 * 60 * 1000 // 10 minutes\n * });\n *\n * // Register for inactivity events\n * registry.on('timeout:inactivity', async (event) => {\n * console.log('No activity for:', event.threshold, 'ms');\n * });\n *\n * // Start watching\n * watcher.watch('/path/to/docs');\n *\n * // Simulate file events\n * await watcher.onFileCreated('/path/to/docs/new-file.md');\n * await watcher.onFileChanged('/path/to/docs/existing.md', 'content diff');\n * ```\n */\nexport class FileWatcherIntegration {\n private registry: WebhookRegistry;\n private watchPaths: Set<string> = new Set();\n private lastActivityMap: Map<string, number> = new Map();\n private inactivityTimers: Map<string, ReturnType<typeof setTimeout>> = new Map();\n private inactivityThreshold: number;\n\n /**\n * Create a new file watcher integration\n * @param registry - Webhook registry to emit events to\n * @param options - Configuration options\n */\n constructor(registry: WebhookRegistry, options: { inactivityThreshold?: number } = {}) {\n this.registry = registry;\n this.inactivityThreshold = options.inactivityThreshold ?? 5 * 60 * 1000; // 5 minutes default\n }\n\n /**\n * Add a path to watch\n *\n * Files created, changed, or deleted under this path will\n * trigger workflow events. Inactivity detection starts immediately.\n *\n * @param path - Absolute path to watch\n *\n * @example\n * ```typescript\n * watcher.watch('/path/to/docs');\n * watcher.watch('/path/to/templates');\n * ```\n */\n watch(path: string): void {\n this.watchPaths.add(path);\n this.resetInactivityTimer(path);\n }\n\n /**\n * Stop watching a path\n *\n * Clears inactivity timer and removes path from watch list.\n *\n * @param path - Path to stop watching\n */\n unwatch(path: string): void {\n this.watchPaths.delete(path);\n const timer = this.inactivityTimers.get(path);\n if (timer) {\n clearTimeout(timer);\n this.inactivityTimers.delete(path);\n }\n this.lastActivityMap.delete(path);\n }\n\n /**\n * Stop watching all paths and clear all timers\n */\n unwatchAll(): void {\n for (const path of Array.from(this.watchPaths)) {\n this.unwatch(path);\n }\n }\n\n /**\n * Handle file created event\n *\n * @param path - Path to the created file\n *\n * @example\n * ```typescript\n * // Called by file system watcher\n * fsWatcher.on('add', (path) => {\n * watcher.onFileCreated(path);\n * });\n * ```\n */\n async onFileCreated(path: string): Promise<void> {\n if (!this.shouldProcess(path)) return;\n\n this.updateActivity(path);\n await this.registry.emit({\n type: 'file:created',\n path,\n timestamp: Date.now(),\n });\n }\n\n /**\n * Handle file changed event\n *\n * @param path - Path to the changed file\n * @param changes - Optional description of changes (e.g., diff)\n *\n * @example\n * ```typescript\n * // Called by file system watcher\n * fsWatcher.on('change', (path) => {\n * const diff = computeDiff(path);\n * watcher.onFileChanged(path, diff);\n * });\n * ```\n */\n async onFileChanged(path: string, changes?: string): Promise<void> {\n if (!this.shouldProcess(path)) return;\n\n this.updateActivity(path);\n await this.registry.emit({\n type: 'file:changed',\n path,\n timestamp: Date.now(),\n changes,\n });\n }\n\n /**\n * Handle file deleted event\n *\n * @param path - Path to the deleted file\n */\n async onFileDeleted(path: string): Promise<void> {\n if (!this.shouldProcess(path)) return;\n\n this.updateActivity(path);\n await this.registry.emit({\n type: 'file:deleted',\n path,\n timestamp: Date.now(),\n });\n }\n\n /**\n * Get all watched paths\n * @returns Array of watched paths\n */\n getWatchedPaths(): string[] {\n return Array.from(this.watchPaths);\n }\n\n /**\n * Get last activity timestamp for a path\n * @param path - Path to check\n * @returns Timestamp of last activity, or undefined if not tracked\n */\n getLastActivity(path: string): number | undefined {\n return this.lastActivityMap.get(path);\n }\n\n /**\n * Get the inactivity threshold\n * @returns Inactivity threshold in milliseconds\n */\n getInactivityThreshold(): number {\n return this.inactivityThreshold;\n }\n\n /**\n * Set the inactivity threshold\n *\n * Updates the threshold and resets all active timers with the new value.\n *\n * @param threshold - New threshold in milliseconds\n */\n setInactivityThreshold(threshold: number): void {\n this.inactivityThreshold = threshold;\n // Reset all timers with new threshold\n for (const path of Array.from(this.watchPaths)) {\n this.resetInactivityTimer(path);\n }\n }\n\n /**\n * Check if path should be processed\n * @param path - Path to check\n * @returns Whether the path is being watched\n */\n private shouldProcess(path: string): boolean {\n // Check if path is watched or is under a watched directory\n for (const watchPath of Array.from(this.watchPaths)) {\n if (path === watchPath || path.startsWith(watchPath + '/')) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Update activity timestamp and reset inactivity timer\n * @param path - Path where activity occurred\n */\n private updateActivity(path: string): void {\n const parentPath = this.findWatchedParent(path);\n if (parentPath) {\n this.lastActivityMap.set(parentPath, Date.now());\n this.resetInactivityTimer(parentPath);\n }\n }\n\n /**\n * Find the watched parent path for a given path\n * @param path - Path to find parent for\n * @returns Watched parent path, or undefined if not found\n */\n private findWatchedParent(path: string): string | undefined {\n for (const watchPath of Array.from(this.watchPaths)) {\n if (path === watchPath || path.startsWith(watchPath + '/')) {\n return watchPath;\n }\n }\n return undefined;\n }\n\n /**\n * Reset the inactivity timer for a path\n * @param path - Path to reset timer for\n */\n private resetInactivityTimer(path: string): void {\n // Clear existing timer\n const existingTimer = this.inactivityTimers.get(path);\n if (existingTimer) {\n clearTimeout(existingTimer);\n }\n\n // Set new timer\n const timer = setTimeout(async () => {\n const lastActivity = this.lastActivityMap.get(path) ?? 0;\n await this.registry.emit({\n type: 'timeout:inactivity',\n lastActivity,\n threshold: this.inactivityThreshold,\n });\n }, this.inactivityThreshold);\n\n this.inactivityTimers.set(path, timer);\n }\n}\n\n/**\n * Create a webhook registry instance\n *\n * Factory function for creating a configured webhook registry.\n *\n * @param config - Registry configuration\n * @returns Configured webhook registry\n *\n * @example\n * ```typescript\n * const registry = createWebhookRegistry({\n * secret: process.env.WEBHOOK_SECRET,\n * maxPayloadSize: 2 * 1024 * 1024, // 2MB\n * rateLimit: 50\n * });\n * ```\n */\nexport function createWebhookRegistry(config?: WebhookConfig): WebhookRegistry {\n return new WebhookRegistry(config);\n}\n\n/**\n * Create a file watcher integration instance\n *\n * Factory function for creating a configured file watcher integration.\n *\n * @param registry - Webhook registry to emit events to\n * @param options - Configuration options\n * @returns Configured file watcher integration\n *\n * @example\n * ```typescript\n * const registry = createWebhookRegistry();\n * const watcher = createFileWatcherIntegration(registry, {\n * inactivityThreshold: 10 * 60 * 1000 // 10 minutes\n * });\n *\n * watcher.watch('/docs');\n * ```\n */\nexport function createFileWatcherIntegration(\n registry: WebhookRegistry,\n options?: { inactivityThreshold?: number }\n): FileWatcherIntegration {\n return new FileWatcherIntegration(registry, options);\n}\n"],"names":[],"mappings":"AA4FO,MAAM,gBAAgB;AAAA,EACnB,+BAA8C,IAAA;AAAA,EAC9C;AAAA;AAAA;AAAA;AAAA;AAAA,EAMR,YAAY,SAAwB,IAAI;AACtC,SAAK,SAAS;AAAA,MACZ,gBAAgB,OAAO,kBAAkB,OAAO;AAAA;AAAA,MAChD,WAAW,OAAO,aAAa;AAAA,MAC/B,GAAG;AAAA,IAAA;AAAA,EAEP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBA,GAAG,WAAyC,SAAqC;AAC/E,UAAM,WAAW,KAAK,SAAS,IAAI,SAAS,KAAK,CAAA;AACjD,aAAS,KAAK,OAAO;AACrB,SAAK,SAAS,IAAI,WAAW,QAAQ;AAGrC,WAAO,MAAM;AACX,YAAM,kBAAkB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eAAe,MAAoB;AACzC,UAAM,aAAa,KAAK,kBAAkB,IAAI;AAC9C,QAAI,YAAY;AACd,WAAK,gBAAgB,IAAI,YAAY,KAAK,KAAK;AAC/C,WAAK,qBAAqB,UAAU;AAAA,IACtC;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOQ,kBAAkB,MAAkC;AAC1D,eAAW,aAAa,MAAM,KAAK,KAAK,UAAU,GAAG;AACnD,UAAI,SAAS,aAAa,KAAK,WAAW,YAAY,GAAG,GAAG;AAC1D,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA,EAMQ,qBAAqB,MAAoB;AAE/C,UAAM,gBAAgB,KAAK,iBAAiB,IAAI,IAAI;AACpD,QAAI,eAAe;AACjB,mBAAa,aAAa;AAAA,IAC5B;AAGA,UAAM,QAAQ,WAAW,YAAY;AACnC,YAAM,eAAe,KAAK,gBAAgB,IAAI,IAAI,KAAK;AACvD,YAAM,KAAK,SAAS,KAAK;AAAA,QACvB,MAAM;AAAA,QACN;AAAA,QACA,WAAW,KAAK;AAAA,MAAA,CACjB;AAAA,IACH,GAAG,KAAK,mBAAmB;AAE3B,SAAK,iBAAiB,IAAI,MAAM,KAAK;AAAA,EACvC;AACF;AAmBO,SAAS,sBAAsB,QAAyC;AAC7E,SAAO,IAAI,gBAAgB,MAAM;AACnC;AAqBO,SAAS,6BACd,UACA,SACwB;AACxB,SAAO,IAAI,uBAAuB,UAAU,OAAO;AACrD;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow Module
|
|
3
|
+
*
|
|
4
|
+
* Exports all workflow-related functionality for the Workflow DevKit,
|
|
5
|
+
* including configuration management, type definitions, and GOAP planning support.
|
|
6
|
+
*
|
|
7
|
+
* @module workflow
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import {
|
|
12
|
+
* createWorkflowConfig,
|
|
13
|
+
* defaultConfig,
|
|
14
|
+
* type WorldState,
|
|
15
|
+
* type GOAPAction,
|
|
16
|
+
* type TaskSpec,
|
|
17
|
+
* } from './workflow/index.js';
|
|
18
|
+
*
|
|
19
|
+
* // Create environment-based configuration
|
|
20
|
+
* const config = createWorkflowConfig();
|
|
21
|
+
*
|
|
22
|
+
* // Define world state for planning
|
|
23
|
+
* const state: WorldState = {
|
|
24
|
+
* hasSpecification: true,
|
|
25
|
+
* specCompleteness: 0.7,
|
|
26
|
+
* hasAcceptanceCriteria: false,
|
|
27
|
+
* taskDefined: false,
|
|
28
|
+
* blockersFree: true,
|
|
29
|
+
* developmentStarted: false,
|
|
30
|
+
* timeSinceLastChange: 0,
|
|
31
|
+
* lastChangeTimestamp: Date.now(),
|
|
32
|
+
* activeCollaborators: [],
|
|
33
|
+
* pendingGaps: [],
|
|
34
|
+
* };
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export { createWorkflowConfig, validateWorkflowConfig, createPostgresConfig, createVercelConfig, createLocalConfig, defaultConfig, type WorkflowConfig, type PostgresPoolConfig, type PostgresWorldConfig, type VercelWorldConfig, type LocalWorldConfig, } from './config.js';
|
|
38
|
+
export { type WorldState, type NodeUpdateEvent, type GapDetectedEvent, type WorkflowCompleteEvent, type WorkflowRunMetadata, type TaskSpec, type DocumentGap, type GapAnalysis, type GOAPAction, type GOAPGoal, type GOAPPlanStep, type GOAPPlan, type GOAPPlanExtended, type PlanExecutionResult, type ReadinessEvaluation, type WorkflowExecutionOptions, type WorkflowExecutionResult, type HookHandler, type HookRegistration, } from './types.js';
|
|
39
|
+
export { WebhookRegistry, FileWatcherIntegration, createWebhookRegistry, createFileWatcherIntegration, type WorkflowTriggerEvent, type WebhookConfig, type WebhookValidation, type WebhookHandler, } from './handlers/index.js';
|
|
40
|
+
export { GOAPAdapter, createGOAPAdapter, DEFAULT_GOAP_ACTIONS, type GOAPAdapterConfig, } from './adapters/index.js';
|
|
41
|
+
export { WorkflowService, createWorkflowService, type WorkflowServiceConfig, type WorkflowExecutionResult as ServiceExecutionResult, type WorkflowServiceStatus, type WorkflowExecutionStats, } from './services/index.js';
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/workflow/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAGH,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EAChB,KAAK,gBAAgB,GACtB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,qBAAqB,EACrB,4BAA4B,EAC5B,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACpB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,iBAAiB,GACvB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,IAAI,sBAAsB,EACtD,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow Services
|
|
3
|
+
*
|
|
4
|
+
* Exports all service modules for the workflow system.
|
|
5
|
+
*
|
|
6
|
+
* @module workflow/services
|
|
7
|
+
*/
|
|
8
|
+
export { WorkflowService, createWorkflowService, type WorkflowServiceConfig, type WorkflowExecutionResult, type WorkflowServiceStatus, type WorkflowExecutionStats, } from './workflow-service.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/workflow/services/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,uBAAuB,CAAC"}
|