@llm-dev-ops/agentics-cli 1.4.32 → 1.4.34
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/agents/repo-agent-runner.d.ts +10 -0
- package/dist/agents/repo-agent-runner.d.ts.map +1 -1
- package/dist/agents/repo-agent-runner.js +264 -11
- package/dist/agents/repo-agent-runner.js.map +1 -1
- package/dist/bundled-agents/analytics-hub-agents/package-lock.json +154 -174
- package/dist/bundled-agents/auto-optimizer-agents/package-lock.json +9226 -0
- package/dist/bundled-agents/benchmark-exchange-agents/package-lock.json +16 -0
- package/dist/bundled-agents/copilot-agents/functions/package-lock.json +5473 -0
- package/dist/bundled-agents/copilot-agents/functions/src/claude.ts +71 -0
- package/dist/bundled-agents/copilot-agents/package-lock.json +11825 -0
- package/dist/bundled-agents/incident-manager-agents/functions/src/claude.ts +71 -0
- package/dist/bundled-agents/incident-manager-agents/package-lock.json +48 -3
- package/dist/bundled-agents/inference-gateway-agents/package-lock.json +0 -3
- package/dist/bundled-agents/latency-lens-agents/package-lock.json +11825 -0
- package/dist/bundled-agents/memory-graph-agents/package-lock.json +1 -3
- package/dist/bundled-agents/observatory-agents/package-lock.json +1710 -0
- package/dist/bundled-agents/orchestrator-agents/package-lock.json +13254 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/approval-routing/agent.d.ts +144 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/approval-routing/agent.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/approval-routing/agent.js +730 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/approval-routing/agent.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/approval-routing/handler.d.ts +57 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/approval-routing/handler.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/approval-routing/handler.js +286 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/approval-routing/handler.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/approval-routing/index.d.ts +5 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/approval-routing/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/approval-routing/index.js +21 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/approval-routing/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/constraint-solver/agent.d.ts +106 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/constraint-solver/agent.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/constraint-solver/agent.js +552 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/constraint-solver/agent.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/constraint-solver/handler.d.ts +51 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/constraint-solver/handler.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/constraint-solver/handler.js +209 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/constraint-solver/handler.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/constraint-solver/index.d.ts +8 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/constraint-solver/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/constraint-solver/index.js +20 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/constraint-solver/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/contracts/approval-routing.d.ts +246 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/contracts/approval-routing.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/contracts/approval-routing.js +15 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/contracts/approval-routing.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/contracts/constraint-solver.d.ts +131 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/contracts/constraint-solver.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/contracts/constraint-solver.js +15 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/contracts/constraint-solver.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/contracts/decision-event.d.ts +207 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/contracts/decision-event.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/contracts/decision-event.js +14 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/contracts/decision-event.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/contracts/index.d.ts +11 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/contracts/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/contracts/index.js +27 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/contracts/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/index.d.ts +13 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/index.js +52 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/policy-enforcement/agent.d.ts +97 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/policy-enforcement/agent.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/policy-enforcement/agent.js +521 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/policy-enforcement/agent.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/policy-enforcement/handler.d.ts +52 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/policy-enforcement/handler.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/policy-enforcement/handler.js +216 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/policy-enforcement/handler.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/policy-enforcement/index.d.ts +8 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/policy-enforcement/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/policy-enforcement/index.js +24 -0
- package/dist/bundled-agents/policy-engine-agents/dist/agents/policy-enforcement/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/middleware/auth.d.ts +39 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/middleware/auth.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/middleware/auth.js +194 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/middleware/auth.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/middleware/error-handler.d.ts +22 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/middleware/error-handler.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/middleware/error-handler.js +124 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/middleware/error-handler.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/middleware/rate-limit.d.ts +40 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/middleware/rate-limit.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/middleware/rate-limit.js +154 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/middleware/rate-limit.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/agents.d.ts +3 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/agents.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/agents.js +111 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/agents.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/approval-routing.d.ts +3 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/approval-routing.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/approval-routing.js +135 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/approval-routing.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/constraint-solver.d.ts +3 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/constraint-solver.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/constraint-solver.js +51 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/constraint-solver.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/evaluations.d.ts +3 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/evaluations.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/evaluations.js +311 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/evaluations.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/internal-evaluate.d.ts +3 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/internal-evaluate.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/internal-evaluate.js +133 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/internal-evaluate.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/policies.d.ts +3 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/policies.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/policies.js +602 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/routes/policies.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/server.d.ts +8 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/server.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/server.js +195 -0
- package/dist/bundled-agents/policy-engine-agents/dist/api/server.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/cache/cache-manager.d.ts +77 -0
- package/dist/bundled-agents/policy-engine-agents/dist/cache/cache-manager.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/cache/cache-manager.js +254 -0
- package/dist/bundled-agents/policy-engine-agents/dist/cache/cache-manager.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/cache/l1/memory-cache.d.ts +68 -0
- package/dist/bundled-agents/policy-engine-agents/dist/cache/l1/memory-cache.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/cache/l1/memory-cache.js +170 -0
- package/dist/bundled-agents/policy-engine-agents/dist/cache/l1/memory-cache.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/cache/l2/redis-cache.d.ts +71 -0
- package/dist/bundled-agents/policy-engine-agents/dist/cache/l2/redis-cache.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/cache/l2/redis-cache.js +260 -0
- package/dist/bundled-agents/policy-engine-agents/dist/cache/l2/redis-cache.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/cli/index.d.ts +3 -0
- package/dist/bundled-agents/policy-engine-agents/dist/cli/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/cli/index.js +794 -0
- package/dist/bundled-agents/policy-engine-agents/dist/cli/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/commands/agent.d.ts +46 -0
- package/dist/bundled-agents/policy-engine-agents/dist/commands/agent.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/commands/agent.js +278 -0
- package/dist/bundled-agents/policy-engine-agents/dist/commands/agent.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/commands/approval-routing.d.ts +69 -0
- package/dist/bundled-agents/policy-engine-agents/dist/commands/approval-routing.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/commands/approval-routing.js +425 -0
- package/dist/bundled-agents/policy-engine-agents/dist/commands/approval-routing.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/commands/index.d.ts +21 -0
- package/dist/bundled-agents/policy-engine-agents/dist/commands/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/commands/index.js +50 -0
- package/dist/bundled-agents/policy-engine-agents/dist/commands/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/commands/policy.d.ts +65 -0
- package/dist/bundled-agents/policy-engine-agents/dist/commands/policy.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/commands/policy.js +330 -0
- package/dist/bundled-agents/policy-engine-agents/dist/commands/policy.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/engine/policy-engine.d.ts +45 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/engine/policy-engine.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/engine/policy-engine.js +210 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/engine/policy-engine.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/evaluator/condition-evaluator.d.ts +64 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/evaluator/condition-evaluator.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/evaluator/condition-evaluator.js +190 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/evaluator/condition-evaluator.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/index.d.ts +13 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/index.js +29 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/parser/index.d.ts +17 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/parser/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/parser/index.js +65 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/parser/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/parser/json-parser.d.ts +9 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/parser/json-parser.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/parser/json-parser.js +65 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/parser/json-parser.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/parser/yaml-parser.d.ts +6 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/parser/yaml-parser.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/parser/yaml-parser.js +69 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/parser/yaml-parser.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/primitives/cost-calculator.d.ts +52 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/primitives/cost-calculator.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/primitives/cost-calculator.js +169 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/primitives/cost-calculator.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/primitives/index.d.ts +7 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/primitives/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/primitives/index.js +23 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/primitives/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/primitives/pii-detector.d.ts +43 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/primitives/pii-detector.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/primitives/pii-detector.js +137 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/primitives/pii-detector.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/primitives/token-counter.d.ts +32 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/primitives/token-counter.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/primitives/token-counter.js +90 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/primitives/token-counter.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/validator/schema-validator.d.ts +10 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/validator/schema-validator.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/validator/schema-validator.js +106 -0
- package/dist/bundled-agents/policy-engine-agents/dist/core/validator/schema-validator.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/client.d.ts +32 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/client.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/client.js +108 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/client.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/migrate.d.ts +45 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/migrate.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/migrate.js +407 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/migrate.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/models/api-key-repository.d.ts +85 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/models/api-key-repository.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/models/api-key-repository.js +248 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/models/api-key-repository.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/models/evaluation-repository.d.ts +65 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/models/evaluation-repository.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/models/evaluation-repository.js +192 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/models/evaluation-repository.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/models/policy-repository.d.ts +32 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/models/policy-repository.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/models/policy-repository.js +163 -0
- package/dist/bundled-agents/policy-engine-agents/dist/db/models/policy-repository.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/context.d.ts +28 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/context.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/context.js +46 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/context.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/errors.d.ts +21 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/errors.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/errors.js +32 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/errors.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/executor.d.ts +45 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/executor.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/executor.js +96 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/executor.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/index.d.ts +21 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/index.js +40 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/middleware.d.ts +22 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/middleware.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/middleware.js +49 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/middleware.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/spans.d.ts +34 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/spans.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/spans.js +82 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/spans.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/types.d.ts +86 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/types.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/types.js +10 -0
- package/dist/bundled-agents/policy-engine-agents/dist/execution/types.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/functions/handler.d.ts +2 -0
- package/dist/bundled-agents/policy-engine-agents/dist/functions/handler.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/functions/handler.js +207 -0
- package/dist/bundled-agents/policy-engine-agents/dist/functions/handler.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/contracts/governance-signals.d.ts +234 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/contracts/governance-signals.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/contracts/governance-signals.js +40 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/contracts/governance-signals.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/contracts/index.d.ts +5 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/contracts/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/contracts/index.js +21 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/contracts/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/emitters/governance-signal-emitter.d.ts +137 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/emitters/governance-signal-emitter.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/emitters/governance-signal-emitter.js +342 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/emitters/governance-signal-emitter.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/emitters/index.d.ts +5 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/emitters/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/emitters/index.js +10 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/emitters/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/index.d.ts +49 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/index.js +91 -0
- package/dist/bundled-agents/policy-engine-agents/dist/governance/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/grpc/server.d.ts +8 -0
- package/dist/bundled-agents/policy-engine-agents/dist/grpc/server.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/grpc/server.js +137 -0
- package/dist/bundled-agents/policy-engine-agents/dist/grpc/server.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/grpc/services/policy-service.d.ts +47 -0
- package/dist/bundled-agents/policy-engine-agents/dist/grpc/services/policy-service.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/grpc/services/policy-service.js +353 -0
- package/dist/bundled-agents/policy-engine-agents/dist/grpc/services/policy-service.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/index.d.ts +56 -0
- package/dist/bundled-agents/policy-engine-agents/dist/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/index.js +130 -0
- package/dist/bundled-agents/policy-engine-agents/dist/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/config-manager/client.d.ts +115 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/config-manager/client.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/config-manager/client.js +256 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/config-manager/client.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/config-manager/index.d.ts +6 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/config-manager/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/config-manager/index.js +22 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/config-manager/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/costops/client.d.ts +69 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/costops/client.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/costops/client.js +179 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/costops/client.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/edge/client.d.ts +57 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/edge/client.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/edge/client.js +191 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/edge/client.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/governance/client.d.ts +63 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/governance/client.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/governance/client.js +163 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/governance/client.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/observatory/client.d.ts +174 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/observatory/client.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/observatory/client.js +243 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/observatory/client.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/observatory/index.d.ts +6 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/observatory/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/observatory/index.js +22 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/observatory/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/ruvector-service/client.d.ts +164 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/ruvector-service/client.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/ruvector-service/client.js +293 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/ruvector-service/client.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/ruvector-service/index.d.ts +7 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/ruvector-service/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/ruvector-service/index.js +23 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/ruvector-service/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/schema-registry/client.d.ts +94 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/schema-registry/client.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/schema-registry/client.js +174 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/schema-registry/client.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/schema-registry/index.d.ts +6 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/schema-registry/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/schema-registry/index.js +22 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/schema-registry/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/shield/client.d.ts +40 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/shield/client.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/shield/client.js +125 -0
- package/dist/bundled-agents/policy-engine-agents/dist/integrations/shield/client.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/observability/metrics.d.ts +66 -0
- package/dist/bundled-agents/policy-engine-agents/dist/observability/metrics.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/observability/metrics.js +197 -0
- package/dist/bundled-agents/policy-engine-agents/dist/observability/metrics.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/observability/tracing.d.ts +52 -0
- package/dist/bundled-agents/policy-engine-agents/dist/observability/tracing.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/observability/tracing.js +219 -0
- package/dist/bundled-agents/policy-engine-agents/dist/observability/tracing.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/agentics-identity.d.ts +69 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/agentics-identity.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/agentics-identity.js +280 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/agentics-identity.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/audit-trail.d.ts +82 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/audit-trail.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/audit-trail.js +234 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/audit-trail.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/index.d.ts +18 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/index.js +71 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/metrics.d.ts +96 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/metrics.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/metrics.js +189 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/metrics.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/policy-governance.d.ts +69 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/policy-governance.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/policy-governance.js +327 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/policy-governance.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/rate-limiter.d.ts +40 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/rate-limiter.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/rate-limiter.js +147 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/rate-limiter.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/versioned-policy-repository.d.ts +70 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/versioned-policy-repository.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/versioned-policy-repository.js +336 -0
- package/dist/bundled-agents/policy-engine-agents/dist/security/versioned-policy-repository.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/synthesis/builder.d.ts +80 -0
- package/dist/bundled-agents/policy-engine-agents/dist/synthesis/builder.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/synthesis/builder.js +756 -0
- package/dist/bundled-agents/policy-engine-agents/dist/synthesis/builder.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/synthesis/index.d.ts +7 -0
- package/dist/bundled-agents/policy-engine-agents/dist/synthesis/index.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/synthesis/index.js +23 -0
- package/dist/bundled-agents/policy-engine-agents/dist/synthesis/index.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/synthesis/types.d.ts +162 -0
- package/dist/bundled-agents/policy-engine-agents/dist/synthesis/types.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/synthesis/types.js +7 -0
- package/dist/bundled-agents/policy-engine-agents/dist/synthesis/types.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/test/setup.d.ts +15 -0
- package/dist/bundled-agents/policy-engine-agents/dist/test/setup.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/test/setup.js +138 -0
- package/dist/bundled-agents/policy-engine-agents/dist/test/setup.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/types/config.d.ts +69 -0
- package/dist/bundled-agents/policy-engine-agents/dist/types/config.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/types/config.js +6 -0
- package/dist/bundled-agents/policy-engine-agents/dist/types/config.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/types/policy.d.ts +152 -0
- package/dist/bundled-agents/policy-engine-agents/dist/types/policy.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/types/policy.js +38 -0
- package/dist/bundled-agents/policy-engine-agents/dist/types/policy.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/utils/config.d.ts +4 -0
- package/dist/bundled-agents/policy-engine-agents/dist/utils/config.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/utils/config.js +71 -0
- package/dist/bundled-agents/policy-engine-agents/dist/utils/config.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/utils/errors.d.ts +37 -0
- package/dist/bundled-agents/policy-engine-agents/dist/utils/errors.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/utils/errors.js +84 -0
- package/dist/bundled-agents/policy-engine-agents/dist/utils/errors.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/utils/logger.d.ts +8 -0
- package/dist/bundled-agents/policy-engine-agents/dist/utils/logger.d.ts.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/dist/utils/logger.js +36 -0
- package/dist/bundled-agents/policy-engine-agents/dist/utils/logger.js.map +1 -0
- package/dist/bundled-agents/policy-engine-agents/package-lock.json +15388 -0
- package/dist/bundled-agents/registry-agents/functions/src/claude.ts +71 -0
- package/dist/bundled-agents/schema-registry-agents/package-lock.json +3 -0
- package/dist/bundled-agents/sentinel-agents/package-lock.json +2 -438
- package/dist/bundled-agents/simulator-agents/package-lock.json +0 -428
- package/dist/bundled-agents/test-bench-agents/package-lock.json +0 -3
- package/package.json +1 -1
|
@@ -0,0 +1,756 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Executive Synthesis Builder
|
|
4
|
+
* Builds executive summaries for policy operations
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.buildExecutiveSummary = buildExecutiveSummary;
|
|
8
|
+
exports.elevateRiskForProduction = elevateRiskForProduction;
|
|
9
|
+
exports.elevateRiskForPolicyType = elevateRiskForPolicyType;
|
|
10
|
+
exports.elevateRiskForEnabling = elevateRiskForEnabling;
|
|
11
|
+
exports.extractBlockingIssues = extractBlockingIssues;
|
|
12
|
+
exports.buildPolicyCreateSynthesis = buildPolicyCreateSynthesis;
|
|
13
|
+
exports.buildPolicyEditSynthesis = buildPolicyEditSynthesis;
|
|
14
|
+
exports.buildPolicyToggleSynthesis = buildPolicyToggleSynthesis;
|
|
15
|
+
exports.calculateSuccessRate = calculateSuccessRate;
|
|
16
|
+
exports.isProductionTarget = isProductionTarget;
|
|
17
|
+
exports.buildDecisionPacket = buildDecisionPacket;
|
|
18
|
+
exports.buildConflictAnalysis = buildConflictAnalysis;
|
|
19
|
+
exports.buildEnforcementImpact = buildEnforcementImpact;
|
|
20
|
+
exports.buildRollbackInstructions = buildRollbackInstructions;
|
|
21
|
+
exports.buildViolationPredictions = buildViolationPredictions;
|
|
22
|
+
exports.buildPolicyDryRunSynthesis = buildPolicyDryRunSynthesis;
|
|
23
|
+
const policy_1 = require("../types/policy");
|
|
24
|
+
/**
|
|
25
|
+
* Build an executive summary for policy operations
|
|
26
|
+
*/
|
|
27
|
+
function buildExecutiveSummary(deployRef, metrics, stepsExecuted) {
|
|
28
|
+
const deploy_reference = {
|
|
29
|
+
environment: deployRef.environment || 'production',
|
|
30
|
+
timestamp: deployRef.timestamp || new Date().toISOString(),
|
|
31
|
+
version: deployRef.version,
|
|
32
|
+
commit_sha: deployRef.commit_sha,
|
|
33
|
+
};
|
|
34
|
+
const iteration_metrics = {
|
|
35
|
+
success_rate: metrics.success_rate ?? 1.0,
|
|
36
|
+
failed_iterations: metrics.failed_iterations ?? 0,
|
|
37
|
+
blocking_issues: metrics.blocking_issues ?? [],
|
|
38
|
+
steps_executed: stepsExecuted,
|
|
39
|
+
};
|
|
40
|
+
const risk_level = calculateRiskLevel(iteration_metrics);
|
|
41
|
+
const recommendation = determineRecommendation(iteration_metrics, risk_level);
|
|
42
|
+
const rationale = buildRationale(iteration_metrics, risk_level, recommendation);
|
|
43
|
+
return {
|
|
44
|
+
deploy_reference,
|
|
45
|
+
iteration_metrics,
|
|
46
|
+
risk_level,
|
|
47
|
+
recommendation,
|
|
48
|
+
rationale,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Elevate risk level for production environments
|
|
53
|
+
*/
|
|
54
|
+
function elevateRiskForProduction(summary) {
|
|
55
|
+
if (summary.deploy_reference.environment === 'production') {
|
|
56
|
+
if (summary.risk_level === 'low') {
|
|
57
|
+
summary.risk_level = 'medium';
|
|
58
|
+
}
|
|
59
|
+
else if (summary.risk_level === 'medium') {
|
|
60
|
+
summary.risk_level = 'high';
|
|
61
|
+
}
|
|
62
|
+
summary.rationale = `[Production Environment] ${summary.rationale}`;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Elevate risk for security and compliance policy types
|
|
67
|
+
*/
|
|
68
|
+
function elevateRiskForPolicyType(summary, policyType) {
|
|
69
|
+
if (policyType === 'security' || policyType === 'compliance') {
|
|
70
|
+
if (summary.risk_level === 'low') {
|
|
71
|
+
summary.risk_level = 'high';
|
|
72
|
+
}
|
|
73
|
+
else if (summary.risk_level === 'medium') {
|
|
74
|
+
summary.risk_level = 'high';
|
|
75
|
+
}
|
|
76
|
+
summary.rationale = `[${policyType.charAt(0).toUpperCase() + policyType.slice(1)} Policy] ${summary.rationale}`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Elevate risk when enabling a policy (vs creating draft)
|
|
81
|
+
*/
|
|
82
|
+
function elevateRiskForEnabling(summary) {
|
|
83
|
+
if (summary.risk_level === 'low') {
|
|
84
|
+
summary.risk_level = 'medium';
|
|
85
|
+
}
|
|
86
|
+
else if (summary.risk_level === 'medium') {
|
|
87
|
+
summary.risk_level = 'high';
|
|
88
|
+
}
|
|
89
|
+
summary.rationale = `[Enabling Policy] ${summary.rationale}`;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Extract blocking issues from policy validation
|
|
93
|
+
*/
|
|
94
|
+
function extractBlockingIssues(policy, validationErrors) {
|
|
95
|
+
const issues = [];
|
|
96
|
+
// Check for validation errors
|
|
97
|
+
for (const error of validationErrors) {
|
|
98
|
+
issues.push({
|
|
99
|
+
type: 'validation_error',
|
|
100
|
+
severity: 'high',
|
|
101
|
+
description: error,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
// Check for deny actions on critical resources
|
|
105
|
+
for (const rule of policy.rules) {
|
|
106
|
+
if (rule.action.decision === policy_1.DecisionType.DENY) {
|
|
107
|
+
const isCritical = isCriticalResource(rule);
|
|
108
|
+
if (isCritical) {
|
|
109
|
+
issues.push({
|
|
110
|
+
type: 'deny_action',
|
|
111
|
+
severity: 'critical',
|
|
112
|
+
description: `Deny action on critical resource in rule: ${rule.name}`,
|
|
113
|
+
rule_id: rule.id,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// Check for conflicting rule priorities
|
|
119
|
+
const priorityConflicts = findPriorityConflicts(policy.rules);
|
|
120
|
+
for (const conflict of priorityConflicts) {
|
|
121
|
+
issues.push({
|
|
122
|
+
type: 'conflicting_priorities',
|
|
123
|
+
severity: 'high',
|
|
124
|
+
description: conflict.description,
|
|
125
|
+
rule_id: conflict.rule_ids.join(', '),
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
// Check for missing required conditions
|
|
129
|
+
for (const rule of policy.rules) {
|
|
130
|
+
if (!hasRequiredConditions(rule)) {
|
|
131
|
+
issues.push({
|
|
132
|
+
type: 'missing_conditions',
|
|
133
|
+
severity: 'medium',
|
|
134
|
+
description: `Rule ${rule.name} is missing required conditions`,
|
|
135
|
+
rule_id: rule.id,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return issues;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Build synthesis for policy creation
|
|
143
|
+
*/
|
|
144
|
+
function buildPolicyCreateSynthesis(policy, validationErrors, success) {
|
|
145
|
+
const blockingIssues = extractBlockingIssues(policy, validationErrors);
|
|
146
|
+
const synthesis = buildExecutiveSummary({
|
|
147
|
+
environment: 'production',
|
|
148
|
+
timestamp: new Date().toISOString(),
|
|
149
|
+
version: policy.metadata.version,
|
|
150
|
+
commit_sha: process.env['GIT_SHA'],
|
|
151
|
+
}, {
|
|
152
|
+
success_rate: success ? 1.0 : 0.0,
|
|
153
|
+
failed_iterations: validationErrors.length,
|
|
154
|
+
blocking_issues: blockingIssues,
|
|
155
|
+
}, ['policy validation', 'rule parsing', 'persistence']);
|
|
156
|
+
// Apply policy type risk elevation
|
|
157
|
+
const policyType = getPolicyType(policy);
|
|
158
|
+
elevateRiskForPolicyType(synthesis, policyType);
|
|
159
|
+
// Determine recommendation based on status and issues
|
|
160
|
+
synthesis.recommendation = determinePolicyRecommendation(policy, blockingIssues);
|
|
161
|
+
synthesis.rationale = buildPolicyRationale(policy, blockingIssues, synthesis.recommendation);
|
|
162
|
+
return synthesis;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Build synthesis for policy edit
|
|
166
|
+
*/
|
|
167
|
+
function buildPolicyEditSynthesis(policy, validationErrors, success) {
|
|
168
|
+
const blockingIssues = extractBlockingIssues(policy, validationErrors);
|
|
169
|
+
const synthesis = buildExecutiveSummary({
|
|
170
|
+
environment: 'production',
|
|
171
|
+
timestamp: new Date().toISOString(),
|
|
172
|
+
version: policy.metadata.version,
|
|
173
|
+
commit_sha: process.env['GIT_SHA'],
|
|
174
|
+
}, {
|
|
175
|
+
success_rate: success ? 1.0 : 0.0,
|
|
176
|
+
failed_iterations: validationErrors.length,
|
|
177
|
+
blocking_issues: blockingIssues,
|
|
178
|
+
}, ['policy validation', 'rule parsing', 'update', 'persistence']);
|
|
179
|
+
const policyType = getPolicyType(policy);
|
|
180
|
+
elevateRiskForPolicyType(synthesis, policyType);
|
|
181
|
+
synthesis.recommendation = determinePolicyRecommendation(policy, blockingIssues);
|
|
182
|
+
synthesis.rationale = buildPolicyRationale(policy, blockingIssues, synthesis.recommendation);
|
|
183
|
+
return synthesis;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Build synthesis for policy status toggle
|
|
187
|
+
*/
|
|
188
|
+
function buildPolicyToggleSynthesis(policy, previousStatus, newStatus) {
|
|
189
|
+
const isEnabling = newStatus === policy_1.PolicyStatus.ACTIVE && previousStatus !== policy_1.PolicyStatus.ACTIVE;
|
|
190
|
+
const blockingIssues = [];
|
|
191
|
+
const synthesis = buildExecutiveSummary({
|
|
192
|
+
environment: 'production',
|
|
193
|
+
timestamp: new Date().toISOString(),
|
|
194
|
+
version: policy.metadata.version,
|
|
195
|
+
commit_sha: process.env['GIT_SHA'],
|
|
196
|
+
}, {
|
|
197
|
+
success_rate: 1.0,
|
|
198
|
+
failed_iterations: 0,
|
|
199
|
+
blocking_issues: blockingIssues,
|
|
200
|
+
}, ['status validation', 'policy toggle', 'persistence']);
|
|
201
|
+
const policyType = getPolicyType(policy);
|
|
202
|
+
elevateRiskForPolicyType(synthesis, policyType);
|
|
203
|
+
// Enabling a policy has higher risk
|
|
204
|
+
if (isEnabling) {
|
|
205
|
+
elevateRiskForEnabling(synthesis);
|
|
206
|
+
// Security policies require review when enabling
|
|
207
|
+
if (policyType === 'security') {
|
|
208
|
+
synthesis.recommendation = 'DEFER';
|
|
209
|
+
synthesis.rationale = `Enabling security policy requires additional review. Policy: ${policy.metadata.name}`;
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
synthesis.recommendation = 'APPROVE';
|
|
213
|
+
synthesis.rationale = `Policy ${policy.metadata.name} is being enabled. All rules validated.`;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
synthesis.recommendation = 'APPROVE';
|
|
218
|
+
synthesis.rationale = `Policy status changed from ${previousStatus} to ${newStatus}`;
|
|
219
|
+
}
|
|
220
|
+
return synthesis;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Calculate success rate based on validation results
|
|
224
|
+
*/
|
|
225
|
+
function calculateSuccessRate(validationErrors, totalRules) {
|
|
226
|
+
if (totalRules === 0)
|
|
227
|
+
return 1.0;
|
|
228
|
+
const invalidRules = validationErrors.length;
|
|
229
|
+
return Math.max(0, (totalRules - invalidRules) / totalRules);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Determine if this is a production target
|
|
233
|
+
*/
|
|
234
|
+
function isProductionTarget(namespace) {
|
|
235
|
+
if (!namespace)
|
|
236
|
+
return true;
|
|
237
|
+
const prodIndicators = ['prod', 'production', 'live', 'main'];
|
|
238
|
+
return prodIndicators.some(indicator => namespace.toLowerCase().includes(indicator));
|
|
239
|
+
}
|
|
240
|
+
// --- Private helper functions ---
|
|
241
|
+
function calculateRiskLevel(metrics) {
|
|
242
|
+
const criticalIssues = metrics.blocking_issues.filter(i => i.severity === 'critical').length;
|
|
243
|
+
const highIssues = metrics.blocking_issues.filter(i => i.severity === 'high').length;
|
|
244
|
+
if (criticalIssues > 0)
|
|
245
|
+
return 'critical';
|
|
246
|
+
if (highIssues > 0 || metrics.success_rate < 0.5)
|
|
247
|
+
return 'high';
|
|
248
|
+
if (metrics.failed_iterations > 0 || metrics.success_rate < 0.8)
|
|
249
|
+
return 'medium';
|
|
250
|
+
return 'low';
|
|
251
|
+
}
|
|
252
|
+
function determineRecommendation(metrics, riskLevel) {
|
|
253
|
+
if (riskLevel === 'critical')
|
|
254
|
+
return 'REJECT';
|
|
255
|
+
if (riskLevel === 'high')
|
|
256
|
+
return 'DEFER';
|
|
257
|
+
if (metrics.failed_iterations > 0)
|
|
258
|
+
return 'DEFER';
|
|
259
|
+
return 'APPROVE';
|
|
260
|
+
}
|
|
261
|
+
function determinePolicyRecommendation(policy, blockingIssues) {
|
|
262
|
+
const criticalIssues = blockingIssues.filter(i => i.severity === 'critical');
|
|
263
|
+
const highIssues = blockingIssues.filter(i => i.severity === 'high');
|
|
264
|
+
// Invalid rules -> REJECT
|
|
265
|
+
if (criticalIssues.length > 0)
|
|
266
|
+
return 'REJECT';
|
|
267
|
+
if (highIssues.length > 0)
|
|
268
|
+
return 'REJECT';
|
|
269
|
+
// Draft status with valid rules -> APPROVE
|
|
270
|
+
if (policy.status === policy_1.PolicyStatus.DRAFT)
|
|
271
|
+
return 'APPROVE';
|
|
272
|
+
// Enabling security policy -> DEFER
|
|
273
|
+
const policyType = getPolicyType(policy);
|
|
274
|
+
if (policyType === 'security' && policy.status === policy_1.PolicyStatus.ACTIVE) {
|
|
275
|
+
return 'DEFER';
|
|
276
|
+
}
|
|
277
|
+
return 'APPROVE';
|
|
278
|
+
}
|
|
279
|
+
function buildRationale(metrics, riskLevel, _recommendation) {
|
|
280
|
+
const parts = [];
|
|
281
|
+
parts.push(`Risk level: ${riskLevel}`);
|
|
282
|
+
parts.push(`Success rate: ${(metrics.success_rate * 100).toFixed(1)}%`);
|
|
283
|
+
if (metrics.blocking_issues.length > 0) {
|
|
284
|
+
parts.push(`Blocking issues: ${metrics.blocking_issues.length}`);
|
|
285
|
+
}
|
|
286
|
+
parts.push(`Steps executed: ${metrics.steps_executed.join(', ')}`);
|
|
287
|
+
return parts.join('. ');
|
|
288
|
+
}
|
|
289
|
+
function buildPolicyRationale(policy, blockingIssues, recommendation) {
|
|
290
|
+
const parts = [];
|
|
291
|
+
parts.push(`Policy: ${policy.metadata.name} (v${policy.metadata.version})`);
|
|
292
|
+
parts.push(`Status: ${policy.status}`);
|
|
293
|
+
parts.push(`Rules: ${policy.rules.length}`);
|
|
294
|
+
if (blockingIssues.length > 0) {
|
|
295
|
+
parts.push(`Issues: ${blockingIssues.length} (${blockingIssues.map(i => i.type).join(', ')})`);
|
|
296
|
+
}
|
|
297
|
+
parts.push(`Recommendation: ${recommendation}`);
|
|
298
|
+
return parts.join('. ');
|
|
299
|
+
}
|
|
300
|
+
function getPolicyType(policy) {
|
|
301
|
+
// Check tags for policy type
|
|
302
|
+
const tags = policy.metadata.tags || [];
|
|
303
|
+
if (tags.includes('security'))
|
|
304
|
+
return 'security';
|
|
305
|
+
if (tags.includes('compliance'))
|
|
306
|
+
return 'compliance';
|
|
307
|
+
// Check namespace for type hints
|
|
308
|
+
const namespace = policy.metadata.namespace.toLowerCase();
|
|
309
|
+
if (namespace.includes('security') || namespace.includes('sec'))
|
|
310
|
+
return 'security';
|
|
311
|
+
if (namespace.includes('compliance') || namespace.includes('audit'))
|
|
312
|
+
return 'compliance';
|
|
313
|
+
// Check rule actions for security patterns
|
|
314
|
+
const hasDenyRules = policy.rules.some(r => r.action.decision === policy_1.DecisionType.DENY);
|
|
315
|
+
if (hasDenyRules)
|
|
316
|
+
return 'security';
|
|
317
|
+
return undefined;
|
|
318
|
+
}
|
|
319
|
+
function isCriticalResource(rule) {
|
|
320
|
+
const criticalPatterns = [
|
|
321
|
+
'admin', 'root', 'system', 'database', 'credentials',
|
|
322
|
+
'secret', 'key', 'token', 'password', 'auth',
|
|
323
|
+
];
|
|
324
|
+
const ruleName = rule.name.toLowerCase();
|
|
325
|
+
const ruleDesc = (rule.description || '').toLowerCase();
|
|
326
|
+
return criticalPatterns.some(pattern => ruleName.includes(pattern) || ruleDesc.includes(pattern));
|
|
327
|
+
}
|
|
328
|
+
function findPriorityConflicts(rules) {
|
|
329
|
+
const conflicts = [];
|
|
330
|
+
// Group rules by their condition field (simplified conflict detection)
|
|
331
|
+
const rulesByField = new Map();
|
|
332
|
+
for (const rule of rules) {
|
|
333
|
+
if (rule.condition.field) {
|
|
334
|
+
const field = rule.condition.field;
|
|
335
|
+
if (!rulesByField.has(field)) {
|
|
336
|
+
rulesByField.set(field, []);
|
|
337
|
+
}
|
|
338
|
+
rulesByField.get(field).push(rule);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
// Check for conflicting decisions on same field
|
|
342
|
+
for (const [field, fieldRules] of rulesByField) {
|
|
343
|
+
if (fieldRules.length > 1) {
|
|
344
|
+
const decisions = new Set(fieldRules.map(r => r.action.decision));
|
|
345
|
+
if (decisions.has(policy_1.DecisionType.ALLOW) && decisions.has(policy_1.DecisionType.DENY)) {
|
|
346
|
+
conflicts.push({
|
|
347
|
+
rule_ids: fieldRules.map(r => r.id),
|
|
348
|
+
description: `Conflicting ALLOW and DENY decisions on field: ${field}`,
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return conflicts;
|
|
354
|
+
}
|
|
355
|
+
function hasRequiredConditions(rule) {
|
|
356
|
+
// A valid rule must have a condition with either a field or nested conditions
|
|
357
|
+
if (!rule.condition)
|
|
358
|
+
return false;
|
|
359
|
+
if (rule.condition.field)
|
|
360
|
+
return true;
|
|
361
|
+
if (rule.condition.conditions && rule.condition.conditions.length > 0)
|
|
362
|
+
return true;
|
|
363
|
+
return false;
|
|
364
|
+
}
|
|
365
|
+
// --- Decision Packet Builders ---
|
|
366
|
+
/**
|
|
367
|
+
* Build a complete Decision Packet for policy operations
|
|
368
|
+
*/
|
|
369
|
+
function buildDecisionPacket(policy, existingPolicies = [], options = {}) {
|
|
370
|
+
const conflictAnalysis = buildConflictAnalysis(policy, existingPolicies);
|
|
371
|
+
const enforcementImpact = buildEnforcementImpact(policy);
|
|
372
|
+
const affectedResourceCount = calculateAffectedResources(policy, existingPolicies);
|
|
373
|
+
const packet = {
|
|
374
|
+
conflict_analysis: conflictAnalysis,
|
|
375
|
+
affected_resource_count: affectedResourceCount,
|
|
376
|
+
enforcement_impact: enforcementImpact,
|
|
377
|
+
};
|
|
378
|
+
// Add rollback instructions for enable/disable operations
|
|
379
|
+
if (options.includeRollback && options.previousStatus !== undefined) {
|
|
380
|
+
packet.rollback_instructions = buildRollbackInstructions(policy, options.previousStatus, options.operationType || 'enable');
|
|
381
|
+
}
|
|
382
|
+
return packet;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Build conflict analysis for a policy against existing policies
|
|
386
|
+
*/
|
|
387
|
+
function buildConflictAnalysis(policy, existingPolicies = []) {
|
|
388
|
+
const conflicts = [];
|
|
389
|
+
// Internal conflicts within the policy
|
|
390
|
+
const internalConflicts = findPriorityConflicts(policy.rules);
|
|
391
|
+
for (const conflict of internalConflicts) {
|
|
392
|
+
conflicts.push({
|
|
393
|
+
rule_a_id: conflict.rule_ids[0],
|
|
394
|
+
rule_b_id: conflict.rule_ids[1] || conflict.rule_ids[0],
|
|
395
|
+
conflict_type: 'decision',
|
|
396
|
+
description: conflict.description,
|
|
397
|
+
severity: 'high',
|
|
398
|
+
resolution: 'Review rule priorities and ensure consistent decision logic',
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
// Cross-policy conflicts
|
|
402
|
+
for (const existingPolicy of existingPolicies) {
|
|
403
|
+
if (existingPolicy.metadata.id === policy.metadata.id)
|
|
404
|
+
continue;
|
|
405
|
+
if (existingPolicy.status !== policy_1.PolicyStatus.ACTIVE)
|
|
406
|
+
continue;
|
|
407
|
+
// Check for namespace overlap with conflicting decisions
|
|
408
|
+
if (existingPolicy.metadata.namespace === policy.metadata.namespace) {
|
|
409
|
+
const crossConflicts = findCrossPolicyConflicts(policy, existingPolicy);
|
|
410
|
+
conflicts.push(...crossConflicts);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
const maxSeverity = conflicts.length > 0
|
|
414
|
+
? conflicts.reduce((max, c) => severityOrder(c.severity) > severityOrder(max) ? c.severity : max, 'low')
|
|
415
|
+
: 'low';
|
|
416
|
+
return {
|
|
417
|
+
has_conflicts: conflicts.length > 0,
|
|
418
|
+
conflicts,
|
|
419
|
+
max_severity: maxSeverity,
|
|
420
|
+
summary: conflicts.length > 0
|
|
421
|
+
? `Found ${conflicts.length} conflict(s): ${conflicts.map(c => c.conflict_type).join(', ')}`
|
|
422
|
+
: 'No conflicts detected',
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Build enforcement impact projection for a policy
|
|
427
|
+
*/
|
|
428
|
+
function buildEnforcementImpact(policy) {
|
|
429
|
+
// Analyze rules to project impact
|
|
430
|
+
const denyRules = policy.rules.filter(r => r.action.decision === policy_1.DecisionType.DENY && r.enabled !== false);
|
|
431
|
+
const warnRules = policy.rules.filter(r => r.action.decision === policy_1.DecisionType.WARN && r.enabled !== false);
|
|
432
|
+
const modifyRules = policy.rules.filter(r => r.action.decision === policy_1.DecisionType.MODIFY && r.enabled !== false);
|
|
433
|
+
// Note: allowRules can be derived if needed for future analysis but not currently used
|
|
434
|
+
// Estimate impact based on rule types and criticality
|
|
435
|
+
const criticalDenyRules = denyRules.filter(r => isCriticalResource(r));
|
|
436
|
+
// Base predictions on rule analysis (would be enhanced with real traffic data)
|
|
437
|
+
const baseRate = 1000; // hypothetical requests per hour baseline
|
|
438
|
+
const denyRate = denyRules.length > 0 ? Math.min(denyRules.length * 50, baseRate * 0.3) : 0;
|
|
439
|
+
const warnRate = warnRules.length > 0 ? Math.min(warnRules.length * 100, baseRate * 0.2) : 0;
|
|
440
|
+
const modifyRate = modifyRules.length > 0 ? Math.min(modifyRules.length * 75, baseRate * 0.15) : 0;
|
|
441
|
+
// Determine impact level
|
|
442
|
+
let impactLevel;
|
|
443
|
+
if (criticalDenyRules.length > 0 || denyRules.length > 5) {
|
|
444
|
+
impactLevel = 'critical';
|
|
445
|
+
}
|
|
446
|
+
else if (denyRules.length > 2 || (denyRate / baseRate) > 0.2) {
|
|
447
|
+
impactLevel = 'significant';
|
|
448
|
+
}
|
|
449
|
+
else if (denyRules.length > 0 || warnRules.length > 3) {
|
|
450
|
+
impactLevel = 'moderate';
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
impactLevel = 'minimal';
|
|
454
|
+
}
|
|
455
|
+
// Calculate confidence based on rule specificity
|
|
456
|
+
const hasSpecificConditions = policy.rules.every(r => hasRequiredConditions(r));
|
|
457
|
+
const confidence = hasSpecificConditions ? 0.75 : 0.5;
|
|
458
|
+
return {
|
|
459
|
+
allowed_predictions: Math.round(baseRate - denyRate - warnRate - modifyRate),
|
|
460
|
+
denied_predictions: Math.round(denyRate),
|
|
461
|
+
warned_predictions: Math.round(warnRate),
|
|
462
|
+
modified_predictions: Math.round(modifyRate),
|
|
463
|
+
confidence,
|
|
464
|
+
impact_level: impactLevel,
|
|
465
|
+
description: buildImpactDescription(impactLevel, denyRules.length, warnRules.length, modifyRules.length),
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Build rollback instructions for enable/disable operations
|
|
470
|
+
*/
|
|
471
|
+
function buildRollbackInstructions(policy, previousStatus, operationType) {
|
|
472
|
+
const policyId = policy.metadata.id;
|
|
473
|
+
const policyType = getPolicyType(policy);
|
|
474
|
+
// Determine appropriate rollback command
|
|
475
|
+
let rollbackCommand;
|
|
476
|
+
if (operationType === 'enable') {
|
|
477
|
+
rollbackCommand = `agentics policy disable ${policyId}`;
|
|
478
|
+
}
|
|
479
|
+
else if (operationType === 'disable') {
|
|
480
|
+
rollbackCommand = `agentics policy enable ${policyId}`;
|
|
481
|
+
}
|
|
482
|
+
else {
|
|
483
|
+
rollbackCommand = `agentics policy edit ${policyId} --status ${previousStatus}`;
|
|
484
|
+
}
|
|
485
|
+
// Build verification steps
|
|
486
|
+
const verificationSteps = [
|
|
487
|
+
`Verify policy status: agentics policy inspect ${policyId}`,
|
|
488
|
+
'Review recent evaluation logs for affected requests',
|
|
489
|
+
'Check system health metrics for anomalies',
|
|
490
|
+
'Confirm no pending requests are blocked unexpectedly',
|
|
491
|
+
];
|
|
492
|
+
// Calculate safe rollback window based on policy type
|
|
493
|
+
let safeRollbackWindow;
|
|
494
|
+
if (policyType === 'security') {
|
|
495
|
+
safeRollbackWindow = '5 minutes';
|
|
496
|
+
}
|
|
497
|
+
else if (policyType === 'compliance') {
|
|
498
|
+
safeRollbackWindow = '15 minutes';
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
safeRollbackWindow = '30 minutes';
|
|
502
|
+
}
|
|
503
|
+
// Build warnings
|
|
504
|
+
const warnings = [];
|
|
505
|
+
if (policyType === 'security') {
|
|
506
|
+
warnings.push('Rolling back security policies may expose vulnerabilities');
|
|
507
|
+
}
|
|
508
|
+
if (policy.status === policy_1.PolicyStatus.ACTIVE) {
|
|
509
|
+
warnings.push('Active policies may have cached evaluations that persist after rollback');
|
|
510
|
+
}
|
|
511
|
+
if (policy.rules.filter(r => r.action.decision === policy_1.DecisionType.DENY).length > 0) {
|
|
512
|
+
warnings.push('Rollback will re-enable/disable DENY rules which may affect blocked requests');
|
|
513
|
+
}
|
|
514
|
+
return {
|
|
515
|
+
previous_status: previousStatus,
|
|
516
|
+
rollback_command: rollbackCommand,
|
|
517
|
+
verification_steps: verificationSteps,
|
|
518
|
+
safe_rollback_window: safeRollbackWindow,
|
|
519
|
+
warnings,
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Build violation predictions for dry-run analysis
|
|
524
|
+
*/
|
|
525
|
+
function buildViolationPredictions(policy) {
|
|
526
|
+
const predictions = [];
|
|
527
|
+
for (const rule of policy.rules) {
|
|
528
|
+
if (rule.enabled === false)
|
|
529
|
+
continue;
|
|
530
|
+
// Only predict for non-ALLOW decisions
|
|
531
|
+
if (rule.action.decision === policy_1.DecisionType.ALLOW)
|
|
532
|
+
continue;
|
|
533
|
+
const predictedAction = mapDecisionToAction(rule.action.decision);
|
|
534
|
+
const riskLevel = assessRuleRisk(rule);
|
|
535
|
+
const frequency = estimateViolationFrequency(rule);
|
|
536
|
+
predictions.push({
|
|
537
|
+
rule_id: rule.id,
|
|
538
|
+
rule_name: rule.name,
|
|
539
|
+
predicted_action: predictedAction,
|
|
540
|
+
estimated_frequency: frequency,
|
|
541
|
+
estimated_affected_requests_per_hour: estimateAffectedRequests(frequency),
|
|
542
|
+
sample_trigger_conditions: buildSampleConditions(rule),
|
|
543
|
+
risk_level: riskLevel,
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
// Sort by risk level (critical first)
|
|
547
|
+
predictions.sort((a, b) => severityOrder(b.risk_level) - severityOrder(a.risk_level));
|
|
548
|
+
return predictions;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Build synthesis for policy dry-run operation
|
|
552
|
+
*/
|
|
553
|
+
function buildPolicyDryRunSynthesis(policy, validationErrors, existingPolicies = []) {
|
|
554
|
+
const canApply = validationErrors.length === 0;
|
|
555
|
+
const violationPredictions = buildViolationPredictions(policy);
|
|
556
|
+
const decisionPacket = buildDecisionPacket(policy, existingPolicies, {
|
|
557
|
+
operationType: 'dry-run',
|
|
558
|
+
});
|
|
559
|
+
const blockingIssues = extractBlockingIssues(policy, validationErrors);
|
|
560
|
+
// Add conflict issues to blocking issues
|
|
561
|
+
for (const conflict of decisionPacket.conflict_analysis.conflicts) {
|
|
562
|
+
if (conflict.severity === 'high' || conflict.severity === 'critical') {
|
|
563
|
+
blockingIssues.push({
|
|
564
|
+
type: 'conflicting_priorities',
|
|
565
|
+
severity: conflict.severity,
|
|
566
|
+
description: conflict.description,
|
|
567
|
+
rule_id: conflict.rule_a_id,
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
const synthesis = buildExecutiveSummary({
|
|
572
|
+
environment: 'dry-run',
|
|
573
|
+
timestamp: new Date().toISOString(),
|
|
574
|
+
version: policy.metadata.version,
|
|
575
|
+
commit_sha: process.env['GIT_SHA'],
|
|
576
|
+
}, {
|
|
577
|
+
success_rate: canApply ? 1.0 : 0.0,
|
|
578
|
+
failed_iterations: validationErrors.length,
|
|
579
|
+
blocking_issues: blockingIssues,
|
|
580
|
+
}, ['policy parsing', 'schema validation', 'conflict analysis', 'impact projection']);
|
|
581
|
+
// Adjust recommendation based on dry-run results
|
|
582
|
+
if (!canApply) {
|
|
583
|
+
synthesis.recommendation = 'REJECT';
|
|
584
|
+
synthesis.rationale = `Dry-run failed: ${validationErrors.length} validation error(s). ${synthesis.rationale}`;
|
|
585
|
+
}
|
|
586
|
+
else if (decisionPacket.conflict_analysis.has_conflicts) {
|
|
587
|
+
synthesis.recommendation = 'DEFER';
|
|
588
|
+
synthesis.rationale = `Dry-run detected ${decisionPacket.conflict_analysis.conflicts.length} conflict(s). Review before applying.`;
|
|
589
|
+
}
|
|
590
|
+
else if (decisionPacket.enforcement_impact.impact_level === 'critical') {
|
|
591
|
+
synthesis.recommendation = 'DEFER';
|
|
592
|
+
synthesis.rationale = `Dry-run shows critical enforcement impact. ${violationPredictions.length} violation(s) predicted.`;
|
|
593
|
+
}
|
|
594
|
+
else if (violationPredictions.length > 0) {
|
|
595
|
+
const criticalViolations = violationPredictions.filter(v => v.risk_level === 'critical');
|
|
596
|
+
if (criticalViolations.length > 0) {
|
|
597
|
+
synthesis.recommendation = 'DEFER';
|
|
598
|
+
synthesis.rationale = `Dry-run shows ${criticalViolations.length} critical violation prediction(s).`;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
return {
|
|
602
|
+
canApply,
|
|
603
|
+
violationPredictions,
|
|
604
|
+
decisionPacket,
|
|
605
|
+
synthesis,
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
// --- Additional Helper Functions ---
|
|
609
|
+
function findCrossPolicyConflicts(policyA, policyB) {
|
|
610
|
+
const conflicts = [];
|
|
611
|
+
for (const ruleA of policyA.rules) {
|
|
612
|
+
for (const ruleB of policyB.rules) {
|
|
613
|
+
// Check for same field with conflicting decisions
|
|
614
|
+
if (ruleA.condition.field && ruleB.condition.field) {
|
|
615
|
+
if (ruleA.condition.field === ruleB.condition.field) {
|
|
616
|
+
const decisionsConflict = ((ruleA.action.decision === policy_1.DecisionType.ALLOW && ruleB.action.decision === policy_1.DecisionType.DENY) ||
|
|
617
|
+
(ruleA.action.decision === policy_1.DecisionType.DENY && ruleB.action.decision === policy_1.DecisionType.ALLOW));
|
|
618
|
+
if (decisionsConflict) {
|
|
619
|
+
conflicts.push({
|
|
620
|
+
rule_a_id: ruleA.id,
|
|
621
|
+
rule_b_id: ruleB.id,
|
|
622
|
+
conflict_type: 'decision',
|
|
623
|
+
description: `Rule "${ruleA.name}" (${policyA.metadata.name}) conflicts with "${ruleB.name}" (${policyB.metadata.name}) on field "${ruleA.condition.field}"`,
|
|
624
|
+
severity: 'high',
|
|
625
|
+
resolution: 'Review priority ordering or consolidate into single policy',
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
return conflicts;
|
|
633
|
+
}
|
|
634
|
+
function severityOrder(severity) {
|
|
635
|
+
const order = {
|
|
636
|
+
'low': 0,
|
|
637
|
+
'medium': 1,
|
|
638
|
+
'high': 2,
|
|
639
|
+
'critical': 3,
|
|
640
|
+
};
|
|
641
|
+
return order[severity];
|
|
642
|
+
}
|
|
643
|
+
function calculateAffectedResources(policy, existingPolicies) {
|
|
644
|
+
// Calculate resources affected based on namespace scope and rule count
|
|
645
|
+
let baseCount = policy.rules.length * 10; // Base: each rule affects ~10 resource types
|
|
646
|
+
// Broader namespace = more affected resources
|
|
647
|
+
const namespace = policy.metadata.namespace.toLowerCase();
|
|
648
|
+
if (namespace === 'global' || namespace === '*') {
|
|
649
|
+
baseCount *= 5;
|
|
650
|
+
}
|
|
651
|
+
else if (namespace.includes('prod')) {
|
|
652
|
+
baseCount *= 3;
|
|
653
|
+
}
|
|
654
|
+
// Cross-policy overlap increases affected resources
|
|
655
|
+
const overlappingPolicies = existingPolicies.filter(p => p.metadata.namespace === policy.metadata.namespace && p.status === policy_1.PolicyStatus.ACTIVE);
|
|
656
|
+
baseCount += overlappingPolicies.length * 5;
|
|
657
|
+
return Math.round(baseCount);
|
|
658
|
+
}
|
|
659
|
+
function buildImpactDescription(impactLevel, denyCount, warnCount, modifyCount) {
|
|
660
|
+
const parts = [];
|
|
661
|
+
if (denyCount > 0) {
|
|
662
|
+
parts.push(`${denyCount} DENY rule(s)`);
|
|
663
|
+
}
|
|
664
|
+
if (warnCount > 0) {
|
|
665
|
+
parts.push(`${warnCount} WARN rule(s)`);
|
|
666
|
+
}
|
|
667
|
+
if (modifyCount > 0) {
|
|
668
|
+
parts.push(`${modifyCount} MODIFY rule(s)`);
|
|
669
|
+
}
|
|
670
|
+
const rulesDesc = parts.length > 0 ? parts.join(', ') : 'no enforcement rules';
|
|
671
|
+
switch (impactLevel) {
|
|
672
|
+
case 'critical':
|
|
673
|
+
return `Critical impact expected: ${rulesDesc} affecting critical resources`;
|
|
674
|
+
case 'significant':
|
|
675
|
+
return `Significant impact expected: ${rulesDesc} will affect substantial traffic`;
|
|
676
|
+
case 'moderate':
|
|
677
|
+
return `Moderate impact expected: ${rulesDesc} with targeted enforcement`;
|
|
678
|
+
case 'minimal':
|
|
679
|
+
default:
|
|
680
|
+
return `Minimal impact expected: ${rulesDesc} with limited scope`;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
function mapDecisionToAction(decision) {
|
|
684
|
+
switch (decision) {
|
|
685
|
+
case policy_1.DecisionType.DENY:
|
|
686
|
+
return 'DENY';
|
|
687
|
+
case policy_1.DecisionType.WARN:
|
|
688
|
+
return 'WARN';
|
|
689
|
+
case policy_1.DecisionType.MODIFY:
|
|
690
|
+
return 'MODIFY';
|
|
691
|
+
default:
|
|
692
|
+
return 'WARN';
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
function assessRuleRisk(rule) {
|
|
696
|
+
// Critical resources always high risk
|
|
697
|
+
if (isCriticalResource(rule)) {
|
|
698
|
+
return rule.action.decision === policy_1.DecisionType.DENY ? 'critical' : 'high';
|
|
699
|
+
}
|
|
700
|
+
// DENY rules are inherently higher risk
|
|
701
|
+
if (rule.action.decision === policy_1.DecisionType.DENY) {
|
|
702
|
+
return hasRequiredConditions(rule) ? 'medium' : 'high';
|
|
703
|
+
}
|
|
704
|
+
// MODIFY rules can have unintended consequences
|
|
705
|
+
if (rule.action.decision === policy_1.DecisionType.MODIFY) {
|
|
706
|
+
return 'medium';
|
|
707
|
+
}
|
|
708
|
+
return 'low';
|
|
709
|
+
}
|
|
710
|
+
function estimateViolationFrequency(rule) {
|
|
711
|
+
// Rules without specific conditions trigger more frequently
|
|
712
|
+
if (!hasRequiredConditions(rule)) {
|
|
713
|
+
return 'very_frequent';
|
|
714
|
+
}
|
|
715
|
+
// Check condition specificity using the actual enum values
|
|
716
|
+
const condition = rule.condition;
|
|
717
|
+
const op = condition.operator;
|
|
718
|
+
// Array-based conditions are typically more targeted
|
|
719
|
+
if (op === 'in' || op === 'not_in') {
|
|
720
|
+
return 'occasional';
|
|
721
|
+
}
|
|
722
|
+
// Regex matches vary widely
|
|
723
|
+
if (op === 'matches') {
|
|
724
|
+
return 'frequent';
|
|
725
|
+
}
|
|
726
|
+
// Exact matches are usually specific
|
|
727
|
+
if (op === 'eq' || op === 'ne') {
|
|
728
|
+
return 'rare';
|
|
729
|
+
}
|
|
730
|
+
return 'occasional';
|
|
731
|
+
}
|
|
732
|
+
function estimateAffectedRequests(frequency) {
|
|
733
|
+
const rates = {
|
|
734
|
+
'rare': 5,
|
|
735
|
+
'occasional': 25,
|
|
736
|
+
'frequent': 100,
|
|
737
|
+
'very_frequent': 500,
|
|
738
|
+
};
|
|
739
|
+
return rates[frequency] || 25;
|
|
740
|
+
}
|
|
741
|
+
function buildSampleConditions(rule) {
|
|
742
|
+
const samples = [];
|
|
743
|
+
const condition = rule.condition;
|
|
744
|
+
if (condition.field && condition.value !== undefined) {
|
|
745
|
+
samples.push(`${condition.field} ${condition.operator} ${JSON.stringify(condition.value)}`);
|
|
746
|
+
}
|
|
747
|
+
if (condition.conditions && condition.conditions.length > 0) {
|
|
748
|
+
const nestedSamples = condition.conditions.slice(0, 2).map(c => `${c.field} ${c.operator} ${JSON.stringify(c.value)}`);
|
|
749
|
+
samples.push(...nestedSamples);
|
|
750
|
+
}
|
|
751
|
+
if (samples.length === 0) {
|
|
752
|
+
samples.push('All requests (no specific conditions)');
|
|
753
|
+
}
|
|
754
|
+
return samples;
|
|
755
|
+
}
|
|
756
|
+
//# sourceMappingURL=builder.js.map
|