chainlesschain 0.166.6 → 0.166.9
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 -0
- package/package.json +5 -1
- package/src/assets/web-panel/.build-hash +1 -1
- package/src/assets/web-panel/assets/{AIOps-CVnFjTfG.js → AIOps-DJvpifGx.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-BxkwuuQC.js → ActionButton-D2UhuF_A.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-C2670q6z.js → Analytics-C9ho9obu.js} +3 -3
- package/src/assets/web-panel/assets/{AppLayout-CU_rylW6.js → AppLayout-BvRCpFK3.js} +3 -3
- package/src/assets/web-panel/assets/{Artifacts-DGJmYqnj.js → Artifacts-jxrySvpk.js} +1 -1
- package/src/assets/web-panel/assets/{Audit-BZOQbINJ.js → Audit-ovEw0ZYl.js} +1 -1
- package/src/assets/web-panel/assets/{BackgroundAgents-DghB4QwF.js → BackgroundAgents-D7H5z6zS.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-l0mwPbta.js → Backup-BuXob8za.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-Bv3WSZOh.js → BaseInput-CtnszuQ2.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-s88nBdvt.js → Chat-B_mYE8fJ.js} +6 -6
- package/src/assets/web-panel/assets/{ChatBubbleRenderer-Z8CBuB1a.js → ChatBubbleRenderer-DaiA6CsX.js} +1 -1
- package/src/assets/web-panel/assets/{Checkbox-B5icasEs.js → Checkbox-ierdtcJD.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-CsUFqNud.js → Codegen-3VKPJD_B.js} +1 -1
- package/src/assets/web-panel/assets/{Col-DlBtClaW.js → Col-1EdMyf5P.js} +1 -1
- package/src/assets/web-panel/assets/{Community-xRn1IdLB.js → Community-D6H7UA8K.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-naIr8a_o.js → Compact-BBAZvYIm.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-Dp9esfFE.js → Compliance-CgsTrAoj.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-DQlMYJB-.js → Cowork-tnZgLoTE.js} +4 -4
- package/src/assets/web-panel/assets/{Cron-Cd0oNLzJ.js → Cron-CPpZw2Nh.js} +2 -2
- package/src/assets/web-panel/assets/{Crosschain-BtDIx3XX.js → Crosschain-BymBcp5z.js} +1 -1
- package/src/assets/web-panel/assets/{DID-BOlpzEwg.js → DID-DKPxS_K1.js} +2 -2
- package/src/assets/web-panel/assets/{Dashboard-DV15Axk1.js → Dashboard-DvJhEmH9.js} +2 -2
- package/src/assets/web-panel/assets/{Dropdown-COXrewN1.js → Dropdown-b8iQyQIZ.js} +1 -1
- package/src/assets/web-panel/assets/{EmailListRenderer-EjIt0Cm7.js → EmailListRenderer--0-A-zKb.js} +1 -1
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-DJlhwb-R.js → FamilyGuardDashboard-C12iDN06.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-BMiFl82k.js → Federation-BRhaE2Z8.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-BUcDQyxn.js → FormItemContext-C4dnq7yf.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-C25uFxvK.js → GenericCardRenderer-CGAdbR5n.js} +1 -1
- package/src/assets/web-panel/assets/{Git-D20uaEUU.js → Git-4eA2fYzL.js} +2 -2
- package/src/assets/web-panel/assets/{Governance-CQxYJjCX.js → Governance-BJuY9Y-9.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-m-sczpS5.js → Inference-DZ5Dy4up.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-CBsIlU0S.js → KnowledgeGraph-BMTjRs4A.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-D0-5bqeu.js → Logs-BKEeQEfJ.js} +2 -2
- package/src/assets/web-panel/assets/MarkdownRenderer-B05DgASC.js +1 -0
- package/src/assets/web-panel/assets/{Marketplace-CwDGFu2Q.js → Marketplace-Dhho4fEg.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-7FxJ3omT.js → McpTools-BW6xxSlU.js} +2 -2
- package/src/assets/web-panel/assets/{Memory-DOVyb59U.js → Memory-mPqlpSkq.js} +2 -2
- package/src/assets/web-panel/assets/{MobileBridge-DZXl-Hje.js → MobileBridge-Cb9N_DQI.js} +1 -1
- package/src/assets/web-panel/assets/{MobileProjects-DlZ8tRXt.js → MobileProjects-BNs8tah_.js} +1 -1
- package/src/assets/web-panel/assets/{Mtc-D7Pjx1s_.js → Mtc-CaxBt8tn.js} +5 -5
- package/src/assets/web-panel/assets/{MtcAudit-BND7lX8p.js → MtcAudit-DRPQbp3t.js} +2 -2
- package/src/assets/web-panel/assets/{Multisig-BknS7B-p.js → Multisig-CRm-d8bK.js} +3 -3
- package/src/assets/web-panel/assets/{NLProgramming-7C2-KPHt.js → NLProgramming-BCCk3LPs.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-DNWdTndN.js → Notes-Cv8SN8gN.js} +4 -4
- package/src/assets/web-panel/assets/{NotificationSettings-DCm4KcJZ.js → NotificationSettings-CggIvTh5.js} +1 -1
- package/src/assets/web-panel/assets/{OrderTableRenderer-DyVwwjJx.js → OrderTableRenderer-BW3_bV12.js} +1 -1
- package/src/assets/web-panel/assets/{Organization-Dl2O_qJ9.js → Organization-BuRE-VCO.js} +4 -4
- package/src/assets/web-panel/assets/{Overflow-BOFCvk9Q.js → Overflow-DBrm1gju.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-DgdVowY1.js → P2P-CWVnDYgS.js} +2 -2
- package/src/assets/web-panel/assets/PdhVaultBrowser-8RKUIpte.js +7 -0
- package/src/assets/web-panel/assets/{Permissions-BHNEUUwa.js → Permissions-tDUAxogW.js} +4 -4
- package/src/assets/web-panel/assets/{PersonalDataHub-CaZbrOdz.js → PersonalDataHub-Dv2-CFis.js} +4 -4
- package/src/assets/web-panel/assets/{Pipeline-DJDnoXmE.js → Pipeline-DM6kvFni.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-CBQr2eX8.js → Privacy-DzK-yL0d.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-Yghqa06z.js → ProjectInit-B5UrNpkj.js} +2 -2
- package/src/assets/web-panel/assets/{ProjectSettings-HBAtJi8U.js → ProjectSettings-CxJD43oW.js} +2 -2
- package/src/assets/web-panel/assets/Projects-Z2Orm8Ma.js +1 -0
- package/src/assets/web-panel/assets/{Providers-uJTz77GI.js → Providers-CYl4jRYK.js} +1 -1
- package/src/assets/web-panel/assets/{QrScannerModal-k3M5ouTp.js → QrScannerModal-DeH2T0fH.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-CMji45PH.js → QuickAsk-Bw9k_kTk.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-DyoZYPls.js → Recommend-Bl_jGwoi.js} +1 -1
- package/src/assets/web-panel/assets/RemoteSession-d6u01Kq0.js +5 -0
- package/src/assets/web-panel/assets/{Reputation-D4hIs4vV.js → Reputation-Ds_Dfr-k.js} +1 -1
- package/src/assets/web-panel/assets/{Row-mzE-ElTg.js → Row-BpQUQTNj.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-cg7J3hI6.js → RssFeed-BatpZBGt.js} +3 -3
- package/src/assets/web-panel/assets/{Search-6M0TkGSZ.js → Search-D7hOObzi.js} +1 -1
- package/src/assets/web-panel/assets/{Security-B1GQ67qh.js → Security-dXQ4FKNt.js} +4 -4
- package/src/assets/web-panel/assets/{Services-D_RwU_5S.js → Services-D8wInGPa.js} +2 -2
- package/src/assets/web-panel/assets/{Skeleton-TZjk-dsW.js → Skeleton-DXQCoYpM.js} +1 -1
- package/src/assets/web-panel/assets/{Skills-CG6FcaCV.js → Skills-D3oLRIVn.js} +1 -1
- package/src/assets/web-panel/assets/{Sla-BI190QDv.js → Sla-BmP4-LnJ.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-BWmxF2Wu.js → SpeechSettings-DLj-xzro.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-CwPiGw6L.js → SyncSettings-8KKaaRMr.js} +2 -2
- package/src/assets/web-panel/assets/{Tasks-BIXgCeSk.js → Tasks-GyK42I7C.js} +1 -1
- package/src/assets/web-panel/assets/{Templates-CQFgGCoK.js → Templates-n1y_8UBG.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-DAelEdkL.js → Tenant-B39nBph8.js} +1 -1
- package/src/assets/web-panel/assets/{Terminal-BbqWK6qh.js → Terminal-DCQoOKXe.js} +2 -2
- package/src/assets/web-panel/assets/{TimelineRenderer-cmG3zvY5.js → TimelineRenderer-BkhbDfXk.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-C8444NKU.js → Tokens-BeHIIU8D.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-C1Rpnz0I.js → Trigger-BHvWXVOb.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-u4koPiFD.js → Trust-y2WaOSto.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-oPWKn80Z.js → UkeySign-DBFeJBzt.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-D0CUUY_5.js → VideoEditing-BEOWitC-.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-fu9pIAbt.js → Wallet-BITedTe6.js} +4 -4
- package/src/assets/web-panel/assets/{WebAuthn-Bc5ciuOx.js → WebAuthn-DMwlJVin.js} +2 -2
- package/src/assets/web-panel/assets/{WorkflowEditor-BCin4_4N.js → WorkflowEditor-CKfGFEu1.js} +1 -1
- package/src/assets/web-panel/assets/{chat-B2jbM-XN.js → chat-DR6gnBGF.js} +1 -1
- package/src/assets/web-panel/assets/{colors-CUVoUQ_2.js → colors-C_Hw5NCn.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-DgOGpkRH.js → compact-item-B8IPwsEu.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-DIxU6eKI.js → createContext-D-u4JVnJ.js} +1 -1
- package/src/assets/web-panel/assets/devWarning-Cq6lSd_q.js +1 -0
- package/src/assets/web-panel/assets/{hasIn-DoKRKMav.js → hasIn-CZubdS4D.js} +1 -1
- package/src/assets/web-panel/assets/{index-ByjrulIZ.js → index-11ASqx-A.js} +1 -1
- package/src/assets/web-panel/assets/index-BQ3213fz.js +1 -0
- package/src/assets/web-panel/assets/{index-BwYofQJg.js → index-BXS6wYJZ.js} +1 -1
- package/src/assets/web-panel/assets/{index-CLdpHe6w.js → index-Bi21Etg4.js} +1 -1
- package/src/assets/web-panel/assets/{index-2flsPFIX.js → index-Bizm87cX.js} +1 -1
- package/src/assets/web-panel/assets/{index-BXb-Smmm.js → index-Bv2132PO.js} +1 -1
- package/src/assets/web-panel/assets/{index-B5ySiGYy.js → index-BzoFanEQ.js} +1 -1
- package/src/assets/web-panel/assets/{index-CWbL1-N0.js → index-C25rOz7O.js} +1 -1
- package/src/assets/web-panel/assets/{index-Cj-us-D_.js → index-C2VmtNaQ.js} +1 -1
- package/src/assets/web-panel/assets/{index-C9TsO9T9.js → index-Cbm8F0M2.js} +1 -1
- package/src/assets/web-panel/assets/{index-eTWPaeBI.js → index-CfniPP5p.js} +1 -1
- package/src/assets/web-panel/assets/{index-D2yo6ast.js → index-Cg2bCeol.js} +1 -1
- package/src/assets/web-panel/assets/{index-CPXdBnGi.js → index-CiXkhOkY.js} +1 -1
- package/src/assets/web-panel/assets/{index-BCLeNqIL.js → index-Cl5RpreD.js} +1 -1
- package/src/assets/web-panel/assets/{index-BtSPhEyC.js → index-CqmLw8cs.js} +1 -1
- package/src/assets/web-panel/assets/{index-eYxUASSG.js → index-Ctje8Vl3.js} +1 -1
- package/src/assets/web-panel/assets/{index-i5MB455u.js → index-D1w96gg9.js} +1 -1
- package/src/assets/web-panel/assets/{index-CpvyOt5Z.js → index-D47jt8ET.js} +1 -1
- package/src/assets/web-panel/assets/{index-CeWSw-z5.js → index-DJ6pG79m.js} +1 -1
- package/src/assets/web-panel/assets/{index-B3F_p8NA.js → index-DTosx2Wu.js} +1 -1
- package/src/assets/web-panel/assets/{index-B9mSYovv.js → index-DY6MHo9D.js} +1 -1
- package/src/assets/web-panel/assets/{index-DJMHnbmu.js → index-DcFjRT-K.js} +1 -1
- package/src/assets/web-panel/assets/{index-D-ufbAJB.js → index-DfnzrUxU.js} +1 -1
- package/src/assets/web-panel/assets/{index-BFUprhNd.js → index-DjRrqooR.js} +1 -1
- package/src/assets/web-panel/assets/{index-Co4lDEk-.js → index-DmRcgiYT.js} +1 -1
- package/src/assets/web-panel/assets/{index-DGTZdZOE.js → index-DpjHpRoq.js} +3 -3
- package/src/assets/web-panel/assets/{index-DHugFl3v.js → index-Dt-w3xQ7.js} +1 -1
- package/src/assets/web-panel/assets/{index-B-f6l4Vm.js → index-DuOU5apg.js} +1 -1
- package/src/assets/web-panel/assets/{index-DtyAuGOm.js → index-LvjAKDSl.js} +1 -1
- package/src/assets/web-panel/assets/{index-be8SonCh.js → index-_nL79NT8.js} +1 -1
- package/src/assets/web-panel/assets/{index-BRMEO2Tl.js → index-auyNYjLo.js} +1 -1
- package/src/assets/web-panel/assets/{index-C88m9lsi.js → index-cVqbas5C.js} +1 -1
- package/src/assets/web-panel/assets/{index-CqlwIjJx.js → index-ffe7bvqP.js} +1 -1
- package/src/assets/web-panel/assets/{index-DpTFx8Xx.js → index-idZKyADQ.js} +1 -1
- package/src/assets/web-panel/assets/{index-Cskz--fd.js → index-k1Xa5iw1.js} +1 -1
- package/src/assets/web-panel/assets/{index-CF80xxPG.js → index-mYZJxGH6.js} +1 -1
- package/src/assets/web-panel/assets/{index-Ds8r3Fzb.js → index-rYBHSDcJ.js} +1 -1
- package/src/assets/web-panel/assets/index-vJagfET2.js +1 -0
- package/src/assets/web-panel/assets/{index-C846lPGD.js → index-xoNssgz_.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-B4chl7iR.js → initDefaultProps-lcU_dT2r.js} +1 -1
- package/src/assets/web-panel/assets/{motion-DruN9h96.js → motion-Dc7UNXZ1.js} +1 -1
- package/src/assets/web-panel/assets/{move-Cl0UtCgU.js → move-Cll8ZXaL.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-FX2ttw70.js → mtc-parser-CAb_yLIM.js} +1 -1
- package/src/assets/web-panel/assets/{omit-BDCneY46.js → omit-DurYMyTe.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-DycsEg8b.js → pickAttrs-BITQyOlw.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-Bc-dBuMv.js → placementArrow-Dg1rH91i.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve--Wwaf8lu.js → responsiveObserve-D_EWIeac.js} +1 -1
- package/src/assets/web-panel/assets/{slide-vDmHQqHH.js → slide-lK4d3zsh.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-9c52yv3G.js → statusUtils-Bflq-Git.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-BT4BiO6_.js → styleChecker-Ccp0I-wt.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-C7XxWPcP.js → useFlexGapSupport-CYZbByYA.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-BHoMqh4i.js → useFs-B_x0nxFD.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-BOLxvsAG.js → usePersonalDataHub-DW55rL85.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-CA7poeeP.js → vnode-Ca6MH3W8.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-B_sAn-co.js → zoom-NdHelOog.js} +1 -1
- package/src/assets/web-panel/index.html +1 -1
- package/src/command-help-index.json +1 -1
- package/src/commands/graph.js +215 -5
- package/src/commands/orchestrate.js +61 -9
- package/src/commands/team-distributed.js +342 -2
- package/src/commands/team.js +169 -7
- package/src/data/changelog.json +46 -0
- package/src/gateways/ws/message-dispatcher.js +4 -0
- package/src/gateways/ws/session-protocol.js +89 -11
- package/src/gateways/ws/ws-agent-handler.js +65 -9
- package/src/gateways/ws/ws-approval-gate.js +181 -16
- package/src/gateways/ws/ws-server.js +16 -6
- package/src/generated/cc-agent-protocol.schema.json +154 -3
- package/src/lib/agent-team/task-lease.js +487 -3
- package/src/lib/agent-team/team-agent-stream.js +16 -0
- package/src/lib/agent-team/team-distributed-graph-bridge.js +257 -0
- package/src/lib/agent-team/team-distributed-graph-writer.js +523 -0
- package/src/lib/agent-team/team-distributed-queue.js +251 -0
- package/src/lib/agent-team/team-graph-runtime-adapter.js +1918 -0
- package/src/lib/agent-team/team-runner.js +285 -3
- package/src/lib/app-server/graph-runtime.js +1078 -0
- package/src/lib/app-server/rollout-store.js +32 -0
- package/src/lib/app-server/server.js +200 -0
- package/src/lib/approval-grant-ledger.js +69 -0
- package/src/lib/autonomous-agent.js +11 -0
- package/src/lib/codex-app-server-adapter.js +11 -20
- package/src/lib/cowork-graph-authority-adapter.js +455 -0
- package/src/lib/dynamic-workflow-facade.js +83 -16
- package/src/lib/graph-kernel/adapters.js +93 -20
- package/src/lib/graph-kernel/authority.js +324 -0
- package/src/lib/graph-kernel/compiler.js +67 -21
- package/src/lib/graph-kernel/cutover-authority-resolver.js +245 -0
- package/src/lib/graph-kernel/cutover-ledger.js +692 -0
- package/src/lib/graph-kernel/event-store.js +15 -1
- package/src/lib/graph-kernel/graph-runtime-surfaces.json +1427 -0
- package/src/lib/graph-kernel/index.js +4 -0
- package/src/lib/graph-kernel/migration-saga.js +309 -0
- package/src/lib/graph-kernel/retirement-evidence.js +567 -0
- package/src/lib/graph-kernel/runtime-surface-manifest.js +481 -0
- package/src/lib/graph-kernel/runtime.js +737 -38
- package/src/lib/graph-kernel/store-cutover-evidence.js +354 -0
- package/src/lib/graph-kernel/trace-reducer.js +6 -0
- package/src/lib/graph-kernel/trigger-adapter.js +60 -3
- package/src/lib/interaction-adapter.js +61 -9
- package/src/lib/legacy-runtime-authority.js +160 -0
- package/src/lib/orchestrator.js +28 -0
- package/src/lib/policy-decision-event.js +149 -0
- package/src/lib/process-execution-broker/platform-sandbox.js +15 -1
- package/src/lib/record-replay/index.js +1 -0
- package/src/lib/record-replay/playwright-ui-driver.js +327 -0
- package/src/lib/scheduler-kernel/graph-authority-adapter.js +512 -0
- package/src/lib/scheduler-kernel/runtime.js +75 -2
- package/src/lib/webhook-security.js +484 -36
- package/src/runtime/coding-agent-events.cjs +13 -11
- package/src/runtime/headless-runner.js +17 -1
- package/src/runtime/headless-stream.js +66 -3
- package/src/runtime/session-slash-commands.js +57 -6
- package/src/assets/web-panel/assets/MarkdownRenderer-BwH414Ms.js +0 -1
- package/src/assets/web-panel/assets/PdhVaultBrowser-BiaZfQIM.js +0 -7
- package/src/assets/web-panel/assets/Projects-DiCGnMjz.js +0 -1
- package/src/assets/web-panel/assets/RemoteSession-s1gR38IO.js +0 -5
- package/src/assets/web-panel/assets/devWarning-DiSlgCC4.js +0 -1
- package/src/assets/web-panel/assets/index-9WIQEHvv.js +0 -1
- package/src/assets/web-panel/assets/index-B7mDobAl.js +0 -1
|
@@ -116,6 +116,36 @@ function buildRecord(input, previous, now) {
|
|
|
116
116
|
return Object.freeze({ ...record, hash: recordHash(record) });
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
function assertExpectedHead(input, records) {
|
|
120
|
+
const previous = records.at(-1) || null;
|
|
121
|
+
if (
|
|
122
|
+
input.expectedRevision !== undefined &&
|
|
123
|
+
Number(input.expectedRevision) !== Number(previous?.event_seq || 0)
|
|
124
|
+
) {
|
|
125
|
+
throw storeError(
|
|
126
|
+
"CC_ROLLOUT_HEAD_CONFLICT",
|
|
127
|
+
"rollout revision changed before append",
|
|
128
|
+
{
|
|
129
|
+
expectedRevision: Number(input.expectedRevision),
|
|
130
|
+
actualRevision: Number(previous?.event_seq || 0),
|
|
131
|
+
},
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
if (
|
|
135
|
+
input.expectedHeadHash !== undefined &&
|
|
136
|
+
input.expectedHeadHash !== (previous?.hash || null)
|
|
137
|
+
) {
|
|
138
|
+
throw storeError(
|
|
139
|
+
"CC_ROLLOUT_HEAD_CONFLICT",
|
|
140
|
+
"rollout event head changed before append",
|
|
141
|
+
{
|
|
142
|
+
expectedHeadHash: input.expectedHeadHash,
|
|
143
|
+
actualHeadHash: previous?.hash || null,
|
|
144
|
+
},
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
119
149
|
function verifyRecords(records, expectedThreadId = null) {
|
|
120
150
|
let previous = null;
|
|
121
151
|
for (const record of records) {
|
|
@@ -309,6 +339,7 @@ export class JsonlRolloutStore {
|
|
|
309
339
|
return clone(duplicate);
|
|
310
340
|
}
|
|
311
341
|
}
|
|
342
|
+
assertExpectedHead(input, records);
|
|
312
343
|
const record = buildRecord(input, records.at(-1), this.now);
|
|
313
344
|
fs.appendFileSync(file, `${JSON.stringify(record)}\n`, "utf8");
|
|
314
345
|
return clone(record);
|
|
@@ -498,6 +529,7 @@ export class MemoryRolloutStore {
|
|
|
498
529
|
}
|
|
499
530
|
return clone(duplicate);
|
|
500
531
|
}
|
|
532
|
+
assertExpectedHead(input, records);
|
|
501
533
|
const record = buildRecord(input, records.at(-1), this.now);
|
|
502
534
|
records.push(record);
|
|
503
535
|
return clone(record);
|
|
@@ -2,6 +2,8 @@ import { createHash, randomUUID } from "node:crypto";
|
|
|
2
2
|
import { BoundedAsyncQueue, QueueOverloadedError } from "./bounded-queue.js";
|
|
3
3
|
import { CliAgentKernelAdapter } from "./cli-agent-kernel-adapter.js";
|
|
4
4
|
import { JsonlRolloutStore } from "./rollout-store.js";
|
|
5
|
+
import { AppServerGraphRuntime } from "./graph-runtime.js";
|
|
6
|
+
import { compileGraphDefinition } from "../graph-kernel/compiler.js";
|
|
5
7
|
import {
|
|
6
8
|
APP_SERVER_MIN_PROTOCOL_VERSION,
|
|
7
9
|
APP_SERVER_PROTOCOL_VERSION,
|
|
@@ -110,6 +112,7 @@ export class CcAppServer {
|
|
|
110
112
|
requestTimeoutMs = 120_000,
|
|
111
113
|
interruptSettlementMs = 30_000,
|
|
112
114
|
transport = "stdio",
|
|
115
|
+
graphRuntime = null,
|
|
113
116
|
} = {}) {
|
|
114
117
|
if (typeof send !== "function") {
|
|
115
118
|
throw new TypeError("CcAppServer requires a send(message) function");
|
|
@@ -122,6 +125,18 @@ export class CcAppServer {
|
|
|
122
125
|
this.requestTimeoutMs = requestTimeoutMs;
|
|
123
126
|
this.interruptSettlementMs = interruptSettlementMs;
|
|
124
127
|
this.transport = transport === "websocket" ? "websocket" : "stdio";
|
|
128
|
+
this.graphRuntime =
|
|
129
|
+
graphRuntime ||
|
|
130
|
+
new AppServerGraphRuntime({
|
|
131
|
+
rolloutStore: store,
|
|
132
|
+
now,
|
|
133
|
+
createId,
|
|
134
|
+
executeNode: (context) => this._executeGraphNode(context),
|
|
135
|
+
requestHumanTask: (context) => this._requestHumanTask(context),
|
|
136
|
+
onEvent: (event) => {
|
|
137
|
+
void this._notify("graph/event", event).catch(() => {});
|
|
138
|
+
},
|
|
139
|
+
});
|
|
125
140
|
this.initialized = false;
|
|
126
141
|
this.negotiated = null;
|
|
127
142
|
this.client = null;
|
|
@@ -278,6 +293,12 @@ export class CcAppServer {
|
|
|
278
293
|
"thread/archive": () => this._threadArchive(message.params),
|
|
279
294
|
"turn/start": () => this._turnStart(message.params),
|
|
280
295
|
"turn/interrupt": () => this._turnInterrupt(message.params),
|
|
296
|
+
"graph/compile": () => this._graphCompile(message.params),
|
|
297
|
+
"graph/run": () => this._graphRun(message.params),
|
|
298
|
+
"graph/status": () => this._graphStatus(message.params),
|
|
299
|
+
"graph/history": () => this._graphHistory(message.params),
|
|
300
|
+
"graph/cancel": () => this._graphCancel(message.params),
|
|
301
|
+
"graph/reconcile": () => this._graphReconcile(message.params),
|
|
281
302
|
};
|
|
282
303
|
const handler = handlers[method];
|
|
283
304
|
if (!handler) {
|
|
@@ -324,6 +345,7 @@ export class CcAppServer {
|
|
|
324
345
|
transports: [this.transport],
|
|
325
346
|
websocket: { stability: "experimental" },
|
|
326
347
|
limits: this.requestQueue.snapshot(),
|
|
348
|
+
graphRuntime: this.graphRuntime.runtimeClaims(),
|
|
327
349
|
schema: {
|
|
328
350
|
id: APP_SERVER_SCHEMA.$id,
|
|
329
351
|
version: APP_SERVER_PROTOCOL_VERSION,
|
|
@@ -331,6 +353,146 @@ export class CcAppServer {
|
|
|
331
353
|
});
|
|
332
354
|
}
|
|
333
355
|
|
|
356
|
+
_graphCompile(rawParams) {
|
|
357
|
+
const params = requireObject(rawParams);
|
|
358
|
+
const compiled = compileGraphDefinition(
|
|
359
|
+
requireObject(params.definition, "definition"),
|
|
360
|
+
);
|
|
361
|
+
return {
|
|
362
|
+
definitionId: compiled.definitionId,
|
|
363
|
+
revision: compiled.revision,
|
|
364
|
+
revisionDigest: compiled.revisionDigest,
|
|
365
|
+
migratedFrom: compiled.migratedFrom,
|
|
366
|
+
definitionMigration: compiled.definitionMigration
|
|
367
|
+
? {
|
|
368
|
+
schema: compiled.definitionMigration.schema,
|
|
369
|
+
fromVersion: compiled.definitionMigration.fromVersion,
|
|
370
|
+
toVersion: compiled.definitionMigration.toVersion,
|
|
371
|
+
revisionDigest: compiled.definitionMigration.revisionDigest,
|
|
372
|
+
rollbackDigest: compiled.definitionMigration.rollbackDigest,
|
|
373
|
+
backupAvailable: true,
|
|
374
|
+
}
|
|
375
|
+
: null,
|
|
376
|
+
topologicalOrder: [...compiled.topologicalOrder],
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
async _graphRun(rawParams) {
|
|
381
|
+
const params = requireObject(rawParams);
|
|
382
|
+
if (params.resume === true) {
|
|
383
|
+
return this.graphRuntime.resume(requiredString(params.runId, "runId"), {
|
|
384
|
+
waitForCompletion: params.waitForCompletion === true,
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
return this.graphRuntime.run({
|
|
388
|
+
definition: requireObject(params.definition, "definition"),
|
|
389
|
+
runId: params.runId || this.createId(),
|
|
390
|
+
inputs: params.inputs || {},
|
|
391
|
+
originSurface: params.originSurface || "desktop",
|
|
392
|
+
agentCapacity: params.agentCapacity,
|
|
393
|
+
authorityMode: params.authorityMode || "canonical",
|
|
394
|
+
waitForCompletion: params.waitForCompletion === true,
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
_graphStatus(rawParams) {
|
|
399
|
+
const params = requireObject(rawParams);
|
|
400
|
+
return this.graphRuntime.status(requiredString(params.runId, "runId"));
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
_graphHistory(rawParams) {
|
|
404
|
+
const params = requireObject(rawParams);
|
|
405
|
+
return this.graphRuntime.history(requiredString(params.runId, "runId"), {
|
|
406
|
+
afterSeq: params.afterSeq,
|
|
407
|
+
limit: params.limit,
|
|
408
|
+
snapshotLimit: params.snapshotLimit,
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
_graphCancel(rawParams) {
|
|
413
|
+
const params = requireObject(rawParams);
|
|
414
|
+
return this.graphRuntime.cancel(
|
|
415
|
+
requiredString(params.runId, "runId"),
|
|
416
|
+
params.reason || "cancelled by App Server client",
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
_graphReconcile(rawParams) {
|
|
421
|
+
const params = requireObject(rawParams);
|
|
422
|
+
return this.graphRuntime.reconcile(
|
|
423
|
+
requiredString(params.runId, "runId"),
|
|
424
|
+
requireObject(params.reconciliation, "reconciliation"),
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
async _executeGraphNode({ runId, nodeId, attempt, input, signal }) {
|
|
429
|
+
const threadId = `graph-agent:${runId}:${nodeId}`;
|
|
430
|
+
const turn = { id: attempt.id, threadId };
|
|
431
|
+
const onAbort = () => {
|
|
432
|
+
void this.kernel.interruptTurn?.(threadId, attempt.id);
|
|
433
|
+
};
|
|
434
|
+
signal?.addEventListener?.("abort", onAbort, { once: true });
|
|
435
|
+
try {
|
|
436
|
+
const result = await this.kernel.startTurn({
|
|
437
|
+
threadId,
|
|
438
|
+
turnId: attempt.id,
|
|
439
|
+
input: requiredString(input?.prompt, `inputs.${nodeId}.prompt`),
|
|
440
|
+
options: input?.options || {},
|
|
441
|
+
emit: (event) =>
|
|
442
|
+
this._notify("graph/event", {
|
|
443
|
+
type: "graph/agent-event",
|
|
444
|
+
runId,
|
|
445
|
+
nodeId,
|
|
446
|
+
attemptId: attempt.id,
|
|
447
|
+
event,
|
|
448
|
+
}),
|
|
449
|
+
requestApproval: (event) => this._requestApproval(turn, event),
|
|
450
|
+
});
|
|
451
|
+
const failed = result?.is_error === true || result?.subtype === "error";
|
|
452
|
+
const output = typeof result?.result === "string" ? result.result : "";
|
|
453
|
+
const receiptThreadId = `graph-executor:${runId}`;
|
|
454
|
+
this.store.start({
|
|
455
|
+
threadId: receiptThreadId,
|
|
456
|
+
title: `Graph executor receipts for ${runId}`,
|
|
457
|
+
metadata: { kind: "graph_executor_receipts", graphRunId: runId },
|
|
458
|
+
});
|
|
459
|
+
const events = this.store.read(receiptThreadId);
|
|
460
|
+
const receiptEvent = this.store.append({
|
|
461
|
+
threadId: receiptThreadId,
|
|
462
|
+
turnId: attempt.id,
|
|
463
|
+
eventType: failed ? "executor.failed" : "executor.succeeded",
|
|
464
|
+
idempotencyKey: `graph-executor:${attempt.id}`,
|
|
465
|
+
payload: {
|
|
466
|
+
runId,
|
|
467
|
+
nodeId,
|
|
468
|
+
attemptId: attempt.id,
|
|
469
|
+
status: failed ? "failed" : "succeeded",
|
|
470
|
+
outputDigest: output ? digest(output) : null,
|
|
471
|
+
error: failed ? String(result?.error || "Agent turn failed") : null,
|
|
472
|
+
},
|
|
473
|
+
expectedRevision: events.at(-1)?.seq,
|
|
474
|
+
expectedHeadHash: events.at(-1)?.hash,
|
|
475
|
+
});
|
|
476
|
+
if (failed) {
|
|
477
|
+
return {
|
|
478
|
+
status: "failed",
|
|
479
|
+
outcomeKnown: true,
|
|
480
|
+
error: result?.error || "Agent turn failed",
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
return {
|
|
484
|
+
status: "succeeded",
|
|
485
|
+
terminalEvidence: {
|
|
486
|
+
eventDigest: receiptEvent.hash,
|
|
487
|
+
outputDigest: output ? digest(output) : null,
|
|
488
|
+
},
|
|
489
|
+
usage: result?.usage || {},
|
|
490
|
+
};
|
|
491
|
+
} finally {
|
|
492
|
+
signal?.removeEventListener?.("abort", onAbort);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
334
496
|
async _notify(method, params, rollout = null) {
|
|
335
497
|
if (rollout) {
|
|
336
498
|
this.store.append({
|
|
@@ -769,6 +931,44 @@ export class CcAppServer {
|
|
|
769
931
|
return result;
|
|
770
932
|
}
|
|
771
933
|
|
|
934
|
+
async _requestHumanTask({ task }) {
|
|
935
|
+
const result = await this._requestClient("humanTask/decide", { task });
|
|
936
|
+
const response = requireObject(result, "humanTask decision");
|
|
937
|
+
const validation = validateApprovalDecision(response.decision);
|
|
938
|
+
const bindings = [
|
|
939
|
+
["humanTaskId", task.id],
|
|
940
|
+
["runId", task.runId],
|
|
941
|
+
["revisionDigest", task.revisionDigest],
|
|
942
|
+
["operationDigest", task.operationDigest],
|
|
943
|
+
["nonce", task.nonce],
|
|
944
|
+
];
|
|
945
|
+
if (
|
|
946
|
+
!validation.ok ||
|
|
947
|
+
typeof response.actorId !== "string" ||
|
|
948
|
+
!/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,159}$/u.test(response.actorId) ||
|
|
949
|
+
Object.keys(response).some(
|
|
950
|
+
(field) =>
|
|
951
|
+
![
|
|
952
|
+
"humanTaskId",
|
|
953
|
+
"runId",
|
|
954
|
+
"revisionDigest",
|
|
955
|
+
"operationDigest",
|
|
956
|
+
"nonce",
|
|
957
|
+
"actorId",
|
|
958
|
+
"decision",
|
|
959
|
+
].includes(field),
|
|
960
|
+
) ||
|
|
961
|
+
bindings.some(([field, expected]) => response[field] !== expected)
|
|
962
|
+
) {
|
|
963
|
+
throw new JsonRpcError(
|
|
964
|
+
JSON_RPC_ERROR.INVALID_PARAMS,
|
|
965
|
+
"client returned an invalid or stale HumanTask decision",
|
|
966
|
+
{ errors: validation.errors },
|
|
967
|
+
);
|
|
968
|
+
}
|
|
969
|
+
return response;
|
|
970
|
+
}
|
|
971
|
+
|
|
772
972
|
async _completeTurn(turn, status, result) {
|
|
773
973
|
if (TERMINAL_TURN_STATUSES.has(turn.status)) return;
|
|
774
974
|
if (turn.assistantStarted) {
|
|
@@ -46,6 +46,14 @@ function permissionKey(permission) {
|
|
|
46
46
|
return `${permission.capability}\0${permission.scope}`;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
function grantId(sessionId, lifetime, permission) {
|
|
50
|
+
return `grant_${createHash("sha256")
|
|
51
|
+
.update(
|
|
52
|
+
`${String(sessionId)}\0${String(lifetime)}\0${permissionKey(permission)}`,
|
|
53
|
+
)
|
|
54
|
+
.digest("hex")}`;
|
|
55
|
+
}
|
|
56
|
+
|
|
49
57
|
function livePermission(permission, now) {
|
|
50
58
|
const validation = validateAppServerDefinition("PermissionGrant", permission);
|
|
51
59
|
if (!validation.ok) return false;
|
|
@@ -102,6 +110,67 @@ export class ApprovalGrantLedger {
|
|
|
102
110
|
return false;
|
|
103
111
|
}
|
|
104
112
|
|
|
113
|
+
listGrants() {
|
|
114
|
+
const now = this.now();
|
|
115
|
+
const grants = [];
|
|
116
|
+
for (const [lifetime, entries] of [
|
|
117
|
+
["turn", this.turnGrants],
|
|
118
|
+
["session", this.sessionGrants],
|
|
119
|
+
]) {
|
|
120
|
+
for (const [key, entry] of entries) {
|
|
121
|
+
if (!livePermission(entry.permission, now)) {
|
|
122
|
+
entries.delete(key);
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
grants.push(
|
|
126
|
+
Object.freeze({
|
|
127
|
+
grantId: grantId(this.sessionId, lifetime, entry.permission),
|
|
128
|
+
lifetime,
|
|
129
|
+
permission: Object.freeze({ ...entry.permission }),
|
|
130
|
+
binding: entry.binding,
|
|
131
|
+
grantedAt: entry.grantedAt,
|
|
132
|
+
...(lifetime === "turn" ? { turnId: this.turnId } : {}),
|
|
133
|
+
}),
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return Object.freeze(grants);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
revoke(grantIdValue) {
|
|
141
|
+
const requestedId = String(grantIdValue || "");
|
|
142
|
+
for (const [lifetime, entries] of [
|
|
143
|
+
["turn", this.turnGrants],
|
|
144
|
+
["session", this.sessionGrants],
|
|
145
|
+
]) {
|
|
146
|
+
for (const [key, entry] of entries) {
|
|
147
|
+
if (
|
|
148
|
+
grantId(this.sessionId, lifetime, entry.permission) !== requestedId
|
|
149
|
+
) {
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
entries.delete(key);
|
|
153
|
+
if (lifetime === "session") this.revision += 1;
|
|
154
|
+
return Object.freeze({
|
|
155
|
+
revoked: true,
|
|
156
|
+
persistedScope: lifetime === "session",
|
|
157
|
+
grant: Object.freeze({
|
|
158
|
+
grantId: requestedId,
|
|
159
|
+
lifetime,
|
|
160
|
+
permission: Object.freeze({ ...entry.permission }),
|
|
161
|
+
binding: entry.binding,
|
|
162
|
+
grantedAt: entry.grantedAt,
|
|
163
|
+
}),
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return Object.freeze({
|
|
168
|
+
revoked: false,
|
|
169
|
+
persistedScope: false,
|
|
170
|
+
grant: null,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
105
174
|
applyDecision(decision, requiredPermission, binding) {
|
|
106
175
|
if (
|
|
107
176
|
decision?.kind !== "acceptForTurn" &&
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { EventEmitter } from "events";
|
|
11
11
|
import { firstBalancedJson } from "./json-schema-output.js";
|
|
12
|
+
import { assertCLILegacyMutationAllowed } from "./legacy-runtime-authority.js";
|
|
12
13
|
|
|
13
14
|
// Exported for test injection
|
|
14
15
|
export const _deps = {
|
|
@@ -67,6 +68,7 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
67
68
|
maxGoals,
|
|
68
69
|
iterationBudget,
|
|
69
70
|
} = {}) {
|
|
71
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent.initialize");
|
|
70
72
|
this._llmChat = llmChat || null;
|
|
71
73
|
this._toolExecutor = toolExecutor || null;
|
|
72
74
|
this._hookManager = hookManager || null;
|
|
@@ -84,6 +86,7 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
84
86
|
* @returns {{ goalId: string }}
|
|
85
87
|
*/
|
|
86
88
|
async submitGoal(description, { tokenBudget = 50000 } = {}) {
|
|
89
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent.submitGoal");
|
|
87
90
|
if (!this._initialized) throw new Error("Agent not initialized");
|
|
88
91
|
if (!description) throw new Error("Goal description required");
|
|
89
92
|
|
|
@@ -124,6 +127,7 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
124
127
|
* the cap rather than losing live work.
|
|
125
128
|
*/
|
|
126
129
|
_pruneGoals() {
|
|
130
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent._pruneGoals");
|
|
127
131
|
if (this._goals.size <= this._maxGoals) return;
|
|
128
132
|
for (const [id, g] of this._goals) {
|
|
129
133
|
if (this._goals.size <= this._maxGoals) break;
|
|
@@ -141,6 +145,7 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
141
145
|
* Pause a running goal.
|
|
142
146
|
*/
|
|
143
147
|
pauseGoal(goalId) {
|
|
148
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent.pauseGoal");
|
|
144
149
|
const goal = this._goals.get(goalId);
|
|
145
150
|
if (!goal) return { error: "Goal not found" };
|
|
146
151
|
if (goal.status !== GoalStatus.RUNNING)
|
|
@@ -156,6 +161,7 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
156
161
|
* Resume a paused goal.
|
|
157
162
|
*/
|
|
158
163
|
resumeGoal(goalId) {
|
|
164
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent.resumeGoal");
|
|
159
165
|
const goal = this._goals.get(goalId);
|
|
160
166
|
if (!goal) return { error: "Goal not found" };
|
|
161
167
|
if (goal.status !== GoalStatus.PAUSED)
|
|
@@ -178,6 +184,7 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
178
184
|
* Cancel a goal.
|
|
179
185
|
*/
|
|
180
186
|
cancelGoal(goalId) {
|
|
187
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent.cancelGoal");
|
|
181
188
|
const goal = this._goals.get(goalId);
|
|
182
189
|
if (!goal) return { error: "Goal not found" };
|
|
183
190
|
|
|
@@ -228,6 +235,7 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
228
235
|
// ─── ReAct Loop ─────────────────────────────────────────────
|
|
229
236
|
|
|
230
237
|
async _runReActLoop(goal) {
|
|
238
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent._runReActLoop");
|
|
231
239
|
goal.status = GoalStatus.RUNNING;
|
|
232
240
|
this.emit("goal:started", { goalId: goal.id });
|
|
233
241
|
|
|
@@ -342,6 +350,7 @@ export class CLIAutonomousAgent extends EventEmitter {
|
|
|
342
350
|
* Decompose a goal into executable steps using LLM.
|
|
343
351
|
*/
|
|
344
352
|
async _decomposeGoal(goal) {
|
|
353
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent._decomposeGoal");
|
|
345
354
|
if (!this._llmChat) {
|
|
346
355
|
// No LLM — create a single step
|
|
347
356
|
return [
|
|
@@ -406,6 +415,7 @@ Only return the JSON array, no other text.`;
|
|
|
406
415
|
* Execute a single step using the tool executor.
|
|
407
416
|
*/
|
|
408
417
|
async _executeStep(step) {
|
|
418
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent._executeStep");
|
|
409
419
|
if (!step.tool || !this._toolExecutor) {
|
|
410
420
|
// No tool specified or no executor — skip as informational
|
|
411
421
|
return "No tool action required";
|
|
@@ -419,6 +429,7 @@ Only return the JSON array, no other text.`;
|
|
|
419
429
|
* Returns true if a correction was applied.
|
|
420
430
|
*/
|
|
421
431
|
async _selfCorrect(goal, error) {
|
|
432
|
+
assertCLILegacyMutationAllowed("CLIAutonomousAgent._selfCorrect");
|
|
422
433
|
if (!this._llmChat) return false;
|
|
423
434
|
|
|
424
435
|
try {
|
|
@@ -2,6 +2,11 @@ import { EventEmitter } from "node:events";
|
|
|
2
2
|
|
|
3
3
|
export const CODEX_APP_SERVER_PROTOCOL = "codex-app-server-experimental-v1";
|
|
4
4
|
export const CODEX_APP_SERVER_FEATURE_FLAG = "CC_EXPERIMENTAL_CODEX_APP_SERVER";
|
|
5
|
+
export const CODEX_APP_SERVER_COMPATIBILITY_MATRIX = Object.freeze([
|
|
6
|
+
Object.freeze({ version: "0.149.0" }),
|
|
7
|
+
Object.freeze({ version: "0.150.0" }),
|
|
8
|
+
Object.freeze({ version: "0.150.1" }),
|
|
9
|
+
]);
|
|
5
10
|
|
|
6
11
|
function adapterError(code, message, details = {}) {
|
|
7
12
|
const error = new Error(message);
|
|
@@ -12,30 +17,16 @@ function adapterError(code, message, details = {}) {
|
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
function parseVersion(value) {
|
|
15
|
-
const match = String(value || "")
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
function compareVersion(left, right) {
|
|
20
|
-
for (let index = 0; index < 3; index += 1) {
|
|
21
|
-
if (left[index] !== right[index]) return left[index] - right[index];
|
|
22
|
-
}
|
|
23
|
-
return 0;
|
|
20
|
+
const match = String(value || "")
|
|
21
|
+
.trim()
|
|
22
|
+
.match(/^(?:codex(?:-cli)?\s+)?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/u);
|
|
23
|
+
return match ? match.slice(1).map(Number).join(".") : null;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export function isCodexAppServerVersionCompatible(version, matrix = []) {
|
|
27
27
|
const parsed = parseVersion(version);
|
|
28
28
|
if (!parsed || !Array.isArray(matrix) || matrix.length === 0) return false;
|
|
29
|
-
return matrix.some((
|
|
30
|
-
const minimum = parseVersion(range.min);
|
|
31
|
-
const maximum = parseVersion(range.maxExclusive);
|
|
32
|
-
return (
|
|
33
|
-
minimum &&
|
|
34
|
-
maximum &&
|
|
35
|
-
compareVersion(parsed, minimum) >= 0 &&
|
|
36
|
-
compareVersion(parsed, maximum) < 0
|
|
37
|
-
);
|
|
38
|
-
});
|
|
29
|
+
return matrix.some((entry) => parseVersion(entry?.version) === parsed);
|
|
39
30
|
}
|
|
40
31
|
|
|
41
32
|
function projectNotification(notification) {
|
|
@@ -103,7 +94,7 @@ export class CodexAppServerAdapter extends EventEmitter {
|
|
|
103
94
|
client,
|
|
104
95
|
fallback,
|
|
105
96
|
upstreamVersion,
|
|
106
|
-
compatibilityMatrix =
|
|
97
|
+
compatibilityMatrix = CODEX_APP_SERVER_COMPATIBILITY_MATRIX,
|
|
107
98
|
enabled = process.env[CODEX_APP_SERVER_FEATURE_FLAG] === "1",
|
|
108
99
|
timeoutMs = 120_000,
|
|
109
100
|
} = {}) {
|