@namzu/cli 35.0.0 → 36.1.0

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 (1309) hide show
  1. package/CHANGELOG.md +764 -0
  2. package/README.md +160 -394
  3. package/assets/pal-blender-mcp.py +123 -0
  4. package/assets/pal-godot-mcp-pin.json +135 -0
  5. package/assets/pal-godot-mcp.cjs +418 -0
  6. package/dist/bin-main.d.ts +3 -0
  7. package/dist/bin-main.d.ts.map +1 -0
  8. package/dist/bin.d.ts +2 -1
  9. package/dist/bin.d.ts.map +1 -1
  10. package/dist/bin.js +85 -23
  11. package/dist/bin.js.map +6 -1
  12. package/dist/boot-narrative.d.ts +16 -0
  13. package/dist/boot-narrative.d.ts.map +1 -0
  14. package/dist/checkpoints/manifest.d.ts +107 -0
  15. package/dist/checkpoints/manifest.d.ts.map +1 -0
  16. package/dist/checkpoints/store.d.ts +280 -40
  17. package/dist/checkpoints/store.d.ts.map +1 -1
  18. package/dist/checkpoints/undo-plan.d.ts +83 -0
  19. package/dist/checkpoints/undo-plan.d.ts.map +1 -0
  20. package/dist/checkpoints/wrap.d.ts +4 -0
  21. package/dist/checkpoints/wrap.d.ts.map +1 -1
  22. package/dist/chunks/acp-5CWS2GLJ.js +13448 -0
  23. package/dist/chunks/acp-5CWS2GLJ.js.map +6 -0
  24. package/dist/chunks/activity-command-HK7YJTXV.js +262 -0
  25. package/dist/chunks/activity-command-HK7YJTXV.js.map +6 -0
  26. package/dist/chunks/add-ULH5DUNX.js +712 -0
  27. package/dist/chunks/add-ULH5DUNX.js.map +6 -0
  28. package/dist/chunks/agent-UEK2U3RE.js +87 -0
  29. package/dist/chunks/agent-UEK2U3RE.js.map +6 -0
  30. package/dist/chunks/agent-session-V7JRTODS.js +46 -0
  31. package/dist/chunks/agent-session-V7JRTODS.js.map +6 -0
  32. package/dist/chunks/archive-C4A3HPLF.js +84 -0
  33. package/dist/chunks/archive-C4A3HPLF.js.map +6 -0
  34. package/dist/chunks/bin-main-EEJHRDIC.js +126 -0
  35. package/dist/chunks/bin-main-EEJHRDIC.js.map +6 -0
  36. package/dist/chunks/browser-CRX4HM4C.js +31 -0
  37. package/dist/chunks/browser-CRX4HM4C.js.map +6 -0
  38. package/dist/chunks/chat-FVBATC4E.js +101 -0
  39. package/dist/chunks/chat-FVBATC4E.js.map +6 -0
  40. package/dist/chunks/chunk-2A37JQKY.js +1355 -0
  41. package/dist/chunks/chunk-2A37JQKY.js.map +6 -0
  42. package/dist/chunks/chunk-2NJ2XUXJ.js +283 -0
  43. package/dist/chunks/chunk-2NJ2XUXJ.js.map +6 -0
  44. package/dist/chunks/chunk-4HAE7PYX.js +74 -0
  45. package/dist/chunks/chunk-4HAE7PYX.js.map +6 -0
  46. package/dist/chunks/chunk-5GRV6P5C.js +69 -0
  47. package/dist/chunks/chunk-5GRV6P5C.js.map +6 -0
  48. package/dist/chunks/chunk-5PQVJBIO.js +168 -0
  49. package/dist/chunks/chunk-5PQVJBIO.js.map +6 -0
  50. package/dist/chunks/chunk-62I7HLAP.js +1142 -0
  51. package/dist/chunks/chunk-62I7HLAP.js.map +6 -0
  52. package/dist/chunks/chunk-63CGV3XY.js +161 -0
  53. package/dist/chunks/chunk-63CGV3XY.js.map +6 -0
  54. package/dist/chunks/chunk-6LLJQ3KY.js +225 -0
  55. package/dist/chunks/chunk-6LLJQ3KY.js.map +6 -0
  56. package/dist/chunks/chunk-6YG7D7U4.js +159 -0
  57. package/dist/chunks/chunk-6YG7D7U4.js.map +6 -0
  58. package/dist/chunks/chunk-76FLAFCG.js +51 -0
  59. package/dist/chunks/chunk-76FLAFCG.js.map +6 -0
  60. package/dist/chunks/chunk-7WJOQ6EA.js +106 -0
  61. package/dist/chunks/chunk-7WJOQ6EA.js.map +6 -0
  62. package/dist/chunks/chunk-A22MBIYU.js +42 -0
  63. package/dist/chunks/chunk-A22MBIYU.js.map +6 -0
  64. package/dist/chunks/chunk-A5DWGNGR.js +73 -0
  65. package/dist/chunks/chunk-A5DWGNGR.js.map +6 -0
  66. package/dist/chunks/chunk-A5UXODFL.js +76 -0
  67. package/dist/chunks/chunk-A5UXODFL.js.map +6 -0
  68. package/dist/chunks/chunk-AHIDYIRB.js +329 -0
  69. package/dist/chunks/chunk-AHIDYIRB.js.map +6 -0
  70. package/dist/chunks/chunk-AIY4PCDR.js +164 -0
  71. package/dist/chunks/chunk-AIY4PCDR.js.map +6 -0
  72. package/dist/chunks/chunk-AK2U3N2A.js +31 -0
  73. package/dist/chunks/chunk-AK2U3N2A.js.map +6 -0
  74. package/dist/chunks/chunk-AN7FO7NS.js +247 -0
  75. package/dist/chunks/chunk-AN7FO7NS.js.map +6 -0
  76. package/dist/chunks/chunk-AXIGFKJF.js +34 -0
  77. package/dist/chunks/chunk-AXIGFKJF.js.map +6 -0
  78. package/dist/chunks/chunk-C5WBEO3X.js +46 -0
  79. package/dist/chunks/chunk-C5WBEO3X.js.map +6 -0
  80. package/dist/chunks/chunk-C5XYHYMX.js +675 -0
  81. package/dist/chunks/chunk-C5XYHYMX.js.map +6 -0
  82. package/dist/chunks/chunk-CG65NUSJ.js +115 -0
  83. package/dist/chunks/chunk-CG65NUSJ.js.map +6 -0
  84. package/dist/chunks/chunk-CHIEVVQ2.js +32 -0
  85. package/dist/chunks/chunk-CHIEVVQ2.js.map +6 -0
  86. package/dist/chunks/chunk-E5VLANCO.js +101 -0
  87. package/dist/chunks/chunk-E5VLANCO.js.map +6 -0
  88. package/dist/chunks/chunk-EBOHVFOB.js +648 -0
  89. package/dist/chunks/chunk-EBOHVFOB.js.map +6 -0
  90. package/dist/chunks/chunk-EEDZOGV4.js +47 -0
  91. package/dist/chunks/chunk-EEDZOGV4.js.map +6 -0
  92. package/dist/chunks/chunk-EIYM6TY7.js +1479 -0
  93. package/dist/chunks/chunk-EIYM6TY7.js.map +6 -0
  94. package/dist/chunks/chunk-EWKJGHRO.js +82559 -0
  95. package/dist/chunks/chunk-EWKJGHRO.js.map +6 -0
  96. package/dist/chunks/chunk-EY7UNVER.js +311 -0
  97. package/dist/chunks/chunk-EY7UNVER.js.map +6 -0
  98. package/dist/chunks/chunk-FTMTO72X.js +95 -0
  99. package/dist/chunks/chunk-FTMTO72X.js.map +6 -0
  100. package/dist/chunks/chunk-FXS3AG6B.js +25326 -0
  101. package/dist/chunks/chunk-FXS3AG6B.js.map +6 -0
  102. package/dist/chunks/chunk-GIXSS6KW.js +2228 -0
  103. package/dist/chunks/chunk-GIXSS6KW.js.map +6 -0
  104. package/dist/chunks/chunk-GMCOZ3CU.js +245 -0
  105. package/dist/chunks/chunk-GMCOZ3CU.js.map +6 -0
  106. package/dist/chunks/chunk-GNBMKISG.js +19 -0
  107. package/dist/chunks/chunk-GNBMKISG.js.map +6 -0
  108. package/dist/chunks/chunk-GWQEMJFS.js +28 -0
  109. package/dist/chunks/chunk-GWQEMJFS.js.map +6 -0
  110. package/dist/chunks/chunk-H6B6AROX.js +151 -0
  111. package/dist/chunks/chunk-H6B6AROX.js.map +6 -0
  112. package/dist/chunks/chunk-HBBB2CAC.js +75 -0
  113. package/dist/chunks/chunk-HBBB2CAC.js.map +6 -0
  114. package/dist/chunks/chunk-HE7WUOX2.js +26 -0
  115. package/dist/chunks/chunk-HE7WUOX2.js.map +6 -0
  116. package/dist/chunks/chunk-HFJHHCTY.js +303 -0
  117. package/dist/chunks/chunk-HFJHHCTY.js.map +6 -0
  118. package/dist/chunks/chunk-HPMWYIBY.js +773 -0
  119. package/dist/chunks/chunk-HPMWYIBY.js.map +6 -0
  120. package/dist/chunks/chunk-HQM2WSQT.js +106 -0
  121. package/dist/chunks/chunk-HQM2WSQT.js.map +6 -0
  122. package/dist/chunks/chunk-ITZK4B66.js +787 -0
  123. package/dist/chunks/chunk-ITZK4B66.js.map +6 -0
  124. package/dist/chunks/chunk-J72CRUNX.js +154 -0
  125. package/dist/chunks/chunk-J72CRUNX.js.map +6 -0
  126. package/dist/chunks/chunk-JORONMD3.js +18 -0
  127. package/dist/chunks/chunk-JORONMD3.js.map +6 -0
  128. package/dist/chunks/chunk-JPPC4LJF.js +271 -0
  129. package/dist/chunks/chunk-JPPC4LJF.js.map +6 -0
  130. package/dist/chunks/chunk-JV3LONAU.js +76 -0
  131. package/dist/chunks/chunk-JV3LONAU.js.map +6 -0
  132. package/dist/chunks/chunk-K76WV7TN.js +71 -0
  133. package/dist/chunks/chunk-K76WV7TN.js.map +6 -0
  134. package/dist/chunks/chunk-KCWUQRZV.js +828 -0
  135. package/dist/chunks/chunk-KCWUQRZV.js.map +6 -0
  136. package/dist/chunks/chunk-KONYGNG6.js +7661 -0
  137. package/dist/chunks/chunk-KONYGNG6.js.map +6 -0
  138. package/dist/chunks/chunk-KU3W6IHV.js +109 -0
  139. package/dist/chunks/chunk-KU3W6IHV.js.map +6 -0
  140. package/dist/chunks/chunk-LQMHASKR.js +171 -0
  141. package/dist/chunks/chunk-LQMHASKR.js.map +6 -0
  142. package/dist/chunks/chunk-LXB3S4IC.js +19 -0
  143. package/dist/chunks/chunk-LXB3S4IC.js.map +6 -0
  144. package/dist/chunks/chunk-MZP6SH3M.js +3497 -0
  145. package/dist/chunks/chunk-MZP6SH3M.js.map +6 -0
  146. package/dist/chunks/chunk-N5IF64K3.js +1858 -0
  147. package/dist/chunks/chunk-N5IF64K3.js.map +6 -0
  148. package/dist/chunks/chunk-NADQQMMG.js +46 -0
  149. package/dist/chunks/chunk-NADQQMMG.js.map +6 -0
  150. package/dist/chunks/chunk-NQY5P2EB.js +20 -0
  151. package/dist/chunks/chunk-NQY5P2EB.js.map +6 -0
  152. package/dist/chunks/chunk-NUGPLXVK.js +228 -0
  153. package/dist/chunks/chunk-NUGPLXVK.js.map +6 -0
  154. package/dist/chunks/chunk-O7DBCVNY.js +110 -0
  155. package/dist/chunks/chunk-O7DBCVNY.js.map +6 -0
  156. package/dist/chunks/chunk-OEW7CJKK.js +140 -0
  157. package/dist/chunks/chunk-OEW7CJKK.js.map +6 -0
  158. package/dist/chunks/chunk-OH6TB27S.js +111 -0
  159. package/dist/chunks/chunk-OH6TB27S.js.map +6 -0
  160. package/dist/chunks/chunk-OLPOM3DR.js +127 -0
  161. package/dist/chunks/chunk-OLPOM3DR.js.map +6 -0
  162. package/dist/chunks/chunk-PYG7DZ2D.js +380 -0
  163. package/dist/chunks/chunk-PYG7DZ2D.js.map +6 -0
  164. package/dist/chunks/chunk-Q24K7536.js +661 -0
  165. package/dist/chunks/chunk-Q24K7536.js.map +6 -0
  166. package/dist/chunks/chunk-Q5YM2GCX.js +283 -0
  167. package/dist/chunks/chunk-Q5YM2GCX.js.map +6 -0
  168. package/dist/chunks/chunk-R7DCDBRN.js +106 -0
  169. package/dist/chunks/chunk-R7DCDBRN.js.map +6 -0
  170. package/dist/chunks/chunk-RC6X3ZY6.js +1439 -0
  171. package/dist/chunks/chunk-RC6X3ZY6.js.map +6 -0
  172. package/dist/chunks/chunk-SGS435PR.js +11111 -0
  173. package/dist/chunks/chunk-SGS435PR.js.map +6 -0
  174. package/dist/chunks/chunk-SKKWMMFP.js +474 -0
  175. package/dist/chunks/chunk-SKKWMMFP.js.map +6 -0
  176. package/dist/chunks/chunk-SRU3MDHZ.js +75 -0
  177. package/dist/chunks/chunk-SRU3MDHZ.js.map +6 -0
  178. package/dist/chunks/chunk-TBIX6JRE.js +24 -0
  179. package/dist/chunks/chunk-TBIX6JRE.js.map +6 -0
  180. package/dist/chunks/chunk-THNCQJ33.js +11265 -0
  181. package/dist/chunks/chunk-THNCQJ33.js.map +6 -0
  182. package/dist/chunks/chunk-THZXXVHM.js +2953 -0
  183. package/dist/chunks/chunk-THZXXVHM.js.map +6 -0
  184. package/dist/chunks/chunk-TIGWWAJI.js +765 -0
  185. package/dist/chunks/chunk-TIGWWAJI.js.map +6 -0
  186. package/dist/chunks/chunk-UDBEU2FR.js +97 -0
  187. package/dist/chunks/chunk-UDBEU2FR.js.map +6 -0
  188. package/dist/chunks/chunk-UOOQPODR.js +257 -0
  189. package/dist/chunks/chunk-UOOQPODR.js.map +6 -0
  190. package/dist/chunks/chunk-US5ZFPAU.js +400 -0
  191. package/dist/chunks/chunk-US5ZFPAU.js.map +6 -0
  192. package/dist/chunks/chunk-UWWGSDZ5.js +134 -0
  193. package/dist/chunks/chunk-UWWGSDZ5.js.map +6 -0
  194. package/dist/chunks/chunk-UXVYJWN5.js +1373 -0
  195. package/dist/chunks/chunk-UXVYJWN5.js.map +6 -0
  196. package/dist/chunks/chunk-V7TQR6AR.js +818 -0
  197. package/dist/chunks/chunk-V7TQR6AR.js.map +6 -0
  198. package/dist/chunks/chunk-VRL2WNQN.js +7534 -0
  199. package/dist/chunks/chunk-VRL2WNQN.js.map +6 -0
  200. package/dist/chunks/chunk-WATMFOHB.js +319 -0
  201. package/dist/chunks/chunk-WATMFOHB.js.map +6 -0
  202. package/dist/chunks/chunk-WHODOMXA.js +132 -0
  203. package/dist/chunks/chunk-WHODOMXA.js.map +6 -0
  204. package/dist/chunks/chunk-WM2JEUGV.js +207 -0
  205. package/dist/chunks/chunk-WM2JEUGV.js.map +6 -0
  206. package/dist/chunks/chunk-XEUQN4JC.js +54 -0
  207. package/dist/chunks/chunk-XEUQN4JC.js.map +6 -0
  208. package/dist/chunks/chunk-XHOD3RDN.js +517 -0
  209. package/dist/chunks/chunk-XHOD3RDN.js.map +6 -0
  210. package/dist/chunks/chunk-Y7B67G22.js +26 -0
  211. package/dist/chunks/chunk-Y7B67G22.js.map +6 -0
  212. package/dist/chunks/chunk-ZKEWE6K4.js +399 -0
  213. package/dist/chunks/chunk-ZKEWE6K4.js.map +6 -0
  214. package/dist/chunks/chunk-ZPR4IMRT.js +36 -0
  215. package/dist/chunks/chunk-ZPR4IMRT.js.map +6 -0
  216. package/dist/chunks/chunk-ZWA2JRJV.js +45 -0
  217. package/dist/chunks/chunk-ZWA2JRJV.js.map +6 -0
  218. package/dist/chunks/cli-runtime-7YAOEJGS.js +129 -0
  219. package/dist/chunks/cli-runtime-7YAOEJGS.js.map +6 -0
  220. package/dist/chunks/commands-QPVRB3RK.js +21 -0
  221. package/dist/chunks/commands-QPVRB3RK.js.map +6 -0
  222. package/dist/chunks/computer-GXDY4H35.js +493 -0
  223. package/dist/chunks/computer-GXDY4H35.js.map +6 -0
  224. package/dist/chunks/crash-report-S3BTEPYR.js +21 -0
  225. package/dist/chunks/crash-report-S3BTEPYR.js.map +6 -0
  226. package/dist/chunks/devtools-LBE4PAQN.js +3851 -0
  227. package/dist/chunks/devtools-LBE4PAQN.js.map +6 -0
  228. package/dist/chunks/dist-3GJFRS2X.js +520 -0
  229. package/dist/chunks/dist-3GJFRS2X.js.map +6 -0
  230. package/dist/chunks/dist-BFC7XUCT.js +555 -0
  231. package/dist/chunks/dist-BFC7XUCT.js.map +6 -0
  232. package/dist/chunks/dist-ERN5DRKK.js +1415 -0
  233. package/dist/chunks/dist-ERN5DRKK.js.map +6 -0
  234. package/dist/chunks/dist-EY3OJBQH.js +1339 -0
  235. package/dist/chunks/dist-EY3OJBQH.js.map +6 -0
  236. package/dist/chunks/dist-G42HPNIE.js +514 -0
  237. package/dist/chunks/dist-G42HPNIE.js.map +6 -0
  238. package/dist/chunks/dist-SKRHHPUR.js +1018 -0
  239. package/dist/chunks/dist-SKRHHPUR.js.map +6 -0
  240. package/dist/chunks/dist-Z47L7ZAJ.js +40654 -0
  241. package/dist/chunks/dist-Z47L7ZAJ.js.map +6 -0
  242. package/dist/chunks/doctor-IE3PLXZK.js +28 -0
  243. package/dist/chunks/doctor-IE3PLXZK.js.map +6 -0
  244. package/dist/chunks/drain-ESXUKOE6.js +471 -0
  245. package/dist/chunks/drain-ESXUKOE6.js.map +6 -0
  246. package/dist/chunks/endpoint-M2DDENPP.js +15 -0
  247. package/dist/chunks/endpoint-M2DDENPP.js.map +6 -0
  248. package/dist/chunks/eval-53UONRWR.js +187 -0
  249. package/dist/chunks/eval-53UONRWR.js.map +6 -0
  250. package/dist/chunks/exec-COV235L5.js +1284 -0
  251. package/dist/chunks/exec-COV235L5.js.map +6 -0
  252. package/dist/chunks/home-QS7RBP34.js +16 -0
  253. package/dist/chunks/home-QS7RBP34.js.map +6 -0
  254. package/dist/chunks/host-queries-LDEBHKBX.js +152 -0
  255. package/dist/chunks/host-queries-LDEBHKBX.js.map +6 -0
  256. package/dist/chunks/lib-KXZZJJG2.js +2657 -0
  257. package/dist/chunks/lib-KXZZJJG2.js.map +6 -0
  258. package/dist/chunks/lifecycle-6NF6NJNV.js +63 -0
  259. package/dist/chunks/lifecycle-6NF6NJNV.js.map +6 -0
  260. package/dist/chunks/list-DQZU7NEF.js +293 -0
  261. package/dist/chunks/list-DQZU7NEF.js.map +6 -0
  262. package/dist/chunks/login-IQGNP5XY.js +29 -0
  263. package/dist/chunks/login-IQGNP5XY.js.map +6 -0
  264. package/dist/chunks/logs-KSG7SFAB.js +116 -0
  265. package/dist/chunks/logs-KSG7SFAB.js.map +6 -0
  266. package/dist/chunks/mcp-WFXKXGNM.js +763 -0
  267. package/dist/chunks/mcp-WFXKXGNM.js.map +6 -0
  268. package/dist/chunks/message-command-O7ZH4I4C.js +170 -0
  269. package/dist/chunks/message-command-O7ZH4I4C.js.map +6 -0
  270. package/dist/chunks/node-QB2FA2ZB.js +916 -0
  271. package/dist/chunks/node-QB2FA2ZB.js.map +6 -0
  272. package/dist/chunks/operator-tools-LTPV3CH5.js +115 -0
  273. package/dist/chunks/operator-tools-LTPV3CH5.js.map +6 -0
  274. package/dist/chunks/output-schema-UM3P5AOR.js +11 -0
  275. package/dist/chunks/output-schema-UM3P5AOR.js.map +6 -0
  276. package/dist/chunks/pal-GBYJHBP3.js +200 -0
  277. package/dist/chunks/pal-GBYJHBP3.js.map +6 -0
  278. package/dist/chunks/paths-DXYFKIJU.js +10 -0
  279. package/dist/chunks/paths-DXYFKIJU.js.map +6 -0
  280. package/dist/chunks/pica-WNHDDIFX.js +1736 -0
  281. package/dist/chunks/pica-WNHDDIFX.js.map +6 -0
  282. package/dist/chunks/providers-J42J2PDA.js +160 -0
  283. package/dist/chunks/providers-J42J2PDA.js.map +6 -0
  284. package/dist/chunks/resident-7D6IM5LP.js +1314 -0
  285. package/dist/chunks/resident-7D6IM5LP.js.map +6 -0
  286. package/dist/chunks/resume-command-XZWGUXRK.js +22 -0
  287. package/dist/chunks/resume-command-XZWGUXRK.js.map +6 -0
  288. package/dist/chunks/schedule-JLIOF3MS.js +143 -0
  289. package/dist/chunks/schedule-JLIOF3MS.js.map +6 -0
  290. package/dist/chunks/serve-S7UWNIR3.js +21 -0
  291. package/dist/chunks/serve-S7UWNIR3.js.map +6 -0
  292. package/dist/chunks/service-YBU5VTKQ.js +1633 -0
  293. package/dist/chunks/service-YBU5VTKQ.js.map +6 -0
  294. package/dist/chunks/session-step-2HJSIJNN.js +26 -0
  295. package/dist/chunks/session-step-2HJSIJNN.js.map +6 -0
  296. package/dist/chunks/skills-HV2MOBEW.js +282 -0
  297. package/dist/chunks/skills-HV2MOBEW.js.map +6 -0
  298. package/dist/chunks/state-6HV3D3O4.js +717 -0
  299. package/dist/chunks/state-6HV3D3O4.js.map +6 -0
  300. package/dist/chunks/store-6J2MUGON.js +82 -0
  301. package/dist/chunks/store-6J2MUGON.js.map +6 -0
  302. package/dist/chunks/store-GDP2EW27.js +34 -0
  303. package/dist/chunks/store-GDP2EW27.js.map +6 -0
  304. package/dist/chunks/store-VXNKMMNW.js +42 -0
  305. package/dist/chunks/store-VXNKMMNW.js.map +6 -0
  306. package/dist/chunks/tui-DDWX2WYH.js +56903 -0
  307. package/dist/chunks/tui-DDWX2WYH.js.map +6 -0
  308. package/dist/chunks/upgrade-MC5JB7DK.js +315 -0
  309. package/dist/chunks/upgrade-MC5JB7DK.js.map +6 -0
  310. package/dist/chunks/webapi-6HUHZUAH.js +2715 -0
  311. package/dist/chunks/webapi-6HUHZUAH.js.map +6 -0
  312. package/dist/chunks/worktree-6YPRX6SU.js +116 -0
  313. package/dist/chunks/worktree-6YPRX6SU.js.map +6 -0
  314. package/dist/cli-runtime.d.ts +19 -0
  315. package/dist/cli-runtime.d.ts.map +1 -0
  316. package/dist/cli.d.ts +0 -15
  317. package/dist/cli.d.ts.map +1 -1
  318. package/dist/commands/acp-harness.d.ts +64 -0
  319. package/dist/commands/acp-harness.d.ts.map +1 -0
  320. package/dist/commands/acp-provider-retry.d.ts +27 -0
  321. package/dist/commands/acp-provider-retry.d.ts.map +1 -0
  322. package/dist/commands/acp.d.ts +134 -3
  323. package/dist/commands/acp.d.ts.map +1 -1
  324. package/dist/commands/computer.d.ts +3 -0
  325. package/dist/commands/computer.d.ts.map +1 -0
  326. package/dist/commands/desktop-host-changes.d.ts +65 -0
  327. package/dist/commands/desktop-host-changes.d.ts.map +1 -0
  328. package/dist/commands/desktop-host-header.d.ts +30 -0
  329. package/dist/commands/desktop-host-header.d.ts.map +1 -0
  330. package/dist/commands/desktop-host.d.ts +354 -0
  331. package/dist/commands/desktop-host.d.ts.map +1 -0
  332. package/dist/commands/desktop-model-catalogue.d.ts +25 -0
  333. package/dist/commands/desktop-model-catalogue.d.ts.map +1 -0
  334. package/dist/commands/effort-levels.d.ts +3 -0
  335. package/dist/commands/effort-levels.d.ts.map +1 -0
  336. package/dist/commands/exec-flags.d.ts +4 -0
  337. package/dist/commands/exec-flags.d.ts.map +1 -1
  338. package/dist/commands/exec.d.ts.map +1 -1
  339. package/dist/commands/lazy.d.ts +20 -0
  340. package/dist/commands/lazy.d.ts.map +1 -0
  341. package/dist/commands/manifest.d.ts +33 -0
  342. package/dist/commands/manifest.d.ts.map +1 -0
  343. package/dist/commands/pal.d.ts +5 -0
  344. package/dist/commands/pal.d.ts.map +1 -0
  345. package/dist/commands/permission-preview.d.ts +38 -0
  346. package/dist/commands/permission-preview.d.ts.map +1 -0
  347. package/dist/commands/registry.d.ts +10 -0
  348. package/dist/commands/registry.d.ts.map +1 -1
  349. package/dist/commands/serve.d.ts +1 -12
  350. package/dist/commands/serve.d.ts.map +1 -1
  351. package/dist/commands/stdin.d.ts.map +1 -1
  352. package/dist/commands/upgrade.d.ts +14 -0
  353. package/dist/commands/upgrade.d.ts.map +1 -1
  354. package/dist/compile-cache-enable.d.ts +2 -0
  355. package/dist/compile-cache-enable.d.ts.map +1 -0
  356. package/dist/compile-cache.d.ts +53 -0
  357. package/dist/compile-cache.d.ts.map +1 -0
  358. package/dist/computer/bundle.d.ts +18 -0
  359. package/dist/computer/bundle.d.ts.map +1 -0
  360. package/dist/computer/run.d.ts +26 -0
  361. package/dist/computer/run.d.ts.map +1 -0
  362. package/dist/computer/sentences.d.ts +30 -0
  363. package/dist/computer/sentences.d.ts.map +1 -0
  364. package/dist/config/load.d.ts +10 -1
  365. package/dist/config/load.d.ts.map +1 -1
  366. package/dist/context/capabilities.d.ts +25 -2
  367. package/dist/context/capabilities.d.ts.map +1 -1
  368. package/dist/context/runtime-message.d.ts.map +1 -1
  369. package/dist/crash-report.d.ts +22 -0
  370. package/dist/crash-report.d.ts.map +1 -0
  371. package/dist/debug-requested.d.ts +7 -0
  372. package/dist/debug-requested.d.ts.map +1 -0
  373. package/dist/doctor/checks/credentials.d.ts.map +1 -1
  374. package/dist/exit-codes.d.ts +9 -1
  375. package/dist/exit-codes.d.ts.map +1 -1
  376. package/dist/index.js +105 -17
  377. package/dist/index.js.map +6 -1
  378. package/dist/integrations/harness/claude-adapter.d.ts +20 -0
  379. package/dist/integrations/harness/claude-adapter.d.ts.map +1 -0
  380. package/dist/integrations/harness/claude-protocol.d.ts +67 -0
  381. package/dist/integrations/harness/claude-protocol.d.ts.map +1 -0
  382. package/dist/integrations/harness/codex-adapter.d.ts +80 -0
  383. package/dist/integrations/harness/codex-adapter.d.ts.map +1 -0
  384. package/dist/integrations/harness/codex-protocol.d.ts +22 -0
  385. package/dist/integrations/harness/codex-protocol.d.ts.map +1 -0
  386. package/dist/integrations/harness/model-cache.d.ts +16 -0
  387. package/dist/integrations/harness/model-cache.d.ts.map +1 -0
  388. package/dist/integrations/harness/native-executable.d.ts +8 -0
  389. package/dist/integrations/harness/native-executable.d.ts.map +1 -0
  390. package/dist/integrations/harness/process.d.ts +25 -0
  391. package/dist/integrations/harness/process.d.ts.map +1 -0
  392. package/dist/integrations/peers/runtime.d.ts +64 -0
  393. package/dist/integrations/peers/runtime.d.ts.map +1 -0
  394. package/dist/integrations/plugins/inventory.d.ts +27 -0
  395. package/dist/integrations/plugins/inventory.d.ts.map +1 -0
  396. package/dist/integrations/providers/composer-settings.d.ts +33 -0
  397. package/dist/integrations/providers/composer-settings.d.ts.map +1 -0
  398. package/dist/integrations/providers/connections.d.ts +37 -0
  399. package/dist/integrations/providers/connections.d.ts.map +1 -0
  400. package/dist/integrations/providers/credential-store.d.ts +35 -0
  401. package/dist/integrations/providers/credential-store.d.ts.map +1 -1
  402. package/dist/integrations/providers/discover.d.ts +27 -1
  403. package/dist/integrations/providers/discover.d.ts.map +1 -1
  404. package/dist/integrations/providers/index.d.ts +2 -2
  405. package/dist/integrations/providers/index.d.ts.map +1 -1
  406. package/dist/integrations/providers/picker-operation.d.ts +6 -0
  407. package/dist/integrations/providers/picker-operation.d.ts.map +1 -0
  408. package/dist/integrations/providers/setup.d.ts +16 -1
  409. package/dist/integrations/providers/setup.d.ts.map +1 -1
  410. package/dist/integrations/resident/runner-worker.js +190 -161
  411. package/dist/integrations/resident/runner-worker.js.map +6 -1
  412. package/dist/integrations/sessions/display-title.d.ts +8 -0
  413. package/dist/integrations/sessions/display-title.d.ts.map +1 -1
  414. package/dist/integrations/sessions/store.d.ts +23 -9
  415. package/dist/integrations/sessions/store.d.ts.map +1 -1
  416. package/dist/integrations/sessions/task-context.d.ts +1 -1
  417. package/dist/integrations/sessions/task-context.d.ts.map +1 -1
  418. package/dist/integrations/sessions/transcript-export.d.ts.map +1 -1
  419. package/dist/integrations/subagents/activity.d.ts +9 -6
  420. package/dist/integrations/subagents/activity.d.ts.map +1 -1
  421. package/dist/integrations/subagents/operator-journal.d.ts +20 -0
  422. package/dist/integrations/subagents/operator-journal.d.ts.map +1 -0
  423. package/dist/integrations/subagents/runtime.d.ts +11 -0
  424. package/dist/integrations/subagents/runtime.d.ts.map +1 -1
  425. package/dist/integrations/trust/store.d.ts +14 -0
  426. package/dist/integrations/trust/store.d.ts.map +1 -1
  427. package/dist/integrations/web/search.d.ts +1 -1
  428. package/dist/pals/actions.d.ts +57 -0
  429. package/dist/pals/actions.d.ts.map +1 -0
  430. package/dist/pals/activity-command.d.ts +3 -0
  431. package/dist/pals/activity-command.d.ts.map +1 -0
  432. package/dist/pals/activity.d.ts +18 -0
  433. package/dist/pals/activity.d.ts.map +1 -0
  434. package/dist/pals/agent-session.d.ts +19 -0
  435. package/dist/pals/agent-session.d.ts.map +1 -0
  436. package/dist/pals/channel-actions.d.ts +5 -0
  437. package/dist/pals/channel-actions.d.ts.map +1 -0
  438. package/dist/pals/channel-local.d.ts +7 -0
  439. package/dist/pals/channel-local.d.ts.map +1 -0
  440. package/dist/pals/channel.d.ts +20 -0
  441. package/dist/pals/channel.d.ts.map +1 -0
  442. package/dist/pals/chat.d.ts +6 -0
  443. package/dist/pals/chat.d.ts.map +1 -0
  444. package/dist/pals/communication.d.ts +47 -0
  445. package/dist/pals/communication.d.ts.map +1 -0
  446. package/dist/pals/conversations.d.ts +26 -0
  447. package/dist/pals/conversations.d.ts.map +1 -0
  448. package/dist/pals/desktop-communication.d.ts +111 -0
  449. package/dist/pals/desktop-communication.d.ts.map +1 -0
  450. package/dist/pals/dispatch.d.ts +13 -0
  451. package/dist/pals/dispatch.d.ts.map +1 -0
  452. package/dist/pals/environment.d.ts +103 -0
  453. package/dist/pals/environment.d.ts.map +1 -0
  454. package/dist/pals/guest-mcp-transport.d.ts +28 -0
  455. package/dist/pals/guest-mcp-transport.d.ts.map +1 -0
  456. package/dist/pals/guest-mcp.d.ts +22 -0
  457. package/dist/pals/guest-mcp.d.ts.map +1 -0
  458. package/dist/pals/inbox-start.d.ts +35 -0
  459. package/dist/pals/inbox-start.d.ts.map +1 -0
  460. package/dist/pals/message-command.d.ts +3 -0
  461. package/dist/pals/message-command.d.ts.map +1 -0
  462. package/dist/pals/operator-tools.d.ts +23 -0
  463. package/dist/pals/operator-tools.d.ts.map +1 -0
  464. package/dist/pals/public-transcript.d.ts +4 -0
  465. package/dist/pals/public-transcript.d.ts.map +1 -0
  466. package/dist/pals/review.d.ts +16 -0
  467. package/dist/pals/review.d.ts.map +1 -0
  468. package/dist/pals/store.d.ts +16 -0
  469. package/dist/pals/store.d.ts.map +1 -0
  470. package/dist/pals/tui-session.d.ts +11 -0
  471. package/dist/pals/tui-session.d.ts.map +1 -0
  472. package/dist/permissions/mode-names.d.ts +2 -0
  473. package/dist/permissions/mode-names.d.ts.map +1 -0
  474. package/dist/resume-invocation.d.ts +1 -1
  475. package/dist/resume-invocation.d.ts.map +1 -1
  476. package/dist/resume-shell.d.ts +8 -0
  477. package/dist/resume-shell.d.ts.map +1 -0
  478. package/dist/schedule/build.d.ts +12 -3
  479. package/dist/schedule/build.d.ts.map +1 -1
  480. package/dist/schedule/commands/add.d.ts +1 -1
  481. package/dist/schedule/commands/add.d.ts.map +1 -1
  482. package/dist/schedule/commands/lifecycle.d.ts.map +1 -1
  483. package/dist/schedule/commands/list.d.ts +3 -1
  484. package/dist/schedule/commands/list.d.ts.map +1 -1
  485. package/dist/schedule/daemon/daemon.d.ts +2 -0
  486. package/dist/schedule/daemon/daemon.d.ts.map +1 -1
  487. package/dist/schedule/delivery.d.ts +66 -0
  488. package/dist/schedule/delivery.d.ts.map +1 -0
  489. package/dist/schedule/fire/fire.d.ts +1 -1
  490. package/dist/schedule/fire/fire.d.ts.map +1 -1
  491. package/dist/schedule/fire/run-script.d.ts +2 -2
  492. package/dist/schedule/fire/run-script.d.ts.map +1 -1
  493. package/dist/schedule/fire/script-report.d.ts +31 -0
  494. package/dist/schedule/fire/script-report.d.ts.map +1 -0
  495. package/dist/schedule/floor.d.ts +1 -1
  496. package/dist/schedule/floor.d.ts.map +1 -1
  497. package/dist/schedule/folder.d.ts +6 -0
  498. package/dist/schedule/folder.d.ts.map +1 -1
  499. package/dist/schedule/resume-command.d.ts +3 -3
  500. package/dist/schedule/resume-command.d.ts.map +1 -1
  501. package/dist/schedule/store/history.d.ts.map +1 -1
  502. package/dist/schedule/store/jobs.d.ts +6 -6
  503. package/dist/schedule/store/jobs.d.ts.map +1 -1
  504. package/dist/schedule/store/script-state.d.ts +31 -0
  505. package/dist/schedule/store/script-state.d.ts.map +1 -0
  506. package/dist/schedule/store/state.d.ts +4 -2
  507. package/dist/schedule/store/state.d.ts.map +1 -1
  508. package/dist/schedule/types.d.ts +61 -16
  509. package/dist/schedule/types.d.ts.map +1 -1
  510. package/dist/skills/store.d.ts.map +1 -1
  511. package/dist/terminal/host.d.ts +22 -0
  512. package/dist/terminal/host.d.ts.map +1 -0
  513. package/dist/terminal/manager.d.ts +124 -0
  514. package/dist/terminal/manager.d.ts.map +1 -0
  515. package/dist/terminal/protocol.d.ts +162 -0
  516. package/dist/terminal/protocol.d.ts.map +1 -0
  517. package/dist/terminal/pty.d.ts +85 -0
  518. package/dist/terminal/pty.d.ts.map +1 -0
  519. package/dist/terminal/ring.d.ts +23 -0
  520. package/dist/terminal/ring.d.ts.map +1 -0
  521. package/dist/terminal/screen.d.ts +31 -0
  522. package/dist/terminal/screen.d.ts.map +1 -0
  523. package/dist/termination-state.d.ts +19 -0
  524. package/dist/termination-state.d.ts.map +1 -0
  525. package/dist/termination.d.ts +2 -9
  526. package/dist/termination.d.ts.map +1 -1
  527. package/dist/tui/AgentExplorer.d.ts +4 -1
  528. package/dist/tui/AgentExplorer.d.ts.map +1 -1
  529. package/dist/tui/App.d.ts.map +1 -1
  530. package/dist/tui/BackgroundJobsPanel.d.ts.map +1 -1
  531. package/dist/tui/BrandHeader.d.ts.map +1 -1
  532. package/dist/tui/ChildComposer.d.ts +22 -0
  533. package/dist/tui/ChildComposer.d.ts.map +1 -0
  534. package/dist/tui/ChoicePicker.d.ts.map +1 -1
  535. package/dist/tui/Composer.d.ts +21 -3
  536. package/dist/tui/Composer.d.ts.map +1 -1
  537. package/dist/tui/ComposerFrame.d.ts.map +1 -1
  538. package/dist/tui/CopyPicker.d.ts.map +1 -1
  539. package/dist/tui/EditPromptPicker.d.ts.map +1 -1
  540. package/dist/tui/EffortSlider.d.ts.map +1 -1
  541. package/dist/tui/LiveActivity.d.ts +7 -1
  542. package/dist/tui/LiveActivity.d.ts.map +1 -1
  543. package/dist/tui/Markdown.d.ts.map +1 -1
  544. package/dist/tui/PendingInputPanel.d.ts.map +1 -1
  545. package/dist/tui/PermissionOverlay.d.ts.map +1 -1
  546. package/dist/tui/Picker.d.ts.map +1 -1
  547. package/dist/tui/ProviderSetup.d.ts.map +1 -1
  548. package/dist/tui/ResumePicker.d.ts.map +1 -1
  549. package/dist/tui/SaveSkillOverlay.d.ts.map +1 -1
  550. package/dist/tui/ScheduleReviewOverlay.d.ts +1 -1
  551. package/dist/tui/ScheduleReviewOverlay.d.ts.map +1 -1
  552. package/dist/tui/StatusBar.d.ts +7 -1
  553. package/dist/tui/StatusBar.d.ts.map +1 -1
  554. package/dist/tui/StatusPanel.d.ts.map +1 -1
  555. package/dist/tui/TextPrompt.d.ts.map +1 -1
  556. package/dist/tui/ToolOutputViewer.d.ts.map +1 -1
  557. package/dist/tui/Transcript.d.ts +3 -0
  558. package/dist/tui/Transcript.d.ts.map +1 -1
  559. package/dist/tui/TranscriptScrollView.d.ts +23 -0
  560. package/dist/tui/TranscriptScrollView.d.ts.map +1 -0
  561. package/dist/tui/TrustPrompt.d.ts +8 -0
  562. package/dist/tui/TrustPrompt.d.ts.map +1 -1
  563. package/dist/tui/agent.d.ts +125 -3
  564. package/dist/tui/agent.d.ts.map +1 -1
  565. package/dist/tui/browser-notices.d.ts.map +1 -1
  566. package/dist/tui/capability-notice.d.ts +38 -0
  567. package/dist/tui/capability-notice.d.ts.map +1 -0
  568. package/dist/tui/console-input.d.ts +31 -0
  569. package/dist/tui/console-input.d.ts.map +1 -0
  570. package/dist/tui/conversation-evidence-view.d.ts.map +1 -1
  571. package/dist/tui/credential-entry.d.ts.map +1 -1
  572. package/dist/tui/exit-summary.d.ts +9 -1
  573. package/dist/tui/exit-summary.d.ts.map +1 -1
  574. package/dist/tui/external-editor.d.ts.map +1 -1
  575. package/dist/tui/index.d.ts.map +1 -1
  576. package/dist/tui/key-hints.d.ts +51 -0
  577. package/dist/tui/key-hints.d.ts.map +1 -0
  578. package/dist/tui/launch-settings.d.ts +34 -0
  579. package/dist/tui/launch-settings.d.ts.map +1 -0
  580. package/dist/tui/log-pane.d.ts.map +1 -1
  581. package/dist/tui/model-choices.d.ts +39 -1
  582. package/dist/tui/model-choices.d.ts.map +1 -1
  583. package/dist/tui/model-search.d.ts +4 -1
  584. package/dist/tui/model-search.d.ts.map +1 -1
  585. package/dist/tui/output-size-watch.d.ts +32 -0
  586. package/dist/tui/output-size-watch.d.ts.map +1 -0
  587. package/dist/tui/permission-review.d.ts.map +1 -1
  588. package/dist/tui/person-terms.d.ts +58 -0
  589. package/dist/tui/person-terms.d.ts.map +1 -0
  590. package/dist/tui/plain-failure.d.ts +27 -0
  591. package/dist/tui/plain-failure.d.ts.map +1 -0
  592. package/dist/tui/plain-interruption.d.ts +46 -0
  593. package/dist/tui/plain-interruption.d.ts.map +1 -0
  594. package/dist/tui/provider-list.d.ts.map +1 -1
  595. package/dist/tui/render-mode.d.ts +19 -0
  596. package/dist/tui/render-mode.d.ts.map +1 -0
  597. package/dist/tui/schedule/host-commands.d.ts +2 -9
  598. package/dist/tui/schedule/host-commands.d.ts.map +1 -1
  599. package/dist/tui/schedule/integration.d.ts +8 -0
  600. package/dist/tui/schedule/integration.d.ts.map +1 -1
  601. package/dist/tui/schedule/source-deliveries.d.ts +37 -0
  602. package/dist/tui/schedule/source-deliveries.d.ts.map +1 -0
  603. package/dist/tui/schedule/startup.d.ts.map +1 -1
  604. package/dist/tui/schedule/tool-host.d.ts +3 -1
  605. package/dist/tui/schedule/tool-host.d.ts.map +1 -1
  606. package/dist/tui/setup-text.d.ts +14 -0
  607. package/dist/tui/setup-text.d.ts.map +1 -0
  608. package/dist/tui/shell-escape.d.ts.map +1 -1
  609. package/dist/tui/skills/suggest-setting.d.ts.map +1 -1
  610. package/dist/tui/slashCommands.d.ts +4 -1
  611. package/dist/tui/slashCommands.d.ts.map +1 -1
  612. package/dist/tui/terminal-choice-text.d.ts +7 -0
  613. package/dist/tui/terminal-choice-text.d.ts.map +1 -1
  614. package/dist/tui/tidy-tool-output.d.ts +83 -0
  615. package/dist/tui/tidy-tool-output.d.ts.map +1 -0
  616. package/dist/tui/tool-presentation.d.ts +6 -0
  617. package/dist/tui/tool-presentation.d.ts.map +1 -0
  618. package/dist/tui/transcript-scroll.d.ts +73 -0
  619. package/dist/tui/transcript-scroll.d.ts.map +1 -0
  620. package/dist/tui/triggers/copy.d.ts.map +1 -1
  621. package/dist/tui/triggers/setting.d.ts.map +1 -1
  622. package/dist/tui/turn-interruption.d.ts +1 -1
  623. package/dist/tui/turn-interruption.d.ts.map +1 -1
  624. package/dist/tui/turn-limits-settings.d.ts +4 -4
  625. package/dist/tui/turn-limits-settings.d.ts.map +1 -1
  626. package/dist/tui/types.d.ts +10 -0
  627. package/dist/tui/types.d.ts.map +1 -1
  628. package/dist/tui/web-activity.d.ts +3 -2
  629. package/dist/tui/web-activity.d.ts.map +1 -1
  630. package/dist/tui/zen-free-refusal.d.ts +17 -0
  631. package/dist/tui/zen-free-refusal.d.ts.map +1 -0
  632. package/dist/usage-error.d.ts +15 -0
  633. package/dist/usage-error.d.ts.map +1 -0
  634. package/dist/warning-filter.d.ts +30 -0
  635. package/dist/warning-filter.d.ts.map +1 -0
  636. package/package.json +21 -10
  637. package/skills/schedule-task/SKILL.md +74 -20
  638. package/dist/browser/commands.js +0 -365
  639. package/dist/browser/commands.js.map +0 -1
  640. package/dist/browser/control.js +0 -140
  641. package/dist/browser/control.js.map +0 -1
  642. package/dist/browser/describe.js +0 -27
  643. package/dist/browser/describe.js.map +0 -1
  644. package/dist/checkpoints/store.js +0 -192
  645. package/dist/checkpoints/store.js.map +0 -1
  646. package/dist/checkpoints/wrap.js +0 -37
  647. package/dist/checkpoints/wrap.js.map +0 -1
  648. package/dist/cli.js +0 -602
  649. package/dist/cli.js.map +0 -1
  650. package/dist/commands/acp.js +0 -388
  651. package/dist/commands/acp.js.map +0 -1
  652. package/dist/commands/archive.js +0 -65
  653. package/dist/commands/archive.js.map +0 -1
  654. package/dist/commands/browser.js +0 -16
  655. package/dist/commands/browser.js.map +0 -1
  656. package/dist/commands/doctor.js +0 -267
  657. package/dist/commands/doctor.js.map +0 -1
  658. package/dist/commands/drain.js +0 -498
  659. package/dist/commands/drain.js.map +0 -1
  660. package/dist/commands/eval.js +0 -237
  661. package/dist/commands/eval.js.map +0 -1
  662. package/dist/commands/exec-flags.js +0 -334
  663. package/dist/commands/exec-flags.js.map +0 -1
  664. package/dist/commands/exec-json.js +0 -497
  665. package/dist/commands/exec-json.js.map +0 -1
  666. package/dist/commands/exec.js +0 -688
  667. package/dist/commands/exec.js.map +0 -1
  668. package/dist/commands/host-queries.js +0 -156
  669. package/dist/commands/host-queries.js.map +0 -1
  670. package/dist/commands/login.js +0 -315
  671. package/dist/commands/login.js.map +0 -1
  672. package/dist/commands/mcp-oauth-login.js +0 -213
  673. package/dist/commands/mcp-oauth-login.js.map +0 -1
  674. package/dist/commands/mcp.js +0 -461
  675. package/dist/commands/mcp.js.map +0 -1
  676. package/dist/commands/prior-messages.js +0 -329
  677. package/dist/commands/prior-messages.js.map +0 -1
  678. package/dist/commands/provider-wait.js +0 -65
  679. package/dist/commands/provider-wait.js.map +0 -1
  680. package/dist/commands/registry.js +0 -40
  681. package/dist/commands/registry.js.map +0 -1
  682. package/dist/commands/resident-flags.js +0 -193
  683. package/dist/commands/resident-flags.js.map +0 -1
  684. package/dist/commands/resident-learning.js +0 -293
  685. package/dist/commands/resident-learning.js.map +0 -1
  686. package/dist/commands/resident.js +0 -419
  687. package/dist/commands/resident.js.map +0 -1
  688. package/dist/commands/resume.js +0 -109
  689. package/dist/commands/resume.js.map +0 -1
  690. package/dist/commands/schedule.js +0 -131
  691. package/dist/commands/schedule.js.map +0 -1
  692. package/dist/commands/serve.js +0 -21
  693. package/dist/commands/serve.js.map +0 -1
  694. package/dist/commands/skills.js +0 -178
  695. package/dist/commands/skills.js.map +0 -1
  696. package/dist/commands/state.js +0 -110
  697. package/dist/commands/state.js.map +0 -1
  698. package/dist/commands/stdin.js +0 -69
  699. package/dist/commands/stdin.js.map +0 -1
  700. package/dist/commands/types.js +0 -2
  701. package/dist/commands/types.js.map +0 -1
  702. package/dist/commands/upgrade-progress.js +0 -54
  703. package/dist/commands/upgrade-progress.js.map +0 -1
  704. package/dist/commands/upgrade.js +0 -232
  705. package/dist/commands/upgrade.js.map +0 -1
  706. package/dist/commands/worktree.js +0 -86
  707. package/dist/commands/worktree.js.map +0 -1
  708. package/dist/config/composer-triggers.js +0 -80
  709. package/dist/config/composer-triggers.js.map +0 -1
  710. package/dist/config/debug.js +0 -126
  711. package/dist/config/debug.js.map +0 -1
  712. package/dist/config/load.js +0 -1208
  713. package/dist/config/load.js.map +0 -1
  714. package/dist/config/schema.js +0 -13
  715. package/dist/config/schema.js.map +0 -1
  716. package/dist/config/tool-result-screens.js +0 -104
  717. package/dist/config/tool-result-screens.js.map +0 -1
  718. package/dist/config/trusted-project-context.js +0 -28
  719. package/dist/config/trusted-project-context.js.map +0 -1
  720. package/dist/config/turn-guards.js +0 -46
  721. package/dist/config/turn-guards.js.map +0 -1
  722. package/dist/config/user-config.js +0 -118
  723. package/dist/config/user-config.js.map +0 -1
  724. package/dist/context/capabilities.js +0 -164
  725. package/dist/context/capabilities.js.map +0 -1
  726. package/dist/context/directories.js +0 -69
  727. package/dist/context/directories.js.map +0 -1
  728. package/dist/context/doctrine.js +0 -24
  729. package/dist/context/doctrine.js.map +0 -1
  730. package/dist/context/environment.js +0 -255
  731. package/dist/context/environment.js.map +0 -1
  732. package/dist/context/project-path.js +0 -16
  733. package/dist/context/project-path.js.map +0 -1
  734. package/dist/context/project-tracker.js +0 -217
  735. package/dist/context/project-tracker.js.map +0 -1
  736. package/dist/context/project.js +0 -256
  737. package/dist/context/project.js.map +0 -1
  738. package/dist/context/runtime-message.js +0 -30
  739. package/dist/context/runtime-message.js.map +0 -1
  740. package/dist/context/sandbox.js +0 -114
  741. package/dist/context/sandbox.js.map +0 -1
  742. package/dist/context/turn-snapshot.js +0 -122
  743. package/dist/context/turn-snapshot.js.map +0 -1
  744. package/dist/doctor/checks/browser.js +0 -63
  745. package/dist/doctor/checks/browser.js.map +0 -1
  746. package/dist/doctor/checks/chain.js +0 -211
  747. package/dist/doctor/checks/chain.js.map +0 -1
  748. package/dist/doctor/checks/credentials.js +0 -98
  749. package/dist/doctor/checks/credentials.js.map +0 -1
  750. package/dist/doctor/checks/index.js +0 -72
  751. package/dist/doctor/checks/index.js.map +0 -1
  752. package/dist/doctor/checks/invariants.js +0 -79
  753. package/dist/doctor/checks/invariants.js.map +0 -1
  754. package/dist/doctor/checks/logging.js +0 -69
  755. package/dist/doctor/checks/logging.js.map +0 -1
  756. package/dist/doctor/checks/providers.js +0 -30
  757. package/dist/doctor/checks/providers.js.map +0 -1
  758. package/dist/doctor/checks/runtime.js +0 -40
  759. package/dist/doctor/checks/runtime.js.map +0 -1
  760. package/dist/doctor/checks/sandbox.js +0 -76
  761. package/dist/doctor/checks/sandbox.js.map +0 -1
  762. package/dist/doctor/checks/scheduler.js +0 -74
  763. package/dist/doctor/checks/scheduler.js.map +0 -1
  764. package/dist/doctor/checks/session-export.js +0 -62
  765. package/dist/doctor/checks/session-export.js.map +0 -1
  766. package/dist/doctor/checks/telemetry.js +0 -58
  767. package/dist/doctor/checks/telemetry.js.map +0 -1
  768. package/dist/doctor/checks/vault.js +0 -67
  769. package/dist/doctor/checks/vault.js.map +0 -1
  770. package/dist/doctor/index.js +0 -3
  771. package/dist/doctor/index.js.map +0 -1
  772. package/dist/doctor/registry.js +0 -230
  773. package/dist/doctor/registry.js.map +0 -1
  774. package/dist/exit-codes.js +0 -62
  775. package/dist/exit-codes.js.map +0 -1
  776. package/dist/installation.js +0 -48
  777. package/dist/installation.js.map +0 -1
  778. package/dist/integrations/clipboard/image.js +0 -119
  779. package/dist/integrations/clipboard/image.js.map +0 -1
  780. package/dist/integrations/clipboard/text.js +0 -43
  781. package/dist/integrations/clipboard/text.js.map +0 -1
  782. package/dist/integrations/files/attachment-store.js +0 -86
  783. package/dist/integrations/files/attachment-store.js.map +0 -1
  784. package/dist/integrations/mcp/oauth-store.js +0 -549
  785. package/dist/integrations/mcp/oauth-store.js.map +0 -1
  786. package/dist/integrations/mcp/servers.js +0 -611
  787. package/dist/integrations/mcp/servers.js.map +0 -1
  788. package/dist/integrations/mcp/user-config.js +0 -92
  789. package/dist/integrations/mcp/user-config.js.map +0 -1
  790. package/dist/integrations/notifications/desktop/freedesktop.js +0 -33
  791. package/dist/integrations/notifications/desktop/freedesktop.js.map +0 -1
  792. package/dist/integrations/notifications/desktop/macos.js +0 -17
  793. package/dist/integrations/notifications/desktop/macos.js.map +0 -1
  794. package/dist/integrations/notifications/desktop/sanitize.js +0 -49
  795. package/dist/integrations/notifications/desktop/sanitize.js.map +0 -1
  796. package/dist/integrations/notifications/desktop/throttle.js +0 -39
  797. package/dist/integrations/notifications/desktop/throttle.js.map +0 -1
  798. package/dist/integrations/notifications/desktop/windows-toast.js +0 -56
  799. package/dist/integrations/notifications/desktop/windows-toast.js.map +0 -1
  800. package/dist/integrations/notifications/desktop.js +0 -199
  801. package/dist/integrations/notifications/desktop.js.map +0 -1
  802. package/dist/integrations/notifications/terminal.js +0 -46
  803. package/dist/integrations/notifications/terminal.js.map +0 -1
  804. package/dist/integrations/npm-invocation.js +0 -23
  805. package/dist/integrations/npm-invocation.js.map +0 -1
  806. package/dist/integrations/plugins/runtime.js +0 -189
  807. package/dist/integrations/plugins/runtime.js.map +0 -1
  808. package/dist/integrations/plugins/settings.js +0 -106
  809. package/dist/integrations/plugins/settings.js.map +0 -1
  810. package/dist/integrations/providers/access.js +0 -23
  811. package/dist/integrations/providers/access.js.map +0 -1
  812. package/dist/integrations/providers/chain-capabilities.js +0 -211
  813. package/dist/integrations/providers/chain-capabilities.js.map +0 -1
  814. package/dist/integrations/providers/codex-device-login.js +0 -195
  815. package/dist/integrations/providers/codex-device-login.js.map +0 -1
  816. package/dist/integrations/providers/codex-oauth.js +0 -95
  817. package/dist/integrations/providers/codex-oauth.js.map +0 -1
  818. package/dist/integrations/providers/credential-provider.js +0 -74
  819. package/dist/integrations/providers/credential-provider.js.map +0 -1
  820. package/dist/integrations/providers/credential-store.js +0 -657
  821. package/dist/integrations/providers/credential-store.js.map +0 -1
  822. package/dist/integrations/providers/current-credential.js +0 -45
  823. package/dist/integrations/providers/current-credential.js.map +0 -1
  824. package/dist/integrations/providers/discover.js +0 -313
  825. package/dist/integrations/providers/discover.js.map +0 -1
  826. package/dist/integrations/providers/gemini-credentials.js +0 -148
  827. package/dist/integrations/providers/gemini-credentials.js.map +0 -1
  828. package/dist/integrations/providers/harness-credentials.js +0 -344
  829. package/dist/integrations/providers/harness-credentials.js.map +0 -1
  830. package/dist/integrations/providers/identity.js +0 -64
  831. package/dist/integrations/providers/identity.js.map +0 -1
  832. package/dist/integrations/providers/index.js +0 -14
  833. package/dist/integrations/providers/index.js.map +0 -1
  834. package/dist/integrations/providers/keychain.js +0 -78
  835. package/dist/integrations/providers/keychain.js.map +0 -1
  836. package/dist/integrations/providers/model-reasoning.js +0 -51
  837. package/dist/integrations/providers/model-reasoning.js.map +0 -1
  838. package/dist/integrations/providers/oauth.js +0 -302
  839. package/dist/integrations/providers/oauth.js.map +0 -1
  840. package/dist/integrations/providers/preferences.js +0 -287
  841. package/dist/integrations/providers/preferences.js.map +0 -1
  842. package/dist/integrations/providers/register.js +0 -154
  843. package/dist/integrations/providers/register.js.map +0 -1
  844. package/dist/integrations/providers/registry.js +0 -289
  845. package/dist/integrations/providers/registry.js.map +0 -1
  846. package/dist/integrations/providers/setup.js +0 -158
  847. package/dist/integrations/providers/setup.js.map +0 -1
  848. package/dist/integrations/providers/subscription-login.js +0 -328
  849. package/dist/integrations/providers/subscription-login.js.map +0 -1
  850. package/dist/integrations/providers/zen-catalogue.js +0 -196
  851. package/dist/integrations/providers/zen-catalogue.js.map +0 -1
  852. package/dist/integrations/resident/foreground.js +0 -95
  853. package/dist/integrations/resident/foreground.js.map +0 -1
  854. package/dist/integrations/resident/inspection.js +0 -282
  855. package/dist/integrations/resident/inspection.js.map +0 -1
  856. package/dist/integrations/resident/learning-sources.js +0 -79
  857. package/dist/integrations/resident/learning-sources.js.map +0 -1
  858. package/dist/integrations/resident/learning-storage.js +0 -55
  859. package/dist/integrations/resident/learning-storage.js.map +0 -1
  860. package/dist/integrations/resident/lifecycle-errors.js +0 -15
  861. package/dist/integrations/resident/lifecycle-errors.js.map +0 -1
  862. package/dist/integrations/resident/owned-runner.js +0 -91
  863. package/dist/integrations/resident/owned-runner.js.map +0 -1
  864. package/dist/integrations/resident/runner-control.js +0 -238
  865. package/dist/integrations/resident/runner-control.js.map +0 -1
  866. package/dist/integrations/resident/runner-launch.js +0 -142
  867. package/dist/integrations/resident/runner-launch.js.map +0 -1
  868. package/dist/integrations/resident/runner-store.js +0 -284
  869. package/dist/integrations/resident/runner-store.js.map +0 -1
  870. package/dist/integrations/resident/session-log-reads.js +0 -125
  871. package/dist/integrations/resident/session-log-reads.js.map +0 -1
  872. package/dist/integrations/resident/session-step.js +0 -476
  873. package/dist/integrations/resident/session-step.js.map +0 -1
  874. package/dist/integrations/resident/storage.js +0 -183
  875. package/dist/integrations/resident/storage.js.map +0 -1
  876. package/dist/integrations/resident/tool-evidence.js +0 -123
  877. package/dist/integrations/resident/tool-evidence.js.map +0 -1
  878. package/dist/integrations/resident/verification.js +0 -109
  879. package/dist/integrations/resident/verification.js.map +0 -1
  880. package/dist/integrations/sessions/checkpoint-view.js +0 -48
  881. package/dist/integrations/sessions/checkpoint-view.js.map +0 -1
  882. package/dist/integrations/sessions/context-inventory.js +0 -44
  883. package/dist/integrations/sessions/context-inventory.js.map +0 -1
  884. package/dist/integrations/sessions/conversation-search.js +0 -572
  885. package/dist/integrations/sessions/conversation-search.js.map +0 -1
  886. package/dist/integrations/sessions/display-title.js +0 -5
  887. package/dist/integrations/sessions/display-title.js.map +0 -1
  888. package/dist/integrations/sessions/evidence-page-validation.js +0 -74
  889. package/dist/integrations/sessions/evidence-page-validation.js.map +0 -1
  890. package/dist/integrations/sessions/evidence-recall.js +0 -117
  891. package/dist/integrations/sessions/evidence-recall.js.map +0 -1
  892. package/dist/integrations/sessions/store.js +0 -780
  893. package/dist/integrations/sessions/store.js.map +0 -1
  894. package/dist/integrations/sessions/task-context.js +0 -96
  895. package/dist/integrations/sessions/task-context.js.map +0 -1
  896. package/dist/integrations/sessions/transcript-export.js +0 -342
  897. package/dist/integrations/sessions/transcript-export.js.map +0 -1
  898. package/dist/integrations/state/home.js +0 -17
  899. package/dist/integrations/state/home.js.map +0 -1
  900. package/dist/integrations/state/identity.js +0 -49
  901. package/dist/integrations/state/identity.js.map +0 -1
  902. package/dist/integrations/state/immutable-json.js +0 -38
  903. package/dist/integrations/state/immutable-json.js.map +0 -1
  904. package/dist/integrations/state/private-directory.js +0 -43
  905. package/dist/integrations/state/private-directory.js.map +0 -1
  906. package/dist/integrations/state/project.js +0 -13
  907. package/dist/integrations/state/project.js.map +0 -1
  908. package/dist/integrations/state/report.js +0 -626
  909. package/dist/integrations/state/report.js.map +0 -1
  910. package/dist/integrations/state/retention.js +0 -18
  911. package/dist/integrations/state/retention.js.map +0 -1
  912. package/dist/integrations/subagents/NamzuCliAgent.js +0 -9
  913. package/dist/integrations/subagents/NamzuCliAgent.js.map +0 -1
  914. package/dist/integrations/subagents/activity.js +0 -759
  915. package/dist/integrations/subagents/activity.js.map +0 -1
  916. package/dist/integrations/subagents/batches.js +0 -172
  917. package/dist/integrations/subagents/batches.js.map +0 -1
  918. package/dist/integrations/subagents/definitions.js +0 -26
  919. package/dist/integrations/subagents/definitions.js.map +0 -1
  920. package/dist/integrations/subagents/model-effort.js +0 -12
  921. package/dist/integrations/subagents/model-effort.js.map +0 -1
  922. package/dist/integrations/subagents/parent.js +0 -47
  923. package/dist/integrations/subagents/parent.js.map +0 -1
  924. package/dist/integrations/subagents/policy.js +0 -3
  925. package/dist/integrations/subagents/policy.js.map +0 -1
  926. package/dist/integrations/subagents/replay.js +0 -295
  927. package/dist/integrations/subagents/replay.js.map +0 -1
  928. package/dist/integrations/subagents/runtime.js +0 -1317
  929. package/dist/integrations/subagents/runtime.js.map +0 -1
  930. package/dist/integrations/subagents/saved-agents.js +0 -102
  931. package/dist/integrations/subagents/saved-agents.js.map +0 -1
  932. package/dist/integrations/subagents/slash.js +0 -45
  933. package/dist/integrations/subagents/slash.js.map +0 -1
  934. package/dist/integrations/subagents/worktree-driver.js +0 -72
  935. package/dist/integrations/subagents/worktree-driver.js.map +0 -1
  936. package/dist/integrations/telemetry/session-export.js +0 -119
  937. package/dist/integrations/telemetry/session-export.js.map +0 -1
  938. package/dist/integrations/trust/store.js +0 -73
  939. package/dist/integrations/trust/store.js.map +0 -1
  940. package/dist/integrations/updates.js +0 -115
  941. package/dist/integrations/updates.js.map +0 -1
  942. package/dist/integrations/web/exa-search.js +0 -154
  943. package/dist/integrations/web/exa-search.js.map +0 -1
  944. package/dist/integrations/web/open-url.js +0 -73
  945. package/dist/integrations/web/open-url.js.map +0 -1
  946. package/dist/integrations/web/search.js +0 -68
  947. package/dist/integrations/web/search.js.map +0 -1
  948. package/dist/integrations/worktrees/managed.js +0 -231
  949. package/dist/integrations/worktrees/managed.js.map +0 -1
  950. package/dist/logging.js +0 -115
  951. package/dist/logging.js.map +0 -1
  952. package/dist/memory/io.js +0 -177
  953. package/dist/memory/io.js.map +0 -1
  954. package/dist/memory/presentation.js +0 -76
  955. package/dist/memory/presentation.js.map +0 -1
  956. package/dist/memory/store.js +0 -180
  957. package/dist/memory/store.js.map +0 -1
  958. package/dist/memory/typed.js +0 -336
  959. package/dist/memory/typed.js.map +0 -1
  960. package/dist/output/formatter.js +0 -16
  961. package/dist/output/formatter.js.map +0 -1
  962. package/dist/output/index.js +0 -22
  963. package/dist/output/index.js.map +0 -1
  964. package/dist/output/json.js +0 -51
  965. package/dist/output/json.js.map +0 -1
  966. package/dist/output/text.js +0 -50
  967. package/dist/output/text.js.map +0 -1
  968. package/dist/output/yaml.js +0 -26
  969. package/dist/output/yaml.js.map +0 -1
  970. package/dist/output-schema.js +0 -18
  971. package/dist/output-schema.js.map +0 -1
  972. package/dist/permissions/browser-sites.js +0 -270
  973. package/dist/permissions/browser-sites.js.map +0 -1
  974. package/dist/permissions/canonical-project.js +0 -13
  975. package/dist/permissions/canonical-project.js.map +0 -1
  976. package/dist/permissions/checks.js +0 -128
  977. package/dist/permissions/checks.js.map +0 -1
  978. package/dist/permissions/headless-trust.js +0 -86
  979. package/dist/permissions/headless-trust.js.map +0 -1
  980. package/dist/permissions/live-mode.js +0 -62
  981. package/dist/permissions/live-mode.js.map +0 -1
  982. package/dist/permissions/mode.js +0 -65
  983. package/dist/permissions/mode.js.map +0 -1
  984. package/dist/permissions/rules.js +0 -358
  985. package/dist/permissions/rules.js.map +0 -1
  986. package/dist/release-notes.js +0 -64
  987. package/dist/release-notes.js.map +0 -1
  988. package/dist/resume-invocation.js +0 -24
  989. package/dist/resume-invocation.js.map +0 -1
  990. package/dist/schedule/build.js +0 -374
  991. package/dist/schedule/build.js.map +0 -1
  992. package/dist/schedule/changes.js +0 -78
  993. package/dist/schedule/changes.js.map +0 -1
  994. package/dist/schedule/commands/add.js +0 -603
  995. package/dist/schedule/commands/add.js.map +0 -1
  996. package/dist/schedule/commands/args.js +0 -80
  997. package/dist/schedule/commands/args.js.map +0 -1
  998. package/dist/schedule/commands/confirm-prompt.js +0 -21
  999. package/dist/schedule/commands/confirm-prompt.js.map +0 -1
  1000. package/dist/schedule/commands/lifecycle.js +0 -586
  1001. package/dist/schedule/commands/lifecycle.js.map +0 -1
  1002. package/dist/schedule/commands/list.js +0 -260
  1003. package/dist/schedule/commands/list.js.map +0 -1
  1004. package/dist/schedule/commands/logs.js +0 -106
  1005. package/dist/schedule/commands/logs.js.map +0 -1
  1006. package/dist/schedule/commands/service.js +0 -458
  1007. package/dist/schedule/commands/service.js.map +0 -1
  1008. package/dist/schedule/daemon/daemon.js +0 -1265
  1009. package/dist/schedule/daemon/daemon.js.map +0 -1
  1010. package/dist/schedule/daemon/endpoint.js +0 -158
  1011. package/dist/schedule/daemon/endpoint.js.map +0 -1
  1012. package/dist/schedule/daemon/exit.js +0 -8
  1013. package/dist/schedule/daemon/exit.js.map +0 -1
  1014. package/dist/schedule/daemon/log.js +0 -53
  1015. package/dist/schedule/daemon/log.js.map +0 -1
  1016. package/dist/schedule/daemon/notify.js +0 -158
  1017. package/dist/schedule/daemon/notify.js.map +0 -1
  1018. package/dist/schedule/daemon/retention.js +0 -46
  1019. package/dist/schedule/daemon/retention.js.map +0 -1
  1020. package/dist/schedule/daemon/sessions.js +0 -52
  1021. package/dist/schedule/daemon/sessions.js.map +0 -1
  1022. package/dist/schedule/env.js +0 -106
  1023. package/dist/schedule/env.js.map +0 -1
  1024. package/dist/schedule/fire/browser-preflight.js +0 -73
  1025. package/dist/schedule/fire/browser-preflight.js.map +0 -1
  1026. package/dist/schedule/fire/calls.js +0 -114
  1027. package/dist/schedule/fire/calls.js.map +0 -1
  1028. package/dist/schedule/fire/fire.js +0 -681
  1029. package/dist/schedule/fire/fire.js.map +0 -1
  1030. package/dist/schedule/fire/result.js +0 -19
  1031. package/dist/schedule/fire/result.js.map +0 -1
  1032. package/dist/schedule/fire/run-script.js +0 -81
  1033. package/dist/schedule/fire/run-script.js.map +0 -1
  1034. package/dist/schedule/fire/unattended-note.js +0 -51
  1035. package/dist/schedule/fire/unattended-note.js.map +0 -1
  1036. package/dist/schedule/fire/wake-gate.js +0 -90
  1037. package/dist/schedule/fire/wake-gate.js.map +0 -1
  1038. package/dist/schedule/floor.js +0 -1561
  1039. package/dist/schedule/floor.js.map +0 -1
  1040. package/dist/schedule/folder.js +0 -84
  1041. package/dist/schedule/folder.js.map +0 -1
  1042. package/dist/schedule/paths.js +0 -53
  1043. package/dist/schedule/paths.js.map +0 -1
  1044. package/dist/schedule/policy.js +0 -414
  1045. package/dist/schedule/policy.js.map +0 -1
  1046. package/dist/schedule/resume-command.js +0 -72
  1047. package/dist/schedule/resume-command.js.map +0 -1
  1048. package/dist/schedule/script-check.js +0 -146
  1049. package/dist/schedule/script-check.js.map +0 -1
  1050. package/dist/schedule/script-shell.js +0 -5
  1051. package/dist/schedule/script-shell.js.map +0 -1
  1052. package/dist/schedule/service/detect.js +0 -29
  1053. package/dist/schedule/service/detect.js.map +0 -1
  1054. package/dist/schedule/service/index.js +0 -361
  1055. package/dist/schedule/service/index.js.map +0 -1
  1056. package/dist/schedule/service/launchd.js +0 -84
  1057. package/dist/schedule/service/launchd.js.map +0 -1
  1058. package/dist/schedule/service/manifest.js +0 -16
  1059. package/dist/schedule/service/manifest.js.map +0 -1
  1060. package/dist/schedule/service/names.js +0 -22
  1061. package/dist/schedule/service/names.js.map +0 -1
  1062. package/dist/schedule/service/quote.js +0 -64
  1063. package/dist/schedule/service/quote.js.map +0 -1
  1064. package/dist/schedule/service/runner.js +0 -31
  1065. package/dist/schedule/service/runner.js.map +0 -1
  1066. package/dist/schedule/service/systemd.js +0 -96
  1067. package/dist/schedule/service/systemd.js.map +0 -1
  1068. package/dist/schedule/service/windows-task.js +0 -199
  1069. package/dist/schedule/service/windows-task.js.map +0 -1
  1070. package/dist/schedule/service/wsl.js +0 -121
  1071. package/dist/schedule/service/wsl.js.map +0 -1
  1072. package/dist/schedule/store/atomic.js +0 -138
  1073. package/dist/schedule/store/atomic.js.map +0 -1
  1074. package/dist/schedule/store/claims.js +0 -57
  1075. package/dist/schedule/store/claims.js.map +0 -1
  1076. package/dist/schedule/store/digest.js +0 -139
  1077. package/dist/schedule/store/digest.js.map +0 -1
  1078. package/dist/schedule/store/history.js +0 -117
  1079. package/dist/schedule/store/history.js.map +0 -1
  1080. package/dist/schedule/store/jobs.js +0 -277
  1081. package/dist/schedule/store/jobs.js.map +0 -1
  1082. package/dist/schedule/store/state.js +0 -38
  1083. package/dist/schedule/store/state.js.map +0 -1
  1084. package/dist/schedule/types.js +0 -33
  1085. package/dist/schedule/types.js.map +0 -1
  1086. package/dist/schedule/visible-source.js +0 -59
  1087. package/dist/schedule/visible-source.js.map +0 -1
  1088. package/dist/skills/audit.js +0 -75
  1089. package/dist/skills/audit.js.map +0 -1
  1090. package/dist/skills/catalog.js +0 -226
  1091. package/dist/skills/catalog.js.map +0 -1
  1092. package/dist/skills/directory.js +0 -51
  1093. package/dist/skills/directory.js.map +0 -1
  1094. package/dist/skills/save.js +0 -344
  1095. package/dist/skills/save.js.map +0 -1
  1096. package/dist/skills/store.js +0 -351
  1097. package/dist/skills/store.js.map +0 -1
  1098. package/dist/termination.js +0 -143
  1099. package/dist/termination.js.map +0 -1
  1100. package/dist/test-support/toolset.js +0 -27
  1101. package/dist/test-support/toolset.js.map +0 -1
  1102. package/dist/tui/AgentExplorer.js +0 -789
  1103. package/dist/tui/AgentExplorer.js.map +0 -1
  1104. package/dist/tui/App.js +0 -8499
  1105. package/dist/tui/App.js.map +0 -1
  1106. package/dist/tui/BackgroundJobsPanel.js +0 -129
  1107. package/dist/tui/BackgroundJobsPanel.js.map +0 -1
  1108. package/dist/tui/BrandHeader.js +0 -14
  1109. package/dist/tui/BrandHeader.js.map +0 -1
  1110. package/dist/tui/Checklist.js +0 -90
  1111. package/dist/tui/Checklist.js.map +0 -1
  1112. package/dist/tui/ChoicePicker.js +0 -64
  1113. package/dist/tui/ChoicePicker.js.map +0 -1
  1114. package/dist/tui/Composer.js +0 -939
  1115. package/dist/tui/Composer.js.map +0 -1
  1116. package/dist/tui/ComposerFrame.js +0 -79
  1117. package/dist/tui/ComposerFrame.js.map +0 -1
  1118. package/dist/tui/CopyPicker.js +0 -19
  1119. package/dist/tui/CopyPicker.js.map +0 -1
  1120. package/dist/tui/EditPromptPicker.js +0 -17
  1121. package/dist/tui/EditPromptPicker.js.map +0 -1
  1122. package/dist/tui/EffortSlider.js +0 -134
  1123. package/dist/tui/EffortSlider.js.map +0 -1
  1124. package/dist/tui/LiveActivity.js +0 -89
  1125. package/dist/tui/LiveActivity.js.map +0 -1
  1126. package/dist/tui/Markdown.js +0 -137
  1127. package/dist/tui/Markdown.js.map +0 -1
  1128. package/dist/tui/PendingInputPanel.js +0 -108
  1129. package/dist/tui/PendingInputPanel.js.map +0 -1
  1130. package/dist/tui/PermissionOverlay.js +0 -278
  1131. package/dist/tui/PermissionOverlay.js.map +0 -1
  1132. package/dist/tui/Picker.js +0 -1310
  1133. package/dist/tui/Picker.js.map +0 -1
  1134. package/dist/tui/ProviderSetup.js +0 -125
  1135. package/dist/tui/ProviderSetup.js.map +0 -1
  1136. package/dist/tui/ResumePicker.js +0 -34
  1137. package/dist/tui/ResumePicker.js.map +0 -1
  1138. package/dist/tui/SaveSkillOverlay.js +0 -118
  1139. package/dist/tui/SaveSkillOverlay.js.map +0 -1
  1140. package/dist/tui/ScheduleReviewOverlay.js +0 -166
  1141. package/dist/tui/ScheduleReviewOverlay.js.map +0 -1
  1142. package/dist/tui/StatusBar.js +0 -182
  1143. package/dist/tui/StatusBar.js.map +0 -1
  1144. package/dist/tui/StatusPanel.js +0 -11
  1145. package/dist/tui/StatusPanel.js.map +0 -1
  1146. package/dist/tui/TaskList.js +0 -43
  1147. package/dist/tui/TaskList.js.map +0 -1
  1148. package/dist/tui/TextPrompt.js +0 -185
  1149. package/dist/tui/TextPrompt.js.map +0 -1
  1150. package/dist/tui/ToolOutputViewer.js +0 -39
  1151. package/dist/tui/ToolOutputViewer.js.map +0 -1
  1152. package/dist/tui/Transcript.js +0 -235
  1153. package/dist/tui/Transcript.js.map +0 -1
  1154. package/dist/tui/TrustPrompt.js +0 -13
  1155. package/dist/tui/TrustPrompt.js.map +0 -1
  1156. package/dist/tui/ViewportBound.js +0 -55
  1157. package/dist/tui/ViewportBound.js.map +0 -1
  1158. package/dist/tui/agent-transcript-rows.js +0 -115
  1159. package/dist/tui/agent-transcript-rows.js.map +0 -1
  1160. package/dist/tui/agent.js +0 -4301
  1161. package/dist/tui/agent.js.map +0 -1
  1162. package/dist/tui/browser-notices.js +0 -107
  1163. package/dist/tui/browser-notices.js.map +0 -1
  1164. package/dist/tui/choice-selection.js +0 -38
  1165. package/dist/tui/choice-selection.js.map +0 -1
  1166. package/dist/tui/compact-transcript.js +0 -46
  1167. package/dist/tui/compact-transcript.js.map +0 -1
  1168. package/dist/tui/consent-timing.js +0 -48
  1169. package/dist/tui/consent-timing.js.map +0 -1
  1170. package/dist/tui/conversation-evidence-view.js +0 -96
  1171. package/dist/tui/conversation-evidence-view.js.map +0 -1
  1172. package/dist/tui/conversation-history.js +0 -33
  1173. package/dist/tui/conversation-history.js.map +0 -1
  1174. package/dist/tui/copy-targets.js +0 -189
  1175. package/dist/tui/copy-targets.js.map +0 -1
  1176. package/dist/tui/credential-entry.js +0 -134
  1177. package/dist/tui/credential-entry.js.map +0 -1
  1178. package/dist/tui/edit-prompts.js +0 -35
  1179. package/dist/tui/edit-prompts.js.map +0 -1
  1180. package/dist/tui/exit-summary.js +0 -30
  1181. package/dist/tui/exit-summary.js.map +0 -1
  1182. package/dist/tui/external-editor.js +0 -169
  1183. package/dist/tui/external-editor.js.map +0 -1
  1184. package/dist/tui/hypermode.js +0 -58
  1185. package/dist/tui/hypermode.js.map +0 -1
  1186. package/dist/tui/index.js +0 -81
  1187. package/dist/tui/index.js.map +0 -1
  1188. package/dist/tui/live-window.js +0 -281
  1189. package/dist/tui/live-window.js.map +0 -1
  1190. package/dist/tui/log-pane.js +0 -100
  1191. package/dist/tui/log-pane.js.map +0 -1
  1192. package/dist/tui/login-prompt.js +0 -105
  1193. package/dist/tui/login-prompt.js.map +0 -1
  1194. package/dist/tui/logo.js +0 -9
  1195. package/dist/tui/logo.js.map +0 -1
  1196. package/dist/tui/markdown-block-cache.js +0 -76
  1197. package/dist/tui/markdown-block-cache.js.map +0 -1
  1198. package/dist/tui/markdown-table.js +0 -175
  1199. package/dist/tui/markdown-table.js.map +0 -1
  1200. package/dist/tui/markdown-wrap.js +0 -189
  1201. package/dist/tui/markdown-wrap.js.map +0 -1
  1202. package/dist/tui/markdownParser.js +0 -237
  1203. package/dist/tui/markdownParser.js.map +0 -1
  1204. package/dist/tui/mentions.js +0 -150
  1205. package/dist/tui/mentions.js.map +0 -1
  1206. package/dist/tui/model-catalogue-view.js +0 -75
  1207. package/dist/tui/model-catalogue-view.js.map +0 -1
  1208. package/dist/tui/model-choices.js +0 -157
  1209. package/dist/tui/model-choices.js.map +0 -1
  1210. package/dist/tui/model-search.js +0 -28
  1211. package/dist/tui/model-search.js.map +0 -1
  1212. package/dist/tui/model-selection-intent.js +0 -96
  1213. package/dist/tui/model-selection-intent.js.map +0 -1
  1214. package/dist/tui/model-switch-tool.js +0 -74
  1215. package/dist/tui/model-switch-tool.js.map +0 -1
  1216. package/dist/tui/model-switch.js +0 -106
  1217. package/dist/tui/model-switch.js.map +0 -1
  1218. package/dist/tui/notices.js +0 -27
  1219. package/dist/tui/notices.js.map +0 -1
  1220. package/dist/tui/open-browser.js +0 -147
  1221. package/dist/tui/open-browser.js.map +0 -1
  1222. package/dist/tui/permission-review.js +0 -858
  1223. package/dist/tui/permission-review.js.map +0 -1
  1224. package/dist/tui/plugin-view.js +0 -59
  1225. package/dist/tui/plugin-view.js.map +0 -1
  1226. package/dist/tui/provider-list.js +0 -327
  1227. package/dist/tui/provider-list.js.map +0 -1
  1228. package/dist/tui/provider-selection.js +0 -16
  1229. package/dist/tui/provider-selection.js.map +0 -1
  1230. package/dist/tui/schedule/host-commands.js +0 -428
  1231. package/dist/tui/schedule/host-commands.js.map +0 -1
  1232. package/dist/tui/schedule/integration.js +0 -150
  1233. package/dist/tui/schedule/integration.js.map +0 -1
  1234. package/dist/tui/schedule/loop-host.js +0 -153
  1235. package/dist/tui/schedule/loop-host.js.map +0 -1
  1236. package/dist/tui/schedule/resume.js +0 -333
  1237. package/dist/tui/schedule/resume.js.map +0 -1
  1238. package/dist/tui/schedule/startup.js +0 -121
  1239. package/dist/tui/schedule/startup.js.map +0 -1
  1240. package/dist/tui/schedule/tool-host.js +0 -619
  1241. package/dist/tui/schedule/tool-host.js.map +0 -1
  1242. package/dist/tui/selection-window.js +0 -37
  1243. package/dist/tui/selection-window.js.map +0 -1
  1244. package/dist/tui/shell-escape.js +0 -110
  1245. package/dist/tui/shell-escape.js.map +0 -1
  1246. package/dist/tui/skills/learning.js +0 -131
  1247. package/dist/tui/skills/learning.js.map +0 -1
  1248. package/dist/tui/skills/suggest-setting.js +0 -55
  1249. package/dist/tui/skills/suggest-setting.js.map +0 -1
  1250. package/dist/tui/skills/suggestion-ledger.js +0 -52
  1251. package/dist/tui/skills/suggestion-ledger.js.map +0 -1
  1252. package/dist/tui/slashCommands.js +0 -1588
  1253. package/dist/tui/slashCommands.js.map +0 -1
  1254. package/dist/tui/status-card.js +0 -30
  1255. package/dist/tui/status-card.js.map +0 -1
  1256. package/dist/tui/status-panel-layout.js +0 -42
  1257. package/dist/tui/status-panel-layout.js.map +0 -1
  1258. package/dist/tui/stream-blocks.js +0 -187
  1259. package/dist/tui/stream-blocks.js.map +0 -1
  1260. package/dist/tui/task-activity.js +0 -157
  1261. package/dist/tui/task-activity.js.map +0 -1
  1262. package/dist/tui/terminal-choice-text.js +0 -118
  1263. package/dist/tui/terminal-choice-text.js.map +0 -1
  1264. package/dist/tui/terminal-display.js +0 -65
  1265. package/dist/tui/terminal-display.js.map +0 -1
  1266. package/dist/tui/terminal-hyperlinks.js +0 -70
  1267. package/dist/tui/terminal-hyperlinks.js.map +0 -1
  1268. package/dist/tui/theme.js +0 -34
  1269. package/dist/tui/theme.js.map +0 -1
  1270. package/dist/tui/triggers/analyze.js +0 -221
  1271. package/dist/tui/triggers/analyze.js.map +0 -1
  1272. package/dist/tui/triggers/context-text.js +0 -44
  1273. package/dist/tui/triggers/context-text.js.map +0 -1
  1274. package/dist/tui/triggers/copy.js +0 -163
  1275. package/dist/tui/triggers/copy.js.map +0 -1
  1276. package/dist/tui/triggers/detect.js +0 -295
  1277. package/dist/tui/triggers/detect.js.map +0 -1
  1278. package/dist/tui/triggers/fold.js +0 -44
  1279. package/dist/tui/triggers/fold.js.map +0 -1
  1280. package/dist/tui/triggers/pattern.js +0 -243
  1281. package/dist/tui/triggers/pattern.js.map +0 -1
  1282. package/dist/tui/triggers/provenance.js +0 -98
  1283. package/dist/tui/triggers/provenance.js.map +0 -1
  1284. package/dist/tui/triggers/registry.js +0 -164
  1285. package/dist/tui/triggers/registry.js.map +0 -1
  1286. package/dist/tui/triggers/setting.js +0 -61
  1287. package/dist/tui/triggers/setting.js.map +0 -1
  1288. package/dist/tui/triggers/verbs.js +0 -140
  1289. package/dist/tui/triggers/verbs.js.map +0 -1
  1290. package/dist/tui/turn-interruption.js +0 -160
  1291. package/dist/tui/turn-interruption.js.map +0 -1
  1292. package/dist/tui/turn-limits-settings.js +0 -88
  1293. package/dist/tui/turn-limits-settings.js.map +0 -1
  1294. package/dist/tui/types.js +0 -7
  1295. package/dist/tui/types.js.map +0 -1
  1296. package/dist/tui/units.js +0 -20
  1297. package/dist/tui/units.js.map +0 -1
  1298. package/dist/tui/use-selection-index.js +0 -13
  1299. package/dist/tui/use-selection-index.js.map +0 -1
  1300. package/dist/tui/web-activity.js +0 -105
  1301. package/dist/tui/web-activity.js.map +0 -1
  1302. package/dist/tui/workspace-diff.js +0 -101
  1303. package/dist/tui/workspace-diff.js.map +0 -1
  1304. package/dist/tui/workspace-review.js +0 -67
  1305. package/dist/tui/workspace-review.js.map +0 -1
  1306. package/dist/user-commands/store.js +0 -235
  1307. package/dist/user-commands/store.js.map +0 -1
  1308. package/dist/version.js +0 -23
  1309. package/dist/version.js.map +0 -1
