chainlesschain 0.166.126 → 0.166.127
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 +21 -3
- package/package.json +1 -1
- package/src/assets/linux-subreaper/linux-arm64/manifest.json +1 -1
- package/src/assets/linux-subreaper/linux-x64/manifest.json +1 -1
- package/src/assets/web-panel/.build-hash +1 -1
- package/src/assets/web-panel/assets/{AIOps-C6HzxpS_.js → AIOps-DkSOwKNn.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-Ba2WP_mo.js → ActionButton-CaYSnkeR.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-MEZ-eSYO.js → Analytics-D8kEgXLP.js} +3 -3
- package/src/assets/web-panel/assets/{AppLayout-B1F4dMJl.js → AppLayout-D43FaO4a.js} +3 -3
- package/src/assets/web-panel/assets/{Artifacts-D50kNasl.js → Artifacts-DfxY2Gqs.js} +1 -1
- package/src/assets/web-panel/assets/{Audit-GzrP6OYx.js → Audit-0ogv1Zu5.js} +1 -1
- package/src/assets/web-panel/assets/{BackgroundAgents-PJ3RWIS5.js → BackgroundAgents-BhLnn-Gw.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-DV0wK73Y.js → Backup-D4591rlk.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-BqWPlsK1.js → BaseInput-gK1PjPDZ.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-D0yNPOid.js → Chat-CCDmOYwg.js} +5 -5
- package/src/assets/web-panel/assets/{ChatBubbleRenderer-D0De01yM.js → ChatBubbleRenderer-CnpWe3dp.js} +1 -1
- package/src/assets/web-panel/assets/{Checkbox-GOdS6Fpz.js → Checkbox-DG4PRH9M.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-CcvPMAwP.js → Codegen-DtJxGiSg.js} +1 -1
- package/src/assets/web-panel/assets/{Col-07yH3vgP.js → Col-4wGBC25p.js} +1 -1
- package/src/assets/web-panel/assets/{Community-cZI0W7u_.js → Community-dOCSc8t-.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-BP6fwhXB.js → Compact-Du4kXsyN.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-BvwQCjXA.js → Compliance-BbI5XMcz.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-yhhvyKZU.js → Cowork-CbQRpyiK.js} +3 -3
- package/src/assets/web-panel/assets/{Cron-Bpji2uez.js → Cron-CtWy2bMC.js} +2 -2
- package/src/assets/web-panel/assets/{Crosschain-BZ7XwkuS.js → Crosschain-CzdM5hF6.js} +1 -1
- package/src/assets/web-panel/assets/{DID-BJ-Fw-Uk.js → DID-CcBboBJN.js} +2 -2
- package/src/assets/web-panel/assets/{Dashboard-3FbsaKoR.js → Dashboard-I7m0oCeC.js} +2 -2
- package/src/assets/web-panel/assets/{Dropdown-DP8yuWyM.js → Dropdown-CKIy2Ikn.js} +1 -1
- package/src/assets/web-panel/assets/{EmailListRenderer-Co3i-4ca.js → EmailListRenderer-BNuxCq89.js} +1 -1
- package/src/assets/web-panel/assets/EvolutionSettings-BeBovLZs.js +1 -0
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-CPjecSCb.js → FamilyGuardDashboard-QThmET-n.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-CJkZPulM.js → Federation-Bqf7YYlV.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-CU0YWiAZ.js → FormItemContext-DZAM28ve.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-kTxvvpiU.js → GenericCardRenderer-DunXFYML.js} +1 -1
- package/src/assets/web-panel/assets/{Git-Cs6SFvMq.js → Git-BgwOjaMf.js} +2 -2
- package/src/assets/web-panel/assets/{Governance-CSs_8thn.js → Governance-B1za4wCP.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-D7yCromD.js → Inference-DMPqX1oN.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-C6BcMDRm.js → KnowledgeGraph-ChDn3okr.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-Cz20G07I.js → Logs-BQoPB6-O.js} +2 -2
- package/src/assets/web-panel/assets/MarkdownRenderer-uS1yHX12.js +1 -0
- package/src/assets/web-panel/assets/{Marketplace-BZIopTsG.js → Marketplace-DZXEaPpe.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-OHaHium7.js → McpTools-CZbVOFaG.js} +3 -3
- package/src/assets/web-panel/assets/{Memory-DBNBmoM9.js → Memory-Cl3T8asu.js} +2 -2
- package/src/assets/web-panel/assets/{MobileBridge-BH-ajP-j.js → MobileBridge-DK_ayU9I.js} +1 -1
- package/src/assets/web-panel/assets/{MobileProjects-DwiFGqpp.js → MobileProjects-DEWAA2gT.js} +1 -1
- package/src/assets/web-panel/assets/{Mtc-BmT_VyZL.js → Mtc-z-XAWzMh.js} +2 -2
- package/src/assets/web-panel/assets/{MtcAudit-D24wmjmR.js → MtcAudit-CX7qJvQS.js} +4 -4
- package/src/assets/web-panel/assets/{Multisig-DwWj1F8f.js → Multisig-DiQlKgxx.js} +3 -3
- package/src/assets/web-panel/assets/{NLProgramming-DXBRBwhU.js → NLProgramming-Ciuxcu00.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-C1QG3x5c.js → Notes-BAvqNw_6.js} +3 -3
- package/src/assets/web-panel/assets/{NotificationSettings-BnlSMFBJ.js → NotificationSettings-DkHDTslA.js} +1 -1
- package/src/assets/web-panel/assets/{OrderTableRenderer-uuW0wQc0.js → OrderTableRenderer--WZdD2oV.js} +1 -1
- package/src/assets/web-panel/assets/{Organization-CXGC9RYr.js → Organization-Bv6bMLCe.js} +4 -4
- package/src/assets/web-panel/assets/{Overflow-C3RxcBqQ.js → Overflow-Bwoz_oq1.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-DTh-AqFm.js → P2P-De7T0ZeB.js} +2 -2
- package/src/assets/web-panel/assets/{PdhVaultBrowser-IX0sEKne.js → PdhVaultBrowser-Dblr2x25.js} +3 -3
- package/src/assets/web-panel/assets/{Permissions-CpcyEP_G.js → Permissions-C-jAt-cg.js} +4 -4
- package/src/assets/web-panel/assets/{PersonalDataHub-I5zN_SIn.js → PersonalDataHub-yXeXDMgf.js} +3 -3
- package/src/assets/web-panel/assets/{Pipeline-CVg3gNFN.js → Pipeline-C8CYoLOa.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-Dffk2pq9.js → Privacy-B-gwnOGT.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-B8Y3VsbN.js → ProjectInit-CbNjHiBV.js} +2 -2
- package/src/assets/web-panel/assets/{ProjectSettings-Ds_4fCFG.js → ProjectSettings-BMUY0GCP.js} +2 -2
- package/src/assets/web-panel/assets/Projects-DpCaWXv6.js +1 -0
- package/src/assets/web-panel/assets/{Providers-CI9tKh8S.js → Providers-K_tlWkON.js} +1 -1
- package/src/assets/web-panel/assets/{QrScannerModal-DOrmL6X3.js → QrScannerModal-2RSZDzJI.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-CSSlopeF.js → QuickAsk-mhbcQRMI.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-fKDWVJgw.js → Recommend-BXm0uG0q.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-BKlbq1C0.js → RemoteSession-xhOpmNZG.js} +3 -3
- package/src/assets/web-panel/assets/{Reputation-DhOFTKRG.js → Reputation-CwbCWB-3.js} +1 -1
- package/src/assets/web-panel/assets/{Row-ckVQk62z.js → Row-BdAjmDBO.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-CShivptZ.js → RssFeed-Cq4LZ9WU.js} +2 -2
- package/src/assets/web-panel/assets/{Search-PJpI8T9h.js → Search-C_I6B-4l.js} +1 -1
- package/src/assets/web-panel/assets/{Security-CVQPej3p.js → Security-CdH6mzL-.js} +3 -3
- package/src/assets/web-panel/assets/{Services-CWJj07ru.js → Services-CWu1wqtS.js} +2 -2
- package/src/assets/web-panel/assets/{Skeleton-CNxdd41V.js → Skeleton-daw9DiVM.js} +1 -1
- package/src/assets/web-panel/assets/{Skills-AD-xWT2V.js → Skills-CmurIxkM.js} +1 -1
- package/src/assets/web-panel/assets/{Sla-BuDuN1ak.js → Sla-cETA5aPO.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-WYryugQK.js → SpeechSettings-B1llZgu3.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-Dxz8z_yO.js → SyncSettings-DufZ-B2q.js} +2 -2
- package/src/assets/web-panel/assets/{Tasks-BCQFGo6S.js → Tasks-PfRLKTFY.js} +1 -1
- package/src/assets/web-panel/assets/{Templates-CNU1xhuV.js → Templates-DGtz-vT8.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-CFsqv744.js → Tenant-JeKYLN0b.js} +1 -1
- package/src/assets/web-panel/assets/{Terminal--7FxkXMc.js → Terminal-BiMsF2Y0.js} +2 -2
- package/src/assets/web-panel/assets/{TimelineRenderer-Cqtg4CN-.js → TimelineRenderer-DhcBAGPg.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-DQD8oVJ3.js → Tokens-DpIg-0ju.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-BujLIIRO.js → Trigger-DreKHxyb.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-_3yRNM57.js → Trust-D7ByQvBQ.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-C_QKp9Ig.js → UkeySign-OudyQByy.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-BkgP1c6L.js → VideoEditing-BhU6nzCF.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-CTHaNBha.js → Wallet-BCEpB6E0.js} +4 -4
- package/src/assets/web-panel/assets/{WebAuthn-CbXcDn_T.js → WebAuthn-DwjAM5Mr.js} +5 -5
- package/src/assets/web-panel/assets/{WorkflowEditor-BUOyHiTN.js → WorkflowEditor-ChQqlAmY.js} +1 -1
- package/src/assets/web-panel/assets/{chat-DTG5Geyv.js → chat-CzUKWqTy.js} +1 -1
- package/src/assets/web-panel/assets/{colors-BAdqWSlv.js → colors-D3Y_Pvu4.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-DYh7YdLa.js → compact-item-ByyPRfkA.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-mPOA80GV.js → createContext-Dt5PF6VI.js} +1 -1
- package/src/assets/web-panel/assets/devWarning-BgSxkkQ3.js +1 -0
- package/src/assets/web-panel/assets/{hasIn-Gzp3HIXP.js → hasIn-BuIaEKuC.js} +1 -1
- package/src/assets/web-panel/assets/{index-Byln7kVS.js → index-1YgdY0Vq.js} +1 -1
- package/src/assets/web-panel/assets/{index-Brr8ALy2.js → index-B600riYP.js} +1 -1
- package/src/assets/web-panel/assets/{index-C9uyUX6z.js → index-BFQGN97S.js} +1 -1
- package/src/assets/web-panel/assets/{index-DfsFQ-DX.js → index-BO29sPX8.js} +1 -1
- package/src/assets/web-panel/assets/{index-Ch0qsp2p.js → index-BSWTyRhI.js} +1 -1
- package/src/assets/web-panel/assets/{index-CqSb5LAk.js → index-BcqZAAr5.js} +1 -1
- package/src/assets/web-panel/assets/{index-OkiNUps8.js → index-BdvZNMNm.js} +1 -1
- package/src/assets/web-panel/assets/{index-BjRl7Jhc.js → index-BmVY2f7I.js} +1 -1
- package/src/assets/web-panel/assets/{index-DxpX3q8j.js → index-BwlY7Yap.js} +1 -1
- package/src/assets/web-panel/assets/{index-Diwevwx7.js → index-BztqxXMP.js} +1 -1
- package/src/assets/web-panel/assets/{index-DCw8rGv8.js → index-CAfX0VyL.js} +1 -1
- package/src/assets/web-panel/assets/{index-y-TWtPEX.js → index-CByWkXdO.js} +1 -1
- package/src/assets/web-panel/assets/{index-CchNIYmQ.js → index-CCBm8_o4.js} +1 -1
- package/src/assets/web-panel/assets/{index-B1UsX4Hx.js → index-CDTS4qJm.js} +1 -1
- package/src/assets/web-panel/assets/{index-CsgxUKpZ.js → index-CFXZ9lbO.js} +1 -1
- package/src/assets/web-panel/assets/{index-BYE61P6D.js → index-COsjgjvP.js} +1 -1
- package/src/assets/web-panel/assets/{index-og41WNLX.js → index-CZX4_hGp.js} +1 -1
- package/src/assets/web-panel/assets/{index-CcZz24sL.js → index-Cb7MzML-.js} +1 -1
- package/src/assets/web-panel/assets/{index-CGQfiMVc.js → index-CgPKUSe4.js} +1 -1
- package/src/assets/web-panel/assets/{index-CdleQSUU.js → index-CmrfHS36.js} +1 -1
- package/src/assets/web-panel/assets/{index-CR3ZvuY6.js → index-D51wU4q-.js} +1 -1
- package/src/assets/web-panel/assets/index-D5v6roiB.js +1 -0
- package/src/assets/web-panel/assets/{index-D_65ERlZ.js → index-D7QSTEjb.js} +1 -1
- package/src/assets/web-panel/assets/{index-CFXlLyEF.js → index-DHzVIQLX.js} +1 -1
- package/src/assets/web-panel/assets/{index-CYbMpkmP.js → index-DSXjiZAV.js} +1 -1
- package/src/assets/web-panel/assets/{index-DbdMPF9D.js → index-DSgroT-P.js} +3 -3
- package/src/assets/web-panel/assets/{index-CLuIQO9d.js → index-DWW5svXU.js} +1 -1
- package/src/assets/web-panel/assets/index-DgXZCvH5.js +1 -0
- package/src/assets/web-panel/assets/{index-CzkgWUAt.js → index-Di78LDr8.js} +1 -1
- package/src/assets/web-panel/assets/{index-BQZVcznI.js → index-Dlec7Sr4.js} +1 -1
- package/src/assets/web-panel/assets/{index-BH067bfd.js → index-DpAqy6Co.js} +1 -1
- package/src/assets/web-panel/assets/{index-C52u0SKj.js → index-DxVLI-Iu.js} +1 -1
- package/src/assets/web-panel/assets/{index-X1iyU-gh.js → index-EtrWRKu2.js} +1 -1
- package/src/assets/web-panel/assets/{index-BKYYncej.js → index-F-T8AHeo.js} +1 -1
- package/src/assets/web-panel/assets/{index-ByUjSWIg.js → index-GyTOYTFg.js} +1 -1
- package/src/assets/web-panel/assets/{index-BL46pkYn.js → index-NFqKQquS.js} +1 -1
- package/src/assets/web-panel/assets/{index-z3FnuAKK.js → index-_oJnnOnZ.js} +1 -1
- package/src/assets/web-panel/assets/{index-C5MHbkbK.js → index-gg5zO3aD.js} +1 -1
- package/src/assets/web-panel/assets/{index-CMScSzoi.js → index-huWw0XBb.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-DmksOjaL.js → initDefaultProps-Bny6G13G.js} +1 -1
- package/src/assets/web-panel/assets/{motion-Cb3y_Vsi.js → motion-DRhRj_uM.js} +1 -1
- package/src/assets/web-panel/assets/{move-DP-3qcfq.js → move-D0wKnhYr.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-BCDUfUEO.js → mtc-parser-BXXSTJBk.js} +1 -1
- package/src/assets/web-panel/assets/{omit-MH-O2PY6.js → omit-d8t9Yze4.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-BaZORqPr.js → pickAttrs-nyB6BMe6.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-Dkp_5tvw.js → placementArrow-CSFyBNA2.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-DBJSmMkS.js → responsiveObserve-DYmiKhJa.js} +1 -1
- package/src/assets/web-panel/assets/{slide-Cc6qGIgj.js → slide-D4KZSRmt.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-FundADw-.js → statusUtils-BcrcPeFm.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-qOO9jMdb.js → styleChecker-BFgOb1vz.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-BYbRYwok.js → useFlexGapSupport-DQ5qSQlN.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-D6PqFBtt.js → useFs-Cafq069l.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-mJpur_zt.js → usePersonalDataHub-DTma9Ary.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-ZFVHKenK.js → vnode-HvC2-bE9.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-Ca_KBv2o.js → zoom-AZxADWXu.js} +1 -1
- package/src/assets/web-panel/index.html +1 -1
- package/src/commands/ask.js +23 -23
- package/src/commands/chat.js +1 -5
- package/src/commands/session.js +92 -61
- package/src/commands/ui.js +18 -5
- package/src/constants.js +3 -0
- package/src/data/changelog.json +13 -0
- package/src/gateways/ws/action-protocol.js +22 -14
- package/src/gateways/ws/chat-intent-protocol.js +7 -3
- package/src/gateways/ws/llm-chat-protocol.js +9 -2
- package/src/gateways/ws/ws-server.js +24 -12
- package/src/lib/chat-intent-service.js +28 -4
- package/src/lib/config-manager.js +49 -16
- package/src/lib/config-schema.js +5 -0
- package/src/lib/evolution/evolution-deployment-config.js +48 -5
- package/src/lib/evolution/evolution-deployment-loader.js +26 -11
- package/src/lib/evolution/evolution-enabled.js +27 -0
- package/src/lib/evolution/governed-model-turn.js +4 -1
- package/src/lib/evolution/optional-ui-model-turn.js +26 -0
- package/src/lib/paths.js +2 -2
- package/src/repl/chat-repl.js +15 -9
- package/src/runtime/agent-runtime.js +18 -6
- package/src/assets/web-panel/assets/EvolutionSettings-BKWKDok5.js +0 -1
- package/src/assets/web-panel/assets/MarkdownRenderer-vialawkx.js +0 -1
- package/src/assets/web-panel/assets/Projects-BlyQuiCs.js +0 -1
- package/src/assets/web-panel/assets/devWarning-ChcomtaV.js +0 -1
- package/src/assets/web-panel/assets/index-CXxCC-4V.js +0 -1
- package/src/assets/web-panel/assets/index-CZYLUp6g.js +0 -1
|
@@ -40,7 +40,13 @@ async function waitForIntentOperation(operation, signal) {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
async function* intentModelStream(
|
|
43
|
+
async function* intentModelStream(
|
|
44
|
+
messages,
|
|
45
|
+
options,
|
|
46
|
+
factory,
|
|
47
|
+
mode,
|
|
48
|
+
prepareModelTurn,
|
|
49
|
+
) {
|
|
44
50
|
const controller = new AbortController();
|
|
45
51
|
const timeoutMs = resolveIntentTimeout(options);
|
|
46
52
|
const timer =
|
|
@@ -57,7 +63,10 @@ async function* intentModelStream(messages, options, factory, mode) {
|
|
|
57
63
|
let completed = false;
|
|
58
64
|
try {
|
|
59
65
|
const turn = await waitForIntentOperation(
|
|
60
|
-
|
|
66
|
+
(
|
|
67
|
+
prepareModelTurn ||
|
|
68
|
+
((context) => prepareGovernedModelTurn(factory, context))
|
|
69
|
+
)({
|
|
61
70
|
mode,
|
|
62
71
|
messages,
|
|
63
72
|
signal: controller.signal,
|
|
@@ -87,13 +96,20 @@ async function* intentModelStream(messages, options, factory, mode) {
|
|
|
87
96
|
}
|
|
88
97
|
}
|
|
89
98
|
|
|
90
|
-
async function intentModelText(
|
|
99
|
+
async function intentModelText(
|
|
100
|
+
messages,
|
|
101
|
+
options,
|
|
102
|
+
factory,
|
|
103
|
+
mode,
|
|
104
|
+
prepareModelTurn,
|
|
105
|
+
) {
|
|
91
106
|
let content = "";
|
|
92
107
|
for await (const event of intentModelStream(
|
|
93
108
|
messages,
|
|
94
109
|
options,
|
|
95
110
|
factory,
|
|
96
111
|
mode,
|
|
112
|
+
prepareModelTurn,
|
|
97
113
|
)) {
|
|
98
114
|
if (event.type === "response-complete") content = event.content;
|
|
99
115
|
}
|
|
@@ -213,6 +229,7 @@ export async function understandIntent({
|
|
|
213
229
|
history,
|
|
214
230
|
llmOptions,
|
|
215
231
|
evolutionCompositionFactory = null,
|
|
232
|
+
prepareModelTurn,
|
|
216
233
|
}) {
|
|
217
234
|
if (!userInput || !userInput.trim()) {
|
|
218
235
|
throw new Error("userInput required");
|
|
@@ -249,6 +266,7 @@ export async function understandIntent({
|
|
|
249
266
|
},
|
|
250
267
|
evolutionCompositionFactory,
|
|
251
268
|
"intent-understand",
|
|
269
|
+
prepareModelTurn,
|
|
252
270
|
);
|
|
253
271
|
|
|
254
272
|
const jsonText = extractJson(fullContent);
|
|
@@ -297,6 +315,7 @@ export async function* understandIntentStream({
|
|
|
297
315
|
history,
|
|
298
316
|
llmOptions,
|
|
299
317
|
evolutionCompositionFactory = null,
|
|
318
|
+
prepareModelTurn,
|
|
300
319
|
}) {
|
|
301
320
|
if (!userInput || !userInput.trim()) {
|
|
302
321
|
throw new Error("userInput required");
|
|
@@ -321,7 +340,7 @@ export async function* understandIntentStream({
|
|
|
321
340
|
let buffer = "";
|
|
322
341
|
try {
|
|
323
342
|
// Every model-backed intent stream uses an abortable per-call deadline and
|
|
324
|
-
//
|
|
343
|
+
// host-selected Evolution policy; the rule-only path above stays local.
|
|
325
344
|
for await (const event of intentModelStream(
|
|
326
345
|
[
|
|
327
346
|
{ role: "system", content: systemPrompt },
|
|
@@ -330,6 +349,7 @@ export async function* understandIntentStream({
|
|
|
330
349
|
{ ...llmOptions, temperature: 0.3, maxTokens: 500 },
|
|
331
350
|
evolutionCompositionFactory,
|
|
332
351
|
"intent-understand-stream",
|
|
352
|
+
prepareModelTurn,
|
|
333
353
|
)) {
|
|
334
354
|
if (event.type === "response-token") {
|
|
335
355
|
buffer += event.token;
|
|
@@ -575,6 +595,7 @@ async function llmBasedClassify(
|
|
|
575
595
|
context,
|
|
576
596
|
llmOptions,
|
|
577
597
|
evolutionCompositionFactory,
|
|
598
|
+
prepareModelTurn,
|
|
578
599
|
) {
|
|
579
600
|
const { systemPrompt, userPrompt } = buildFollowupPrompts(userInput, context);
|
|
580
601
|
const fullContent = await intentModelText(
|
|
@@ -589,6 +610,7 @@ async function llmBasedClassify(
|
|
|
589
610
|
},
|
|
590
611
|
evolutionCompositionFactory,
|
|
591
612
|
"intent-classify",
|
|
613
|
+
prepareModelTurn,
|
|
592
614
|
);
|
|
593
615
|
const jsonText = extractJson(fullContent);
|
|
594
616
|
if (!jsonText) throw new Error("LLM response missing JSON");
|
|
@@ -618,6 +640,7 @@ export async function classifyFollowupIntent({
|
|
|
618
640
|
context = {},
|
|
619
641
|
llmOptions,
|
|
620
642
|
evolutionCompositionFactory = null,
|
|
643
|
+
prepareModelTurn,
|
|
621
644
|
}) {
|
|
622
645
|
const startTime = Date.now();
|
|
623
646
|
const ruleResult = ruleBasedClassify(input);
|
|
@@ -644,6 +667,7 @@ export async function classifyFollowupIntent({
|
|
|
644
667
|
context,
|
|
645
668
|
llmOptions,
|
|
646
669
|
evolutionCompositionFactory,
|
|
670
|
+
prepareModelTurn,
|
|
647
671
|
);
|
|
648
672
|
return {
|
|
649
673
|
...llmResult,
|
|
@@ -30,6 +30,16 @@ import {
|
|
|
30
30
|
// `_deps.warn` to assert it fired.
|
|
31
31
|
const _warnedConfigPaths = new Set();
|
|
32
32
|
const _loadedSecretRefs = new Map();
|
|
33
|
+
const _implicitEvolutionDefaults = new WeakSet();
|
|
34
|
+
|
|
35
|
+
function trackImplicitEvolutionDefault(config, raw = {}) {
|
|
36
|
+
if (
|
|
37
|
+
raw.evolution?.enabled === undefined &&
|
|
38
|
+
config.evolution?.enabled === false
|
|
39
|
+
)
|
|
40
|
+
_implicitEvolutionDefaults.add(config.evolution);
|
|
41
|
+
return config;
|
|
42
|
+
}
|
|
33
43
|
export const _deps = {
|
|
34
44
|
createSecretStore: () => createSecretStore(),
|
|
35
45
|
warn: (msg) => {
|
|
@@ -72,8 +82,11 @@ function assertNotSymbolicLink(target, label = "configuration path") {
|
|
|
72
82
|
return stat;
|
|
73
83
|
}
|
|
74
84
|
|
|
75
|
-
function readConfigDocument({
|
|
76
|
-
|
|
85
|
+
function readConfigDocument({
|
|
86
|
+
failIfUnavailable = false,
|
|
87
|
+
...pathOptions
|
|
88
|
+
} = {}) {
|
|
89
|
+
const configPath = getConfigPath(pathOptions);
|
|
77
90
|
if (!existsSync(configPath)) return {};
|
|
78
91
|
try {
|
|
79
92
|
assertNotSymbolicLink(configPath, "config.json");
|
|
@@ -182,9 +195,9 @@ function resolveSecretReferences(value, prefix = "", state = {}) {
|
|
|
182
195
|
return value;
|
|
183
196
|
}
|
|
184
197
|
|
|
185
|
-
function restoreSecretReferences(config) {
|
|
198
|
+
function restoreSecretReferences(config, configPath = getConfigPath()) {
|
|
186
199
|
const out = structuredClone(config);
|
|
187
|
-
const prefix = `${
|
|
200
|
+
const prefix = `${configPath}\0`;
|
|
188
201
|
for (const [cacheKey, saved] of _loadedSecretRefs) {
|
|
189
202
|
if (!cacheKey.startsWith(prefix)) continue;
|
|
190
203
|
const key = cacheKey.slice(prefix.length);
|
|
@@ -199,17 +212,21 @@ function restoreSecretReferences(config) {
|
|
|
199
212
|
export function loadConfig({
|
|
200
213
|
failIfUnavailable = false,
|
|
201
214
|
resolveSecrets = true,
|
|
215
|
+
...pathOptions
|
|
202
216
|
} = {}) {
|
|
203
|
-
const configPath = getConfigPath();
|
|
217
|
+
const configPath = getConfigPath(pathOptions);
|
|
204
218
|
if (!existsSync(configPath)) {
|
|
205
|
-
return
|
|
219
|
+
return trackImplicitEvolutionDefault(structuredClone(DEFAULT_CONFIG));
|
|
206
220
|
}
|
|
207
221
|
try {
|
|
208
|
-
const parsed = readConfigDocument({ failIfUnavailable });
|
|
222
|
+
const parsed = readConfigDocument({ ...pathOptions, failIfUnavailable });
|
|
209
223
|
const effective = deepMerge(structuredClone(DEFAULT_CONFIG), parsed);
|
|
210
|
-
return
|
|
211
|
-
|
|
212
|
-
|
|
224
|
+
return trackImplicitEvolutionDefault(
|
|
225
|
+
resolveSecrets
|
|
226
|
+
? resolveSecretReferences(effective, "", { configPath })
|
|
227
|
+
: effective,
|
|
228
|
+
parsed,
|
|
229
|
+
);
|
|
213
230
|
} catch (err) {
|
|
214
231
|
if (failIfUnavailable) {
|
|
215
232
|
const error = new Error(
|
|
@@ -255,12 +272,12 @@ export function loadConfig({
|
|
|
255
272
|
`Fix the JSON to restore them.${backupNote}\n`,
|
|
256
273
|
);
|
|
257
274
|
}
|
|
258
|
-
return
|
|
275
|
+
return trackImplicitEvolutionDefault(structuredClone(DEFAULT_CONFIG));
|
|
259
276
|
}
|
|
260
277
|
}
|
|
261
278
|
|
|
262
279
|
export function saveConfig(config, options = {}) {
|
|
263
|
-
const configPath = getConfigPath();
|
|
280
|
+
const configPath = getConfigPath(options);
|
|
264
281
|
ensurePrivateDirectory(dirname(configPath), {
|
|
265
282
|
applyWindowsAcl: true,
|
|
266
283
|
failIfUnavailable: true,
|
|
@@ -276,7 +293,18 @@ export function saveConfig(config, options = {}) {
|
|
|
276
293
|
const persisted =
|
|
277
294
|
options.preserveSecretRefs === false
|
|
278
295
|
? structuredClone(config)
|
|
279
|
-
: restoreSecretReferences(config);
|
|
296
|
+
: restoreSecretReferences(config, configPath);
|
|
297
|
+
// An inherited default must not become an explicit opt-out when unrelated
|
|
298
|
+
// settings are saved. Track the child object so top-level spreads preserve
|
|
299
|
+
// this distinction too; explicit writes via setConfigValue clear it.
|
|
300
|
+
if (
|
|
301
|
+
_implicitEvolutionDefaults.has(config.evolution) &&
|
|
302
|
+
persisted.evolution?.enabled === false
|
|
303
|
+
) {
|
|
304
|
+
delete persisted.evolution.enabled;
|
|
305
|
+
if (Object.keys(persisted.evolution).length === 0)
|
|
306
|
+
delete persisted.evolution;
|
|
307
|
+
}
|
|
280
308
|
assertSafeConfigObject(persisted);
|
|
281
309
|
writeFileSync(tmp, JSON.stringify(persisted, null, 2) + "\n", {
|
|
282
310
|
encoding: "utf-8",
|
|
@@ -390,7 +418,7 @@ export function setConfigValue(key, value, options = {}) {
|
|
|
390
418
|
// `cc config set` invocations would otherwise each load, mutate, and write
|
|
391
419
|
// back, silently losing one update. Configuration can carry credentials and
|
|
392
420
|
// permission policy, so bounded lock failure must never write unlocked.
|
|
393
|
-
const configPath = getConfigPath();
|
|
421
|
+
const configPath = getConfigPath(options);
|
|
394
422
|
ensurePrivateDirectory(dirname(configPath), {
|
|
395
423
|
applyWindowsAcl: true,
|
|
396
424
|
failIfUnavailable: true,
|
|
@@ -398,9 +426,14 @@ export function setConfigValue(key, value, options = {}) {
|
|
|
398
426
|
return withFileLock(
|
|
399
427
|
configPath,
|
|
400
428
|
() => {
|
|
401
|
-
const config = loadConfig({
|
|
429
|
+
const config = loadConfig({
|
|
430
|
+
...options,
|
|
431
|
+
failIfUnavailable: true,
|
|
432
|
+
});
|
|
402
433
|
setNestedValue(config, key, parsedValue);
|
|
403
|
-
|
|
434
|
+
if (key === "evolution.enabled")
|
|
435
|
+
_implicitEvolutionDefaults.delete(config.evolution);
|
|
436
|
+
saveConfig(config, options);
|
|
404
437
|
return config;
|
|
405
438
|
},
|
|
406
439
|
{ failIfUnavailable: true },
|
package/src/lib/config-schema.js
CHANGED
|
@@ -22,6 +22,11 @@ const descriptor = (key, type, options = {}) => ({
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
const DESCRIPTORS = [
|
|
25
|
+
descriptor("evolution.enabled", "boolean", {
|
|
26
|
+
default: DEFAULT_CONFIG.evolution.enabled,
|
|
27
|
+
description:
|
|
28
|
+
"Enable optional self-evolution for new Agent sessions (off by default)",
|
|
29
|
+
}),
|
|
25
30
|
descriptor("setupCompleted", "boolean", {
|
|
26
31
|
default: DEFAULT_CONFIG.setupCompleted,
|
|
27
32
|
description: "Whether initial CLI setup has completed",
|
|
@@ -9,6 +9,11 @@ import {
|
|
|
9
9
|
import { verifyEvolutionDeployment } from "./evolution-deployment-loader.js";
|
|
10
10
|
import { verifyEvolutionDeploymentRootRotationSync } from "./evolution-deployment-root-rotation.js";
|
|
11
11
|
import { verifyEvolutionDeploymentDescriptorRevocationsSync } from "./evolution-deployment-descriptor-revocations.js";
|
|
12
|
+
import {
|
|
13
|
+
readEvolutionEnabled,
|
|
14
|
+
resolveEvolutionEnabled,
|
|
15
|
+
writeEvolutionEnabled,
|
|
16
|
+
} from "./evolution-enabled.js";
|
|
12
17
|
|
|
13
18
|
function environmentSelection(env) {
|
|
14
19
|
const descriptorPath = env.CHAINLESSCHAIN_EVOLUTION_DEPLOYMENT_DESCRIPTOR;
|
|
@@ -119,14 +124,18 @@ function withDeploymentReadiness(status) {
|
|
|
119
124
|
export async function getEvolutionDeploymentStatus(options = {}) {
|
|
120
125
|
const env = options.env || process.env;
|
|
121
126
|
const saved = await readEvolutionDeploymentProfile(options);
|
|
122
|
-
const
|
|
127
|
+
const enabled = resolveEvolutionEnabled(
|
|
128
|
+
readEvolutionEnabled(options),
|
|
129
|
+
saved.profile,
|
|
130
|
+
env,
|
|
131
|
+
);
|
|
132
|
+
const fromEnvironment = enabled ? environmentSelection(env) : null;
|
|
123
133
|
const source = fromEnvironment
|
|
124
134
|
? "environment"
|
|
125
|
-
: saved.profile
|
|
135
|
+
: enabled && saved.profile
|
|
126
136
|
? "profile"
|
|
127
137
|
: "none";
|
|
128
|
-
const selected =
|
|
129
|
-
fromEnvironment || (saved.profile?.enabled ? saved.profile : null);
|
|
138
|
+
const selected = fromEnvironment || (enabled ? saved.profile : null);
|
|
130
139
|
const base = {
|
|
131
140
|
source,
|
|
132
141
|
deploymentMode:
|
|
@@ -134,7 +143,9 @@ export async function getEvolutionDeploymentStatus(options = {}) {
|
|
|
134
143
|
? "external"
|
|
135
144
|
: saved.profile?.deploymentMode || "none",
|
|
136
145
|
effectiveEnabled: source !== "none",
|
|
137
|
-
profileEnabled:
|
|
146
|
+
profileEnabled: enabled,
|
|
147
|
+
evolutionEnabled: enabled,
|
|
148
|
+
configKey: "evolution.enabled",
|
|
138
149
|
profilePath: saved.filePath,
|
|
139
150
|
activeTrustRootDigest: saved.profile?.activeTrustRootDigest || null,
|
|
140
151
|
descriptorPath:
|
|
@@ -295,11 +306,42 @@ export async function configureEvolutionDeployment(
|
|
|
295
306
|
: null,
|
|
296
307
|
};
|
|
297
308
|
}, options);
|
|
309
|
+
writeEvolutionEnabled(enabled === true, options);
|
|
298
310
|
return getEvolutionDeploymentStatus(options);
|
|
299
311
|
}
|
|
300
312
|
|
|
301
313
|
export async function setEvolutionDeploymentEnabled(enabled, options = {}) {
|
|
314
|
+
if (typeof enabled !== "boolean")
|
|
315
|
+
throw new TypeError("enabled must be a boolean");
|
|
316
|
+
const saved = await readEvolutionDeploymentProfile(options);
|
|
317
|
+
if (!enabled) {
|
|
318
|
+
writeEvolutionEnabled(false, options);
|
|
319
|
+
if (saved.profile && !saved.error)
|
|
320
|
+
await setEvolutionDeploymentProfileEnabled(false, options);
|
|
321
|
+
return getEvolutionDeploymentStatus(options);
|
|
322
|
+
}
|
|
323
|
+
if (saved.error) throw new Error(saved.error);
|
|
324
|
+
if (!saved.profile) {
|
|
325
|
+
const selected = environmentSelection(options.env || process.env);
|
|
326
|
+
if (selected) {
|
|
327
|
+
return configureEvolutionDeployment({ ...selected, enabled }, options);
|
|
328
|
+
}
|
|
329
|
+
const { initializeDefaultLocalUiEvolutionDeployment } = await import(
|
|
330
|
+
"./local-ui-evolution-deployment.js"
|
|
331
|
+
);
|
|
332
|
+
await initializeDefaultLocalUiEvolutionDeployment(options);
|
|
333
|
+
writeEvolutionEnabled(true, options);
|
|
334
|
+
return getEvolutionDeploymentStatus(options);
|
|
335
|
+
}
|
|
302
336
|
await setEvolutionDeploymentProfileEnabled(enabled, options);
|
|
337
|
+
// A local profile can predate Agent support. Upgrade only on explicit enable.
|
|
338
|
+
if (enabled && saved.profile.deploymentMode === "local") {
|
|
339
|
+
const { initializeDefaultLocalUiEvolutionDeployment } = await import(
|
|
340
|
+
"./local-ui-evolution-deployment.js"
|
|
341
|
+
);
|
|
342
|
+
await initializeDefaultLocalUiEvolutionDeployment(options);
|
|
343
|
+
}
|
|
344
|
+
writeEvolutionEnabled(enabled, options);
|
|
303
345
|
return getEvolutionDeploymentStatus(options);
|
|
304
346
|
}
|
|
305
347
|
|
|
@@ -331,5 +373,6 @@ export function revokeEvolutionDeploymentDescriptorRevisions(
|
|
|
331
373
|
},
|
|
332
374
|
};
|
|
333
375
|
}, options);
|
|
376
|
+
writeEvolutionEnabled(false, options);
|
|
334
377
|
return getEvolutionDeploymentStatus(options);
|
|
335
378
|
}
|
|
@@ -8,6 +8,10 @@ import {
|
|
|
8
8
|
assertEvolutionDeploymentRevisionFloor,
|
|
9
9
|
readEvolutionDeploymentProfile,
|
|
10
10
|
} from "./evolution-deployment-profile.js";
|
|
11
|
+
import {
|
|
12
|
+
readEvolutionEnabled,
|
|
13
|
+
resolveEvolutionEnabled,
|
|
14
|
+
} from "./evolution-enabled.js";
|
|
11
15
|
|
|
12
16
|
export const EVOLUTION_DEPLOYMENT_DESCRIPTOR_SCHEMA =
|
|
13
17
|
"chainlesschain.evolution-deployment-descriptor/v1";
|
|
@@ -138,7 +142,7 @@ function dependencies(value, commandName) {
|
|
|
138
142
|
}
|
|
139
143
|
|
|
140
144
|
function deniedAgentDependencies(commandName, code, message, source = null) {
|
|
141
|
-
if (
|
|
145
|
+
if (!["agent", "ask", "chat", "ui"].includes(commandName)) return null;
|
|
142
146
|
const evolutionCompositionFactory = Object.freeze(async () => {
|
|
143
147
|
const error = new Error(message);
|
|
144
148
|
error.code = code;
|
|
@@ -175,7 +179,8 @@ function deniedAgentDependencies(commandName, code, message, source = null) {
|
|
|
175
179
|
}
|
|
176
180
|
|
|
177
181
|
function authenticatedDependencies(value, commandName) {
|
|
178
|
-
if (
|
|
182
|
+
if (!["agent", "ask", "chat", "ui"].includes(commandName))
|
|
183
|
+
return dependencies(value, commandName);
|
|
179
184
|
if (
|
|
180
185
|
value === null ||
|
|
181
186
|
typeof value !== "object" ||
|
|
@@ -1029,7 +1034,7 @@ export async function loadEvolutionDeploymentCommandDependencies(
|
|
|
1029
1034
|
importModule = (url) => import(url),
|
|
1030
1035
|
additionalFactories = {},
|
|
1031
1036
|
initializeDefaultLocalUi = false,
|
|
1032
|
-
initializeDefaultLocalModels =
|
|
1037
|
+
initializeDefaultLocalModels = false,
|
|
1033
1038
|
} = {},
|
|
1034
1039
|
) {
|
|
1035
1040
|
if (!SUPPORTED_COMMANDS.has(commandName)) return null;
|
|
@@ -1064,6 +1069,20 @@ export async function loadEvolutionDeploymentCommandDependencies(
|
|
|
1064
1069
|
);
|
|
1065
1070
|
let descriptorPath = env.CHAINLESSCHAIN_EVOLUTION_DEPLOYMENT_DESCRIPTOR;
|
|
1066
1071
|
let trustRootPath = env.CHAINLESSCHAIN_EVOLUTION_DEPLOYMENT_TRUST_ROOT;
|
|
1072
|
+
const currentProfile = await readEvolutionDeploymentProfile({ env, cwd });
|
|
1073
|
+
const choice = readEvolutionEnabled({ env, cwd });
|
|
1074
|
+
if (choice === false) return null;
|
|
1075
|
+
if (
|
|
1076
|
+
!currentProfile.error &&
|
|
1077
|
+
!resolveEvolutionEnabled(choice, currentProfile.profile, env)
|
|
1078
|
+
)
|
|
1079
|
+
return null;
|
|
1080
|
+
if (choice === true && currentProfile.profile?.enabled === false) {
|
|
1081
|
+
const { setEvolutionDeploymentProfileEnabled } = await import(
|
|
1082
|
+
"./evolution-deployment-profile.js"
|
|
1083
|
+
);
|
|
1084
|
+
await setEvolutionDeploymentProfileEnabled(true, { env, cwd });
|
|
1085
|
+
}
|
|
1067
1086
|
if (
|
|
1068
1087
|
initializeDefaultLocalUi === true &&
|
|
1069
1088
|
commandName === "ui" &&
|
|
@@ -1087,15 +1106,11 @@ export async function loadEvolutionDeploymentCommandDependencies(
|
|
|
1087
1106
|
);
|
|
1088
1107
|
}
|
|
1089
1108
|
if (saved.profile && !saved.profile.enabled) {
|
|
1090
|
-
return
|
|
1091
|
-
commandName,
|
|
1092
|
-
"EVOLUTION_DEPLOYMENT_DISABLED",
|
|
1093
|
-
"Saved evolution deployment profile is disabled",
|
|
1094
|
-
);
|
|
1109
|
+
return null;
|
|
1095
1110
|
}
|
|
1096
1111
|
if (
|
|
1097
|
-
initializeDefaultLocalModels &&
|
|
1098
|
-
["agent", "ask", "chat"].includes(commandName) &&
|
|
1112
|
+
(initializeDefaultLocalModels || choice === true) &&
|
|
1113
|
+
["agent", "ask", "chat", "ui"].includes(commandName) &&
|
|
1099
1114
|
!saved.profile
|
|
1100
1115
|
) {
|
|
1101
1116
|
// Registration/help is read-only. Bootstrap only when a real command
|
|
@@ -1175,7 +1190,7 @@ export async function loadEvolutionDeploymentCommandDependencies(
|
|
|
1175
1190
|
);
|
|
1176
1191
|
}
|
|
1177
1192
|
if (
|
|
1178
|
-
initializeDefaultLocalModels &&
|
|
1193
|
+
(initializeDefaultLocalModels || choice === true) &&
|
|
1179
1194
|
["agent", "ask", "chat", "ui"].includes(commandName) &&
|
|
1180
1195
|
descriptor.commands.length === 1 &&
|
|
1181
1196
|
descriptor.commands[0] === "ui"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { loadUserConfig, setConfigValue } from "../config-manager.js";
|
|
2
|
+
|
|
3
|
+
export function writeEvolutionEnabled(enabled, options = {}) {
|
|
4
|
+
return setConfigValue("evolution.enabled", enabled, {
|
|
5
|
+
...options,
|
|
6
|
+
resolveSecrets: false,
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function readEvolutionEnabled(options = {}) {
|
|
11
|
+
const config = loadUserConfig({ ...options, failIfUnavailable: true });
|
|
12
|
+
const value = config.evolution?.enabled;
|
|
13
|
+
if (value !== undefined && typeof value !== "boolean")
|
|
14
|
+
throw new TypeError("evolution.enabled must be a boolean");
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// External and manually configured deployments remain explicit opt-ins. Old
|
|
19
|
+
// automatically created local profiles do not opt a user into self-evolution.
|
|
20
|
+
export function resolveEvolutionEnabled(choice, profile, env) {
|
|
21
|
+
if (typeof choice === "boolean") return choice;
|
|
22
|
+
return Boolean(
|
|
23
|
+
env.CHAINLESSCHAIN_EVOLUTION_DEPLOYMENT_DESCRIPTOR ||
|
|
24
|
+
env.CHAINLESSCHAIN_EVOLUTION_DEPLOYMENT_TRUST_ROOT ||
|
|
25
|
+
(profile?.enabled && profile.deploymentMode !== "local"),
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -32,9 +32,12 @@ export function readEvolutionCompositionFactory(dependencies = {}) {
|
|
|
32
32
|
// never a run identifier or composition to borrow from another request.
|
|
33
33
|
export async function prepareGovernedModelTurn(
|
|
34
34
|
factory,
|
|
35
|
-
{ mode, messages, signal },
|
|
35
|
+
{ mode, messages, signal, evolutionDisabled = false },
|
|
36
36
|
) {
|
|
37
37
|
signal?.throwIfAborted();
|
|
38
|
+
if (factory === null && evolutionDisabled === true) {
|
|
39
|
+
return Object.freeze({ governed: false, messages, async complete() {} });
|
|
40
|
+
}
|
|
38
41
|
if (factory === null) {
|
|
39
42
|
const error = new Error(
|
|
40
43
|
"Model egress requires an authenticated evolution composition factory",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { loadEvolutionDeploymentCommandDependencies } from "./evolution-deployment-loader.js";
|
|
2
|
+
import {
|
|
3
|
+
prepareGovernedModelTurn,
|
|
4
|
+
readEvolutionCompositionFactory,
|
|
5
|
+
} from "./governed-model-turn.js";
|
|
6
|
+
|
|
7
|
+
/** Host-only entry point; client frames cannot select the Evolution policy. */
|
|
8
|
+
export async function loadConfiguredUiEvolutionFactory(options = {}) {
|
|
9
|
+
return readEvolutionCompositionFactory(
|
|
10
|
+
(await loadEvolutionDeploymentCommandDependencies("ui", options)) || {},
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function resolveServerEvolutionFactory(server) {
|
|
15
|
+
return typeof server.resolveEvolutionCompositionFactory === "function"
|
|
16
|
+
? server.resolveEvolutionCompositionFactory()
|
|
17
|
+
: (server.evolutionCompositionFactory ?? null);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function prepareConfiguredUiModelTurn(context, options = {}) {
|
|
21
|
+
const current = await loadConfiguredUiEvolutionFactory(options);
|
|
22
|
+
return prepareGovernedModelTurn(current, {
|
|
23
|
+
...context,
|
|
24
|
+
evolutionDisabled: current === null,
|
|
25
|
+
});
|
|
26
|
+
}
|
package/src/lib/paths.js
CHANGED
|
@@ -278,8 +278,8 @@ export function getBinDir() {
|
|
|
278
278
|
return join(getHomeDir(), "bin");
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
export function getConfigPath() {
|
|
282
|
-
return join(
|
|
281
|
+
export function getConfigPath(options = {}) {
|
|
282
|
+
return join(resolveConfigDataRoot(options).path, "config.json");
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
export function getStatePath() {
|
package/src/repl/chat-repl.js
CHANGED
|
@@ -103,17 +103,20 @@ export async function startChatRepl(options = {}) {
|
|
|
103
103
|
options.evolutionIngress == null
|
|
104
104
|
? null
|
|
105
105
|
: captureAgentEvolutionIngress(options.evolutionIngress);
|
|
106
|
-
if (evolutionIngress === null) {
|
|
107
|
-
const error = new Error(
|
|
108
|
-
"Chat REPL model egress requires an authenticated evolution ingress",
|
|
109
|
-
);
|
|
110
|
-
error.code = "CC_AGENT_EVOLUTION_INGRESS_FAILED";
|
|
111
|
-
throw error;
|
|
112
|
-
}
|
|
113
106
|
const admittedSessionId = options.sessionId
|
|
114
107
|
? assertChatSessionUsageAdmission(options.sessionId)
|
|
115
108
|
: null;
|
|
116
|
-
const evolutionSession =
|
|
109
|
+
const evolutionSession =
|
|
110
|
+
evolutionIngress === null
|
|
111
|
+
? null
|
|
112
|
+
: createAgentEvolutionSessionLifecycle(evolutionIngress);
|
|
113
|
+
let resolveFinished;
|
|
114
|
+
let rejectFinished;
|
|
115
|
+
const finished = new Promise((resolve, reject) => {
|
|
116
|
+
resolveFinished = resolve;
|
|
117
|
+
rejectFinished = reject;
|
|
118
|
+
});
|
|
119
|
+
void finished.catch(() => {});
|
|
117
120
|
const llmConfig = loadConfig().llm || {};
|
|
118
121
|
const connection = resolveLlmConnection(options, [llmConfig], {
|
|
119
122
|
defaultModel:
|
|
@@ -510,7 +513,10 @@ export async function startChatRepl(options = {}) {
|
|
|
510
513
|
? 0
|
|
511
514
|
: 1
|
|
512
515
|
: exitCode;
|
|
516
|
+
if (finalExitCode === 0) resolveFinished();
|
|
517
|
+
else rejectFinished(outputFailure);
|
|
513
518
|
process.exit(finalExitCode);
|
|
514
519
|
});
|
|
515
|
-
|
|
520
|
+
// Keep owners alive until readline closes even when Evolution is off.
|
|
521
|
+
return evolutionSession?.handle ?? Object.freeze({ finished });
|
|
516
522
|
}
|
|
@@ -189,6 +189,9 @@ export class AgentRuntime {
|
|
|
189
189
|
resolveAgentBundle: deps.resolveAgentBundle || null,
|
|
190
190
|
openBrowser: deps.openBrowser || openBrowser,
|
|
191
191
|
runTurn: deps.runTurn || null,
|
|
192
|
+
prepareUiModelTurn: deps.prepareUiModelTurn || null,
|
|
193
|
+
resolveEvolutionCompositionFactory:
|
|
194
|
+
deps.resolveEvolutionCompositionFactory || null,
|
|
192
195
|
evolutionCompositionFactory:
|
|
193
196
|
deps.evolutionCompositionFactory == null
|
|
194
197
|
? null
|
|
@@ -415,6 +418,9 @@ export class AgentRuntime {
|
|
|
415
418
|
? {}
|
|
416
419
|
: { evolutionIngress: this.evolutionIngress }),
|
|
417
420
|
});
|
|
421
|
+
if (this.evolutionIngress === null && result?.finished) {
|
|
422
|
+
await result.finished;
|
|
423
|
+
}
|
|
418
424
|
if (this.evolutionIngress !== null) {
|
|
419
425
|
if (result?.schema === AGENT_EVOLUTION_SESSION_SCHEMA) {
|
|
420
426
|
return await waitForAgentEvolutionSession(
|
|
@@ -489,10 +495,12 @@ export class AgentRuntime {
|
|
|
489
495
|
typeof loadBundle !== "function" ||
|
|
490
496
|
typeof resolveBundle !== "function"
|
|
491
497
|
) {
|
|
492
|
-
({ loadBundle } =
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
498
|
+
({ loadBundle } = await import(
|
|
499
|
+
"@chainlesschain/session-core/agent-bundle-loader"
|
|
500
|
+
));
|
|
501
|
+
({ resolveBundle } = await import(
|
|
502
|
+
"@chainlesschain/session-core/agent-bundle-resolver"
|
|
503
|
+
));
|
|
496
504
|
}
|
|
497
505
|
const bundle = loadBundle(this.policy.bundlePath);
|
|
498
506
|
bundleResolved = resolveBundle(bundle);
|
|
@@ -557,8 +565,9 @@ export class AgentRuntime {
|
|
|
557
565
|
if (Number.isNaN(httpPort) || httpPort < 1 || httpPort > 65535) {
|
|
558
566
|
throw new Error("Invalid --http-port. Must be between 1 and 65535.");
|
|
559
567
|
}
|
|
560
|
-
const { createEnvelopeBus, createEnvelopeHttpServer } =
|
|
561
|
-
|
|
568
|
+
const { createEnvelopeBus, createEnvelopeHttpServer } = await import(
|
|
569
|
+
"../gateways/http/envelope-http-server.js"
|
|
570
|
+
);
|
|
562
571
|
envelopeBus = createEnvelopeBus();
|
|
563
572
|
httpServer = createEnvelopeHttpServer({
|
|
564
573
|
bus: envelopeBus,
|
|
@@ -766,6 +775,9 @@ export class AgentRuntime {
|
|
|
766
775
|
sessionManager,
|
|
767
776
|
projectRoot: workspacePolicyCwd,
|
|
768
777
|
evolutionCompositionFactory: this.deps.evolutionCompositionFactory,
|
|
778
|
+
prepareUiModelTurn: this.deps.prepareUiModelTurn,
|
|
779
|
+
resolveEvolutionCompositionFactory:
|
|
780
|
+
this.deps.resolveEvolutionCompositionFactory,
|
|
769
781
|
});
|
|
770
782
|
// ChainlessChainWSServer extends EventEmitter and emits "error"
|
|
771
783
|
// synchronously on bind failure (in addition to rejecting start()).
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as r,J as T,U as c,c as a,K as o,S as I,V as C,o as M,r as k,a as V,b as L,P as R,Q as d,R as m,F as H,Z as W}from"./vendor-Bn1JzzAn.js";import{_ as A,u as N,d as i}from"./index-DbdMPF9D.js";import{R as F}from"./icons-DG5UD-6K.js";function B(P){return["ask","agent"].map(t=>{const n=P?.readiness?.[t],e=n?.state==="admitted",f=n?.scope==="deployment-admission"&&n.runtimeVerification==="not_checked"&&Array.isArray(n.requiredCommands)&&n.requiredCommands.includes(t)&&(e?n.ready===!0&&n.taskReady===null:["not_configured","disabled","invalid","command_not_allowed"].includes(n.state)&&n.ready===!1&&n.taskReady===!1);return{command:t,state:f?n.state:"unknown",summary:f?e?"部署准入通过":"部署准入被阻断":"未提供准入诊断",detail:f&&typeof n.detail=="string"?n.detail:"当前 CLI 未提供可识别的部署准入诊断,请更新 CLI。",remediation:f&&typeof n.remediation=="string"?n.remediation:""}})}function U(P,t){for(const n of Object.keys(P))delete P[n];Object.assign(P,{source:"none",effectiveEnabled:!1,profileEnabled:!1,verified:!1,commands:[],readiness:null},t||{})}const J={__name:"EvolutionSettings",setup(P,{expose:t}){t();const n=N(),e=k(!1),f=k(!1),S=k(!1),p=k(!1),w=k(!1),g=k(""),_=k(""),E=k(""),v=V({source:"none",effectiveEnabled:!1,profileEnabled:!1,verified:!1,commands:[]}),x=L(()=>e.value||f.value||S.value||p.value||w.value),h=L(()=>B(v));function b(s){U(v,s),_.value=v.descriptorPath||"",E.value=v.trustRootPath||"",g.value=v.modulePath||g.value||""}async function u(s,z=3e4){return await n.waitConnected(8e3),(await n.sendRaw(s,z)).result}async function y(){e.value=!0;try{b(await u({type:"evolution.deployment.status"}))}catch(s){i.error("读取配置失败:"+s.message)}finally{e.value=!1}}async function O(){if(!_.value.trim()||!E.value.trim()){i.warning("请填写描述符和信任根公钥的绝对路径");return}f.value=!0;try{b(await u({type:"evolution.deployment.configure",descriptorPath:_.value.trim(),trustRootPath:E.value.trim()},6e4)),i.success("签名校验通过,配置已保存并启用;自动发布仍为 HOLD")}catch(s){i.error("配置失败:"+s.message)}finally{f.value=!1}}async function D(){if(!g.value.trim()){i.warning("请填写测试部署宿主模块的服务器绝对路径");return}p.value=!0;try{b(await u({type:"evolution.deployment.init-test",modulePath:g.value.trim()},6e4)),i.success("TEST 测试开发环境已生成并启用;禁止用于生产")}catch(s){i.error("生成测试环境失败:"+s.message)}finally{p.value=!1}}async function l(){if(!_.value.trim()||!E.value.trim()){i.warning("请填写正式描述符和正式信任根公钥的绝对路径");return}w.value=!0;try{b(await u({type:"evolution.deployment.replace-test",descriptorPath:_.value.trim(),trustRootPath:E.value.trim()},6e4)),i.success("测试根已安全轮换为正式受管证书;请重启 cc ui、IDE 或 Desktop 长驻进程后做正式验证")}catch(s){i.error("替换失败:"+s.message)}finally{w.value=!1}}async function q(){S.value=!0;try{b(await u({type:"evolution.deployment.set-enabled",enabled:!v.profileEnabled})),i.success(v.profileEnabled?"已启用":"已停用")}catch(s){i.error("更新失败:"+s.message)}finally{S.value=!1}}M(y);const j={ws:n,loading:e,saving:f,toggling:S,initializingTest:p,replacingTest:w,modulePath:g,descriptorPath:_,trustRootPath:E,status:v,busy:x,readinessRows:h,apply:b,request:u,loadStatus:y,save:O,initTest:D,replaceTest:l,toggle:q,computed:L,onMounted:M,reactive:V,ref:k,get ReloadOutlined(){return F},get message(){return i},get useWsStore(){return N},get deploymentReadinessRows(){return B},get replaceDeploymentStatus(){return U}};return Object.defineProperty(j,"__isScriptSetup",{enumerable:!1,value:!0}),j}},Q={class:"page-head"},Z={class:"mono"},K={class:"mono"},G={class:"admission-status","aria-live":"polite"},X=["data-admission-command"],Y={class:"mono"},$={key:0,class:"mono"};function ee(P,t,n,e,f,S){const p=r("a-button"),w=r("a-alert"),g=r("a-input"),_=r("a-form-item"),E=r("a-divider"),v=r("a-space"),x=r("a-form"),h=r("a-card"),b=r("a-col"),u=r("a-tag"),y=r("a-descriptions-item"),O=r("a-descriptions"),D=r("a-row");return R(),T("div",null,[c("div",Q,[t[4]||(t[4]=c("div",null,[c("h2",{class:"page-title"},"Skill 自进化配置"),c("p",{class:"page-sub"},"统一配置受治理部署;CLI、IDE 插件与 cc ui 共享。")],-1)),a(p,{loading:e.loading,onClick:e.loadStatus},{icon:o(()=>[a(e.ReloadOutlined)]),default:o(()=>[t[3]||(t[3]=d("刷新 ",-1))]),_:1},8,["loading"])]),a(w,{message:"不会开启自动发布",description:"此开关只启用经过签名的 Skill 自进化运行时。候选项进入 active 前仍需人工审核,自动发布始终保持 HOLD。",type:"warning","show-icon":"",class:"notice"}),e.status.deploymentMode==="test"?(R(),I(w,{key:0,message:"当前为 TEST 测试开发环境",description:"本机自动生成的测试密钥不能用于生产。正式 descriptor 和 trust root 到位后,请使用下方“一键替换测试证书并转正式”。",type:"error","show-icon":"",class:"notice"})):C("v-if",!0),a(D,{gutter:16},{default:o(()=>[a(b,{xs:24,xl:15},{default:o(()=>[a(h,{title:"上线前测试与正式部署",class:"panel-card"},{default:o(()=>[a(x,{layout:"vertical"},{default:o(()=>[a(_,{label:"测试部署宿主模块"},{extra:o(()=>[...t[5]||(t[5]=[d("首次填写后点击一次即可生成 Ed25519 测试密钥、签名描述符并启用;宿主模块修改后再次点击可刷新。",-1)])]),default:o(()=>[a(g,{value:e.modulePath,"onUpdate:value":t[0]||(t[0]=l=>e.modulePath=l),disabled:e.busy,placeholder:"运行 cc ui 的机器上 deployment host .mjs/.js 的绝对路径"},null,8,["value","disabled"])]),_:1}),a(p,{type:"primary",loading:e.initializingTest,onClick:e.initTest},{default:o(()=>[...t[6]||(t[6]=[d("一键生成/刷新测试环境",-1)])]),_:1},8,["loading"]),a(E),a(_,{label:"签名部署描述符"},{extra:o(()=>[...t[7]||(t[7]=[d("Web 页面不能读取本机文件选择器,请填写运行 cc ui 的机器上的绝对路径。",-1)])]),default:o(()=>[a(g,{value:e.descriptorPath,"onUpdate:value":t[1]||(t[1]=l=>e.descriptorPath=l),disabled:e.busy,placeholder:"deployment descriptor JSON 的服务器绝对路径"},null,8,["value","disabled"])]),_:1}),a(_,{label:"Ed25519 信任根公钥"},{default:o(()=>[a(g,{value:e.trustRootPath,"onUpdate:value":t[2]||(t[2]=l=>e.trustRootPath=l),disabled:e.busy,placeholder:"信任根 public key 的服务器绝对路径"},null,8,["value","disabled"])]),_:1}),a(v,null,{default:o(()=>[a(p,{type:"primary",loading:e.saving,onClick:e.save},{default:o(()=>[...t[8]||(t[8]=[d("校验、保存并启用",-1)])]),_:1},8,["loading"]),a(p,{danger:e.status.profileEnabled,disabled:!e.status.descriptorPath,loading:e.toggling,onClick:e.toggle},{default:o(()=>[d(m(e.status.profileEnabled?"停用":"启用"),1)]),_:1},8,["danger","disabled","loading"]),e.status.deploymentMode==="test"?(R(),I(p,{key:0,loading:e.replacingTest,onClick:e.replaceTest},{default:o(()=>[...t[9]||(t[9]=[d("一键替换测试证书并转正式",-1)])]),_:1},8,["loading"])):C("v-if",!0)]),_:1})]),_:1})]),_:1})]),_:1}),a(b,{xs:24,xl:9},{default:o(()=>[a(h,{title:"治理状态",class:"panel-card status-card"},{default:o(()=>[a(O,{column:1,size:"small"},{default:o(()=>[a(y,{label:"部署模式"},{default:o(()=>[a(u,{color:e.status.deploymentMode==="test"?"red":"blue"},{default:o(()=>[d(m(e.status.deploymentMode==="test"?"TEST(仅限上线前联调)":e.status.deploymentMode||"none"),1)]),_:1},8,["color"])]),_:1}),a(y,{label:"生效状态"},{default:o(()=>[a(u,{color:e.status.effectiveEnabled?"green":"default"},{default:o(()=>[d(m(e.status.effectiveEnabled?"已启用":"未启用"),1)]),_:1},8,["color"])]),_:1}),a(y,{label:"生效来源"},{default:o(()=>[d(m(e.status.source||"none"),1)]),_:1}),a(y,{label:"签名校验"},{default:o(()=>[a(u,{color:e.status.verified?"green":"red"},{default:o(()=>[d(m(e.status.verified?"已通过":"未通过"),1)]),_:1},8,["color"])]),_:1}),a(y,{label:"自动发布"},{default:o(()=>[a(u,{color:"orange"},{default:o(()=>[...t[10]||(t[10]=[d("HOLD",-1)])]),_:1})]),_:1}),a(y,{label:"配置文件"},{default:o(()=>[c("span",Z,m(e.status.profilePath||"—"),1)]),_:1}),a(y,{label:"允许命令"},{default:o(()=>[c("span",K,m((e.status.commands||[]).join(", ")||"—"),1)]),_:1})]),_:1}),c("section",G,[t[11]||(t[11]=c("h3",null,"模型命令部署准入",-1)),t[12]||(t[12]=c("p",null,"这里只检查部署准入,实际任务运行尚未验证。",-1)),(R(!0),T(H,null,W(e.readinessRows,l=>(R(),T("div",{key:l.command,"data-admission-command":l.command},[c("strong",null,m(l.command)+":"+m(l.summary),1),c("p",Y,m(l.detail),1),l.remediation?(R(),T("p",$,m(l.remediation),1)):C("v-if",!0)],8,X))),128))]),e.status.error?(R(),I(w,{key:0,message:e.status.error,type:"error","show-icon":"",class:"error"},null,8,["message"])):C("v-if",!0)]),_:1})]),_:1})]),_:1})])}const le=A(J,[["render",ee],["__scopeId","data-v-5a42105e"],["__file","/tmp/cc-web-panel-ZQdeec/repo/packages/web-panel/src/views/EvolutionSettings.vue"]]);export{le as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as a,J as d,b as c}from"./vendor-Bn1JzzAn.js";import{r as s}from"./markdown-Bq2x0XsR.js";import{_ as p}from"./index-DbdMPF9D.js";const _={__name:"MarkdownRenderer",props:{content:{type:String,default:""}},setup(t,{expose:o}){o();const e=t,r=c(()=>s(e.content||"")),n={props:e,rendered:r,computed:c,get renderMarkdown(){return s}};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}},i=["innerHTML"];function m(t,o,e,r,n,u){return a(),d("div",{class:"markdown-content",innerHTML:r.rendered},null,8,i)}const w=p(_,[["render",m],["__scopeId","data-v-0b0b9f63"],["__file","/tmp/cc-web-panel-ZQdeec/repo/packages/web-panel/src/components/MarkdownRenderer.vue"]]);export{w as M};
|