@askexenow/exe-os 0.9.409 → 0.9.411

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.
Files changed (409) hide show
  1. package/deploy/stack-manifests/v0.9.json +408 -1
  2. package/dist/.dist-verified.json +3 -3
  3. package/dist/{active-agent-5AKPW2N7.js → active-agent-3YCLS7GB.js} +4 -4
  4. package/dist/{active-agent-2AMJC3SC.js → active-agent-MHWQDMML.js} +4 -4
  5. package/dist/agent-defs-generator-DNXMO34I.js +32 -0
  6. package/dist/{agentic-ontology-6RS7A7KP.js → agentic-ontology-RA6CMND6.js} +1 -1
  7. package/dist/{artifact-backup-6O4FNYPS.js → artifact-backup-EETHNFFP.js} +3 -3
  8. package/dist/{backfill-metadata-6YX6LGPJ.js → backfill-metadata-WYT257VG.js} +7 -7
  9. package/dist/backup-verify-AG54CYGR.js +62 -0
  10. package/dist/{behavior-injection-NRXTNROW.js → behavior-injection-G7GAUHGO.js} +10 -10
  11. package/dist/{behavior-promotion-MW7OQ72V.js → behavior-promotion-I2DIUFUR.js} +9 -9
  12. package/dist/{behaviors-7AOK44QK.js → behaviors-SKVKPCRW.js} +8 -8
  13. package/dist/bin/agentic-ontology-backfill.js +8 -8
  14. package/dist/bin/agentic-reflection-backfill.js +9 -9
  15. package/dist/bin/agentic-semantic-label.js +8 -8
  16. package/dist/bin/backfill-conversations.js +7 -7
  17. package/dist/bin/backfill-responses.js +7 -7
  18. package/dist/bin/backfill-vectors.js +7 -7
  19. package/dist/bin/bulk-sync-postgres.js +16 -16
  20. package/dist/bin/cc-doctor.js +8 -8
  21. package/dist/bin/cleanup-stale-review-tasks.js +13 -16
  22. package/dist/bin/cli.js +24 -24
  23. package/dist/bin/deferred-daemon-restart.js +97 -97
  24. package/dist/bin/exe-actions.js +1 -1
  25. package/dist/bin/exe-agent-config.js +3 -3
  26. package/dist/bin/exe-agent.js +12 -12
  27. package/dist/bin/exe-assign.js +8 -8
  28. package/dist/bin/exe-boot.js +35 -38
  29. package/dist/bin/exe-call.js +9 -9
  30. package/dist/bin/exe-cloud.js +26 -22
  31. package/dist/bin/exe-config-dump.js +3 -3
  32. package/dist/bin/exe-dispatch.js +14 -17
  33. package/dist/bin/exe-doctor.js +5 -5
  34. package/dist/bin/exe-export-behaviors.js +12 -12
  35. package/dist/bin/exe-forget.js +12 -12
  36. package/dist/bin/exe-gateway.js +9 -9
  37. package/dist/bin/exe-grant.js +6 -6
  38. package/dist/bin/exe-healthcheck.js +8 -8
  39. package/dist/bin/exe-heartbeat.js +19 -22
  40. package/dist/bin/exe-kill.js +18 -21
  41. package/dist/bin/exe-launch-agent.js +264 -110
  42. package/dist/bin/exe-mcp.js +5 -5
  43. package/dist/bin/exe-memory-reads.js +7 -7
  44. package/dist/bin/exe-new-employee.js +11 -11
  45. package/dist/bin/exe-os-mcp-proxy.js +5 -5
  46. package/dist/bin/exe-pending-messages.js +14 -17
  47. package/dist/bin/exe-pending-notifications.js +13 -16
  48. package/dist/bin/exe-pending-reviews.js +14 -17
  49. package/dist/bin/exe-rename.js +7 -7
  50. package/dist/bin/exe-review.js +17 -20
  51. package/dist/bin/exe-search.js +11 -11
  52. package/dist/bin/exe-session-cleanup.js +18 -21
  53. package/dist/bin/exe-settings.js +16 -16
  54. package/dist/bin/exe-start-codex.js +37 -19
  55. package/dist/bin/exe-start-opencode.js +35 -17
  56. package/dist/bin/exe-status.js +15 -18
  57. package/dist/bin/exe-support.js +3 -3
  58. package/dist/bin/exe-team.js +5 -5
  59. package/dist/bin/git-sweep.js +15 -17
  60. package/dist/bin/graph-backfill.js +8 -8
  61. package/dist/bin/graph-export.js +8 -8
  62. package/dist/bin/hooks-cli.js +1 -1
  63. package/dist/bin/import-history.js +11 -11
  64. package/dist/bin/install.js +99 -99
  65. package/dist/bin/intercom-check.js +5 -5
  66. package/dist/bin/mcp-sessions.js +2 -2
  67. package/dist/bin/orchestration-metrics.js +5 -5
  68. package/dist/bin/postgres-agentic-reflection-backfill.js +2 -2
  69. package/dist/bin/postgres-agentic-semantic-backfill.js +1 -1
  70. package/dist/bin/pre-publish.js +1 -1
  71. package/dist/bin/reconcile-backlog.js +2 -2
  72. package/dist/bin/registry-proxy.js +1 -1
  73. package/dist/bin/repair-document-chunks.js +7 -7
  74. package/dist/bin/scan-tasks.js +14 -17
  75. package/dist/bin/setup.js +2 -2
  76. package/dist/bin/shard-migrate.js +8 -8
  77. package/dist/bin/stack-update.js +4 -4
  78. package/dist/bin/vps-health-gate.js +1 -1
  79. package/dist/{boot-generation-HG6LLZLY.js → boot-generation-RPJVFAQJ.js} +4 -4
  80. package/dist/{boot-review-sections-STZ5EAIL.js → boot-review-sections-FOPPZTJI.js} +12 -15
  81. package/dist/{bug-landed-reconciler-EO72HUI2.js → bug-landed-reconciler-FN5KPBRK.js} +6 -6
  82. package/dist/build-info.json +3 -3
  83. package/dist/build-manifest.json +997 -987
  84. package/dist/{capability-cards-C3SMHB2E.js → capability-cards-YQWBEG7A.js} +3 -3
  85. package/dist/{capacity-monitor-UI553HRL.js → capacity-monitor-7SMEJHYG.js} +14 -17
  86. package/dist/{catchup-brief-VE2X4HML.js → catchup-brief-IBQ26LEB.js} +21 -23
  87. package/dist/{chunk-6ZW6BRI4.js → chunk-27NG2NTG.js} +2 -2
  88. package/dist/{chunk-EIM7OGTD.js → chunk-2BOLFLAU.js} +4 -2
  89. package/dist/{chunk-DM4VTXM6.js → chunk-2EYVXUGA.js} +4 -4
  90. package/dist/{chunk-LMF2YC5C.js → chunk-2YFMBXUU.js} +4 -4
  91. package/dist/{chunk-C426MZMD.js → chunk-2YGBJHC2.js} +3 -3
  92. package/dist/{chunk-6EY6OFBC.js → chunk-353XF4LU.js} +2 -2
  93. package/dist/{chunk-VMHZSZQJ.js → chunk-3ARSKDHC.js} +52 -0
  94. package/dist/{chunk-ZYOIH5NY.js → chunk-3DXAJVXE.js} +6 -6
  95. package/dist/{chunk-HFSFWMID.js → chunk-3GGMHSY2.js} +3 -3
  96. package/dist/{chunk-BM467PZN.js → chunk-3N24FV22.js} +1 -1
  97. package/dist/{chunk-SY53PYLU.js → chunk-47YGEM4N.js} +1 -1
  98. package/dist/{chunk-NVM3SKJ4.js → chunk-4CN3EE6U.js} +27 -21
  99. package/dist/{chunk-KIJRAZWR.js → chunk-4J77TCTX.js} +1 -1
  100. package/dist/{chunk-NHQWPKX7.js → chunk-54STF27U.js} +2 -2
  101. package/dist/{chunk-Q4GS5VW7.js → chunk-5BWDUUMH.js} +3 -3
  102. package/dist/{chunk-VYKXRSHU.js → chunk-5ZMNFSHV.js} +1 -1
  103. package/dist/{chunk-HNGAM3U4.js → chunk-657I6PUF.js} +3 -3
  104. package/dist/{chunk-OE7TAEOG.js → chunk-6777GNWI.js} +1 -1
  105. package/dist/{chunk-HYZV25LY.js → chunk-67IVG6CB.js} +1 -11
  106. package/dist/{chunk-5N34MMKS.js → chunk-6APOLYIZ.js} +43 -3
  107. package/dist/{chunk-TBYWOHTE.js → chunk-6BD6JYR2.js} +1 -1
  108. package/dist/{chunk-JJYAETCO.js → chunk-6DMURUBY.js} +4 -4
  109. package/dist/{chunk-W5XAB2SW.js → chunk-6HJF7IA3.js} +273 -206
  110. package/dist/{chunk-HRKN3DQE.js → chunk-6J2J3VJS.js} +11 -11
  111. package/dist/{chunk-XFGS22VE.js → chunk-6PXFF6IV.js} +1 -1
  112. package/dist/{chunk-RZ23QQCI.js → chunk-7HLAYQRG.js} +4 -4
  113. package/dist/{chunk-IUBCS6TA.js → chunk-7KPZQ65I.js} +3 -3
  114. package/dist/{chunk-SYUJCVJG.js → chunk-7PDZBPGW.js} +1 -1
  115. package/dist/{chunk-VLAENYCN.js → chunk-7SHU5MOD.js} +1 -1
  116. package/dist/{chunk-6RRPVE5O.js → chunk-A5I2GYVQ.js} +3 -3
  117. package/dist/{chunk-X4V5ZLNX.js → chunk-A75TAU2I.js} +628 -4
  118. package/dist/{chunk-SGR4ZQAV.js → chunk-BE3UETW6.js} +3 -3
  119. package/dist/{chunk-GG73NHZD.js → chunk-BG6RAOCJ.js} +63 -9
  120. package/dist/{chunk-DMYJVGQM.js → chunk-BIPTWAEO.js} +1 -1
  121. package/dist/{chunk-B3ISLIKE.js → chunk-BLTXAUP6.js} +2 -2
  122. package/dist/{chunk-G2M7WQ2M.js → chunk-CBC3JCIF.js} +1 -1
  123. package/dist/{chunk-FJKUFMNF.js → chunk-CFFSHBQF.js} +1 -1
  124. package/dist/{chunk-WYNIWJRN.js → chunk-CJ6CS2IH.js} +5 -5
  125. package/dist/{chunk-7LTAA55U.js → chunk-CRW63CDI.js} +1 -1
  126. package/dist/{chunk-BHDDDNC6.js → chunk-CWHTUNJX.js} +2 -2
  127. package/dist/{chunk-FZT4VQP7.js → chunk-D6NZNUVH.js} +1 -1
  128. package/dist/{chunk-GKPPLIMJ.js → chunk-DHLJZDWI.js} +4 -4
  129. package/dist/{chunk-JR3GTBV3.js → chunk-DRHTRVDT.js} +1 -1
  130. package/dist/{chunk-GTRB6DGI.js → chunk-DWRULKB3.js} +2 -2
  131. package/dist/{chunk-DIKLSAJE.js → chunk-EOWJXCYC.js} +25 -7
  132. package/dist/{chunk-4W7Y67B5.js → chunk-EWDBWOCX.js} +1 -1
  133. package/dist/{chunk-EHILXBVT.js → chunk-FPF2PJFK.js} +3 -3
  134. package/dist/{chunk-BPBEJD7U.js → chunk-FSXMKIDO.js} +1 -1
  135. package/dist/{chunk-E2Z3F26R.js → chunk-FUDXITKX.js} +1 -1
  136. package/dist/{chunk-SFGFNJBR.js → chunk-FYV2CTKP.js} +1 -1
  137. package/dist/{chunk-4M24XCTI.js → chunk-GATAYYAF.js} +53 -7
  138. package/dist/{chunk-L5CPS34O.js → chunk-GHYHNHDL.js} +1 -1
  139. package/dist/{chunk-OISOA6NX.js → chunk-GL5ZG72X.js} +1 -1
  140. package/dist/{chunk-XAGIZVYI.js → chunk-GM4UEZDE.js} +181 -1625
  141. package/dist/{chunk-4O7OUBEX.js → chunk-GZVFHFO3.js} +27 -140
  142. package/dist/{chunk-M4N7I2H5.js → chunk-HA6BIZ6L.js} +5 -5
  143. package/dist/chunk-HDQAVAV6.js +248 -0
  144. package/dist/{chunk-IPANAGA3.js → chunk-HDV2V25K.js} +1 -1
  145. package/dist/{chunk-XGPBHKU3.js → chunk-HTFM7ZDD.js} +2 -2
  146. package/dist/{chunk-KPLMY2GT.js → chunk-HUHR5CKJ.js} +4 -4
  147. package/dist/{chunk-IPBNHPTE.js → chunk-IC2AONBH.js} +9 -9
  148. package/dist/{chunk-23XUZHB7.js → chunk-IHAXXDBH.js} +245 -36
  149. package/dist/{chunk-4S6H2NWS.js → chunk-IPUDXR67.js} +1 -1
  150. package/dist/{chunk-UXJAW4IQ.js → chunk-J6U4ZR77.js} +2 -2
  151. package/dist/{chunk-7I6KVKFF.js → chunk-JAIZCE6W.js} +3 -3
  152. package/dist/{chunk-SA66WRBT.js → chunk-JGBYZTWH.js} +1 -1
  153. package/dist/{chunk-HRYWB4TO.js → chunk-JJZZXEAN.js} +3 -3
  154. package/dist/{chunk-IZ24HRDC.js → chunk-JNULO6I5.js} +3 -3
  155. package/dist/{chunk-YVS77JPW.js → chunk-JTJP4JK7.js} +3 -3
  156. package/dist/{chunk-BIV4IHED.js → chunk-JW5NUXPN.js} +15 -28
  157. package/dist/{chunk-NFNM64A7.js → chunk-K2HIXAIF.js} +22 -18
  158. package/dist/{chunk-F5ZRHLG5.js → chunk-KEDZRQI3.js} +2 -2
  159. package/dist/{chunk-QPMKVSHU.js → chunk-KN5GAVCG.js} +2 -2
  160. package/dist/{chunk-3MDUKF3N.js → chunk-L5JFVK5T.js} +5 -4
  161. package/dist/{chunk-FBZ32BD4.js → chunk-LBSCOP25.js} +1 -1
  162. package/dist/{chunk-K7DAE2HO.js → chunk-LLZUL7M2.js} +19 -6
  163. package/dist/{chunk-PCFYNK7V.js → chunk-LQGLGSBY.js} +2 -2
  164. package/dist/{chunk-APVU4Q5B.js → chunk-LSHUX7P4.js} +16 -16
  165. package/dist/{chunk-GRAMRMWS.js → chunk-M6AX64J2.js} +2 -2
  166. package/dist/{chunk-52Z435PH.js → chunk-M6SUJLNP.js} +15 -10
  167. package/dist/{chunk-GPWXUU3L.js → chunk-MZNLQC6W.js} +1 -1
  168. package/dist/{chunk-G3ZYXXO7.js → chunk-N7POJZJT.js} +10 -10
  169. package/dist/{chunk-DE2V7547.js → chunk-NCNT2C2P.js} +2 -2
  170. package/dist/{chunk-HK7HIDXP.js → chunk-O3BLL6MY.js} +1 -1
  171. package/dist/{chunk-YLWKWEJJ.js → chunk-O6KQAJCC.js} +3 -3
  172. package/dist/{chunk-QUK3UDZV.js → chunk-OHHZNNUD.js} +1 -1
  173. package/dist/{chunk-6JLVCMKH.js → chunk-PDQGR5LZ.js} +1 -1
  174. package/dist/{chunk-LE3DIA25.js → chunk-PTF5TB6O.js} +3 -3
  175. package/dist/{chunk-KBHK2WNO.js → chunk-PYXXL7N7.js} +1 -1
  176. package/dist/{chunk-QK3Z4TKQ.js → chunk-Q6KUBP6R.js} +5 -5
  177. package/dist/{chunk-NDCW4G55.js → chunk-QJWLQXR7.js} +1 -1
  178. package/dist/{chunk-ME733Y2F.js → chunk-QOFQY7BJ.js} +37 -9
  179. package/dist/{chunk-HFXBL7XE.js → chunk-QSW5DHMZ.js} +1 -1
  180. package/dist/{chunk-OFT5KSBM.js → chunk-QV26G2BF.js} +1 -1
  181. package/dist/{chunk-LVEMYNYH.js → chunk-RHHEYC6H.js} +3 -3
  182. package/dist/{chunk-QYIR64RR.js → chunk-RHJOTGEU.js} +1 -1
  183. package/dist/{chunk-HUMNRJZE.js → chunk-RJIH7JXM.js} +4 -4
  184. package/dist/{chunk-6TB7UXCA.js → chunk-RMC2A6EE.js} +1 -1
  185. package/dist/{chunk-XCPD7NGP.js → chunk-RYMXD2NT.js} +1 -1
  186. package/dist/{chunk-W2VDJKTB.js → chunk-RYYFFCJG.js} +1 -1
  187. package/dist/{chunk-YUAOQJVV.js → chunk-SINIRUYZ.js} +101 -9
  188. package/dist/{chunk-R7QZXQPU.js → chunk-SXUABANK.js} +216 -147
  189. package/dist/{backup-verify-QIAQ63VC.js → chunk-T3AM52YT.js} +411 -90
  190. package/dist/{chunk-NK4JHJNP.js → chunk-TCBWHLKH.js} +4 -4
  191. package/dist/{chunk-R6CKQLEA.js → chunk-TS4LSNRI.js} +2 -2
  192. package/dist/{chunk-4Q7H3TO7.js → chunk-TVWYMOZ4.js} +1 -1
  193. package/dist/{chunk-TCV3WA5I.js → chunk-VAHQOIQY.js} +1 -1
  194. package/dist/{chunk-ZEHBSA25.js → chunk-VQQPYI4X.js} +1 -1
  195. package/dist/{chunk-PZDAPIQL.js → chunk-VS7V5HNO.js} +1 -1
  196. package/dist/{chunk-7R7KDRKV.js → chunk-W7VKGB42.js} +1 -1
  197. package/dist/{chunk-M7774YLB.js → chunk-WC44PNZU.js} +1 -1
  198. package/dist/{chunk-3AL2LO3L.js → chunk-WHUQ44F2.js} +1 -1
  199. package/dist/{chunk-4RQ62XXK.js → chunk-X2ZHCNNB.js} +5 -5
  200. package/dist/{chunk-T2PAFWRK.js → chunk-X4FHT6ST.js} +5 -5
  201. package/dist/{chunk-N3JEYUDV.js → chunk-XC5OASHV.js} +1 -1
  202. package/dist/{agent-defs-generator-QN3J6FVJ.js → chunk-XDOCXKHW.js} +61 -21
  203. package/dist/{chunk-OEHZ46WQ.js → chunk-XEAZJXMZ.js} +2 -2
  204. package/dist/{chunk-DACRR362.js → chunk-XQ7BIVLI.js} +6 -6
  205. package/dist/{chunk-7P2TDFZL.js → chunk-Z3LGAFMG.js} +1 -1
  206. package/dist/{chunk-GEQQGN3J.js → chunk-ZJ6AMC4Y.js} +7 -7
  207. package/dist/{chunk-IURGBN5B.js → chunk-ZZR2WRNW.js} +4 -4
  208. package/dist/{cleanup-graph-garbage-NKAJSCWZ.js → cleanup-graph-garbage-SYGPMPUM.js} +8 -8
  209. package/dist/{cli-shutdown-F3DFDCB5.js → cli-shutdown-JI7CASE4.js} +1 -1
  210. package/dist/{cloud-sync-command-3YBLSMAL.js → cloud-sync-command-ZV3P5FP6.js} +2 -2
  211. package/dist/{cloud-sync-db-init-JWSPAFKY.js → cloud-sync-db-init-RQIHWKV4.js} +1 -1
  212. package/dist/{cloud-sync-shutdown-4R6RIO67.js → cloud-sync-shutdown-V2N7VLD3.js} +3 -3
  213. package/dist/{co-activation-2ZRANV3Q.js → co-activation-SRE6DIRX.js} +3 -3
  214. package/dist/{co-occurrence-6EELW2L2.js → co-occurrence-F5TMSEQZ.js} +6 -6
  215. package/dist/{consent-passphrase-TDR263MC.js → consent-passphrase-MWZRHJRC.js} +2 -2
  216. package/dist/content-extractor-GWF2T7FK.js +13 -0
  217. package/dist/{conversation-entity-extractor-KUJN3MOH.js → conversation-entity-extractor-XMOUHGMT.js} +3 -3
  218. package/dist/{crdt-sync-IX43KVQ3.js → crdt-sync-FXEKABM7.js} +4 -4
  219. package/dist/{crm-webhook-GSCIW6CE.js → crm-webhook-D6IJOPRQ.js} +2 -2
  220. package/dist/{cto-delegation-gate-ZWD4EFRR.js → cto-delegation-gate-BU3JRCYN.js} +12 -15
  221. package/dist/{daemon-orchestration-WL6V4QL4.js → daemon-orchestration-K4NKFYXO.js} +19 -21
  222. package/dist/{destructive-data-guard-JDUJ2ULM.js → destructive-data-guard-3TGAAE7K.js} +77 -23
  223. package/dist/{doc-graph-extractor-NJ7ZZC2C.js → doc-graph-extractor-TVK2NGAR.js} +6 -6
  224. package/dist/{documents-O7WYZFFE.js → documents-MDZ4VB5X.js} +8 -8
  225. package/dist/{dreaming-TUESPDT3.js → dreaming-L24PSS35.js} +17 -20
  226. package/dist/{employee-boot-brief-UCP6QLN4.js → employee-boot-brief-GQVL3FQC.js} +23 -25
  227. package/dist/{entity-boost-TK43XT24.js → entity-boost-OMFA5QCG.js} +2 -2
  228. package/dist/{exe-drift-QD6LUZT2.js → exe-drift-JDDG3OPT.js} +4 -4
  229. package/dist/{exe-export-QIUNHFSS.js → exe-export-EEGIE3JP.js} +10 -10
  230. package/dist/{exe-import-3UFOLHEW.js → exe-import-UJNC5Q2L.js} +10 -10
  231. package/dist/{exe-key-D5NDKGHT.js → exe-key-TYEY4W4E.js} +97 -97
  232. package/dist/{exe-org-UWDJBOCV.js → exe-org-B3ICTTEV.js} +32 -32
  233. package/dist/{exe-snapshot-P6SFODEN.js → exe-snapshot-VBFBONYN.js} +20 -23
  234. package/dist/{fast-db-init-SD7JZSEC.js → fast-db-init-TFRTK6EH.js} +1 -1
  235. package/dist/{founder-context-QIXDZIJX.js → founder-context-3X4QUWKD.js} +2 -2
  236. package/dist/{founder-monitor-envelope-TLOC4UYG.js → founder-monitor-envelope-54UNZNY4.js} +4 -4
  237. package/dist/gateway/index.js +11 -11
  238. package/dist/{gateway-client-CQTSYJLP.js → gateway-client-OUDO5GGV.js} +1 -1
  239. package/dist/{git-staleness-JSQTHB4Z.js → git-staleness-73YZ5PGU.js} +3 -3
  240. package/dist/{global-procedures-T3RKI4QX.js → global-procedures-PYNE2BQG.js} +20 -6
  241. package/dist/{graph-auto-extract-V75GSTNX.js → graph-auto-extract-PGUMEEQB.js} +6 -6
  242. package/dist/{graph-query-VAQN2RK3.js → graph-query-7YA3YNKL.js} +1 -1
  243. package/dist/{graph-rag-GBA5E3QC.js → graph-rag-UWOTK4AQ.js} +3 -3
  244. package/dist/{hook-integrity-II6QK6Y4.js → hook-integrity-6MNEPT6W.js} +1 -1
  245. package/dist/{hook-prefetch-5EHPOYY3.js → hook-prefetch-JOF6YZSR.js} +13 -16
  246. package/dist/hooks/bug-report-worker.js +17 -20
  247. package/dist/hooks/codex-stop-task-finalizer.js +19 -22
  248. package/dist/hooks/commit-complete.js +16 -19
  249. package/dist/hooks/error-recall.js +14 -14
  250. package/dist/hooks/exe-heartbeat-hook.js +5 -5
  251. package/dist/hooks/ingest-worker.js +18 -20
  252. package/dist/hooks/ingest.js +16 -16
  253. package/dist/hooks/instructions-loaded.js +7 -7
  254. package/dist/hooks/manifest.json +20 -20
  255. package/dist/hooks/notification.js +6 -6
  256. package/dist/hooks/post-compact.js +5 -5
  257. package/dist/hooks/post-tool-combined.js +13 -13
  258. package/dist/hooks/pre-compact.js +16 -19
  259. package/dist/hooks/pre-tool-use.js +2 -2
  260. package/dist/hooks/prompt-submit.js +40 -39
  261. package/dist/hooks/session-end.js +21 -24
  262. package/dist/hooks/session-start.js +18 -18
  263. package/dist/hooks/stop.js +19 -22
  264. package/dist/hooks/subagent-stop.js +18 -21
  265. package/dist/hooks/summary-worker.js +20 -23
  266. package/dist/index.js +25 -28
  267. package/dist/{installer-XEEZSF3V.js → installer-34XZ7JMW.js} +7 -8
  268. package/dist/{installer-MPVQ5L22.js → installer-356RMQ2K.js} +7 -8
  269. package/dist/{installer-ILYC4LI5.js → installer-7TN36Z7T.js} +113 -30
  270. package/dist/{intercom-queue-QGHAW2KO.js → intercom-queue-ZJ3MNULM.js} +12 -15
  271. package/dist/lib/backup-verify-worker.js +157 -0
  272. package/dist/lib/cloud-sync.js +16 -20
  273. package/dist/lib/consolidation.js +9 -9
  274. package/dist/lib/crypto.js +3 -3
  275. package/dist/lib/database.js +3 -3
  276. package/dist/lib/db-backup.js +7 -3
  277. package/dist/lib/db-write-worker.js +3 -3
  278. package/dist/lib/db.js +3 -3
  279. package/dist/lib/device-registry.js +1 -1
  280. package/dist/lib/employee-templates.js +7 -7
  281. package/dist/lib/employees.js +3 -3
  282. package/dist/lib/error-detector.js +2 -2
  283. package/dist/lib/exe-daemon.js +89 -87
  284. package/dist/lib/hybrid-search.js +11 -11
  285. package/dist/lib/identity.js +5 -3
  286. package/dist/lib/keychain.js +1 -1
  287. package/dist/lib/license.js +2 -2
  288. package/dist/lib/messaging.js +13 -16
  289. package/dist/lib/post-tool-memory.js +16 -18
  290. package/dist/lib/registry-proxy.js +1 -1
  291. package/dist/lib/reminders.js +4 -4
  292. package/dist/lib/schedules.js +8 -8
  293. package/dist/lib/session-registry.js +5 -5
  294. package/dist/lib/skill-learning.js +9 -9
  295. package/dist/lib/store.js +7 -7
  296. package/dist/lib/task-router.js +4 -4
  297. package/dist/lib/tasks.js +14 -17
  298. package/dist/lib/tmux-routing.js +14 -41
  299. package/dist/lib/token-spend.js +4 -4
  300. package/dist/lib/ws-client.js +1 -1
  301. package/dist/{license-gate-CARN6AB6.js → license-gate-4BXUTHLB.js} +3 -3
  302. package/dist/{license-recheck-7Z3LS6YS.js → license-recheck-QFPUKISQ.js} +1 -1
  303. package/dist/{license-sync-PUQV3HSZ.js → license-sync-FDEDT4AC.js} +2 -2
  304. package/dist/mcp/register-tools.js +96 -96
  305. package/dist/mcp/server.js +96 -96
  306. package/dist/mcp/tools/complete-reminder.js +5 -5
  307. package/dist/mcp/tools/create-reminder.js +5 -5
  308. package/dist/mcp/tools/create-task.js +16 -19
  309. package/dist/mcp/tools/deactivate-behavior.js +10 -10
  310. package/dist/mcp/tools/list-reminders.js +5 -5
  311. package/dist/mcp/tools/list-tasks.js +16 -19
  312. package/dist/mcp/tools/send-message.js +15 -18
  313. package/dist/mcp/tools/update-task.js +15 -18
  314. package/dist/{mcp-http-config-RJKTZPHZ.js → mcp-http-config-GKP5QGAO.js} +5 -5
  315. package/dist/{mcp-session-identity-HN444A3G.js → mcp-session-identity-JHAGRB7B.js} +12 -15
  316. package/dist/{memory-cards-AT3QCCWU.js → memory-cards-O377ETAM.js} +8 -8
  317. package/dist/{memory-graph-extractor-B43UWGV5.js → memory-graph-extractor-4KJCCUOP.js} +7 -7
  318. package/dist/{memory-maintenance-WDLL3ZX3.js → memory-maintenance-RR5UPRW3.js} +1 -1
  319. package/dist/{memory-poisoning-defense-TS4WNW4S.js → memory-poisoning-defense-Y5TTKGOP.js} +3 -3
  320. package/dist/{memory-pressure-watchdog-6YH7S6W7.js → memory-pressure-watchdog-NGXTI4HR.js} +13 -16
  321. package/dist/{memory-reflection-N6NSYW6S.js → memory-reflection-EXNHRZL7.js} +8 -8
  322. package/dist/{memory-write-repository-D35RDO62.js → memory-write-repository-S4TX7WQB.js} +1 -1
  323. package/dist/{monitor-grants-FH4PNYN5.js → monitor-grants-57Q4NL25.js} +3 -3
  324. package/dist/{monitor-identity-LK5ZCCND.js → monitor-identity-3FQ52SYU.js} +2 -2
  325. package/dist/{notification-ledger-3WJYJGGS.js → notification-ledger-O6KQYYGK.js} +13 -16
  326. package/dist/{notifications-T5C2CVB3.js → notifications-6FCQCJ4P.js} +12 -15
  327. package/dist/{orchestration-events-73VEJT7Q.js → orchestration-events-2Z2BMMA5.js} +4 -4
  328. package/dist/{orchestrator-3O657734.js → orchestrator-AGOSKPHD.js} +14 -17
  329. package/dist/{org-brief-session-EGB35QLM.js → org-brief-session-WJHZVXXJ.js} +15 -15
  330. package/dist/{org-consent-policy-MSVSRI53.js → org-consent-policy-X43UGTHI.js} +5 -5
  331. package/dist/{org-join-4BK2XJJI.js → org-join-M3UTBMHC.js} +9 -9
  332. package/dist/{org-key-admin-EUSSGXQ3.js → org-key-admin-AA2DRHB2.js} +11 -11
  333. package/dist/{org-key-epoch-NMEWDT5L.js → org-key-epoch-Z5UIVUHT.js} +5 -5
  334. package/dist/{org-key-pin-HUSXGINB.js → org-key-pin-FE6YHEZ3.js} +3 -3
  335. package/dist/{org-membership-B74IWEM5.js → org-membership-3J2MIGE4.js} +4 -4
  336. package/dist/{org-partner-config-5FJTJABN.js → org-partner-config-5HATZYG4.js} +8 -8
  337. package/dist/{org-partner-runtime-GN4GFWI2.js → org-partner-runtime-UI35IHUC.js} +15 -15
  338. package/dist/{org-row-visibility-PBZ2TSCR.js → org-row-visibility-TRJERVYP.js} +1 -1
  339. package/dist/{pipeline-router-2IELBSVJ.js → pipeline-router-EKQ6D7ZA.js} +4 -4
  340. package/dist/{plan-limits-4GXK5PFT.js → plan-limits-3BGHIHX6.js} +6 -6
  341. package/dist/{platform-procedures-QP3W2NLH.js → platform-procedures-RXW46WNY.js} +1 -1
  342. package/dist/{pre-tool-use-impl-CY73PRJP.js → pre-tool-use-impl-7BT5TJVM.js} +35 -33
  343. package/dist/{project-name-337ERIAX.js → project-name-PGJGUEJY.js} +4 -4
  344. package/dist/{projection-worker-W476IG6V.js → projection-worker-3GEVFPAI.js} +2 -2
  345. package/dist/{prospective-memory-5INB7NUL.js → prospective-memory-GEN7CN7H.js} +3 -3
  346. package/dist/{push-notifications-YVOP4KGN.js → push-notifications-QW4BWRC7.js} +13 -16
  347. package/dist/{reproject-worktree-memories-OGBR3CMO.js → reproject-worktree-memories-DIULBEBD.js} +12 -15
  348. package/dist/{reranker-W7WCJH6Y.js → reranker-LQ6OPJOI.js} +1 -1
  349. package/dist/{retrieval-health-R6MGXLTP.js → retrieval-health-XDFYFEOP.js} +1 -1
  350. package/dist/{review-polling-TKAWVY6G.js → review-polling-ED33YLFT.js} +13 -16
  351. package/dist/runtime/index.js +20 -23
  352. package/dist/{session-events-HUCZ7TOR.js → session-events-7IJGTBVH.js} +13 -16
  353. package/dist/{session-kill-telemetry-RWRWOW4C.js → session-kill-telemetry-RUTEARJ3.js} +13 -16
  354. package/dist/{session-scope-5CDRHV75.js → session-scope-SSYA64L3.js} +12 -15
  355. package/dist/{setup-wizard-RBTJAZOP.js → setup-wizard-XD7FZVLJ.js} +2 -2
  356. package/dist/{shard-manager-LRPAAQA4.js → shard-manager-FH5JZRSE.js} +2 -2
  357. package/dist/{skill-refinement-MDXKDCY6.js → skill-refinement-UHD4E6GV.js} +4 -4
  358. package/dist/{skill-retrieval-OWY6MTCX.js → skill-retrieval-F6PAJ3I5.js} +11 -11
  359. package/dist/{skill-usage-GNV737U5.js → skill-usage-2MBTF7Y4.js} +4 -4
  360. package/dist/{stack-generate-manifest-S4SBLKBY.js → stack-generate-manifest-SU6OFFY7.js} +4 -4
  361. package/dist/{stack-promote-U4EZNLOV.js → stack-promote-MJF436JD.js} +4 -4
  362. package/dist/{stack-release-4VBGOYGK.js → stack-release-S37R57XC.js} +5 -5
  363. package/dist/{stack-update-C5YKHE7A.js → stack-update-XXDRKGGR.js} +3 -3
  364. package/dist/{steward-gate-QFPXQBUZ.js → steward-gate-EWG2BHYQ.js} +4 -4
  365. package/dist/{subagent-brief-injection-GDXO5WNS.js → subagent-brief-injection-YZGSWUEY.js} +25 -27
  366. package/dist/{support-bug-actions-4XEKXIIO.js → support-bug-actions-RU6WZ3UV.js} +3 -3
  367. package/dist/{support-inbox-Y7AFCOGM.js → support-inbox-A3S52SPS.js} +12 -12
  368. package/dist/{task-enforcement-CN3Q4PEH.js → task-enforcement-LVAS55AR.js} +13 -16
  369. package/dist/{task-request-inbox-AY3C6DND.js → task-request-inbox-2TN4ZUH2.js} +5 -5
  370. package/dist/{task-scope-AMR3Z3DJ.js → task-scope-NLKUVCP5.js} +12 -15
  371. package/dist/{tasks-crud-2GHKIZOM.js → tasks-crud-NQDPLHNZ.js} +14 -15
  372. package/dist/{tasks-notify-Z53446KM.js → tasks-notify-BDM2NEHP.js} +13 -16
  373. package/dist/{tasks-review-APRNSHMQ.js → tasks-review-3G7CAW2O.js} +12 -15
  374. package/dist/{telemetry-upload-5XR42SQN.js → telemetry-upload-6DR6AL3V.js} +8 -8
  375. package/dist/{token-budget-TTNJXI7W.js → token-budget-KNC2WGR7.js} +4 -4
  376. package/dist/{tool-telemetry-36ST422N.js → tool-telemetry-I3SEU5M5.js} +1 -1
  377. package/dist/tui/App.js +23 -26
  378. package/dist/{tui-data-AP5TPUOQ.js → tui-data-KJDWP4CB.js} +16 -19
  379. package/dist/{update-support-SFTI2PUD.js → update-support-UYDYMHVR.js} +11 -11
  380. package/dist/{whatsapp-5CXE3JHG.js → whatsapp-5EMPZHF5.js} +2 -2
  381. package/dist/{wiki-acl-N754BC2W.js → wiki-acl-M7BTQJBZ.js} +1 -1
  382. package/dist/{work-claims-OAICQBWO.js → work-claims-5CFMZTML.js} +4 -4
  383. package/dist/{work-state-heartbeat-MTTUGMPU.js → work-state-heartbeat-7IA2DZ2E.js} +1 -1
  384. package/dist/{workflow-engine-RID3QL2U.js → workflow-engine-S5JOE2YR.js} +2 -2
  385. package/dist/{worktree-XWVNDBRD.js → worktree-7V4ZMF3D.js} +5 -5
  386. package/dist/{worktree-sweep-6VEHGH7U.js → worktree-sweep-34MXJ7S6.js} +6 -6
  387. package/package.json +2 -1
  388. package/release-notes.json +25 -7
  389. package/stack.release.json +3 -3
  390. package/dist/chunk-ESO5JDOT.js +0 -70
  391. package/dist/chunk-KCRSJ3VU.js +0 -113
  392. package/dist/content-extractor-OVD7PTSN.js +0 -9
  393. /package/dist/{chunk-OLMLA377.js → chunk-542FBM5U.js} +0 -0
  394. /package/dist/{chunk-LDHJX4TZ.js → chunk-6D2O5SAH.js} +0 -0
  395. /package/dist/{chunk-33PG3KNY.js → chunk-6NRZLVK3.js} +0 -0
  396. /package/dist/{chunk-CLV7ALXV.js → chunk-CFO47VW4.js} +0 -0
  397. /package/dist/{chunk-FLO24BNN.js → chunk-EULAP6L6.js} +0 -0
  398. /package/dist/{chunk-PKM456D2.js → chunk-FYSKQPTE.js} +0 -0
  399. /package/dist/{chunk-WIDOLS7T.js → chunk-J4B4M5PH.js} +0 -0
  400. /package/dist/{chunk-YBB43SXC.js → chunk-J635FA7T.js} +0 -0
  401. /package/dist/{chunk-64UAHPXA.js → chunk-MOBZTIJQ.js} +0 -0
  402. /package/dist/{chunk-EZQ4W3WW.js → chunk-N45FAI6D.js} +0 -0
  403. /package/dist/{chunk-OEEHLATI.js → chunk-QDSNEGJE.js} +0 -0
  404. /package/dist/{chunk-YG4DZZ6J.js → chunk-SKSXROKP.js} +0 -0
  405. /package/dist/{chunk-FUZHMV7K.js → chunk-YVWXI2HM.js} +0 -0
  406. /package/dist/{core-memory-WR7I7DIP.js → core-memory-PZEO3OWH.js} +0 -0
  407. /package/dist/{memory-isolation-4RQJ5RCK.js → memory-isolation-MFNT2ITE.js} +0 -0
  408. /package/dist/{oauth-server-VBDMZIEV.js → oauth-server-CBGEWD6H.js} +0 -0
  409. /package/dist/{project-boot-G7T5WHO6.js → project-boot-VESAYDIH.js} +0 -0
