@dcyfr/ai 2.1.3 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +81 -0
- package/README.md +75 -10
- package/config/default.json +11 -5
- package/config/default.yaml +13 -5
- package/dist/.tsbuildinfo +1 -0
- package/dist/ai/agents/agent-loader.d.ts.map +1 -1
- package/dist/ai/agents/agent-loader.js +1 -0
- package/dist/ai/agents/agent-loader.js.map +1 -1
- package/dist/ai/agents/agent-registry.d.ts.map +1 -1
- package/dist/ai/agents/agent-registry.js.map +1 -1
- package/dist/ai/agents/agent-router.d.ts +3 -3
- package/dist/ai/agents/agent-router.d.ts.map +1 -1
- package/dist/ai/agents/agent-router.js +6 -7
- package/dist/ai/agents/agent-router.js.map +1 -1
- package/dist/ai/config/schema.js +3 -3
- package/dist/ai/config/schema.js.map +1 -1
- package/dist/ai/core/provider-registry.d.ts.map +1 -1
- package/dist/ai/core/provider-registry.js +47 -16
- package/dist/ai/core/provider-registry.js.map +1 -1
- package/dist/ai/core/telemetry-engine.d.ts.map +1 -1
- package/dist/ai/core/telemetry-engine.js +5 -3
- package/dist/ai/core/telemetry-engine.js.map +1 -1
- package/dist/ai/delegation/capability-bootstrap.js +1 -1
- package/dist/ai/delegation/capability-bootstrap.js.map +1 -1
- package/dist/ai/delegation/contract-manager.d.ts +54 -5
- package/dist/ai/delegation/contract-manager.d.ts.map +1 -1
- package/dist/ai/delegation/contract-manager.js +122 -7
- package/dist/ai/delegation/contract-manager.js.map +1 -1
- package/dist/ai/delegation/feature-flags.d.ts +1 -1
- package/dist/ai/delegation/feature-flags.d.ts.map +1 -1
- package/dist/ai/delegation/feature-flags.js +3 -1
- package/dist/ai/delegation/feature-flags.js.map +1 -1
- package/dist/ai/delegation/index.d.ts +1 -0
- package/dist/ai/delegation/index.d.ts.map +1 -1
- package/dist/ai/delegation/index.js +2 -0
- package/dist/ai/delegation/index.js.map +1 -1
- package/dist/ai/delegation/monitoring.d.ts.map +1 -1
- package/dist/ai/delegation/monitoring.js +1 -0
- package/dist/ai/delegation/monitoring.js.map +1 -1
- package/dist/ai/delegation/session-manager.d.ts +16 -1
- package/dist/ai/delegation/session-manager.d.ts.map +1 -1
- package/dist/ai/delegation/session-manager.js +10 -1
- package/dist/ai/delegation/session-manager.js.map +1 -1
- package/dist/ai/delegation/session-queue.d.ts.map +1 -1
- package/dist/ai/delegation/session-queue.js.map +1 -1
- package/dist/ai/examples/integration-demo.d.ts.map +1 -1
- package/dist/ai/examples/integration-demo.js +1 -0
- package/dist/ai/examples/integration-demo.js.map +1 -1
- package/dist/ai/index.d.ts +7 -0
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +8 -0
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/mcp/mcp-registry.d.ts.map +1 -1
- package/dist/ai/mcp/mcp-registry.js +1 -1
- package/dist/ai/mcp/mcp-registry.js.map +1 -1
- package/dist/ai/mcp/servers/analytics/index.d.ts.map +1 -1
- package/dist/ai/mcp/servers/analytics/index.js +1 -0
- package/dist/ai/mcp/servers/analytics/index.js.map +1 -1
- package/dist/ai/mcp/servers/content-manager/index.d.ts.map +1 -1
- package/dist/ai/mcp/servers/delegation-monitor/index.js +27 -27
- package/dist/ai/mcp/servers/delegation-monitor/index.js.map +1 -1
- package/dist/ai/mcp/servers/design-tokens/index.js +1 -1
- package/dist/ai/mcp/servers/design-tokens/index.js.map +1 -1
- package/dist/ai/mcp/servers/promptintel/index.d.ts.map +1 -1
- package/dist/ai/mcp/servers/promptintel/index.js +2 -1
- package/dist/ai/mcp/servers/promptintel/index.js.map +1 -1
- package/dist/ai/mcp/servers/shared/rate-limiter.d.ts.map +1 -1
- package/dist/ai/mcp/servers/shared/rate-limiter.js +1 -0
- package/dist/ai/mcp/servers/shared/rate-limiter.js.map +1 -1
- package/dist/ai/mcp/servers/shared/redis-client.d.ts.map +1 -1
- package/dist/ai/mcp/servers/shared/redis-client.js +2 -0
- package/dist/ai/mcp/servers/shared/redis-client.js.map +1 -1
- package/dist/ai/mcp/servers/shared/utils.js +12 -18
- package/dist/ai/mcp/servers/shared/utils.js.map +1 -1
- package/dist/ai/memory/dcyfr-memory.d.ts.map +1 -1
- package/dist/ai/memory/dcyfr-memory.js +11 -1
- package/dist/ai/memory/dcyfr-memory.js.map +1 -1
- package/dist/ai/memory/file-memory-adapter.d.ts +103 -0
- package/dist/ai/memory/file-memory-adapter.d.ts.map +1 -0
- package/dist/ai/memory/file-memory-adapter.js +532 -0
- package/dist/ai/memory/file-memory-adapter.js.map +1 -0
- package/dist/ai/memory/index.d.ts +6 -0
- package/dist/ai/memory/index.d.ts.map +1 -1
- package/dist/ai/memory/index.js +6 -0
- package/dist/ai/memory/index.js.map +1 -1
- package/dist/ai/memory/mem0-client.d.ts.map +1 -1
- package/dist/ai/memory/mem0-client.js +5 -2
- package/dist/ai/memory/mem0-client.js.map +1 -1
- package/dist/ai/memory/sqlite-index.d.ts +89 -0
- package/dist/ai/memory/sqlite-index.d.ts.map +1 -0
- package/dist/ai/memory/sqlite-index.js +295 -0
- package/dist/ai/memory/sqlite-index.js.map +1 -0
- package/dist/ai/memory/types.d.ts.map +1 -1
- package/dist/ai/memory/types.js +1 -0
- package/dist/ai/memory/types.js.map +1 -1
- package/dist/ai/memory/working-memory-persistence.d.ts +79 -0
- package/dist/ai/memory/working-memory-persistence.d.ts.map +1 -0
- package/dist/ai/memory/working-memory-persistence.js +220 -0
- package/dist/ai/memory/working-memory-persistence.js.map +1 -0
- package/dist/ai/permissions/attenuation-engine.d.ts.map +1 -1
- package/dist/ai/permissions/attenuation-engine.js.map +1 -1
- package/dist/ai/reputation/reputation-engine.d.ts +4 -0
- package/dist/ai/reputation/reputation-engine.d.ts.map +1 -1
- package/dist/ai/reputation/reputation-engine.js +1 -0
- package/dist/ai/reputation/reputation-engine.js.map +1 -1
- package/dist/ai/runtime/agent-runtime.d.ts.map +1 -1
- package/dist/ai/runtime/agent-runtime.js +9 -5
- package/dist/ai/runtime/agent-runtime.js.map +1 -1
- package/dist/ai/src/batch-processor.d.ts +6 -6
- package/dist/ai/src/batch-processor.d.ts.map +1 -1
- package/dist/ai/src/batch-processor.js +11 -4
- package/dist/ai/src/batch-processor.js.map +1 -1
- package/dist/ai/src/capability-bootstrap.d.ts.map +1 -1
- package/dist/ai/src/capability-bootstrap.js +1 -0
- package/dist/ai/src/capability-bootstrap.js.map +1 -1
- package/dist/ai/src/capability-registry.js +1 -1
- package/dist/ai/src/capability-registry.js.map +1 -1
- package/dist/ai/src/cli/telemetry-dashboard.d.ts +0 -11
- package/dist/ai/src/cli/telemetry-dashboard.d.ts.map +1 -1
- package/dist/ai/src/cli/telemetry-dashboard.js +12 -6
- package/dist/ai/src/cli/telemetry-dashboard.js.map +1 -1
- package/dist/ai/src/compaction/context-compactor.d.ts +149 -0
- package/dist/ai/src/compaction/context-compactor.d.ts.map +1 -0
- package/dist/ai/src/compaction/context-compactor.js +302 -0
- package/dist/ai/src/compaction/context-compactor.js.map +1 -0
- package/dist/ai/src/compaction/index.d.ts +11 -0
- package/dist/ai/src/compaction/index.d.ts.map +1 -0
- package/dist/ai/src/compaction/index.js +11 -0
- package/dist/ai/src/compaction/index.js.map +1 -0
- package/dist/ai/src/compaction/memory-compaction.d.ts +138 -0
- package/dist/ai/src/compaction/memory-compaction.d.ts.map +1 -0
- package/dist/ai/src/compaction/memory-compaction.js +630 -0
- package/dist/ai/src/compaction/memory-compaction.js.map +1 -0
- package/dist/ai/src/container/agent-container-dispatcher.d.ts +154 -0
- package/dist/ai/src/container/agent-container-dispatcher.d.ts.map +1 -0
- package/dist/ai/src/container/agent-container-dispatcher.js +329 -0
- package/dist/ai/src/container/agent-container-dispatcher.js.map +1 -0
- package/dist/ai/src/container/backend-factory.d.ts +89 -0
- package/dist/ai/src/container/backend-factory.d.ts.map +1 -0
- package/dist/ai/src/container/backend-factory.js +169 -0
- package/dist/ai/src/container/backend-factory.js.map +1 -0
- package/dist/ai/src/container/index.d.ts +13 -0
- package/dist/ai/src/container/index.d.ts.map +1 -0
- package/dist/ai/src/container/index.js +13 -0
- package/dist/ai/src/container/index.js.map +1 -0
- package/dist/ai/src/container/kubernetes-backend.d.ts +23 -0
- package/dist/ai/src/container/kubernetes-backend.d.ts.map +1 -0
- package/dist/ai/src/container/kubernetes-backend.js +39 -0
- package/dist/ai/src/container/kubernetes-backend.js.map +1 -0
- package/dist/ai/src/container/local-docker-backend.d.ts +77 -0
- package/dist/ai/src/container/local-docker-backend.d.ts.map +1 -0
- package/dist/ai/src/container/local-docker-backend.js +362 -0
- package/dist/ai/src/container/local-docker-backend.js.map +1 -0
- package/dist/ai/src/container/remote-docker-backend.d.ts +35 -0
- package/dist/ai/src/container/remote-docker-backend.d.ts.map +1 -0
- package/dist/ai/src/container/remote-docker-backend.js +189 -0
- package/dist/ai/src/container/remote-docker-backend.js.map +1 -0
- package/dist/ai/src/container/types.d.ts +270 -0
- package/dist/ai/src/container/types.d.ts.map +1 -0
- package/dist/ai/src/container/types.js +86 -0
- package/dist/ai/src/container/types.js.map +1 -0
- package/dist/ai/src/delegation/feature-flags.d.ts.map +1 -1
- package/dist/ai/src/delegation/feature-flags.js +1 -0
- package/dist/ai/src/delegation/feature-flags.js.map +1 -1
- package/dist/ai/src/delegation/liability-firebreak.d.ts.map +1 -1
- package/dist/ai/src/delegation/liability-firebreak.js +1 -0
- package/dist/ai/src/delegation/liability-firebreak.js.map +1 -1
- package/dist/ai/src/delegation/security-threat-model.d.ts.map +1 -1
- package/dist/ai/src/delegation/security-threat-model.js +1 -1
- package/dist/ai/src/delegation/security-threat-model.js.map +1 -1
- package/dist/ai/src/delegation-capability-integration.d.ts +1 -1
- package/dist/ai/src/delegation-capability-integration.d.ts.map +1 -1
- package/dist/ai/src/delegation-capability-integration.js +2 -7
- package/dist/ai/src/delegation-capability-integration.js.map +1 -1
- package/dist/ai/src/end-to-end-workflow-orchestrator.d.ts.map +1 -1
- package/dist/ai/src/end-to-end-workflow-orchestrator.js +2 -1
- package/dist/ai/src/end-to-end-workflow-orchestrator.js.map +1 -1
- package/dist/ai/src/enhanced-capability-detection.d.ts +1 -1
- package/dist/ai/src/enhanced-capability-detection.d.ts.map +1 -1
- package/dist/ai/src/enhanced-capability-detection.js +1 -1
- package/dist/ai/src/enhanced-capability-detection.js.map +1 -1
- package/dist/ai/src/gateway/index.d.ts +6 -0
- package/dist/ai/src/gateway/index.d.ts.map +1 -0
- package/dist/ai/src/gateway/index.js +6 -0
- package/dist/ai/src/gateway/index.js.map +1 -0
- package/dist/ai/src/gateway/message-gateway.d.ts +296 -0
- package/dist/ai/src/gateway/message-gateway.d.ts.map +1 -0
- package/dist/ai/src/gateway/message-gateway.js +415 -0
- package/dist/ai/src/gateway/message-gateway.js.map +1 -0
- package/dist/ai/src/intelligent-cache-manager.d.ts.map +1 -1
- package/dist/ai/src/intelligent-cache-manager.js +2 -1
- package/dist/ai/src/intelligent-cache-manager.js.map +1 -1
- package/dist/ai/src/mcp/index.d.ts +10 -0
- package/dist/ai/src/mcp/index.d.ts.map +1 -0
- package/dist/ai/src/mcp/index.js +10 -0
- package/dist/ai/src/mcp/index.js.map +1 -0
- package/dist/ai/src/mcp/mcp-tool-bridge.d.ts +186 -0
- package/dist/ai/src/mcp/mcp-tool-bridge.d.ts.map +1 -0
- package/dist/ai/src/mcp/mcp-tool-bridge.js +292 -0
- package/dist/ai/src/mcp/mcp-tool-bridge.js.map +1 -0
- package/dist/ai/src/mcp-auto-configuration.d.ts.map +1 -1
- package/dist/ai/src/mcp-auto-configuration.js +2 -1
- package/dist/ai/src/mcp-auto-configuration.js.map +1 -1
- package/dist/ai/src/performance-profiler.d.ts.map +1 -1
- package/dist/ai/src/performance-profiler.js +1 -0
- package/dist/ai/src/performance-profiler.js.map +1 -1
- package/dist/ai/src/plugins/anomaly/anomaly-detector.d.ts +58 -0
- package/dist/ai/src/plugins/anomaly/anomaly-detector.d.ts.map +1 -0
- package/dist/ai/src/plugins/anomaly/anomaly-detector.js +101 -0
- package/dist/ai/src/plugins/anomaly/anomaly-detector.js.map +1 -0
- package/dist/ai/src/plugins/anomaly/anomaly-monitor.d.ts +145 -0
- package/dist/ai/src/plugins/anomaly/anomaly-monitor.d.ts.map +1 -0
- package/dist/ai/src/plugins/anomaly/anomaly-monitor.js +245 -0
- package/dist/ai/src/plugins/anomaly/anomaly-monitor.js.map +1 -0
- package/dist/ai/src/plugins/anomaly/behavior-baseline.d.ts +79 -0
- package/dist/ai/src/plugins/anomaly/behavior-baseline.d.ts.map +1 -0
- package/dist/ai/src/plugins/anomaly/behavior-baseline.js +161 -0
- package/dist/ai/src/plugins/anomaly/behavior-baseline.js.map +1 -0
- package/dist/ai/src/plugins/anomaly/index.d.ts +15 -0
- package/dist/ai/src/plugins/anomaly/index.d.ts.map +1 -0
- package/dist/ai/src/plugins/anomaly/index.js +12 -0
- package/dist/ai/src/plugins/anomaly/index.js.map +1 -0
- package/dist/ai/src/plugins/anomaly/types.d.ts +150 -0
- package/dist/ai/src/plugins/anomaly/types.d.ts.map +1 -0
- package/dist/ai/src/plugins/anomaly/types.js +68 -0
- package/dist/ai/src/plugins/anomaly/types.js.map +1 -0
- package/dist/ai/src/plugins/certification/certification-manager.d.ts +102 -0
- package/dist/ai/src/plugins/certification/certification-manager.d.ts.map +1 -0
- package/dist/ai/src/plugins/certification/certification-manager.js +321 -0
- package/dist/ai/src/plugins/certification/certification-manager.js.map +1 -0
- package/dist/ai/src/plugins/certification/index.d.ts +12 -0
- package/dist/ai/src/plugins/certification/index.d.ts.map +1 -0
- package/dist/ai/src/plugins/certification/index.js +10 -0
- package/dist/ai/src/plugins/certification/index.js.map +1 -0
- package/dist/ai/src/plugins/certification/types.d.ts +128 -0
- package/dist/ai/src/plugins/certification/types.d.ts.map +1 -0
- package/dist/ai/src/plugins/certification/types.js +201 -0
- package/dist/ai/src/plugins/certification/types.js.map +1 -0
- package/dist/ai/src/plugins/escalation/escalation-trigger.d.ts +155 -0
- package/dist/ai/src/plugins/escalation/escalation-trigger.d.ts.map +1 -0
- package/dist/ai/src/plugins/escalation/escalation-trigger.js +183 -0
- package/dist/ai/src/plugins/escalation/escalation-trigger.js.map +1 -0
- package/dist/ai/src/plugins/escalation/index.d.ts +11 -0
- package/dist/ai/src/plugins/escalation/index.d.ts.map +1 -0
- package/dist/ai/src/plugins/escalation/index.js +10 -0
- package/dist/ai/src/plugins/escalation/index.js.map +1 -0
- package/dist/ai/src/plugins/incidents/incident-response-manager.d.ts +165 -0
- package/dist/ai/src/plugins/incidents/incident-response-manager.d.ts.map +1 -0
- package/dist/ai/src/plugins/incidents/incident-response-manager.js +462 -0
- package/dist/ai/src/plugins/incidents/incident-response-manager.js.map +1 -0
- package/dist/ai/src/plugins/incidents/index.d.ts +8 -0
- package/dist/ai/src/plugins/incidents/index.d.ts.map +1 -0
- package/dist/ai/src/plugins/incidents/index.js +7 -0
- package/dist/ai/src/plugins/incidents/index.js.map +1 -0
- package/dist/ai/src/plugins/incidents/types.d.ts +183 -0
- package/dist/ai/src/plugins/incidents/types.d.ts.map +1 -0
- package/dist/ai/src/plugins/incidents/types.js +55 -0
- package/dist/ai/src/plugins/incidents/types.js.map +1 -0
- package/dist/ai/src/plugins/permissions/index.d.ts +17 -0
- package/dist/ai/src/plugins/permissions/index.d.ts.map +1 -0
- package/dist/ai/src/plugins/permissions/index.js +14 -0
- package/dist/ai/src/plugins/permissions/index.js.map +1 -0
- package/dist/ai/src/plugins/permissions/permission-attenuator.d.ts +29 -0
- package/dist/ai/src/plugins/permissions/permission-attenuator.d.ts.map +1 -0
- package/dist/ai/src/plugins/permissions/permission-attenuator.js +190 -0
- package/dist/ai/src/plugins/permissions/permission-attenuator.js.map +1 -0
- package/dist/ai/src/plugins/permissions/permission-audit-logger.d.ts +72 -0
- package/dist/ai/src/plugins/permissions/permission-audit-logger.d.ts.map +1 -0
- package/dist/ai/src/plugins/permissions/permission-audit-logger.js +176 -0
- package/dist/ai/src/plugins/permissions/permission-audit-logger.js.map +1 -0
- package/dist/ai/src/plugins/permissions/permission-enforcer.d.ts +99 -0
- package/dist/ai/src/plugins/permissions/permission-enforcer.d.ts.map +1 -0
- package/dist/ai/src/plugins/permissions/permission-enforcer.js +151 -0
- package/dist/ai/src/plugins/permissions/permission-enforcer.js.map +1 -0
- package/dist/ai/src/plugins/permissions/plugin-permission-validator.d.ts +39 -0
- package/dist/ai/src/plugins/permissions/plugin-permission-validator.d.ts.map +1 -0
- package/dist/ai/src/plugins/permissions/plugin-permission-validator.js +296 -0
- package/dist/ai/src/plugins/permissions/plugin-permission-validator.js.map +1 -0
- package/dist/ai/src/plugins/permissions/types.d.ts +116 -0
- package/dist/ai/src/plugins/permissions/types.d.ts.map +1 -0
- package/dist/ai/src/plugins/permissions/types.js +36 -0
- package/dist/ai/src/plugins/permissions/types.js.map +1 -0
- package/dist/ai/src/plugins/reputation/index.d.ts +9 -0
- package/dist/ai/src/plugins/reputation/index.d.ts.map +1 -0
- package/dist/ai/src/plugins/reputation/index.js +8 -0
- package/dist/ai/src/plugins/reputation/index.js.map +1 -0
- package/dist/ai/src/plugins/reputation/plugin-reputation-db.d.ts +29 -0
- package/dist/ai/src/plugins/reputation/plugin-reputation-db.d.ts.map +1 -0
- package/dist/ai/src/plugins/reputation/plugin-reputation-db.js +120 -0
- package/dist/ai/src/plugins/reputation/plugin-reputation-db.js.map +1 -0
- package/dist/ai/src/plugins/reputation/plugin-reputation-engine.d.ts +115 -0
- package/dist/ai/src/plugins/reputation/plugin-reputation-engine.d.ts.map +1 -0
- package/dist/ai/src/plugins/reputation/plugin-reputation-engine.js +528 -0
- package/dist/ai/src/plugins/reputation/plugin-reputation-engine.js.map +1 -0
- package/dist/ai/src/plugins/reputation/types.d.ts +149 -0
- package/dist/ai/src/plugins/reputation/types.d.ts.map +1 -0
- package/dist/ai/src/plugins/reputation/types.js +14 -0
- package/dist/ai/src/plugins/reputation/types.js.map +1 -0
- package/dist/ai/src/plugins/reviews/index.d.ts +11 -0
- package/dist/ai/src/plugins/reviews/index.d.ts.map +1 -0
- package/dist/ai/src/plugins/reviews/index.js +10 -0
- package/dist/ai/src/plugins/reviews/index.js.map +1 -0
- package/dist/ai/src/plugins/reviews/plugin-rating-aggregator.d.ts +116 -0
- package/dist/ai/src/plugins/reviews/plugin-rating-aggregator.d.ts.map +1 -0
- package/dist/ai/src/plugins/reviews/plugin-rating-aggregator.js +282 -0
- package/dist/ai/src/plugins/reviews/plugin-rating-aggregator.js.map +1 -0
- package/dist/ai/src/plugins/reviews/types.d.ts +113 -0
- package/dist/ai/src/plugins/reviews/types.d.ts.map +1 -0
- package/dist/ai/src/plugins/reviews/types.js +55 -0
- package/dist/ai/src/plugins/reviews/types.js.map +1 -0
- package/dist/ai/src/plugins/runtime/docker-plugin-runner.d.ts +77 -0
- package/dist/ai/src/plugins/runtime/docker-plugin-runner.d.ts.map +1 -0
- package/dist/ai/src/plugins/runtime/docker-plugin-runner.js +248 -0
- package/dist/ai/src/plugins/runtime/docker-plugin-runner.js.map +1 -0
- package/dist/ai/src/plugins/runtime/gvisor-plugin-runner.d.ts +99 -0
- package/dist/ai/src/plugins/runtime/gvisor-plugin-runner.d.ts.map +1 -0
- package/dist/ai/src/plugins/runtime/gvisor-plugin-runner.js +158 -0
- package/dist/ai/src/plugins/runtime/gvisor-plugin-runner.js.map +1 -0
- package/dist/ai/src/plugins/runtime/index.d.ts +13 -0
- package/dist/ai/src/plugins/runtime/index.d.ts.map +1 -0
- package/dist/ai/src/plugins/runtime/index.js +11 -0
- package/dist/ai/src/plugins/runtime/index.js.map +1 -0
- package/dist/ai/src/plugins/runtime/types.d.ts +143 -0
- package/dist/ai/src/plugins/runtime/types.d.ts.map +1 -0
- package/dist/ai/src/plugins/runtime/types.js +19 -0
- package/dist/ai/src/plugins/runtime/types.js.map +1 -0
- package/dist/ai/src/plugins/runtime/wasm-plugin-runner.d.ts +104 -0
- package/dist/ai/src/plugins/runtime/wasm-plugin-runner.d.ts.map +1 -0
- package/dist/ai/src/plugins/runtime/wasm-plugin-runner.js +307 -0
- package/dist/ai/src/plugins/runtime/wasm-plugin-runner.js.map +1 -0
- package/dist/ai/src/plugins/security/index.d.ts +24 -0
- package/dist/ai/src/plugins/security/index.d.ts.map +1 -0
- package/dist/ai/src/plugins/security/index.js +23 -0
- package/dist/ai/src/plugins/security/index.js.map +1 -0
- package/dist/ai/src/plugins/security/license-checker.d.ts +26 -0
- package/dist/ai/src/plugins/security/license-checker.d.ts.map +1 -0
- package/dist/ai/src/plugins/security/license-checker.js +137 -0
- package/dist/ai/src/plugins/security/license-checker.js.map +1 -0
- package/dist/ai/src/plugins/security/malware-scanner.d.ts +19 -0
- package/dist/ai/src/plugins/security/malware-scanner.d.ts.map +1 -0
- package/dist/ai/src/plugins/security/malware-scanner.js +121 -0
- package/dist/ai/src/plugins/security/malware-scanner.js.map +1 -0
- package/dist/ai/src/plugins/security/plugin-security-scanner.d.ts +36 -0
- package/dist/ai/src/plugins/security/plugin-security-scanner.d.ts.map +1 -0
- package/dist/ai/src/plugins/security/plugin-security-scanner.js +160 -0
- package/dist/ai/src/plugins/security/plugin-security-scanner.js.map +1 -0
- package/dist/ai/src/plugins/security/sbom-generator.d.ts +23 -0
- package/dist/ai/src/plugins/security/sbom-generator.d.ts.map +1 -0
- package/dist/ai/src/plugins/security/sbom-generator.js +115 -0
- package/dist/ai/src/plugins/security/sbom-generator.js.map +1 -0
- package/dist/ai/src/plugins/security/secret-detector.d.ts +19 -0
- package/dist/ai/src/plugins/security/secret-detector.d.ts.map +1 -0
- package/dist/ai/src/plugins/security/secret-detector.js +204 -0
- package/dist/ai/src/plugins/security/secret-detector.js.map +1 -0
- package/dist/ai/src/plugins/security/signature-verifier.d.ts +21 -0
- package/dist/ai/src/plugins/security/signature-verifier.d.ts.map +1 -0
- package/dist/ai/src/plugins/security/signature-verifier.js +75 -0
- package/dist/ai/src/plugins/security/signature-verifier.js.map +1 -0
- package/dist/ai/src/plugins/security/sonarcloud-client.d.ts +20 -0
- package/dist/ai/src/plugins/security/sonarcloud-client.d.ts.map +1 -0
- package/dist/ai/src/plugins/security/sonarcloud-client.js +106 -0
- package/dist/ai/src/plugins/security/sonarcloud-client.js.map +1 -0
- package/dist/ai/src/plugins/security/trust-score.d.ts +58 -0
- package/dist/ai/src/plugins/security/trust-score.d.ts.map +1 -0
- package/dist/ai/src/plugins/security/trust-score.js +173 -0
- package/dist/ai/src/plugins/security/trust-score.js.map +1 -0
- package/dist/ai/src/plugins/security/types.d.ts +220 -0
- package/dist/ai/src/plugins/security/types.d.ts.map +1 -0
- package/dist/ai/src/plugins/security/types.js +12 -0
- package/dist/ai/src/plugins/security/types.js.map +1 -0
- package/dist/ai/src/plugins/security/vulnerability-scanner.d.ts +22 -0
- package/dist/ai/src/plugins/security/vulnerability-scanner.d.ts.map +1 -0
- package/dist/ai/src/plugins/security/vulnerability-scanner.js +109 -0
- package/dist/ai/src/plugins/security/vulnerability-scanner.js.map +1 -0
- package/dist/ai/src/plugins/tlp/index.d.ts +17 -0
- package/dist/ai/src/plugins/tlp/index.d.ts.map +1 -0
- package/dist/ai/src/plugins/tlp/index.js +17 -0
- package/dist/ai/src/plugins/tlp/index.js.map +1 -0
- package/dist/ai/src/plugins/tlp/tlp-classifier.d.ts +55 -0
- package/dist/ai/src/plugins/tlp/tlp-classifier.d.ts.map +1 -0
- package/dist/ai/src/plugins/tlp/tlp-classifier.js +232 -0
- package/dist/ai/src/plugins/tlp/tlp-classifier.js.map +1 -0
- package/dist/ai/src/plugins/tlp/tlp-validator.d.ts +97 -0
- package/dist/ai/src/plugins/tlp/tlp-validator.d.ts.map +1 -0
- package/dist/ai/src/plugins/tlp/tlp-validator.js +120 -0
- package/dist/ai/src/plugins/tlp/tlp-validator.js.map +1 -0
- package/dist/ai/src/plugins/tlp/types.d.ts +84 -0
- package/dist/ai/src/plugins/tlp/types.d.ts.map +1 -0
- package/dist/ai/src/plugins/tlp/types.js +20 -0
- package/dist/ai/src/plugins/tlp/types.js.map +1 -0
- package/dist/ai/src/resource-monitor.d.ts +1 -1
- package/dist/ai/src/resource-monitor.d.ts.map +1 -1
- package/dist/ai/src/resource-monitor.js +4 -3
- package/dist/ai/src/resource-monitor.js.map +1 -1
- package/dist/ai/src/runtime/agent-runtime.d.ts +77 -0
- package/dist/ai/src/runtime/agent-runtime.d.ts.map +1 -1
- package/dist/ai/src/runtime/agent-runtime.js +138 -2
- package/dist/ai/src/runtime/agent-runtime.js.map +1 -1
- package/dist/ai/src/scheduler/agent-scheduler.d.ts +365 -0
- package/dist/ai/src/scheduler/agent-scheduler.d.ts.map +1 -0
- package/dist/ai/src/scheduler/agent-scheduler.js +610 -0
- package/dist/ai/src/scheduler/agent-scheduler.js.map +1 -0
- package/dist/ai/src/scheduler/index.d.ts +6 -0
- package/dist/ai/src/scheduler/index.d.ts.map +1 -0
- package/dist/ai/src/scheduler/index.js +6 -0
- package/dist/ai/src/scheduler/index.js.map +1 -0
- package/dist/ai/src/session/index.d.ts +6 -0
- package/dist/ai/src/session/index.d.ts.map +1 -0
- package/dist/ai/src/session/index.js +6 -0
- package/dist/ai/src/session/index.js.map +1 -0
- package/dist/ai/src/session/session-manager.d.ts +380 -0
- package/dist/ai/src/session/session-manager.d.ts.map +1 -0
- package/dist/ai/src/session/session-manager.js +625 -0
- package/dist/ai/src/session/session-manager.js.map +1 -0
- package/dist/ai/src/skills/index.d.ts +10 -0
- package/dist/ai/src/skills/index.d.ts.map +1 -0
- package/dist/ai/src/skills/index.js +10 -0
- package/dist/ai/src/skills/index.js.map +1 -0
- package/dist/ai/src/skills/skill-registry.d.ts +181 -0
- package/dist/ai/src/skills/skill-registry.d.ts.map +1 -0
- package/dist/ai/src/skills/skill-registry.js +465 -0
- package/dist/ai/src/skills/skill-registry.js.map +1 -0
- package/dist/ai/src/telemetry/delegation-telemetry.d.ts.map +1 -1
- package/dist/ai/src/telemetry/delegation-telemetry.js +1 -0
- package/dist/ai/src/telemetry/delegation-telemetry.js.map +1 -1
- package/dist/ai/src/telemetry/runtime-telemetry-integration.d.ts +1 -1
- package/dist/ai/src/telemetry/runtime-telemetry-integration.d.ts.map +1 -1
- package/dist/ai/src/telemetry/runtime-telemetry-integration.js +3 -2
- package/dist/ai/src/telemetry/runtime-telemetry-integration.js.map +1 -1
- package/dist/ai/src/telemetry/telemetry-utils.d.ts.map +1 -1
- package/dist/ai/src/telemetry/telemetry-utils.js +1 -0
- package/dist/ai/src/telemetry/telemetry-utils.js.map +1 -1
- package/dist/ai/src/types/agent-capabilities.d.ts.map +1 -1
- package/dist/ai/src/types/agent-capabilities.js +1 -0
- package/dist/ai/src/types/agent-capabilities.js.map +1 -1
- package/dist/ai/src/types/delegation-contracts.d.ts +92 -0
- package/dist/ai/src/types/delegation-contracts.d.ts.map +1 -1
- package/dist/ai/src/types/delegation-contracts.js.map +1 -1
- package/dist/ai/src/validation-pipeline-integration.d.ts.map +1 -1
- package/dist/ai/src/validation-pipeline-integration.js +1 -2
- package/dist/ai/src/validation-pipeline-integration.js.map +1 -1
- package/dist/ai/src/verification/multi-modal-formatters.d.ts +1 -1
- package/dist/ai/src/verification/multi-modal-formatters.d.ts.map +1 -1
- package/dist/ai/src/verification/multi-modal-formatters.js +3 -2
- package/dist/ai/src/verification/multi-modal-formatters.js.map +1 -1
- package/dist/ai/src/verification/output-formatter.d.ts +1 -1
- package/dist/ai/src/verification/output-formatter.d.ts.map +1 -1
- package/dist/ai/src/verification/output-formatter.js +2 -1
- package/dist/ai/src/verification/output-formatter.js.map +1 -1
- package/dist/ai/src/verification/parser-integration.d.ts.map +1 -1
- package/dist/ai/src/verification/parser-integration.js.map +1 -1
- package/dist/ai/types/agent-capabilities.d.ts +7 -0
- package/dist/ai/types/agent-capabilities.d.ts.map +1 -1
- package/dist/ai/types/delegation-contracts.d.ts +75 -0
- package/dist/ai/types/delegation-contracts.d.ts.map +1 -1
- package/dist/ai/types/index.d.ts +3 -3
- package/dist/ai/types/index.d.ts.map +1 -1
- package/dist/ai/types/index.js.map +1 -1
- package/dist/ai/types/permission-tokens.d.ts +23 -0
- package/dist/ai/types/permission-tokens.d.ts.map +1 -1
- package/dist/ai/types/permission-tokens.js +65 -1
- package/dist/ai/types/permission-tokens.js.map +1 -1
- package/dist/ai/validation/validation-framework.d.ts.map +1 -1
- package/dist/ai/verification/policy-framework.d.ts +1 -1
- package/dist/ai/verification/policy-framework.d.ts.map +1 -1
- package/dist/ai/verification/policy-framework.js +4 -4
- package/dist/ai/verification/policy-framework.js.map +1 -1
- package/package.json +33 -4
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TLP Classifier for Plugin Marketplace
|
|
3
|
+
*
|
|
4
|
+
* Analyzes a plugin's PluginPermissions manifest and derives an appropriate
|
|
5
|
+
* TLP 2.0 classification level using a deterministic rule-set. Rules are
|
|
6
|
+
* evaluated in escalating order; the highest triggered level wins.
|
|
7
|
+
*
|
|
8
|
+
* Classification rules (highest → lowest priority):
|
|
9
|
+
* RED — secret access, unrestricted shell execution, or deleting sensitive paths
|
|
10
|
+
* AMBER — network egress, restricted shell, env-var access, or writing sensitive paths
|
|
11
|
+
* GREEN — any filesystem write/delete, any MCP server access
|
|
12
|
+
* CLEAR — read-only, no network, no shell, no secrets (default)
|
|
13
|
+
*
|
|
14
|
+
* @module plugins/tlp/tlp-classifier
|
|
15
|
+
* @version 1.0.0
|
|
16
|
+
* @date 2026-02-28
|
|
17
|
+
* @license MIT
|
|
18
|
+
*/
|
|
19
|
+
import { TlpLevel, TlpBadge, TlpClassificationResult, PluginTlpInput } from './types.js';
|
|
20
|
+
declare const BADGES: Record<TlpLevel, TlpBadge>;
|
|
21
|
+
/**
|
|
22
|
+
* Classifies a plugin's permissions into a TLP 2.0 level.
|
|
23
|
+
*
|
|
24
|
+
* @param input - Plugin id + full PluginPermissions
|
|
25
|
+
* @returns A TlpClassificationResult with the level, all triggered reasons, and badge
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const result = classifyPlugin({
|
|
30
|
+
* plugin_id: 'dcyfr/secret-detector',
|
|
31
|
+
* permissions: { ...noNetworkReadOnly },
|
|
32
|
+
* });
|
|
33
|
+
* console.log(result.level); // 'CLEAR'
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function classifyPlugin(input: PluginTlpInput): TlpClassificationResult;
|
|
37
|
+
/**
|
|
38
|
+
* Returns the TLP badge metadata for a given level, for use in UI rendering.
|
|
39
|
+
*
|
|
40
|
+
* @param level - TLP classification level
|
|
41
|
+
* @returns TlpBadge with color, label, tooltip, and description
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const badge = getTlpBadge('AMBER');
|
|
46
|
+
* // { color: '#FFC000', label: 'TLP:AMBER', ... }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function getTlpBadge(level: TlpLevel): TlpBadge;
|
|
50
|
+
/**
|
|
51
|
+
* Returns all four TLP badges, useful for rendering a legend.
|
|
52
|
+
*/
|
|
53
|
+
export declare function getAllTlpBadges(): TlpBadge[];
|
|
54
|
+
export { BADGES as TLP_BADGES };
|
|
55
|
+
//# sourceMappingURL=tlp-classifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tlp-classifier.d.ts","sourceRoot":"","sources":["../../../../../packages/ai/src/plugins/tlp/tlp-classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EACL,QAAQ,EAER,QAAQ,EAER,uBAAuB,EACvB,cAAc,EACf,MAAM,YAAY,CAAC;AAMpB,QAAA,MAAM,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,CA6BtC,CAAC;AAmJF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,cAAc,GAAG,uBAAuB,CAwB7E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAErD;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,QAAQ,EAAE,CAE5C;AAGD,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TLP Classifier for Plugin Marketplace
|
|
3
|
+
*
|
|
4
|
+
* Analyzes a plugin's PluginPermissions manifest and derives an appropriate
|
|
5
|
+
* TLP 2.0 classification level using a deterministic rule-set. Rules are
|
|
6
|
+
* evaluated in escalating order; the highest triggered level wins.
|
|
7
|
+
*
|
|
8
|
+
* Classification rules (highest → lowest priority):
|
|
9
|
+
* RED — secret access, unrestricted shell execution, or deleting sensitive paths
|
|
10
|
+
* AMBER — network egress, restricted shell, env-var access, or writing sensitive paths
|
|
11
|
+
* GREEN — any filesystem write/delete, any MCP server access
|
|
12
|
+
* CLEAR — read-only, no network, no shell, no secrets (default)
|
|
13
|
+
*
|
|
14
|
+
* @module plugins/tlp/tlp-classifier
|
|
15
|
+
* @version 1.0.0
|
|
16
|
+
* @date 2026-02-28
|
|
17
|
+
* @license MIT
|
|
18
|
+
*/
|
|
19
|
+
import { TLP_RANK, } from './types.js';
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Badge definitions (TLP 2.0 spec colors)
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
const BADGES = {
|
|
24
|
+
CLEAR: {
|
|
25
|
+
level: 'CLEAR',
|
|
26
|
+
color: '#FFFFFF',
|
|
27
|
+
label: 'TLP:CLEAR',
|
|
28
|
+
tooltip: 'No restriction — safe to redistribute publicly',
|
|
29
|
+
description: 'This plugin has read-only, no-network, no-shell permissions. Safe for all users.',
|
|
30
|
+
},
|
|
31
|
+
GREEN: {
|
|
32
|
+
level: 'GREEN',
|
|
33
|
+
color: '#33FF00',
|
|
34
|
+
label: 'TLP:GREEN',
|
|
35
|
+
tooltip: 'Limited community distribution',
|
|
36
|
+
description: 'This plugin can write files or access MCP servers. Share within your organization.',
|
|
37
|
+
},
|
|
38
|
+
AMBER: {
|
|
39
|
+
level: 'AMBER',
|
|
40
|
+
color: '#FFC000',
|
|
41
|
+
label: 'TLP:AMBER',
|
|
42
|
+
tooltip: 'Limited distribution — need-to-know',
|
|
43
|
+
description: 'This plugin accesses the network, environment variables, or shell. Restricted to vetted users.',
|
|
44
|
+
},
|
|
45
|
+
RED: {
|
|
46
|
+
level: 'RED',
|
|
47
|
+
color: '#FF2B2B',
|
|
48
|
+
label: 'TLP:RED',
|
|
49
|
+
tooltip: 'Restricted — individual recipients only',
|
|
50
|
+
description: 'This plugin accesses secrets, runs unrestricted shell commands, or deletes sensitive paths. Human approval required.',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
// Sensitive path patterns
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
56
|
+
const SENSITIVE_WRITE_PATTERNS = [
|
|
57
|
+
'.env', 'secrets', '.ssh', '.aws', '.gnupg',
|
|
58
|
+
'.npmrc', '.docker/config.json', 'credentials',
|
|
59
|
+
];
|
|
60
|
+
const SENSITIVE_DELETE_PATTERNS = [
|
|
61
|
+
'src', 'node_modules', '.git', 'dist', 'build', 'package.json',
|
|
62
|
+
];
|
|
63
|
+
/**
|
|
64
|
+
* Write check: pattern contains a sensitive keyword anywhere (e.g. ".env.production" contains ".env").
|
|
65
|
+
*/
|
|
66
|
+
function matchesSensitiveWritePath(patterns, sensitiveList) {
|
|
67
|
+
return patterns.some(p => sensitiveList.some(s => p.toLowerCase().includes(s.toLowerCase())));
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Delete check: pattern starts with a sensitive root directory name.
|
|
71
|
+
* Uses startsWith to avoid '/' matching any path that has a slash.
|
|
72
|
+
*/
|
|
73
|
+
function matchesSensitiveDeletePath(patterns, sensitiveList) {
|
|
74
|
+
return patterns.some(p => sensitiveList.some(s => p === s ||
|
|
75
|
+
p.startsWith(s + '/') ||
|
|
76
|
+
p.startsWith(s + '\\')));
|
|
77
|
+
}
|
|
78
|
+
const RULES = [
|
|
79
|
+
// -------- RED rules --------
|
|
80
|
+
{
|
|
81
|
+
id: 'RED:secret-access',
|
|
82
|
+
level: 'RED',
|
|
83
|
+
description: 'Plugin requests secret vault access',
|
|
84
|
+
test: (p) => ({ triggered: p.data.allowSecretAccess }),
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: 'RED:unrestricted-shell',
|
|
88
|
+
level: 'RED',
|
|
89
|
+
description: 'Plugin allows shell commands with no command allowlist',
|
|
90
|
+
test: (p) => ({
|
|
91
|
+
triggered: p.execution.allowShellCommands && p.execution.allowedCommands.length === 0,
|
|
92
|
+
}),
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: 'RED:sensitive-delete',
|
|
96
|
+
level: 'RED',
|
|
97
|
+
description: 'Plugin deletes sensitive filesystem paths',
|
|
98
|
+
test: (p) => ({
|
|
99
|
+
triggered: p.filesystem.delete.length > 0 &&
|
|
100
|
+
matchesSensitiveDeletePath(p.filesystem.delete, SENSITIVE_DELETE_PATTERNS),
|
|
101
|
+
detail: p.filesystem.delete.join(', '),
|
|
102
|
+
}),
|
|
103
|
+
},
|
|
104
|
+
// -------- AMBER rules --------
|
|
105
|
+
{
|
|
106
|
+
id: 'AMBER:network-egress',
|
|
107
|
+
level: 'AMBER',
|
|
108
|
+
description: 'Plugin makes outbound network requests',
|
|
109
|
+
test: (p) => ({
|
|
110
|
+
triggered: p.network.allowed,
|
|
111
|
+
detail: p.network.allowedDomains.length > 0
|
|
112
|
+
? `domains: ${p.network.allowedDomains.join(', ')}` : undefined,
|
|
113
|
+
}),
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: 'AMBER:restricted-shell',
|
|
117
|
+
level: 'AMBER',
|
|
118
|
+
description: 'Plugin executes shell commands (restricted allowlist)',
|
|
119
|
+
test: (p) => ({
|
|
120
|
+
triggered: p.execution.allowShellCommands && p.execution.allowedCommands.length > 0,
|
|
121
|
+
detail: `commands: ${p.execution.allowedCommands.join(', ')}`,
|
|
122
|
+
}),
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: 'AMBER:env-vars',
|
|
126
|
+
level: 'AMBER',
|
|
127
|
+
description: 'Plugin reads environment variables',
|
|
128
|
+
test: (p) => ({ triggered: p.data.allowEnvironmentVars }),
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
id: 'AMBER:sensitive-write',
|
|
132
|
+
level: 'AMBER',
|
|
133
|
+
description: 'Plugin writes to sensitive filesystem paths',
|
|
134
|
+
test: (p) => ({
|
|
135
|
+
triggered: p.filesystem.write.length > 0 &&
|
|
136
|
+
matchesSensitiveWritePath(p.filesystem.write, SENSITIVE_WRITE_PATTERNS),
|
|
137
|
+
detail: p.filesystem.write.join(', '),
|
|
138
|
+
}),
|
|
139
|
+
},
|
|
140
|
+
// -------- GREEN rules --------
|
|
141
|
+
{
|
|
142
|
+
id: 'GREEN:filesystem-write',
|
|
143
|
+
level: 'GREEN',
|
|
144
|
+
description: 'Plugin writes to the filesystem',
|
|
145
|
+
test: (p) => ({
|
|
146
|
+
triggered: p.filesystem.write.length > 0,
|
|
147
|
+
detail: p.filesystem.write.join(', '),
|
|
148
|
+
}),
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
id: 'GREEN:filesystem-delete',
|
|
152
|
+
level: 'GREEN',
|
|
153
|
+
description: 'Plugin deletes filesystem entries',
|
|
154
|
+
test: (p) => ({
|
|
155
|
+
triggered: p.filesystem.delete.length > 0,
|
|
156
|
+
detail: p.filesystem.delete.join(', '),
|
|
157
|
+
}),
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: 'GREEN:mcp-access',
|
|
161
|
+
level: 'GREEN',
|
|
162
|
+
description: 'Plugin calls MCP servers',
|
|
163
|
+
test: (p) => ({
|
|
164
|
+
triggered: p.mcp.allowedServers.length > 0,
|
|
165
|
+
detail: `servers: ${p.mcp.allowedServers.join(', ')}`,
|
|
166
|
+
}),
|
|
167
|
+
},
|
|
168
|
+
];
|
|
169
|
+
// ---------------------------------------------------------------------------
|
|
170
|
+
// Public API
|
|
171
|
+
// ---------------------------------------------------------------------------
|
|
172
|
+
/**
|
|
173
|
+
* Classifies a plugin's permissions into a TLP 2.0 level.
|
|
174
|
+
*
|
|
175
|
+
* @param input - Plugin id + full PluginPermissions
|
|
176
|
+
* @returns A TlpClassificationResult with the level, all triggered reasons, and badge
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```ts
|
|
180
|
+
* const result = classifyPlugin({
|
|
181
|
+
* plugin_id: 'dcyfr/secret-detector',
|
|
182
|
+
* permissions: { ...noNetworkReadOnly },
|
|
183
|
+
* });
|
|
184
|
+
* console.log(result.level); // 'CLEAR'
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
export function classifyPlugin(input) {
|
|
188
|
+
const triggered = [];
|
|
189
|
+
for (const rule of RULES) {
|
|
190
|
+
const { triggered: hit, detail } = rule.test(input.permissions);
|
|
191
|
+
if (hit) {
|
|
192
|
+
triggered.push({
|
|
193
|
+
rule: rule.id,
|
|
194
|
+
reason: detail ? `${rule.description} (${detail})` : rule.description,
|
|
195
|
+
level: rule.level,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
const finalLevel = triggered.reduce((max, r) => {
|
|
200
|
+
return TLP_RANK[r.level] > TLP_RANK[max] ? r.level : max;
|
|
201
|
+
}, 'CLEAR');
|
|
202
|
+
return {
|
|
203
|
+
level: finalLevel,
|
|
204
|
+
reasons: triggered,
|
|
205
|
+
elevated: TLP_RANK[finalLevel] >= TLP_RANK['AMBER'],
|
|
206
|
+
badge: BADGES[finalLevel],
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Returns the TLP badge metadata for a given level, for use in UI rendering.
|
|
211
|
+
*
|
|
212
|
+
* @param level - TLP classification level
|
|
213
|
+
* @returns TlpBadge with color, label, tooltip, and description
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```ts
|
|
217
|
+
* const badge = getTlpBadge('AMBER');
|
|
218
|
+
* // { color: '#FFC000', label: 'TLP:AMBER', ... }
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
export function getTlpBadge(level) {
|
|
222
|
+
return BADGES[level];
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Returns all four TLP badges, useful for rendering a legend.
|
|
226
|
+
*/
|
|
227
|
+
export function getAllTlpBadges() {
|
|
228
|
+
return ['CLEAR', 'GREEN', 'AMBER', 'RED'].map(l => BADGES[l]);
|
|
229
|
+
}
|
|
230
|
+
// Re-export badge map for advanced consumers
|
|
231
|
+
export { BADGES as TLP_BADGES };
|
|
232
|
+
//# sourceMappingURL=tlp-classifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tlp-classifier.js","sourceRoot":"","sources":["../../../../../packages/ai/src/plugins/tlp/tlp-classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAEL,QAAQ,GAKT,MAAM,YAAY,CAAC;AAEpB,8EAA8E;AAC9E,0CAA0C;AAC1C,8EAA8E;AAE9E,MAAM,MAAM,GAA+B;IACzC,KAAK,EAAE;QACL,KAAK,EAAQ,OAAO;QACpB,KAAK,EAAQ,SAAS;QACtB,KAAK,EAAQ,WAAW;QACxB,OAAO,EAAM,gDAAgD;QAC7D,WAAW,EAAE,kFAAkF;KAChG;IACD,KAAK,EAAE;QACL,KAAK,EAAQ,OAAO;QACpB,KAAK,EAAQ,SAAS;QACtB,KAAK,EAAQ,WAAW;QACxB,OAAO,EAAM,gCAAgC;QAC7C,WAAW,EAAE,oFAAoF;KAClG;IACD,KAAK,EAAE;QACL,KAAK,EAAQ,OAAO;QACpB,KAAK,EAAQ,SAAS;QACtB,KAAK,EAAQ,WAAW;QACxB,OAAO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GAAG,EAAE,CAAC,EAAE,EAAE;QACjE,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;IAC3D,CAAC,EAAE,OAAO,CAAC,CAAC;IAEZ,OAAO;QACL,KAAK,EAAK,UAAU;QACpB,OAAO,EAAG,SAAS;QACnB,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,IAAI,QAAQ,CAAC,OAAO,CAAC;QACnD,KAAK,EAAK,MAAM,CAAC,UAAU,CAAC;KAC7B,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,WAAW,CAAC,KAAe;IACzC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAa,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED,6CAA6C;AAC7C,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TLP Clearance Validator for Plugin Marketplace
|
|
3
|
+
*
|
|
4
|
+
* Validates whether a user or agent has sufficient TLP clearance to
|
|
5
|
+
* install or execute a plugin at a given classification level.
|
|
6
|
+
*
|
|
7
|
+
* Clearance hierarchy (permissive upward):
|
|
8
|
+
* CLEAR ⊂ GREEN ⊂ AMBER ⊂ RED
|
|
9
|
+
*
|
|
10
|
+
* A subject with clearance X may access any resource classified at X or below.
|
|
11
|
+
*
|
|
12
|
+
* Integration point: pair with classifyPlugin() from tlp-classifier.ts —
|
|
13
|
+
* classify the plugin first, then call checkClearance() before installing.
|
|
14
|
+
*
|
|
15
|
+
* @module plugins/tlp/tlp-validator
|
|
16
|
+
* @version 1.0.0
|
|
17
|
+
* @date 2026-02-28
|
|
18
|
+
* @license MIT
|
|
19
|
+
*/
|
|
20
|
+
import { TlpLevel, TlpClearanceProfile, TlpClearanceCheckResult, TlpClassificationResult } from './types.js';
|
|
21
|
+
/**
|
|
22
|
+
* Checks whether a subject's clearance level permits access to a resource
|
|
23
|
+
* at the given TLP classification.
|
|
24
|
+
*
|
|
25
|
+
* @param subject - Subject's clearance profile
|
|
26
|
+
* @param required - Required classification level of the resource
|
|
27
|
+
* @returns TlpClearanceCheckResult — allowed flag + denial reason if blocked
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const result = checkClearance(
|
|
32
|
+
* { subjectId: 'user-123', clearance: 'GREEN' },
|
|
33
|
+
* 'AMBER',
|
|
34
|
+
* );
|
|
35
|
+
* result.allowed; // false — GREEN < AMBER
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function checkClearance(subject: TlpClearanceProfile, required: TlpLevel): TlpClearanceCheckResult;
|
|
39
|
+
/**
|
|
40
|
+
* Validates plugin installation for a given subject.
|
|
41
|
+
* Convenience wrapper combining a full classification result with a clearance check.
|
|
42
|
+
*
|
|
43
|
+
* @param subject - Subject's clearance profile
|
|
44
|
+
* @param classification - Full TLP classification result from classifyPlugin()
|
|
45
|
+
* @returns TlpClearanceCheckResult
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const classification = classifyPlugin({ plugin_id: 'x', permissions });
|
|
50
|
+
* const check = validatePluginInstall(
|
|
51
|
+
* { subjectId: 'agent-1', clearance: 'AMBER' },
|
|
52
|
+
* classification,
|
|
53
|
+
* );
|
|
54
|
+
* if (!check.allowed) throw new Error(check.denyReason);
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function validatePluginInstall(subject: TlpClearanceProfile, classification: TlpClassificationResult): TlpClearanceCheckResult;
|
|
58
|
+
/** Result for a single plugin in a batch validation */
|
|
59
|
+
export interface BatchValidationEntry {
|
|
60
|
+
pluginId: string;
|
|
61
|
+
level: TlpLevel;
|
|
62
|
+
result: TlpClearanceCheckResult;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Validates multiple plugins against a single subject's clearance.
|
|
66
|
+
* Useful for marketplace listing pages where each plugin has a pre-computed level.
|
|
67
|
+
*
|
|
68
|
+
* @param subject - Subject's clearance profile
|
|
69
|
+
* @param plugins - Array of { pluginId, level } pairs
|
|
70
|
+
* @returns Array of BatchValidationEntry with per-plugin results
|
|
71
|
+
*/
|
|
72
|
+
export declare function batchValidate(subject: TlpClearanceProfile, plugins: Array<{
|
|
73
|
+
pluginId: string;
|
|
74
|
+
level: TlpLevel;
|
|
75
|
+
}>): BatchValidationEntry[];
|
|
76
|
+
/**
|
|
77
|
+
* Returns true if the subject's clearance is sufficient for the given level.
|
|
78
|
+
* Lightweight alternative to checkClearance() when you only need the boolean.
|
|
79
|
+
*/
|
|
80
|
+
export declare function isCleared(clearance: TlpLevel, required: TlpLevel): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Returns the minimum clearance level required to access a resource.
|
|
83
|
+
* Equivalent to the resource's TLP level — provided for symmetry with checkClearance.
|
|
84
|
+
*/
|
|
85
|
+
export declare function requiredClearance(level: TlpLevel): TlpLevel;
|
|
86
|
+
/**
|
|
87
|
+
* Returns all TLP levels at or below the given clearance.
|
|
88
|
+
* Useful for constructing filtered marketplace views.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* accessibleLevels('GREEN'); // ['CLEAR', 'GREEN']
|
|
93
|
+
* accessibleLevels('AMBER'); // ['CLEAR', 'GREEN', 'AMBER']
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export declare function accessibleLevels(clearance: TlpLevel): TlpLevel[];
|
|
97
|
+
//# sourceMappingURL=tlp-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tlp-validator.d.ts","sourceRoot":"","sources":["../../../../../packages/ai/src/plugins/tlp/tlp-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACL,QAAQ,EAER,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAMpB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,mBAAmB,EAC5B,QAAQ,EAAE,QAAQ,GACjB,uBAAuB,CAYzB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,mBAAmB,EAC5B,cAAc,EAAE,uBAAuB,GACtC,uBAAuB,CAEzB;AAMD,uDAAuD;AACvD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,QAAQ,CAAC;IAChB,MAAM,EAAE,uBAAuB,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,CAAC,GACpD,oBAAoB,EAAE,CAMxB;AAMD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE1E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAE3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,QAAQ,GAAG,QAAQ,EAAE,CAGhE"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TLP Clearance Validator for Plugin Marketplace
|
|
3
|
+
*
|
|
4
|
+
* Validates whether a user or agent has sufficient TLP clearance to
|
|
5
|
+
* install or execute a plugin at a given classification level.
|
|
6
|
+
*
|
|
7
|
+
* Clearance hierarchy (permissive upward):
|
|
8
|
+
* CLEAR ⊂ GREEN ⊂ AMBER ⊂ RED
|
|
9
|
+
*
|
|
10
|
+
* A subject with clearance X may access any resource classified at X or below.
|
|
11
|
+
*
|
|
12
|
+
* Integration point: pair with classifyPlugin() from tlp-classifier.ts —
|
|
13
|
+
* classify the plugin first, then call checkClearance() before installing.
|
|
14
|
+
*
|
|
15
|
+
* @module plugins/tlp/tlp-validator
|
|
16
|
+
* @version 1.0.0
|
|
17
|
+
* @date 2026-02-28
|
|
18
|
+
* @license MIT
|
|
19
|
+
*/
|
|
20
|
+
import { TLP_RANK, } from './types.js';
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Core clearance check
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
/**
|
|
25
|
+
* Checks whether a subject's clearance level permits access to a resource
|
|
26
|
+
* at the given TLP classification.
|
|
27
|
+
*
|
|
28
|
+
* @param subject - Subject's clearance profile
|
|
29
|
+
* @param required - Required classification level of the resource
|
|
30
|
+
* @returns TlpClearanceCheckResult — allowed flag + denial reason if blocked
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const result = checkClearance(
|
|
35
|
+
* { subjectId: 'user-123', clearance: 'GREEN' },
|
|
36
|
+
* 'AMBER',
|
|
37
|
+
* );
|
|
38
|
+
* result.allowed; // false — GREEN < AMBER
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export function checkClearance(subject, required) {
|
|
42
|
+
const allowed = TLP_RANK[subject.clearance] >= TLP_RANK[required];
|
|
43
|
+
return {
|
|
44
|
+
allowed,
|
|
45
|
+
subjectClearance: subject.clearance,
|
|
46
|
+
requiredClearance: required,
|
|
47
|
+
denyReason: allowed
|
|
48
|
+
? undefined
|
|
49
|
+
: `Subject "${subject.subjectId}" has TLP:${subject.clearance} clearance ` +
|
|
50
|
+
`but the resource requires TLP:${required} or higher.`,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Validates plugin installation for a given subject.
|
|
55
|
+
* Convenience wrapper combining a full classification result with a clearance check.
|
|
56
|
+
*
|
|
57
|
+
* @param subject - Subject's clearance profile
|
|
58
|
+
* @param classification - Full TLP classification result from classifyPlugin()
|
|
59
|
+
* @returns TlpClearanceCheckResult
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const classification = classifyPlugin({ plugin_id: 'x', permissions });
|
|
64
|
+
* const check = validatePluginInstall(
|
|
65
|
+
* { subjectId: 'agent-1', clearance: 'AMBER' },
|
|
66
|
+
* classification,
|
|
67
|
+
* );
|
|
68
|
+
* if (!check.allowed) throw new Error(check.denyReason);
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export function validatePluginInstall(subject, classification) {
|
|
72
|
+
return checkClearance(subject, classification.level);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Validates multiple plugins against a single subject's clearance.
|
|
76
|
+
* Useful for marketplace listing pages where each plugin has a pre-computed level.
|
|
77
|
+
*
|
|
78
|
+
* @param subject - Subject's clearance profile
|
|
79
|
+
* @param plugins - Array of { pluginId, level } pairs
|
|
80
|
+
* @returns Array of BatchValidationEntry with per-plugin results
|
|
81
|
+
*/
|
|
82
|
+
export function batchValidate(subject, plugins) {
|
|
83
|
+
return plugins.map(({ pluginId, level }) => ({
|
|
84
|
+
pluginId,
|
|
85
|
+
level,
|
|
86
|
+
result: checkClearance(subject, level),
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
// Utility helpers
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
/**
|
|
93
|
+
* Returns true if the subject's clearance is sufficient for the given level.
|
|
94
|
+
* Lightweight alternative to checkClearance() when you only need the boolean.
|
|
95
|
+
*/
|
|
96
|
+
export function isCleared(clearance, required) {
|
|
97
|
+
return TLP_RANK[clearance] >= TLP_RANK[required];
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Returns the minimum clearance level required to access a resource.
|
|
101
|
+
* Equivalent to the resource's TLP level — provided for symmetry with checkClearance.
|
|
102
|
+
*/
|
|
103
|
+
export function requiredClearance(level) {
|
|
104
|
+
return level;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Returns all TLP levels at or below the given clearance.
|
|
108
|
+
* Useful for constructing filtered marketplace views.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* accessibleLevels('GREEN'); // ['CLEAR', 'GREEN']
|
|
113
|
+
* accessibleLevels('AMBER'); // ['CLEAR', 'GREEN', 'AMBER']
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export function accessibleLevels(clearance) {
|
|
117
|
+
const all = ['CLEAR', 'GREEN', 'AMBER', 'RED'];
|
|
118
|
+
return all.filter(l => TLP_RANK[l] <= TLP_RANK[clearance]);
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=tlp-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tlp-validator.js","sourceRoot":"","sources":["../../../../../packages/ai/src/plugins/tlp/tlp-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAEL,QAAQ,GAIT,MAAM,YAAY,CAAC;AAEpB,8EAA8E;AAC9E,uBAAuB;AACvB,8EAA8E;AAE9E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,cAAc,CAC5B,OAA4B,EAC5B,QAAkB;IAElB,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAElE,OAAO;QACL,OA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CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TLP Classification Types for Plugin Marketplace
|
|
3
|
+
*
|
|
4
|
+
* Implements TLP 2.0 (Traffic Light Protocol) classification for plugins,
|
|
5
|
+
* mapping permission profiles to appropriate distribution levels.
|
|
6
|
+
*
|
|
7
|
+
* @see https://www.first.org/tlp/
|
|
8
|
+
* @module plugins/tlp/types
|
|
9
|
+
* @version 1.0.0
|
|
10
|
+
* @date 2026-02-28
|
|
11
|
+
* @license MIT
|
|
12
|
+
*/
|
|
13
|
+
import type { PluginPermissions } from '../permissions/types.js';
|
|
14
|
+
/**
|
|
15
|
+
* TLP 2.0 classification levels, ordered from lowest to highest sensitivity.
|
|
16
|
+
*
|
|
17
|
+
* - CLEAR: No restriction. Safe to redistribute publicly.
|
|
18
|
+
* - GREEN: Limited community distribution. Share within the organization.
|
|
19
|
+
* - AMBER: Limited distribution. Need-to-know basis inside the organization.
|
|
20
|
+
* - RED: Restricted. Individual recipients only; not for redistribution.
|
|
21
|
+
*/
|
|
22
|
+
export type TlpLevel = 'CLEAR' | 'GREEN' | 'AMBER' | 'RED';
|
|
23
|
+
/** Numeric severity for ordering/comparison */
|
|
24
|
+
export declare const TLP_RANK: Record<TlpLevel, number>;
|
|
25
|
+
/** Visual badge metadata for marketplace UI rendering */
|
|
26
|
+
export interface TlpBadge {
|
|
27
|
+
/** TLP level this badge represents */
|
|
28
|
+
level: TlpLevel;
|
|
29
|
+
/** Hex background color per TLP 2.0 spec */
|
|
30
|
+
color: string;
|
|
31
|
+
/** Human-readable label */
|
|
32
|
+
label: string;
|
|
33
|
+
/** Short tooltip shown on hover */
|
|
34
|
+
tooltip: string;
|
|
35
|
+
/** Longer description for detail views */
|
|
36
|
+
description: string;
|
|
37
|
+
}
|
|
38
|
+
/** Single rule that contributed to a TLP classification decision */
|
|
39
|
+
export interface TlpClassificationReason {
|
|
40
|
+
/** The rule identifier */
|
|
41
|
+
rule: string;
|
|
42
|
+
/** Human-readable explanation */
|
|
43
|
+
reason: string;
|
|
44
|
+
/** The TLP level this rule produces */
|
|
45
|
+
level: TlpLevel;
|
|
46
|
+
}
|
|
47
|
+
/** Full result returned by the TLP classifier */
|
|
48
|
+
export interface TlpClassificationResult {
|
|
49
|
+
/** Final assigned TLP level (highest level among triggered rules) */
|
|
50
|
+
level: TlpLevel;
|
|
51
|
+
/** All rules that were triggered */
|
|
52
|
+
reasons: TlpClassificationReason[];
|
|
53
|
+
/** Whether ANY elevated rule was triggered (AMBER or RED) */
|
|
54
|
+
elevated: boolean;
|
|
55
|
+
/** Badge metadata for UI rendering */
|
|
56
|
+
badge: TlpBadge;
|
|
57
|
+
}
|
|
58
|
+
/** User or agent TLP clearance profile */
|
|
59
|
+
export interface TlpClearanceProfile {
|
|
60
|
+
/** Maximum TLP level the subject is cleared to access */
|
|
61
|
+
clearance: TlpLevel;
|
|
62
|
+
/** Subject identifier (user ID, agent name, etc.) */
|
|
63
|
+
subjectId: string;
|
|
64
|
+
}
|
|
65
|
+
/** Result of a clearance check */
|
|
66
|
+
export interface TlpClearanceCheckResult {
|
|
67
|
+
/** Whether the subject is cleared to access the resource */
|
|
68
|
+
allowed: boolean;
|
|
69
|
+
/** Subject's clearance level */
|
|
70
|
+
subjectClearance: TlpLevel;
|
|
71
|
+
/** Required clearance level */
|
|
72
|
+
requiredClearance: TlpLevel;
|
|
73
|
+
/** Human-readable denial reason when allowed=false */
|
|
74
|
+
denyReason?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Minimal plugin descriptor accepted by the TLP classifier.
|
|
78
|
+
* Accepts the full PluginPermissions type — extra fields are ignored.
|
|
79
|
+
*/
|
|
80
|
+
export interface PluginTlpInput {
|
|
81
|
+
plugin_id: string;
|
|
82
|
+
permissions: PluginPermissions;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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4D;IAC5D,OAAO,EAAE,OAAO,CAAC;IACjB,gCAAgC;IAChC,gBAAgB,EAAE,QAAQ,CAAC;IAC3B,+BAA+B;IAC/B,iBAAiB,EAAE,QAAQ,CAAC;IAC5B,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,iBAAiB,CAAC;CAChC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TLP Classification Types for Plugin Marketplace
|
|
3
|
+
*
|
|
4
|
+
* Implements TLP 2.0 (Traffic Light Protocol) classification for plugins,
|
|
5
|
+
* mapping permission profiles to appropriate distribution levels.
|
|
6
|
+
*
|
|
7
|
+
* @see https://www.first.org/tlp/
|
|
8
|
+
* @module plugins/tlp/types
|
|
9
|
+
* @version 1.0.0
|
|
10
|
+
* @date 2026-02-28
|
|
11
|
+
* @license MIT
|
|
12
|
+
*/
|
|
13
|
+
/** Numeric severity for ordering/comparison */
|
|
14
|
+
export const TLP_RANK = {
|
|
15
|
+
CLEAR: 0,
|
|
16
|
+
GREEN: 1,
|
|
17
|
+
AMBER: 2,
|
|
18
|
+
RED: 3,
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../packages/ai/src/plugins/tlp/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAkBH,+CAA+C;AAC/C,MAAM,CAAC,MAAM,QAAQ,GAA6B;IAChD,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,GAAG,EAAI,CAAC;CACT,CAAC"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @date 2026-02-15
|
|
11
11
|
* @module dcyfr-ai/resource-monitor
|
|
12
12
|
*/
|
|
13
|
-
import { EventEmitter } from 'events';
|
|
13
|
+
import { EventEmitter } from 'node:events';
|
|
14
14
|
import { PerformanceProfiler } from './performance-profiler.js';
|
|
15
15
|
/**
|
|
16
16
|
* System resource usage snapshot
|