@llm-dev-ops/agentics-cli 1.4.32 → 1.4.35
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,794 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/**
|
|
5
|
+
* LLM-Policy-Engine CLI
|
|
6
|
+
* Command-line interface for policy management and evaluation
|
|
7
|
+
*
|
|
8
|
+
* Executive Synthesis Integration:
|
|
9
|
+
* - policy create: synthesis with conflict analysis and enforcement impact
|
|
10
|
+
* - policy edit: synthesis with change tracking and impact projection
|
|
11
|
+
* - policy enable: synthesis with rollback instructions
|
|
12
|
+
* - policy disable: synthesis with rollback instructions
|
|
13
|
+
* - policy dry-run: violation predictions without state change
|
|
14
|
+
*/
|
|
15
|
+
const commander_1 = require("commander");
|
|
16
|
+
const fs_1 = require("fs");
|
|
17
|
+
const policy_repository_1 = require("../db/models/policy-repository");
|
|
18
|
+
const evaluation_repository_1 = require("../db/models/evaluation-repository");
|
|
19
|
+
const policy_engine_1 = require("../core/engine/policy-engine");
|
|
20
|
+
const client_1 = require("../db/client");
|
|
21
|
+
const migrate_1 = require("../db/migrate");
|
|
22
|
+
const uuid_1 = require("uuid");
|
|
23
|
+
const policy_1 = require("../commands/policy");
|
|
24
|
+
const agent_1 = require("../commands/agent");
|
|
25
|
+
const approval_routing_1 = require("../commands/approval-routing");
|
|
26
|
+
const program = new commander_1.Command();
|
|
27
|
+
const policyRepository = new policy_repository_1.PolicyRepository();
|
|
28
|
+
const evaluationRepository = new evaluation_repository_1.EvaluationRepository();
|
|
29
|
+
// Note: yamlParser, jsonParser, and validator are used directly in command modules now
|
|
30
|
+
/**
|
|
31
|
+
* Format and output executive synthesis for CLI display
|
|
32
|
+
*/
|
|
33
|
+
function outputSynthesis(synthesis, label = 'Executive Synthesis') {
|
|
34
|
+
console.log(`\n--- ${label} ---`);
|
|
35
|
+
console.log(`Risk Level: ${synthesis.risk_level.toUpperCase()}`);
|
|
36
|
+
console.log(`Recommendation: ${synthesis.recommendation}`);
|
|
37
|
+
console.log(`Rationale: ${synthesis.rationale}`);
|
|
38
|
+
if (synthesis.iteration_metrics.blocking_issues.length > 0) {
|
|
39
|
+
console.log(`\nBlocking Issues (${synthesis.iteration_metrics.blocking_issues.length}):`);
|
|
40
|
+
synthesis.iteration_metrics.blocking_issues.forEach((issue, idx) => {
|
|
41
|
+
console.log(` ${idx + 1}. [${issue.severity.toUpperCase()}] ${issue.type}: ${issue.description}`);
|
|
42
|
+
if (issue.rule_id) {
|
|
43
|
+
console.log(` Rule: ${issue.rule_id}`);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
console.log(`\nSteps Executed: ${synthesis.iteration_metrics.steps_executed.join(' -> ')}`);
|
|
48
|
+
console.log(`Success Rate: ${(synthesis.iteration_metrics.success_rate * 100).toFixed(1)}%`);
|
|
49
|
+
console.log(`Environment: ${synthesis.deploy_reference.environment}`);
|
|
50
|
+
console.log(`Timestamp: ${synthesis.deploy_reference.timestamp}`);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Format and output decision packet for CLI display
|
|
54
|
+
*/
|
|
55
|
+
function outputDecisionPacket(packet) {
|
|
56
|
+
console.log('\n--- Decision Packet ---');
|
|
57
|
+
// Conflict Analysis
|
|
58
|
+
console.log(`\nConflict Analysis:`);
|
|
59
|
+
console.log(` Has Conflicts: ${packet.conflict_analysis.has_conflicts ? 'YES' : 'No'}`);
|
|
60
|
+
console.log(` Summary: ${packet.conflict_analysis.summary}`);
|
|
61
|
+
if (packet.conflict_analysis.conflicts.length > 0) {
|
|
62
|
+
console.log(` Conflicts (${packet.conflict_analysis.conflicts.length}):`);
|
|
63
|
+
packet.conflict_analysis.conflicts.forEach((conflict, idx) => {
|
|
64
|
+
console.log(` ${idx + 1}. [${conflict.severity.toUpperCase()}] ${conflict.conflict_type}`);
|
|
65
|
+
console.log(` ${conflict.description}`);
|
|
66
|
+
if (conflict.resolution) {
|
|
67
|
+
console.log(` Resolution: ${conflict.resolution}`);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
// Affected Resources
|
|
72
|
+
console.log(`\nAffected Resource Count: ${packet.affected_resource_count}`);
|
|
73
|
+
// Enforcement Impact
|
|
74
|
+
console.log(`\nEnforcement Impact Projection:`);
|
|
75
|
+
console.log(` Impact Level: ${packet.enforcement_impact.impact_level.toUpperCase()}`);
|
|
76
|
+
console.log(` Description: ${packet.enforcement_impact.description}`);
|
|
77
|
+
console.log(` Confidence: ${(packet.enforcement_impact.confidence * 100).toFixed(0)}%`);
|
|
78
|
+
console.log(` Predictions (per hour):`);
|
|
79
|
+
console.log(` - Allowed: ~${packet.enforcement_impact.allowed_predictions}`);
|
|
80
|
+
console.log(` - Denied: ~${packet.enforcement_impact.denied_predictions}`);
|
|
81
|
+
console.log(` - Warned: ~${packet.enforcement_impact.warned_predictions}`);
|
|
82
|
+
console.log(` - Modified: ~${packet.enforcement_impact.modified_predictions}`);
|
|
83
|
+
// Rollback Instructions (if present)
|
|
84
|
+
if (packet.rollback_instructions) {
|
|
85
|
+
console.log(`\nRollback Instructions:`);
|
|
86
|
+
console.log(` Previous Status: ${packet.rollback_instructions.previous_status}`);
|
|
87
|
+
console.log(` Rollback Command: ${packet.rollback_instructions.rollback_command}`);
|
|
88
|
+
console.log(` Safe Rollback Window: ${packet.rollback_instructions.safe_rollback_window}`);
|
|
89
|
+
console.log(` Verification Steps:`);
|
|
90
|
+
packet.rollback_instructions.verification_steps.forEach((step, idx) => {
|
|
91
|
+
console.log(` ${idx + 1}. ${step}`);
|
|
92
|
+
});
|
|
93
|
+
if (packet.rollback_instructions.warnings.length > 0) {
|
|
94
|
+
console.log(` Warnings:`);
|
|
95
|
+
packet.rollback_instructions.warnings.forEach((warning) => {
|
|
96
|
+
console.log(` ⚠️ ${warning}`);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Format and output dry-run results for CLI display
|
|
103
|
+
*/
|
|
104
|
+
function outputDryRunResults(result) {
|
|
105
|
+
console.log('\n=== Policy Dry-Run Results ===');
|
|
106
|
+
console.log(`Policy ID: ${result.policy_id}`);
|
|
107
|
+
console.log(`Can Apply: ${result.can_apply ? 'YES' : 'NO'}`);
|
|
108
|
+
if (result.validation_errors.length > 0) {
|
|
109
|
+
console.log(`\nValidation Errors (${result.validation_errors.length}):`);
|
|
110
|
+
result.validation_errors.forEach((err, idx) => {
|
|
111
|
+
console.log(` ${idx + 1}. ${err}`);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
if (result.violation_predictions.length > 0) {
|
|
115
|
+
console.log(`\nViolation Predictions (${result.violation_predictions.length}):`);
|
|
116
|
+
result.violation_predictions.forEach((vp, idx) => {
|
|
117
|
+
console.log(` ${idx + 1}. [${vp.risk_level.toUpperCase()}] ${vp.rule_name}`);
|
|
118
|
+
console.log(` Action: ${vp.predicted_action}`);
|
|
119
|
+
console.log(` Frequency: ${vp.estimated_frequency} (~${vp.estimated_affected_requests_per_hour}/hour)`);
|
|
120
|
+
console.log(` Trigger conditions: ${vp.sample_trigger_conditions.join(', ')}`);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
outputDecisionPacket(result.decision_packet);
|
|
124
|
+
outputSynthesis(result.synthesis);
|
|
125
|
+
}
|
|
126
|
+
program
|
|
127
|
+
.name('llm-policy')
|
|
128
|
+
.description('LLM Policy Engine CLI - Manage and evaluate policies')
|
|
129
|
+
.version('1.0.0');
|
|
130
|
+
// Policy management commands
|
|
131
|
+
const policyCommand = program.command('policy').description('Manage policies');
|
|
132
|
+
policyCommand
|
|
133
|
+
.command('create')
|
|
134
|
+
.description('Create a new policy from file (with executive synthesis)')
|
|
135
|
+
.argument('<file>', 'Policy file (YAML or JSON)')
|
|
136
|
+
.option('-c, --created-by <user>', 'User creating the policy')
|
|
137
|
+
.option('--json', 'Output full result as JSON')
|
|
138
|
+
.option('--no-synthesis', 'Disable synthesis output')
|
|
139
|
+
.action(async (file, options) => {
|
|
140
|
+
try {
|
|
141
|
+
const result = await (0, policy_1.createPolicy)(file, options.createdBy);
|
|
142
|
+
if (options.json) {
|
|
143
|
+
console.log(JSON.stringify(result, null, 2));
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
if (result.validation_errors.length > 0) {
|
|
147
|
+
console.error('Policy validation failed:');
|
|
148
|
+
result.validation_errors.forEach((err) => console.error(` - ${err}`));
|
|
149
|
+
if (result.synthesis && options.synthesis !== false) {
|
|
150
|
+
outputSynthesis(result.synthesis, 'Validation Synthesis');
|
|
151
|
+
}
|
|
152
|
+
await client_1.db.close();
|
|
153
|
+
process.exit(1);
|
|
154
|
+
}
|
|
155
|
+
console.log(`Policy created successfully: ${result.policy_id}`);
|
|
156
|
+
console.log(` Version: ${result.version}`);
|
|
157
|
+
console.log(` Status: ${result.status}`);
|
|
158
|
+
console.log(` Rules: ${result.rules_count}`);
|
|
159
|
+
if (result.synthesis && options.synthesis !== false) {
|
|
160
|
+
outputSynthesis(result.synthesis, 'Create Synthesis');
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
await client_1.db.close();
|
|
164
|
+
process.exit(0);
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
console.error('Failed to create policy:', error);
|
|
168
|
+
await client_1.db.close();
|
|
169
|
+
process.exit(1);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
policyCommand
|
|
173
|
+
.command('update')
|
|
174
|
+
.description('Update an existing policy (with executive synthesis)')
|
|
175
|
+
.alias('edit')
|
|
176
|
+
.argument('<id>', 'Policy ID')
|
|
177
|
+
.argument('<file>', 'Policy file (YAML or JSON)')
|
|
178
|
+
.option('--json', 'Output full result as JSON')
|
|
179
|
+
.option('--no-synthesis', 'Disable synthesis output')
|
|
180
|
+
.action(async (id, file, options) => {
|
|
181
|
+
try {
|
|
182
|
+
const result = await (0, policy_1.updatePolicy)(id, file);
|
|
183
|
+
if (options.json) {
|
|
184
|
+
console.log(JSON.stringify(result, null, 2));
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
if (result.validation_errors.length > 0) {
|
|
188
|
+
console.error('Policy validation failed:');
|
|
189
|
+
result.validation_errors.forEach((err) => console.error(` - ${err}`));
|
|
190
|
+
if (result.synthesis && options.synthesis !== false) {
|
|
191
|
+
outputSynthesis(result.synthesis, 'Validation Synthesis');
|
|
192
|
+
}
|
|
193
|
+
await client_1.db.close();
|
|
194
|
+
process.exit(1);
|
|
195
|
+
}
|
|
196
|
+
console.log(`Policy updated successfully: ${result.policy_id}`);
|
|
197
|
+
console.log(` Version: ${result.version} (was: ${result.previous_version})`);
|
|
198
|
+
console.log(` Changes: ${result.changes_applied.join(', ') || 'none'}`);
|
|
199
|
+
if (result.synthesis && options.synthesis !== false) {
|
|
200
|
+
outputSynthesis(result.synthesis, 'Edit Synthesis');
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
await client_1.db.close();
|
|
204
|
+
process.exit(0);
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
console.error('Failed to update policy:', error);
|
|
208
|
+
await client_1.db.close();
|
|
209
|
+
process.exit(1);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
policyCommand
|
|
213
|
+
.command('delete')
|
|
214
|
+
.description('Delete a policy')
|
|
215
|
+
.argument('<id>', 'Policy ID')
|
|
216
|
+
.action(async (id) => {
|
|
217
|
+
try {
|
|
218
|
+
await policyRepository.delete(id);
|
|
219
|
+
console.log(`Policy deleted successfully: ${id}`);
|
|
220
|
+
await client_1.db.close();
|
|
221
|
+
process.exit(0);
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
console.error('Failed to delete policy:', error);
|
|
225
|
+
await client_1.db.close();
|
|
226
|
+
process.exit(1);
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
policyCommand
|
|
230
|
+
.command('list')
|
|
231
|
+
.description('List all policies')
|
|
232
|
+
.option('-n, --namespace <namespace>', 'Filter by namespace')
|
|
233
|
+
.option('-s, --status <status>', 'Filter by status (active, draft, deprecated)')
|
|
234
|
+
.action(async (options) => {
|
|
235
|
+
try {
|
|
236
|
+
let policies;
|
|
237
|
+
if (options.namespace) {
|
|
238
|
+
policies = await policyRepository.findByNamespace(options.namespace);
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
policies = await policyRepository.findActive();
|
|
242
|
+
}
|
|
243
|
+
if (options.status) {
|
|
244
|
+
policies = policies.filter((p) => p.status === options.status);
|
|
245
|
+
}
|
|
246
|
+
console.log(`Found ${policies.length} policies:\n`);
|
|
247
|
+
policies.forEach((policy) => {
|
|
248
|
+
console.log(`${policy.metadata.id}`);
|
|
249
|
+
console.log(` Name: ${policy.metadata.name}`);
|
|
250
|
+
console.log(` Namespace: ${policy.metadata.namespace}`);
|
|
251
|
+
console.log(` Version: ${policy.metadata.version}`);
|
|
252
|
+
console.log(` Status: ${policy.status}`);
|
|
253
|
+
console.log(` Priority: ${policy.metadata.priority || 0}`);
|
|
254
|
+
console.log(` Rules: ${policy.rules.length}`);
|
|
255
|
+
console.log();
|
|
256
|
+
});
|
|
257
|
+
await client_1.db.close();
|
|
258
|
+
process.exit(0);
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
console.error('Failed to list policies:', error);
|
|
262
|
+
await client_1.db.close();
|
|
263
|
+
process.exit(1);
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
policyCommand
|
|
267
|
+
.command('get')
|
|
268
|
+
.description('Get policy details')
|
|
269
|
+
.argument('<id>', 'Policy ID')
|
|
270
|
+
.option('-o, --output <format>', 'Output format (json, yaml)', 'json')
|
|
271
|
+
.action(async (id, options) => {
|
|
272
|
+
try {
|
|
273
|
+
const policy = await policyRepository.findById(id);
|
|
274
|
+
if (!policy) {
|
|
275
|
+
console.error(`Policy not found: ${id}`);
|
|
276
|
+
process.exit(1);
|
|
277
|
+
}
|
|
278
|
+
if (options.output === 'yaml') {
|
|
279
|
+
const yaml = require('yaml');
|
|
280
|
+
console.log(yaml.stringify(policy));
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
console.log(JSON.stringify(policy, null, 2));
|
|
284
|
+
}
|
|
285
|
+
await client_1.db.close();
|
|
286
|
+
process.exit(0);
|
|
287
|
+
}
|
|
288
|
+
catch (error) {
|
|
289
|
+
console.error('Failed to get policy:', error);
|
|
290
|
+
await client_1.db.close();
|
|
291
|
+
process.exit(1);
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
policyCommand
|
|
295
|
+
.command('validate')
|
|
296
|
+
.description('Validate a policy file without creating it (with synthesis)')
|
|
297
|
+
.argument('<file>', 'Policy file (YAML or JSON)')
|
|
298
|
+
.option('--json', 'Output full result as JSON')
|
|
299
|
+
.option('--no-synthesis', 'Disable synthesis output')
|
|
300
|
+
.action(async (file, options) => {
|
|
301
|
+
try {
|
|
302
|
+
const result = await (0, policy_1.validatePolicy)(file);
|
|
303
|
+
if (options.json) {
|
|
304
|
+
console.log(JSON.stringify(result, null, 2));
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
if (result.valid) {
|
|
308
|
+
console.log('Policy is valid');
|
|
309
|
+
console.log(` ID: ${result.policy.metadata.id}`);
|
|
310
|
+
console.log(` Name: ${result.policy.metadata.name}`);
|
|
311
|
+
console.log(` Rules: ${result.policy.rules.length}`);
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
console.error('Policy validation failed:');
|
|
315
|
+
result.errors.forEach((err) => console.error(` - ${err}`));
|
|
316
|
+
}
|
|
317
|
+
if (result.synthesis && options.synthesis !== false) {
|
|
318
|
+
outputSynthesis(result.synthesis, 'Validation Synthesis');
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
process.exit(result.valid ? 0 : 1);
|
|
322
|
+
}
|
|
323
|
+
catch (error) {
|
|
324
|
+
console.error('Failed to validate policy:', error);
|
|
325
|
+
process.exit(1);
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
policyCommand
|
|
329
|
+
.command('enable')
|
|
330
|
+
.description('Enable a policy (with rollback instructions in synthesis)')
|
|
331
|
+
.argument('<id>', 'Policy ID')
|
|
332
|
+
.option('--json', 'Output full result as JSON')
|
|
333
|
+
.option('--no-synthesis', 'Disable synthesis output')
|
|
334
|
+
.action(async (id, options) => {
|
|
335
|
+
try {
|
|
336
|
+
const result = await (0, policy_1.enablePolicy)(id);
|
|
337
|
+
if (options.json) {
|
|
338
|
+
console.log(JSON.stringify(result, null, 2));
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
console.log(`Policy enabled successfully: ${result.policy_id}`);
|
|
342
|
+
console.log(` Previous Status: ${result.previous_status}`);
|
|
343
|
+
console.log(` New Status: ${result.new_status}`);
|
|
344
|
+
console.log(` Affected Rules: ${result.affected_rules}`);
|
|
345
|
+
if (result.decision_packet && options.synthesis !== false) {
|
|
346
|
+
outputDecisionPacket(result.decision_packet);
|
|
347
|
+
}
|
|
348
|
+
if (result.synthesis && options.synthesis !== false) {
|
|
349
|
+
outputSynthesis(result.synthesis, 'Enable Synthesis');
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
await client_1.db.close();
|
|
353
|
+
process.exit(0);
|
|
354
|
+
}
|
|
355
|
+
catch (error) {
|
|
356
|
+
console.error('Failed to enable policy:', error);
|
|
357
|
+
await client_1.db.close();
|
|
358
|
+
process.exit(1);
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
policyCommand
|
|
362
|
+
.command('disable')
|
|
363
|
+
.description('Disable a policy (with rollback instructions in synthesis)')
|
|
364
|
+
.argument('<id>', 'Policy ID')
|
|
365
|
+
.option('--json', 'Output full result as JSON')
|
|
366
|
+
.option('--no-synthesis', 'Disable synthesis output')
|
|
367
|
+
.action(async (id, options) => {
|
|
368
|
+
try {
|
|
369
|
+
const result = await (0, policy_1.disablePolicy)(id);
|
|
370
|
+
if (options.json) {
|
|
371
|
+
console.log(JSON.stringify(result, null, 2));
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
console.log(`Policy disabled successfully: ${result.policy_id}`);
|
|
375
|
+
console.log(` Previous Status: ${result.previous_status}`);
|
|
376
|
+
console.log(` New Status: ${result.new_status}`);
|
|
377
|
+
console.log(` Affected Rules: ${result.affected_rules}`);
|
|
378
|
+
if (result.decision_packet && options.synthesis !== false) {
|
|
379
|
+
outputDecisionPacket(result.decision_packet);
|
|
380
|
+
}
|
|
381
|
+
if (result.synthesis && options.synthesis !== false) {
|
|
382
|
+
outputSynthesis(result.synthesis, 'Disable Synthesis');
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
await client_1.db.close();
|
|
386
|
+
process.exit(0);
|
|
387
|
+
}
|
|
388
|
+
catch (error) {
|
|
389
|
+
console.error('Failed to disable policy:', error);
|
|
390
|
+
await client_1.db.close();
|
|
391
|
+
process.exit(1);
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
policyCommand
|
|
395
|
+
.command('dry-run')
|
|
396
|
+
.description('Evaluate policy impact without state changes (violation predictions)')
|
|
397
|
+
.argument('<file>', 'Policy file (YAML or JSON)')
|
|
398
|
+
.option('--json', 'Output full result as JSON')
|
|
399
|
+
.action(async (file, options) => {
|
|
400
|
+
try {
|
|
401
|
+
const result = await (0, policy_1.dryRunPolicy)(file);
|
|
402
|
+
if (options.json) {
|
|
403
|
+
console.log(JSON.stringify(result, null, 2));
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
outputDryRunResults(result);
|
|
407
|
+
}
|
|
408
|
+
await client_1.db.close();
|
|
409
|
+
// Exit with non-zero if policy cannot be applied
|
|
410
|
+
process.exit(result.can_apply ? 0 : 1);
|
|
411
|
+
}
|
|
412
|
+
catch (error) {
|
|
413
|
+
console.error('Failed to run policy dry-run:', error);
|
|
414
|
+
await client_1.db.close();
|
|
415
|
+
process.exit(1);
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
// Evaluation commands
|
|
419
|
+
const evalCommand = program.command('evaluate').description('Evaluate policies');
|
|
420
|
+
evalCommand
|
|
421
|
+
.command('run')
|
|
422
|
+
.description('Evaluate a request against policies')
|
|
423
|
+
.option('-c, --context <file>', 'Context JSON file')
|
|
424
|
+
.option('-p, --policies <ids>', 'Comma-separated policy IDs')
|
|
425
|
+
.option('-t, --trace', 'Enable trace mode')
|
|
426
|
+
.option('-d, --dry-run', 'Dry run mode')
|
|
427
|
+
.action(async (options) => {
|
|
428
|
+
try {
|
|
429
|
+
let context;
|
|
430
|
+
if (options.context) {
|
|
431
|
+
const contextContent = (0, fs_1.readFileSync)(options.context, 'utf-8');
|
|
432
|
+
context = JSON.parse(contextContent);
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
console.error('Context file required (-c, --context)');
|
|
436
|
+
process.exit(1);
|
|
437
|
+
}
|
|
438
|
+
const policies = await policyRepository.findActive();
|
|
439
|
+
const engine = new policy_engine_1.PolicyEngine(policies);
|
|
440
|
+
const request = {
|
|
441
|
+
requestId: (0, uuid_1.v4)(),
|
|
442
|
+
context,
|
|
443
|
+
policies: options.policies ? options.policies.split(',') : undefined,
|
|
444
|
+
trace: options.trace || false,
|
|
445
|
+
dryRun: options.dryRun || false,
|
|
446
|
+
};
|
|
447
|
+
const response = await engine.evaluate(request);
|
|
448
|
+
console.log('Evaluation Result:');
|
|
449
|
+
console.log(JSON.stringify(response, null, 2));
|
|
450
|
+
if (!options.dryRun) {
|
|
451
|
+
await evaluationRepository.log(request, response);
|
|
452
|
+
console.log('\nEvaluation logged to database');
|
|
453
|
+
}
|
|
454
|
+
await client_1.db.close();
|
|
455
|
+
process.exit(response.decision.allowed ? 0 : 1);
|
|
456
|
+
}
|
|
457
|
+
catch (error) {
|
|
458
|
+
console.error('Evaluation failed:', error);
|
|
459
|
+
await client_1.db.close();
|
|
460
|
+
process.exit(1);
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
evalCommand
|
|
464
|
+
.command('history')
|
|
465
|
+
.description('View evaluation history')
|
|
466
|
+
.option('-r, --request-id <id>', 'Filter by request ID')
|
|
467
|
+
.option('-p, --policy-id <id>', 'Filter by policy ID')
|
|
468
|
+
.option('-l, --limit <number>', 'Limit results', '20')
|
|
469
|
+
.action(async (options) => {
|
|
470
|
+
try {
|
|
471
|
+
const filters = {
|
|
472
|
+
limit: parseInt(options.limit, 10),
|
|
473
|
+
};
|
|
474
|
+
if (options.requestId) {
|
|
475
|
+
const evaluation = await evaluationRepository.findByRequestId(options.requestId);
|
|
476
|
+
if (evaluation) {
|
|
477
|
+
console.log(JSON.stringify(evaluation, null, 2));
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
console.log('Evaluation not found');
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
else if (options.policyId) {
|
|
484
|
+
const evaluations = await evaluationRepository.findByPolicyId(options.policyId, filters.limit);
|
|
485
|
+
console.log(`Found ${evaluations.length} evaluations:\n`);
|
|
486
|
+
console.log(JSON.stringify(evaluations, null, 2));
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
const evaluations = await evaluationRepository.find(filters);
|
|
490
|
+
console.log(`Found ${evaluations.length} evaluations:\n`);
|
|
491
|
+
console.log(JSON.stringify(evaluations, null, 2));
|
|
492
|
+
}
|
|
493
|
+
await client_1.db.close();
|
|
494
|
+
process.exit(0);
|
|
495
|
+
}
|
|
496
|
+
catch (error) {
|
|
497
|
+
console.error('Failed to get evaluation history:', error);
|
|
498
|
+
await client_1.db.close();
|
|
499
|
+
process.exit(1);
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
evalCommand
|
|
503
|
+
.command('stats')
|
|
504
|
+
.description('View evaluation statistics')
|
|
505
|
+
.option('-d, --days <number>', 'Days to look back', '7')
|
|
506
|
+
.action(async (options) => {
|
|
507
|
+
try {
|
|
508
|
+
const days = parseInt(options.days, 10);
|
|
509
|
+
const startDate = new Date();
|
|
510
|
+
startDate.setDate(startDate.getDate() - days);
|
|
511
|
+
const stats = await evaluationRepository.getStats(startDate);
|
|
512
|
+
console.log('Evaluation Statistics:');
|
|
513
|
+
console.log(` Total Evaluations: ${stats.total}`);
|
|
514
|
+
console.log(` Allowed: ${stats.allowed} (${((stats.allowed / stats.total) * 100).toFixed(1)}%)`);
|
|
515
|
+
console.log(` Denied: ${stats.denied} (${((stats.denied / stats.total) * 100).toFixed(1)}%)`);
|
|
516
|
+
console.log(` Warned: ${stats.warned} (${((stats.warned / stats.total) * 100).toFixed(1)}%)`);
|
|
517
|
+
console.log(` Modified: ${stats.modified} (${((stats.modified / stats.total) * 100).toFixed(1)}%)`);
|
|
518
|
+
console.log(` Avg Evaluation Time: ${stats.avgEvaluationTimeMs.toFixed(2)}ms`);
|
|
519
|
+
console.log(` Cache Hit Rate: ${(stats.cacheHitRate * 100).toFixed(1)}%`);
|
|
520
|
+
await client_1.db.close();
|
|
521
|
+
process.exit(0);
|
|
522
|
+
}
|
|
523
|
+
catch (error) {
|
|
524
|
+
console.error('Failed to get evaluation stats:', error);
|
|
525
|
+
await client_1.db.close();
|
|
526
|
+
process.exit(1);
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
// Database commands
|
|
530
|
+
const dbCommand = program.command('db').description('Database management');
|
|
531
|
+
dbCommand
|
|
532
|
+
.command('migrate')
|
|
533
|
+
.description('Run database migrations')
|
|
534
|
+
.action(async () => {
|
|
535
|
+
try {
|
|
536
|
+
const migrationRunner = new migrate_1.MigrationRunner();
|
|
537
|
+
await migrationRunner.up();
|
|
538
|
+
console.log('Database migrations completed successfully');
|
|
539
|
+
await client_1.db.close();
|
|
540
|
+
process.exit(0);
|
|
541
|
+
}
|
|
542
|
+
catch (error) {
|
|
543
|
+
console.error('Migration failed:', error);
|
|
544
|
+
await client_1.db.close();
|
|
545
|
+
process.exit(1);
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
dbCommand
|
|
549
|
+
.command('migrate:status')
|
|
550
|
+
.description('Check migration status')
|
|
551
|
+
.action(async () => {
|
|
552
|
+
try {
|
|
553
|
+
const migrationRunner = new migrate_1.MigrationRunner();
|
|
554
|
+
const status = await migrationRunner.status();
|
|
555
|
+
console.log('\nApplied migrations:');
|
|
556
|
+
status.applied.forEach((m) => console.log(` ✓ ${m.version} - ${m.name}`));
|
|
557
|
+
console.log('\nPending migrations:');
|
|
558
|
+
status.pending.forEach((m) => console.log(` ○ ${m.version} - ${m.name}`));
|
|
559
|
+
await client_1.db.close();
|
|
560
|
+
process.exit(0);
|
|
561
|
+
}
|
|
562
|
+
catch (error) {
|
|
563
|
+
console.error('Failed to get migration status:', error);
|
|
564
|
+
await client_1.db.close();
|
|
565
|
+
process.exit(1);
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
dbCommand
|
|
569
|
+
.command('migrate:rollback')
|
|
570
|
+
.description('Rollback last migration')
|
|
571
|
+
.action(async () => {
|
|
572
|
+
try {
|
|
573
|
+
const migrationRunner = new migrate_1.MigrationRunner();
|
|
574
|
+
await migrationRunner.down();
|
|
575
|
+
console.log('Migration rolled back successfully');
|
|
576
|
+
await client_1.db.close();
|
|
577
|
+
process.exit(0);
|
|
578
|
+
}
|
|
579
|
+
catch (error) {
|
|
580
|
+
console.error('Rollback failed:', error);
|
|
581
|
+
await client_1.db.close();
|
|
582
|
+
process.exit(1);
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
// Agent commands - Policy Enforcement Agent
|
|
586
|
+
const agentCommand = program.command('agent').description('Policy Enforcement Agent commands');
|
|
587
|
+
agentCommand
|
|
588
|
+
.command('evaluate')
|
|
589
|
+
.description('Evaluate a request against policy rules')
|
|
590
|
+
.requiredOption('-c, --context <file|json>', 'Context JSON file or inline JSON')
|
|
591
|
+
.option('-r, --request-id <id>', 'Request ID (auto-generated if not provided)')
|
|
592
|
+
.option('-p, --policies <ids>', 'Comma-separated policy IDs to evaluate')
|
|
593
|
+
.option('-d, --dry-run', 'Dry run mode (no side effects)')
|
|
594
|
+
.option('-t, --trace', 'Enable trace mode for debugging')
|
|
595
|
+
.option('--json', 'Output as JSON')
|
|
596
|
+
.action(async (options) => {
|
|
597
|
+
await (0, agent_1.agentEvaluate)({
|
|
598
|
+
context: options.context,
|
|
599
|
+
requestId: options.requestId,
|
|
600
|
+
policies: options.policies,
|
|
601
|
+
dryRun: options.dryRun,
|
|
602
|
+
trace: options.trace,
|
|
603
|
+
json: options.json,
|
|
604
|
+
});
|
|
605
|
+
});
|
|
606
|
+
agentCommand
|
|
607
|
+
.command('resolve')
|
|
608
|
+
.description('Resolve constraint conflicts for a given context')
|
|
609
|
+
.requiredOption('-c, --context <file|json>', 'Context JSON file or inline JSON')
|
|
610
|
+
.option('-r, --request-id <id>', 'Request ID')
|
|
611
|
+
.option('-p, --policies <ids>', 'Comma-separated policy IDs')
|
|
612
|
+
.option('-d, --dry-run', 'Dry run mode')
|
|
613
|
+
.option('--json', 'Output as JSON')
|
|
614
|
+
.action(async (options) => {
|
|
615
|
+
await (0, agent_1.agentResolve)({
|
|
616
|
+
context: options.context,
|
|
617
|
+
requestId: options.requestId,
|
|
618
|
+
policies: options.policies,
|
|
619
|
+
dryRun: options.dryRun,
|
|
620
|
+
trace: true,
|
|
621
|
+
json: options.json,
|
|
622
|
+
});
|
|
623
|
+
});
|
|
624
|
+
agentCommand
|
|
625
|
+
.command('route')
|
|
626
|
+
.description('Route a decision to appropriate enforcement layers')
|
|
627
|
+
.requiredOption('-c, --context <file|json>', 'Context JSON file or inline JSON')
|
|
628
|
+
.option('-r, --request-id <id>', 'Request ID')
|
|
629
|
+
.option('-p, --policies <ids>', 'Comma-separated policy IDs')
|
|
630
|
+
.option('-d, --dry-run', 'Dry run mode')
|
|
631
|
+
.option('-t, --trace', 'Enable trace mode')
|
|
632
|
+
.option('--json', 'Output as JSON')
|
|
633
|
+
.action(async (options) => {
|
|
634
|
+
await (0, agent_1.agentRoute)({
|
|
635
|
+
context: options.context,
|
|
636
|
+
requestId: options.requestId,
|
|
637
|
+
policies: options.policies,
|
|
638
|
+
dryRun: options.dryRun,
|
|
639
|
+
trace: options.trace,
|
|
640
|
+
json: options.json,
|
|
641
|
+
});
|
|
642
|
+
});
|
|
643
|
+
agentCommand
|
|
644
|
+
.command('info')
|
|
645
|
+
.description('Get agent registration information')
|
|
646
|
+
.option('--json', 'Output as JSON')
|
|
647
|
+
.action(async (options) => {
|
|
648
|
+
await (0, agent_1.agentInfo)({ json: options.json });
|
|
649
|
+
});
|
|
650
|
+
agentCommand
|
|
651
|
+
.command('register')
|
|
652
|
+
.description('Register agent with ruvector-service')
|
|
653
|
+
.option('--json', 'Output as JSON')
|
|
654
|
+
.action(async (options) => {
|
|
655
|
+
await (0, agent_1.agentRegister)({ json: options.json });
|
|
656
|
+
});
|
|
657
|
+
// Approval Routing Agent commands
|
|
658
|
+
const approvalCommand = program
|
|
659
|
+
.command('approval')
|
|
660
|
+
.description('Approval Routing Agent commands - manage approval workflows');
|
|
661
|
+
approvalCommand
|
|
662
|
+
.command('evaluate')
|
|
663
|
+
.description('Evaluate approval requirements for an action')
|
|
664
|
+
.requiredOption('-a, --action-type <type>', 'Action type')
|
|
665
|
+
.requiredOption('--resource-id <id>', 'Resource ID')
|
|
666
|
+
.requiredOption('--resource-type <type>', 'Resource type')
|
|
667
|
+
.requiredOption('-o, --operation <op>', 'Operation (create, read, update, delete, execute)')
|
|
668
|
+
.requiredOption('--requester <file|json>', 'Requester JSON file or inline JSON')
|
|
669
|
+
.option('-r, --request-id <id>', 'Request ID')
|
|
670
|
+
.option('--rules <rules>', 'Comma-separated approval rule IDs')
|
|
671
|
+
.option('-p, --priority <level>', 'Priority (low, normal, high, critical, emergency)')
|
|
672
|
+
.option('-c, --context <file|json>', 'Additional context JSON')
|
|
673
|
+
.option('--json', 'Output as JSON')
|
|
674
|
+
.action(async (options) => {
|
|
675
|
+
await (0, approval_routing_1.approvalEvaluate)({
|
|
676
|
+
requestId: options.requestId,
|
|
677
|
+
actionType: options.actionType,
|
|
678
|
+
resourceId: options.resourceId,
|
|
679
|
+
resourceType: options.resourceType,
|
|
680
|
+
operation: options.operation,
|
|
681
|
+
requester: options.requester,
|
|
682
|
+
rules: options.rules,
|
|
683
|
+
priority: options.priority,
|
|
684
|
+
context: options.context,
|
|
685
|
+
json: options.json,
|
|
686
|
+
});
|
|
687
|
+
});
|
|
688
|
+
approvalCommand
|
|
689
|
+
.command('route')
|
|
690
|
+
.description('Route an action to appropriate approval workflow')
|
|
691
|
+
.requiredOption('-a, --action-type <type>', 'Action type')
|
|
692
|
+
.requiredOption('--resource-id <id>', 'Resource ID')
|
|
693
|
+
.requiredOption('--resource-type <type>', 'Resource type')
|
|
694
|
+
.requiredOption('-o, --operation <op>', 'Operation (create, read, update, delete, execute)')
|
|
695
|
+
.requiredOption('--requester <file|json>', 'Requester JSON file or inline JSON')
|
|
696
|
+
.option('-r, --request-id <id>', 'Request ID')
|
|
697
|
+
.option('--rules <rules>', 'Comma-separated approval rule IDs')
|
|
698
|
+
.option('-p, --priority <level>', 'Priority (low, normal, high, critical, emergency)')
|
|
699
|
+
.option('-c, --context <file|json>', 'Additional context JSON')
|
|
700
|
+
.option('--json', 'Output as JSON')
|
|
701
|
+
.action(async (options) => {
|
|
702
|
+
await (0, approval_routing_1.approvalRoute)({
|
|
703
|
+
requestId: options.requestId,
|
|
704
|
+
actionType: options.actionType,
|
|
705
|
+
resourceId: options.resourceId,
|
|
706
|
+
resourceType: options.resourceType,
|
|
707
|
+
operation: options.operation,
|
|
708
|
+
requester: options.requester,
|
|
709
|
+
rules: options.rules,
|
|
710
|
+
priority: options.priority,
|
|
711
|
+
context: options.context,
|
|
712
|
+
json: options.json,
|
|
713
|
+
});
|
|
714
|
+
});
|
|
715
|
+
approvalCommand
|
|
716
|
+
.command('resolve')
|
|
717
|
+
.description('Resolve approval conflicts for an action')
|
|
718
|
+
.requiredOption('-a, --action-type <type>', 'Action type')
|
|
719
|
+
.requiredOption('--resource-id <id>', 'Resource ID')
|
|
720
|
+
.requiredOption('--resource-type <type>', 'Resource type')
|
|
721
|
+
.requiredOption('-o, --operation <op>', 'Operation (create, read, update, delete, execute)')
|
|
722
|
+
.requiredOption('--requester <file|json>', 'Requester JSON file or inline JSON')
|
|
723
|
+
.option('-r, --request-id <id>', 'Request ID')
|
|
724
|
+
.option('--rules <rules>', 'Comma-separated approval rule IDs')
|
|
725
|
+
.option('-p, --priority <level>', 'Priority (low, normal, high, critical, emergency)')
|
|
726
|
+
.option('-c, --context <file|json>', 'Additional context JSON')
|
|
727
|
+
.option('--json', 'Output as JSON')
|
|
728
|
+
.action(async (options) => {
|
|
729
|
+
await (0, approval_routing_1.approvalResolve)({
|
|
730
|
+
requestId: options.requestId,
|
|
731
|
+
actionType: options.actionType,
|
|
732
|
+
resourceId: options.resourceId,
|
|
733
|
+
resourceType: options.resourceType,
|
|
734
|
+
operation: options.operation,
|
|
735
|
+
requester: options.requester,
|
|
736
|
+
rules: options.rules,
|
|
737
|
+
priority: options.priority,
|
|
738
|
+
context: options.context,
|
|
739
|
+
json: options.json,
|
|
740
|
+
});
|
|
741
|
+
});
|
|
742
|
+
approvalCommand
|
|
743
|
+
.command('status <request-id>')
|
|
744
|
+
.description('Get status of an approval request')
|
|
745
|
+
.option('--json', 'Output as JSON')
|
|
746
|
+
.action(async (requestId, options) => {
|
|
747
|
+
await (0, approval_routing_1.approvalStatus)(requestId, { json: options.json });
|
|
748
|
+
});
|
|
749
|
+
approvalCommand
|
|
750
|
+
.command('info')
|
|
751
|
+
.description('Get Approval Routing Agent registration information')
|
|
752
|
+
.option('--json', 'Output as JSON')
|
|
753
|
+
.action(async (options) => {
|
|
754
|
+
await (0, approval_routing_1.approvalInfo)({ json: options.json });
|
|
755
|
+
});
|
|
756
|
+
approvalCommand
|
|
757
|
+
.command('register')
|
|
758
|
+
.description('Register Approval Routing Agent with ruvector-service')
|
|
759
|
+
.option('--json', 'Output as JSON')
|
|
760
|
+
.action(async (options) => {
|
|
761
|
+
await (0, approval_routing_1.approvalRegister)({ json: options.json });
|
|
762
|
+
});
|
|
763
|
+
// Server commands
|
|
764
|
+
program
|
|
765
|
+
.command('server:start')
|
|
766
|
+
.description('Start the API server')
|
|
767
|
+
.option('-p, --port <port>', 'Server port')
|
|
768
|
+
.action(async (options) => {
|
|
769
|
+
try {
|
|
770
|
+
const { startAPIServer } = await import('../api/server');
|
|
771
|
+
await startAPIServer(options.port ? parseInt(options.port, 10) : undefined);
|
|
772
|
+
}
|
|
773
|
+
catch (error) {
|
|
774
|
+
console.error('Failed to start server:', error);
|
|
775
|
+
process.exit(1);
|
|
776
|
+
}
|
|
777
|
+
});
|
|
778
|
+
program
|
|
779
|
+
.command('grpc:start')
|
|
780
|
+
.description('Start the gRPC server')
|
|
781
|
+
.option('-p, --port <port>', 'gRPC server port')
|
|
782
|
+
.action(async (options) => {
|
|
783
|
+
try {
|
|
784
|
+
const { startGRPCServer } = await import('../grpc/server');
|
|
785
|
+
await startGRPCServer(options.port ? parseInt(options.port, 10) : undefined);
|
|
786
|
+
}
|
|
787
|
+
catch (error) {
|
|
788
|
+
console.error('Failed to start gRPC server:', error);
|
|
789
|
+
process.exit(1);
|
|
790
|
+
}
|
|
791
|
+
});
|
|
792
|
+
// Parse arguments
|
|
793
|
+
program.parse(process.argv);
|
|
794
|
+
//# sourceMappingURL=index.js.map
|