@askexenow/exe-os 0.9.374 → 0.9.376
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/deploy/compose/.env.customer.example +16 -1
- package/deploy/compose/.env.example +16 -1
- package/deploy/compose/docker-compose.yml +80 -18
- package/deploy/compose/gateway-watchdog.sh +17 -0
- package/deploy/compose/generate-env.ts +41 -1
- package/deploy/compose/sso-edge/default.conf.template +59 -63
- package/deploy/compose/sso-edge/error-pages/404.html +129 -0
- package/deploy/compose/sso-edge/error-pages/500.html +129 -0
- package/deploy/compose/sso-edge/error-pages/503.html +118 -0
- package/deploy/compose/sso-edge/sso-redirect.conf +115 -92
- package/dist/.dist-verified.json +3 -3
- package/dist/{active-agent-ONPPEWQV.js → active-agent-BOBBUJ74.js} +6 -6
- package/dist/{active-agent-UJKMG7LJ.js → active-agent-GFGEGK2U.js} +6 -6
- package/dist/{agent-defs-generator-ZWI6DXOE.js → agent-defs-generator-OX6UFPRX.js} +5 -5
- package/dist/{agent-loop-OYHJKNYH.js → agent-loop-7ZRH56EX.js} +1 -1
- package/dist/{agentic-ontology-WHFJ3QFS.js → agentic-ontology-DT3VOXBT.js} +1 -1
- package/dist/{backfill-metadata-3OUSQD5V.js → backfill-metadata-VRP6PTPP.js} +9 -9
- package/dist/{backup-verify-ZKTUYLTA.js → backup-verify-LWHKGOOV.js} +1 -1
- package/dist/behavior-injection-GMZKZ3BT.js +83 -0
- package/dist/behavior-promotion-QPC4AQ24.js +62 -0
- package/dist/{behaviors-ZJ45TFBJ.js → behaviors-GPI4BLTC.js} +16 -14
- package/dist/bin/agentic-ontology-backfill.js +10 -10
- package/dist/bin/agentic-reflection-backfill.js +11 -11
- package/dist/bin/agentic-semantic-label.js +10 -10
- package/dist/bin/backfill-conversations.js +14 -12
- package/dist/bin/backfill-responses.js +14 -12
- package/dist/bin/backfill-vectors.js +16 -14
- package/dist/bin/bulk-sync-postgres.js +21 -19
- package/dist/bin/cc-doctor.js +19 -11
- package/dist/bin/cleanup-stale-review-tasks.js +27 -26
- package/dist/bin/cli.js +83 -109
- package/dist/bin/daemon-restart-handoff.js +2 -1
- package/dist/bin/deferred-daemon-restart.js +118 -110
- package/dist/bin/exe-actions.js +176 -0
- package/dist/bin/exe-agent-config.js +5 -5
- package/dist/bin/exe-agent.js +23 -23
- package/dist/bin/exe-assign.js +16 -14
- package/dist/bin/exe-boot.js +91 -71
- package/dist/bin/exe-call.js +8 -8
- package/dist/bin/exe-cicd.js +1210 -0
- package/dist/bin/exe-cloud.js +70 -37
- package/dist/bin/exe-config-dump.js +5 -5
- package/dist/bin/exe-dispatch.js +28 -27
- package/dist/bin/exe-doctor.js +12 -11
- package/dist/bin/exe-export-behaviors.js +20 -18
- package/dist/bin/exe-forget.js +11 -11
- package/dist/bin/exe-gateway.js +10 -10
- package/dist/bin/exe-healthcheck.js +22 -10
- package/dist/bin/exe-heartbeat.js +33 -32
- package/dist/bin/exe-kill.js +32 -31
- package/dist/bin/exe-launch-agent.js +76 -54
- package/dist/bin/exe-mcp.js +10 -6
- package/dist/bin/exe-memory-reads.js +9 -9
- package/dist/bin/exe-model-supervisor.js +138 -0
- package/dist/bin/exe-new-employee.js +14 -14
- package/dist/bin/exe-os-mcp-proxy.js +10 -6
- package/dist/bin/exe-pending-messages.js +28 -27
- package/dist/bin/exe-pending-notifications.js +27 -26
- package/dist/bin/exe-pending-reviews.js +28 -27
- package/dist/bin/exe-rename.js +9 -9
- package/dist/bin/exe-repo-truth.js +1 -1
- package/dist/bin/exe-review.js +31 -30
- package/dist/bin/exe-search.js +10 -10
- package/dist/bin/exe-session-cleanup.js +32 -31
- package/dist/bin/exe-settings.js +21 -19
- package/dist/bin/exe-start-codex.js +31 -25
- package/dist/bin/exe-start-opencode.js +24 -22
- package/dist/bin/exe-start.sh +11 -2
- package/dist/bin/exe-status.js +29 -28
- package/dist/bin/exe-support.js +3 -3
- package/dist/bin/exe-team.js +7 -7
- package/dist/bin/exe-timers.js +2 -1
- package/dist/bin/exe-watchdog.js +170 -16
- package/dist/bin/generate-hook-manifest.js +8 -41
- package/dist/bin/git-sweep.js +28 -27
- package/dist/bin/graph-backfill.js +11 -11
- package/dist/bin/graph-export.js +10 -10
- package/dist/bin/hooks-cli.js +289 -0
- package/dist/bin/import-history.js +14 -14
- package/dist/bin/install.js +130 -116
- package/dist/bin/intercom-check.js +5 -5
- package/dist/bin/mcp-sessions.js +2 -2
- package/dist/bin/orchestration-metrics.js +7 -7
- package/dist/bin/postgres-agentic-reflection-backfill.js +4 -4
- package/dist/bin/postgres-agentic-semantic-backfill.js +4 -4
- package/dist/bin/pre-publish.js +1 -1
- package/dist/bin/reconcile-backlog.js +2 -2
- package/dist/bin/registry-proxy.js +2 -2
- package/dist/bin/scan-tasks.js +52 -38
- package/dist/bin/setup.js +1 -1
- package/dist/bin/shard-migrate.js +9 -9
- package/dist/bin/stack-update.js +10 -5
- package/dist/bin/verify-stack.js +3 -1
- package/dist/bin/vps-health-gate.js +1 -1
- package/dist/{boot-generation-JKVZ4ZAT.js → boot-generation-BN6GKASY.js} +6 -6
- package/dist/{boot-review-sections-2M6BTG73.js → boot-review-sections-OQ5JGSOD.js} +26 -25
- package/dist/{branch-hygiene-U5GFRSTP.js → branch-hygiene-QLD77IMJ.js} +1 -1
- package/dist/build-manifest.json +1186 -1106
- package/dist/{capability-cards-5IMJT6J7.js → capability-cards-EDZ62HKG.js} +5 -5
- package/dist/{capacity-monitor-SAXCQK7O.js → capacity-monitor-6GMTVILS.js} +28 -27
- package/dist/{catchup-brief-U2TXBLHD.js → catchup-brief-SGGBMDUP.js} +32 -31
- package/dist/{cc-binary-detect-6TNIY5JX.js → cc-binary-detect-ZR6WNOUU.js} +1 -3
- package/dist/{chunk-NKETJCB5.js → chunk-2ODXCCMR.js} +18 -3
- package/dist/{hook-integrity-KGAV6ZC2.js → chunk-3L72UBUH.js} +28 -15
- package/dist/chunk-3OX5S7KZ.js +273 -0
- package/dist/{chunk-W75GTHR3.js → chunk-3SRZNJKD.js} +1 -1
- package/dist/{chunk-I4DNJFDR.js → chunk-42IFYZUN.js} +4 -4
- package/dist/{chunk-JHI5WMK5.js → chunk-473JUDCT.js} +5 -5
- package/dist/{chunk-ANLFH23R.js → chunk-4F5CNI65.js} +1 -1
- package/dist/{chunk-AWWKRZMB.js → chunk-4KVSCQND.js} +87 -14
- package/dist/{chunk-ZCERWHY2.js → chunk-4M6RXJEY.js} +33 -23
- package/dist/{chunk-YTSXPJUQ.js → chunk-4YJEEOYT.js} +3 -3
- package/dist/{chunk-6RKKVPYF.js → chunk-4YUGB637.js} +1 -1
- package/dist/{chunk-XXOPG4BW.js → chunk-4ZSOKEDY.js} +3 -3
- package/dist/{chunk-55BEFF4V.js → chunk-5DF4Y6EC.js} +1 -1
- package/dist/{chunk-4QCFFW2H.js → chunk-5QCIWWFA.js} +46 -0
- package/dist/{chunk-3UUX5OY4.js → chunk-5QKLWJ4Z.js} +1 -1
- package/dist/{chunk-YSLGFPWX.js → chunk-5UBWBXLF.js} +3 -3
- package/dist/chunk-5WA4DG2A.js +117 -0
- package/dist/{chunk-4EN3IZ3Q.js → chunk-64ODONK2.js} +67 -1
- package/dist/{chunk-TAMDAOCU.js → chunk-66CGXQUA.js} +239 -39
- package/dist/{chunk-QHJR7IMX.js → chunk-6F3FQCAQ.js} +3 -3
- package/dist/{chunk-WMEYJT4R.js → chunk-6FG34V6D.js} +15 -14
- package/dist/{chunk-NMH5ZQPU.js → chunk-6KQ6WMTI.js} +1 -1
- package/dist/{chunk-IRVOXUSK.js → chunk-6WKBTZVL.js} +10 -4
- package/dist/{chunk-NOKJCF27.js → chunk-7INEFMVU.js} +9 -3
- package/dist/{chunk-GSJLB6JI.js → chunk-7THUQU44.js} +34 -8
- package/dist/{chunk-HDLAB7W3.js → chunk-7UH2JWBF.js} +1 -1
- package/dist/{chunk-KTCXJWJG.js → chunk-7UNMSF5O.js} +1 -1
- package/dist/{chunk-JTVIANUB.js → chunk-AEUGIJDO.js} +3 -1
- package/dist/{chunk-DSJI76XL.js → chunk-AHNVFBVB.js} +113 -16
- package/dist/{chunk-IBS2FAI4.js → chunk-AUKRBHHZ.js} +4 -1
- package/dist/{chunk-AKLJ4JH3.js → chunk-BBK2TSK3.js} +1 -1
- package/dist/{chunk-ZL4AGWAH.js → chunk-BNWWVYRN.js} +6 -5
- package/dist/{chunk-PY3FOMRN.js → chunk-BQEZPRUC.js} +4 -4
- package/dist/{chunk-DIXXEE3S.js → chunk-BQXYXJYC.js} +721 -309
- package/dist/{chunk-ORM7ZFKC.js → chunk-BZ546I4Q.js} +32 -0
- package/dist/{chunk-3KDCORDO.js → chunk-C2UN464N.js} +1 -1
- package/dist/{chunk-75H4R62K.js → chunk-CBPNZFSU.js} +0 -2
- package/dist/{chunk-YLXTKI6M.js → chunk-CHO5SNWR.js} +1 -1
- package/dist/{chunk-MXPNVSXI.js → chunk-CIEVY5TD.js} +11 -11
- package/dist/{chunk-UBK7HK3J.js → chunk-CKLJT2DH.js} +2 -2
- package/dist/{chunk-MOGA4Q7F.js → chunk-CKOJP7JI.js} +1 -1
- package/dist/{chunk-V3W3SATA.js → chunk-CL4J4757.js} +1 -1
- package/dist/{chunk-XNNECNDL.js → chunk-CQFWTWC6.js} +13 -13
- package/dist/{chunk-PDVXWXTL.js → chunk-CROVXJ4S.js} +3 -3
- package/dist/{chunk-WJG344NC.js → chunk-CWSLTSL6.js} +8 -8
- package/dist/{chunk-VMTZ4RUW.js → chunk-DDMGQ5Q3.js} +60 -26
- package/dist/{chunk-YKC7QDZH.js → chunk-DN24VTS5.js} +31 -6
- package/dist/{chunk-IN6CAM4F.js → chunk-EHAN752X.js} +7 -7
- package/dist/{chunk-EXTZSNWL.js → chunk-EPHSISMT.js} +2 -2
- package/dist/{chunk-6EZQUNE6.js → chunk-FCMQVEVL.js} +36 -3
- package/dist/{chunk-3L2QU5ZF.js → chunk-FS7XF7SE.js} +1 -1
- package/dist/{chunk-LGS2V2XD.js → chunk-FUKVP54K.js} +66 -19
- package/dist/{chunk-44TLJZJ5.js → chunk-FX2QRSRT.js} +1 -1
- package/dist/{chunk-PWRC5XZO.js → chunk-FXZ6VGFW.js} +16 -8
- package/dist/{chunk-NT7W4RXD.js → chunk-GKDAQL45.js} +1 -1
- package/dist/{chunk-EKE37MO4.js → chunk-GOT5ZHPX.js} +3 -3
- package/dist/{chunk-SLLLOOEI.js → chunk-GPJIBLP4.js} +1 -0
- package/dist/{chunk-EKYYMIVT.js → chunk-GPUOUUHA.js} +10 -1
- package/dist/{chunk-PB5S7YOF.js → chunk-GXNBPTPJ.js} +1 -1
- package/dist/{chunk-4SJ4LK4V.js → chunk-HE34XVD5.js} +5 -5
- package/dist/{chunk-6VHOQ3IM.js → chunk-HHAKXIKX.js} +12 -9
- package/dist/{chunk-TFKCERAK.js → chunk-HHT527PV.js} +38 -41
- package/dist/{chunk-ZSODLMFV.js → chunk-HIVOLPLD.js} +1 -40
- package/dist/{chunk-UCFC2AEI.js → chunk-I3LDTSWU.js} +1 -1
- package/dist/{chunk-Q3AXXKDF.js → chunk-IKXH4BFC.js} +5 -5
- package/dist/chunk-IMYGYIAI.js +23 -0
- package/dist/{chunk-GS7LIT34.js → chunk-IPHLUZ37.js} +1 -1
- package/dist/{chunk-M4IRPXSZ.js → chunk-IZA7XW2Q.js} +3 -3
- package/dist/{chunk-SEQIPGLU.js → chunk-IZLML47J.js} +1 -1
- package/dist/{chunk-4HKTO2SV.js → chunk-JRMHGO5B.js} +1 -1
- package/dist/{chunk-U73AC5AN.js → chunk-JSTTPYL3.js} +16 -16
- package/dist/{chunk-6SCGLHJ7.js → chunk-JVWLHBAV.js} +4 -4
- package/dist/{chunk-OVEQE6YS.js → chunk-K7UNIEB4.js} +254 -48
- package/dist/{chunk-HNWS7YHN.js → chunk-KBR5LIWD.js} +1 -1
- package/dist/{chunk-AKLQSC6W.js → chunk-KI7O64XV.js} +328 -98
- package/dist/{chunk-XXFKSJYA.js → chunk-KK3MIY5C.js} +5 -5
- package/dist/{chunk-U6SUKSZR.js → chunk-KO3OHI6V.js} +3 -3
- package/dist/{chunk-NJFJWQNN.js → chunk-L5CGXEZC.js} +27 -22
- package/dist/{chunk-NBXDXKLC.js → chunk-LK3XQDBP.js} +1 -1
- package/dist/{chunk-T3QUKNLI.js → chunk-LM443ORV.js} +1 -1
- package/dist/{chunk-BBSIEYF5.js → chunk-LNAFLXL7.js} +12 -4
- package/dist/{chunk-32YV32VA.js → chunk-LTUA5EYI.js} +122 -11
- package/dist/{chunk-23MVDXLY.js → chunk-MAXD5JQL.js} +11 -10
- package/dist/{chunk-GNUAL43X.js → chunk-MFASHRJ6.js} +5 -5
- package/dist/chunk-MFYMDGE7.js +37 -0
- package/dist/{chunk-VKJGHAZT.js → chunk-MGVILAYU.js} +57 -13
- package/dist/{chunk-DB55JZHU.js → chunk-MSLWRWTI.js} +1 -1
- package/dist/{chunk-C2L622QJ.js → chunk-NB5IRTC4.js} +52 -44
- package/dist/{chunk-2ZOEC4KC.js → chunk-ND75TGPR.js} +2 -2
- package/dist/{chunk-VRTCVZND.js → chunk-NE34MWVL.js} +142 -16
- package/dist/{chunk-S2WBS6BG.js → chunk-NMOFLWDY.js} +1 -1
- package/dist/{chunk-CRCB5S7I.js → chunk-NPXKGBVZ.js} +140 -23
- package/dist/{chunk-JSMDRKPJ.js → chunk-NRBGUIPE.js} +1 -1
- package/dist/{chunk-4LWBC7CM.js → chunk-NY6SBR4O.js} +1 -1
- package/dist/{chunk-UCUOGVDX.js → chunk-O3K2C22L.js} +13 -1
- package/dist/{chunk-R522MWAR.js → chunk-OATET4BV.js} +2 -2
- package/dist/chunk-OOZU5H3T.js +86 -0
- package/dist/{chunk-XFTEX77S.js → chunk-OQ4FNDRG.js} +28 -6
- package/dist/{chunk-VYQ7B7DI.js → chunk-OWVX52XF.js} +4 -4
- package/dist/{chunk-AETLDRZB.js → chunk-PEAAX6UA.js} +1 -1
- package/dist/{chunk-UM3N6VND.js → chunk-PFAVHC5N.js} +5 -5
- package/dist/chunk-PMVVUIHH.js +85 -0
- package/dist/chunk-PPMGQFLJ.js +2317 -0
- package/dist/{chunk-7TSBV3SD.js → chunk-PTY2N23C.js} +310 -2
- package/dist/{chunk-UKLN57Q5.js → chunk-PZ5SKYK6.js} +4 -4
- package/dist/{chunk-636LKCKE.js → chunk-Q6ZLQMP2.js} +1 -1
- package/dist/{chunk-N7VEP5B3.js → chunk-QFR5EKZG.js} +29 -7
- package/dist/{chunk-YMP2QSOP.js → chunk-QN56VQ6Z.js} +1 -1
- package/dist/{chunk-6YVUR3OU.js → chunk-QR3BUMOS.js} +2 -2
- package/dist/{chunk-XZ65ST2I.js → chunk-QV5CQLQH.js} +2 -2
- package/dist/{chunk-DJOIMFKV.js → chunk-REZIGNA6.js} +2 -2
- package/dist/{chunk-UQGSBM3U.js → chunk-RFPMXR6B.js} +11 -0
- package/dist/{chunk-DN4YVV4Z.js → chunk-RSABKW6B.js} +1 -1
- package/dist/{chunk-LP4GB656.js → chunk-RZNP35SI.js} +2 -2
- package/dist/{chunk-NUTZJZKW.js → chunk-SKTAZGFI.js} +10 -42
- package/dist/{chunk-TQAZTRQ3.js → chunk-SVXUT2DN.js} +4 -4
- package/dist/{chunk-DJ7YXOTU.js → chunk-T7EF5CQO.js} +3 -3
- package/dist/{chunk-QAEWWYHL.js → chunk-TDF2XKLK.js} +5 -1
- package/dist/{chunk-ZGYNKA3O.js → chunk-TT5BBVLX.js} +29 -31
- package/dist/{chunk-5H47VHB7.js → chunk-UWX6MMCX.js} +1 -1
- package/dist/{chunk-XL5MFGMR.js → chunk-V4YNN7PA.js} +10 -3
- package/dist/{chunk-SL6KQYDU.js → chunk-V5DDXXMP.js} +7 -7
- package/dist/{chunk-DZKPOSFD.js → chunk-VH6SPPNA.js} +1 -1
- package/dist/{chunk-LDNYSMPZ.js → chunk-VJUUI2VT.js} +1 -1
- package/dist/{chunk-CBCGDEJA.js → chunk-VN5WOOAQ.js} +42 -6
- package/dist/{chunk-EXDW3E2R.js → chunk-VPHJ2LUI.js} +165 -15
- package/dist/{chunk-GOMQ7PVQ.js → chunk-WJC6AAJN.js} +1 -1
- package/dist/{chunk-GJI77VDO.js → chunk-WVBVUVZB.js} +6 -5
- package/dist/{chunk-A6PDF4BO.js → chunk-XTQ7R2PA.js} +2 -2
- package/dist/{chunk-L6RXG36J.js → chunk-Y2HD2YB7.js} +1 -1
- package/dist/{chunk-KTU3EAWK.js → chunk-YAACLBZ7.js} +5 -5
- package/dist/{chunk-7GE2EQ23.js → chunk-YGVAKKGJ.js} +11 -6
- package/dist/chunk-YLHACCCB.js +166 -0
- package/dist/{chunk-PLZSZOZN.js → chunk-YP6UGVEY.js} +3 -3
- package/dist/{chunk-ULIBLJ6W.js → chunk-YYC553FO.js} +5 -5
- package/dist/{chunk-T35RCQFE.js → chunk-YZPEQW7H.js} +9 -8
- package/dist/{chunk-KI5PFRG6.js → chunk-ZKGWHT56.js} +60 -2
- package/dist/{chunk-NUK7EEN5.js → chunk-ZKJ5S23O.js} +33 -13
- package/dist/chunk-ZLPS3GR7.js +146 -0
- package/dist/{chunk-XH7YL7JM.js → chunk-ZMX22HSS.js} +50 -6
- package/dist/{chunk-JY5GAZYC.js → chunk-ZQEJ4IX2.js} +4 -0
- package/dist/{chunk-R4CBHKZ2.js → chunk-ZS5JO6QV.js} +7 -6
- package/dist/{cleanup-graph-garbage-DPJGO52H.js → cleanup-graph-garbage-LAPIZGFX.js} +12 -12
- package/dist/{cloud-sync-command-JPNTT4OQ.js → cloud-sync-command-QAZ2NWRA.js} +11 -2
- package/dist/{cloud-sync-db-init-V2LWIUQU.js → cloud-sync-db-init-HAGVF32Y.js} +1 -1
- package/dist/{cloud-sync-shutdown-BNALPWGX.js → cloud-sync-shutdown-DAEPCFVK.js} +5 -5
- package/dist/{co-activation-CMNSWS6B.js → co-activation-523TKQPZ.js} +5 -5
- package/dist/{co-occurrence-WRI2NAN6.js → co-occurrence-PQUCTENN.js} +36 -17
- package/dist/{code-context-index-NOJSHLPN.js → code-context-index-LIDOFKOR.js} +6 -4
- package/dist/{code-context-watcher-VZNZU3BO.js → code-context-watcher-4F7K2N3U.js} +6 -4
- package/dist/{content-extractor-NXYNEF5K.js → content-extractor-DJM5EUDA.js} +2 -2
- package/dist/{conversation-entity-extractor-74252CAO.js → conversation-entity-extractor-THGKQ5RD.js} +5 -5
- package/dist/{crdt-sync-B3JN6AIV.js → crdt-sync-32B55NOJ.js} +1 -1
- package/dist/{crm-webhook-GYWQRFET.js → crm-webhook-FHRISFYQ.js} +2 -2
- package/dist/{cto-delegation-gate-LQHVLEMW.js → cto-delegation-gate-O6XPGECP.js} +27 -26
- package/dist/{daemon-auth-QZHEO7IQ.js → daemon-auth-PNKHERLV.js} +6 -1
- package/dist/daemon-drift-N2GKUBAO.js +15 -0
- package/dist/{daemon-orchestration-5HIQALZH.js → daemon-orchestration-BWLSJG2X.js} +33 -30
- package/dist/{daemon-ready-P2BR2XP5.js → daemon-ready-BN6EZLTQ.js} +1 -1
- package/dist/{daemon-ready-signal-CKXPUMJ2.js → daemon-ready-signal-PNDMVKPJ.js} +3 -1
- package/dist/{daemon-restart-circuit-breaker-SMTWFX27.js → daemon-restart-circuit-breaker-CD4VMCU7.js} +1 -1
- package/dist/daemon-restart-report-FIO5HZTJ.js +15 -0
- package/dist/{daemon-timer-report-TNJH5SFY.js → daemon-timer-report-6UK5PSDP.js} +2 -1
- package/dist/{db-integrity-events-2DTFO37N.js → db-integrity-events-GYGANKZV.js} +1 -1
- package/dist/{destructive-data-guard-BVFWPPIS.js → destructive-data-guard-HHWUBIGS.js} +1 -1
- package/dist/{doc-graph-extractor-PQHDHQPQ.js → doc-graph-extractor-HOKOV7BE.js} +10 -10
- package/dist/{documents-C4SSPJMC.js → documents-HWEJMONR.js} +16 -14
- package/dist/{dreaming-XAO3FCBV.js → dreaming-FMNDODG2.js} +31 -30
- package/dist/{employee-boot-brief-W4OHUMRQ.js → employee-boot-brief-DBFROOQJ.js} +35 -34
- package/dist/{entity-boost-3UWGXG5O.js → entity-boost-5V4W6NFA.js} +1 -1
- package/dist/{exe-drift-AG2KMKD5.js → exe-drift-V55UAYRT.js} +6 -6
- package/dist/{exe-export-IC5BT335.js → exe-export-LHN42ZUS.js} +18 -16
- package/dist/{exe-import-A35ZLDPG.js → exe-import-M536BEZC.js} +18 -16
- package/dist/{exe-key-TCMJNYLA.js → exe-key-37XIR22X.js} +111 -107
- package/dist/{exe-org-JXCR3JYZ.js → exe-org-7TDIRNTE.js} +14 -14
- package/dist/{exe-snapshot-SV6SRIG6.js → exe-snapshot-EOUBCIQK.js} +34 -33
- package/dist/{fast-db-init-L2RGKJWH.js → fast-db-init-GWUZ746B.js} +1 -1
- package/dist/{founder-context-D4HFIESJ.js → founder-context-6LQKET4A.js} +2 -2
- package/dist/{fts-integrity-4YB34KWX.js → fts-integrity-PLAL6NMG.js} +1 -1
- package/dist/gateway/index.js +17 -17
- package/dist/{git-main-guard-VTW4N3CM.js → git-main-guard-BGICS25C.js} +1 -1
- package/dist/{git-staleness-TN7CYGFG.js → git-staleness-QNNXJK3W.js} +5 -5
- package/dist/{global-procedures-YFDEIOG7.js → global-procedures-NMQGF54V.js} +7 -7
- package/dist/{gotrue-session-ODZ2ERJX.js → gotrue-session-U4H3UGHL.js} +1 -3
- package/dist/{graph-auto-extract-3YR3TYRW.js → graph-auto-extract-7POGAKHM.js} +10 -10
- package/dist/{graph-query-AP5R6ZHO.js → graph-query-ZEDO4BDF.js} +1 -1
- package/dist/{graph-rag-Z2KCJTPK.js → graph-rag-JA7XN7NO.js} +5 -5
- package/dist/hook-integrity-6NLSNTXD.js +15 -0
- package/dist/{hook-prefetch-K5DN3TOQ.js → hook-prefetch-4KH3D4YU.js} +28 -26
- package/dist/hook-tamper-log-Z4PWC7N4.js +90 -0
- package/dist/hooks/bug-report-worker.js +31 -30
- package/dist/hooks/codex-stop-task-finalizer.js +33 -32
- package/dist/hooks/commit-complete.js +30 -29
- package/dist/hooks/error-recall.js +12 -12
- package/dist/hooks/exe-heartbeat-hook.js +7 -7
- package/dist/hooks/ingest-worker.js +17 -15
- package/dist/hooks/ingest.js +20 -20
- package/dist/hooks/instructions-loaded.js +9 -9
- package/dist/hooks/manifest.json +20 -20
- package/dist/hooks/notification.js +8 -8
- package/dist/hooks/post-compact.js +7 -7
- package/dist/hooks/post-tool-combined.js +14 -14
- package/dist/hooks/pre-compact.js +30 -29
- package/dist/hooks/pre-tool-use.js +303 -489
- package/dist/hooks/prompt-submit.js +61 -54
- package/dist/hooks/session-end.js +35 -34
- package/dist/hooks/session-start.js +18 -18
- package/dist/hooks/stop.js +36 -35
- package/dist/hooks/subagent-stop.js +32 -31
- package/dist/hooks/summary-worker.js +36 -35
- package/dist/index.js +39 -38
- package/dist/{installer-LK35OX6R.js → installer-M34Q7LAS.js} +25 -10
- package/dist/{installer-54HTN5RE.js → installer-POV6TDQ5.js} +12 -8
- package/dist/{installer-LLWKZI2S.js → installer-S624ZOMB.js} +12 -8
- package/dist/{intercom-queue-5NOT2RKI.js → intercom-queue-MKDWAEUV.js} +26 -25
- package/dist/lib/cloud-sync.js +27 -19
- package/dist/lib/consolidation.js +12 -12
- package/dist/lib/database.js +5 -5
- package/dist/lib/db-backup.js +7 -1
- package/dist/lib/db-daemon-client.js +8 -6
- package/dist/lib/db-write-worker.js +4 -4
- package/dist/lib/db.js +5 -5
- package/dist/lib/device-registry.js +1 -1
- package/dist/lib/embedder.js +6 -4
- package/dist/lib/employee-templates.js +8 -8
- package/dist/lib/employees.js +5 -5
- package/dist/lib/exe-daemon-client.js +5 -3
- package/dist/lib/exe-daemon.js +333 -262
- package/dist/lib/hybrid-search.js +10 -10
- package/dist/lib/identity-templates.js +1 -1
- package/dist/lib/identity.js +17 -7
- package/dist/lib/license.js +2 -2
- package/dist/lib/messaging.js +27 -26
- package/dist/lib/post-tool-memory.js +9 -9
- package/dist/lib/registry-proxy.js +3 -1
- package/dist/lib/reminders.js +6 -6
- package/dist/lib/schedules.js +11 -11
- package/dist/lib/session-registry.js +11 -7
- package/dist/lib/session-wrappers.js +1 -1
- package/dist/lib/skill-learning.js +17 -15
- package/dist/lib/status-brief.js +2 -1
- package/dist/lib/store.js +9 -9
- package/dist/lib/task-router.js +6 -6
- package/dist/lib/tasks.js +28 -27
- package/dist/lib/tmux-routing.js +26 -25
- package/dist/lib/tmux-status.js +5 -1
- package/dist/lib/token-spend.js +6 -6
- package/dist/{license-gate-JVMB6OFD.js → license-gate-2QNMBAZU.js} +3 -3
- package/dist/{license-sync-5VYS2F2W.js → license-sync-FEDKH5MD.js} +2 -2
- package/dist/{mailbox-inbox-4MEUOL3J.js → mailbox-inbox-XE72D3AX.js} +2 -2
- package/dist/{mailbox-outbox-J6WIF3UY.js → mailbox-outbox-DNDDP2HW.js} +1 -1
- package/dist/mcp/register-tools.js +110 -106
- package/dist/mcp/server.js +113 -109
- package/dist/mcp/tools/complete-reminder.js +7 -7
- package/dist/mcp/tools/create-reminder.js +7 -7
- package/dist/mcp/tools/create-task.js +30 -29
- package/dist/mcp/tools/deactivate-behavior.js +18 -16
- package/dist/mcp/tools/list-reminders.js +7 -7
- package/dist/mcp/tools/list-tasks.js +30 -29
- package/dist/mcp/tools/send-message.js +33 -30
- package/dist/mcp/tools/update-task.js +29 -28
- package/dist/{mcp-child-registry-OTG4MWO7.js → mcp-child-registry-DVHYAHPW.js} +2 -2
- package/dist/{mcp-health-HNVSWKFA.js → mcp-health-B5EKRCZG.js} +2 -2
- package/dist/{mcp-http-config-DQWL7U2Z.js → mcp-http-config-ZJ7XHWT7.js} +10 -6
- package/dist/{mcp-session-identity-277GASTQ.js → mcp-session-identity-PEVM7VIP.js} +26 -25
- package/dist/{memory-cards-3S2ZQPR7.js → memory-cards-VN5DEWPD.js} +9 -9
- package/dist/{memory-graph-extractor-A6DFEFIN.js → memory-graph-extractor-TMEB6WLA.js} +11 -11
- package/dist/{memory-poisoning-defense-ZVP4H6DY.js → memory-poisoning-defense-DYHARQ2G.js} +5 -5
- package/dist/{memory-pressure-watchdog-6W5F6R7H.js → memory-pressure-watchdog-J6Q3SIBL.js} +27 -26
- package/dist/{memory-queue-client-ADSDP6OX.js → memory-queue-client-QC2OTMJB.js} +6 -4
- package/dist/{memory-reflection-BKB2YOE6.js → memory-reflection-ZYJUOSFX.js} +9 -9
- package/dist/{message-queue-client-XQN7QABL.js → message-queue-client-OEQCGSWC.js} +1 -25
- package/dist/{notification-ledger-CLGM7ODF.js → notification-ledger-TG6EFYBP.js} +29 -28
- package/dist/{notifications-MACUZPYP.js → notifications-LGYY22W5.js} +26 -25
- package/dist/{orchestration-events-N7LYMUGA.js → orchestration-events-JPHB6NPY.js} +6 -6
- package/dist/{orchestrator-4X24EWHV.js → orchestrator-IC4WGP6L.js} +28 -27
- package/dist/{org-brief-session-FZOFMO5U.js → org-brief-session-DEPHWCQR.js} +9 -9
- package/dist/{org-consent-policy-O5E6HXBL.js → org-consent-policy-T27AO5OJ.js} +2 -2
- package/dist/{org-join-POWUG25F.js → org-join-A3YXC5RB.js} +2 -2
- package/dist/{org-key-admin-E7EMDOZZ.js → org-key-admin-SQFHCVP2.js} +3 -3
- package/dist/{org-partner-runtime-FODONVTM.js → org-partner-runtime-L7L2WWGN.js} +10 -10
- package/dist/{org-row-visibility-VX4AVV5Q.js → org-row-visibility-M54Z6ZH3.js} +1 -1
- package/dist/{pipeline-router-6GGT2ZW3.js → pipeline-router-NKYAUR3Y.js} +6 -6
- package/dist/{plan-limits-FUN76LYY.js → plan-limits-ISRRGF23.js} +8 -8
- package/dist/{platform-procedures-7YSCLF4Z.js → platform-procedures-Z7ZGBJWN.js} +1 -1
- package/dist/{project-boot-3Q65LCIP.js → project-boot-BLYGVUJH.js} +4 -1
- package/dist/{project-name-LJVFMYTQ.js → project-name-WKSNNKXK.js} +6 -6
- package/dist/{projection-worker-4OANGP5K.js → projection-worker-RNYPE46G.js} +2 -2
- package/dist/{prospective-memory-KR3P4T6N.js → prospective-memory-GEO6E3UL.js} +5 -5
- package/dist/{push-notifications-NCZLH6DI.js → push-notifications-EY6BXZUY.js} +27 -26
- package/dist/{reproject-worktree-memories-PWYKPB2U.js → reproject-worktree-memories-DAA5GWMH.js} +28 -27
- package/dist/{reranker-6V3C2AO4.js → reranker-7OADQPMG.js} +1 -1
- package/dist/{retrieval-health-5D7O6VH6.js → retrieval-health-FCEDWN2P.js} +2 -2
- package/dist/{review-polling-QW3LJ4KN.js → review-polling-G52BR4MC.js} +27 -26
- package/dist/runtime/index.js +39 -38
- package/dist/{session-events-T45SSTMF.js → session-events-P6E2373E.js} +27 -26
- package/dist/{session-kill-telemetry-QSPVJGBF.js → session-kill-telemetry-OHNJMIVT.js} +27 -26
- package/dist/{session-mcp-config-SC5BLWZG.js → session-mcp-config-WFZAH6R5.js} +2 -1
- package/dist/{session-scope-KRWE54C4.js → session-scope-DKOHPQPJ.js} +26 -25
- package/dist/{setup-wizard-GP3TBTPF.js → setup-wizard-RNU3RFBE.js} +1 -1
- package/dist/{skill-refinement-C7JTMLJG.js → skill-refinement-AKJTHFXC.js} +6 -6
- package/dist/{stack-generate-manifest-MFMDWRUP.js → stack-generate-manifest-7WJZWSPK.js} +163 -15
- package/dist/{stack-promote-EKSCYY63.js → stack-promote-OP2URGFF.js} +4 -4
- package/dist/{stack-release-2GZAAFO4.js → stack-release-MY6U2QIO.js} +31 -8
- package/dist/{stack-update-J6JXSTAZ.js → stack-update-QSHSLUTZ.js} +3 -3
- package/dist/{steward-gate-BFCCMCSW.js → steward-gate-KMLS5ECC.js} +6 -6
- package/dist/{subagent-brief-injection-ED36PLYY.js → subagent-brief-injection-HCKZQZBF.js} +37 -36
- package/dist/{support-inbox-YW47SYJF.js → support-inbox-UBXU5RKV.js} +11 -11
- package/dist/{support-outbox-HFJWG52M.js → support-outbox-G2NG2U5K.js} +2 -2
- package/dist/{sweep-budget-KMPJ7O5Z.js → sweep-budget-YGLCNXZZ.js} +9 -3
- package/dist/{task-enforcement-CECTQX4U.js → task-enforcement-2GR7HU6V.js} +27 -26
- package/dist/{task-request-inbox-Q5T4N5K7.js → task-request-inbox-ANCVK2VG.js} +2 -2
- package/dist/{task-scope-ERVEUEYU.js → task-scope-QANJJXXB.js} +30 -29
- package/dist/{tasks-crud-ZRQNJXQ2.js → tasks-crud-45WOIMIM.js} +44 -25
- package/dist/{tasks-notify-MIZH4C2O.js → tasks-notify-ZJS4MA3S.js} +29 -26
- package/dist/{tasks-review-Z7J2P6DG.js → tasks-review-ZVPKY47Z.js} +26 -25
- package/dist/{telemetry-upload-LVQUQYFP.js → telemetry-upload-VY3UWAEL.js} +10 -10
- package/dist/{token-budget-BU4NOVZF.js → token-budget-XHX6XFEC.js} +6 -6
- package/dist/{tool-capability-index-7F42MOJT.js → tool-capability-index-6HLZU437.js} +1 -1
- package/dist/{tool-telemetry-O27EVMBR.js → tool-telemetry-GBDI4AXR.js} +1 -1
- package/dist/tui/App.js +36 -35
- package/dist/{tui-data-TPWWBIUQ.js → tui-data-IQFE3UW3.js} +30 -29
- package/dist/{typed-messages-RCMPEKJN.js → typed-messages-P2HLLA62.js} +1 -1
- package/dist/{update-support-F2F5537B.js → update-support-BDN5AK4R.js} +25 -22
- package/dist/{work-claims-B73X5NE7.js → work-claims-PDQNLE5K.js} +7 -7
- package/dist/{work-state-heartbeat-P4YX6E2R.js → work-state-heartbeat-CH6BLQKV.js} +1 -1
- package/dist/{worker-gate-BEEIIVWA.js → worker-gate-NUUSQMBT.js} +1 -3
- package/dist/{workflow-engine-5X46PFCW.js → workflow-engine-RZ7QEI3Z.js} +2 -2
- package/dist/{worktree-W47CIMJ6.js → worktree-Q25PZST6.js} +11 -7
- package/dist/worktree-ownership-guard-4LKMW6PW.js +421 -0
- package/dist/{worktree-sweep-BNBD4RFX.js → worktree-sweep-EV5YQ2OB.js} +8 -8
- package/package.json +15 -3
- package/release-notes.json +5 -5
- package/src/commands/exe.md +16 -16
- package/stack.release.json +9 -8
- package/dist/behavior-injection-M6UYZCMW.js +0 -63
- package/dist/chunk-BJ7AVSY6.js +0 -50
- package/dist/daemon-restart-report-EIVD6WDJ.js +0 -10
- package/dist/worktree-ownership-guard-OUWJROW2.js +0 -88
- /package/dist/{chunk-GQOEWNVM.js → chunk-4EG4DT4F.js} +0 -0
- /package/dist/{chunk-AISULNGL.js → chunk-BRAIWGMF.js} +0 -0
- /package/dist/{chunk-NRG7KZIP.js → chunk-HQEAZDAC.js} +0 -0
- /package/dist/{chunk-VZAFWPAY.js → chunk-IK4344V5.js} +0 -0
- /package/dist/{chunk-GM7TLYOK.js → chunk-K3VDF6II.js} +0 -0
- /package/dist/{chunk-2AJGV5UL.js → chunk-KM7DAG5J.js} +0 -0
- /package/dist/{chunk-YO4BO2CL.js → chunk-QIEYJ4KZ.js} +0 -0
- /package/dist/{chunk-WSQASFLP.js → chunk-VCTK5HRA.js} +0 -0
- /package/dist/{chunk-KQ6RJWRW.js → chunk-VPT6VMBG.js} +0 -0
- /package/dist/{chunk-6WIFPD2P.js → chunk-YZ4AEMR7.js} +0 -0
- /package/dist/{core-memory-7I7RE2SJ.js → core-memory-UIZKCY4L.js} +0 -0
- /package/dist/{memory-isolation-2TUZ7Z4K.js → memory-isolation-3GJ6WLYX.js} +0 -0
- /package/dist/{oauth-server-AYM37SQ4.js → oauth-server-ZRHXIRXQ.js} +0 -0
- /package/dist/{wiki-acl-IBQLLBTS.js → wiki-acl-MFOYK5F4.js} +0 -0
|
@@ -1,73 +1,75 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "../chunk-
|
|
2
|
+
appendDecision,
|
|
3
|
+
decide,
|
|
4
|
+
evaluateScratchPathTarget,
|
|
5
|
+
resolveLedgerPath
|
|
6
|
+
} from "../chunk-PPMGQFLJ.js";
|
|
7
|
+
import "../chunk-NB5IRTC4.js";
|
|
7
8
|
import {
|
|
8
|
-
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
resolvePreToolUseAgentIdentity
|
|
10
|
+
} from "../chunk-O3K2C22L.js";
|
|
10
11
|
import "../chunk-YSU7JB7H.js";
|
|
11
12
|
import "../chunk-SH45SJQW.js";
|
|
12
13
|
import {
|
|
13
14
|
getActiveAgent
|
|
14
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-5DF4Y6EC.js";
|
|
15
16
|
import "../chunk-K4ESASPL.js";
|
|
16
17
|
import {
|
|
17
18
|
sessionScopeFilter
|
|
18
|
-
} from "../chunk-
|
|
19
|
-
import "../chunk-
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-3KDCORDO.js";
|
|
19
|
+
} from "../chunk-KI7O64XV.js";
|
|
20
|
+
import "../chunk-4YUGB637.js";
|
|
21
|
+
import "../chunk-64ODONK2.js";
|
|
22
|
+
import "../chunk-C2UN464N.js";
|
|
23
|
+
import "../chunk-ZKGWHT56.js";
|
|
24
24
|
import "../chunk-WT4RI36X.js";
|
|
25
|
-
import "../chunk-
|
|
26
|
-
import "../chunk-QAEWWYHL.js";
|
|
25
|
+
import "../chunk-TDF2XKLK.js";
|
|
27
26
|
import "../chunk-EIKATSE4.js";
|
|
28
27
|
import "../chunk-MJCSEIFI.js";
|
|
29
|
-
import "../chunk-
|
|
30
|
-
import "../chunk-
|
|
28
|
+
import "../chunk-E23LNUWJ.js";
|
|
29
|
+
import "../chunk-ZMX22HSS.js";
|
|
31
30
|
import "../chunk-VI4ATC6I.js";
|
|
32
31
|
import "../chunk-A27Q27CT.js";
|
|
33
|
-
import "../chunk-
|
|
32
|
+
import "../chunk-BZ546I4Q.js";
|
|
33
|
+
import "../chunk-3SRZNJKD.js";
|
|
34
34
|
import "../chunk-AJIXH5JF.js";
|
|
35
|
-
import "../chunk-
|
|
35
|
+
import "../chunk-YGVAKKGJ.js";
|
|
36
36
|
import "../chunk-GZOG2MAX.js";
|
|
37
37
|
import "../chunk-AM7S2TY6.js";
|
|
38
|
-
import "../chunk-
|
|
38
|
+
import "../chunk-QR3BUMOS.js";
|
|
39
39
|
import {
|
|
40
40
|
getSessionKey
|
|
41
41
|
} from "../chunk-CVYC6DUW.js";
|
|
42
|
-
import "../chunk-
|
|
42
|
+
import "../chunk-WJC6AAJN.js";
|
|
43
43
|
import "../chunk-4IK2K3B3.js";
|
|
44
|
-
import "../chunk-
|
|
44
|
+
import "../chunk-ZKJ5S23O.js";
|
|
45
|
+
import "../chunk-GPUOUUHA.js";
|
|
46
|
+
import "../chunk-BTSWFMEH.js";
|
|
45
47
|
import "../chunk-ZG62LIK3.js";
|
|
46
|
-
import "../chunk-
|
|
48
|
+
import "../chunk-IMYGYIAI.js";
|
|
47
49
|
import "../chunk-NLEW62VC.js";
|
|
48
|
-
import "../chunk-
|
|
50
|
+
import "../chunk-GPJIBLP4.js";
|
|
49
51
|
import "../chunk-V3WLC5TJ.js";
|
|
50
|
-
import "../chunk-
|
|
52
|
+
import "../chunk-AEUGIJDO.js";
|
|
51
53
|
import "../chunk-HYZV25LY.js";
|
|
52
54
|
import "../chunk-GJV3WDWM.js";
|
|
53
55
|
import "../chunk-MP2AFCGL.js";
|
|
54
56
|
import {
|
|
55
57
|
canCoordinate,
|
|
56
58
|
loadEmployeesSync
|
|
57
|
-
} from "../chunk-
|
|
59
|
+
} from "../chunk-66CGXQUA.js";
|
|
58
60
|
import "../chunk-BBMTVAE3.js";
|
|
59
61
|
import "../chunk-TKDITWDN.js";
|
|
60
62
|
import "../chunk-5YEUPUV4.js";
|
|
61
|
-
import "../chunk-
|
|
63
|
+
import "../chunk-AHNVFBVB.js";
|
|
62
64
|
import "../chunk-YYB5PMTK.js";
|
|
63
|
-
import "../chunk-
|
|
64
|
-
import "../chunk-
|
|
65
|
-
import "../chunk-
|
|
65
|
+
import "../chunk-L5CGXEZC.js";
|
|
66
|
+
import "../chunk-CL4J4757.js";
|
|
67
|
+
import "../chunk-ZQEJ4IX2.js";
|
|
66
68
|
import "../chunk-FXU7JOXK.js";
|
|
67
69
|
import "../chunk-WNBZJSQT.js";
|
|
68
|
-
import "../chunk-
|
|
70
|
+
import "../chunk-Y2HD2YB7.js";
|
|
69
71
|
import "../chunk-A7XLR3K7.js";
|
|
70
|
-
import "../chunk-
|
|
72
|
+
import "../chunk-4EG4DT4F.js";
|
|
71
73
|
import "../chunk-A7JYF4RG.js";
|
|
72
74
|
import "../chunk-ARX6TAGN.js";
|
|
73
75
|
import {
|
|
@@ -81,7 +83,7 @@ import "../chunk-MLKGABMK.js";
|
|
|
81
83
|
// src/adapters/claude/hooks/pre-tool-use.ts
|
|
82
84
|
import { existsSync, writeFileSync, mkdirSync } from "fs";
|
|
83
85
|
import { execFileSync } from "child_process";
|
|
84
|
-
import
|
|
86
|
+
import path from "path";
|
|
85
87
|
import os from "os";
|
|
86
88
|
|
|
87
89
|
// src/lib/sidechain-task-guard.ts
|
|
@@ -141,308 +143,6 @@ function shouldBlockSidechainTaskMutation(agentId, toolName, action) {
|
|
|
141
143
|
return isSidechainIdentity(agentId) && isSidechainTaskMutation(toolName, action);
|
|
142
144
|
}
|
|
143
145
|
|
|
144
|
-
// src/lib/settings-tamper-guard.ts
|
|
145
|
-
import path from "path";
|
|
146
|
-
function normalizeForCompare(filePath, homeDir) {
|
|
147
|
-
const expanded = filePath.startsWith("~/") ? path.join(homeDir, filePath.slice(2)) : filePath;
|
|
148
|
-
return path.resolve(expanded);
|
|
149
|
-
}
|
|
150
|
-
function isProtectedAgentSettingsPath(filePath, homeDir) {
|
|
151
|
-
if (!filePath) return false;
|
|
152
|
-
const resolved = normalizeForCompare(filePath, homeDir);
|
|
153
|
-
const claudeSettings = path.join(homeDir, ".claude", "settings.json");
|
|
154
|
-
const claudeRoot = path.join(homeDir, ".claude.json");
|
|
155
|
-
return resolved === claudeSettings || resolved === claudeRoot;
|
|
156
|
-
}
|
|
157
|
-
function commandTouchesProtectedAgentSettings(command, homeDir) {
|
|
158
|
-
if (!command) return false;
|
|
159
|
-
const escapedHome = homeDir.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
160
|
-
const patterns = [
|
|
161
|
-
/~\/\.claude\/settings\.json/,
|
|
162
|
-
/~\/\.claude\.json/,
|
|
163
|
-
new RegExp(`${escapedHome}/\\.claude/settings\\.json`),
|
|
164
|
-
new RegExp(`${escapedHome}/\\.claude\\.json`)
|
|
165
|
-
];
|
|
166
|
-
if (!patterns.some((p) => p.test(command))) return false;
|
|
167
|
-
return /(^|[;&|]\s*|\b)(?:cat\s+>+|tee\b|sed\b.*\s-i\b|python\b|node\b|perl\b|ruby\b|jq\b.*>+|echo\b.*>+|cp\b|mv\b|rm\b)/s.test(command);
|
|
168
|
-
}
|
|
169
|
-
function settingsTamperDenyMessage(target) {
|
|
170
|
-
return `ACTION BLOCKED: ${target} is protected exe-os/Claude settings. Agents must not edit hook/MCP settings directly. Use exe-os install/update paths or ask the coordinator to approve the settings change.`;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// src/lib/remote-ref-delete-guard.ts
|
|
174
|
-
var REF_DELETE_OVERRIDE_ENV = "EXE_FORCE_ALLOW_REMOTE_REF_DELETE";
|
|
175
|
-
var REF_DELETE_OVERRIDE_TOKEN = `${REF_DELETE_OVERRIDE_ENV}=1`;
|
|
176
|
-
var SHELLS = /* @__PURE__ */ new Set(["sh", "bash", "zsh", "dash", "ksh"]);
|
|
177
|
-
var HTTP_CLIENTS = /* @__PURE__ */ new Set(["curl", "wget", "http", "https", "httpie"]);
|
|
178
|
-
function basename(tok) {
|
|
179
|
-
return tok.split("/").pop() ?? tok;
|
|
180
|
-
}
|
|
181
|
-
function isProgram(tok, name) {
|
|
182
|
-
return basename(tok) === name;
|
|
183
|
-
}
|
|
184
|
-
function isShellProgram(tok) {
|
|
185
|
-
return SHELLS.has(basename(tok));
|
|
186
|
-
}
|
|
187
|
-
function isDashC(tok) {
|
|
188
|
-
return /^-[a-z]*c[a-z]*$/i.test(tok) && tok.includes("c");
|
|
189
|
-
}
|
|
190
|
-
function methodFlagValue(tok, next) {
|
|
191
|
-
let m = /^(?:-X|--method|--request)=(.+)$/i.exec(tok);
|
|
192
|
-
if (m) return m[1];
|
|
193
|
-
m = /^-X(.+)$/.exec(tok);
|
|
194
|
-
if (m) return m[1];
|
|
195
|
-
if (/^(?:-X|--method|--request)$/i.test(tok)) return next ?? null;
|
|
196
|
-
return null;
|
|
197
|
-
}
|
|
198
|
-
function hasDeleteMethod(tokens) {
|
|
199
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
200
|
-
const v = methodFlagValue(tokens[i], tokens[i + 1]);
|
|
201
|
-
if (v && v.trim().toUpperCase() === "DELETE") return true;
|
|
202
|
-
}
|
|
203
|
-
return false;
|
|
204
|
-
}
|
|
205
|
-
function refPathOf(tok) {
|
|
206
|
-
const m = /(?:^|[/\s])git\/refs\/([^\s?#'"]+)/.exec(tok);
|
|
207
|
-
if (!m) return null;
|
|
208
|
-
return m[1].replace(/\/+$/, "");
|
|
209
|
-
}
|
|
210
|
-
function isTagRef(refPath) {
|
|
211
|
-
return /^tags\//.test(refPath);
|
|
212
|
-
}
|
|
213
|
-
function firstNonTagRef(tokens) {
|
|
214
|
-
for (const t of tokens) {
|
|
215
|
-
const ref = refPathOf(t);
|
|
216
|
-
if (ref && !isTagRef(ref)) return ref;
|
|
217
|
-
}
|
|
218
|
-
return null;
|
|
219
|
-
}
|
|
220
|
-
function looksLikeGitHubApi(tok) {
|
|
221
|
-
return /api\.github\.com|\/api\/v3\/|\/api\/graphql/.test(tok);
|
|
222
|
-
}
|
|
223
|
-
function mentionsDeleteRefMutation(text) {
|
|
224
|
-
return /\bdeleteRef\b/.test(text);
|
|
225
|
-
}
|
|
226
|
-
function hasStdinRedirect(segment) {
|
|
227
|
-
let inSingle = false;
|
|
228
|
-
let inDouble = false;
|
|
229
|
-
for (let i = 0; i < segment.length; i++) {
|
|
230
|
-
const ch = segment[i];
|
|
231
|
-
if (ch === "\\") {
|
|
232
|
-
i++;
|
|
233
|
-
continue;
|
|
234
|
-
}
|
|
235
|
-
if (inSingle) {
|
|
236
|
-
if (ch === "'") inSingle = false;
|
|
237
|
-
continue;
|
|
238
|
-
}
|
|
239
|
-
if (inDouble) {
|
|
240
|
-
if (ch === '"') inDouble = false;
|
|
241
|
-
continue;
|
|
242
|
-
}
|
|
243
|
-
if (ch === "'") {
|
|
244
|
-
inSingle = true;
|
|
245
|
-
continue;
|
|
246
|
-
}
|
|
247
|
-
if (ch === '"') {
|
|
248
|
-
inDouble = true;
|
|
249
|
-
continue;
|
|
250
|
-
}
|
|
251
|
-
if (ch === "<") return true;
|
|
252
|
-
}
|
|
253
|
-
return false;
|
|
254
|
-
}
|
|
255
|
-
function hasExternalPayload(tokens) {
|
|
256
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
257
|
-
const t = tokens[i];
|
|
258
|
-
if (/^(?:--input|-T|--upload-file)$/.test(t)) return true;
|
|
259
|
-
if (/^--input=/.test(t)) return true;
|
|
260
|
-
if (t.startsWith("@")) return true;
|
|
261
|
-
if (/=@/.test(t)) return true;
|
|
262
|
-
if (t.startsWith("-") && t.includes("@")) return true;
|
|
263
|
-
}
|
|
264
|
-
return false;
|
|
265
|
-
}
|
|
266
|
-
var WRAPPERS = /* @__PURE__ */ new Set(["env", "command", "builtin", "exec", "nohup", "time", "stdbuf", "nice", "ionice", "setsid", "timeout", "caffeinate"]);
|
|
267
|
-
function stripWrappers(tokens, depth = 0) {
|
|
268
|
-
if (depth > 6) return { kind: "argv", argv: [...tokens] };
|
|
269
|
-
let i = 0;
|
|
270
|
-
while (i < tokens.length && /^[A-Za-z_][A-Za-z0-9_]*=/.test(tokens[i])) i++;
|
|
271
|
-
const head = tokens[i];
|
|
272
|
-
if (head === void 0) return { kind: "argv", argv: [] };
|
|
273
|
-
if (!WRAPPERS.has(basename(head))) return { kind: "argv", argv: tokens.slice(i) };
|
|
274
|
-
let j = i + 1;
|
|
275
|
-
while (j < tokens.length) {
|
|
276
|
-
const t = tokens[j];
|
|
277
|
-
if (t.startsWith("-")) {
|
|
278
|
-
const inlineSplit = /^--split-string=(.*)$/.exec(t) ?? /^-S(.+)$/.exec(t);
|
|
279
|
-
if (inlineSplit) return { kind: "nested", script: inlineSplit[1] };
|
|
280
|
-
if (/^(?:-S|--split-string)$/.test(t)) {
|
|
281
|
-
const script = tokens[j + 1];
|
|
282
|
-
if (script !== void 0) return { kind: "nested", script };
|
|
283
|
-
return { kind: "argv", argv: tokens.slice(i) };
|
|
284
|
-
}
|
|
285
|
-
if (/^(?:-u|--unset|-n|-k|--kill-after|-s|--signal)$/.test(t)) j++;
|
|
286
|
-
j++;
|
|
287
|
-
continue;
|
|
288
|
-
}
|
|
289
|
-
if (/^[A-Za-z_][A-Za-z0-9_]*=/.test(t)) {
|
|
290
|
-
j++;
|
|
291
|
-
continue;
|
|
292
|
-
}
|
|
293
|
-
if (basename(head) === "timeout" && /^[0-9]+(?:\.[0-9]+)?[smhd]?$/.test(t)) {
|
|
294
|
-
j++;
|
|
295
|
-
continue;
|
|
296
|
-
}
|
|
297
|
-
break;
|
|
298
|
-
}
|
|
299
|
-
if (j >= tokens.length) return { kind: "argv", argv: tokens.slice(i) };
|
|
300
|
-
return stripWrappers(tokens.slice(j), depth + 1);
|
|
301
|
-
}
|
|
302
|
-
function shellScripts(tokens) {
|
|
303
|
-
const out = [];
|
|
304
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
305
|
-
if (!isShellProgram(tokens[i])) continue;
|
|
306
|
-
for (let j = i + 1; j < tokens.length; j++) {
|
|
307
|
-
if (!isDashC(tokens[j])) continue;
|
|
308
|
-
const script = tokens[j + 1];
|
|
309
|
-
if (script !== void 0) out.push(script);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
return out;
|
|
313
|
-
}
|
|
314
|
-
function positionalsAfter(tokens, startIndex) {
|
|
315
|
-
const out = [];
|
|
316
|
-
for (let i = startIndex; i < tokens.length; i++) {
|
|
317
|
-
const t = tokens[i];
|
|
318
|
-
if (t.startsWith("-")) {
|
|
319
|
-
if (/^(?:-X|--method|--request|-f|-F|--field|--raw-field|-H|--header|--input|--hostname|--jq|-q|--template|-t|-d|--data|--data-raw|--data-binary|-o|--output|-u|--user|-A|--user-agent|-e|--referer)$/i.test(t)) i++;
|
|
320
|
-
continue;
|
|
321
|
-
}
|
|
322
|
-
if (/^[A-Za-z_][A-Za-z0-9_.-]*=/.test(t)) continue;
|
|
323
|
-
out.push(t);
|
|
324
|
-
}
|
|
325
|
-
return out;
|
|
326
|
-
}
|
|
327
|
-
function blockMessage(spelling, target) {
|
|
328
|
-
return `\u{1F6D1} BLOCKED: remote ref DELETION via ${spelling}.
|
|
329
|
-
|
|
330
|
-
` + (target ? `TARGET: refs/${target}
|
|
331
|
-
|
|
332
|
-
` : "") + `WHY: deleting a remote ref destroys the only copy of any work that lives only on it, and this repo's policy allows remote deletes only for TAGS. Blocking the git spelling while leaving the REST/GraphQL spelling open made the guard bypassable in one step (bug c0547f31), so the gate is on the OPERATION now, whatever tool performs it.
|
|
333
|
-
|
|
334
|
-
INSTEAD:
|
|
335
|
-
\u2022 Prove the work landed first: exe-os repo-truth
|
|
336
|
-
\u2022 Keep a recovery point: git fetch origin <branch> && git branch keep/<branch> FETCH_HEAD
|
|
337
|
-
\u2022 Ask the ref's owner, or delete it in the GitHub UI where the act is attributable.
|
|
338
|
-
|
|
339
|
-
OVERRIDE (deliberate, audited): prefix the command with ${REF_DELETE_OVERRIDE_TOKEN}.
|
|
340
|
-
The shared-main guard runs FIRST and independently covers the \`gh api\` REST
|
|
341
|
-
spelling, so for that one you need BOTH tokens: ${MAIN_GUARD_OVERRIDE_TOKEN} ${REF_DELETE_OVERRIDE_TOKEN} <command>`;
|
|
342
|
-
}
|
|
343
|
-
function evaluateSegment(segment, depth) {
|
|
344
|
-
if (depth > 3) {
|
|
345
|
-
return {
|
|
346
|
-
block: true,
|
|
347
|
-
message: blockMessage("a pathologically nested shell invocation", null),
|
|
348
|
-
spelling: "nested-shell",
|
|
349
|
-
target: null
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
const { tokens } = tokenizeShell(segment);
|
|
353
|
-
if (tokens.length === 0) return { block: false };
|
|
354
|
-
for (const script of shellScripts(tokens)) {
|
|
355
|
-
const inner = evaluateCommandInternal(script, depth + 1);
|
|
356
|
-
if (inner.block) return inner;
|
|
357
|
-
}
|
|
358
|
-
const unwrapped = stripWrappers(tokens);
|
|
359
|
-
if (unwrapped.kind === "nested") return evaluateCommandInternal(unwrapped.script, depth + 1);
|
|
360
|
-
const argv = unwrapped.argv;
|
|
361
|
-
const program = argv[0];
|
|
362
|
-
if (!program) return { block: false };
|
|
363
|
-
if (isProgram(program, "gh")) {
|
|
364
|
-
const allOperands = positionalsAfter(argv, 1);
|
|
365
|
-
const apiIndex = allOperands.indexOf("api");
|
|
366
|
-
if (apiIndex === -1) return { block: false };
|
|
367
|
-
const operands = allOperands.slice(apiIndex + 1);
|
|
368
|
-
if (operands.includes("graphql")) {
|
|
369
|
-
if (mentionsDeleteRefMutation(segment)) {
|
|
370
|
-
return {
|
|
371
|
-
block: true,
|
|
372
|
-
message: blockMessage("a `gh api graphql` deleteRef mutation", null),
|
|
373
|
-
spelling: "gh-api-graphql-deleteRef",
|
|
374
|
-
target: null
|
|
375
|
-
};
|
|
376
|
-
}
|
|
377
|
-
if (hasExternalPayload(argv) || hasStdinRedirect(segment)) {
|
|
378
|
-
return {
|
|
379
|
-
block: true,
|
|
380
|
-
message: blockMessage("a `gh api graphql` call whose payload is read from a file, stdin, or a redirect", null),
|
|
381
|
-
spelling: "gh-api-graphql-opaque-payload",
|
|
382
|
-
target: null
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
if (!hasDeleteMethod(argv)) return { block: false };
|
|
387
|
-
const ref = firstNonTagRef(operands);
|
|
388
|
-
if (!ref) return { block: false };
|
|
389
|
-
return {
|
|
390
|
-
block: true,
|
|
391
|
-
message: blockMessage("a `gh api` DELETE on a git ref", ref),
|
|
392
|
-
spelling: "gh-api-delete",
|
|
393
|
-
target: ref
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
if (HTTP_CLIENTS.has(basename(program))) {
|
|
397
|
-
if (!argv.some((t) => looksLikeGitHubApi(t))) return { block: false };
|
|
398
|
-
if (mentionsDeleteRefMutation(segment)) {
|
|
399
|
-
return {
|
|
400
|
-
block: true,
|
|
401
|
-
message: blockMessage(`a \`${basename(program)}\` GitHub GraphQL deleteRef mutation`, null),
|
|
402
|
-
spelling: "http-graphql-deleteRef",
|
|
403
|
-
target: null
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
if (argv.some((t) => /\/graphql\b/.test(t)) && (hasExternalPayload(argv) || hasStdinRedirect(segment))) {
|
|
407
|
-
return {
|
|
408
|
-
block: true,
|
|
409
|
-
message: blockMessage(`a \`${basename(program)}\` GitHub GraphQL call whose payload is read from a file, stdin, or a redirect`, null),
|
|
410
|
-
spelling: "http-graphql-opaque-payload",
|
|
411
|
-
target: null
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
const bareVerb = argv.slice(1).some((t) => t === "DELETE");
|
|
415
|
-
if (!hasDeleteMethod(argv) && !bareVerb) return { block: false };
|
|
416
|
-
const ref = firstNonTagRef(argv);
|
|
417
|
-
if (!ref) return { block: false };
|
|
418
|
-
return {
|
|
419
|
-
block: true,
|
|
420
|
-
message: blockMessage(`a \`${basename(program)}\` DELETE on a GitHub git ref`, ref),
|
|
421
|
-
spelling: "http-delete",
|
|
422
|
-
target: ref
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
return { block: false };
|
|
426
|
-
}
|
|
427
|
-
function evaluateCommandInternal(command, depth) {
|
|
428
|
-
for (const segment of splitShellSegments(command)) {
|
|
429
|
-
const d = evaluateSegment(segment, depth);
|
|
430
|
-
if (d.block) return d;
|
|
431
|
-
}
|
|
432
|
-
return { block: false };
|
|
433
|
-
}
|
|
434
|
-
function evaluateRemoteRefDeleteGuard(command, env = process.env) {
|
|
435
|
-
try {
|
|
436
|
-
if (env[REF_DELETE_OVERRIDE_ENV] === "1") return { block: false, overridden: true };
|
|
437
|
-
if (new RegExp(String.raw`^\s*${REF_DELETE_OVERRIDE_ENV}=1\s`).test(command)) {
|
|
438
|
-
return { block: false, overridden: true };
|
|
439
|
-
}
|
|
440
|
-
return evaluateCommandInternal(command, 0);
|
|
441
|
-
} catch {
|
|
442
|
-
return { block: false };
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
|
|
446
146
|
// src/adapters/claude/hooks/pre-tool-use.ts
|
|
447
147
|
process.on("uncaughtException", (err) => {
|
|
448
148
|
console.error(`[exe-os:hook:pre-tool-use] FATAL: ${err instanceof Error ? err.stack ?? err.message : String(err)}`);
|
|
@@ -453,7 +153,7 @@ process.on("unhandledRejection", (err) => {
|
|
|
453
153
|
process.exit(1);
|
|
454
154
|
});
|
|
455
155
|
try {
|
|
456
|
-
const { verifyOrBlock } = await import("../hook-integrity-
|
|
156
|
+
const { verifyOrBlock } = await import("../hook-integrity-6NLSNTXD.js");
|
|
457
157
|
if (!await verifyOrBlock(new URL(import.meta.url).pathname)) process.exit(2);
|
|
458
158
|
} catch (err) {
|
|
459
159
|
const code = err?.code;
|
|
@@ -473,23 +173,185 @@ if (!process.env.AGENT_ID) {
|
|
|
473
173
|
}
|
|
474
174
|
var DELEGATION_TASK_THRESHOLD = 3;
|
|
475
175
|
var CTO_ROLES = ["CTO", "executive"];
|
|
476
|
-
var CACHE_DIR =
|
|
176
|
+
var CACHE_DIR = path.join(EXE_AI_DIR, "session-cache");
|
|
477
177
|
var PRE_TOOL_SAFEGUARD_MS = Number(process.env.EXE_HOOK_PRE_TOOL_TIMEOUT_MS) || 5e3;
|
|
478
178
|
var hookStdoutWritten = false;
|
|
179
|
+
var degradedSubject;
|
|
180
|
+
var DEGRADED_READ_ONLY_PROGRAMS = /* @__PURE__ */ new Set([
|
|
181
|
+
"pwd",
|
|
182
|
+
"cd",
|
|
183
|
+
"ls",
|
|
184
|
+
"cat",
|
|
185
|
+
"head",
|
|
186
|
+
"tail",
|
|
187
|
+
"wc",
|
|
188
|
+
"stat",
|
|
189
|
+
"basename",
|
|
190
|
+
"dirname",
|
|
191
|
+
"realpath",
|
|
192
|
+
"readlink",
|
|
193
|
+
"echo",
|
|
194
|
+
"printf",
|
|
195
|
+
"grep",
|
|
196
|
+
"egrep",
|
|
197
|
+
"fgrep",
|
|
198
|
+
"rg",
|
|
199
|
+
"which",
|
|
200
|
+
"type",
|
|
201
|
+
"whoami",
|
|
202
|
+
"id",
|
|
203
|
+
"hostname",
|
|
204
|
+
"uname",
|
|
205
|
+
"printenv",
|
|
206
|
+
"ps",
|
|
207
|
+
"df",
|
|
208
|
+
"du",
|
|
209
|
+
"uptime",
|
|
210
|
+
"free",
|
|
211
|
+
"cut",
|
|
212
|
+
"tr",
|
|
213
|
+
"jq",
|
|
214
|
+
"diff",
|
|
215
|
+
"true",
|
|
216
|
+
"false",
|
|
217
|
+
"test"
|
|
218
|
+
]);
|
|
219
|
+
var FORBIDDEN_FLAGS = {
|
|
220
|
+
// ripgrep's --pre / --pre-glob / --hostname-bin run an EXTERNAL program per
|
|
221
|
+
// file, which would hand execution to something the allow-list never saw.
|
|
222
|
+
rg: /^(--pre|--pre-glob|--hostname-bin)(=|$)/
|
|
223
|
+
};
|
|
224
|
+
function hasSideEffectingShellSyntax(command) {
|
|
225
|
+
return /[><]/.test(command) || // redirection, incl. >> and <()
|
|
226
|
+
/\$\(/.test(command) || // $( ) command substitution
|
|
227
|
+
/`/.test(command) || // backtick command substitution
|
|
228
|
+
/\bsudo\b/.test(command);
|
|
229
|
+
}
|
|
230
|
+
function isReadOnlyBashCommand(command) {
|
|
231
|
+
const trimmed = command.trim();
|
|
232
|
+
if (!trimmed) return false;
|
|
233
|
+
if (hasSideEffectingShellSyntax(trimmed)) return false;
|
|
234
|
+
const segments = trimmed.split(/&&|\|\||[;&|\n\r]/).map((seg) => seg.trim()).filter(Boolean);
|
|
235
|
+
if (segments.length === 0) return false;
|
|
236
|
+
return segments.every((segment) => {
|
|
237
|
+
const tokens = segment.split(/\s+/).filter(Boolean);
|
|
238
|
+
const program = tokens[0];
|
|
239
|
+
if (!program) return false;
|
|
240
|
+
if (/^[A-Za-z_][A-Za-z0-9_]*=/.test(program)) return false;
|
|
241
|
+
if (program.includes("/")) return false;
|
|
242
|
+
if (!DEGRADED_READ_ONLY_PROGRAMS.has(program)) return false;
|
|
243
|
+
const forbidden = FORBIDDEN_FLAGS[program];
|
|
244
|
+
if (forbidden && tokens.slice(1).some((t) => forbidden.test(t))) return false;
|
|
245
|
+
return true;
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
var DEGRADED_BLOCKED_NOTICE = [
|
|
249
|
+
"exe-os PreToolUse hook: THE DAEMON IS DEGRADED, and this is NOT a policy decision about your command.",
|
|
250
|
+
"",
|
|
251
|
+
"A DB call inside the hook stalled past its safeguard timeout, so the hook could not finish evaluating",
|
|
252
|
+
"the guards (worktree ownership, data-loss, main-history-rewrite). Because those guards did not run, the",
|
|
253
|
+
"hook declines to auto-approve a command that could mutate state \u2014 it is failing closed on purpose.",
|
|
254
|
+
"",
|
|
255
|
+
"Read-only commands (pwd, cat, ls, grep, git status/log/diff ...) DO still run while degraded; this",
|
|
256
|
+
"command was not classified as read-only. Note `git push` is deliberately excluded: the guard that would",
|
|
257
|
+
"catch a force-push to main is one of the ones currently not running.",
|
|
258
|
+
"",
|
|
259
|
+
"WHAT TO DO: do not retry with different syntax \u2014 the hook is not reading your command's semantics.",
|
|
260
|
+
"Check daemon health (`tail -100 ~/.exe-os/logs/exed-launchd.log`, or /exe-doctor), wait for it to",
|
|
261
|
+
"recover, and retry. If you have uncommitted work, commit it locally now so it is safe."
|
|
262
|
+
].join("\n");
|
|
479
263
|
function emitDegradedProceedOnce() {
|
|
480
264
|
if (hookStdoutWritten) return;
|
|
481
265
|
hookStdoutWritten = true;
|
|
482
|
-
|
|
483
|
-
|
|
266
|
+
const isBash = degradedSubject?.toolName === "Bash";
|
|
267
|
+
const command = degradedSubject?.command ?? "";
|
|
268
|
+
let readOnly = false;
|
|
269
|
+
try {
|
|
270
|
+
readOnly = isBash && isReadOnlyBashCommand(command);
|
|
271
|
+
} catch {
|
|
272
|
+
readOnly = false;
|
|
273
|
+
}
|
|
274
|
+
if (readOnly) {
|
|
275
|
+
process.stdout.write(JSON.stringify({
|
|
276
|
+
hookSpecificOutput: {
|
|
277
|
+
hookEventName: "PreToolUse",
|
|
278
|
+
permissionDecision: "allow",
|
|
279
|
+
permissionDecisionReason: "exe-os hook degraded (daemon stalled past the safeguard timeout). Command classified as read-only, so it is allowed \u2014 the skipped guards only govern mutating commands."
|
|
280
|
+
}
|
|
281
|
+
}));
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
process.stdout.write(JSON.stringify({
|
|
285
|
+
hookSpecificOutput: {
|
|
286
|
+
hookEventName: "PreToolUse",
|
|
287
|
+
additionalContext: DEGRADED_BLOCKED_NOTICE
|
|
288
|
+
},
|
|
289
|
+
systemMessage: DEGRADED_BLOCKED_NOTICE
|
|
290
|
+
}));
|
|
291
|
+
}
|
|
292
|
+
var PRE_PARSE_SAFEGUARD_MS = Math.max(PRE_TOOL_SAFEGUARD_MS, 250);
|
|
293
|
+
function armSafeguard(ms) {
|
|
294
|
+
const timeout2 = setTimeout(() => {
|
|
295
|
+
emitDegradedProceedOnce();
|
|
296
|
+
process.exit(0);
|
|
297
|
+
}, ms);
|
|
298
|
+
timeout2.unref();
|
|
299
|
+
return timeout2;
|
|
300
|
+
}
|
|
301
|
+
var timeout = armSafeguard(PRE_PARSE_SAFEGUARD_MS);
|
|
302
|
+
var restoreProofModule = null;
|
|
303
|
+
try {
|
|
304
|
+
restoreProofModule = await import("../restore-proof-HR4TXI3X.js");
|
|
305
|
+
} catch (err) {
|
|
306
|
+
process.stderr.write(
|
|
307
|
+
`[action-gateway] restore-proof.js failed to import: ${err instanceof Error ? err.stack ?? err.message : String(err)}
|
|
308
|
+
[action-gateway] destructive-data-guard blocking still fully enforced; only the backup-provenance audit note is unavailable.
|
|
309
|
+
`
|
|
484
310
|
);
|
|
485
311
|
}
|
|
486
|
-
|
|
487
|
-
|
|
312
|
+
function enforceActionPolicy(action, worktree) {
|
|
313
|
+
const ledgerPath = resolveLedgerPath();
|
|
314
|
+
const decision = decide(action, {
|
|
315
|
+
env: process.env,
|
|
316
|
+
homeDir: os.homedir(),
|
|
317
|
+
ledgerPath,
|
|
318
|
+
worktree,
|
|
319
|
+
restoreProof: restoreProofModule ? (storeId) => restoreProofModule.evaluateRestoreProof(storeId) : void 0
|
|
320
|
+
});
|
|
321
|
+
if (decision.record) {
|
|
322
|
+
const written = appendDecision(action, decision, { file: ledgerPath });
|
|
323
|
+
if (!written.ok) {
|
|
324
|
+
process.stderr.write(
|
|
325
|
+
`[action-gateway] AUDIT WRITE FAILED (${written.error}) \u2014 decision is still enforced, but this action is NOT in the ledger. Fix ${ledgerPath}.
|
|
326
|
+
`
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
for (const note of decision.notes) {
|
|
331
|
+
process.stderr.write(`[action-gateway] ${decision.ruleId ?? "no-rule"}: ${note}
|
|
332
|
+
`);
|
|
333
|
+
}
|
|
334
|
+
if (decision.effect === "allow") return;
|
|
335
|
+
const target = (action.command ?? action.filePath ?? "").split("\n")[0] ?? "";
|
|
336
|
+
process.stderr.write(
|
|
337
|
+
`[action-gateway] ${decision.effect.toUpperCase()} by ${decision.ruleId}: ${target.slice(0, 200)}
|
|
338
|
+
`
|
|
339
|
+
);
|
|
340
|
+
hookStdoutWritten = true;
|
|
341
|
+
process.stdout.write(
|
|
342
|
+
JSON.stringify({
|
|
343
|
+
hookSpecificOutput: {
|
|
344
|
+
hookEventName: "PreToolUse",
|
|
345
|
+
permissionDecision: decision.effect,
|
|
346
|
+
additionalContext: decision.reason
|
|
347
|
+
},
|
|
348
|
+
systemMessage: decision.reason
|
|
349
|
+
})
|
|
350
|
+
);
|
|
488
351
|
process.exit(0);
|
|
489
|
-
}
|
|
490
|
-
timeout.unref();
|
|
352
|
+
}
|
|
491
353
|
function getDelegationFlagPath() {
|
|
492
|
-
return
|
|
354
|
+
return path.join(CACHE_DIR, `delegation-checkpoint-${getSessionKey()}.json`);
|
|
493
355
|
}
|
|
494
356
|
function hasDelegationFired() {
|
|
495
357
|
try {
|
|
@@ -543,15 +405,15 @@ function getWorktreeContext(cwd = process.cwd()) {
|
|
|
543
405
|
return { isWorktree: false };
|
|
544
406
|
}
|
|
545
407
|
function pathContains(root, candidate) {
|
|
546
|
-
const relative =
|
|
547
|
-
return relative === "" || relative !== ".." && !relative.startsWith("../") && !
|
|
408
|
+
const relative = path.relative(path.resolve(root), path.resolve(candidate));
|
|
409
|
+
return relative === "" || relative !== ".." && !relative.startsWith("../") && !path.isAbsolute(relative);
|
|
548
410
|
}
|
|
549
411
|
function gitRootOf(filePath) {
|
|
550
|
-
let probe =
|
|
551
|
-
if (!existsSync(probe)) probe =
|
|
412
|
+
let probe = path.resolve(filePath);
|
|
413
|
+
if (!existsSync(probe)) probe = path.dirname(probe);
|
|
552
414
|
while (true) {
|
|
553
|
-
if (existsSync(
|
|
554
|
-
const parent =
|
|
415
|
+
if (existsSync(path.join(probe, ".git"))) return probe;
|
|
416
|
+
const parent = path.dirname(probe);
|
|
555
417
|
if (parent === probe) return null;
|
|
556
418
|
probe = parent;
|
|
557
419
|
}
|
|
@@ -559,11 +421,11 @@ function gitRootOf(filePath) {
|
|
|
559
421
|
function isMainRepoPath(filePath, ctx) {
|
|
560
422
|
if (!pathContains(ctx.repoRoot, filePath) || pathContains(ctx.worktreeRoot, filePath)) return false;
|
|
561
423
|
const targetGitRoot = gitRootOf(filePath);
|
|
562
|
-
return targetGitRoot === null ||
|
|
424
|
+
return targetGitRoot === null || path.resolve(targetGitRoot) === path.resolve(ctx.repoRoot);
|
|
563
425
|
}
|
|
564
426
|
function rewriteToWorktree(filePath, ctx) {
|
|
565
|
-
const relative =
|
|
566
|
-
return
|
|
427
|
+
const relative = path.relative(ctx.repoRoot, filePath);
|
|
428
|
+
return path.join(ctx.worktreeRoot, relative);
|
|
567
429
|
}
|
|
568
430
|
function shouldApplyOuterWorktreeGuard(filePath, ctx) {
|
|
569
431
|
return isMainRepoPath(filePath, ctx);
|
|
@@ -607,7 +469,13 @@ process.stdin.on("end", async () => {
|
|
|
607
469
|
process.exit(0);
|
|
608
470
|
}
|
|
609
471
|
const data = JSON.parse(input);
|
|
610
|
-
|
|
472
|
+
degradedSubject = {
|
|
473
|
+
toolName: data.tool_name,
|
|
474
|
+
command: data.tool_input?.command
|
|
475
|
+
};
|
|
476
|
+
clearTimeout(timeout);
|
|
477
|
+
timeout = armSafeguard(PRE_TOOL_SAFEGUARD_MS);
|
|
478
|
+
const agent = resolvePreToolUseAgentIdentity(getActiveAgent(), data);
|
|
611
479
|
let wroteStdout = false;
|
|
612
480
|
try {
|
|
613
481
|
if (data.tool_name === "Task" || data.tool_name === "Agent") {
|
|
@@ -621,11 +489,11 @@ process.stdin.on("end", async () => {
|
|
|
621
489
|
const ti = data.tool_input;
|
|
622
490
|
const haystack = `${ti?.description ?? ""}
|
|
623
491
|
${ti?.prompt ?? ""}`;
|
|
624
|
-
const { extractWorkRefCandidates } = await import("../work-claims-
|
|
492
|
+
const { extractWorkRefCandidates } = await import("../work-claims-PDQNLE5K.js");
|
|
625
493
|
if (extractWorkRefCandidates(haystack).length > 0) {
|
|
626
|
-
const { fastDbInit } = await import("../fast-db-init-
|
|
494
|
+
const { fastDbInit } = await import("../fast-db-init-GWUZ746B.js");
|
|
627
495
|
await fastDbInit({ caller: "hook" });
|
|
628
|
-
const { findConflictsInText, describeConflict, resolveHolderSession } = await import("../work-claims-
|
|
496
|
+
const { findConflictsInText, describeConflict, resolveHolderSession } = await import("../work-claims-PDQNLE5K.js");
|
|
629
497
|
const holderSession = await resolveHolderSession();
|
|
630
498
|
if (holderSession) {
|
|
631
499
|
const conflicts = await findConflictsInText(haystack, holderSession);
|
|
@@ -662,7 +530,7 @@ Session ${holderSession} does not hold this. Two sessions doing the same work is
|
|
|
662
530
|
}
|
|
663
531
|
if (data.tool_name === "Task" || data.tool_name === "Agent") {
|
|
664
532
|
try {
|
|
665
|
-
const { evaluateNestedSpawnGuard } = await import("../worktree-ownership-guard-
|
|
533
|
+
const { evaluateNestedSpawnGuard } = await import("../worktree-ownership-guard-4LKMW6PW.js");
|
|
666
534
|
const nestedDecision = evaluateNestedSpawnGuard({
|
|
667
535
|
toolName: data.tool_name,
|
|
668
536
|
toolInput: data.tool_input,
|
|
@@ -672,7 +540,11 @@ Session ${holderSession} does not hold this. Two sessions doing the same work is
|
|
|
672
540
|
process.stderr.write(`[pre-tool-use] nested-spawn isolation BLOCKED ${data.tool_name}
|
|
673
541
|
`);
|
|
674
542
|
process.stdout.write(JSON.stringify({
|
|
675
|
-
hookSpecificOutput: {
|
|
543
|
+
hookSpecificOutput: {
|
|
544
|
+
hookEventName: "PreToolUse",
|
|
545
|
+
permissionDecision: "deny",
|
|
546
|
+
additionalContext: nestedDecision.reason
|
|
547
|
+
},
|
|
676
548
|
systemMessage: nestedDecision.reason
|
|
677
549
|
}));
|
|
678
550
|
process.exit(0);
|
|
@@ -684,19 +556,28 @@ Session ${holderSession} does not hold this. Two sessions doing the same work is
|
|
|
684
556
|
}
|
|
685
557
|
if (["Bash", "Write", "Edit", "MultiEdit", "NotebookEdit"].includes(data.tool_name)) {
|
|
686
558
|
try {
|
|
687
|
-
const { evaluateWorktreeOwnership } = await import("../worktree-ownership-guard-
|
|
688
|
-
const ownershipDecision = evaluateWorktreeOwnership({
|
|
559
|
+
const { evaluateWorktreeOwnership } = await import("../worktree-ownership-guard-4LKMW6PW.js");
|
|
560
|
+
const ownershipDecision = await evaluateWorktreeOwnership({
|
|
689
561
|
toolName: data.tool_name,
|
|
690
562
|
cwd: data.cwd ?? process.cwd(),
|
|
563
|
+
// The Bash command string powers the cwd-deadlock escape hatch: a
|
|
564
|
+
// `cd` out of a foreign worktree (or a read-only command) must be
|
|
565
|
+
// allowed even though the PERSISTENT cwd is still inside it.
|
|
566
|
+
command: data.tool_name === "Bash" ? data.tool_input?.command ?? "" : void 0,
|
|
691
567
|
actorAgentId: data.agent_id ?? null,
|
|
692
568
|
sessionKey: getSessionKey()
|
|
693
569
|
});
|
|
694
570
|
if (ownershipDecision.outcome === "block") {
|
|
695
571
|
process.stderr.write(`[pre-tool-use] worktree-ownership BLOCKED ${data.tool_name}
|
|
696
572
|
`);
|
|
573
|
+
const reason = ownershipDecision.reason.trim() || `BLOCKED: worktree ownership guard denied this ${data.tool_name} call from ${data.cwd ?? process.cwd()}. Leave the foreign worktree with a cd to the repo root and retry.`;
|
|
697
574
|
process.stdout.write(JSON.stringify({
|
|
698
|
-
hookSpecificOutput: {
|
|
699
|
-
|
|
575
|
+
hookSpecificOutput: {
|
|
576
|
+
hookEventName: "PreToolUse",
|
|
577
|
+
permissionDecision: "deny",
|
|
578
|
+
additionalContext: reason
|
|
579
|
+
},
|
|
580
|
+
systemMessage: reason
|
|
700
581
|
}));
|
|
701
582
|
process.exit(0);
|
|
702
583
|
}
|
|
@@ -708,114 +589,20 @@ Session ${holderSession} does not hold this. Two sessions doing the same work is
|
|
|
708
589
|
if (data.tool_name === "Bash") {
|
|
709
590
|
const command = data.tool_input?.command ?? "";
|
|
710
591
|
const isCoordinator = canCoordinate(agent.agentId, agent.agentRole);
|
|
711
|
-
{
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
process.
|
|
720
|
-
}
|
|
721
|
-
if (guard.overridden) {
|
|
722
|
-
process.stderr.write(
|
|
723
|
-
`[pre-tool-use] MAIN-GUARD OVERRIDE used \u2014 destructive main-rewrite allowed via EXE_FORCE_ALLOW_MAIN_HISTORY_REWRITE=1: ${command}
|
|
724
|
-
`
|
|
725
|
-
);
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
{
|
|
729
|
-
const refGuard = evaluateRemoteRefDeleteGuard(command, process.env);
|
|
730
|
-
if (refGuard.block) {
|
|
731
|
-
process.stderr.write(
|
|
732
|
-
`[pre-tool-use] remote-ref-delete BLOCKED (${refGuard.spelling}): ${command}
|
|
733
|
-
`
|
|
734
|
-
);
|
|
735
|
-
process.stdout.write(JSON.stringify({
|
|
736
|
-
hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny" },
|
|
737
|
-
systemMessage: refGuard.message
|
|
738
|
-
}));
|
|
739
|
-
process.exit(0);
|
|
592
|
+
enforceActionPolicy({
|
|
593
|
+
tool: "Bash",
|
|
594
|
+
command,
|
|
595
|
+
cwd: process.cwd(),
|
|
596
|
+
actor: {
|
|
597
|
+
agentId: agent.agentId,
|
|
598
|
+
agentRole: agent.agentRole,
|
|
599
|
+
isCoordinator,
|
|
600
|
+
sessionId: process.env.EXE_SESSION_NAME
|
|
740
601
|
}
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
);
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
{
|
|
749
|
-
let decision = null;
|
|
750
|
-
let guardError = null;
|
|
751
|
-
try {
|
|
752
|
-
const { evaluateDestructiveDataGuard, formatAllowAudit } = await import("../destructive-data-guard-BVFWPPIS.js");
|
|
753
|
-
const result = evaluateDestructiveDataGuard(command, { cwd: process.cwd(), env: process.env });
|
|
754
|
-
decision = result;
|
|
755
|
-
if (!result.block && result.ops.length > 0) {
|
|
756
|
-
const { evaluateRestoreProof } = await import("../restore-proof-HR4TXI3X.js");
|
|
757
|
-
process.stderr.write(`${formatAllowAudit(result.ops, (id) => evaluateRestoreProof(id))}
|
|
758
|
-
`);
|
|
759
|
-
}
|
|
760
|
-
} catch (err) {
|
|
761
|
-
guardError = err instanceof Error ? err.stack ?? err.message : String(err);
|
|
762
|
-
}
|
|
763
|
-
if (guardError !== null) {
|
|
764
|
-
const msg = `BLOCKED: the irreversible-data-operation guard could not evaluate this command, so it is refused.
|
|
765
|
-
Guard error: ${guardError}
|
|
766
|
-
This gate fails CLOSED by design \u2014 "the check did not run" is never "the operation is safe".
|
|
767
|
-
Fix the guard (src/lib/destructive-data-guard.ts) rather than routing around it.`;
|
|
768
|
-
process.stderr.write(`[pre-tool-use] destructive-data-guard ERROR \u2192 fail-closed block: ${guardError}
|
|
769
|
-
`);
|
|
770
|
-
process.stdout.write(
|
|
771
|
-
JSON.stringify({
|
|
772
|
-
hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny", additionalContext: msg },
|
|
773
|
-
systemMessage: msg
|
|
774
|
-
})
|
|
775
|
-
);
|
|
776
|
-
process.exit(0);
|
|
777
|
-
}
|
|
778
|
-
if (decision?.block) {
|
|
779
|
-
process.stderr.write(`[pre-tool-use] destructive-data-guard BLOCKED: ${command}
|
|
780
|
-
`);
|
|
781
|
-
process.stdout.write(
|
|
782
|
-
JSON.stringify({
|
|
783
|
-
hookSpecificOutput: {
|
|
784
|
-
hookEventName: "PreToolUse",
|
|
785
|
-
permissionDecision: "deny",
|
|
786
|
-
additionalContext: decision.message
|
|
787
|
-
},
|
|
788
|
-
systemMessage: decision.message
|
|
789
|
-
})
|
|
790
|
-
);
|
|
791
|
-
process.exit(0);
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
if (!isCoordinator && commandTouchesProtectedAgentSettings(command, os.homedir())) {
|
|
795
|
-
const output = JSON.stringify({
|
|
796
|
-
hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny" },
|
|
797
|
-
systemMessage: settingsTamperDenyMessage("Claude/exe-os settings")
|
|
798
|
-
});
|
|
799
|
-
process.stdout.write(output);
|
|
800
|
-
process.exit(0);
|
|
801
|
-
}
|
|
802
|
-
if (/tmux\s+send-keys/i.test(command)) {
|
|
803
|
-
if (!isCoordinator) {
|
|
804
|
-
const output = JSON.stringify({
|
|
805
|
-
hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny" },
|
|
806
|
-
systemMessage: `\u274C BLOCKED: tmux send-keys is not allowed for non-coordinator agents.
|
|
807
|
-
Use MCP tools to communicate:
|
|
808
|
-
- create_task to assign work (auto-spawns + sends intercom)
|
|
809
|
-
- send_message for context
|
|
810
|
-
- update_task to report status
|
|
811
|
-
- task(action="resume") to respawn a dead session
|
|
812
|
-
Read-only tmux (capture-pane, list-sessions) is fine for monitoring.
|
|
813
|
-
If MCP is down, tell the user: "MCP disconnected. Run /mcp to reconnect."`
|
|
814
|
-
});
|
|
815
|
-
process.stdout.write(output);
|
|
816
|
-
process.exit(0);
|
|
817
|
-
}
|
|
818
|
-
}
|
|
602
|
+
}, (() => {
|
|
603
|
+
const wt = getWorktreeContext();
|
|
604
|
+
return { isWorktree: wt.isWorktree, root: wt.isWorktree ? wt.worktreeRoot : null };
|
|
605
|
+
})());
|
|
819
606
|
}
|
|
820
607
|
if (data.tool_name === "Bash") {
|
|
821
608
|
const cmd = data.tool_input?.command ?? "";
|
|
@@ -884,7 +671,7 @@ NEVER write to the main repo from a worktree. The main repo belongs to the coord
|
|
|
884
671
|
const targetDir = targetSegments[0];
|
|
885
672
|
const currentProject = process.cwd().split("/").pop();
|
|
886
673
|
if (targetDir && currentProject && targetDir !== currentProject && !command.includes("worktree")) {
|
|
887
|
-
const expandHome = (p) => p.startsWith("~/") ?
|
|
674
|
+
const expandHome = (p) => p.startsWith("~/") ? path.join(os.homedir(), p.slice(2)) : p;
|
|
888
675
|
const gitRootOf2 = (dir) => {
|
|
889
676
|
try {
|
|
890
677
|
return execFileSync("git", ["-C", dir, "rev-parse", "--show-toplevel"], {
|
|
@@ -897,7 +684,7 @@ NEVER write to the main repo from a worktree. The main repo belongs to the coord
|
|
|
897
684
|
}
|
|
898
685
|
};
|
|
899
686
|
const currentRepoRoot = gitRootOf2(process.cwd());
|
|
900
|
-
const absTarget =
|
|
687
|
+
const absTarget = path.resolve(process.cwd(), expandHome(cdTarget));
|
|
901
688
|
let probe = absTarget;
|
|
902
689
|
let targetRepoRoot = null;
|
|
903
690
|
for (let depth = 0; depth < 12 && probe && probe !== "/"; depth++) {
|
|
@@ -906,7 +693,7 @@ NEVER write to the main repo from a worktree. The main repo belongs to the coord
|
|
|
906
693
|
targetRepoRoot = root;
|
|
907
694
|
break;
|
|
908
695
|
}
|
|
909
|
-
probe =
|
|
696
|
+
probe = path.dirname(probe);
|
|
910
697
|
}
|
|
911
698
|
const currentRepoName = currentRepoRoot?.split("/").pop() ?? null;
|
|
912
699
|
const isMonorepoNavigation = currentRepoRoot !== null && targetRepoRoot !== null && currentRepoRoot === targetRepoRoot || currentRepoName !== null && targetDir === currentRepoName;
|
|
@@ -971,12 +758,36 @@ Rerun ${data.tool_name} with this worktree path instead: ${rewritten}`
|
|
|
971
758
|
process.exit(0);
|
|
972
759
|
}
|
|
973
760
|
}
|
|
974
|
-
if (/^(Write|Edit)$/.test(data.tool_name)
|
|
975
|
-
const filePath = data.tool_input?.file_path ?? "";
|
|
976
|
-
if (
|
|
761
|
+
if (/^(Write|Edit|MultiEdit|NotebookEdit)$/.test(data.tool_name)) {
|
|
762
|
+
const filePath = data.tool_input?.file_path ?? data.tool_input?.notebook_path ?? "";
|
|
763
|
+
if (filePath) {
|
|
764
|
+
enforceActionPolicy({
|
|
765
|
+
tool: data.tool_name,
|
|
766
|
+
filePath,
|
|
767
|
+
cwd: process.cwd(),
|
|
768
|
+
actor: {
|
|
769
|
+
agentId: agent.agentId,
|
|
770
|
+
agentRole: agent.agentRole,
|
|
771
|
+
isCoordinator: canCoordinate(agent.agentId, agent.agentRole),
|
|
772
|
+
sessionId: process.env.EXE_SESSION_NAME
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
if (/^(Write|Edit|NotebookEdit)$/.test(data.tool_name)) {
|
|
778
|
+
const filePath = data.tool_input?.file_path ?? data.tool_input?.notebook_path ?? "";
|
|
779
|
+
const wtCtxScratch = getWorktreeContext();
|
|
780
|
+
const scratch = evaluateScratchPathTarget(filePath, {
|
|
781
|
+
cwd: process.cwd(),
|
|
782
|
+
surface: "tool",
|
|
783
|
+
worktreeRoot: wtCtxScratch.isWorktree ? wtCtxScratch.worktreeRoot : null
|
|
784
|
+
});
|
|
785
|
+
if (scratch.block) {
|
|
786
|
+
process.stderr.write(`[pre-tool-use] lesson-guard BLOCKED (shared-scratch-path): ${filePath}
|
|
787
|
+
`);
|
|
977
788
|
const output = JSON.stringify({
|
|
978
789
|
hookSpecificOutput: { hookEventName: "PreToolUse", permissionDecision: "deny" },
|
|
979
|
-
systemMessage:
|
|
790
|
+
systemMessage: scratch.message
|
|
980
791
|
});
|
|
981
792
|
process.stdout.write(output);
|
|
982
793
|
process.exit(0);
|
|
@@ -1018,7 +829,7 @@ Do NOT report this as successful. No file was changed. If you are a sub-agent, r
|
|
|
1018
829
|
process.exit(0);
|
|
1019
830
|
}
|
|
1020
831
|
}
|
|
1021
|
-
const { getGatedAgent } = await import("../cto-delegation-gate-
|
|
832
|
+
const { getGatedAgent } = await import("../cto-delegation-gate-O6XPGECP.js");
|
|
1022
833
|
const gatedAgent = getGatedAgent();
|
|
1023
834
|
if (agent.agentId === gatedAgent) {
|
|
1024
835
|
const isStructured = /^(Write|Edit|MultiEdit|NotebookEdit)$/.test(data.tool_name);
|
|
@@ -1030,7 +841,7 @@ Do NOT report this as successful. No file was changed. If you are a sub-agent, r
|
|
|
1030
841
|
evaluateDelegationGate,
|
|
1031
842
|
evaluateBashWriteGate,
|
|
1032
843
|
GATE_BLOCK_MESSAGE
|
|
1033
|
-
} = await import("../cto-delegation-gate-
|
|
844
|
+
} = await import("../cto-delegation-gate-O6XPGECP.js");
|
|
1034
845
|
let decision = null;
|
|
1035
846
|
let surfaceLabel = data.tool_name;
|
|
1036
847
|
let targetLabel = "";
|
|
@@ -1039,7 +850,7 @@ Do NOT report this as successful. No file was changed. If you are a sub-agent, r
|
|
|
1039
850
|
const filePath = data.tool_name === "NotebookEdit" ? ti.notebook_path ?? "" : ti.file_path ?? "";
|
|
1040
851
|
const content = data.tool_name === "MultiEdit" ? (ti.edits ?? []).map((e) => e.new_string ?? "").filter(Boolean) : data.tool_name === "NotebookEdit" ? ti.new_source : ti.content ?? ti.new_string;
|
|
1041
852
|
if (filePath) {
|
|
1042
|
-
const { fastDbInit } = await import("../fast-db-init-
|
|
853
|
+
const { fastDbInit } = await import("../fast-db-init-GWUZ746B.js");
|
|
1043
854
|
await fastDbInit({ caller: "hook" });
|
|
1044
855
|
targetLabel = filePath;
|
|
1045
856
|
decision = await evaluateDelegationGate({
|
|
@@ -1052,10 +863,10 @@ Do NOT report this as successful. No file was changed. If you are a sub-agent, r
|
|
|
1052
863
|
}
|
|
1053
864
|
} else {
|
|
1054
865
|
const command = data.tool_input?.command ?? "";
|
|
1055
|
-
const { detectBashSourceWrites } = await import("../cto-delegation-gate-
|
|
866
|
+
const { detectBashSourceWrites } = await import("../cto-delegation-gate-O6XPGECP.js");
|
|
1056
867
|
const targets = detectBashSourceWrites(command, process.cwd());
|
|
1057
868
|
if (targets.length > 0) {
|
|
1058
|
-
const { fastDbInit } = await import("../fast-db-init-
|
|
869
|
+
const { fastDbInit } = await import("../fast-db-init-GWUZ746B.js");
|
|
1059
870
|
await fastDbInit({ caller: "hook" });
|
|
1060
871
|
surfaceLabel = "Bash-write";
|
|
1061
872
|
targetLabel = targets.join(", ");
|
|
@@ -1132,7 +943,7 @@ Reason: ${decision.reason ?? "engineer-delegatable edit"}`;
|
|
|
1132
943
|
const isUpdateTaskDone = (data.tool_name === "mcp__exe-os__update_task" || data.tool_name === "mcp__exe-mem__update_task") && toolInput.status === "done" && CTO_ROLES.includes(agent.agentRole);
|
|
1133
944
|
if (isUpdateTaskDone) {
|
|
1134
945
|
try {
|
|
1135
|
-
const { fastDbInit } = await import("../fast-db-init-
|
|
946
|
+
const { fastDbInit } = await import("../fast-db-init-GWUZ746B.js");
|
|
1136
947
|
const client = await fastDbInit({ caller: "hook" });
|
|
1137
948
|
const taskId = String(toolInput.task_id ?? "");
|
|
1138
949
|
const ptScope = sessionScopeFilter();
|
|
@@ -1190,7 +1001,7 @@ Reason: ${decision.reason ?? "engineer-delegatable edit"}`;
|
|
|
1190
1001
|
}
|
|
1191
1002
|
if (data.agent_type == null && CTO_ROLES.includes(agent.agentRole) && !hasDelegationFired()) {
|
|
1192
1003
|
try {
|
|
1193
|
-
const { fastDbInit } = await import("../fast-db-init-
|
|
1004
|
+
const { fastDbInit } = await import("../fast-db-init-GWUZ746B.js");
|
|
1194
1005
|
const client = await fastDbInit({ caller: "hook" });
|
|
1195
1006
|
const dlScope = sessionScopeFilter();
|
|
1196
1007
|
const result = await client.execute({
|
|
@@ -1262,7 +1073,7 @@ Do NOT attempt workarounds \u2014 direct DB access bypasses encryption, breaks d
|
|
|
1262
1073
|
}
|
|
1263
1074
|
if (!wroteStdout && data.agent_type != null) {
|
|
1264
1075
|
try {
|
|
1265
|
-
const { buildSubagentBootstrapContext } = await import("../subagent-brief-injection-
|
|
1076
|
+
const { buildSubagentBootstrapContext } = await import("../subagent-brief-injection-HCKZQZBF.js");
|
|
1266
1077
|
const subagentBrief = await buildSubagentBootstrapContext(data);
|
|
1267
1078
|
if (subagentBrief) {
|
|
1268
1079
|
const output = JSON.stringify({
|
|
@@ -1285,8 +1096,8 @@ Do NOT attempt workarounds \u2014 direct DB access bypasses encryption, breaks d
|
|
|
1285
1096
|
selectUrgentUnsurfaced,
|
|
1286
1097
|
formatInRunInboxBanner
|
|
1287
1098
|
} = await import("../inrun-inbox-DRKVDPLY.js");
|
|
1288
|
-
const throttlePath =
|
|
1289
|
-
const seenPath =
|
|
1099
|
+
const throttlePath = path.join(CACHE_DIR, `inrun-inbox-check-${getSessionKey()}.json`);
|
|
1100
|
+
const seenPath = path.join(CACHE_DIR, `inrun-inbox-seen-${getSessionKey()}.json`);
|
|
1290
1101
|
let lastCheckMs = null;
|
|
1291
1102
|
try {
|
|
1292
1103
|
const { readFileSync } = await import("fs");
|
|
@@ -1299,7 +1110,7 @@ Do NOT attempt workarounds \u2014 direct DB access bypasses encryption, breaks d
|
|
|
1299
1110
|
writeFileSync(throttlePath, JSON.stringify({ ts: Date.now() }));
|
|
1300
1111
|
} catch {
|
|
1301
1112
|
}
|
|
1302
|
-
const { fastDbInit } = await import("../fast-db-init-
|
|
1113
|
+
const { fastDbInit } = await import("../fast-db-init-GWUZ746B.js");
|
|
1303
1114
|
const client = await fastDbInit({ daemonOnly: true, caller: "hook" });
|
|
1304
1115
|
const { isInitialized } = await import("../lib/database.js");
|
|
1305
1116
|
if (isInitialized()) {
|
|
@@ -1339,3 +1150,6 @@ Do NOT attempt workarounds \u2014 direct DB access bypasses encryption, breaks d
|
|
|
1339
1150
|
clearTimeout(timeout);
|
|
1340
1151
|
process.exit(0);
|
|
1341
1152
|
});
|
|
1153
|
+
export {
|
|
1154
|
+
isReadOnlyBashCommand
|
|
1155
|
+
};
|