@yyc3/ai-family-kernel 0.0.0-stage → 2.52.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 +313 -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,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 能力注册中心(P4-T2 · 静态注册中心)—— scope 解析与合并,纯函数、零网络。
|
|
3
|
+
*
|
|
4
|
+
* 职责(ADR D4「静态清单 + 门禁可验证」):
|
|
5
|
+
* - 接收 builtin / local 两组已解析的能力包清单(解析由部署侧完成,内核不做 IO);
|
|
6
|
+
* - 确定性合并:同 id local 覆盖 builtin;组内同 id 后者覆盖前者;
|
|
7
|
+
* - 展开注册能力(contents refs)并保持 (type, ref) 稳定排序;
|
|
8
|
+
* - 提供只读查询:清单、覆盖关系、能力归属。
|
|
9
|
+
*
|
|
10
|
+
* 红线:不 import family-agents;不做动态 import();不做远程安装;插件 = 静态清单。
|
|
11
|
+
*/
|
|
12
|
+
/** contents.type 白名单(P4-T1 格式契约)。 */
|
|
13
|
+
export const PLUGIN_CONTENT_TYPES = ['skills', 'mcp-servers', 'policies', 'prompts'];
|
|
14
|
+
/** 组内去重:同 id 后者覆盖前者(数组序即优先级)。 */
|
|
15
|
+
function latestById(manifests) {
|
|
16
|
+
const map = new Map();
|
|
17
|
+
for (const m of manifests)
|
|
18
|
+
map.set(m.id, m);
|
|
19
|
+
return map;
|
|
20
|
+
}
|
|
21
|
+
const byId = (a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0);
|
|
22
|
+
/**
|
|
23
|
+
* 合并 builtin / local 两组清单并展开能力。
|
|
24
|
+
* 覆盖顺序确定且可测:组内数组序后者胜;跨层 local 必覆盖 builtin。
|
|
25
|
+
*/
|
|
26
|
+
export function buildCapabilityCatalog(builtin, local) {
|
|
27
|
+
const builtinMap = latestById(builtin);
|
|
28
|
+
const localMap = latestById(local);
|
|
29
|
+
const overriddenIds = [];
|
|
30
|
+
for (const id of localMap.keys())
|
|
31
|
+
if (builtinMap.has(id))
|
|
32
|
+
overriddenIds.push(id);
|
|
33
|
+
const effective = new Map(builtinMap);
|
|
34
|
+
for (const [id, m] of localMap)
|
|
35
|
+
effective.set(id, m);
|
|
36
|
+
const plugins = [...effective.values()].sort(byId);
|
|
37
|
+
const capabilities = [];
|
|
38
|
+
for (const m of plugins) {
|
|
39
|
+
for (const group of m.contents ?? []) {
|
|
40
|
+
for (const ref of group.refs) {
|
|
41
|
+
capabilities.push({ type: group.type, ref, pluginId: m.id, scope: m.scope });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
capabilities.sort((a, b) => a.type === b.type
|
|
46
|
+
? a.ref === b.ref
|
|
47
|
+
? a.pluginId < b.pluginId
|
|
48
|
+
? -1
|
|
49
|
+
: a.pluginId > b.pluginId
|
|
50
|
+
? 1
|
|
51
|
+
: 0
|
|
52
|
+
: a.ref < b.ref
|
|
53
|
+
? -1
|
|
54
|
+
: 1
|
|
55
|
+
: a.type < b.type
|
|
56
|
+
? -1
|
|
57
|
+
: 1);
|
|
58
|
+
return { plugins, overriddenIds: overriddenIds.sort(), capabilities };
|
|
59
|
+
}
|
|
60
|
+
/** 查询生效清单。 */
|
|
61
|
+
export function findPlugin(snapshot, id) {
|
|
62
|
+
return snapshot.plugins.find((m) => m.id === id);
|
|
63
|
+
}
|
|
64
|
+
/** 按类型过滤注册能力。 */
|
|
65
|
+
export function capabilitiesOfType(snapshot, type) {
|
|
66
|
+
return snapshot.capabilities.filter((c) => c.type === type);
|
|
67
|
+
}
|
|
68
|
+
/** 注册能力是否存在(含归属)。 */
|
|
69
|
+
export function hasCapability(snapshot, type, ref) {
|
|
70
|
+
return snapshot.capabilities.some((c) => c.type === type && c.ref === ref);
|
|
71
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 10-能力注册中心 barrel —— P4-T2 静态注册中心 + P4-T3 准入治理 + P4-T4 完整性校验。
|
|
3
|
+
*
|
|
4
|
+
* 红线:仅依赖 node: 标准库;插件 = 静态可校验清单 + 已编译模块的注册,
|
|
5
|
+
* 不做动态 import() / 远程安装 / vm 沙箱。
|
|
6
|
+
*/
|
|
7
|
+
export { PLUGIN_CONTENT_TYPES, buildCapabilityCatalog, capabilitiesOfType, findPlugin, hasCapability, } from './catalog.js';
|
|
8
|
+
export type { CapabilityCatalogSnapshot, CatalogCapability, PluginContent, PluginContentType, PluginIntegrity, PluginManifest, PluginScope, } from './catalog.js';
|
|
9
|
+
export { PluginLoader, pluginManifestErrors } from './plugin-loader.js';
|
|
10
|
+
export type { LoaderCapability } from './plugin-loader.js';
|
|
11
|
+
export { PLUGIN_DIGEST_ALGORITHM, canonicalDigestLines, computePluginDigest, sha256Hex, verifyPluginDigest, } from './integrity.js';
|
|
12
|
+
export type { PluginDigestEntry } from './integrity.js';
|
|
13
|
+
export { ADMISSION_MODES, ADMISSION_POLICY_ID, ADMISSION_POLICY_VERSION, CapabilityAllowlist, DEFAULT_ADMISSION_ACTION, DEFAULT_ADMISSION_MODE, } from './allowlist.js';
|
|
14
|
+
export type { AdmissionConfig, AdmissionDecision, AdmissionMode, AdmissionRequest } from './allowlist.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 10-能力注册中心 barrel —— P4-T2 静态注册中心 + P4-T3 准入治理 + P4-T4 完整性校验。
|
|
3
|
+
*
|
|
4
|
+
* 红线:仅依赖 node: 标准库;插件 = 静态可校验清单 + 已编译模块的注册,
|
|
5
|
+
* 不做动态 import() / 远程安装 / vm 沙箱。
|
|
6
|
+
*/
|
|
7
|
+
export { PLUGIN_CONTENT_TYPES, buildCapabilityCatalog, capabilitiesOfType, findPlugin, hasCapability, } from './catalog.js';
|
|
8
|
+
export { PluginLoader, pluginManifestErrors } from './plugin-loader.js';
|
|
9
|
+
export { PLUGIN_DIGEST_ALGORITHM, canonicalDigestLines, computePluginDigest, sha256Hex, verifyPluginDigest, } from './integrity.js';
|
|
10
|
+
export { ADMISSION_MODES, ADMISSION_POLICY_ID, ADMISSION_POLICY_VERSION, CapabilityAllowlist, DEFAULT_ADMISSION_ACTION, DEFAULT_ADMISSION_MODE, } from './allowlist.js';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 能力包完整性(P4-T4 · 权威实现)—— 纯 TypeScript SHA-256,零依赖(无 node:crypto)。
|
|
3
|
+
*
|
|
4
|
+
* 为什么不用 node:crypto:内核边界 = 零运行时依赖 + 零 node 类型依赖(浏览器/边缘可用,
|
|
5
|
+
* 五高之高可用);正确性由契约套件交叉断言——scripts/check-plugins.mjs 以 node:crypto
|
|
6
|
+
* 独立实现同构算法,两实现(同输入恒同摘要)不一致即门禁失败。
|
|
7
|
+
*
|
|
8
|
+
* canonical 摘要算法:
|
|
9
|
+
* 1. entries 按 (kind, ref) 字典序排序;
|
|
10
|
+
* 2. 逐项 sha256(`${kind}\u0000${ref}\u0000${payload}`) 取 hex;
|
|
11
|
+
* 3. 以 '\n' 连接各项 hex,对连接串再取 sha256 hex 即 digest。
|
|
12
|
+
*
|
|
13
|
+
* skills / prompts(文件产物类)payload = 引用文件内容;
|
|
14
|
+
* mcp-servers / policies(声明类)payload = ref 字符串本身。
|
|
15
|
+
*/
|
|
16
|
+
/** 摘要算法固定值(包清单 integrity.algorithm 必须声明该值)。 */
|
|
17
|
+
export declare const PLUGIN_DIGEST_ALGORITHM: "sha256";
|
|
18
|
+
/** 摘要输入单项。 */
|
|
19
|
+
export interface PluginDigestEntry {
|
|
20
|
+
/** contents.type(skills / mcp-servers / policies / prompts)。 */
|
|
21
|
+
kind: string;
|
|
22
|
+
/** 能力引用(如 shared.self-judge)。 */
|
|
23
|
+
ref: string;
|
|
24
|
+
/** 文件产物内容;声明类能力为 ref 字符串本身。 */
|
|
25
|
+
payload: string;
|
|
26
|
+
}
|
|
27
|
+
/** 纯 TS SHA-256:UTF-8 输入 → 64 位小写 hex(FIPS 180-4)。 */
|
|
28
|
+
export declare function sha256Hex(text: string): string;
|
|
29
|
+
/** canonical 化:按 (kind, ref) 排序后逐项哈希,返回待连接的 hex 行。 */
|
|
30
|
+
export declare function canonicalDigestLines(entries: readonly PluginDigestEntry[]): string[];
|
|
31
|
+
/** 计算能力包 canonical 摘要(64 位小写 hex)。 */
|
|
32
|
+
export declare function computePluginDigest(entries: readonly PluginDigestEntry[]): string;
|
|
33
|
+
/** 完整性声明(与包清单 integrity 字段一致)。 */
|
|
34
|
+
export interface PluginIntegrity {
|
|
35
|
+
/** 必须为 sha256。 */
|
|
36
|
+
algorithm: string;
|
|
37
|
+
/** 64 位小写 hex。 */
|
|
38
|
+
digest: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 比对实算摘要与包清单声明——篡改即失败。
|
|
42
|
+
* 算法不匹配视为失败(防降级);空 entries 允许(空包恒空摘要)。
|
|
43
|
+
*/
|
|
44
|
+
export declare function verifyPluginDigest(entries: readonly PluginDigestEntry[], declared: PluginIntegrity): boolean;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 能力包完整性(P4-T4 · 权威实现)—— 纯 TypeScript SHA-256,零依赖(无 node:crypto)。
|
|
3
|
+
*
|
|
4
|
+
* 为什么不用 node:crypto:内核边界 = 零运行时依赖 + 零 node 类型依赖(浏览器/边缘可用,
|
|
5
|
+
* 五高之高可用);正确性由契约套件交叉断言——scripts/check-plugins.mjs 以 node:crypto
|
|
6
|
+
* 独立实现同构算法,两实现(同输入恒同摘要)不一致即门禁失败。
|
|
7
|
+
*
|
|
8
|
+
* canonical 摘要算法:
|
|
9
|
+
* 1. entries 按 (kind, ref) 字典序排序;
|
|
10
|
+
* 2. 逐项 sha256(`${kind}\u0000${ref}\u0000${payload}`) 取 hex;
|
|
11
|
+
* 3. 以 '\n' 连接各项 hex,对连接串再取 sha256 hex 即 digest。
|
|
12
|
+
*
|
|
13
|
+
* skills / prompts(文件产物类)payload = 引用文件内容;
|
|
14
|
+
* mcp-servers / policies(声明类)payload = ref 字符串本身。
|
|
15
|
+
*/
|
|
16
|
+
/** 摘要算法固定值(包清单 integrity.algorithm 必须声明该值)。 */
|
|
17
|
+
export const PLUGIN_DIGEST_ALGORITHM = 'sha256';
|
|
18
|
+
/** SHA-256 轮常数 K:前 64 个素数的立方根小数部分前 32 位(FIPS 180-4 §4.2.2)。 */
|
|
19
|
+
const K = new Uint32Array([
|
|
20
|
+
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
|
21
|
+
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
|
22
|
+
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
23
|
+
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
|
24
|
+
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
|
25
|
+
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
26
|
+
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
|
27
|
+
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
|
|
28
|
+
]);
|
|
29
|
+
const rotr = (x, n) => (x >>> n) | (x << (32 - n));
|
|
30
|
+
/** 纯 TS SHA-256:UTF-8 输入 → 64 位小写 hex(FIPS 180-4)。 */
|
|
31
|
+
export function sha256Hex(text) {
|
|
32
|
+
const bytes = new TextEncoder().encode(text);
|
|
33
|
+
const bitLen = bytes.length * 8;
|
|
34
|
+
// 填充:原文 + 0x80 + 0x00… + 64 位大端长度(总长 ≡ 0 mod 64)
|
|
35
|
+
const padded = new Uint8Array((((bytes.length + 8) >> 6) + 1) << 6);
|
|
36
|
+
padded.set(bytes);
|
|
37
|
+
padded[bytes.length] = 0x80;
|
|
38
|
+
const dv = new DataView(padded.buffer);
|
|
39
|
+
dv.setUint32(padded.length - 4, bitLen >>> 0);
|
|
40
|
+
dv.setUint32(padded.length - 8, Math.floor(bitLen / 0x100000000));
|
|
41
|
+
let h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a;
|
|
42
|
+
let h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19;
|
|
43
|
+
const w = new Uint32Array(64);
|
|
44
|
+
for (let off = 0; off < padded.length; off += 64) {
|
|
45
|
+
for (let i = 0; i < 16; i += 1)
|
|
46
|
+
w[i] = dv.getUint32(off + i * 4);
|
|
47
|
+
for (let i = 16; i < 64; i += 1) {
|
|
48
|
+
const s0 = rotr(w[i - 15], 7) ^ rotr(w[i - 15], 18) ^ (w[i - 15] >>> 3);
|
|
49
|
+
const s1 = rotr(w[i - 2], 17) ^ rotr(w[i - 2], 19) ^ (w[i - 2] >>> 10);
|
|
50
|
+
w[i] = (w[i - 16] + s0 + w[i - 7] + s1) >>> 0;
|
|
51
|
+
}
|
|
52
|
+
let a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7;
|
|
53
|
+
for (let i = 0; i < 64; i += 1) {
|
|
54
|
+
const S1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
55
|
+
const ch = (e & f) ^ (~e & g);
|
|
56
|
+
const t1 = (h + S1 + ch + K[i] + w[i]) >>> 0;
|
|
57
|
+
const S0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
|
|
58
|
+
const maj = (a & b) ^ (a & c) ^ (b & c);
|
|
59
|
+
const t2 = (S0 + maj) >>> 0;
|
|
60
|
+
h = g;
|
|
61
|
+
g = f;
|
|
62
|
+
f = e;
|
|
63
|
+
e = (d + t1) >>> 0;
|
|
64
|
+
d = c;
|
|
65
|
+
c = b;
|
|
66
|
+
b = a;
|
|
67
|
+
a = (t1 + t2) >>> 0;
|
|
68
|
+
}
|
|
69
|
+
h0 = (h0 + a) >>> 0;
|
|
70
|
+
h1 = (h1 + b) >>> 0;
|
|
71
|
+
h2 = (h2 + c) >>> 0;
|
|
72
|
+
h3 = (h3 + d) >>> 0;
|
|
73
|
+
h4 = (h4 + e) >>> 0;
|
|
74
|
+
h5 = (h5 + f) >>> 0;
|
|
75
|
+
h6 = (h6 + g) >>> 0;
|
|
76
|
+
h7 = (h7 + h) >>> 0;
|
|
77
|
+
}
|
|
78
|
+
return [h0, h1, h2, h3, h4, h5, h6, h7].map((x) => x.toString(16).padStart(8, '0')).join('');
|
|
79
|
+
}
|
|
80
|
+
/** canonical 化:按 (kind, ref) 排序后逐项哈希,返回待连接的 hex 行。 */
|
|
81
|
+
export function canonicalDigestLines(entries) {
|
|
82
|
+
const sorted = [...entries].sort((a, b) => a.kind === b.kind ? (a.ref < b.ref ? -1 : a.ref > b.ref ? 1 : 0) : a.kind < b.kind ? -1 : 1);
|
|
83
|
+
return sorted.map((e) => sha256Hex(`${e.kind}\u0000${e.ref}\u0000${e.payload}`));
|
|
84
|
+
}
|
|
85
|
+
/** 计算能力包 canonical 摘要(64 位小写 hex)。 */
|
|
86
|
+
export function computePluginDigest(entries) {
|
|
87
|
+
return sha256Hex(canonicalDigestLines(entries).join('\n'));
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* 比对实算摘要与包清单声明——篡改即失败。
|
|
91
|
+
* 算法不匹配视为失败(防降级);空 entries 允许(空包恒空摘要)。
|
|
92
|
+
*/
|
|
93
|
+
export function verifyPluginDigest(entries, declared) {
|
|
94
|
+
if (declared.algorithm !== PLUGIN_DIGEST_ALGORITHM)
|
|
95
|
+
return false;
|
|
96
|
+
if (!/^[0-9a-f]{64}$/.test(declared.digest))
|
|
97
|
+
return false;
|
|
98
|
+
return computePluginDigest(entries) === declared.digest;
|
|
99
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 能力包装载器(P4-T2 · plugin-loader)—— 仅「注册」不「执行」。
|
|
3
|
+
*
|
|
4
|
+
* 边界(演进指导 §4.3 红线):
|
|
5
|
+
* - 不做动态 import()、不做远程安装、不引 vm 沙箱;
|
|
6
|
+
* - 无 IO:清单由部署侧解析后注入(register / registerAll);
|
|
7
|
+
* - fail-fast:格式非法(id / version / scope / contents.type)即抛,绝不静默收编;
|
|
8
|
+
* - 确定性:list 按 id 升序返回。
|
|
9
|
+
*/
|
|
10
|
+
import { type PluginContentType, type PluginManifest } from './catalog.js';
|
|
11
|
+
/** 返回清单的全部格式错误(空数组 = 合法)。 */
|
|
12
|
+
export declare function pluginManifestErrors(manifest: PluginManifest): string[];
|
|
13
|
+
/** 能力归属(loader 视角的展开项)。 */
|
|
14
|
+
export interface LoaderCapability {
|
|
15
|
+
type: PluginContentType;
|
|
16
|
+
ref: string;
|
|
17
|
+
pluginId: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 能力包注册表:register → query,仅此而已。
|
|
21
|
+
* 「装载」语义止步于内存注册——执行由既有运行时(mcp-server / SkillRegistry)承接。
|
|
22
|
+
*/
|
|
23
|
+
export declare class PluginLoader {
|
|
24
|
+
private readonly byId;
|
|
25
|
+
/** 注册单个能力包;重复 id 或格式非法即抛。 */
|
|
26
|
+
register(manifest: PluginManifest): void;
|
|
27
|
+
/** 批量注册(数组序,重复 id 即抛)。 */
|
|
28
|
+
registerAll(manifests: readonly PluginManifest[]): void;
|
|
29
|
+
/** 生效清单(id 升序,确定性)。 */
|
|
30
|
+
list(): readonly PluginManifest[];
|
|
31
|
+
/** 按 id 查询。 */
|
|
32
|
+
get(id: string): PluginManifest | undefined;
|
|
33
|
+
/** 已注册能力包数量。 */
|
|
34
|
+
get size(): number;
|
|
35
|
+
/** 展开全部注册能力(type → ref → pluginId 稳定排序)。 */
|
|
36
|
+
capabilities(): readonly LoaderCapability[];
|
|
37
|
+
/** 按类型过滤注册能力。 */
|
|
38
|
+
capabilitiesOf(type: PluginContentType): readonly LoaderCapability[];
|
|
39
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 能力包装载器(P4-T2 · plugin-loader)—— 仅「注册」不「执行」。
|
|
3
|
+
*
|
|
4
|
+
* 边界(演进指导 §4.3 红线):
|
|
5
|
+
* - 不做动态 import()、不做远程安装、不引 vm 沙箱;
|
|
6
|
+
* - 无 IO:清单由部署侧解析后注入(register / registerAll);
|
|
7
|
+
* - fail-fast:格式非法(id / version / scope / contents.type)即抛,绝不静默收编;
|
|
8
|
+
* - 确定性:list 按 id 升序返回。
|
|
9
|
+
*/
|
|
10
|
+
import { PLUGIN_CONTENT_TYPES } from './catalog.js';
|
|
11
|
+
const ID_RE = /^[a-z0-9][a-z0-9-]*$/;
|
|
12
|
+
const VERSION_RE = /^\d+\.\d+\.\d+$/;
|
|
13
|
+
const SCOPES = ['builtin', 'local'];
|
|
14
|
+
const REF_RE = /^[a-z0-9][a-z0-9./_-]*$/;
|
|
15
|
+
/** 返回清单的全部格式错误(空数组 = 合法)。 */
|
|
16
|
+
export function pluginManifestErrors(manifest) {
|
|
17
|
+
const errors = [];
|
|
18
|
+
if (!manifest.id)
|
|
19
|
+
errors.push('缺 id');
|
|
20
|
+
else if (!ID_RE.test(manifest.id))
|
|
21
|
+
errors.push(`id 命名不合规:${manifest.id}`);
|
|
22
|
+
if (!VERSION_RE.test(manifest.version ?? ''))
|
|
23
|
+
errors.push(`缺语义化 version:${manifest.version}`);
|
|
24
|
+
if (!SCOPES.includes(manifest.scope))
|
|
25
|
+
errors.push(`scope 非法:${String(manifest.scope)}`);
|
|
26
|
+
const contents = manifest.contents ?? [];
|
|
27
|
+
for (const group of contents) {
|
|
28
|
+
if (!PLUGIN_CONTENT_TYPES.includes(group.type)) {
|
|
29
|
+
errors.push(`contents.type 非法:${String(group.type)}`);
|
|
30
|
+
}
|
|
31
|
+
for (const ref of group.refs ?? []) {
|
|
32
|
+
if (!REF_RE.test(ref))
|
|
33
|
+
errors.push(`引用格式不合规:${ref}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return errors;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 能力包注册表:register → query,仅此而已。
|
|
40
|
+
* 「装载」语义止步于内存注册——执行由既有运行时(mcp-server / SkillRegistry)承接。
|
|
41
|
+
*/
|
|
42
|
+
export class PluginLoader {
|
|
43
|
+
byId = new Map();
|
|
44
|
+
/** 注册单个能力包;重复 id 或格式非法即抛。 */
|
|
45
|
+
register(manifest) {
|
|
46
|
+
const errors = pluginManifestErrors(manifest);
|
|
47
|
+
if (errors.length > 0) {
|
|
48
|
+
throw new Error(`能力包清单非法(${manifest.id ?? '<no-id>'}):${errors.join(';')}`);
|
|
49
|
+
}
|
|
50
|
+
if (this.byId.has(manifest.id)) {
|
|
51
|
+
throw new Error(`能力包重复注册:${manifest.id}(跨 scope 覆盖请走 catalog 合并,见 buildCapabilityCatalog)`);
|
|
52
|
+
}
|
|
53
|
+
this.byId.set(manifest.id, manifest);
|
|
54
|
+
}
|
|
55
|
+
/** 批量注册(数组序,重复 id 即抛)。 */
|
|
56
|
+
registerAll(manifests) {
|
|
57
|
+
for (const m of manifests)
|
|
58
|
+
this.register(m);
|
|
59
|
+
}
|
|
60
|
+
/** 生效清单(id 升序,确定性)。 */
|
|
61
|
+
list() {
|
|
62
|
+
return [...this.byId.values()].sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
|
|
63
|
+
}
|
|
64
|
+
/** 按 id 查询。 */
|
|
65
|
+
get(id) {
|
|
66
|
+
return this.byId.get(id);
|
|
67
|
+
}
|
|
68
|
+
/** 已注册能力包数量。 */
|
|
69
|
+
get size() {
|
|
70
|
+
return this.byId.size;
|
|
71
|
+
}
|
|
72
|
+
/** 展开全部注册能力(type → ref → pluginId 稳定排序)。 */
|
|
73
|
+
capabilities() {
|
|
74
|
+
const out = [];
|
|
75
|
+
for (const m of this.list()) {
|
|
76
|
+
for (const group of m.contents ?? []) {
|
|
77
|
+
for (const ref of group.refs) {
|
|
78
|
+
out.push({ type: group.type, ref, pluginId: m.id });
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
out.sort((a, b) => a.type === b.type ? (a.ref === b.ref ? (a.pluginId < b.pluginId ? -1 : 1) : a.ref < b.ref ? -1 : 1) : a.type < b.type ? -1 : 1);
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
/** 按类型过滤注册能力。 */
|
|
86
|
+
capabilitiesOf(type) {
|
|
87
|
+
return this.capabilities().filter((c) => c.type === type);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A2A 适配层 · Card 发现(card-discovery · P2-T2)—— 「治」支柱生态外挂。
|
|
3
|
+
* 职责:`/.well-known/agent-card.json` 路径映射 + 内存 Card 注册表(发现/枚举)。
|
|
4
|
+
* 边界:**纯内存 stub,零网络**——真实发现由部署侧 transport 完成;
|
|
5
|
+
* card 形态复用 assets/agent-cards/(8 张既有卡,schema 对齐 A2A)。
|
|
6
|
+
* 红线:零运行时依赖;不 import family-agents。
|
|
7
|
+
*/
|
|
8
|
+
/** Agent Card(与 assets/agent-cards/*.json 的 agentCard 字段同构,最小契约面)。 */
|
|
9
|
+
export interface A2aAgentCard {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly description: string;
|
|
12
|
+
/** 服务基址(如 https://matrix.yyc3.top/family/tianshu)。 */
|
|
13
|
+
readonly url: string;
|
|
14
|
+
readonly version: string;
|
|
15
|
+
readonly skills: readonly {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly description: string;
|
|
19
|
+
}[];
|
|
20
|
+
}
|
|
21
|
+
/** A2A 1.0 规范的 well-known 发现路径。 */
|
|
22
|
+
export declare const WELL_KNOWN_PATH = "/.well-known/agent-card.json";
|
|
23
|
+
/** 由服务基址推导 well-known 发现 URL(P2 本轮补充建议:直接映射,不新建格式)。 */
|
|
24
|
+
export declare function wellKnownPath(baseUrl: string): string;
|
|
25
|
+
/** 从 card.url 提取 slug(末段)。 */
|
|
26
|
+
export declare function slugOf(card: A2aAgentCard): string;
|
|
27
|
+
/**
|
|
28
|
+
* 内存 Card 注册表(发现/枚举;零网络)。
|
|
29
|
+
* 登记:部署侧把已发现的 card 装入;发现:按 slug 或能力 id 检索。
|
|
30
|
+
*/
|
|
31
|
+
export declare class CardDirectory {
|
|
32
|
+
private readonly bySlug;
|
|
33
|
+
register(card: A2aAgentCard): A2aAgentCard;
|
|
34
|
+
/** 按 slug 发现(A2A card 发现语义)。 */
|
|
35
|
+
discover(slug: string): A2aAgentCard | undefined;
|
|
36
|
+
/** 按能力(技能)id 找到可委托的 card(跨家人委托入口)。 */
|
|
37
|
+
findByCapability(skillId: string): A2aAgentCard | undefined;
|
|
38
|
+
list(): readonly A2aAgentCard[];
|
|
39
|
+
get size(): number;
|
|
40
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A2A 适配层 · Card 发现(card-discovery · P2-T2)—— 「治」支柱生态外挂。
|
|
3
|
+
* 职责:`/.well-known/agent-card.json` 路径映射 + 内存 Card 注册表(发现/枚举)。
|
|
4
|
+
* 边界:**纯内存 stub,零网络**——真实发现由部署侧 transport 完成;
|
|
5
|
+
* card 形态复用 assets/agent-cards/(8 张既有卡,schema 对齐 A2A)。
|
|
6
|
+
* 红线:零运行时依赖;不 import family-agents。
|
|
7
|
+
*/
|
|
8
|
+
/** A2A 1.0 规范的 well-known 发现路径。 */
|
|
9
|
+
export const WELL_KNOWN_PATH = '/.well-known/agent-card.json';
|
|
10
|
+
/** 由服务基址推导 well-known 发现 URL(P2 本轮补充建议:直接映射,不新建格式)。 */
|
|
11
|
+
export function wellKnownPath(baseUrl) {
|
|
12
|
+
return `${baseUrl.replace(/\/+$/, '')}${WELL_KNOWN_PATH}`;
|
|
13
|
+
}
|
|
14
|
+
/** 从 card.url 提取 slug(末段)。 */
|
|
15
|
+
export function slugOf(card) {
|
|
16
|
+
const parts = card.url.replace(/\/+$/, '').split('/');
|
|
17
|
+
return parts[parts.length - 1] ?? '';
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 内存 Card 注册表(发现/枚举;零网络)。
|
|
21
|
+
* 登记:部署侧把已发现的 card 装入;发现:按 slug 或能力 id 检索。
|
|
22
|
+
*/
|
|
23
|
+
export class CardDirectory {
|
|
24
|
+
bySlug = new Map();
|
|
25
|
+
register(card) {
|
|
26
|
+
this.bySlug.set(slugOf(card), card);
|
|
27
|
+
return card;
|
|
28
|
+
}
|
|
29
|
+
/** 按 slug 发现(A2A card 发现语义)。 */
|
|
30
|
+
discover(slug) {
|
|
31
|
+
return this.bySlug.get(slug);
|
|
32
|
+
}
|
|
33
|
+
/** 按能力(技能)id 找到可委托的 card(跨家人委托入口)。 */
|
|
34
|
+
findByCapability(skillId) {
|
|
35
|
+
for (const card of this.bySlug.values()) {
|
|
36
|
+
if (card.skills.some((s) => s.id === skillId))
|
|
37
|
+
return card;
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
list() {
|
|
42
|
+
return [...this.bySlug.values()];
|
|
43
|
+
}
|
|
44
|
+
get size() {
|
|
45
|
+
return this.bySlug.size;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A2A 适配层 · 任务委托(task-delegate · P2-T2)—— 「治」支柱生态外挂。
|
|
3
|
+
* 职责:JSON-RPC 2.0 委托请求构造 + 结果归一;失败(超时 / 非法响应 / 上游 error)
|
|
4
|
+
* **不向委托方抛出**,归一为 DeadLetter 入有界 FIFO(同构 EventBus DLQ 语义),
|
|
5
|
+
* 并经 `onDeadLetter` 回调供自愈中心消费。
|
|
6
|
+
* 边界:**纯内存 stub,零网络**——transport 由注入提供(生产装配 HTTP,测试注入 fake);
|
|
7
|
+
* traceId 贯穿(对齐 P1-T3:「MCP/A2A 调用携带同一 traceId 并可查询」)。
|
|
8
|
+
* 红线:零运行时依赖;不 import family-agents;不真正发起 IO。
|
|
9
|
+
*/
|
|
10
|
+
/** 委托请求(调用方语义)。 */
|
|
11
|
+
export interface DelegateRequest {
|
|
12
|
+
/** 目标能力(manifest 技能 id,如 shared.a2a-delegate 的对端能力)。 */
|
|
13
|
+
readonly skillId: string;
|
|
14
|
+
/** 任务输入(结构化载荷)。 */
|
|
15
|
+
readonly input: Readonly<Record<string, unknown>>;
|
|
16
|
+
/** 链路追踪 id(贯穿到外部调用链)。 */
|
|
17
|
+
readonly traceId: string;
|
|
18
|
+
}
|
|
19
|
+
/** 归一结果(委托方只认这一种形态)。 */
|
|
20
|
+
export interface DelegateResult {
|
|
21
|
+
readonly ok: boolean;
|
|
22
|
+
/** 目标 card slug(ok=true 时存在)。 */
|
|
23
|
+
readonly slug?: string;
|
|
24
|
+
/** 归一任务句柄(ok=true 时存在)。 */
|
|
25
|
+
readonly task?: {
|
|
26
|
+
readonly taskId: string;
|
|
27
|
+
readonly state: string;
|
|
28
|
+
};
|
|
29
|
+
/** 失败原因(ok=false 时存在)。 */
|
|
30
|
+
readonly reason?: string;
|
|
31
|
+
readonly traceId: string;
|
|
32
|
+
}
|
|
33
|
+
/** 死信(同构 EventBus DeadLetter:重试/传输耗尽的任务归档)。 */
|
|
34
|
+
export interface A2aDeadLetter {
|
|
35
|
+
readonly topic: 'a2a.delegate.failed';
|
|
36
|
+
readonly reason: string;
|
|
37
|
+
readonly ts: number;
|
|
38
|
+
readonly request: DelegateRequest;
|
|
39
|
+
/** 目标 slug(可达 card 时存在)。 */
|
|
40
|
+
readonly slug?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 传输接口(注入式,零网络 stub)。
|
|
44
|
+
* 生产:HTTP POST JSON-RPC;测试:注入 fake(成功 / 抛超时 / 返回非法体)。
|
|
45
|
+
*/
|
|
46
|
+
export interface A2aTransport {
|
|
47
|
+
/** 发送 JSON-RPC 请求体,返回响应体;失败可抛错(如超时)。 */
|
|
48
|
+
send(url: string, body: string): Promise<string>;
|
|
49
|
+
}
|
|
50
|
+
/** 委托客户端依赖(可注入)。 */
|
|
51
|
+
export interface DelegateClientDeps {
|
|
52
|
+
/** card 注册表(findByCapability 定位目标)。 */
|
|
53
|
+
readonly directory: import('./card-discovery.js').CardDirectory;
|
|
54
|
+
/** 传输实现(注入式)。 */
|
|
55
|
+
readonly transport: A2aTransport;
|
|
56
|
+
/** 单调时钟(可注入,测试冻结)。 */
|
|
57
|
+
readonly now?: () => number;
|
|
58
|
+
/** 请求 id 生成(默认递增)。 */
|
|
59
|
+
readonly nextId?: () => string;
|
|
60
|
+
/** 死信回调(装配层可接 EventBus / 自愈中心)。 */
|
|
61
|
+
readonly onDeadLetter?: (letter: A2aDeadLetter) => void;
|
|
62
|
+
/** DLQ 容量上限,默认 100,超限淘汰最旧。 */
|
|
63
|
+
readonly dlqCapacity?: number;
|
|
64
|
+
}
|
|
65
|
+
/** A2A 1.0 标准委托 method(message/send → task)。 */
|
|
66
|
+
export declare const A2A_METHOD = "message/send";
|
|
67
|
+
/** 任务委托客户端(统一拦截后的外呼出口)。 */
|
|
68
|
+
export declare class DelegateClient {
|
|
69
|
+
private readonly deps;
|
|
70
|
+
private readonly deadQueue;
|
|
71
|
+
private readonly dlqCapacity;
|
|
72
|
+
private seq;
|
|
73
|
+
constructor(deps: DelegateClientDeps);
|
|
74
|
+
/** 死信快照(自愈中心消费)。 */
|
|
75
|
+
deadLetters(): readonly A2aDeadLetter[];
|
|
76
|
+
/**
|
|
77
|
+
* 委托一次任务:能力定位 → JSON-RPC 构造 → 传输 → 归一。
|
|
78
|
+
* 任何失败路径都归一为 `{ok:false}` 并入 DLQ,不向委托方抛出。
|
|
79
|
+
*/
|
|
80
|
+
delegate(req: DelegateRequest): Promise<DelegateResult>;
|
|
81
|
+
/** 响应归一:JSON-RPC result → 任务句柄;error / 非法体 → 失败。 */
|
|
82
|
+
private normalize;
|
|
83
|
+
/** 失败归档:入有界 DLQ(超限淘汰最旧)+ 回调,不抛出。 */
|
|
84
|
+
private dead;
|
|
85
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A2A 适配层 · 任务委托(task-delegate · P2-T2)—— 「治」支柱生态外挂。
|
|
3
|
+
* 职责:JSON-RPC 2.0 委托请求构造 + 结果归一;失败(超时 / 非法响应 / 上游 error)
|
|
4
|
+
* **不向委托方抛出**,归一为 DeadLetter 入有界 FIFO(同构 EventBus DLQ 语义),
|
|
5
|
+
* 并经 `onDeadLetter` 回调供自愈中心消费。
|
|
6
|
+
* 边界:**纯内存 stub,零网络**——transport 由注入提供(生产装配 HTTP,测试注入 fake);
|
|
7
|
+
* traceId 贯穿(对齐 P1-T3:「MCP/A2A 调用携带同一 traceId 并可查询」)。
|
|
8
|
+
* 红线:零运行时依赖;不 import family-agents;不真正发起 IO。
|
|
9
|
+
*/
|
|
10
|
+
/** A2A 1.0 标准委托 method(message/send → task)。 */
|
|
11
|
+
export const A2A_METHOD = 'message/send';
|
|
12
|
+
/** 任务委托客户端(统一拦截后的外呼出口)。 */
|
|
13
|
+
export class DelegateClient {
|
|
14
|
+
deps;
|
|
15
|
+
deadQueue = [];
|
|
16
|
+
dlqCapacity;
|
|
17
|
+
seq = 0;
|
|
18
|
+
constructor(deps) {
|
|
19
|
+
this.deps = deps;
|
|
20
|
+
this.dlqCapacity = Math.max(1, Math.trunc(deps.dlqCapacity ?? 100));
|
|
21
|
+
}
|
|
22
|
+
/** 死信快照(自愈中心消费)。 */
|
|
23
|
+
deadLetters() {
|
|
24
|
+
return [...this.deadQueue];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 委托一次任务:能力定位 → JSON-RPC 构造 → 传输 → 归一。
|
|
28
|
+
* 任何失败路径都归一为 `{ok:false}` 并入 DLQ,不向委托方抛出。
|
|
29
|
+
*/
|
|
30
|
+
async delegate(req) {
|
|
31
|
+
const now = this.deps.now ?? Date.now;
|
|
32
|
+
const card = this.deps.directory.findByCapability(req.skillId);
|
|
33
|
+
if (!card) {
|
|
34
|
+
return this.dead(req, `无 card 声明能力 ${req.skillId}(card 目录 ${this.deps.directory.size} 张)`, now());
|
|
35
|
+
}
|
|
36
|
+
const slug = card.url.replace(/\/+$/, '').split('/').pop() ?? '';
|
|
37
|
+
// W3C traceparent 外发(M21 关联维):traceId 为原生 32hex 时附带标准头(spanId 取本委托序号),否则不造假格式
|
|
38
|
+
const w3cTrace = /^[0-9a-f]{32}$/.test(req.traceId) ? req.traceId : undefined;
|
|
39
|
+
const traceparent = w3cTrace
|
|
40
|
+
? `00-${w3cTrace}-${(this.seq + 1).toString(16).padStart(16, '0')}-01`
|
|
41
|
+
: undefined;
|
|
42
|
+
let raw;
|
|
43
|
+
try {
|
|
44
|
+
raw = await this.deps.transport.send(card.url, JSON.stringify({
|
|
45
|
+
jsonrpc: '2.0',
|
|
46
|
+
id: this.deps.nextId ? this.deps.nextId() : `a2a-${++this.seq}`,
|
|
47
|
+
method: A2A_METHOD,
|
|
48
|
+
params: { skillId: req.skillId, input: req.input, traceId: req.traceId, ...(traceparent ? { traceparent } : {}) },
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
return this.dead(req, `传输失败(超时/网络):${error instanceof Error ? error.message : String(error)}`, now(), slug);
|
|
53
|
+
}
|
|
54
|
+
const parsed = this.normalize(raw, req.traceId);
|
|
55
|
+
if (!parsed.ok) {
|
|
56
|
+
return this.dead(req, parsed.reason ?? '非法响应', now(), slug);
|
|
57
|
+
}
|
|
58
|
+
return { ok: true, slug, task: parsed.task, traceId: req.traceId };
|
|
59
|
+
}
|
|
60
|
+
/** 响应归一:JSON-RPC result → 任务句柄;error / 非法体 → 失败。 */
|
|
61
|
+
normalize(raw, traceId) {
|
|
62
|
+
let body;
|
|
63
|
+
try {
|
|
64
|
+
body = JSON.parse(raw);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return { ok: false, reason: '非法响应:非 JSON 体' };
|
|
68
|
+
}
|
|
69
|
+
if (!body || typeof body !== 'object')
|
|
70
|
+
return { ok: false, reason: '非法响应:非对象体' };
|
|
71
|
+
const record = body;
|
|
72
|
+
if (record.error) {
|
|
73
|
+
const err = record.error;
|
|
74
|
+
return { ok: false, reason: `上游错误 ${String(err.code ?? '?')}:${String(err.message ?? '')}` };
|
|
75
|
+
}
|
|
76
|
+
const result = (record.result ?? record);
|
|
77
|
+
const taskId = result.taskId ?? result.id;
|
|
78
|
+
const state = result.state ?? result.status;
|
|
79
|
+
if (typeof taskId !== 'string' || taskId.length === 0)
|
|
80
|
+
return { ok: false, reason: '非法响应:缺任务 id' };
|
|
81
|
+
if (typeof state !== 'string' || state.length === 0)
|
|
82
|
+
return { ok: false, reason: '非法响应:缺任务状态' };
|
|
83
|
+
return { ok: true, task: { taskId, state } };
|
|
84
|
+
}
|
|
85
|
+
/** 失败归档:入有界 DLQ(超限淘汰最旧)+ 回调,不抛出。 */
|
|
86
|
+
dead(req, reason, ts, slug) {
|
|
87
|
+
const letter = { topic: 'a2a.delegate.failed', reason, ts, request: req, ...(slug ? { slug } : {}) };
|
|
88
|
+
if (this.deadQueue.length >= this.dlqCapacity)
|
|
89
|
+
this.deadQueue.shift();
|
|
90
|
+
this.deadQueue.push(letter);
|
|
91
|
+
this.deps.onDeadLetter?.(letter);
|
|
92
|
+
return { ok: false, ...(slug ? { slug } : {}), reason, traceId: req.traceId };
|
|
93
|
+
}
|
|
94
|
+
}
|