@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 @@
|
|
|
1
|
+
{"version":3,"file":"string.js","sources":["../../../../../../../../../node_modules/zod-to-json-schema/dist/esm/parsers/string.js"],"sourcesContent":["import { setResponseValueAndErrors } from \"../errorMessages.js\";\nlet emojiRegex = undefined;\n/**\n * Generated from the regular expressions found here as of 2024-05-22:\n * https://github.com/colinhacks/zod/blob/master/src/types.ts.\n *\n * Expressions with /i flag have been changed accordingly.\n */\nexport const zodPatterns = {\n /**\n * `c` was changed to `[cC]` to replicate /i flag\n */\n cuid: /^[cC][^\\s-]{8,}$/,\n cuid2: /^[0-9a-z]+$/,\n ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,\n /**\n * `a-z` was added to replicate /i flag\n */\n email: /^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_'+\\-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$/,\n /**\n * Constructed a valid Unicode RegExp\n *\n * Lazily instantiate since this type of regex isn't supported\n * in all envs (e.g. React Native).\n *\n * See:\n * https://github.com/colinhacks/zod/issues/2433\n * Fix in Zod:\n * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b\n */\n emoji: () => {\n if (emojiRegex === undefined) {\n emojiRegex = RegExp(\"^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$\", \"u\");\n }\n return emojiRegex;\n },\n /**\n * Unused\n */\n uuid: /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/,\n /**\n * Unused\n */\n ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,\n ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/,\n /**\n * Unused\n */\n ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,\n ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,\n base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,\n base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,\n nanoid: /^[a-zA-Z0-9_-]{21}$/,\n jwt: /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,\n};\nexport function parseStringDef(def, refs) {\n const res = {\n type: \"string\",\n };\n if (def.checks) {\n for (const check of def.checks) {\n switch (check.kind) {\n case \"min\":\n setResponseValueAndErrors(res, \"minLength\", typeof res.minLength === \"number\"\n ? Math.max(res.minLength, check.value)\n : check.value, check.message, refs);\n break;\n case \"max\":\n setResponseValueAndErrors(res, \"maxLength\", typeof res.maxLength === \"number\"\n ? Math.min(res.maxLength, check.value)\n : check.value, check.message, refs);\n break;\n case \"email\":\n switch (refs.emailStrategy) {\n case \"format:email\":\n addFormat(res, \"email\", check.message, refs);\n break;\n case \"format:idn-email\":\n addFormat(res, \"idn-email\", check.message, refs);\n break;\n case \"pattern:zod\":\n addPattern(res, zodPatterns.email, check.message, refs);\n break;\n }\n break;\n case \"url\":\n addFormat(res, \"uri\", check.message, refs);\n break;\n case \"uuid\":\n addFormat(res, \"uuid\", check.message, refs);\n break;\n case \"regex\":\n addPattern(res, check.regex, check.message, refs);\n break;\n case \"cuid\":\n addPattern(res, zodPatterns.cuid, check.message, refs);\n break;\n case \"cuid2\":\n addPattern(res, zodPatterns.cuid2, check.message, refs);\n break;\n case \"startsWith\":\n addPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs);\n break;\n case \"endsWith\":\n addPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs);\n break;\n case \"datetime\":\n addFormat(res, \"date-time\", check.message, refs);\n break;\n case \"date\":\n addFormat(res, \"date\", check.message, refs);\n break;\n case \"time\":\n addFormat(res, \"time\", check.message, refs);\n break;\n case \"duration\":\n addFormat(res, \"duration\", check.message, refs);\n break;\n case \"length\":\n setResponseValueAndErrors(res, \"minLength\", typeof res.minLength === \"number\"\n ? Math.max(res.minLength, check.value)\n : check.value, check.message, refs);\n setResponseValueAndErrors(res, \"maxLength\", typeof res.maxLength === \"number\"\n ? Math.min(res.maxLength, check.value)\n : check.value, check.message, refs);\n break;\n case \"includes\": {\n addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);\n break;\n }\n case \"ip\": {\n if (check.version !== \"v6\") {\n addFormat(res, \"ipv4\", check.message, refs);\n }\n if (check.version !== \"v4\") {\n addFormat(res, \"ipv6\", check.message, refs);\n }\n break;\n }\n case \"base64url\":\n addPattern(res, zodPatterns.base64url, check.message, refs);\n break;\n case \"jwt\":\n addPattern(res, zodPatterns.jwt, check.message, refs);\n break;\n case \"cidr\": {\n if (check.version !== \"v6\") {\n addPattern(res, zodPatterns.ipv4Cidr, check.message, refs);\n }\n if (check.version !== \"v4\") {\n addPattern(res, zodPatterns.ipv6Cidr, check.message, refs);\n }\n break;\n }\n case \"emoji\":\n addPattern(res, zodPatterns.emoji(), check.message, refs);\n break;\n case \"ulid\": {\n addPattern(res, zodPatterns.ulid, check.message, refs);\n break;\n }\n case \"base64\": {\n switch (refs.base64Strategy) {\n case \"format:binary\": {\n addFormat(res, \"binary\", check.message, refs);\n break;\n }\n case \"contentEncoding:base64\": {\n setResponseValueAndErrors(res, \"contentEncoding\", \"base64\", check.message, refs);\n break;\n }\n case \"pattern:zod\": {\n addPattern(res, zodPatterns.base64, check.message, refs);\n break;\n }\n }\n break;\n }\n case \"nanoid\": {\n addPattern(res, zodPatterns.nanoid, check.message, refs);\n }\n case \"toLowerCase\":\n case \"toUpperCase\":\n case \"trim\":\n break;\n default:\n ((_) => { })(check);\n }\n }\n }\n return res;\n}\nfunction escapeLiteralCheckValue(literal, refs) {\n return refs.patternStrategy === \"escape\"\n ? escapeNonAlphaNumeric(literal)\n : literal;\n}\nconst ALPHA_NUMERIC = new Set(\"ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789\");\nfunction escapeNonAlphaNumeric(source) {\n let result = \"\";\n for (let i = 0; i < source.length; i++) {\n if (!ALPHA_NUMERIC.has(source[i])) {\n result += \"\\\\\";\n }\n result += source[i];\n }\n return result;\n}\n// Adds a \"format\" keyword to the schema. If a format exists, both formats will be joined in an allOf-node, along with subsequent ones.\nfunction addFormat(schema, value, message, refs) {\n if (schema.format || schema.anyOf?.some((x) => x.format)) {\n if (!schema.anyOf) {\n schema.anyOf = [];\n }\n if (schema.format) {\n schema.anyOf.push({\n format: schema.format,\n ...(schema.errorMessage &&\n refs.errorMessages && {\n errorMessage: { format: schema.errorMessage.format },\n }),\n });\n delete schema.format;\n if (schema.errorMessage) {\n delete schema.errorMessage.format;\n if (Object.keys(schema.errorMessage).length === 0) {\n delete schema.errorMessage;\n }\n }\n }\n schema.anyOf.push({\n format: value,\n ...(message &&\n refs.errorMessages && { errorMessage: { format: message } }),\n });\n }\n else {\n setResponseValueAndErrors(schema, \"format\", value, message, refs);\n }\n}\n// Adds a \"pattern\" keyword to the schema. If a pattern exists, both patterns will be joined in an allOf-node, along with subsequent ones.\nfunction addPattern(schema, regex, message, refs) {\n if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {\n if (!schema.allOf) {\n schema.allOf = [];\n }\n if (schema.pattern) {\n schema.allOf.push({\n pattern: schema.pattern,\n ...(schema.errorMessage &&\n refs.errorMessages && {\n errorMessage: { pattern: schema.errorMessage.pattern },\n }),\n });\n delete schema.pattern;\n if (schema.errorMessage) {\n delete schema.errorMessage.pattern;\n if (Object.keys(schema.errorMessage).length === 0) {\n delete schema.errorMessage;\n }\n }\n }\n schema.allOf.push({\n pattern: stringifyRegExpWithFlags(regex, refs),\n ...(message &&\n refs.errorMessages && { errorMessage: { pattern: message } }),\n });\n }\n else {\n setResponseValueAndErrors(schema, \"pattern\", stringifyRegExpWithFlags(regex, refs), message, refs);\n }\n}\n// Mutate z.string.regex() in a best attempt to accommodate for regex flags when applyRegexFlags is true\nfunction stringifyRegExpWithFlags(regex, refs) {\n if (!refs.applyRegexFlags || !regex.flags) {\n return regex.source;\n }\n // Currently handled flags\n const flags = {\n i: regex.flags.includes(\"i\"),\n m: regex.flags.includes(\"m\"),\n s: regex.flags.includes(\"s\"), // `.` matches newlines\n };\n // The general principle here is to step through each character, one at a time, applying mutations as flags require. We keep track when the current character is escaped, and when it's inside a group /like [this]/ or (also) a range like /[a-z]/. The following is fairly brittle imperative code; edit at your peril!\n const source = flags.i ? regex.source.toLowerCase() : regex.source;\n let pattern = \"\";\n let isEscaped = false;\n let inCharGroup = false;\n let inCharRange = false;\n for (let i = 0; i < source.length; i++) {\n if (isEscaped) {\n pattern += source[i];\n isEscaped = false;\n continue;\n }\n if (flags.i) {\n if (inCharGroup) {\n if (source[i].match(/[a-z]/)) {\n if (inCharRange) {\n pattern += source[i];\n pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();\n inCharRange = false;\n }\n else if (source[i + 1] === \"-\" && source[i + 2]?.match(/[a-z]/)) {\n pattern += source[i];\n inCharRange = true;\n }\n else {\n pattern += `${source[i]}${source[i].toUpperCase()}`;\n }\n continue;\n }\n }\n else if (source[i].match(/[a-z]/)) {\n pattern += `[${source[i]}${source[i].toUpperCase()}]`;\n continue;\n }\n }\n if (flags.m) {\n if (source[i] === \"^\") {\n pattern += `(^|(?<=[\\r\\n]))`;\n continue;\n }\n else if (source[i] === \"$\") {\n pattern += `($|(?=[\\r\\n]))`;\n continue;\n }\n }\n if (flags.s && source[i] === \".\") {\n pattern += inCharGroup ? `${source[i]}\\r\\n` : `[${source[i]}\\r\\n]`;\n continue;\n }\n pattern += source[i];\n if (source[i] === \"\\\\\") {\n isEscaped = true;\n }\n else if (inCharGroup && source[i] === \"]\") {\n inCharGroup = false;\n }\n else if (!inCharGroup && source[i] === \"[\") {\n inCharGroup = true;\n }\n }\n try {\n new RegExp(pattern);\n }\n catch {\n console.warn(`Could not convert regex pattern at ${refs.currentPath.join(\"/\")} to a flag-independent form! Falling back to the flag-ignorant source`);\n return regex.source;\n }\n return pattern;\n}\n"],"names":[],"mappings":"AAqMsB,IAAI,IAAI,8DAA8D;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reasoning Module
|
|
3
|
+
*
|
|
4
|
+
* Provides decision tracking, reasoning chains, and explainability.
|
|
5
|
+
*/
|
|
6
|
+
export type DecisionType = 'classification' | 'selection' | 'routing' | 'prioritization' | 'validation' | 'transformation';
|
|
7
|
+
export type ConfidenceLevel = 'very_low' | 'low' | 'medium' | 'high' | 'very_high';
|
|
8
|
+
export interface DecisionContext {
|
|
9
|
+
id: string;
|
|
10
|
+
input: Record<string, unknown>;
|
|
11
|
+
options?: string[];
|
|
12
|
+
constraints?: string[];
|
|
13
|
+
timestamp: Date;
|
|
14
|
+
}
|
|
15
|
+
export interface Alternative {
|
|
16
|
+
id: string;
|
|
17
|
+
description: string;
|
|
18
|
+
score: number;
|
|
19
|
+
reasonNotSelected?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface DecisionOutcome {
|
|
22
|
+
selected: string;
|
|
23
|
+
confidence: ConfidenceLevel;
|
|
24
|
+
confidenceScore: number;
|
|
25
|
+
alternatives: Alternative[];
|
|
26
|
+
reasoning: string[];
|
|
27
|
+
}
|
|
28
|
+
export interface Decision {
|
|
29
|
+
id: string;
|
|
30
|
+
type: DecisionType;
|
|
31
|
+
context: DecisionContext;
|
|
32
|
+
outcome: DecisionOutcome;
|
|
33
|
+
duration: number;
|
|
34
|
+
metadata?: Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
export interface ReasoningChain {
|
|
37
|
+
id: string;
|
|
38
|
+
decisions: Decision[];
|
|
39
|
+
conclusion?: string;
|
|
40
|
+
confidence: ConfidenceLevel;
|
|
41
|
+
totalDuration: number;
|
|
42
|
+
metadata?: Record<string, unknown>;
|
|
43
|
+
}
|
|
44
|
+
export declare class DecisionTracker {
|
|
45
|
+
private decisions;
|
|
46
|
+
private chains;
|
|
47
|
+
private currentChainId?;
|
|
48
|
+
startChain(metadata?: Record<string, unknown>): string;
|
|
49
|
+
endChain(conclusion?: string): ReasoningChain | undefined;
|
|
50
|
+
recordDecision(type: DecisionType, context: Omit<DecisionContext, 'id' | 'timestamp'>, outcome: DecisionOutcome, duration: number, metadata?: Record<string, unknown>): Decision;
|
|
51
|
+
getDecision(id: string): Decision | undefined;
|
|
52
|
+
getChain(id: string): ReasoningChain | undefined;
|
|
53
|
+
getAllDecisions(): Decision[];
|
|
54
|
+
getAllChains(): ReasoningChain[];
|
|
55
|
+
getDecisionsByType(type: DecisionType): Decision[];
|
|
56
|
+
getRecentDecisions(limit?: number): Decision[];
|
|
57
|
+
getStatistics(): {
|
|
58
|
+
totalDecisions: number;
|
|
59
|
+
totalChains: number;
|
|
60
|
+
averageDuration: number;
|
|
61
|
+
byType: Record<DecisionType, number>;
|
|
62
|
+
byConfidence: Record<ConfidenceLevel, number>;
|
|
63
|
+
};
|
|
64
|
+
export(): {
|
|
65
|
+
decisions: Decision[];
|
|
66
|
+
chains: ReasoningChain[];
|
|
67
|
+
exportedAt: Date;
|
|
68
|
+
};
|
|
69
|
+
clear(): void;
|
|
70
|
+
private calculateChainConfidence;
|
|
71
|
+
}
|
|
72
|
+
export declare function createDecisionTracker(): DecisionTracker;
|
|
73
|
+
export declare function getDecisionTracker(): DecisionTracker;
|
|
74
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reasoning/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,MAAM,MAAM,YAAY,GACpB,gBAAgB,GAChB,WAAW,GACX,SAAS,GACT,gBAAgB,GAChB,YAAY,GACZ,gBAAgB,CAAC;AAErB,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;AAEnF,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,eAAe,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,eAAe,CAAC;IACzB,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,Q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AM,CAAC;QACxB,MAAM,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QACrC,YAAY,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;KAC/C;IAuBD,MAAM,IAAI;QACR,SAAS,EAAE,QAAQ,EAAE,CAAC;QACtB,MAAM,EAAE,cAAc,EAAE,CAAC;QACzB,UAAU,EAAE,IAAI,CAAC;KAClB;IAQD,KAAK,IAAI,IAAI;IAMb,OAAO,CAAC,wBAAwB;CAajC;AAQD,wBAAgB,qBAAqB,IAAI,eAAe,CAEvD;AAED,wBAAgB,kBAAkB,IAAI,eAAe,CAKpD"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
class DecisionTracker {
|
|
2
|
+
decisions = /* @__PURE__ */ new Map();
|
|
3
|
+
chains = /* @__PURE__ */ new Map();
|
|
4
|
+
currentChainId;
|
|
5
|
+
startChain(metadata) {
|
|
6
|
+
const id = `chain-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
7
|
+
this.chains.set(id, {
|
|
8
|
+
id,
|
|
9
|
+
decisions: [],
|
|
10
|
+
confidence: "medium",
|
|
11
|
+
totalDuration: 0,
|
|
12
|
+
metadata
|
|
13
|
+
});
|
|
14
|
+
this.currentChainId = id;
|
|
15
|
+
return id;
|
|
16
|
+
}
|
|
17
|
+
endChain(conclusion) {
|
|
18
|
+
if (!this.currentChainId) return void 0;
|
|
19
|
+
const chain = this.chains.get(this.currentChainId);
|
|
20
|
+
if (chain) {
|
|
21
|
+
chain.conclusion = conclusion;
|
|
22
|
+
chain.totalDuration = chain.decisions.reduce((sum, d) => sum + d.duration, 0);
|
|
23
|
+
chain.confidence = this.calculateChainConfidence(chain);
|
|
24
|
+
}
|
|
25
|
+
this.currentChainId = void 0;
|
|
26
|
+
return chain;
|
|
27
|
+
}
|
|
28
|
+
recordDecision(type, context, outcome, duration, metadata) {
|
|
29
|
+
const id = `decision-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
30
|
+
const decision = {
|
|
31
|
+
id,
|
|
32
|
+
type,
|
|
33
|
+
context: {
|
|
34
|
+
...context,
|
|
35
|
+
id: `ctx-${id}`,
|
|
36
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
37
|
+
},
|
|
38
|
+
outcome,
|
|
39
|
+
duration,
|
|
40
|
+
metadata
|
|
41
|
+
};
|
|
42
|
+
this.decisions.set(id, decision);
|
|
43
|
+
if (this.currentChainId) {
|
|
44
|
+
const chain = this.chains.get(this.currentChainId);
|
|
45
|
+
if (chain) {
|
|
46
|
+
chain.decisions.push(decision);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return decision;
|
|
50
|
+
}
|
|
51
|
+
getDecision(id) {
|
|
52
|
+
return this.decisions.get(id);
|
|
53
|
+
}
|
|
54
|
+
getChain(id) {
|
|
55
|
+
return this.chains.get(id);
|
|
56
|
+
}
|
|
57
|
+
getAllDecisions() {
|
|
58
|
+
return Array.from(this.decisions.values());
|
|
59
|
+
}
|
|
60
|
+
getAllChains() {
|
|
61
|
+
return Array.from(this.chains.values());
|
|
62
|
+
}
|
|
63
|
+
getDecisionsByType(type) {
|
|
64
|
+
return Array.from(this.decisions.values()).filter((d) => d.type === type);
|
|
65
|
+
}
|
|
66
|
+
getRecentDecisions(limit = 10) {
|
|
67
|
+
return Array.from(this.decisions.values()).sort((a, b) => b.context.timestamp.getTime() - a.context.timestamp.getTime()).slice(0, limit);
|
|
68
|
+
}
|
|
69
|
+
getStatistics() {
|
|
70
|
+
const decisions = Array.from(this.decisions.values());
|
|
71
|
+
const byType = {};
|
|
72
|
+
const byConfidence = {};
|
|
73
|
+
let totalDuration = 0;
|
|
74
|
+
for (const decision of decisions) {
|
|
75
|
+
byType[decision.type] = (byType[decision.type] || 0) + 1;
|
|
76
|
+
byConfidence[decision.outcome.confidence] = (byConfidence[decision.outcome.confidence] || 0) + 1;
|
|
77
|
+
totalDuration += decision.duration;
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
totalDecisions: decisions.length,
|
|
81
|
+
totalChains: this.chains.size,
|
|
82
|
+
averageDuration: decisions.length > 0 ? totalDuration / decisions.length : 0,
|
|
83
|
+
byType,
|
|
84
|
+
byConfidence
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export() {
|
|
88
|
+
return {
|
|
89
|
+
decisions: Array.from(this.decisions.values()),
|
|
90
|
+
chains: Array.from(this.chains.values()),
|
|
91
|
+
exportedAt: /* @__PURE__ */ new Date()
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
clear() {
|
|
95
|
+
this.decisions.clear();
|
|
96
|
+
this.chains.clear();
|
|
97
|
+
this.currentChainId = void 0;
|
|
98
|
+
}
|
|
99
|
+
calculateChainConfidence(chain) {
|
|
100
|
+
if (chain.decisions.length === 0) return "medium";
|
|
101
|
+
const avgScore = chain.decisions.reduce((sum, d) => sum + d.outcome.confidenceScore, 0) / chain.decisions.length;
|
|
102
|
+
if (avgScore >= 0.9) return "very_high";
|
|
103
|
+
if (avgScore >= 0.7) return "high";
|
|
104
|
+
if (avgScore >= 0.5) return "medium";
|
|
105
|
+
if (avgScore >= 0.3) return "low";
|
|
106
|
+
return "very_low";
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
let defaultTracker;
|
|
110
|
+
function createDecisionTracker() {
|
|
111
|
+
return new DecisionTracker();
|
|
112
|
+
}
|
|
113
|
+
function getDecisionTracker() {
|
|
114
|
+
if (!defaultTracker) {
|
|
115
|
+
defaultTracker = new DecisionTracker();
|
|
116
|
+
}
|
|
117
|
+
return defaultTracker;
|
|
118
|
+
}
|
|
119
|
+
export {
|
|
120
|
+
DecisionTracker,
|
|
121
|
+
createDecisionTracker,
|
|
122
|
+
getDecisionTracker
|
|
123
|
+
};
|
|
124
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/reasoning/index.ts"],"sourcesContent":["/**\n * Reasoning Module\n *\n * Provides decision tracking, reasoning chains, and explainability.\n */\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type DecisionType =\n | 'classification'\n | 'selection'\n | 'routing'\n | 'prioritization'\n | 'validation'\n | 'transformation';\n\nexport type ConfidenceLevel = 'very_low' | 'low' | 'medium' | 'high' | 'very_high';\n\nexport interface DecisionContext {\n id: string;\n input: Record<string, unknown>;\n options?: string[];\n constraints?: string[];\n timestamp: Date;\n}\n\nexport interface Alternative {\n id: string;\n description: string;\n score: number;\n reasonNotSelected?: string;\n}\n\nexport interface DecisionOutcome {\n selected: string;\n confidence: ConfidenceLevel;\n confidenceScore: number;\n alternatives: Alternative[];\n reasoning: string[];\n}\n\nexport interface Decision {\n id: string;\n type: DecisionType;\n context: DecisionContext;\n outcome: DecisionOutcome;\n duration: number;\n metadata?: Record<string, unknown>;\n}\n\nexport interface ReasoningChain {\n id: string;\n decisions: Decision[];\n conclusion?: string;\n confidence: ConfidenceLevel;\n totalDuration: number;\n metadata?: Record<string, unknown>;\n}\n\n// ============================================================================\n// Decision Tracker\n// ============================================================================\n\nexport class DecisionTracker {\n private decisions: Map<string, Decision> = new Map();\n private chains: Map<string, ReasoningChain> = new Map();\n private currentChainId?: string;\n\n startChain(metadata?: Record<string, unknown>): string {\n const id = `chain-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;\n\n this.chains.set(id, {\n id,\n decisions: [],\n confidence: 'medium',\n totalDuration: 0,\n metadata,\n });\n\n this.currentChainId = id;\n return id;\n }\n\n endChain(conclusion?: string): ReasoningChain | undefined {\n if (!this.currentChainId) return undefined;\n\n const chain = this.chains.get(this.currentChainId);\n if (chain) {\n chain.conclusion = conclusion;\n chain.totalDuration = chain.decisions.reduce((sum, d) => sum + d.duration, 0);\n chain.confidence = this.calculateChainConfidence(chain);\n }\n\n this.currentChainId = undefined;\n return chain;\n }\n\n recordDecision(\n type: DecisionType,\n context: Omit<DecisionContext, 'id' | 'timestamp'>,\n outcome: DecisionOutcome,\n duration: number,\n metadata?: Record<string, unknown>\n ): Decision {\n const id = `decision-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;\n\n const decision: Decision = {\n id,\n type,\n context: {\n ...context,\n id: `ctx-${id}`,\n timestamp: new Date(),\n },\n outcome,\n duration,\n metadata,\n };\n\n this.decisions.set(id, decision);\n\n if (this.currentChainId) {\n const chain = this.chains.get(this.currentChainId);\n if (chain) {\n chain.decisions.push(decision);\n }\n }\n\n return decision;\n }\n\n getDecision(id: string): Decision | undefined {\n return this.decisions.get(id);\n }\n\n getChain(id: string): ReasoningChain | undefined {\n return this.chains.get(id);\n }\n\n getAllDecisions(): Decision[] {\n return Array.from(this.decisions.values());\n }\n\n getAllChains(): ReasoningChain[] {\n return Array.from(this.chains.values());\n }\n\n getDecisionsByType(type: DecisionType): Decision[] {\n return Array.from(this.decisions.values()).filter((d) => d.type === type);\n }\n\n getRecentDecisions(limit: number = 10): Decision[] {\n return Array.from(this.decisions.values())\n .sort((a, b) => b.context.timestamp.getTime() - a.context.timestamp.getTime())\n .slice(0, limit);\n }\n\n getStatistics(): {\n totalDecisions: number;\n totalChains: number;\n averageDuration: number;\n byType: Record<DecisionType, number>;\n byConfidence: Record<ConfidenceLevel, number>;\n } {\n const decisions = Array.from(this.decisions.values());\n const byType: Record<string, number> = {};\n const byConfidence: Record<string, number> = {};\n\n let totalDuration = 0;\n\n for (const decision of decisions) {\n byType[decision.type] = (byType[decision.type] || 0) + 1;\n byConfidence[decision.outcome.confidence] =\n (byConfidence[decision.outcome.confidence] || 0) + 1;\n totalDuration += decision.duration;\n }\n\n return {\n totalDecisions: decisions.length,\n totalChains: this.chains.size,\n averageDuration: decisions.length > 0 ? totalDuration / decisions.length : 0,\n byType: byType as Record<DecisionType, number>,\n byConfidence: byConfidence as Record<ConfidenceLevel, number>,\n };\n }\n\n export(): {\n decisions: Decision[];\n chains: ReasoningChain[];\n exportedAt: Date;\n } {\n return {\n decisions: Array.from(this.decisions.values()),\n chains: Array.from(this.chains.values()),\n exportedAt: new Date(),\n };\n }\n\n clear(): void {\n this.decisions.clear();\n this.chains.clear();\n this.currentChainId = undefined;\n }\n\n private calculateChainConfidence(chain: ReasoningChain): ConfidenceLevel {\n if (chain.decisions.length === 0) return 'medium';\n\n const avgScore =\n chain.decisions.reduce((sum, d) => sum + d.outcome.confidenceScore, 0) /\n chain.decisions.length;\n\n if (avgScore >= 0.9) return 'very_high';\n if (avgScore >= 0.7) return 'high';\n if (avgScore >= 0.5) return 'medium';\n if (avgScore >= 0.3) return 'low';\n return 'very_low';\n }\n}\n\n// ============================================================================\n// Singleton Instance\n// ============================================================================\n\nlet defaultTracker: DecisionTracker | undefined;\n\nexport function createDecisionTracker(): DecisionTracker {\n return new DecisionTracker();\n}\n\nexport function getDecisionTracker(): DecisionTracker {\n if (!defaultTracker) {\n defaultTracker = new DecisionTracker();\n }\n return defaultTracker;\n}\n"],"names":[],"mappings":"AAiEO,MAAM,gBAAgB;AAAA,EACnB,gCAAuC,IAAA;AAAA,EACvC,6BAA0C,IAAA;AAAA,EAC1C;AAAA,EAER,WAAW,UAA4C;AACrD,UAAM,KAAK,SAAS,KAAK,IAAA,CAAK,IAAI,KAAK,OAAA,EAAS,SAAS,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;AAExE,SAAK,OAAO,IAAI,IAAI;AAAA,MAClB;AAAA,MACA,WAAW,CAAA;AAAA,MACX,YAAY;AAAA,MACZ,eAAe;AAAA,MACf;AAAA,IAAA,CACD;AAED,SAAK,iBAAiB;AACtB,WAAO;AAAA,EACT;AAAA,EAEA,SAAS,YAAiD;AACxD,QAAI,CAAC,KAAK,eAAgB,QAAO;AAEjC,UAAM,QAAQ,KAAK,OAAO,IAAI,KAAK,cAAc;AACjD,QAAI,OAAO;AACT,YAAM,aAAa;AACnB,YAAM,gBAAgB,MAAM,UAAU,OAAO,CAAC,KAAK,MAAM,MAAM,EAAE,UAAU,CAAC;AAC5E,YAAM,aAAa,KAAK,yBAAyB,KAAK;AAA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B;AACnB,qBAAiB,IAAI,gBAAA;AAAA,EACvB;AACA,SAAO;AACT;"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decision Tracker - Track and explain AI decisions
|
|
3
|
+
*
|
|
4
|
+
* Provides comprehensive tracking of AI reasoning and decision-making,
|
|
5
|
+
* enabling transparency, debugging, and audit trails for all automated actions.
|
|
6
|
+
*
|
|
7
|
+
* @module reasoning/tracker
|
|
8
|
+
*/
|
|
9
|
+
import { EventEmitter } from 'events';
|
|
10
|
+
import type { Decision, DecisionOutcome, ReasoningChain, ReasoningChainStatus, ConfidenceLevel, DecisionType, CreateDecisionParams, ReasoningStats } from './types.js';
|
|
11
|
+
/**
|
|
12
|
+
* Events emitted by the DecisionTracker
|
|
13
|
+
*/
|
|
14
|
+
export interface DecisionTrackerEvents {
|
|
15
|
+
chainStarted: (chain: ReasoningChain) => void;
|
|
16
|
+
chainEnded: (chain: ReasoningChain) => void;
|
|
17
|
+
decisionRecorded: (decision: Decision) => void;
|
|
18
|
+
outcomeRecorded: (decision: Decision) => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Decision Tracker for recording, explaining, and auditing AI decisions
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const tracker = createDecisionTracker();
|
|
26
|
+
*
|
|
27
|
+
* // Start a reasoning chain for a goal
|
|
28
|
+
* const chainId = tracker.startChain('Process user query about entities');
|
|
29
|
+
*
|
|
30
|
+
* // Record decisions as they're made
|
|
31
|
+
* const decision = tracker.recordDecision({
|
|
32
|
+
* action: 'Extract entities from query',
|
|
33
|
+
* reasoning: [
|
|
34
|
+
* 'Query contains multiple noun phrases',
|
|
35
|
+
* 'NLP analysis identified 3 potential entities',
|
|
36
|
+
* 'Confidence scores above threshold for all 3',
|
|
37
|
+
* ],
|
|
38
|
+
* confidence: 'high',
|
|
39
|
+
* context: {
|
|
40
|
+
* trigger: 'user_query',
|
|
41
|
+
* inputs: { query: 'Tell me about Apple and Microsoft' },
|
|
42
|
+
* constraints: ['max 10 entities', 'confidence > 0.7'],
|
|
43
|
+
* alternatives: [],
|
|
44
|
+
* },
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* // Record outcome after execution
|
|
48
|
+
* tracker.recordOutcome(decision.id, {
|
|
49
|
+
* success: true,
|
|
50
|
+
* result: { entities: ['Apple', 'Microsoft'] },
|
|
51
|
+
* duration: 150,
|
|
52
|
+
* sideEffects: [],
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* // Get explanation
|
|
56
|
+
* console.log(tracker.explainDecision(decision.id));
|
|
57
|
+
*
|
|
58
|
+
* // End the chain
|
|
59
|
+
* tracker.endChain(chainId);
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare class DecisionTracker extends EventEmitter {
|
|
63
|
+
private decisions;
|
|
64
|
+
private chains;
|
|
65
|
+
private currentChain?;
|
|
66
|
+
private maxDecisions;
|
|
67
|
+
private maxChains;
|
|
68
|
+
constructor(options?: {
|
|
69
|
+
maxDecisions?: number;
|
|
70
|
+
maxChains?: number;
|
|
71
|
+
});
|
|
72
|
+
/**
|
|
73
|
+
* Start a new reasoning chain for a specific goal
|
|
74
|
+
*
|
|
75
|
+
* @param goal - The goal this reasoning chain is working toward
|
|
76
|
+
* @returns The chain ID
|
|
77
|
+
*/
|
|
78
|
+
startChain(goal: string): string;
|
|
79
|
+
/**
|
|
80
|
+
* Record a decision made by the system
|
|
81
|
+
*
|
|
82
|
+
* @param params - Decision parameters
|
|
83
|
+
* @returns The recorded decision
|
|
84
|
+
*/
|
|
85
|
+
recordDecision(params: CreateDecisionParams): Decision;
|
|
86
|
+
/**
|
|
87
|
+
* Record the outcome of a decision after execution
|
|
88
|
+
*
|
|
89
|
+
* @param decisionId - ID of the decision
|
|
90
|
+
* @param outcome - The outcome to record
|
|
91
|
+
*/
|
|
92
|
+
recordOutcome(decisionId: string, outcome: DecisionOutcome): void;
|
|
93
|
+
/**
|
|
94
|
+
* End a reasoning chain
|
|
95
|
+
*
|
|
96
|
+
* @param chainId - ID of the chain to end
|
|
97
|
+
* @param status - Final status of the chain
|
|
98
|
+
*/
|
|
99
|
+
endChain(chainId: string, status?: ReasoningChainStatus): void;
|
|
100
|
+
/**
|
|
101
|
+
* Get a decision by ID
|
|
102
|
+
*
|
|
103
|
+
* @param id - Decision ID
|
|
104
|
+
* @returns The decision or undefined
|
|
105
|
+
*/
|
|
106
|
+
getDecision(id: string): Decision | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Get a reasoning chain by ID
|
|
109
|
+
*
|
|
110
|
+
* @param id - Chain ID
|
|
111
|
+
* @returns The chain or undefined
|
|
112
|
+
*/
|
|
113
|
+
getChain(id: string): ReasoningChain | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Get the currently active reasoning chain
|
|
116
|
+
*
|
|
117
|
+
* @returns The current chain or undefined
|
|
118
|
+
*/
|
|
119
|
+
getCurrentChain(): ReasoningChain | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* Get recent decisions
|
|
122
|
+
*
|
|
123
|
+
* @param limit - Maximum number of decisions to return
|
|
124
|
+
* @returns Array of recent decisions, newest first
|
|
125
|
+
*/
|
|
126
|
+
getRecentDecisions(limit?: number): Decision[];
|
|
127
|
+
/**
|
|
128
|
+
* Get all decisions in a chain
|
|
129
|
+
*
|
|
130
|
+
* @param chainId - Chain ID
|
|
131
|
+
* @returns Array of decisions in the chain
|
|
132
|
+
*/
|
|
133
|
+
getChainDecisions(chainId: string): Decision[];
|
|
134
|
+
/**
|
|
135
|
+
* Generate a human-readable explanation of a decision
|
|
136
|
+
*
|
|
137
|
+
* @param decisionId - ID of the decision to explain
|
|
138
|
+
* @returns Formatted explanation string
|
|
139
|
+
*/
|
|
140
|
+
explainDecision(decisionId: string): string;
|
|
141
|
+
/**
|
|
142
|
+
* Generate a summary of a reasoning chain
|
|
143
|
+
*
|
|
144
|
+
* @param chainId - ID of the chain to summarize
|
|
145
|
+
* @returns Formatted summary string
|
|
146
|
+
*/
|
|
147
|
+
summarizeChain(chainId: string): string;
|
|
148
|
+
/**
|
|
149
|
+
* Export a chain as a structured object for persistence or analysis
|
|
150
|
+
*
|
|
151
|
+
* @param chainId - ID of the chain to export
|
|
152
|
+
* @returns Structured chain data with explanations
|
|
153
|
+
*/
|
|
154
|
+
exportChain(chainId: string): object;
|
|
155
|
+
/**
|
|
156
|
+
* Get statistics about reasoning performance
|
|
157
|
+
*
|
|
158
|
+
* @returns Reasoning statistics
|
|
159
|
+
*/
|
|
160
|
+
getStats(): ReasoningStats;
|
|
161
|
+
/**
|
|
162
|
+
* Find decisions by criteria
|
|
163
|
+
*
|
|
164
|
+
* @param criteria - Search criteria
|
|
165
|
+
* @returns Matching decisions
|
|
166
|
+
*/
|
|
167
|
+
findDecisions(criteria: {
|
|
168
|
+
type?: DecisionType;
|
|
169
|
+
confidence?: ConfidenceLevel;
|
|
170
|
+
success?: boolean;
|
|
171
|
+
afterDate?: Date;
|
|
172
|
+
beforeDate?: Date;
|
|
173
|
+
actionContains?: string;
|
|
174
|
+
}): Decision[];
|
|
175
|
+
/**
|
|
176
|
+
* Clear all tracked decisions and chains
|
|
177
|
+
*/
|
|
178
|
+
clear(): void;
|
|
179
|
+
/**
|
|
180
|
+
* Remove old decisions to stay within limits
|
|
181
|
+
*/
|
|
182
|
+
private pruneOldDecisions;
|
|
183
|
+
/**
|
|
184
|
+
* Remove old chains to stay within limits
|
|
185
|
+
*/
|
|
186
|
+
private pruneOldChains;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Create a new DecisionTracker instance
|
|
190
|
+
*
|
|
191
|
+
* @param options - Tracker options
|
|
192
|
+
* @returns New DecisionTracker instance
|
|
193
|
+
*/
|
|
194
|
+
export declare function createDecisionTracker(options?: {
|
|
195
|
+
maxDecisions?: number;
|
|
196
|
+
maxChains?: number;
|
|
197
|
+
}): DecisionTracker;
|
|
198
|
+
/**
|
|
199
|
+
* Get the default singleton DecisionTracker instance
|
|
200
|
+
*
|
|
201
|
+
* @returns The default DecisionTracker
|
|
202
|
+
*/
|
|
203
|
+
export declare function getDecisionTracker(): DecisionTracker;
|
|
204
|
+
/**
|
|
205
|
+
* Set the default singleton DecisionTracker instance
|
|
206
|
+
*
|
|
207
|
+
* @param tracker - The tracker to use as default
|
|
208
|
+
*/
|
|
209
|
+
export declare function setDefaultDecisionTracker(tracker: DecisionTracker): void;
|
|
210
|
+
//# sourceMappingURL=tracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracker.d.ts","sourceRoot":"","sources":["../../src/reasoning/tracker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,EACV,QAAQ,EAER,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACf,MAAM,YAAY,CAAC;AAIpB;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC9C,UAAU,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC5C,gBAAgB,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC/C,eAAe,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;CAC/C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,OAAO,CAAC,SAAS,CAAoC;IACrD,OAAO,CAAC,MAAM,CAA0C;IACxD,OAAO,CAAC,YAAY,CAAC,CAAiB;IACtC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,SAAS,CAAS;gBAEd,OAAO,GAAE;QAAE,YAA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,MAAM,CAAC;KACzB,GAAG,QAAQ,EAAE;IAiBd;;OAEG;IACH,KAAK,IAAI,IAAI;IAOb;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAazB;;OAEG;IACH,OAAO,CAAC,cAAc;CAYvB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,CAAC,EAAE;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,eAAe,CAElB;AAKD;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,CAKpD;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAExE"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reasoning System Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for the decision tracking and reasoning chain system.
|
|
5
|
+
* Enables transparent AI decision-making with full audit trails.
|
|
6
|
+
*
|
|
7
|
+
* @module reasoning/types
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Type of decision made by the system
|
|
11
|
+
* - automatic: System made decision without human input
|
|
12
|
+
* - suggested: System suggests but awaits confirmation
|
|
13
|
+
* - manual: Human-made decision
|
|
14
|
+
* - override: Human override of system decision
|
|
15
|
+
*/
|
|
16
|
+
export type DecisionType = 'automatic' | 'suggested' | 'manual' | 'override';
|
|
17
|
+
/**
|
|
18
|
+
* Confidence level in a decision
|
|
19
|
+
* - low: <50% confidence, should probably get human input
|
|
20
|
+
* - medium: 50-75% confidence, reasonable to proceed
|
|
21
|
+
* - high: 75-95% confidence, strong basis for decision
|
|
22
|
+
* - certain: >95% confidence, essentially deterministic
|
|
23
|
+
*/
|
|
24
|
+
export type ConfidenceLevel = 'low' | 'medium' | 'high' | 'certain';
|
|
25
|
+
/**
|
|
26
|
+
* Represents a single decision made by the reasoning system
|
|
27
|
+
*/
|
|
28
|
+
export interface Decision {
|
|
29
|
+
/** Unique identifier for this decision */
|
|
30
|
+
id: string;
|
|
31
|
+
/** How the decision was made */
|
|
32
|
+
type: DecisionType;
|
|
33
|
+
/** The action taken or to be taken */
|
|
34
|
+
action: string;
|
|
35
|
+
/** Step-by-step reasoning that led to this decision */
|
|
36
|
+
reasoning: string[];
|
|
37
|
+
/** Confidence level in this decision */
|
|
38
|
+
confidence: ConfidenceLevel;
|
|
39
|
+
/** Context in which the decision was made */
|
|
40
|
+
context: DecisionContext;
|
|
41
|
+
/** Outcome after execution (populated later) */
|
|
42
|
+
outcome?: DecisionOutcome;
|
|
43
|
+
/** When the decision was made */
|
|
44
|
+
timestamp: Date;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Context surrounding a decision
|
|
48
|
+
*/
|
|
49
|
+
export interface DecisionContext {
|
|
50
|
+
/** What triggered the need for a decision */
|
|
51
|
+
trigger: string;
|
|
52
|
+
/** Input data used to make the decision */
|
|
53
|
+
inputs: Record<string, unknown>;
|
|
54
|
+
/** Constraints that bounded the decision space */
|
|
55
|
+
constraints: string[];
|
|
56
|
+
/** Other options that were considered */
|
|
57
|
+
alternatives: Alternative[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* An alternative option that was considered
|
|
61
|
+
*/
|
|
62
|
+
export interface Alternative {
|
|
63
|
+
/** The alternative action */
|
|
64
|
+
action: string;
|
|
65
|
+
/** Advantages of this alternative */
|
|
66
|
+
pros: string[];
|
|
67
|
+
/** Disadvantages of this alternative */
|
|
68
|
+
cons: string[];
|
|
69
|
+
/** Confidence level if this alternative were chosen */
|
|
70
|
+
confidence: ConfidenceLevel;
|
|
71
|
+
/** Whether this alternative was rejected */
|
|
72
|
+
rejected: boolean;
|
|
73
|
+
/** Why this alternative was not chosen */
|
|
74
|
+
rejectionReason?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Outcome of executing a decision
|
|
78
|
+
*/
|
|
79
|
+
export interface DecisionOutcome {
|
|
80
|
+
/** Whether the action succeeded */
|
|
81
|
+
success: boolean;
|
|
82
|
+
/** Result data if successful */
|
|
83
|
+
result?: unknown;
|
|
84
|
+
/** Error message if failed */
|
|
85
|
+
error?: string;
|
|
86
|
+
/** How long execution took in milliseconds */
|
|
87
|
+
duration: number;
|
|
88
|
+
/** Unintended effects that occurred */
|
|
89
|
+
sideEffects: string[];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Status of a reasoning chain
|
|
93
|
+
*/
|
|
94
|
+
export type ReasoningChainStatus = 'in_progress' | 'completed' | 'failed' | 'aborted';
|
|
95
|
+
/**
|
|
96
|
+
* A chain of related decisions working toward a goal
|
|
97
|
+
*/
|
|
98
|
+
export interface ReasoningChain {
|
|
99
|
+
/** Unique identifier for this chain */
|
|
100
|
+
id: string;
|
|
101
|
+
/** Decisions made as part of this chain */
|
|
102
|
+
decisions: Decision[];
|
|
103
|
+
/** When the chain started */
|
|
104
|
+
startTime: Date;
|
|
105
|
+
/** When the chain ended (if finished) */
|
|
106
|
+
endTime?: Date;
|
|
107
|
+
/** The goal this chain is working toward */
|
|
108
|
+
goal: string;
|
|
109
|
+
/** Current status of the chain */
|
|
110
|
+
status: ReasoningChainStatus;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Parameters for creating a new decision
|
|
114
|
+
*/
|
|
115
|
+
export interface CreateDecisionParams {
|
|
116
|
+
/** The action to take */
|
|
117
|
+
action: string;
|
|
118
|
+
/** Reasoning steps */
|
|
119
|
+
reasoning: string[];
|
|
120
|
+
/** Confidence in the decision */
|
|
121
|
+
confidence: ConfidenceLevel;
|
|
122
|
+
/** Decision context */
|
|
123
|
+
context: DecisionContext;
|
|
124
|
+
/** Optional decision type (defaults to 'automatic') */
|
|
125
|
+
type?: DecisionType;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Statistics about reasoning performance
|
|
129
|
+
*/
|
|
130
|
+
export interface ReasoningStats {
|
|
131
|
+
/** Total decisions made */
|
|
132
|
+
totalDecisions: number;
|
|
133
|
+
/** Decisions by type */
|
|
134
|
+
byType: Record<DecisionType, number>;
|
|
135
|
+
/** Decisions by confidence level */
|
|
136
|
+
byConfidence: Record<ConfidenceLevel, number>;
|
|
137
|
+
/** Success rate of completed decisions */
|
|
138
|
+
successRate: number;
|
|
139
|
+
/** Average decision duration in ms */
|
|
140
|
+
averageDuration: number;
|
|
141
|
+
/** Total chains started */
|
|
142
|
+
totalChains: number;
|
|
143
|
+
/** Chains by status */
|
|
144
|
+
chainsByStatus: Record<ReasoningChainStatus, number>;
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/reasoning/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE7E;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,0CAA0C;IAC1C,EAAE,EAAE,MAAM,CAAC;IAEX,gCAAgC;IAChC,IAAI,EAAE,YAAY,CAAC;IAEnB,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IAEf,uDAAuD;IACvD,SAAS,EAAE,MAAM,EAAE,CAAC;IAEpB,wCAAwC;IACxC,UAAU,EAAE,eAAe,CAAC;IAE5B,6CAA6C;IAC7C,OAAO,EAAE,eAAe,CAAC;IAEzB,gDAAgD;IAChD,OAAO,CAAC,EAAE,eAAe,CAAC;IAE1B,iCAAiC;IACjC,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;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