@@ -1,1561 +0,0 @@
1
- /**
2
- * The scheduled-run floor: what no scheduled run may do, whatever its rules
3
- * say.
4
- *
5
- * A scheduled run must not reach its own scheduler — stop, disable or remove
6
- * the service, or run a `namzu schedule` subcommand that changes something —
7
- * and must not name `NAMZU_HOME`, where its job, its history, the daemon's
8
- * endpoint token and the credentials beside them live, nor the Windows
9
- * browser's profile folder (`%LOCALAPPDATA%\namzu`), where namzu keeps the
10
- * profiles it drives from WSL with the cookies of every site the operator
11
- * signed in to.
12
- *
13
- * ## Why this is code and not patterns
14
- *
15
- * The floor used to be regular expressions over the command line's text.
16
- * A pattern about what a line RUNS has to re-implement the shell's quoting to
17
- * see through `'sched'ule`, `$'\x73'chedule`, `sche\<newline>dule` and
18
- * `namzu --add-dir ';' schedule stop`, and each review round found another
19
- * form it missed, plus a pattern that backtracked quadratically. The SDK
20
- * reads a command line once, with the lexer the gate itself uses
21
- * (`lexShellCommandLine`, checked against real bash), and this module decides
22
- * on what that lexer reports: the words bash will pass to each simple
23
- * command, after quote removal and `$'…'` decoding, the payload of a nested
24
- * `bash -c`, every redirection target, and the words of `for` lists and
25
- * `case` statements. Quoting is the lexer's business; this file never
26
- * mentions a quote character except in the tripwire below.
27
- *
28
- * ## What is decided, and how
29
- *
30
- * - **Scheduler commands**, on each simple command's words in order,
31
- * anywhere in the command, so `sudo`, `env`, `nohup` or `timeout` in front
32
- * changes nothing: `systemctl` + a stopping verb + a unit naming namzu (or
33
- * a glob), `launchctl` + a removing verb + a namzu label, `schtasks` with a
34
- * `/delete`, `/change` or `/end` switch and a namzu task in any order,
35
- * `pkill`/`killall` with a pattern that could match the daemon,
36
- * `busctl`/`dbus-send`/`gdbus` naming namzu, and the CLI (`namzu` or a path
37
- * to it, `@namzu/cli`, a `bin.js`, or a JavaScript runtime) with `schedule`
38
- * followed by anything but a read-only verb. A word that expands at
39
- * runtime (`$V`) stands for any word in any of those places; one whose only
40
- * expansion is locale quoting (`$"stop"`) is read as its text.
41
- * - **NAMZU_HOME**, on every word, redirection target, `for` list and `case`
42
- * word: `~` (where bash expands it), `$HOME`, `${HOME}`, `$NAMZU_HOME` and
43
- * `$PWD` are expanded here from known values, as are variables the line
44
- * itself assigns; `..` and `.` are resolved; a relative path is resolved
45
- * against the job's folder and every directory a `cd` before it names.
46
- * Where a word still holds an unknown expansion or a glob, it is denied
47
- * when the known part before it could lead into NAMZU_HOME (`~/.nam*`,
48
- * `~/$X`, `/$X`), or the text after it names NAMZU_HOME's last segment. An
49
- * assignment standing alone reaches no program and is judged where the
50
- * variable is used; one that is exported is judged where it stands.
51
- * - **What the lexer cannot account for** — an opaque line (a command
52
- * substitution, `eval`-like constructs, a syntax error, a construct it does
53
- * not model), a command whose name expands, or a program that runs text as
54
- * code (`sh` reading its input, `sudo bash -c`, `powershell`, `python`,
55
- * `xargs`, `watch` …) — is denied when the line's text holds something that
56
- * could reach what the floor protects (see {@link Floor.tripwire}): a
57
- * `schedule` subcommand that changes something with the CLI or an
58
- * expansion in reach, the scheduler service's name, a service tool with a
59
- * namzu name, a process killer, `NAMZU_HOME` by name or path, or the
60
- * Windows browser's profile folder. That is the tripwire, deliberately
61
- * textual and cheap. The product's name on its own is not in that list: a
62
- * message box saying "Namzu: scheduled job running" reaches nothing, and a
63
- * run that showed one was refused for it. Text such a program may run — an
64
- * argument, a here-string, a here-document's body — is also read as a
65
- * command line of its own, so an escape only the inner shell undoes does
66
- * not hide it.
67
-
68
- * - **The Windows browser's profiles**, on the same words, spellings and
69
- * directories: a path whose segments run `AppData/Local/namzu` (any user,
70
- * any drive, `/mnt/c/Users/<you>/…` or `C:\Users\<you>\…`, either slash,
71
- * any letter case), with `%LOCALAPPDATA%`, `$env:LOCALAPPDATA` and
72
- * `$LOCALAPPDATA` spelled out. The user folder above it is not known here,
73
- * so the three segments are what is matched. Where a word holds an unknown
74
- * expansion or a glob, it is denied when its segments could still read
75
- * `AppData/Local/namzu` and one of them is spelled out, or when an unknown
76
- * expansion is followed by a `namzu` segment.
77
-
78
- * Every other tool's arguments are strings, not shell: each is searched for
79
- * NAMZU_HOME and the browser's profiles by path, in any letter case, with
80
- * `~`, `$HOME`, `$NAMZU_HOME` and `%LOCALAPPDATA%` spelled out, and once more
81
- * with shell quotes and backslashes dropped, in case the tool hands it to a
82
- * shell.
83
- *
84
- * Everything here is linear in the input.
85
- */
86
- import { builtinCommandArguments, commandArgumentOf, lexShellCommandLine, nestedShellCommand, programPositions, } from '@namzu/sdk';
87
- /** Scheduler verbs a run may use: they read, they change nothing. */
88
- export const READ_ONLY_VERBS = ['list', 'show', 'status', 'history', 'logs'];
89
- /** The floor's reason for denying a call, or null: what the rule below decides on. */
90
- export function scheduledRunFloorVerdict(options) {
91
- const floor = new Floor(options);
92
- return (call) => floor.find(call)?.reason ?? null;
93
- }
94
- /** The floor's finding for a call, or null: the reason and what matched. */
95
- export function scheduledRunFloorFinding(options) {
96
- const floor = new Floor(options);
97
- return (call) => floor.find(call);
98
- }
99
- /** What a refusal says: the rule that matched, and that another wording will not help. */
100
- export function floorRefusal(finding) {
101
- return `the scheduled-run floor refused this call: ${finding.detail}. It holds for every scheduled run, so rewording the call will not help`;
102
- }
103
- /**
104
- * Rules this module made, which decide `deny` or nothing: a rule here never
105
- * lets a call through, so a tool it covers may still be withheld from a run.
106
- */
107
- const DENY_ONLY = new WeakSet();
108
- /** Whether `rule` is the floor's, and so can only deny. */
109
- export function isFloorRule(rule) {
110
- return DENY_ONLY.has(rule);
111
- }
112
- /** The floor as one gate rule. */
113
- export function scheduledRunFloorRule(options) {
114
- const floor = new Floor(options);
115
- const rule = {
116
- type: 'predicate',
117
- description: `the scheduled-run floor: a scheduled run may not stop, disable or remove the scheduler, run a \`namzu schedule\` subcommand other than ${READ_ONLY_VERBS.join(', ')}, or name NAMZU_HOME (${options.namzuHome}) or the Windows browser's profile folder (%LOCALAPPDATA%\\namzu) in any argument. It holds for every scheduled run, so rewording the call will not help`,
118
- decide: (call) => (floor.find(call) === null ? null : 'deny'),
119
- // Asked only after `decide` denied, so the reading is done twice for a
120
- // refused call and once for every other.
121
- describe: (call) => {
122
- const finding = floor.find(call);
123
- return finding ? floorRefusal(finding) : null;
124
- },
125
- };
126
- DENY_ONLY.add(rule);
127
- return rule;
128
- }
129
- // ---------------------------------------------------------------------------
130
- // Words
131
- const SYSTEMCTL_VERBS_WITH_UNIT = new Set([
132
- 'stop',
133
- 'disable',
134
- 'mask',
135
- 'edit',
136
- 'kill',
137
- 'revert',
138
- 'freeze',
139
- 'set-property',
140
- 'clean',
141
- ]);
142
- /** Verbs that stop units without naming them. */
143
- const SYSTEMCTL_VERBS_ALONE = new Set(['isolate', 'exit']);
144
- const LAUNCHCTL_VERBS = new Set(['bootout', 'unload', 'remove', 'disable', 'kill', 'stop']);
145
- const SCHTASKS_SWITCH = /^[/-](?:delete|change|end)$/;
146
- const DBUS_TOOLS = new Set(['busctl', 'dbus-send', 'gdbus']);
147
- /** Runtimes the CLI can be started through without its name in the line. */
148
- const JS_RUNTIMES = new Set([
149
- 'node',
150
- 'nodejs',
151
- 'npx',
152
- 'pnpx',
153
- 'bunx',
154
- 'bun',
155
- 'deno',
156
- 'tsx',
157
- 'ts-node',
158
- 'npm',
159
- 'pnpm',
160
- 'yarn',
161
- ]);
162
- const CLI_ENTRY = /^bin(?:\.[cm]?js)?$/;
163
- /** Shells: a payload the lexer did not follow (stdin, a script, `sudo bash -c`) is text it never read. */
164
- const SHELLS = new Set([
165
- 'sh',
166
- 'bash',
167
- 'dash',
168
- 'zsh',
169
- 'ksh',
170
- 'ash',
171
- 'mksh',
172
- 'busybox',
173
- 'fish',
174
- 'csh',
175
- 'tcsh',
176
- 'pwsh',
177
- 'powershell',
178
- 'cmd',
179
- 'wsl',
180
- ]);
181
- /** Programs that run a string, a file or their input as code or as a command. */
182
- const INTERPRETERS = /^(?:python[0-9.]*|pypy[0-9.]*|node|nodejs|deno|bun|perl[0-9.]*|ruby|php[0-9.]*|lua[0-9.]*|luajit|osascript|awk|gawk|mawk|nawk|sed|gsed|tclsh|wish|expect|eval|source|xargs|parallel|watch|su|runuser|ssh|script|flock|at|batch|crontab)$/;
183
- /** Options that make `sudo` or `env` run a string rather than an argv. */
184
- const STRING_OPTIONS = {
185
- sudo: /^-(?:[a-z]*[si][a-z]*|-shell|-login)$/,
186
- env: /^-(?:[a-z]*s[a-z]*|-split-string(?:=.*)?)$/i,
187
- };
188
- /** PowerShell's two names, wherever the floor treats them as an unread shell. */
189
- const POWERSHELL_NAMES = new Set(['powershell', 'pwsh']);
190
- /**
191
- * `-EncodedCommand` and every unambiguous prefix PowerShell itself accepts
192
- * (`-e`, `-en`, `-enc`, …, up to the full name), case-insensitive. Unlike
193
- * `-Command`/`-c`, whose literal text the tripwire can still read, the
194
- * argument here is base64 of UTF-16LE: nothing in it can be read as text, so
195
- * a line the tripwire finds nothing in front of proves nothing about what it
196
- * runs.
197
- */
198
- const ENCODED_COMMAND_FLAG = /^-e(?:n(?:c(?:o(?:d(?:e(?:d(?:c(?:o(?:m(?:m(?:a(?:n(?:d)?)?)?)?)?)?)?)?)?)?)?)?)?$/i;
199
- /** What a refusal says about a `schedule` verb that is not read-only. */
200
- const NOT_READ_ONLY = `a \`namzu schedule\` subcommand other than ${READ_ONLY_VERBS.join(', ')}`;
201
- const NAME_CHAR = /[a-z0-9._-]/;
202
- function lower(text) {
203
- return text.toLowerCase();
204
- }
205
- /** The last path segment, lower-cased, with `.exe` dropped. */
206
- function commandName(value) {
207
- const cut = Math.max(value.lastIndexOf('/'), value.lastIndexOf('\\'));
208
- const base = lower(cut < 0 ? value : value.slice(cut + 1));
209
- return base.endsWith('.exe') ? base.slice(0, -4) : base;
210
- }
211
- /** Text as a refusal quotes it: on one line, cut to `max` characters, in backticks. */
212
- function shown(text, max = 80) {
213
- const flat = text.replace(/\s*\n\s*/g, ' ⏎ ');
214
- const cut = [...flat].length > max ? `${[...flat].slice(0, max - 1).join('')}…` : flat;
215
- return cut.includes('`') ? `\`\` ${cut} \`\`` : `\`${cut}\``;
216
- }
217
- /**
218
- * `$"…"` read as its text. The lexer leaves locale quoting as written and
219
- * flags the word, because a translation catalogue could change it; the text
220
- * itself is what a C locale passes.
221
- */
222
- function unlocale(value) {
223
- return value.includes('$"')
224
- ? value.replace(/\$"((?:[^"\\]|\\.)*)"/g, (_, inner) => inner.replace(/\\([$`"\\\n])/g, '$1'))
225
- : value;
226
- }
227
- /**
228
- * A word whose only expansion is locale quoting, read as its C-locale text,
229
- * unless the line can choose a translation catalogue (`TEXTDOMAIN`,
230
- * `TEXTDOMAINDIR`), which could turn `$"status"` into anything.
231
- */
232
- function localeOnly(value, catalogue) {
233
- return !catalogue && value.includes('$"') && !/[$`*?[{~]/.test(unlocale(value));
234
- }
235
- function wordsOf(command, catalogue) {
236
- return command.words.map((w) => {
237
- const text = w.expands ? unlocale(w.value) : w.value;
238
- return { text: lower(text), wild: w.expands && !localeOnly(w.value, catalogue) };
239
- });
240
- }
241
- // ---------------------------------------------------------------------------
242
- // Scheduler commands
243
- /**
244
- * Whether one command's words, in order, reach the scheduler, and if so what
245
- * they do, in words. Each role is taken at its first place after the one
246
- * before; for a question of "is there such a subsequence" that loses
247
- * nothing, and it is one pass.
248
- */
249
- function reachesScheduler(command, words, daemonCommandLine, dialect) {
250
- const n = words.length;
251
- const find = (from, test) => {
252
- for (let i = from; i < n; i++)
253
- if (test(words[i], i))
254
- return i;
255
- return -1;
256
- };
257
- // Where a program name could stand: `programPositions` — the SDK's one
258
- // answer to "where does this command actually exec a program" — unwraps
259
- // a chain of re-exec wrappers (`sudo`, `env`, `nice`, `timeout`, …) with
260
- // each one's own real option grammar, rather than assuming the program
261
- // sits right after the wrapper's name (`timeout 5 prog`, `stdbuf -oL
262
- // prog` and `ionice -c2 -n7 prog` all take at least one word of their
263
- // own first). `words`/`command.words` share indices, so a resolved
264
- // position's word maps straight back to one. A position `programPositions`
265
- // could not resolve because that word ITSELF expands (`sudo
266
- // $(echo systemctl) stop x`) still carries the word, so it becomes a
267
- // head here too — same as before, just correctly placed after however
268
- // many wrapper words came first. A literal `source`/`.` with a literal
269
- // path, or a literal `eval` whose literal payload lexes cleanly, is read
270
- // the same way and adds its own resolved position(s) here too. A
271
- // position it could not resolve for a structural reason with no wild
272
- // word of its own (an option a wrapper does not recognise, too many
273
- // wrappers, an opaque `eval` payload) carries no word and adds nothing
274
- // here; that gap is not this fix's scope — an interpreter or unread
275
- // construct is the tripwire's and `runsUnreadText`'s job, not this one's.
276
- const heads = new Set();
277
- for (const position of programPositions(command, dialect)) {
278
- if (position.word === undefined)
279
- continue;
280
- const idx = command.words.indexOf(position.word);
281
- if (idx >= 0)
282
- heads.add(idx);
283
- }
284
- // A wild (expanding) word in one of those positions cannot be read as
285
- // NOT being the tool in question — a substring check on its raw,
286
- // unevaluated text (`$(echo pk)ill`) is defeated by gluing a literal
287
- // suffix onto the substitution, which never contains the tool's name as
288
- // one contiguous run. Unknown never passes: such a word counts as being
289
- // every name checked here, the same way `namesNamzu`/a verb check
290
- // already treats a wild argument. A wild word elsewhere (an argument, a
291
- // path — `find ~/.namzu -exec …`'s `~/.namzu`) is not a program name and
292
- // is read as what it actually is, an argument, by the checks below.
293
- const named = (name) => (w, i) => (w.wild && heads.has(i)) || commandName(w.text) === name;
294
- const namesNamzu = (w) => w.wild || w.text.includes('namzu');
295
- // systemctl <verb> <unit>
296
- const systemctl = find(0, named('systemctl'));
297
- if (systemctl >= 0) {
298
- if (find(systemctl + 1, (w) => !w.wild && SYSTEMCTL_VERBS_ALONE.has(w.text)) >= 0)
299
- return 'stops every service, the scheduler with them';
300
- const verb = find(systemctl + 1, (w) => w.wild || SYSTEMCTL_VERBS_WITH_UNIT.has(w.text));
301
- // systemctl matches unit names against a glob.
302
- if (verb >= 0 && find(verb + 1, (u) => namesNamzu(u) || /[*?[]/.test(u.text)) >= 0)
303
- return "stops or disables the scheduler's service";
304
- }
305
- // launchctl <verb> <label or plist>
306
- const launchctl = find(0, named('launchctl'));
307
- if (launchctl >= 0) {
308
- const verb = find(launchctl + 1, (w) => w.wild || LAUNCHCTL_VERBS.has(w.text));
309
- if (verb >= 0 && find(verb + 1, namesNamzu) >= 0)
310
- return "removes the scheduler's launchd agent";
311
- }
312
- // schtasks, whose switches come in any order.
313
- const schtasks = find(0, named('schtasks'));
314
- if (schtasks >= 0) {
315
- const rest = words.slice(schtasks + 1);
316
- if (rest.some((w) => w.wild || SCHTASKS_SWITCH.test(w.text)) && rest.some(namesNamzu))
317
- return "deletes, changes or ends the scheduler's task";
318
- }
319
- // pkill / killall: a pattern that could match the daemon's process.
320
- const killer = find(0, (w, i) => named('pkill')(w, i) || named('killall')(w, i));
321
- if (killer >= 0) {
322
- const kills = "has a pattern that could match the scheduler's process";
323
- const full = words
324
- .slice(killer + 1)
325
- .some((w) => /^-[a-z]*f/.test(w.text) || w.text === '--full');
326
- for (let i = killer + 1; i < n; i++) {
327
- const w = words[i];
328
- if (w.wild)
329
- return kills;
330
- if (w.text.startsWith('-'))
331
- continue;
332
- if (/[.*+?^$|()[\]{}\\]/.test(w.text))
333
- return kills;
334
- if (w.text.includes('namzu') || w.text.includes('schedul'))
335
- return kills;
336
- if ('node'.includes(w.text) || (full && daemonCommandLine.includes(w.text)))
337
- return kills;
338
- }
339
- }
340
- // A D-Bus call to systemd naming the unit.
341
- const dbus = find(0, (w, i) => (w.wild && heads.has(i)) || DBUS_TOOLS.has(commandName(w.text)));
342
- if (dbus >= 0 && find(dbus + 1, namesNamzu) >= 0)
343
- return 'calls systemd about a namzu unit';
344
- // The CLI, by name (`namzu`, a path to it, `npx @namzu/cli`) or through
345
- // its entry script or a JavaScript runtime: `schedule` and then anything
346
- // but a read-only verb.
347
- const strong = find(0, (w) => commandName(w.text) === 'namzu' || w.text.includes('@namzu/cli'));
348
- const weak = find(0, (w) => CLI_ENTRY.test(commandName(w.text)) || JS_RUNTIMES.has(commandName(w.text)));
349
- // After the CLI's own name, a word that expands may be `schedule stop`.
350
- if (strong >= 0 && find(strong + 1, (w) => w.wild) >= 0)
351
- return 'passes the CLI a word that expands at runtime, which could be a `schedule` subcommand';
352
- const cli = strong < 0 ? weak : weak < 0 ? strong : Math.min(strong, weak);
353
- if (cli >= 0) {
354
- for (let i = cli + 1; i < n; i++) {
355
- if (words[i].text !== 'schedule' || words[i].wild)
356
- continue;
357
- const verb = words[i + 1];
358
- if (verb === undefined)
359
- continue;
360
- if (verb.wild)
361
- return 'runs a `schedule` subcommand that expands at runtime';
362
- if (!READ_ONLY_VERBS.includes(verb.text))
363
- return `runs \`schedule ${verb.text}\`, ${NOT_READ_ONLY}`;
364
- }
365
- }
366
- return null;
367
- }
368
- /**
369
- * Whether a command runs text the lexer did not read as commands — a shell
370
- * the lexer did not follow, an interpreter, `xargs`, `sudo -s`, `env -S` —
371
- * and if so which, in words.
372
- */
373
- function runsUnreadText(command) {
374
- const words = command.words;
375
- const head = command.assignments;
376
- const names = words.map((w) => (w.expands ? '' : commandName(w.value)));
377
- // The shell at the head whose `-c` payload the lexer read, and `busybox`
378
- // in front of it: exactly the lexer's own decision. Any other shell —
379
- // `powershell -c`, `fish -c`, `bash.exe -c`, one given a script — runs
380
- // text the lexer never read, whatever its options look like.
381
- const nested = nestedShellCommand(words.slice(head));
382
- const readTo = nested !== null && 'payload' in nested
383
- ? head + (commandName(words[head].value) === 'busybox' ? 1 : 0)
384
- : -1;
385
- for (let i = 0; i < words.length; i++) {
386
- const name = names[i];
387
- if (name === '')
388
- continue;
389
- const program = shown(words[i].value);
390
- if (INTERPRETERS.test(name))
391
- return `${program} runs text as code`;
392
- if (i === head && name === '.')
393
- return '`.` runs a file as commands';
394
- if (i === head && name === 'trap') {
395
- // `trap [-lp] [action] [sigspec...]`: the action, when given, runs as
396
- // a command line when the signal fires — read the same way a nested
397
- // shell's `-c` payload is, just later. `-l`/`-p`/`--` alone print or
398
- // reset and run nothing.
399
- const action = words
400
- .slice(i + 1)
401
- .find((w) => w.expands || (w.value !== '-l' && w.value !== '-p' && w.value !== '--'));
402
- if (action !== undefined)
403
- return `${program} runs its action as a command when the signal fires`;
404
- }
405
- if (SHELLS.has(name) && !(i >= head && i <= readTo))
406
- return `${program} runs commands the floor does not read`;
407
- }
408
- for (const [program, option] of Object.entries(STRING_OPTIONS)) {
409
- const flag = words.find((w) => !w.expands && option.test(w.value));
410
- if (names.includes(program) && flag !== undefined)
411
- return `\`${program} ${flag.value}\` runs a string as commands`;
412
- }
413
- return null;
414
- }
415
- /**
416
- * `powershell`/`pwsh`, anywhere in the command, given `-EncodedCommand` (or
417
- * an unambiguous prefix of it): the program word and the flag, or null.
418
- */
419
- function encodedCommandCall(command) {
420
- const words = command.words;
421
- for (let i = command.assignments; i < words.length; i++) {
422
- const word = words[i];
423
- if (word.expands || !POWERSHELL_NAMES.has(commandName(word.value)))
424
- continue;
425
- const flag = words.slice(i + 1).find((w) => !w.expands && ENCODED_COMMAND_FLAG.test(w.value));
426
- if (flag !== undefined)
427
- return { program: word, flag };
428
- }
429
- return null;
430
- }
431
- // ---------------------------------------------------------------------------
432
- // Paths
433
- /**
434
- * `text` with `\` read as `/`, empty and `.` segments dropped and `..`
435
- * applied, the way the kernel resolves a path (symbolic links aside). Applied
436
- * to any text, not only a path: a segment that is not a path's is kept.
437
- */
438
- function normalize(text) {
439
- const out = [];
440
- const parts = text.replace(/\\/g, '/').split('/');
441
- for (let i = 0; i < parts.length; i++) {
442
- const part = parts[i];
443
- if (part === '' && i > 0)
444
- continue;
445
- if (part === '.')
446
- continue;
447
- if (part === '..') {
448
- const last = out.at(-1);
449
- if (last === '')
450
- continue; // at the root
451
- if (last !== undefined && last !== '..') {
452
- out.pop();
453
- continue;
454
- }
455
- }
456
- out.push(part);
457
- }
458
- if (out.length === 1 && out[0] === '')
459
- return '/';
460
- return out.join('/');
461
- }
462
- function isAbsolute(path) {
463
- return path.startsWith('/') || path.startsWith('\\') || /^[a-z]:[\\/]/.test(path);
464
- }
465
- function join(dir, rel) {
466
- return normalize(`${dir}/${rel}`);
467
- }
468
- /** Linear-time search for `home` in normalized `text`, as a whole path. */
469
- function containsPath(text, home) {
470
- let at = text.indexOf(home);
471
- while (at >= 0) {
472
- const before = at === 0 ? '' : text[at - 1];
473
- const after = text[at + home.length] ?? '';
474
- if (!NAME_CHAR.test(before) && !NAME_CHAR.test(after))
475
- return true;
476
- at = text.indexOf(home, at + 1);
477
- }
478
- return false;
479
- }
480
- /** No directory known: a relative path is checked against none. */
481
- const NOWHERE = { dirs: [], unknown: true };
482
- const UNKNOWN = { values: [], unknown: true };
483
- /** How many ways a word may be spelled out before the floor stops trying and denies. */
484
- const MAX_ALTERNATIVES = 64;
485
- class TooMany extends Error {
486
- }
487
- // ---------------------------------------------------------------------------
488
- // The Windows browser's profiles
489
- /**
490
- * The segments that end the path of the Windows browser's profile root,
491
- * `%LOCALAPPDATA%\namzu`. The user folder above them is not known here (a
492
- * run may name any user's), so these are what a path is matched on.
493
- */
494
- const PROFILE_SEGMENTS = ['appdata', 'local', 'namzu'];
495
- const PROFILE_TAIL = PROFILE_SEGMENTS.join('/');
496
- /** What `%LOCALAPPDATA%` and `$LOCALAPPDATA` stand for in the checks below. */
497
- const LOCAL_APP_DATA = 'c:/users/%username%/appdata/local';
498
- /**
499
- * Lower-cased `text` with `%LOCALAPPDATA%`, `$env:LOCALAPPDATA`,
500
- * `${env:LOCALAPPDATA}`, `$LOCALAPPDATA` and `${LOCALAPPDATA}` spelled out.
501
- */
502
- function spellLocalAppData(text) {
503
- return text.includes('localappdata')
504
- ? text.replace(/%localappdata%|\$\{?(?:env:)?localappdata(?![a-z0-9_])\}?/g, LOCAL_APP_DATA)
505
- : text;
506
- }
507
- /** Whether normalized, lower-cased text names the profile root or a path in it. */
508
- function namesProfile(text) {
509
- return containsPath(text, PROFILE_TAIL);
510
- }
511
- /** Characters that stand for text the floor does not know: a glob or an expansion. */
512
- const WILD = /[*?[$`{]/;
513
- const WILD_RUN = /\$\{[^}]*\}?|\$[a-z0-9_]*|`[^`]*`?|\[[^\]]*\]?|[*?{}]/;
514
- /** Whether one path segment with wildcards in it could be `name`: its literal pieces, in order. */
515
- function mayBe(segment, name) {
516
- if (!WILD.test(segment))
517
- return segment === name;
518
- const pieces = segment.split(WILD_RUN);
519
- const first = pieces[0];
520
- const last = pieces.at(-1);
521
- if (!name.startsWith(first) || !name.endsWith(last))
522
- return false;
523
- let at = first.length;
524
- for (const piece of pieces.slice(1, -1)) {
525
- const found = name.indexOf(piece, at);
526
- if (found < 0)
527
- return false;
528
- at = found + piece.length;
529
- }
530
- return at <= name.length - last.length;
531
- }
532
- /**
533
- * Whether a normalized path with wildcards in it could run through
534
- * `appdata/local/namzu`. Three segments of nothing but wildcards are not
535
- * enough: `ls` of three globbed levels in a project is not a way into a Windows profile.
536
- */
537
- function mayNameProfile(text) {
538
- const segments = text.split('/');
539
- for (let i = 0; i + PROFILE_SEGMENTS.length <= segments.length; i++) {
540
- const run = segments.slice(i, i + PROFILE_SEGMENTS.length);
541
- if (!run.every((segment, k) => mayBe(segment, PROFILE_SEGMENTS[k])))
542
- continue;
543
- if (run.some((segment) => segment.split(WILD_RUN).some((piece) => piece !== '')))
544
- return true;
545
- }
546
- return false;
547
- }
548
- /**
549
- * Whether a path stops short inside the profile root's last name
550
- * (`…/AppData/Local/nam`), to be finished by an expansion elsewhere.
551
- */
552
- function endsShortOfProfile(path) {
553
- const segments = path.split('/');
554
- const n = segments.length;
555
- const last = segments[n - 1];
556
- return (n >= 3 &&
557
- segments[n - 3] === 'appdata' &&
558
- segments[n - 2] === 'local' &&
559
- last !== '' &&
560
- last !== 'namzu' &&
561
- 'namzu'.startsWith(last));
562
- }
563
- /** `schedule` as a command word: not a path segment, not a longer word (`scheduled`). */
564
- const SCHEDULE_WORD = /(?:^|[\s,;([{|&=])schedule(?=$|[\s,;)\]}|&])/g;
565
- /** The CLI, the runtimes it can be started through, or its entry script, as a word. */
566
- const CLI_IN_TEXT = /namzu|bin\.[cm]?js|(?:^|[^a-z0-9_-])(?:node|nodejs|npx|pnpx|bunx|bun|deno|tsx|ts-node|npm|pnpm|yarn)(?![a-z0-9_-])/;
567
- /** An expansion that could hold the CLI's name or path: `$X`, a backtick, `%X%`. */
568
- const EXPANSION_IN_TEXT = /[$`]|%[a-z_][a-z0-9_]*%/;
569
- /** The scheduler service's names: the unit and task (`namzu-scheduler…`), the launchd label. */
570
- const SERVICE_NAME_IN_TEXT = /namzu-scheduler[a-z0-9._-]*|com\.namzu\.[a-z0-9._-]*/;
571
- /** Tools that stop, change or remove a service or a scheduled task. */
572
- const SERVICE_TOOL_IN_TEXT = /(?:^|[^a-z0-9_-])(systemctl|launchctl|schtasks|busctl|dbus-send|gdbus|(?:stop|disable|unregister|set)-scheduledtask|schedule\.service)(?![a-z0-9_-])/;
573
- /** `pkill` and `killall` match a process by pattern, and the scheduler is a `node` process. */
574
- const PROCESS_KILLER_IN_TEXT = /(?:^|[^a-z0-9_-])(pkill|killall)(?![a-z0-9_-])/;
575
- /** `NAMZU_HOME` by name, in any shell's or language's spelling of a variable. */
576
- const HOME_VARIABLE_IN_TEXT = /(?:^|[^a-z0-9_])namzu_home(?![a-z0-9_])/;
577
- /** The Windows profile root's parent, spelled as a variable or a known-folder name. */
578
- const LOCAL_APP_DATA_IN_TEXT = /localappdata|localapplicationdata|(?:^|[^a-z0-9])appdata(?![a-z0-9])/;
579
- /** `namzu` as a path segment or a string of its own. */
580
- const NAMZU_SEGMENT = /(?:^|[^a-z0-9_.-])namzu(?![a-z0-9_.-])/;
581
- function escapeRegExp(text) {
582
- return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
583
- }
584
- /** A `schedule` subcommand that is not read-only, in one text, or null. */
585
- function scheduleSubcommand(text) {
586
- for (const match of text.matchAll(SCHEDULE_WORD)) {
587
- const after = text.slice((match.index ?? 0) + match[0].length);
588
- const verb = /^[\s,]*([a-z0-9][a-z0-9_-]*)/.exec(after)?.[1];
589
- if (verb !== undefined && READ_ONLY_VERBS.includes(verb))
590
- continue;
591
- return verb === undefined ? 'schedule' : `schedule ${verb}`;
592
- }
593
- return null;
594
- }
595
- class Floor {
596
- home;
597
- /** NAMZU_HOME as the operator wrote it, for a refusal. */
598
- homeShown;
599
- homeCore;
600
- /** NAMZU_HOME's last segment, and the default's (`.namzu`), as path segments in text. */
601
- homeSegments;
602
- userHome;
603
- folders;
604
- daemonCommandLine;
605
- builtinCommands;
606
- constructor(options) {
607
- this.home = normalize(lower(options.namzuHome));
608
- this.homeShown = options.namzuHome;
609
- this.userHome = normalize(lower(options.userHome));
610
- this.folders = (options.folders ?? []).map((f) => normalize(lower(f)));
611
- const last = this.home.split('/').at(-1) ?? '';
612
- this.homeCore = last.replace(/^\.+/, '');
613
- // A dotted name (`.namzu`) is a path segment wherever it stands; an
614
- // undotted one only after a slash, or the product's name would be one.
615
- this.homeSegments = [...new Set(['.namzu', last])]
616
- .filter((name) => name.replace(/^\.+/, '').length >= 3)
617
- .map((name) => ({
618
- name,
619
- pattern: name.startsWith('.')
620
- ? new RegExp(`(?:^|[^a-z0-9_.-])${escapeRegExp(name)}(?![a-z0-9_.-])`)
621
- : new RegExp(`[/\\\\]${escapeRegExp(name)}(?![a-z0-9_.-])`),
622
- }));
623
- this.builtinCommands = builtinCommandArguments();
624
- this.daemonCommandLine = lower(options.daemonCommandLine ?? `${process.execPath} ${process.argv[1] ?? ''} schedule daemon`);
625
- }
626
- /** What the floor protects, as a refusal names it. */
627
- protectedWords(what) {
628
- return what === 'NAMZU_HOME'
629
- ? `NAMZU_HOME (${this.homeShown})`
630
- : "the Windows browser's profile folder (%LOCALAPPDATA%\\namzu)";
631
- }
632
- /** Why the floor denies the call and what matched, or null when it does not. */
633
- find(call) {
634
- const argument = call.toolDef
635
- ? commandArgumentOf(call.toolDef)
636
- : this.builtinCommands.get(call.toolName);
637
- const input = call.toolInput;
638
- let line;
639
- if (argument !== undefined && typeof input === 'object' && input !== null) {
640
- const value = input[argument];
641
- if (typeof value === 'string')
642
- line = value;
643
- }
644
- try {
645
- const named = this.stringsName(input, line);
646
- if (named !== null)
647
- return {
648
- reason: `names ${named.what}`,
649
- detail: `${named.where} names ${this.protectedWords(named.what)}`,
650
- };
651
- if (line !== undefined)
652
- return this.lineVerdict(line, call.commandDialect);
653
- return null;
654
- }
655
- catch (error) {
656
- if (error instanceof TooMany)
657
- return {
658
- reason: 'too many spellings',
659
- detail: `a word in the command can be spelled more than ${MAX_ALTERNATIVES} ways once its variables are filled in, and the floor refuses rather than try them all`,
660
- };
661
- throw error;
662
- }
663
- }
664
- // ---- any tool -----------------------------------------------------------
665
- /** Every string in the input but the command line, searched as text. */
666
- stringsName(input, line) {
667
- const stack = [
668
- { value: input, at: '' },
669
- ];
670
- let skipped = false;
671
- while (stack.length > 0) {
672
- const { value, at, key } = stack.pop();
673
- if (typeof value === 'string') {
674
- if (!skipped && value === line) {
675
- skipped = true;
676
- continue;
677
- }
678
- const where = key
679
- ? `the argument name ${shown(value)}`
680
- : at === ''
681
- ? 'the input'
682
- : `the \`${at}\` argument`;
683
- if (this.textNamesHome(value))
684
- return { what: 'NAMZU_HOME', where };
685
- if (textNamesProfile(value))
686
- return { what: 'the browser profiles', where };
687
- }
688
- else if (Array.isArray(value)) {
689
- value.forEach((each, i) => stack.push({ value: each, at: `${at}[${i}]` }));
690
- }
691
- else if (value !== null && typeof value === 'object') {
692
- for (const [name, each] of Object.entries(value)) {
693
- const path = at === '' ? name : `${at}.${name}`;
694
- stack.push({ value: name, at: path, key: true }, { value: each, at: path });
695
- }
696
- }
697
- }
698
- return null;
699
- }
700
- /**
701
- * NAMZU_HOME in free text: as a path, through `~`, `$HOME`, `${HOME}` or
702
- * `$NAMZU_HOME`, in any letter case; and again with quotes and
703
- * backslashes dropped, as a shell would drop them.
704
- */
705
- textNamesHome(text) {
706
- const plain = lower(text);
707
- const unquoted = plain
708
- .replace(/\\\n/g, '')
709
- .replace(/\$(?=["'])/g, '')
710
- .replace(/["'\\]/g, '');
711
- for (const variant of [plain, unquoted]) {
712
- if (/\$\{?[!#]?namzu_home(?![a-z0-9_])/.test(variant))
713
- return true;
714
- const spelled = variant
715
- .replace(/\$\{home\}|\$home(?![a-z0-9_])/g, this.userHome)
716
- .replace(/(^|[\s"'=:(<>|;&,`])~[a-z0-9._-]*(?=[/\\]|$|[\s"'])/g, `$1${this.userHome}`);
717
- if (containsPath(normalize(spelled), this.home))
718
- return true;
719
- }
720
- return false;
721
- }
722
- // ---- a command line -----------------------------------------------------
723
- lineVerdict(line, dialect, depth = 0) {
724
- // A line for a shell that may be bash or a POSIX shell is read both
725
- // ways, and denied if either reading denies it.
726
- const dialects = dialect === 'bash' ? ['bash'] : ['sh', 'bash'];
727
- const readings = dialects.map((d) => lexShellCommandLine(line, { dialect: d }));
728
- const catalogue = /textdomain/i.test(line);
729
- const loops = /\b(?:while|until|for|select)\b/.test(line);
730
- let unaccounted = null;
731
- for (let i = 0; i < readings.length; i += 1) {
732
- const reading = readings[i];
733
- const finding = this.readingVerdict(reading, catalogue, loops, dialects[i]);
734
- if (finding !== null)
735
- return finding;
736
- if (reading.opaque) {
737
- unaccounted ??= {
738
- reason: 'opaque line mentions a protected name',
739
- why: `the floor cannot read the line (${reading.reasons[0] ?? 'a construct it does not model'})`,
740
- };
741
- continue;
742
- }
743
- for (const command of reading.commands) {
744
- const unread = unreadCommand(command);
745
- if (unread === null)
746
- continue;
747
- unaccounted ??= { reason: 'unread text mentions a protected name', why: unread };
748
- break;
749
- }
750
- }
751
- if (unaccounted === null)
752
- return null;
753
- const trip = this.tripwire(line, readings);
754
- if (trip !== null)
755
- return {
756
- reason: unaccounted.reason,
757
- detail: `${unaccounted.why}, and it holds ${shown(trip.token)} (${trip.what})${whereIn(readings, trip.pattern ?? trip.token)}`,
758
- };
759
- // Text a program may run as a command line — an argument (`echo '…' |
760
- // sh`, `sudo bash -c '…'`), a here-string, a here-document's body —
761
- // is read as one, decoded, so what the tripwire looks for cannot hide
762
- // behind escapes that only the inner shell undoes.
763
- if (depth < MAX_TEXT_DEPTH)
764
- for (const text of fedTexts(readings)) {
765
- const inner = this.lineVerdict(text, 'bash', depth + 1);
766
- if (inner !== null)
767
- return {
768
- reason: unaccounted.reason,
769
- detail: `${unaccounted.why}, and read as a command line, ${shown(text)}: ${inner.detail}`,
770
- };
771
- }
772
- return null;
773
- }
774
- /**
775
- * The tripwire, for a line the lexer could not account for: something in
776
- * its text that can reach what the floor protects, or null. Read in the
777
- * line as written, with quotes and expansion marks dropped (and once more
778
- * with backslashes dropped too), and in every word the lexer decoded:
779
- *
780
- * - `NAMZU_HOME` by name (`$NAMZU_HOME`, `%NAMZU_HOME%`,
781
- * `os.environ['NAMZU_HOME']`), its last segment as a path segment
782
- * (`.namzu`, always), or a path into it;
783
- * - the Windows browser's profile folder, as a path, or `LOCALAPPDATA` (or
784
- * `AppData`) with `namzu` as a segment or a string of its own;
785
- * - the scheduler service's name (`namzu-scheduler…`, `com.namzu.…`);
786
- * - a service tool (`systemctl`, `launchctl`, `schtasks`, the D-Bus tools,
787
- * PowerShell's `*-ScheduledTask`) with `namzu` or a glob in the text,
788
- * `systemctl isolate` or `exit`; `pkill` or `killall` anywhere, because
789
- * a pattern can match the scheduler's `node` process without naming it;
790
- * - `schedule` as a command word followed by anything but a read-only
791
- * verb, when the text also names the CLI (`namzu`, `@namzu/cli`,
792
- * `bin.js`, a JavaScript runtime) or holds an expansion that could.
793
- *
794
- * Nothing else: the product's name in a string (`MessageBox::Show('Namzu:
795
- * scheduled job running')`) reaches none of them.
796
- */
797
- tripwire(line, readings) {
798
- const plain = lower(line).replace(/\\\n/g, '');
799
- const unquoted = plain.replace(/["'$`]/g, '');
800
- const squashed = unquoted.replace(/\\/g, '');
801
- const decoded = readings
802
- .flatMap((r) => r.commands.flatMap((c) => c.words.map((w) => lower(w.value))))
803
- .join(' ');
804
- const texts = [squashed, unquoted, decoded];
805
- const first = (pattern) => {
806
- for (const text of texts) {
807
- const match = pattern.exec(text);
808
- if (match)
809
- return match[1] ?? match[0].replace(/^[^a-z0-9%.]+/, '');
810
- }
811
- return null;
812
- };
813
- // NAMZU_HOME.
814
- if (HOME_VARIABLE_IN_TEXT.test(plain) || first(HOME_VARIABLE_IN_TEXT) !== null)
815
- return { token: 'NAMZU_HOME', what: 'the NAMZU_HOME variable' };
816
- for (const { name, pattern } of this.homeSegments)
817
- if (texts.some((text) => pattern.test(text)))
818
- return { token: name, what: "NAMZU_HOME's folder name", pattern };
819
- if (this.textNamesHome(line) || this.textNamesHome(decoded))
820
- return { token: this.homeShown, what: 'a path into NAMZU_HOME' };
821
- // The Windows browser's profiles.
822
- if (textNamesProfile(line) || textNamesProfile(decoded))
823
- return {
824
- token: '%LOCALAPPDATA%\\namzu',
825
- what: "a path into the Windows browser's profile folder",
826
- };
827
- const appData = first(LOCAL_APP_DATA_IN_TEXT);
828
- if (appData !== null && texts.some((text) => NAMZU_SEGMENT.test(text)))
829
- return {
830
- token: `${appData} … namzu`,
831
- what: "together, the Windows browser's profile folder",
832
- };
833
- // The service.
834
- const service = first(SERVICE_NAME_IN_TEXT);
835
- if (service !== null)
836
- return { token: service, what: "the scheduler service's name" };
837
- const tool = first(SERVICE_TOOL_IN_TEXT);
838
- if (tool !== null) {
839
- if (texts.some((text) => text.includes('namzu')))
840
- return { token: `${tool} … namzu`, what: 'a service tool with a namzu name' };
841
- if (plain.includes('*'))
842
- return { token: `${tool} … *`, what: 'a service tool with a pattern that can match it' };
843
- if (tool === 'systemctl') {
844
- const all = first(/(?:^|\s)(isolate|exit)(?![a-z0-9_-])/);
845
- if (all !== null)
846
- return { token: `systemctl ${all}`, what: 'which stops every service' };
847
- }
848
- }
849
- const killer = first(PROCESS_KILLER_IN_TEXT);
850
- if (killer !== null)
851
- return {
852
- token: killer,
853
- what: 'which kills by pattern, and the scheduler is a node process a pattern can match',
854
- };
855
- // The CLI's `schedule` subcommands.
856
- // `$'…'` and `$"…"` are quotes, not expansions.
857
- const cli = texts.some((text) => CLI_IN_TEXT.test(text)) ||
858
- EXPANSION_IN_TEXT.test(plain.replace(/\$(?=['"])/g, ''));
859
- if (cli)
860
- for (const text of [squashed, decoded]) {
861
- const subcommand = scheduleSubcommand(text);
862
- if (subcommand !== null)
863
- return { token: subcommand, what: NOT_READ_ONLY };
864
- }
865
- return null;
866
- }
867
- readingVerdict(reading, catalogue, loops, dialect) {
868
- for (const command of reading.commands) {
869
- const encoded = encodedCommandCall(command);
870
- if (encoded !== null)
871
- return {
872
- reason: 'encoded command cannot be read at all',
873
- detail: `${shown(encoded.program.value)} ${shown(encoded.flag.value)} runs a base64-encoded script the floor cannot read at all, so it is refused outright whatever it decodes to; use -Command '<literal text>' instead`,
874
- };
875
- }
876
- for (const command of reading.commands) {
877
- const does = reachesScheduler(command, wordsOf(command, catalogue), this.daemonCommandLine, dialect);
878
- if (does !== null)
879
- return {
880
- reason: 'scheduler command',
881
- detail: `${shown(command.words.map((w) => w.text).join(' '))} ${does}`,
882
- };
883
- }
884
- const variables = this.assignments(reading);
885
- const expanding = (w) => w.expands && !localeOnly(w.value, catalogue);
886
- const expands = reading.commands.some((c) => c.words.some(expanding)) ||
887
- reading.redirections.some((r) => expanding(r.target)) ||
888
- reading.compoundWords.some(expanding);
889
- // An assignment on its own reaches no program, and every use of the
890
- // variable is spelled out with its value. One that is exported, or
891
- // could be, is checked where it stands.
892
- const exported = reading.commands.some((c) => c.words.some((w) => !w.expands && EXPORTING.has(commandName(w.value))));
893
- const names = (what) => `names ${this.protectedWords(what)}`;
894
- const cwd = new Directories(this.folders);
895
- // In a loop, a `cd` late in the body applies to the next pass's first
896
- // command: every command gets every directory the line can reach.
897
- if (loops)
898
- for (const command of reading.commands)
899
- cwd.after(command, (target) => this.spell(target, variables, cwd.current()), this.userHome);
900
- const seen = new Set();
901
- /** Files an earlier command in this line wrote, resolved and normalized; content unverifiable. */
902
- const written = new Set();
903
- for (const command of reading.commands) {
904
- const here = cwd.current();
905
- const findExec = this.findExecFinding(command, variables, here, dialect);
906
- if (findExec !== null)
907
- return findExec;
908
- const executed = executedPath(command);
909
- if (executed !== null && !executed.expands) {
910
- for (const base of isAbsolute(executed.value) ? [''] : here.dirs) {
911
- const path = base === '' ? normalize(executed.value) : join(base, executed.value);
912
- if (written.has(path)) {
913
- return {
914
- reason: 'runs a file the script wrote earlier',
915
- detail: `${shown(command.text)} runs ${shown(executed.text)}, which an earlier command in this script wrote; its content cannot be verified, so it is refused rather than run unattended`,
916
- };
917
- }
918
- }
919
- }
920
- for (const target of writeTargets(command)) {
921
- if (target.expands)
922
- continue;
923
- for (const base of isAbsolute(target.value) ? [''] : here.dirs) {
924
- written.add(base === '' ? normalize(target.value) : join(base, target.value));
925
- }
926
- }
927
- const check = (word) => this.wordNames(word, variables, here, expands);
928
- const standalone = command.words.length === command.assignments && !exported;
929
- for (const [i, word] of command.words.entries()) {
930
- if (standalone && i < command.assignments)
931
- continue;
932
- const named = check(word);
933
- if (named !== null)
934
- return {
935
- reason: `word names ${named}`,
936
- detail: `the argument ${shown(word.text)} ${names(named)}`,
937
- };
938
- // `X=~/.namzu` as an argument, or exported: the value on its own.
939
- const assigned = assignedValue(word);
940
- const value = assigned ? check(assigned.word) : null;
941
- if (value !== null)
942
- return {
943
- reason: `assigned value names ${value}`,
944
- detail: `the value assigned in ${shown(word.text)} ${names(value)}`,
945
- };
946
- }
947
- for (const redirection of command.redirections) {
948
- seen.add(redirection);
949
- const named = redirectsTo(redirection) ? check(redirection.target) : null;
950
- if (named !== null)
951
- return {
952
- reason: `redirection names ${named}`,
953
- detail: `the redirection ${shown(`${redirection.operator} ${redirection.target.text}`)} ${names(named)}`,
954
- };
955
- }
956
- cwd.after(command, (target) => this.spell(target, variables, cwd.current()), this.userHome);
957
- }
958
- // A compound command's redirections and words belong to no one
959
- // command: every directory the line can be in applies.
960
- const anywhere = cwd.current();
961
- const check = (word) => this.wordNames(word, variables, anywhere, expands);
962
- for (const redirection of reading.redirections) {
963
- if (seen.has(redirection) || !redirectsTo(redirection))
964
- continue;
965
- const named = check(redirection.target);
966
- if (named !== null)
967
- return {
968
- reason: `redirection names ${named}`,
969
- detail: `the redirection ${shown(`${redirection.operator} ${redirection.target.text}`)} ${names(named)}`,
970
- };
971
- }
972
- for (const word of reading.compoundWords) {
973
- const named = check(word);
974
- if (named !== null)
975
- return {
976
- reason: `loop or case word names ${named}`,
977
- detail: `the loop or case word ${shown(word.text)} ${names(named)}`,
978
- };
979
- }
980
- return null;
981
- }
982
- /** Literal values the line assigns to each variable (`X=…`, `export X=…`). */
983
- assignments(reading) {
984
- const found = new Map();
985
- const unknown = new Set();
986
- const record = (word) => {
987
- const value = assignedValue(word);
988
- if (value === null)
989
- return;
990
- const { name, append } = value;
991
- const spellings = append ? [] : this.spell(value.word, new Map(), NOWHERE);
992
- if (spellings.length === 0 || spellings.some((s) => s.stop !== 'end')) {
993
- unknown.add(name);
994
- return;
995
- }
996
- const values = found.get(name) ?? new Set();
997
- for (const s of spellings)
998
- values.add(s.known);
999
- found.set(name, values);
1000
- };
1001
- for (const command of reading.commands) {
1002
- command.words.slice(0, command.assignments).forEach(record);
1003
- const head = command.words[command.assignments];
1004
- if (head &&
1005
- !head.expands &&
1006
- ['export', 'declare', 'typeset', 'local', 'readonly'].includes(head.value))
1007
- command.words.slice(command.assignments + 1).forEach(record);
1008
- }
1009
- const out = new Map();
1010
- for (const [name, values] of found) {
1011
- if (values.size > 8)
1012
- throw new TooMany();
1013
- // The environment's value is possible too: a use may come before the assignment.
1014
- out.set(name, { values: [...values], unknown: true });
1015
- }
1016
- for (const name of unknown)
1017
- if (!out.has(name))
1018
- out.set(name, UNKNOWN);
1019
- return out;
1020
- }
1021
- /**
1022
- * A word's value with `~`, `$HOME`, `${HOME}`, `$NAMZU_HOME`, `$PWD` and
1023
- * the line's own literal assignments spelled out, one spelling per
1024
- * combination of the values each may hold.
1025
- */
1026
- spell(word, variables, cwd) {
1027
- if (!word.expands)
1028
- return [{ known: lower(word.value), stop: 'end', rest: '' }];
1029
- const value = unlocale(word.value.replace(/\\\n/g, ''));
1030
- // Bash expands a tilde only when nothing between it and the first
1031
- // unquoted `/` is quoted: `~/x` does, `"~"/x`, `~"/x"` and `~\/x` do not.
1032
- const raw = word.text.replace(/\\\n/g, '');
1033
- const tildeFirst = /^~[A-Za-z0-9._-]*(?:\/|$)/.test(raw);
1034
- const tildeAssigned = /^[A-Za-z_][A-Za-z0-9_]*\+?=/.test(raw) && /[=:]~[A-Za-z0-9._-]*(?:[/:]|$)/.test(raw);
1035
- let open = [''];
1036
- const out = [];
1037
- const stopAll = (stop, from) => {
1038
- const rest = lower(value.slice(from));
1039
- for (const known of open)
1040
- out.push({ known: lower(known), stop, rest });
1041
- };
1042
- let i = 0;
1043
- while (i < value.length && open.length > 0) {
1044
- const c = value[i];
1045
- if (c === '~' &&
1046
- ((i === 0 && tildeFirst) ||
1047
- ((value[i - 1] === '=' || value[i - 1] === ':') && tildeAssigned))) {
1048
- let j = i + 1;
1049
- while (j < value.length && NAME_CHAR.test(lower(value[j])))
1050
- j++;
1051
- if (j === value.length || value[j] === '/') {
1052
- open = open.map((known) => known + this.userHome);
1053
- i = j;
1054
- continue;
1055
- }
1056
- }
1057
- if (c === '$') {
1058
- const simple = /^\$(?:([A-Za-z_][A-Za-z0-9_]*)|\{([A-Za-z_][A-Za-z0-9_]*)\})/.exec(value.slice(i, i + 256));
1059
- if (simple) {
1060
- const name = (simple[1] ?? simple[2]);
1061
- const alternatives = name === 'HOME'
1062
- ? { values: [this.userHome], unknown: false }
1063
- : name === 'NAMZU_HOME'
1064
- ? { values: [this.home], unknown: false }
1065
- : name === 'PWD'
1066
- ? { values: cwd.dirs, unknown: cwd.unknown }
1067
- : name === 'LOCALAPPDATA'
1068
- ? localAppData(variables.get(name))
1069
- : (variables.get(name) ?? UNKNOWN);
1070
- i += simple[0].length;
1071
- // An unknown value ends every spelling here; a known one
1072
- // continues each, once per value.
1073
- if (alternatives.unknown)
1074
- stopAll('unknown', i);
1075
- const next = [];
1076
- for (const known of open)
1077
- for (const v of alternatives.values)
1078
- next.push(known + v);
1079
- if (next.length + out.length > MAX_ALTERNATIVES)
1080
- throw new TooMany();
1081
- open = next;
1082
- continue;
1083
- }
1084
- if (i + 1 < value.length) {
1085
- stopAll('unknown', i + 1);
1086
- return out;
1087
- }
1088
- }
1089
- if (c === '`' || c === '{') {
1090
- stopAll('unknown', i + 1);
1091
- return out;
1092
- }
1093
- if (c === '*' || c === '?' || c === '[') {
1094
- stopAll('glob', i);
1095
- return out;
1096
- }
1097
- open = open.map((known) => known + c);
1098
- i++;
1099
- }
1100
- stopAll('end', value.length);
1101
- return out;
1102
- }
1103
- inside(path) {
1104
- return path === this.home || path.startsWith(this.home === '/' ? '/' : `${this.home}/`);
1105
- }
1106
- /** The home segment right below `dir`, when `dir` is an ancestor of NAMZU_HOME. */
1107
- belowAncestor(dir) {
1108
- const prefix = dir === '/' ? '/' : `${dir}/`;
1109
- if (!this.home.startsWith(prefix))
1110
- return null;
1111
- return this.home.slice(prefix.length).split('/')[0] ?? '';
1112
- }
1113
- /** What a word names that the floor protects, or null. */
1114
- wordNames(word, variables, cwd, lineExpands) {
1115
- if (this.wordNamesHome(word, variables, cwd, lineExpands))
1116
- return 'NAMZU_HOME';
1117
- if (this.wordNamesProfile(word, variables, cwd, lineExpands))
1118
- return 'the browser profiles';
1119
- return null;
1120
- }
1121
- /**
1122
- * The Windows browser's profiles in a word, on the same spellings and
1123
- * directories as NAMZU_HOME. The root is known only by its last three
1124
- * segments, so a word with an unknown part is denied when its segments
1125
- * could still read `appdata/local/namzu` and one of them is spelled out,
1126
- * or when an unknown expansion is followed by a `namzu` segment.
1127
- */
1128
- wordNamesProfile(word, variables, cwd, lineExpands) {
1129
- for (const spelling of this.spell(word, variables, cwd)) {
1130
- const known = spellLocalAppData(spelling.known);
1131
- const rest = spellLocalAppData(spelling.rest);
1132
- // Anywhere in the word, and as a relative path from each directory.
1133
- const bases = isAbsolute(known) ? [''] : ['', ...cwd.dirs];
1134
- // A word with none of the root's names, no `..` and nothing unknown
1135
- // in it cannot lead into the root from a directory outside it:
1136
- // only a directory already inside it matters then, and joining the
1137
- // word to every directory a line of `cd`s names is the cost.
1138
- const inert = !/namzu|local|appdata|\.\.|[*?[$`{]/.test(known + rest);
1139
- for (const base of bases) {
1140
- if (inert && base !== '') {
1141
- if (namesProfile(base))
1142
- return true;
1143
- continue;
1144
- }
1145
- const at = (text) => (base === '' ? normalize(text) : join(base, text));
1146
- if (spelling.stop === 'end') {
1147
- const path = at(known);
1148
- if (namesProfile(path))
1149
- return true;
1150
- if (lineExpands && endsShortOfProfile(path))
1151
- return true;
1152
- continue;
1153
- }
1154
- // The unknown part stands for any text: `*` does, as a segment's wildcard.
1155
- if (mayNameProfile(at(`${known}*${rest}`)))
1156
- return true;
1157
- }
1158
- // An expansion may hold slashes, and so the whole path above `namzu`.
1159
- if (spelling.stop === 'unknown' && /(?:^|\/)namzu(?:\/|$)/.test(normalize(rest)))
1160
- return true;
1161
- }
1162
- return false;
1163
- }
1164
- /** Whether text after an unknown expansion holds NAMZU_HOME's last segment as a path segment. */
1165
- restNamesHome(rest) {
1166
- let at = rest.indexOf(this.homeCore);
1167
- while (at >= 0) {
1168
- const before = at === 0 ? '' : rest[at - 1];
1169
- const after = rest[at + this.homeCore.length] ?? '';
1170
- if (/^[./\\]?$/.test(before) && !NAME_CHAR.test(after))
1171
- return true;
1172
- at = rest.indexOf(this.homeCore, at + 1);
1173
- }
1174
- return false;
1175
- }
1176
- wordNamesHome(word, variables, cwd, lineExpands) {
1177
- if (word.expands && /\$\{?[!#]?namzu_home(?![a-z0-9_])/i.test(word.value))
1178
- return true;
1179
- for (const spelling of this.spell(word, variables, cwd)) {
1180
- const { known } = spelling;
1181
- // Anywhere in the word: `--config=/…/.namzu/x`, `-f/…`.
1182
- if (containsPath(normalize(known), this.home))
1183
- return true;
1184
- const bases = isAbsolute(known) ? [''] : cwd.dirs;
1185
- for (const base of bases) {
1186
- const path = base === '' ? normalize(known) : join(base, known);
1187
- if (spelling.stop === 'end') {
1188
- if (this.inside(path))
1189
- return true;
1190
- // A piece of the path, to be finished by an expansion elsewhere
1191
- // in the line: `for p in ~/.nam; do ls ${p}zu; done`.
1192
- if (lineExpands &&
1193
- path !== '/' &&
1194
- this.home.startsWith(path) &&
1195
- this.home[path.length] !== '/')
1196
- return true;
1197
- continue;
1198
- }
1199
- // Stopped at an unknown: does the known part lead into NAMZU_HOME?
1200
- const slash = known.lastIndexOf('/');
1201
- const partial = known.slice(slash + 1);
1202
- const dir = slash < 0
1203
- ? base === ''
1204
- ? null
1205
- : base
1206
- : base === ''
1207
- ? normalize(known.slice(0, slash + 1) || '/')
1208
- : join(base, known.slice(0, slash + 1));
1209
- if (dir === null)
1210
- continue;
1211
- if (this.inside(dir))
1212
- return true;
1213
- const next = this.belowAncestor(dir);
1214
- if (next === null)
1215
- continue;
1216
- if (partial === '') {
1217
- // A glob does not match a leading dot unless it spells one.
1218
- if (spelling.stop === 'glob' && next.startsWith('.'))
1219
- continue;
1220
- return true;
1221
- }
1222
- if (next.startsWith(partial))
1223
- return true;
1224
- }
1225
- // After the unknown part, NAMZU_HOME's last segment as a path
1226
- // segment: right after the expansion (`${X}namzu`, where X may end
1227
- // in `/.`), or after a `.`, `/` or `\` (`$X/.namzu/x`). The name
1228
- // inside other text (`$(echo namzu)`, `"$USER: namzu done"`) is not
1229
- // a path.
1230
- if (spelling.stop !== 'end' && this.homeCore.length >= 3 && this.restNamesHome(spelling.rest))
1231
- return true;
1232
- }
1233
- return false;
1234
- }
1235
- /**
1236
- * `find … -exec|-execdir|-ok|-okdir … ;|+`: the clause runs on every path
1237
- * `find` matches, substituted for `{}` — a placeholder no static reading
1238
- * can resolve. Refused when `{}` stands in that clause AND the search
1239
- * could plausibly reach a protected target: the root is unknown or is
1240
- * NAMZU_HOME itself or an ancestor of it (so `find` would recurse THROUGH
1241
- * it), a `-name`/`-iname`/`-path`/`-ipath` pattern could match NAMZU_HOME's
1242
- * own folder name, or the clause's own program is a tool that can stop or
1243
- * remove a service (`{}` there could name the scheduler's unit without
1244
- * ever spelling it in the line the floor can read).
1245
- */
1246
- findExecFinding(command, variables, cwd, dialect) {
1247
- const words = command.words;
1248
- const findAt = programPositions(command, dialect)
1249
- .map((position) => position.word && !position.word.expands && commandName(position.word.value) === 'find'
1250
- ? words.indexOf(position.word)
1251
- : -1)
1252
- .find((index) => index >= 0);
1253
- if (findAt === undefined)
1254
- return null;
1255
- const head = words[findAt];
1256
- const rootWords = [];
1257
- let i = findAt + 1;
1258
- while (i < words.length) {
1259
- const w = words[i];
1260
- if (!w.expands && (w.value.startsWith('-') || w.value === '(' || w.value === '!'))
1261
- break;
1262
- rootWords.push(w);
1263
- i++;
1264
- }
1265
- const roots = rootWords.length > 0
1266
- ? rootWords
1267
- : [{ text: '.', value: '.', expands: false, quoted: false, substitutes: false }];
1268
- const reachesHome = roots.some((root) => {
1269
- if (root.expands)
1270
- return true;
1271
- for (const spelling of this.spell(root, variables, cwd)) {
1272
- if (spelling.stop !== 'end')
1273
- return true;
1274
- const bases = isAbsolute(spelling.known) ? [''] : cwd.dirs.length > 0 ? cwd.dirs : [''];
1275
- for (const base of bases) {
1276
- const path = base === '' ? normalize(spelling.known) : join(base, spelling.known);
1277
- if (this.inside(path) || this.belowAncestor(path) !== null)
1278
- return true;
1279
- }
1280
- }
1281
- return false;
1282
- });
1283
- let filterMatchesHome = false;
1284
- for (let j = findAt; j < words.length; j++) {
1285
- const flag = words[j];
1286
- if (flag.expands || !/^-i?(?:name|path)$/.test(flag.value))
1287
- continue;
1288
- const pattern = words[j + 1];
1289
- if (!pattern || pattern.expands)
1290
- continue;
1291
- if (this.homeSegments.some((seg) => mayBe(lower(pattern.value), seg.name))) {
1292
- filterMatchesHome = true;
1293
- break;
1294
- }
1295
- }
1296
- for (let j = findAt + 1; j < words.length; j++) {
1297
- const flag = words[j];
1298
- if (flag.expands || !/^-(?:exec|execdir|ok|okdir)$/.test(flag.value))
1299
- continue;
1300
- let k = j + 1;
1301
- let hasPlaceholder = false;
1302
- const clauseStart = k;
1303
- while (k < words.length) {
1304
- const w = words[k];
1305
- if (!w.expands && (w.value === ';' || w.value === '+'))
1306
- break;
1307
- if (!w.expands) {
1308
- if (w.value.includes('{}'))
1309
- hasPlaceholder = true;
1310
- }
1311
- k++;
1312
- }
1313
- // Ask the shared resolver what this clause actually runs. The
1314
- // first word may be `env`/`sudo`/another wrapper, and a shell -c
1315
- // payload can itself name a service tool. Reusing a one-clause
1316
- // find command keeps the answer tied to this clause.
1317
- const clauseCommand = {
1318
- ...command,
1319
- words: [head, flag, ...words.slice(clauseStart, k)],
1320
- assignments: 0,
1321
- };
1322
- const toolIsSchedulerTool = programPositions(clauseCommand, dialect)
1323
- .slice(1)
1324
- .some((position) => position.unknown !== undefined ||
1325
- (position.word !== undefined &&
1326
- SCHEDULER_EXEC_TOOLS.has(commandName(position.word.value))));
1327
- if (hasPlaceholder && (reachesHome || filterMatchesHome || toolIsSchedulerTool)) {
1328
- const clauseText = words
1329
- .slice(clauseStart, k)
1330
- .map((w) => w.text)
1331
- .join(' ');
1332
- const why = toolIsSchedulerTool
1333
- ? "its clause's own program can stop or remove a service"
1334
- : filterMatchesHome
1335
- ? 'a -name/-iname/-path/-ipath pattern could match NAMZU_HOME’s own folder name'
1336
- : 'its search root is unknown, is NAMZU_HOME, or is an ancestor of it';
1337
- return {
1338
- reason: 'find -exec reaches a protected target',
1339
- detail: `${shown(command.text)} runs \`${flag.value} ${clauseText}\` on whatever it finds, and ${why}; the floor cannot verify what {} will stand for`,
1340
- };
1341
- }
1342
- j = k;
1343
- }
1344
- return null;
1345
- }
1346
- }
1347
- /** Tools whose `find -exec`/`-execdir`/`-ok`/`-okdir` clause the floor refuses outright: each can stop or remove a service. */
1348
- const SCHEDULER_EXEC_TOOLS = new Set([
1349
- 'systemctl',
1350
- 'launchctl',
1351
- 'schtasks',
1352
- 'pkill',
1353
- 'killall',
1354
- 'busctl',
1355
- 'dbus-send',
1356
- 'gdbus',
1357
- ]);
1358
- /** A write target this command names: `>`/`>>` redirections, `tee`'s arguments, `cp`/`mv`'s destination. */
1359
- function writeTargets(command) {
1360
- const targets = [];
1361
- for (const r of command.redirections) {
1362
- if (r.operator === '>' || r.operator === '>>')
1363
- targets.push(r.target);
1364
- }
1365
- const words = command.words;
1366
- const head = words[command.assignments];
1367
- if (!head || head.expands)
1368
- return targets;
1369
- const name = commandName(head.value);
1370
- const rest = words
1371
- .slice(command.assignments + 1)
1372
- .filter((w) => w.expands || !w.value.startsWith('-'));
1373
- if (name === 'tee')
1374
- targets.push(...rest);
1375
- else if (name === 'cp' || name === 'mv') {
1376
- const last = rest.at(-1);
1377
- if (last)
1378
- targets.push(last);
1379
- }
1380
- return targets;
1381
- }
1382
- /**
1383
- * The path this command executes as a FILE — `./x.sh`, `some/dir/x.sh`,
1384
- * `sh x.sh`, `bash x.sh`, `. x.sh`, `source x.sh` — or null. A bare name on
1385
- * `PATH` (`x.sh` alone, no `/`) is not: that resolves to whatever `PATH`
1386
- * finds, not a file this line can be shown to have written.
1387
- */
1388
- function executedPath(command) {
1389
- const words = command.words;
1390
- const head = words[command.assignments];
1391
- if (!head || head.expands)
1392
- return null;
1393
- const name = commandName(head.value);
1394
- if (name === 'sh' || name === 'bash' || name === '.' || name === 'source') {
1395
- const rest = words
1396
- .slice(command.assignments + 1)
1397
- .filter((w) => w.expands || !w.value.startsWith('-'));
1398
- return rest[0] ?? null;
1399
- }
1400
- if (!head.expands && head.value.includes('/'))
1401
- return head;
1402
- return null;
1403
- }
1404
- /** `NAME=value`, `NAME+=value` or `--opt=value`: the value as a word of its own. */
1405
- function assignedValue(word) {
1406
- // An assignment's name and `=` are never quoted, so both spellings start
1407
- // with them.
1408
- const text = word.text.replace(/\\\n/g, '');
1409
- const match = /^([A-Za-z_][A-Za-z0-9_]*)(\+?)=/.exec(text);
1410
- if (!match || !word.value.startsWith(match[0]))
1411
- return null;
1412
- return {
1413
- name: match[1],
1414
- append: match[2] === '+',
1415
- word: {
1416
- text: text.slice(match[0].length),
1417
- value: word.value.slice(match[0].length),
1418
- expands: word.expands,
1419
- quoted: word.quoted,
1420
- substitutes: word.substitutes,
1421
- },
1422
- };
1423
- }
1424
- /** `$LOCALAPPDATA`'s values: the profile root's parent, and whatever the line assigns it. */
1425
- function localAppData(assigned) {
1426
- return {
1427
- values: [LOCAL_APP_DATA, ...(assigned?.values ?? [])],
1428
- unknown: assigned?.unknown ?? false,
1429
- };
1430
- }
1431
- /**
1432
- * The Windows browser's profiles in free text: a path through
1433
- * `AppData/Local/namzu` or `%LOCALAPPDATA%\namzu`, in any letter case, either
1434
- * slash; and again with quotes and backslashes dropped, as a shell would.
1435
- */
1436
- export function textNamesProfile(text) {
1437
- const plain = lower(text);
1438
- const unquoted = plain
1439
- .replace(/\\\n/g, '')
1440
- .replace(/\$(?=["'])/g, '')
1441
- .replace(/["']/g, '');
1442
- for (const variant of [plain, unquoted])
1443
- if (namesProfile(normalize(spellLocalAppData(variant))))
1444
- return true;
1445
- return false;
1446
- }
1447
- /** Commands that export a variable, or print the environment. */
1448
- const EXPORTING = new Set([
1449
- 'export',
1450
- 'declare',
1451
- 'typeset',
1452
- 'local',
1453
- 'readonly',
1454
- 'set',
1455
- 'env',
1456
- 'printenv',
1457
- ]);
1458
- /** Whether a redirection names a file: not a here-document's delimiter. */
1459
- function redirectsTo(redirection) {
1460
- return redirection.operator !== '<<' && redirection.operator !== '<<-';
1461
- }
1462
- /**
1463
- * Where a relative path may start, command by command: the job's folder and
1464
- * every directory a `cd` or `pushd` earlier in the line names, from any of
1465
- * those (a `cd` in a subshell or a pipeline is counted too: broader, never
1466
- * narrower). Unknown once a `cd` goes somewhere the line does not spell out.
1467
- */
1468
- class Directories {
1469
- dirs;
1470
- unknown = false;
1471
- constructor(folders) {
1472
- this.dirs = new Set(folders);
1473
- }
1474
- /** Every directory known to be possible, and whether others are. */
1475
- current() {
1476
- return { dirs: [...this.dirs], unknown: this.unknown };
1477
- }
1478
- after(command, spell, userHome) {
1479
- const words = command.words.slice(command.assignments);
1480
- let at = 0;
1481
- while (at < words.length &&
1482
- !words[at]?.expands &&
1483
- ['builtin', 'command'].includes(words[at]?.value ?? ''))
1484
- at++;
1485
- const head = words[at];
1486
- if (!head || head.expands)
1487
- return;
1488
- if (head.value === 'popd') {
1489
- this.unknown = true;
1490
- return;
1491
- }
1492
- if (head.value !== 'cd' && head.value !== 'pushd')
1493
- return;
1494
- let target = words.slice(at + 1).find((w) => w.expands || !/^-[LPe@]+$/.test(w.value));
1495
- if (target && !target.expands && target.value === '--')
1496
- target = words[words.indexOf(target) + 1];
1497
- if (!target) {
1498
- this.dirs.add(userHome);
1499
- return;
1500
- }
1501
- if (!target.expands && (target.value === '-' || /^[+-]\d+$/.test(target.value))) {
1502
- this.unknown = true;
1503
- return;
1504
- }
1505
- const from = [...this.dirs];
1506
- for (const spelling of spell(target)) {
1507
- if (spelling.stop !== 'end') {
1508
- this.unknown = true;
1509
- continue;
1510
- }
1511
- for (const dir of isAbsolute(spelling.known) ? ['/'] : from) {
1512
- if (this.dirs.size >= 16) {
1513
- this.unknown = true;
1514
- return;
1515
- }
1516
- this.dirs.add(join(dir, spelling.known));
1517
- }
1518
- }
1519
- }
1520
- }
1521
- /** How many levels of text-inside-text the tripwire reads. */
1522
- const MAX_TEXT_DEPTH = 3;
1523
- /** Every string in the line a program could run as a command line. */
1524
- function fedTexts(readings) {
1525
- const out = new Set();
1526
- for (const reading of readings) {
1527
- for (const command of reading.commands)
1528
- for (const word of command.words) {
1529
- const text = word.expands ? unlocale(word.value) : word.value;
1530
- if (/\s|;|&|\|/.test(text))
1531
- out.add(text);
1532
- }
1533
- for (const redirection of reading.redirections) {
1534
- if (redirection.body !== undefined)
1535
- out.add(redirection.body);
1536
- if (redirection.operator === '<<<')
1537
- out.add(redirection.target.value);
1538
- }
1539
- }
1540
- return [...out];
1541
- }
1542
- /** A command the lexer listed whose name or payload it could not read, in words, or null. */
1543
- function unreadCommand(command) {
1544
- const head = command.words[command.assignments];
1545
- if (head?.expands)
1546
- return `the command's name ${shown(head.text)} expands at runtime`;
1547
- return runsUnreadText(command);
1548
- }
1549
- /** `, in the argument …` for the first word that holds `token`, or nothing. */
1550
- function whereIn(readings, token) {
1551
- const holds = typeof token === 'string'
1552
- ? (text) => text.includes(lower(token))
1553
- : (text) => token.test(text);
1554
- for (const reading of readings)
1555
- for (const command of reading.commands)
1556
- for (const word of command.words)
1557
- if (holds(lower(word.value)))
1558
- return `, in the argument ${shown(word.value)}`;
1559
- return '';
1560
- }
1561
- //# sourceMappingURL=floor.js.map