@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,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================
|
|
3
|
+
* YYC³ AI Family — 记忆框架(「知」支柱)核心类型定义
|
|
4
|
+
* ------------------------------------------------------------
|
|
5
|
+
* 文档依据:YYC3-AI-Family-Agent-架构设计.md §5.1
|
|
6
|
+
* 边界:负责感知暂存 / 上下文窗口 / 情景轨迹 / 语义图谱 /
|
|
7
|
+
* 程序记忆 / 写入决策 / 检索编排;
|
|
8
|
+
* 不负责模型推理(llm-adapter)、业务意图(家人 core)、
|
|
9
|
+
* 安全判定(治理中心)。
|
|
10
|
+
* ============================================================
|
|
11
|
+
*/
|
|
12
|
+
import type { JudgmentSignal } from '../self-judge-kit/index.js';
|
|
13
|
+
/**
|
|
14
|
+
* 记忆分层(五大认知层)。
|
|
15
|
+
* 完整的「七层」= 五层认知记忆 + write-policy(决策进程) + memory-orchestrator(编排)。
|
|
16
|
+
*/
|
|
17
|
+
export type MemoryLayer = 'sensory' | 'working' | 'episodic' | 'semantic' | 'procedural';
|
|
18
|
+
/** 可写入长期持久化存储的层(对应 §5.1 `MemoryWriteRequest.layer`)。 */
|
|
19
|
+
export type WritableMemoryLayer = 'episodic' | 'semantic' | 'procedural';
|
|
20
|
+
/** 任务类型(用于 memory-orchestrator 的检索路由)。 */
|
|
21
|
+
export type TaskType = 'intent-classification' | 'analysis' | 'prediction' | 'recommendation' | 'creation' | 'quality-review' | 'security-audit' | 'orchestration' | 'general';
|
|
22
|
+
/** 记忆作用域:区分「跨家人共享内核记忆」与「家人本地会话缓存」(解决 C5 双写风险)。 */
|
|
23
|
+
export interface MemoryScope {
|
|
24
|
+
/** 属主家人标识;缺省表示全局共享记忆。 */
|
|
25
|
+
readonly agent?: string;
|
|
26
|
+
/** 租户隔离维度。 */
|
|
27
|
+
readonly tenantId?: string;
|
|
28
|
+
/** 会话隔离维度(sensory/working 层必需)。 */
|
|
29
|
+
readonly sessionId?: string;
|
|
30
|
+
/** 是否把全局共享记忆纳入检索结果。默认 true。 */
|
|
31
|
+
readonly includeGlobal?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** 记忆预算(工作上下文窗口分配上限)。 */
|
|
34
|
+
export interface MemoryBudget {
|
|
35
|
+
/** 单次检索注入上下文的最大 token 数。 */
|
|
36
|
+
readonly maxTokens?: number;
|
|
37
|
+
/** 单次检索返回的最大条目数。 */
|
|
38
|
+
readonly maxItems?: number;
|
|
39
|
+
}
|
|
40
|
+
/** 任务上下文(编排器检索/写入时携带的运行时语境)。 */
|
|
41
|
+
export interface TaskContext {
|
|
42
|
+
readonly traceId: string;
|
|
43
|
+
readonly agent: string;
|
|
44
|
+
readonly taskId: string;
|
|
45
|
+
readonly taskType: TaskType;
|
|
46
|
+
readonly startedAt: number;
|
|
47
|
+
readonly scope: MemoryScope;
|
|
48
|
+
readonly budget?: MemoryBudget;
|
|
49
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
50
|
+
}
|
|
51
|
+
/** 检索请求。 */
|
|
52
|
+
export interface MemoryQuery {
|
|
53
|
+
/** 自然语言/关键词查询文本。 */
|
|
54
|
+
readonly text?: string;
|
|
55
|
+
/** 仅检索指定层;缺省按路由策略决定。 */
|
|
56
|
+
readonly layers?: readonly MemoryLayer[];
|
|
57
|
+
/** 实体锚点(语义图谱检索用)。 */
|
|
58
|
+
readonly entities?: readonly string[];
|
|
59
|
+
/** 双时态时间范围:事件时间与记录时间的可选区间。 */
|
|
60
|
+
readonly eventTimeRange?: TimeRange;
|
|
61
|
+
readonly recordTimeRange?: TimeRange;
|
|
62
|
+
/** 返回条数上限。 */
|
|
63
|
+
readonly limit?: number;
|
|
64
|
+
/** 相关性得分下限。 */
|
|
65
|
+
readonly minScore?: number;
|
|
66
|
+
readonly scope: MemoryScope;
|
|
67
|
+
}
|
|
68
|
+
/** 时间区间。 */
|
|
69
|
+
export interface TimeRange {
|
|
70
|
+
readonly from?: number;
|
|
71
|
+
readonly to?: number;
|
|
72
|
+
}
|
|
73
|
+
/** 单条检索命中。 */
|
|
74
|
+
export interface MemoryHit {
|
|
75
|
+
readonly layer: MemoryLayer;
|
|
76
|
+
readonly id: string;
|
|
77
|
+
/** 命中内容(层语义决定具体结构)。 */
|
|
78
|
+
readonly content: unknown;
|
|
79
|
+
/** 与查询的相关性得分 0–1。 */
|
|
80
|
+
readonly score: number;
|
|
81
|
+
/** 写入时的显著度 0–1(§5.1)。 */
|
|
82
|
+
readonly salience: number;
|
|
83
|
+
readonly eventTime?: number;
|
|
84
|
+
readonly recordTime?: number;
|
|
85
|
+
}
|
|
86
|
+
/** 检索结果包。 */
|
|
87
|
+
export interface MemoryBundle {
|
|
88
|
+
readonly query: MemoryQuery;
|
|
89
|
+
readonly hits: readonly MemoryHit[];
|
|
90
|
+
readonly traceId: string;
|
|
91
|
+
readonly ts: number;
|
|
92
|
+
/** 各层命中统计。 */
|
|
93
|
+
readonly layerStats?: Readonly<Partial<Record<MemoryLayer, number>>>;
|
|
94
|
+
}
|
|
95
|
+
/** 记忆写入请求(§5.1 契约;salience 由 write-policy 计算)。 */
|
|
96
|
+
export interface MemoryWriteRequest {
|
|
97
|
+
readonly layer: WritableMemoryLayer;
|
|
98
|
+
readonly payload: unknown;
|
|
99
|
+
/** 信息显著度 0–1,由 write-policy.salience-scorer 计算。 */
|
|
100
|
+
readonly salience: number;
|
|
101
|
+
/** 【自】低置信但成功的轨迹 → 高价值学习素材。 */
|
|
102
|
+
readonly sourceJudgment?: JudgmentSignal;
|
|
103
|
+
readonly provenance: MemoryProvenance;
|
|
104
|
+
}
|
|
105
|
+
/** 溯源信息(不可篡改审计基座)。 */
|
|
106
|
+
export interface MemoryProvenance {
|
|
107
|
+
readonly agent: string;
|
|
108
|
+
readonly traceId: string;
|
|
109
|
+
readonly ts: number;
|
|
110
|
+
}
|
|
111
|
+
/** 写入回执。 */
|
|
112
|
+
export interface WriteAck {
|
|
113
|
+
readonly accepted: boolean;
|
|
114
|
+
readonly layer: WritableMemoryLayer;
|
|
115
|
+
readonly traceId: string;
|
|
116
|
+
readonly salience: number;
|
|
117
|
+
readonly committedAt: number;
|
|
118
|
+
/** 落库后生成的记忆 id(被拒时缺省)。 */
|
|
119
|
+
readonly id?: string;
|
|
120
|
+
/** 被拒原因(如显著度过低、策略拦截)。 */
|
|
121
|
+
readonly reason?: string;
|
|
122
|
+
}
|
|
123
|
+
/** 遗忘策略(遗忘曲线驱动)。 */
|
|
124
|
+
export interface ForgettingPolicy {
|
|
125
|
+
/** 作用层;缺省表示全部层。 */
|
|
126
|
+
readonly layers?: readonly MemoryLayer[];
|
|
127
|
+
/** 超过该存活时长的条目进入候选遗忘。 */
|
|
128
|
+
readonly maxAgeMs?: number;
|
|
129
|
+
/** 显著度低于该阈值的条目进入候选遗忘。 */
|
|
130
|
+
readonly minSalience?: number;
|
|
131
|
+
/** 衰减半衰期(毫秒),用于遗忘曲线计算。 */
|
|
132
|
+
readonly decayHalfLifeMs?: number;
|
|
133
|
+
/** 物理删除(true)或软删除/降权(false)。默认软删除。 */
|
|
134
|
+
readonly hardDelete?: boolean;
|
|
135
|
+
readonly scope: MemoryScope;
|
|
136
|
+
}
|
|
137
|
+
/** 遗忘单条明细。 */
|
|
138
|
+
export interface ForgetDetail {
|
|
139
|
+
readonly id: string;
|
|
140
|
+
readonly layer: MemoryLayer;
|
|
141
|
+
readonly reason: string;
|
|
142
|
+
}
|
|
143
|
+
/** 遗忘回执。 */
|
|
144
|
+
export interface ForgetAck {
|
|
145
|
+
readonly forgotten: number;
|
|
146
|
+
readonly layers: readonly MemoryLayer[];
|
|
147
|
+
readonly traceId: string;
|
|
148
|
+
readonly ts: number;
|
|
149
|
+
readonly details: readonly ForgetDetail[];
|
|
150
|
+
}
|
|
151
|
+
/** 一致性问题的分类。 */
|
|
152
|
+
export type ConsistencyIssueKind = 'missing' | 'conflict' | 'stale' | 'orphan' | 'duplicate';
|
|
153
|
+
/** 跨层一致性问题。 */
|
|
154
|
+
export interface ConsistencyIssue {
|
|
155
|
+
readonly kind: ConsistencyIssueKind;
|
|
156
|
+
readonly layer: MemoryLayer;
|
|
157
|
+
readonly id?: string;
|
|
158
|
+
readonly detail: string;
|
|
159
|
+
readonly severity: 'low' | 'med' | 'high';
|
|
160
|
+
/** 是否可由 consistency-repair 自动修复(对接自愈中心 §5.5)。 */
|
|
161
|
+
readonly repairable: boolean;
|
|
162
|
+
}
|
|
163
|
+
/** 一致性校验报告。 */
|
|
164
|
+
export interface ConsistencyReport {
|
|
165
|
+
readonly scope: MemoryScope;
|
|
166
|
+
readonly ok: boolean;
|
|
167
|
+
readonly checkedAt: number;
|
|
168
|
+
readonly issues: readonly ConsistencyIssue[];
|
|
169
|
+
/** 参与校验的层。 */
|
|
170
|
+
readonly layers: readonly MemoryLayer[];
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* 记忆分层生命周期契约(§5.1 表格的代码级镜像)。
|
|
174
|
+
* 存储介质与写入触发点在此声明,供真实基础设施(DB/向量库/图库)接入时对齐。
|
|
175
|
+
*/
|
|
176
|
+
export declare const MEMORY_LIFECYCLE: Readonly<Record<MemoryLayer, {
|
|
177
|
+
retention: string;
|
|
178
|
+
medium: string;
|
|
179
|
+
writeTrigger: string;
|
|
180
|
+
}>>;
|
|
181
|
+
/**
|
|
182
|
+
* 记忆编排器契约(§5.1 核心接口契约)。
|
|
183
|
+
* 所有检索请求经此入口路由到相应记忆层,所有写入经 write-policy 显著度评分后落库。
|
|
184
|
+
*/
|
|
185
|
+
export interface MemoryOrchestrator {
|
|
186
|
+
retrieve(query: MemoryQuery, ctx: TaskContext): Promise<MemoryBundle>;
|
|
187
|
+
/** 经 write-policy 显著度评分后提交写入。 */
|
|
188
|
+
commit(bundle: MemoryWriteRequest): Promise<WriteAck>;
|
|
189
|
+
/** 遗忘曲线驱动。 */
|
|
190
|
+
forget(policy: ForgettingPolicy): Promise<ForgetAck>;
|
|
191
|
+
checkConsistency(scope: MemoryScope): Promise<ConsistencyReport>;
|
|
192
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================
|
|
3
|
+
* YYC³ AI Family — 记忆框架(「知」支柱)核心类型定义
|
|
4
|
+
* ------------------------------------------------------------
|
|
5
|
+
* 文档依据:YYC3-AI-Family-Agent-架构设计.md §5.1
|
|
6
|
+
* 边界:负责感知暂存 / 上下文窗口 / 情景轨迹 / 语义图谱 /
|
|
7
|
+
* 程序记忆 / 写入决策 / 检索编排;
|
|
8
|
+
* 不负责模型推理(llm-adapter)、业务意图(家人 core)、
|
|
9
|
+
* 安全判定(治理中心)。
|
|
10
|
+
* ============================================================
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* 记忆分层生命周期契约(§5.1 表格的代码级镜像)。
|
|
14
|
+
* 存储介质与写入触发点在此声明,供真实基础设施(DB/向量库/图库)接入时对齐。
|
|
15
|
+
*/
|
|
16
|
+
export const MEMORY_LIFECYCLE = {
|
|
17
|
+
sensory: {
|
|
18
|
+
retention: '秒级(会话内)',
|
|
19
|
+
medium: '内存环形缓冲',
|
|
20
|
+
writeTrigger: '输入到达即写',
|
|
21
|
+
},
|
|
22
|
+
working: {
|
|
23
|
+
retention: '会话期',
|
|
24
|
+
medium: '内存 + Redis',
|
|
25
|
+
writeTrigger: '注意力评分动态维护',
|
|
26
|
+
},
|
|
27
|
+
episodic: {
|
|
28
|
+
retention: '天~永久',
|
|
29
|
+
medium: '关系库 + 对象存储',
|
|
30
|
+
writeTrigger: '任务链路结束',
|
|
31
|
+
},
|
|
32
|
+
semantic: {
|
|
33
|
+
retention: '永久(可遗忘)',
|
|
34
|
+
medium: '图库 / 向量库',
|
|
35
|
+
writeTrigger: '实体/关系确认',
|
|
36
|
+
},
|
|
37
|
+
procedural: {
|
|
38
|
+
retention: '版本化永久',
|
|
39
|
+
medium: 'Git 版本化 YAML',
|
|
40
|
+
writeTrigger: '学习引擎固化 / 人工审核',
|
|
41
|
+
},
|
|
42
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 注意力评分器(attention-scorer)——「知」支柱 working-context 子模块。
|
|
3
|
+
* 职责:对工作记忆条目按相关性加权,动态决定"什么留在注意力窗口内"。
|
|
4
|
+
* 边界:只做相关性加权,不做检索(检索归 memory-orchestrator)。
|
|
5
|
+
*
|
|
6
|
+
* TODO(infra): 以轻量检索模型(如嵌入余弦相似度)替换启发式打分。
|
|
7
|
+
*/
|
|
8
|
+
/** 工作记忆条目。 */
|
|
9
|
+
export interface WorkingItem {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly content: unknown;
|
|
12
|
+
/** 基础显著度 0–1(来自写入时的 salience)。 */
|
|
13
|
+
readonly salience: number;
|
|
14
|
+
/** 最近一次被访问的事件时间。 */
|
|
15
|
+
readonly lastAccessTs: number;
|
|
16
|
+
/** 关键词/实体,用于相关性匹配。 */
|
|
17
|
+
readonly keywords: readonly string[];
|
|
18
|
+
}
|
|
19
|
+
/** 评分权重配置。 */
|
|
20
|
+
export interface AttentionWeights {
|
|
21
|
+
/** 相关性权重(默认 0.5)。 */
|
|
22
|
+
readonly relevance: number;
|
|
23
|
+
/** 显著度权重(默认 0.3)。 */
|
|
24
|
+
readonly salience: number;
|
|
25
|
+
/** 新近度权重(默认 0.2)。 */
|
|
26
|
+
readonly recency: number;
|
|
27
|
+
}
|
|
28
|
+
export declare const DEFAULT_ATTENTION_WEIGHTS: AttentionWeights;
|
|
29
|
+
/** 注意力评分器。 */
|
|
30
|
+
export declare class AttentionScorer {
|
|
31
|
+
private readonly weights;
|
|
32
|
+
constructor(weights?: AttentionWeights);
|
|
33
|
+
/** 计算条目在给定查询下的注意力权重 0–1。 */
|
|
34
|
+
score(item: WorkingItem, query: string, now: number, halfLifeMs?: number): number;
|
|
35
|
+
/** 关键词/查询匹配相关性(启发式:命中率)。 */
|
|
36
|
+
private relevance;
|
|
37
|
+
/** 指数衰减新近度。 */
|
|
38
|
+
private recency;
|
|
39
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 注意力评分器(attention-scorer)——「知」支柱 working-context 子模块。
|
|
3
|
+
* 职责:对工作记忆条目按相关性加权,动态决定"什么留在注意力窗口内"。
|
|
4
|
+
* 边界:只做相关性加权,不做检索(检索归 memory-orchestrator)。
|
|
5
|
+
*
|
|
6
|
+
* TODO(infra): 以轻量检索模型(如嵌入余弦相似度)替换启发式打分。
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_ATTENTION_WEIGHTS = {
|
|
9
|
+
relevance: 0.5,
|
|
10
|
+
salience: 0.3,
|
|
11
|
+
recency: 0.2,
|
|
12
|
+
};
|
|
13
|
+
/** 注意力评分器。 */
|
|
14
|
+
export class AttentionScorer {
|
|
15
|
+
weights;
|
|
16
|
+
constructor(weights = DEFAULT_ATTENTION_WEIGHTS) {
|
|
17
|
+
this.weights = weights;
|
|
18
|
+
}
|
|
19
|
+
/** 计算条目在给定查询下的注意力权重 0–1。 */
|
|
20
|
+
score(item, query, now, halfLifeMs = 60_000) {
|
|
21
|
+
const relevance = this.relevance(item.keywords, query);
|
|
22
|
+
const recency = this.recency(item.lastAccessTs, now, halfLifeMs);
|
|
23
|
+
const s = this.weights.relevance * relevance +
|
|
24
|
+
this.weights.salience * item.salience +
|
|
25
|
+
this.weights.recency * recency;
|
|
26
|
+
return clamp01(s);
|
|
27
|
+
}
|
|
28
|
+
/** 关键词/查询匹配相关性(启发式:命中率)。 */
|
|
29
|
+
relevance(keywords, query) {
|
|
30
|
+
if (keywords.length === 0)
|
|
31
|
+
return 0;
|
|
32
|
+
const q = query.toLowerCase();
|
|
33
|
+
const hit = keywords.filter((k) => q.includes(k.toLowerCase())).length;
|
|
34
|
+
// TODO(infra): 替换为嵌入向量余弦相似度
|
|
35
|
+
return clamp01(hit / keywords.length);
|
|
36
|
+
}
|
|
37
|
+
/** 指数衰减新近度。 */
|
|
38
|
+
recency(lastAccessTs, now, halfLifeMs) {
|
|
39
|
+
const dt = Math.max(0, now - lastAccessTs);
|
|
40
|
+
return Math.pow(0.5, dt / halfLifeMs);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function clamp01(v) {
|
|
44
|
+
return Math.min(1, Math.max(0, v));
|
|
45
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 上下文窗口(context-window)——「知」支柱 working-context 子模块。
|
|
3
|
+
* 职责:在 token 预算内做动态窗口分配(DWA),保证高注意力条目优先保留。
|
|
4
|
+
* 边界:只负责分配与裁剪,不做内容生成。
|
|
5
|
+
*
|
|
6
|
+
* TODO(infra): token 计数替换为真实分词器(tiktoken / 模型侧计数)。
|
|
7
|
+
*/
|
|
8
|
+
/** 窗口候选条目(携带 token 估算与注意力权重)。 */
|
|
9
|
+
export interface WindowCandidate {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly content: unknown;
|
|
12
|
+
/** token 估算值。 */
|
|
13
|
+
readonly tokens: number;
|
|
14
|
+
/** 由 attention-scorer 计算的权重 0–1。 */
|
|
15
|
+
readonly weight: number;
|
|
16
|
+
}
|
|
17
|
+
/** 窗口分配结果。 */
|
|
18
|
+
export interface WindowAllocation {
|
|
19
|
+
readonly selected: readonly WindowCandidate[];
|
|
20
|
+
readonly dropped: readonly WindowCandidate[];
|
|
21
|
+
readonly usedTokens: number;
|
|
22
|
+
readonly budgetTokens: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 动态窗口分配器。
|
|
26
|
+
* 策略:按注意力权重降序贪心填充,直至预算耗尽(权重高者优先)。
|
|
27
|
+
*/
|
|
28
|
+
export declare class ContextWindow {
|
|
29
|
+
private readonly budgetTokens;
|
|
30
|
+
constructor(budgetTokens?: number);
|
|
31
|
+
/** 在预算内分配窗口。 */
|
|
32
|
+
allocate(candidates: readonly WindowCandidate[], budget?: number): WindowAllocation;
|
|
33
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 上下文窗口(context-window)——「知」支柱 working-context 子模块。
|
|
3
|
+
* 职责:在 token 预算内做动态窗口分配(DWA),保证高注意力条目优先保留。
|
|
4
|
+
* 边界:只负责分配与裁剪,不做内容生成。
|
|
5
|
+
*
|
|
6
|
+
* TODO(infra): token 计数替换为真实分词器(tiktoken / 模型侧计数)。
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* 动态窗口分配器。
|
|
10
|
+
* 策略:按注意力权重降序贪心填充,直至预算耗尽(权重高者优先)。
|
|
11
|
+
*/
|
|
12
|
+
export class ContextWindow {
|
|
13
|
+
budgetTokens;
|
|
14
|
+
constructor(budgetTokens = 128_000) {
|
|
15
|
+
this.budgetTokens = budgetTokens;
|
|
16
|
+
}
|
|
17
|
+
/** 在预算内分配窗口。 */
|
|
18
|
+
allocate(candidates, budget = this.budgetTokens) {
|
|
19
|
+
const ranked = [...candidates].sort((a, b) => b.weight - a.weight);
|
|
20
|
+
const selected = [];
|
|
21
|
+
const dropped = [];
|
|
22
|
+
let used = 0;
|
|
23
|
+
for (const c of ranked) {
|
|
24
|
+
if (used + c.tokens <= budget) {
|
|
25
|
+
selected.push(c);
|
|
26
|
+
used += c.tokens;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
dropped.push(c);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// TODO(infra): 接入真实分词器做精确 token 计量;可选支持摘要压缩
|
|
33
|
+
return { selected, dropped, usedTokens: used, budgetTokens: budget };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 工作上下文(working-context)——「知」支柱第 2 层。
|
|
3
|
+
* 生命周期:会话期|存储介质:内存 + Redis|写入触发:注意力评分动态维护。
|
|
4
|
+
*/
|
|
5
|
+
import { AttentionScorer, type WorkingItem } from './attention-scorer.js';
|
|
6
|
+
import { ContextWindow, type WindowAllocation } from './context-window.js';
|
|
7
|
+
export type { WorkingItem } from './attention-scorer.js';
|
|
8
|
+
export type { WindowAllocation, WindowCandidate } from './context-window.js';
|
|
9
|
+
/** 工作上下文端口。 */
|
|
10
|
+
export interface WorkingContextPort {
|
|
11
|
+
put(item: WorkingItem): void;
|
|
12
|
+
get(id: string): WorkingItem | undefined;
|
|
13
|
+
/** 查询后重新计算注意力权重并返回窗口分配结果。 */
|
|
14
|
+
attend(query: string, now: number): WindowAllocation;
|
|
15
|
+
clear(): void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 工作上下文实现(内存桩)。
|
|
19
|
+
* 维护会话内的注意焦点集合,随查询动态排序。
|
|
20
|
+
*/
|
|
21
|
+
export declare class WorkingContext implements WorkingContextPort {
|
|
22
|
+
private readonly scorer;
|
|
23
|
+
private readonly window;
|
|
24
|
+
private readonly items;
|
|
25
|
+
constructor(scorer?: AttentionScorer, window?: ContextWindow);
|
|
26
|
+
put(item: WorkingItem): void;
|
|
27
|
+
get(id: string): WorkingItem | undefined;
|
|
28
|
+
attend(query: string, now: number): WindowAllocation;
|
|
29
|
+
clear(): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 工作上下文(working-context)——「知」支柱第 2 层。
|
|
3
|
+
* 生命周期:会话期|存储介质:内存 + Redis|写入触发:注意力评分动态维护。
|
|
4
|
+
*/
|
|
5
|
+
import { AttentionScorer } from './attention-scorer.js';
|
|
6
|
+
import { ContextWindow } from './context-window.js';
|
|
7
|
+
/**
|
|
8
|
+
* 工作上下文实现(内存桩)。
|
|
9
|
+
* 维护会话内的注意焦点集合,随查询动态排序。
|
|
10
|
+
*/
|
|
11
|
+
export class WorkingContext {
|
|
12
|
+
scorer;
|
|
13
|
+
window;
|
|
14
|
+
items = new Map();
|
|
15
|
+
constructor(scorer = new AttentionScorer(), window = new ContextWindow()) {
|
|
16
|
+
this.scorer = scorer;
|
|
17
|
+
this.window = window;
|
|
18
|
+
}
|
|
19
|
+
put(item) {
|
|
20
|
+
this.items.set(item.id, item);
|
|
21
|
+
// TODO(infra): 同步到 Redis 会话键,支持多实例共享
|
|
22
|
+
}
|
|
23
|
+
get(id) {
|
|
24
|
+
return this.items.get(id);
|
|
25
|
+
}
|
|
26
|
+
attend(query, now) {
|
|
27
|
+
const candidates = [...this.items.values()].map((item) => ({
|
|
28
|
+
id: item.id,
|
|
29
|
+
content: item.content,
|
|
30
|
+
// 桩实现:token 以内容长度粗估
|
|
31
|
+
tokens: estimateTokens(item.content),
|
|
32
|
+
weight: this.scorer.score(item, query, now),
|
|
33
|
+
}));
|
|
34
|
+
return this.window.allocate(candidates);
|
|
35
|
+
}
|
|
36
|
+
clear() {
|
|
37
|
+
this.items.clear();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** 粗估 token 数(桩)。 */
|
|
41
|
+
function estimateTokens(content) {
|
|
42
|
+
const text = typeof content === 'string' ? content : JSON.stringify(content ?? '');
|
|
43
|
+
return Math.max(1, Math.ceil(text.length / 4));
|
|
44
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 记忆巩固(consolidation)——「知」支柱 write-policy 子模块。
|
|
3
|
+
* 职责:短期(sensory/working)→ 长期(episodic/semantic)的巩固决策。
|
|
4
|
+
* 触发点:任务链路结束(task.completed)。
|
|
5
|
+
*
|
|
6
|
+
* TODO(infra): 引入批量巩固调度(learning-scheduler.budget-allocator)。
|
|
7
|
+
*/
|
|
8
|
+
import type { MemoryLayer, WritableMemoryLayer } from '../types.js';
|
|
9
|
+
/** 待巩固条目。 */
|
|
10
|
+
export interface CandidateItem {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly fromLayer: MemoryLayer;
|
|
13
|
+
readonly content: unknown;
|
|
14
|
+
readonly salience: number;
|
|
15
|
+
readonly eventTime: number;
|
|
16
|
+
}
|
|
17
|
+
/** 巩固计划:将短期条目映射到长期层。 */
|
|
18
|
+
export interface ConsolidationPlan {
|
|
19
|
+
readonly items: readonly {
|
|
20
|
+
id: string;
|
|
21
|
+
targetLayer: WritableMemoryLayer;
|
|
22
|
+
content: unknown;
|
|
23
|
+
salience: number;
|
|
24
|
+
}[];
|
|
25
|
+
readonly skipped: readonly string[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 记忆巩固器。
|
|
29
|
+
* 规则:显著度 ≥ 阈值的高价值短期条目进入长期;工作记忆中的稳定事实进入语义层。
|
|
30
|
+
*/
|
|
31
|
+
export declare class Consolidation {
|
|
32
|
+
private readonly threshold;
|
|
33
|
+
constructor(threshold?: number);
|
|
34
|
+
plan(items: readonly CandidateItem[]): ConsolidationPlan;
|
|
35
|
+
/** 源层 → 目标层映射。 */
|
|
36
|
+
private targetOf;
|
|
37
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 记忆巩固(consolidation)——「知」支柱 write-policy 子模块。
|
|
3
|
+
* 职责:短期(sensory/working)→ 长期(episodic/semantic)的巩固决策。
|
|
4
|
+
* 触发点:任务链路结束(task.completed)。
|
|
5
|
+
*
|
|
6
|
+
* TODO(infra): 引入批量巩固调度(learning-scheduler.budget-allocator)。
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* 记忆巩固器。
|
|
10
|
+
* 规则:显著度 ≥ 阈值的高价值短期条目进入长期;工作记忆中的稳定事实进入语义层。
|
|
11
|
+
*/
|
|
12
|
+
export class Consolidation {
|
|
13
|
+
threshold;
|
|
14
|
+
constructor(threshold = 0.6) {
|
|
15
|
+
this.threshold = threshold;
|
|
16
|
+
}
|
|
17
|
+
plan(items) {
|
|
18
|
+
const planned = [];
|
|
19
|
+
const skipped = [];
|
|
20
|
+
for (const it of items) {
|
|
21
|
+
if (it.salience < this.threshold) {
|
|
22
|
+
skipped.push(it.id);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
planned.push({
|
|
26
|
+
id: it.id,
|
|
27
|
+
targetLayer: this.targetOf(it),
|
|
28
|
+
content: it.content,
|
|
29
|
+
salience: it.salience,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
// TODO(infra): 写入长期层前做去重/合并(与既有记忆比对)
|
|
33
|
+
return { items: planned, skipped };
|
|
34
|
+
}
|
|
35
|
+
/** 源层 → 目标层映射。 */
|
|
36
|
+
targetOf(it) {
|
|
37
|
+
switch (it.fromLayer) {
|
|
38
|
+
case 'working':
|
|
39
|
+
return 'semantic';
|
|
40
|
+
case 'sensory':
|
|
41
|
+
case 'episodic':
|
|
42
|
+
return 'episodic';
|
|
43
|
+
case 'semantic':
|
|
44
|
+
case 'procedural':
|
|
45
|
+
return 'semantic';
|
|
46
|
+
default:
|
|
47
|
+
return 'episodic';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 遗忘策略(forgetting-policy)——「知」支柱 write-policy 子模块。
|
|
3
|
+
* 职责:遗忘曲线驱动的衰减与清除决策("何时忘")。
|
|
4
|
+
* 边界:只做决策与打分;真实删除由 memory-orchestrator.forget 执行。
|
|
5
|
+
*
|
|
6
|
+
* TODO(infra): 引入更贴近人类记忆的幂律遗忘曲线,并结合访问频率(spacing effect)。
|
|
7
|
+
*/
|
|
8
|
+
import type { ForgettingPolicy, MemoryLayer } from '../types.js';
|
|
9
|
+
/** 遗忘候选条目(供衰减计算)。 */
|
|
10
|
+
export interface ForgetCandidate {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly layer: MemoryLayer;
|
|
13
|
+
readonly salience: number;
|
|
14
|
+
readonly eventTime: number;
|
|
15
|
+
/** 最近访问时间(用于间隔效应)。 */
|
|
16
|
+
readonly lastAccessTs?: number;
|
|
17
|
+
}
|
|
18
|
+
/** 衰减结果。 */
|
|
19
|
+
export interface DecayResult {
|
|
20
|
+
readonly decayedSalience: number;
|
|
21
|
+
readonly shouldForget: boolean;
|
|
22
|
+
readonly reason: string;
|
|
23
|
+
}
|
|
24
|
+
/** 遗忘策略引擎。 */
|
|
25
|
+
export declare class ForgettingPolicyEngine {
|
|
26
|
+
/** 计算条目在当前策略下的衰减后显著度与是否遗忘。 */
|
|
27
|
+
evaluate(candidate: ForgetCandidate, policy: ForgettingPolicy, now: number): DecayResult;
|
|
28
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 遗忘策略(forgetting-policy)——「知」支柱 write-policy 子模块。
|
|
3
|
+
* 职责:遗忘曲线驱动的衰减与清除决策("何时忘")。
|
|
4
|
+
* 边界:只做决策与打分;真实删除由 memory-orchestrator.forget 执行。
|
|
5
|
+
*
|
|
6
|
+
* TODO(infra): 引入更贴近人类记忆的幂律遗忘曲线,并结合访问频率(spacing effect)。
|
|
7
|
+
*/
|
|
8
|
+
/** 遗忘策略引擎。 */
|
|
9
|
+
export class ForgettingPolicyEngine {
|
|
10
|
+
/** 计算条目在当前策略下的衰减后显著度与是否遗忘。 */
|
|
11
|
+
evaluate(candidate, policy, now) {
|
|
12
|
+
const halfLife = policy.decayHalfLifeMs ?? 7 * 24 * 3600 * 1000; // 默认半衰期 7 天
|
|
13
|
+
const last = candidate.lastAccessTs ?? candidate.eventTime;
|
|
14
|
+
const dt = Math.max(0, now - last);
|
|
15
|
+
const decayed = candidate.salience * Math.pow(0.5, dt / halfLife);
|
|
16
|
+
const agedOut = policy.maxAgeMs !== undefined && now - candidate.eventTime > policy.maxAgeMs;
|
|
17
|
+
const salienceLow = policy.minSalience !== undefined && decayed < policy.minSalience;
|
|
18
|
+
// 语义/程序层默认永久(除非显式指定层)
|
|
19
|
+
const layerInScope = policy.layers === undefined || policy.layers.includes(candidate.layer);
|
|
20
|
+
if (!layerInScope) {
|
|
21
|
+
return { decayedSalience: decayed, shouldForget: false, reason: 'out-of-scope' };
|
|
22
|
+
}
|
|
23
|
+
if (agedOut && salienceLow) {
|
|
24
|
+
return { decayedSalience: decayed, shouldForget: true, reason: 'aged-and-faded' };
|
|
25
|
+
}
|
|
26
|
+
if (salienceLow) {
|
|
27
|
+
return { decayedSalience: decayed, shouldForget: true, reason: 'salience-below-threshold' };
|
|
28
|
+
}
|
|
29
|
+
return { decayedSalience: decayed, shouldForget: false, reason: 'retained' };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 写入策略(write-policy)——「知」支柱的"决策进程"(生命周期表中间件)。
|
|
3
|
+
* 生命周期:—(决策进程)|存储介质:内存|写入触发:持续运行。
|
|
4
|
+
*
|
|
5
|
+
* 组合:salience-scorer(评分)+ consolidation(巩固)+ forgetting-policy(遗忘)。
|
|
6
|
+
*/
|
|
7
|
+
import type { MemoryWriteRequest, WritableMemoryLayer } from '../types.js';
|
|
8
|
+
import { Consolidation } from './consolidation.js';
|
|
9
|
+
import { ForgettingPolicyEngine } from './forgetting-policy.js';
|
|
10
|
+
import { SalienceScorer } from './salience-scorer.js';
|
|
11
|
+
export { Consolidation } from './consolidation.js';
|
|
12
|
+
export type { CandidateItem, ConsolidationPlan } from './consolidation.js';
|
|
13
|
+
export { ForgettingPolicyEngine } from './forgetting-policy.js';
|
|
14
|
+
export type { DecayResult, ForgetCandidate } from './forgetting-policy.js';
|
|
15
|
+
export { SalienceScorer } from './salience-scorer.js';
|
|
16
|
+
export type { SalienceInput, SalienceResult } from './salience-scorer.js';
|
|
17
|
+
/** 写入裁决结果。 */
|
|
18
|
+
export interface WriteDecision {
|
|
19
|
+
readonly accepted: boolean;
|
|
20
|
+
/** 经写策略计算/覆写的显著度。 */
|
|
21
|
+
readonly salience: number;
|
|
22
|
+
readonly layer: WritableMemoryLayer;
|
|
23
|
+
/** 被拒原因。 */
|
|
24
|
+
readonly reason?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 写入策略。
|
|
28
|
+
* 流程:显著度评分 → 阈值裁决(是否写入)→(异步)巩固/遗忘。
|
|
29
|
+
*/
|
|
30
|
+
export declare class WritePolicy {
|
|
31
|
+
private readonly scorer;
|
|
32
|
+
private readonly consolidation;
|
|
33
|
+
readonly forgetting: ForgettingPolicyEngine;
|
|
34
|
+
private readonly acceptThreshold;
|
|
35
|
+
constructor(scorer?: SalienceScorer, consolidation?: Consolidation, forgetting?: ForgettingPolicyEngine, acceptThreshold?: number);
|
|
36
|
+
/** 对写入请求做显著度评分与接收裁决。 */
|
|
37
|
+
evaluate(req: MemoryWriteRequest, novelty?: number): WriteDecision;
|
|
38
|
+
/** 暴露巩固器供编排器在任务结束时调用。 */
|
|
39
|
+
planConsolidation(candidates: Parameters<Consolidation['plan']>[0]): import("./consolidation.js").ConsolidationPlan;
|
|
40
|
+
}
|