@dcyfr/ai 1.0.3 → 2.1.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/CHANGELOG.md +106 -0
- package/LICENSE +27 -1
- package/README.md +720 -9
- package/dist/ai/agents/agent-loader.d.ts +12 -0
- package/dist/ai/agents/agent-loader.d.ts.map +1 -1
- package/dist/ai/agents/agent-loader.js +74 -65
- package/dist/ai/agents/agent-loader.js.map +1 -1
- package/dist/ai/agents/agent-registry.d.ts +2 -0
- package/dist/ai/agents/agent-registry.d.ts.map +1 -1
- package/dist/ai/agents/agent-registry.js +15 -14
- package/dist/ai/agents/agent-registry.js.map +1 -1
- package/dist/ai/agents/agent-router.d.ts +20 -5
- package/dist/ai/agents/agent-router.d.ts.map +1 -1
- package/dist/ai/agents/agent-router.js +89 -43
- package/dist/ai/agents/agent-router.js.map +1 -1
- package/dist/ai/agents/index.d.ts +6 -1
- package/dist/ai/agents/index.d.ts.map +1 -1
- package/dist/ai/agents/index.js +9 -3
- package/dist/ai/agents/index.js.map +1 -1
- package/dist/ai/agents/instruction-template.d.ts +45 -0
- package/dist/ai/agents/instruction-template.d.ts.map +1 -0
- package/dist/ai/agents/instruction-template.js +197 -0
- package/dist/ai/agents/instruction-template.js.map +1 -0
- package/dist/ai/agents/persona-resolver.d.ts +90 -0
- package/dist/ai/agents/persona-resolver.d.ts.map +1 -0
- package/dist/ai/agents/persona-resolver.js +121 -0
- package/dist/ai/agents/persona-resolver.js.map +1 -0
- package/dist/ai/agents/schema.d.ts +166 -0
- package/dist/ai/agents/schema.d.ts.map +1 -0
- package/dist/ai/agents/schema.js +94 -0
- package/dist/ai/agents/schema.js.map +1 -0
- package/dist/ai/agents/types.d.ts +102 -0
- package/dist/ai/agents/types.d.ts.map +1 -1
- package/dist/ai/agents-builtin/architecture/index.js +3 -3
- package/dist/ai/agents-builtin/content/index.js +1 -1
- package/dist/ai/agents-builtin/data/index.js +1 -1
- package/dist/ai/agents-builtin/development/index.js +4 -4
- package/dist/ai/agents-builtin/devops/index.js +1 -1
- package/dist/ai/agents-builtin/index.js +33 -33
- package/dist/ai/agents-builtin/performance/index.js +1 -1
- package/dist/ai/agents-builtin/research/index.js +1 -1
- package/dist/ai/agents-builtin/security/index.js +1 -1
- package/dist/ai/agents-builtin/testing/index.js +2 -2
- package/dist/ai/config/loader.d.ts.map +1 -1
- package/dist/ai/config/loader.js +6 -3
- package/dist/ai/config/loader.js.map +1 -1
- package/dist/ai/config/schema.d.ts +242 -1156
- package/dist/ai/config/schema.d.ts.map +1 -1
- package/dist/ai/config/schema.js +69 -20
- package/dist/ai/config/schema.js.map +1 -1
- package/dist/ai/core/provider-registry.d.ts +32 -0
- package/dist/ai/core/provider-registry.d.ts.map +1 -1
- package/dist/ai/core/provider-registry.js +189 -14
- package/dist/ai/core/provider-registry.js.map +1 -1
- package/dist/ai/core/telemetry-engine.d.ts +26 -0
- package/dist/ai/core/telemetry-engine.d.ts.map +1 -1
- package/dist/ai/core/telemetry-engine.js +81 -1
- package/dist/ai/core/telemetry-engine.js.map +1 -1
- package/dist/ai/delegation/agent-registry.d.ts +143 -0
- package/dist/ai/delegation/agent-registry.d.ts.map +1 -0
- package/dist/ai/delegation/agent-registry.js +231 -0
- package/dist/ai/delegation/agent-registry.js.map +1 -0
- package/dist/ai/delegation/blast-radius-tracker.d.ts +65 -0
- package/dist/ai/delegation/blast-radius-tracker.d.ts.map +1 -0
- package/dist/ai/delegation/blast-radius-tracker.js +81 -0
- package/dist/ai/delegation/blast-radius-tracker.js.map +1 -0
- package/dist/ai/delegation/capability-bootstrap.d.ts +40 -0
- package/dist/ai/delegation/capability-bootstrap.d.ts.map +1 -0
- package/dist/ai/delegation/capability-bootstrap.js +431 -0
- package/dist/ai/delegation/capability-bootstrap.js.map +1 -0
- package/dist/ai/delegation/capability-registry.d.ts +81 -0
- package/dist/ai/delegation/capability-registry.d.ts.map +1 -0
- package/dist/ai/delegation/capability-registry.js +339 -0
- package/dist/ai/delegation/capability-registry.js.map +1 -0
- package/dist/ai/delegation/chain-tracker.d.ts +152 -0
- package/dist/ai/delegation/chain-tracker.d.ts.map +1 -0
- package/dist/ai/delegation/chain-tracker.js +336 -0
- package/dist/ai/delegation/chain-tracker.js.map +1 -0
- package/dist/ai/delegation/circuit-breaker.d.ts +59 -0
- package/dist/ai/delegation/circuit-breaker.d.ts.map +1 -0
- package/dist/ai/delegation/circuit-breaker.js +153 -0
- package/dist/ai/delegation/circuit-breaker.js.map +1 -0
- package/dist/ai/delegation/contract-manager.d.ts +415 -0
- package/dist/ai/delegation/contract-manager.d.ts.map +1 -0
- package/dist/ai/delegation/contract-manager.js +1258 -0
- package/dist/ai/delegation/contract-manager.js.map +1 -0
- package/dist/ai/delegation/delegation-manager.d.ts +505 -0
- package/dist/ai/delegation/delegation-manager.d.ts.map +1 -0
- package/dist/ai/delegation/delegation-manager.js +773 -0
- package/dist/ai/delegation/delegation-manager.js.map +1 -0
- package/dist/ai/delegation/event-schemas.d.ts +101 -0
- package/dist/ai/delegation/event-schemas.d.ts.map +1 -0
- package/dist/ai/delegation/event-schemas.js +59 -0
- package/dist/ai/delegation/event-schemas.js.map +1 -0
- package/dist/ai/delegation/execution-mode-dashboard.d.ts +109 -0
- package/dist/ai/delegation/execution-mode-dashboard.d.ts.map +1 -0
- package/dist/ai/delegation/execution-mode-dashboard.js +167 -0
- package/dist/ai/delegation/execution-mode-dashboard.js.map +1 -0
- package/dist/ai/delegation/feature-flags.d.ts +191 -0
- package/dist/ai/delegation/feature-flags.d.ts.map +1 -0
- package/dist/ai/delegation/feature-flags.js +332 -0
- package/dist/ai/delegation/feature-flags.js.map +1 -0
- package/dist/ai/delegation/index.d.ts +51 -0
- package/dist/ai/delegation/index.d.ts.map +1 -0
- package/dist/ai/delegation/index.js +39 -0
- package/dist/ai/delegation/index.js.map +1 -0
- package/dist/ai/delegation/middleware/chain-depth-middleware.d.ts +39 -0
- package/dist/ai/delegation/middleware/chain-depth-middleware.d.ts.map +1 -0
- package/dist/ai/delegation/middleware/chain-depth-middleware.js +77 -0
- package/dist/ai/delegation/middleware/chain-depth-middleware.js.map +1 -0
- package/dist/ai/delegation/middleware/chain-tracker-middleware.d.ts +46 -0
- package/dist/ai/delegation/middleware/chain-tracker-middleware.d.ts.map +1 -0
- package/dist/ai/delegation/middleware/chain-tracker-middleware.js +89 -0
- package/dist/ai/delegation/middleware/chain-tracker-middleware.js.map +1 -0
- package/dist/ai/delegation/middleware/content-policy-middleware.d.ts +31 -0
- package/dist/ai/delegation/middleware/content-policy-middleware.d.ts.map +1 -0
- package/dist/ai/delegation/middleware/content-policy-middleware.js +82 -0
- package/dist/ai/delegation/middleware/content-policy-middleware.js.map +1 -0
- package/dist/ai/delegation/middleware/feature-flag-middleware.d.ts +46 -0
- package/dist/ai/delegation/middleware/feature-flag-middleware.d.ts.map +1 -0
- package/dist/ai/delegation/middleware/feature-flag-middleware.js +59 -0
- package/dist/ai/delegation/middleware/feature-flag-middleware.js.map +1 -0
- package/dist/ai/delegation/middleware/identity-middleware.d.ts +23 -0
- package/dist/ai/delegation/middleware/identity-middleware.d.ts.map +1 -0
- package/dist/ai/delegation/middleware/identity-middleware.js +64 -0
- package/dist/ai/delegation/middleware/identity-middleware.js.map +1 -0
- package/dist/ai/delegation/middleware/permissions-middleware.d.ts +48 -0
- package/dist/ai/delegation/middleware/permissions-middleware.d.ts.map +1 -0
- package/dist/ai/delegation/middleware/permissions-middleware.js +107 -0
- package/dist/ai/delegation/middleware/permissions-middleware.js.map +1 -0
- package/dist/ai/delegation/middleware/rate-limiter-middleware.d.ts +38 -0
- package/dist/ai/delegation/middleware/rate-limiter-middleware.d.ts.map +1 -0
- package/dist/ai/delegation/middleware/rate-limiter-middleware.js +65 -0
- package/dist/ai/delegation/middleware/rate-limiter-middleware.js.map +1 -0
- package/dist/ai/delegation/middleware/reputation-middleware.d.ts +39 -0
- package/dist/ai/delegation/middleware/reputation-middleware.d.ts.map +1 -0
- package/dist/ai/delegation/middleware/reputation-middleware.js +75 -0
- package/dist/ai/delegation/middleware/reputation-middleware.js.map +1 -0
- package/dist/ai/delegation/middleware/resource-limiter-middleware.d.ts +52 -0
- package/dist/ai/delegation/middleware/resource-limiter-middleware.d.ts.map +1 -0
- package/dist/ai/delegation/middleware/resource-limiter-middleware.js +112 -0
- package/dist/ai/delegation/middleware/resource-limiter-middleware.js.map +1 -0
- package/dist/ai/delegation/middleware/threat-validator-middleware.d.ts +23 -0
- package/dist/ai/delegation/middleware/threat-validator-middleware.d.ts.map +1 -0
- package/dist/ai/delegation/middleware/threat-validator-middleware.js +83 -0
- package/dist/ai/delegation/middleware/threat-validator-middleware.js.map +1 -0
- package/dist/ai/delegation/middleware/tlp-middleware.d.ts +23 -0
- package/dist/ai/delegation/middleware/tlp-middleware.d.ts.map +1 -0
- package/dist/ai/delegation/middleware/tlp-middleware.js +59 -0
- package/dist/ai/delegation/middleware/tlp-middleware.js.map +1 -0
- package/dist/ai/delegation/monitoring.d.ts +298 -0
- package/dist/ai/delegation/monitoring.d.ts.map +1 -0
- package/dist/ai/delegation/monitoring.js +584 -0
- package/dist/ai/delegation/monitoring.js.map +1 -0
- package/dist/ai/delegation/security-middleware-chain.d.ts +71 -0
- package/dist/ai/delegation/security-middleware-chain.d.ts.map +1 -0
- package/dist/ai/delegation/security-middleware-chain.js +163 -0
- package/dist/ai/delegation/security-middleware-chain.js.map +1 -0
- package/dist/ai/delegation/session-checkpoint.d.ts +77 -0
- package/dist/ai/delegation/session-checkpoint.d.ts.map +1 -0
- package/dist/ai/delegation/session-checkpoint.js +131 -0
- package/dist/ai/delegation/session-checkpoint.js.map +1 -0
- package/dist/ai/delegation/session-manager.d.ts +131 -0
- package/dist/ai/delegation/session-manager.d.ts.map +1 -0
- package/dist/ai/delegation/session-manager.js +243 -0
- package/dist/ai/delegation/session-manager.js.map +1 -0
- package/dist/ai/delegation/session-queue.d.ts +95 -0
- package/dist/ai/delegation/session-queue.d.ts.map +1 -0
- package/dist/ai/delegation/session-queue.js +136 -0
- package/dist/ai/delegation/session-queue.js.map +1 -0
- package/dist/ai/delegation/timeout-watchdog.d.ts +60 -0
- package/dist/ai/delegation/timeout-watchdog.d.ts.map +1 -0
- package/dist/ai/delegation/timeout-watchdog.js +100 -0
- package/dist/ai/delegation/timeout-watchdog.js.map +1 -0
- package/dist/ai/examples/integration-demo.d.ts +27 -0
- package/dist/ai/examples/integration-demo.d.ts.map +1 -0
- package/dist/ai/examples/integration-demo.js +536 -0
- package/dist/ai/examples/integration-demo.js.map +1 -0
- package/dist/ai/index.d.ts +27 -0
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +32 -10
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/mcp/index.d.ts +14 -2
- package/dist/ai/mcp/index.d.ts.map +1 -1
- package/dist/ai/mcp/index.js +11 -1
- package/dist/ai/mcp/index.js.map +1 -1
- package/dist/ai/mcp/servers/analytics/index.d.ts +19 -0
- package/dist/ai/mcp/servers/analytics/index.d.ts.map +1 -0
- package/dist/ai/mcp/servers/analytics/index.js +612 -0
- package/dist/ai/mcp/servers/analytics/index.js.map +1 -0
- package/dist/ai/mcp/servers/content-manager/content-provider.d.ts +61 -0
- package/dist/ai/mcp/servers/content-manager/content-provider.d.ts.map +1 -0
- package/dist/ai/mcp/servers/content-manager/content-provider.js +8 -0
- package/dist/ai/mcp/servers/content-manager/content-provider.js.map +1 -0
- package/dist/ai/mcp/servers/content-manager/index.d.ts +19 -0
- package/dist/ai/mcp/servers/content-manager/index.d.ts.map +1 -0
- package/dist/ai/mcp/servers/content-manager/index.js +282 -0
- package/dist/ai/mcp/servers/content-manager/index.js.map +1 -0
- package/dist/ai/mcp/servers/delegation-monitor/index.d.ts +36 -0
- package/dist/ai/mcp/servers/delegation-monitor/index.d.ts.map +1 -0
- package/dist/ai/mcp/servers/delegation-monitor/index.js +757 -0
- package/dist/ai/mcp/servers/delegation-monitor/index.js.map +1 -0
- package/dist/ai/mcp/servers/design-tokens/index.d.ts +19 -0
- package/dist/ai/mcp/servers/design-tokens/index.d.ts.map +1 -0
- package/dist/ai/mcp/servers/design-tokens/index.js +445 -0
- package/dist/ai/mcp/servers/design-tokens/index.js.map +1 -0
- package/dist/ai/mcp/servers/design-tokens/token-provider.d.ts +59 -0
- package/dist/ai/mcp/servers/design-tokens/token-provider.d.ts.map +1 -0
- package/dist/ai/mcp/servers/design-tokens/token-provider.js +8 -0
- package/dist/ai/mcp/servers/design-tokens/token-provider.js.map +1 -0
- package/dist/ai/mcp/servers/promptintel/index.d.ts +19 -0
- package/dist/ai/mcp/servers/promptintel/index.d.ts.map +1 -0
- package/dist/ai/mcp/servers/promptintel/index.js +335 -0
- package/dist/ai/mcp/servers/promptintel/index.js.map +1 -0
- package/dist/ai/mcp/servers/shared/cache.d.ts +62 -0
- package/dist/ai/mcp/servers/shared/cache.d.ts.map +1 -0
- package/dist/ai/mcp/servers/shared/cache.js +117 -0
- package/dist/ai/mcp/servers/shared/cache.js.map +1 -0
- package/dist/ai/mcp/servers/shared/promptintel-client.d.ts +53 -0
- package/dist/ai/mcp/servers/shared/promptintel-client.d.ts.map +1 -0
- package/dist/ai/mcp/servers/shared/promptintel-client.js +185 -0
- package/dist/ai/mcp/servers/shared/promptintel-client.js.map +1 -0
- package/dist/ai/mcp/servers/shared/promptintel-types.d.ts +85 -0
- package/dist/ai/mcp/servers/shared/promptintel-types.d.ts.map +1 -0
- package/dist/ai/mcp/servers/shared/promptintel-types.js +7 -0
- package/dist/ai/mcp/servers/shared/promptintel-types.js.map +1 -0
- package/dist/ai/mcp/servers/shared/rate-limiter.d.ts +54 -0
- package/dist/ai/mcp/servers/shared/rate-limiter.d.ts.map +1 -0
- package/dist/ai/mcp/servers/shared/rate-limiter.js +124 -0
- package/dist/ai/mcp/servers/shared/rate-limiter.js.map +1 -0
- package/dist/ai/mcp/servers/shared/redis-client.d.ts +54 -0
- package/dist/ai/mcp/servers/shared/redis-client.d.ts.map +1 -0
- package/dist/ai/mcp/servers/shared/redis-client.js +232 -0
- package/dist/ai/mcp/servers/shared/redis-client.js.map +1 -0
- package/dist/ai/mcp/servers/shared/types.d.ts +301 -0
- package/dist/ai/mcp/servers/shared/types.d.ts.map +1 -0
- package/dist/ai/mcp/servers/shared/types.js +6 -0
- package/dist/ai/mcp/servers/shared/types.js.map +1 -0
- package/dist/ai/mcp/servers/shared/utils.d.ts +49 -0
- package/dist/ai/mcp/servers/shared/utils.d.ts.map +1 -0
- package/dist/ai/mcp/servers/shared/utils.js +233 -0
- package/dist/ai/mcp/servers/shared/utils.js.map +1 -0
- package/dist/ai/memory/config.d.ts +102 -0
- package/dist/ai/memory/config.d.ts.map +1 -0
- package/dist/ai/memory/config.js +200 -0
- package/dist/ai/memory/config.js.map +1 -0
- package/dist/ai/memory/dcyfr-memory.d.ts +67 -0
- package/dist/ai/memory/dcyfr-memory.d.ts.map +1 -0
- package/dist/ai/memory/dcyfr-memory.js +308 -0
- package/dist/ai/memory/dcyfr-memory.js.map +1 -0
- package/dist/ai/memory/index.d.ts +15 -0
- package/dist/ai/memory/index.d.ts.map +1 -0
- package/dist/ai/memory/index.js +15 -0
- package/dist/ai/memory/index.js.map +1 -0
- package/dist/ai/memory/mem0-client.d.ts +108 -0
- package/dist/ai/memory/mem0-client.d.ts.map +1 -0
- package/dist/ai/memory/mem0-client.js +205 -0
- package/dist/ai/memory/mem0-client.js.map +1 -0
- package/dist/ai/memory/types.d.ts +175 -0
- package/dist/ai/memory/types.d.ts.map +1 -0
- package/dist/ai/memory/types.js +10 -0
- package/dist/ai/memory/types.js.map +1 -0
- package/dist/ai/permissions/attenuation-engine.d.ts +159 -0
- package/dist/ai/permissions/attenuation-engine.d.ts.map +1 -0
- package/dist/ai/permissions/attenuation-engine.js +511 -0
- package/dist/ai/permissions/attenuation-engine.js.map +1 -0
- package/dist/ai/plugins/plugin-loader.d.ts +4 -0
- package/dist/ai/plugins/plugin-loader.d.ts.map +1 -1
- package/dist/ai/plugins/plugin-loader.js +28 -28
- package/dist/ai/plugins/plugin-loader.js.map +1 -1
- package/dist/ai/reputation/execution-mode-reputation.d.ts +104 -0
- package/dist/ai/reputation/execution-mode-reputation.d.ts.map +1 -0
- package/dist/ai/reputation/execution-mode-reputation.js +142 -0
- package/dist/ai/reputation/execution-mode-reputation.js.map +1 -0
- package/dist/ai/reputation/reputation-engine.d.ts +204 -0
- package/dist/ai/reputation/reputation-engine.d.ts.map +1 -0
- package/dist/ai/reputation/reputation-engine.js +426 -0
- package/dist/ai/reputation/reputation-engine.js.map +1 -0
- package/dist/ai/runtime/agent-runtime.d.ts +193 -0
- package/dist/ai/runtime/agent-runtime.d.ts.map +1 -0
- package/dist/ai/runtime/agent-runtime.js +1009 -0
- package/dist/ai/runtime/agent-runtime.js.map +1 -0
- package/dist/ai/runtime/index.d.ts +11 -0
- package/dist/ai/runtime/index.d.ts.map +1 -0
- package/dist/ai/runtime/index.js +9 -0
- package/dist/ai/runtime/index.js.map +1 -0
- package/dist/ai/runtime/telemetry-schema.d.ts +192 -0
- package/dist/ai/runtime/telemetry-schema.d.ts.map +1 -0
- package/dist/ai/runtime/telemetry-schema.js +200 -0
- package/dist/ai/runtime/telemetry-schema.js.map +1 -0
- package/dist/ai/runtime/types.d.ts +236 -0
- package/dist/ai/runtime/types.d.ts.map +1 -0
- package/dist/ai/runtime/types.js +10 -0
- package/dist/ai/runtime/types.js.map +1 -0
- package/dist/ai/src/batch-processor.d.ts +298 -0
- package/dist/ai/src/batch-processor.d.ts.map +1 -0
- package/dist/ai/src/batch-processor.js +520 -0
- package/dist/ai/src/batch-processor.js.map +1 -0
- package/dist/ai/src/capability-bootstrap.d.ts +222 -0
- package/dist/ai/src/capability-bootstrap.d.ts.map +1 -0
- package/dist/ai/src/capability-bootstrap.js +421 -0
- package/dist/ai/src/capability-bootstrap.js.map +1 -0
- package/dist/ai/src/capability-manifest-generator.d.ts +52 -0
- package/dist/ai/src/capability-manifest-generator.d.ts.map +1 -0
- package/dist/ai/src/capability-manifest-generator.js +691 -0
- package/dist/ai/src/capability-manifest-generator.js.map +1 -0
- package/dist/ai/src/capability-registry.d.ts +157 -0
- package/dist/ai/src/capability-registry.d.ts.map +1 -0
- package/dist/ai/src/capability-registry.js +577 -0
- package/dist/ai/src/capability-registry.js.map +1 -0
- package/dist/ai/src/cli/telemetry-dashboard.d.ts +132 -0
- package/dist/ai/src/cli/telemetry-dashboard.d.ts.map +1 -0
- package/dist/ai/src/cli/telemetry-dashboard.js +565 -0
- package/dist/ai/src/cli/telemetry-dashboard.js.map +1 -0
- package/dist/ai/src/delegation/feature-flags.d.ts +213 -0
- package/dist/ai/src/delegation/feature-flags.d.ts.map +1 -0
- package/dist/ai/src/delegation/feature-flags.js +395 -0
- package/dist/ai/src/delegation/feature-flags.js.map +1 -0
- package/dist/ai/src/delegation/liability-firebreak.d.ts +303 -0
- package/dist/ai/src/delegation/liability-firebreak.d.ts.map +1 -0
- package/dist/ai/src/delegation/liability-firebreak.js +643 -0
- package/dist/ai/src/delegation/liability-firebreak.js.map +1 -0
- package/dist/ai/src/delegation/security-threat-model.d.ts +171 -0
- package/dist/ai/src/delegation/security-threat-model.d.ts.map +1 -0
- package/dist/ai/src/delegation/security-threat-model.js +723 -0
- package/dist/ai/src/delegation/security-threat-model.js.map +1 -0
- package/dist/ai/src/delegation/tlp-enforcement.d.ts +146 -0
- package/dist/ai/src/delegation/tlp-enforcement.d.ts.map +1 -0
- package/dist/ai/src/delegation/tlp-enforcement.js +382 -0
- package/dist/ai/src/delegation/tlp-enforcement.js.map +1 -0
- package/dist/ai/src/delegation-capability-integration.d.ts +154 -0
- package/dist/ai/src/delegation-capability-integration.d.ts.map +1 -0
- package/dist/ai/src/delegation-capability-integration.js +351 -0
- package/dist/ai/src/delegation-capability-integration.js.map +1 -0
- package/dist/ai/src/end-to-end-workflow-orchestrator.d.ts +325 -0
- package/dist/ai/src/end-to-end-workflow-orchestrator.d.ts.map +1 -0
- package/dist/ai/src/end-to-end-workflow-orchestrator.js +801 -0
- package/dist/ai/src/end-to-end-workflow-orchestrator.js.map +1 -0
- package/dist/ai/src/enhanced-capability-detection.d.ts +237 -0
- package/dist/ai/src/enhanced-capability-detection.d.ts.map +1 -0
- package/dist/ai/src/enhanced-capability-detection.js +448 -0
- package/dist/ai/src/enhanced-capability-detection.js.map +1 -0
- package/dist/ai/src/intelligent-cache-manager.d.ts +327 -0
- package/dist/ai/src/intelligent-cache-manager.d.ts.map +1 -0
- package/dist/ai/src/intelligent-cache-manager.js +634 -0
- package/dist/ai/src/intelligent-cache-manager.js.map +1 -0
- package/dist/ai/src/mcp-auto-configuration.d.ts +232 -0
- package/dist/ai/src/mcp-auto-configuration.d.ts.map +1 -0
- package/dist/ai/src/mcp-auto-configuration.js +445 -0
- package/dist/ai/src/mcp-auto-configuration.js.map +1 -0
- package/dist/ai/src/performance-profiler.d.ts +351 -0
- package/dist/ai/src/performance-profiler.d.ts.map +1 -0
- package/dist/ai/src/performance-profiler.js +475 -0
- package/dist/ai/src/performance-profiler.js.map +1 -0
- package/dist/ai/src/personas/hooks/before-llm-call.d.ts +96 -0
- package/dist/ai/src/personas/hooks/before-llm-call.d.ts.map +1 -0
- package/dist/ai/src/personas/hooks/before-llm-call.js +83 -0
- package/dist/ai/src/personas/hooks/before-llm-call.js.map +1 -0
- package/dist/ai/src/personas/index.d.ts +10 -0
- package/dist/ai/src/personas/index.d.ts.map +1 -0
- package/dist/ai/src/personas/index.js +10 -0
- package/dist/ai/src/personas/index.js.map +1 -0
- package/dist/ai/src/personas/persona-loader.d.ts +42 -0
- package/dist/ai/src/personas/persona-loader.d.ts.map +1 -0
- package/dist/ai/src/personas/persona-loader.js +162 -0
- package/dist/ai/src/personas/persona-loader.js.map +1 -0
- package/dist/ai/src/personas/types.d.ts +199 -0
- package/dist/ai/src/personas/types.d.ts.map +1 -0
- package/dist/ai/src/personas/types.js +7 -0
- package/dist/ai/src/personas/types.js.map +1 -0
- package/dist/ai/src/personas/voice-resolver.d.ts +40 -0
- package/dist/ai/src/personas/voice-resolver.d.ts.map +1 -0
- package/dist/ai/src/personas/voice-resolver.js +201 -0
- package/dist/ai/src/personas/voice-resolver.js.map +1 -0
- package/dist/ai/src/resource-monitor.d.ts +311 -0
- package/dist/ai/src/resource-monitor.d.ts.map +1 -0
- package/dist/ai/src/resource-monitor.js +475 -0
- package/dist/ai/src/resource-monitor.js.map +1 -0
- package/dist/ai/src/runtime/agent-runtime.d.ts +340 -0
- package/dist/ai/src/runtime/agent-runtime.d.ts.map +1 -0
- package/dist/ai/src/runtime/agent-runtime.js +1084 -0
- package/dist/ai/src/runtime/agent-runtime.js.map +1 -0
- package/dist/ai/src/telemetry/delegation-telemetry.d.ts +287 -0
- package/dist/ai/src/telemetry/delegation-telemetry.d.ts.map +1 -0
- package/dist/ai/src/telemetry/delegation-telemetry.js +389 -0
- package/dist/ai/src/telemetry/delegation-telemetry.js.map +1 -0
- package/dist/ai/src/telemetry/index.d.ts +48 -0
- package/dist/ai/src/telemetry/index.d.ts.map +1 -0
- package/dist/ai/src/telemetry/index.js +48 -0
- package/dist/ai/src/telemetry/index.js.map +1 -0
- package/dist/ai/src/telemetry/runtime-telemetry-integration.d.ts +67 -0
- package/dist/ai/src/telemetry/runtime-telemetry-integration.d.ts.map +1 -0
- package/dist/ai/src/telemetry/runtime-telemetry-integration.js +415 -0
- package/dist/ai/src/telemetry/runtime-telemetry-integration.js.map +1 -0
- package/dist/ai/src/telemetry/telemetry-utils.d.ts +119 -0
- package/dist/ai/src/telemetry/telemetry-utils.d.ts.map +1 -0
- package/dist/ai/src/telemetry/telemetry-utils.js +250 -0
- package/dist/ai/src/telemetry/telemetry-utils.js.map +1 -0
- package/dist/ai/src/types/agent-capabilities.d.ts +227 -0
- package/dist/ai/src/types/agent-capabilities.d.ts.map +1 -0
- package/dist/ai/src/types/agent-capabilities.js +11 -0
- package/dist/ai/src/types/agent-capabilities.js.map +1 -0
- package/dist/ai/src/types/context-verification.d.ts +158 -0
- package/dist/ai/src/types/context-verification.d.ts.map +1 -0
- package/dist/ai/src/types/context-verification.js +73 -0
- package/dist/ai/src/types/context-verification.js.map +1 -0
- package/dist/ai/src/types/delegation-contracts.d.ts +296 -0
- package/dist/ai/src/types/delegation-contracts.d.ts.map +1 -0
- package/dist/ai/src/types/delegation-contracts.js +17 -0
- package/dist/ai/src/types/delegation-contracts.js.map +1 -0
- package/dist/ai/src/validation-pipeline-integration.d.ts +266 -0
- package/dist/ai/src/validation-pipeline-integration.d.ts.map +1 -0
- package/dist/ai/src/validation-pipeline-integration.js +695 -0
- package/dist/ai/src/validation-pipeline-integration.js.map +1 -0
- package/dist/ai/src/verification/multi-modal-formatters.d.ts +57 -0
- package/dist/ai/src/verification/multi-modal-formatters.d.ts.map +1 -0
- package/dist/ai/src/verification/multi-modal-formatters.js +655 -0
- package/dist/ai/src/verification/multi-modal-formatters.js.map +1 -0
- package/dist/ai/src/verification/output-formatter.d.ts +186 -0
- package/dist/ai/src/verification/output-formatter.d.ts.map +1 -0
- package/dist/ai/src/verification/output-formatter.js +296 -0
- package/dist/ai/src/verification/output-formatter.js.map +1 -0
- package/dist/ai/src/verification/parser-integration.d.ts +137 -0
- package/dist/ai/src/verification/parser-integration.d.ts.map +1 -0
- package/dist/ai/src/verification/parser-integration.js +273 -0
- package/dist/ai/src/verification/parser-integration.js.map +1 -0
- package/dist/ai/types/agent-capabilities.d.ts +387 -0
- package/dist/ai/types/agent-capabilities.d.ts.map +1 -0
- package/dist/ai/types/agent-capabilities.js +32 -0
- package/dist/ai/types/agent-capabilities.js.map +1 -0
- package/dist/ai/types/delegation-contracts.d.ts +291 -0
- package/dist/ai/types/delegation-contracts.d.ts.map +1 -0
- package/dist/ai/types/delegation-contracts.js +14 -0
- package/dist/ai/types/delegation-contracts.js.map +1 -0
- package/dist/ai/types/index.d.ts +4 -1
- package/dist/ai/types/index.d.ts.map +1 -1
- package/dist/ai/types/index.js +4 -1
- package/dist/ai/types/index.js.map +1 -1
- package/dist/ai/types/permission-tokens.d.ts +365 -0
- package/dist/ai/types/permission-tokens.d.ts.map +1 -0
- package/dist/ai/types/permission-tokens.js +13 -0
- package/dist/ai/types/permission-tokens.js.map +1 -0
- package/dist/ai/types/security-middleware.d.ts +130 -0
- package/dist/ai/types/security-middleware.d.ts.map +1 -0
- package/dist/ai/types/security-middleware.js +13 -0
- package/dist/ai/types/security-middleware.js.map +1 -0
- package/dist/ai/utils/storage.d.ts.map +1 -1
- package/dist/ai/utils/storage.js +6 -3
- package/dist/ai/utils/storage.js.map +1 -1
- package/dist/ai/validation/validation-framework.js +1 -1
- package/dist/ai/verification/policy-framework.d.ts +161 -0
- package/dist/ai/verification/policy-framework.d.ts.map +1 -0
- package/dist/ai/verification/policy-framework.js +436 -0
- package/dist/ai/verification/policy-framework.js.map +1 -0
- package/package.json +56 -6
|
@@ -0,0 +1,655 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DCYFR Multi-Modal Verification Formatters
|
|
3
|
+
* TLP:AMBER - Internal Use Only
|
|
4
|
+
*
|
|
5
|
+
* Concrete implementations of verification output formatters for multiple
|
|
6
|
+
* formats including JSON, YAML, Markdown, HTML, and contract compliance.
|
|
7
|
+
*
|
|
8
|
+
* @module verification/multi-modal-formatters
|
|
9
|
+
* @version 1.0.0
|
|
10
|
+
* @date 2026-02-13
|
|
11
|
+
*/
|
|
12
|
+
import { BaseVerificationFormatter, } from './output-formatter.js';
|
|
13
|
+
/**
|
|
14
|
+
* Standard multi-modal verification formatter
|
|
15
|
+
*
|
|
16
|
+
* Provides implementations for all standard output formats with
|
|
17
|
+
* configurable templates and styling options.
|
|
18
|
+
*/
|
|
19
|
+
export class StandardVerificationFormatter extends BaseVerificationFormatter {
|
|
20
|
+
async formatOutput(result, contract, format) {
|
|
21
|
+
let content;
|
|
22
|
+
switch (format) {
|
|
23
|
+
case 'json':
|
|
24
|
+
content = await this.formatAsJson(result, contract);
|
|
25
|
+
break;
|
|
26
|
+
case 'yaml':
|
|
27
|
+
content = await this.formatAsYaml(result, contract);
|
|
28
|
+
break;
|
|
29
|
+
case 'markdown':
|
|
30
|
+
content = await this.formatAsMarkdown(result, contract);
|
|
31
|
+
break;
|
|
32
|
+
case 'html':
|
|
33
|
+
content = await this.formatAsHtml(result, contract);
|
|
34
|
+
break;
|
|
35
|
+
case 'xml':
|
|
36
|
+
content = await this.formatAsXml(result, contract);
|
|
37
|
+
break;
|
|
38
|
+
case 'csv':
|
|
39
|
+
content = await this.formatAsCsv(result, contract);
|
|
40
|
+
break;
|
|
41
|
+
case 'plain_text':
|
|
42
|
+
content = await this.formatAsPlainText(result, contract);
|
|
43
|
+
break;
|
|
44
|
+
case 'contract_compliance':
|
|
45
|
+
content = await this.formatAsContractCompliance(result, contract);
|
|
46
|
+
break;
|
|
47
|
+
default:
|
|
48
|
+
throw new Error(`Unsupported output format: ${format}`);
|
|
49
|
+
}
|
|
50
|
+
// Apply content size limits
|
|
51
|
+
if (content.length > this.config.max_content_size_bytes) {
|
|
52
|
+
const truncationMessage = '\n... (truncated)';
|
|
53
|
+
const maxContentLength = this.config.max_content_size_bytes - truncationMessage.length;
|
|
54
|
+
content = content.slice(0, maxContentLength) + truncationMessage;
|
|
55
|
+
}
|
|
56
|
+
// Validate contract compliance
|
|
57
|
+
const validation = this.validateContractCompliance(content, contract, result);
|
|
58
|
+
const formatted = {
|
|
59
|
+
format,
|
|
60
|
+
mime_type: this.getMimeType(format),
|
|
61
|
+
content,
|
|
62
|
+
metadata: {
|
|
63
|
+
formatted_at: new Date().toISOString(),
|
|
64
|
+
formatter_version: '1.0.0',
|
|
65
|
+
contract_id: contract.contract_id,
|
|
66
|
+
content_size_bytes: content.length,
|
|
67
|
+
content_hash: this.config.include_content_hash ? this.calculateContentHash(content) : undefined,
|
|
68
|
+
format_metadata: this.getFormatMetadata(format, result, contract),
|
|
69
|
+
},
|
|
70
|
+
validation: {
|
|
71
|
+
contract_compliant: validation.compliant,
|
|
72
|
+
compliance_checks: validation.checks,
|
|
73
|
+
compliance_score: validation.score,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
return formatted;
|
|
77
|
+
}
|
|
78
|
+
// Format-specific implementations
|
|
79
|
+
async formatAsJson(result, contract) {
|
|
80
|
+
const output = {
|
|
81
|
+
contract_id: contract.contract_id,
|
|
82
|
+
execution_result: {
|
|
83
|
+
success: result.success,
|
|
84
|
+
output: result.output,
|
|
85
|
+
error: result.error,
|
|
86
|
+
metrics: this.config.metadata_options.include_resource_usage ? result.metrics : {
|
|
87
|
+
execution_time_ms: result.metrics.execution_time_ms,
|
|
88
|
+
},
|
|
89
|
+
verification: result.verification,
|
|
90
|
+
completed_at: result.completed_at,
|
|
91
|
+
},
|
|
92
|
+
contract_verification: {
|
|
93
|
+
verification_policy: contract.verification_policy,
|
|
94
|
+
success_criteria: contract.success_criteria,
|
|
95
|
+
tlp_classification: contract.tlp_classification,
|
|
96
|
+
},
|
|
97
|
+
compliance_summary: this.generateComplianceSummary(result, contract),
|
|
98
|
+
metadata: {
|
|
99
|
+
formatted_at: new Date().toISOString(),
|
|
100
|
+
formatter: 'StandardVerificationFormatter',
|
|
101
|
+
format_version: '1.0.0',
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
return JSON.stringify(output, null, 2);
|
|
105
|
+
}
|
|
106
|
+
async formatAsYaml(result, contract) {
|
|
107
|
+
// Simple YAML-like format (would use proper YAML library in production)
|
|
108
|
+
const data = {
|
|
109
|
+
contract_id: contract.contract_id,
|
|
110
|
+
execution_result: result,
|
|
111
|
+
contract_verification: {
|
|
112
|
+
verification_policy: contract.verification_policy,
|
|
113
|
+
success_criteria: contract.success_criteria,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
return this.objectToYaml(data);
|
|
117
|
+
}
|
|
118
|
+
formatContractRequirementsMarkdown(contract) {
|
|
119
|
+
let section = `## Contract Requirements\n\n`;
|
|
120
|
+
section += `- **Verification Policy:** ${contract.verification_policy}\n`;
|
|
121
|
+
if (contract.tlp_classification) {
|
|
122
|
+
section += `- **TLP Classification:** ${contract.tlp_classification}\n`;
|
|
123
|
+
}
|
|
124
|
+
if (contract.timeout_ms) {
|
|
125
|
+
section += `- **Timeout:** ${contract.timeout_ms}ms\n`;
|
|
126
|
+
}
|
|
127
|
+
const criteria = contract.success_criteria;
|
|
128
|
+
if (criteria.quality_threshold !== undefined) {
|
|
129
|
+
section += `- **Quality Threshold:** ${(criteria.quality_threshold * 100).toFixed(1)}%\n`;
|
|
130
|
+
}
|
|
131
|
+
if (criteria.performance_requirements) {
|
|
132
|
+
section += `- **Performance Requirements:**\n`;
|
|
133
|
+
const perf = criteria.performance_requirements;
|
|
134
|
+
if (perf.max_execution_time_ms) {
|
|
135
|
+
section += ` - Max Execution Time: ${perf.max_execution_time_ms}ms\n`;
|
|
136
|
+
}
|
|
137
|
+
if (perf.max_memory_mb) {
|
|
138
|
+
section += ` - Max Memory: ${perf.max_memory_mb}MB\n`;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return section;
|
|
142
|
+
}
|
|
143
|
+
formatMarkdownMetrics(result) {
|
|
144
|
+
let section = '';
|
|
145
|
+
if (result.metrics.peak_memory_mb) {
|
|
146
|
+
section += `- **Peak Memory:** ${result.metrics.peak_memory_mb}MB\n`;
|
|
147
|
+
}
|
|
148
|
+
if (result.metrics.cpu_time_ms) {
|
|
149
|
+
section += `- **CPU Time:** ${result.metrics.cpu_time_ms}ms\n`;
|
|
150
|
+
}
|
|
151
|
+
return section;
|
|
152
|
+
}
|
|
153
|
+
formatMarkdownOutput(result) {
|
|
154
|
+
if (!result.success || !result.output)
|
|
155
|
+
return '';
|
|
156
|
+
return `## Task Output\n\n\`\`\`json\n${JSON.stringify(result.output, null, 2)}\n\`\`\`\n\n`;
|
|
157
|
+
}
|
|
158
|
+
formatMarkdownError(result) {
|
|
159
|
+
if (result.success || !result.error)
|
|
160
|
+
return '';
|
|
161
|
+
let section = `## Error Details\n\n`;
|
|
162
|
+
section += `- **Type:** ${result.error.type}\n`;
|
|
163
|
+
section += `- **Message:** ${result.error.message}\n`;
|
|
164
|
+
if (result.error.details) {
|
|
165
|
+
section += `- **Details:** \`${JSON.stringify(result.error.details)}\`\n`;
|
|
166
|
+
}
|
|
167
|
+
return section + '\n';
|
|
168
|
+
}
|
|
169
|
+
formatMarkdownVerification(result) {
|
|
170
|
+
if (!result.verification)
|
|
171
|
+
return '';
|
|
172
|
+
const v = result.verification;
|
|
173
|
+
let section = `## Verification Results\n\n`;
|
|
174
|
+
section += `- **Verified:** ${v.verified ? '✅ Yes' : '❌ No'}\n`;
|
|
175
|
+
section += `- **Method:** ${v.verification_method}\n`;
|
|
176
|
+
section += `- **Verified By:** ${v.verified_by}\n`;
|
|
177
|
+
if (v.quality_score !== undefined) {
|
|
178
|
+
section += `- **Quality Score:** ${(v.quality_score * 100).toFixed(1)}%\n`;
|
|
179
|
+
}
|
|
180
|
+
if (v.verification_details) {
|
|
181
|
+
section += `- **Details:** ${v.verification_details}\n`;
|
|
182
|
+
}
|
|
183
|
+
return section + '\n';
|
|
184
|
+
}
|
|
185
|
+
async formatAsMarkdown(result, contract) {
|
|
186
|
+
const status = result.success ? '✅ SUCCESS' : '❌ FAILED';
|
|
187
|
+
const complianceScore = this.calculateComplianceScore(result, contract);
|
|
188
|
+
const complianceStatus = complianceScore >= 0.8 ? '✅ COMPLIANT' : '⚠️ NON-COMPLIANT';
|
|
189
|
+
let markdown = `# Verification Report\n\n`;
|
|
190
|
+
markdown += `**Contract ID:** \`${contract.contract_id}\` \n`;
|
|
191
|
+
markdown += `**Status:** ${status} \n`;
|
|
192
|
+
markdown += `**Compliance:** ${complianceStatus} (${(complianceScore * 100).toFixed(1)}%) \n`;
|
|
193
|
+
markdown += `**Generated:** ${new Date().toISOString()} \n\n`;
|
|
194
|
+
markdown += `## Execution Summary\n\n`;
|
|
195
|
+
markdown += `- **Execution Time:** ${result.metrics.execution_time_ms}ms\n`;
|
|
196
|
+
markdown += this.formatMarkdownMetrics(result);
|
|
197
|
+
markdown += `- **Completed At:** ${result.completed_at}\n\n`;
|
|
198
|
+
markdown += this.formatMarkdownOutput(result);
|
|
199
|
+
markdown += this.formatMarkdownError(result);
|
|
200
|
+
markdown += this.formatMarkdownVerification(result);
|
|
201
|
+
markdown += this.formatContractRequirementsMarkdown(contract);
|
|
202
|
+
return markdown;
|
|
203
|
+
}
|
|
204
|
+
async formatAsHtml(result, contract) {
|
|
205
|
+
const status = result.success ? 'SUCCESS' : 'FAILED';
|
|
206
|
+
const statusClass = result.success ? 'success' : 'error';
|
|
207
|
+
const complianceScore = this.calculateComplianceScore(result, contract);
|
|
208
|
+
const complianceStatus = complianceScore >= 0.8 ? 'COMPLIANT' : 'NON-COMPLIANT';
|
|
209
|
+
const complianceClass = complianceScore >= 0.8 ? 'compliant' : 'non-compliant';
|
|
210
|
+
let html = `<!DOCTYPE html>\n<html lang="en">\n<head>\n`;
|
|
211
|
+
html += ` <meta charset="UTF-8">\n`;
|
|
212
|
+
html += ` <meta name="viewport" content="width=device-width, initial-scale=1.0">\n`;
|
|
213
|
+
html += ` <title>Verification Report - ${contract.contract_id}</title>\n`;
|
|
214
|
+
html += ` <style>\n`;
|
|
215
|
+
html += this.getHtmlStyles();
|
|
216
|
+
html += ` </style>\n</head>\n<body>\n`;
|
|
217
|
+
html += ` <div class="container">\n`;
|
|
218
|
+
html += ` <header>\n`;
|
|
219
|
+
html += ` <h1>Verification Report</h1>\n`;
|
|
220
|
+
html += ` <div class="status-bar">\n`;
|
|
221
|
+
html += ` <span class="status ${statusClass}">${status}</span>\n`;
|
|
222
|
+
html += ` <span class="compliance ${complianceClass}">${complianceStatus}</span>\n`;
|
|
223
|
+
html += ` </div>\n`;
|
|
224
|
+
html += ` </header>\n`;
|
|
225
|
+
html += ` <section class="summary">\n`;
|
|
226
|
+
html += ` <h2>Summary</h2>\n`;
|
|
227
|
+
html += ` <table>\n`;
|
|
228
|
+
html += ` <tr><td>Contract ID</td><td>${contract.contract_id}</td></tr>\n`;
|
|
229
|
+
html += ` <tr><td>Execution Time</td><td>${result.metrics.execution_time_ms}ms</td></tr>\n`;
|
|
230
|
+
html += ` <tr><td>Compliance Score</td><td>${(complianceScore * 100).toFixed(1)}%</td></tr>\n`;
|
|
231
|
+
html += ` <tr><td>Completed At</td><td>${result.completed_at}</td></tr>\n`;
|
|
232
|
+
html += ` </table>\n`;
|
|
233
|
+
html += ` </section>\n`;
|
|
234
|
+
if (result.success && result.output) {
|
|
235
|
+
html += ` <section class="output">\n`;
|
|
236
|
+
html += ` <h2>Task Output</h2>\n`;
|
|
237
|
+
html += ` <pre><code>${this.escapeHtml(JSON.stringify(result.output, null, 2))}</code></pre>\n`;
|
|
238
|
+
html += ` </section>\n`;
|
|
239
|
+
}
|
|
240
|
+
if (!result.success && result.error) {
|
|
241
|
+
html += ` <section class="error">\n`;
|
|
242
|
+
html += ` <h2>Error Details</h2>\n`;
|
|
243
|
+
html += ` <p><strong>Type:</strong> ${result.error.type}</p>\n`;
|
|
244
|
+
html += ` <p><strong>Message:</strong> ${result.error.message}</p>\n`;
|
|
245
|
+
html += ` </section>\n`;
|
|
246
|
+
}
|
|
247
|
+
html += ` </div>\n</body>\n</html>`;
|
|
248
|
+
return html;
|
|
249
|
+
}
|
|
250
|
+
async formatAsXml(result, contract) {
|
|
251
|
+
let xml = `<?xml version="1.0" encoding="UTF-8"?>\n`;
|
|
252
|
+
xml += `<verification_report contract_id="${contract.contract_id}" generated_at="${new Date().toISOString()}">\n`;
|
|
253
|
+
xml += ` <execution_result success="${result.success}">\n`;
|
|
254
|
+
xml += ` <metrics>\n`;
|
|
255
|
+
xml += ` <execution_time_ms>${result.metrics.execution_time_ms}</execution_time_ms>\n`;
|
|
256
|
+
if (result.metrics.peak_memory_mb) {
|
|
257
|
+
xml += ` <peak_memory_mb>${result.metrics.peak_memory_mb}</peak_memory_mb>\n`;
|
|
258
|
+
}
|
|
259
|
+
xml += ` </metrics>\n`;
|
|
260
|
+
if (result.success && result.output) {
|
|
261
|
+
xml += ` <output><![CDATA[${JSON.stringify(result.output)}]]></output>\n`;
|
|
262
|
+
}
|
|
263
|
+
if (result.error) {
|
|
264
|
+
xml += ` <error>\n`;
|
|
265
|
+
xml += ` <type>${result.error.type}</type>\n`;
|
|
266
|
+
xml += ` <message><![CDATA[${result.error.message}]]></message>\n`;
|
|
267
|
+
xml += ` </error>\n`;
|
|
268
|
+
}
|
|
269
|
+
xml += ` <completed_at>${result.completed_at}</completed_at>\n`;
|
|
270
|
+
xml += ` </execution_result>\n`;
|
|
271
|
+
xml += ` <contract_requirements>\n`;
|
|
272
|
+
xml += ` <verification_policy>${contract.verification_policy}</verification_policy>\n`;
|
|
273
|
+
if (contract.tlp_classification) {
|
|
274
|
+
xml += ` <tlp_classification>${contract.tlp_classification}</tlp_classification>\n`;
|
|
275
|
+
}
|
|
276
|
+
xml += ` </contract_requirements>\n`;
|
|
277
|
+
if (result.verification) {
|
|
278
|
+
xml += ` <verification verified="${result.verification.verified}">\n`;
|
|
279
|
+
xml += ` <method>${result.verification.verification_method}</method>\n`;
|
|
280
|
+
xml += ` <verified_by>${result.verification.verified_by}</verified_by>\n`;
|
|
281
|
+
if (result.verification.quality_score !== undefined) {
|
|
282
|
+
xml += ` <quality_score>${result.verification.quality_score}</quality_score>\n`;
|
|
283
|
+
}
|
|
284
|
+
xml += ` </verification>\n`;
|
|
285
|
+
}
|
|
286
|
+
xml += `</verification_report>`;
|
|
287
|
+
return xml;
|
|
288
|
+
}
|
|
289
|
+
async formatAsCsv(result, contract) {
|
|
290
|
+
const headers = [
|
|
291
|
+
'contract_id',
|
|
292
|
+
'success',
|
|
293
|
+
'execution_time_ms',
|
|
294
|
+
'peak_memory_mb',
|
|
295
|
+
'verified',
|
|
296
|
+
'quality_score',
|
|
297
|
+
'compliance_score',
|
|
298
|
+
'completed_at'
|
|
299
|
+
];
|
|
300
|
+
const complianceScore = this.calculateComplianceScore(result, contract);
|
|
301
|
+
const row = [
|
|
302
|
+
contract.contract_id,
|
|
303
|
+
result.success,
|
|
304
|
+
result.metrics.execution_time_ms,
|
|
305
|
+
result.metrics.peak_memory_mb || '',
|
|
306
|
+
result.verification?.verified || false,
|
|
307
|
+
result.verification?.quality_score || '',
|
|
308
|
+
complianceScore,
|
|
309
|
+
result.completed_at
|
|
310
|
+
];
|
|
311
|
+
return headers.join(',') + '\n' + row.join(',');
|
|
312
|
+
}
|
|
313
|
+
async formatAsPlainText(result, contract) {
|
|
314
|
+
const status = result.success ? 'SUCCESS' : 'FAILED';
|
|
315
|
+
const complianceScore = this.calculateComplianceScore(result, contract);
|
|
316
|
+
let text = `VERIFICATION REPORT\n`;
|
|
317
|
+
text += `==================\n\n`;
|
|
318
|
+
text += `Contract ID: ${contract.contract_id}\n`;
|
|
319
|
+
text += `Status: ${status}\n`;
|
|
320
|
+
text += `Compliance Score: ${(complianceScore * 100).toFixed(1)}%\n`;
|
|
321
|
+
text += `Execution Time: ${result.metrics.execution_time_ms}ms\n`;
|
|
322
|
+
text += `Completed At: ${result.completed_at}\n\n`;
|
|
323
|
+
if (result.success && result.output) {
|
|
324
|
+
text += `TASK OUTPUT:\n`;
|
|
325
|
+
text += `${JSON.stringify(result.output, null, 2)}\n\n`;
|
|
326
|
+
}
|
|
327
|
+
if (!result.success && result.error) {
|
|
328
|
+
text += `ERROR DETAILS:\n`;
|
|
329
|
+
text += `Type: ${result.error.type}\n`;
|
|
330
|
+
text += `Message: ${result.error.message}\n\n`;
|
|
331
|
+
}
|
|
332
|
+
if (result.verification) {
|
|
333
|
+
text += `VERIFICATION:\n`;
|
|
334
|
+
text += `Verified: ${result.verification.verified ? 'Yes' : 'No'}\n`;
|
|
335
|
+
text += `Method: ${result.verification.verification_method}\n`;
|
|
336
|
+
if (result.verification.quality_score !== undefined) {
|
|
337
|
+
text += `Quality Score: ${(result.verification.quality_score * 100).toFixed(1)}%\n`;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return text;
|
|
341
|
+
}
|
|
342
|
+
async formatAsContractCompliance(result, contract) {
|
|
343
|
+
const validation = this.validateContractCompliance('', contract, result);
|
|
344
|
+
const compliance = {
|
|
345
|
+
contract_id: contract.contract_id,
|
|
346
|
+
compliance_check: {
|
|
347
|
+
overall_compliant: validation.compliant,
|
|
348
|
+
compliance_score: validation.score,
|
|
349
|
+
checks_performed: validation.checks.length,
|
|
350
|
+
checks_passed: validation.checks.filter(c => c.passed).length,
|
|
351
|
+
timestamp: new Date().toISOString(),
|
|
352
|
+
},
|
|
353
|
+
detailed_checks: validation.checks.map(check => ({
|
|
354
|
+
name: check.check_name,
|
|
355
|
+
passed: check.passed,
|
|
356
|
+
severity: check.severity,
|
|
357
|
+
details: check.details,
|
|
358
|
+
})),
|
|
359
|
+
execution_summary: {
|
|
360
|
+
success: result.success,
|
|
361
|
+
execution_time_ms: result.metrics.execution_time_ms,
|
|
362
|
+
verified: result.verification?.verified || false,
|
|
363
|
+
quality_score: result.verification?.quality_score,
|
|
364
|
+
},
|
|
365
|
+
contract_termsReview: {
|
|
366
|
+
verification_policy: contract.verification_policy,
|
|
367
|
+
tlp_classification: contract.tlp_classification,
|
|
368
|
+
success_criteria_met: this.evaluateSuccessCriteria(result, contract),
|
|
369
|
+
},
|
|
370
|
+
};
|
|
371
|
+
return JSON.stringify(compliance, null, 2);
|
|
372
|
+
}
|
|
373
|
+
// Helper methods
|
|
374
|
+
getFormatMetadata(format, result, contract) {
|
|
375
|
+
const base = {
|
|
376
|
+
format_type: format,
|
|
377
|
+
includes_timing: this.config.metadata_options.include_timing_data,
|
|
378
|
+
includes_resources: this.config.metadata_options.include_resource_usage,
|
|
379
|
+
};
|
|
380
|
+
switch (format) {
|
|
381
|
+
case 'html':
|
|
382
|
+
return { ...base, has_styling: true, interactive: false };
|
|
383
|
+
case 'json':
|
|
384
|
+
return { ...base, structured: true, machine_readable: true };
|
|
385
|
+
case 'markdown':
|
|
386
|
+
return { ...base, human_readable: true, renderable: true };
|
|
387
|
+
case 'csv':
|
|
388
|
+
return { ...base, tabular: true, header_row: true };
|
|
389
|
+
case 'contract_compliance':
|
|
390
|
+
return { ...base, compliance_focused: true, audit_ready: true };
|
|
391
|
+
default:
|
|
392
|
+
return base;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
generateComplianceSummary(result, contract) {
|
|
396
|
+
const validation = this.validateContractCompliance('', contract, result);
|
|
397
|
+
return {
|
|
398
|
+
compliant: validation.compliant,
|
|
399
|
+
score: validation.score,
|
|
400
|
+
checks_total: validation.checks.length,
|
|
401
|
+
checks_passed: validation.checks.filter(c => c.passed).length,
|
|
402
|
+
major_issues: validation.checks.filter(c => !c.passed && c.severity === 'error').length,
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
calculateComplianceScore(result, contract) {
|
|
406
|
+
const validation = this.validateContractCompliance('', contract, result);
|
|
407
|
+
return validation.score;
|
|
408
|
+
}
|
|
409
|
+
evaluateSuccessCriteria(result, contract) {
|
|
410
|
+
const validation = this.validateContractCompliance('', contract, result);
|
|
411
|
+
return validation.compliant && result.success;
|
|
412
|
+
}
|
|
413
|
+
objectToYaml(obj, indent = 0) {
|
|
414
|
+
let yaml = '';
|
|
415
|
+
const spaces = ' '.repeat(indent);
|
|
416
|
+
if (Array.isArray(obj)) {
|
|
417
|
+
for (const item of obj) {
|
|
418
|
+
yaml += `${spaces}- ${this.objectToYaml(item, indent + 1)}\n`;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
else if (obj && typeof obj === 'object') {
|
|
422
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
423
|
+
if (typeof value === 'object' && value !== null) {
|
|
424
|
+
yaml += `${spaces}${key}:\n${this.objectToYaml(value, indent + 1)}`;
|
|
425
|
+
}
|
|
426
|
+
else {
|
|
427
|
+
yaml += `${spaces}${key}: ${value}\n`;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
return String(obj);
|
|
433
|
+
}
|
|
434
|
+
return yaml;
|
|
435
|
+
}
|
|
436
|
+
getHtmlStyles() {
|
|
437
|
+
return `
|
|
438
|
+
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; margin: 0; padding: 20px; background: #f5f5f5; }
|
|
439
|
+
.container { max-width: 1200px; margin: 0 auto; background: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); overflow: hidden; }
|
|
440
|
+
header { background: #2563eb; color: white; padding: 20px; }
|
|
441
|
+
header h1 { margin: 0; font-size: 24px; }
|
|
442
|
+
.status-bar { margin-top: 10px; }
|
|
443
|
+
.status, .compliance { padding: 4px 12px; border-radius: 4px; font-weight: bold; margin-right: 10px; }
|
|
444
|
+
.success { background: #10b981; }
|
|
445
|
+
.error { background: #ef4444; }
|
|
446
|
+
.compliant { background: #10b981; }
|
|
447
|
+
.non-compliant { background: #f59e0b; }
|
|
448
|
+
section { padding: 20px; border-bottom: 1px solid #e5e7eb; }
|
|
449
|
+
section:last-child { border-bottom: none; }
|
|
450
|
+
h2 { margin-top: 0; color: #1f2937; }
|
|
451
|
+
table { width: 100%; border-collapse: collapse; }
|
|
452
|
+
td { padding: 8px; border-bottom: 1px solid #e5e7eb; }
|
|
453
|
+
td:first-child { font-weight: bold; width: 200px; }
|
|
454
|
+
pre { background: #f3f4f6; padding: 15px; border-radius: 4px; overflow-x: auto; }
|
|
455
|
+
code { font-family: 'SF Mono', Monaco, monospace; }
|
|
456
|
+
.error { background: #fef2f2; border-left: 4px solid #ef4444; }
|
|
457
|
+
`;
|
|
458
|
+
}
|
|
459
|
+
escapeHtml(text) {
|
|
460
|
+
const htmlEscapes = {
|
|
461
|
+
'&': '&',
|
|
462
|
+
'<': '<',
|
|
463
|
+
'>': '>',
|
|
464
|
+
'"': '"',
|
|
465
|
+
"'": ''',
|
|
466
|
+
};
|
|
467
|
+
return text.replace(/[&<>"']/g, (match) => htmlEscapes[match] || match);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Specialized contract compliance formatter
|
|
472
|
+
*
|
|
473
|
+
* Focused specifically on contract compliance verification with
|
|
474
|
+
* detailed audit trails and regulatory compliance features.
|
|
475
|
+
*/
|
|
476
|
+
export class ContractComplianceFormatter extends BaseVerificationFormatter {
|
|
477
|
+
async formatOutput(result, contract, format) {
|
|
478
|
+
// Always output in contract compliance format regardless of requested format
|
|
479
|
+
const content = await this.generateComplianceReport(result, contract);
|
|
480
|
+
const validation = this.validateContractCompliance(content, contract, result);
|
|
481
|
+
return {
|
|
482
|
+
format: 'contract_compliance',
|
|
483
|
+
mime_type: 'application/vnd.dcyfr.verification+json',
|
|
484
|
+
content,
|
|
485
|
+
metadata: {
|
|
486
|
+
formatted_at: new Date().toISOString(),
|
|
487
|
+
formatter_version: '1.0.0',
|
|
488
|
+
contract_id: contract.contract_id,
|
|
489
|
+
content_size_bytes: content.length,
|
|
490
|
+
content_hash: this.config.include_content_hash ? this.calculateContentHash(content) : undefined,
|
|
491
|
+
format_metadata: {
|
|
492
|
+
compliance_focused: true,
|
|
493
|
+
audit_ready: true,
|
|
494
|
+
regulatory_compliant: true,
|
|
495
|
+
tlp_classified: true,
|
|
496
|
+
},
|
|
497
|
+
},
|
|
498
|
+
validation: {
|
|
499
|
+
contract_compliant: validation.compliant,
|
|
500
|
+
compliance_checks: validation.checks,
|
|
501
|
+
compliance_score: validation.score,
|
|
502
|
+
},
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
async generateComplianceReport(result, contract) {
|
|
506
|
+
const validation = this.validateContractCompliance('', contract, result);
|
|
507
|
+
const timestamp = new Date().toISOString();
|
|
508
|
+
const report = {
|
|
509
|
+
compliance_report: {
|
|
510
|
+
header: {
|
|
511
|
+
report_id: this.generateReportId(),
|
|
512
|
+
contract_id: contract.contract_id,
|
|
513
|
+
generated_at: timestamp,
|
|
514
|
+
report_type: 'delegation_contract_compliance',
|
|
515
|
+
tlp_classification: contract.tlp_classification || 'TLP:AMBER',
|
|
516
|
+
formatter_version: '1.0.0',
|
|
517
|
+
},
|
|
518
|
+
executive_summary: {
|
|
519
|
+
overall_compliance: validation.compliant ? 'COMPLIANT' : 'NON_COMPLIANT',
|
|
520
|
+
compliance_score: validation.score,
|
|
521
|
+
total_checks: validation.checks.length,
|
|
522
|
+
passed_checks: validation.checks.filter(c => c.passed).length,
|
|
523
|
+
critical_failures: validation.checks.filter(c => !c.passed && c.severity === 'error').length,
|
|
524
|
+
recommendation: validation.compliant ? 'Contract terms satisfied' : 'Review and address compliance failures',
|
|
525
|
+
},
|
|
526
|
+
contract_analysis: {
|
|
527
|
+
contract_terms: {
|
|
528
|
+
verification_policy: contract.verification_policy,
|
|
529
|
+
tlp_classification: contract.tlp_classification,
|
|
530
|
+
timeout_ms: contract.timeout_ms,
|
|
531
|
+
success_criteria: contract.success_criteria,
|
|
532
|
+
},
|
|
533
|
+
execution_analysis: {
|
|
534
|
+
task_success: result.success,
|
|
535
|
+
execution_time_ms: result.metrics.execution_time_ms,
|
|
536
|
+
within_timeout: contract.timeout_ms ? result.metrics.execution_time_ms <= contract.timeout_ms : true,
|
|
537
|
+
resource_usage: {
|
|
538
|
+
peak_memory_mb: result.metrics.peak_memory_mb,
|
|
539
|
+
cpu_time_ms: result.metrics.cpu_time_ms,
|
|
540
|
+
network_bytes: result.metrics.network_bytes,
|
|
541
|
+
},
|
|
542
|
+
},
|
|
543
|
+
verification_analysis: result.verification ? {
|
|
544
|
+
verified: result.verification.verified,
|
|
545
|
+
verification_method: result.verification.verification_method,
|
|
546
|
+
quality_score: result.verification.quality_score,
|
|
547
|
+
verified_by: result.verification.verified_by,
|
|
548
|
+
verification_details: result.verification.verification_details,
|
|
549
|
+
} : {
|
|
550
|
+
verified: false,
|
|
551
|
+
note: 'No verification performed',
|
|
552
|
+
},
|
|
553
|
+
},
|
|
554
|
+
detailed_compliance_checks: validation.checks.map((check, index) => ({
|
|
555
|
+
check_number: index + 1,
|
|
556
|
+
check_name: check.check_name,
|
|
557
|
+
requirement: this.getCheckRequirement(check.check_name, contract),
|
|
558
|
+
status: check.passed ? 'PASS' : 'FAIL',
|
|
559
|
+
severity: check.severity.toUpperCase(),
|
|
560
|
+
details: check.details,
|
|
561
|
+
remediation: check.passed ? null : this.getRemediation(check.check_name),
|
|
562
|
+
})),
|
|
563
|
+
audit_trail: {
|
|
564
|
+
task_execution: {
|
|
565
|
+
started_at: result.context.metadata.started_at,
|
|
566
|
+
completed_at: result.completed_at,
|
|
567
|
+
execution_context: {
|
|
568
|
+
execution_id: result.context.execution_id,
|
|
569
|
+
task_description: result.context.task?.description,
|
|
570
|
+
delegation_contract_id: contract.contract_id,
|
|
571
|
+
},
|
|
572
|
+
},
|
|
573
|
+
compliance_evaluation: {
|
|
574
|
+
evaluation_timestamp: timestamp,
|
|
575
|
+
evaluation_method: 'automated_contract_validation',
|
|
576
|
+
evaluator: 'ContractComplianceFormatter',
|
|
577
|
+
evaluation_criteria: Object.keys(contract.success_criteria),
|
|
578
|
+
},
|
|
579
|
+
},
|
|
580
|
+
recommendations: this.generateRecommendations(validation, result, contract),
|
|
581
|
+
appendix: {
|
|
582
|
+
raw_execution_result: this.config.metadata_options.include_error_details ? result : {
|
|
583
|
+
success: result.success,
|
|
584
|
+
metrics: result.metrics,
|
|
585
|
+
completed_at: result.completed_at,
|
|
586
|
+
},
|
|
587
|
+
contract_metadata: {
|
|
588
|
+
created_at: contract.created_at,
|
|
589
|
+
delegator_agent_id: contract.delegator_agent_id,
|
|
590
|
+
delegatee_agent_id: contract.delegatee_agent_id,
|
|
591
|
+
},
|
|
592
|
+
},
|
|
593
|
+
},
|
|
594
|
+
};
|
|
595
|
+
return JSON.stringify(report, null, 2);
|
|
596
|
+
}
|
|
597
|
+
getCheckRequirement(checkName, contract) {
|
|
598
|
+
const requirements = {
|
|
599
|
+
'output_schema_compliance': 'Task output must conform to contract-specified schema',
|
|
600
|
+
'performance_requirements': 'Task execution must meet performance criteria',
|
|
601
|
+
'quality_threshold': `Quality score must meet or exceed ${contract.success_criteria.quality_threshold || 0}`,
|
|
602
|
+
'output_format_compliance': 'Output must be in required format(s)',
|
|
603
|
+
};
|
|
604
|
+
return requirements[checkName] || 'Contract requirement validation';
|
|
605
|
+
}
|
|
606
|
+
getRemediation(checkName) {
|
|
607
|
+
const remediations = {
|
|
608
|
+
'output_schema_compliance': 'Review task output structure and ensure all required fields are present',
|
|
609
|
+
'performance_requirements': 'Optimize task execution or request timeout extension',
|
|
610
|
+
'quality_threshold': 'Improve task implementation or review quality metrics',
|
|
611
|
+
'output_format_compliance': 'Convert output to required format(s)',
|
|
612
|
+
};
|
|
613
|
+
return remediations[checkName] || 'Review contract requirements and adjust implementation';
|
|
614
|
+
}
|
|
615
|
+
generateRecommendations(validation, result, contract) {
|
|
616
|
+
const recommendations = [];
|
|
617
|
+
if (!validation.compliant) {
|
|
618
|
+
recommendations.push({
|
|
619
|
+
type: 'compliance',
|
|
620
|
+
priority: 'HIGH',
|
|
621
|
+
description: 'Address compliance failures before considering task complete',
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
if (!result.success) {
|
|
625
|
+
recommendations.push({
|
|
626
|
+
type: 'execution',
|
|
627
|
+
priority: 'CRITICAL',
|
|
628
|
+
description: 'Task execution failed - review error details and retry',
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
if (validation.score < 0.5) {
|
|
632
|
+
recommendations.push({
|
|
633
|
+
type: 'quality',
|
|
634
|
+
priority: 'HIGH',
|
|
635
|
+
description: 'Low compliance score indicates significant issues',
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
if (contract.timeout_ms && result.metrics.execution_time_ms > (contract.timeout_ms * 0.8)) {
|
|
639
|
+
recommendations.push({
|
|
640
|
+
type: 'performance',
|
|
641
|
+
priority: 'MEDIUM',
|
|
642
|
+
description: 'Execution time approaching timeout limit',
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
if (validation.compliant && result.success) {
|
|
646
|
+
recommendations.push({
|
|
647
|
+
type: 'success',
|
|
648
|
+
priority: 'INFO',
|
|
649
|
+
description: 'All contract requirements satisfied',
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
return recommendations;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
//# sourceMappingURL=multi-modal-formatters.js.map
|