@yyc3/ai-family-kernel 0.0.0-stage → 2.54.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/README.md +11 -2
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/index.d.ts +24 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/index.js +24 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-1-foundation/foundation-capability.d.ts +16 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-1-foundation/foundation-capability.js +29 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-1-foundation/index.d.ts +4 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-1-foundation/index.js +4 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-2-bole/bole-capability.d.ts +16 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-2-bole/bole-capability.js +29 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-2-bole/index.d.ts +4 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-2-bole/index.js +4 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-3-prophet/index.d.ts +4 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-3-prophet/index.js +4 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-3-prophet/prophet-capability.d.ts +16 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-3-prophet/prophet-capability.js +29 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-4-thinker/index.d.ts +4 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-4-thinker/index.js +4 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-4-thinker/thinker-capability.d.ts +16 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-4-thinker/thinker-capability.js +29 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-5-navigator/index.d.ts +4 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-5-navigator/index.js +4 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-5-navigator/navigator-capability.d.ts +16 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-5-navigator/navigator-capability.js +29 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-6-creative/creative-capability.d.ts +16 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-6-creative/creative-capability.js +29 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-6-creative/index.d.ts +4 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-6-creative/index.js +4 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-7-master/index.d.ts +4 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-7-master/index.js +4 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-7-master/master-capability.d.ts +16 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-7-master/master-capability.js +29 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-8-guardian/guardian-capability.d.ts +16 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-8-guardian/guardian-capability.js +29 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-8-guardian/index.d.ts +4 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-8-guardian/index.js +4 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-9-meta-oracle/index.d.ts +4 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-9-meta-oracle/index.js +4 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-9-meta-oracle/meta-oracle-capability.d.ts +17 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-9-meta-oracle/meta-oracle-capability.js +30 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-registry.d.ts +34 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/layer-registry.js +76 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/types.d.ts +49 -0
- package/dist/src/01-/344/271/235/345/261/202/346/236/266/346/236/204/345/210/206/345/261/202/345/272/225/345/272/247/types.js +33 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/index.d.ts +7 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/index.js +7 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/orchestrator.d.ts +47 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/orchestrator.js +59 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/task-decomposer.d.ts +21 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/task-decomposer.js +72 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/verification-gateway/confidence-calibrator.d.ts +31 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/verification-gateway/confidence-calibrator.js +39 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/verification-gateway/consistency-metrics.d.ts +45 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/verification-gateway/consistency-metrics.js +44 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/verification-gateway/cross-validator.d.ts +44 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/verification-gateway/cross-validator.js +69 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/verification-gateway/gateway.d.ts +64 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/verification-gateway/gateway.js +96 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/verification-gateway/ground-truth-checker.d.ts +33 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/verification-gateway/ground-truth-checker.js +74 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/verification-gateway/index.d.ts +12 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/verification-gateway/index.js +12 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/verification-gateway/oracle-registry.d.ts +18 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/cloud-pivot-orchestrator/verification-gateway/oracle-registry.js +26 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/dashu-self-healing/index.d.ts +5 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/dashu-self-healing/index.js +5 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/dashu-self-healing/self-healing-controller.d.ts +33 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/dashu-self-healing/self-healing-controller.js +68 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/family-communication-bus/event-bus.d.ts +99 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/family-communication-bus/event-bus.js +178 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/family-communication-bus/index.d.ts +7 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/family-communication-bus/index.js +7 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/family-communication-bus/trajectory-bridge.d.ts +57 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/family-communication-bus/trajectory-bridge.js +72 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/family-phone-system/index.d.ts +4 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/family-phone-system/index.js +4 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/family-phone-system/phone-system.d.ts +46 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/family-phone-system/phone-system.js +85 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/global-status-center/index.d.ts +4 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/global-status-center/index.js +4 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/global-status-center/status-center.d.ts +27 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/global-status-center/status-center.js +57 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/index.d.ts +21 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/index.js +21 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/mcp-adapter/bus-mcp-codec.d.ts +29 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/mcp-adapter/bus-mcp-codec.js +84 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/mcp-adapter/index.d.ts +31 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/mcp-adapter/index.js +28 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/mcp-adapter/server/index.d.ts +5 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/mcp-adapter/server/index.js +5 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/mcp-adapter/server/protocol.d.ts +80 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/mcp-adapter/server/protocol.js +148 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/mcp-adapter/stdio-transport.d.ts +47 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/mcp-adapter/stdio-transport.js +178 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/mcp-adapter/types.d.ts +63 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/mcp-adapter/types.js +7 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/types.d.ts +167 -0
- package/dist/src/02-/344/272/221/346/236/242/346/240/270/345/277/203/345/274/225/346/223/216/types.js +23 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/experience-reflow/index.d.ts +7 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/experience-reflow/index.js +7 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/experience-reflow/outcome-labeler.d.ts +34 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/experience-reflow/outcome-labeler.js +38 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/experience-reflow/pattern-extractor.d.ts +64 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/experience-reflow/pattern-extractor.js +94 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/experience-reflow/trajectory-collector.d.ts +39 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/experience-reflow/trajectory-collector.js +36 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/index.d.ts +23 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/index.js +23 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/knowledge-update/index.d.ts +7 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/knowledge-update/index.js +7 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/knowledge-update/preference-tracker.d.ts +32 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/knowledge-update/preference-tracker.js +49 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/knowledge-update/rule-evolution.d.ts +41 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/knowledge-update/rule-evolution.js +60 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/knowledge-update/semantic-diff.d.ts +32 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/knowledge-update/semantic-diff.js +69 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/learning-loop.d.ts +146 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/learning-loop.js +171 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/learning-scheduler/budget-allocator.d.ts +29 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/learning-scheduler/budget-allocator.js +58 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/learning-scheduler/index.d.ts +6 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/learning-scheduler/index.js +6 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/learning-scheduler/priority-queue.d.ts +22 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/learning-scheduler/priority-queue.js +34 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/param-adaptation.d.ts +59 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/param-adaptation.js +55 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/skill-consolidation/index.d.ts +12 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/skill-consolidation/index.js +12 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/skill-consolidation/skill-eval.d.ts +77 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/skill-consolidation/skill-eval.js +110 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/skill-consolidation/skill-executor.d.ts +51 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/skill-consolidation/skill-executor.js +63 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/skill-consolidation/skill-id.d.ts +32 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/skill-consolidation/skill-id.js +54 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/skill-consolidation/skill-index.d.ts +29 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/skill-consolidation/skill-index.js +32 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/skill-consolidation/skill-merger.d.ts +26 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/skill-consolidation/skill-merger.js +65 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/skill-consolidation/skill-pruner.d.ts +31 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/skill-consolidation/skill-pruner.js +35 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/skill-consolidation/skill-store-file.d.ts +33 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/skill-consolidation/skill-store-file.js +76 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/skill-consolidation/skill-versioner.d.ts +33 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/skill-consolidation/skill-versioner.js +63 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/stability-guard/forgetting-detector.d.ts +31 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/stability-guard/forgetting-detector.js +26 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/stability-guard/index.d.ts +7 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/stability-guard/index.js +7 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/stability-guard/regression-tester.d.ts +30 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/stability-guard/regression-tester.js +48 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/stability-guard/rollback-controller.d.ts +19 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/stability-guard/rollback-controller.js +19 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/types.d.ts +137 -0
- package/dist/src/05-/346/214/201/347/273/255/345/255/246/344/271/240/345/274/225/346/223/216/types.js +22 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/compliance-audit/compliance-audit.d.ts +20 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/compliance-audit/compliance-audit.js +83 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/compliance-audit/index.d.ts +4 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/compliance-audit/index.js +4 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/index.d.ts +18 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/index.js +18 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/policy-registry/index.d.ts +6 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/policy-registry/index.js +6 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/policy-registry/policy-bus.d.ts +39 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/policy-registry/policy-bus.js +73 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/policy-registry/policy-registry.d.ts +19 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/policy-registry/policy-registry.js +44 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/policy-registry/security-policies.d.ts +54 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/policy-registry/security-policies.js +80 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/quality-governance/index.d.ts +4 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/quality-governance/index.js +4 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/quality-governance/quality-governance.d.ts +23 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/quality-governance/quality-governance.js +38 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/security-governance/index.d.ts +4 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/security-governance/index.js +4 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/security-governance/security-governance.d.ts +24 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/security-governance/security-governance.js +29 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/types.d.ts +77 -0
- package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/types.js +17 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/consistency-repair/consistency-repair.d.ts +25 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/consistency-repair/consistency-repair.js +66 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/consistency-repair/index.d.ts +4 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/consistency-repair/index.js +4 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/degradation-controller/degradation-controller.d.ts +50 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/degradation-controller/degradation-controller.js +90 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/degradation-controller/index.d.ts +4 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/degradation-controller/index.js +4 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/fault-detector/fault-detector.d.ts +42 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/fault-detector/fault-detector.js +55 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/fault-detector/index.d.ts +4 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/fault-detector/index.js +4 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/index.d.ts +19 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/index.js +19 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/rollback-controller/index.d.ts +4 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/rollback-controller/index.js +4 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/rollback-controller/rollback-controller.d.ts +36 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/rollback-controller/rollback-controller.js +71 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/types.d.ts +73 -0
- package/dist/src/07-/350/207/252/346/204/210/344/270/255/345/277/203/types.js +63 -0
- package/dist/src/08-/347/263/273/347/273/237/350/243/205/351/205/215/index.d.ts +5 -0
- package/dist/src/08-/347/263/273/347/273/237/350/243/205/351/205/215/index.js +5 -0
- package/dist/src/08-/347/263/273/347/273/237/350/243/205/351/205/215/mcp-server-assembly.d.ts +48 -0
- package/dist/src/08-/347/263/273/347/273/237/350/243/205/351/205/215/mcp-server-assembly.js +53 -0
- package/dist/src/08-/347/263/273/347/273/237/350/243/205/351/205/215/runtime-assembly.d.ts +175 -0
- package/dist/src/08-/347/263/273/347/273/237/350/243/205/351/205/215/runtime-assembly.js +249 -0
- package/dist/src/08-/347/263/273/347/273/237/350/243/205/351/205/215/runtime-entry.d.ts +68 -0
- package/dist/src/08-/347/263/273/347/273/237/350/243/205/351/205/215/runtime-entry.js +86 -0
- package/dist/src/09-/345/217/257/350/247/202/346/265/213/346/200/247/capability-instrumentation.d.ts +53 -0
- package/dist/src/09-/345/217/257/350/247/202/346/265/213/346/200/247/capability-instrumentation.js +85 -0
- package/dist/src/09-/345/217/257/350/247/202/346/265/213/346/200/247/collaboration-instrumentation.d.ts +56 -0
- package/dist/src/09-/345/217/257/350/247/202/346/265/213/346/200/247/collaboration-instrumentation.js +100 -0
- package/dist/src/09-/345/217/257/350/247/202/346/265/213/346/200/247/family-metrics.d.ts +172 -0
- package/dist/src/09-/345/217/257/350/247/202/346/265/213/346/200/247/family-metrics.js +314 -0
- package/dist/src/09-/345/217/257/350/247/202/346/265/213/346/200/247/index.d.ts +8 -0
- package/dist/src/09-/345/217/257/350/247/202/346/265/213/346/200/247/index.js +8 -0
- package/dist/src/09-/345/217/257/350/247/202/346/265/213/346/200/247/metrics-registry.d.ts +123 -0
- package/dist/src/09-/345/217/257/350/247/202/346/265/213/346/200/247/metrics-registry.js +270 -0
- package/dist/src/09-/345/217/257/350/247/202/346/265/213/346/200/247/metrics-server.d.ts +45 -0
- package/dist/src/09-/345/217/257/350/247/202/346/265/213/346/200/247/metrics-server.js +86 -0
- package/dist/src/10-/350/203/275/345/212/233/346/263/250/345/206/214/344/270/255/345/277/203/allowlist.d.ts +79 -0
- package/dist/src/10-/350/203/275/345/212/233/346/263/250/345/206/214/344/270/255/345/277/203/allowlist.js +122 -0
- package/dist/src/10-/350/203/275/345/212/233/346/263/250/345/206/214/344/270/255/345/277/203/catalog.d.ts +67 -0
- package/dist/src/10-/350/203/275/345/212/233/346/263/250/345/206/214/344/270/255/345/277/203/catalog.js +71 -0
- package/dist/src/10-/350/203/275/345/212/233/346/263/250/345/206/214/344/270/255/345/277/203/index.d.ts +14 -0
- package/dist/src/10-/350/203/275/345/212/233/346/263/250/345/206/214/344/270/255/345/277/203/index.js +10 -0
- package/dist/src/10-/350/203/275/345/212/233/346/263/250/345/206/214/344/270/255/345/277/203/integrity.d.ts +44 -0
- package/dist/src/10-/350/203/275/345/212/233/346/263/250/345/206/214/344/270/255/345/277/203/integrity.js +99 -0
- package/dist/src/10-/350/203/275/345/212/233/346/263/250/345/206/214/344/270/255/345/277/203/plugin-loader.d.ts +39 -0
- package/dist/src/10-/350/203/275/345/212/233/346/263/250/345/206/214/344/270/255/345/277/203/plugin-loader.js +89 -0
- package/dist/src/a2a-adapter/card-discovery.d.ts +40 -0
- package/dist/src/a2a-adapter/card-discovery.js +47 -0
- package/dist/src/a2a-adapter/index.d.ts +7 -0
- package/dist/src/a2a-adapter/index.js +7 -0
- package/dist/src/a2a-adapter/task-delegate.d.ts +85 -0
- package/dist/src/a2a-adapter/task-delegate.js +94 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.js +10 -0
- package/dist/vendor/memory-framework/episodic-store/episode-indexer.d.ts +30 -0
- package/dist/vendor/memory-framework/episodic-store/episode-indexer.js +45 -0
- package/dist/vendor/memory-framework/episodic-store/index.d.ts +30 -0
- package/dist/vendor/memory-framework/episodic-store/index.js +45 -0
- package/dist/vendor/memory-framework/episodic-store/retrieval-adapter.d.ts +20 -0
- package/dist/vendor/memory-framework/episodic-store/retrieval-adapter.js +29 -0
- package/dist/vendor/memory-framework/episodic-store/trajectory-logger.d.ts +36 -0
- package/dist/vendor/memory-framework/episodic-store/trajectory-logger.js +32 -0
- package/dist/vendor/memory-framework/index.d.ts +19 -0
- package/dist/vendor/memory-framework/index.js +19 -0
- package/dist/vendor/memory-framework/memory-orchestrator/consistency-checker.d.ts +20 -0
- package/dist/vendor/memory-framework/memory-orchestrator/consistency-checker.js +41 -0
- package/dist/vendor/memory-framework/memory-orchestrator/index.d.ts +55 -0
- package/dist/vendor/memory-framework/memory-orchestrator/index.js +185 -0
- package/dist/vendor/memory-framework/memory-orchestrator/retrieval-router.d.ts +21 -0
- package/dist/vendor/memory-framework/memory-orchestrator/retrieval-router.js +37 -0
- package/dist/vendor/memory-framework/procedural-memory/guardrail-registry.d.ts +34 -0
- package/dist/vendor/memory-framework/procedural-memory/guardrail-registry.js +22 -0
- package/dist/vendor/memory-framework/procedural-memory/index.d.ts +31 -0
- package/dist/vendor/memory-framework/procedural-memory/index.js +34 -0
- package/dist/vendor/memory-framework/procedural-memory/prompt-rule-extractor.d.ts +95 -0
- package/dist/vendor/memory-framework/procedural-memory/prompt-rule-extractor.js +160 -0
- package/dist/vendor/memory-framework/procedural-memory/skill-registry.d.ts +115 -0
- package/dist/vendor/memory-framework/procedural-memory/skill-registry.js +165 -0
- package/dist/vendor/memory-framework/procedural-memory/workflow-patterns.d.ts +36 -0
- package/dist/vendor/memory-framework/procedural-memory/workflow-patterns.js +22 -0
- package/dist/vendor/memory-framework/semantic-graph/entity-resolver.d.ts +26 -0
- package/dist/vendor/memory-framework/semantic-graph/entity-resolver.js +61 -0
- package/dist/vendor/memory-framework/semantic-graph/index.d.ts +23 -0
- package/dist/vendor/memory-framework/semantic-graph/index.js +25 -0
- package/dist/vendor/memory-framework/semantic-graph/knowledge-graph.d.ts +50 -0
- package/dist/vendor/memory-framework/semantic-graph/knowledge-graph.js +44 -0
- package/dist/vendor/memory-framework/sensory-buffer/index.d.ts +41 -0
- package/dist/vendor/memory-framework/sensory-buffer/index.js +70 -0
- package/dist/vendor/memory-framework/types.d.ts +192 -0
- package/dist/vendor/memory-framework/types.js +42 -0
- package/dist/vendor/memory-framework/working-context/attention-scorer.d.ts +39 -0
- package/dist/vendor/memory-framework/working-context/attention-scorer.js +45 -0
- package/dist/vendor/memory-framework/working-context/context-window.d.ts +33 -0
- package/dist/vendor/memory-framework/working-context/context-window.js +35 -0
- package/dist/vendor/memory-framework/working-context/index.d.ts +30 -0
- package/dist/vendor/memory-framework/working-context/index.js +44 -0
- package/dist/vendor/memory-framework/write-policy/consolidation.d.ts +37 -0
- package/dist/vendor/memory-framework/write-policy/consolidation.js +50 -0
- package/dist/vendor/memory-framework/write-policy/forgetting-policy.d.ts +28 -0
- package/dist/vendor/memory-framework/write-policy/forgetting-policy.js +31 -0
- package/dist/vendor/memory-framework/write-policy/index.d.ts +40 -0
- package/dist/vendor/memory-framework/write-policy/index.js +50 -0
- package/dist/vendor/memory-framework/write-policy/salience-scorer.d.ts +41 -0
- package/dist/vendor/memory-framework/write-policy/salience-scorer.js +70 -0
- package/dist/vendor/self-judge-kit/assumption-tracker.d.ts +31 -0
- package/dist/vendor/self-judge-kit/assumption-tracker.js +45 -0
- package/dist/vendor/self-judge-kit/confidence-scorer.d.ts +46 -0
- package/dist/vendor/self-judge-kit/confidence-scorer.js +60 -0
- package/dist/vendor/self-judge-kit/deviation-detector.d.ts +23 -0
- package/dist/vendor/self-judge-kit/deviation-detector.js +55 -0
- package/dist/vendor/self-judge-kit/escalation-policy.d.ts +17 -0
- package/dist/vendor/self-judge-kit/escalation-policy.js +45 -0
- package/dist/vendor/self-judge-kit/index.d.ts +46 -0
- package/dist/vendor/self-judge-kit/index.js +79 -0
- package/dist/vendor/self-judge-kit/types.d.ts +87 -0
- package/dist/vendor/self-judge-kit/types.js +18 -0
- package/package.json +41 -4
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 学习回滚(rollback-controller)——「学」支柱 stability-guard 子模块。
|
|
3
|
+
* 职责:学习失败 / 引发退化时,回滚至**上一技能版本**(对接 §5.5 自愈中心学习回滚)。
|
|
4
|
+
* 边界:只决策与触发;实际版本回退由 07-自愈中心 rollback-controller 执行。
|
|
5
|
+
*
|
|
6
|
+
* v2.4.0(Phase C)实装:委托 SkillVersioner 做状态翻转
|
|
7
|
+
* (当前最高 active → rolled-back,前一 active → 恢复),
|
|
8
|
+
* 返回翻转后历史 + 恢复版本,供 pipeline 原子替换技能库。
|
|
9
|
+
* TODO(infra): 委托 07-自愈中心执行落盘回滚,并冻结相关学习任务(status='rolled-back')。
|
|
10
|
+
*/
|
|
11
|
+
import type { SkillDefinition } from '../types.js';
|
|
12
|
+
import { type RollbackOutcome } from '../skill-consolidation/skill-versioner.js';
|
|
13
|
+
/** 学习回滚控制器。 */
|
|
14
|
+
export declare class LearningRollbackController {
|
|
15
|
+
private readonly versioner;
|
|
16
|
+
/** 回滚指定技能:返回翻转后的完整历史与恢复的版本(无可回滚时 restored 为 undefined)。 */
|
|
17
|
+
rollback(history: readonly SkillDefinition[]): RollbackOutcome;
|
|
18
|
+
}
|
|
19
|
+
export type { RollbackOutcome };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 学习回滚(rollback-controller)——「学」支柱 stability-guard 子模块。
|
|
3
|
+
* 职责:学习失败 / 引发退化时,回滚至**上一技能版本**(对接 §5.5 自愈中心学习回滚)。
|
|
4
|
+
* 边界:只决策与触发;实际版本回退由 07-自愈中心 rollback-controller 执行。
|
|
5
|
+
*
|
|
6
|
+
* v2.4.0(Phase C)实装:委托 SkillVersioner 做状态翻转
|
|
7
|
+
* (当前最高 active → rolled-back,前一 active → 恢复),
|
|
8
|
+
* 返回翻转后历史 + 恢复版本,供 pipeline 原子替换技能库。
|
|
9
|
+
* TODO(infra): 委托 07-自愈中心执行落盘回滚,并冻结相关学习任务(status='rolled-back')。
|
|
10
|
+
*/
|
|
11
|
+
import { SkillVersioner } from '../skill-consolidation/skill-versioner.js';
|
|
12
|
+
/** 学习回滚控制器。 */
|
|
13
|
+
export class LearningRollbackController {
|
|
14
|
+
versioner = new SkillVersioner();
|
|
15
|
+
/** 回滚指定技能:返回翻转后的完整历史与恢复的版本(无可回滚时 restored 为 undefined)。 */
|
|
16
|
+
rollback(history) {
|
|
17
|
+
return this.versioner.rollback(history);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================
|
|
3
|
+
* YYC³ AI Family — 持续学习引擎(「学」支柱)核心类型定义
|
|
4
|
+
* ------------------------------------------------------------
|
|
5
|
+
* 文档依据:YYC3-AI-Family-Agent-架构设计.md §5.3
|
|
6
|
+
* 边界:负责经验回流 / 模式提炼 / 技能巩固与淘汰 / 知识更新 /
|
|
7
|
+
* 学习稳定性保障 / 学习调度;
|
|
8
|
+
* 不负责模型权重微调(参数级适应列为后置可选演进)。
|
|
9
|
+
*
|
|
10
|
+
* 学习模式声明(v2.0.0,避免「在线微调」误读):
|
|
11
|
+
* v2.0.0 的学习 = **程序性知识沉淀**(skill-consolidation 固化技能)
|
|
12
|
+
* + **语义知识更新**(knowledge-update 更新语义记忆);
|
|
13
|
+
* 参数级微调(权重适应)为**后置可选项**(§6.4 Phase D),
|
|
14
|
+
* 以「稳定性—可塑性困境」为约束,不得阻塞本引擎落地。
|
|
15
|
+
*
|
|
16
|
+
* ⚠️ 稳定性—可塑性约束(必选,见 §5.3):
|
|
17
|
+
* 任何新学习必须经 forgetting-detector 检查是否导致既有能力退化;
|
|
18
|
+
* 冲突案例触发 regression-tester 回归;失败学习由 rollback-controller
|
|
19
|
+
* 回滚至上一技能版本(对接 §5.5 自愈中心)。
|
|
20
|
+
* ============================================================
|
|
21
|
+
*/
|
|
22
|
+
import type { JudgmentSignal } from '../../vendor/self-judge-kit/index.js';
|
|
23
|
+
/**
|
|
24
|
+
* 学习模式(v2.0.0 仅前两者)。
|
|
25
|
+
* - procedural-consolidation:程序性知识沉淀(高频成功模式 → 技能)。
|
|
26
|
+
* - semantic-update:语义知识更新(冲突/过时事实 → 语义记忆)。
|
|
27
|
+
* 参数级微调(权重适应)为后置可选演进,不在此枚举内(§6.4 Phase D)。
|
|
28
|
+
*/
|
|
29
|
+
export type LearningMode = 'procedural-consolidation' | 'semantic-update';
|
|
30
|
+
/** 结果标注(不依赖人工标注,借助既有信号推导)。 */
|
|
31
|
+
export type OutcomeLabel = 'success' | 'failure' | 'partial';
|
|
32
|
+
/** 任务轨迹(从通信总线 task.executed 链路采集)。 */
|
|
33
|
+
export interface TaskTrajectory {
|
|
34
|
+
readonly traceId: string;
|
|
35
|
+
/** 发起家人。 */
|
|
36
|
+
readonly agent: string;
|
|
37
|
+
readonly taskType: string;
|
|
38
|
+
/** 工具/步骤调用序列。 */
|
|
39
|
+
readonly steps: readonly TrajectoryStep[];
|
|
40
|
+
readonly startedAt: number;
|
|
41
|
+
readonly finishedAt: number;
|
|
42
|
+
/** 链路是否正常结束(总线侧判定)。 */
|
|
43
|
+
readonly completed: boolean;
|
|
44
|
+
/** 【自】自我判断信号:低置信但成功 → 高价值学习素材(见 §5.1)。 */
|
|
45
|
+
readonly judgment?: JudgmentSignal;
|
|
46
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
47
|
+
}
|
|
48
|
+
/** 轨迹单步。 */
|
|
49
|
+
export interface TrajectoryStep {
|
|
50
|
+
readonly order: number;
|
|
51
|
+
readonly action: string;
|
|
52
|
+
readonly tool?: string;
|
|
53
|
+
readonly input?: unknown;
|
|
54
|
+
readonly output?: unknown;
|
|
55
|
+
readonly ok: boolean;
|
|
56
|
+
readonly latencyMs?: number;
|
|
57
|
+
}
|
|
58
|
+
/** 「条件X → 策略Y → 结果Z」三元组模式(pattern-extractor 用 LLM 抽象)。 */
|
|
59
|
+
export interface PatternTriplet {
|
|
60
|
+
/** 条件 X:触发情境(意图 / 前置事实 / 约束)。 */
|
|
61
|
+
readonly condition: string;
|
|
62
|
+
/** 策略 Y:采取的动作序列 / 工具使用模式。 */
|
|
63
|
+
readonly strategy: string;
|
|
64
|
+
/** 结果 Z:可观测成效。 */
|
|
65
|
+
readonly outcome: string;
|
|
66
|
+
/** 支撑该模式的轨迹(溯源)。 */
|
|
67
|
+
readonly supportingTraces: readonly string[];
|
|
68
|
+
/** 置信度 0–1(出现频次 + 结果一致性)。 */
|
|
69
|
+
readonly confidence: number;
|
|
70
|
+
}
|
|
71
|
+
/** 技能定义(可版本化,固化自高频成功模式)。 */
|
|
72
|
+
export interface SkillDefinition {
|
|
73
|
+
readonly id: string;
|
|
74
|
+
/**
|
|
75
|
+
* 统一命名空间 id(P3-T3):指向 manifest 契约 id 或 `learned.*` 沉淀命名空间;
|
|
76
|
+
* 缺省时由 skill-consolidation/skill-id.ts 的 `logicalIdOfStored` 派生
|
|
77
|
+
* (FNV 内部主键 `skill-xxxxxxxx` 归并为 `learned.skill-xxxxxxxx`)。
|
|
78
|
+
*/
|
|
79
|
+
readonly logicalId?: string;
|
|
80
|
+
readonly name: string;
|
|
81
|
+
/** 语义化版本,如 "1.2.0"。 */
|
|
82
|
+
readonly version: string;
|
|
83
|
+
readonly description: string;
|
|
84
|
+
/** 触发条件(意图 / 前置事实)。 */
|
|
85
|
+
readonly when: readonly string[];
|
|
86
|
+
/** 执行步骤。 */
|
|
87
|
+
readonly steps: readonly string[];
|
|
88
|
+
/** 由哪个模式三元组固化而来。 */
|
|
89
|
+
readonly sourcePattern?: PatternTriplet;
|
|
90
|
+
readonly status: 'active' | 'deprecated' | 'rolled-back';
|
|
91
|
+
readonly createdAt: number;
|
|
92
|
+
/** 最近使用时间(供 skill-pruner 淘汰久未使用)。 */
|
|
93
|
+
readonly lastUsedAt?: number;
|
|
94
|
+
/** 使用频次。 */
|
|
95
|
+
readonly useCount: number;
|
|
96
|
+
}
|
|
97
|
+
/** 回归结果(学习后稳定性验证,对接 tests/regression 基线)。 */
|
|
98
|
+
export interface RegressionResult {
|
|
99
|
+
readonly skillId: string;
|
|
100
|
+
readonly skillVersion: string;
|
|
101
|
+
readonly passed: boolean;
|
|
102
|
+
/** 通过率 0–1。 */
|
|
103
|
+
readonly passRate: number;
|
|
104
|
+
/** 回归用例总数。 */
|
|
105
|
+
readonly total: number;
|
|
106
|
+
/** 退化用例(新旧能力退化)。 */
|
|
107
|
+
readonly regressions: readonly RegressionCase[];
|
|
108
|
+
readonly at: number;
|
|
109
|
+
}
|
|
110
|
+
/** 回归用例。 */
|
|
111
|
+
export interface RegressionCase {
|
|
112
|
+
readonly id: string;
|
|
113
|
+
readonly expected: string;
|
|
114
|
+
readonly actual: string;
|
|
115
|
+
/** 该用例此前是否通过(true 表示本次新引入退化)。 */
|
|
116
|
+
readonly previouslyPassed: boolean;
|
|
117
|
+
}
|
|
118
|
+
/** 学习任务(供 learning-scheduler 排序与配额)。 */
|
|
119
|
+
export interface LearningTask {
|
|
120
|
+
readonly id: string;
|
|
121
|
+
readonly mode: LearningMode;
|
|
122
|
+
/** 优先级得分(越大越优先)。 */
|
|
123
|
+
readonly priority: number;
|
|
124
|
+
/** 预估资源配额(token / 调用次数)。 */
|
|
125
|
+
readonly budget: LearningBudget;
|
|
126
|
+
readonly status: 'pending' | 'running' | 'done' | 'failed' | 'rolled-back';
|
|
127
|
+
/** 素材来源(轨迹 / 模式)。 */
|
|
128
|
+
readonly source: string;
|
|
129
|
+
readonly requestedAt: number;
|
|
130
|
+
}
|
|
131
|
+
/** 学习资源配额。 */
|
|
132
|
+
export interface LearningBudget {
|
|
133
|
+
/** 允许消耗的 LLM token 上限。 */
|
|
134
|
+
readonly maxTokens: number;
|
|
135
|
+
/** 允许的调用次数。 */
|
|
136
|
+
readonly maxCalls: number;
|
|
137
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================
|
|
3
|
+
* YYC³ AI Family — 持续学习引擎(「学」支柱)核心类型定义
|
|
4
|
+
* ------------------------------------------------------------
|
|
5
|
+
* 文档依据:YYC3-AI-Family-Agent-架构设计.md §5.3
|
|
6
|
+
* 边界:负责经验回流 / 模式提炼 / 技能巩固与淘汰 / 知识更新 /
|
|
7
|
+
* 学习稳定性保障 / 学习调度;
|
|
8
|
+
* 不负责模型权重微调(参数级适应列为后置可选演进)。
|
|
9
|
+
*
|
|
10
|
+
* 学习模式声明(v2.0.0,避免「在线微调」误读):
|
|
11
|
+
* v2.0.0 的学习 = **程序性知识沉淀**(skill-consolidation 固化技能)
|
|
12
|
+
* + **语义知识更新**(knowledge-update 更新语义记忆);
|
|
13
|
+
* 参数级微调(权重适应)为**后置可选项**(§6.4 Phase D),
|
|
14
|
+
* 以「稳定性—可塑性困境」为约束,不得阻塞本引擎落地。
|
|
15
|
+
*
|
|
16
|
+
* ⚠️ 稳定性—可塑性约束(必选,见 §5.3):
|
|
17
|
+
* 任何新学习必须经 forgetting-detector 检查是否导致既有能力退化;
|
|
18
|
+
* 冲突案例触发 regression-tester 回归;失败学习由 rollback-controller
|
|
19
|
+
* 回滚至上一技能版本(对接 §5.5 自愈中心)。
|
|
20
|
+
* ============================================================
|
|
21
|
+
*/
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 合规审计(compliance-audit)——「治」支柱子模块。
|
|
3
|
+
* 职责:合规检查 + **不可篡改审计链**(append-only,链式哈希防篡改)。
|
|
4
|
+
* 边界:只记录与校验;合规判定策略化归 security / quality-governance。
|
|
5
|
+
*
|
|
6
|
+
* v2.5.0(Phase D)转实——FNV-1a 链式哈希:
|
|
7
|
+
* - hash = FNV-1a(content ∥ prevHash):任何一条被篡改,其 hash 重算不符且后续 prevHash 断链;
|
|
8
|
+
* - verify() 重算全链逐环校验,断链即 false(防篡改可检测)。
|
|
9
|
+
* TODO(infra): 落 WORM / 区块链存证存储;提供审计查询分页接口(当前 list 全量内存)。
|
|
10
|
+
*/
|
|
11
|
+
import type { AuditRecord, PolicyDecision, ResourceRequest } from '../types.js';
|
|
12
|
+
/** 合规审计链。 */
|
|
13
|
+
export declare class ComplianceAudit {
|
|
14
|
+
private readonly chain;
|
|
15
|
+
/** 追加审计记录(链式哈希,篡改即断链)。 */
|
|
16
|
+
append(req: ResourceRequest, decision: PolicyDecision): AuditRecord;
|
|
17
|
+
/** 校验链完整性:重算每条 hash 并逐环校验 prevHash,断链即 false。 */
|
|
18
|
+
verify(): boolean;
|
|
19
|
+
list(): readonly AuditRecord[];
|
|
20
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 合规审计(compliance-audit)——「治」支柱子模块。
|
|
3
|
+
* 职责:合规检查 + **不可篡改审计链**(append-only,链式哈希防篡改)。
|
|
4
|
+
* 边界:只记录与校验;合规判定策略化归 security / quality-governance。
|
|
5
|
+
*
|
|
6
|
+
* v2.5.0(Phase D)转实——FNV-1a 链式哈希:
|
|
7
|
+
* - hash = FNV-1a(content ∥ prevHash):任何一条被篡改,其 hash 重算不符且后续 prevHash 断链;
|
|
8
|
+
* - verify() 重算全链逐环校验,断链即 false(防篡改可检测)。
|
|
9
|
+
* TODO(infra): 落 WORM / 区块链存证存储;提供审计查询分页接口(当前 list 全量内存)。
|
|
10
|
+
*/
|
|
11
|
+
/** FNV-1a 32 位摘要(确定性、跨平台一致;桩级防篡改足够,生产可换 SHA-256)。 */
|
|
12
|
+
function fnv1a(input) {
|
|
13
|
+
let h = 0x811c9dc5;
|
|
14
|
+
for (let i = 0; i < input.length; i += 1) {
|
|
15
|
+
h ^= input.charCodeAt(i);
|
|
16
|
+
h = Math.imul(h, 0x01000193);
|
|
17
|
+
}
|
|
18
|
+
return (h >>> 0).toString(16).padStart(8, '0');
|
|
19
|
+
}
|
|
20
|
+
/** 审计哈希原像(append 与 verify 共用同一编码,保证可重算)。 */
|
|
21
|
+
function hashPayload(parts) {
|
|
22
|
+
return fnv1a(JSON.stringify({
|
|
23
|
+
id: parts.id,
|
|
24
|
+
ts: parts.ts,
|
|
25
|
+
traceId: parts.traceId,
|
|
26
|
+
actor: parts.actor,
|
|
27
|
+
action: parts.action,
|
|
28
|
+
resource: parts.resource,
|
|
29
|
+
decision: parts.decision,
|
|
30
|
+
prevHash: parts.prevHash,
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
/** 合规审计链。 */
|
|
34
|
+
export class ComplianceAudit {
|
|
35
|
+
chain = [];
|
|
36
|
+
/** 追加审计记录(链式哈希,篡改即断链)。 */
|
|
37
|
+
append(req, decision) {
|
|
38
|
+
const prevHash = this.chain.length > 0 ? this.chain[this.chain.length - 1].hash : 'GENESIS';
|
|
39
|
+
const record = {
|
|
40
|
+
id: `audit-${this.chain.length + 1}`,
|
|
41
|
+
ts: Date.now(),
|
|
42
|
+
traceId: req.traceId,
|
|
43
|
+
actor: req.actor,
|
|
44
|
+
action: req.action,
|
|
45
|
+
resource: req.resource,
|
|
46
|
+
decision,
|
|
47
|
+
hash: 'PENDING',
|
|
48
|
+
prevHash,
|
|
49
|
+
};
|
|
50
|
+
// hash 覆盖完整原像(含 prevHash),与 verify() 重算逻辑严格一致
|
|
51
|
+
const withHash = {
|
|
52
|
+
...record,
|
|
53
|
+
hash: hashPayload({
|
|
54
|
+
id: record.id,
|
|
55
|
+
ts: record.ts,
|
|
56
|
+
traceId: record.traceId,
|
|
57
|
+
actor: record.actor,
|
|
58
|
+
action: record.action,
|
|
59
|
+
resource: record.resource,
|
|
60
|
+
decision: record.decision,
|
|
61
|
+
prevHash: record.prevHash,
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
this.chain.push(withHash);
|
|
65
|
+
return withHash;
|
|
66
|
+
}
|
|
67
|
+
/** 校验链完整性:重算每条 hash 并逐环校验 prevHash,断链即 false。 */
|
|
68
|
+
verify() {
|
|
69
|
+
let prev = 'GENESIS';
|
|
70
|
+
for (const r of this.chain) {
|
|
71
|
+
if (r.prevHash !== prev)
|
|
72
|
+
return false;
|
|
73
|
+
const expected = hashPayload(r);
|
|
74
|
+
if (r.hash !== expected)
|
|
75
|
+
return false;
|
|
76
|
+
prev = r.hash;
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
list() {
|
|
81
|
+
return this.chain;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================
|
|
3
|
+
* YYC³ AI Family — 治理中心(「治」支柱)统一入口(barrel)。
|
|
4
|
+
* ------------------------------------------------------------
|
|
5
|
+
* 四大子模块:
|
|
6
|
+
* policy-registry 策略即代码注册中心 + 策略总线(统一拦截点)
|
|
7
|
+
* security-governance 安全治理适配层(对接智云·守护 UEBA/SOAR)
|
|
8
|
+
* quality-governance 质量治理适配层(对接格物·宗师 SAST/黄金标准库)
|
|
9
|
+
* compliance-audit 合规与不可篡改审计链
|
|
10
|
+
*
|
|
11
|
+
* 核心机制(§5.4):策略即代码、白名单可版本化、审计不可篡改(对接守护/宗师)。
|
|
12
|
+
* ============================================================
|
|
13
|
+
*/
|
|
14
|
+
export * from './types.js';
|
|
15
|
+
export * from './policy-registry/index.js';
|
|
16
|
+
export * from './security-governance/index.js';
|
|
17
|
+
export * from './quality-governance/index.js';
|
|
18
|
+
export * from './compliance-audit/index.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================
|
|
3
|
+
* YYC³ AI Family — 治理中心(「治」支柱)统一入口(barrel)。
|
|
4
|
+
* ------------------------------------------------------------
|
|
5
|
+
* 四大子模块:
|
|
6
|
+
* policy-registry 策略即代码注册中心 + 策略总线(统一拦截点)
|
|
7
|
+
* security-governance 安全治理适配层(对接智云·守护 UEBA/SOAR)
|
|
8
|
+
* quality-governance 质量治理适配层(对接格物·宗师 SAST/黄金标准库)
|
|
9
|
+
* compliance-audit 合规与不可篡改审计链
|
|
10
|
+
*
|
|
11
|
+
* 核心机制(§5.4):策略即代码、白名单可版本化、审计不可篡改(对接守护/宗师)。
|
|
12
|
+
* ============================================================
|
|
13
|
+
*/
|
|
14
|
+
export * from './types.js';
|
|
15
|
+
export * from './policy-registry/index.js';
|
|
16
|
+
export * from './security-governance/index.js';
|
|
17
|
+
export * from './quality-governance/index.js';
|
|
18
|
+
export * from './compliance-audit/index.js';
|
package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/policy-registry/policy-bus.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 家族策略总线(family-policy-bus)——「治」支柱 policy-registry 子模块。
|
|
3
|
+
* 职责(§5.4 统一拦截点):任何**跨家人调用**先经策略裁决
|
|
4
|
+
* (allow / deny / allow-with-audit);与 guardrail-registry 双向同步;
|
|
5
|
+
* 命中 deny / audit 的裁决写入不可篡改审计链。
|
|
6
|
+
* 边界:不实现具体检测(委托 security / quality-governance)。
|
|
7
|
+
*
|
|
8
|
+
* ⚠️ 这是总线上唯一的统一拦截入口(FamilyPolicyBus)。裁决顺序:
|
|
9
|
+
* 护栏规则(guardrail) → 安全治理(守护) → 质量治理(宗师) → 策略注册中心。
|
|
10
|
+
*
|
|
11
|
+
* TODO(infra): 接入 family-communication-bus 中间件链;低延迟缓存 + 失败开放/关闭可配置。
|
|
12
|
+
*/
|
|
13
|
+
import type { GuardrailRule } from '../../../vendor/memory-framework/index.js';
|
|
14
|
+
import type { ComplianceAudit } from '../compliance-audit/compliance-audit.js';
|
|
15
|
+
import type { PolicyRegistry } from './policy-registry.js';
|
|
16
|
+
import type { SecurityGovernance, SecuritySignal } from '../security-governance/security-governance.js';
|
|
17
|
+
import type { QualityGovernance, QualitySignal } from '../quality-governance/quality-governance.js';
|
|
18
|
+
import type { FamilyPolicyBus, PolicyDecision, ResourceRequest } from '../types.js';
|
|
19
|
+
/** 策略总线依赖(可注入,便于测试与替换)。 */
|
|
20
|
+
export interface FamilyPolicyBusDeps {
|
|
21
|
+
readonly registry: PolicyRegistry;
|
|
22
|
+
readonly audit: ComplianceAudit;
|
|
23
|
+
readonly security: SecurityGovernance;
|
|
24
|
+
readonly quality: QualityGovernance;
|
|
25
|
+
/** 护栏规则来源(与 guardrail-registry 同步)。 */
|
|
26
|
+
readonly guardrails?: () => readonly GuardrailRule[];
|
|
27
|
+
/** 安全信号取数(守护 UEBA/SOAR)。 */
|
|
28
|
+
readonly securitySignal?: (req: ResourceRequest) => SecuritySignal | undefined;
|
|
29
|
+
/** 质量信号取数(宗师 SAST/黄金标准库)。 */
|
|
30
|
+
readonly qualitySignal?: (req: ResourceRequest) => QualitySignal | undefined;
|
|
31
|
+
}
|
|
32
|
+
/** 家族策略总线实现(统一拦截)。 */
|
|
33
|
+
export declare class DefaultFamilyPolicyBus implements FamilyPolicyBus {
|
|
34
|
+
private readonly deps;
|
|
35
|
+
constructor(deps: FamilyPolicyBusDeps);
|
|
36
|
+
evaluate(req: ResourceRequest): Promise<PolicyDecision>;
|
|
37
|
+
private decide;
|
|
38
|
+
private guardrailMatches;
|
|
39
|
+
}
|
package/dist/src/06-/346/262/273/347/220/206/344/270/255/345/277/203/policy-registry/policy-bus.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 家族策略总线(family-policy-bus)——「治」支柱 policy-registry 子模块。
|
|
3
|
+
* 职责(§5.4 统一拦截点):任何**跨家人调用**先经策略裁决
|
|
4
|
+
* (allow / deny / allow-with-audit);与 guardrail-registry 双向同步;
|
|
5
|
+
* 命中 deny / audit 的裁决写入不可篡改审计链。
|
|
6
|
+
* 边界:不实现具体检测(委托 security / quality-governance)。
|
|
7
|
+
*
|
|
8
|
+
* ⚠️ 这是总线上唯一的统一拦截入口(FamilyPolicyBus)。裁决顺序:
|
|
9
|
+
* 护栏规则(guardrail) → 安全治理(守护) → 质量治理(宗师) → 策略注册中心。
|
|
10
|
+
*
|
|
11
|
+
* TODO(infra): 接入 family-communication-bus 中间件链;低延迟缓存 + 失败开放/关闭可配置。
|
|
12
|
+
*/
|
|
13
|
+
/** 家族策略总线实现(统一拦截)。 */
|
|
14
|
+
export class DefaultFamilyPolicyBus {
|
|
15
|
+
deps;
|
|
16
|
+
constructor(deps) {
|
|
17
|
+
this.deps = deps;
|
|
18
|
+
}
|
|
19
|
+
async evaluate(req) {
|
|
20
|
+
// TODO(infra): 中间件链(鉴权→护栏→安全→质量→审计),失败开放/关闭可配置
|
|
21
|
+
const decision = this.decide(req);
|
|
22
|
+
// 命中 deny / allow-with-audit 时写入不可篡改审计链
|
|
23
|
+
if (decision.decision !== 'allow') {
|
|
24
|
+
this.deps.audit.append(req, decision);
|
|
25
|
+
}
|
|
26
|
+
return decision;
|
|
27
|
+
}
|
|
28
|
+
decide(req) {
|
|
29
|
+
// 1) 护栏规则(与 guardrail-registry 同步)
|
|
30
|
+
const guardrails = this.deps.guardrails?.() ?? [];
|
|
31
|
+
const denied = guardrails.find((g) => g.action === 'deny' && this.guardrailMatches(g, req));
|
|
32
|
+
if (denied) {
|
|
33
|
+
return {
|
|
34
|
+
decision: 'deny',
|
|
35
|
+
policyId: denied.id,
|
|
36
|
+
policyVersion: denied.version,
|
|
37
|
+
reason: `护栏拦截:${denied.statement}`,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// 2) 安全治理(智云·守护)
|
|
41
|
+
const securitySignal = this.deps.securitySignal?.(req);
|
|
42
|
+
if (securitySignal) {
|
|
43
|
+
const securityDecision = this.deps.security.assess(req, securitySignal);
|
|
44
|
+
if (securityDecision.decision === 'deny')
|
|
45
|
+
return securityDecision;
|
|
46
|
+
}
|
|
47
|
+
// 3) 质量治理(格物·宗师)
|
|
48
|
+
const qualitySignal = this.deps.qualitySignal?.(req);
|
|
49
|
+
if (qualitySignal) {
|
|
50
|
+
const qualityDecision = this.deps.quality.assess(req, qualitySignal);
|
|
51
|
+
if (qualityDecision.decision !== 'allow')
|
|
52
|
+
return qualityDecision;
|
|
53
|
+
}
|
|
54
|
+
// 4) 策略注册中心(策略即代码)——命中则 allow-with-audit
|
|
55
|
+
const policies = this.deps.registry.match(req);
|
|
56
|
+
if (policies.length > 0) {
|
|
57
|
+
const policy = policies[0];
|
|
58
|
+
return {
|
|
59
|
+
decision: 'allow-with-audit',
|
|
60
|
+
policyId: policy.id,
|
|
61
|
+
policyVersion: policy.version,
|
|
62
|
+
reason: `策略 ${policy.id}@${policy.version} 命中,需记录审计`,
|
|
63
|
+
obligations: ['记录审计'],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return { decision: 'allow', policyId: 'default-allow', policyVersion: '1.0.0', reason: '无拦截策略命中' };
|
|
67
|
+
}
|
|
68
|
+
guardrailMatches(rule, req) {
|
|
69
|
+
// TODO(infra): 基于 interceptPoint(policy-bus)与作用域(agent/global)精确匹配
|
|
70
|
+
void req;
|
|
71
|
+
return rule.interceptPoint === 'policy-bus';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 策略注册中心(policy-registry)——「治」支柱 policy-registry 子模块。
|
|
3
|
+
* 职责:**策略即代码**注册中心,含**版本化**(多版本共存、回滚)。
|
|
4
|
+
* 边界:只注册与检索策略定义;裁决执行归 family-policy-bus(policy-bus)。
|
|
5
|
+
*
|
|
6
|
+
* TODO(infra): 落 Git 版本化 YAML + assets/schemas 校验;与 guardrail-registry 双向同步。
|
|
7
|
+
*/
|
|
8
|
+
import type { PolicyDefinition, ResourceRequest } from '../types.js';
|
|
9
|
+
/** 策略注册中心(内存桩,多版本共存)。 */
|
|
10
|
+
export declare class PolicyRegistry {
|
|
11
|
+
/** id → (version → definition) */
|
|
12
|
+
private readonly versions;
|
|
13
|
+
register(policy: PolicyDefinition): PolicyDefinition;
|
|
14
|
+
/** 取某策略最新 active 版本。 */
|
|
15
|
+
latest(id: string): PolicyDefinition | undefined;
|
|
16
|
+
/** 命中给定请求的候选策略(作用域匹配)。 */
|
|
17
|
+
match(req: ResourceRequest): readonly PolicyDefinition[];
|
|
18
|
+
private scopeMatches;
|
|
19
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 策略注册中心(policy-registry)——「治」支柱 policy-registry 子模块。
|
|
3
|
+
* 职责:**策略即代码**注册中心,含**版本化**(多版本共存、回滚)。
|
|
4
|
+
* 边界:只注册与检索策略定义;裁决执行归 family-policy-bus(policy-bus)。
|
|
5
|
+
*
|
|
6
|
+
* TODO(infra): 落 Git 版本化 YAML + assets/schemas 校验;与 guardrail-registry 双向同步。
|
|
7
|
+
*/
|
|
8
|
+
/** 策略注册中心(内存桩,多版本共存)。 */
|
|
9
|
+
export class PolicyRegistry {
|
|
10
|
+
/** id → (version → definition) */
|
|
11
|
+
versions = new Map();
|
|
12
|
+
register(policy) {
|
|
13
|
+
const byVersion = this.versions.get(policy.id) ?? new Map();
|
|
14
|
+
byVersion.set(policy.version, policy);
|
|
15
|
+
this.versions.set(policy.id, byVersion);
|
|
16
|
+
// TODO(infra): 写入 Git 版本化 YAML + schema 校验
|
|
17
|
+
return policy;
|
|
18
|
+
}
|
|
19
|
+
/** 取某策略最新 active 版本。 */
|
|
20
|
+
latest(id) {
|
|
21
|
+
const byVersion = this.versions.get(id);
|
|
22
|
+
if (!byVersion)
|
|
23
|
+
return undefined;
|
|
24
|
+
return [...byVersion.values()].filter((p) => p.status === 'active').pop();
|
|
25
|
+
}
|
|
26
|
+
/** 命中给定请求的候选策略(作用域匹配)。 */
|
|
27
|
+
match(req) {
|
|
28
|
+
// TODO(infra): ABAC 属性匹配 + 优先级排序
|
|
29
|
+
const out = [];
|
|
30
|
+
for (const byVersion of this.versions.values()) {
|
|
31
|
+
const active = [...byVersion.values()].filter((p) => p.status === 'active').pop();
|
|
32
|
+
if (active && this.scopeMatches(active, req))
|
|
33
|
+
out.push(active);
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
scopeMatches(policy, req) {
|
|
38
|
+
const scope = policy.scope;
|
|
39
|
+
const okAgent = !scope.agents || scope.wildcard === true || scope.agents.includes(req.actor);
|
|
40
|
+
const okAction = !scope.actions || scope.actions.includes(req.action);
|
|
41
|
+
const okResource = !scope.resources || scope.resources.includes(req.resource);
|
|
42
|
+
return okAgent && okAction && okResource;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 安全策略映射(security-policies · P2-T4)—— 「治」支柱 policy-registry 子模块。
|
|
3
|
+
* 职责:蓝图 1209 安全策略(零信任 / 内容过滤 / 注入检测)→ `PolicyRegistry.register()`
|
|
4
|
+
* 的**策略即代码**映射;并提供**模式感知裁决**(SecurityPolicyBinder):
|
|
5
|
+
* 默认 **observe**(命中只记审计 allow-with-audit),**enforce 为显式开关**
|
|
6
|
+
* (逐策略声明,命中即 deny + 计数)。
|
|
7
|
+
* 边界:不实现检测算法(复用守护 detectors);策略定义经解析注入(内核零 IO)。
|
|
8
|
+
*/
|
|
9
|
+
import type { ComplianceAudit } from '../compliance-audit/compliance-audit.js';
|
|
10
|
+
import type { PolicyDecision, PolicyScope, ResourceRequest } from '../types.js';
|
|
11
|
+
import type { PolicyRegistry } from './policy-registry.js';
|
|
12
|
+
/** 安全策略定义(= PolicyDefinition + 模式开关 + 来源锚点)。 */
|
|
13
|
+
export interface SecurityPolicyDefinition {
|
|
14
|
+
readonly id: string;
|
|
15
|
+
readonly version: string;
|
|
16
|
+
/** 规则表达式名(检测算法锚点,如 detect-prompt-injection → 守护 injection-detector)。 */
|
|
17
|
+
readonly rule: string;
|
|
18
|
+
/** 裁决模式:observe(默认)= 命中记审计;enforce = 命中即拒绝。 */
|
|
19
|
+
readonly mode: 'observe' | 'enforce';
|
|
20
|
+
readonly scope: PolicyScope;
|
|
21
|
+
/** 来源锚点(如 blueprint-1209)。 */
|
|
22
|
+
readonly source?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 把安全策略注册进 PolicyRegistry(可枚举 / 可版本化)。
|
|
26
|
+
* @returns 逐条模式表(id → mode),供 Binder 裁决。
|
|
27
|
+
*/
|
|
28
|
+
export declare function registerSecurityPolicies(registry: PolicyRegistry, defs: readonly SecurityPolicyDefinition[]): Map<string, 'observe' | 'enforce'>;
|
|
29
|
+
/** 策略绑定器依赖(可注入)。 */
|
|
30
|
+
export interface SecurityPolicyBinderDeps {
|
|
31
|
+
readonly registry: PolicyRegistry;
|
|
32
|
+
/** 审计链(observe / enforce 均留痕,篡改即断链)。 */
|
|
33
|
+
readonly audit?: ComplianceAudit;
|
|
34
|
+
/** 计数回调(指标面可挂 family_capability_plugin_denied_total 同类口径)。 */
|
|
35
|
+
readonly onDeny?: (policyId: string, req: ResourceRequest) => void;
|
|
36
|
+
}
|
|
37
|
+
/** 安全策略绑定器(模式感知裁决;observe 默认,enforce 显式)。 */
|
|
38
|
+
export declare class SecurityPolicyBinder {
|
|
39
|
+
private readonly deps;
|
|
40
|
+
private readonly modes;
|
|
41
|
+
private denyCount;
|
|
42
|
+
constructor(deps: SecurityPolicyBinderDeps, modes: Map<string, 'observe' | 'enforce'>);
|
|
43
|
+
/** 已拦截计数(enforce 命中)。 */
|
|
44
|
+
get deniedTotal(): number;
|
|
45
|
+
/** 已注册策略数(经 PolicyRegistry 的 active 视角)。 */
|
|
46
|
+
get policyTotal(): number;
|
|
47
|
+
/**
|
|
48
|
+
* 裁决一次资源请求:
|
|
49
|
+
* 无命中 → allow(default-allow);
|
|
50
|
+
* observe 命中 → allow-with-audit(记审计链);
|
|
51
|
+
* enforce 命中 → deny(记审计链 + 计数 + 回调)。
|
|
52
|
+
*/
|
|
53
|
+
evaluate(req: ResourceRequest): PolicyDecision;
|
|
54
|
+
}
|