@@ -1583,7 +1583,7 @@ function settingsTamperDenyMessage(target) {
1583
1583
  var destructiveDataGuardModule = null;
1584
1584
  var destructiveDataGuardImportError = null;
1585
1585
  try {
1586
- destructiveDataGuardModule = await import("./destructive-data-guard-JDUJ2ULM.js");
1586
+ destructiveDataGuardModule = await import("./destructive-data-guard-3TGAAE7K.js");
1587
1587
  } catch (err) {
1588
1588
  destructiveDataGuardImportError = err instanceof Error ? err.stack ?? err.message : String(err);
1589
1589
  }
@@ -1836,9 +1836,543 @@ function isUnverifiablePathToken(expanded) {
1836
1836
  const residue = expanded.replace(/\$\([^)]*\)/g, "").replace(/`[^`]*`/g, "").replace(/\$\{[^}]*\}/g, "").replace(/\$[^A-Za-z_\s]/g, "");
1837
1837
  return residue.includes("/") || residue.includes("~");
1838
1838
  }
1839
+ var QUOTED_LITERAL_PLACEHOLDER = /^\u0001(\d+)\u0001$/;
1840
+ function maskSingleQuotedWords(text) {
1841
+ const unchanged = { masked: text, literals: [], commands: [] };
1842
+ if (text.includes("") || text.includes("`") || text.includes("<<")) return unchanged;
1843
+ const isBreak = (c) => c === void 0 || /[\s;&|()<>]/.test(c);
1844
+ const literals = [];
1845
+ const commands = [];
1846
+ let out = "";
1847
+ let commandStart = 0;
1848
+ let open = [];
1849
+ const closeCommand = () => {
1850
+ for (const k of open) commands[k] = out.slice(commandStart);
1851
+ open = [];
1852
+ };
1853
+ let inDouble = false;
1854
+ let i = 0;
1855
+ while (i < text.length) {
1856
+ const c = text[i];
1857
+ if (inDouble) {
1858
+ if (c === "\\") {
1859
+ out += text.slice(i, i + 2);
1860
+ i += 2;
1861
+ continue;
1862
+ }
1863
+ if (c === "$" && (text[i + 1] === "(" || text[i + 1] === "{")) return unchanged;
1864
+ if (c === '"') inDouble = false;
1865
+ out += c;
1866
+ i++;
1867
+ continue;
1868
+ }
1869
+ if (c === "\\") {
1870
+ out += text.slice(i, i + 2);
1871
+ i += 2;
1872
+ continue;
1873
+ }
1874
+ if (c === '"') {
1875
+ inDouble = true;
1876
+ out += c;
1877
+ i++;
1878
+ continue;
1879
+ }
1880
+ if (c === "#" && (i === 0 || isBreak(text[i - 1]))) return unchanged;
1881
+ if (c === "$" && text[i + 1] === "'") {
1882
+ let j = i + 2;
1883
+ while (j < text.length && text[j] !== "'") j += text[j] === "\\" ? 2 : 1;
1884
+ if (j >= text.length) return unchanged;
1885
+ out += text.slice(i, j + 1);
1886
+ i = j + 1;
1887
+ continue;
1888
+ }
1889
+ if (c === "'") {
1890
+ const end = text.indexOf("'", i + 1);
1891
+ if (end < 0) return unchanged;
1892
+ if (/[\r\n]/.test(text.slice(i + 1, end))) return unchanged;
1893
+ const startsWord = i === 0 || isBreak(text[i - 1]) && text[i - 2] !== "\\";
1894
+ if (startsWord && isBreak(text[end + 1])) {
1895
+ open.push(literals.length);
1896
+ out += `${literals.length}`;
1897
+ literals.push(text.slice(i + 1, end));
1898
+ } else {
1899
+ out += text.slice(i, end + 1);
1900
+ }
1901
+ i = end + 1;
1902
+ continue;
1903
+ }
1904
+ if (/[;&|()\r\n]/.test(c)) {
1905
+ closeCommand();
1906
+ commandStart = out.length + 1;
1907
+ }
1908
+ out += c;
1909
+ i++;
1910
+ }
1911
+ if (inDouble) return unchanged;
1912
+ closeCommand();
1913
+ return { masked: out, literals, commands };
1914
+ }
1915
+ var SED_SIMPLE_OPTIONS = /* @__PURE__ */ new Set(["-n", "-E", "-r", "--quiet", "--silent", "--regexp-extended"]);
1916
+ function isSimpleSedAwk(program, args, realArgs, placeholder) {
1917
+ let i = 0;
1918
+ if (program === "sed") {
1919
+ while (i < args.length && SED_SIMPLE_OPTIONS.has(args[i])) i++;
1920
+ if (args[i] === "-e" || args[i] === "--expression") i++;
1921
+ } else {
1922
+ while (i < args.length && /^-[Fv]/.test(args[i])) i += args[i] === "-F" || args[i] === "-v" ? 2 : 1;
1923
+ }
1924
+ if (args[i] !== placeholder) return false;
1925
+ if (args.some((a, k) => k !== i && /[$`*?[{]/.test(a))) return false;
1926
+ return realArgs.slice(i + 1).every((a) => a === "-" || !a.startsWith("-"));
1927
+ }
1928
+ function quotedLiteralIsData(literal, index, command, literals) {
1929
+ const tokens = tokenizeShell(command).tokens;
1930
+ let p = 0;
1931
+ while (p < tokens.length && /^[A-Za-z_][A-Za-z0-9_]*=/.test(tokens[p]) && isInertAssignment(tokens[p])) p++;
1932
+ const args = tokens.slice(p + 1);
1933
+ const realArgs = args.map((a) => a.replace(/\u0001(\d+)\u0001/g, (_m, n) => literals[Number(n)] ?? ""));
1934
+ if (args.some((a) => !/^\u0001\d+\u0001$/.test(a) && /[$`*?[{]/.test(a))) return false;
1935
+ switch (tokens[p]) {
1936
+ case "gh": {
1937
+ const at = args.indexOf(`${index}`);
1938
+ return at > 0 && (args[at - 1] === "--jq" || args[at - 1] === "-q");
1939
+ }
1940
+ case "jq":
1941
+ case "grep":
1942
+ case "egrep":
1943
+ case "fgrep":
1944
+ case "printf":
1945
+ return true;
1946
+ case "rg":
1947
+ return !realArgs.some((a) => a === "--pre" || a.startsWith("--pre="));
1948
+ // sed/awk: credited ONLY in one fully-visible shape, see isSimpleSedAwk.
1949
+ case "sed":
1950
+ return isSimpleSedAwk("sed", args, realArgs, `${index}`) && !/[wWe]/.test(literal);
1951
+ // awk's ways to write a file or run a command, all refused: output
1952
+ // redirection (`>`, `>>`), pipes (`|`, `|&`, `cmd | getline`),
1953
+ // `system()`, and gawk directives that load code (`@include`, `@load`,
1954
+ // any `@…` — codex, PR #3956 round 11). Code-loading OPTIONS (`-f`, `-E`,
1955
+ // `-i`, `-l`) are already excluded by the strict shape.
1956
+ case "awk":
1957
+ return isSimpleSedAwk("awk", args, realArgs, `${index}`) && !/[>|@]|system|getline|fflush/.test(literal);
1958
+ default:
1959
+ return false;
1960
+ }
1961
+ }
1962
+ var LAUNCHCTL_DOMAIN_SUBCOMMANDS = /* @__PURE__ */ new Set([
1963
+ "bootstrap",
1964
+ "bootout",
1965
+ "print",
1966
+ "kickstart",
1967
+ "enable",
1968
+ "disable",
1969
+ "kill",
1970
+ "blame"
1971
+ ]);
1972
+ var LAUNCHCTL_DOMAIN_TARGET = /(^|\s)(?:system|(?:gui|user|login|pid)\/(?:\d+|\$\{?E?UID\}?))(?:\/[A-Za-z0-9._-]+)?(?=\s|$)/g;
1973
+ function stripLaunchctlDomainTargets(text) {
1974
+ const m = /^\s*launchctl\s+([a-z]+)(?=\s)/.exec(text);
1975
+ if (!m || !LAUNCHCTL_DOMAIN_SUBCOMMANDS.has(m[1])) return text;
1976
+ if (/[;&|()<>\r\n`]/.test(text)) return text;
1977
+ const head = m[0];
1978
+ return head + text.slice(head.length).replace(LAUNCHCTL_DOMAIN_TARGET, "$1");
1979
+ }
1980
+ function quotedLiteralNamesAuditLocation(literal, rawLedgerPath, rawAuditDir) {
1981
+ if (!/[*?[\]$`\\]/.test(literal)) return false;
1982
+ if (literal.includes(path2.basename(rawLedgerPath)) || literal.includes("EXE_GATEWAY_LEDGER_DIR")) return true;
1983
+ const dirName = path2.basename(rawAuditDir).replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1984
+ return new RegExp(`(?:^|[^A-Za-z0-9_.-])${dirName}(?:[/"'\\\\]|$)`).test(literal);
1985
+ }
1839
1986
  function inAuditDir(resolved, auditDir, ledgerFile) {
1840
1987
  return resolved === ledgerFile || resolved === auditDir || resolved.startsWith(auditDir + path2.sep);
1841
1988
  }
1989
+ function stripRedirections(segment) {
1990
+ let out = "";
1991
+ let wordStart = -1;
1992
+ let quote = null;
1993
+ const stops = /* @__PURE__ */ new Set([" ", " ", "\n", ";", "|", "&", "<", ">", "(", ")"]);
1994
+ for (let i = 0; i < segment.length; i++) {
1995
+ const ch = segment[i];
1996
+ if (quote) {
1997
+ out += ch;
1998
+ if (ch === quote) quote = null;
1999
+ else if (ch === "\\" && quote === '"' && i + 1 < segment.length) out += segment[++i];
2000
+ continue;
2001
+ }
2002
+ const redirectAt = (ch === "<" || ch === ">") && segment[i + 1] !== "(" ? i : ch === "&" && segment[i + 1] === ">" ? i : -1;
2003
+ if (redirectAt < 0) {
2004
+ if (ch === " " || ch === " ") wordStart = -1;
2005
+ else if (wordStart < 0) wordStart = out.length;
2006
+ if (ch === "'" || ch === '"') quote = ch;
2007
+ out += ch;
2008
+ if (ch === "\\" && i + 1 < segment.length) out += segment[++i];
2009
+ continue;
2010
+ }
2011
+ if (wordStart >= 0 && /^(?:\d+|\{[A-Za-z_][A-Za-z0-9_]*\})$/.test(out.slice(wordStart))) out = out.slice(0, wordStart);
2012
+ const operator = /^(?:&>>|&>|>>|>\||>&|>|<<<|<<-|<<|<>|<&|<)/.exec(segment.slice(i))[0];
2013
+ let j = i + operator.length;
2014
+ while (segment[j] === " " || segment[j] === " ") j++;
2015
+ let targetQuote = null;
2016
+ for (; j < segment.length; j++) {
2017
+ const c = segment[j];
2018
+ if (targetQuote) {
2019
+ if (c === targetQuote) targetQuote = null;
2020
+ else if (c === "\\" && targetQuote === '"') j++;
2021
+ continue;
2022
+ }
2023
+ if (c === "'" || c === '"') targetQuote = c;
2024
+ else if (c === "\\") j++;
2025
+ else if (stops.has(c)) break;
2026
+ }
2027
+ out += " ";
2028
+ wordStart = -1;
2029
+ i = j - 1;
2030
+ }
2031
+ return out;
2032
+ }
2033
+ function commandWords(segment) {
2034
+ return tokenizeShell(stripRedirections(segment)).tokens;
2035
+ }
2036
+ var WRAPPERS3 = {
2037
+ env: {
2038
+ short: { i: "flag", "0": "flag", v: "flag", u: "arg", P: "arg", C: "cwdArg", S: "split" },
2039
+ long: {
2040
+ "--ignore-environment": "flag",
2041
+ "--null": "flag",
2042
+ "--debug": "flag",
2043
+ "--unset": "arg",
2044
+ "--chdir": "cwdArg",
2045
+ "--split-string": "split",
2046
+ "--default-signal": "flag",
2047
+ "--ignore-signal": "flag",
2048
+ "--block-signal": "flag",
2049
+ "--list-signal-handling": "flag",
2050
+ "--help": "noexec",
2051
+ "--version": "noexec"
2052
+ },
2053
+ loneDash: true
2054
+ },
2055
+ sudo: {
2056
+ short: {
2057
+ A: "flag",
2058
+ b: "flag",
2059
+ E: "flag",
2060
+ H: "flag",
2061
+ k: "flag",
2062
+ n: "flag",
2063
+ P: "flag",
2064
+ S: "flag",
2065
+ s: "flag",
2066
+ i: "cwdFlag",
2067
+ C: "arg",
2068
+ g: "arg",
2069
+ h: "arg",
2070
+ p: "arg",
2071
+ r: "arg",
2072
+ t: "arg",
2073
+ T: "arg",
2074
+ u: "arg",
2075
+ U: "arg",
2076
+ D: "cwdArg",
2077
+ l: "noexec",
2078
+ v: "noexec",
2079
+ V: "noexec",
2080
+ K: "noexec"
2081
+ },
2082
+ long: {
2083
+ "--askpass": "flag",
2084
+ "--background": "flag",
2085
+ "--preserve-env": "flag",
2086
+ "--set-home": "flag",
2087
+ "--reset-timestamp": "flag",
2088
+ "--non-interactive": "flag",
2089
+ "--preserve-groups": "flag",
2090
+ "--stdin": "flag",
2091
+ "--shell": "flag",
2092
+ "--login": "cwdFlag",
2093
+ "--close-from": "arg",
2094
+ "--group": "arg",
2095
+ "--host": "arg",
2096
+ "--prompt": "arg",
2097
+ "--role": "arg",
2098
+ "--type": "arg",
2099
+ "--command-timeout": "arg",
2100
+ "--user": "arg",
2101
+ "--other-user": "arg",
2102
+ "--chdir": "cwdArg",
2103
+ "--list": "noexec",
2104
+ "--validate": "noexec",
2105
+ "--version": "noexec",
2106
+ "--help": "noexec",
2107
+ "--remove-timestamp": "noexec"
2108
+ }
2109
+ },
2110
+ command: { short: { p: "flag", v: "noexec", V: "noexec" }, long: {} },
2111
+ builtin: { short: {}, long: {} },
2112
+ exec: { short: { c: "flag", l: "flag", a: "arg" }, long: {} },
2113
+ nohup: { short: {}, long: { "--help": "noexec", "--version": "noexec" } },
2114
+ nice: { short: { n: "arg" }, long: { "--adjustment": "arg", "--help": "noexec", "--version": "noexec" }, numericOption: true },
2115
+ time: {
2116
+ short: { p: "flag", a: "flag", v: "flag", q: "flag", o: "arg", f: "arg" },
2117
+ long: { "--portability": "flag", "--append": "flag", "--verbose": "flag", "--quiet": "flag", "--output": "arg", "--format": "arg" }
2118
+ },
2119
+ timeout: {
2120
+ short: { v: "flag", s: "arg", k: "arg" },
2121
+ long: {
2122
+ "--preserve-status": "flag",
2123
+ "--foreground": "flag",
2124
+ "--verbose": "flag",
2125
+ "--signal": "arg",
2126
+ "--kill-after": "arg",
2127
+ "--help": "noexec",
2128
+ "--version": "noexec"
2129
+ },
2130
+ positional: 1
2131
+ }
2132
+ };
2133
+ function parseWrapperOptions(spec, tokens, start) {
2134
+ let i = start;
2135
+ let cwdUnknown = false;
2136
+ const apply = (kind, value) => {
2137
+ if (kind === "noexec") return { kind: "noexec" };
2138
+ if (kind === "cwdArg" || kind === "cwdFlag") cwdUnknown = true;
2139
+ if (kind === "split") {
2140
+ if (value === void 0 || !/^[A-Za-z0-9_./=:,+@%\s-]*$/.test(value)) return { kind: "undetermined" };
2141
+ return { kind: "command", index: i, cwdUnknown, split: value.trim().split(/\s+/).filter(Boolean) };
2142
+ }
2143
+ return null;
2144
+ };
2145
+ while (i < tokens.length) {
2146
+ const tok = tokens[i];
2147
+ if (tok === "--") {
2148
+ i++;
2149
+ break;
2150
+ }
2151
+ if (tok === "-" && spec.loneDash) {
2152
+ i++;
2153
+ continue;
2154
+ }
2155
+ if (tok.startsWith("--")) {
2156
+ const eq = tok.indexOf("=");
2157
+ const name = eq < 0 ? tok : tok.slice(0, eq);
2158
+ const kind = spec.long[name];
2159
+ if (kind === void 0) return { kind: "unknown", index: i + 1 };
2160
+ let value = eq < 0 ? void 0 : tok.slice(eq + 1);
2161
+ i++;
2162
+ if (value === void 0 && (kind === "arg" || kind === "cwdArg" || kind === "split")) value = tokens[i++];
2163
+ const result = apply(kind, value);
2164
+ if (result) return result;
2165
+ continue;
2166
+ }
2167
+ if (tok.length > 1 && tok.startsWith("-")) {
2168
+ if (spec.numericOption && /^-\d+$/.test(tok)) {
2169
+ i++;
2170
+ continue;
2171
+ }
2172
+ i++;
2173
+ for (let k = 1; k < tok.length; k++) {
2174
+ const kind = spec.short[tok[k]];
2175
+ if (kind === void 0) return { kind: "unknown", index: i };
2176
+ if (kind === "arg" || kind === "cwdArg" || kind === "split") {
2177
+ const value = k + 1 < tok.length ? tok.slice(k + 1) : tokens[i++];
2178
+ const result2 = apply(kind, value);
2179
+ if (result2) return result2;
2180
+ break;
2181
+ }
2182
+ const result = apply(kind, void 0);
2183
+ if (result) return result;
2184
+ }
2185
+ continue;
2186
+ }
2187
+ break;
2188
+ }
2189
+ i += spec.positional ?? 0;
2190
+ return i <= tokens.length ? { kind: "command", index: i, cwdUnknown } : { kind: "noexec" };
2191
+ }
2192
+ function unwrapCommand(tokens, budget = { left: 64 }, cwdUnknownIn = false) {
2193
+ const undetermined = [{ argv: [], cwdUnknown: true, undetermined: true }];
2194
+ let words = tokens;
2195
+ let i = 0;
2196
+ let cwdUnknown = cwdUnknownIn;
2197
+ for (; ; ) {
2198
+ if (--budget.left < 0) return undetermined;
2199
+ while (i < words.length && /^[A-Za-z_][A-Za-z0-9_]*=/.test(words[i])) i++;
2200
+ if (i >= words.length) return [];
2201
+ const name = path2.basename(words[i].replace(/^\\/, ""));
2202
+ const spec = Object.hasOwn(WRAPPERS3, name) ? WRAPPERS3[name] : void 0;
2203
+ if (!spec) return [{ argv: words.slice(i), cwdUnknown, undetermined: false }];
2204
+ const parsed = parseWrapperOptions(spec, words, i + 1);
2205
+ switch (parsed.kind) {
2206
+ case "noexec":
2207
+ return [];
2208
+ case "undetermined":
2209
+ return undetermined;
2210
+ case "unknown": {
2211
+ const candidates = [];
2212
+ for (let j = parsed.index; j < words.length; j++) {
2213
+ const found = unwrapCommand(words.slice(j), budget, true);
2214
+ if (found.some((c) => c.undetermined)) return undetermined;
2215
+ candidates.push(...found);
2216
+ }
2217
+ return candidates;
2218
+ }
2219
+ case "command":
2220
+ cwdUnknown ||= parsed.cwdUnknown;
2221
+ if (parsed.split) {
2222
+ words = [words[i], ...parsed.split, ...words.slice(parsed.index)];
2223
+ i = 0;
2224
+ } else {
2225
+ i = parsed.index;
2226
+ }
2227
+ }
2228
+ }
2229
+ }
2230
+ var TREE_OPTIONS_WITH_ARGUMENT = {
2231
+ mv: /* @__PURE__ */ new Set(["-S", "--suffix", "-t", "--target-directory"]),
2232
+ rsync: /* @__PURE__ */ new Set([
2233
+ "-e",
2234
+ "--rsh",
2235
+ "-f",
2236
+ "--filter",
2237
+ "--exclude",
2238
+ "--include",
2239
+ "--exclude-from",
2240
+ "--include-from",
2241
+ "--files-from",
2242
+ "--rsync-path",
2243
+ "--log-file",
2244
+ "--partial-dir",
2245
+ "-T",
2246
+ "--temp-dir",
2247
+ "--backup-dir",
2248
+ "--compare-dest",
2249
+ "--copy-dest",
2250
+ "--link-dest",
2251
+ "--chmod",
2252
+ "--chown",
2253
+ "--timeout",
2254
+ "--port",
2255
+ "--bwlimit",
2256
+ "--max-size",
2257
+ "--min-size",
2258
+ "--suffix",
2259
+ "--out-format",
2260
+ "--password-file",
2261
+ "-B",
2262
+ "-M"
2263
+ ])
2264
+ };
2265
+ function treeMutationTargets(segment) {
2266
+ const found = [];
2267
+ for (const command of unwrapCommand(commandWords(segment))) {
2268
+ if (command.undetermined) return [{ path: UNKNOWN_TARGET, cwdUnknown: true }];
2269
+ for (const target of treeTargetsOf(command.argv) ?? []) found.push({ path: target, cwdUnknown: command.cwdUnknown });
2270
+ }
2271
+ return found.length > 0 ? found : null;
2272
+ }
2273
+ function treeTargetsOf(tokens) {
2274
+ if (tokens.length === 0) return null;
2275
+ const program = path2.basename(tokens[0].replace(/^\\/, ""));
2276
+ const takesArgument = TREE_OPTIONS_WITH_ARGUMENT[program] ?? /* @__PURE__ */ new Set();
2277
+ const options = [];
2278
+ const operands = [];
2279
+ let endOfOptions = false;
2280
+ for (let i = 1; i < tokens.length; i++) {
2281
+ const tok = tokens[i];
2282
+ if (!endOfOptions && tok === "--") endOfOptions = true;
2283
+ else if (!endOfOptions && tok.length > 1 && tok.startsWith("-")) {
2284
+ options.push(tok);
2285
+ if (takesArgument.has(tok)) i++;
2286
+ } else operands.push(tok);
2287
+ }
2288
+ const recursive = options.some((o) => o === "--recursive" || /^-[A-Za-z]*[rR]/.test(o));
2289
+ switch (program) {
2290
+ case "rm":
2291
+ case "srm":
2292
+ case "shred":
2293
+ return recursive ? operands : null;
2294
+ case "trash":
2295
+ case "rimraf":
2296
+ return operands;
2297
+ case "mv": {
2298
+ const targetDirectory = options.some((o) => o === "--target-directory" || o.startsWith("--target-directory=") || /^-[A-Za-z]*t/.test(o));
2299
+ return targetDirectory ? operands : operands.slice(0, -1);
2300
+ }
2301
+ case "rsync": {
2302
+ const targets = [
2303
+ ...options.some((o) => o.startsWith("--delete")) ? operands.slice(-1) : [],
2304
+ ...options.includes("--remove-source-files") ? operands.slice(0, -1) : []
2305
+ ];
2306
+ return targets.length > 0 ? targets : null;
2307
+ }
2308
+ default:
2309
+ return null;
2310
+ }
2311
+ }
2312
+ function isAncestorOrSelf(ancestor, descendant) {
2313
+ const rel = path2.relative(ancestor, descendant);
2314
+ return rel === "" || rel !== ".." && !rel.startsWith(".." + path2.sep) && !path2.isAbsolute(rel);
2315
+ }
2316
+ var UNKNOWN_TARGET = "\0unknown-mutation-target";
2317
+ function targetMayReachAudit(target, cwd, auditDir, ledgerFile, homeDir, env, options = {}) {
2318
+ if (target === UNKNOWN_TARGET) return true;
2319
+ const expanded = expandEnvReferences(target, homeDir, env);
2320
+ if (isUnverifiablePathToken(expanded) || UNRESOLVABLE_EXPANSION.test(expanded)) return true;
2321
+ if (options.cwdUnknown && !path2.isAbsolute(expanded)) return true;
2322
+ let literal = expanded;
2323
+ if (/[*?\[]/.test(expanded)) {
2324
+ const components = expanded.split("/");
2325
+ const firstGlob = components.findIndex((component) => /[*?\[]/.test(component));
2326
+ literal = components.slice(0, firstGlob).join("/") || (path2.isAbsolute(expanded) ? "/" : ".");
2327
+ }
2328
+ const resolved = realResolve(cwd, literal);
2329
+ if (resolved === null) return true;
2330
+ if (isAncestorOrSelf(resolved, auditDir) || isAncestorOrSelf(resolved, ledgerFile) || isAncestorOrSelf(auditDir, resolved)) return true;
2331
+ return options.followsSymlinks === true && followedTreeMayReachAudit(resolved, auditDir, env.HOME ?? homeDir);
2332
+ }
2333
+ var FOLLOW_WALK_CAP = 2e3;
2334
+ function followedTreeMayReachAudit(root, auditDir, homeDir) {
2335
+ const homes = [path2.resolve(homeDir), realDir(path2.resolve(homeDir))];
2336
+ const nearHome = (p) => homes.some((home) => isAncestorOrSelf(home, p) || isAncestorOrSelf(p, home));
2337
+ if (nearHome(root)) return true;
2338
+ let budget = FOLLOW_WALK_CAP;
2339
+ const pending = [root];
2340
+ const seen = /* @__PURE__ */ new Set();
2341
+ while (pending.length > 0) {
2342
+ const dir = pending.pop();
2343
+ if (seen.has(dir)) continue;
2344
+ seen.add(dir);
2345
+ let entries;
2346
+ try {
2347
+ entries = fs.readdirSync(dir, { withFileTypes: true });
2348
+ } catch (error) {
2349
+ const code = error.code;
2350
+ if (code === "ENOENT" || code === "ENOTDIR") continue;
2351
+ return true;
2352
+ }
2353
+ for (const entry of entries) {
2354
+ if (--budget < 0) return true;
2355
+ const entryPath = path2.join(dir, entry.name);
2356
+ if (entry.isSymbolicLink()) {
2357
+ let real;
2358
+ try {
2359
+ real = fs.realpathSync.native(entryPath);
2360
+ } catch {
2361
+ return true;
2362
+ }
2363
+ if (isAncestorOrSelf(real, auditDir) || isAncestorOrSelf(auditDir, real) || nearHome(real)) return true;
2364
+ try {
2365
+ if (fs.statSync(real).isDirectory()) pending.push(real);
2366
+ } catch {
2367
+ return true;
2368
+ }
2369
+ } else if (entry.isDirectory()) {
2370
+ pending.push(entryPath);
2371
+ }
2372
+ }
2373
+ }
2374
+ return false;
2375
+ }
1842
2376
  function findBracketClassEnd(component, start) {
1843
2377
  return component.indexOf("]", component[start] === "]" ? start + 1 : start);
1844
2378
  }
@@ -1927,7 +2461,16 @@ function segmentAuditVerdict(text, auditDir, ledgerFile, rawLedgerPath, rawAudit
1927
2461
  const mentions = (s) => s.includes(rawLedgerPath) || s.includes(rawAuditDir);
1928
2462
  if (mentions(text) || mentions(expandEnvReferences(text, homeDir, env))) return "yes";
1929
2463
  let unverified = false;
1930
- for (const frag of text.split(/\s+/)) {
2464
+ const { masked, literals, commands } = maskSingleQuotedWords(text);
2465
+ const credited = literals.map((literal, k) => quotedLiteralIsData(literal, k, commands[k] ?? "", literals));
2466
+ const scanText = stripLaunchctlDomainTargets(literals.length === 0 ? masked : masked.replace(
2467
+ /\u0001(\d+)\u0001/g,
2468
+ (placeholder, n) => credited[Number(n)] ? placeholder : `'${literals[Number(n)]}'`
2469
+ ));
2470
+ if (literals.some((literal, k) => !credited[k] && quotedLiteralNamesAuditLocation(literal, rawLedgerPath, rawAuditDir))) {
2471
+ unverified = true;
2472
+ }
2473
+ for (const frag of scanText.split(/\s+/)) {
1931
2474
  const expandedFrag = expandEnvReferences(frag, homeDir, env);
1932
2475
  if (isUnverifiablePathToken(expandedFrag)) {
1933
2476
  unverified = true;
@@ -1939,7 +2482,20 @@ function segmentAuditVerdict(text, auditDir, ledgerFile, rawLedgerPath, rawAudit
1939
2482
  if (verdict === "yes") return "yes";
1940
2483
  if (verdict === "unverified") unverified = true;
1941
2484
  }
1942
- for (const tok of tokenizeShell(text).tokens) {
2485
+ for (const tok of tokenizeShell(scanText).tokens) {
2486
+ const placeholder = QUOTED_LITERAL_PLACEHOLDER.exec(tok);
2487
+ if (placeholder && literals[Number(placeholder[1])] !== void 0) {
2488
+ const literal = literals[Number(placeholder[1])];
2489
+ if (fstringIsOpaque(literal)) {
2490
+ unverified = true;
2491
+ continue;
2492
+ }
2493
+ const resolved2 = realResolve(cwd, literal);
2494
+ if (resolved2 === null) unverified = true;
2495
+ else if (inAuditDir(resolved2, auditDir, ledgerFile)) return "yes";
2496
+ else if (quotedLiteralNamesAuditLocation(literal, rawLedgerPath, rawAuditDir)) unverified = true;
2497
+ continue;
2498
+ }
1943
2499
  const stripped = tok.replace(/\/+\*+\/?$/, "");
1944
2500
  const expanded = expandEnvReferences(stripped, homeDir, env);
1945
2501
  if (isUnverifiablePathToken(expanded)) {
@@ -2245,10 +2801,15 @@ function commandMutatesLedger(command, ledgerPath, homeDir, cwd, env, depth = 0)
2245
2801
  });
2246
2802
  const naiveSegments = splitShellSegments(command).flatMap((segment) => {
2247
2803
  const tokens = tokenizeShell(segment).tokens;
2248
- return tokens.some((_token, index) => shellDashCScriptIndex(tokens, index) >= 0) ? [segment] : splitShellSegmentsNaive(segment);
2804
+ return tokens.some((_token, index) => shellDashCScriptIndex(tokens, index) >= 0) ? [segment] : splitNaiveOutsideSingleQuotedWords(segment);
2249
2805
  });
2250
2806
  return commandMutatesLedgerForSegments(quoteAwareSegments, command, ledgerPath, homeDir, cwd, env, depth) || commandMutatesLedgerForSegments(naiveSegments, command, ledgerPath, homeDir, cwd, env, depth);
2251
2807
  }
2808
+ function splitNaiveOutsideSingleQuotedWords(segment) {
2809
+ const { masked, literals } = maskSingleQuotedWords(segment);
2810
+ if (literals.length === 0) return splitShellSegmentsNaive(segment);
2811
+ return splitShellSegmentsNaive(masked).map((piece) => piece.replace(/\u0001(\d+)\u0001/g, (_m, n) => `'${literals[Number(n)]}'`));
2812
+ }
2252
2813
  function rejoinSplitFdDuplications(segments) {
2253
2814
  const rejoined = [];
2254
2815
  for (let i = 0; i < segments.length; i++) {
@@ -2272,6 +2833,7 @@ function commandMutatesLedgerForSegments(rawSegments, command, ledgerPath, homeD
2272
2833
  const npmRootGSubstitutionPolluted = npmRootGSubstitutionMayBePolluted(command, env);
2273
2834
  const verdictOf = (text, directory = cwd) => segmentAuditVerdict(text, auditDir, ledgerFile, rawLedgerPath, rawAuditDir, homeDir, directory, env);
2274
2835
  if (segments.length === 0) return verdictOf(command) !== "no";
2836
+ const feedsMutatingXargs = segments.some(xargsRunsMutatingCommand);
2275
2837
  let accountedFor = false;
2276
2838
  const directories = /* @__PURE__ */ new Set([cwd]);
2277
2839
  let unknownDirectory = false;
@@ -2282,10 +2844,14 @@ function commandMutatesLedgerForSegments(rawSegments, command, ledgerPath, homeD
2282
2844
  if (scriptIndex < 0) continue;
2283
2845
  if (unknownDirectory || [...directories].some((directory) => commandMutatesLedger(tokens[scriptIndex], ledgerPath, homeDir, directory, env, depth + 1))) return true;
2284
2846
  }
2847
+ const findRoots = destructiveFindRoots(seg, feedsMutatingXargs);
2848
+ if (findRoots !== null && (unknownDirectory || findRoots.some(({ root, cwdUnknown, followsSymlinks }) => [...directories].some((directory) => targetMayReachAudit(root, directory, auditDir, ledgerFile, homeDir, env, { cwdUnknown, followsSymlinks }))))) return true;
2285
2849
  if (isTrustedNodeBootLine(seg, homeDir, env, npmRootGSubstitutionPolluted)) {
2286
2850
  accountedFor = true;
2287
2851
  continue;
2288
2852
  }
2853
+ const treeTargets = treeMutationTargets(seg);
2854
+ if (treeTargets !== null && treeTargets.some(({ path: target, cwdUnknown }) => [...directories].some((directory) => targetMayReachAudit(target, directory, auditDir, ledgerFile, homeDir, env, { cwdUnknown })))) return true;
2289
2855
  const changesDirectory = ["cd", "pushd", "popd"].includes(tokens[0] ?? "");
2290
2856
  if (changesDirectory && /\$\(|`/.test(seg)) return true;
2291
2857
  if (changesDirectory && !/[<>]/.test(seg)) {
@@ -2311,6 +2877,64 @@ function commandMutatesLedgerForSegments(rawSegments, command, ledgerPath, homeD
2311
2877
  }
2312
2878
  return !accountedFor && verdictOf(command) === "yes";
2313
2879
  }
2880
+ var FIND_WRITING_ACTIONS = /* @__PURE__ */ new Set(["-delete", "-fprint", "-fprint0", "-fprintf", "-fls"]);
2881
+ var FIND_EXEC_ACTIONS = /* @__PURE__ */ new Set(["-exec", "-execdir", "-ok", "-okdir"]);
2882
+ var XARGS_OPTIONS_WITH_ARGUMENT = /* @__PURE__ */ new Set(["-I", "-L", "-n", "-P", "-s", "-d", "-E", "-a", "-J", "-R", "-S"]);
2883
+ function isMutatingProgram(word) {
2884
+ return word === void 0 || !LEDGER_READ_ONLY_PROGRAMS.has(path2.basename(word));
2885
+ }
2886
+ function xargsRunsMutatingCommand(segment) {
2887
+ return unwrapCommand(commandWords(segment)).some((command) => !command.undetermined && xargsArgvRunsMutating(command.argv));
2888
+ }
2889
+ function xargsArgvRunsMutating(tokens) {
2890
+ if (tokens.length === 0 || path2.basename(tokens[0]) !== "xargs") return false;
2891
+ let index = 1;
2892
+ while (index < tokens.length && tokens[index].startsWith("-")) {
2893
+ index += XARGS_OPTIONS_WITH_ARGUMENT.has(tokens[index]) ? 2 : 1;
2894
+ }
2895
+ return index < tokens.length && isMutatingProgram(tokens[index]);
2896
+ }
2897
+ function destructiveFindRoots(segment, feedsMutatingXargs) {
2898
+ const found = [];
2899
+ for (const command of unwrapCommand(commandWords(segment))) {
2900
+ if (command.undetermined) return [{ root: UNKNOWN_TARGET, cwdUnknown: true, followsSymlinks: false }];
2901
+ const plan = destructiveFindPlan(command.argv, feedsMutatingXargs);
2902
+ if (plan) found.push(...plan.roots.map((root) => ({ root, cwdUnknown: command.cwdUnknown, followsSymlinks: plan.followsSymlinks })));
2903
+ }
2904
+ return found.length > 0 ? found : null;
2905
+ }
2906
+ function destructiveFindPlan(tokens, feedsMutatingXargs) {
2907
+ if (tokens.length === 0 || path2.basename(tokens[0]) !== "find") return null;
2908
+ let index = 1;
2909
+ const roots = [];
2910
+ let followsSymlinks = false;
2911
+ while (index < tokens.length) {
2912
+ const tok = tokens[index];
2913
+ if (/^-O\d*$/.test(tok)) {
2914
+ index++;
2915
+ continue;
2916
+ }
2917
+ if (tok === "-D") {
2918
+ index += 2;
2919
+ continue;
2920
+ }
2921
+ if (tok === "-f") {
2922
+ if (index + 1 < tokens.length) roots.push(tokens[index + 1]);
2923
+ index += 2;
2924
+ continue;
2925
+ }
2926
+ if (!/^-[HLPEXdsx]+$/.test(tok)) break;
2927
+ for (const flag of tok.slice(1)) if (flag === "L" || flag === "H" || flag === "P") followsSymlinks = flag === "L";
2928
+ index++;
2929
+ }
2930
+ while (index < tokens.length && !/^[-(!),]/.test(tokens[index])) roots.push(tokens[index++]);
2931
+ const expression = tokens.slice(index);
2932
+ const writes = feedsMutatingXargs || expression.some((token, i) => FIND_WRITING_ACTIONS.has(token) || FIND_EXEC_ACTIONS.has(token) && isMutatingProgram(expression[i + 1]));
2933
+ if (!writes) return null;
2934
+ if (expression.includes("-follow")) followsSymlinks = true;
2935
+ if (expression.includes("-files0-from")) return { roots: [UNKNOWN_TARGET], followsSymlinks };
2936
+ return { roots: roots.length > 0 ? roots : ["."], followsSymlinks };
2937
+ }
2314
2938
  var ACTION_POLICY = [
2315
2939
  {
2316
2940
  id: "audit.ledger-tamper",