chainlesschain 0.166.45 → 0.166.47
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 +6 -4
- package/package.json +3 -1
- package/src/assets/web-panel/assets/{AIOps-CrMhYNeH.js → AIOps-CDpT0WXV.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-DLY5blZ3.js → ActionButton-BNfUljWx.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-C0NhKQB0.js → Analytics-C9323DEx.js} +3 -3
- package/src/assets/web-panel/assets/{AppLayout-DLyepgMq.js → AppLayout-CRrjb2db.js} +5 -5
- package/src/assets/web-panel/assets/{Artifacts-Depk01Sa.js → Artifacts-Db-DGqJS.js} +1 -1
- package/src/assets/web-panel/assets/{Audit-jKe6NQ3J.js → Audit-CJdHRJ0W.js} +1 -1
- package/src/assets/web-panel/assets/{BackgroundAgents-CG4GKT9s.js → BackgroundAgents-_RSCnTYs.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-DYWCkzwM.js → Backup-8GFQi-dM.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-xm5vodmJ.js → BaseInput-C87NtgUZ.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-B20_PNd3.js → Chat-DcTMWS8G.js} +5 -5
- package/src/assets/web-panel/assets/{ChatBubbleRenderer-D4d-eh0F.js → ChatBubbleRenderer-5ZDPTW_H.js} +1 -1
- package/src/assets/web-panel/assets/{Checkbox-CfgwkV_r.js → Checkbox-DM9EmYee.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-DbnoWI44.js → Codegen-M2YqDRNN.js} +1 -1
- package/src/assets/web-panel/assets/{Col-CfzzhgGw.js → Col-oB1LLxyf.js} +1 -1
- package/src/assets/web-panel/assets/{Community-BU7mGM8p.js → Community-TcVZK5tF.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-DpYim0an.js → Compact-XKmq-3K_.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-BNJcO6ra.js → Compliance-C6CBiDRy.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-CecZ-pWj.js → Cowork-Dz9CGqXH.js} +4 -4
- package/src/assets/web-panel/assets/{Cron-BG_C1fe3.js → Cron-CxJDgDVL.js} +2 -2
- package/src/assets/web-panel/assets/{Crosschain-BAeILQLL.js → Crosschain-DMP0JsaQ.js} +1 -1
- package/src/assets/web-panel/assets/{DID-CYqOEkXi.js → DID-I5IQeogb.js} +2 -2
- package/src/assets/web-panel/assets/{Dashboard-BYU8wmL1.js → Dashboard-BfLW2MXj.js} +2 -2
- package/src/assets/web-panel/assets/{Dropdown-DYlJeTTa.js → Dropdown-BK8EjAlh.js} +1 -1
- package/src/assets/web-panel/assets/{EmailListRenderer-C0M6py3K.js → EmailListRenderer-C3iqSv5I.js} +1 -1
- package/src/assets/web-panel/assets/EvolutionSettings-BJmBzpW6.js +1 -0
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-Du90iDch.js → FamilyGuardDashboard-T19rnqm-.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-DkFp_hzB.js → Federation-CozrbPMy.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-BGgtGTfG.js → FormItemContext-k1dCLNNJ.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-BIDsSCei.js → GenericCardRenderer-DbaW_Jvt.js} +1 -1
- package/src/assets/web-panel/assets/{Git--d3Te93J.js → Git-CQHRyEIt.js} +2 -2
- package/src/assets/web-panel/assets/{Governance-CZwD0vmO.js → Governance-BMJYZgMy.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-DiDcSFEW.js → Inference-B7mpNU7V.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-Bi0hSfzg.js → KnowledgeGraph-Br0Blg6B.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-C8NHSc0K.js → Logs-HIdk0S6M.js} +2 -2
- package/src/assets/web-panel/assets/{MarkdownRenderer-DfDuADqF.js → MarkdownRenderer-HxeocBHy.js} +1 -1
- package/src/assets/web-panel/assets/{Marketplace-D6kD0bNf.js → Marketplace-Bkfq69UP.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-mTSamCr5.js → McpTools-dtmx0bHO.js} +3 -3
- package/src/assets/web-panel/assets/{Memory-YQBXfLjU.js → Memory-CrRlOuEf.js} +2 -2
- package/src/assets/web-panel/assets/{MobileBridge-D2awuupp.js → MobileBridge-D4ZIZiAH.js} +1 -1
- package/src/assets/web-panel/assets/{MobileProjects-Bl7lZc_-.js → MobileProjects-C90Rw7GE.js} +1 -1
- package/src/assets/web-panel/assets/{Mtc-CBqjLK2Q.js → Mtc-CC6k_uh4.js} +5 -5
- package/src/assets/web-panel/assets/{MtcAudit-C4poRInZ.js → MtcAudit-T_CUIYUy.js} +2 -2
- package/src/assets/web-panel/assets/{Multisig-C_J0zXYZ.js → Multisig-N_e0RRWk.js} +3 -3
- package/src/assets/web-panel/assets/{NLProgramming-Ci43sWOU.js → NLProgramming-Iq3VzEv0.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-DN7A-GFZ.js → Notes-B5sKJUJt.js} +4 -4
- package/src/assets/web-panel/assets/{NotificationSettings-D5jNm71V.js → NotificationSettings-K8UVp8qQ.js} +1 -1
- package/src/assets/web-panel/assets/{OrderTableRenderer-C9UsPOG8.js → OrderTableRenderer-BWNyM-6m.js} +1 -1
- package/src/assets/web-panel/assets/{Organization-BapYMJrP.js → Organization-DMO1NJxI.js} +4 -4
- package/src/assets/web-panel/assets/{Overflow-BwxwjhFw.js → Overflow-BBY6b31Z.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-TObXXOu3.js → P2P-DmsL0y0v.js} +2 -2
- package/src/assets/web-panel/assets/{PdhVaultBrowser-UwJvMbFO.js → PdhVaultBrowser-C65AX_RY.js} +3 -3
- package/src/assets/web-panel/assets/{Permissions-Damnxv-O.js → Permissions-CWcpRtWa.js} +4 -4
- package/src/assets/web-panel/assets/{PersonalDataHub-d_7jlBb-.js → PersonalDataHub--ZNDIdsn.js} +3 -3
- package/src/assets/web-panel/assets/{Pipeline-DA87VjLw.js → Pipeline-DCdj5NGb.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-DzO_UvWn.js → Privacy-BRKu7Q3E.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-CwqECDhs.js → ProjectInit-BJ7ozIAb.js} +2 -2
- package/src/assets/web-panel/assets/{ProjectSettings-CT5YdIl6.js → ProjectSettings-B2cVLiXW.js} +2 -2
- package/src/assets/web-panel/assets/{Projects-D3KdZPCv.js → Projects-Ce9r_W-p.js} +1 -1
- package/src/assets/web-panel/assets/{Providers-BjBIS8kk.js → Providers-BDespvGZ.js} +1 -1
- package/src/assets/web-panel/assets/{QrScannerModal-mMFqiKkI.js → QrScannerModal-BUNO4fDU.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-BwGi9ZU1.js → QuickAsk-D2TUqeBV.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-BY65SR5s.js → Recommend-BNNQPHBH.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-BGsVH_XU.js → RemoteSession-D2t1V_Cm.js} +2 -2
- package/src/assets/web-panel/assets/{Reputation-DpPbxSgI.js → Reputation-DVK5hEqI.js} +1 -1
- package/src/assets/web-panel/assets/{Row-B5YBYoVz.js → Row-BB9RTwmE.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-DvM5jaoh.js → RssFeed-DmEO7liZ.js} +2 -2
- package/src/assets/web-panel/assets/{Search-6RX39EPO.js → Search-UwEYjnDB.js} +1 -1
- package/src/assets/web-panel/assets/{Security-Beal-7cM.js → Security-DebqSsMp.js} +4 -4
- package/src/assets/web-panel/assets/{Services-D6rjVLe-.js → Services-CuuPts3C.js} +2 -2
- package/src/assets/web-panel/assets/{Skeleton-Dur7R7vz.js → Skeleton-DbWpmbgf.js} +1 -1
- package/src/assets/web-panel/assets/{Skills-D1QkGwMk.js → Skills-BaK7SxzT.js} +1 -1
- package/src/assets/web-panel/assets/{Sla-3ObrX8Es.js → Sla-BFHv51Jb.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-DG_KAiH1.js → SpeechSettings-B9b1R6uK.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-BaHq0SJ2.js → SyncSettings-BnO0CN02.js} +2 -2
- package/src/assets/web-panel/assets/{Tasks-BDpAkBAB.js → Tasks-Dy01Vq49.js} +1 -1
- package/src/assets/web-panel/assets/{Templates-tYdoRd-c.js → Templates-BCy2AMHc.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-yGS5zIQ1.js → Tenant-4Tx9y_Y1.js} +1 -1
- package/src/assets/web-panel/assets/{Terminal-B3QbmVFa.js → Terminal-CPOoUH8J.js} +2 -2
- package/src/assets/web-panel/assets/{TimelineRenderer-B_7Pr5dS.js → TimelineRenderer-C85GlJzu.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-DPvpDa53.js → Tokens-_xneFBGF.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-DcSAD0GZ.js → Trigger-BizG4rTr.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-BBzEq-uy.js → Trust-Dh8EIn3n.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-Dssav7-5.js → UkeySign-C5NWoHWQ.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-CPOZf4yi.js → VideoEditing-0YfrySL6.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-BzBVRXEq.js → Wallet-BZVH8Ags.js} +4 -4
- package/src/assets/web-panel/assets/{WebAuthn-DdSGaCCh.js → WebAuthn-kNofa6vm.js} +4 -4
- package/src/assets/web-panel/assets/{WorkflowEditor-CKjBFoSs.js → WorkflowEditor-BNO34_j0.js} +1 -1
- package/src/assets/web-panel/assets/{chat-B9aMGLg0.js → chat-ifQ2FlwD.js} +1 -1
- package/src/assets/web-panel/assets/{colors-GFCMctSV.js → colors-1TL8H6EH.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-BqSDFAYJ.js → compact-item-DBfRjs_T.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-BwUm3Ffp.js → createContext-Bs6V4iBf.js} +1 -1
- package/src/assets/web-panel/assets/devWarning-BHnbnuYL.js +1 -0
- package/src/assets/web-panel/assets/{hasIn-DN1kMJOT.js → hasIn-Bz6LMY_0.js} +1 -1
- package/src/assets/web-panel/assets/{index-B4dI_csl.js → index--WvT2Il3.js} +1 -1
- package/src/assets/web-panel/assets/{index-B7Yu5wwV.js → index-84mi5rsv.js} +1 -1
- package/src/assets/web-panel/assets/{index-DAK28GY8.js → index-B5SJCUZ7.js} +1 -1
- package/src/assets/web-panel/assets/{index-CmEHzOsw.js → index-B6RClMZl.js} +1 -1
- package/src/assets/web-panel/assets/{index-By9GbJhu.js → index-BB1Af7Fv.js} +1 -1
- package/src/assets/web-panel/assets/{index-7W1e9Vi4.js → index-BQL_tldd.js} +1 -1
- package/src/assets/web-panel/assets/{index-BDL2MwxN.js → index-BXJXMaZe.js} +1 -1
- package/src/assets/web-panel/assets/{index-CEMl-Qte.js → index-BhPDhmvN.js} +1 -1
- package/src/assets/web-panel/assets/{index-BCnbC2z7.js → index-BiZ7Nz5-.js} +1 -1
- package/src/assets/web-panel/assets/{index-Cwih67e8.js → index-BoCTDcn6.js} +1 -1
- package/src/assets/web-panel/assets/{index-DI90Wo_P.js → index-BxqC3LiO.js} +1 -1
- package/src/assets/web-panel/assets/{index-THsr_UUJ.js → index-C6c0j-Ki.js} +1 -1
- package/src/assets/web-panel/assets/{index-PKwZkQDC.js → index-C7d6QlfR.js} +1 -1
- package/src/assets/web-panel/assets/{index-rCTtYCGu.js → index-C9QYxq61.js} +1 -1
- package/src/assets/web-panel/assets/{index-Ci0zIpSX.js → index-CBh48_Mh.js} +1 -1
- package/src/assets/web-panel/assets/{index-tMF_deZb.js → index-CNKHoXWI.js} +1 -1
- package/src/assets/web-panel/assets/{index-B9Pe-EyB.js → index-CXVBQ82k.js} +3 -3
- package/src/assets/web-panel/assets/{index-B4MfxM5W.js → index-CXtiLagi.js} +1 -1
- package/src/assets/web-panel/assets/{index-DaFr7XB1.js → index-Cn7EIWmI.js} +1 -1
- package/src/assets/web-panel/assets/index-CsRz9-ZH.js +1 -0
- package/src/assets/web-panel/assets/{index-D8jcp9Rj.js → index-CtB45Hok.js} +1 -1
- package/src/assets/web-panel/assets/{index-Cli0VREv.js → index-Cu_V6ZJH.js} +1 -1
- package/src/assets/web-panel/assets/{index-DO-IKERp.js → index-Cykt9BbN.js} +1 -1
- package/src/assets/web-panel/assets/{index-y7cfh9rP.js → index-DDhy4eCS.js} +1 -1
- package/src/assets/web-panel/assets/{index-CH2wK5dx.js → index-DEPPzM8I.js} +1 -1
- package/src/assets/web-panel/assets/{index-BeycSy7n.js → index-DMVktlxG.js} +1 -1
- package/src/assets/web-panel/assets/{index-BwssFWI1.js → index-DOww5Qny.js} +1 -1
- package/src/assets/web-panel/assets/{index-PJt1Zrx2.js → index-DWPp-d07.js} +1 -1
- package/src/assets/web-panel/assets/index-DnjMFf3m.js +1 -0
- package/src/assets/web-panel/assets/{index-BPGlcDvs.js → index-DvM2xBUA.js} +1 -1
- package/src/assets/web-panel/assets/{index-BL_0ndQc.js → index-EK3XtMxA.js} +1 -1
- package/src/assets/web-panel/assets/{index-DnJt9DaX.js → index-XJIV7HEw.js} +1 -1
- package/src/assets/web-panel/assets/{index-BpiR6uzH.js → index-cNwsev6n.js} +1 -1
- package/src/assets/web-panel/assets/{index-bwb4cg_D.js → index-f_7L9GvP.js} +1 -1
- package/src/assets/web-panel/assets/{index-DbDhKroq.js → index-lUL3bD2z.js} +1 -1
- package/src/assets/web-panel/assets/{index-DvvJWwT8.js → index-pOUFfRdN.js} +1 -1
- package/src/assets/web-panel/assets/{index-BBMW8bQO.js → index-rGhS02f8.js} +1 -1
- package/src/assets/web-panel/assets/{index-CRikhGgx.js → index-vHtnQsnV.js} +1 -1
- package/src/assets/web-panel/assets/{index-BHUxz4dy.js → index-vb1XIxEB.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-B6e5CZ5p.js → initDefaultProps-DpRIjwTt.js} +1 -1
- package/src/assets/web-panel/assets/{motion-riMM1KfJ.js → motion-CG4_9o-Z.js} +1 -1
- package/src/assets/web-panel/assets/{move-C1NSDMjc.js → move-Dku1fXtf.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-Bibuny9B.js → mtc-parser-BvAVeX-3.js} +1 -1
- package/src/assets/web-panel/assets/{omit-Cmf6FoRn.js → omit-DFu0x78D.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-BSsYBUCY.js → pickAttrs-CmI-FNcK.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-gSB7-GAS.js → placementArrow-CGERYewB.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-qaqttvKa.js → responsiveObserve-D7G8bF5J.js} +1 -1
- package/src/assets/web-panel/assets/{slide-RX2gxl3k.js → slide-B2sXwWXy.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-DEJmkhqw.js → statusUtils-DI5yh0n3.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-CIWmJ78O.js → styleChecker-deGJ5dp_.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-D-UPSQBE.js → useFlexGapSupport-OqHBXEmi.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-9QFtqADc.js → useFs-Dqgx0Qv_.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-DM6kyift.js → usePersonalDataHub-Be-lveh2.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-C-q6FNSJ.js → vnode-CFxB876W.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-D4WJY2m8.js → zoom-BFOYrl4e.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 +11 -7
- package/src/commands/background-session.js +31 -3
- package/src/commands/chat.js +5 -1
- package/src/commands/eval.js +86 -28
- package/src/commands/llm.js +104 -1
- package/src/commands/plugin.js +130 -1
- package/src/commands/sandbox.js +121 -2
- package/src/commands/serve.js +11 -2
- package/src/commands/skill.js +29 -0
- package/src/data/changelog.json +26 -0
- package/src/gateways/ws/session-protocol.js +13 -0
- package/src/gateways/ws/ws-agent-handler.js +17 -0
- package/src/gateways/ws/ws-server.js +3 -0
- package/src/gateways/ws/ws-session-state.js +131 -0
- package/src/generated/cc-agent-protocol.schema.json +4 -0
- package/src/lazy-dispatch.js +8 -1
- package/src/lib/agent-sandbox.js +337 -53
- package/src/lib/app-server/cli-agent-kernel-adapter.js +28 -0
- package/src/lib/app-server/server.js +93 -0
- package/src/lib/background-agent-keeper-client.js +2 -0
- package/src/lib/background-agent-keeper-protocol.js +7 -0
- package/src/lib/background-agent-supervisor.js +194 -47
- package/src/lib/codex-app-server-adapter.js +81 -27
- package/src/lib/context-memory-kernel/durable-memory-port.js +31 -8
- package/src/lib/context-memory-kernel/provider-context.js +53 -19
- package/src/lib/deferred-question-context.js +122 -0
- package/src/lib/eval/evidence.js +202 -64
- package/src/lib/eval/plugin-suite.js +917 -0
- package/src/lib/eval/runner.js +10 -3
- package/src/lib/evolution/agent-evolution-ingress.js +60 -8
- package/src/lib/evolution/agent-evolution-runtime-composition.js +236 -1
- package/src/lib/evolution/agent-model-projection.js +97 -1
- package/src/lib/evolution/evidence-backed-wiki-maintainer.js +154 -1
- package/src/lib/evolution/evolution-artifact-ports.js +6 -0
- package/src/lib/evolution/evolution-deployment-loader.js +188 -10
- package/src/lib/evolution/evolution-eval-gate.js +8 -0
- package/src/lib/evolution/evolution-eval-runtime-composition.js +255 -0
- package/src/lib/evolution/evolution-evidence-artifact-adapter.js +58 -2
- package/src/lib/evolution/evolution-ledger-file-backend.js +23 -2
- package/src/lib/evolution/evolution-ledger-manifest-chain.js +223 -7
- package/src/lib/evolution/evolution-ledger-v2-journal.js +525 -0
- package/src/lib/evolution/evolution-ledger-v2-manifest-backend.js +46 -2
- package/src/lib/evolution/evolution-ledger.js +57 -1
- package/src/lib/evolution/evolution-run-ledger-adapter.js +93 -0
- package/src/lib/evolution/evolution-run-wiki-evidence-resolver.js +259 -0
- package/src/lib/evolution/governed-hub-llm.js +238 -5
- package/src/lib/evolution/governed-hub-resolver.js +82 -4
- package/src/lib/evolution/governed-hub-skill.js +11 -5
- package/src/lib/evolution/governed-skill-synthesis-provider-chat.js +10 -1
- package/src/lib/evolution/skill-runtime-revalidation-ledger-adapter.js +254 -0
- package/src/lib/evolution/skill-runtime-revalidation.js +530 -0
- package/src/lib/evolution/skill-target-matrix-eval.js +4 -4
- package/src/lib/evolution/wiki-evidence-commit-guard.js +366 -0
- package/src/lib/evolution/wiki-informed-skill-proposer.js +13 -1
- package/src/lib/goal-context.js +14 -5
- package/src/lib/interaction-adapter.js +166 -1
- package/src/lib/model-capabilities.js +271 -0
- package/src/lib/model-context-catalog.js +105 -0
- package/src/lib/model-context-window.js +4 -49
- package/src/lib/openai-responses.js +428 -0
- package/src/lib/plugin-runtime/scopes.js +7 -1
- package/src/lib/remote-read-loop-guard.js +2 -2
- package/src/lib/runtime-usage-ledger.js +16 -0
- package/src/lib/skill-loader.js +12 -0
- package/src/lib/with-file-lock.js +3 -1
- package/src/repl/agent-repl.js +6 -2
- package/src/runtime/agent-core.js +357 -44
- package/src/runtime/agent-runtime.js +7 -0
- package/src/runtime/coding-agent-contract-shared.cjs +13 -1
- package/src/runtime/headless-runner.js +4 -1
- package/src/runtime/headless-stream.js +133 -44
- package/src/runtime/runtime-factory.js +26 -2
- package/src/workers/background-agent-keeper.js +23 -13
- package/src/workers/background-agent-worker.js +27 -13
- package/src/assets/web-panel/assets/EvolutionSettings-_QnjPFZJ.js +0 -1
- package/src/assets/web-panel/assets/devWarning-LxtRBsCm.js +0 -1
- package/src/assets/web-panel/assets/index-36hxBH-o.js +0 -1
- package/src/assets/web-panel/assets/index-C0b78zWZ.js +0 -1
|
@@ -42,6 +42,10 @@ import { createHash, randomUUID } from "node:crypto";
|
|
|
42
42
|
import skillInvocationReceipt from "@chainlesschain/session-core/skill-invocation-receipt";
|
|
43
43
|
import { isProxy } from "node:util/types";
|
|
44
44
|
import { captureAgentEvolutionIngress } from "../lib/evolution/agent-evolution-ingress.js";
|
|
45
|
+
import {
|
|
46
|
+
assertSkillRuntimeAdmission,
|
|
47
|
+
captureSkillRuntimeDependencies,
|
|
48
|
+
} from "../lib/evolution/skill-runtime-revalidation.js";
|
|
45
49
|
import { isEvolutionIngressFailure } from "../lib/model-failure-policy.js";
|
|
46
50
|
|
|
47
51
|
const { startSkillInvocation, settleSkillInvocation } = skillInvocationReceipt;
|
|
@@ -50,7 +54,17 @@ import sharedShellPolicy from "./coding-agent-shell-policy.cjs";
|
|
|
50
54
|
import sharedPermissionRules from "../lib/permission-rules.cjs";
|
|
51
55
|
import sharedSettingsHooks from "../lib/settings-hooks.cjs";
|
|
52
56
|
import sharedHookEvents from "../lib/settings-hook-events.js";
|
|
53
|
-
import {
|
|
57
|
+
import {
|
|
58
|
+
resolveAgentOutputBudget,
|
|
59
|
+
resolveModelCapabilityProfile,
|
|
60
|
+
} from "../lib/model-capabilities.js";
|
|
61
|
+
import {
|
|
62
|
+
createOpenAIResponsesBody,
|
|
63
|
+
createOpenAIResponsesStreamState,
|
|
64
|
+
finalizeOpenAIResponsesStream,
|
|
65
|
+
normalizeOpenAIResponsesResponse,
|
|
66
|
+
reduceOpenAIResponsesStreamLine,
|
|
67
|
+
} from "../lib/openai-responses.js";
|
|
54
68
|
import { applyCredentialProxy } from "../lib/credential-proxy.js";
|
|
55
69
|
import {
|
|
56
70
|
commitShellApprovalSideEffects,
|
|
@@ -1261,7 +1275,9 @@ export function buildSystemPrompt(cwd, opts = {}) {
|
|
|
1261
1275
|
|
|
1262
1276
|
// Append auto-activated persona skills
|
|
1263
1277
|
try {
|
|
1264
|
-
const loader =
|
|
1278
|
+
const loader =
|
|
1279
|
+
opts.skillLoader ||
|
|
1280
|
+
new CLISkillLoader(captureSkillRuntimeDependencies(opts));
|
|
1265
1281
|
const personaSkills = loader.getAutoActivatedPersonas({
|
|
1266
1282
|
sessionId: opts.sessionId,
|
|
1267
1283
|
turnId: opts.turnId,
|
|
@@ -2604,7 +2620,11 @@ export async function executeTool(name, args, context = {}) {
|
|
|
2604
2620
|
}
|
|
2605
2621
|
}
|
|
2606
2622
|
const hookDb = context.hookDb || null;
|
|
2607
|
-
const skillLoader =
|
|
2623
|
+
const skillLoader =
|
|
2624
|
+
context.skillLoader ||
|
|
2625
|
+
(context.skillRuntimeAdmission || context.skillRuntimeAdmissionRequired
|
|
2626
|
+
? new CLISkillLoader(captureSkillRuntimeDependencies(context))
|
|
2627
|
+
: _defaultSkillLoader);
|
|
2608
2628
|
// Keep the authority-bearing workspace root distinct from the command's
|
|
2609
2629
|
// requested cwd. A command may run in a nested directory, but Plugin policy
|
|
2610
2630
|
// discovery and strong-sandbox issuance must remain anchored to the host
|
|
@@ -3604,6 +3624,8 @@ export async function executeTool(name, args, context = {}) {
|
|
|
3604
3624
|
skillAllowlist: context.skillAllowlist ?? null,
|
|
3605
3625
|
skillOutcomeIndex: context.skillOutcomeIndex,
|
|
3606
3626
|
skillVectorAuthority: context.skillVectorAuthority,
|
|
3627
|
+
skillRuntimeAdmission: context.skillRuntimeAdmission,
|
|
3628
|
+
skillRuntimeAdmissionRequired: context.skillRuntimeAdmissionRequired,
|
|
3607
3629
|
skillRetrievalRevocationReader: context.skillRetrievalRevocationReader,
|
|
3608
3630
|
cwd,
|
|
3609
3631
|
parentMessages: context.parentMessages,
|
|
@@ -5157,6 +5179,8 @@ async function executeToolInner(
|
|
|
5157
5179
|
skillAllowlist = null,
|
|
5158
5180
|
skillOutcomeIndex,
|
|
5159
5181
|
skillVectorAuthority,
|
|
5182
|
+
skillRuntimeAdmission,
|
|
5183
|
+
skillRuntimeAdmissionRequired = false,
|
|
5160
5184
|
skillRetrievalRevocationReader,
|
|
5161
5185
|
cwd,
|
|
5162
5186
|
parentMessages,
|
|
@@ -6652,6 +6676,7 @@ async function executeToolInner(
|
|
|
6652
6676
|
}
|
|
6653
6677
|
const common = {
|
|
6654
6678
|
sandbox: sandboxSummary(shellSandbox),
|
|
6679
|
+
sandboxCapabilities: result.sandboxCapabilities || null,
|
|
6655
6680
|
shellCommandPolicy: shellPolicy,
|
|
6656
6681
|
approval: approvalOutcome,
|
|
6657
6682
|
policyTrace: ["shell-policy", "approval", "sandbox"],
|
|
@@ -6907,6 +6932,7 @@ async function executeToolInner(
|
|
|
6907
6932
|
encoding: "utf8",
|
|
6908
6933
|
timeout: 60000,
|
|
6909
6934
|
maxBuffer: 1024 * 1024,
|
|
6935
|
+
shell: false,
|
|
6910
6936
|
windowsHide: true,
|
|
6911
6937
|
origin: "agent-core:git-command",
|
|
6912
6938
|
policy: "allow",
|
|
@@ -7035,6 +7061,8 @@ async function executeToolInner(
|
|
|
7035
7061
|
sessionId,
|
|
7036
7062
|
llmOptions,
|
|
7037
7063
|
evolutionIngress,
|
|
7064
|
+
skillRuntimeAdmission,
|
|
7065
|
+
skillRuntimeAdmissionRequired,
|
|
7038
7066
|
workflowEffectId,
|
|
7039
7067
|
workflowChildEffectId,
|
|
7040
7068
|
workflowChildSequence,
|
|
@@ -7241,6 +7269,62 @@ async function executeToolInner(
|
|
|
7241
7269
|
}
|
|
7242
7270
|
|
|
7243
7271
|
case "ask_user_question": {
|
|
7272
|
+
const questionMode = args.mode === "deferred" ? "deferred" : "blocking";
|
|
7273
|
+
const questionPurpose = [
|
|
7274
|
+
"decision",
|
|
7275
|
+
"authorization",
|
|
7276
|
+
"preference",
|
|
7277
|
+
"information",
|
|
7278
|
+
].includes(args.purpose)
|
|
7279
|
+
? args.purpose
|
|
7280
|
+
: "decision";
|
|
7281
|
+
if (questionMode === "deferred") {
|
|
7282
|
+
if (!["preference", "information"].includes(questionPurpose)) {
|
|
7283
|
+
return attachDescriptor({
|
|
7284
|
+
error: "deferred_question_requires_non_authoritative_purpose",
|
|
7285
|
+
hint: "Authorization and branch-dependent decisions must use mode=blocking. Deferred answers are informational and cannot grant permission.",
|
|
7286
|
+
});
|
|
7287
|
+
}
|
|
7288
|
+
if (
|
|
7289
|
+
!interaction ||
|
|
7290
|
+
typeof interaction.deferUserQuestion !== "function"
|
|
7291
|
+
) {
|
|
7292
|
+
return attachDescriptor({
|
|
7293
|
+
error: "deferred_questions_not_supported",
|
|
7294
|
+
hint: "This host cannot receive answers out of band. Use mode=blocking or continue autonomously.",
|
|
7295
|
+
});
|
|
7296
|
+
}
|
|
7297
|
+
try {
|
|
7298
|
+
const receipt = await interaction.deferUserQuestion({
|
|
7299
|
+
question: args.question,
|
|
7300
|
+
options: Array.isArray(args.options) ? args.options : null,
|
|
7301
|
+
multiSelect: args.multiSelect === true,
|
|
7302
|
+
timeoutMs:
|
|
7303
|
+
typeof args.timeoutMs === "number" ? args.timeoutMs : 60000,
|
|
7304
|
+
defaultValue: args.defaultValue,
|
|
7305
|
+
onTimeout: args.onTimeout || "error",
|
|
7306
|
+
onReject: args.onReject || "error",
|
|
7307
|
+
purpose: questionPurpose,
|
|
7308
|
+
sessionId,
|
|
7309
|
+
turnId,
|
|
7310
|
+
toolUseId: toolCallId,
|
|
7311
|
+
});
|
|
7312
|
+
return attachDescriptor({
|
|
7313
|
+
questionId: receipt.questionId || receipt.id,
|
|
7314
|
+
status: "pending",
|
|
7315
|
+
mode: "deferred",
|
|
7316
|
+
purpose: questionPurpose,
|
|
7317
|
+
authorization: false,
|
|
7318
|
+
...(receipt.binding ? { binding: receipt.binding } : {}),
|
|
7319
|
+
instructions:
|
|
7320
|
+
"Continue only work independent of this answer. A later answer is information, never authorization; use a blocking question for any dependent decision.",
|
|
7321
|
+
});
|
|
7322
|
+
} catch (err) {
|
|
7323
|
+
return attachDescriptor({
|
|
7324
|
+
error: `ask_user_question deferred registration failed: ${err.message}`,
|
|
7325
|
+
});
|
|
7326
|
+
}
|
|
7327
|
+
}
|
|
7244
7328
|
if (!interaction || typeof interaction.askUser !== "function") {
|
|
7245
7329
|
return attachDescriptor({
|
|
7246
7330
|
error: "user_not_reachable",
|
|
@@ -7984,11 +8068,36 @@ async function executeToolInner(
|
|
|
7984
8068
|
signal,
|
|
7985
8069
|
});
|
|
7986
8070
|
const skillExecutionSignal = skillExecutionLease?.signal || signal;
|
|
8071
|
+
const selectedSkillName = match.id || match.dirName;
|
|
8072
|
+
const runtimeAdmissionContext = {
|
|
8073
|
+
llmOptions,
|
|
8074
|
+
effectiveAllowedToolNames: [
|
|
8075
|
+
"read_file",
|
|
8076
|
+
"search_files",
|
|
8077
|
+
"list_dir",
|
|
8078
|
+
].filter(
|
|
8079
|
+
(tool) =>
|
|
8080
|
+
!Array.isArray(effectiveAllowedToolNames) ||
|
|
8081
|
+
effectiveAllowedToolNames.includes(tool),
|
|
8082
|
+
),
|
|
8083
|
+
};
|
|
8084
|
+
const assertRuntime = () =>
|
|
8085
|
+
assertSkillRuntimeAdmission({
|
|
8086
|
+
skill: match,
|
|
8087
|
+
loader: skillLoader,
|
|
8088
|
+
admission: skillRuntimeAdmission,
|
|
8089
|
+
required: skillRuntimeAdmissionRequired,
|
|
8090
|
+
expectedSkillName: selectedSkillName,
|
|
8091
|
+
context: runtimeAdmissionContext,
|
|
8092
|
+
});
|
|
8093
|
+
let runtimeEligibility;
|
|
7987
8094
|
try {
|
|
7988
8095
|
skillExecutionLease?.assertActive?.();
|
|
8096
|
+
runtimeEligibility = assertRuntime();
|
|
7989
8097
|
if (typeof skillLoader.materializeSkillForExecution === "function") {
|
|
7990
8098
|
match = await raceWithAbort(
|
|
7991
8099
|
skillLoader.materializeSkillForExecution(match, {
|
|
8100
|
+
...runtimeAdmissionContext,
|
|
7992
8101
|
sessionId,
|
|
7993
8102
|
turnId,
|
|
7994
8103
|
loadedBecause: "run_skill",
|
|
@@ -8000,6 +8109,7 @@ async function executeToolInner(
|
|
|
8000
8109
|
);
|
|
8001
8110
|
} else if (typeof skillLoader.materializeSkill === "function") {
|
|
8002
8111
|
match = skillLoader.materializeSkill(match, {
|
|
8112
|
+
...runtimeAdmissionContext,
|
|
8003
8113
|
sessionId,
|
|
8004
8114
|
turnId,
|
|
8005
8115
|
loadedBecause: "run_skill",
|
|
@@ -8008,6 +8118,7 @@ async function executeToolInner(
|
|
|
8008
8118
|
});
|
|
8009
8119
|
}
|
|
8010
8120
|
skillExecutionLease?.assertActive?.();
|
|
8121
|
+
runtimeEligibility = assertRuntime();
|
|
8011
8122
|
throwIfAborted(
|
|
8012
8123
|
skillExecutionSignal,
|
|
8013
8124
|
"run_skill interrupted during materialization",
|
|
@@ -8196,6 +8307,7 @@ async function executeToolInner(
|
|
|
8196
8307
|
let subCtx;
|
|
8197
8308
|
try {
|
|
8198
8309
|
skillExecutionLease?.assertActive?.();
|
|
8310
|
+
runtimeEligibility = assertRuntime();
|
|
8199
8311
|
subCtx = SubAgentContext.create({
|
|
8200
8312
|
role: `skill-${args.skill_name}`,
|
|
8201
8313
|
task:
|
|
@@ -8268,11 +8380,13 @@ async function executeToolInner(
|
|
|
8268
8380
|
}
|
|
8269
8381
|
skillSubRef = subCtx;
|
|
8270
8382
|
try {
|
|
8383
|
+
runtimeEligibility = assertRuntime();
|
|
8271
8384
|
const result = await raceWithAbort(
|
|
8272
8385
|
subCtx.run(args.input),
|
|
8273
8386
|
skillExecutionSignal,
|
|
8274
8387
|
"run_skill interrupted while the isolated child was running",
|
|
8275
8388
|
);
|
|
8389
|
+
runtimeEligibility = assertRuntime();
|
|
8276
8390
|
skillExecutionLease?.assertActive?.();
|
|
8277
8391
|
throwIfAborted(
|
|
8278
8392
|
skillExecutionSignal,
|
|
@@ -8302,6 +8416,7 @@ async function executeToolInner(
|
|
|
8302
8416
|
success: true,
|
|
8303
8417
|
isolated: true,
|
|
8304
8418
|
skill: args.skill_name,
|
|
8419
|
+
runtimeEligibility,
|
|
8305
8420
|
invocationReceipt: settleInvocation("completed", result),
|
|
8306
8421
|
summary: result.summary,
|
|
8307
8422
|
toolsUsed: result.toolsUsed,
|
|
@@ -10212,6 +10327,13 @@ async function _executeSpawnSubAgent(args, ctx) {
|
|
|
10212
10327
|
const parentLlm = ctx.llmOptions || {};
|
|
10213
10328
|
const subLlmOptions = {
|
|
10214
10329
|
...parentLlm,
|
|
10330
|
+
...(ctx.skillRuntimeAdmission
|
|
10331
|
+
? { skillRuntimeAdmission: ctx.skillRuntimeAdmission }
|
|
10332
|
+
: {}),
|
|
10333
|
+
...(ctx.skillRuntimeAdmissionRequired
|
|
10334
|
+
? { skillRuntimeAdmissionRequired: true }
|
|
10335
|
+
: {}),
|
|
10336
|
+
...(ctx.skillLoader ? { skillLoader: ctx.skillLoader } : {}),
|
|
10215
10337
|
...(ctx.evolutionIngress != null
|
|
10216
10338
|
? { evolutionIngress: ctx.evolutionIngress }
|
|
10217
10339
|
: {}),
|
|
@@ -10943,13 +11065,6 @@ export async function chatWithTools(rawMessages, options) {
|
|
|
10943
11065
|
options.evolutionIngress == null
|
|
10944
11066
|
? null
|
|
10945
11067
|
: captureAgentEvolutionIngress(options.evolutionIngress);
|
|
10946
|
-
if (evolutionIngress === null) {
|
|
10947
|
-
const error = new Error(
|
|
10948
|
-
"Agent model egress requires an authenticated evolution ingress",
|
|
10949
|
-
);
|
|
10950
|
-
error.code = "CC_AGENT_EVOLUTION_INGRESS_FAILED";
|
|
10951
|
-
throw error;
|
|
10952
|
-
}
|
|
10953
11068
|
const {
|
|
10954
11069
|
provider,
|
|
10955
11070
|
model,
|
|
@@ -10998,12 +11113,14 @@ export async function chatWithTools(rawMessages, options) {
|
|
|
10998
11113
|
})
|
|
10999
11114
|
: providerMessages;
|
|
11000
11115
|
|
|
11001
|
-
|
|
11002
|
-
|
|
11003
|
-
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11116
|
+
if (evolutionIngress !== null) {
|
|
11117
|
+
const projected = await evolutionIngress.prepareModelRequest({
|
|
11118
|
+
messages,
|
|
11119
|
+
tools,
|
|
11120
|
+
});
|
|
11121
|
+
messages = projected.messages;
|
|
11122
|
+
tools = projected.tools;
|
|
11123
|
+
}
|
|
11007
11124
|
|
|
11008
11125
|
throwIfAborted(signal);
|
|
11009
11126
|
|
|
@@ -11119,21 +11236,20 @@ export async function chatWithTools(rawMessages, options) {
|
|
|
11119
11236
|
};
|
|
11120
11237
|
}
|
|
11121
11238
|
|
|
11122
|
-
// Model-aware max_tokens (Opus → 16384, Haiku → 4096, else 8192)
|
|
11123
|
-
//
|
|
11124
|
-
// default is never forwarded (400s on Opus 4.7/4.8).
|
|
11239
|
+
// Model-aware max_tokens (Opus → 16384, Haiku → 4096, else 8192).
|
|
11240
|
+
// The shared budget resolver reads only provider maxTokens; its unrelated
|
|
11241
|
+
// temperature default is never forwarded (400s on Opus 4.7/4.8).
|
|
11125
11242
|
// Fallback to the CURRENT Sonnet, not a retired snapshot:
|
|
11126
11243
|
// claude-sonnet-4-20250514 was retired 2026-06-15 and would 404 here.
|
|
11127
11244
|
const effModel = model || "claude-sonnet-4-6";
|
|
11128
|
-
const
|
|
11129
|
-
"anthropic",
|
|
11130
|
-
effModel,
|
|
11131
|
-
|
|
11245
|
+
const anthropicOutputBudget = resolveAgentOutputBudget({
|
|
11246
|
+
provider: "anthropic",
|
|
11247
|
+
model: effModel,
|
|
11248
|
+
maxOutputTokens: options.maxOutputTokens,
|
|
11249
|
+
});
|
|
11132
11250
|
const body = {
|
|
11133
11251
|
model: effModel,
|
|
11134
|
-
max_tokens:
|
|
11135
|
-
? Math.min(anthropicMaxTokens || 8192, options.maxOutputTokens)
|
|
11136
|
-
: anthropicMaxTokens || 8192,
|
|
11252
|
+
max_tokens: anthropicOutputBudget.requestMaxOutputTokens,
|
|
11137
11253
|
// Convert cc's internal OpenAI-shaped history (role:"tool" results,
|
|
11138
11254
|
// assistant tool_calls[]) into Anthropic content blocks. Without this,
|
|
11139
11255
|
// multi-turn tool use 400s on turn 2 (Anthropic rejects role:"tool" and
|
|
@@ -11301,6 +11417,85 @@ export async function chatWithTools(rawMessages, options) {
|
|
|
11301
11417
|
gemini: "gemini-2.0-flash",
|
|
11302
11418
|
volcengine: "deepseek-v4-flash-ga-260731",
|
|
11303
11419
|
};
|
|
11420
|
+
const effectiveModel = model || defaultModels[provider] || "gpt-4o-mini";
|
|
11421
|
+
const modelProfile = resolveModelCapabilityProfile({
|
|
11422
|
+
provider,
|
|
11423
|
+
model: effectiveModel,
|
|
11424
|
+
baseUrl: url,
|
|
11425
|
+
maxOutputTokens: options.maxOutputTokens,
|
|
11426
|
+
});
|
|
11427
|
+
const useOpenAIResponses =
|
|
11428
|
+
provider === "openai" &&
|
|
11429
|
+
modelProfile.runtimeProtocol === "openai-responses";
|
|
11430
|
+
|
|
11431
|
+
if (useOpenAIResponses) {
|
|
11432
|
+
const responseBody = createOpenAIResponsesBody({
|
|
11433
|
+
model: effectiveModel,
|
|
11434
|
+
messages,
|
|
11435
|
+
tools,
|
|
11436
|
+
maxOutputTokens: options.maxOutputTokens,
|
|
11437
|
+
reasoning: _openAIResponsesReasoningParams(options),
|
|
11438
|
+
stream: typeof options.onToken === "function",
|
|
11439
|
+
});
|
|
11440
|
+
if (typeof options.onToken === "function") {
|
|
11441
|
+
return await _retryStreamingChat(
|
|
11442
|
+
(attempt = 0) =>
|
|
11443
|
+
_chatOpenAIResponsesStreaming(
|
|
11444
|
+
`${url}/responses`,
|
|
11445
|
+
responseBody,
|
|
11446
|
+
key,
|
|
11447
|
+
options.onToken,
|
|
11448
|
+
signal,
|
|
11449
|
+
options.onThinking,
|
|
11450
|
+
options.onStall,
|
|
11451
|
+
options.streamStallMs,
|
|
11452
|
+
options.streamStallTimeoutMs,
|
|
11453
|
+
supportsOpenAIRequestIdentity
|
|
11454
|
+
? _physicalProviderRequestId(providerRequestId, attempt)
|
|
11455
|
+
: null,
|
|
11456
|
+
),
|
|
11457
|
+
{
|
|
11458
|
+
signal,
|
|
11459
|
+
retries: options.workflowEffectId ? 0 : undefined,
|
|
11460
|
+
strictRetryObserver: options.strictUsageTelemetry === true,
|
|
11461
|
+
...(typeof options.onStreamRetry === "function"
|
|
11462
|
+
? {
|
|
11463
|
+
onRetry: (attempt, error, telemetry) =>
|
|
11464
|
+
options.onStreamRetry(attempt, error, {
|
|
11465
|
+
...telemetry,
|
|
11466
|
+
provider,
|
|
11467
|
+
model: effectiveModel,
|
|
11468
|
+
}),
|
|
11469
|
+
}
|
|
11470
|
+
: {}),
|
|
11471
|
+
},
|
|
11472
|
+
);
|
|
11473
|
+
}
|
|
11474
|
+
|
|
11475
|
+
const response = await fetch(`${url}/responses`, {
|
|
11476
|
+
method: "POST",
|
|
11477
|
+
headers: {
|
|
11478
|
+
"Content-Type": "application/json",
|
|
11479
|
+
Authorization: `Bearer ${key}`,
|
|
11480
|
+
...(supportsOpenAIRequestIdentity && providerRequestId
|
|
11481
|
+
? { "X-Client-Request-Id": providerRequestId }
|
|
11482
|
+
: {}),
|
|
11483
|
+
},
|
|
11484
|
+
signal,
|
|
11485
|
+
body: JSON.stringify(responseBody),
|
|
11486
|
+
});
|
|
11487
|
+
if (!response.ok) {
|
|
11488
|
+
throw new Error(await formatProviderResponseError(provider, response));
|
|
11489
|
+
}
|
|
11490
|
+
const data = await response.json();
|
|
11491
|
+
const out = normalizeOpenAIResponsesResponse(data);
|
|
11492
|
+
delete out.responseId;
|
|
11493
|
+
const providerReceipt = supportsOpenAIRequestIdentity
|
|
11494
|
+
? _openAIProviderRequestReceipt(response, data, providerRequestId)
|
|
11495
|
+
: null;
|
|
11496
|
+
if (providerReceipt) out.providerReceipt = providerReceipt;
|
|
11497
|
+
return out;
|
|
11498
|
+
}
|
|
11304
11499
|
|
|
11305
11500
|
// Real token streaming (--include-partial-messages) for every OpenAI-compatible
|
|
11306
11501
|
// provider (openai / deepseek / dashscope / mistral / gemini / volcengine):
|
|
@@ -11312,7 +11507,7 @@ export async function chatWithTools(rawMessages, options) {
|
|
|
11312
11507
|
_chatOpenAIStreaming(
|
|
11313
11508
|
`${url}/chat/completions`,
|
|
11314
11509
|
{
|
|
11315
|
-
model:
|
|
11510
|
+
model: effectiveModel,
|
|
11316
11511
|
messages,
|
|
11317
11512
|
tools,
|
|
11318
11513
|
stream: true,
|
|
@@ -11342,7 +11537,7 @@ export async function chatWithTools(rawMessages, options) {
|
|
|
11342
11537
|
options.onStreamRetry(attempt, error, {
|
|
11343
11538
|
...telemetry,
|
|
11344
11539
|
provider,
|
|
11345
|
-
model:
|
|
11540
|
+
model: effectiveModel,
|
|
11346
11541
|
}),
|
|
11347
11542
|
}
|
|
11348
11543
|
: {}),
|
|
@@ -11361,7 +11556,7 @@ export async function chatWithTools(rawMessages, options) {
|
|
|
11361
11556
|
},
|
|
11362
11557
|
signal,
|
|
11363
11558
|
body: JSON.stringify({
|
|
11364
|
-
model:
|
|
11559
|
+
model: effectiveModel,
|
|
11365
11560
|
messages,
|
|
11366
11561
|
tools,
|
|
11367
11562
|
...(options.maxOutputTokens
|
|
@@ -12276,6 +12471,83 @@ async function _chatOpenAIStreaming(
|
|
|
12276
12471
|
return out;
|
|
12277
12472
|
}
|
|
12278
12473
|
|
|
12474
|
+
async function _chatOpenAIResponsesStreaming(
|
|
12475
|
+
apiUrl,
|
|
12476
|
+
body,
|
|
12477
|
+
apiKey,
|
|
12478
|
+
onToken,
|
|
12479
|
+
signal,
|
|
12480
|
+
onThinking,
|
|
12481
|
+
onStall,
|
|
12482
|
+
stallMs,
|
|
12483
|
+
stallTimeoutMs,
|
|
12484
|
+
providerRequestId = null,
|
|
12485
|
+
) {
|
|
12486
|
+
const response = await fetch(apiUrl, {
|
|
12487
|
+
method: "POST",
|
|
12488
|
+
headers: {
|
|
12489
|
+
"Content-Type": "application/json",
|
|
12490
|
+
Authorization: `Bearer ${apiKey}`,
|
|
12491
|
+
...(providerRequestId
|
|
12492
|
+
? { "X-Client-Request-Id": providerRequestId }
|
|
12493
|
+
: {}),
|
|
12494
|
+
},
|
|
12495
|
+
signal,
|
|
12496
|
+
body: JSON.stringify(body),
|
|
12497
|
+
});
|
|
12498
|
+
if (!response.ok) {
|
|
12499
|
+
throw new Error(await formatProviderResponseError("openai", response));
|
|
12500
|
+
}
|
|
12501
|
+
const state = createOpenAIResponsesStreamState();
|
|
12502
|
+
const ui = _streamUiCallbacks(onToken, onThinking);
|
|
12503
|
+
const reader = response.body.getReader();
|
|
12504
|
+
const decoder = new TextDecoder();
|
|
12505
|
+
let buf = "";
|
|
12506
|
+
try {
|
|
12507
|
+
for await (const value of _iterateStreamWithStall(reader, {
|
|
12508
|
+
onStall,
|
|
12509
|
+
stallMs,
|
|
12510
|
+
stallTimeoutMs,
|
|
12511
|
+
})) {
|
|
12512
|
+
buf += decoder.decode(value, { stream: true });
|
|
12513
|
+
const lines = buf.split("\n");
|
|
12514
|
+
buf = lines.pop() || "";
|
|
12515
|
+
for (const line of lines) {
|
|
12516
|
+
reduceOpenAIResponsesStreamLine(state, line, ui.onToken, ui.onThinking);
|
|
12517
|
+
await ui.settle();
|
|
12518
|
+
}
|
|
12519
|
+
}
|
|
12520
|
+
if (buf.trim()) {
|
|
12521
|
+
reduceOpenAIResponsesStreamLine(state, buf, ui.onToken, ui.onThinking);
|
|
12522
|
+
await ui.settle();
|
|
12523
|
+
}
|
|
12524
|
+
} catch (error) {
|
|
12525
|
+
if (_streamErrorDisposition(error, signal, state.text) === "rethrow") {
|
|
12526
|
+
throw error;
|
|
12527
|
+
}
|
|
12528
|
+
const out = _finalizeTruncatedStream(finalizeOpenAIResponsesStream, state);
|
|
12529
|
+
const responseId = out.responseId || state.responseId;
|
|
12530
|
+
delete out.responseId;
|
|
12531
|
+
const providerReceipt = _openAIProviderRequestReceipt(
|
|
12532
|
+
response,
|
|
12533
|
+
{ id: responseId },
|
|
12534
|
+
providerRequestId,
|
|
12535
|
+
);
|
|
12536
|
+
if (providerReceipt) out.providerReceipt = providerReceipt;
|
|
12537
|
+
return out;
|
|
12538
|
+
}
|
|
12539
|
+
const out = finalizeOpenAIResponsesStream(state);
|
|
12540
|
+
const responseId = out.responseId || state.responseId;
|
|
12541
|
+
delete out.responseId;
|
|
12542
|
+
const providerReceipt = _openAIProviderRequestReceipt(
|
|
12543
|
+
response,
|
|
12544
|
+
{ id: responseId },
|
|
12545
|
+
providerRequestId,
|
|
12546
|
+
);
|
|
12547
|
+
if (providerReceipt) out.providerReceipt = providerReceipt;
|
|
12548
|
+
return out;
|
|
12549
|
+
}
|
|
12550
|
+
|
|
12279
12551
|
/**
|
|
12280
12552
|
* Convert cc's internal OpenAI-shaped messages into Anthropic content-block
|
|
12281
12553
|
* messages. Internal shape: {role:"user"|"assistant"|"tool", content,
|
|
@@ -12376,6 +12648,31 @@ function _intensityToEffort(want) {
|
|
|
12376
12648
|
}
|
|
12377
12649
|
}
|
|
12378
12650
|
|
|
12651
|
+
/** Build an opt-in Responses reasoning request without changing default cost. */
|
|
12652
|
+
export function _openAIResponsesReasoningParams(options = {}) {
|
|
12653
|
+
const want = options?.thinking;
|
|
12654
|
+
if (!want || want === "off" || want === "none") return null;
|
|
12655
|
+
const allowed = new Set([
|
|
12656
|
+
"none",
|
|
12657
|
+
"minimal",
|
|
12658
|
+
"low",
|
|
12659
|
+
"medium",
|
|
12660
|
+
"high",
|
|
12661
|
+
"xhigh",
|
|
12662
|
+
]);
|
|
12663
|
+
const requested =
|
|
12664
|
+
typeof options.thinkingEffort === "string"
|
|
12665
|
+
? options.thinkingEffort.toLowerCase()
|
|
12666
|
+
: null;
|
|
12667
|
+
return {
|
|
12668
|
+
effort:
|
|
12669
|
+
requested && allowed.has(requested)
|
|
12670
|
+
? requested
|
|
12671
|
+
: _intensityToEffort(want),
|
|
12672
|
+
summary: "auto",
|
|
12673
|
+
};
|
|
12674
|
+
}
|
|
12675
|
+
|
|
12379
12676
|
/**
|
|
12380
12677
|
* Decide the Anthropic `thinking` request params for a model. Returns null
|
|
12381
12678
|
* (off) unless the caller opts in via options.thinking (true | "think" |
|
|
@@ -13534,15 +13831,8 @@ export async function* agentLoop(messages, options) {
|
|
|
13534
13831
|
options.evolutionIngress == null
|
|
13535
13832
|
? null
|
|
13536
13833
|
: captureAgentEvolutionIngress(options.evolutionIngress);
|
|
13537
|
-
if (evolutionIngress === null) {
|
|
13538
|
-
const error = new Error(
|
|
13539
|
-
"Agent loop requires an authenticated evolution ingress",
|
|
13540
|
-
);
|
|
13541
|
-
error.code = "CC_AGENT_EVOLUTION_INGRESS_FAILED";
|
|
13542
|
-
throw error;
|
|
13543
|
-
}
|
|
13544
13834
|
let llmCall = configuredChatFn || chatWithTools;
|
|
13545
|
-
if (configuredChatFn) {
|
|
13835
|
+
if (evolutionIngress !== null && configuredChatFn) {
|
|
13546
13836
|
const { captureCanonicalFallbackChatFn } =
|
|
13547
13837
|
await import("./fallback-model.js");
|
|
13548
13838
|
llmCall = captureCanonicalFallbackChatFn(
|
|
@@ -13620,9 +13910,15 @@ export async function* agentLoop(messages, options) {
|
|
|
13620
13910
|
const toolContext = {
|
|
13621
13911
|
readFileCache: new Map(),
|
|
13622
13912
|
hookDb: hermeticExecution ? null : options.hookDb || null,
|
|
13623
|
-
skillLoader:
|
|
13913
|
+
skillLoader:
|
|
13914
|
+
options.skillLoader ||
|
|
13915
|
+
(options.skillRuntimeAdmission || options.skillRuntimeAdmissionRequired
|
|
13916
|
+
? new CLISkillLoader(captureSkillRuntimeDependencies(options))
|
|
13917
|
+
: _defaultSkillLoader),
|
|
13624
13918
|
skillOutcomeIndex: options.skillOutcomeIndex,
|
|
13625
13919
|
skillVectorAuthority: options.skillVectorAuthority,
|
|
13920
|
+
skillRuntimeAdmission: options.skillRuntimeAdmission,
|
|
13921
|
+
skillRuntimeAdmissionRequired: options.skillRuntimeAdmissionRequired,
|
|
13626
13922
|
skillRetrievalRevocationReader: options.skillRetrievalRevocationReader,
|
|
13627
13923
|
// Hook-envelope tracing (P2 unified event bus): every settings-hook payload
|
|
13628
13924
|
// fired during this run carries trace_id = this run's id; a spawned child
|
|
@@ -14762,6 +15058,15 @@ export async function* agentLoop(messages, options) {
|
|
|
14762
15058
|
];
|
|
14763
15059
|
contextMemoryTrustedSystemIndexes.push(callMessages.length - 1);
|
|
14764
15060
|
}
|
|
15061
|
+
if (hook && typeof hook.userContext === "string" && hook.userContext) {
|
|
15062
|
+
// User-originated asynchronous context must remain user authority.
|
|
15063
|
+
// In particular, deferred question answers cannot become a trusted
|
|
15064
|
+
// system instruction merely because they arrive between iterations.
|
|
15065
|
+
callMessages = [
|
|
15066
|
+
...callMessages,
|
|
15067
|
+
{ role: "user", content: hook.userContext },
|
|
15068
|
+
];
|
|
15069
|
+
}
|
|
14765
15070
|
} catch (_e) {
|
|
14766
15071
|
// prepareCall failures are non-critical — proceed with original messages
|
|
14767
15072
|
}
|
|
@@ -15112,7 +15417,9 @@ export async function* agentLoop(messages, options) {
|
|
|
15112
15417
|
.map((b) => b.thinking || "")
|
|
15113
15418
|
.join("")
|
|
15114
15419
|
.trim()
|
|
15115
|
-
: ""
|
|
15420
|
+
: typeof msg._openaiReasoningSummary === "string"
|
|
15421
|
+
? msg._openaiReasoningSummary.trim()
|
|
15422
|
+
: "";
|
|
15116
15423
|
// Claude Code 2.1.183 parity: a turn that produced ONLY extended-thinking
|
|
15117
15424
|
// (no visible text, no tool calls) would otherwise complete silently with
|
|
15118
15425
|
// an empty answer — the user sees nothing. Re-prompt the model ONCE to
|
|
@@ -15209,11 +15516,17 @@ export async function* agentLoop(messages, options) {
|
|
|
15209
15516
|
// before it chose these tool calls. Streaming consumers already get it live
|
|
15210
15517
|
// via onThinking, so only surface it as an event for non-streaming consumers
|
|
15211
15518
|
// (the REPL) — keeps it out of the --include-partial-messages stream.
|
|
15212
|
-
if (
|
|
15213
|
-
|
|
15214
|
-
|
|
15215
|
-
.
|
|
15216
|
-
|
|
15519
|
+
if (
|
|
15520
|
+
!options.onThinking &&
|
|
15521
|
+
(Array.isArray(msg._thinkingBlocks) ||
|
|
15522
|
+
typeof msg._openaiReasoningSummary === "string")
|
|
15523
|
+
) {
|
|
15524
|
+
const _stepThinking = Array.isArray(msg._thinkingBlocks)
|
|
15525
|
+
? msg._thinkingBlocks
|
|
15526
|
+
.map((b) => b.thinking || "")
|
|
15527
|
+
.join("")
|
|
15528
|
+
.trim()
|
|
15529
|
+
: msg._openaiReasoningSummary.trim();
|
|
15217
15530
|
if (_stepThinking) yield { type: "thinking", text: _stepThinking };
|
|
15218
15531
|
}
|
|
15219
15532
|
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
} from "../lib/evolution/agent-evolution-session-lifecycle.js";
|
|
42
42
|
import { captureAgentSkillOutcomeIndex } from "../lib/evolution/agent-evolution-runtime-composition-brand.js";
|
|
43
43
|
import { captureSkillVectorAuthority } from "../lib/skill-vector-authority.js";
|
|
44
|
+
import { captureSkillRuntimeDependencies } from "../lib/evolution/skill-runtime-revalidation.js";
|
|
44
45
|
import { captureSkillRetrievalRevocationReader } from "../lib/evolution/skill-retrieval-revocation-authority.js";
|
|
45
46
|
|
|
46
47
|
const {
|
|
@@ -77,6 +78,10 @@ export class AgentRuntime {
|
|
|
77
78
|
deps.evolutionIngress == null
|
|
78
79
|
? null
|
|
79
80
|
: captureAgentEvolutionIngress(deps.evolutionIngress);
|
|
81
|
+
this.runtimeAdmissionDependencies = captureSkillRuntimeDependencies(
|
|
82
|
+
deps,
|
|
83
|
+
this.evolutionIngress?.tenantId,
|
|
84
|
+
);
|
|
80
85
|
this.skillOutcomeIndex =
|
|
81
86
|
deps.skillOutcomeIndex == null
|
|
82
87
|
? null
|
|
@@ -343,6 +348,7 @@ export class AgentRuntime {
|
|
|
343
348
|
});
|
|
344
349
|
const result = await this.deps.startAgentRepl({
|
|
345
350
|
...this.policy,
|
|
351
|
+
...this.runtimeAdmissionDependencies,
|
|
346
352
|
...(this.memoryPolicyReceiptWriter === null
|
|
347
353
|
? {}
|
|
348
354
|
: { memoryPolicyReceiptWriter: this.memoryPolicyReceiptWriter }),
|
|
@@ -551,6 +557,7 @@ export class AgentRuntime {
|
|
|
551
557
|
}
|
|
552
558
|
|
|
553
559
|
const server = this.deps.createServer({
|
|
560
|
+
...this.runtimeAdmissionDependencies,
|
|
554
561
|
port,
|
|
555
562
|
host,
|
|
556
563
|
token,
|
|
@@ -966,7 +966,7 @@ const CODING_AGENT_TOOL_CONTRACTS = Object.freeze([
|
|
|
966
966
|
kind: "interaction",
|
|
967
967
|
tier: "extension",
|
|
968
968
|
description:
|
|
969
|
-
"
|
|
969
|
+
"Ask the user a structured question. blocking (default) waits for a decision; deferred returns a pending receipt so independent work can continue and is restricted to non-authoritative preference/information collection. Deferred answers never grant permission or approve a branch.",
|
|
970
970
|
inputSchema: {
|
|
971
971
|
type: "object",
|
|
972
972
|
properties: {
|
|
@@ -984,6 +984,18 @@ const CODING_AGENT_TOOL_CONTRACTS = Object.freeze([
|
|
|
984
984
|
type: "boolean",
|
|
985
985
|
description: "Allow multiple selections (default: false)",
|
|
986
986
|
},
|
|
987
|
+
mode: {
|
|
988
|
+
type: "string",
|
|
989
|
+
enum: ["blocking", "deferred"],
|
|
990
|
+
description:
|
|
991
|
+
"blocking waits for the answer (default). deferred immediately returns a pending receipt and may only be used for independent preference/information collection",
|
|
992
|
+
},
|
|
993
|
+
purpose: {
|
|
994
|
+
type: "string",
|
|
995
|
+
enum: ["decision", "authorization", "preference", "information"],
|
|
996
|
+
description:
|
|
997
|
+
"Why the answer is needed. decision/authorization questions are always blocking; deferred requires preference or information",
|
|
998
|
+
},
|
|
987
999
|
timeoutMs: {
|
|
988
1000
|
type: "number",
|
|
989
1001
|
description: "Max wait for user reply in ms (default: 60000)",
|