mcp-ai-agent-guidelines 0.13.0 → 0.14.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/dist/domain/base-strategy/execution-trace.d.ts +142 -0
- package/dist/domain/base-strategy/execution-trace.d.ts.map +1 -0
- package/dist/domain/base-strategy/execution-trace.js +377 -0
- package/dist/domain/base-strategy/execution-trace.js.map +1 -0
- package/dist/domain/base-strategy/index.d.ts +10 -0
- package/dist/domain/base-strategy/index.d.ts.map +1 -0
- package/dist/domain/base-strategy/index.js +11 -0
- package/dist/domain/base-strategy/index.js.map +1 -0
- package/dist/domain/base-strategy/trace-utils.d.ts +59 -0
- package/dist/domain/base-strategy/trace-utils.d.ts.map +1 -0
- package/dist/domain/base-strategy/trace-utils.js +86 -0
- package/dist/domain/base-strategy/trace-utils.js.map +1 -0
- package/dist/domain/base-strategy/types.d.ts +65 -0
- package/dist/domain/base-strategy/types.d.ts.map +1 -0
- package/dist/domain/base-strategy/types.js +8 -0
- package/dist/domain/base-strategy/types.js.map +1 -0
- package/dist/domain/coordination/agent-handoff-coordinator.d.ts +57 -0
- package/dist/domain/coordination/agent-handoff-coordinator.d.ts.map +1 -0
- package/dist/domain/coordination/agent-handoff-coordinator.js +232 -0
- package/dist/domain/coordination/agent-handoff-coordinator.js.map +1 -0
- package/dist/domain/coordination/execution-trace.d.ts +42 -0
- package/dist/domain/coordination/execution-trace.d.ts.map +1 -0
- package/dist/domain/coordination/execution-trace.js +42 -0
- package/dist/domain/coordination/execution-trace.js.map +1 -0
- package/dist/domain/coordination/handoff-types.d.ts +132 -0
- package/dist/domain/coordination/handoff-types.d.ts.map +1 -0
- package/dist/domain/coordination/handoff-types.js +2 -0
- package/dist/domain/coordination/handoff-types.js.map +1 -0
- package/dist/domain/coordination/index.d.ts +7 -0
- package/dist/domain/coordination/index.d.ts.map +1 -0
- package/dist/domain/coordination/index.js +4 -0
- package/dist/domain/coordination/index.js.map +1 -0
- package/dist/domain/coordination/summary-feedback-coordinator.d.ts +3 -0
- package/dist/domain/coordination/summary-feedback-coordinator.d.ts.map +1 -0
- package/dist/domain/coordination/summary-feedback-coordinator.js +2 -0
- package/dist/domain/coordination/summary-feedback-coordinator.js.map +1 -0
- package/dist/domain/coordinators/index.d.ts +3 -0
- package/dist/domain/coordinators/index.d.ts.map +1 -0
- package/dist/domain/coordinators/index.js +2 -0
- package/dist/domain/coordinators/index.js.map +1 -0
- package/dist/domain/coordinators/summary-feedback-coordinator.d.ts +111 -0
- package/dist/domain/coordinators/summary-feedback-coordinator.d.ts.map +1 -0
- package/dist/domain/coordinators/summary-feedback-coordinator.js +372 -0
- package/dist/domain/coordinators/summary-feedback-coordinator.js.map +1 -0
- package/dist/domain/coordinators/types.d.ts +90 -0
- package/dist/domain/coordinators/types.d.ts.map +1 -0
- package/dist/domain/coordinators/types.js +2 -0
- package/dist/domain/coordinators/types.js.map +1 -0
- package/dist/domain/index.d.ts +2 -0
- package/dist/domain/index.d.ts.map +1 -1
- package/dist/domain/index.js +2 -0
- package/dist/domain/index.js.map +1 -1
- package/dist/domain/prompts/generators/architecture.d.ts +43 -0
- package/dist/domain/prompts/generators/architecture.d.ts.map +1 -0
- package/dist/domain/prompts/generators/architecture.js +71 -0
- package/dist/domain/prompts/generators/architecture.js.map +1 -0
- package/dist/domain/prompts/generators/code-analysis.d.ts +43 -0
- package/dist/domain/prompts/generators/code-analysis.d.ts.map +1 -0
- package/dist/domain/prompts/generators/code-analysis.js +73 -0
- package/dist/domain/prompts/generators/code-analysis.js.map +1 -0
- package/dist/domain/prompts/generators/domain-neutral.d.ts +55 -0
- package/dist/domain/prompts/generators/domain-neutral.d.ts.map +1 -0
- package/dist/domain/prompts/generators/domain-neutral.js +98 -0
- package/dist/domain/prompts/generators/domain-neutral.js.map +1 -0
- package/dist/domain/prompts/generators/hierarchical.d.ts +46 -0
- package/dist/domain/prompts/generators/hierarchical.d.ts.map +1 -0
- package/dist/domain/prompts/generators/hierarchical.js +83 -0
- package/dist/domain/prompts/generators/hierarchical.js.map +1 -0
- package/dist/domain/prompts/generators/index.d.ts +11 -0
- package/dist/domain/prompts/generators/index.d.ts.map +1 -0
- package/dist/domain/prompts/generators/index.js +6 -0
- package/dist/domain/prompts/generators/index.js.map +1 -0
- package/dist/domain/prompts/generators/security.d.ts +52 -0
- package/dist/domain/prompts/generators/security.d.ts.map +1 -0
- package/dist/domain/prompts/generators/security.js +83 -0
- package/dist/domain/prompts/generators/security.js.map +1 -0
- package/dist/domain/prompts/index.d.ts +11 -0
- package/dist/domain/prompts/index.d.ts.map +1 -0
- package/dist/domain/prompts/index.js +12 -0
- package/dist/domain/prompts/index.js.map +1 -0
- package/dist/domain/prompts/registry.d.ts +17 -0
- package/dist/domain/prompts/registry.d.ts.map +1 -0
- package/dist/domain/prompts/registry.js +46 -0
- package/dist/domain/prompts/registry.js.map +1 -0
- package/dist/domain/prompts/renderers/index.d.ts +3 -0
- package/dist/domain/prompts/renderers/index.d.ts.map +1 -0
- package/dist/domain/prompts/renderers/index.js +3 -0
- package/dist/domain/prompts/renderers/index.js.map +1 -0
- package/dist/domain/prompts/renderers/markdown-renderer.d.ts +10 -0
- package/dist/domain/prompts/renderers/markdown-renderer.d.ts.map +1 -0
- package/dist/domain/prompts/renderers/markdown-renderer.js +29 -0
- package/dist/domain/prompts/renderers/markdown-renderer.js.map +1 -0
- package/dist/domain/prompts/renderers/xml-renderer.d.ts +10 -0
- package/dist/domain/prompts/renderers/xml-renderer.d.ts.map +1 -0
- package/dist/domain/prompts/renderers/xml-renderer.js +49 -0
- package/dist/domain/prompts/renderers/xml-renderer.js.map +1 -0
- package/dist/domain/prompts/template-engine.d.ts +11 -0
- package/dist/domain/prompts/template-engine.d.ts.map +1 -0
- package/dist/domain/prompts/template-engine.js +55 -0
- package/dist/domain/prompts/template-engine.js.map +1 -0
- package/dist/domain/prompts/template-types.d.ts +41 -0
- package/dist/domain/prompts/template-types.d.ts.map +1 -0
- package/dist/domain/prompts/template-types.js +2 -0
- package/dist/domain/prompts/template-types.js.map +1 -0
- package/dist/domain/prompts/types.d.ts +53 -0
- package/dist/domain/prompts/types.d.ts.map +1 -0
- package/dist/domain/prompts/types.js +2 -0
- package/dist/domain/prompts/types.js.map +1 -0
- package/dist/domain/prompts/unified-prompt-builder.d.ts +43 -0
- package/dist/domain/prompts/unified-prompt-builder.d.ts.map +1 -0
- package/dist/domain/prompts/unified-prompt-builder.js +80 -0
- package/dist/domain/prompts/unified-prompt-builder.js.map +1 -0
- package/dist/domain/router/framework-router.d.ts +53 -0
- package/dist/domain/router/framework-router.d.ts.map +1 -0
- package/dist/domain/router/framework-router.js +142 -0
- package/dist/domain/router/framework-router.js.map +1 -0
- package/dist/domain/router/index.d.ts +11 -0
- package/dist/domain/router/index.d.ts.map +1 -0
- package/dist/domain/router/index.js +12 -0
- package/dist/domain/router/index.js.map +1 -0
- package/dist/domain/router/plugin-manager.d.ts +81 -0
- package/dist/domain/router/plugin-manager.d.ts.map +1 -0
- package/dist/domain/router/plugin-manager.js +100 -0
- package/dist/domain/router/plugin-manager.js.map +1 -0
- package/dist/domain/router/strategy-registry.d.ts +73 -0
- package/dist/domain/router/strategy-registry.d.ts.map +1 -0
- package/dist/domain/router/strategy-registry.js +92 -0
- package/dist/domain/router/strategy-registry.js.map +1 -0
- package/dist/domain/router/types.d.ts +111 -0
- package/dist/domain/router/types.d.ts.map +1 -0
- package/dist/domain/router/types.js +7 -0
- package/dist/domain/router/types.js.map +1 -0
- package/dist/domain/speckit/generators/adr-generator.d.ts +3 -0
- package/dist/domain/speckit/generators/adr-generator.d.ts.map +1 -0
- package/dist/domain/speckit/generators/adr-generator.js +25 -0
- package/dist/domain/speckit/generators/adr-generator.js.map +1 -0
- package/dist/domain/speckit/generators/index.d.ts +8 -0
- package/dist/domain/speckit/generators/index.d.ts.map +1 -0
- package/dist/domain/speckit/generators/index.js +8 -0
- package/dist/domain/speckit/generators/index.js.map +1 -0
- package/dist/domain/speckit/generators/plan-generator.d.ts +3 -0
- package/dist/domain/speckit/generators/plan-generator.d.ts.map +1 -0
- package/dist/domain/speckit/generators/plan-generator.js +88 -0
- package/dist/domain/speckit/generators/plan-generator.js.map +1 -0
- package/dist/domain/speckit/generators/progress-generator.d.ts +3 -0
- package/dist/domain/speckit/generators/progress-generator.d.ts.map +1 -0
- package/dist/domain/speckit/generators/progress-generator.js +24 -0
- package/dist/domain/speckit/generators/progress-generator.js.map +1 -0
- package/dist/domain/speckit/generators/readme-generator.d.ts +3 -0
- package/dist/domain/speckit/generators/readme-generator.d.ts.map +1 -0
- package/dist/domain/speckit/generators/readme-generator.js +23 -0
- package/dist/domain/speckit/generators/readme-generator.js.map +1 -0
- package/dist/domain/speckit/generators/roadmap-generator.d.ts +3 -0
- package/dist/domain/speckit/generators/roadmap-generator.d.ts.map +1 -0
- package/dist/domain/speckit/generators/roadmap-generator.js +18 -0
- package/dist/domain/speckit/generators/roadmap-generator.js.map +1 -0
- package/dist/domain/speckit/generators/spec-generator.d.ts +3 -0
- package/dist/domain/speckit/generators/spec-generator.d.ts.map +1 -0
- package/dist/domain/speckit/generators/spec-generator.js +76 -0
- package/dist/domain/speckit/generators/spec-generator.js.map +1 -0
- package/dist/domain/speckit/generators/tasks-generator.d.ts +3 -0
- package/dist/domain/speckit/generators/tasks-generator.d.ts.map +1 -0
- package/dist/domain/speckit/generators/tasks-generator.js +15 -0
- package/dist/domain/speckit/generators/tasks-generator.js.map +1 -0
- package/dist/domain/speckit/index.d.ts +5 -0
- package/dist/domain/speckit/index.d.ts.map +1 -0
- package/dist/domain/speckit/index.js +4 -0
- package/dist/domain/speckit/index.js.map +1 -0
- package/dist/domain/speckit/types.d.ts +161 -0
- package/dist/domain/speckit/types.d.ts.map +1 -0
- package/dist/domain/speckit/types.js +74 -0
- package/dist/domain/speckit/types.js.map +1 -0
- package/dist/domain/speckit/validators/constitution-validator.d.ts +3 -0
- package/dist/domain/speckit/validators/constitution-validator.d.ts.map +1 -0
- package/dist/domain/speckit/validators/constitution-validator.js +28 -0
- package/dist/domain/speckit/validators/constitution-validator.js.map +1 -0
- package/dist/domain/speckit/validators/index.d.ts +2 -0
- package/dist/domain/speckit/validators/index.d.ts.map +1 -0
- package/dist/domain/speckit/validators/index.js +2 -0
- package/dist/domain/speckit/validators/index.js.map +1 -0
- package/dist/frameworks/agent-orchestration/index.d.ts +7 -0
- package/dist/frameworks/agent-orchestration/index.d.ts.map +1 -0
- package/dist/frameworks/agent-orchestration/index.js +81 -0
- package/dist/frameworks/agent-orchestration/index.js.map +1 -0
- package/dist/frameworks/code-quality/index.d.ts +13 -0
- package/dist/frameworks/code-quality/index.d.ts.map +1 -0
- package/dist/frameworks/code-quality/index.js +24 -0
- package/dist/frameworks/code-quality/index.js.map +1 -0
- package/dist/frameworks/code-quality/router.d.ts +7 -0
- package/dist/frameworks/code-quality/router.d.ts.map +1 -0
- package/dist/frameworks/code-quality/router.js +50 -0
- package/dist/frameworks/code-quality/router.js.map +1 -0
- package/dist/frameworks/code-quality/types.d.ts +61 -0
- package/dist/frameworks/code-quality/types.d.ts.map +1 -0
- package/dist/frameworks/code-quality/types.js +29 -0
- package/dist/frameworks/code-quality/types.js.map +1 -0
- package/dist/frameworks/design-architecture/index.d.ts +13 -0
- package/dist/frameworks/design-architecture/index.d.ts.map +1 -0
- package/dist/frameworks/design-architecture/index.js +29 -0
- package/dist/frameworks/design-architecture/index.js.map +1 -0
- package/dist/frameworks/design-architecture/router.d.ts +6 -0
- package/dist/frameworks/design-architecture/router.d.ts.map +1 -0
- package/dist/frameworks/design-architecture/router.js +51 -0
- package/dist/frameworks/design-architecture/router.js.map +1 -0
- package/dist/frameworks/design-architecture/types.d.ts +42 -0
- package/dist/frameworks/design-architecture/types.d.ts.map +1 -0
- package/dist/frameworks/design-architecture/types.js +35 -0
- package/dist/frameworks/design-architecture/types.js.map +1 -0
- package/dist/frameworks/documentation/index.d.ts +11 -0
- package/dist/frameworks/documentation/index.d.ts.map +1 -0
- package/dist/frameworks/documentation/index.js +22 -0
- package/dist/frameworks/documentation/index.js.map +1 -0
- package/dist/frameworks/documentation/router.d.ts +6 -0
- package/dist/frameworks/documentation/router.d.ts.map +1 -0
- package/dist/frameworks/documentation/router.js +36 -0
- package/dist/frameworks/documentation/router.js.map +1 -0
- package/dist/frameworks/documentation/types.d.ts +39 -0
- package/dist/frameworks/documentation/types.d.ts.map +1 -0
- package/dist/frameworks/documentation/types.js +30 -0
- package/dist/frameworks/documentation/types.js.map +1 -0
- package/dist/frameworks/index.d.ts +20 -0
- package/dist/frameworks/index.d.ts.map +1 -0
- package/dist/frameworks/index.js +43 -0
- package/dist/frameworks/index.js.map +1 -0
- package/dist/frameworks/project-management/index.d.ts +7 -0
- package/dist/frameworks/project-management/index.d.ts.map +1 -0
- package/dist/frameworks/project-management/index.js +80 -0
- package/dist/frameworks/project-management/index.js.map +1 -0
- package/dist/frameworks/prompt-engineering/index.d.ts +14 -0
- package/dist/frameworks/prompt-engineering/index.d.ts.map +1 -0
- package/dist/frameworks/prompt-engineering/index.js +25 -0
- package/dist/frameworks/prompt-engineering/index.js.map +1 -0
- package/dist/frameworks/prompt-engineering/router.d.ts +7 -0
- package/dist/frameworks/prompt-engineering/router.d.ts.map +1 -0
- package/dist/frameworks/prompt-engineering/router.js +47 -0
- package/dist/frameworks/prompt-engineering/router.js.map +1 -0
- package/dist/frameworks/prompt-engineering/types.d.ts +39 -0
- package/dist/frameworks/prompt-engineering/types.d.ts.map +1 -0
- package/dist/frameworks/prompt-engineering/types.js +44 -0
- package/dist/frameworks/prompt-engineering/types.js.map +1 -0
- package/dist/frameworks/prompt-optimization/index.d.ts +7 -0
- package/dist/frameworks/prompt-optimization/index.d.ts.map +1 -0
- package/dist/frameworks/prompt-optimization/index.js +66 -0
- package/dist/frameworks/prompt-optimization/index.js.map +1 -0
- package/dist/frameworks/registry.d.ts +27 -0
- package/dist/frameworks/registry.d.ts.map +1 -0
- package/dist/frameworks/registry.js +38 -0
- package/dist/frameworks/registry.js.map +1 -0
- package/dist/frameworks/security/index.d.ts +10 -0
- package/dist/frameworks/security/index.d.ts.map +1 -0
- package/dist/frameworks/security/index.js +21 -0
- package/dist/frameworks/security/index.js.map +1 -0
- package/dist/frameworks/security/router.d.ts +6 -0
- package/dist/frameworks/security/router.d.ts.map +1 -0
- package/dist/frameworks/security/router.js +25 -0
- package/dist/frameworks/security/router.js.map +1 -0
- package/dist/frameworks/security/types.d.ts +39 -0
- package/dist/frameworks/security/types.d.ts.map +1 -0
- package/dist/frameworks/security/types.js +43 -0
- package/dist/frameworks/security/types.js.map +1 -0
- package/dist/frameworks/strategic-planning/index.d.ts +7 -0
- package/dist/frameworks/strategic-planning/index.d.ts.map +1 -0
- package/dist/frameworks/strategic-planning/index.js +73 -0
- package/dist/frameworks/strategic-planning/index.js.map +1 -0
- package/dist/frameworks/testing/index.d.ts +10 -0
- package/dist/frameworks/testing/index.d.ts.map +1 -0
- package/dist/frameworks/testing/index.js +21 -0
- package/dist/frameworks/testing/index.js.map +1 -0
- package/dist/frameworks/testing/router.d.ts +6 -0
- package/dist/frameworks/testing/router.d.ts.map +1 -0
- package/dist/frameworks/testing/router.js +38 -0
- package/dist/frameworks/testing/router.js.map +1 -0
- package/dist/frameworks/testing/types.d.ts +86 -0
- package/dist/frameworks/testing/types.d.ts.map +1 -0
- package/dist/frameworks/testing/types.js +37 -0
- package/dist/frameworks/testing/types.js.map +1 -0
- package/dist/frameworks/types.d.ts +24 -0
- package/dist/frameworks/types.d.ts.map +1 -0
- package/dist/frameworks/types.js +6 -0
- package/dist/frameworks/types.js.map +1 -0
- package/dist/frameworks/visualization/index.d.ts +7 -0
- package/dist/frameworks/visualization/index.d.ts.map +1 -0
- package/dist/frameworks/visualization/index.js +80 -0
- package/dist/frameworks/visualization/index.js.map +1 -0
- package/dist/gateway/polyglot-gateway.d.ts +2 -2
- package/dist/gateway/polyglot-gateway.d.ts.map +1 -1
- package/dist/gateway/polyglot-gateway.js +9 -4
- package/dist/gateway/polyglot-gateway.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +139 -0
- package/dist/index.js.map +1 -1
- package/dist/platform/index.d.ts +35 -0
- package/dist/platform/index.d.ts.map +1 -0
- package/dist/platform/index.js +46 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/platform/mock-pal.d.ts +70 -0
- package/dist/platform/mock-pal.d.ts.map +1 -0
- package/dist/platform/mock-pal.js +244 -0
- package/dist/platform/mock-pal.js.map +1 -0
- package/dist/platform/node-pal.d.ts +52 -0
- package/dist/platform/node-pal.d.ts.map +1 -0
- package/dist/platform/node-pal.js +154 -0
- package/dist/platform/node-pal.js.map +1 -0
- package/dist/platform/pal.interface.d.ts +103 -0
- package/dist/platform/pal.interface.d.ts.map +1 -0
- package/dist/platform/pal.interface.js +12 -0
- package/dist/platform/pal.interface.js.map +1 -0
- package/dist/schemas/prompt-hierarchy.d.ts +2 -2
- package/dist/schemas/prompt-hierarchy.d.ts.map +1 -1
- package/dist/schemas/prompt-hierarchy.js +35 -9
- package/dist/schemas/prompt-hierarchy.js.map +1 -1
- package/dist/schemas/update-progress.d.ts +4 -4
- package/dist/schemas/validate-spec.d.ts +1 -1
- package/dist/strategies/adr-strategy.d.ts +17 -8
- package/dist/strategies/adr-strategy.d.ts.map +1 -1
- package/dist/strategies/adr-strategy.js +42 -17
- package/dist/strategies/adr-strategy.js.map +1 -1
- package/dist/strategies/chat-strategy.d.ts +17 -8
- package/dist/strategies/chat-strategy.d.ts.map +1 -1
- package/dist/strategies/chat-strategy.js +39 -17
- package/dist/strategies/chat-strategy.js.map +1 -1
- package/dist/strategies/enterprise-strategy.d.ts +17 -8
- package/dist/strategies/enterprise-strategy.d.ts.map +1 -1
- package/dist/strategies/enterprise-strategy.js +41 -21
- package/dist/strategies/enterprise-strategy.js.map +1 -1
- package/dist/strategies/output-strategy.d.ts +25 -0
- package/dist/strategies/output-strategy.d.ts.map +1 -1
- package/dist/strategies/output-strategy.js.map +1 -1
- package/dist/strategies/rfc-strategy.d.ts +17 -9
- package/dist/strategies/rfc-strategy.d.ts.map +1 -1
- package/dist/strategies/rfc-strategy.js +40 -22
- package/dist/strategies/rfc-strategy.js.map +1 -1
- package/dist/strategies/sdd-strategy.d.ts +17 -8
- package/dist/strategies/sdd-strategy.d.ts.map +1 -1
- package/dist/strategies/sdd-strategy.js +32 -13
- package/dist/strategies/sdd-strategy.js.map +1 -1
- package/dist/strategies/shared/base-strategy.d.ts +144 -0
- package/dist/strategies/shared/base-strategy.d.ts.map +1 -0
- package/dist/strategies/shared/base-strategy.js +241 -0
- package/dist/strategies/shared/base-strategy.js.map +1 -0
- package/dist/strategies/shared/execution-trace.d.ts +74 -0
- package/dist/strategies/shared/execution-trace.d.ts.map +1 -0
- package/dist/strategies/shared/execution-trace.js +176 -0
- package/dist/strategies/shared/execution-trace.js.map +1 -0
- package/dist/strategies/shared/index.d.ts +9 -0
- package/dist/strategies/shared/index.d.ts.map +1 -0
- package/dist/strategies/shared/index.js +7 -0
- package/dist/strategies/shared/index.js.map +1 -0
- package/dist/strategies/shared/types.d.ts +96 -0
- package/dist/strategies/shared/types.d.ts.map +1 -0
- package/dist/strategies/shared/types.js +6 -0
- package/dist/strategies/shared/types.js.map +1 -0
- package/dist/strategies/speckit/index.d.ts +1 -0
- package/dist/strategies/speckit/index.d.ts.map +1 -1
- package/dist/strategies/speckit/index.js +2 -0
- package/dist/strategies/speckit/index.js.map +1 -1
- package/dist/strategies/speckit/speckit-strategy.d.ts +40 -0
- package/dist/strategies/speckit/speckit-strategy.d.ts.map +1 -0
- package/dist/strategies/speckit/speckit-strategy.js +217 -0
- package/dist/strategies/speckit/speckit-strategy.js.map +1 -0
- package/dist/strategies/togaf-strategy.d.ts +17 -8
- package/dist/strategies/togaf-strategy.d.ts.map +1 -1
- package/dist/strategies/togaf-strategy.js +42 -22
- package/dist/strategies/togaf-strategy.js.map +1 -1
- package/dist/tools/agent-orchestrator.d.ts.map +1 -1
- package/dist/tools/agent-orchestrator.js +6 -4
- package/dist/tools/agent-orchestrator.js.map +1 -1
- package/dist/tools/analysis/gap-frameworks-analyzers.d.ts.map +1 -1
- package/dist/tools/analysis/gap-frameworks-analyzers.js +40 -11
- package/dist/tools/analysis/gap-frameworks-analyzers.js.map +1 -1
- package/dist/tools/analysis/strategy-frameworks-builder.d.ts.map +1 -1
- package/dist/tools/analysis/strategy-frameworks-builder.js +42 -16
- package/dist/tools/analysis/strategy-frameworks-builder.js.map +1 -1
- package/dist/tools/config/generated/index.js +1 -1
- package/dist/tools/config/generated/mode-enum.js +1 -1
- package/dist/tools/config/generated/model-aliases.js +1 -1
- package/dist/tools/config/generated/model-identifiers.js +1 -1
- package/dist/tools/config/generated/provider-enum.js +1 -1
- package/dist/tools/design/design-assistant.js +1 -1
- package/dist/tools/design/design-assistant.js.map +1 -1
- package/dist/tools/design/services/artifact-generation.service.js +1 -1
- package/dist/tools/design/services/artifact-generation.service.js.map +1 -1
- package/dist/tools/enforcement/enforce-planning.d.ts +40 -0
- package/dist/tools/enforcement/enforce-planning.d.ts.map +1 -0
- package/dist/tools/enforcement/enforce-planning.js +105 -0
- package/dist/tools/enforcement/enforce-planning.js.map +1 -0
- package/dist/tools/enforcement/index.d.ts +14 -0
- package/dist/tools/enforcement/index.d.ts.map +1 -0
- package/dist/tools/enforcement/index.js +9 -0
- package/dist/tools/enforcement/index.js.map +1 -0
- package/dist/tools/enforcement/types.d.ts +52 -0
- package/dist/tools/enforcement/types.d.ts.map +1 -0
- package/dist/tools/enforcement/types.js +6 -0
- package/dist/tools/enforcement/types.js.map +1 -0
- package/dist/tools/enforcement/validate-annotations.d.ts +33 -0
- package/dist/tools/enforcement/validate-annotations.d.ts.map +1 -0
- package/dist/tools/enforcement/validate-annotations.js +89 -0
- package/dist/tools/enforcement/validate-annotations.js.map +1 -0
- package/dist/tools/enforcement/validate-progress.d.ts +80 -0
- package/dist/tools/enforcement/validate-progress.d.ts.map +1 -0
- package/dist/tools/enforcement/validate-progress.js +312 -0
- package/dist/tools/enforcement/validate-progress.js.map +1 -0
- package/dist/tools/enforcement/validate-schema-examples.d.ts +37 -0
- package/dist/tools/enforcement/validate-schema-examples.d.ts.map +1 -0
- package/dist/tools/enforcement/validate-schema-examples.js +99 -0
- package/dist/tools/enforcement/validate-schema-examples.js.map +1 -0
- package/dist/tools/guidelines-validator.d.ts.map +1 -1
- package/dist/tools/guidelines-validator.js +18 -6
- package/dist/tools/guidelines-validator.js.map +1 -1
- package/dist/tools/memory-context-optimizer.d.ts.map +1 -1
- package/dist/tools/memory-context-optimizer.js +26 -7
- package/dist/tools/memory-context-optimizer.js.map +1 -1
- package/dist/tools/mermaid/types.d.ts +2 -2
- package/dist/tools/mermaid/types.d.ts.map +1 -1
- package/dist/tools/mermaid/types.js +41 -11
- package/dist/tools/mermaid/types.js.map +1 -1
- package/dist/tools/mermaid-diagram-generator.d.ts.map +1 -1
- package/dist/tools/mermaid-diagram-generator.js +67 -38
- package/dist/tools/mermaid-diagram-generator.js.map +1 -1
- package/dist/tools/model-compatibility-checker.d.ts.map +1 -1
- package/dist/tools/model-compatibility-checker.js +36 -9
- package/dist/tools/model-compatibility-checker.js.map +1 -1
- package/dist/tools/prompt/architecture-design-prompt-builder.d.ts.map +1 -1
- package/dist/tools/prompt/architecture-design-prompt-builder.js +32 -7
- package/dist/tools/prompt/architecture-design-prompt-builder.js.map +1 -1
- package/dist/tools/prompt/code-analysis-prompt-builder.d.ts.map +1 -1
- package/dist/tools/prompt/code-analysis-prompt-builder.js +36 -8
- package/dist/tools/prompt/code-analysis-prompt-builder.js.map +1 -1
- package/dist/tools/prompt/coverage-dashboard-design-prompt-builder.d.ts +6 -6
- package/dist/tools/prompt/coverage-dashboard-design-prompt-builder.d.ts.map +1 -1
- package/dist/tools/prompt/coverage-dashboard-design-prompt-builder.js +296 -63
- package/dist/tools/prompt/coverage-dashboard-design-prompt-builder.js.map +1 -1
- package/dist/tools/prompt/debugging-assistant-prompt-builder.d.ts.map +1 -1
- package/dist/tools/prompt/debugging-assistant-prompt-builder.js +32 -7
- package/dist/tools/prompt/debugging-assistant-prompt-builder.js.map +1 -1
- package/dist/tools/prompt/digital-enterprise-architect-prompt-builder.d.ts.map +1 -1
- package/dist/tools/prompt/digital-enterprise-architect-prompt-builder.js +32 -7
- package/dist/tools/prompt/digital-enterprise-architect-prompt-builder.js.map +1 -1
- package/dist/tools/prompt/documentation-generator-prompt-builder.d.ts.map +1 -1
- package/dist/tools/prompt/documentation-generator-prompt-builder.js +32 -7
- package/dist/tools/prompt/documentation-generator-prompt-builder.js.map +1 -1
- package/dist/tools/prompt/domain-neutral-prompt-builder.d.ts +14 -14
- package/dist/tools/prompt/domain-neutral-prompt-builder.d.ts.map +1 -1
- package/dist/tools/prompt/domain-neutral-prompt-builder.js +198 -63
- package/dist/tools/prompt/domain-neutral-prompt-builder.js.map +1 -1
- package/dist/tools/prompt/facades/domain-neutral-facade.d.ts +77 -0
- package/dist/tools/prompt/facades/domain-neutral-facade.d.ts.map +1 -0
- package/dist/tools/prompt/facades/domain-neutral-facade.js +58 -0
- package/dist/tools/prompt/facades/domain-neutral-facade.js.map +1 -0
- package/dist/tools/prompt/facades/hierarchical-facade.d.ts +68 -0
- package/dist/tools/prompt/facades/hierarchical-facade.d.ts.map +1 -0
- package/dist/tools/prompt/facades/hierarchical-facade.js +84 -0
- package/dist/tools/prompt/facades/hierarchical-facade.js.map +1 -0
- package/dist/tools/prompt/facades/index.d.ts +5 -0
- package/dist/tools/prompt/facades/index.d.ts.map +1 -0
- package/dist/tools/prompt/facades/index.js +3 -0
- package/dist/tools/prompt/facades/index.js.map +1 -0
- package/dist/tools/prompt/hierarchical-prompt-builder.d.ts.map +1 -1
- package/dist/tools/prompt/hierarchical-prompt-builder.js +109 -28
- package/dist/tools/prompt/hierarchical-prompt-builder.js.map +1 -1
- package/dist/tools/prompt/hierarchy-level-selector.d.ts.map +1 -1
- package/dist/tools/prompt/hierarchy-level-selector.js +13 -2
- package/dist/tools/prompt/hierarchy-level-selector.js.map +1 -1
- package/dist/tools/prompt/l9-distinguished-engineer-prompt-builder.d.ts.map +1 -1
- package/dist/tools/prompt/l9-distinguished-engineer-prompt-builder.js +32 -7
- package/dist/tools/prompt/l9-distinguished-engineer-prompt-builder.js.map +1 -1
- package/dist/tools/prompt/prompt-chaining-builder.d.ts.map +1 -1
- package/dist/tools/prompt/prompt-chaining-builder.js +54 -14
- package/dist/tools/prompt/prompt-chaining-builder.js.map +1 -1
- package/dist/tools/prompt/prompt-flow-builder.d.ts.map +1 -1
- package/dist/tools/prompt/prompt-flow-builder.js +62 -25
- package/dist/tools/prompt/prompt-flow-builder.js.map +1 -1
- package/dist/tools/prompt/prompt-hierarchy.d.ts +3 -3
- package/dist/tools/prompt/quick-developer-prompts-builder.d.ts.map +1 -1
- package/dist/tools/prompt/quick-developer-prompts-builder.js +28 -7
- package/dist/tools/prompt/quick-developer-prompts-builder.js.map +1 -1
- package/dist/tools/prompt/security-hardening-prompt-builder.d.ts.map +1 -1
- package/dist/tools/prompt/security-hardening-prompt-builder.js +109 -24
- package/dist/tools/prompt/security-hardening-prompt-builder.js.map +1 -1
- package/dist/tools/prompt/spark-prompt-builder.d.ts.map +1 -1
- package/dist/tools/prompt/spark-prompt-builder.js +151 -69
- package/dist/tools/prompt/spark-prompt-builder.js.map +1 -1
- package/dist/tools/shared/deprecation-helpers.d.ts +79 -0
- package/dist/tools/shared/deprecation-helpers.d.ts.map +1 -0
- package/dist/tools/shared/deprecation-helpers.js +115 -0
- package/dist/tools/shared/deprecation-helpers.js.map +1 -0
- package/dist/tools/shared/index.d.ts +1 -0
- package/dist/tools/shared/index.d.ts.map +1 -1
- package/dist/tools/shared/index.js +1 -0
- package/dist/tools/shared/index.js.map +1 -1
- package/dist/tools/shared/types/export-format.types.d.ts.map +1 -1
- package/dist/tools/shared/types/export-format.types.js +25 -6
- package/dist/tools/shared/types/export-format.types.js.map +1 -1
- package/dist/tools/speckit-generator.d.ts.map +1 -1
- package/dist/tools/speckit-generator.js +11 -21
- package/dist/tools/speckit-generator.js.map +1 -1
- package/dist/tools/sprint-timeline-calculator.d.ts.map +1 -1
- package/dist/tools/sprint-timeline-calculator.js +24 -11
- package/dist/tools/sprint-timeline-calculator.js.map +1 -1
- package/package.json +10 -5
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution Trace - records decisions, metrics, and errors during strategy execution.
|
|
3
|
+
*
|
|
4
|
+
* The trace is mutable during execution but provides immutable snapshots for export.
|
|
5
|
+
* This domain-level trace is distinct from the legacy strategies/shared ExecutionTrace.
|
|
6
|
+
*/
|
|
7
|
+
import type { Decision, ExecutionTraceData, TracedError } from "./types.js";
|
|
8
|
+
type IdGenerator = () => string;
|
|
9
|
+
type Clock = () => Date;
|
|
10
|
+
interface ExecutionTraceOptions {
|
|
11
|
+
readonly executionId?: string;
|
|
12
|
+
readonly startedAt?: Date;
|
|
13
|
+
readonly now?: Clock;
|
|
14
|
+
readonly idGenerator?: IdGenerator;
|
|
15
|
+
readonly onFallbackId?: (fallbackId: string) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Execution Trace - records decisions, metrics, and errors during strategy execution.
|
|
19
|
+
*
|
|
20
|
+
* The trace is mutable during execution but provides immutable snapshots for export.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const trace = new ExecutionTrace('my-strategy', '1.0.0');
|
|
25
|
+
*
|
|
26
|
+
* trace.recordDecision(
|
|
27
|
+
* 'select-template',
|
|
28
|
+
* 'Selected enterprise template based on input size',
|
|
29
|
+
* { inputSize: 1500, threshold: 1000 }
|
|
30
|
+
* );
|
|
31
|
+
*
|
|
32
|
+
* trace.recordMetric('generation_time_ms', 250);
|
|
33
|
+
*
|
|
34
|
+
* try {
|
|
35
|
+
* // operation
|
|
36
|
+
* } catch (error) {
|
|
37
|
+
* trace.recordError(error, { operation: 'template-render' });
|
|
38
|
+
* }
|
|
39
|
+
*
|
|
40
|
+
* // Export for debugging
|
|
41
|
+
* const markdown = trace.toMarkdown();
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare class ExecutionTrace {
|
|
45
|
+
private readonly strategyName;
|
|
46
|
+
private readonly strategyVersion;
|
|
47
|
+
private readonly executionId;
|
|
48
|
+
private readonly startedAt;
|
|
49
|
+
private completedAt;
|
|
50
|
+
private readonly now;
|
|
51
|
+
private readonly idGenerator;
|
|
52
|
+
private readonly _decisions;
|
|
53
|
+
private readonly _metrics;
|
|
54
|
+
private readonly _errors;
|
|
55
|
+
constructor(strategyName: string, strategyVersion: string, options?: ExecutionTraceOptions);
|
|
56
|
+
/**
|
|
57
|
+
* Record a decision made during execution.
|
|
58
|
+
*
|
|
59
|
+
* @param category - Decision category (e.g., 'validation', 'generation', 'selection')
|
|
60
|
+
* @param description - Human-readable description of the decision
|
|
61
|
+
* @param context - Additional context (must be JSON-serializable)
|
|
62
|
+
* @returns The recorded decision
|
|
63
|
+
*/
|
|
64
|
+
recordDecision(category: string, description: string, context?: Record<string, unknown>): Decision;
|
|
65
|
+
/**
|
|
66
|
+
* Record a numeric metric.
|
|
67
|
+
*
|
|
68
|
+
* @param name - Metric name (e.g., 'generation_time_ms', 'token_count')
|
|
69
|
+
* @param value - Metric value
|
|
70
|
+
*/
|
|
71
|
+
recordMetric(name: string, value: number): void;
|
|
72
|
+
/**
|
|
73
|
+
* Increment a counter metric.
|
|
74
|
+
*
|
|
75
|
+
* @param name - Counter name
|
|
76
|
+
* @param increment - Amount to increment (default: 1)
|
|
77
|
+
*/
|
|
78
|
+
incrementMetric(name: string, increment?: number): void;
|
|
79
|
+
/**
|
|
80
|
+
* Record an error with context.
|
|
81
|
+
*
|
|
82
|
+
* @param error - The error that occurred
|
|
83
|
+
* @param context - Additional context at time of error
|
|
84
|
+
*/
|
|
85
|
+
recordError(error: Error, context?: Record<string, unknown>): void;
|
|
86
|
+
/**
|
|
87
|
+
* Mark the trace as complete.
|
|
88
|
+
*/
|
|
89
|
+
complete(): void;
|
|
90
|
+
/**
|
|
91
|
+
* Get all recorded decisions.
|
|
92
|
+
*/
|
|
93
|
+
get decisions(): readonly Decision[];
|
|
94
|
+
/**
|
|
95
|
+
* Get all recorded metrics.
|
|
96
|
+
*/
|
|
97
|
+
get metrics(): Readonly<Record<string, number>>;
|
|
98
|
+
/**
|
|
99
|
+
* Get all recorded errors.
|
|
100
|
+
*/
|
|
101
|
+
get errors(): readonly TracedError[];
|
|
102
|
+
/**
|
|
103
|
+
* Get current duration in milliseconds.
|
|
104
|
+
*/
|
|
105
|
+
get durationMs(): number;
|
|
106
|
+
/**
|
|
107
|
+
* Check if any errors were recorded.
|
|
108
|
+
*/
|
|
109
|
+
get hasErrors(): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Get decisions filtered by category.
|
|
112
|
+
*/
|
|
113
|
+
getDecisionsByCategory(category: string): readonly Decision[];
|
|
114
|
+
/**
|
|
115
|
+
* Export trace as immutable data object.
|
|
116
|
+
*/
|
|
117
|
+
toData(): ExecutionTraceData;
|
|
118
|
+
/**
|
|
119
|
+
* Export trace as JSON string.
|
|
120
|
+
*/
|
|
121
|
+
toJSON(): string;
|
|
122
|
+
/**
|
|
123
|
+
* Export trace as Markdown for human-readable debugging.
|
|
124
|
+
*/
|
|
125
|
+
toMarkdown(): string;
|
|
126
|
+
/**
|
|
127
|
+
* Sanitize context to ensure it's JSON-serializable.
|
|
128
|
+
* Circular detection is scoped to the current traversal path; shared references
|
|
129
|
+
* are serialized independently rather than de-duplicated (for example, if the
|
|
130
|
+
* same object is referenced by two sibling keys, each key gets its own copy).
|
|
131
|
+
* This can increase trace size when large objects are referenced multiple times.
|
|
132
|
+
*/
|
|
133
|
+
private sanitizeContext;
|
|
134
|
+
private sanitizeValue;
|
|
135
|
+
private cloneDecision;
|
|
136
|
+
private cloneError;
|
|
137
|
+
private cloneDate;
|
|
138
|
+
private cloneContext;
|
|
139
|
+
private isRecord;
|
|
140
|
+
}
|
|
141
|
+
export {};
|
|
142
|
+
//# sourceM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ategy execution.
|
|
3
|
+
*
|
|
4
|
+
* The trace is mutable during execution but provides immutable snapshots for export.
|
|
5
|
+
* This domain-level trace is distinct from the legacy strategies/shared ExecutionTrace.
|
|
6
|
+
*/
|
|
7
|
+
const defaultClock = () => new Date();
|
|
8
|
+
const defaultIdGenerator = () => {
|
|
9
|
+
const cryptoApi = globalThis.crypto;
|
|
10
|
+
if (cryptoApi?.randomUUID) {
|
|
11
|
+
return cryptoApi.randomUUID();
|
|
12
|
+
}
|
|
13
|
+
// Fallback IDs are not cryptographically secure; use the idGenerator option in
|
|
14
|
+
// ExecutionTraceOptions to inject a custom ID generator if stronger guarantees
|
|
15
|
+
// are required (or use onFallbackId to surface a warning to callers).
|
|
16
|
+
return generateFallbackUUID();
|
|
17
|
+
};
|
|
18
|
+
const generateFallbackUUID = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (char) => {
|
|
19
|
+
const randomValue = Math.floor(Math.random() * 16);
|
|
20
|
+
const value = char === "x" ? randomValue : (randomValue & 0x3) | 0x8;
|
|
21
|
+
return value.toString(16);
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Execution Trace - records decisions, metrics, and errors during strategy execution.
|
|
25
|
+
*
|
|
26
|
+
* The trace is mutable during execution but provides immutable snapshots for export.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const trace = new ExecutionTrace('my-strategy', '1.0.0');
|
|
31
|
+
*
|
|
32
|
+
* trace.recordDecision(
|
|
33
|
+
* 'select-template',
|
|
34
|
+
* 'Selected enterprise template based on input size',
|
|
35
|
+
* { inputSize: 1500, threshold: 1000 }
|
|
36
|
+
* );
|
|
37
|
+
*
|
|
38
|
+
* trace.recordMetric('generation_time_ms', 250);
|
|
39
|
+
*
|
|
40
|
+
* try {
|
|
41
|
+
* // operation
|
|
42
|
+
* } catch (error) {
|
|
43
|
+
* trace.recordError(error, { operation: 'template-render' });
|
|
44
|
+
* }
|
|
45
|
+
*
|
|
46
|
+
* // Export for debugging
|
|
47
|
+
* const markdown = trace.toMarkdown();
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export class ExecutionTrace {
|
|
51
|
+
strategyName;
|
|
52
|
+
strategyVersion;
|
|
53
|
+
executionId;
|
|
54
|
+
startedAt;
|
|
55
|
+
completedAt = null;
|
|
56
|
+
now;
|
|
57
|
+
idGenerator;
|
|
58
|
+
_decisions = [];
|
|
59
|
+
_metrics = {};
|
|
60
|
+
_errors = [];
|
|
61
|
+
constructor(strategyName, strategyVersion, options = {}) {
|
|
62
|
+
this.strategyName = strategyName;
|
|
63
|
+
this.strategyVersion = strategyVersion;
|
|
64
|
+
const usingDefaultIdGenerator = !options.executionId && !options.idGenerator;
|
|
65
|
+
this.now = options.now ?? defaultClock;
|
|
66
|
+
this.idGenerator = options.idGenerator ?? defaultIdGenerator;
|
|
67
|
+
this.executionId = options.executionId ?? this.idGenerator();
|
|
68
|
+
this.startedAt = options.startedAt ?? this.now();
|
|
69
|
+
if (usingDefaultIdGenerator && !globalThis.crypto?.randomUUID) {
|
|
70
|
+
options.onFallbackId?.(this.executionId);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// ============================================
|
|
74
|
+
// Recording Methods
|
|
75
|
+
// ============================================
|
|
76
|
+
/**
|
|
77
|
+
* Record a decision made during execution.
|
|
78
|
+
*
|
|
79
|
+
* @param category - Decision category (e.g., 'validation', 'generation', 'selection')
|
|
80
|
+
* @param description - Human-readable description of the decision
|
|
81
|
+
* @param context - Additional context (must be JSON-serializable)
|
|
82
|
+
* @returns The recorded decision
|
|
83
|
+
*/
|
|
84
|
+
recordDecision(category, description, context = {}) {
|
|
85
|
+
const decision = {
|
|
86
|
+
id: this.idGenerator(),
|
|
87
|
+
timestamp: this.now(),
|
|
88
|
+
category,
|
|
89
|
+
description,
|
|
90
|
+
context: this.sanitizeContext(context),
|
|
91
|
+
};
|
|
92
|
+
this._decisions.push(decision);
|
|
93
|
+
return decision;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Record a numeric metric.
|
|
97
|
+
*
|
|
98
|
+
* @param name - Metric name (e.g., 'generation_time_ms', 'token_count')
|
|
99
|
+
* @param value - Metric value
|
|
100
|
+
*/
|
|
101
|
+
recordMetric(name, value) {
|
|
102
|
+
this._metrics[name] = value;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Increment a counter metric.
|
|
106
|
+
*
|
|
107
|
+
* @param name - Counter name
|
|
108
|
+
* @param increment - Amount to increment (default: 1)
|
|
109
|
+
*/
|
|
110
|
+
incrementMetric(name, increment = 1) {
|
|
111
|
+
this._metrics[name] = (this._metrics[name] ?? 0) + increment;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Record an error with context.
|
|
115
|
+
*
|
|
116
|
+
* @param error - The error that occurred
|
|
117
|
+
* @param context - Additional context at time of error
|
|
118
|
+
*/
|
|
119
|
+
recordError(error, context = {}) {
|
|
120
|
+
this._errors.push({
|
|
121
|
+
timestamp: this.now(),
|
|
122
|
+
category: error.name || "Error",
|
|
123
|
+
message: error.message,
|
|
124
|
+
stack: error.stack,
|
|
125
|
+
context: this.sanitizeContext(context),
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Mark the trace as complete.
|
|
130
|
+
*/
|
|
131
|
+
complete() {
|
|
132
|
+
this.completedAt = this.now();
|
|
133
|
+
this.recordMetric("total_duration_ms", this.durationMs);
|
|
134
|
+
}
|
|
135
|
+
// ============================================
|
|
136
|
+
// Query Methods
|
|
137
|
+
// ============================================
|
|
138
|
+
/**
|
|
139
|
+
* Get all recorded decisions.
|
|
140
|
+
*/
|
|
141
|
+
get decisions() {
|
|
142
|
+
return this._decisions.map((decision) => this.cloneDecision(decision));
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Get all recorded metrics.
|
|
146
|
+
*/
|
|
147
|
+
get metrics() {
|
|
148
|
+
return { ...this._metrics };
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Get all recorded errors.
|
|
152
|
+
*/
|
|
153
|
+
get errors() {
|
|
154
|
+
return this._errors.map((error) => this.cloneError(error));
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Get current duration in milliseconds.
|
|
158
|
+
*/
|
|
159
|
+
get durationMs() {
|
|
160
|
+
const endTime = this.completedAt ?? this.now();
|
|
161
|
+
return endTime.getTime() - this.startedAt.getTime();
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Check if any errors were recorded.
|
|
165
|
+
*/
|
|
166
|
+
get hasErrors() {
|
|
167
|
+
return this._errors.length > 0;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Get decisions filtered by category.
|
|
171
|
+
*/
|
|
172
|
+
getDecisionsByCategory(category) {
|
|
173
|
+
return this._decisions.filter((d) => d.category === category);
|
|
174
|
+
}
|
|
175
|
+
// ============================================
|
|
176
|
+
// Export Methods
|
|
177
|
+
// ============================================
|
|
178
|
+
/**
|
|
179
|
+
* Export trace as immutable data object.
|
|
180
|
+
*/
|
|
181
|
+
toData() {
|
|
182
|
+
return {
|
|
183
|
+
executionId: this.executionId,
|
|
184
|
+
strategyName: this.strategyName,
|
|
185
|
+
strategyVersion: this.strategyVersion,
|
|
186
|
+
startedAt: this.cloneDate(this.startedAt),
|
|
187
|
+
completedAt: this.completedAt ? this.cloneDate(this.completedAt) : null,
|
|
188
|
+
decisions: this._decisions.map((decision) => this.cloneDecision(decision)),
|
|
189
|
+
metrics: { ...this._metrics },
|
|
190
|
+
errors: this._errors.map((error) => this.cloneError(error)),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Export trace as JSON string.
|
|
195
|
+
*/
|
|
196
|
+
toJSON() {
|
|
197
|
+
return JSON.stringify(this.toData(), null, 2);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Export trace as Markdown for human-readable debugging.
|
|
201
|
+
*/
|
|
202
|
+
toMarkdown() {
|
|
203
|
+
const lines = [];
|
|
204
|
+
// Header
|
|
205
|
+
lines.push(`# Execution Trace: ${this.strategyName} v${this.strategyVersion}`);
|
|
206
|
+
lines.push("");
|
|
207
|
+
lines.push(`**Execution ID**: \`${this.executionId}\``);
|
|
208
|
+
lines.push(`**Started**: ${this.startedAt.toISOString()}`);
|
|
209
|
+
if (this.completedAt) {
|
|
210
|
+
lines.push(`**Completed**: ${this.completedAt.toISOString()}`);
|
|
211
|
+
}
|
|
212
|
+
lines.push(`**Duration**: ${this.durationMs}ms`);
|
|
213
|
+
lines.push("");
|
|
214
|
+
// Metrics
|
|
215
|
+
if (Object.keys(this._metrics).length > 0) {
|
|
216
|
+
lines.push("## Metrics");
|
|
217
|
+
lines.push("");
|
|
218
|
+
lines.push("| Metric | Value |");
|
|
219
|
+
lines.push("|--------|-------|");
|
|
220
|
+
for (const [name, value] of Object.entries(this._metrics)) {
|
|
221
|
+
lines.push(`| ${name} | ${value} |`);
|
|
222
|
+
}
|
|
223
|
+
lines.push("");
|
|
224
|
+
}
|
|
225
|
+
// Decisions
|
|
226
|
+
if (this._decisions.length > 0) {
|
|
227
|
+
lines.push("## Decisions");
|
|
228
|
+
lines.push("");
|
|
229
|
+
for (const decision of this._decisions) {
|
|
230
|
+
lines.push(`### ${decision.category}`);
|
|
231
|
+
lines.push("");
|
|
232
|
+
lines.push(`**Time**: ${decision.timestamp.toISOString()}`);
|
|
233
|
+
lines.push("");
|
|
234
|
+
lines.push(decision.description);
|
|
235
|
+
lines.push("");
|
|
236
|
+
if (Object.keys(decision.context).length > 0) {
|
|
237
|
+
lines.push("**Context**:");
|
|
238
|
+
lines.push("```json");
|
|
239
|
+
lines.push(JSON.stringify(decision.context, null, 2));
|
|
240
|
+
lines.push("```");
|
|
241
|
+
lines.push("");
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
// Errors
|
|
246
|
+
if (this._errors.length > 0) {
|
|
247
|
+
lines.push("## Errors");
|
|
248
|
+
lines.push("");
|
|
249
|
+
for (const error of this._errors) {
|
|
250
|
+
lines.push(`### ${error.category}`);
|
|
251
|
+
lines.push("");
|
|
252
|
+
lines.push(`**Time**: ${error.timestamp.toISOString()}`);
|
|
253
|
+
lines.push(`**Message**: ${error.message}`);
|
|
254
|
+
lines.push("");
|
|
255
|
+
if (error.stack) {
|
|
256
|
+
lines.push("**Stack**:");
|
|
257
|
+
lines.push("```");
|
|
258
|
+
lines.push(error.stack);
|
|
259
|
+
lines.push("```");
|
|
260
|
+
lines.push("");
|
|
261
|
+
}
|
|
262
|
+
if (Object.keys(error.context).length > 0) {
|
|
263
|
+
lines.push("**Context**:");
|
|
264
|
+
lines.push("```json");
|
|
265
|
+
lines.push(JSON.stringify(error.context, null, 2));
|
|
266
|
+
lines.push("```");
|
|
267
|
+
lines.push("");
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return lines.join("\n");
|
|
272
|
+
}
|
|
273
|
+
// ============================================
|
|
274
|
+
// Private Helpers
|
|
275
|
+
// ============================================
|
|
276
|
+
/**
|
|
277
|
+
* Sanitize context to ensure it's JSON-serializable.
|
|
278
|
+
* Circular detection is scoped to the current traversal path; shared references
|
|
279
|
+
* are serialized independently rather than de-duplicated (for example, if the
|
|
280
|
+
* same object is referenced by two sibling keys, each key gets its own copy).
|
|
281
|
+
* This can increase trace size when large objects are referenced multiple times.
|
|
282
|
+
*/
|
|
283
|
+
sanitizeContext(context) {
|
|
284
|
+
const sanitized = this.sanitizeValue(context, new WeakSet());
|
|
285
|
+
return this.isRecord(sanitized) ? sanitized : {};
|
|
286
|
+
}
|
|
287
|
+
sanitizeValue(value, path) {
|
|
288
|
+
if (value === null) {
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
292
|
+
return value;
|
|
293
|
+
}
|
|
294
|
+
if (typeof value === "boolean") {
|
|
295
|
+
return value;
|
|
296
|
+
}
|
|
297
|
+
if (typeof value === "bigint" ||
|
|
298
|
+
typeof value === "symbol" ||
|
|
299
|
+
typeof value === "function" ||
|
|
300
|
+
typeof value === "undefined") {
|
|
301
|
+
return String(value);
|
|
302
|
+
}
|
|
303
|
+
if (value instanceof Date) {
|
|
304
|
+
return value.toISOString();
|
|
305
|
+
}
|
|
306
|
+
if (value instanceof RegExp) {
|
|
307
|
+
return value.toString();
|
|
308
|
+
}
|
|
309
|
+
if (value instanceof Error) {
|
|
310
|
+
return {
|
|
311
|
+
name: value.name,
|
|
312
|
+
message: value.message,
|
|
313
|
+
stack: value.stack,
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
if (value instanceof Map) {
|
|
317
|
+
// Map entries are serialized as [key, value] tuples with stringified keys.
|
|
318
|
+
// Non-string keys that stringify to the same value may collide (for example,
|
|
319
|
+
// keys 1 and "1" both stringify to "1"), which risks data loss.
|
|
320
|
+
// Prefer string keys for traceable context.
|
|
321
|
+
return Array.from(value.entries()).map(([key, entryValue]) => [
|
|
322
|
+
String(key),
|
|
323
|
+
this.sanitizeValue(entryValue, path),
|
|
324
|
+
]);
|
|
325
|
+
}
|
|
326
|
+
if (value instanceof Set) {
|
|
327
|
+
return Array.from(value.values()).map((entryValue) => this.sanitizeValue(entryValue, path));
|
|
328
|
+
}
|
|
329
|
+
if (Array.isArray(value)) {
|
|
330
|
+
return value.map((entryValue) => this.sanitizeValue(entryValue, path));
|
|
331
|
+
}
|
|
332
|
+
if (typeof value === "object") {
|
|
333
|
+
if (path.has(value)) {
|
|
334
|
+
return "[Circular]";
|
|
335
|
+
}
|
|
336
|
+
path.add(value);
|
|
337
|
+
try {
|
|
338
|
+
const result = {};
|
|
339
|
+
for (const [key, entryValue] of Object.entries(value)) {
|
|
340
|
+
result[key] = this.sanitizeValue(entryValue, path);
|
|
341
|
+
}
|
|
342
|
+
return result;
|
|
343
|
+
}
|
|
344
|
+
finally {
|
|
345
|
+
path.delete(value);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
return String(value);
|
|
349
|
+
}
|
|
350
|
+
cloneDecision(decision) {
|
|
351
|
+
return {
|
|
352
|
+
...decision,
|
|
353
|
+
timestamp: this.cloneDate(decision.timestamp),
|
|
354
|
+
context: this.cloneContext(decision.context),
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
cloneError(error) {
|
|
358
|
+
return {
|
|
359
|
+
...error,
|
|
360
|
+
timestamp: this.cloneDate(error.timestamp),
|
|
361
|
+
context: this.cloneContext(error.context),
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
cloneDate(date) {
|
|
365
|
+
return new Date(date.getTime());
|
|
366
|
+
}
|
|
367
|
+
cloneContext(context) {
|
|
368
|
+
if (typeof structuredClone === "function") {
|
|
369
|
+
return structuredClone(context);
|
|
370
|
+
}
|
|
371
|
+
return JSON.parse(JSON.stringify(context));
|
|
372
|
+
}
|
|
373
|
+
isRecord(value) {
|
|
374
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
//# sourceMappingURL=execution-trace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-trace.js","sourceRoot":"","sources":["../../../src/domain/base-strategy/execution-trace.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,MAAM,YAAY,GAAU,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;AAE7C,MAAM,kBAAkB,GAAgB,GAAG,EAAE;IAC5C,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC;IACpC,IAAI,SAAS,EAAE,UAAU,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC,UAAU,EAAE,CAAC;IAC/B,CAAC;IACD,+EAA+E;IAC/E,+EAA+E;IAC/E,sEAAsE;IACtE,OAAO,oBAAoB,EAAE,CAAC;AAC/B,CAAC,CAAC;AAEF,MAAM,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YAAY,CAAC,KAAK,CAAC,OAAO,CAAC;SACzC,CAAC;IACH,CAAC;IAEO,SAAS,CAAC,IAAU;QAC3B,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IACjC,CAAC;IAEO,YAAY,CACnB,OAAgC;QAEhC,IAAI,OAAO,eAAe,KAAK,UAAU,EAAE,CAAC;YAC3C,OAAO,eAAe,CAAC,OAAO,CAA4B,CAAC;QAC5D,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAA4B,CAAC;IACvE,CAAC;IAEO,QAAQ,CAAC,KAAc;QAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC7E,CAAC;CACD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Strategy domain module.
|
|
3
|
+
*
|
|
4
|
+
* Provides ExecutionTrace for logging decisions, metrics, and errors
|
|
5
|
+
* during strategy execution.
|
|
6
|
+
*/
|
|
7
|
+
export { ExecutionTrace } from "./execution-trace.js";
|
|
8
|
+
export { createTrace, mergeTraces, startTiming, withErrorTracing, } from "./trace-utils.js";
|
|
9
|
+
export type { Decision, ExecutionTraceData, TracedError } from "./types.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain/base-strategy/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EACN,WAAW,EACX,WAAW,EACX,WAAW,EACX,gBAAgB,GAChB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,QAAQ,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Strategy domain module.
|
|
3
|
+
*
|
|
4
|
+
* Provides ExecutionTrace for logging decisions, metrics, and errors
|
|
5
|
+
* during strategy execution.
|
|
6
|
+
*/
|
|
7
|
+
// Core class
|
|
8
|
+
export { ExecutionTrace } from "./execution-trace.js";
|
|
9
|
+
// Utilities
|
|
10
|
+
export { createTrace, mergeTraces, startTiming, withErrorTracing, } from "./trace-utils.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/base-strategy/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,aAAa;AACb,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY;AACZ,OAAO,EACN,WAAW,EACX,WAAW,EACX,WAAW,EACX,gBAAgB,GAChB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for working with ExecutionTrace.
|
|
3
|
+
*
|
|
4
|
+
* Provides factory functions, timing helpers, and trace aggregation utilities.
|
|
5
|
+
*/
|
|
6
|
+
import { ExecutionTrace } from "./execution-trace.js";
|
|
7
|
+
import type { ExecutionTraceData } from "./types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Create a new execution trace for a strategy.
|
|
10
|
+
*
|
|
11
|
+
* @param strategyName - Name of the strategy
|
|
12
|
+
* @param strategyVersion - Version of the strategy
|
|
13
|
+
* @returns New ExecutionTrace instance
|
|
14
|
+
*/
|
|
15
|
+
export declare function createTrace(strategyName: string, strategyVersion: string): ExecutionTrace;
|
|
16
|
+
/**
|
|
17
|
+
* Merge multiple traces into a summary.
|
|
18
|
+
*
|
|
19
|
+
* Useful for aggregating traces from sub-strategies or parallel execution.
|
|
20
|
+
*/
|
|
21
|
+
export declare function mergeTraces(traces: ExecutionTraceData[]): {
|
|
22
|
+
totalDuration: number;
|
|
23
|
+
totalDecisions: number;
|
|
24
|
+
totalErrors: number;
|
|
25
|
+
metrics: Record<string, number>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Create a timing helper for measuring durations.
|
|
29
|
+
*
|
|
30
|
+
* @param trace - Trace to record timing to
|
|
31
|
+
* @param metricName - Name of the timing metric
|
|
32
|
+
* @returns Function to call when operation completes
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const endTiming = startTiming(trace, 'generation_time_ms');
|
|
37
|
+
* await generateDocument();
|
|
38
|
+
* endTiming(); // Records duration to trace
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function startTiming(trace: ExecutionTrace, metricName: string): () => number;
|
|
42
|
+
/**
|
|
43
|
+
* Wrap an async operation with automatic error tracing.
|
|
44
|
+
*
|
|
45
|
+
* @param trace - Trace to record to
|
|
46
|
+
* @param operation - Async operation to wrap
|
|
47
|
+
* @param context - Context to include if error occurs
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const result = await withErrorTracing(
|
|
52
|
+
* trace,
|
|
53
|
+
* () => fetchData(url),
|
|
54
|
+
* { url, operation: 'fetch-data' }
|
|
55
|
+
* );
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function withErrorTracing<T>(trace: ExecutionTrace, operation: () => Promise<T>, context?: Record<string, unknown>): Promise<T>;
|
|
59
|
+
//# sourceMappingURL=trace-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace-utils.d.ts","sourceRoot":"","sources":["../../../src/domain/base-strategy/trace-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAC1B,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,GACrB,cAAc,CAEhB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,kBAAkB,EAAE,GAAG;IAC1D,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC,CAoBA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAC1B,KAAK,EAAE,cAAc,EACrB,UAAU,EAAE,MAAM,GAChB,MAAM,MAAM,CAQd;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACvC,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACnC,OAAO,CAAC,CAAC,CAAC,CAUZ"}
|