chainlesschain 0.166.17 → 0.166.20
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 +14 -7
- package/package.json +2 -2
- package/src/assets/web-panel/assets/{AIOps-CVW2n2rh.js → AIOps-CcJst5Zs.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-DtuM163O.js → ActionButton-BpHPFKd3.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-BXvl_qHu.js → Analytics-DHAsASuS.js} +3 -3
- package/src/assets/web-panel/assets/{AppLayout-VDBTFKOp.js → AppLayout-BTKwo5RC.js} +3 -3
- package/src/assets/web-panel/assets/{Artifacts-BNz2xCiG.js → Artifacts-BcCBTggA.js} +1 -1
- package/src/assets/web-panel/assets/{Audit-DTu9Hn9P.js → Audit-z1JvJYbT.js} +1 -1
- package/src/assets/web-panel/assets/{BackgroundAgents-D2OCPzLe.js → BackgroundAgents-CJ7DCMDR.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-C9M-vG7G.js → Backup-CKpxw4uw.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-BUkCNiUQ.js → BaseInput-2jI_IlUB.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-OJ2ajF7l.js → Chat-C_4RfBeN.js} +5 -5
- package/src/assets/web-panel/assets/ChatBubbleRenderer-eMmw1eZF.js +1 -0
- package/src/assets/web-panel/assets/{Checkbox-C1gXKDsc.js → Checkbox-BnF4z4N1.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-BXbznLg7.js → Codegen-m_LMamhM.js} +1 -1
- package/src/assets/web-panel/assets/{Col-CbCq5N0i.js → Col-DzMbA760.js} +1 -1
- package/src/assets/web-panel/assets/{Community-V8Ks6Yun.js → Community-SScuZUcW.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-DkeHQTpQ.js → Compact-CiOHRvwQ.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-JeLKwn4Q.js → Compliance-97FzYz-6.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-azfetcBz.js → Cowork-C0ss-SRl.js} +3 -3
- package/src/assets/web-panel/assets/{Cron-Q691i_Gp.js → Cron-CCbdc9fp.js} +2 -2
- package/src/assets/web-panel/assets/{Crosschain-BLjDRbr_.js → Crosschain-BPnabXej.js} +1 -1
- package/src/assets/web-panel/assets/{DID-D8ptXplK.js → DID-B65hFnHs.js} +2 -2
- package/src/assets/web-panel/assets/{Dashboard-Ctj2VVZL.js → Dashboard-B6qR_TF2.js} +2 -2
- package/src/assets/web-panel/assets/{Dropdown-D8VgkMJ8.js → Dropdown-6c-2Fxm-.js} +1 -1
- package/src/assets/web-panel/assets/{EmailListRenderer-CQPe5S6q.js → EmailListRenderer-GD57mfiz.js} +1 -1
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-ySA-7SiN.js → FamilyGuardDashboard-B2mxG6LN.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-1PMD-fBf.js → Federation-cZS-uvAo.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-C_jr6U4Q.js → FormItemContext-UbSfBIe1.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-Bu3bKf2B.js → GenericCardRenderer-BMAtvGt1.js} +1 -1
- package/src/assets/web-panel/assets/{Git-Dv4Fa_T5.js → Git-DAlhOiDA.js} +2 -2
- package/src/assets/web-panel/assets/{Governance-DOEy1n1k.js → Governance-B-RRVaP8.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-DkvqzWcJ.js → Inference-DBl-pXYR.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-DdUJK949.js → KnowledgeGraph-DjqOkvgY.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-CRelcdUZ.js → Logs-CEV7AEAD.js} +2 -2
- package/src/assets/web-panel/assets/{MarkdownRenderer-0AHbbTA4.js → MarkdownRenderer-BDCxa4d1.js} +1 -1
- package/src/assets/web-panel/assets/{Marketplace-BuuBKsev.js → Marketplace-oRjzfmYJ.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-DlgpEmA1.js → McpTools-BiTnznLw.js} +3 -3
- package/src/assets/web-panel/assets/{Memory-DTfdqUGy.js → Memory-DR0C5K4N.js} +2 -2
- package/src/assets/web-panel/assets/{MobileBridge-CXLE5ZFO.js → MobileBridge--oR8wEcp.js} +1 -1
- package/src/assets/web-panel/assets/{MobileProjects-Dz25OB0n.js → MobileProjects-DKqpYMuG.js} +1 -1
- package/src/assets/web-panel/assets/{Mtc-kEL0fhgD.js → Mtc-Dg0D6fDQ.js} +2 -2
- package/src/assets/web-panel/assets/{MtcAudit-BE4UvFJU.js → MtcAudit-D4_-yWTK.js} +2 -2
- package/src/assets/web-panel/assets/{Multisig-CSApSn8c.js → Multisig-Coz55FxA.js} +3 -3
- package/src/assets/web-panel/assets/{NLProgramming-D11FpKWx.js → NLProgramming-BWVjgW9Y.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-CDL-D2CS.js → Notes-BflVuGwr.js} +3 -3
- package/src/assets/web-panel/assets/{NotificationSettings-C0Q6lO-c.js → NotificationSettings-CT0F_dJ7.js} +1 -1
- package/src/assets/web-panel/assets/{OrderTableRenderer-ZRE0OKbj.js → OrderTableRenderer-Dyrnqy_o.js} +1 -1
- package/src/assets/web-panel/assets/{Organization-Dc-maVAq.js → Organization-CMDTM2z5.js} +4 -4
- package/src/assets/web-panel/assets/{Overflow-B5mUpSvi.js → Overflow-acKvvYpC.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-TjXV53wq.js → P2P-CRq5j9Ax.js} +2 -2
- package/src/assets/web-panel/assets/PdhVaultBrowser-DmtzN6Kn.js +7 -0
- package/src/assets/web-panel/assets/{Permissions-DKRzQ2O6.js → Permissions-SZ-kjJDa.js} +4 -4
- package/src/assets/web-panel/assets/{PersonalDataHub-Dx2eqft8.js → PersonalDataHub-DXh-ZfgJ.js} +6 -6
- package/src/assets/web-panel/assets/{Pipeline-CnYZMB5p.js → Pipeline-DhBU9ftP.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-BonKpPnp.js → Privacy-BgEXpO_V.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-DWO0Du3J.js → ProjectInit-B2DJ-dmK.js} +2 -2
- package/src/assets/web-panel/assets/{ProjectSettings-C9jqyYRv.js → ProjectSettings-ve3SocWc.js} +2 -2
- package/src/assets/web-panel/assets/{Projects-CYpKwXbz.js → Projects-5ZvFasSJ.js} +1 -1
- package/src/assets/web-panel/assets/{Providers-CW-fkwJq.js → Providers-C8fcF3BK.js} +1 -1
- package/src/assets/web-panel/assets/{QrScannerModal-Cw0J3Zud.js → QrScannerModal-unjO8lNO.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-BH4A4IpR.js → QuickAsk-BT1QtT7D.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-CDwMwJus.js → Recommend-BSjFrY1w.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-DKIPwzTf.js → RemoteSession-CWV0bICg.js} +2 -2
- package/src/assets/web-panel/assets/{Reputation-CklDj7qS.js → Reputation-BMjiMsk2.js} +1 -1
- package/src/assets/web-panel/assets/{Row-DJWZKsH0.js → Row-9XCY22PM.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-BfSLCewo.js → RssFeed-DQ9PDy7Q.js} +2 -2
- package/src/assets/web-panel/assets/{Search-B0IST--x.js → Search-Boym2HwG.js} +1 -1
- package/src/assets/web-panel/assets/{Security-h1sYNWtt.js → Security-Gbq3lGQb.js} +4 -4
- package/src/assets/web-panel/assets/{Services-Gh0-oxI_.js → Services-OcUfLdnu.js} +2 -2
- package/src/assets/web-panel/assets/{Skeleton-CNDV_jOs.js → Skeleton-BjTog6cA.js} +1 -1
- package/src/assets/web-panel/assets/{Skills-ByCLTh1n.js → Skills-Dny4ft_1.js} +1 -1
- package/src/assets/web-panel/assets/{Sla-BfyrJTJz.js → Sla-Cy_VnhpZ.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-BQzo9kNX.js → SpeechSettings-CrFuL_lp.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-B6fS6z_1.js → SyncSettings-k-FnjuOR.js} +2 -2
- package/src/assets/web-panel/assets/{Tasks-C-uKCP-l.js → Tasks-ZEqDSo0_.js} +1 -1
- package/src/assets/web-panel/assets/{Templates-D6oDy7wL.js → Templates-CYYksYV5.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-D3LT2wNQ.js → Tenant-BvTTRTHS.js} +1 -1
- package/src/assets/web-panel/assets/{Terminal-BteLcv_O.js → Terminal-DMOQOtkj.js} +2 -2
- package/src/assets/web-panel/assets/{TimelineRenderer-DHHuxfqH.js → TimelineRenderer-CnudkJxk.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-BRQeykXw.js → Tokens-VW6Wocdp.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-p2XaFWEu.js → Trigger-BtOxZqP6.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-BxadBMft.js → Trust-XcGJoTQx.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-DRBP7LDk.js → UkeySign-aASNCs5j.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-CZ3NZkh7.js → VideoEditing-Bz89M52u.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-C3NTBN7G.js → Wallet-uU4dSS_N.js} +4 -4
- package/src/assets/web-panel/assets/{WebAuthn-C7LVgMlb.js → WebAuthn-Brrroxgr.js} +2 -2
- package/src/assets/web-panel/assets/{WorkflowEditor-0_Iveog7.js → WorkflowEditor-Cny-evI9.js} +1 -1
- package/src/assets/web-panel/assets/{chat-DzzluYo3.js → chat-CJ5iSwWq.js} +1 -1
- package/src/assets/web-panel/assets/{colors-DSMYXpaj.js → colors-DWa-2flG.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-W76u1VSV.js → compact-item-DFwUfptU.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-otsESjb5.js → createContext-FHWWcyeB.js} +1 -1
- package/src/assets/web-panel/assets/devWarning-DxufPwXC.js +1 -0
- package/src/assets/web-panel/assets/{hasIn-3sNLrvug.js → hasIn-QY_TElrN.js} +1 -1
- package/src/assets/web-panel/assets/{index-CENWwjef.js → index-0umhind6.js} +1 -1
- package/src/assets/web-panel/assets/{index-B5LOYdYm.js → index-2ufsNuVn.js} +1 -1
- package/src/assets/web-panel/assets/{index-DdU7IkKX.js → index-B18zERdP.js} +1 -1
- package/src/assets/web-panel/assets/{index-CtFOt5x1.js → index-B33frlaD.js} +1 -1
- package/src/assets/web-panel/assets/{index-Cg86EzNp.js → index-BEjwv2x6.js} +1 -1
- package/src/assets/web-panel/assets/{index-uSCkbpZH.js → index-BQCtBurK.js} +1 -1
- package/src/assets/web-panel/assets/{index-BdtmEKat.js → index-BR4RMPnB.js} +1 -1
- package/src/assets/web-panel/assets/{index-ClOFeZ-t.js → index-BRsGZBHc.js} +1 -1
- package/src/assets/web-panel/assets/{index-C2aht9-M.js → index-BUNwuu5v.js} +1 -1
- package/src/assets/web-panel/assets/{index-B9X_jqXe.js → index-BYbwQ7SP.js} +1 -1
- package/src/assets/web-panel/assets/{index-DMmdIpLA.js → index-BcVr-LOk.js} +1 -1
- package/src/assets/web-panel/assets/{index-BpcQYzP7.js → index-Bd7McYpJ.js} +1 -1
- package/src/assets/web-panel/assets/{index-BA8mZxd-.js → index-BiHRihC0.js} +1 -1
- package/src/assets/web-panel/assets/{index-DTA8Iavv.js → index-C5F1vwec.js} +3 -3
- package/src/assets/web-panel/assets/{index-B1I1AYJs.js → index-CGv5In_T.js} +1 -1
- package/src/assets/web-panel/assets/{index-vBKPcmAP.js → index-CKS7n6mE.js} +1 -1
- package/src/assets/web-panel/assets/{index-NaO9AE-F.js → index-CUiTugu3.js} +1 -1
- package/src/assets/web-panel/assets/{index-CKoFyHYQ.js → index-CUoLd1dt.js} +1 -1
- package/src/assets/web-panel/assets/{index-DS9WYDMf.js → index-CeGn0A4W.js} +1 -1
- package/src/assets/web-panel/assets/{index-D7A5U2IH.js → index-CjejB-z9.js} +1 -1
- package/src/assets/web-panel/assets/{index-DmpaC2yk.js → index-CkmgbT7h.js} +1 -1
- package/src/assets/web-panel/assets/{index-vUmYkqmu.js → index-D-Mhq8K6.js} +1 -1
- package/src/assets/web-panel/assets/{index-DH4cl52p.js → index-D2rPJ6Sv.js} +1 -1
- package/src/assets/web-panel/assets/{index-GlIOE4ja.js → index-DCHMVYG1.js} +1 -1
- package/src/assets/web-panel/assets/{index-q7ftLqNt.js → index-DDpXDi4J.js} +1 -1
- package/src/assets/web-panel/assets/{index-MhQQ3h8q.js → index-DUepuy7O.js} +1 -1
- package/src/assets/web-panel/assets/{index-BRsD1PT2.js → index-DUfILsc-.js} +1 -1
- package/src/assets/web-panel/assets/{index-pVm_iUre.js → index-DaHvj4jA.js} +1 -1
- package/src/assets/web-panel/assets/{index-BcGJtmHM.js → index-Dlq-u9E4.js} +1 -1
- package/src/assets/web-panel/assets/{index-BJsQio5O.js → index-Dy2PnKZx.js} +1 -1
- package/src/assets/web-panel/assets/index-ZMTB9p5z.js +1 -0
- package/src/assets/web-panel/assets/index-_PvIDelE.js +1 -0
- package/src/assets/web-panel/assets/{index-CE7tSow-.js → index-aTiI7lOQ.js} +1 -1
- package/src/assets/web-panel/assets/{index-BXLx9HfA.js → index-hw1J_Oxs.js} +1 -1
- package/src/assets/web-panel/assets/{index-DZKAzEge.js → index-th467RN6.js} +1 -1
- package/src/assets/web-panel/assets/{index-UUHCwfNq.js → index-uRUZdL7I.js} +1 -1
- package/src/assets/web-panel/assets/{index-DLDh1OW3.js → index-va4Rt-yM.js} +1 -1
- package/src/assets/web-panel/assets/{index-BDlDO2px.js → index-w3SdYwaC.js} +1 -1
- package/src/assets/web-panel/assets/{index-Ddd4mird.js → index-wqiOz655.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-DF6llUXV.js → initDefaultProps-BeSPUFDz.js} +1 -1
- package/src/assets/web-panel/assets/{motion-vtDV8_5K.js → motion-Dcajvjm9.js} +1 -1
- package/src/assets/web-panel/assets/{move-B6c0bdy2.js → move-B76orau-.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-DlLYWuBK.js → mtc-parser-zB6yFwcX.js} +1 -1
- package/src/assets/web-panel/assets/{omit-BH0zOxLN.js → omit-BsbNjz8w.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-D9di8_In.js → pickAttrs-BiJ9tssQ.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-BDSngufM.js → placementArrow-BdfMjMeN.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-C_EawMvP.js → responsiveObserve-rV4LGpbU.js} +1 -1
- package/src/assets/web-panel/assets/{slide-B_4wShxA.js → slide-HsVw1qFQ.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-CbQu6qJ-.js → statusUtils-D1ry8XPE.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-CvXJWYXb.js → styleChecker-B1t6aQQ_.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-jjY1XknO.js → useFlexGapSupport-C8qbl-9w.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-CMXBdsK_.js → useFs-R7g_mYTC.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-YbAhhPXx.js → usePersonalDataHub-Cd-kCe7Z.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-BFCTKc0H.js → vnode-9WhK5UWA.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-CY9aBl5O.js → zoom-CUqppPco.js} +1 -1
- package/src/assets/web-panel/index.html +1 -1
- package/src/command-help-index.json +1 -1
- package/src/commands/agent.js +80 -2
- package/src/commands/evolution.js +33 -27
- package/src/commands/serve.js +11 -2
- package/src/data/changelog.json +18 -5
- package/src/gateways/ws/session-protocol.js +1 -0
- package/src/gateways/ws/ws-agent-handler.js +70 -2
- package/src/gateways/ws/ws-server.js +8 -0
- package/src/lib/app-server/cli-agent-kernel-adapter.js +4 -0
- package/src/lib/app-server/graph-runtime.js +115 -8
- package/src/lib/app-server/server.js +21 -2
- package/src/lib/app-server/websocket-transport.js +2 -0
- package/src/lib/evolution/agent-evolution-ingress.js +300 -0
- package/src/lib/evolution/agent-evolution-runtime-composition-brand.js +22 -0
- package/src/lib/evolution/agent-evolution-runtime-composition.js +369 -0
- package/src/lib/evolution/evidence-backed-wiki-maintainer.js +752 -0
- package/src/lib/evolution/evolution-artifact-ports.js +48 -0
- package/src/lib/evolution/evolution-eval-gate.js +11 -4
- package/src/lib/evolution/evolution-evidence-artifact-adapter.js +499 -0
- package/src/lib/evolution/evolution-evidence-projector.js +61 -1
- package/src/lib/evolution/evolution-file-witness.js +601 -0
- package/src/lib/evolution/evolution-ledger-file-backend.js +176 -0
- package/src/lib/evolution/evolution-ledger-ports.js +353 -16
- package/src/lib/evolution/evolution-ledger.js +1355 -54
- package/src/lib/evolution/evolution-run-ledger-adapter.js +409 -0
- package/src/lib/evolution/evolution-run-wiki-maintenance-source.js +300 -0
- package/src/lib/evolution/scheduled-batch-wiki-maintenance-source.js +368 -0
- package/src/lib/evolution/skill-candidate-registry.js +649 -0
- package/src/lib/evolution/skill-promotion-controller.js +109 -38
- package/src/lib/evolution/skill-promotion-review-ledger-adapter.js +451 -0
- package/src/lib/evolution/skill-promotion-review.js +793 -0
- package/src/lib/evolution/skill-registry-transition-capability.js +55 -0
- package/src/lib/evolution/skill-registry-transition-ledger-adapter.js +1280 -0
- package/src/lib/evolution/skill-registry-transition-source.js +372 -0
- package/src/lib/evolution/skill-release-registry.js +2191 -11
- package/src/lib/evolution/skill-target-matrix-eval.js +133 -10
- package/src/lib/evolution/structured-memory-agent-control-plane.js +222 -0
- package/src/lib/evolution/structured-memory-authority-ledger-adapter.js +351 -0
- package/src/lib/evolution/structured-memory-ledger-adapter.js +220 -0
- package/src/lib/evolution/structured-memory-policy-receipt-writer.js +164 -0
- package/src/lib/evolution/structured-memory-post-compact-hook.js +87 -0
- package/src/lib/evolution/structured-memory-promotion-receipt-writer.js +221 -0
- package/src/lib/evolution/structured-memory-semantic-review-pipeline.js +313 -0
- package/src/lib/evolution/wiki-maintainer-ledger-adapter.js +200 -0
- package/src/lib/evolution/wiki-maintenance-trigger-ledger-adapter.js +687 -0
- package/src/lib/evolution-system.js +65 -30
- package/src/lib/mcp-lifecycle-authority.js +21 -2
- package/src/lib/remote-approval-bridge.js +24 -0
- package/src/lib/scheduler-kernel/store.js +62 -14
- package/src/repl/agent-repl.js +45 -0
- package/src/runtime/agent-runtime.js +114 -1
- package/src/runtime/headless-runner.js +19 -0
- package/src/runtime/headless-stream.js +43 -0
- package/src/runtime/runtime-factory.js +19 -1
- package/src/assets/web-panel/assets/ChatBubbleRenderer-BdZt76Ab.js +0 -1
- package/src/assets/web-panel/assets/PdhVaultBrowser-DvV2btIr.js +0 -7
- package/src/assets/web-panel/assets/devWarning-BztaXF84.js +0 -1
- package/src/assets/web-panel/assets/index-4jP_hG_4.js +0 -1
- package/src/assets/web-panel/assets/index-zxwuAXL5.js +0 -1
- package/src/lib/learning/learning-hooks.js +0 -123
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Evolution metrics and governance-record commands
|
|
3
|
-
* chainlesschain evolution assess|
|
|
3
|
+
* chainlesschain evolution assess|record-model-metrics|diagnose|repair|predict|growth|stats|export
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import chalk from "chalk";
|
|
7
|
-
import { intArg
|
|
7
|
+
import { intArg } from "../lib/cli-arg.js";
|
|
8
8
|
import { numericOption } from "../lib/cli-numeric.js";
|
|
9
9
|
import ora from "ora";
|
|
10
10
|
import { logger } from "../lib/logger.js";
|
|
@@ -12,7 +12,7 @@ import { parseJsonOption } from "../lib/parse-json-option.js";
|
|
|
12
12
|
import { bootstrap, shutdown } from "../runtime/bootstrap.js";
|
|
13
13
|
import {
|
|
14
14
|
assessCapability,
|
|
15
|
-
|
|
15
|
+
recordIncrementalModelMetrics,
|
|
16
16
|
selfDiagnose,
|
|
17
17
|
selfRepair,
|
|
18
18
|
predictBehavior,
|
|
@@ -26,10 +26,9 @@ import {
|
|
|
26
26
|
REPAIR_STRATEGY,
|
|
27
27
|
GROWTH_MILESTONE,
|
|
28
28
|
assessCapabilityV2,
|
|
29
|
-
getCapabilityV2,
|
|
30
29
|
listCapabilitiesV2,
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
recordTrainingMetricsV2,
|
|
31
|
+
listTrainingMetricRecordsV2,
|
|
33
32
|
selfDiagnoseV2,
|
|
34
33
|
getDiagnosisV2,
|
|
35
34
|
listDiagnosesV2,
|
|
@@ -97,12 +96,12 @@ export function registerEvolutionCommand(program) {
|
|
|
97
96
|
}
|
|
98
97
|
});
|
|
99
98
|
|
|
100
|
-
// evolution
|
|
99
|
+
// evolution record-model-metrics <model-id>
|
|
101
100
|
evolution
|
|
102
|
-
.command("
|
|
103
|
-
.description("Record
|
|
101
|
+
.command("record-model-metrics")
|
|
102
|
+
.description("Record a synthetic model metric estimate (no training)")
|
|
104
103
|
.argument("<model-id>", "Model record ID")
|
|
105
|
-
.option("--data <json>", "
|
|
104
|
+
.option("--data <json>", "Observed data as JSON array")
|
|
106
105
|
.option(
|
|
107
106
|
"--type <type>",
|
|
108
107
|
"Model type (classification|regression)",
|
|
@@ -123,13 +122,13 @@ export function registerEvolutionCommand(program) {
|
|
|
123
122
|
if (options.data) {
|
|
124
123
|
try {
|
|
125
124
|
data = JSON.parse(options.data);
|
|
126
|
-
} catch
|
|
125
|
+
} catch {
|
|
127
126
|
// Use data string as single data point
|
|
128
127
|
data = [options.data];
|
|
129
128
|
}
|
|
130
129
|
}
|
|
131
130
|
|
|
132
|
-
const result =
|
|
131
|
+
const result = recordIncrementalModelMetrics(db, modelId, data, {
|
|
133
132
|
type: options.type,
|
|
134
133
|
});
|
|
135
134
|
spinner.succeed("Model metrics recorded");
|
|
@@ -139,8 +138,11 @@ export function registerEvolutionCommand(program) {
|
|
|
139
138
|
} else {
|
|
140
139
|
logger.log(chalk.bold(`Model: ${result.name}`));
|
|
141
140
|
logger.log(` Type: ${result.type}`);
|
|
142
|
-
logger.log(
|
|
141
|
+
logger.log(
|
|
142
|
+
` Formula Estimate: ${chalk.cyan(result.accuracy.toFixed(4))}`,
|
|
143
|
+
);
|
|
143
144
|
logger.log(` Data Points: ${result.dataPoints}`);
|
|
145
|
+
logger.log(` Training Performed: ${result.performedTraining}`);
|
|
144
146
|
}
|
|
145
147
|
|
|
146
148
|
await shutdown();
|
|
@@ -389,7 +391,7 @@ export function registerEvolutionCommand(program) {
|
|
|
389
391
|
// evolution export <model-id>
|
|
390
392
|
evolution
|
|
391
393
|
.command("export")
|
|
392
|
-
.description("Export a model for portability")
|
|
394
|
+
.description("Export a model metric record for portability")
|
|
393
395
|
.argument("<model-id>", "Model ID to export")
|
|
394
396
|
.option("--json", "Output as JSON")
|
|
395
397
|
.action(async (modelId, options) => {
|
|
@@ -512,20 +514,20 @@ export function registerEvolutionCommand(program) {
|
|
|
512
514
|
});
|
|
513
515
|
|
|
514
516
|
evolution
|
|
515
|
-
.command("
|
|
516
|
-
.description("Record
|
|
517
|
+
.command("record-training-metrics-v2")
|
|
518
|
+
.description("Record caller-supplied loss metrics (no training)")
|
|
517
519
|
.requiredOption(
|
|
518
520
|
"-s, --strategy <s>",
|
|
519
521
|
"replay|elastic-weight|knowledge-distill",
|
|
520
522
|
)
|
|
521
523
|
.requiredOption("--data-size <n>", "Data size")
|
|
522
|
-
.requiredOption("--loss-before <n>", "
|
|
523
|
-
.requiredOption("--loss-after <n>", "
|
|
524
|
+
.requiredOption("--loss-before <n>", "Caller-reported loss before")
|
|
525
|
+
.requiredOption("--loss-after <n>", "Caller-reported loss after")
|
|
524
526
|
.option("--duration-ms <n>", "Duration in ms", "0")
|
|
525
527
|
.option("--json", "Output as JSON")
|
|
526
528
|
.action((options) => {
|
|
527
529
|
try {
|
|
528
|
-
const r =
|
|
530
|
+
const r = recordTrainingMetricsV2({
|
|
529
531
|
strategy: options.strategy,
|
|
530
532
|
dataSize: numericOption(options.dataSize, {
|
|
531
533
|
name: "--data-size",
|
|
@@ -543,10 +545,11 @@ export function registerEvolutionCommand(program) {
|
|
|
543
545
|
});
|
|
544
546
|
if (options.json) console.log(JSON.stringify(r, null, 2));
|
|
545
547
|
else {
|
|
546
|
-
logger.log(chalk.bold(`
|
|
548
|
+
logger.log(chalk.bold(`Metric Record ${r.id}`));
|
|
547
549
|
logger.log(` Strategy: ${r.strategy}`);
|
|
548
550
|
logger.log(` KnowledgeRetention ${r.knowledgeRetention.toFixed(4)}`);
|
|
549
|
-
logger.log(`
|
|
551
|
+
logger.log(` Assessment: ${r.retentionAssessment}`);
|
|
552
|
+
logger.log(` Training Performed: ${r.performedTraining}`);
|
|
550
553
|
}
|
|
551
554
|
} catch (err) {
|
|
552
555
|
logger.error(`Failed: ${err.message}`);
|
|
@@ -555,20 +558,23 @@ export function registerEvolutionCommand(program) {
|
|
|
555
558
|
});
|
|
556
559
|
|
|
557
560
|
evolution
|
|
558
|
-
.command("training-
|
|
559
|
-
.description("List V2 training
|
|
561
|
+
.command("training-metrics-v2")
|
|
562
|
+
.description("List V2 training metric records")
|
|
560
563
|
.option("-s, --strategy <s>", "Filter by strategy")
|
|
561
564
|
.option("-l, --limit <n>", "Limit")
|
|
562
565
|
.option("--json", "Output as JSON")
|
|
563
566
|
.action((options) => {
|
|
564
567
|
const limit = options.limit ? parseInt(options.limit, 10) : undefined;
|
|
565
|
-
const list =
|
|
568
|
+
const list = listTrainingMetricRecordsV2({
|
|
569
|
+
strategy: options.strategy,
|
|
570
|
+
limit,
|
|
571
|
+
});
|
|
566
572
|
if (options.json) console.log(JSON.stringify(list, null, 2));
|
|
567
573
|
else {
|
|
568
|
-
if (list.length === 0) logger.log("(no
|
|
574
|
+
if (list.length === 0) logger.log("(no metric records)");
|
|
569
575
|
for (const t of list) {
|
|
570
576
|
logger.log(
|
|
571
|
-
`${new Date(t.createdAt).toISOString()} ${t.strategy.padEnd(20)} retention=${t.knowledgeRetention.toFixed(3)}
|
|
577
|
+
`${new Date(t.createdAt).toISOString()} ${t.strategy.padEnd(20)} retention=${t.knowledgeRetention.toFixed(3)} assessment=${t.retentionAssessment}`,
|
|
572
578
|
);
|
|
573
579
|
}
|
|
574
580
|
}
|
|
@@ -785,7 +791,7 @@ export function registerEvolutionCommand(program) {
|
|
|
785
791
|
else {
|
|
786
792
|
logger.log(chalk.bold("Evolution Stats V2"));
|
|
787
793
|
logger.log(` Capabilities: ${s.capabilityCount}`);
|
|
788
|
-
logger.log(`
|
|
794
|
+
logger.log(` TrainingMetricRecords: ${s.trainingMetricRecords}`);
|
|
789
795
|
logger.log(
|
|
790
796
|
` Diagnoses: ${s.diagnoses.total} (${Object.entries(
|
|
791
797
|
s.diagnoses.bySeverity,
|
package/src/commands/serve.js
CHANGED
|
@@ -7,7 +7,9 @@ import { logger } from "../lib/logger.js";
|
|
|
7
7
|
import { createAgentRuntimeFactory } from "../runtime/runtime-factory.js";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
|
|
10
|
-
export function registerServeCommand(program) {
|
|
10
|
+
export function registerServeCommand(program, dependencies = {}) {
|
|
11
|
+
const evolutionCompositionFactory =
|
|
12
|
+
dependencies.evolutionCompositionFactory ?? null;
|
|
11
13
|
const serve = program
|
|
12
14
|
.command("serve")
|
|
13
15
|
.description("Start WebSocket server for remote CLI access")
|
|
@@ -126,6 +128,7 @@ export function registerServeCommand(program) {
|
|
|
126
128
|
maxConnections: parseInt(opts.maxConnections, 10),
|
|
127
129
|
store,
|
|
128
130
|
kernelFactory: () => new CliAgentKernelAdapter({ cwd }),
|
|
131
|
+
evolutionCompositionFactory,
|
|
129
132
|
maxQueuedRequests,
|
|
130
133
|
});
|
|
131
134
|
const info = await host.start();
|
|
@@ -155,6 +158,7 @@ export function registerServeCommand(program) {
|
|
|
155
158
|
await runStdioAppServer({
|
|
156
159
|
store,
|
|
157
160
|
kernel: new CliAgentKernelAdapter({ cwd }),
|
|
161
|
+
evolutionCompositionFactory,
|
|
158
162
|
maxQueuedRequests,
|
|
159
163
|
});
|
|
160
164
|
} finally {
|
|
@@ -162,7 +166,12 @@ export function registerServeCommand(program) {
|
|
|
162
166
|
}
|
|
163
167
|
return;
|
|
164
168
|
}
|
|
165
|
-
const runtime = createAgentRuntimeFactory(
|
|
169
|
+
const runtime = createAgentRuntimeFactory({
|
|
170
|
+
deps:
|
|
171
|
+
evolutionCompositionFactory === null
|
|
172
|
+
? {}
|
|
173
|
+
: { evolutionCompositionFactory },
|
|
174
|
+
}).createServerRuntime({
|
|
166
175
|
port: parseInt(opts.port, 10),
|
|
167
176
|
host: opts.host,
|
|
168
177
|
token: opts.token,
|
package/src/data/changelog.json
CHANGED
|
@@ -3,14 +3,27 @@
|
|
|
3
3
|
"releases": [
|
|
4
4
|
{
|
|
5
5
|
"productVersion": null,
|
|
6
|
-
"cliVersion": "0.166.
|
|
7
|
-
"cliVersions": ["0.3.
|
|
8
|
-
"date": "2026-09-
|
|
6
|
+
"cliVersion": "0.166.20",
|
|
7
|
+
"cliVersions": ["0.3.10", "0.166.18", "0.166.20"],
|
|
8
|
+
"date": "2026-09-03",
|
|
9
9
|
"title": "",
|
|
10
10
|
"sections": [
|
|
11
11
|
{
|
|
12
|
-
"heading": "
|
|
13
|
-
"body": "> `chainlesschain` **0.166.
|
|
12
|
+
"heading": "Fixed - cc CLI 0.166.20 and Session Core 0.3.10: public-install agent startup",
|
|
13
|
+
"body": "> `chainlesschain` **0.166.18 -> 0.166.20** and\n> `@chainlesschain/session-core` **0.3.9 -> 0.3.10** (release candidate,\n> 2026-09-03).\n\n- **Restore `cc` and `cc agent` startup from public npm installs**: publish the\n Session Core `./structured-evolution-memory` export consumed by the CLI's\n Agent command graph. Version `0.166.18` referenced this source export while\n the immutable public `session-core@0.3.9` bytes predated it, so lazy command\n registration fell back and reported the misleading `unknown command 'agent'`.\n- **Preserve fast help/version paths** while requiring executable Agent\n capability checks against installed package bytes before release.\n- **Release boundary**: publish Session Core `0.3.10` before the pinned CLI\n `0.166.20`, then verify the public registry installation can execute\n `cc agent --capabilities`."
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"productVersion": null,
|
|
19
|
+
"cliVersion": "0.166.18",
|
|
20
|
+
"cliVersions": ["0.3.9", "0.166.17", "0.166.18"],
|
|
21
|
+
"date": "2026-09-03",
|
|
22
|
+
"title": "",
|
|
23
|
+
"sections": [
|
|
24
|
+
{
|
|
25
|
+
"heading": "Added - cc CLI 0.166.18 and Session Core 0.3.9: governed Skill evolution",
|
|
26
|
+
"body": "> `chainlesschain` **0.166.17 -> 0.166.18** and\n> `@chainlesschain/session-core` **0.3.8 -> 0.3.9** (release candidate,\n> 2026-09-03).\n\n- **Evaluated promotion**: Skill candidates must carry target-matrix evidence,\n current-revision bindings, durable promotion receipts, and revocation-aware\n attestations before an active revision can change.\n- **Crash-safe lifecycle**: tenant-scoped candidate and release registries,\n lease/CAS promotion, last-known-good tracking, and rollback keep concurrent\n or interrupted mutations fail closed.\n- **Bounded improvement pilot**: the CLI can propose constrained Skill\n improvements and wiki-informed candidates without directly rewriting or\n activating installed Skills.\n- **Cross-runtime evidence**: CLI, Desktop, and Graph adapters share the new\n Session Core `EvolutionRun` and Skill-invocation receipt contracts, keeping\n evidence identity consistent across runtimes.\n- **Deterministic async hooks**: tool execution now skips `async:true`\n `PostToolUse` hooks when no supervisor/dispatcher is available, preventing a\n hidden background command and a Windows timing race.\n- **Release boundary**: publication requires this exact candidate commit to\n pass every configured Linux, Windows, and macOS job in `CLI CI` and\n `CLI Strict Sandbox`; a local test result or an older green run is not\n release authorization."
|
|
14
27
|
}
|
|
15
28
|
]
|
|
16
29
|
},
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* adapter.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import { randomUUID } from "node:crypto";
|
|
14
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
15
15
|
import { agentLoop, formatToolArgs } from "../../runtime/agent-core.js";
|
|
16
16
|
import { classifyToolSideEffect } from "../../lib/side-effect-ledger.js";
|
|
17
17
|
import { DiffReviewFollowUpTracker } from "../../lib/diff-review-follow-up.js";
|
|
@@ -81,6 +81,7 @@ import {
|
|
|
81
81
|
rejectSessionBudgetUsageUnknown,
|
|
82
82
|
} from "../../lib/session-budget-usage.js";
|
|
83
83
|
import { HostResourceBudget } from "../../lib/host-resource-budget.js";
|
|
84
|
+
import { captureAgentEvolutionRuntimeComposition } from "../../lib/evolution/agent-evolution-runtime-composition-brand.js";
|
|
84
85
|
|
|
85
86
|
const CANONICAL_WS_TURN_QUEUES = new Map();
|
|
86
87
|
const CANONICAL_WS_CLAIM_CAS_ATTEMPTS = 4;
|
|
@@ -176,6 +177,7 @@ export class WSAgentHandler {
|
|
|
176
177
|
sessionHostLease = null,
|
|
177
178
|
sessionBudgetRoot = null,
|
|
178
179
|
hostResourceBudget = null,
|
|
180
|
+
evolutionCompositionFactory = null,
|
|
179
181
|
}) {
|
|
180
182
|
this.session = session;
|
|
181
183
|
this.interaction = interaction;
|
|
@@ -243,6 +245,13 @@ export class WSAgentHandler {
|
|
|
243
245
|
this._mcpRecoveryRevision = null;
|
|
244
246
|
this._mcpRecoveryClient = null;
|
|
245
247
|
this._agentLoop = runAgentLoop || agentLoop;
|
|
248
|
+
if (
|
|
249
|
+
evolutionCompositionFactory !== null &&
|
|
250
|
+
typeof evolutionCompositionFactory !== "function"
|
|
251
|
+
) {
|
|
252
|
+
throw new TypeError("evolutionCompositionFactory must be a function");
|
|
253
|
+
}
|
|
254
|
+
this._evolutionCompositionFactory = evolutionCompositionFactory;
|
|
246
255
|
this._compactionLlmQuery = compactionLlmQuery || null;
|
|
247
256
|
this._compactionSettlementBlock = null;
|
|
248
257
|
this._compactionChatFn =
|
|
@@ -297,6 +306,46 @@ export class WSAgentHandler {
|
|
|
297
306
|
: Object.freeze(hostSystemPrefix);
|
|
298
307
|
}
|
|
299
308
|
|
|
309
|
+
async _prepareEvolutionTurn(requestId) {
|
|
310
|
+
if (!this._evolutionCompositionFactory) return null;
|
|
311
|
+
const sessionId = String(this.session.id);
|
|
312
|
+
const stableRequestId =
|
|
313
|
+
typeof requestId === "string" && requestId.trim()
|
|
314
|
+
? requestId.trim()
|
|
315
|
+
: randomUUID();
|
|
316
|
+
const runId = `ws-run-${createHash("sha256")
|
|
317
|
+
.update(`${sessionId}\0${stableRequestId}`, "utf8")
|
|
318
|
+
.digest("hex")}`;
|
|
319
|
+
try {
|
|
320
|
+
const composition = captureAgentEvolutionRuntimeComposition(
|
|
321
|
+
await this._evolutionCompositionFactory(
|
|
322
|
+
Object.freeze({
|
|
323
|
+
mode: "legacy-websocket",
|
|
324
|
+
runId,
|
|
325
|
+
sessionId,
|
|
326
|
+
requestId: stableRequestId,
|
|
327
|
+
cwd: this.session.projectRoot,
|
|
328
|
+
}),
|
|
329
|
+
),
|
|
330
|
+
);
|
|
331
|
+
if (composition.runId !== runId) {
|
|
332
|
+
throw new TypeError(
|
|
333
|
+
"Agent evolution composition belongs to another WebSocket turn",
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
await composition.evolutionIngress.start();
|
|
337
|
+
return composition;
|
|
338
|
+
} catch (cause) {
|
|
339
|
+
if (cause?.code === "CC_AGENT_EVOLUTION_INGRESS_FAILED") throw cause;
|
|
340
|
+
const error = new Error(
|
|
341
|
+
`WebSocket evolution ingress failed: ${cause?.message || String(cause)}`,
|
|
342
|
+
{ cause },
|
|
343
|
+
);
|
|
344
|
+
error.code = "CC_AGENT_EVOLUTION_INGRESS_FAILED";
|
|
345
|
+
throw error;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
300
349
|
attachInteraction(interaction) {
|
|
301
350
|
if (!interaction || interaction === this.interaction) return false;
|
|
302
351
|
const previous = this.interaction;
|
|
@@ -1277,6 +1326,7 @@ export class WSAgentHandler {
|
|
|
1277
1326
|
let runRecorded = false;
|
|
1278
1327
|
let canonicalTurn = null;
|
|
1279
1328
|
let strictUsageTelemetry = false;
|
|
1329
|
+
let evolutionComposition = null;
|
|
1280
1330
|
|
|
1281
1331
|
try {
|
|
1282
1332
|
const { session } = this;
|
|
@@ -1335,7 +1385,19 @@ export class WSAgentHandler {
|
|
|
1335
1385
|
});
|
|
1336
1386
|
return;
|
|
1337
1387
|
}
|
|
1338
|
-
}
|
|
1388
|
+
}
|
|
1389
|
+
if (this._evolutionCompositionFactory !== null) {
|
|
1390
|
+
evolutionComposition = await this._prepareEvolutionTurn(requestId);
|
|
1391
|
+
}
|
|
1392
|
+
if (evolutionComposition !== null) {
|
|
1393
|
+
await evolutionComposition.evolutionIngress.ingestUserPrompt({
|
|
1394
|
+
content: userMessage,
|
|
1395
|
+
sessionId: session.id,
|
|
1396
|
+
requestId: requestId || null,
|
|
1397
|
+
source: "legacy-websocket",
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
if (session.canonicalJsonlSession !== true) {
|
|
1339
1401
|
session.messages.push({ role: "user", content: userMessage });
|
|
1340
1402
|
}
|
|
1341
1403
|
this._recordSessionState("run.started", {
|
|
@@ -1520,6 +1582,9 @@ export class WSAgentHandler {
|
|
|
1520
1582
|
session.messages,
|
|
1521
1583
|
loopOptions,
|
|
1522
1584
|
)) {
|
|
1585
|
+
if (evolutionComposition !== null) {
|
|
1586
|
+
await evolutionComposition.evolutionIngress.ingestAgentEvent(event);
|
|
1587
|
+
}
|
|
1523
1588
|
switch (event.type) {
|
|
1524
1589
|
case "slot-filling":
|
|
1525
1590
|
this.interaction.emit("slot-filling", {
|
|
@@ -1710,6 +1775,9 @@ export class WSAgentHandler {
|
|
|
1710
1775
|
break;
|
|
1711
1776
|
|
|
1712
1777
|
case "response-complete":
|
|
1778
|
+
if (evolutionComposition !== null) {
|
|
1779
|
+
await evolutionComposition.evolutionIngress.complete();
|
|
1780
|
+
}
|
|
1713
1781
|
if (session.canonicalJsonlSession === true) {
|
|
1714
1782
|
const settled = this._settleCanonicalSuccess(
|
|
1715
1783
|
canonicalTurn,
|
|
@@ -322,6 +322,14 @@ export class ChainlessChainWSServer extends EventEmitter {
|
|
|
322
322
|
LEGACY_WS_FLOW_DEFAULTS.maxCommandOutputBytes,
|
|
323
323
|
);
|
|
324
324
|
this._spawnProcess = options.spawn || _deps.spawn;
|
|
325
|
+
if (
|
|
326
|
+
options.evolutionCompositionFactory != null &&
|
|
327
|
+
typeof options.evolutionCompositionFactory !== "function"
|
|
328
|
+
) {
|
|
329
|
+
throw new TypeError("evolutionCompositionFactory must be a function");
|
|
330
|
+
}
|
|
331
|
+
this.evolutionCompositionFactory =
|
|
332
|
+
options.evolutionCompositionFactory || null;
|
|
325
333
|
|
|
326
334
|
/** Optional Phase-5 envelope bus for fan-out to hosted HTTP SSE. */
|
|
327
335
|
this.envelopeBus = options.envelopeBus || null;
|
|
@@ -196,6 +196,10 @@ export class CliAgentKernelAdapter {
|
|
|
196
196
|
interactiveApprovals: true,
|
|
197
197
|
includePartialMessages: true,
|
|
198
198
|
ephemeral: false,
|
|
199
|
+
evolutionIngress:
|
|
200
|
+
turnOptions.evolutionIngress ??
|
|
201
|
+
this.sessionOptions.evolutionIngress ??
|
|
202
|
+
null,
|
|
199
203
|
},
|
|
200
204
|
{
|
|
201
205
|
...this.dependencies,
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
import { createGraphAuthorityBinding } from "../graph-kernel/authority.js";
|
|
7
7
|
import { GraphEventStore } from "../graph-kernel/event-store.js";
|
|
8
8
|
import { GraphKernel } from "../graph-kernel/runtime.js";
|
|
9
|
+
import { captureAgentEvolutionRuntimeComposition } from "../evolution/agent-evolution-runtime-composition-brand.js";
|
|
9
10
|
import {
|
|
10
11
|
diffGraphTrace,
|
|
11
12
|
locateBlockedRoot,
|
|
@@ -143,11 +144,18 @@ export class AppServerGraphRuntime {
|
|
|
143
144
|
now = Date.now,
|
|
144
145
|
createId = randomUUID,
|
|
145
146
|
onEvent = null,
|
|
147
|
+
evolutionCompositionFactory = null,
|
|
146
148
|
writerLeaseTtlMs = 24 * 60 * 60 * 1000,
|
|
147
149
|
} = {}) {
|
|
148
150
|
if (typeof executeNode !== "function") {
|
|
149
151
|
throw new TypeError("AppServerGraphRuntime requires executeNode()");
|
|
150
152
|
}
|
|
153
|
+
if (
|
|
154
|
+
evolutionCompositionFactory !== null &&
|
|
155
|
+
typeof evolutionCompositionFactory !== "function"
|
|
156
|
+
) {
|
|
157
|
+
throw new TypeError("evolutionCompositionFactory must be a function");
|
|
158
|
+
}
|
|
151
159
|
this.eventStore = eventStore;
|
|
152
160
|
this.rolloutStore = eventStore.rolloutStore;
|
|
153
161
|
this.executeNode = executeNode;
|
|
@@ -156,12 +164,88 @@ export class AppServerGraphRuntime {
|
|
|
156
164
|
this.now = now;
|
|
157
165
|
this.createId = createId;
|
|
158
166
|
this.onEvent = typeof onEvent === "function" ? onEvent : null;
|
|
167
|
+
this.evolutionCompositionFactory = evolutionCompositionFactory;
|
|
159
168
|
this.writerLeaseTtlMs = writerLeaseTtlMs;
|
|
160
169
|
this.runs = new Map();
|
|
161
170
|
this.drives = new Map();
|
|
162
171
|
this.active = new Map();
|
|
163
172
|
}
|
|
164
173
|
|
|
174
|
+
async _prepareEvolution(entry) {
|
|
175
|
+
if (!this.evolutionCompositionFactory) return null;
|
|
176
|
+
if (!entry.evolutionCompositionPromise) {
|
|
177
|
+
const context = Object.freeze({
|
|
178
|
+
mode: "graph",
|
|
179
|
+
runId: entry.runId,
|
|
180
|
+
originSurface: entry.originSurface,
|
|
181
|
+
revisionDigest: entry.compiled.revisionDigest,
|
|
182
|
+
authorityMode: entry.authorityMode,
|
|
183
|
+
});
|
|
184
|
+
entry.evolutionCompositionPromise = Promise.resolve()
|
|
185
|
+
.then(() => this.evolutionCompositionFactory(context))
|
|
186
|
+
.then((value) => {
|
|
187
|
+
const composition = captureAgentEvolutionRuntimeComposition(value);
|
|
188
|
+
if (composition.runId !== entry.runId) {
|
|
189
|
+
throw new TypeError(
|
|
190
|
+
"Agent evolution composition belongs to another Graph run",
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
if (
|
|
194
|
+
typeof composition.evolutionIngress?.start !== "function" ||
|
|
195
|
+
typeof composition.evolutionIngress?.complete !== "function"
|
|
196
|
+
) {
|
|
197
|
+
throw new TypeError(
|
|
198
|
+
"Agent evolution composition has no usable ingress",
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
return composition;
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
if (!entry.evolutionStartPromise) {
|
|
205
|
+
entry.evolutionStartPromise = entry.evolutionCompositionPromise.then(
|
|
206
|
+
async (composition) => {
|
|
207
|
+
await composition.evolutionIngress.start();
|
|
208
|
+
return composition;
|
|
209
|
+
},
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
try {
|
|
213
|
+
return await entry.evolutionStartPromise;
|
|
214
|
+
} catch (cause) {
|
|
215
|
+
entry.evolutionIngressFailed = true;
|
|
216
|
+
if (cause?.code === "CC_AGENT_EVOLUTION_INGRESS_FAILED") throw cause;
|
|
217
|
+
const error = runtimeError(
|
|
218
|
+
"CC_AGENT_EVOLUTION_INGRESS_FAILED",
|
|
219
|
+
`Graph evolution ingress failed: ${cause?.message || String(cause)}`,
|
|
220
|
+
{ cause },
|
|
221
|
+
);
|
|
222
|
+
throw error;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async _completeEvolution(entry) {
|
|
227
|
+
if (!this.evolutionCompositionFactory || entry.evolutionIngressFailed) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
if (entry.evolutionCompletionPromise) {
|
|
231
|
+
return entry.evolutionCompletionPromise;
|
|
232
|
+
}
|
|
233
|
+
try {
|
|
234
|
+
entry.evolutionCompletionPromise = this._prepareEvolution(entry).then(
|
|
235
|
+
(composition) => composition.evolutionIngress.complete(),
|
|
236
|
+
);
|
|
237
|
+
await entry.evolutionCompletionPromise;
|
|
238
|
+
} catch (cause) {
|
|
239
|
+
entry.evolutionIngressFailed = true;
|
|
240
|
+
if (cause?.code === "CC_AGENT_EVOLUTION_INGRESS_FAILED") throw cause;
|
|
241
|
+
throw runtimeError(
|
|
242
|
+
"CC_AGENT_EVOLUTION_INGRESS_FAILED",
|
|
243
|
+
`Graph evolution completion failed: ${cause?.message || String(cause)}`,
|
|
244
|
+
{ cause },
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
165
249
|
_requestThread(runId) {
|
|
166
250
|
return `graph-request:${graphDigest(
|
|
167
251
|
runId,
|
|
@@ -329,6 +413,8 @@ export class AppServerGraphRuntime {
|
|
|
329
413
|
runId: id,
|
|
330
414
|
compiled,
|
|
331
415
|
inputs: { ...inputs },
|
|
416
|
+
originSurface,
|
|
417
|
+
authorityMode,
|
|
332
418
|
});
|
|
333
419
|
this._emit(id, "graph/run-started", { projection });
|
|
334
420
|
return this.status(id);
|
|
@@ -339,9 +425,16 @@ export class AppServerGraphRuntime {
|
|
|
339
425
|
if (projection.authorityMode === "shadow") {
|
|
340
426
|
return Promise.resolve(this.status(projection.id));
|
|
341
427
|
}
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
|
|
428
|
+
const entry = this.runs.get(projection.id);
|
|
429
|
+
const launch = () => {
|
|
430
|
+
const settled = this._drive(projection.id);
|
|
431
|
+
if (options.waitForCompletion === true) return settled;
|
|
432
|
+
return projection;
|
|
433
|
+
};
|
|
434
|
+
if (this.evolutionCompositionFactory) {
|
|
435
|
+
return this._prepareEvolution(entry).then(launch);
|
|
436
|
+
}
|
|
437
|
+
return Promise.resolve(launch());
|
|
345
438
|
}
|
|
346
439
|
|
|
347
440
|
resume(runId, { waitForCompletion = false } = {}) {
|
|
@@ -375,12 +468,15 @@ export class AppServerGraphRuntime {
|
|
|
375
468
|
if (!entry)
|
|
376
469
|
throw runtimeError("CC_GRAPH_RUN_NOT_FOUND", "Graph run missing");
|
|
377
470
|
const { kernel } = entry;
|
|
471
|
+
await this._prepareEvolution(entry);
|
|
378
472
|
for (let steps = 0; steps < 10_000; steps += 1) {
|
|
379
473
|
const status = kernel.getRun(runId);
|
|
380
|
-
if (
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
474
|
+
if (TERMINAL.has(status.status)) {
|
|
475
|
+
await this._completeEvolution(entry);
|
|
476
|
+
this._emit(runId, "graph/run-settled", { projection: status });
|
|
477
|
+
return status;
|
|
478
|
+
}
|
|
479
|
+
if (status.status === "reconciliation_required") {
|
|
384
480
|
this._emit(runId, "graph/run-settled", { projection: status });
|
|
385
481
|
return status;
|
|
386
482
|
}
|
|
@@ -562,6 +658,7 @@ export class AppServerGraphRuntime {
|
|
|
562
658
|
async _executeAttempt(entry, nodeId) {
|
|
563
659
|
const { kernel } = entry;
|
|
564
660
|
const runId = entry.runId;
|
|
661
|
+
const evolutionComposition = await this._prepareEvolution(entry);
|
|
565
662
|
const attempt = kernel.assignNode(runId, nodeId, "app-server-agent", {
|
|
566
663
|
ttlMs: this.writerLeaseTtlMs,
|
|
567
664
|
leaseId: `app-server-attempt:${this.createId()}`,
|
|
@@ -595,6 +692,7 @@ export class AppServerGraphRuntime {
|
|
|
595
692
|
attempt,
|
|
596
693
|
input: nodeInput(entry.inputs, nodeId),
|
|
597
694
|
signal: controller.signal,
|
|
695
|
+
evolutionIngress: evolutionComposition?.evolutionIngress || null,
|
|
598
696
|
});
|
|
599
697
|
if (!result || !["succeeded", "completed"].includes(result.status)) {
|
|
600
698
|
const error = runtimeError(
|
|
@@ -631,6 +729,9 @@ export class AppServerGraphRuntime {
|
|
|
631
729
|
});
|
|
632
730
|
return settled;
|
|
633
731
|
} catch (error) {
|
|
732
|
+
if (error?.code === "CC_AGENT_EVOLUTION_INGRESS_FAILED") {
|
|
733
|
+
entry.evolutionIngressFailed = true;
|
|
734
|
+
}
|
|
634
735
|
if (controller.signal.aborted) return kernel.getRun(runId);
|
|
635
736
|
if (effect) {
|
|
636
737
|
const known = error?.outcomeKnown === true;
|
|
@@ -826,6 +927,8 @@ export class AppServerGraphRuntime {
|
|
|
826
927
|
runId,
|
|
827
928
|
compiled: compileGraphDefinition(request.definition),
|
|
828
929
|
inputs: { ...request.inputs },
|
|
930
|
+
originSurface: request.originSurface,
|
|
931
|
+
authorityMode: request.authorityMode,
|
|
829
932
|
};
|
|
830
933
|
this.runs.set(runId, entry);
|
|
831
934
|
this._recoverReceiptedAttempts(entry);
|
|
@@ -1003,7 +1106,7 @@ export class AppServerGraphRuntime {
|
|
|
1003
1106
|
async cancel(runId, reason = "cancelled by App Server client") {
|
|
1004
1107
|
const id = String(runId);
|
|
1005
1108
|
const entry = this.runs.get(id) || this._recover(id);
|
|
1006
|
-
|
|
1109
|
+
const projection = await entry.kernel.cancelRun(id, {
|
|
1007
1110
|
reason,
|
|
1008
1111
|
interrupt: async (attempt) => {
|
|
1009
1112
|
const active = this.active.get(attempt.id);
|
|
@@ -1012,6 +1115,10 @@ export class AppServerGraphRuntime {
|
|
|
1012
1115
|
await active.done;
|
|
1013
1116
|
},
|
|
1014
1117
|
});
|
|
1118
|
+
if (TERMINAL.has(projection.status)) {
|
|
1119
|
+
await this._completeEvolution(entry);
|
|
1120
|
+
}
|
|
1121
|
+
return projection;
|
|
1015
1122
|
}
|
|
1016
1123
|
|
|
1017
1124
|
async reconcile(runId, input = {}) {
|