chainlesschain 0.162.176 → 0.162.178
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 +10 -0
- package/package.json +1 -1
- package/src/assets/web-panel/.build-hash +1 -1
- package/src/assets/web-panel/assets/{AIOps-BDLu5Elz.js → AIOps-DRftcSue.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-DH5us-CK.js → ActionButton-BFvUaMKR.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-BZ0u8IFG.js → Analytics-C0-Rru4P.js} +3 -3
- package/src/assets/web-panel/assets/AppLayout-bx-BCljj.js +9 -0
- package/src/assets/web-panel/assets/{Artifacts-Br2YBbh_.js → Artifacts-DAJ8B3Un.js} +1 -1
- package/src/assets/web-panel/assets/{Audit-C3C6a482.js → Audit-hOk4L1lr.js} +1 -1
- package/src/assets/web-panel/assets/{BackgroundAgents-CzHvebcj.js → BackgroundAgents-3pbDpM9z.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-DZNHYDFd.js → Backup-BtziGDn9.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-VRiC4fIx.js → BaseInput-kmshphJ3.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-Cm08WWAD.js → Chat-d7tGSosA.js} +5 -5
- package/src/assets/web-panel/assets/{ChatBubbleRenderer-CGHYrugQ.js → ChatBubbleRenderer-p-_PBpX_.js} +1 -1
- package/src/assets/web-panel/assets/{Checkbox-DtByk7d7.js → Checkbox-C4Eh4Tz5.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-CphXXOfD.js → Codegen-r7gmhZyA.js} +1 -1
- package/src/assets/web-panel/assets/{Col-Hz86TnLR.js → Col-U7mDaGlL.js} +1 -1
- package/src/assets/web-panel/assets/{Community-HP03ltpD.js → Community-Bpu8aH1T.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-B_N1mqQz.js → Compact-CHb2XBJe.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-CVztRpi8.js → Compliance-Cn_r4dey.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-wUVOyZih.js → Cowork-CdMWfDcz.js} +4 -4
- package/src/assets/web-panel/assets/{Cron-DW5TLJKw.js → Cron-BtnREHWy.js} +2 -2
- package/src/assets/web-panel/assets/{Crosschain-CrAFGhWH.js → Crosschain-BKI9TSzr.js} +1 -1
- package/src/assets/web-panel/assets/{DID-pA-oD8ke.js → DID-pkNubzzJ.js} +2 -2
- package/src/assets/web-panel/assets/Dashboard-1rrz1snN.js +3 -0
- package/src/assets/web-panel/assets/{Dropdown-EweJcsek.js → Dropdown-DLyFVxDc.js} +1 -1
- package/src/assets/web-panel/assets/{EmailListRenderer-C9xVLPG4.js → EmailListRenderer-CtUWfYVq.js} +1 -1
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-CDcEEqlu.js → FamilyGuardDashboard-B8eX2Qe4.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-DtZda9A_.js → Federation-D8lsDGus.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-CiYdcVz3.js → FormItemContext-CRYt_aIw.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-DA13uwA0.js → GenericCardRenderer-ClKzY8_N.js} +1 -1
- package/src/assets/web-panel/assets/{Git-DzRhZD1O.js → Git-BXj5Dney.js} +2 -2
- package/src/assets/web-panel/assets/{Governance-D5RMgOSb.js → Governance-Cm-I8RMz.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-BgrPfSNk.js → Inference-CPvbhvgt.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-DzjnD571.js → KnowledgeGraph-sYNDZaoi.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-BhWzVDtN.js → Logs-BZY_3CRZ.js} +2 -2
- package/src/assets/web-panel/assets/{MarkdownRenderer-BDape9cx.js → MarkdownRenderer-up0BW6pv.js} +1 -1
- package/src/assets/web-panel/assets/{Marketplace-DJtL5GV7.js → Marketplace-C5MEJ2Qe.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-CZcQygI7.js → McpTools-ihdrn43I.js} +5 -5
- package/src/assets/web-panel/assets/{Memory-DUWSDUUu.js → Memory-Br8bPMlh.js} +2 -2
- package/src/assets/web-panel/assets/{MobileBridge-BTwq2WKY.js → MobileBridge-BNntgrYW.js} +1 -1
- package/src/assets/web-panel/assets/MobileProjects-BdV915mw.js +1 -0
- package/src/assets/web-panel/assets/{Mtc-BiGugEQm.js → Mtc-A3wDmlqL.js} +5 -5
- package/src/assets/web-panel/assets/{MtcAudit-DY7a6gUe.js → MtcAudit-CF-mBLWM.js} +2 -2
- package/src/assets/web-panel/assets/{Multisig-BQbDu_w7.js → Multisig-Iy2k_MSo.js} +3 -3
- package/src/assets/web-panel/assets/{NLProgramming-CM2wXTLv.js → NLProgramming-kk0W7HUb.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-DI6gGs1v.js → Notes-B5u5t_4S.js} +3 -3
- package/src/assets/web-panel/assets/{NotificationSettings-BsZOLWAB.js → NotificationSettings-BN0POf6_.js} +1 -1
- package/src/assets/web-panel/assets/OrderTableRenderer-CHkSUrXB.js +1 -0
- package/src/assets/web-panel/assets/{Organization-Cds0_tXr.js → Organization-DwWQESuN.js} +4 -4
- package/src/assets/web-panel/assets/{Overflow-WunYMD87.js → Overflow-DG6klrcC.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-Bo6j4DDv.js → P2P-BwJcKkgZ.js} +2 -2
- package/src/assets/web-panel/assets/{PdhVaultBrowser-Bh2XPD5f.js → PdhVaultBrowser-BwOHG0in.js} +5 -5
- package/src/assets/web-panel/assets/{Permissions-EMvMMC8N.js → Permissions-CGMXe4TX.js} +4 -4
- package/src/assets/web-panel/assets/PersonalDataHub-ziYqg7-A.js +8 -0
- package/src/assets/web-panel/assets/{Pipeline-BOx8HOgL.js → Pipeline-BzJfeoGt.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-tBeTVQVM.js → Privacy-DLh3Bblx.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-CVYg1W4M.js → ProjectInit-USVWW36c.js} +2 -2
- package/src/assets/web-panel/assets/{ProjectSettings-Dvt5I7y1.js → ProjectSettings-CiiOn62h.js} +2 -2
- package/src/assets/web-panel/assets/Projects-6V-PNmcA.js +1 -0
- package/src/assets/web-panel/assets/{Providers-Ct8xqY-E.js → Providers-CBPWWzpu.js} +1 -1
- package/src/assets/web-panel/assets/{QrScannerModal-Cni8Ooja.js → QrScannerModal-QVwoRUq3.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-BJVLKdxr.js → QuickAsk-CXnR-2Vn.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-DPG8Rbbm.js → Recommend-ClaNzjmF.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-DsdR7dCt.js → RemoteSession-C3rGw8vJ.js} +2 -2
- package/src/assets/web-panel/assets/{Reputation-Csg1YM-b.js → Reputation-Ci-OWAoP.js} +1 -1
- package/src/assets/web-panel/assets/{Row-D9DoFoEf.js → Row-DRhAwXOS.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-BsvKrXMS.js → RssFeed-BQLJQ2_y.js} +3 -3
- package/src/assets/web-panel/assets/{Search-DFUStfgQ.js → Search-QQUpkfFd.js} +1 -1
- package/src/assets/web-panel/assets/{Security-ILg1zxdK.js → Security-DdXKzuKT.js} +4 -4
- package/src/assets/web-panel/assets/{Services-Dd41PCaY.js → Services-x2Zh62Qd.js} +2 -2
- package/src/assets/web-panel/assets/{Skeleton-Bzo1cN80.js → Skeleton-GdY4KwRz.js} +1 -1
- package/src/assets/web-panel/assets/{Skills-BDHh17P0.js → Skills-Bv4tY1Fd.js} +1 -1
- package/src/assets/web-panel/assets/{Sla-jl7UTiRY.js → Sla-C3QnM-11.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-BePa-RF6.js → SpeechSettings-Bl3ytvmI.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-DiqqDKGZ.js → SyncSettings-Wp9IwTsP.js} +2 -2
- package/src/assets/web-panel/assets/{Tasks-DYQ_6lxj.js → Tasks-CF3rIrDe.js} +1 -1
- package/src/assets/web-panel/assets/{Templates-JiDeI06L.js → Templates-CGfvVVM9.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-hhgI6zwS.js → Tenant-CVXmwQ3U.js} +1 -1
- package/src/assets/web-panel/assets/Terminal-bvwrt03E.js +3 -0
- package/src/assets/web-panel/assets/{TimelineRenderer-B8uB5Llk.js → TimelineRenderer-D0g74KhH.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-C3b_6r2z.js → Tokens-BH4IwzlT.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-tIP7HKVe.js → Trigger-DJOpM533.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-vjoc11vJ.js → Trust-B43EPRLr.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-DUPBnGuH.js → UkeySign-BmBFG-em.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-CBvhUY5T.js → VideoEditing-n9oJwB8k.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-DUaQ0uA5.js → Wallet-D5QeivHp.js} +4 -4
- package/src/assets/web-panel/assets/{WebAuthn-DllSivjE.js → WebAuthn-DcNy7igO.js} +5 -5
- package/src/assets/web-panel/assets/{WorkflowEditor-xc8D3uO6.js → WorkflowEditor-BVjc7-5-.js} +1 -1
- package/src/assets/web-panel/assets/{chat-BVicU7oA.js → chat-Dy5Tfj3m.js} +1 -1
- package/src/assets/web-panel/assets/{colors-DJzLmhLm.js → colors-C4c2CNZU.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-BvYRfThE.js → compact-item-DPa3O5vN.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-DGXxCBKR.js → createContext-TLcfNA6_.js} +1 -1
- package/src/assets/web-panel/assets/devWarning-BAwdDA_5.js +1 -0
- package/src/assets/web-panel/assets/{hasIn-SBDJB1y4.js → hasIn-D41LVFkp.js} +1 -1
- package/src/assets/web-panel/assets/{index-D7HimK0M.js → index-0oevYjfT.js} +1 -1
- package/src/assets/web-panel/assets/{index-DCdRAgjy.js → index-388pLGJ1.js} +1 -1
- package/src/assets/web-panel/assets/{index-BO1itZaY.js → index-B8nLBZbv.js} +3 -3
- package/src/assets/web-panel/assets/{index-DvUTDYXX.js → index-BPTGAjee.js} +1 -1
- package/src/assets/web-panel/assets/{index-hxTODbM1.js → index-BPtrOBmW.js} +1 -1
- package/src/assets/web-panel/assets/{index-wcCL-miV.js → index-BQiIxHBy.js} +1 -1
- package/src/assets/web-panel/assets/{index-CKyEivf8.js → index-BSM1cHVK.js} +1 -1
- package/src/assets/web-panel/assets/{index-BJZf9DhV.js → index-BYPr9fkz.js} +1 -1
- package/src/assets/web-panel/assets/{index-DHVLJ8q0.js → index-BsQ7Ev6i.js} +1 -1
- package/src/assets/web-panel/assets/{index-Cs2rmLFt.js → index-Btk9qLL2.js} +1 -1
- package/src/assets/web-panel/assets/{index-z1ZylsLq.js → index-BvmziZSG.js} +1 -1
- package/src/assets/web-panel/assets/{index-Cf-O_g_8.js → index-BvopLC_T.js} +1 -1
- package/src/assets/web-panel/assets/{index-DMarmfrv.js → index-C7xhTVyP.js} +1 -1
- package/src/assets/web-panel/assets/{index-CoJAO1Lm.js → index-CNk_ZooP.js} +1 -1
- package/src/assets/web-panel/assets/{index-9gdI7uUW.js → index-CQrEHoOG.js} +1 -1
- package/src/assets/web-panel/assets/{index-Bf-ctERC.js → index-CSxex23J.js} +1 -1
- package/src/assets/web-panel/assets/{index-MjC4G09d.js → index-CVjgm992.js} +1 -1
- package/src/assets/web-panel/assets/{index-e4fXH_WO.js → index-CWK4zOPe.js} +1 -1
- package/src/assets/web-panel/assets/{index-xfluRkCT.js → index-CX0VsoP4.js} +1 -1
- package/src/assets/web-panel/assets/{index-DRfiXB_p.js → index-CXl0YPNG.js} +1 -1
- package/src/assets/web-panel/assets/{index-d5BVd-cL.js → index-Cip7LWml.js} +1 -1
- package/src/assets/web-panel/assets/{index-Dm_77jgR.js → index-Cq_hlWNt.js} +1 -1
- package/src/assets/web-panel/assets/{index-YJkzy8ZF.js → index-CzZ49YZL.js} +1 -1
- package/src/assets/web-panel/assets/{index-CtwqO5qo.js → index-D2Nkivlm.js} +1 -1
- package/src/assets/web-panel/assets/{index-BYqz4Wrr.js → index-DBUgRs4D.js} +1 -1
- package/src/assets/web-panel/assets/index-DEjVkdzq.js +1 -0
- package/src/assets/web-panel/assets/{index-CdGY9P8a.js → index-DNsBj2Ob.js} +1 -1
- package/src/assets/web-panel/assets/{index-DonCnfMr.js → index-Di4X8cfI.js} +1 -1
- package/src/assets/web-panel/assets/{index-1SdDS6lR.js → index-DljFsVGI.js} +1 -1
- package/src/assets/web-panel/assets/{index-DnjPdvR6.js → index-Korc3QIe.js} +1 -1
- package/src/assets/web-panel/assets/index-LMOc5xrS.js +1 -0
- package/src/assets/web-panel/assets/{index-VMfwIH5G.js → index-MKZDje0H.js} +1 -1
- package/src/assets/web-panel/assets/{index-DKrvvWm4.js → index-OHAfRu_3.js} +1 -1
- package/src/assets/web-panel/assets/{index-FxZzRyE1.js → index-WEJr8PL5.js} +1 -1
- package/src/assets/web-panel/assets/{index-Crk5NTb0.js → index-WinCp6du.js} +1 -1
- package/src/assets/web-panel/assets/{index-DCqRS6da.js → index-Yjr6cqSK.js} +1 -1
- package/src/assets/web-panel/assets/{index-BTrBGBJs.js → index-iQ6gtFih.js} +1 -1
- package/src/assets/web-panel/assets/{index-lpaGoTH3.js → index-pt3s7yvV.js} +1 -1
- package/src/assets/web-panel/assets/{index-CloCgBUR.js → index-tQ3igERQ.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-C1zO1KnY.js → initDefaultProps-BFZu87WZ.js} +1 -1
- package/src/assets/web-panel/assets/{motion-CWLtEGmC.js → motion-DJIo7qvt.js} +1 -1
- package/src/assets/web-panel/assets/{move-DzD_C3Vm.js → move-Cfr5qknL.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-D880PYJl.js → mtc-parser-Bgc-OadH.js} +1 -1
- package/src/assets/web-panel/assets/{omit-CFR_z2ov.js → omit-X3WI-TNp.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-srIhgrSC.js → pickAttrs-pJhU9IxK.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-C1rXpibP.js → placementArrow-BNg_Vj3T.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-C30gRcSS.js → responsiveObserve-TeSEGQ5-.js} +1 -1
- package/src/assets/web-panel/assets/{slide-CvtKiMfV.js → slide-D_t_P0bv.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-DNHO7ITG.js → statusUtils-DrrIMwAT.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-Dt_Sl-g4.js → styleChecker-BjZCuFRm.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-Cjev42Gh.js → useFlexGapSupport-rTFdlqdQ.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-Baxglj2V.js → useFs-BidCpfLX.js} +1 -1
- package/src/assets/web-panel/assets/usePersonalDataHub-C5mHttA9.js +1 -0
- package/src/assets/web-panel/assets/{vnode-mIRkdT7o.js → vnode-BrbcRiHZ.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-HzI5DlH_.js → zoom-PISX7AkR.js} +1 -1
- package/src/assets/web-panel/index.html +1 -1
- package/src/commands/__tests__/hub-wechat.test.js +45 -0
- package/src/commands/agenda.js +22 -6
- package/src/commands/agent.js +3 -3
- package/src/commands/background-session.js +16 -6
- package/src/commands/batch.js +79 -27
- package/src/commands/changelog.js +15 -4
- package/src/commands/context.js +33 -1
- package/src/commands/eval.js +21 -6
- package/src/commands/hook.js +2 -2
- package/src/commands/hub.js +473 -39
- package/src/commands/init.js +212 -110
- package/src/commands/llm.js +22 -6
- package/src/commands/loop.js +9 -2
- package/src/commands/skill.js +13 -1
- package/src/commands/statusline.js +3 -3
- package/src/data/changelog.json +53 -5
- package/src/gateways/ws/personal-data-hub-protocol.js +22 -2
- package/src/harness/background-task-manager.js +18 -6
- package/src/harness/background-task-worker.js +11 -18
- package/src/harness/golden-transcript.js +3 -0
- package/src/harness/mcp-client.js +9 -15
- package/src/harness/worktree-isolator.js +18 -21
- package/src/index.js +18 -7
- package/src/lib/agent-core.js +5 -0
- package/src/lib/agent-ipc-bus.js +12 -3
- package/src/lib/agent-team/team-worktree.js +28 -6
- package/src/lib/agent-worktree.js +20 -19
- package/src/lib/approval-authority-store.js +891 -0
- package/src/lib/async-hook-supervisor.cjs +134 -24
- package/src/lib/async-hook-supervisor.js +47 -0
- package/src/lib/background-agent-supervisor.js +35 -12
- package/src/lib/background-interaction-resolver.js +399 -54
- package/src/lib/background-session-transport.js +3 -1
- package/src/lib/background-task-manager.js +5 -1
- package/src/lib/changelog.js +57 -0
- package/src/lib/chrome-connector.js +6 -2
- package/src/lib/claude-code-bridge.js +24 -8
- package/src/lib/cli-anything-bridge.js +82 -25
- package/src/lib/context-breakdown.js +82 -3
- package/src/lib/doctor-checkup.js +18 -6
- package/src/lib/eval/tasks.js +25 -31
- package/src/lib/event-runtime-host.js +225 -0
- package/src/lib/event-runtime-store.js +102 -21
- package/src/lib/event-runtime-worker.js +70 -2
- package/src/lib/hook-runner.cjs +71 -36
- package/src/lib/hook-runner.js +55 -0
- package/src/lib/hooks-v2-producers.js +33 -8
- package/src/lib/hooks-v2-runtime.js +360 -40
- package/src/lib/host-adb-bridge.js +18 -3
- package/src/lib/interaction-adapter.js +66 -0
- package/src/lib/lsp/__tests__/benchmark.test.js +61 -0
- package/src/lib/lsp/__tests__/lsp-client.test.js +6 -1
- package/src/lib/lsp/benchmark.js +20 -4
- package/src/lib/lsp/lsp-client.js +6 -4
- package/src/lib/lsp/lsp-server-registry.js +0 -2
- package/src/lib/operation-fingerprint.js +107 -2
- package/src/lib/orchestrator.js +8 -2
- package/src/lib/packer/pack-update-applier.js +14 -2
- package/src/lib/packer/smoke-runner.js +18 -5
- package/src/lib/paths.js +1 -1
- package/src/lib/pdh-dedicated-batch-collectors.js +124 -0
- package/src/lib/personal-data-hub-wiring.js +327 -52
- package/src/lib/plugin-monitor-supervisor.js +20 -13
- package/src/lib/plugin-runtime/install.js +10 -3
- package/src/lib/process-execution-broker/credential-agent.js +954 -111
- package/src/lib/process-execution-broker/index.js +369 -85
- package/src/lib/process-execution-broker/platform-sandbox.js +320 -140
- package/src/lib/provider-http-error.js +94 -0
- package/src/lib/remote-approval-bridge.js +222 -26
- package/src/lib/repl-bang-memorize.js +10 -2
- package/src/lib/repl-goal.js +19 -2
- package/src/lib/settings-hook-events.cjs +13 -8
- package/src/lib/settings-hook-events.js +20 -0
- package/src/lib/side-effect-ledger-store.js +65 -14
- package/src/lib/skill-loader.js +215 -12
- package/src/lib/skill-packs/generator.js +18 -9
- package/src/lib/skill-process-broker.js +85 -0
- package/src/lib/slash-commands.js +10 -2
- package/src/lib/status-line.cjs +28 -7
- package/src/lib/status-line.js +33 -0
- package/src/lib/sub-agent-context.js +42 -0
- package/src/lib/turn-binding-store.js +64 -15
- package/src/lib/turn-binding.js +85 -16
- package/src/repl/agent-repl.js +88 -49
- package/src/repl/remote-approval.js +13 -13
- package/src/repl/repl-turn-binding.js +46 -16
- package/src/runtime/agent-core.js +419 -84
- package/src/runtime/coding-agent-contract-shared.cjs +16 -0
- package/src/runtime/headless-runner.js +172 -44
- package/src/runtime/headless-stream.js +221 -11
- package/src/runtime/session-slash-commands.js +506 -0
- package/src/skills/video-editing/extractors/audio-extractor.js +13 -5
- package/src/skills/video-editing/extractors/video-extractor.js +13 -3
- package/src/skills/video-editing/media-process.js +20 -0
- package/src/skills/video-editing/render/audio-mix.js +13 -3
- package/src/skills/video-editing/render/ffmpeg-concat.js +7 -2
- package/src/skills/video-editing/render/ffmpeg-extract.js +7 -2
- package/src/workers/background-agent-worker.js +76 -40
- package/src/assets/web-panel/assets/AppLayout-Duu8xR14.js +0 -9
- package/src/assets/web-panel/assets/Dashboard-CXrd5gAw.js +0 -3
- package/src/assets/web-panel/assets/MobileProjects-NZvvfDME.js +0 -1
- package/src/assets/web-panel/assets/OrderTableRenderer-C48mu09U.js +0 -1
- package/src/assets/web-panel/assets/PersonalDataHub-AX3ypUDV.js +0 -9
- package/src/assets/web-panel/assets/Projects-Cc7FC9-e.js +0 -1
- package/src/assets/web-panel/assets/Terminal-CjTZPa37.js +0 -3
- package/src/assets/web-panel/assets/devWarning-BT46Y_QI.js +0 -1
- package/src/assets/web-panel/assets/index-B7nuIywP.js +0 -1
- package/src/assets/web-panel/assets/index-ycwAfC-i.js +0 -1
- package/src/assets/web-panel/assets/usePersonalDataHub-B4NkcLaP.js +0 -1
|
@@ -16,15 +16,14 @@
|
|
|
16
16
|
|
|
17
17
|
import fs from "fs";
|
|
18
18
|
import path from "path";
|
|
19
|
-
import { execSync, spawn, spawnSync } from "child_process";
|
|
20
19
|
import broker from "../lib/process-execution-broker/index.js";
|
|
21
20
|
import os from "os";
|
|
22
21
|
import sharedCodingAgentPolicy from "./coding-agent-policy.cjs";
|
|
23
22
|
import sharedShellPolicy from "./coding-agent-shell-policy.cjs";
|
|
24
23
|
import sharedPermissionRules from "../lib/permission-rules.cjs";
|
|
25
24
|
import sharedSettingsHooks from "../lib/settings-hooks.cjs";
|
|
26
|
-
import sharedHookRunner from "../lib/hook-runner.
|
|
27
|
-
import sharedHookEvents from "../lib/settings-hook-events.
|
|
25
|
+
import sharedHookRunner from "../lib/hook-runner.js";
|
|
26
|
+
import sharedHookEvents from "../lib/settings-hook-events.js";
|
|
28
27
|
import { mergeProviderOptions } from "../lib/provider-options.js";
|
|
29
28
|
import { applyCredentialProxy } from "../lib/credential-proxy.js";
|
|
30
29
|
import { describeBackgroundCommand } from "../lib/terminal-context.js";
|
|
@@ -60,6 +59,7 @@ import {
|
|
|
60
59
|
} from "../lib/idempotency.js";
|
|
61
60
|
import { buildSearchCommand } from "../lib/search-command.js";
|
|
62
61
|
import { discoverCommands } from "../lib/slash-commands.js";
|
|
62
|
+
import { createSkillProcessBroker } from "../lib/skill-process-broker.js";
|
|
63
63
|
import {
|
|
64
64
|
isRetryableStreamError,
|
|
65
65
|
STREAM_RETRY_BASE_MS,
|
|
@@ -80,12 +80,21 @@ import {
|
|
|
80
80
|
imageUrlBlockToAnthropic,
|
|
81
81
|
} from "../lib/image-input.js";
|
|
82
82
|
import { executeToolSearch, gateDeferredMcpCall } from "./mcp-tool-search.js";
|
|
83
|
-
import {
|
|
83
|
+
import {
|
|
84
|
+
emitHooksV2Event,
|
|
85
|
+
executeHooksV2Event,
|
|
86
|
+
} from "../lib/hooks-v2-producers.js";
|
|
84
87
|
import {
|
|
85
88
|
admitTool,
|
|
86
89
|
buildToolAttribution,
|
|
87
90
|
} from "../lib/agent-tool-admission.js";
|
|
88
91
|
import { evaluateUnattendedShellAction } from "../lib/unattended-action-policy.js";
|
|
92
|
+
import {
|
|
93
|
+
formatProviderHttpError,
|
|
94
|
+
formatProviderResponseError,
|
|
95
|
+
} from "../lib/provider-http-error.js";
|
|
96
|
+
|
|
97
|
+
export { formatProviderHttpError };
|
|
89
98
|
|
|
90
99
|
/**
|
|
91
100
|
* Names of MCP servers currently mounted by an in-flight run_skill call.
|
|
@@ -113,6 +122,33 @@ const {
|
|
|
113
122
|
withDeliveryId,
|
|
114
123
|
} = sharedHookEvents;
|
|
115
124
|
|
|
125
|
+
const searchProcessRunner = broker.execSync.bind(broker);
|
|
126
|
+
const runCodeProcessRunner = broker.execFileSync.bind(broker);
|
|
127
|
+
|
|
128
|
+
export const _agentToolProcessDeps = {
|
|
129
|
+
runSearch: searchProcessRunner,
|
|
130
|
+
runCode: runCodeProcessRunner,
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
function runSearchProcess(command, options = {}) {
|
|
134
|
+
return _agentToolProcessDeps.runSearch(command, {
|
|
135
|
+
...options,
|
|
136
|
+
origin: "agent-core:search-files",
|
|
137
|
+
policy: "allow",
|
|
138
|
+
scope: "agent-core",
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function runCodeProcess(file, args, options = {}, origin = "run-code") {
|
|
143
|
+
return _agentToolProcessDeps.runCode(file, args, {
|
|
144
|
+
...options,
|
|
145
|
+
origin: `agent-core:${origin}`,
|
|
146
|
+
policy: "allow",
|
|
147
|
+
scope: "agent-core",
|
|
148
|
+
shell: false,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
116
152
|
// ─── Background shell tasks ────────────────────────────────────────────────
|
|
117
153
|
//
|
|
118
154
|
// run_shell is synchronous (execSync) and capped at a foreground timeout, which
|
|
@@ -231,25 +267,54 @@ function _releaseBgChildHandles(task) {
|
|
|
231
267
|
}
|
|
232
268
|
}
|
|
233
269
|
|
|
270
|
+
const backgroundTaskRunner = broker.spawn.bind(broker);
|
|
271
|
+
const backgroundTaskSyncRunner = broker.spawnSync.bind(broker);
|
|
272
|
+
|
|
273
|
+
export const _backgroundProcessDeps = {
|
|
274
|
+
run: backgroundTaskRunner,
|
|
275
|
+
runSync: backgroundTaskSyncRunner,
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
export function _runBackgroundTaskkill(pid, { sync = false } = {}) {
|
|
279
|
+
const args = ["/pid", String(pid), "/T", "/F"];
|
|
280
|
+
const options = {
|
|
281
|
+
windowsHide: true,
|
|
282
|
+
origin: "agent-core:background-taskkill",
|
|
283
|
+
policy: "allow",
|
|
284
|
+
scope: "agent-core",
|
|
285
|
+
};
|
|
286
|
+
return sync
|
|
287
|
+
? _backgroundProcessDeps.runSync("taskkill", args, options)
|
|
288
|
+
: _backgroundProcessDeps.run("taskkill", args, options);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const gitProcessRunner = broker.spawnSync.bind(broker);
|
|
292
|
+
|
|
293
|
+
export const _gitProcessDeps = {
|
|
294
|
+
run: gitProcessRunner,
|
|
295
|
+
};
|
|
296
|
+
|
|
234
297
|
function _killTask(task) {
|
|
235
298
|
const child = task?.child;
|
|
236
299
|
if (!child || child.killed || task?.status !== "running") return false;
|
|
237
300
|
try {
|
|
238
301
|
if (process.platform === "win32") {
|
|
239
302
|
if (child.pid) {
|
|
240
|
-
const tk =
|
|
241
|
-
|
|
242
|
-
});
|
|
243
|
-
// A spawn that fails to launch emits an async 'error' event — with no
|
|
244
|
-
// listener Node rethrows it as an UNCAUGHT exception (the try/catch
|
|
245
|
-
// here can't catch the async emit), crashing the CLI. Handle it and
|
|
246
|
-
// fall back to a direct kill.
|
|
247
|
-
tk.on("error", () => {
|
|
303
|
+
const tk = _runBackgroundTaskkill(child.pid);
|
|
304
|
+
const fallbackDirectKill = () => {
|
|
248
305
|
try {
|
|
249
|
-
child.kill();
|
|
306
|
+
if (!child.killed) child.kill("SIGKILL");
|
|
250
307
|
} catch {
|
|
251
308
|
/* already dead */
|
|
252
309
|
}
|
|
310
|
+
};
|
|
311
|
+
// A launch failure emits 'error'; a permissions/policy failure instead
|
|
312
|
+
// launches taskkill successfully and exits non-zero. Both must fall
|
|
313
|
+
// back or the background command remains alive while teardown reports
|
|
314
|
+
// success.
|
|
315
|
+
tk.once("error", fallbackDirectKill);
|
|
316
|
+
tk.once("close", (code) => {
|
|
317
|
+
if (code !== 0) fallbackDirectKill();
|
|
253
318
|
});
|
|
254
319
|
} else {
|
|
255
320
|
child.kill();
|
|
@@ -310,9 +375,13 @@ function _killTaskSync(task) {
|
|
|
310
375
|
try {
|
|
311
376
|
if (process.platform === "win32") {
|
|
312
377
|
if (child.pid) {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
378
|
+
const killed = _runBackgroundTaskkill(child.pid, { sync: true });
|
|
379
|
+
if (killed.error || killed.status !== 0) {
|
|
380
|
+
// Restricted runners can execute taskkill but receive a non-zero
|
|
381
|
+
// access/policy result. Direct termination is the synchronous
|
|
382
|
+
// last-resort for the child handle we own.
|
|
383
|
+
child.kill("SIGKILL");
|
|
384
|
+
}
|
|
316
385
|
} else {
|
|
317
386
|
child.kill();
|
|
318
387
|
}
|
|
@@ -601,6 +670,33 @@ async function requestInteractivePermission(
|
|
|
601
670
|
cwd,
|
|
602
671
|
confirmArgs,
|
|
603
672
|
) {
|
|
673
|
+
const hooksV2 = await executeHooksV2Event(
|
|
674
|
+
"PermissionRequest",
|
|
675
|
+
{
|
|
676
|
+
schema_version: 1,
|
|
677
|
+
session_id: context.sessionId || null,
|
|
678
|
+
turn_id: context.turnId || null,
|
|
679
|
+
tool_use_id: context.toolCallId || null,
|
|
680
|
+
tool_name: name,
|
|
681
|
+
input_keys:
|
|
682
|
+
args && typeof args === "object" ? Object.keys(args).sort() : [],
|
|
683
|
+
reason: confirmArgs?.reason || null,
|
|
684
|
+
cwd,
|
|
685
|
+
},
|
|
686
|
+
{ failClosed: true },
|
|
687
|
+
);
|
|
688
|
+
if (hooksV2.decision === "allow") return true;
|
|
689
|
+
if (hooksV2.blocked || hooksV2.decision === "block") {
|
|
690
|
+
emitHooksV2Event("PermissionDenied", {
|
|
691
|
+
schema_version: 1,
|
|
692
|
+
session_id: context.sessionId || null,
|
|
693
|
+
turn_id: context.turnId || null,
|
|
694
|
+
tool_use_id: context.toolCallId || null,
|
|
695
|
+
tool_name: name,
|
|
696
|
+
source: "hooks-v2",
|
|
697
|
+
});
|
|
698
|
+
return false;
|
|
699
|
+
}
|
|
604
700
|
const verdict = runSettingsPermissionRequestHooks(
|
|
605
701
|
name,
|
|
606
702
|
args,
|
|
@@ -609,9 +705,31 @@ async function requestInteractivePermission(
|
|
|
609
705
|
confirmArgs?.reason,
|
|
610
706
|
);
|
|
611
707
|
if (verdict.decision === "allow") return true;
|
|
612
|
-
if (verdict.decision === "deny")
|
|
708
|
+
if (verdict.decision === "deny") {
|
|
709
|
+
emitHooksV2Event("PermissionDenied", {
|
|
710
|
+
schema_version: 1,
|
|
711
|
+
session_id: context.sessionId || null,
|
|
712
|
+
turn_id: context.turnId || null,
|
|
713
|
+
tool_use_id: context.toolCallId || null,
|
|
714
|
+
tool_name: name,
|
|
715
|
+
source: "settings-hook",
|
|
716
|
+
});
|
|
717
|
+
return false;
|
|
718
|
+
}
|
|
613
719
|
const confirm = context.permissionConfirm || context.shellConfirm || null;
|
|
614
|
-
|
|
720
|
+
const approved =
|
|
721
|
+
typeof confirm === "function" ? await confirm(confirmArgs) : false;
|
|
722
|
+
if (!approved) {
|
|
723
|
+
emitHooksV2Event("PermissionDenied", {
|
|
724
|
+
schema_version: 1,
|
|
725
|
+
session_id: context.sessionId || null,
|
|
726
|
+
turn_id: context.turnId || null,
|
|
727
|
+
tool_use_id: context.toolCallId || null,
|
|
728
|
+
tool_name: name,
|
|
729
|
+
source: typeof confirm === "function" ? "user" : "no-confirmer",
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
return approved;
|
|
615
733
|
}
|
|
616
734
|
|
|
617
735
|
// ─── Tool definitions ────────────────────────────────────────────────────
|
|
@@ -693,6 +811,21 @@ export function reloadSkills() {
|
|
|
693
811
|
let _cachedPython = null;
|
|
694
812
|
let _cachedEnvInfo = null;
|
|
695
813
|
|
|
814
|
+
const environmentProbeRunner = broker.execFileSync.bind(broker);
|
|
815
|
+
|
|
816
|
+
export const _environmentProcessDeps = {
|
|
817
|
+
run: environmentProbeRunner,
|
|
818
|
+
};
|
|
819
|
+
|
|
820
|
+
function runEnvironmentProbe(file, args, options = {}) {
|
|
821
|
+
return _environmentProcessDeps.run(file, args, {
|
|
822
|
+
...options,
|
|
823
|
+
origin: "agent-core:environment-probe",
|
|
824
|
+
policy: "allow",
|
|
825
|
+
scope: "agent-core",
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
|
|
696
829
|
/**
|
|
697
830
|
* Get cached Python interpreter info (reuses cli-anything-bridge detection).
|
|
698
831
|
* @returns {{ found: boolean, command?: string, version?: string }}
|
|
@@ -716,7 +849,7 @@ export function getEnvironmentInfo() {
|
|
|
716
849
|
let pipAvailable = false;
|
|
717
850
|
if (py.found) {
|
|
718
851
|
try {
|
|
719
|
-
|
|
852
|
+
runEnvironmentProbe(py.command, ["-m", "pip", "--version"], {
|
|
720
853
|
encoding: "utf-8",
|
|
721
854
|
timeout: 10000,
|
|
722
855
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -729,7 +862,7 @@ export function getEnvironmentInfo() {
|
|
|
729
862
|
|
|
730
863
|
let nodeVersion = null;
|
|
731
864
|
try {
|
|
732
|
-
nodeVersion =
|
|
865
|
+
nodeVersion = runEnvironmentProbe(process.execPath, ["--version"], {
|
|
733
866
|
encoding: "utf-8",
|
|
734
867
|
timeout: 5000,
|
|
735
868
|
}).trim();
|
|
@@ -739,7 +872,7 @@ export function getEnvironmentInfo() {
|
|
|
739
872
|
|
|
740
873
|
let gitAvailable = false;
|
|
741
874
|
try {
|
|
742
|
-
|
|
875
|
+
runEnvironmentProbe("git", ["--version"], {
|
|
743
876
|
encoding: "utf-8",
|
|
744
877
|
timeout: 5000,
|
|
745
878
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -932,13 +1065,14 @@ export function buildSystemPrompt(cwd, opts = {}) {
|
|
|
932
1065
|
|
|
933
1066
|
// Append auto-activated persona skills
|
|
934
1067
|
try {
|
|
935
|
-
const loader = new CLISkillLoader();
|
|
936
|
-
const
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1068
|
+
const loader = opts.skillLoader || new CLISkillLoader();
|
|
1069
|
+
const personaSkills = loader.getAutoActivatedPersonas({
|
|
1070
|
+
sessionId: opts.sessionId,
|
|
1071
|
+
turnId: opts.turnId,
|
|
1072
|
+
loadedBecause: "persona_auto",
|
|
1073
|
+
});
|
|
940
1074
|
if (typeof opts.onSkillsLoaded === "function") {
|
|
941
|
-
opts.onSkillsLoaded(personaSkills);
|
|
1075
|
+
opts.onSkillsLoaded(personaSkills, loader.getCacheLedger());
|
|
942
1076
|
}
|
|
943
1077
|
for (const p of personaSkills) {
|
|
944
1078
|
if (p.body?.trim()) {
|
|
@@ -1387,11 +1521,11 @@ export async function executeTool(name, args, context = {}) {
|
|
|
1387
1521
|
override.capabilityGranted ?? admission.capabilityGranted,
|
|
1388
1522
|
policyAllowed:
|
|
1389
1523
|
override.policyAllowed ??
|
|
1390
|
-
(context.hostManagedToolPolicy
|
|
1391
|
-
(
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
admission.policyAllowed),
|
|
1524
|
+
(context.hostManagedToolPolicy
|
|
1525
|
+
? (context.hostManagedToolPolicy?.tools ||
|
|
1526
|
+
context.hostManagedToolPolicy?.toolPolicies ||
|
|
1527
|
+
{})[name]?.allowed !== false
|
|
1528
|
+
: admission.policyAllowed),
|
|
1395
1529
|
permissionGranted:
|
|
1396
1530
|
override.permissionGranted ?? admission.permissionGranted,
|
|
1397
1531
|
budgetOk: override.budgetOk ?? admission.budgetOk,
|
|
@@ -1736,6 +1870,52 @@ export async function executeTool(name, args, context = {}) {
|
|
|
1736
1870
|
// capable: a `block` (exit 2 / {decision:block}) stops the tool here, an
|
|
1737
1871
|
// `ask` routes to the confirmer. Runs after permission resolution so a
|
|
1738
1872
|
// settings deny / host deny short-circuits before any hook process spawns.
|
|
1873
|
+
const hooksV2Pre = await executeHooksV2Event(
|
|
1874
|
+
"PreToolUse",
|
|
1875
|
+
{
|
|
1876
|
+
schema_version: 1,
|
|
1877
|
+
session_id: context.sessionId || null,
|
|
1878
|
+
turn_id: context.turnId || null,
|
|
1879
|
+
tool_use_id: context.toolCallId || null,
|
|
1880
|
+
tool_name: name,
|
|
1881
|
+
input_keys:
|
|
1882
|
+
args && typeof args === "object" ? Object.keys(args).sort() : [],
|
|
1883
|
+
cwd,
|
|
1884
|
+
},
|
|
1885
|
+
{ failClosed: true },
|
|
1886
|
+
);
|
|
1887
|
+
if (hooksV2Pre.blocked || hooksV2Pre.decision === "block") {
|
|
1888
|
+
return {
|
|
1889
|
+
error: `[Hook v2] PreToolUse blocked "${name}".`,
|
|
1890
|
+
policy: { decision: "block", via: "hooks-v2" },
|
|
1891
|
+
};
|
|
1892
|
+
}
|
|
1893
|
+
if (hooksV2Pre.requiresApproval || hooksV2Pre.decision === "ask") {
|
|
1894
|
+
const confirm = context.permissionConfirm || context.shellConfirm || null;
|
|
1895
|
+
const approved =
|
|
1896
|
+
typeof confirm === "function"
|
|
1897
|
+
? await confirm({
|
|
1898
|
+
tool: name,
|
|
1899
|
+
args,
|
|
1900
|
+
reason: "Hooks v2 PreToolUse requested confirmation",
|
|
1901
|
+
source: "hooks-v2",
|
|
1902
|
+
})
|
|
1903
|
+
: false;
|
|
1904
|
+
if (!approved) {
|
|
1905
|
+
emitHooksV2Event("PermissionDenied", {
|
|
1906
|
+
schema_version: 1,
|
|
1907
|
+
session_id: context.sessionId || null,
|
|
1908
|
+
turn_id: context.turnId || null,
|
|
1909
|
+
tool_use_id: context.toolCallId || null,
|
|
1910
|
+
tool_name: name,
|
|
1911
|
+
source: "hooks-v2",
|
|
1912
|
+
});
|
|
1913
|
+
return {
|
|
1914
|
+
error: `[Hook v2] PreToolUse confirmation denied for "${name}".`,
|
|
1915
|
+
policy: { decision: "deny", via: "hooks-v2" },
|
|
1916
|
+
};
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1739
1919
|
if (hookDb) {
|
|
1740
1920
|
try {
|
|
1741
1921
|
await executeHooks(hookDb, HookEvents.PreToolUse, {
|
|
@@ -1775,6 +1955,8 @@ export async function executeTool(name, args, context = {}) {
|
|
|
1775
1955
|
parentMessages: context.parentMessages,
|
|
1776
1956
|
interaction: context.interaction,
|
|
1777
1957
|
sessionId: context.sessionId || null,
|
|
1958
|
+
turnId: context.turnId || null,
|
|
1959
|
+
toolCallId: context.toolCallId || null,
|
|
1778
1960
|
// Parent LLM config — documented at toolContext as forwarded to
|
|
1779
1961
|
// spawn_sub_agent for provider/key inheritance; without this line it
|
|
1780
1962
|
// never actually reached executeToolInner (sub-agents silently fell
|
|
@@ -2586,6 +2768,8 @@ async function executeToolInner(
|
|
|
2586
2768
|
parentMessages,
|
|
2587
2769
|
interaction,
|
|
2588
2770
|
sessionId,
|
|
2771
|
+
turnId,
|
|
2772
|
+
toolCallId,
|
|
2589
2773
|
hostManagedToolPolicy,
|
|
2590
2774
|
externalToolDescriptors,
|
|
2591
2775
|
externalToolExecutors,
|
|
@@ -3158,9 +3342,8 @@ async function executeToolInner(
|
|
|
3158
3342
|
// from an ambient system command in the process audit log.
|
|
3159
3343
|
let pluginBinProvenance = null;
|
|
3160
3344
|
try {
|
|
3161
|
-
const { resolvePluginBinCommand } =
|
|
3162
|
-
"../lib/plugin-runtime/bin.js"
|
|
3163
|
-
);
|
|
3345
|
+
const { resolvePluginBinCommand } =
|
|
3346
|
+
await import("../lib/plugin-runtime/bin.js");
|
|
3164
3347
|
pluginBinProvenance = resolvePluginBinCommand(args.command, { cwd });
|
|
3165
3348
|
} catch {
|
|
3166
3349
|
pluginBinProvenance = null;
|
|
@@ -3551,12 +3734,15 @@ async function executeToolInner(
|
|
|
3551
3734
|
// command-execution bypass for a prompt-injected agent. Quoted args (a
|
|
3552
3735
|
// commit message) keep their content via the quote-aware tokenizer.
|
|
3553
3736
|
const gitArgs = tokenizeShellWords(normalizedCommand);
|
|
3554
|
-
const res =
|
|
3737
|
+
const res = _gitProcessDeps.run("git", gitArgs, {
|
|
3555
3738
|
cwd: args.cwd || cwd,
|
|
3556
3739
|
encoding: "utf8",
|
|
3557
3740
|
timeout: 60000,
|
|
3558
3741
|
maxBuffer: 1024 * 1024,
|
|
3559
3742
|
windowsHide: true,
|
|
3743
|
+
origin: "agent-core:git-command",
|
|
3744
|
+
policy: "allow",
|
|
3745
|
+
scope: "agent-core",
|
|
3560
3746
|
});
|
|
3561
3747
|
const readOnly = isReadOnlyGitCommand(normalizedCommand);
|
|
3562
3748
|
if (res.error) {
|
|
@@ -3807,16 +3993,62 @@ async function executeToolInner(
|
|
|
3807
3993
|
multiSelect: args.multiSelect === true,
|
|
3808
3994
|
timeoutMs:
|
|
3809
3995
|
typeof args.timeoutMs === "number" ? args.timeoutMs : 60000,
|
|
3996
|
+
defaultValue: args.defaultValue,
|
|
3997
|
+
onTimeout: args.onTimeout || "error",
|
|
3998
|
+
onReject: args.onReject || "error",
|
|
3810
3999
|
sessionId,
|
|
4000
|
+
turnId,
|
|
4001
|
+
toolUseId: toolCallId,
|
|
3811
4002
|
});
|
|
3812
4003
|
return attachDescriptor({ answer });
|
|
3813
4004
|
} catch (err) {
|
|
3814
|
-
|
|
4005
|
+
const failureKind =
|
|
4006
|
+
err?.code === "USER_TIMEOUT"
|
|
4007
|
+
? "timeout"
|
|
4008
|
+
: [
|
|
4009
|
+
"USER_REJECTED",
|
|
4010
|
+
"INTERACTION_REJECTED",
|
|
4011
|
+
"INTERACTION_CANCELLED",
|
|
4012
|
+
].includes(err?.code)
|
|
4013
|
+
? "reject"
|
|
4014
|
+
: null;
|
|
4015
|
+
const strategy =
|
|
4016
|
+
failureKind === "timeout"
|
|
4017
|
+
? args.onTimeout || "error"
|
|
4018
|
+
: failureKind === "reject"
|
|
4019
|
+
? args.onReject || "error"
|
|
4020
|
+
: "error";
|
|
4021
|
+
if (failureKind && strategy === "useDefault") {
|
|
4022
|
+
if (!Object.prototype.hasOwnProperty.call(args, "defaultValue")) {
|
|
4023
|
+
return attachDescriptor({
|
|
4024
|
+
error: `${failureKind === "timeout" ? "user_timeout" : "user_rejected"}: useDefault requires defaultValue`,
|
|
4025
|
+
});
|
|
4026
|
+
}
|
|
4027
|
+
return attachDescriptor({
|
|
4028
|
+
answer: args.defaultValue,
|
|
4029
|
+
fallback: "default",
|
|
4030
|
+
reason: failureKind,
|
|
4031
|
+
});
|
|
4032
|
+
}
|
|
4033
|
+
if (failureKind && strategy === "skip") {
|
|
4034
|
+
return attachDescriptor({
|
|
4035
|
+
answer: null,
|
|
4036
|
+
skipped: true,
|
|
4037
|
+
reason: failureKind,
|
|
4038
|
+
});
|
|
4039
|
+
}
|
|
4040
|
+
if (failureKind === "timeout") {
|
|
3815
4041
|
return attachDescriptor({
|
|
3816
4042
|
error: "user_timeout",
|
|
3817
4043
|
hint: "User did not respond in time. Proceed with best judgement.",
|
|
3818
4044
|
});
|
|
3819
4045
|
}
|
|
4046
|
+
if (failureKind === "reject") {
|
|
4047
|
+
return attachDescriptor({
|
|
4048
|
+
error: "user_rejected",
|
|
4049
|
+
hint: "The user declined this question. Do not assume consent.",
|
|
4050
|
+
});
|
|
4051
|
+
}
|
|
3820
4052
|
return attachDescriptor({
|
|
3821
4053
|
error: `ask_user_question failed: ${err.message}`,
|
|
3822
4054
|
});
|
|
@@ -4157,7 +4389,7 @@ async function executeToolInner(
|
|
|
4157
4389
|
};
|
|
4158
4390
|
try {
|
|
4159
4391
|
if (!fs.existsSync(root)) continue;
|
|
4160
|
-
const output =
|
|
4392
|
+
const output = runSearchProcess(cmd, {
|
|
4161
4393
|
cwd: root,
|
|
4162
4394
|
encoding: "utf8",
|
|
4163
4395
|
timeout: 10000,
|
|
@@ -4345,7 +4577,7 @@ async function executeToolInner(
|
|
|
4345
4577
|
: "No skills found. Make sure you're in the ChainlessChain project root or have skills installed.",
|
|
4346
4578
|
});
|
|
4347
4579
|
}
|
|
4348
|
-
|
|
4580
|
+
let match = allSkills.find(
|
|
4349
4581
|
(s) => s.id === args.skill_name || s.dirName === args.skill_name,
|
|
4350
4582
|
);
|
|
4351
4583
|
if (!match || !match.hasHandler) {
|
|
@@ -4353,6 +4585,20 @@ async function executeToolInner(
|
|
|
4353
4585
|
error: `Skill "${args.skill_name}" not found or has no handler. Use list_skills to see available skills.`,
|
|
4354
4586
|
});
|
|
4355
4587
|
}
|
|
4588
|
+
try {
|
|
4589
|
+
if (typeof skillLoader.materializeSkill === "function") {
|
|
4590
|
+
match = skillLoader.materializeSkill(match, {
|
|
4591
|
+
sessionId,
|
|
4592
|
+
turnId,
|
|
4593
|
+
loadedBecause: "run_skill",
|
|
4594
|
+
bodyIncluded: false,
|
|
4595
|
+
});
|
|
4596
|
+
}
|
|
4597
|
+
} catch (error) {
|
|
4598
|
+
return attachDescriptor({
|
|
4599
|
+
error: `Skill "${args.skill_name}" body could not be loaded: ${error.message}`,
|
|
4600
|
+
});
|
|
4601
|
+
}
|
|
4356
4602
|
|
|
4357
4603
|
// Check if skill requests isolation (via SKILL.md frontmatter)
|
|
4358
4604
|
const skillIsolation = match.isolation === true;
|
|
@@ -4428,7 +4674,7 @@ async function executeToolInner(
|
|
|
4428
4674
|
onWarn: (msg) => {
|
|
4429
4675
|
// Non-fatal — logged as warning, skipped servers captured
|
|
4430
4676
|
// in mountResult.skipped.
|
|
4431
|
-
|
|
4677
|
+
|
|
4432
4678
|
console.warn(msg);
|
|
4433
4679
|
},
|
|
4434
4680
|
});
|
|
@@ -4458,6 +4704,7 @@ async function executeToolInner(
|
|
|
4458
4704
|
const taskContext = {
|
|
4459
4705
|
projectRoot: cwd,
|
|
4460
4706
|
workspacePath: cwd,
|
|
4707
|
+
processBroker: createSkillProcessBroker(match),
|
|
4461
4708
|
// Expose the MCP client + mounted servers so the skill handler
|
|
4462
4709
|
// can call MCP tools directly without going through the agent
|
|
4463
4710
|
// loop. Handlers that don't need MCP can ignore these.
|
|
@@ -4510,6 +4757,11 @@ async function executeToolInner(
|
|
|
4510
4757
|
s.category.toLowerCase().includes(q),
|
|
4511
4758
|
);
|
|
4512
4759
|
}
|
|
4760
|
+
skillLoader.recordDescriptorUse?.(skills, {
|
|
4761
|
+
sessionId,
|
|
4762
|
+
turnId,
|
|
4763
|
+
loadedBecause: "list_skills",
|
|
4764
|
+
});
|
|
4513
4765
|
return attachDescriptor({
|
|
4514
4766
|
count: skills.length,
|
|
4515
4767
|
skills: skills.map((s) => ({
|
|
@@ -4763,7 +5015,7 @@ async function _executeRunCode(args, cwd) {
|
|
|
4763
5015
|
const start = Date.now();
|
|
4764
5016
|
let output;
|
|
4765
5017
|
try {
|
|
4766
|
-
output =
|
|
5018
|
+
output = runCodeProcess(interpreter, [scriptPath], {
|
|
4767
5019
|
cwd,
|
|
4768
5020
|
encoding: "utf8",
|
|
4769
5021
|
timeout: timeoutSec * 1000,
|
|
@@ -4863,12 +5115,18 @@ async function _executeRunCode(args, cwd) {
|
|
|
4863
5115
|
|
|
4864
5116
|
// Attempt pip install
|
|
4865
5117
|
try {
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
5118
|
+
runCodeProcess(
|
|
5119
|
+
interpreter,
|
|
5120
|
+
["-m", "pip", "install", packageName],
|
|
5121
|
+
{
|
|
5122
|
+
cwd,
|
|
5123
|
+
encoding: "utf-8",
|
|
5124
|
+
timeout: 120000,
|
|
5125
|
+
maxBuffer: 2 * 1024 * 1024,
|
|
5126
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
5127
|
+
},
|
|
5128
|
+
"run-code-install",
|
|
5129
|
+
);
|
|
4872
5130
|
recordInstallAudit({
|
|
4873
5131
|
package: packageName,
|
|
4874
5132
|
interpreter,
|
|
@@ -4879,12 +5137,17 @@ async function _executeRunCode(args, cwd) {
|
|
|
4879
5137
|
|
|
4880
5138
|
// Retry execution
|
|
4881
5139
|
const retryStart = Date.now();
|
|
4882
|
-
const retryOutput =
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
5140
|
+
const retryOutput = runCodeProcess(
|
|
5141
|
+
interpreter,
|
|
5142
|
+
[scriptPath],
|
|
5143
|
+
{
|
|
5144
|
+
cwd,
|
|
5145
|
+
encoding: "utf8",
|
|
5146
|
+
timeout: timeoutSec * 1000,
|
|
5147
|
+
maxBuffer: 5 * 1024 * 1024,
|
|
5148
|
+
},
|
|
5149
|
+
"run-code-retry",
|
|
5150
|
+
);
|
|
4888
5151
|
const retryDuration = Date.now() - retryStart;
|
|
4889
5152
|
|
|
4890
5153
|
return {
|
|
@@ -5034,6 +5297,55 @@ export function safeStringifyToolResult(value) {
|
|
|
5034
5297
|
}
|
|
5035
5298
|
}
|
|
5036
5299
|
|
|
5300
|
+
function emitToolHookLifecycle({
|
|
5301
|
+
tool,
|
|
5302
|
+
args,
|
|
5303
|
+
result,
|
|
5304
|
+
error = null,
|
|
5305
|
+
sessionId = null,
|
|
5306
|
+
turnId = null,
|
|
5307
|
+
toolUseId = null,
|
|
5308
|
+
cwd = process.cwd(),
|
|
5309
|
+
}) {
|
|
5310
|
+
const failed = Boolean(error || result?.error);
|
|
5311
|
+
const base = {
|
|
5312
|
+
schema_version: 1,
|
|
5313
|
+
session_id: sessionId,
|
|
5314
|
+
turn_id: turnId,
|
|
5315
|
+
tool_use_id: toolUseId,
|
|
5316
|
+
tool_name: tool,
|
|
5317
|
+
duration_ms: Number(result?.toolTelemetryRecord?.durationMs || 0),
|
|
5318
|
+
cwd,
|
|
5319
|
+
};
|
|
5320
|
+
emitHooksV2Event(failed ? "PostToolUseFailure" : "PostToolUse", {
|
|
5321
|
+
...base,
|
|
5322
|
+
...(failed
|
|
5323
|
+
? {
|
|
5324
|
+
error_code:
|
|
5325
|
+
result?.error?.code ||
|
|
5326
|
+
result?.code ||
|
|
5327
|
+
(typeof error === "object" ? error?.code : null) ||
|
|
5328
|
+
"tool_error",
|
|
5329
|
+
}
|
|
5330
|
+
: {}),
|
|
5331
|
+
});
|
|
5332
|
+
if (!failed && GUARDED_FILE_MUTATION_TOOLS.has(tool)) {
|
|
5333
|
+
const changedPath =
|
|
5334
|
+
args?.path ||
|
|
5335
|
+
args?.filePath ||
|
|
5336
|
+
args?.file_path ||
|
|
5337
|
+
args?.targetPath ||
|
|
5338
|
+
args?.target_path ||
|
|
5339
|
+
null;
|
|
5340
|
+
emitHooksV2Event("FileChanged", {
|
|
5341
|
+
...base,
|
|
5342
|
+
path: changedPath == null ? null : String(changedPath),
|
|
5343
|
+
operation: tool,
|
|
5344
|
+
});
|
|
5345
|
+
}
|
|
5346
|
+
return failed;
|
|
5347
|
+
}
|
|
5348
|
+
|
|
5037
5349
|
/**
|
|
5038
5350
|
* Execute a spawn_sub_agent tool call.
|
|
5039
5351
|
* Creates an isolated SubAgentContext, runs it, and returns only the summary.
|
|
@@ -5618,10 +5930,7 @@ async function _executeSpawnSubAgent(args, ctx) {
|
|
|
5618
5930
|
task: subCtx.task,
|
|
5619
5931
|
background: payload?.background === true,
|
|
5620
5932
|
});
|
|
5621
|
-
} else if (
|
|
5622
|
-
type === "sub-agent.completed" ||
|
|
5623
|
-
type === "sub-agent.failed"
|
|
5624
|
-
) {
|
|
5933
|
+
} else if (type === "sub-agent.completed" || type === "sub-agent.failed") {
|
|
5625
5934
|
emitHooksV2Event("TaskCompleted", {
|
|
5626
5935
|
task_id: subCtx.id,
|
|
5627
5936
|
session_id: parentSessionId,
|
|
@@ -5700,6 +6009,8 @@ async function _executeSpawnSubAgent(args, ctx) {
|
|
|
5700
6009
|
outcome: null,
|
|
5701
6010
|
hookFeedback: null,
|
|
5702
6011
|
promise: null,
|
|
6012
|
+
recoveryBinding: () =>
|
|
6013
|
+
subCtx.recoveryBinding(entry.outcome?.result || null),
|
|
5703
6014
|
};
|
|
5704
6015
|
// Settle-capture wrapper: the stored promise NEVER rejects, so an
|
|
5705
6016
|
// unconsumed handle can't surface as an unhandled rejection.
|
|
@@ -5746,6 +6057,7 @@ async function _executeSpawnSubAgent(args, ctx) {
|
|
|
5746
6057
|
subAgentId: subCtx.id,
|
|
5747
6058
|
role: subCtx.role,
|
|
5748
6059
|
parentSessionId,
|
|
6060
|
+
childBinding: subCtx.recoveryBinding(),
|
|
5749
6061
|
note: "Sub-agent is running in the background. Its result will be delivered to you automatically in a later turn — continue with other work; the run will not finish before the result arrives.",
|
|
5750
6062
|
};
|
|
5751
6063
|
}
|
|
@@ -5793,6 +6105,7 @@ async function _executeSpawnSubAgent(args, ctx) {
|
|
|
5793
6105
|
subAgentId: subCtx.id,
|
|
5794
6106
|
role: subCtx.role,
|
|
5795
6107
|
parentSessionId,
|
|
6108
|
+
childBinding: subCtx.recoveryBinding(result),
|
|
5796
6109
|
summary: result.summary,
|
|
5797
6110
|
toolsUsed: result.toolsUsed,
|
|
5798
6111
|
iterationCount: result.iterationCount,
|
|
@@ -5824,6 +6137,7 @@ async function _executeSpawnSubAgent(args, ctx) {
|
|
|
5824
6137
|
subAgentId: subCtx.id,
|
|
5825
6138
|
role: subCtx.role,
|
|
5826
6139
|
parentSessionId,
|
|
6140
|
+
childBinding: subCtx.recoveryBinding(subCtx.result),
|
|
5827
6141
|
};
|
|
5828
6142
|
}
|
|
5829
6143
|
}
|
|
@@ -5914,7 +6228,7 @@ export async function chatWithTools(rawMessages, options) {
|
|
|
5914
6228
|
}),
|
|
5915
6229
|
});
|
|
5916
6230
|
if (!response.ok) {
|
|
5917
|
-
throw new Error(
|
|
6231
|
+
throw new Error(await formatProviderResponseError("ollama", response));
|
|
5918
6232
|
}
|
|
5919
6233
|
const data = await response.json();
|
|
5920
6234
|
if (data.prompt_eval_count || data.eval_count) {
|
|
@@ -6041,7 +6355,7 @@ export async function chatWithTools(rawMessages, options) {
|
|
|
6041
6355
|
});
|
|
6042
6356
|
|
|
6043
6357
|
if (!response.ok) {
|
|
6044
|
-
throw new Error(
|
|
6358
|
+
throw new Error(await formatProviderResponseError("anthropic", response));
|
|
6045
6359
|
}
|
|
6046
6360
|
|
|
6047
6361
|
const data = await response.json();
|
|
@@ -6148,7 +6462,7 @@ export async function chatWithTools(rawMessages, options) {
|
|
|
6148
6462
|
});
|
|
6149
6463
|
|
|
6150
6464
|
if (!response.ok) {
|
|
6151
|
-
throw new Error(
|
|
6465
|
+
throw new Error(await formatProviderResponseError(provider, response));
|
|
6152
6466
|
}
|
|
6153
6467
|
|
|
6154
6468
|
const data = await response.json();
|
|
@@ -6271,23 +6585,9 @@ export function _streamErrorDisposition(err, signal, partialText) {
|
|
|
6271
6585
|
* means a missing/invalid API key for the ACTIVE provider — and because the
|
|
6272
6586
|
* provider is resolved from config, a surprise "anthropic 401" usually means
|
|
6273
6587
|
* the effective provider differs from what the user configured. Name the
|
|
6274
|
-
* provider and point at the
|
|
6275
|
-
* exported for tests.
|
|
6588
|
+
* provider and point at the appropriate key, billing, or permission fix
|
|
6589
|
+
* instead of dumping a bare status code. Pure + exported for tests.
|
|
6276
6590
|
*/
|
|
6277
|
-
export function formatProviderHttpError(provider, status) {
|
|
6278
|
-
const base = `${provider} API error: HTTP ${status}`;
|
|
6279
|
-
if (status === 401 || status === 403) {
|
|
6280
|
-
return (
|
|
6281
|
-
`${base} — authentication failed: the API key for provider "${provider}" ` +
|
|
6282
|
-
`is missing or invalid. Check "cc config get llm.provider" and ` +
|
|
6283
|
-
`"cc config get llm.apiKey" (or run Configure LLM). A surprise "${provider}" ` +
|
|
6284
|
-
`here usually means the effective provider differs from the one you configured.`
|
|
6285
|
-
);
|
|
6286
|
-
}
|
|
6287
|
-
if (status === 429) return `${base} — rate limited; please retry shortly.`;
|
|
6288
|
-
return base;
|
|
6289
|
-
}
|
|
6290
|
-
|
|
6291
6591
|
/**
|
|
6292
6592
|
* Is this error from a streaming chat request a transient API CONNECTION drop
|
|
6293
6593
|
* that is safe to retry? True only for genuine network failures (reset /
|
|
@@ -6481,7 +6781,7 @@ async function _chatOllamaStreaming(
|
|
|
6481
6781
|
body: JSON.stringify({ ...body, stream: true }),
|
|
6482
6782
|
});
|
|
6483
6783
|
if (!response.ok) {
|
|
6484
|
-
throw new Error(
|
|
6784
|
+
throw new Error(await formatProviderResponseError("ollama", response));
|
|
6485
6785
|
}
|
|
6486
6786
|
const state = _ollamaInitState();
|
|
6487
6787
|
const reader = response.body.getReader();
|
|
@@ -6667,7 +6967,7 @@ async function _chatAnthropicStreaming(
|
|
|
6667
6967
|
body: JSON.stringify(body),
|
|
6668
6968
|
});
|
|
6669
6969
|
if (!response.ok) {
|
|
6670
|
-
throw new Error(
|
|
6970
|
+
throw new Error(await formatProviderResponseError("anthropic", response));
|
|
6671
6971
|
}
|
|
6672
6972
|
const state = _anthropicInitState();
|
|
6673
6973
|
const reader = response.body.getReader();
|
|
@@ -6819,7 +7119,7 @@ async function _chatOpenAIStreaming(
|
|
|
6819
7119
|
body: JSON.stringify(body),
|
|
6820
7120
|
});
|
|
6821
7121
|
if (!response.ok) {
|
|
6822
|
-
throw new Error(
|
|
7122
|
+
throw new Error(await formatProviderResponseError(provider, response));
|
|
6823
7123
|
}
|
|
6824
7124
|
const state = _openaiInitState();
|
|
6825
7125
|
const reader = response.body.getReader();
|
|
@@ -7249,6 +7549,10 @@ export async function* agentLoop(messages, options) {
|
|
|
7249
7549
|
cwd: options.cwd || process.cwd(),
|
|
7250
7550
|
planManager: options.planManager || null,
|
|
7251
7551
|
sessionId: options.sessionId || null,
|
|
7552
|
+
// One agentLoop invocation represents one user turn even when it performs
|
|
7553
|
+
// several model/tool iterations. Hosts may supply their persisted turn id;
|
|
7554
|
+
// otherwise the run id is the stable in-process binding.
|
|
7555
|
+
turnId: options.turnId || runId,
|
|
7252
7556
|
hostManagedToolPolicy: options.hostManagedToolPolicy || null,
|
|
7253
7557
|
externalToolDescriptors: options.externalToolDescriptors || null,
|
|
7254
7558
|
externalToolExecutors: options.externalToolExecutors || null,
|
|
@@ -7678,6 +7982,7 @@ export async function* agentLoop(messages, options) {
|
|
|
7678
7982
|
role: entry.role,
|
|
7679
7983
|
error: entry.outcome?.error || null,
|
|
7680
7984
|
summary: entry.outcome?.result?.summary || null,
|
|
7985
|
+
childBinding: entry.recoveryBinding?.() || null,
|
|
7681
7986
|
};
|
|
7682
7987
|
}
|
|
7683
7988
|
}
|
|
@@ -7821,6 +8126,7 @@ export async function* agentLoop(messages, options) {
|
|
|
7821
8126
|
role: entry.role,
|
|
7822
8127
|
error: entry.outcome?.error || null,
|
|
7823
8128
|
summary: entry.outcome?.result?.summary || null,
|
|
8129
|
+
childBinding: entry.recoveryBinding?.() || null,
|
|
7824
8130
|
};
|
|
7825
8131
|
}
|
|
7826
8132
|
continue;
|
|
@@ -7944,9 +8250,9 @@ export async function* agentLoop(messages, options) {
|
|
|
7944
8250
|
let toolArgs;
|
|
7945
8251
|
try {
|
|
7946
8252
|
toolArgs =
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
8253
|
+
typeof call.function.arguments === "string"
|
|
8254
|
+
? JSON.parse(call.function.arguments)
|
|
8255
|
+
: call.function.arguments;
|
|
7950
8256
|
} catch {
|
|
7951
8257
|
toolArgs = {};
|
|
7952
8258
|
}
|
|
@@ -7966,6 +8272,8 @@ export async function* agentLoop(messages, options) {
|
|
|
7966
8272
|
type: "tool-executing",
|
|
7967
8273
|
tool: call.function.name,
|
|
7968
8274
|
args: toolArgs,
|
|
8275
|
+
tool_use_id: call.id,
|
|
8276
|
+
turn_id: `${runId}:t${budget.consumed}`,
|
|
7969
8277
|
};
|
|
7970
8278
|
const { result: toolResult, error: toolError } = await promise;
|
|
7971
8279
|
throwIfAborted(signal);
|
|
@@ -7981,6 +8289,12 @@ export async function* agentLoop(messages, options) {
|
|
|
7981
8289
|
tool: call.function.name,
|
|
7982
8290
|
result: toolResult,
|
|
7983
8291
|
error: toolError,
|
|
8292
|
+
tool_use_id: call.id,
|
|
8293
|
+
turn_id: `${runId}:t${budget.consumed}`,
|
|
8294
|
+
permission_decision_id: permissionDecisionId(
|
|
8295
|
+
call.id,
|
|
8296
|
+
toolResult?.policy,
|
|
8297
|
+
),
|
|
7984
8298
|
};
|
|
7985
8299
|
messages.push({
|
|
7986
8300
|
role: "tool",
|
|
@@ -8009,6 +8323,8 @@ export async function* agentLoop(messages, options) {
|
|
|
8009
8323
|
tool: "(unknown)",
|
|
8010
8324
|
result: { error: reason },
|
|
8011
8325
|
error: reason,
|
|
8326
|
+
tool_use_id: call?.id || null,
|
|
8327
|
+
turn_id: `${runId}:t${budget.consumed}`,
|
|
8012
8328
|
};
|
|
8013
8329
|
messages.push({
|
|
8014
8330
|
role: "tool",
|
|
@@ -8035,9 +8351,22 @@ export async function* agentLoop(messages, options) {
|
|
|
8035
8351
|
toolName,
|
|
8036
8352
|
toolArgs,
|
|
8037
8353
|
);
|
|
8038
|
-
if (cpId)
|
|
8354
|
+
if (cpId)
|
|
8355
|
+
yield {
|
|
8356
|
+
type: "checkpoint",
|
|
8357
|
+
id: cpId,
|
|
8358
|
+
tool: toolName,
|
|
8359
|
+
tool_use_id: call.id,
|
|
8360
|
+
turn_id: `${runId}:t${budget.consumed}`,
|
|
8361
|
+
};
|
|
8039
8362
|
|
|
8040
|
-
yield {
|
|
8363
|
+
yield {
|
|
8364
|
+
type: "tool-executing",
|
|
8365
|
+
tool: toolName,
|
|
8366
|
+
args: toolArgs,
|
|
8367
|
+
tool_use_id: call.id,
|
|
8368
|
+
turn_id: `${runId}:t${budget.consumed}`,
|
|
8369
|
+
};
|
|
8041
8370
|
|
|
8042
8371
|
let toolResult;
|
|
8043
8372
|
let toolError = null;
|
|
@@ -8134,6 +8463,12 @@ export async function* agentLoop(messages, options) {
|
|
|
8134
8463
|
tool: toolName,
|
|
8135
8464
|
result: toolResult,
|
|
8136
8465
|
error: toolError,
|
|
8466
|
+
tool_use_id: call.id,
|
|
8467
|
+
turn_id: `${runId}:t${budget.consumed}`,
|
|
8468
|
+
permission_decision_id: permissionDecisionId(
|
|
8469
|
+
call.id,
|
|
8470
|
+
toolResult?.policy,
|
|
8471
|
+
),
|
|
8137
8472
|
};
|
|
8138
8473
|
|
|
8139
8474
|
messages.push({
|