@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,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 偏好追踪(preference-tracker)——「学」支柱 knowledge-update 子模块。
|
|
3
|
+
* 职责:用户偏好**渐进更新**(渐进式覆盖,不粗暴替换,保留历史偏好可回溯)。
|
|
4
|
+
* 边界:只维护偏好;规则演化归 rule-evolution。
|
|
5
|
+
*
|
|
6
|
+
* v2.5.0(Phase E)转实——历史保留 + 冲突防抖:
|
|
7
|
+
* - update() 沿用纯函数签名;实例内部自动把 current 存入该 key 的历史(可回溯);
|
|
8
|
+
* - 冲突防抖(渐进式覆盖):观测值与当前值不同 → 置信先衰减(×0.5,上限 0.5)再累积,
|
|
9
|
+
* 避免偶发反馈翻转高置信偏好;同值反馈 → 置信按 alpha 渐进提升。
|
|
10
|
+
* TODO(infra): 历史写入语义记忆(preference 实体);持续冲突触发治理裁决。
|
|
11
|
+
*/
|
|
12
|
+
/** 用户偏好条目。 */
|
|
13
|
+
export interface Preference {
|
|
14
|
+
readonly key: string;
|
|
15
|
+
readonly value: unknown;
|
|
16
|
+
/** 置信度 0–1(随反馈渐进提升)。 */
|
|
17
|
+
readonly confidence: number;
|
|
18
|
+
readonly updatedAt: number;
|
|
19
|
+
}
|
|
20
|
+
/** 偏好追踪器。 */
|
|
21
|
+
export declare class PreferenceTracker {
|
|
22
|
+
private readonly history;
|
|
23
|
+
/**
|
|
24
|
+
* 渐进更新:以 alpha 为学习率向观测值靠拢。
|
|
25
|
+
* 传入 current 时自动归档历史(historyOf 可回溯);首见 key 用 'unknown' 兜底。
|
|
26
|
+
*/
|
|
27
|
+
update(current: Preference | undefined, observed: unknown, alpha?: number): Preference;
|
|
28
|
+
/** 指定 key 的历史偏好(旧→新,供回溯与冲突消解审计)。 */
|
|
29
|
+
historyOf(key: string): readonly Preference[];
|
|
30
|
+
/** 全部已追踪 key(供观测)。 */
|
|
31
|
+
trackedKeys(): readonly string[];
|
|
32
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 偏好追踪(preference-tracker)——「学」支柱 knowledge-update 子模块。
|
|
3
|
+
* 职责:用户偏好**渐进更新**(渐进式覆盖,不粗暴替换,保留历史偏好可回溯)。
|
|
4
|
+
* 边界:只维护偏好;规则演化归 rule-evolution。
|
|
5
|
+
*
|
|
6
|
+
* v2.5.0(Phase E)转实——历史保留 + 冲突防抖:
|
|
7
|
+
* - update() 沿用纯函数签名;实例内部自动把 current 存入该 key 的历史(可回溯);
|
|
8
|
+
* - 冲突防抖(渐进式覆盖):观测值与当前值不同 → 置信先衰减(×0.5,上限 0.5)再累积,
|
|
9
|
+
* 避免偶发反馈翻转高置信偏好;同值反馈 → 置信按 alpha 渐进提升。
|
|
10
|
+
* TODO(infra): 历史写入语义记忆(preference 实体);持续冲突触发治理裁决。
|
|
11
|
+
*/
|
|
12
|
+
/** 偏好追踪器。 */
|
|
13
|
+
export class PreferenceTracker {
|
|
14
|
+
history = new Map();
|
|
15
|
+
/**
|
|
16
|
+
* 渐进更新:以 alpha 为学习率向观测值靠拢。
|
|
17
|
+
* 传入 current 时自动归档历史(historyOf 可回溯);首见 key 用 'unknown' 兜底。
|
|
18
|
+
*/
|
|
19
|
+
update(current, observed, alpha = 0.3) {
|
|
20
|
+
const key = current?.key ?? 'unknown';
|
|
21
|
+
if (current) {
|
|
22
|
+
const hist = this.history.get(key) ?? [];
|
|
23
|
+
hist.push(current);
|
|
24
|
+
this.history.set(key, hist);
|
|
25
|
+
}
|
|
26
|
+
const prevConfidence = current?.confidence ?? 0;
|
|
27
|
+
// 冲突防抖:值变化 → 先衰减再累积;同值 → 直接渐进提升
|
|
28
|
+
const changed = current !== undefined && !scalarEquals(current.value, observed);
|
|
29
|
+
const base = changed ? Math.min(prevConfidence * 0.5, 0.5) : prevConfidence;
|
|
30
|
+
return {
|
|
31
|
+
key,
|
|
32
|
+
value: observed,
|
|
33
|
+
confidence: base + alpha * (1 - base),
|
|
34
|
+
updatedAt: Date.now(),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** 指定 key 的历史偏好(旧→新,供回溯与冲突消解审计)。 */
|
|
38
|
+
historyOf(key) {
|
|
39
|
+
return this.history.get(key) ?? [];
|
|
40
|
+
}
|
|
41
|
+
/** 全部已追踪 key(供观测)。 */
|
|
42
|
+
trackedKeys() {
|
|
43
|
+
return [...this.history.keys()];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** 值相等判定(标量与可序列化值统一走 JSON 比较,保证确定)。 */
|
|
47
|
+
function scalarEquals(a, b) {
|
|
48
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
49
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 规则演化(rule-evolution)——「学」支柱 knowledge-update 子模块。
|
|
3
|
+
* 职责:行为规则演化,**对接程序记忆**(procedural-memory 的可版本化规则)。
|
|
4
|
+
* 边界:只产出演化**建议**,须经治理中心审核后才固化,避免规则自激。
|
|
5
|
+
*
|
|
6
|
+
* v2.5.0(Phase E)转实——演化门禁:
|
|
7
|
+
* - 仅 confidence ≥ 0.8 且溯源轨迹 ≥ 2 的高置信模式才产出演化建议
|
|
8
|
+
* (低质模式不触发规则变更,防规则自激);
|
|
9
|
+
* - ruleId 缺省由 condition 的 FNV-1a 摘要确定(同情境同规则,跨周期可升级);
|
|
10
|
+
* - 版本演化 fromVersion → minor +1(对齐 skill-versioner 语义)。
|
|
11
|
+
* TODO(infra): 对接 guardrail-registry 与 family-policy-bus,规则变更写入不可篡改审计链;
|
|
12
|
+
* write-policy.salience-scorer 接入后替换固定 salience。
|
|
13
|
+
*/
|
|
14
|
+
import type { MemoryWriteRequest } from '../../../vendor/memory-framework/index.js';
|
|
15
|
+
import type { PatternTriplet } from '../types.js';
|
|
16
|
+
/** 规则演化建议。 */
|
|
17
|
+
export interface RuleEvolutionProposal {
|
|
18
|
+
readonly ruleId: string;
|
|
19
|
+
readonly fromVersion: string;
|
|
20
|
+
readonly toVersion: string;
|
|
21
|
+
/** 变更内容(策略即代码片段)。 */
|
|
22
|
+
readonly change: string;
|
|
23
|
+
readonly rationale: string;
|
|
24
|
+
}
|
|
25
|
+
/** 演化门禁阈值(confidence ≥ 0.8 且溯源 ≥ 2)。 */
|
|
26
|
+
export declare const RULE_EVOLUTION_GATE: {
|
|
27
|
+
readonly minConfidence: 0.8;
|
|
28
|
+
readonly minSupportingTraces: 2;
|
|
29
|
+
};
|
|
30
|
+
/** 已知规则的当前状态(供既有规则升级;缺省视为新规则 v1.0.0)。 */
|
|
31
|
+
export interface RuleCurrentState {
|
|
32
|
+
readonly ruleId?: string;
|
|
33
|
+
readonly fromVersion?: string;
|
|
34
|
+
}
|
|
35
|
+
/** 规则演化器。 */
|
|
36
|
+
export declare class RuleEvolution {
|
|
37
|
+
/** 从高频模式推导行为规则演化建议(未达门禁返回 undefined)。 */
|
|
38
|
+
propose(pattern: PatternTriplet, current?: RuleCurrentState): RuleEvolutionProposal | undefined;
|
|
39
|
+
/** 产出程序记忆写入请求(治理审核通过后提交)。 */
|
|
40
|
+
toWriteRequest(proposal: RuleEvolutionProposal): MemoryWriteRequest;
|
|
41
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 规则演化(rule-evolution)——「学」支柱 knowledge-update 子模块。
|
|
3
|
+
* 职责:行为规则演化,**对接程序记忆**(procedural-memory 的可版本化规则)。
|
|
4
|
+
* 边界:只产出演化**建议**,须经治理中心审核后才固化,避免规则自激。
|
|
5
|
+
*
|
|
6
|
+
* v2.5.0(Phase E)转实——演化门禁:
|
|
7
|
+
* - 仅 confidence ≥ 0.8 且溯源轨迹 ≥ 2 的高置信模式才产出演化建议
|
|
8
|
+
* (低质模式不触发规则变更,防规则自激);
|
|
9
|
+
* - ruleId 缺省由 condition 的 FNV-1a 摘要确定(同情境同规则,跨周期可升级);
|
|
10
|
+
* - 版本演化 fromVersion → minor +1(对齐 skill-versioner 语义)。
|
|
11
|
+
* TODO(infra): 对接 guardrail-registry 与 family-policy-bus,规则变更写入不可篡改审计链;
|
|
12
|
+
* write-policy.salience-scorer 接入后替换固定 salience。
|
|
13
|
+
*/
|
|
14
|
+
/** 演化门禁阈值(confidence ≥ 0.8 且溯源 ≥ 2)。 */
|
|
15
|
+
export const RULE_EVOLUTION_GATE = {
|
|
16
|
+
minConfidence: 0.8,
|
|
17
|
+
minSupportingTraces: 2,
|
|
18
|
+
};
|
|
19
|
+
/** 规则演化器。 */
|
|
20
|
+
export class RuleEvolution {
|
|
21
|
+
/** 从高频模式推导行为规则演化建议(未达门禁返回 undefined)。 */
|
|
22
|
+
propose(pattern, current) {
|
|
23
|
+
if (pattern.confidence < RULE_EVOLUTION_GATE.minConfidence)
|
|
24
|
+
return undefined;
|
|
25
|
+
if (pattern.supportingTraces.length < RULE_EVOLUTION_GATE.minSupportingTraces)
|
|
26
|
+
return undefined;
|
|
27
|
+
const ruleId = current?.ruleId ?? `rule-${fnv1a(pattern.condition)}`;
|
|
28
|
+
const fromVersion = current?.fromVersion ?? '1.0.0';
|
|
29
|
+
return {
|
|
30
|
+
ruleId,
|
|
31
|
+
fromVersion,
|
|
32
|
+
toVersion: nextMinor(fromVersion),
|
|
33
|
+
change: pattern.strategy,
|
|
34
|
+
rationale: `${pattern.outcome};溯源轨迹 ${pattern.supportingTraces.length} 条,置信 ${pattern.confidence}(达演化门禁,待治理中心审核)`,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** 产出程序记忆写入请求(治理审核通过后提交)。 */
|
|
38
|
+
toWriteRequest(proposal) {
|
|
39
|
+
return {
|
|
40
|
+
layer: 'procedural',
|
|
41
|
+
payload: proposal,
|
|
42
|
+
salience: 0.7, // TODO(infra): 由 write-policy.salience-scorer 计算
|
|
43
|
+
provenance: { agent: 'learning-engine', traceId: proposal.ruleId, ts: Date.now() },
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** FNV-1a 32 位摘要(确定性规则 ID)。 */
|
|
48
|
+
function fnv1a(input) {
|
|
49
|
+
let h = 0x811c9dc5;
|
|
50
|
+
for (let i = 0; i < input.length; i += 1) {
|
|
51
|
+
h ^= input.charCodeAt(i);
|
|
52
|
+
h = Math.imul(h, 0x01000193);
|
|
53
|
+
}
|
|
54
|
+
return (h >>> 0).toString(16).padStart(8, '0');
|
|
55
|
+
}
|
|
56
|
+
/** minor +1(与 skill-versioner.nextVersion 默认档对齐)。 */
|
|
57
|
+
function nextMinor(version) {
|
|
58
|
+
const parts = version.split('.').map((p) => Number.parseInt(p, 10) || 0);
|
|
59
|
+
return `${parts[0] ?? 1}.${(parts[1] ?? 0) + 1}.0`;
|
|
60
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 语义差异(semantic-diff)——「学」支柱 knowledge-update 子模块。
|
|
3
|
+
* 职责:检测新知识与既有**语义记忆**的冲突 / 过时。
|
|
4
|
+
* 边界:只检测与上报;冲突修复归 stability-guard 回归与自愈中心。
|
|
5
|
+
*
|
|
6
|
+
* v2.5.0(Phase E)转实——确定性键值冲突检测(可审计、可回归):
|
|
7
|
+
* - 事实格式约定 `subject|attribute|value`(无分隔符则整句归一化后为键、空值);
|
|
8
|
+
* - 同键同值 → 一致(无差异);同键异值:
|
|
9
|
+
* · incoming 值**包含**既有值(细化/补充表述)→ 'superseded'(旧表述被更完整版取代);
|
|
10
|
+
* · 否则 → 'contradiction'(直接矛盾,severity high,repairable 交自愈中心);
|
|
11
|
+
* - 全新键(既有记忆无此键)→ 无冲突,不属于差异检测范围;
|
|
12
|
+
* - 比较前做归一化(trim + 折叠连续空白 + 转小写),保证判定稳定。
|
|
13
|
+
* TODO(infra): 基于语义图谱(semantic-graph)嵌入比对 + 双时态时间戳判定 'stale'。
|
|
14
|
+
*/
|
|
15
|
+
import type { ConsistencyIssue } from '../../../vendor/memory-framework/index.js';
|
|
16
|
+
/** 语义冲突类型。 */
|
|
17
|
+
export type SemanticConflictKind = 'contradiction' | 'stale' | 'superseded';
|
|
18
|
+
/** 语义差异条目。 */
|
|
19
|
+
export interface SemanticDiff {
|
|
20
|
+
readonly kind: SemanticConflictKind;
|
|
21
|
+
/** 既有事实。 */
|
|
22
|
+
readonly existing: string;
|
|
23
|
+
/** 新进入事实。 */
|
|
24
|
+
readonly incoming: string;
|
|
25
|
+
/** 关联的跨层一致性问题(复用记忆框架类型,供自愈中心修复)。 */
|
|
26
|
+
readonly issue?: ConsistencyIssue;
|
|
27
|
+
}
|
|
28
|
+
/** 语义差异检测器。 */
|
|
29
|
+
export declare class SemanticDiffDetector {
|
|
30
|
+
/** 比对既有事实与新事实,产出差异条目(顺序与 incoming 一致,确定性输出)。 */
|
|
31
|
+
diff(existingFacts: readonly string[], incomingFacts: readonly string[]): readonly SemanticDiff[];
|
|
32
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 语义差异(semantic-diff)——「学」支柱 knowledge-update 子模块。
|
|
3
|
+
* 职责:检测新知识与既有**语义记忆**的冲突 / 过时。
|
|
4
|
+
* 边界:只检测与上报;冲突修复归 stability-guard 回归与自愈中心。
|
|
5
|
+
*
|
|
6
|
+
* v2.5.0(Phase E)转实——确定性键值冲突检测(可审计、可回归):
|
|
7
|
+
* - 事实格式约定 `subject|attribute|value`(无分隔符则整句归一化后为键、空值);
|
|
8
|
+
* - 同键同值 → 一致(无差异);同键异值:
|
|
9
|
+
* · incoming 值**包含**既有值(细化/补充表述)→ 'superseded'(旧表述被更完整版取代);
|
|
10
|
+
* · 否则 → 'contradiction'(直接矛盾,severity high,repairable 交自愈中心);
|
|
11
|
+
* - 全新键(既有记忆无此键)→ 无冲突,不属于差异检测范围;
|
|
12
|
+
* - 比较前做归一化(trim + 折叠连续空白 + 转小写),保证判定稳定。
|
|
13
|
+
* TODO(infra): 基于语义图谱(semantic-graph)嵌入比对 + 双时态时间戳判定 'stale'。
|
|
14
|
+
*/
|
|
15
|
+
/** 语义差异检测器。 */
|
|
16
|
+
export class SemanticDiffDetector {
|
|
17
|
+
/** 比对既有事实与新事实,产出差异条目(顺序与 incoming 一致,确定性输出)。 */
|
|
18
|
+
diff(existingFacts, incomingFacts) {
|
|
19
|
+
// 索引既有事实:归一化键 → [(原始事实, 归一化值)]
|
|
20
|
+
const index = new Map();
|
|
21
|
+
for (const fact of existingFacts) {
|
|
22
|
+
const p = parseFact(fact);
|
|
23
|
+
const bucket = index.get(p.key) ?? [];
|
|
24
|
+
bucket.push({ fact, value: p.value });
|
|
25
|
+
index.set(p.key, bucket);
|
|
26
|
+
}
|
|
27
|
+
const diffs = [];
|
|
28
|
+
for (const incoming of incomingFacts) {
|
|
29
|
+
const p = parseFact(incoming);
|
|
30
|
+
const matches = index.get(p.key);
|
|
31
|
+
if (!matches || matches.length === 0)
|
|
32
|
+
continue; // 全新事实,无冲突
|
|
33
|
+
const first = matches[0];
|
|
34
|
+
if (first.value === p.value)
|
|
35
|
+
continue; // 同键同值,一致
|
|
36
|
+
const isSupersede = first.value.length > 0 && p.value.includes(first.value);
|
|
37
|
+
diffs.push({
|
|
38
|
+
kind: isSupersede ? 'superseded' : 'contradiction',
|
|
39
|
+
existing: first.fact,
|
|
40
|
+
incoming,
|
|
41
|
+
issue: {
|
|
42
|
+
kind: 'conflict',
|
|
43
|
+
layer: 'semantic',
|
|
44
|
+
id: p.key,
|
|
45
|
+
detail: isSupersede
|
|
46
|
+
? `语义键「${p.key}」出现更完整表述,旧事实被取代:「${first.value}」→「${p.value}」`
|
|
47
|
+
: `语义冲突:键「${p.key}」既有「${first.value}」与新至「${p.value}」矛盾`,
|
|
48
|
+
severity: isSupersede ? 'med' : 'high',
|
|
49
|
+
repairable: true,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
matches.shift(); // 每条既有事实至多被报告一次,保证幂等
|
|
53
|
+
}
|
|
54
|
+
return diffs;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/** 解析事实文本:`subject|attribute|value`;无分隔符时整句为键、值为空。 */
|
|
58
|
+
function parseFact(fact) {
|
|
59
|
+
const parts = fact.split('|');
|
|
60
|
+
if (parts.length < 3) {
|
|
61
|
+
return { key: normalize(fact), value: '' };
|
|
62
|
+
}
|
|
63
|
+
const value = parts.slice(2).join('|'); // 值本身可含 '|'
|
|
64
|
+
return { key: `${normalize(parts[0])}|${normalize(parts[1])}`, value: normalize(value) };
|
|
65
|
+
}
|
|
66
|
+
/** 归一化:trim + 折叠连续空白 + 转小写(保证判定确定性)。 */
|
|
67
|
+
function normalize(s) {
|
|
68
|
+
return s.trim().replace(/\s+/g, ' ').toLowerCase();
|
|
69
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 经验回流闭环管道(learning-loop)——「学」支柱主回路门面(Phase C)。
|
|
3
|
+
*
|
|
4
|
+
* 首条学习回路(§5.3 / §6.4 Phase C):
|
|
5
|
+
* verification-gateway 有效裁定(goldenPass 可靠标签)
|
|
6
|
+
* → TrajectoryCollector 采集 → OutcomeLabeler 标注
|
|
7
|
+
* → PatternExtractor 提炼「条件X→策略Y→结果Z」
|
|
8
|
+
* → SkillVersioner 固化为版本化技能(高频成功模式 → 技能)
|
|
9
|
+
* → RegressionTester 回归门禁(零新增退化才放行)
|
|
10
|
+
* → LearningRollbackController 回滚(失败学习不污染技能库)。
|
|
11
|
+
*
|
|
12
|
+
* 红线(「稳定性—可塑性」约束,§5.3):
|
|
13
|
+
* 未经回归门禁的技能不得 active;回归失败必须回滚至上一版本。
|
|
14
|
+
*
|
|
15
|
+
* TODO(infra): 接入 knowledge-update(语义更新);固化落位钩子(onPromoted,P8 收尾 a)
|
|
16
|
+
* 已开——procedural-memory SkillRegistry 注册由装配层适配完成。
|
|
17
|
+
*/
|
|
18
|
+
import { OutcomeLabeler, type LabeledTrajectory } from './experience-reflow/outcome-labeler.js';
|
|
19
|
+
import { PatternExtractor } from './experience-reflow/pattern-extractor.js';
|
|
20
|
+
import { TrajectoryCollector, type TrajectoryEvent } from './experience-reflow/trajectory-collector.js';
|
|
21
|
+
import { SkillVersioner } from './skill-consolidation/skill-versioner.js';
|
|
22
|
+
import { RegressionTester, type CaseEvaluator, type RegressionTestCase } from './stability-guard/regression-tester.js';
|
|
23
|
+
import { LearningRollbackController } from './stability-guard/rollback-controller.js';
|
|
24
|
+
import type { PatternTriplet, RegressionResult, SkillDefinition } from './types.js';
|
|
25
|
+
/** 回流输入:总线轨迹事件 + 该链路的外验标签信号(来自 verification-gateway 裁定)。 */
|
|
26
|
+
export interface ReflowItem {
|
|
27
|
+
readonly event: TrajectoryEvent;
|
|
28
|
+
/** 有效裁定是否证实(宗师质量判定 / gateway.effective.verified;最可靠标签)。 */
|
|
29
|
+
readonly goldenPass?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** 单周期学习报告(可审计)。 */
|
|
32
|
+
export interface CycleReport {
|
|
33
|
+
/** 本周期标注结果。 */
|
|
34
|
+
readonly labeled: readonly LabeledTrajectory[];
|
|
35
|
+
/** 提炼出的模式(置信度降序)。 */
|
|
36
|
+
readonly patterns: readonly PatternTriplet[];
|
|
37
|
+
/** 固化 / 升级的技能。 */
|
|
38
|
+
readonly promoted: readonly SkillDefinition[];
|
|
39
|
+
/** 被回归门禁打回并回滚的技能。 */
|
|
40
|
+
readonly rolledBack: readonly {
|
|
41
|
+
readonly skillId: string;
|
|
42
|
+
readonly version: string;
|
|
43
|
+
readonly restored?: string;
|
|
44
|
+
}[];
|
|
45
|
+
/** 回归结果明细。 */
|
|
46
|
+
readonly regressions: readonly RegressionResult[];
|
|
47
|
+
}
|
|
48
|
+
/** 管道选项。 */
|
|
49
|
+
export interface LearningLoopOptions {
|
|
50
|
+
readonly labeler?: OutcomeLabeler;
|
|
51
|
+
readonly extractor?: PatternExtractor;
|
|
52
|
+
readonly versioner?: SkillVersioner;
|
|
53
|
+
readonly regressionTester?: RegressionTester;
|
|
54
|
+
readonly rollback?: LearningRollbackController;
|
|
55
|
+
/** 回归用例与评估器(提供即启用回归门禁;缺省跳过门禁仅用于脚手架期)。 */
|
|
56
|
+
readonly regressionCases?: readonly RegressionTestCase[];
|
|
57
|
+
readonly evaluate?: CaseEvaluator;
|
|
58
|
+
/** 每周期最多固化技能数(预算约束,默认 5)。 */
|
|
59
|
+
readonly maxPromotionsPerCycle?: number;
|
|
60
|
+
/**
|
|
61
|
+
* 自愈联动钩子(infra-4):回归失败触发技能回滚时回调,
|
|
62
|
+
* 由部署侧委托 07-自愈中心 RollbackController 记账(RTO ≤ 600s,§5.5)。
|
|
63
|
+
* 学习侧不直接依赖「愈」实现,仅以结构化事件解耦(05→07 单向依赖由装配层完成)。
|
|
64
|
+
*/
|
|
65
|
+
readonly healingRollback?: HealingRollbackHook;
|
|
66
|
+
/**
|
|
67
|
+
* 周期观测钩子(v2.7.0 埋点):runCycle 结束后回调完整报告,
|
|
68
|
+
* 由装配层上报指标(promoted / rolledBack / 回归失败用例数)。只读观测,不影响学习决策。
|
|
69
|
+
*/
|
|
70
|
+
readonly onCycle?: (report: CycleReport) => void;
|
|
71
|
+
/**
|
|
72
|
+
* 固化落位钩子(P8 收尾 a):本周期实际晋升(过回归门禁、已写库)的技能回调——
|
|
73
|
+
* 由装配层适配注入 procedural-memory SkillRegistry(merger→registry 装配位)。
|
|
74
|
+
* 只在 store 写入成功后触发;回滚技能不在列。
|
|
75
|
+
*/
|
|
76
|
+
readonly onPromoted?: (promoted: readonly SkillDefinition[]) => void;
|
|
77
|
+
/**
|
|
78
|
+
* 统一 id 解析钩子(P3-T3):把固化模式映射到统一命名空间 logicalId
|
|
79
|
+
* (如 `learned.qianhang.intent-detection`,见 skill-consolidation/skill-id.ts)。
|
|
80
|
+
* 缺省不设置——技能仅携带 FNV 内部主键,读取侧按归并规则查询。
|
|
81
|
+
*/
|
|
82
|
+
readonly logicalIdResolver?: (pattern: PatternTriplet) => string | undefined;
|
|
83
|
+
}
|
|
84
|
+
/** 自愈回滚事件(回归失败 → 技能回滚,供 07-自愈中心记账)。 */
|
|
85
|
+
export interface HealingRollbackEvent {
|
|
86
|
+
readonly skillId: string;
|
|
87
|
+
readonly version: string;
|
|
88
|
+
readonly restored?: string;
|
|
89
|
+
/** 确定性故障 id(可溯源到具体回归周期)。 */
|
|
90
|
+
readonly faultId: string;
|
|
91
|
+
}
|
|
92
|
+
/** 自愈回滚钩子签名。 */
|
|
93
|
+
export type HealingRollbackHook = (event: HealingRollbackEvent) => void;
|
|
94
|
+
/** 技能库端口(内存实现;生产对接 procedural-memory 落盘)。 */
|
|
95
|
+
export interface SkillStorePort {
|
|
96
|
+
historyOf(skillId: string): readonly SkillDefinition[];
|
|
97
|
+
replaceHistory(skillId: string, history: readonly SkillDefinition[]): void;
|
|
98
|
+
activeSkills(): readonly SkillDefinition[];
|
|
99
|
+
}
|
|
100
|
+
/** 内存技能库。 */
|
|
101
|
+
export declare class InMemorySkillStore implements SkillStorePort {
|
|
102
|
+
private readonly store;
|
|
103
|
+
historyOf(skillId: string): readonly SkillDefinition[];
|
|
104
|
+
replaceHistory(skillId: string, history: readonly SkillDefinition[]): void;
|
|
105
|
+
activeSkills(): readonly SkillDefinition[];
|
|
106
|
+
}
|
|
107
|
+
/** 经验回流闭环管道。 */
|
|
108
|
+
export declare class LearningLoop {
|
|
109
|
+
private readonly collector;
|
|
110
|
+
private readonly labeler;
|
|
111
|
+
private readonly extractor;
|
|
112
|
+
private readonly versioner;
|
|
113
|
+
private readonly regressionTester;
|
|
114
|
+
private readonly rollback;
|
|
115
|
+
private readonly regressionCases?;
|
|
116
|
+
private readonly evaluate?;
|
|
117
|
+
private readonly maxPromotions;
|
|
118
|
+
private readonly healingRollback?;
|
|
119
|
+
private readonly onCycle?;
|
|
120
|
+
private readonly onPromoted?;
|
|
121
|
+
private readonly store;
|
|
122
|
+
private readonly logicalIdResolver?;
|
|
123
|
+
/** traceId → 标签信号(ingest 时登记,runCycle 时消费)。 */
|
|
124
|
+
private readonly pendingSignals;
|
|
125
|
+
constructor(store?: SkillStorePort, options?: LearningLoopOptions);
|
|
126
|
+
/** 暴露子组件(供观测与测试)。 */
|
|
127
|
+
get components(): {
|
|
128
|
+
readonly collector: TrajectoryCollector;
|
|
129
|
+
readonly labeler: OutcomeLabeler;
|
|
130
|
+
readonly extractor: PatternExtractor;
|
|
131
|
+
readonly store: SkillStorePort;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* 登记外验标签信号(只登记不采集;v2.6.0 装配指导方案 A)。
|
|
135
|
+
* 事件唯一入口为 TrajectoryBridge(总线→轨迹),本方法仅登记 verification-gateway
|
|
136
|
+
* 的裁定结论(goldenPass),与已采轨迹按 traceId 关联——避免 ingest 双采同一事件。
|
|
137
|
+
*/
|
|
138
|
+
signal(traceId: string, goldenPass: boolean): void;
|
|
139
|
+
/** 登记回流输入(只采集不学习;学习由 runCycle 显式触发,保证批处理边界清晰)。 */
|
|
140
|
+
ingest(items: readonly ReflowItem[]): void;
|
|
141
|
+
/** 执行一个学习周期:标注 → 提炼 → 固化 → 回归门禁 → 回滚。 */
|
|
142
|
+
runCycle(extractOptions?: {
|
|
143
|
+
minSamples?: number;
|
|
144
|
+
minSuccessRate?: number;
|
|
145
|
+
}): CycleReport;
|
|
146
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 经验回流闭环管道(learning-loop)——「学」支柱主回路门面(Phase C)。
|
|
3
|
+
*
|
|
4
|
+
* 首条学习回路(§5.3 / §6.4 Phase C):
|
|
5
|
+
* verification-gateway 有效裁定(goldenPass 可靠标签)
|
|
6
|
+
* → TrajectoryCollector 采集 → OutcomeLabeler 标注
|
|
7
|
+
* → PatternExtractor 提炼「条件X→策略Y→结果Z」
|
|
8
|
+
* → SkillVersioner 固化为版本化技能(高频成功模式 → 技能)
|
|
9
|
+
* → RegressionTester 回归门禁(零新增退化才放行)
|
|
10
|
+
* → LearningRollbackController 回滚(失败学习不污染技能库)。
|
|
11
|
+
*
|
|
12
|
+
* 红线(「稳定性—可塑性」约束,§5.3):
|
|
13
|
+
* 未经回归门禁的技能不得 active;回归失败必须回滚至上一版本。
|
|
14
|
+
*
|
|
15
|
+
* TODO(infra): 接入 knowledge-update(语义更新);固化落位钩子(onPromoted,P8 收尾 a)
|
|
16
|
+
* 已开——procedural-memory SkillRegistry 注册由装配层适配完成。
|
|
17
|
+
*/
|
|
18
|
+
import { OutcomeLabeler } from './experience-reflow/outcome-labeler.js';
|
|
19
|
+
import { PatternExtractor } from './experience-reflow/pattern-extractor.js';
|
|
20
|
+
import { TrajectoryCollector } from './experience-reflow/trajectory-collector.js';
|
|
21
|
+
import { SkillVersioner } from './skill-consolidation/skill-versioner.js';
|
|
22
|
+
import { RegressionTester } from './stability-guard/regression-tester.js';
|
|
23
|
+
import { LearningRollbackController } from './stability-guard/rollback-controller.js';
|
|
24
|
+
/** 内存技能库。 */
|
|
25
|
+
export class InMemorySkillStore {
|
|
26
|
+
store = new Map();
|
|
27
|
+
historyOf(skillId) {
|
|
28
|
+
return this.store.get(skillId) ?? [];
|
|
29
|
+
}
|
|
30
|
+
replaceHistory(skillId, history) {
|
|
31
|
+
this.store.set(skillId, [...history]);
|
|
32
|
+
}
|
|
33
|
+
activeSkills() {
|
|
34
|
+
const out = [];
|
|
35
|
+
for (const hist of this.store.values()) {
|
|
36
|
+
for (const s of hist)
|
|
37
|
+
if (s.status === 'active')
|
|
38
|
+
out.push(s);
|
|
39
|
+
}
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** 经验回流闭环管道。 */
|
|
44
|
+
export class LearningLoop {
|
|
45
|
+
collector = new TrajectoryCollector();
|
|
46
|
+
labeler;
|
|
47
|
+
extractor;
|
|
48
|
+
versioner;
|
|
49
|
+
regressionTester;
|
|
50
|
+
rollback;
|
|
51
|
+
regressionCases;
|
|
52
|
+
evaluate;
|
|
53
|
+
maxPromotions;
|
|
54
|
+
healingRollback;
|
|
55
|
+
onCycle;
|
|
56
|
+
onPromoted;
|
|
57
|
+
store;
|
|
58
|
+
logicalIdResolver;
|
|
59
|
+
/** traceId → 标签信号(ingest 时登记,runCycle 时消费)。 */
|
|
60
|
+
pendingSignals = new Map();
|
|
61
|
+
constructor(store, options = {}) {
|
|
62
|
+
this.labeler = options.labeler ?? new OutcomeLabeler();
|
|
63
|
+
this.extractor = options.extractor ?? new PatternExtractor();
|
|
64
|
+
this.versioner = options.versioner ?? new SkillVersioner();
|
|
65
|
+
this.regressionTester = options.regressionTester ?? new RegressionTester();
|
|
66
|
+
this.rollback = options.rollback ?? new LearningRollbackController();
|
|
67
|
+
this.regressionCases = options.regressionCases;
|
|
68
|
+
this.evaluate = options.evaluate;
|
|
69
|
+
this.maxPromotions = options.maxPromotionsPerCycle ?? 5;
|
|
70
|
+
this.healingRollback = options.healingRollback;
|
|
71
|
+
this.onCycle = options.onCycle;
|
|
72
|
+
this.onPromoted = options.onPromoted;
|
|
73
|
+
this.store = store ?? new InMemorySkillStore();
|
|
74
|
+
this.logicalIdResolver = options.logicalIdResolver;
|
|
75
|
+
}
|
|
76
|
+
/** 暴露子组件(供观测与测试)。 */
|
|
77
|
+
get components() {
|
|
78
|
+
return { collector: this.collector, labeler: this.labeler, extractor: this.extractor, store: this.store };
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* 登记外验标签信号(只登记不采集;v2.6.0 装配指导方案 A)。
|
|
82
|
+
* 事件唯一入口为 TrajectoryBridge(总线→轨迹),本方法仅登记 verification-gateway
|
|
83
|
+
* 的裁定结论(goldenPass),与已采轨迹按 traceId 关联——避免 ingest 双采同一事件。
|
|
84
|
+
*/
|
|
85
|
+
signal(traceId, goldenPass) {
|
|
86
|
+
this.pendingSignals.set(traceId, { goldenPass });
|
|
87
|
+
}
|
|
88
|
+
/** 登记回流输入(只采集不学习;学习由 runCycle 显式触发,保证批处理边界清晰)。 */
|
|
89
|
+
ingest(items) {
|
|
90
|
+
for (const item of items) {
|
|
91
|
+
this.collector.collect(item.event);
|
|
92
|
+
if (item.goldenPass !== undefined) {
|
|
93
|
+
this.pendingSignals.set(item.event.traceId, { goldenPass: item.goldenPass });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/** 执行一个学习周期:标注 → 提炼 → 固化 → 回归门禁 → 回滚。 */
|
|
98
|
+
runCycle(extractOptions) {
|
|
99
|
+
const trajectories = this.collector.drain();
|
|
100
|
+
const labeled = trajectories.map((t) => this.labeler.label(t, this.pendingSignals.get(t.traceId) ?? {}));
|
|
101
|
+
this.pendingSignals.clear();
|
|
102
|
+
const patterns = this.extractor.extractWith(labeled, extractOptions ?? {});
|
|
103
|
+
const promoted = [];
|
|
104
|
+
const rolledBack = [];
|
|
105
|
+
const regressions = [];
|
|
106
|
+
// 预算约束:每周期最多固化 maxPromotions 个技能
|
|
107
|
+
for (const pattern of patterns.slice(0, this.maxPromotions)) {
|
|
108
|
+
const skillId = skillIdOf(pattern);
|
|
109
|
+
const history = [...this.store.historyOf(skillId)];
|
|
110
|
+
const currentActive = history.find((s) => s.status === 'active');
|
|
111
|
+
const version = currentActive
|
|
112
|
+
? this.versioner.nextVersion(currentActive.version)
|
|
113
|
+
: '1.0.0';
|
|
114
|
+
const skill = {
|
|
115
|
+
id: skillId,
|
|
116
|
+
logicalId: this.logicalIdResolver?.(pattern),
|
|
117
|
+
name: `${pattern.condition} 最佳实践`,
|
|
118
|
+
version,
|
|
119
|
+
description: pattern.outcome,
|
|
120
|
+
when: [pattern.condition],
|
|
121
|
+
steps: pattern.strategy.split('→'),
|
|
122
|
+
sourcePattern: pattern,
|
|
123
|
+
status: 'active',
|
|
124
|
+
createdAt: Date.now(),
|
|
125
|
+
useCount: 0,
|
|
126
|
+
};
|
|
127
|
+
// 版本共存:旧 active 降级为 deprecated
|
|
128
|
+
const nextHistory = history.map((s) => s.status === 'active' ? { ...s, status: 'deprecated' } : s);
|
|
129
|
+
nextHistory.push(skill);
|
|
130
|
+
// 回归门禁(§5.3 稳定性—可塑性红线)
|
|
131
|
+
if (this.regressionCases && this.evaluate) {
|
|
132
|
+
const result = this.regressionTester.run(skillId, version, this.regressionCases, this.evaluate);
|
|
133
|
+
regressions.push(result);
|
|
134
|
+
if (!result.passed) {
|
|
135
|
+
const outcome = this.rollback.rollback(nextHistory);
|
|
136
|
+
this.store.replaceHistory(skillId, outcome.history);
|
|
137
|
+
rolledBack.push({
|
|
138
|
+
skillId,
|
|
139
|
+
version,
|
|
140
|
+
restored: outcome.restored?.version,
|
|
141
|
+
});
|
|
142
|
+
// infra-4:委托「愈」侧记账(RTO/RPO 审计),学习侧保持零硬依赖
|
|
143
|
+
this.healingRollback?.({
|
|
144
|
+
skillId,
|
|
145
|
+
version,
|
|
146
|
+
restored: outcome.restored?.version,
|
|
147
|
+
faultId: `learning-rollback-${skillId}-${version}`,
|
|
148
|
+
});
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
this.store.replaceHistory(skillId, nextHistory);
|
|
153
|
+
promoted.push(skill);
|
|
154
|
+
}
|
|
155
|
+
const report = { labeled, patterns, promoted, rolledBack, regressions };
|
|
156
|
+
if (promoted.length > 0)
|
|
157
|
+
this.onPromoted?.(promoted);
|
|
158
|
+
this.onCycle?.(report);
|
|
159
|
+
return report;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/** 确定性技能 ID:condition|strategy 的 FNV-1a 摘要(同簇同 ID,跨周期可升级)。 */
|
|
163
|
+
function skillIdOf(pattern) {
|
|
164
|
+
const input = `${pattern.condition}|${pattern.strategy}`;
|
|
165
|
+
let h = 0x811c9dc5;
|
|
166
|
+
for (let i = 0; i < input.length; i += 1) {
|
|
167
|
+
h ^= input.charCodeAt(i);
|
|
168
|
+
h = Math.imul(h, 0x01000193);
|
|
169
|
+
}
|
|
170
|
+
return `skill-${(h >>> 0).toString(16).padStart(8, '0')}`;
|
|
171
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 学习资源配额(budget-allocator)——「学」支柱 learning-scheduler 子模块。
|
|
3
|
+
* 职责:为学习任务分配 LLM token / 调用次数配额,防止学习挤占在线推理资源。
|
|
4
|
+
* 语义(M23 由桩转实):
|
|
5
|
+
* - allocate(task):按「剩余配额 ∧ 任务申请」授予(token 与调用数分别取 min);
|
|
6
|
+
* 授予即从剩余中预扣(未消耗部分由消费方 release 归还);
|
|
7
|
+
* - 任一维度剩余为 0 → 授予零配额(调用方应入队等待,超额任务降级异步);
|
|
8
|
+
* - release(budget):未消耗部分归还剩余(如执行失败提前退出)。
|
|
9
|
+
* 边界:只分配配额;排队归 priority-queue;不做时钟/重试。
|
|
10
|
+
*/
|
|
11
|
+
import type { LearningBudget, LearningTask } from '../types.js';
|
|
12
|
+
/** 零配额(等待信号:任一维度为 0 即视为未获资源)。 */
|
|
13
|
+
export declare const ZERO_BUDGET: LearningBudget;
|
|
14
|
+
/** 学习资源配额分配器(剩余配额记账 + 授予预扣 + 归还)。 */
|
|
15
|
+
export declare class BudgetAllocator {
|
|
16
|
+
private remaining;
|
|
17
|
+
constructor(total: LearningBudget);
|
|
18
|
+
/** 剩余配额快照。 */
|
|
19
|
+
get available(): LearningBudget;
|
|
20
|
+
/** 是否已耗尽(任一维度为 0)。 */
|
|
21
|
+
get exhausted(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 按剩余配额为任务授予资源:token 与调用数分别取 min(申请,剩余),授予即预扣。
|
|
24
|
+
* 耗尽或申请非法 → 零配额(不入账);高优先级不越权(先到先得 + 调用方排队策略)。
|
|
25
|
+
*/
|
|
26
|
+
allocate(task: LearningTask): LearningBudget;
|
|
27
|
+
/** 归还未消耗配额(执行失败 / 提前退出;负数部分按 0 计)。 */
|
|
28
|
+
release(unused: LearningBudget): void;
|
|
29
|
+
}
|