@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,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 写入策略(write-policy)——「知」支柱的"决策进程"(生命周期表中间件)。
|
|
3
|
+
* 生命周期:—(决策进程)|存储介质:内存|写入触发:持续运行。
|
|
4
|
+
*
|
|
5
|
+
* 组合:salience-scorer(评分)+ consolidation(巩固)+ forgetting-policy(遗忘)。
|
|
6
|
+
*/
|
|
7
|
+
import { Consolidation } from './consolidation.js';
|
|
8
|
+
import { ForgettingPolicyEngine } from './forgetting-policy.js';
|
|
9
|
+
import { SalienceScorer } from './salience-scorer.js';
|
|
10
|
+
export { Consolidation } from './consolidation.js';
|
|
11
|
+
export { ForgettingPolicyEngine } from './forgetting-policy.js';
|
|
12
|
+
export { SalienceScorer } from './salience-scorer.js';
|
|
13
|
+
/**
|
|
14
|
+
* 写入策略。
|
|
15
|
+
* 流程:显著度评分 → 阈值裁决(是否写入)→(异步)巩固/遗忘。
|
|
16
|
+
*/
|
|
17
|
+
export class WritePolicy {
|
|
18
|
+
scorer;
|
|
19
|
+
consolidation;
|
|
20
|
+
forgetting;
|
|
21
|
+
acceptThreshold;
|
|
22
|
+
constructor(scorer = new SalienceScorer(), consolidation = new Consolidation(), forgetting = new ForgettingPolicyEngine(), acceptThreshold = 0.35) {
|
|
23
|
+
this.scorer = scorer;
|
|
24
|
+
this.consolidation = consolidation;
|
|
25
|
+
this.forgetting = forgetting;
|
|
26
|
+
this.acceptThreshold = acceptThreshold;
|
|
27
|
+
}
|
|
28
|
+
/** 对写入请求做显著度评分与接收裁决。 */
|
|
29
|
+
evaluate(req, novelty = 0.5) {
|
|
30
|
+
const scored = this.scorer.score({
|
|
31
|
+
layer: req.layer,
|
|
32
|
+
payload: req.payload,
|
|
33
|
+
sourceJudgment: req.sourceJudgment,
|
|
34
|
+
novelty,
|
|
35
|
+
});
|
|
36
|
+
if (scored.salience < this.acceptThreshold) {
|
|
37
|
+
return {
|
|
38
|
+
accepted: false,
|
|
39
|
+
salience: scored.salience,
|
|
40
|
+
layer: req.layer,
|
|
41
|
+
reason: `salience ${scored.salience.toFixed(2)} < threshold ${this.acceptThreshold}`,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return { accepted: true, salience: scored.salience, layer: req.layer };
|
|
45
|
+
}
|
|
46
|
+
/** 暴露巩固器供编排器在任务结束时调用。 */
|
|
47
|
+
planConsolidation(candidates) {
|
|
48
|
+
return this.consolidation.plan(candidates);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 信息显著性评分(salience-scorer)——「知」支柱 write-policy 子模块。
|
|
3
|
+
* 职责:对候选写入内容打分(0–1),决定"写什么"。
|
|
4
|
+
* 关键:低置信但成功的轨迹(sourceJudgment.confidence 低 + 任务成功)=高价值学习素材。
|
|
5
|
+
*
|
|
6
|
+
* TODO(infra): 以学习引擎回流样本替换启发式权重。
|
|
7
|
+
*/
|
|
8
|
+
import type { JudgmentSignal } from '../../self-judge-kit/index.js';
|
|
9
|
+
import type { TaskType, WritableMemoryLayer } from '../types.js';
|
|
10
|
+
/** 显著度评分输入。 */
|
|
11
|
+
export interface SalienceInput {
|
|
12
|
+
readonly layer: WritableMemoryLayer;
|
|
13
|
+
readonly payload: unknown;
|
|
14
|
+
readonly sourceJudgment?: JudgmentSignal;
|
|
15
|
+
/** 新颖度 0–1(与既有记忆的差异度)。 */
|
|
16
|
+
readonly novelty?: number;
|
|
17
|
+
readonly taskType?: TaskType;
|
|
18
|
+
}
|
|
19
|
+
/** 显著度评分结果。 */
|
|
20
|
+
export interface SalienceResult {
|
|
21
|
+
/** 最终显著度 0–1。 */
|
|
22
|
+
readonly salience: number;
|
|
23
|
+
/** 各因子贡献明细(可观测)。 */
|
|
24
|
+
readonly factors: Readonly<Record<string, number>>;
|
|
25
|
+
}
|
|
26
|
+
export declare const SALIENCE_WEIGHTS: {
|
|
27
|
+
readonly novelty: 0.35;
|
|
28
|
+
readonly judgmentValue: 0.3;
|
|
29
|
+
readonly layerPrior: 0.2;
|
|
30
|
+
readonly outcome: 0.15;
|
|
31
|
+
};
|
|
32
|
+
/** 显著度评分器。 */
|
|
33
|
+
export declare class SalienceScorer {
|
|
34
|
+
score(input: SalienceInput): SalienceResult;
|
|
35
|
+
/**
|
|
36
|
+
* 判断价值:
|
|
37
|
+
* - 低置信度(< 0.6)但成功 → 高价值("差点出错但走对了"的经验)
|
|
38
|
+
* - 高置信度 → 常规价值
|
|
39
|
+
*/
|
|
40
|
+
private judgmentValue;
|
|
41
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 信息显著性评分(salience-scorer)——「知」支柱 write-policy 子模块。
|
|
3
|
+
* 职责:对候选写入内容打分(0–1),决定"写什么"。
|
|
4
|
+
* 关键:低置信但成功的轨迹(sourceJudgment.confidence 低 + 任务成功)=高价值学习素材。
|
|
5
|
+
*
|
|
6
|
+
* TODO(infra): 以学习引擎回流样本替换启发式权重。
|
|
7
|
+
*/
|
|
8
|
+
export const SALIENCE_WEIGHTS = {
|
|
9
|
+
novelty: 0.35,
|
|
10
|
+
judgmentValue: 0.3,
|
|
11
|
+
layerPrior: 0.2,
|
|
12
|
+
outcome: 0.15,
|
|
13
|
+
};
|
|
14
|
+
/** 显著度评分器。 */
|
|
15
|
+
export class SalienceScorer {
|
|
16
|
+
score(input) {
|
|
17
|
+
const novelty = clamp01(input.novelty ?? 0.5);
|
|
18
|
+
const judgmentValue = this.judgmentValue(input.sourceJudgment);
|
|
19
|
+
const layerPrior = layerPriorOf(input.layer);
|
|
20
|
+
const outcome = outcomeOf(input.sourceJudgment);
|
|
21
|
+
const salience = clamp01(SALIENCE_WEIGHTS.novelty * novelty +
|
|
22
|
+
SALIENCE_WEIGHTS.judgmentValue * judgmentValue +
|
|
23
|
+
SALIENCE_WEIGHTS.layerPrior * layerPrior +
|
|
24
|
+
SALIENCE_WEIGHTS.outcome * outcome);
|
|
25
|
+
// TODO(infra): 以学习引擎回流统计校准权重
|
|
26
|
+
return {
|
|
27
|
+
salience,
|
|
28
|
+
factors: { novelty, judgmentValue, layerPrior, outcome },
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 判断价值:
|
|
33
|
+
* - 低置信度(< 0.6)但成功 → 高价值("差点出错但走对了"的经验)
|
|
34
|
+
* - 高置信度 → 常规价值
|
|
35
|
+
*/
|
|
36
|
+
judgmentValue(j) {
|
|
37
|
+
if (!j)
|
|
38
|
+
return 0.5;
|
|
39
|
+
const lowConfidence = j.confidence < 0.6;
|
|
40
|
+
const escalated = j.escalation !== 'none';
|
|
41
|
+
if (lowConfidence && escalated)
|
|
42
|
+
return 0.95; // 低置信升级后成功的稀有样本
|
|
43
|
+
if (lowConfidence)
|
|
44
|
+
return 0.8;
|
|
45
|
+
return 0.55;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function outcomeOf(j) {
|
|
49
|
+
if (!j)
|
|
50
|
+
return 0.5;
|
|
51
|
+
// 无 deviation 视为成功;高偏离视为低价值/待复核
|
|
52
|
+
if (!j.deviation)
|
|
53
|
+
return 0.9;
|
|
54
|
+
return j.deviation.severity === 'high' ? 0.2 : j.deviation.severity === 'med' ? 0.5 : 0.8;
|
|
55
|
+
}
|
|
56
|
+
function layerPriorOf(layer) {
|
|
57
|
+
switch (layer) {
|
|
58
|
+
case 'procedural':
|
|
59
|
+
return 1;
|
|
60
|
+
case 'semantic':
|
|
61
|
+
return 0.8;
|
|
62
|
+
case 'episodic':
|
|
63
|
+
return 0.6;
|
|
64
|
+
default:
|
|
65
|
+
return 0.5;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function clamp01(v) {
|
|
69
|
+
return Math.min(1, Math.max(0, v));
|
|
70
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 假设登记(assumption-tracker)——「自」支柱子组件。
|
|
3
|
+
* 职责:**显式记录隐式假设**;异常/升级时暴露相关假设,支撑事后归因。
|
|
4
|
+
* 边界:只登记与检索假设,不做判断。
|
|
5
|
+
*
|
|
6
|
+
* TODO(infra): 假设落库到情景记忆,供学习引擎回流为"高风险假设库"。
|
|
7
|
+
*/
|
|
8
|
+
import type { Assumption } from './types.js';
|
|
9
|
+
/** 带标识的可追踪假设。 */
|
|
10
|
+
export interface TrackedAssumption extends Assumption {
|
|
11
|
+
id: string;
|
|
12
|
+
/** 登记时间。 */
|
|
13
|
+
recordedAt: number;
|
|
14
|
+
}
|
|
15
|
+
/** 假设登记器。 */
|
|
16
|
+
export declare class AssumptionTracker {
|
|
17
|
+
private readonly assumptions;
|
|
18
|
+
private seq;
|
|
19
|
+
/** 登记一条隐式假设。 */
|
|
20
|
+
record(assumption: Assumption, ts?: number): TrackedAssumption;
|
|
21
|
+
/** 批量登记。 */
|
|
22
|
+
recordAll(items: readonly Assumption[], ts?: number): readonly TrackedAssumption[];
|
|
23
|
+
/** 当前会话登记的全部假设。 */
|
|
24
|
+
all(): readonly TrackedAssumption[];
|
|
25
|
+
/**
|
|
26
|
+
* 暴露相关假设。
|
|
27
|
+
* @param onAnomaly 是否处于异常/升级态;为 true 时优先暴露高风险假设。
|
|
28
|
+
*/
|
|
29
|
+
relevant(onAnomaly: boolean): readonly TrackedAssumption[];
|
|
30
|
+
clear(): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 假设登记(assumption-tracker)——「自」支柱子组件。
|
|
3
|
+
* 职责:**显式记录隐式假设**;异常/升级时暴露相关假设,支撑事后归因。
|
|
4
|
+
* 边界:只登记与检索假设,不做判断。
|
|
5
|
+
*
|
|
6
|
+
* TODO(infra): 假设落库到情景记忆,供学习引擎回流为"高风险假设库"。
|
|
7
|
+
*/
|
|
8
|
+
/** 假设登记器。 */
|
|
9
|
+
export class AssumptionTracker {
|
|
10
|
+
assumptions = [];
|
|
11
|
+
seq = 0;
|
|
12
|
+
/** 登记一条隐式假设。 */
|
|
13
|
+
record(assumption, ts = Date.now()) {
|
|
14
|
+
this.seq += 1;
|
|
15
|
+
const tracked = {
|
|
16
|
+
...assumption,
|
|
17
|
+
id: `asm-${ts}-${this.seq}`,
|
|
18
|
+
recordedAt: ts,
|
|
19
|
+
};
|
|
20
|
+
this.assumptions.push(tracked);
|
|
21
|
+
// TODO(infra): 写入情景记忆(episodic),与 JudgmentSignal 关联
|
|
22
|
+
return tracked;
|
|
23
|
+
}
|
|
24
|
+
/** 批量登记。 */
|
|
25
|
+
recordAll(items, ts = Date.now()) {
|
|
26
|
+
return items.map((a) => this.record(a, ts));
|
|
27
|
+
}
|
|
28
|
+
/** 当前会话登记的全部假设。 */
|
|
29
|
+
all() {
|
|
30
|
+
return this.assumptions;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 暴露相关假设。
|
|
34
|
+
* @param onAnomaly 是否处于异常/升级态;为 true 时优先暴露高风险假设。
|
|
35
|
+
*/
|
|
36
|
+
relevant(onAnomaly) {
|
|
37
|
+
if (!onAnomaly)
|
|
38
|
+
return this.all();
|
|
39
|
+
const rank = { high: 0, med: 1, low: 2 };
|
|
40
|
+
return [...this.assumptions].sort((a, b) => rank[a.riskIfWrong] - rank[b.riskIfWrong]);
|
|
41
|
+
}
|
|
42
|
+
clear() {
|
|
43
|
+
this.assumptions.length = 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 置信度评分(confidence-scorer)——「自」支柱子组件。
|
|
3
|
+
* 职责:输出**结构化**置信度(含不确定性来源与替代假设)。
|
|
4
|
+
* 边界:只做打分与校准;外部真值校验归 verification-gateway。
|
|
5
|
+
*
|
|
6
|
+
* ⚠️ 红线:本组件输出必须与 ground-truth-checker 联合校准,防「进展海市蜃楼」。
|
|
7
|
+
*
|
|
8
|
+
* TODO(infra): 以温度缩放(temperature scaling)/ 保序回归做校准,
|
|
9
|
+
* 目标校准误差 < 0.15(见 §6.4 Phase B)。
|
|
10
|
+
*/
|
|
11
|
+
import type { Candidate } from './types.js';
|
|
12
|
+
/** 置信度评分输入。 */
|
|
13
|
+
export interface ConfidenceInput {
|
|
14
|
+
agent: string;
|
|
15
|
+
taskType: string;
|
|
16
|
+
candidates: Candidate[];
|
|
17
|
+
/** 已知的不确定性来源(用户输入歧义 / 数据缺失 / 上下文不足等)。 */
|
|
18
|
+
uncertaintySources?: string[];
|
|
19
|
+
/** 判断依据(供生成替代假设)。 */
|
|
20
|
+
context?: Readonly<Record<string, unknown>>;
|
|
21
|
+
}
|
|
22
|
+
/** 置信度评分结果。 */
|
|
23
|
+
export interface ConfidenceResult {
|
|
24
|
+
/** 校准后置信度 0–1。 */
|
|
25
|
+
confidence: number;
|
|
26
|
+
/** 最高候选的原始打分。 */
|
|
27
|
+
rawTop: number;
|
|
28
|
+
/** 与次高候选的间隔(margin)。 */
|
|
29
|
+
margin: number;
|
|
30
|
+
/** 不确定性来源(原样透出 + 派生)。 */
|
|
31
|
+
uncertaintySources: string[];
|
|
32
|
+
/** 替代假设(除最高候选外的候选标签)。 */
|
|
33
|
+
alternativeHypotheses: string[];
|
|
34
|
+
}
|
|
35
|
+
/** 置信度评分器。 */
|
|
36
|
+
export declare class ConfidenceScorer {
|
|
37
|
+
private readonly config;
|
|
38
|
+
constructor(config?: {
|
|
39
|
+
temperature?: number;
|
|
40
|
+
maxAlternatives?: number;
|
|
41
|
+
});
|
|
42
|
+
/** 输出结构化置信度评分。 */
|
|
43
|
+
score(input: ConfidenceInput): ConfidenceResult;
|
|
44
|
+
/** 温度缩放(桩:恒等映射,保留接口)。 */
|
|
45
|
+
private calibrate;
|
|
46
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 置信度评分(confidence-scorer)——「自」支柱子组件。
|
|
3
|
+
* 职责:输出**结构化**置信度(含不确定性来源与替代假设)。
|
|
4
|
+
* 边界:只做打分与校准;外部真值校验归 verification-gateway。
|
|
5
|
+
*
|
|
6
|
+
* ⚠️ 红线:本组件输出必须与 ground-truth-checker 联合校准,防「进展海市蜃楼」。
|
|
7
|
+
*
|
|
8
|
+
* TODO(infra): 以温度缩放(temperature scaling)/ 保序回归做校准,
|
|
9
|
+
* 目标校准误差 < 0.15(见 §6.4 Phase B)。
|
|
10
|
+
*/
|
|
11
|
+
/** 置信度评分器。 */
|
|
12
|
+
export class ConfidenceScorer {
|
|
13
|
+
config;
|
|
14
|
+
constructor(config = {}) {
|
|
15
|
+
this.config = config;
|
|
16
|
+
}
|
|
17
|
+
/** 输出结构化置信度评分。 */
|
|
18
|
+
score(input) {
|
|
19
|
+
const sorted = [...input.candidates].sort((a, b) => b.score - a.score);
|
|
20
|
+
const top = sorted[0];
|
|
21
|
+
const second = sorted[1];
|
|
22
|
+
const rawTop = top?.score ?? 0;
|
|
23
|
+
const margin = top && second ? Math.max(0, top.score - second.score) : rawTop;
|
|
24
|
+
// 基础置信度:top 打分与 margin 的加权(margin 越大越可信)
|
|
25
|
+
const base = 0.7 * rawTop + 0.3 * Math.min(1, margin / 0.3);
|
|
26
|
+
// 不确定性惩罚:来源越多,置信度越低
|
|
27
|
+
const sources = [...(input.uncertaintySources ?? [])];
|
|
28
|
+
if (sorted.length === 0)
|
|
29
|
+
sources.push('无候选结论');
|
|
30
|
+
const penalty = Math.min(0.4, sources.length * 0.08);
|
|
31
|
+
const calibrated = this.calibrate(clamp01(base - penalty));
|
|
32
|
+
return {
|
|
33
|
+
confidence: calibrated,
|
|
34
|
+
rawTop,
|
|
35
|
+
margin,
|
|
36
|
+
uncertaintySources: dedupe(sources),
|
|
37
|
+
alternativeHypotheses: sorted
|
|
38
|
+
.slice(1, 1 + (this.config.maxAlternatives ?? 3))
|
|
39
|
+
.map((c) => c.label),
|
|
40
|
+
};
|
|
41
|
+
// TODO(infra): 以真值反馈做温度缩放/保序回归,替换启发式校准
|
|
42
|
+
}
|
|
43
|
+
/** 温度缩放(桩:恒等映射,保留接口)。 */
|
|
44
|
+
calibrate(p) {
|
|
45
|
+
const t = this.config.temperature ?? 1;
|
|
46
|
+
if (t === 1)
|
|
47
|
+
return p;
|
|
48
|
+
// 简化温度缩放:logit 变换后按 T 缩放再 sigmoid
|
|
49
|
+
const eps = 1e-6;
|
|
50
|
+
const clamped = Math.min(1 - eps, Math.max(eps, p));
|
|
51
|
+
const logit = Math.log(clamped / (1 - clamped));
|
|
52
|
+
return 1 / (1 + Math.exp(-logit / t));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function clamp01(v) {
|
|
56
|
+
return Math.min(1, Math.max(0, v));
|
|
57
|
+
}
|
|
58
|
+
function dedupe(arr) {
|
|
59
|
+
return [...new Set(arr)];
|
|
60
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 偏离检测(deviation-detector)——「自」支柱子组件。
|
|
3
|
+
* 职责:运行时把**实际行为轨迹**与**程序记忆标准模式**比较,超阈值告警。
|
|
4
|
+
* 边界:只检测偏离并上报;修复归自愈中心(§5.5)。
|
|
5
|
+
*
|
|
6
|
+
* TODO(infra): 引入语义等价判定(避免措辞差异误报)+ 模式版本选择器。
|
|
7
|
+
*/
|
|
8
|
+
import type { BehaviorTrace, DeviationReport, StandardPattern } from './types.js';
|
|
9
|
+
/** 偏离阈值配置。 */
|
|
10
|
+
export interface DeviationThresholds {
|
|
11
|
+
/** 相似度低于此值 → med。 */
|
|
12
|
+
medBelow: number;
|
|
13
|
+
/** 相似度低于此值 → high。 */
|
|
14
|
+
highBelow: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const DEFAULT_DEVIATION_THRESHOLDS: DeviationThresholds;
|
|
17
|
+
/** 偏离检测器。 */
|
|
18
|
+
export declare class DeviationDetector {
|
|
19
|
+
private readonly thresholds;
|
|
20
|
+
constructor(thresholds?: DeviationThresholds);
|
|
21
|
+
/** 比较实际轨迹与标准模式;无显著偏离返回 undefined。 */
|
|
22
|
+
detect(actual: BehaviorTrace, expected: StandardPattern): DeviationReport | undefined;
|
|
23
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 偏离检测(deviation-detector)——「自」支柱子组件。
|
|
3
|
+
* 职责:运行时把**实际行为轨迹**与**程序记忆标准模式**比较,超阈值告警。
|
|
4
|
+
* 边界:只检测偏离并上报;修复归自愈中心(§5.5)。
|
|
5
|
+
*
|
|
6
|
+
* TODO(infra): 引入语义等价判定(避免措辞差异误报)+ 模式版本选择器。
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_DEVIATION_THRESHOLDS = {
|
|
9
|
+
medBelow: 0.75,
|
|
10
|
+
highBelow: 0.5,
|
|
11
|
+
};
|
|
12
|
+
/** 偏离检测器。 */
|
|
13
|
+
export class DeviationDetector {
|
|
14
|
+
thresholds;
|
|
15
|
+
constructor(thresholds = DEFAULT_DEVIATION_THRESHOLDS) {
|
|
16
|
+
this.thresholds = thresholds;
|
|
17
|
+
}
|
|
18
|
+
/** 比较实际轨迹与标准模式;无显著偏离返回 undefined。 */
|
|
19
|
+
detect(actual, expected) {
|
|
20
|
+
const sim = similarity(actual.steps, expected.steps);
|
|
21
|
+
if (sim >= this.thresholds.medBelow)
|
|
22
|
+
return undefined;
|
|
23
|
+
const severity = sim < this.thresholds.highBelow ? 'high' : 'med';
|
|
24
|
+
return {
|
|
25
|
+
severity,
|
|
26
|
+
expected: expected.steps.join(' → '),
|
|
27
|
+
actual: actual.steps.join(' → '),
|
|
28
|
+
};
|
|
29
|
+
// TODO(infra): 用语义等价 + 关键步骤对齐,替代纯序列相似度
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** 序列相似度(基于归一化编辑距离)。 */
|
|
33
|
+
function similarity(a, b) {
|
|
34
|
+
const maxLen = Math.max(a.length, b.length);
|
|
35
|
+
if (maxLen === 0)
|
|
36
|
+
return 1;
|
|
37
|
+
return 1 - levenshtein(a, b) / maxLen;
|
|
38
|
+
}
|
|
39
|
+
/** Levenshtein 距离(最小桩实现)。 */
|
|
40
|
+
function levenshtein(a, b) {
|
|
41
|
+
const m = a.length;
|
|
42
|
+
const n = b.length;
|
|
43
|
+
const dp = Array.from({ length: m + 1 }, () => new Array(n + 1).fill(0));
|
|
44
|
+
for (let i = 0; i <= m; i += 1)
|
|
45
|
+
dp[i][0] = i;
|
|
46
|
+
for (let j = 0; j <= n; j += 1)
|
|
47
|
+
dp[0][j] = j;
|
|
48
|
+
for (let i = 1; i <= m; i += 1) {
|
|
49
|
+
for (let j = 1; j <= n; j += 1) {
|
|
50
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
51
|
+
dp[i][j] = Math.min(dp[i - 1][j] + 1, dp[i][j - 1] + 1, dp[i - 1][j - 1] + cost);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return dp[m][n];
|
|
55
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 升级策略(escalation-policy)——「自」支柱**安全护栏**。
|
|
3
|
+
* 职责:confidence < τ_low 或 deviation.severity === 'high' 时**强制升级**。
|
|
4
|
+
* 升级路径:cross-validate(请语枢·万物独立分析)→ human-confirm。
|
|
5
|
+
*
|
|
6
|
+
* ⚠️ 红线:这是安全护栏,**禁止低置信度直接产出**(§5.2)。
|
|
7
|
+
*
|
|
8
|
+
* TODO(infra): 接入 verification-gateway,cross-validate 时请求外部真值校验。
|
|
9
|
+
*/
|
|
10
|
+
import { type ElevationDecision, type JudgmentConfig, type JudgmentSignal } from './types.js';
|
|
11
|
+
/** 升级策略。 */
|
|
12
|
+
export declare class EscalationPolicy {
|
|
13
|
+
private readonly config;
|
|
14
|
+
constructor(config?: JudgmentConfig);
|
|
15
|
+
/** 依据判断信号决定升级路径。 */
|
|
16
|
+
decide(signal: Pick<JudgmentSignal, 'confidence' | 'deviation'>): ElevationDecision;
|
|
17
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 升级策略(escalation-policy)——「自」支柱**安全护栏**。
|
|
3
|
+
* 职责:confidence < τ_low 或 deviation.severity === 'high' 时**强制升级**。
|
|
4
|
+
* 升级路径:cross-validate(请语枢·万物独立分析)→ human-confirm。
|
|
5
|
+
*
|
|
6
|
+
* ⚠️ 红线:这是安全护栏,**禁止低置信度直接产出**(§5.2)。
|
|
7
|
+
*
|
|
8
|
+
* TODO(infra): 接入 verification-gateway,cross-validate 时请求外部真值校验。
|
|
9
|
+
*/
|
|
10
|
+
import { DEFAULT_JUDGMENT_CONFIG } from './types.js';
|
|
11
|
+
/** 升级策略。 */
|
|
12
|
+
export class EscalationPolicy {
|
|
13
|
+
config;
|
|
14
|
+
constructor(config = DEFAULT_JUDGMENT_CONFIG) {
|
|
15
|
+
this.config = config;
|
|
16
|
+
}
|
|
17
|
+
/** 依据判断信号决定升级路径。 */
|
|
18
|
+
decide(signal) {
|
|
19
|
+
const triggeredBy = [];
|
|
20
|
+
if (signal.confidence < this.config.tauLow)
|
|
21
|
+
triggeredBy.push('low-confidence');
|
|
22
|
+
if (signal.deviation?.severity === 'high')
|
|
23
|
+
triggeredBy.push('high-deviation');
|
|
24
|
+
if (triggeredBy.length === 0) {
|
|
25
|
+
return { escalation: 'none', reason: '置信度与偏离均在阈值内', triggeredBy };
|
|
26
|
+
}
|
|
27
|
+
// 严重偏离 → 直接人工确认;仅低置信 → 交叉验证
|
|
28
|
+
const severeDeviation = signal.deviation?.severity === 'high';
|
|
29
|
+
const veryLowConfidence = signal.confidence < this.config.tauLow * 0.5;
|
|
30
|
+
if (severeDeviation || veryLowConfidence) {
|
|
31
|
+
return {
|
|
32
|
+
escalation: 'human-confirm',
|
|
33
|
+
reason: severeDeviation
|
|
34
|
+
? '检测到高严重度行为偏离,需人工确认'
|
|
35
|
+
: '置信度极低,需人工确认',
|
|
36
|
+
triggeredBy,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
escalation: 'cross-validate',
|
|
41
|
+
reason: `置信度 ${signal.confidence.toFixed(2)} < τ_low ${this.config.tauLow},请语枢·万物独立分析`,
|
|
42
|
+
triggeredBy,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================
|
|
3
|
+
* YYC³ AI Family — 自我判断套件(「自」支柱)统一入口。
|
|
4
|
+
* ------------------------------------------------------------
|
|
5
|
+
* 组合四大组件:confidence-scorer / assumption-tracker /
|
|
6
|
+
* deviation-detector / escalation-policy。
|
|
7
|
+
*
|
|
8
|
+
* ⚠️ 红线(醒目):自我判断**不得脱离外部世界状态**,
|
|
9
|
+
* 必须与 verification-gateway.ground-truth-checker 联合校准,
|
|
10
|
+
* 否则低置信度自评会被误当作"已成功",酿成「进展海市蜃楼」。
|
|
11
|
+
* ============================================================
|
|
12
|
+
*/
|
|
13
|
+
import { AssumptionTracker } from './assumption-tracker.js';
|
|
14
|
+
import { type JudgmentConfig, type JudgmentInput, type JudgmentSignal } from './types.js';
|
|
15
|
+
export * from './types.js';
|
|
16
|
+
export { ConfidenceScorer } from './confidence-scorer.js';
|
|
17
|
+
export { AssumptionTracker } from './assumption-tracker.js';
|
|
18
|
+
export { DeviationDetector, DEFAULT_DEVIATION_THRESHOLDS } from './deviation-detector.js';
|
|
19
|
+
export { EscalationPolicy } from './escalation-policy.js';
|
|
20
|
+
export type { ConfidenceInput, ConfidenceResult } from './confidence-scorer.js';
|
|
21
|
+
export type { TrackedAssumption } from './assumption-tracker.js';
|
|
22
|
+
export type { DeviationThresholds } from './deviation-detector.js';
|
|
23
|
+
/** SelfJudge 构造选项。 */
|
|
24
|
+
export interface SelfJudgeOptions {
|
|
25
|
+
config?: Partial<JudgmentConfig>;
|
|
26
|
+
/** 置信度评分器选项(温度缩放等)。 */
|
|
27
|
+
scorer?: {
|
|
28
|
+
temperature?: number;
|
|
29
|
+
maxAlternatives?: number;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 自我判断器(组合四大组件)。
|
|
34
|
+
* 暴露 `judge(input): JudgmentSignal`:一次调用产出完整结构化信号。
|
|
35
|
+
*/
|
|
36
|
+
export declare class SelfJudge {
|
|
37
|
+
private readonly scorer;
|
|
38
|
+
private readonly tracker;
|
|
39
|
+
private readonly detector;
|
|
40
|
+
private readonly policy;
|
|
41
|
+
constructor(options?: SelfJudgeOptions);
|
|
42
|
+
/** 产出自我判断信号。 */
|
|
43
|
+
judge(input: JudgmentInput): JudgmentSignal;
|
|
44
|
+
/** 暴露假设登记器(供异常归因)。 */
|
|
45
|
+
get assumptions(): AssumptionTracker;
|
|
46
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================
|
|
3
|
+
* YYC³ AI Family — 自我判断套件(「自」支柱)统一入口。
|
|
4
|
+
* ------------------------------------------------------------
|
|
5
|
+
* 组合四大组件:confidence-scorer / assumption-tracker /
|
|
6
|
+
* deviation-detector / escalation-policy。
|
|
7
|
+
*
|
|
8
|
+
* ⚠️ 红线(醒目):自我判断**不得脱离外部世界状态**,
|
|
9
|
+
* 必须与 verification-gateway.ground-truth-checker 联合校准,
|
|
10
|
+
* 否则低置信度自评会被误当作"已成功",酿成「进展海市蜃楼」。
|
|
11
|
+
* ============================================================
|
|
12
|
+
*/
|
|
13
|
+
import { AssumptionTracker } from './assumption-tracker.js';
|
|
14
|
+
import { ConfidenceScorer } from './confidence-scorer.js';
|
|
15
|
+
import { DeviationDetector } from './deviation-detector.js';
|
|
16
|
+
import { EscalationPolicy } from './escalation-policy.js';
|
|
17
|
+
import { DEFAULT_JUDGMENT_CONFIG, } from './types.js';
|
|
18
|
+
export * from './types.js';
|
|
19
|
+
export { ConfidenceScorer } from './confidence-scorer.js';
|
|
20
|
+
export { AssumptionTracker } from './assumption-tracker.js';
|
|
21
|
+
export { DeviationDetector, DEFAULT_DEVIATION_THRESHOLDS } from './deviation-detector.js';
|
|
22
|
+
export { EscalationPolicy } from './escalation-policy.js';
|
|
23
|
+
/**
|
|
24
|
+
* 自我判断器(组合四大组件)。
|
|
25
|
+
* 暴露 `judge(input): JudgmentSignal`:一次调用产出完整结构化信号。
|
|
26
|
+
*/
|
|
27
|
+
export class SelfJudge {
|
|
28
|
+
scorer;
|
|
29
|
+
tracker;
|
|
30
|
+
detector;
|
|
31
|
+
policy;
|
|
32
|
+
constructor(options = {}) {
|
|
33
|
+
const config = { ...DEFAULT_JUDGMENT_CONFIG, ...options.config };
|
|
34
|
+
this.scorer = new ConfidenceScorer(options.scorer);
|
|
35
|
+
this.tracker = new AssumptionTracker();
|
|
36
|
+
this.detector = new DeviationDetector();
|
|
37
|
+
this.policy = new EscalationPolicy(config);
|
|
38
|
+
}
|
|
39
|
+
/** 产出自我判断信号。 */
|
|
40
|
+
judge(input) {
|
|
41
|
+
const ts = Date.now();
|
|
42
|
+
// 1) 显式登记隐式假设
|
|
43
|
+
this.tracker.recordAll(input.assumptions ?? [], ts);
|
|
44
|
+
// 2) 置信度评分(结构化)
|
|
45
|
+
const scored = this.scorer.score({
|
|
46
|
+
agent: input.agent,
|
|
47
|
+
taskType: input.taskType,
|
|
48
|
+
candidates: input.candidates,
|
|
49
|
+
uncertaintySources: input.uncertaintySources,
|
|
50
|
+
});
|
|
51
|
+
// 3) 行为偏离检测
|
|
52
|
+
const deviation = input.actualBehavior && input.expectedPattern
|
|
53
|
+
? this.detector.detect(input.actualBehavior, input.expectedPattern)
|
|
54
|
+
: undefined;
|
|
55
|
+
// 4) 升级决策(安全护栏)
|
|
56
|
+
const decision = this.policy.decide({ confidence: scored.confidence, deviation });
|
|
57
|
+
// 5) 组装信号:异常时优先暴露高风险假设
|
|
58
|
+
const onAnomaly = decision.escalation !== 'none';
|
|
59
|
+
const exposedAssumptions = this.tracker.relevant(onAnomaly);
|
|
60
|
+
// TODO(infra): 与 verification-gateway.ground-truth-checker 联合校准后再返回
|
|
61
|
+
return {
|
|
62
|
+
agent: input.agent,
|
|
63
|
+
confidence: scored.confidence,
|
|
64
|
+
uncertaintySources: scored.uncertaintySources,
|
|
65
|
+
alternativeHypotheses: scored.alternativeHypotheses,
|
|
66
|
+
assumptions: exposedAssumptions.map((a) => ({
|
|
67
|
+
statement: a.statement,
|
|
68
|
+
basis: a.basis,
|
|
69
|
+
riskIfWrong: a.riskIfWrong,
|
|
70
|
+
})),
|
|
71
|
+
deviation,
|
|
72
|
+
escalation: decision.escalation,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/** 暴露假设登记器(供异常归因)。 */
|
|
76
|
+
get assumptions() {
|
|
77
|
+
return this.tracker;
|
|
78
|
+
}
|
|
79
|
+
}
|