chainlesschain 0.166.22 → 0.166.25
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 +46 -3
- package/package.json +4 -3
- package/src/assets/web-panel/assets/{AIOps-oJ7USzMC.js → AIOps-RaxL_QQD.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-BlgnZe_C.js → ActionButton-DD3ieFO-.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-D2rRbTLu.js → Analytics-CATDJukS.js} +3 -3
- package/src/assets/web-panel/assets/{AppLayout-FwS3f0B2.js → AppLayout-BHGsnRDS.js} +5 -5
- package/src/assets/web-panel/assets/{Artifacts-iF-_08Hi.js → Artifacts-BL6NunjN.js} +1 -1
- package/src/assets/web-panel/assets/{Audit-D24p0zQw.js → Audit-D0nEWfbA.js} +1 -1
- package/src/assets/web-panel/assets/{BackgroundAgents-Cg3mRVi9.js → BackgroundAgents-BAP1MUol.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-EOqht3H-.js → Backup-R4y2OeSi.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-9XWYq2hj.js → BaseInput-ByQZ2z6S.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-Dq5yardA.js → Chat-32uV--xF.js} +4 -4
- package/src/assets/web-panel/assets/ChatBubbleRenderer-t1enanwz.js +1 -0
- package/src/assets/web-panel/assets/{Checkbox-CuyCBoBf.js → Checkbox-D1CB-7bq.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-DjWtYHNe.js → Codegen-BPx3dQ2q.js} +1 -1
- package/src/assets/web-panel/assets/{Col-CrVr_iuG.js → Col-DkPTQ2Gl.js} +1 -1
- package/src/assets/web-panel/assets/{Community-C6QxpfGc.js → Community-ZriaxRlr.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-B-v5r6Pa.js → Compact-C_qJ0P7F.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-zNiLiFgD.js → Compliance-Bgoy-saS.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-D9K7lMOu.js → Cowork-B5i9y6XK.js} +2 -2
- package/src/assets/web-panel/assets/{Cron-DAjO36z4.js → Cron-D7vBJ5-J.js} +2 -2
- package/src/assets/web-panel/assets/{Crosschain-Bxqn0aqB.js → Crosschain-D4kvoGI_.js} +1 -1
- package/src/assets/web-panel/assets/{DID-DfRmLUe-.js → DID-BLOeBd-r.js} +2 -2
- package/src/assets/web-panel/assets/{Dashboard-Cz8KF3fr.js → Dashboard-mecJaonC.js} +2 -2
- package/src/assets/web-panel/assets/{Dropdown-C4oVfkP0.js → Dropdown-GPKwaFer.js} +1 -1
- package/src/assets/web-panel/assets/{EmailListRenderer-ivyZKN8k.js → EmailListRenderer-BML9m7Dd.js} +1 -1
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-DoxY1CPW.js → FamilyGuardDashboard-DN5bAtJC.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-C93gZxnb.js → Federation-DmD6Gecd.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-D_lEjYJE.js → FormItemContext-6wwplN_K.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-BNFN9YjN.js → GenericCardRenderer-DUhpLkDL.js} +1 -1
- package/src/assets/web-panel/assets/{Git-mUu2HcLI.js → Git-eJfyXkwf.js} +2 -2
- package/src/assets/web-panel/assets/{Governance-CNuosrge.js → Governance-swAUW59x.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-DwY5pbCB.js → Inference-CbdwJPDJ.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-aRUxhACD.js → KnowledgeGraph-UuYpg1nm.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-DFfsWYy_.js → Logs-CS0G057y.js} +2 -2
- package/src/assets/web-panel/assets/MarkdownRenderer-BxIIB4k3.js +1 -0
- package/src/assets/web-panel/assets/{Marketplace-COI-ciM-.js → Marketplace-CZRjuvvI.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-BJJwaIpe.js → McpTools-BOJ9A_Rf.js} +3 -3
- package/src/assets/web-panel/assets/{Memory-CDO6SGDZ.js → Memory-BnkrR-Ok.js} +2 -2
- package/src/assets/web-panel/assets/{MobileBridge-BlZ5tFf4.js → MobileBridge-Do4mPi13.js} +1 -1
- package/src/assets/web-panel/assets/{MobileProjects-DuoxbgWz.js → MobileProjects-2JxWa6-p.js} +1 -1
- package/src/assets/web-panel/assets/{Mtc-6ec9j70b.js → Mtc-CS_mnpGd.js} +2 -2
- package/src/assets/web-panel/assets/{MtcAudit-BuL7HkC7.js → MtcAudit-DZ4J_351.js} +5 -5
- package/src/assets/web-panel/assets/{Multisig-CJxR85lk.js → Multisig-Jh74zKXu.js} +3 -3
- package/src/assets/web-panel/assets/{NLProgramming-B71O1S4l.js → NLProgramming-_4n2BfnS.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-Bsw5zbpV.js → Notes-CtENcKHv.js} +3 -3
- package/src/assets/web-panel/assets/{NotificationSettings-BnAhXuK_.js → NotificationSettings-dgDCvpK9.js} +1 -1
- package/src/assets/web-panel/assets/{OrderTableRenderer-BJ0R5GGz.js → OrderTableRenderer-D5VxCrmG.js} +1 -1
- package/src/assets/web-panel/assets/{Organization-B7wwNxoP.js → Organization-CpIF8Xkd.js} +2 -2
- package/src/assets/web-panel/assets/{Overflow-CfAGr0gM.js → Overflow-aHnBZaez.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-KhMg22Fz.js → P2P-8ppzog2V.js} +2 -2
- package/src/assets/web-panel/assets/{PdhVaultBrowser-NdAXI9ft.js → PdhVaultBrowser-D3p1BXkp.js} +3 -3
- package/src/assets/web-panel/assets/{Permissions-CIYjqyT7.js → Permissions-D7vflD5q.js} +4 -4
- package/src/assets/web-panel/assets/{PersonalDataHub-D2ht3P_R.js → PersonalDataHub-D2hY-Ek2.js} +4 -4
- package/src/assets/web-panel/assets/{Pipeline-i6flZW1m.js → Pipeline-qK2VqhJC.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-DE0lhYVc.js → Privacy-DHJr4uu0.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-BL3YbyxS.js → ProjectInit-DMBS6trm.js} +2 -2
- package/src/assets/web-panel/assets/{ProjectSettings-CEtdg7ni.js → ProjectSettings-D3Ng74BT.js} +2 -2
- package/src/assets/web-panel/assets/{Projects-CvtU5peJ.js → Projects-BfJFZiIW.js} +1 -1
- package/src/assets/web-panel/assets/{Providers-DKt_Cg-j.js → Providers-DlNA95G0.js} +1 -1
- package/src/assets/web-panel/assets/{QrScannerModal-DA61jNSx.js → QrScannerModal-CMOIYxIm.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-fS9ryUmq.js → QuickAsk-D6MyGp5I.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-CR9dZU5Y.js → Recommend-W6WcShtf.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-BV0BR2Dz.js → RemoteSession-Dm_MjlV_.js} +2 -2
- package/src/assets/web-panel/assets/{Reputation-BIeGUvYD.js → Reputation-Ctvij6eX.js} +1 -1
- package/src/assets/web-panel/assets/{Row-DHDT1aro.js → Row-DivbeDE-.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-Cq6YKb1h.js → RssFeed-D4famoAw.js} +3 -3
- package/src/assets/web-panel/assets/{Search-DEF6vsy6.js → Search-6gOAh3zG.js} +1 -1
- package/src/assets/web-panel/assets/{Security-CHtYiKY9.js → Security-DApb9kK8.js} +4 -4
- package/src/assets/web-panel/assets/{Services-u16lvBJN.js → Services-B8OomyE2.js} +2 -2
- package/src/assets/web-panel/assets/{Skeleton-CGbizyDj.js → Skeleton-BTJ2g2E3.js} +1 -1
- package/src/assets/web-panel/assets/{Skills-BZMQcAa7.js → Skills-NIRr4DD1.js} +1 -1
- package/src/assets/web-panel/assets/{Sla-Bm-CycVi.js → Sla-BQHP_6px.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-BudpA5kr.js → SpeechSettings-BVQTDSVS.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-B8q1C1eC.js → SyncSettings-BOD4Mar6.js} +2 -2
- package/src/assets/web-panel/assets/{Tasks-SU1pBWc-.js → Tasks-Ciu7H2-y.js} +1 -1
- package/src/assets/web-panel/assets/{Templates-CyOfJzmt.js → Templates-CtlwavRU.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-xqWSm2GP.js → Tenant-QLWYJdL6.js} +1 -1
- package/src/assets/web-panel/assets/{Terminal-D1Ttgjsi.js → Terminal-B3q10mjm.js} +2 -2
- package/src/assets/web-panel/assets/{TimelineRenderer-Da2lYs5D.js → TimelineRenderer-CqltBA_8.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-B34-SduO.js → Tokens-CJOKrj4y.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-C8zyYm4R.js → Trigger-CPMGgfdM.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-D1Pvqems.js → Trust-DiJms7Bl.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-Do3VVnAy.js → UkeySign-rakR8eel.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-Dz7egVIA.js → VideoEditing-DAWZUM5o.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-Dcuw-OxR.js → Wallet-DqUPnl7K.js} +3 -3
- package/src/assets/web-panel/assets/{WebAuthn-DPlw-QsB.js → WebAuthn-BnVUwvMm.js} +3 -3
- package/src/assets/web-panel/assets/{WorkflowEditor-h4OsnU5q.js → WorkflowEditor-B1CAwxgs.js} +1 -1
- package/src/assets/web-panel/assets/{chat-eO9wEwrW.js → chat-k2-0Jzfy.js} +1 -1
- package/src/assets/web-panel/assets/{colors-34lSmOXw.js → colors-BAu8xBmW.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-CK4kEWJ4.js → compact-item-DMlqcdfI.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-E0A57xed.js → createContext-BU9kfiSw.js} +1 -1
- package/src/assets/web-panel/assets/devWarning-DuGrUMAS.js +1 -0
- package/src/assets/web-panel/assets/{hasIn-BD9ZMGAl.js → hasIn-2vacgdcl.js} +1 -1
- package/src/assets/web-panel/assets/{index--N0u6kTG.js → index-B-C-Ruft.js} +1 -1
- package/src/assets/web-panel/assets/{index-DzXjP44T.js → index-B7wDjYUd.js} +1 -1
- package/src/assets/web-panel/assets/{index-CZBaqe3d.js → index-BMq0frKK.js} +1 -1
- package/src/assets/web-panel/assets/{index-DrOalGut.js → index-BUX4W-2v.js} +1 -1
- package/src/assets/web-panel/assets/{index-CT1_eRL-.js → index-BZz2eB33.js} +1 -1
- package/src/assets/web-panel/assets/{index-DrsDA_md.js → index-BblNQlaA.js} +1 -1
- package/src/assets/web-panel/assets/{index-DP-UZAQN.js → index-BdfKoqsK.js} +1 -1
- package/src/assets/web-panel/assets/{index-DiT_REby.js → index-Bf8YofPE.js} +1 -1
- package/src/assets/web-panel/assets/{index-Cx3Jn1r0.js → index-Bn8tARil.js} +1 -1
- package/src/assets/web-panel/assets/{index-B0rkHxKK.js → index-Bpe2CJd-.js} +1 -1
- package/src/assets/web-panel/assets/{index-B_G_ElKO.js → index-BxctzdYQ.js} +1 -1
- package/src/assets/web-panel/assets/{index-MIg5Z8qe.js → index-C24NoPpy.js} +1 -1
- package/src/assets/web-panel/assets/{index-BmNbU2Z6.js → index-C5C4kSi8.js} +1 -1
- package/src/assets/web-panel/assets/{index-BsGmo6v1.js → index-C6ICn9Y6.js} +1 -1
- package/src/assets/web-panel/assets/{index-CsrKJJcX.js → index-C8ldqZi6.js} +1 -1
- package/src/assets/web-panel/assets/{index-BbX_Dted.js → index-C9WsM29I.js} +1 -1
- package/src/assets/web-panel/assets/{index-Ch175NUw.js → index-CONPVaxw.js} +1 -1
- package/src/assets/web-panel/assets/{index-DONOUtlz.js → index-CPyYXKFB.js} +1 -1
- package/src/assets/web-panel/assets/{index-DFLE2qO9.js → index-CSvSf9px.js} +1 -1
- package/src/assets/web-panel/assets/{index-o8pYehRq.js → index-CXmpR6N3.js} +3 -3
- package/src/assets/web-panel/assets/{index-Cz3unNfL.js → index-Chybe7Ge.js} +1 -1
- package/src/assets/web-panel/assets/{index-yAGBu2E0.js → index-CyXmP3PW.js} +1 -1
- package/src/assets/web-panel/assets/{index-CuSau5ya.js → index-DCusBOqR.js} +1 -1
- package/src/assets/web-panel/assets/{index-DcE1BspQ.js → index-DH01oIaj.js} +1 -1
- package/src/assets/web-panel/assets/{index-DrSAAuJj.js → index-DHg3LMNP.js} +1 -1
- package/src/assets/web-panel/assets/{index-CZkFMeWL.js → index-DWLTSIka.js} +1 -1
- package/src/assets/web-panel/assets/{index-DvKcroix.js → index-DaUGdvtU.js} +1 -1
- package/src/assets/web-panel/assets/{index-Bjs90Eh9.js → index-DcA-tEQd.js} +1 -1
- package/src/assets/web-panel/assets/{index-DGRxt5wj.js → index-DfWvcu4p.js} +1 -1
- package/src/assets/web-panel/assets/{index-DCn-ECvK.js → index-DmZNnZz7.js} +1 -1
- package/src/assets/web-panel/assets/index-DvFfMAux.js +1 -0
- package/src/assets/web-panel/assets/{index-8qMA1DWQ.js → index-JsyGqKmD.js} +1 -1
- package/src/assets/web-panel/assets/{index-D4bB_x_v.js → index-TtrpHmYx.js} +1 -1
- package/src/assets/web-panel/assets/{index-Brqc9Emx.js → index-Ygh0wmKz.js} +1 -1
- package/src/assets/web-panel/assets/{index-Da5fmOHB.js → index-dIYqw3f0.js} +1 -1
- package/src/assets/web-panel/assets/{index-DpfisY1g.js → index-hDHHJYno.js} +1 -1
- package/src/assets/web-panel/assets/index-n6p-1A77.js +1 -0
- package/src/assets/web-panel/assets/{index-DeXNCyQJ.js → index-oElehY4F.js} +1 -1
- package/src/assets/web-panel/assets/{index-DcbgVLOH.js → index-z4_YwZDW.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-DMTkAomF.js → initDefaultProps-B9OXWu2e.js} +1 -1
- package/src/assets/web-panel/assets/{motion-Cnti1F5g.js → motion-IQ47MCDQ.js} +1 -1
- package/src/assets/web-panel/assets/{move-CGxmHUga.js → move-CLCU4kjV.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-CuwwLoq7.js → mtc-parser-CXnVlSPq.js} +1 -1
- package/src/assets/web-panel/assets/{omit-BpdlTkPM.js → omit-BJjLXB0f.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-D7nWrThp.js → pickAttrs-BHdtvdy6.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-Bhx0TV8F.js → placementArrow-oq8X_Bwc.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-CZ1KesZh.js → responsiveObserve-DTD02LAO.js} +1 -1
- package/src/assets/web-panel/assets/{slide-CnldF8J6.js → slide-DbEeq8to.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-CZfo_GOA.js → statusUtils-Do2fy1CJ.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-B2QCcAv5.js → styleChecker-CFWD63T-.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-DzzjIS4J.js → useFlexGapSupport-BeozAWOo.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-B_atg9M0.js → useFs-0-rIgnBL.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-DhZs3QYN.js → usePersonalDataHub-CeiNoI31.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-DcePTYAm.js → vnode-Dj0ReRNg.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-BYmlnjRk.js → zoom-DD7MC4Dy.js} +1 -1
- package/src/assets/web-panel/index.html +1 -1
- package/src/command-help-index.json +3 -3
- package/src/commands/agent.js +18 -1
- package/src/commands/evolution-benchmark.js +72 -0
- package/src/commands/evolution-knowledge.js +40 -1
- package/src/commands/evolution.js +2 -0
- package/src/commands/governed-skill-marketplace.js +142 -0
- package/src/commands/marketplace.js +4 -1
- package/src/commands/serve.js +21 -0
- package/src/commands/skill.js +3 -0
- package/src/data/changelog.json +39 -0
- package/src/gateways/ws/ws-agent-handler.js +59 -2
- package/src/gateways/ws/ws-server.js +2 -0
- package/src/generated/cc-agent-protocol.schema.json +3 -1
- package/src/harness/golden-transcript.js +1 -0
- package/src/harness/prompt-compressor.js +51 -5
- package/src/harness/provider-backed-compaction.js +28 -1
- package/src/harness/remote-session-registry.js +15 -3
- package/src/index.js +20 -2
- package/src/lazy-dispatch.js +6 -0
- package/src/lib/advisor-runtime.js +55 -2
- package/src/lib/app-server/cli-agent-kernel-adapter.js +4 -0
- package/src/lib/app-server/graph-runtime.js +32 -0
- package/src/lib/app-server/server.js +94 -1
- package/src/lib/app-server/websocket-transport.js +15 -0
- package/src/lib/autonomous-agent.js +63 -13
- package/src/lib/cowork/ab-comparator-cli.js +4 -3
- package/src/lib/cowork/debate-review-cli.js +4 -3
- package/src/lib/cowork/decision-kb-cli.js +5 -0
- package/src/lib/cowork-adapter.js +38 -16
- package/src/lib/evolution/agent-evolution-ingress.js +95 -15
- package/src/lib/evolution/agent-evolution-runtime-composition.js +82 -0
- package/src/lib/evolution/agent-evolution-session-lifecycle.js +46 -0
- package/src/lib/evolution/agent-model-projection.js +437 -0
- package/src/lib/evolution/bounded-descriptor-read.js +29 -0
- package/src/lib/evolution/controlled-skill-pilot-ledger-adapter.js +551 -0
- package/src/lib/evolution/controlled-skill-production-pilot.js +308 -18
- package/src/lib/evolution/evidence-backed-wiki-maintainer.js +32 -10
- package/src/lib/evolution/evidence-json-text.js +236 -0
- package/src/lib/evolution/evolution-artifact-ports.js +196 -21
- package/src/lib/evolution/evolution-deployment-loader.js +240 -2
- package/src/lib/evolution/evolution-eval-child-evidence-ledger-adapter.js +373 -0
- package/src/lib/evolution/evolution-eval-gate.js +14 -1
- package/src/lib/evolution/evolution-eval-process-supervisor-worker.mjs +14 -0
- package/src/lib/evolution/evolution-eval-process-supervisor.js +607 -0
- package/src/lib/evolution/evolution-evidence-artifact-adapter.js +14 -1
- package/src/lib/evolution/evolution-evidence-projector.js +271 -37
- package/src/lib/evolution/evolution-file-witness.js +153 -30
- package/src/lib/evolution/evolution-ledger-ports.js +1219 -66
- package/src/lib/evolution/evolution-ledger.js +66 -2
- package/src/lib/evolution/evolution-raw-crypto-shred.js +29 -15
- package/src/lib/evolution/evolution-raw-deletion-ledger-adapter.js +865 -0
- package/src/lib/evolution/evolution-release-train-domain-stages.js +769 -0
- package/src/lib/evolution/evolution-release-train-stage-output-ledger-adapter.js +333 -0
- package/src/lib/evolution/evolution-release-train.js +54 -6
- package/src/lib/evolution/evolution-workbench-batch-executor.js +101 -144
- package/src/lib/evolution/evolution-workbench-control-ports.js +203 -0
- package/src/lib/evolution/evolution-workbench-file-resources.js +403 -0
- package/src/lib/evolution/evolution-workbench-projection.js +134 -26
- package/src/lib/evolution/evolution-workbench-registry-source.js +482 -0
- package/src/lib/evolution/evolution-workbench-review-ledger-adapter.js +823 -0
- package/src/lib/evolution/evolution-workbench-review-protocol.js +157 -0
- package/src/lib/evolution/evolution-workbench-rollback-authorization.js +57 -0
- package/src/lib/evolution/evolution-workbench-rollback-ledger-adapter.js +1016 -0
- package/src/lib/evolution/evolution-workbench-runtime.js +133 -0
- package/src/lib/evolution/evolution-workbench-version-control.js +70 -36
- package/src/lib/evolution/evolvable-artifact-ledger-adapter.js +48 -0
- package/src/lib/evolution/governed-knowledge-candidate-rejection.js +343 -0
- package/src/lib/evolution/governed-knowledge-dependency-authority.js +227 -44
- package/src/lib/evolution/governed-knowledge-dependency-inventory.js +392 -0
- package/src/lib/evolution/governed-knowledge-dependency-ledger-executor.js +217 -82
- package/src/lib/evolution/governed-knowledge-quarantine-release.js +1013 -0
- package/src/lib/evolution/governed-knowledge-record.js +148 -0
- package/src/lib/evolution/governed-knowledge-revocation-host.js +59 -0
- package/src/lib/evolution/governed-knowledge-revocation-record.js +135 -0
- package/src/lib/evolution/governed-knowledge-skill-rollback.js +510 -0
- package/src/lib/evolution/governed-knowledge-sync.js +181 -95
- package/src/lib/evolution/governed-knowledge-wiki-tombstone.js +516 -0
- package/src/lib/evolution/governed-skill-marketplace-badge.js +208 -0
- package/src/lib/evolution/governed-skill-marketplace-candidate.js +330 -0
- package/src/lib/evolution/governed-skill-marketplace-cli-host.js +308 -0
- package/src/lib/evolution/governed-skill-marketplace-ledger-adapter.js +420 -0
- package/src/lib/evolution/governed-skill-marketplace.js +288 -5
- package/src/lib/evolution/governed-wiki-pruning-journal.js +302 -0
- package/src/lib/evolution/governed-wiki-pruning-ledger-adapter.js +459 -0
- package/src/lib/evolution/governed-wiki-pruning-maintenance.js +576 -0
- package/src/lib/evolution/governed-wiki-pruning-plan-authority.js +169 -0
- package/src/lib/evolution/governed-wiki-pruning-raw-shred.js +207 -0
- package/src/lib/evolution/governed-wiki-pruning-retrieval.js +587 -0
- package/src/lib/evolution/governed-wiki-pruning-runtime.js +153 -0
- package/src/lib/evolution/governed-wiki-pruning-skill-rollback.js +360 -0
- package/src/lib/evolution/governed-wiki-pruning.js +322 -143
- package/src/lib/evolution/independent-skill-revocation-source.js +231 -0
- package/src/lib/evolution/knowledge-wiki-source-admission.js +283 -0
- package/src/lib/evolution/knowledge-wiki-source-provenance.js +360 -0
- package/src/lib/evolution/progressive-canary-external-watchdog.js +578 -0
- package/src/lib/evolution/progressive-canary-traffic-worker.js +628 -0
- package/src/lib/evolution/progressive-canary-watchdog-file-store.js +285 -0
- package/src/lib/evolution/progressive-canary-watchdog-node-pki.js +265 -0
- package/src/lib/evolution/skill-candidate-registry.js +43 -3
- package/src/lib/evolution/skill-promotion-controller.js +25 -0
- package/src/lib/evolution/skill-promotion-review-ledger-adapter.js +100 -0
- package/src/lib/evolution/skill-registry-transition-ledger-adapter.js +131 -2
- package/src/lib/evolution/skill-release-registry.js +168 -4
- package/src/lib/evolution/skill-retrieval-revocation-authority.js +361 -0
- package/src/lib/evolution/skill-retrieval-revocation-ledger-adapter.js +346 -0
- package/src/lib/evolution/skill-revocation-propagation.js +467 -0
- package/src/lib/evolution/skill-target-matrix-eval.js +162 -11
- package/src/lib/evolution/skill-wiki-reconciliation.js +985 -0
- package/src/lib/evolution/skill-writer-inventory-manifest.js +8 -6
- package/src/lib/evolution/statistical-progressive-canary.js +165 -3
- package/src/lib/evolution/structured-memory-agent-control-plane.js +120 -0
- package/src/lib/evolution/structured-memory-authority-ledger-adapter.js +5 -1
- package/src/lib/evolution/structured-memory-promotion-receipt-writer.js +126 -0
- package/src/lib/evolution/wiki-informed-skill-proposer.js +127 -21
- package/src/lib/evolution/wiki-maintainer-ledger-adapter.js +822 -101
- package/src/lib/evolution/wiki-revision-protocol.js +120 -0
- package/src/lib/evolution/wiki-skill-proposal-ledger-adapter.js +307 -0
- package/src/lib/evolution/wiki-target-tombstone-revision.js +109 -0
- package/src/lib/evolution/wikiskill-benchmark-cli-host.js +178 -0
- package/src/lib/evolution/wikiskill-benchmark-execution-host.js +702 -0
- package/src/lib/evolution/wikiskill-benchmark-ledger-adapter.js +613 -0
- package/src/lib/evolution/wikiskill-benchmark.js +80 -16
- package/src/lib/goal-assess.js +17 -10
- package/src/lib/interactive-planner.js +9 -1
- package/src/lib/iteration-budget.js +16 -2
- package/src/lib/micro-compact.js +4 -1
- package/src/lib/model-failure-policy.js +21 -0
- package/src/lib/process-execution-broker/index.js +1 -0
- package/src/lib/process-execution-broker/windows-sandbox-helper.dll +0 -0
- package/src/lib/process-execution-broker/windows-sandbox-helper.exe +0 -0
- package/src/lib/process-execution-broker/windows-sandbox.cs +33 -15
- package/src/lib/read-file-loop-guard.js +113 -0
- package/src/lib/read-file-page.js +191 -0
- package/src/lib/runnable-provider.js +2 -1
- package/src/lib/skill-retrieval-router.js +22 -1
- package/src/repl/agent-repl.js +133 -34
- package/src/runtime/agent-core.js +196 -74
- package/src/runtime/agent-runtime.js +43 -0
- package/src/runtime/coding-agent-contract-shared.cjs +7 -1
- package/src/runtime/fallback-model.js +143 -62
- package/src/runtime/headless-runner.js +54 -10
- package/src/runtime/headless-stream.js +50 -6
- package/src/runtime/runtime-factory.js +41 -2
- package/src/assets/web-panel/assets/ChatBubbleRenderer-Ds3pA-ET.js +0 -1
- package/src/assets/web-panel/assets/MarkdownRenderer-DqTx7_u1.js +0 -1
- package/src/assets/web-panel/assets/devWarning-CF3xafX2.js +0 -1
- package/src/assets/web-panel/assets/index-C907rPwd.js +0 -1
- package/src/assets/web-panel/assets/index-wueRSK2d.js +0 -1
|
@@ -43,6 +43,9 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
43
43
|
constructor() {
|
|
44
44
|
super();
|
|
45
45
|
this._goals = new Map();
|
|
46
|
+
this._runningLoops = new Map();
|
|
47
|
+
this._closing = false;
|
|
48
|
+
this._shutdownAbort = new AbortController();
|
|
46
49
|
this._llmChat = null;
|
|
47
50
|
this._toolExecutor = null;
|
|
48
51
|
this._hookManager = null;
|
|
@@ -88,6 +91,7 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
88
91
|
async submitGoal(description, { tokenBudget = 50000 } = {}) {
|
|
89
92
|
assertCLILegacyMutationAllowed("CLIAutonomousAgent.submitGoal");
|
|
90
93
|
if (!this._initialized) throw new Error("Agent not initialized");
|
|
94
|
+
if (this._closing) throw new Error("Agent session is closing");
|
|
91
95
|
if (!description) throw new Error("Goal description required");
|
|
92
96
|
|
|
93
97
|
const goalId = `goal-${_deps.Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
|
|
@@ -111,11 +115,7 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
111
115
|
this.emit("goal:submitted", { goalId, description });
|
|
112
116
|
|
|
113
117
|
// Start the ReAct loop asynchronously
|
|
114
|
-
this.
|
|
115
|
-
goal.status = GoalStatus.FAILED;
|
|
116
|
-
goal.errors.push(err.message);
|
|
117
|
-
this.emit("goal:failed", { goalId, error: err.message });
|
|
118
|
-
});
|
|
118
|
+
this._launchGoalLoop(goal);
|
|
119
119
|
|
|
120
120
|
return { goalId };
|
|
121
121
|
}
|
|
@@ -162,6 +162,7 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
162
162
|
*/
|
|
163
163
|
resumeGoal(goalId) {
|
|
164
164
|
assertCLILegacyMutationAllowed("CLIAutonomousAgent.resumeGoal");
|
|
165
|
+
if (this._closing) return { error: "Agent session is closing" };
|
|
165
166
|
const goal = this._goals.get(goalId);
|
|
166
167
|
if (!goal) return { error: "Goal not found" };
|
|
167
168
|
if (goal.status !== GoalStatus.PAUSED)
|
|
@@ -172,14 +173,51 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
172
173
|
this.emit("goal:resumed", { goalId });
|
|
173
174
|
|
|
174
175
|
// Continue the loop
|
|
175
|
-
this.
|
|
176
|
-
goal.status = GoalStatus.FAILED;
|
|
177
|
-
goal.errors.push(err.message);
|
|
178
|
-
});
|
|
176
|
+
this._launchGoalLoop(goal);
|
|
179
177
|
|
|
180
178
|
return { success: true };
|
|
181
179
|
}
|
|
182
180
|
|
|
181
|
+
_launchGoalLoop(goal) {
|
|
182
|
+
// Resume during an in-flight model/tool call reuses that loop, rather than
|
|
183
|
+
// launching a second execution of the same goal.
|
|
184
|
+
if (this._runningLoops.has(goal.id)) return this._runningLoops.get(goal.id);
|
|
185
|
+
const running = this._runReActLoop(goal)
|
|
186
|
+
.catch((err) => {
|
|
187
|
+
if (goal.status === GoalStatus.CANCELLED) return;
|
|
188
|
+
goal.status = GoalStatus.FAILED;
|
|
189
|
+
goal.errors.push(err.message);
|
|
190
|
+
this.emit("goal:failed", { goalId: goal.id, error: err.message });
|
|
191
|
+
})
|
|
192
|
+
.finally(() => this._runningLoops.delete(goal.id));
|
|
193
|
+
this._runningLoops.set(goal.id, running);
|
|
194
|
+
return running;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
get signal() {
|
|
198
|
+
return this._shutdownAbort.signal;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
async shutdown() {
|
|
202
|
+
this._closing = true;
|
|
203
|
+
let interrupted = 0;
|
|
204
|
+
for (const goal of this._goals.values()) {
|
|
205
|
+
if (
|
|
206
|
+
![GoalStatus.PENDING, GoalStatus.RUNNING, GoalStatus.PAUSED].includes(
|
|
207
|
+
goal.status,
|
|
208
|
+
)
|
|
209
|
+
)
|
|
210
|
+
continue;
|
|
211
|
+
interrupted++;
|
|
212
|
+
goal.status = GoalStatus.CANCELLED;
|
|
213
|
+
goal.updatedAt = new Date().toISOString();
|
|
214
|
+
this.emit("goal:cancelled", { goalId: goal.id });
|
|
215
|
+
}
|
|
216
|
+
this._shutdownAbort.abort(new Error("Agent session is closing"));
|
|
217
|
+
await Promise.allSettled([...this._runningLoops.values()]);
|
|
218
|
+
return { interrupted };
|
|
219
|
+
}
|
|
220
|
+
|
|
183
221
|
/**
|
|
184
222
|
* Cancel a goal.
|
|
185
223
|
*/
|
|
@@ -374,12 +412,13 @@ Goal: ${goal.description}
|
|
|
374
412
|
|
|
375
413
|
Available tools: read_file, write_file, edit_file, run_shell, search_files, list_dir, run_skill
|
|
376
414
|
|
|
377
|
-
Return a JSON array of steps,
|
|
415
|
+
Return a JSON array of steps, for example: [{ "description": "Describe the step", "tool": "tool_name", "params": {} }]
|
|
416
|
+
Populate params with the selected tool's actual arguments.
|
|
378
417
|
Only return the JSON array, no other text.`;
|
|
379
418
|
|
|
380
419
|
const response = await this._llmChat(
|
|
381
420
|
[{ role: "user", content: prompt }],
|
|
382
|
-
{ maxTokens: 1024 },
|
|
421
|
+
{ maxTokens: 1024, signal: this.signal },
|
|
383
422
|
);
|
|
384
423
|
|
|
385
424
|
// Parse steps from LLM response
|
|
@@ -396,6 +435,11 @@ Only return the JSON array, no other text.`;
|
|
|
396
435
|
}));
|
|
397
436
|
} catch (_err) {
|
|
398
437
|
// Fallback: single step
|
|
438
|
+
if (
|
|
439
|
+
_err?.runtimeLedgerPersistence === true ||
|
|
440
|
+
_err?.code === "CC_AGENT_EVOLUTION_INGRESS_FAILED"
|
|
441
|
+
)
|
|
442
|
+
throw _err;
|
|
399
443
|
return [
|
|
400
444
|
{
|
|
401
445
|
description: goal.description,
|
|
@@ -450,11 +494,12 @@ Should I:
|
|
|
450
494
|
2. Add a new prerequisite step
|
|
451
495
|
3. Skip this step and continue
|
|
452
496
|
|
|
453
|
-
Reply with a JSON object: { "action": "retry
|
|
497
|
+
Reply with a JSON object, for example: { "action": "retry", "newParams": {}, "newStep": { "description": "Corrective step", "tool": "tool_name", "params": {} } }
|
|
498
|
+
Set action to retry, add_step, or skip. Supply newParams for retry and newStep for add_step.`;
|
|
454
499
|
|
|
455
500
|
const response = await this._llmChat(
|
|
456
501
|
[{ role: "user", content: prompt }],
|
|
457
|
-
{ maxTokens: 512 },
|
|
502
|
+
{ maxTokens: 512, signal: this.signal },
|
|
458
503
|
);
|
|
459
504
|
|
|
460
505
|
const correction = this._parseJSON(response);
|
|
@@ -499,6 +544,11 @@ Reply with a JSON object: { "action": "retry|add_step|skip", "newParams": {...},
|
|
|
499
544
|
|
|
500
545
|
return false;
|
|
501
546
|
} catch (_err) {
|
|
547
|
+
if (
|
|
548
|
+
_err?.runtimeLedgerPersistence === true ||
|
|
549
|
+
_err?.code === "CC_AGENT_EVOLUTION_INGRESS_FAILED"
|
|
550
|
+
)
|
|
551
|
+
throw _err;
|
|
502
552
|
return false;
|
|
503
553
|
}
|
|
504
554
|
}
|
|
@@ -10,8 +10,9 @@ import { runPeerGroup } from "./agent-group-runner.js";
|
|
|
10
10
|
|
|
11
11
|
const DEFAULT_CRITERIA = ["quality", "performance", "readability"];
|
|
12
12
|
|
|
13
|
-
function
|
|
13
|
+
function throwTerminalModelFailure(error) {
|
|
14
14
|
if (error?.runtimeLedgerPersistence === true) throw error;
|
|
15
|
+
if (error?.code === "CC_AGENT_EVOLUTION_INGRESS_FAILED") throw error;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
const VARIANT_PROFILES = [
|
|
@@ -91,7 +92,7 @@ export async function compare({
|
|
|
91
92
|
// Ordinary variant failures remain comparable, but a host ledger failure
|
|
92
93
|
// must escape before judging can spend again or a partial result is emitted.
|
|
93
94
|
for (const outcome of runResult.results) {
|
|
94
|
-
|
|
95
|
+
throwTerminalModelFailure(outcome.error);
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
const generatedVariants = runResult.results.map((r) => {
|
|
@@ -145,7 +146,7 @@ REASON: (1-2 sentence justification)`;
|
|
|
145
146
|
winner = parseWinner(judgement) || generatedVariants[0]?.name || "unknown";
|
|
146
147
|
reason = parseReason(judgement) || "See detailed scores above.";
|
|
147
148
|
} catch (err) {
|
|
148
|
-
|
|
149
|
+
throwTerminalModelFailure(err);
|
|
149
150
|
reason = `Scoring error: ${err.message}`;
|
|
150
151
|
}
|
|
151
152
|
|
|
@@ -10,8 +10,9 @@ import { runPeerGroup } from "./agent-group-runner.js";
|
|
|
10
10
|
|
|
11
11
|
const DEFAULT_PERSPECTIVES = ["performance", "security", "maintainability"];
|
|
12
12
|
|
|
13
|
-
function
|
|
13
|
+
function throwTerminalModelFailure(error) {
|
|
14
14
|
if (error?.runtimeLedgerPersistence === true) throw error;
|
|
15
|
+
if (error?.code === "CC_AGENT_EVOLUTION_INGRESS_FAILED") throw error;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
const PERSPECTIVE_PROMPTS = {
|
|
@@ -104,7 +105,7 @@ export async function startDebate({
|
|
|
104
105
|
// rows. A durable usage-ledger failure is host-terminal, not review content:
|
|
105
106
|
// let the REPL latch stop this and every later paid call.
|
|
106
107
|
for (const outcome of runResult.results) {
|
|
107
|
-
|
|
108
|
+
throwTerminalModelFailure(outcome.error);
|
|
108
109
|
}
|
|
109
110
|
|
|
110
111
|
const reviews = runResult.results.map((r) => {
|
|
@@ -153,7 +154,7 @@ export async function startDebate({
|
|
|
153
154
|
finalVerdict = extractVerdict(summary);
|
|
154
155
|
consensusScore = extractConsensusScore(summary);
|
|
155
156
|
} catch (err) {
|
|
156
|
-
|
|
157
|
+
throwTerminalModelFailure(err);
|
|
157
158
|
summary = `Moderator error: ${err.message}`;
|
|
158
159
|
}
|
|
159
160
|
|
|
@@ -119,6 +119,11 @@ List all decisions you can find. If no explicit decisions are documented, infer
|
|
|
119
119
|
summary: `Found ${decisions.length} architectural decisions in ${targetPath}\n\n${decisions.map((d) => ` - ${d.title} (${d.status})`).join("\n")}`,
|
|
120
120
|
};
|
|
121
121
|
} catch (err) {
|
|
122
|
+
if (
|
|
123
|
+
err?.runtimeLedgerPersistence === true ||
|
|
124
|
+
err?.code === "CC_AGENT_EVOLUTION_INGRESS_FAILED"
|
|
125
|
+
)
|
|
126
|
+
throw err;
|
|
122
127
|
return {
|
|
123
128
|
decisions: [],
|
|
124
129
|
summary: `Decision extraction failed: ${err.message}`,
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import { LLMProviderRegistry, BUILT_IN_PROVIDERS } from "./llm-providers.js";
|
|
11
11
|
import { loadConfig } from "./config-manager.js";
|
|
12
12
|
import { applyConfigLlmDefaults } from "./llm-config-defaults.js";
|
|
13
|
+
import { captureAgentEvolutionIngress } from "./evolution/agent-evolution-ingress.js";
|
|
13
14
|
|
|
14
15
|
function plainUsage(value) {
|
|
15
16
|
return value && typeof value === "object" && !Array.isArray(value)
|
|
@@ -106,6 +107,8 @@ async function invokeChatCall(callWrapper, provider, model, call) {
|
|
|
106
107
|
* @param {string} [options.model] - Model name override
|
|
107
108
|
* @param {string} [options.baseUrl] - Base URL override
|
|
108
109
|
* @param {string} [options.apiKey] - API key override
|
|
110
|
+
* @param {object} [options.evolutionIngress] - Branded session ingress captured
|
|
111
|
+
* by the adapter; per-call options cannot remove or replace it.
|
|
109
112
|
* @param {(request: {call: function, provider: string, model: string}) => Promise<object>} [options.callWrapper]
|
|
110
113
|
* Optional host boundary around each real provider call. The callback
|
|
111
114
|
* may invoke `call({ signal })` to bind cancellation and resolves to a
|
|
@@ -114,6 +117,10 @@ async function invokeChatCall(callWrapper, provider, model, call) {
|
|
|
114
117
|
* @returns {(messages: object[], opts?: object) => Promise<string>}
|
|
115
118
|
*/
|
|
116
119
|
export function createChatFn(options = {}) {
|
|
120
|
+
const evolutionIngress =
|
|
121
|
+
options.evolutionIngress == null
|
|
122
|
+
? null
|
|
123
|
+
: captureAgentEvolutionIngress(options.evolutionIngress);
|
|
117
124
|
// Fill provider/model/baseUrl/apiKey from config.llm only when the caller
|
|
118
125
|
// gave no explicit provider AND no LLM_PROVIDER env override (both still win).
|
|
119
126
|
// Fail-open: a config read must never break chat construction.
|
|
@@ -140,6 +147,20 @@ export function createChatFn(options = {}) {
|
|
|
140
147
|
return async function chat(messages, opts = {}) {
|
|
141
148
|
const currentModel = opts.model || model;
|
|
142
149
|
const maxTokens = opts.maxTokens || 2048;
|
|
150
|
+
const requestSignal = (hostSignal) => {
|
|
151
|
+
const signals = [
|
|
152
|
+
...new Set([hostSignal, opts.signal, resolved.signal].filter(Boolean)),
|
|
153
|
+
];
|
|
154
|
+
return signals.length > 1 ? AbortSignal.any(signals) : signals[0];
|
|
155
|
+
};
|
|
156
|
+
// Run inside the host's per-call meter, immediately before provider encoding.
|
|
157
|
+
// Every invocation (including concurrent reviewers) gets fresh durable
|
|
158
|
+
// admission; the original conversation is never replaced in place.
|
|
159
|
+
const prepareMessages = async () =>
|
|
160
|
+
evolutionIngress === null
|
|
161
|
+
? messages
|
|
162
|
+
: (await evolutionIngress.prepareModelRequest({ messages, tools: [] }))
|
|
163
|
+
.messages;
|
|
143
164
|
|
|
144
165
|
if (provider === "ollama") {
|
|
145
166
|
const envelope = await invokeChatCall(
|
|
@@ -147,13 +168,14 @@ export function createChatFn(options = {}) {
|
|
|
147
168
|
provider,
|
|
148
169
|
currentModel,
|
|
149
170
|
async ({ signal = opts.signal || resolved.signal } = {}) => {
|
|
171
|
+
const modelMessages = await prepareMessages();
|
|
150
172
|
const res = await fetch(`${baseUrl}/api/chat`, {
|
|
151
173
|
method: "POST",
|
|
152
|
-
signal,
|
|
174
|
+
signal: requestSignal(signal),
|
|
153
175
|
headers: { "Content-Type": "application/json" },
|
|
154
176
|
body: JSON.stringify({
|
|
155
177
|
model: currentModel,
|
|
156
|
-
messages,
|
|
178
|
+
messages: modelMessages,
|
|
157
179
|
stream: false,
|
|
158
180
|
options: { num_predict: maxTokens },
|
|
159
181
|
}),
|
|
@@ -172,25 +194,24 @@ export function createChatFn(options = {}) {
|
|
|
172
194
|
if (provider === "anthropic") {
|
|
173
195
|
const key = resolved.apiKey || process.env[providerDef.apiKeyEnv];
|
|
174
196
|
if (!key) throw new Error("ANTHROPIC_API_KEY not set");
|
|
175
|
-
// Extract system message if present
|
|
176
|
-
const systemMsgs = messages.filter((m) => m.role === "system");
|
|
177
|
-
const otherMsgs = messages.filter((m) => m.role !== "system");
|
|
178
|
-
const body = {
|
|
179
|
-
model: currentModel,
|
|
180
|
-
max_tokens: maxTokens,
|
|
181
|
-
messages: otherMsgs,
|
|
182
|
-
};
|
|
183
|
-
if (systemMsgs.length > 0) {
|
|
184
|
-
body.system = systemMsgs.map((m) => m.content).join("\n");
|
|
185
|
-
}
|
|
186
197
|
const envelope = await invokeChatCall(
|
|
187
198
|
callWrapper,
|
|
188
199
|
provider,
|
|
189
200
|
currentModel,
|
|
190
201
|
async ({ signal = opts.signal || resolved.signal } = {}) => {
|
|
202
|
+
const modelMessages = await prepareMessages();
|
|
203
|
+
const systemMsgs = modelMessages.filter((m) => m.role === "system");
|
|
204
|
+
const body = {
|
|
205
|
+
model: currentModel,
|
|
206
|
+
max_tokens: maxTokens,
|
|
207
|
+
messages: modelMessages.filter((m) => m.role !== "system"),
|
|
208
|
+
...(systemMsgs.length
|
|
209
|
+
? { system: systemMsgs.map((m) => m.content).join("\n") }
|
|
210
|
+
: {}),
|
|
211
|
+
};
|
|
191
212
|
const res = await fetch(`${baseUrl}/messages`, {
|
|
192
213
|
method: "POST",
|
|
193
|
-
signal,
|
|
214
|
+
signal: requestSignal(signal),
|
|
194
215
|
headers: {
|
|
195
216
|
"Content-Type": "application/json",
|
|
196
217
|
"x-api-key": key,
|
|
@@ -218,16 +239,17 @@ export function createChatFn(options = {}) {
|
|
|
218
239
|
provider,
|
|
219
240
|
currentModel,
|
|
220
241
|
async ({ signal = opts.signal || resolved.signal } = {}) => {
|
|
242
|
+
const modelMessages = await prepareMessages();
|
|
221
243
|
const res = await fetch(`${baseUrl}/chat/completions`, {
|
|
222
244
|
method: "POST",
|
|
223
|
-
signal,
|
|
245
|
+
signal: requestSignal(signal),
|
|
224
246
|
headers: {
|
|
225
247
|
"Content-Type": "application/json",
|
|
226
248
|
Authorization: `Bearer ${key}`,
|
|
227
249
|
},
|
|
228
250
|
body: JSON.stringify({
|
|
229
251
|
model: currentModel,
|
|
230
|
-
messages,
|
|
252
|
+
messages: modelMessages,
|
|
231
253
|
max_tokens: maxTokens,
|
|
232
254
|
}),
|
|
233
255
|
});
|
|
@@ -2,9 +2,15 @@ import crypto from "node:crypto";
|
|
|
2
2
|
import evolutionRun from "@chainlesschain/session-core/evolution-run";
|
|
3
3
|
|
|
4
4
|
import { EvolutionEvidenceArtifactAdapter } from "./evolution-evidence-artifact-adapter.js";
|
|
5
|
+
import { EVOLUTION_AGENT_MODEL_PROJECTION_RULESET_DIGEST } from "./evolution-evidence-projector.js";
|
|
5
6
|
import { EvolutionRunLedgerAdapter } from "./evolution-run-ledger-adapter.js";
|
|
6
7
|
import { captureEvolutionRunWikiMaintenanceProducer } from "./evolution-run-wiki-maintenance-source.js";
|
|
7
8
|
import { WIKI_MAINTENANCE_TRIGGER_KIND } from "./wiki-maintenance-trigger-ledger-adapter.js";
|
|
9
|
+
import { captureEvolutionReleaseTrain } from "./evolution-release-train.js";
|
|
10
|
+
import {
|
|
11
|
+
snapshotAgentModelRequest,
|
|
12
|
+
buildAgentModelRequest,
|
|
13
|
+
} from "./agent-model-projection.js";
|
|
8
14
|
|
|
9
15
|
const { EVOLUTION_RUN_EVENT_SCHEMA, EVENT_TYPES } = evolutionRun;
|
|
10
16
|
|
|
@@ -80,15 +86,19 @@ function normalizeId(value, label) {
|
|
|
80
86
|
return result;
|
|
81
87
|
}
|
|
82
88
|
|
|
89
|
+
function ingressFailure(cause) {
|
|
90
|
+
if (cause?.code === AGENT_EVOLUTION_INGRESS_FAILED_CODE) return cause;
|
|
91
|
+
const error = new Error(
|
|
92
|
+
`Agent evolution ingress failed: ${cause?.message || String(cause)}`,
|
|
93
|
+
{ cause },
|
|
94
|
+
);
|
|
95
|
+
error.code = AGENT_EVOLUTION_INGRESS_FAILED_CODE;
|
|
96
|
+
return error;
|
|
97
|
+
}
|
|
98
|
+
|
|
83
99
|
function guardIngress(operation) {
|
|
84
100
|
return Promise.resolve(operation).catch((cause) => {
|
|
85
|
-
|
|
86
|
-
const error = new Error(
|
|
87
|
-
`Agent evolution ingress failed: ${cause?.message || String(cause)}`,
|
|
88
|
-
{ cause },
|
|
89
|
-
);
|
|
90
|
-
error.code = AGENT_EVOLUTION_INGRESS_FAILED_CODE;
|
|
91
|
-
throw error;
|
|
101
|
+
throw ingressFailure(cause);
|
|
92
102
|
});
|
|
93
103
|
}
|
|
94
104
|
|
|
@@ -97,6 +107,7 @@ export function createAgentEvolutionIngress({
|
|
|
97
107
|
runAdapter,
|
|
98
108
|
sourceEnvelopeAuthority,
|
|
99
109
|
wikiMaintenanceProducer = null,
|
|
110
|
+
releaseTrain = null,
|
|
100
111
|
completionTriggerKind = WIKI_MAINTENANCE_TRIGGER_KIND.SESSION_END,
|
|
101
112
|
now = () => new Date(),
|
|
102
113
|
idGenerator = () => crypto.randomUUID(),
|
|
@@ -117,6 +128,8 @@ export function createAgentEvolutionIngress({
|
|
|
117
128
|
wikiMaintenanceProducer === null
|
|
118
129
|
? null
|
|
119
130
|
: captureEvolutionRunWikiMaintenanceProducer(wikiMaintenanceProducer);
|
|
131
|
+
const completionReleaseTrain =
|
|
132
|
+
releaseTrain === null ? null : captureEvolutionReleaseTrain(releaseTrain);
|
|
120
133
|
if (
|
|
121
134
|
![
|
|
122
135
|
WIKI_MAINTENANCE_TRIGGER_KIND.SESSION_END,
|
|
@@ -132,9 +145,22 @@ export function createAgentEvolutionIngress({
|
|
|
132
145
|
);
|
|
133
146
|
const descriptor = runAdapter.descriptor;
|
|
134
147
|
let tail = Promise.resolve();
|
|
148
|
+
let modelAdmissionFailure = null;
|
|
135
149
|
|
|
136
|
-
const serialize = (operation) => {
|
|
137
|
-
const
|
|
150
|
+
const serialize = (operation, latchModelFailure = false) => {
|
|
151
|
+
const invoke = latchModelFailure
|
|
152
|
+
? async () => {
|
|
153
|
+
try {
|
|
154
|
+
return await operation();
|
|
155
|
+
} catch (cause) {
|
|
156
|
+
// Latch inside the serialized operation, before releasing the queue.
|
|
157
|
+
// A complete() already queued by another caller cannot win this race.
|
|
158
|
+
modelAdmissionFailure = ingressFailure(cause);
|
|
159
|
+
throw modelAdmissionFailure;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
: operation;
|
|
163
|
+
const pending = tail.then(invoke, invoke);
|
|
138
164
|
tail = pending.catch(() => undefined);
|
|
139
165
|
return pending;
|
|
140
166
|
};
|
|
@@ -164,9 +190,10 @@ export function createAgentEvolutionIngress({
|
|
|
164
190
|
}).projection;
|
|
165
191
|
};
|
|
166
192
|
|
|
167
|
-
const ingest = (kind, evidence, options = {}) =>
|
|
193
|
+
const ingest = (kind, evidence, options = {}, modelRequest = null) =>
|
|
168
194
|
guardIngress(
|
|
169
195
|
serialize(async () => {
|
|
196
|
+
if (modelAdmissionFailure !== null) throw modelAdmissionFailure;
|
|
170
197
|
const projection = appendStarted();
|
|
171
198
|
if (projection.status === "completed") {
|
|
172
199
|
throw new Error(
|
|
@@ -181,7 +208,7 @@ export function createAgentEvolutionIngress({
|
|
|
181
208
|
options.occurredAt ?? currentTimestamp(),
|
|
182
209
|
"Agent evidence occurredAt",
|
|
183
210
|
);
|
|
184
|
-
const payload = clone(evidence);
|
|
211
|
+
const payload = modelRequest ?? clone(evidence);
|
|
185
212
|
const sourceEnvelope = await issueSourceEnvelope(
|
|
186
213
|
Object.freeze({
|
|
187
214
|
schema: AGENT_EVOLUTION_INGRESS_SCHEMA,
|
|
@@ -193,10 +220,17 @@ export function createAgentEvolutionIngress({
|
|
|
193
220
|
evidence: payload,
|
|
194
221
|
}),
|
|
195
222
|
);
|
|
196
|
-
const
|
|
223
|
+
const projectionInput = {
|
|
197
224
|
sourceEnvelope,
|
|
198
225
|
payload,
|
|
199
|
-
}
|
|
226
|
+
};
|
|
227
|
+
const persisted =
|
|
228
|
+
modelRequest === null
|
|
229
|
+
? await evidenceAdapter.projectAndPersist(projectionInput)
|
|
230
|
+
: await EvolutionEvidenceArtifactAdapter.prototype.projectAndPersistAgentModelRequest.call(
|
|
231
|
+
evidenceAdapter,
|
|
232
|
+
projectionInput,
|
|
233
|
+
);
|
|
200
234
|
if (
|
|
201
235
|
persisted?.tenantId !== descriptor.tenantId ||
|
|
202
236
|
persisted.evidenceId == null ||
|
|
@@ -208,7 +242,7 @@ export function createAgentEvolutionIngress({
|
|
|
208
242
|
);
|
|
209
243
|
}
|
|
210
244
|
const current = runAdapter.load();
|
|
211
|
-
|
|
245
|
+
const appended = runAdapter.appendEvent({
|
|
212
246
|
schema: EVOLUTION_RUN_EVENT_SCHEMA,
|
|
213
247
|
tenantId: descriptor.tenantId,
|
|
214
248
|
runId: descriptor.runId,
|
|
@@ -225,7 +259,37 @@ export function createAgentEvolutionIngress({
|
|
|
225
259
|
derivationManifestDigest: persisted.manifest.digest,
|
|
226
260
|
},
|
|
227
261
|
});
|
|
228
|
-
|
|
262
|
+
if (modelRequest === null) return appended;
|
|
263
|
+
// Resolve the published manifest and every attested component afresh.
|
|
264
|
+
// The prototype call requires the real adapter's private state; an
|
|
265
|
+
// instance-shaped facade cannot mint model-visible input.
|
|
266
|
+
const resolved =
|
|
267
|
+
await EvolutionEvidenceArtifactAdapter.prototype.resolve.call(
|
|
268
|
+
evidenceAdapter,
|
|
269
|
+
persisted,
|
|
270
|
+
);
|
|
271
|
+
if (
|
|
272
|
+
resolved.verification.verified !== true ||
|
|
273
|
+
resolved.verification.tenantId !== descriptor.tenantId ||
|
|
274
|
+
resolved.bundle.modelProjection.rulesetDigest !==
|
|
275
|
+
EVOLUTION_AGENT_MODEL_PROJECTION_RULESET_DIGEST ||
|
|
276
|
+
resolved.bundle.modelProjection.evidenceId !== persisted.evidenceId
|
|
277
|
+
) {
|
|
278
|
+
throw new Error("Agent model projection readback is unbound");
|
|
279
|
+
}
|
|
280
|
+
// A concurrent writer/completion must not make this stale admission
|
|
281
|
+
// authoritative. Reauthenticate the exact committed Run frontier.
|
|
282
|
+
if (
|
|
283
|
+
digest(runAdapter.load().projection) !== digest(appended.projection)
|
|
284
|
+
) {
|
|
285
|
+
throw new Error("Agent model projection Run frontier changed");
|
|
286
|
+
}
|
|
287
|
+
if (modelAdmissionFailure !== null) throw modelAdmissionFailure;
|
|
288
|
+
return buildAgentModelRequest(
|
|
289
|
+
modelRequest,
|
|
290
|
+
resolved.bundle.modelProjection,
|
|
291
|
+
);
|
|
292
|
+
}, modelRequest !== null),
|
|
229
293
|
);
|
|
230
294
|
|
|
231
295
|
const ingress = Object.freeze({
|
|
@@ -233,6 +297,18 @@ export function createAgentEvolutionIngress({
|
|
|
233
297
|
tenantId: descriptor.tenantId,
|
|
234
298
|
runId: descriptor.runId,
|
|
235
299
|
start: () => guardIngress(serialize(() => appendStarted())),
|
|
300
|
+
prepareModelRequest: (request) => {
|
|
301
|
+
if (modelAdmissionFailure !== null)
|
|
302
|
+
return Promise.reject(modelAdmissionFailure);
|
|
303
|
+
let snapshot;
|
|
304
|
+
try {
|
|
305
|
+
snapshot = snapshotAgentModelRequest(request);
|
|
306
|
+
} catch (error) {
|
|
307
|
+
modelAdmissionFailure = ingressFailure(error);
|
|
308
|
+
return Promise.reject(modelAdmissionFailure);
|
|
309
|
+
}
|
|
310
|
+
return ingest("model-input", snapshot, {}, snapshot);
|
|
311
|
+
},
|
|
236
312
|
ingestUserPrompt: (input, options) =>
|
|
237
313
|
ingest("user-prompt", { input: clone(input) }, options),
|
|
238
314
|
ingestAgentEvent: (event, options) => {
|
|
@@ -250,6 +326,7 @@ export function createAgentEvolutionIngress({
|
|
|
250
326
|
complete: (options = {}) =>
|
|
251
327
|
guardIngress(
|
|
252
328
|
serialize(async () => {
|
|
329
|
+
if (modelAdmissionFailure !== null) throw modelAdmissionFailure;
|
|
253
330
|
const loaded = runAdapter.load();
|
|
254
331
|
let projection;
|
|
255
332
|
if (loaded.projection?.status === "completed") {
|
|
@@ -281,6 +358,9 @@ export function createAgentEvolutionIngress({
|
|
|
281
358
|
runId: descriptor.runId,
|
|
282
359
|
});
|
|
283
360
|
}
|
|
361
|
+
if (completionReleaseTrain !== null) {
|
|
362
|
+
await completionReleaseTrain.run();
|
|
363
|
+
}
|
|
284
364
|
return projection;
|
|
285
365
|
}),
|
|
286
366
|
),
|
|
@@ -19,6 +19,11 @@ import {
|
|
|
19
19
|
} from "./evolution-ledger-file-backend.js";
|
|
20
20
|
import { EvolutionRunLedgerAdapter } from "./evolution-run-ledger-adapter.js";
|
|
21
21
|
import { EvolutionWorkbenchMetricsLedgerAdapter } from "./evolution-workbench-metrics-ledger-adapter.js";
|
|
22
|
+
import { EvolutionReleaseTrainLedgerAdapter } from "./evolution-release-train-ledger-adapter.js";
|
|
23
|
+
import { WikiSkillProposalLedgerAdapter } from "./wiki-skill-proposal-ledger-adapter.js";
|
|
24
|
+
import { EvolutionReleaseTrainStageOutputLedgerAdapter } from "./evolution-release-train-stage-output-ledger-adapter.js";
|
|
25
|
+
import { createEvolutionReleaseTrainDomainStages } from "./evolution-release-train-domain-stages.js";
|
|
26
|
+
import { createEvolutionReleaseTrain } from "./evolution-release-train.js";
|
|
22
27
|
import { captureSkillOutcomeSourceCatalogAuthority } from "./skill-outcome-source-catalog-authority.js";
|
|
23
28
|
import {
|
|
24
29
|
captureAgentEvolutionIngress,
|
|
@@ -55,6 +60,8 @@ const ARTIFACT_AUTHORITY_KEYS = new Set([
|
|
|
55
60
|
const SKILL_OUTCOME_SOURCE_KEYS = new Set(["composition", "skillName"]);
|
|
56
61
|
const SKILL_OUTCOME_CATALOG_ENTRY_KEYS = new Set(["runId", "skillNames"]);
|
|
57
62
|
const MAX_SKILL_OUTCOME_SOURCES = 128;
|
|
63
|
+
const RELEASE_TRAIN_STAGE_KEYS = new Set(["plan", "stages"]);
|
|
64
|
+
const RELEASE_TRAIN_DOMAIN_KEYS = new Set(["plan", "domain"]);
|
|
58
65
|
|
|
59
66
|
function exactRecord(value, keys, label) {
|
|
60
67
|
if (
|
|
@@ -183,6 +190,7 @@ export function createAgentEvolutionRuntimeComposition({
|
|
|
183
190
|
evidenceIdGenerator,
|
|
184
191
|
ingressIdGenerator,
|
|
185
192
|
wikiMaintenanceProducer = null,
|
|
193
|
+
releaseTrain: releaseTrainInput = null,
|
|
186
194
|
completionTriggerKind,
|
|
187
195
|
secure = true,
|
|
188
196
|
fsImpl,
|
|
@@ -376,11 +384,84 @@ export function createAgentEvolutionRuntimeComposition({
|
|
|
376
384
|
skillOutcomeReaders.set(skillName, reader);
|
|
377
385
|
return reader;
|
|
378
386
|
});
|
|
387
|
+
let releaseTrain = null;
|
|
388
|
+
if (releaseTrainInput !== null) {
|
|
389
|
+
const releaseTrainKeys = Object.hasOwn(releaseTrainInput, "domain")
|
|
390
|
+
? RELEASE_TRAIN_DOMAIN_KEYS
|
|
391
|
+
: RELEASE_TRAIN_STAGE_KEYS;
|
|
392
|
+
const releaseTrainConfig = exactRecord(
|
|
393
|
+
releaseTrainInput,
|
|
394
|
+
releaseTrainKeys,
|
|
395
|
+
"releaseTrain",
|
|
396
|
+
);
|
|
397
|
+
if (
|
|
398
|
+
releaseTrainConfig.plan?.tenantId !== tenantId ||
|
|
399
|
+
typeof releaseTrainConfig.plan?.skillId !== "string"
|
|
400
|
+
) {
|
|
401
|
+
throw new TypeError(
|
|
402
|
+
"releaseTrain plan must belong to the composition tenant",
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
const releaseTrainAdapter = new EvolutionReleaseTrainLedgerAdapter({
|
|
406
|
+
descriptor: {
|
|
407
|
+
tenantId,
|
|
408
|
+
artifactTenantId: tenantId,
|
|
409
|
+
skillName: releaseTrainConfig.plan.skillId,
|
|
410
|
+
audience,
|
|
411
|
+
purpose: "evolution-ledger",
|
|
412
|
+
},
|
|
413
|
+
artifactPorts,
|
|
414
|
+
ledger: backend.ledger,
|
|
415
|
+
ledgerArtifactResolver,
|
|
416
|
+
clock: () => new Date(clock()).toISOString(),
|
|
417
|
+
});
|
|
418
|
+
let stages = releaseTrainConfig.stages;
|
|
419
|
+
if (Object.hasOwn(releaseTrainConfig, "domain")) {
|
|
420
|
+
const proposalLedger = new WikiSkillProposalLedgerAdapter({
|
|
421
|
+
descriptor: {
|
|
422
|
+
tenantId,
|
|
423
|
+
artifactTenantId: tenantId,
|
|
424
|
+
evolutionRunId: runId,
|
|
425
|
+
skillName: releaseTrainConfig.plan.skillId,
|
|
426
|
+
audience,
|
|
427
|
+
purpose: "evolution-ledger",
|
|
428
|
+
},
|
|
429
|
+
artifactPorts,
|
|
430
|
+
ledger: backend.ledger,
|
|
431
|
+
ledgerArtifactResolver,
|
|
432
|
+
});
|
|
433
|
+
const outputLedger = new EvolutionReleaseTrainStageOutputLedgerAdapter({
|
|
434
|
+
descriptor: {
|
|
435
|
+
tenantId,
|
|
436
|
+
artifactTenantId: tenantId,
|
|
437
|
+
skillName: releaseTrainConfig.plan.skillId,
|
|
438
|
+
audience,
|
|
439
|
+
purpose: "evolution-ledger",
|
|
440
|
+
},
|
|
441
|
+
artifactPorts,
|
|
442
|
+
ledger: backend.ledger,
|
|
443
|
+
ledgerArtifactResolver,
|
|
444
|
+
});
|
|
445
|
+
stages = createEvolutionReleaseTrainDomainStages({
|
|
446
|
+
domain: releaseTrainConfig.domain,
|
|
447
|
+
proposalLedger,
|
|
448
|
+
outputLedger,
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
releaseTrain = createEvolutionReleaseTrain({
|
|
452
|
+
plan: releaseTrainConfig.plan,
|
|
453
|
+
stateStore: releaseTrainAdapter.createStateStore(),
|
|
454
|
+
stages,
|
|
455
|
+
clock,
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
|
|
379
459
|
const evolutionIngress = createAgentEvolutionIngress({
|
|
380
460
|
evidenceAdapter,
|
|
381
461
|
runAdapter,
|
|
382
462
|
sourceEnvelopeAuthority: ports.sourceEnvelope,
|
|
383
463
|
wikiMaintenanceProducer,
|
|
464
|
+
releaseTrain,
|
|
384
465
|
...(completionTriggerKind === undefined ? {} : { completionTriggerKind }),
|
|
385
466
|
now: () => new Date(clock()),
|
|
386
467
|
idGenerator: ingressIdGenerator,
|
|
@@ -395,6 +476,7 @@ export function createAgentEvolutionRuntimeComposition({
|
|
|
395
476
|
loadRun: Object.freeze(() => runAdapter.load()),
|
|
396
477
|
ledgerDescriptor: backend.descriptor,
|
|
397
478
|
storage,
|
|
479
|
+
releaseTrain,
|
|
398
480
|
});
|
|
399
481
|
return composition;
|
|
400
482
|
}
|