chainlesschain 0.166.82 → 0.166.84
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/package.json +1 -1
- package/src/assets/linux-subreaper/linux-arm64/manifest.json +1 -1
- package/src/assets/linux-subreaper/linux-x64/manifest.json +1 -1
- package/src/assets/web-panel/assets/{AIOps-DMzLSUWK.js → AIOps-OYLnAlB5.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-CgnA23oA.js → ActionButton-uc9kbLR6.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-CtXmm8Qe.js → Analytics-BH901FG0.js} +3 -3
- package/src/assets/web-panel/assets/{AppLayout-C5RIh5jA.js → AppLayout-qypKb8GL.js} +5 -5
- package/src/assets/web-panel/assets/{Artifacts-DM525zx0.js → Artifacts-Q-uPWyLY.js} +1 -1
- package/src/assets/web-panel/assets/{Audit-ChBx6f2l.js → Audit-B8hMGMim.js} +1 -1
- package/src/assets/web-panel/assets/{BackgroundAgents-BBHDxCda.js → BackgroundAgents-BSs8rJL_.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-B-qzCAoM.js → Backup-2YMU_nCd.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-C5yoIWAD.js → BaseInput-DyMppTuT.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-NmTrci9a.js → Chat-B5QGMaDO.js} +5 -5
- package/src/assets/web-panel/assets/ChatBubbleRenderer-B8ts_JnN.js +1 -0
- package/src/assets/web-panel/assets/{Checkbox-KdFSU3vd.js → Checkbox-DAvtgEGd.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-L__BOv_4.js → Codegen-BSChEVM3.js} +1 -1
- package/src/assets/web-panel/assets/{Col-Dfuw4IQV.js → Col-G0zYohIP.js} +1 -1
- package/src/assets/web-panel/assets/{Community-BRlEhSbx.js → Community-CzCN0B_p.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-D7dRkv8n.js → Compact-DrIN3G8z.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-CdlFYNR3.js → Compliance-CIsLa64Z.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-Ey7ksHq4.js → Cowork-CGYoafsB.js} +3 -3
- package/src/assets/web-panel/assets/{Cron-DBH__wGJ.js → Cron-DJ1JPXuH.js} +2 -2
- package/src/assets/web-panel/assets/{Crosschain-D3nu9dw7.js → Crosschain-B-IqVFJl.js} +1 -1
- package/src/assets/web-panel/assets/{DID-DS6vZBNv.js → DID-CAAczPz_.js} +2 -2
- package/src/assets/web-panel/assets/{Dashboard-DwFRk2T0.js → Dashboard-Dkpel8VE.js} +2 -2
- package/src/assets/web-panel/assets/{Dropdown-D7b73q3I.js → Dropdown-ETNBf8-Z.js} +1 -1
- package/src/assets/web-panel/assets/{EmailListRenderer-DPNaVH36.js → EmailListRenderer-CJGDyjVD.js} +1 -1
- package/src/assets/web-panel/assets/{EvolutionSettings-BEsOtdpf.js → EvolutionSettings-CL_hvVYe.js} +1 -1
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-ijSqsSsF.js → FamilyGuardDashboard-iexOh6Dh.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-C0BOzPDh.js → Federation-DnDHvV5D.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-DkF5NoAg.js → FormItemContext-DLCDJjUp.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-DQsMcyJj.js → GenericCardRenderer-CaCgXCjS.js} +1 -1
- package/src/assets/web-panel/assets/{Git-DQRt88PU.js → Git-BVm-euUF.js} +2 -2
- package/src/assets/web-panel/assets/{Governance-DIjPmDN8.js → Governance-DPnUvLWr.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-BWMFtT7i.js → Inference-5qCWSYKl.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-M7TfkUVl.js → KnowledgeGraph-DXdv2oEh.js} +1 -1
- package/src/assets/web-panel/assets/Logs-BF2f7bBA.js +2 -0
- package/src/assets/web-panel/assets/MarkdownRenderer-qNJS3ygh.js +1 -0
- package/src/assets/web-panel/assets/{Marketplace-Crd9MYHg.js → Marketplace-Bp-0Y7Ng.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-C37yOQV0.js → McpTools-dm-Xdi63.js} +2 -2
- package/src/assets/web-panel/assets/{Memory-BBsijJCd.js → Memory-TBHK031z.js} +2 -2
- package/src/assets/web-panel/assets/{MobileBridge-CiXIQCju.js → MobileBridge-BTILAlds.js} +1 -1
- package/src/assets/web-panel/assets/{MobileProjects-C0KSvQm5.js → MobileProjects-DC0Clgzs.js} +1 -1
- package/src/assets/web-panel/assets/{Mtc-C0XaQsOY.js → Mtc-BvyWkmRw.js} +2 -2
- package/src/assets/web-panel/assets/{MtcAudit-DPqggKhw.js → MtcAudit-D7ksLoNa.js} +2 -2
- package/src/assets/web-panel/assets/{Multisig-Bie0ZVHe.js → Multisig-Dpzu7X1t.js} +3 -3
- package/src/assets/web-panel/assets/{NLProgramming-BbuJlQ5b.js → NLProgramming-DZ0ADHSB.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-CgqrJV8w.js → Notes-hIdkmRug.js} +4 -4
- package/src/assets/web-panel/assets/{NotificationSettings-CusdZEQl.js → NotificationSettings-R3jyP6Vf.js} +1 -1
- package/src/assets/web-panel/assets/{OrderTableRenderer-B7RrCvCQ.js → OrderTableRenderer-d1zrFkqx.js} +1 -1
- package/src/assets/web-panel/assets/{Organization-BnFpz3bb.js → Organization-DoA5WMcc.js} +4 -4
- package/src/assets/web-panel/assets/{Overflow-C_4_HyyZ.js → Overflow-DHjIloAQ.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-D0KpHxeg.js → P2P-2TMon_Wy.js} +2 -2
- package/src/assets/web-panel/assets/PdhVaultBrowser-DEUxGSWO.js +7 -0
- package/src/assets/web-panel/assets/{Permissions-D2LxL66N.js → Permissions-CxKcZ-8X.js} +4 -4
- package/src/assets/web-panel/assets/{PersonalDataHub-CvSNIxt0.js → PersonalDataHub-CcYtkHqc.js} +4 -4
- package/src/assets/web-panel/assets/{Pipeline-rUl-SM7V.js → Pipeline-BxwOuq22.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-BD8cWSNd.js → Privacy-VIx9pdsH.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-RM7J4X2F.js → ProjectInit-COjp_erK.js} +2 -2
- package/src/assets/web-panel/assets/{ProjectSettings-BIH38RsB.js → ProjectSettings-x9NrZU80.js} +2 -2
- package/src/assets/web-panel/assets/Projects-DMgkw7QJ.js +1 -0
- package/src/assets/web-panel/assets/{Providers-B9Kja2RK.js → Providers-B_fR7Y7Y.js} +1 -1
- package/src/assets/web-panel/assets/{QrScannerModal-ByDKowTD.js → QrScannerModal-BUvzrn3V.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-DqEN1QOE.js → QuickAsk-C0sJwLy2.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-CLrYwNiv.js → Recommend-CJC7Wpce.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-DyDltVPC.js → RemoteSession-B62J6ZP0.js} +3 -3
- package/src/assets/web-panel/assets/{Reputation-BfP8rJ1-.js → Reputation-4f48kVBn.js} +1 -1
- package/src/assets/web-panel/assets/{Row-BpnP6r1H.js → Row-EzEMaYoV.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-CBNI1lCN.js → RssFeed-Dy0wD83j.js} +3 -3
- package/src/assets/web-panel/assets/{Search-CLjrM-xj.js → Search-GeVRHQND.js} +1 -1
- package/src/assets/web-panel/assets/{Security-dRXtg-Mq.js → Security-omLr1J7w.js} +3 -3
- package/src/assets/web-panel/assets/{Services-DAHCtOHL.js → Services-DmGPaDAs.js} +2 -2
- package/src/assets/web-panel/assets/{Skeleton-D11Jgtur.js → Skeleton-CAla21Gm.js} +1 -1
- package/src/assets/web-panel/assets/{Skills-DchvTO4k.js → Skills-QqEyIKOI.js} +1 -1
- package/src/assets/web-panel/assets/{Sla-BFOc2SbL.js → Sla-Cwi15-pZ.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-Dud1xDd2.js → SpeechSettings-Cs8Zi1J8.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-CILfsA2S.js → SyncSettings-ipuJsDKP.js} +2 -2
- package/src/assets/web-panel/assets/{Tasks-C6Qrah_5.js → Tasks-BbVAg9Z7.js} +1 -1
- package/src/assets/web-panel/assets/{Templates--puiHyCR.js → Templates-slUp9yXF.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-cz5vITz_.js → Tenant-6edCSG5K.js} +1 -1
- package/src/assets/web-panel/assets/{Terminal-YRs75Gz8.js → Terminal-DKq84G3h.js} +2 -2
- package/src/assets/web-panel/assets/{TimelineRenderer-C5myb_QZ.js → TimelineRenderer-Dg0Aw6se.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-Bk60iMIj.js → Tokens-D63h7qYd.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-BAb-Fd4z.js → Trigger-F7gTP_gv.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-BlqwmpEB.js → Trust-zw8Zqp8k.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-C6jvuF-7.js → UkeySign-C-YBUmod.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-7zbsdQUj.js → VideoEditing-AhVxTgmC.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-BAouk_kp.js → Wallet-C58zxjIg.js} +4 -4
- package/src/assets/web-panel/assets/{WebAuthn-BQapv504.js → WebAuthn-D-n-rlfI.js} +5 -5
- package/src/assets/web-panel/assets/{WorkflowEditor-ChUXM-Qx.js → WorkflowEditor-Ddc8gGD4.js} +1 -1
- package/src/assets/web-panel/assets/{chat-7B6U8zgJ.js → chat-C66V_U7w.js} +1 -1
- package/src/assets/web-panel/assets/{colors-C8UqaLpe.js → colors-BcJyVZRj.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-x47giTCj.js → compact-item-UgUXWcgP.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-D6ZwjgaZ.js → createContext-oxEKHKYP.js} +1 -1
- package/src/assets/web-panel/assets/devWarning-BoDvrsgY.js +1 -0
- package/src/assets/web-panel/assets/{hasIn-Cv3d9-Bu.js → hasIn-CbqzrKQO.js} +1 -1
- package/src/assets/web-panel/assets/{index-BM-NYjej.js → index-7lSY8B9T.js} +1 -1
- package/src/assets/web-panel/assets/{index-CUUgXcPh.js → index-B-h0Jgtj.js} +1 -1
- package/src/assets/web-panel/assets/{index-CrGQsbpb.js → index-BMOY4PSW.js} +1 -1
- package/src/assets/web-panel/assets/{index-DvoMGeL9.js → index-BNIq0NAn.js} +1 -1
- package/src/assets/web-panel/assets/{index-nogjrcQE.js → index-BQlGMcZ9.js} +1 -1
- package/src/assets/web-panel/assets/{index-C1ElqYDD.js → index-BT2PZ9df.js} +1 -1
- package/src/assets/web-panel/assets/{index-yYdCdtY1.js → index-BZ7mv_oS.js} +1 -1
- package/src/assets/web-panel/assets/{index-N9hNOl1i.js → index-BdFgUn1S.js} +1 -1
- package/src/assets/web-panel/assets/index-BhqRbl5P.js +1 -0
- package/src/assets/web-panel/assets/{index-DVBG0Jqz.js → index-Bmhw_Ler.js} +1 -1
- package/src/assets/web-panel/assets/{index-Dv5E07PZ.js → index-Bp9rfr-P.js} +1 -1
- package/src/assets/web-panel/assets/{index-BTBkdyLk.js → index-BpqJNeIj.js} +1 -1
- package/src/assets/web-panel/assets/{index-EDWA9JL1.js → index-BrWZmUdA.js} +1 -1
- package/src/assets/web-panel/assets/{index-DtBUgc0G.js → index-Bu1A2sXy.js} +1 -1
- package/src/assets/web-panel/assets/{index-BMPk5D1m.js → index-C-p9hhAz.js} +1 -1
- package/src/assets/web-panel/assets/{index-D9lFBkS4.js → index-C3j9jTfB.js} +1 -1
- package/src/assets/web-panel/assets/{index-DLHnYXVa.js → index-C6X26RJu.js} +1 -1
- package/src/assets/web-panel/assets/{index-jgN2e0Oy.js → index-CH13yc9x.js} +1 -1
- package/src/assets/web-panel/assets/{index-CXG6yiAf.js → index-CJluGB2F.js} +1 -1
- package/src/assets/web-panel/assets/{index-CQ0-ny-o.js → index-CM2S5TJZ.js} +1 -1
- package/src/assets/web-panel/assets/{index-B7Dorc7r.js → index-CUmYwZyf.js} +1 -1
- package/src/assets/web-panel/assets/{index-IVelXaiQ.js → index-CrG-1Kqs.js} +1 -1
- package/src/assets/web-panel/assets/{index-Cc2bhSuI.js → index-Crqqbu-W.js} +1 -1
- package/src/assets/web-panel/assets/{index-DD-V-N_m.js → index-CuZupgUw.js} +3 -3
- package/src/assets/web-panel/assets/{index-BUzw-kDo.js → index-D3xNhHF3.js} +1 -1
- package/src/assets/web-panel/assets/{index-Ce666S9v.js → index-D8rgeCoC.js} +1 -1
- package/src/assets/web-panel/assets/{index-Cbf4RqOd.js → index-DAIuMvVR.js} +1 -1
- package/src/assets/web-panel/assets/{index-BGxo1YH0.js → index-DBEL07sa.js} +1 -1
- package/src/assets/web-panel/assets/{index-BTisPSqa.js → index-DMbJ06sF.js} +1 -1
- package/src/assets/web-panel/assets/{index-CXIUyx4U.js → index-DO-5vgTW.js} +1 -1
- package/src/assets/web-panel/assets/{index-CUtcWTSe.js → index-DR4YKlLt.js} +1 -1
- package/src/assets/web-panel/assets/{index-D4ZHX6wo.js → index-DRrxJygS.js} +1 -1
- package/src/assets/web-panel/assets/{index-CiVEatgH.js → index-DWFNv_EG.js} +1 -1
- package/src/assets/web-panel/assets/index-DreT6MIR.js +1 -0
- package/src/assets/web-panel/assets/{index-Dc0hePXV.js → index-Ov77O9mH.js} +1 -1
- package/src/assets/web-panel/assets/{index-Cc6jr0Yb.js → index-RnxuL8wM.js} +1 -1
- package/src/assets/web-panel/assets/{index-dbM4QvQZ.js → index-SzGgAqai.js} +1 -1
- package/src/assets/web-panel/assets/{index-CaPZ_8kP.js → index-UpN_kC9R.js} +1 -1
- package/src/assets/web-panel/assets/{index-WhoNHp50.js → index-YvNh1UdB.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-DkKS5xtR.js → initDefaultProps-BK9ncFiF.js} +1 -1
- package/src/assets/web-panel/assets/{motion-CU-zBUIg.js → motion-BxzXi1Pe.js} +1 -1
- package/src/assets/web-panel/assets/{move-zBE0VEd4.js → move-CRmwRuah.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-B9WyO1je.js → mtc-parser-BQq5_Znx.js} +1 -1
- package/src/assets/web-panel/assets/{omit-6sCoBNTL.js → omit-Ch4VNY2j.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-DDRv_sFc.js → pickAttrs-CUioBhrz.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-Cy_CBDw5.js → placementArrow-Hj3o1CrW.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-CIczLq9K.js → responsiveObserve-PfqJrlkI.js} +1 -1
- package/src/assets/web-panel/assets/{slide-DFfZCvnG.js → slide-BXcnR-Lu.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-DW-0HUl-.js → statusUtils-C74a-ofo.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-BPYaBorP.js → styleChecker-Bq57I3ls.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-DYPoOaZc.js → useFlexGapSupport-ITPUjcDw.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-ODUEWR17.js → useFs-DzPuXDIS.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-CstUt15X.js → usePersonalDataHub-DYSgt9L5.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-D2GW8xCL.js → vnode-NPs_EJEk.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-Bz6GoDwq.js → zoom-DZzO6KVS.js} +1 -1
- package/src/assets/web-panel/index.html +1 -1
- package/src/commands/agent.js +21 -10
- package/src/data/changelog.json +39 -0
- package/src/gateways/ws/session-protocol.js +19 -5
- package/src/gateways/ws/ws-agent-handler.js +6 -0
- package/src/gateways/ws/ws-session-gateway.js +133 -21
- package/src/lib/agent-execution-policy.js +177 -0
- package/src/lib/authority-launch-environment.js +99 -0
- package/src/lib/claude-project-auto-memory.js +7 -30
- package/src/lib/evolution/volcengine-function-replay-store.js +38 -28
- package/src/lib/host-tool-policy-authority.js +151 -0
- package/src/lib/permission-authority.js +109 -6
- package/src/lib/plugin-runtime/settings.js +9 -1
- package/src/lib/sandbox-egress-authority-monitor.js +3 -2
- package/src/lib/scoped-permission-store.js +229 -119
- package/src/lib/session-manager.js +20 -5
- package/src/lib/settings-authority-domain.cjs +966 -0
- package/src/lib/settings-authority-record.cjs +701 -0
- package/src/lib/settings-loader.cjs +175 -19
- package/src/lib/settings-source-observation.cjs +278 -0
- package/src/lib/sub-agent-context.js +36 -18
- package/src/lib/unattended-action-policy.js +456 -38
- package/src/repl/agent-repl.js +43 -15
- package/src/repl/repl-tool-executor.js +39 -0
- package/src/runtime/agent-core.js +272 -5
- package/src/runtime/agent-runtime.js +15 -3
- package/src/runtime/headless-runner.js +13 -4
- package/src/runtime/headless-stream.js +9 -0
- package/src/runtime/policies/agent-policy.js +5 -4
- package/src/assets/web-panel/assets/ChatBubbleRenderer-pPuUDG2V.js +0 -1
- package/src/assets/web-panel/assets/Logs-BZv9Z6BY.js +0 -2
- package/src/assets/web-panel/assets/MarkdownRenderer-D5NZGdg3.js +0 -1
- package/src/assets/web-panel/assets/PdhVaultBrowser-Cfd_C9nc.js +0 -7
- package/src/assets/web-panel/assets/Projects-CTgx3Fxc.js +0 -1
- package/src/assets/web-panel/assets/devWarning-BFfV5AtN.js +0 -1
- package/src/assets/web-panel/assets/index-DUz_bv5i.js +0 -1
- package/src/assets/web-panel/assets/index-rQ59l7GO.js +0 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
captureAgentExecutionPolicy,
|
|
3
|
+
resolveAgentToolSelection,
|
|
4
|
+
} from "../lib/agent-execution-policy.js";
|
|
5
|
+
import {
|
|
6
|
+
executeTool as coreExecuteTool,
|
|
7
|
+
getAgentToolDefinitions,
|
|
8
|
+
} from "../runtime/agent-core.js";
|
|
9
|
+
|
|
10
|
+
/** Direct /auto and /plan tools share the startup ceiling and live permissions. */
|
|
11
|
+
export function createReplToolExecutor(options, readLiveContext) {
|
|
12
|
+
const policy = captureAgentExecutionPolicy(options);
|
|
13
|
+
const selection = resolveAgentToolSelection(policy);
|
|
14
|
+
const ceiling =
|
|
15
|
+
selection.enabledToolNames !== null || selection.disabledTools.length > 0
|
|
16
|
+
? Object.freeze(
|
|
17
|
+
getAgentToolDefinitions({
|
|
18
|
+
names: selection.enabledToolNames,
|
|
19
|
+
disabledTools: selection.disabledTools,
|
|
20
|
+
exactToolNames: true,
|
|
21
|
+
}).map((tool) => tool.function.name),
|
|
22
|
+
)
|
|
23
|
+
: null;
|
|
24
|
+
return (name, args, context = {}) => {
|
|
25
|
+
const live = readLiveContext();
|
|
26
|
+
return coreExecuteTool(name, args, {
|
|
27
|
+
...live,
|
|
28
|
+
...policy,
|
|
29
|
+
// Managed settings may tighten the explicit startup option while the
|
|
30
|
+
// REPL loads. Neither source can turn off the other's classifier.
|
|
31
|
+
classifyAllShell:
|
|
32
|
+
policy.classifyAllShell === true || live.classifyAllShell === true,
|
|
33
|
+
effectiveAllowedToolNames: ceiling,
|
|
34
|
+
sessionId: context.sessionId || null,
|
|
35
|
+
sessionBudget: context.sessionBudget || null,
|
|
36
|
+
signal: context.signal || null,
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -56,6 +56,11 @@ const { startSkillInvocation, settleSkillInvocation } = skillInvocationReceipt;
|
|
|
56
56
|
import sharedCodingAgentPolicy from "./coding-agent-policy.cjs";
|
|
57
57
|
import sharedShellPolicy from "./coding-agent-shell-policy.cjs";
|
|
58
58
|
import sharedPermissionRules from "../lib/permission-rules.cjs";
|
|
59
|
+
import { permissionRulesProviderAuthority } from "../lib/permission-authority.js";
|
|
60
|
+
import {
|
|
61
|
+
captureHostToolPolicyAuthority,
|
|
62
|
+
hostToolPolicyAuthorityForChild,
|
|
63
|
+
} from "../lib/host-tool-policy-authority.js";
|
|
59
64
|
import sharedSettingsHooks from "../lib/settings-hooks.cjs";
|
|
60
65
|
import sharedHookEvents from "../lib/settings-hook-events.js";
|
|
61
66
|
import {
|
|
@@ -148,7 +153,12 @@ import {
|
|
|
148
153
|
admitTool,
|
|
149
154
|
buildToolAttribution,
|
|
150
155
|
} from "../lib/agent-tool-admission.js";
|
|
151
|
-
import {
|
|
156
|
+
import { captureAgentExecutionPolicy } from "../lib/agent-execution-policy.js";
|
|
157
|
+
import {
|
|
158
|
+
evaluateUnattendedToolAction,
|
|
159
|
+
evaluateUnattendedGitAction,
|
|
160
|
+
evaluateUnattendedShellAction,
|
|
161
|
+
} from "../lib/unattended-action-policy.js";
|
|
152
162
|
import {
|
|
153
163
|
formatProviderHttpError,
|
|
154
164
|
formatProviderResponseError,
|
|
@@ -2416,6 +2426,7 @@ function projectPermissionAuthority({ authority, rules, tool, args, cwd }) {
|
|
|
2416
2426
|
scoped: authority?.scoped || null,
|
|
2417
2427
|
version: authority?.version || authority?.policyVersion || null,
|
|
2418
2428
|
revision: authority?.revision ?? null,
|
|
2429
|
+
settingsRevision: authority?.settingsRevision || null,
|
|
2419
2430
|
headHash: authority?.headHash || null,
|
|
2420
2431
|
verdict: {
|
|
2421
2432
|
decision: verdict.decision || null,
|
|
@@ -2550,6 +2561,114 @@ function snapshotApprovalPolicyAuthority(approvalGate, sessionId) {
|
|
|
2550
2561
|
*/
|
|
2551
2562
|
export async function executeTool(name, args, context = {}) {
|
|
2552
2563
|
const liveExecutionContext = context;
|
|
2564
|
+
try {
|
|
2565
|
+
const executionPolicy = captureAgentExecutionPolicy(context);
|
|
2566
|
+
context = {
|
|
2567
|
+
...context,
|
|
2568
|
+
...executionPolicy,
|
|
2569
|
+
};
|
|
2570
|
+
if (
|
|
2571
|
+
context.unattendedActionPolicy?.unattended === true &&
|
|
2572
|
+
["schedule", "git", "spawn_sub_agent"].includes(name)
|
|
2573
|
+
) {
|
|
2574
|
+
args = snapshotMcpJsonRpcInput(args || {});
|
|
2575
|
+
}
|
|
2576
|
+
} catch (error) {
|
|
2577
|
+
return {
|
|
2578
|
+
error:
|
|
2579
|
+
error.code === "CC_UNATTENDED_POLICY_INVALID"
|
|
2580
|
+
? "[Unattended Action] Invalid policy; tool execution was blocked."
|
|
2581
|
+
: "[Execution Policy] Invalid startup policy; tool execution was blocked.",
|
|
2582
|
+
policy: {
|
|
2583
|
+
decision: "deny",
|
|
2584
|
+
via:
|
|
2585
|
+
error.code === "CC_UNATTENDED_POLICY_INVALID"
|
|
2586
|
+
? "unattended-action-policy"
|
|
2587
|
+
: "agent-execution-policy",
|
|
2588
|
+
code: error.code,
|
|
2589
|
+
},
|
|
2590
|
+
};
|
|
2591
|
+
}
|
|
2592
|
+
let hostPolicyAuthority = null;
|
|
2593
|
+
let entryHostPolicySnapshot = null;
|
|
2594
|
+
try {
|
|
2595
|
+
hostPolicyAuthority = captureHostToolPolicyAuthority(
|
|
2596
|
+
context.hostManagedToolPolicyAuthority,
|
|
2597
|
+
);
|
|
2598
|
+
if (hostPolicyAuthority) {
|
|
2599
|
+
// Every call samples the same live owner before the first async boundary.
|
|
2600
|
+
// Decisions and their later revalidation use this immutable policy.
|
|
2601
|
+
entryHostPolicySnapshot = hostPolicyAuthority.getSnapshot();
|
|
2602
|
+
context = {
|
|
2603
|
+
...context,
|
|
2604
|
+
hostManagedToolPolicy: entryHostPolicySnapshot.policy,
|
|
2605
|
+
};
|
|
2606
|
+
}
|
|
2607
|
+
} catch (error) {
|
|
2608
|
+
return {
|
|
2609
|
+
error:
|
|
2610
|
+
"[Host Policy] Tool policy authority is unavailable; execution was blocked.",
|
|
2611
|
+
policy: {
|
|
2612
|
+
decision: "blocked",
|
|
2613
|
+
via: "host-policy-authority",
|
|
2614
|
+
code: error.code,
|
|
2615
|
+
},
|
|
2616
|
+
};
|
|
2617
|
+
}
|
|
2618
|
+
function assertHostPolicyRevision() {
|
|
2619
|
+
if (!hostPolicyAuthority) return;
|
|
2620
|
+
if (
|
|
2621
|
+
liveExecutionContext.hostManagedToolPolicyAuthority !==
|
|
2622
|
+
hostPolicyAuthority ||
|
|
2623
|
+
hostPolicyAuthority.getSnapshot() !== entryHostPolicySnapshot
|
|
2624
|
+
) {
|
|
2625
|
+
const error = new Error(
|
|
2626
|
+
"Host tool policy authority changed after admission",
|
|
2627
|
+
);
|
|
2628
|
+
error.code =
|
|
2629
|
+
name === "run_shell"
|
|
2630
|
+
? "CC_SHELL_POLICY_AUTHORITY_CHANGED"
|
|
2631
|
+
: "CC_HOST_TOOL_POLICY_AUTHORITY_CHANGED";
|
|
2632
|
+
throw error;
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
let settingsPermissionAuthority = null;
|
|
2636
|
+
let entrySettingsPermissionRevision = null;
|
|
2637
|
+
try {
|
|
2638
|
+
if (name === "run_shell") {
|
|
2639
|
+
settingsPermissionAuthority = permissionRulesProviderAuthority(
|
|
2640
|
+
context.permissionRulesProvider,
|
|
2641
|
+
);
|
|
2642
|
+
entrySettingsPermissionRevision =
|
|
2643
|
+
settingsPermissionAuthority?.getSnapshot() || null;
|
|
2644
|
+
}
|
|
2645
|
+
} catch (error) {
|
|
2646
|
+
return {
|
|
2647
|
+
error:
|
|
2648
|
+
"[Permission Authority] Settings authority is unavailable; execution was blocked.",
|
|
2649
|
+
policy: {
|
|
2650
|
+
decision: "blocked",
|
|
2651
|
+
via: "permission-authority-load",
|
|
2652
|
+
code: error.code,
|
|
2653
|
+
},
|
|
2654
|
+
};
|
|
2655
|
+
}
|
|
2656
|
+
function assertSettingsPermissionRevision() {
|
|
2657
|
+
if (!settingsPermissionAuthority) return;
|
|
2658
|
+
if (
|
|
2659
|
+
permissionRulesProviderAuthority(
|
|
2660
|
+
liveExecutionContext.permissionRulesProvider,
|
|
2661
|
+
) !== settingsPermissionAuthority ||
|
|
2662
|
+
settingsPermissionAuthority.getSnapshot() !==
|
|
2663
|
+
entrySettingsPermissionRevision
|
|
2664
|
+
) {
|
|
2665
|
+
const error = new Error(
|
|
2666
|
+
"Settings permission authority changed after admission",
|
|
2667
|
+
);
|
|
2668
|
+
error.code = "CC_SHELL_POLICY_AUTHORITY_CHANGED";
|
|
2669
|
+
throw error;
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2553
2672
|
let admittedApprovalGate = null;
|
|
2554
2673
|
let admittedApprovalPolicyDigest = null;
|
|
2555
2674
|
let entryPlanManager = null;
|
|
@@ -2736,6 +2855,22 @@ export async function executeTool(name, args, context = {}) {
|
|
|
2736
2855
|
}
|
|
2737
2856
|
const runtimeDescriptor =
|
|
2738
2857
|
getRuntimeToolDescriptor(name) || localToolDescriptor;
|
|
2858
|
+
if (context.unattendedActionPolicy?.unattended === true) {
|
|
2859
|
+
const verdict = evaluateUnattendedToolAction(
|
|
2860
|
+
name,
|
|
2861
|
+
args,
|
|
2862
|
+
context.unattendedActionPolicy,
|
|
2863
|
+
{
|
|
2864
|
+
external: Boolean(localToolExecutor),
|
|
2865
|
+
},
|
|
2866
|
+
);
|
|
2867
|
+
if (!verdict.allow)
|
|
2868
|
+
return {
|
|
2869
|
+
error: `[Unattended Action] ${verdict.reason}; tool was not run.`,
|
|
2870
|
+
unattendedAction: verdict,
|
|
2871
|
+
policy: { decision: "deny", via: "unattended-action-policy" },
|
|
2872
|
+
};
|
|
2873
|
+
}
|
|
2739
2874
|
let admittedToolAdmissionDigest = null;
|
|
2740
2875
|
let toolAdmissionEvaluation;
|
|
2741
2876
|
try {
|
|
@@ -2884,11 +3019,13 @@ export async function executeTool(name, args, context = {}) {
|
|
|
2884
3019
|
let effectivePermissionRules = context.permissionRules || null;
|
|
2885
3020
|
if (typeof context.permissionRulesProvider === "function") {
|
|
2886
3021
|
try {
|
|
3022
|
+
assertSettingsPermissionRevision();
|
|
2887
3023
|
permissionAuthority = await context.permissionRulesProvider({
|
|
2888
3024
|
cwd,
|
|
2889
3025
|
tool: name,
|
|
2890
3026
|
args,
|
|
2891
3027
|
});
|
|
3028
|
+
assertSettingsPermissionRevision();
|
|
2892
3029
|
effectivePermissionRules =
|
|
2893
3030
|
permissionAuthority?.rules || permissionAuthority || null;
|
|
2894
3031
|
if (
|
|
@@ -3389,9 +3526,11 @@ export async function executeTool(name, args, context = {}) {
|
|
|
3389
3526
|
let shellDispatchPolicyAuthority = null;
|
|
3390
3527
|
if (name === "run_shell") {
|
|
3391
3528
|
try {
|
|
3529
|
+
assertSettingsPermissionRevision();
|
|
3392
3530
|
const permissionRulesProvider = context.permissionRulesProvider || null;
|
|
3393
3531
|
const approvalGate = context.approvalGate || null;
|
|
3394
3532
|
const initialProjection = {
|
|
3533
|
+
hostAuthority: hostPolicyAuthority?.getSnapshot() || null,
|
|
3395
3534
|
permission: projectPermissionAuthority({
|
|
3396
3535
|
authority: permissionAuthority,
|
|
3397
3536
|
rules: validatePermissionRuleset(effectivePermissionRules),
|
|
@@ -3424,6 +3563,7 @@ export async function executeTool(name, args, context = {}) {
|
|
|
3424
3563
|
classifyAllShell: context.classifyAllShell === true,
|
|
3425
3564
|
};
|
|
3426
3565
|
if (
|
|
3566
|
+
initialProjection.hostAuthority !== entryHostPolicySnapshot ||
|
|
3427
3567
|
approvalGate !== admittedApprovalGate ||
|
|
3428
3568
|
digestPolicyAuthority(initialProjection.approval) !==
|
|
3429
3569
|
admittedApprovalPolicyDigest ||
|
|
@@ -3450,6 +3590,18 @@ export async function executeTool(name, args, context = {}) {
|
|
|
3450
3590
|
? digestPolicyAuthority(context.sandbox)
|
|
3451
3591
|
: null;
|
|
3452
3592
|
shellDispatchPolicyAuthority = Object.freeze({
|
|
3593
|
+
...(settingsPermissionAuthority
|
|
3594
|
+
? {
|
|
3595
|
+
subscribeSettingsPermissionRevision:
|
|
3596
|
+
settingsPermissionAuthority.subscribePolicyRevision,
|
|
3597
|
+
}
|
|
3598
|
+
: {}),
|
|
3599
|
+
...(hostPolicyAuthority
|
|
3600
|
+
? {
|
|
3601
|
+
subscribeHostPolicyRevision:
|
|
3602
|
+
hostPolicyAuthority.subscribePolicyRevision,
|
|
3603
|
+
}
|
|
3604
|
+
: {}),
|
|
3453
3605
|
policyVersion: `cc-shell-policy-authority/v1:${initialDigest}`,
|
|
3454
3606
|
revalidateDockerSandbox() {
|
|
3455
3607
|
if (
|
|
@@ -3464,6 +3616,8 @@ export async function executeTool(name, args, context = {}) {
|
|
|
3464
3616
|
},
|
|
3465
3617
|
async revalidate() {
|
|
3466
3618
|
try {
|
|
3619
|
+
assertHostPolicyRevision();
|
|
3620
|
+
assertSettingsPermissionRevision();
|
|
3467
3621
|
if (
|
|
3468
3622
|
(liveExecutionContext.permissionRulesProvider || null) !==
|
|
3469
3623
|
permissionRulesProvider ||
|
|
@@ -3489,7 +3643,9 @@ export async function executeTool(name, args, context = {}) {
|
|
|
3489
3643
|
currentPermissionAuthority ||
|
|
3490
3644
|
null;
|
|
3491
3645
|
}
|
|
3646
|
+
assertSettingsPermissionRevision();
|
|
3492
3647
|
const currentProjection = {
|
|
3648
|
+
hostAuthority: hostPolicyAuthority?.getSnapshot() || null,
|
|
3493
3649
|
permission: projectPermissionAuthority({
|
|
3494
3650
|
authority: currentPermissionAuthority,
|
|
3495
3651
|
rules: validatePermissionRuleset(currentPermissionRules),
|
|
@@ -3498,7 +3654,9 @@ export async function executeTool(name, args, context = {}) {
|
|
|
3498
3654
|
cwd,
|
|
3499
3655
|
}),
|
|
3500
3656
|
host: selectedHostToolPolicy(
|
|
3501
|
-
|
|
3657
|
+
hostPolicyAuthority
|
|
3658
|
+
? entryHostPolicySnapshot.policy
|
|
3659
|
+
: liveExecutionContext.hostManagedToolPolicy || null,
|
|
3502
3660
|
name,
|
|
3503
3661
|
),
|
|
3504
3662
|
plan: snapshotPlanToolAuthority(planManager, name, args),
|
|
@@ -3511,8 +3669,9 @@ export async function executeTool(name, args, context = {}) {
|
|
|
3511
3669
|
tool: name,
|
|
3512
3670
|
runtimeDescriptor,
|
|
3513
3671
|
localToolDescriptor,
|
|
3514
|
-
hostManagedToolPolicy:
|
|
3515
|
-
|
|
3672
|
+
hostManagedToolPolicy: hostPolicyAuthority
|
|
3673
|
+
? entryHostPolicySnapshot.policy
|
|
3674
|
+
: liveExecutionContext.hostManagedToolPolicy,
|
|
3516
3675
|
}).projection,
|
|
3517
3676
|
approval: snapshotApprovalPolicyAuthority(
|
|
3518
3677
|
approvalGate,
|
|
@@ -3656,6 +3815,19 @@ export async function executeTool(name, args, context = {}) {
|
|
|
3656
3815
|
}
|
|
3657
3816
|
}
|
|
3658
3817
|
|
|
3818
|
+
try {
|
|
3819
|
+
assertHostPolicyRevision();
|
|
3820
|
+
} catch (error) {
|
|
3821
|
+
return {
|
|
3822
|
+
error:
|
|
3823
|
+
"[Host Policy] Tool policy changed during admission; execution was blocked.",
|
|
3824
|
+
policy: {
|
|
3825
|
+
decision: "blocked",
|
|
3826
|
+
via: "host-policy-authority",
|
|
3827
|
+
code: error.code,
|
|
3828
|
+
},
|
|
3829
|
+
};
|
|
3830
|
+
}
|
|
3659
3831
|
let sessionBudgetTool = null;
|
|
3660
3832
|
if (typeof context.sessionBudget?.beginTool === "function") {
|
|
3661
3833
|
const toolBinding = JSON.stringify({
|
|
@@ -3734,6 +3906,7 @@ export async function executeTool(name, args, context = {}) {
|
|
|
3734
3906
|
permissionRulesProvider: context.permissionRulesProvider || null,
|
|
3735
3907
|
effectiveAllowedToolNames: context.effectiveAllowedToolNames ?? null,
|
|
3736
3908
|
hostManagedToolPolicy: context.hostManagedToolPolicy || null,
|
|
3909
|
+
hostManagedToolPolicyAuthority: hostPolicyAuthority,
|
|
3737
3910
|
externalToolDescriptors: context.externalToolDescriptors || null,
|
|
3738
3911
|
externalToolExecutors: context.externalToolExecutors || null,
|
|
3739
3912
|
mcpClient: context.mcpClient || null,
|
|
@@ -5266,8 +5439,10 @@ async function executeToolInner(
|
|
|
5266
5439
|
workflowEffectProtocol = null,
|
|
5267
5440
|
planManager = null,
|
|
5268
5441
|
permissionRules = null,
|
|
5442
|
+
permissionRulesProvider = null,
|
|
5269
5443
|
effectiveAllowedToolNames = null,
|
|
5270
5444
|
hostManagedToolPolicy,
|
|
5445
|
+
hostManagedToolPolicyAuthority = null,
|
|
5271
5446
|
externalToolDescriptors,
|
|
5272
5447
|
externalToolExecutors,
|
|
5273
5448
|
extraToolDefinitions = null,
|
|
@@ -6722,6 +6897,8 @@ async function executeToolInner(
|
|
|
6722
6897
|
let authorityMonitor = null;
|
|
6723
6898
|
let removePlanAuthorityListener = null;
|
|
6724
6899
|
let removeApprovalAuthorityListener = null;
|
|
6900
|
+
let removeHostAuthorityListener = null;
|
|
6901
|
+
let removeSettingsAuthorityListener = null;
|
|
6725
6902
|
if (needsEgress) {
|
|
6726
6903
|
try {
|
|
6727
6904
|
const { startEgressProxyWorker } =
|
|
@@ -6826,6 +7003,43 @@ async function executeToolInner(
|
|
|
6826
7003
|
);
|
|
6827
7004
|
}
|
|
6828
7005
|
}
|
|
7006
|
+
if (
|
|
7007
|
+
typeof shellDispatchPolicyAuthority?.subscribeHostPolicyRevision ===
|
|
7008
|
+
"function"
|
|
7009
|
+
) {
|
|
7010
|
+
removeHostAuthorityListener =
|
|
7011
|
+
shellDispatchPolicyAuthority.subscribeHostPolicyRevision(() => {
|
|
7012
|
+
const error = new Error(
|
|
7013
|
+
"Host tool policy changed during Docker egress execution",
|
|
7014
|
+
);
|
|
7015
|
+
error.code = "CC_SHELL_POLICY_AUTHORITY_CHANGED";
|
|
7016
|
+
authorityMonitor.revoke(error);
|
|
7017
|
+
});
|
|
7018
|
+
if (typeof removeHostAuthorityListener !== "function")
|
|
7019
|
+
throw new TypeError(
|
|
7020
|
+
"host policy subscription must return an unsubscribe function",
|
|
7021
|
+
);
|
|
7022
|
+
}
|
|
7023
|
+
if (
|
|
7024
|
+
typeof shellDispatchPolicyAuthority?.subscribeSettingsPermissionRevision ===
|
|
7025
|
+
"function"
|
|
7026
|
+
) {
|
|
7027
|
+
removeSettingsAuthorityListener =
|
|
7028
|
+
shellDispatchPolicyAuthority.subscribeSettingsPermissionRevision(
|
|
7029
|
+
() => {
|
|
7030
|
+
const error = new Error(
|
|
7031
|
+
"Settings permission policy changed during Docker egress execution",
|
|
7032
|
+
);
|
|
7033
|
+
error.code = "CC_SHELL_POLICY_AUTHORITY_CHANGED";
|
|
7034
|
+
authorityMonitor.revoke(error);
|
|
7035
|
+
},
|
|
7036
|
+
);
|
|
7037
|
+
if (typeof removeSettingsAuthorityListener !== "function") {
|
|
7038
|
+
throw new TypeError(
|
|
7039
|
+
"settings revision subscription must return an unsubscribe function",
|
|
7040
|
+
);
|
|
7041
|
+
}
|
|
7042
|
+
}
|
|
6829
7043
|
authorityMonitor.start();
|
|
6830
7044
|
await authorityMonitor.checkNow();
|
|
6831
7045
|
} else {
|
|
@@ -6889,6 +7103,8 @@ async function executeToolInner(
|
|
|
6889
7103
|
});
|
|
6890
7104
|
}
|
|
6891
7105
|
} finally {
|
|
7106
|
+
removeSettingsAuthorityListener?.();
|
|
7107
|
+
removeHostAuthorityListener?.();
|
|
6892
7108
|
removeApprovalAuthorityListener?.();
|
|
6893
7109
|
removePlanAuthorityListener?.();
|
|
6894
7110
|
authorityMonitor?.stop();
|
|
@@ -7228,6 +7444,18 @@ async function executeToolInner(
|
|
|
7228
7444
|
// command-execution bypass for a prompt-injected agent. Quoted args (a
|
|
7229
7445
|
// commit message) keep their content via the quote-aware tokenizer.
|
|
7230
7446
|
const gitArgs = tokenizeShellWords(normalizedCommand);
|
|
7447
|
+
if (unattendedActionPolicy?.unattended === true) {
|
|
7448
|
+
const verdict = evaluateUnattendedGitAction(gitArgs, {
|
|
7449
|
+
...unattendedActionPolicy,
|
|
7450
|
+
attended: false,
|
|
7451
|
+
});
|
|
7452
|
+
if (!verdict.allow)
|
|
7453
|
+
return attachDescriptor({
|
|
7454
|
+
error: `[Unattended Action] ${verdict.reason}; git command was not run.`,
|
|
7455
|
+
unattendedAction: verdict,
|
|
7456
|
+
policy: { decision: "deny", via: "unattended-action-policy" },
|
|
7457
|
+
});
|
|
7458
|
+
}
|
|
7231
7459
|
const res = _gitProcessDeps.run("git", gitArgs, {
|
|
7232
7460
|
cwd: args.cwd || cwd,
|
|
7233
7461
|
encoding: "utf8",
|
|
@@ -7379,8 +7607,10 @@ async function executeToolInner(
|
|
|
7379
7607
|
// these boundaries; it never reconstructs a fresh default policy.
|
|
7380
7608
|
planManager,
|
|
7381
7609
|
permissionRules,
|
|
7610
|
+
permissionRulesProvider,
|
|
7382
7611
|
effectiveAllowedToolNames,
|
|
7383
7612
|
hostManagedToolPolicy,
|
|
7613
|
+
hostManagedToolPolicyAuthority,
|
|
7384
7614
|
sandbox,
|
|
7385
7615
|
additionalDirectories,
|
|
7386
7616
|
approvalGate,
|
|
@@ -8687,6 +8917,7 @@ async function executeToolInner(
|
|
|
8687
8917
|
...(sessionBudget ? { sessionBudget } : {}),
|
|
8688
8918
|
...(hostResourceBudget ? { hostResourceBudget } : {}),
|
|
8689
8919
|
...(permissionRules ? { permissionRules } : {}),
|
|
8920
|
+
...(permissionRulesProvider ? { permissionRulesProvider } : {}),
|
|
8690
8921
|
...(hostManagedToolPolicy
|
|
8691
8922
|
? {
|
|
8692
8923
|
hostManagedToolPolicy: {
|
|
@@ -8695,6 +8926,14 @@ async function executeToolInner(
|
|
|
8695
8926
|
},
|
|
8696
8927
|
}
|
|
8697
8928
|
: {}),
|
|
8929
|
+
...(hostManagedToolPolicyAuthority
|
|
8930
|
+
? {
|
|
8931
|
+
hostManagedToolPolicyAuthority:
|
|
8932
|
+
hostToolPolicyAuthorityForChild(
|
|
8933
|
+
hostManagedToolPolicyAuthority,
|
|
8934
|
+
),
|
|
8935
|
+
}
|
|
8936
|
+
: {}),
|
|
8698
8937
|
...(planManager ? { planManager } : {}),
|
|
8699
8938
|
...(sandbox ? { sandbox } : {}),
|
|
8700
8939
|
...(Array.isArray(additionalDirectories)
|
|
@@ -11059,6 +11298,13 @@ async function _executeSpawnSubAgent(args, ctx) {
|
|
|
11059
11298
|
...(childHostManagedToolPolicy
|
|
11060
11299
|
? { hostManagedToolPolicy: childHostManagedToolPolicy }
|
|
11061
11300
|
: {}),
|
|
11301
|
+
...(ctx.hostManagedToolPolicyAuthority
|
|
11302
|
+
? {
|
|
11303
|
+
hostManagedToolPolicyAuthority: hostToolPolicyAuthorityForChild(
|
|
11304
|
+
ctx.hostManagedToolPolicyAuthority,
|
|
11305
|
+
),
|
|
11306
|
+
}
|
|
11307
|
+
: {}),
|
|
11062
11308
|
...(ctx.planManager ? { planManager: ctx.planManager } : {}),
|
|
11063
11309
|
...(ctx.sandbox ? { sandbox: ctx.sandbox } : {}),
|
|
11064
11310
|
...(Array.isArray(ctx.additionalDirectories)
|
|
@@ -11333,6 +11579,16 @@ async function _executeSpawnSubAgent(args, ctx) {
|
|
|
11333
11579
|
// ─── LLM chat with tools ─────────────────────────────────────────────────
|
|
11334
11580
|
|
|
11335
11581
|
function getEffectiveToolDefinitions(options = {}) {
|
|
11582
|
+
const hostAuthority = captureHostToolPolicyAuthority(
|
|
11583
|
+
options.hermeticExecution === true
|
|
11584
|
+
? null
|
|
11585
|
+
: options.hostManagedToolPolicyAuthority,
|
|
11586
|
+
);
|
|
11587
|
+
const hostPolicy = hostAuthority
|
|
11588
|
+
? hostAuthority.getSnapshot().policy
|
|
11589
|
+
: options.hermeticExecution === true
|
|
11590
|
+
? null
|
|
11591
|
+
: options.hostManagedToolPolicy;
|
|
11336
11592
|
const persona =
|
|
11337
11593
|
options.hermeticExecution === true
|
|
11338
11594
|
? null
|
|
@@ -11349,7 +11605,7 @@ function getEffectiveToolDefinitions(options = {}) {
|
|
|
11349
11605
|
disabledTools: mergedDisabledTools,
|
|
11350
11606
|
exactToolNames: options.exactToolNames === true,
|
|
11351
11607
|
extraTools: [
|
|
11352
|
-
...(
|
|
11608
|
+
...(hostPolicy?.toolDefinitions || []),
|
|
11353
11609
|
...(options.extraToolDefinitions || []),
|
|
11354
11610
|
],
|
|
11355
11611
|
});
|
|
@@ -14266,6 +14522,13 @@ function permissionDecision(callId, tool, result) {
|
|
|
14266
14522
|
}
|
|
14267
14523
|
|
|
14268
14524
|
export async function* agentLoop(messages, options) {
|
|
14525
|
+
const executionPolicy = captureAgentExecutionPolicy(options, {
|
|
14526
|
+
hermetic: true,
|
|
14527
|
+
});
|
|
14528
|
+
options = {
|
|
14529
|
+
...options,
|
|
14530
|
+
...executionPolicy,
|
|
14531
|
+
};
|
|
14269
14532
|
const configuredChatFn = options.chatFn;
|
|
14270
14533
|
const evolutionIngress =
|
|
14271
14534
|
options.evolutionIngress == null
|
|
@@ -14323,6 +14586,7 @@ export async function* agentLoop(messages, options) {
|
|
|
14323
14586
|
? {
|
|
14324
14587
|
...options,
|
|
14325
14588
|
hostManagedToolPolicy: null,
|
|
14589
|
+
hostManagedToolPolicyAuthority: null,
|
|
14326
14590
|
extraToolDefinitions: [],
|
|
14327
14591
|
}
|
|
14328
14592
|
: options;
|
|
@@ -14388,6 +14652,9 @@ export async function* agentLoop(messages, options) {
|
|
|
14388
14652
|
hostManagedToolPolicy: hermeticExecution
|
|
14389
14653
|
? null
|
|
14390
14654
|
: options.hostManagedToolPolicy || null,
|
|
14655
|
+
hostManagedToolPolicyAuthority: hermeticExecution
|
|
14656
|
+
? null
|
|
14657
|
+
: captureHostToolPolicyAuthority(options.hostManagedToolPolicyAuthority),
|
|
14391
14658
|
externalToolDescriptors: hermeticExecution
|
|
14392
14659
|
? null
|
|
14393
14660
|
: options.externalToolDescriptors || null,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
+
import { captureAgentExecutionPolicy } from "../lib/agent-execution-policy.js";
|
|
2
3
|
import { defaultOpenBrowser } from "../lib/mcp-oauth.js";
|
|
3
4
|
import path from "path";
|
|
4
5
|
import {
|
|
@@ -335,19 +336,30 @@ export class AgentRuntime {
|
|
|
335
336
|
}
|
|
336
337
|
|
|
337
338
|
async startAgentSession() {
|
|
339
|
+
const executionPolicy = captureAgentExecutionPolicy(this.policy);
|
|
340
|
+
const launchPolicy = Object.freeze({
|
|
341
|
+
...this.policy,
|
|
342
|
+
// Preserve the public envelope's absent optional fields. Captured null
|
|
343
|
+
// defaults still apply at the REPL entry, before its first await.
|
|
344
|
+
...Object.fromEntries(
|
|
345
|
+
Object.entries(executionPolicy).filter(([field]) =>
|
|
346
|
+
Object.hasOwn(this.policy, field),
|
|
347
|
+
),
|
|
348
|
+
),
|
|
349
|
+
});
|
|
338
350
|
if (this.evolutionIngress !== null) {
|
|
339
351
|
await this.evolutionIngress.start();
|
|
340
352
|
}
|
|
341
353
|
this.emit(RUNTIME_EVENTS.RUNTIME_START, {
|
|
342
354
|
kind: this.kind,
|
|
343
|
-
policy:
|
|
355
|
+
policy: launchPolicy,
|
|
344
356
|
});
|
|
345
357
|
this.emit(RUNTIME_EVENTS.SESSION_START, {
|
|
346
358
|
kind: this.kind,
|
|
347
|
-
sessionId:
|
|
359
|
+
sessionId: launchPolicy.sessionId || null,
|
|
348
360
|
});
|
|
349
361
|
const result = await this.deps.startAgentRepl({
|
|
350
|
-
...
|
|
362
|
+
...launchPolicy,
|
|
351
363
|
...this.runtimeAdmissionDependencies,
|
|
352
364
|
...(this.memoryPolicyReceiptWriter === null
|
|
353
365
|
? {}
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { randomUUID } from "node:crypto";
|
|
26
|
+
import { captureAgentExecutionPolicy } from "../lib/agent-execution-policy.js";
|
|
26
27
|
import { bootstrap } from "./bootstrap.js";
|
|
27
28
|
import {
|
|
28
29
|
buildSystemPrompt,
|
|
@@ -348,10 +349,7 @@ export function resolvePermissionMode(mode = "default") {
|
|
|
348
349
|
* @returns {string[]|null} null = all tools (subject to disabledTools)
|
|
349
350
|
*/
|
|
350
351
|
export function resolveEnabledTools({ allowedTools, readOnly } = {}) {
|
|
351
|
-
let names =
|
|
352
|
-
Array.isArray(allowedTools) && allowedTools.length > 0
|
|
353
|
-
? [...allowedTools]
|
|
354
|
-
: null;
|
|
352
|
+
let names = Array.isArray(allowedTools) ? [...allowedTools] : null;
|
|
355
353
|
if (readOnly) {
|
|
356
354
|
names = names
|
|
357
355
|
? names.filter((n) => READ_ONLY_TOOLS.includes(n))
|
|
@@ -626,6 +624,13 @@ async function withHeadlessSessionHostLease(options, deps, task) {
|
|
|
626
624
|
}
|
|
627
625
|
|
|
628
626
|
export async function runAgentHeadless(options = {}, deps = {}) {
|
|
627
|
+
const executionPolicy = captureAgentExecutionPolicy(options, {
|
|
628
|
+
hermetic: true,
|
|
629
|
+
});
|
|
630
|
+
options = {
|
|
631
|
+
...options,
|
|
632
|
+
...executionPolicy,
|
|
633
|
+
};
|
|
629
634
|
const trustedWorkspaceRoot = options.cwd || process.cwd();
|
|
630
635
|
const pipeState = { closed: false };
|
|
631
636
|
const stdout = deps.stdout || process.stdout;
|
|
@@ -2617,6 +2622,7 @@ async function runAgentHeadlessInWorkspace(
|
|
|
2617
2622
|
: { skillRetrievalRevocationReader }),
|
|
2618
2623
|
additionalDirectories,
|
|
2619
2624
|
sandbox: options.sandbox || null,
|
|
2625
|
+
shellPolicyOverrides: options.shellPolicyOverrides,
|
|
2620
2626
|
sessionId,
|
|
2621
2627
|
sessionBudget: options.sessionBudget || null,
|
|
2622
2628
|
hostResourceBudget,
|
|
@@ -2653,6 +2659,9 @@ async function runAgentHeadlessInWorkspace(
|
|
|
2653
2659
|
hermeticExecution,
|
|
2654
2660
|
iterationBudget: budget,
|
|
2655
2661
|
toolAdmission: hermeticExecution ? null : options.toolAdmission || null,
|
|
2662
|
+
unattendedActionPolicy: hermeticExecution
|
|
2663
|
+
? null
|
|
2664
|
+
: options.unattendedActionPolicy,
|
|
2656
2665
|
...(Object.keys(headlessInteraction).length > 0
|
|
2657
2666
|
? { interaction: headlessInteraction }
|
|
2658
2667
|
: {}),
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { randomUUID } from "node:crypto";
|
|
20
|
+
import { captureAgentExecutionPolicy } from "../lib/agent-execution-policy.js";
|
|
20
21
|
import { TaskWorklog } from "../lib/context-memory-kernel/task-worklog-port.js";
|
|
21
22
|
import { isProxy } from "node:util/types";
|
|
22
23
|
import {
|
|
@@ -1468,6 +1469,11 @@ async function withStreamSessionHostLease(options, deps, streamCleanup, task) {
|
|
|
1468
1469
|
}
|
|
1469
1470
|
|
|
1470
1471
|
export async function runAgentHeadlessStream(options = {}, deps = {}) {
|
|
1472
|
+
const executionPolicy = captureAgentExecutionPolicy(options);
|
|
1473
|
+
options = {
|
|
1474
|
+
...options,
|
|
1475
|
+
...executionPolicy,
|
|
1476
|
+
};
|
|
1471
1477
|
const trustedWorkspaceRoot = options.cwd || process.cwd();
|
|
1472
1478
|
const input = deps.input || process.stdin;
|
|
1473
1479
|
const pipeState = { closed: false };
|
|
@@ -3597,6 +3603,8 @@ async function runAgentHeadlessStreamInWorkspace(
|
|
|
3597
3603
|
apiKey,
|
|
3598
3604
|
cwd,
|
|
3599
3605
|
additionalDirectories,
|
|
3606
|
+
sandbox: options.sandbox,
|
|
3607
|
+
shellPolicyOverrides: options.shellPolicyOverrides,
|
|
3600
3608
|
...(skillOutcomeIndex === null ? {} : { skillOutcomeIndex }),
|
|
3601
3609
|
...captureSkillRuntimeDependencies(options, evolutionIngress?.tenantId),
|
|
3602
3610
|
...(skillVectorAuthority === null ? {} : { skillVectorAuthority }),
|
|
@@ -3624,6 +3632,7 @@ async function runAgentHeadlessStreamInWorkspace(
|
|
|
3624
3632
|
permissionRulesProvider,
|
|
3625
3633
|
settingsHooks,
|
|
3626
3634
|
toolAdmission: options.toolAdmission || null,
|
|
3635
|
+
unattendedActionPolicy: options.unattendedActionPolicy,
|
|
3627
3636
|
classifyAllShell,
|
|
3628
3637
|
enabledToolNames,
|
|
3629
3638
|
disabledTools,
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { captureAgentExecutionPolicy } from "../../lib/agent-execution-policy.js";
|
|
2
|
+
|
|
1
3
|
export function resolveAgentPolicy({
|
|
2
4
|
config = null,
|
|
3
5
|
overrides = {},
|
|
4
6
|
defaults = {},
|
|
5
7
|
} = {}) {
|
|
6
8
|
const llm = config?.llm || {};
|
|
9
|
+
const executionPolicy = captureAgentExecutionPolicy(overrides);
|
|
7
10
|
|
|
8
11
|
return {
|
|
9
12
|
model: overrides.model || llm.model || defaults.model || "qwen2:7b",
|
|
@@ -28,10 +31,8 @@ export function resolveAgentPolicy({
|
|
|
28
31
|
bundlePath: overrides.bundlePath || null,
|
|
29
32
|
remoteSessionRelayUrl: overrides.remoteSessionRelayUrl || null,
|
|
30
33
|
remoteSessionPeerId: overrides.remoteSessionPeerId || null,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
: [],
|
|
34
|
-
sandbox: overrides.sandbox || null,
|
|
34
|
+
...executionPolicy,
|
|
35
|
+
additionalDirectories: executionPolicy.additionalDirectories || [],
|
|
35
36
|
autoCheckpoint: overrides.autoCheckpoint === true,
|
|
36
37
|
// Managed workspace checkpoints are consumed by both headless runners and
|
|
37
38
|
// the interactive REPL. Keep these explicit because this policy is an
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as v,P as u,J as S,U as n,R as a,S as y,K as x,Q as C,V as w,_ as B,b as s}from"./vendor-Bn1JzzAn.js";import{_ as k}from"./index-DD-V-N_m.js";import"./icons-DG5UD-6K.js";const N={__name:"ChatBubbleRenderer",props:{event:{type:Object,required:!0}},setup(c,{expose:d}){d();const t=c,r=s(()=>{const e=t.event.content||{};return e.text||e.body||e.message||e.title||JSON.stringify(e).slice(0,200)}),i=s(()=>{const e=t.event.content||{};return e.from||e.sender||e.senderName||t.event.actor||"(unknown)"}),l=s(()=>{const e=(t.event.actor||"").toLowerCase();return e.includes("self")||e==="me"||e.endsWith("_self")}),o=s(()=>{const e=t.event.source.adapter||"";return e.startsWith("messaging-qq")?"magenta":e==="wechat"?"green":"blue"}),m=s(()=>{if(!t.event.occurredAt)return"";try{const e=new Date(t.event.occurredAt),p=e.getFullYear(),f=String(e.getMonth()+1).padStart(2,"0"),g=String(e.getDate()).padStart(2,"0"),b=String(e.getHours()).padStart(2,"0"),h=String(e.getMinutes()).padStart(2,"0");return`${p}-${f}-${g} ${b}:${h}`}catch{return""}}),_={props:t,messageText:r,actorLabel:i,isMine:l,adapterColor:o,formattedTime:m,computed:s};return Object.defineProperty(_,"__isScriptSetup",{enumerable:!1,value:!0}),_}},T={class:"bubble"},L={class:"meta"},M={class:"actor"},R={class:"time"},V={class:"body"};function q(c,d,t,r,i,l){const o=v("a-tag");return u(),S("div",{class:B(["chat-row",{mine:r.isMine}])},[n("div",T,[n("div",L,[n("span",M,a(r.actorLabel),1),n("span",R,a(r.formattedTime),1)]),n("div",V,a(r.messageText),1),t.event.source.adapter?(u(),y(o,{key:0,class:"src",color:r.adapterColor},{default:x(()=>[C(a(t.event.source.adapter),1)]),_:1},8,["color"])):w("v-if",!0)])],2)}const z=k(N,[["render",q],["__scopeId","data-v-49238629"],["__file","/tmp/cc-web-panel-UxuLZz/repo/packages/web-panel/src/components/pdh/renderers/ChatBubbleRenderer.vue"]]);export{z as default};
|