@papert-code/papert-code 0.3.95 → 0.3.96

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 (331) hide show
  1. package/README.md +13 -0
  2. package/dist/chunks/{chunk-Q5TJEKUL.js → chunk-HSYOWGEB.js} +1 -1
  3. package/dist/chunks/{chunk-KDPC3L34.js → chunk-IK4ISYCE.js} +4 -4
  4. package/dist/chunks/{chunk-JATIVKZP.js → chunk-KBPFDUTA.js} +55 -10
  5. package/dist/chunks/{chunk-DQ32BMUI.js → chunk-TNDQXJLA.js} +924 -335
  6. package/dist/chunks/{gemini-SUVKHYG5.js → gemini-MVJNXCFF.js} +3910 -1535
  7. package/dist/chunks/{openaiContentGenerator-P6VRBRRB.js → openaiContentGenerator-GTG5MK5E.js} +2 -2
  8. package/dist/chunks/{papertContentGenerator-E64QQV3K.js → papertContentGenerator-Q5TTXUE6.js} +3 -3
  9. package/dist/chunks/{server-N2U4FF55.js → server-6D3KYATG.js} +7 -1
  10. package/dist/cli.js +5 -4
  11. package/dist/sandbox-macos-permissive-proxied.sb +1 -1
  12. package/dist/sandbox-macos-restrictive-proxied.sb +1 -1
  13. package/dist/skills/algorithmic-art/SKILL.md +405 -0
  14. package/dist/skills/algorithmic-art/templates/generator_template.js +223 -0
  15. package/dist/skills/algorithmic-art/templates/viewer.html +599 -0
  16. package/dist/skills/brand-guidelines/SKILL.md +73 -0
  17. package/dist/skills/canvas-design/SKILL.md +130 -0
  18. package/dist/skills/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +93 -0
  19. package/dist/skills/canvas-design/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
  20. package/dist/skills/canvas-design/canvas-fonts/BigShoulders-Bold.ttf +0 -0
  21. package/dist/skills/canvas-design/canvas-fonts/BigShoulders-OFL.txt +93 -0
  22. package/dist/skills/canvas-design/canvas-fonts/BigShoulders-Regular.ttf +0 -0
  23. package/dist/skills/canvas-design/canvas-fonts/Boldonse-OFL.txt +93 -0
  24. package/dist/skills/canvas-design/canvas-fonts/Boldonse-Regular.ttf +0 -0
  25. package/dist/skills/canvas-design/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
  26. package/dist/skills/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
  27. package/dist/skills/canvas-design/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
  28. package/dist/skills/canvas-design/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
  29. package/dist/skills/canvas-design/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
  30. package/dist/skills/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +93 -0
  31. package/dist/skills/canvas-design/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
  32. package/dist/skills/canvas-design/canvas-fonts/DMMono-OFL.txt +93 -0
  33. package/dist/skills/canvas-design/canvas-fonts/DMMono-Regular.ttf +0 -0
  34. package/dist/skills/canvas-design/canvas-fonts/EricaOne-OFL.txt +94 -0
  35. package/dist/skills/canvas-design/canvas-fonts/EricaOne-Regular.ttf +0 -0
  36. package/dist/skills/canvas-design/canvas-fonts/GeistMono-Bold.ttf +0 -0
  37. package/dist/skills/canvas-design/canvas-fonts/GeistMono-OFL.txt +93 -0
  38. package/dist/skills/canvas-design/canvas-fonts/GeistMono-Regular.ttf +0 -0
  39. package/dist/skills/canvas-design/canvas-fonts/Gloock-OFL.txt +93 -0
  40. package/dist/skills/canvas-design/canvas-fonts/Gloock-Regular.ttf +0 -0
  41. package/dist/skills/canvas-design/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
  42. package/dist/skills/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
  43. package/dist/skills/canvas-design/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
  44. package/dist/skills/canvas-design/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
  45. package/dist/skills/canvas-design/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
  46. package/dist/skills/canvas-design/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
  47. package/dist/skills/canvas-design/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
  48. package/dist/skills/canvas-design/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
  49. package/dist/skills/canvas-design/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
  50. package/dist/skills/canvas-design/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
  51. package/dist/skills/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +93 -0
  52. package/dist/skills/canvas-design/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
  53. package/dist/skills/canvas-design/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
  54. package/dist/skills/canvas-design/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
  55. package/dist/skills/canvas-design/canvas-fonts/Italiana-OFL.txt +93 -0
  56. package/dist/skills/canvas-design/canvas-fonts/Italiana-Regular.ttf +0 -0
  57. package/dist/skills/canvas-design/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
  58. package/dist/skills/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
  59. package/dist/skills/canvas-design/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
  60. package/dist/skills/canvas-design/canvas-fonts/Jura-Light.ttf +0 -0
  61. package/dist/skills/canvas-design/canvas-fonts/Jura-Medium.ttf +0 -0
  62. package/dist/skills/canvas-design/canvas-fonts/Jura-OFL.txt +93 -0
  63. package/dist/skills/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
  64. package/dist/skills/canvas-design/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
  65. package/dist/skills/canvas-design/canvas-fonts/Lora-Bold.ttf +0 -0
  66. package/dist/skills/canvas-design/canvas-fonts/Lora-BoldItalic.ttf +0 -0
  67. package/dist/skills/canvas-design/canvas-fonts/Lora-Italic.ttf +0 -0
  68. package/dist/skills/canvas-design/canvas-fonts/Lora-OFL.txt +93 -0
  69. package/dist/skills/canvas-design/canvas-fonts/Lora-Regular.ttf +0 -0
  70. package/dist/skills/canvas-design/canvas-fonts/NationalPark-Bold.ttf +0 -0
  71. package/dist/skills/canvas-design/canvas-fonts/NationalPark-OFL.txt +93 -0
  72. package/dist/skills/canvas-design/canvas-fonts/NationalPark-Regular.ttf +0 -0
  73. package/dist/skills/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
  74. package/dist/skills/canvas-design/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
  75. package/dist/skills/canvas-design/canvas-fonts/Outfit-Bold.ttf +0 -0
  76. package/dist/skills/canvas-design/canvas-fonts/Outfit-OFL.txt +93 -0
  77. package/dist/skills/canvas-design/canvas-fonts/Outfit-Regular.ttf +0 -0
  78. package/dist/skills/canvas-design/canvas-fonts/PixelifySans-Medium.ttf +0 -0
  79. package/dist/skills/canvas-design/canvas-fonts/PixelifySans-OFL.txt +93 -0
  80. package/dist/skills/canvas-design/canvas-fonts/PoiretOne-OFL.txt +93 -0
  81. package/dist/skills/canvas-design/canvas-fonts/PoiretOne-Regular.ttf +0 -0
  82. package/dist/skills/canvas-design/canvas-fonts/RedHatMono-Bold.ttf +0 -0
  83. package/dist/skills/canvas-design/canvas-fonts/RedHatMono-OFL.txt +93 -0
  84. package/dist/skills/canvas-design/canvas-fonts/RedHatMono-Regular.ttf +0 -0
  85. package/dist/skills/canvas-design/canvas-fonts/Silkscreen-OFL.txt +93 -0
  86. package/dist/skills/canvas-design/canvas-fonts/Silkscreen-Regular.ttf +0 -0
  87. package/dist/skills/canvas-design/canvas-fonts/SmoochSans-Medium.ttf +0 -0
  88. package/dist/skills/canvas-design/canvas-fonts/SmoochSans-OFL.txt +93 -0
  89. package/dist/skills/canvas-design/canvas-fonts/Tektur-Medium.ttf +0 -0
  90. package/dist/skills/canvas-design/canvas-fonts/Tektur-OFL.txt +93 -0
  91. package/dist/skills/canvas-design/canvas-fonts/Tektur-Regular.ttf +0 -0
  92. package/dist/skills/canvas-design/canvas-fonts/WorkSans-Bold.ttf +0 -0
  93. package/dist/skills/canvas-design/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
  94. package/dist/skills/canvas-design/canvas-fonts/WorkSans-Italic.ttf +0 -0
  95. package/dist/skills/canvas-design/canvas-fonts/WorkSans-OFL.txt +93 -0
  96. package/dist/skills/canvas-design/canvas-fonts/WorkSans-Regular.ttf +0 -0
  97. package/dist/skills/canvas-design/canvas-fonts/YoungSerif-OFL.txt +93 -0
  98. package/dist/skills/canvas-design/canvas-fonts/YoungSerif-Regular.ttf +0 -0
  99. package/dist/skills/doc-coauthoring/SKILL.md +375 -0
  100. package/dist/skills/docx/SKILL.md +481 -0
  101. package/dist/skills/docx/scripts/__init__.py +1 -0
  102. package/dist/skills/docx/scripts/accept_changes.py +135 -0
  103. package/dist/skills/docx/scripts/comment.py +318 -0
  104. package/dist/skills/docx/scripts/office/helpers/__init__.py +0 -0
  105. package/dist/skills/docx/scripts/office/helpers/merge_runs.py +199 -0
  106. package/dist/skills/docx/scripts/office/helpers/simplify_redlines.py +197 -0
  107. package/dist/skills/docx/scripts/office/pack.py +159 -0
  108. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  109. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  110. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  111. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  112. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  113. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  114. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  115. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  116. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  117. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  118. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  119. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  120. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  121. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  122. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  123. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  124. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  125. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  126. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  127. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  128. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  129. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  130. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  131. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  132. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  133. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  134. package/dist/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  135. package/dist/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  136. package/dist/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  137. package/dist/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  138. package/dist/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  139. package/dist/skills/docx/scripts/office/schemas/mce/mc.xsd +75 -0
  140. package/dist/skills/docx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
  141. package/dist/skills/docx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
  142. package/dist/skills/docx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
  143. package/dist/skills/docx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
  144. package/dist/skills/docx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
  145. package/dist/skills/docx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  146. package/dist/skills/docx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
  147. package/dist/skills/docx/scripts/office/soffice.py +183 -0
  148. package/dist/skills/docx/scripts/office/unpack.py +132 -0
  149. package/dist/skills/docx/scripts/office/validate.py +111 -0
  150. package/dist/skills/docx/scripts/office/validators/__init__.py +15 -0
  151. package/dist/skills/docx/scripts/office/validators/base.py +847 -0
  152. package/dist/skills/docx/scripts/office/validators/docx.py +446 -0
  153. package/dist/skills/docx/scripts/office/validators/pptx.py +275 -0
  154. package/dist/skills/docx/scripts/office/validators/redlining.py +247 -0
  155. package/dist/skills/docx/scripts/templates/comments.xml +3 -0
  156. package/dist/skills/docx/scripts/templates/commentsExtended.xml +3 -0
  157. package/dist/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
  158. package/dist/skills/docx/scripts/templates/commentsIds.xml +3 -0
  159. package/dist/skills/docx/scripts/templates/people.xml +3 -0
  160. package/dist/skills/frontend-design/SKILL.md +42 -0
  161. package/dist/skills/internal-comms/SKILL.md +32 -0
  162. package/dist/skills/internal-comms/examples/3p-updates.md +47 -0
  163. package/dist/skills/internal-comms/examples/company-newsletter.md +65 -0
  164. package/dist/skills/internal-comms/examples/faq-answers.md +30 -0
  165. package/dist/skills/internal-comms/examples/general-comms.md +16 -0
  166. package/dist/skills/mcp-builder/SKILL.md +236 -0
  167. package/dist/skills/mcp-builder/reference/evaluation.md +602 -0
  168. package/dist/skills/mcp-builder/reference/mcp_best_practices.md +249 -0
  169. package/dist/skills/mcp-builder/reference/node_mcp_server.md +970 -0
  170. package/dist/skills/mcp-builder/reference/python_mcp_server.md +719 -0
  171. package/dist/skills/mcp-builder/scripts/connections.py +151 -0
  172. package/dist/skills/mcp-builder/scripts/evaluation.py +373 -0
  173. package/dist/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
  174. package/dist/skills/mcp-builder/scripts/requirements.txt +2 -0
  175. package/dist/skills/papert-code/SKILL.md +561 -0
  176. package/dist/skills/pdf/SKILL.md +314 -0
  177. package/dist/skills/pdf/forms.md +294 -0
  178. package/dist/skills/pdf/reference.md +612 -0
  179. package/dist/skills/pdf/scripts/check_bounding_boxes.py +65 -0
  180. package/dist/skills/pdf/scripts/check_fillable_fields.py +11 -0
  181. package/dist/skills/pdf/scripts/convert_pdf_to_images.py +33 -0
  182. package/dist/skills/pdf/scripts/create_validation_image.py +37 -0
  183. package/dist/skills/pdf/scripts/extract_form_field_info.py +122 -0
  184. package/dist/skills/pdf/scripts/extract_form_structure.py +115 -0
  185. package/dist/skills/pdf/scripts/fill_fillable_fields.py +98 -0
  186. package/dist/skills/pdf/scripts/fill_pdf_form_with_annotations.py +107 -0
  187. package/dist/skills/pptx/SKILL.md +232 -0
  188. package/dist/skills/pptx/editing.md +205 -0
  189. package/dist/skills/pptx/pptxgenjs.md +420 -0
  190. package/dist/skills/pptx/scripts/__init__.py +0 -0
  191. package/dist/skills/pptx/scripts/add_slide.py +195 -0
  192. package/dist/skills/pptx/scripts/clean.py +286 -0
  193. package/dist/skills/pptx/scripts/office/helpers/__init__.py +0 -0
  194. package/dist/skills/pptx/scripts/office/helpers/merge_runs.py +199 -0
  195. package/dist/skills/pptx/scripts/office/helpers/simplify_redlines.py +197 -0
  196. package/dist/skills/pptx/scripts/office/pack.py +159 -0
  197. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  198. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  199. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  200. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  201. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  202. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  203. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  204. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  205. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  206. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  207. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  208. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  209. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  210. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  211. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  212. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  213. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  214. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  215. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  216. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  217. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  218. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  219. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  220. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  221. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  222. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  223. package/dist/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  224. package/dist/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  225. package/dist/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  226. package/dist/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  227. package/dist/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  228. package/dist/skills/pptx/scripts/office/schemas/mce/mc.xsd +75 -0
  229. package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
  230. package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
  231. package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
  232. package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
  233. package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
  234. package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  235. package/dist/skills/pptx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
  236. package/dist/skills/pptx/scripts/office/soffice.py +183 -0
  237. package/dist/skills/pptx/scripts/office/unpack.py +132 -0
  238. package/dist/skills/pptx/scripts/office/validate.py +111 -0
  239. package/dist/skills/pptx/scripts/office/validators/__init__.py +15 -0
  240. package/dist/skills/pptx/scripts/office/validators/base.py +847 -0
  241. package/dist/skills/pptx/scripts/office/validators/docx.py +446 -0
  242. package/dist/skills/pptx/scripts/office/validators/pptx.py +275 -0
  243. package/dist/skills/pptx/scripts/office/validators/redlining.py +247 -0
  244. package/dist/skills/pptx/scripts/thumbnail.py +289 -0
  245. package/dist/skills/skill-creator/SKILL.md +357 -0
  246. package/dist/skills/skill-creator/references/output-patterns.md +82 -0
  247. package/dist/skills/skill-creator/references/workflows.md +28 -0
  248. package/dist/skills/skill-creator/scripts/init_skill.py +303 -0
  249. package/dist/skills/skill-creator/scripts/package_skill.py +110 -0
  250. package/dist/skills/skill-creator/scripts/quick_validate.py +103 -0
  251. package/dist/skills/slack-gif-creator/SKILL.md +254 -0
  252. package/dist/skills/slack-gif-creator/core/easing.py +234 -0
  253. package/dist/skills/slack-gif-creator/core/frame_composer.py +176 -0
  254. package/dist/skills/slack-gif-creator/core/gif_builder.py +269 -0
  255. package/dist/skills/slack-gif-creator/core/validators.py +136 -0
  256. package/dist/skills/slack-gif-creator/requirements.txt +4 -0
  257. package/dist/skills/theme-factory/SKILL.md +59 -0
  258. package/dist/skills/theme-factory/theme-showcase.pdf +0 -0
  259. package/dist/skills/theme-factory/themes/arctic-frost.md +19 -0
  260. package/dist/skills/theme-factory/themes/botanical-garden.md +19 -0
  261. package/dist/skills/theme-factory/themes/desert-rose.md +19 -0
  262. package/dist/skills/theme-factory/themes/forest-canopy.md +19 -0
  263. package/dist/skills/theme-factory/themes/golden-hour.md +19 -0
  264. package/dist/skills/theme-factory/themes/midnight-galaxy.md +19 -0
  265. package/dist/skills/theme-factory/themes/modern-minimalist.md +19 -0
  266. package/dist/skills/theme-factory/themes/ocean-depths.md +19 -0
  267. package/dist/skills/theme-factory/themes/sunset-boulevard.md +19 -0
  268. package/dist/skills/theme-factory/themes/tech-innovation.md +19 -0
  269. package/dist/skills/web-artifacts-builder/SKILL.md +74 -0
  270. package/dist/skills/web-artifacts-builder/scripts/bundle-artifact.sh +54 -0
  271. package/dist/skills/web-artifacts-builder/scripts/init-artifact.sh +322 -0
  272. package/dist/skills/web-artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
  273. package/dist/skills/webapp-testing/SKILL.md +96 -0
  274. package/dist/skills/webapp-testing/examples/console_logging.py +35 -0
  275. package/dist/skills/webapp-testing/examples/element_discovery.py +40 -0
  276. package/dist/skills/webapp-testing/examples/static_html_automation.py +33 -0
  277. package/dist/skills/webapp-testing/scripts/with_server.py +106 -0
  278. package/dist/skills/xlsx/SKILL.md +292 -0
  279. package/dist/skills/xlsx/scripts/office/helpers/__init__.py +0 -0
  280. package/dist/skills/xlsx/scripts/office/helpers/merge_runs.py +199 -0
  281. package/dist/skills/xlsx/scripts/office/helpers/simplify_redlines.py +197 -0
  282. package/dist/skills/xlsx/scripts/office/pack.py +159 -0
  283. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  284. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  285. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  286. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  287. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  288. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  289. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  290. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  291. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  292. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  293. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  294. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  295. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  296. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  297. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  298. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  299. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  300. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  301. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  302. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  303. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  304. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  305. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  306. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  307. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  308. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  309. package/dist/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  310. package/dist/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  311. package/dist/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  312. package/dist/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  313. package/dist/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  314. package/dist/skills/xlsx/scripts/office/schemas/mce/mc.xsd +75 -0
  315. package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
  316. package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
  317. package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
  318. package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
  319. package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
  320. package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  321. package/dist/skills/xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
  322. package/dist/skills/xlsx/scripts/office/soffice.py +183 -0
  323. package/dist/skills/xlsx/scripts/office/unpack.py +132 -0
  324. package/dist/skills/xlsx/scripts/office/validate.py +111 -0
  325. package/dist/skills/xlsx/scripts/office/validators/__init__.py +15 -0
  326. package/dist/skills/xlsx/scripts/office/validators/base.py +847 -0
  327. package/dist/skills/xlsx/scripts/office/validators/docx.py +446 -0
  328. package/dist/skills/xlsx/scripts/office/validators/pptx.py +275 -0
  329. package/dist/skills/xlsx/scripts/office/validators/redlining.py +247 -0
  330. package/dist/skills/xlsx/scripts/recalc.py +184 -0
  331. package/package.json +5 -4
@@ -114,7 +114,7 @@ import {
114
114
  supportsMultimodalFunctionResponse,
115
115
  tokenLimit,
116
116
  uiTelemetryService
117
- } from "./chunk-KDPC3L34.js";
117
+ } from "./chunk-IK4ISYCE.js";
118
118
  import {
119
119
  escape,
120
120
  glob,
@@ -9998,7 +9998,7 @@ var require_ignore = __commonJS({
9998
9998
  // path matching.
9999
9999
  // - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`
10000
10000
  // @returns {TestResult} true if a file is ignored
10001
- test(path66, checkUnignored, mode) {
10001
+ test(path67, checkUnignored, mode) {
10002
10002
  let ignored = false;
10003
10003
  let unignored = false;
10004
10004
  let matchedRule;
@@ -10007,7 +10007,7 @@ var require_ignore = __commonJS({
10007
10007
  if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
10008
10008
  return;
10009
10009
  }
10010
- const matched = rule[mode].test(path66);
10010
+ const matched = rule[mode].test(path67);
10011
10011
  if (!matched) {
10012
10012
  return;
10013
10013
  }
@@ -10028,17 +10028,17 @@ var require_ignore = __commonJS({
10028
10028
  var throwError = /* @__PURE__ */ __name((message, Ctor) => {
10029
10029
  throw new Ctor(message);
10030
10030
  }, "throwError");
10031
- var checkPath = /* @__PURE__ */ __name((path66, originalPath, doThrow) => {
10032
- if (!isString(path66)) {
10031
+ var checkPath = /* @__PURE__ */ __name((path67, originalPath, doThrow) => {
10032
+ if (!isString(path67)) {
10033
10033
  return doThrow(
10034
10034
  `path must be a string, but got \`${originalPath}\``,
10035
10035
  TypeError
10036
10036
  );
10037
10037
  }
10038
- if (!path66) {
10038
+ if (!path67) {
10039
10039
  return doThrow(`path must not be empty`, TypeError);
10040
10040
  }
10041
- if (checkPath.isNotRelative(path66)) {
10041
+ if (checkPath.isNotRelative(path67)) {
10042
10042
  const r2 = "`path.relative()`d";
10043
10043
  return doThrow(
10044
10044
  `path should be a ${r2} string, but got "${originalPath}"`,
@@ -10047,7 +10047,7 @@ var require_ignore = __commonJS({
10047
10047
  }
10048
10048
  return true;
10049
10049
  }, "checkPath");
10050
- var isNotRelative = /* @__PURE__ */ __name((path66) => REGEX_TEST_INVALID_PATH.test(path66), "isNotRelative");
10050
+ var isNotRelative = /* @__PURE__ */ __name((path67) => REGEX_TEST_INVALID_PATH.test(path67), "isNotRelative");
10051
10051
  checkPath.isNotRelative = isNotRelative;
10052
10052
  checkPath.convert = (p) => p;
10053
10053
  var Ignore2 = class {
@@ -10080,19 +10080,19 @@ var require_ignore = __commonJS({
10080
10080
  }
10081
10081
  // @returns {TestResult}
10082
10082
  _test(originalPath, cache2, checkUnignored, slices) {
10083
- const path66 = originalPath && checkPath.convert(originalPath);
10083
+ const path67 = originalPath && checkPath.convert(originalPath);
10084
10084
  checkPath(
10085
- path66,
10085
+ path67,
10086
10086
  originalPath,
10087
10087
  this._strictPathCheck ? throwError : RETURN_FALSE
10088
10088
  );
10089
- return this._t(path66, cache2, checkUnignored, slices);
10089
+ return this._t(path67, cache2, checkUnignored, slices);
10090
10090
  }
10091
- checkIgnore(path66) {
10092
- if (!REGEX_TEST_TRAILING_SLASH.test(path66)) {
10093
- return this.test(path66);
10091
+ checkIgnore(path67) {
10092
+ if (!REGEX_TEST_TRAILING_SLASH.test(path67)) {
10093
+ return this.test(path67);
10094
10094
  }
10095
- const slices = path66.split(SLASH).filter(Boolean);
10095
+ const slices = path67.split(SLASH).filter(Boolean);
10096
10096
  slices.pop();
10097
10097
  if (slices.length) {
10098
10098
  const parent = this._t(
@@ -10105,18 +10105,18 @@ var require_ignore = __commonJS({
10105
10105
  return parent;
10106
10106
  }
10107
10107
  }
10108
- return this._rules.test(path66, false, MODE_CHECK_IGNORE);
10108
+ return this._rules.test(path67, false, MODE_CHECK_IGNORE);
10109
10109
  }
10110
- _t(path66, cache2, checkUnignored, slices) {
10111
- if (path66 in cache2) {
10112
- return cache2[path66];
10110
+ _t(path67, cache2, checkUnignored, slices) {
10111
+ if (path67 in cache2) {
10112
+ return cache2[path67];
10113
10113
  }
10114
10114
  if (!slices) {
10115
- slices = path66.split(SLASH).filter(Boolean);
10115
+ slices = path67.split(SLASH).filter(Boolean);
10116
10116
  }
10117
10117
  slices.pop();
10118
10118
  if (!slices.length) {
10119
- return cache2[path66] = this._rules.test(path66, checkUnignored, MODE_IGNORE);
10119
+ return cache2[path67] = this._rules.test(path67, checkUnignored, MODE_IGNORE);
10120
10120
  }
10121
10121
  const parent = this._t(
10122
10122
  slices.join(SLASH) + SLASH,
@@ -10124,29 +10124,29 @@ var require_ignore = __commonJS({
10124
10124
  checkUnignored,
10125
10125
  slices
10126
10126
  );
10127
- return cache2[path66] = parent.ignored ? parent : this._rules.test(path66, checkUnignored, MODE_IGNORE);
10127
+ return cache2[path67] = parent.ignored ? parent : this._rules.test(path67, checkUnignored, MODE_IGNORE);
10128
10128
  }
10129
- ignores(path66) {
10130
- return this._test(path66, this._ignoreCache, false).ignored;
10129
+ ignores(path67) {
10130
+ return this._test(path67, this._ignoreCache, false).ignored;
10131
10131
  }
10132
10132
  createFilter() {
10133
- return (path66) => !this.ignores(path66);
10133
+ return (path67) => !this.ignores(path67);
10134
10134
  }
10135
10135
  filter(paths) {
10136
10136
  return makeArray(paths).filter(this.createFilter());
10137
10137
  }
10138
10138
  // @returns {TestResult}
10139
- test(path66) {
10140
- return this._test(path66, this._testCache, true);
10139
+ test(path67) {
10140
+ return this._test(path67, this._testCache, true);
10141
10141
  }
10142
10142
  };
10143
10143
  var factory = /* @__PURE__ */ __name((options2) => new Ignore2(options2), "factory");
10144
- var isPathValid = /* @__PURE__ */ __name((path66) => checkPath(path66 && checkPath.convert(path66), path66, RETURN_FALSE), "isPathValid");
10144
+ var isPathValid = /* @__PURE__ */ __name((path67) => checkPath(path67 && checkPath.convert(path67), path67, RETURN_FALSE), "isPathValid");
10145
10145
  var setupWindows = /* @__PURE__ */ __name(() => {
10146
10146
  const makePosix = /* @__PURE__ */ __name((str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/"), "makePosix");
10147
10147
  checkPath.convert = makePosix;
10148
10148
  const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
10149
- checkPath.isNotRelative = (path66) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path66) || isNotRelative(path66);
10149
+ checkPath.isNotRelative = (path67) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path67) || isNotRelative(path67);
10150
10150
  }, "setupWindows");
10151
10151
  if (
10152
10152
  // Detect `process` so that it can run in browsers.
@@ -10173,10 +10173,10 @@ var require_src3 = __commonJS({
10173
10173
  var fs_1 = __require("fs");
10174
10174
  var debug_1 = __importDefault(require_src());
10175
10175
  var log = debug_1.default("@kwsites/file-exists");
10176
- function check2(path66, isFile, isDirectory) {
10177
- log(`checking %s`, path66);
10176
+ function check2(path67, isFile, isDirectory) {
10177
+ log(`checking %s`, path67);
10178
10178
  try {
10179
- const stat3 = fs_1.statSync(path66);
10179
+ const stat3 = fs_1.statSync(path67);
10180
10180
  if (stat3.isFile() && isFile) {
10181
10181
  log(`[OK] path represents a file`);
10182
10182
  return true;
@@ -10197,8 +10197,8 @@ var require_src3 = __commonJS({
10197
10197
  }
10198
10198
  }
10199
10199
  __name(check2, "check");
10200
- function exists2(path66, type = exports2.READABLE) {
10201
- return check2(path66, (type & exports2.FILE) > 0, (type & exports2.FOLDER) > 0);
10200
+ function exists2(path67, type = exports2.READABLE) {
10201
+ return check2(path67, (type & exports2.FILE) > 0, (type & exports2.FOLDER) > 0);
10202
10202
  }
10203
10203
  __name(exists2, "exists");
10204
10204
  exports2.exists = exists2;
@@ -16369,7 +16369,7 @@ var require_windows = __commonJS({
16369
16369
  module2.exports = isexe;
16370
16370
  isexe.sync = sync;
16371
16371
  var fs53 = __require("fs");
16372
- function checkPathExt(path66, options2) {
16372
+ function checkPathExt(path67, options2) {
16373
16373
  var pathext = options2.pathExt !== void 0 ? options2.pathExt : process.env.PATHEXT;
16374
16374
  if (!pathext) {
16375
16375
  return true;
@@ -16380,28 +16380,28 @@ var require_windows = __commonJS({
16380
16380
  }
16381
16381
  for (var i = 0; i < pathext.length; i++) {
16382
16382
  var p = pathext[i].toLowerCase();
16383
- if (p && path66.substr(-p.length).toLowerCase() === p) {
16383
+ if (p && path67.substr(-p.length).toLowerCase() === p) {
16384
16384
  return true;
16385
16385
  }
16386
16386
  }
16387
16387
  return false;
16388
16388
  }
16389
16389
  __name(checkPathExt, "checkPathExt");
16390
- function checkStat(stat3, path66, options2) {
16390
+ function checkStat(stat3, path67, options2) {
16391
16391
  if (!stat3.isSymbolicLink() && !stat3.isFile()) {
16392
16392
  return false;
16393
16393
  }
16394
- return checkPathExt(path66, options2);
16394
+ return checkPathExt(path67, options2);
16395
16395
  }
16396
16396
  __name(checkStat, "checkStat");
16397
- function isexe(path66, options2, cb) {
16398
- fs53.stat(path66, function(er, stat3) {
16399
- cb(er, er ? false : checkStat(stat3, path66, options2));
16397
+ function isexe(path67, options2, cb) {
16398
+ fs53.stat(path67, function(er, stat3) {
16399
+ cb(er, er ? false : checkStat(stat3, path67, options2));
16400
16400
  });
16401
16401
  }
16402
16402
  __name(isexe, "isexe");
16403
- function sync(path66, options2) {
16404
- return checkStat(fs53.statSync(path66), path66, options2);
16403
+ function sync(path67, options2) {
16404
+ return checkStat(fs53.statSync(path67), path67, options2);
16405
16405
  }
16406
16406
  __name(sync, "sync");
16407
16407
  }
@@ -16414,14 +16414,14 @@ var require_mode = __commonJS({
16414
16414
  module2.exports = isexe;
16415
16415
  isexe.sync = sync;
16416
16416
  var fs53 = __require("fs");
16417
- function isexe(path66, options2, cb) {
16418
- fs53.stat(path66, function(er, stat3) {
16417
+ function isexe(path67, options2, cb) {
16418
+ fs53.stat(path67, function(er, stat3) {
16419
16419
  cb(er, er ? false : checkStat(stat3, options2));
16420
16420
  });
16421
16421
  }
16422
16422
  __name(isexe, "isexe");
16423
- function sync(path66, options2) {
16424
- return checkStat(fs53.statSync(path66), options2);
16423
+ function sync(path67, options2) {
16424
+ return checkStat(fs53.statSync(path67), options2);
16425
16425
  }
16426
16426
  __name(sync, "sync");
16427
16427
  function checkStat(stat3, options2) {
@@ -16458,7 +16458,7 @@ var require_isexe = __commonJS({
16458
16458
  }
16459
16459
  module2.exports = isexe;
16460
16460
  isexe.sync = sync;
16461
- function isexe(path66, options2, cb) {
16461
+ function isexe(path67, options2, cb) {
16462
16462
  if (typeof options2 === "function") {
16463
16463
  cb = options2;
16464
16464
  options2 = {};
@@ -16468,7 +16468,7 @@ var require_isexe = __commonJS({
16468
16468
  throw new TypeError("callback not provided");
16469
16469
  }
16470
16470
  return new Promise(function(resolve17, reject) {
16471
- isexe(path66, options2 || {}, function(er, is) {
16471
+ isexe(path67, options2 || {}, function(er, is) {
16472
16472
  if (er) {
16473
16473
  reject(er);
16474
16474
  } else {
@@ -16477,7 +16477,7 @@ var require_isexe = __commonJS({
16477
16477
  });
16478
16478
  });
16479
16479
  }
16480
- core(path66, options2 || {}, function(er, is) {
16480
+ core(path67, options2 || {}, function(er, is) {
16481
16481
  if (er) {
16482
16482
  if (er.code === "EACCES" || options2 && options2.ignoreErrors) {
16483
16483
  er = null;
@@ -16488,9 +16488,9 @@ var require_isexe = __commonJS({
16488
16488
  });
16489
16489
  }
16490
16490
  __name(isexe, "isexe");
16491
- function sync(path66, options2) {
16491
+ function sync(path67, options2) {
16492
16492
  try {
16493
- return core.sync(path66, options2 || {});
16493
+ return core.sync(path67, options2 || {});
16494
16494
  } catch (er) {
16495
16495
  if (options2 && options2.ignoreErrors || er.code === "EACCES") {
16496
16496
  return false;
@@ -16508,7 +16508,7 @@ var require_which = __commonJS({
16508
16508
  "node_modules/which/which.js"(exports2, module2) {
16509
16509
  init_esbuild_shims();
16510
16510
  var isWindows2 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
16511
- var path66 = __require("path");
16511
+ var path67 = __require("path");
16512
16512
  var COLON = isWindows2 ? ";" : ":";
16513
16513
  var isexe = require_isexe();
16514
16514
  var getNotFoundError = /* @__PURE__ */ __name((cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" }), "getNotFoundError");
@@ -16546,7 +16546,7 @@ var require_which = __commonJS({
16546
16546
  return opt.all && found.length ? resolve17(found) : reject(getNotFoundError(cmd));
16547
16547
  const ppRaw = pathEnv[i];
16548
16548
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
16549
- const pCmd = path66.join(pathPart, cmd);
16549
+ const pCmd = path67.join(pathPart, cmd);
16550
16550
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
16551
16551
  resolve17(subStep(p, i, 0));
16552
16552
  }), "step");
@@ -16573,7 +16573,7 @@ var require_which = __commonJS({
16573
16573
  for (let i = 0; i < pathEnv.length; i++) {
16574
16574
  const ppRaw = pathEnv[i];
16575
16575
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
16576
- const pCmd = path66.join(pathPart, cmd);
16576
+ const pCmd = path67.join(pathPart, cmd);
16577
16577
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
16578
16578
  for (let j = 0; j < pathExt.length; j++) {
16579
16579
  const cur = p + pathExt[j];
@@ -16623,7 +16623,7 @@ var require_resolveCommand = __commonJS({
16623
16623
  "node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) {
16624
16624
  "use strict";
16625
16625
  init_esbuild_shims();
16626
- var path66 = __require("path");
16626
+ var path67 = __require("path");
16627
16627
  var which = require_which();
16628
16628
  var getPathKey = require_path_key();
16629
16629
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -16641,7 +16641,7 @@ var require_resolveCommand = __commonJS({
16641
16641
  try {
16642
16642
  resolved = which.sync(parsed.command, {
16643
16643
  path: env3[getPathKey({ env: env3 })],
16644
- pathExt: withoutPathExt ? path66.delimiter : void 0
16644
+ pathExt: withoutPathExt ? path67.delimiter : void 0
16645
16645
  });
16646
16646
  } catch (e2) {
16647
16647
  } finally {
@@ -16650,7 +16650,7 @@ var require_resolveCommand = __commonJS({
16650
16650
  }
16651
16651
  }
16652
16652
  if (resolved) {
16653
- resolved = path66.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
16653
+ resolved = path67.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
16654
16654
  }
16655
16655
  return resolved;
16656
16656
  }
@@ -16711,8 +16711,8 @@ var require_shebang_command = __commonJS({
16711
16711
  if (!match) {
16712
16712
  return null;
16713
16713
  }
16714
- const [path66, argument] = match[0].replace(/#! ?/, "").split(" ");
16715
- const binary = path66.split("/").pop();
16714
+ const [path67, argument] = match[0].replace(/#! ?/, "").split(" ");
16715
+ const binary = path67.split("/").pop();
16716
16716
  if (binary === "env") {
16717
16717
  return argument;
16718
16718
  }
@@ -16750,7 +16750,7 @@ var require_parse2 = __commonJS({
16750
16750
  "node_modules/cross-spawn/lib/parse.js"(exports2, module2) {
16751
16751
  "use strict";
16752
16752
  init_esbuild_shims();
16753
- var path66 = __require("path");
16753
+ var path67 = __require("path");
16754
16754
  var resolveCommand2 = require_resolveCommand();
16755
16755
  var escape5 = require_escape();
16756
16756
  var readShebang = require_readShebang();
@@ -16776,7 +16776,7 @@ var require_parse2 = __commonJS({
16776
16776
  const needsShell = !isExecutableRegExp.test(commandFile);
16777
16777
  if (parsed.options.forceShell || needsShell) {
16778
16778
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
16779
- parsed.command = path66.normalize(parsed.command);
16779
+ parsed.command = path67.normalize(parsed.command);
16780
16780
  parsed.command = escape5.command(parsed.command);
16781
16781
  parsed.args = parsed.args.map((arg) => escape5.argument(arg, needsDoubleEscapeMetaChars));
16782
16782
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -17267,8 +17267,8 @@ var require_utils2 = __commonJS({
17267
17267
  }
17268
17268
  return output;
17269
17269
  };
17270
- exports2.basename = (path66, { windows } = {}) => {
17271
- const segs = path66.split(windows ? /[\\/]/ : "/");
17270
+ exports2.basename = (path67, { windows } = {}) => {
17271
+ const segs = path67.split(windows ? /[\\/]/ : "/");
17272
17272
  const last2 = segs[segs.length - 1];
17273
17273
  if (last2 === "") {
17274
17274
  return segs[segs.length - 2];
@@ -18546,8 +18546,8 @@ var require_utils3 = __commonJS({
18546
18546
  Object.defineProperty(exports2, "__esModule", { value: true });
18547
18547
  exports2.normalizePath = exports2.isRootDirectory = exports2.convertSlashes = exports2.cleanPath = void 0;
18548
18548
  var path_1 = __require("path");
18549
- function cleanPath(path66) {
18550
- let normalized2 = (0, path_1.normalize)(path66);
18549
+ function cleanPath(path67) {
18550
+ let normalized2 = (0, path_1.normalize)(path67);
18551
18551
  if (normalized2.length > 1 && normalized2[normalized2.length - 1] === path_1.sep)
18552
18552
  normalized2 = normalized2.substring(0, normalized2.length - 1);
18553
18553
  return normalized2;
@@ -18555,28 +18555,28 @@ var require_utils3 = __commonJS({
18555
18555
  __name(cleanPath, "cleanPath");
18556
18556
  exports2.cleanPath = cleanPath;
18557
18557
  var SLASHES_REGEX = /[\\/]/g;
18558
- function convertSlashes(path66, separator) {
18559
- return path66.replace(SLASHES_REGEX, separator);
18558
+ function convertSlashes(path67, separator) {
18559
+ return path67.replace(SLASHES_REGEX, separator);
18560
18560
  }
18561
18561
  __name(convertSlashes, "convertSlashes");
18562
18562
  exports2.convertSlashes = convertSlashes;
18563
18563
  var WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
18564
- function isRootDirectory(path66) {
18565
- return path66 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path66);
18564
+ function isRootDirectory(path67) {
18565
+ return path67 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path67);
18566
18566
  }
18567
18567
  __name(isRootDirectory, "isRootDirectory");
18568
18568
  exports2.isRootDirectory = isRootDirectory;
18569
- function normalizePath(path66, options2) {
18569
+ function normalizePath(path67, options2) {
18570
18570
  const { resolvePaths, normalizePath: normalizePath2, pathSeparator } = options2;
18571
- const pathNeedsCleaning = process.platform === "win32" && path66.includes("/") || path66.startsWith(".");
18571
+ const pathNeedsCleaning = process.platform === "win32" && path67.includes("/") || path67.startsWith(".");
18572
18572
  if (resolvePaths)
18573
- path66 = (0, path_1.resolve)(path66);
18573
+ path67 = (0, path_1.resolve)(path67);
18574
18574
  if (normalizePath2 || pathNeedsCleaning)
18575
- path66 = cleanPath(path66);
18576
- if (path66 === ".")
18575
+ path67 = cleanPath(path67);
18576
+ if (path67 === ".")
18577
18577
  return "";
18578
- const needsSeperator = path66[path66.length - 1] !== pathSeparator;
18579
- return convertSlashes(needsSeperator ? path66 + pathSeparator : path66, pathSeparator);
18578
+ const needsSeperator = path67[path67.length - 1] !== pathSeparator;
18579
+ return convertSlashes(needsSeperator ? path67 + pathSeparator : path67, pathSeparator);
18580
18580
  }
18581
18581
  __name(normalizePath, "normalizePath");
18582
18582
  exports2.normalizePath = normalizePath;
@@ -18651,9 +18651,9 @@ var require_push_directory = __commonJS({
18651
18651
  paths.push(directoryPath || ".");
18652
18652
  }, "pushDirectory");
18653
18653
  var pushDirectoryFilter = /* @__PURE__ */ __name((directoryPath, paths, filters) => {
18654
- const path66 = directoryPath || ".";
18655
- if (filters.every((filter3) => filter3(path66, true))) {
18656
- paths.push(path66);
18654
+ const path67 = directoryPath || ".";
18655
+ if (filters.every((filter3) => filter3(path67, true))) {
18656
+ paths.push(path67);
18657
18657
  }
18658
18658
  }, "pushDirectoryFilter");
18659
18659
  var empty = /* @__PURE__ */ __name(() => {
@@ -18764,29 +18764,29 @@ var require_resolve_symlink = __commonJS({
18764
18764
  exports2.build = void 0;
18765
18765
  var fs_1 = __importDefault(__require("fs"));
18766
18766
  var path_1 = __require("path");
18767
- var resolveSymlinksAsync = /* @__PURE__ */ __name(function(path66, state, callback) {
18767
+ var resolveSymlinksAsync = /* @__PURE__ */ __name(function(path67, state, callback) {
18768
18768
  const { queue, options: { suppressErrors } } = state;
18769
18769
  queue.enqueue();
18770
- fs_1.default.realpath(path66, (error2, resolvedPath) => {
18770
+ fs_1.default.realpath(path67, (error2, resolvedPath) => {
18771
18771
  if (error2)
18772
18772
  return queue.dequeue(suppressErrors ? null : error2, state);
18773
18773
  fs_1.default.stat(resolvedPath, (error3, stat3) => {
18774
18774
  if (error3)
18775
18775
  return queue.dequeue(suppressErrors ? null : error3, state);
18776
- if (stat3.isDirectory() && isRecursive(path66, resolvedPath, state))
18776
+ if (stat3.isDirectory() && isRecursive(path67, resolvedPath, state))
18777
18777
  return queue.dequeue(null, state);
18778
18778
  callback(stat3, resolvedPath);
18779
18779
  queue.dequeue(null, state);
18780
18780
  });
18781
18781
  });
18782
18782
  }, "resolveSymlinksAsync");
18783
- var resolveSymlinks = /* @__PURE__ */ __name(function(path66, state, callback) {
18783
+ var resolveSymlinks = /* @__PURE__ */ __name(function(path67, state, callback) {
18784
18784
  const { queue, options: { suppressErrors } } = state;
18785
18785
  queue.enqueue();
18786
18786
  try {
18787
- const resolvedPath = fs_1.default.realpathSync(path66);
18787
+ const resolvedPath = fs_1.default.realpathSync(path67);
18788
18788
  const stat3 = fs_1.default.statSync(resolvedPath);
18789
- if (stat3.isDirectory() && isRecursive(path66, resolvedPath, state))
18789
+ if (stat3.isDirectory() && isRecursive(path67, resolvedPath, state))
18790
18790
  return;
18791
18791
  callback(stat3, resolvedPath);
18792
18792
  } catch (e2) {
@@ -18801,10 +18801,10 @@ var require_resolve_symlink = __commonJS({
18801
18801
  }
18802
18802
  __name(build, "build");
18803
18803
  exports2.build = build;
18804
- function isRecursive(path66, resolved, state) {
18804
+ function isRecursive(path67, resolved, state) {
18805
18805
  if (state.options.useRealPaths)
18806
18806
  return isRecursiveUsingRealPaths(resolved, state);
18807
- let parent = (0, path_1.dirname)(path66);
18807
+ let parent = (0, path_1.dirname)(path67);
18808
18808
  let depth = 1;
18809
18809
  while (parent !== state.root && depth < 2) {
18810
18810
  const resolvedPath = state.symlinks.get(parent);
@@ -18814,7 +18814,7 @@ var require_resolve_symlink = __commonJS({
18814
18814
  else
18815
18815
  parent = (0, path_1.dirname)(parent);
18816
18816
  }
18817
- state.symlinks.set(path66, resolved);
18817
+ state.symlinks.set(path67, resolved);
18818
18818
  return depth > 1;
18819
18819
  }
18820
18820
  __name(isRecursive, "isRecursive");
@@ -19100,21 +19100,21 @@ var require_walker = __commonJS({
19100
19100
  const filename = this.joinPath(entry.name, directoryPath);
19101
19101
  this.pushFile(filename, files, this.state.counts, filters);
19102
19102
  } else if (entry.isDirectory()) {
19103
- let path66 = joinPath.joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
19104
- if (exclude && exclude(entry.name, path66))
19103
+ let path67 = joinPath.joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
19104
+ if (exclude && exclude(entry.name, path67))
19105
19105
  continue;
19106
- this.pushDirectory(path66, paths, filters);
19107
- this.walkDirectory(this.state, path66, path66, depth - 1, this.walk);
19106
+ this.pushDirectory(path67, paths, filters);
19107
+ this.walkDirectory(this.state, path67, path67, depth - 1, this.walk);
19108
19108
  } else if (this.resolveSymlink && entry.isSymbolicLink()) {
19109
- let path66 = joinPath.joinPathWithBasePath(entry.name, directoryPath);
19110
- this.resolveSymlink(path66, this.state, (stat3, resolvedPath) => {
19109
+ let path67 = joinPath.joinPathWithBasePath(entry.name, directoryPath);
19110
+ this.resolveSymlink(path67, this.state, (stat3, resolvedPath) => {
19111
19111
  if (stat3.isDirectory()) {
19112
19112
  resolvedPath = (0, utils_1.normalizePath)(resolvedPath, this.state.options);
19113
- if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path66 + pathSeparator))
19113
+ if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path67 + pathSeparator))
19114
19114
  return;
19115
- this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path66 + pathSeparator, depth - 1, this.walk);
19115
+ this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path67 + pathSeparator, depth - 1, this.walk);
19116
19116
  } else {
19117
- resolvedPath = useRealPaths ? resolvedPath : path66;
19117
+ resolvedPath = useRealPaths ? resolvedPath : path67;
19118
19118
  const filename = (0, path_1.basename)(resolvedPath);
19119
19119
  const directoryPath2 = (0, utils_1.normalizePath)((0, path_1.dirname)(resolvedPath), this.state.options);
19120
19120
  resolvedPath = this.joinPath(filename, directoryPath2);
@@ -19341,7 +19341,7 @@ var require_builder = __commonJS({
19341
19341
  isMatch = globFn(patterns, ...options2);
19342
19342
  this.globCache[patterns.join("\0")] = isMatch;
19343
19343
  }
19344
- this.options.filters.push((path66) => isMatch(path66));
19344
+ this.options.filters.push((path67) => isMatch(path67));
19345
19345
  return this;
19346
19346
  }
19347
19347
  };
@@ -21490,6 +21490,27 @@ init_esbuild_shims();
21490
21490
 
21491
21491
  // packages/core/dist/src/telemetry/config.js
21492
21492
  init_esbuild_shims();
21493
+ var warnedLegacyEnvVars = /* @__PURE__ */ new Set();
21494
+ function warnLegacyEnvVar(legacyName, canonicalName) {
21495
+ if (warnedLegacyEnvVars.has(legacyName)) {
21496
+ return;
21497
+ }
21498
+ warnedLegacyEnvVars.add(legacyName);
21499
+ console.warn(`[DEPRECATION] Environment variable ${legacyName} is deprecated. Use ${canonicalName} instead.`);
21500
+ }
21501
+ __name(warnLegacyEnvVar, "warnLegacyEnvVar");
21502
+ function resolveEnvAlias(env3, canonicalName, legacyName) {
21503
+ const canonicalValue = env3[canonicalName];
21504
+ if (canonicalValue !== void 0) {
21505
+ return canonicalValue;
21506
+ }
21507
+ const legacyValue = env3[legacyName];
21508
+ if (legacyValue !== void 0) {
21509
+ warnLegacyEnvVar(legacyName, canonicalName);
21510
+ }
21511
+ return legacyValue;
21512
+ }
21513
+ __name(resolveEnvAlias, "resolveEnvAlias");
21493
21514
  function parseBooleanEnvFlag(value) {
21494
21515
  if (value === void 0)
21495
21516
  return void 0;
@@ -21512,21 +21533,21 @@ async function resolveTelemetrySettings(options2) {
21512
21533
  const argv = options2.argv ?? {};
21513
21534
  const env3 = options2.env ?? {};
21514
21535
  const settings = options2.settings ?? {};
21515
- const enabled = argv.telemetry ?? parseBooleanEnvFlag(env3["GEMINI_TELEMETRY_ENABLED"]) ?? settings.enabled;
21516
- const rawTarget = argv.telemetryTarget ?? env3["GEMINI_TELEMETRY_TARGET"] ?? settings.target;
21536
+ const enabled = argv.telemetry ?? parseBooleanEnvFlag(resolveEnvAlias(env3, "PAPERT_TELEMETRY_ENABLED", "GEMINI_TELEMETRY_ENABLED")) ?? settings.enabled;
21537
+ const rawTarget = argv.telemetryTarget ?? resolveEnvAlias(env3, "PAPERT_TELEMETRY_TARGET", "GEMINI_TELEMETRY_TARGET") ?? settings.target;
21517
21538
  const target = parseTelemetryTargetValue(rawTarget);
21518
21539
  if (rawTarget !== void 0 && target === void 0) {
21519
21540
  throw new FatalConfigError(`Invalid telemetry target: ${String(rawTarget)}. Valid values are: local, gcp`);
21520
21541
  }
21521
- const otlpEndpoint = argv.telemetryOtlpEndpoint ?? env3["GEMINI_TELEMETRY_OTLP_ENDPOINT"] ?? env3["OTEL_EXPORTER_OTLP_ENDPOINT"] ?? settings.otlpEndpoint;
21522
- const rawProtocol = argv.telemetryOtlpProtocol ?? env3["GEMINI_TELEMETRY_OTLP_PROTOCOL"] ?? settings.otlpProtocol;
21542
+ const otlpEndpoint = argv.telemetryOtlpEndpoint ?? resolveEnvAlias(env3, "PAPERT_TELEMETRY_OTLP_ENDPOINT", "GEMINI_TELEMETRY_OTLP_ENDPOINT") ?? env3["OTEL_EXPORTER_OTLP_ENDPOINT"] ?? settings.otlpEndpoint;
21543
+ const rawProtocol = argv.telemetryOtlpProtocol ?? resolveEnvAlias(env3, "PAPERT_TELEMETRY_OTLP_PROTOCOL", "GEMINI_TELEMETRY_OTLP_PROTOCOL") ?? settings.otlpProtocol;
21523
21544
  const otlpProtocol = ["grpc", "http"].find((p) => p === rawProtocol);
21524
21545
  if (rawProtocol !== void 0 && otlpProtocol === void 0) {
21525
21546
  throw new FatalConfigError(`Invalid telemetry OTLP protocol: ${String(rawProtocol)}. Valid values are: grpc, http`);
21526
21547
  }
21527
- const logPrompts = argv.telemetryLogPrompts ?? parseBooleanEnvFlag(env3["GEMINI_TELEMETRY_LOG_PROMPTS"]) ?? settings.logPrompts;
21528
- const outfile = argv.telemetryOutfile ?? env3["GEMINI_TELEMETRY_OUTFILE"] ?? settings.outfile;
21529
- const useCollector = parseBooleanEnvFlag(env3["GEMINI_TELEMETRY_USE_COLLECTOR"]) ?? settings.useCollector;
21548
+ const logPrompts = argv.telemetryLogPrompts ?? parseBooleanEnvFlag(resolveEnvAlias(env3, "PAPERT_TELEMETRY_LOG_PROMPTS", "GEMINI_TELEMETRY_LOG_PROMPTS")) ?? settings.logPrompts;
21549
+ const outfile = argv.telemetryOutfile ?? resolveEnvAlias(env3, "PAPERT_TELEMETRY_OUTFILE", "GEMINI_TELEMETRY_OUTFILE") ?? settings.outfile;
21550
+ const useCollector = parseBooleanEnvFlag(resolveEnvAlias(env3, "PAPERT_TELEMETRY_USE_COLLECTOR", "GEMINI_TELEMETRY_USE_COLLECTOR")) ?? settings.useCollector;
21530
21551
  return {
21531
21552
  enabled,
21532
21553
  target,
@@ -22359,7 +22380,7 @@ init_esbuild_shims();
22359
22380
  // packages/core/dist/src/config/config.js
22360
22381
  init_esbuild_shims();
22361
22382
  var import_undici3 = __toESM(require_undici(), 1);
22362
- import * as path54 from "node:path";
22383
+ import * as path55 from "node:path";
22363
22384
  import process7 from "node:process";
22364
22385
 
22365
22386
  // packages/core/dist/src/core/baseLlmClient.js
@@ -22873,7 +22894,7 @@ async function retryWithBackoff(fn, options2) {
22873
22894
  const classifiedError = classifyGoogleError(error2);
22874
22895
  const errorCode = getErrorStatus(error2);
22875
22896
  if (classifiedError instanceof TerminalQuotaError || classifiedError instanceof ModelNotFoundError) {
22876
- if (onPersistent429 && authType !== AuthType.PAPERT_OAUTH) {
22897
+ if (onPersistent429) {
22877
22898
  try {
22878
22899
  const fallbackModel = await onPersistent429(authType, classifiedError);
22879
22900
  if (fallbackModel) {
@@ -22890,7 +22911,7 @@ async function retryWithBackoff(fn, options2) {
22890
22911
  const is500 = errorCode !== void 0 && errorCode >= 500 && errorCode < 600;
22891
22912
  if (classifiedError instanceof RetryableQuotaError || is500) {
22892
22913
  if (attempt >= maxAttempts) {
22893
- if (onPersistent429 && authType !== AuthType.PAPERT_OAUTH) {
22914
+ if (onPersistent429) {
22894
22915
  try {
22895
22916
  const fallbackModel = await onPersistent429(authType, classifiedError);
22896
22917
  if (fallbackModel) {
@@ -23567,6 +23588,34 @@ __name(openBrowserSecurely, "openBrowserSecurely");
23567
23588
 
23568
23589
  // packages/core/dist/src/availability/errorClassification.js
23569
23590
  init_esbuild_shims();
23591
+ var TERMINAL_MESSAGE_PATTERNS = [
23592
+ /\binsufficient[_\s-]?quota\b/i,
23593
+ /\bquota exceeded\b/i,
23594
+ /\bbilling.*(limit|exceeded)\b/i,
23595
+ /\bunauthorized\b/i,
23596
+ /\bforbidden\b/i,
23597
+ /\binvalid api key\b/i,
23598
+ /\bauthentication\b/i
23599
+ ];
23600
+ var TRANSIENT_MESSAGE_PATTERNS = [
23601
+ /\brate limit\b/i,
23602
+ /\btoo many requests\b/i,
23603
+ /\btemporar(?:y|ily)\b/i,
23604
+ /\bplease retry\b/i,
23605
+ /\btimeout\b/i,
23606
+ /\bservice unavailable\b/i
23607
+ ];
23608
+ var MODEL_NOT_FOUND_PATTERNS = [
23609
+ /\bmodel\b.*\bnot found\b/i,
23610
+ /\bunknown model\b/i
23611
+ ];
23612
+ function getErrorMessage2(error2) {
23613
+ if (error2 instanceof Error) {
23614
+ return error2.message;
23615
+ }
23616
+ return String(error2 ?? "");
23617
+ }
23618
+ __name(getErrorMessage2, "getErrorMessage");
23570
23619
  function classifyFailureKind(error2) {
23571
23620
  if (error2 instanceof TerminalQuotaError) {
23572
23621
  return "terminal";
@@ -23577,6 +23626,28 @@ function classifyFailureKind(error2) {
23577
23626
  if (error2 instanceof ModelNotFoundError) {
23578
23627
  return "not_found";
23579
23628
  }
23629
+ const status = getErrorStatus(error2);
23630
+ if (status === 404) {
23631
+ return "not_found";
23632
+ }
23633
+ if (status === 401 || status === 402 || status === 403) {
23634
+ return "terminal";
23635
+ }
23636
+ if (typeof status === "number") {
23637
+ if (status === 408 || status === 409 || status === 425 || status === 429 || status >= 500 && status < 600) {
23638
+ return "transient";
23639
+ }
23640
+ }
23641
+ const message = getErrorMessage2(error2);
23642
+ if (MODEL_NOT_FOUND_PATTERNS.some((pattern) => pattern.test(message))) {
23643
+ return "not_found";
23644
+ }
23645
+ if (TERMINAL_MESSAGE_PATTERNS.some((pattern) => pattern.test(message))) {
23646
+ return "terminal";
23647
+ }
23648
+ if (TRANSIENT_MESSAGE_PATTERNS.some((pattern) => pattern.test(message))) {
23649
+ return "transient";
23650
+ }
23580
23651
  return "unknown";
23581
23652
  }
23582
23653
  __name(classifyFailureKind, "classifyFailureKind");
@@ -23594,9 +23665,9 @@ var DEFAULT_ACTIONS = {
23594
23665
  };
23595
23666
  var DEFAULT_STATE = {
23596
23667
  terminal: "terminal",
23597
- transient: "terminal",
23668
+ transient: "sticky_retry",
23598
23669
  not_found: "terminal",
23599
- unknown: "terminal"
23670
+ unknown: "transient"
23600
23671
  };
23601
23672
  var DEFAULT_CHAIN = [
23602
23673
  definePolicy({ model: DEFAULT_GEMINI_MODEL }),
@@ -23621,6 +23692,19 @@ function createDefaultPolicy(model, options2) {
23621
23692
  return definePolicy({ model, isLastResort: options2?.isLastResort });
23622
23693
  }
23623
23694
  __name(createDefaultPolicy, "createDefaultPolicy");
23695
+ function validateModelPolicyChain(chain2) {
23696
+ if (chain2.length === 0) {
23697
+ throw new Error("Model policy chain must include at least one model.");
23698
+ }
23699
+ const lastResortCount = chain2.filter((policy) => policy.isLastResort).length;
23700
+ if (lastResortCount === 0) {
23701
+ throw new Error("Model policy chain must include an `isLastResort` model.");
23702
+ }
23703
+ if (lastResortCount > 1) {
23704
+ throw new Error("Model policy chain must only have one `isLastResort`.");
23705
+ }
23706
+ }
23707
+ __name(validateModelPolicyChain, "validateModelPolicyChain");
23624
23708
  function definePolicy(config2) {
23625
23709
  return {
23626
23710
  model: config2.model,
@@ -23659,6 +23743,7 @@ function resolvePolicyChain(config2, preferredModel, wrapsAround = false) {
23659
23743
  } else {
23660
23744
  chain2 = createSingleModelChain(modelFromConfig);
23661
23745
  }
23746
+ validateModelPolicyChain(chain2);
23662
23747
  const activeModel = resolveModel(modelFromConfig);
23663
23748
  const activeIndex = chain2.findIndex((policy) => policy.model === activeModel);
23664
23749
  if (activeIndex !== -1) {
@@ -23688,7 +23773,7 @@ function selectModelForAvailability(config2, requestedModel) {
23688
23773
  const selection = config2.getModelAvailabilityService().selectFirstAvailable(chain2.map((p) => p.model));
23689
23774
  if (selection.selectedModel)
23690
23775
  return selection;
23691
- const backupModel = chain2.find((p) => p.isLastResort)?.model ?? DEFAULT_GEMINI_MODEL;
23776
+ const backupModel = chain2.find((p) => p.isLastResort)?.model ?? resolveModel(requestedModel);
23692
23777
  return { selectedModel: backupModel, skipped: [] };
23693
23778
  }
23694
23779
  __name(selectModelForAvailability, "selectModelForAvailability");
@@ -23701,6 +23786,8 @@ function applyAvailabilityTransition(getContext, failureKind) {
23701
23786
  return;
23702
23787
  if (transition === "terminal") {
23703
23788
  context.service.markTerminal(context.policy.model, failureKind === "terminal" ? "quota" : "capacity");
23789
+ } else if (transition === "transient") {
23790
+ context.service.markTransient(context.policy.model);
23704
23791
  } else if (transition === "sticky_retry") {
23705
23792
  context.service.markRetryOncePerTurn(context.policy.model);
23706
23793
  }
@@ -23711,15 +23798,15 @@ __name(applyAvailabilityTransition, "applyAvailabilityTransition");
23711
23798
  var UPGRADE_URL_PAGE = "https://goo.gle/set-up-gemini-code-assist";
23712
23799
  async function handleFallback(config2, failedModel, authType, error2) {
23713
23800
  if (authType === AuthType.PAPERT_OAUTH) {
23714
- return handlePapertOAuthError(error2);
23801
+ const papertResult = await handlePapertOAuthError(error2);
23802
+ if (papertResult) {
23803
+ return papertResult;
23804
+ }
23715
23805
  }
23716
23806
  return handlePolicyDrivenFallback(config2, failedModel, authType, error2);
23717
23807
  }
23718
23808
  __name(handleFallback, "handleFallback");
23719
23809
  async function handlePolicyDrivenFallback(config2, failedModel, authType, error2) {
23720
- if (authType !== AuthType.LOGIN_WITH_GOOGLE) {
23721
- return null;
23722
- }
23723
23810
  const chain2 = resolvePolicyChain(config2);
23724
23811
  const { failedPolicy, candidates } = buildFallbackPolicyContext(chain2, failedModel);
23725
23812
  const failureKind = classifyFailureKind(error2);
@@ -23731,6 +23818,7 @@ async function handlePolicyDrivenFallback(config2, failedModel, authType, error2
23731
23818
  }, "getAvailabilityContext");
23732
23819
  let fallbackModel;
23733
23820
  if (!candidates.length) {
23821
+ applyAvailabilityTransition(getAvailabilityContext, failureKind);
23734
23822
  return null;
23735
23823
  } else {
23736
23824
  const selection = availability.selectFirstAvailable(candidates.map((policy) => policy.model));
@@ -23738,6 +23826,7 @@ async function handlePolicyDrivenFallback(config2, failedModel, authType, error2
23738
23826
  const selectedFallbackModel = selection.selectedModel ?? lastResortPolicy?.model;
23739
23827
  const selectedPolicy = candidates.find((policy) => policy.model === selectedFallbackModel);
23740
23828
  if (!selectedFallbackModel || selectedFallbackModel === failedModel || !selectedPolicy) {
23829
+ applyAvailabilityTransition(getAvailabilityContext, failureKind);
23741
23830
  return null;
23742
23831
  }
23743
23832
  fallbackModel = selectedFallbackModel;
@@ -24644,16 +24733,16 @@ var Diff = class {
24644
24733
  }
24645
24734
  }
24646
24735
  }
24647
- addToPath(path66, added, removed, oldPosInc, options2) {
24648
- const last2 = path66.lastComponent;
24736
+ addToPath(path67, added, removed, oldPosInc, options2) {
24737
+ const last2 = path67.lastComponent;
24649
24738
  if (last2 && !options2.oneChangePerToken && last2.added === added && last2.removed === removed) {
24650
24739
  return {
24651
- oldPos: path66.oldPos + oldPosInc,
24740
+ oldPos: path67.oldPos + oldPosInc,
24652
24741
  lastComponent: { count: last2.count + 1, added, removed, previousComponent: last2.previousComponent }
24653
24742
  };
24654
24743
  } else {
24655
24744
  return {
24656
- oldPos: path66.oldPos + oldPosInc,
24745
+ oldPos: path67.oldPos + oldPosInc,
24657
24746
  lastComponent: { count: 1, added, removed, previousComponent: last2 }
24658
24747
  };
24659
24748
  }
@@ -29449,6 +29538,42 @@ __name(safetyRuleMatches, "safetyRuleMatches");
29449
29538
  import * as fs11 from "node:fs/promises";
29450
29539
  import * as path11 from "node:path";
29451
29540
  var import_fast_levenshtein = __toESM(require_levenshtein(), 1);
29541
+
29542
+ // packages/core/dist/src/policy/types.js
29543
+ init_esbuild_shims();
29544
+ var PolicyDecision;
29545
+ (function(PolicyDecision2) {
29546
+ PolicyDecision2["ALLOW"] = "allow";
29547
+ PolicyDecision2["DENY"] = "deny";
29548
+ PolicyDecision2["ASK_USER"] = "ask_user";
29549
+ })(PolicyDecision || (PolicyDecision = {}));
29550
+ var VALID_HOOK_SOURCES = [
29551
+ "project",
29552
+ "user",
29553
+ "system",
29554
+ "extension"
29555
+ ];
29556
+ function getHookSource(input) {
29557
+ const source = input["hook_source"];
29558
+ if (typeof source === "string" && VALID_HOOK_SOURCES.includes(source)) {
29559
+ return source;
29560
+ }
29561
+ return "project";
29562
+ }
29563
+ __name(getHookSource, "getHookSource");
29564
+ var ApprovalMode;
29565
+ (function(ApprovalMode3) {
29566
+ ApprovalMode3["DEFAULT"] = "default";
29567
+ ApprovalMode3["AUTO_EDIT"] = "autoEdit";
29568
+ ApprovalMode3["YOLO"] = "yolo";
29569
+ ApprovalMode3["PLAN"] = "plan";
29570
+ })(ApprovalMode || (ApprovalMode = {}));
29571
+ var InProcessCheckerType;
29572
+ (function(InProcessCheckerType2) {
29573
+ InProcessCheckerType2["ALLOWED_PATH"] = "allowed-path";
29574
+ })(InProcessCheckerType || (InProcessCheckerType = {}));
29575
+
29576
+ // packages/core/dist/src/core/coreToolScheduler.js
29452
29577
  function createFunctionResponsePart(callId, toolName, output) {
29453
29578
  return {
29454
29579
  functionResponse: {
@@ -29543,6 +29668,7 @@ var createErrorResponse = /* @__PURE__ */ __name((request, error2, errorType) =>
29543
29668
  ],
29544
29669
  resultDisplay: error2.message,
29545
29670
  errorType,
29671
+ reason: error2.message,
29546
29672
  contentLength: error2.message.length
29547
29673
  }), "createErrorResponse");
29548
29674
  async function truncateAndSaveToFile(content, callId, projectTempDir, threshold, truncateLines) {
@@ -29592,6 +29718,7 @@ ${truncatedContent}`,
29592
29718
  }
29593
29719
  }
29594
29720
  __name(truncateAndSaveToFile, "truncateAndSaveToFile");
29721
+ var DOOM_LOOP_IDENTICAL_TOOL_CALL_THRESHOLD = 6;
29595
29722
  var CoreToolScheduler = class {
29596
29723
  static {
29597
29724
  __name(this, "CoreToolScheduler");
@@ -29608,6 +29735,9 @@ var CoreToolScheduler = class {
29608
29735
  isFinalizingToolCalls = false;
29609
29736
  isScheduling = false;
29610
29737
  requestQueue = [];
29738
+ doomLoopPromptId = null;
29739
+ doomLoopLastSignature = null;
29740
+ doomLoopRunLength = 0;
29611
29741
  constructor(options2) {
29612
29742
  this.config = options2.config;
29613
29743
  this.toolRegistry = options2.config.getToolRegistry();
@@ -29708,9 +29838,10 @@ var CoreToolScheduler = class {
29708
29838
  }
29709
29839
  }
29710
29840
  ],
29711
- resultDisplay,
29841
+ resultDisplay: resultDisplay ?? String(auxiliaryData),
29712
29842
  error: void 0,
29713
29843
  errorType: void 0,
29844
+ reason: String(auxiliaryData),
29714
29845
  contentLength: errorMessage.length
29715
29846
  },
29716
29847
  durationMs,
@@ -29842,6 +29973,33 @@ var CoreToolScheduler = class {
29842
29973
  }
29843
29974
  const requestsToProcess = Array.isArray(request) ? request : [request];
29844
29975
  const newToolCalls = requestsToProcess.map((reqInfo) => {
29976
+ const doomLoopBlockReason = this.getDoomLoopBlockReason(reqInfo);
29977
+ if (doomLoopBlockReason) {
29978
+ return {
29979
+ status: "error",
29980
+ request: reqInfo,
29981
+ response: createErrorResponse(reqInfo, new Error(doomLoopBlockReason), ToolErrorType.EXECUTION_DENIED),
29982
+ durationMs: 0
29983
+ };
29984
+ }
29985
+ const policyEngine2 = this.config.getPolicyEngine?.();
29986
+ if (policyEngine2) {
29987
+ const workspaceDirs = this.config.getWorkspaceContext?.().getDirectories?.();
29988
+ const policyDetails = policyEngine2.getDecisionDetails({ name: reqInfo.name, args: reqInfo.args }, void 0, {
29989
+ cwd: this.config.getTargetDir?.(),
29990
+ workspaces: Array.isArray(workspaceDirs) ? workspaceDirs : void 0,
29991
+ agentName: reqInfo.agentName
29992
+ });
29993
+ if (policyDetails.decision === PolicyDecision.DENY) {
29994
+ const permissionErrorMessage = policyDetails.reason ?? `Papert Code requires permission to use "${reqInfo.name}", but that permission was declined.`;
29995
+ return {
29996
+ status: "error",
29997
+ request: reqInfo,
29998
+ response: createErrorResponse(reqInfo, new Error(permissionErrorMessage), ToolErrorType.EXECUTION_DENIED),
29999
+ durationMs: 0
30000
+ };
30001
+ }
30002
+ }
29845
30003
  const excludeTools = this.config.getExcludeTools?.() ?? void 0;
29846
30004
  if (excludeTools && excludeTools.length > 0) {
29847
30005
  const normalizedToolName = reqInfo.name.toLowerCase().trim();
@@ -29867,6 +30025,15 @@ var CoreToolScheduler = class {
29867
30025
  durationMs: 0
29868
30026
  };
29869
30027
  }
30028
+ const modeProfileBlockReason = this.getModeProfileBlockReason(reqInfo, toolInstance);
30029
+ if (modeProfileBlockReason) {
30030
+ return {
30031
+ status: "error",
30032
+ request: reqInfo,
30033
+ response: createErrorResponse(reqInfo, new Error(modeProfileBlockReason), ToolErrorType.EXECUTION_DENIED),
30034
+ durationMs: 0
30035
+ };
30036
+ }
29870
30037
  const invocationOrError = this.buildInvocation(toolInstance, reqInfo.args);
29871
30038
  if (invocationOrError instanceof Error) {
29872
30039
  return {
@@ -29904,7 +30071,7 @@ var CoreToolScheduler = class {
29904
30071
  continue;
29905
30072
  }
29906
30073
  const allowedTools = this.config.getAllowedTools() || [];
29907
- const isPlanMode = this.config.getApprovalMode() === ApprovalMode.PLAN;
30074
+ const isPlanMode = this.config.getApprovalMode() === ApprovalMode2.PLAN;
29908
30075
  const isExitPlanModeTool = reqInfo.name === "exit_plan_mode";
29909
30076
  if (isPlanMode && !isExitPlanModeTool) {
29910
30077
  if (confirmationDetails) {
@@ -29918,7 +30085,7 @@ var CoreToolScheduler = class {
29918
30085
  } else {
29919
30086
  this.setStatusInternal(reqInfo.callId, "scheduled");
29920
30087
  }
29921
- } else if (this.config.getApprovalMode() === ApprovalMode.YOLO || doesToolInvocationMatch(toolCall.tool, invocation, allowedTools)) {
30088
+ } else if (this.config.getApprovalMode() === ApprovalMode2.YOLO || doesToolInvocationMatch(toolCall.tool, invocation, allowedTools)) {
29922
30089
  this.setToolCallOutcome(reqInfo.callId, ToolConfirmationOutcome.ProceedAlways);
29923
30090
  this.setStatusInternal(reqInfo.callId, "scheduled");
29924
30091
  } else {
@@ -30127,6 +30294,43 @@ var CoreToolScheduler = class {
30127
30294
  }
30128
30295
  }
30129
30296
  }
30297
+ getDoomLoopBlockReason(request) {
30298
+ if (this.doomLoopPromptId !== request.prompt_id) {
30299
+ this.doomLoopPromptId = request.prompt_id;
30300
+ this.doomLoopLastSignature = null;
30301
+ this.doomLoopRunLength = 0;
30302
+ }
30303
+ const signature = `${request.name}:${stableStringify(request.args ?? {})}`;
30304
+ if (this.doomLoopLastSignature === signature) {
30305
+ this.doomLoopRunLength += 1;
30306
+ } else {
30307
+ this.doomLoopLastSignature = signature;
30308
+ this.doomLoopRunLength = 1;
30309
+ }
30310
+ if (this.doomLoopRunLength < DOOM_LOOP_IDENTICAL_TOOL_CALL_THRESHOLD) {
30311
+ return void 0;
30312
+ }
30313
+ return `Doom-loop protection blocked repeated identical tool call "${request.name}" after ${this.doomLoopRunLength} consecutive attempts in the same prompt.`;
30314
+ }
30315
+ getModeProfileBlockReason(request, tool) {
30316
+ const modeProfile = this.config.getModeProfile?.();
30317
+ if (!modeProfile || modeProfile === "build") {
30318
+ return void 0;
30319
+ }
30320
+ const isMutatingTool = tool.kind === Kind.Edit || tool.kind === Kind.Delete || tool.kind === Kind.Move || tool.kind === Kind.Execute;
30321
+ if (modeProfile === "plan" && isMutatingTool && request.name !== "exit_plan_mode") {
30322
+ return `Mode profile "${modeProfile}" blocked mutating tool "${request.name}". Switch to "/mode build" before making changes.`;
30323
+ }
30324
+ if (modeProfile === "review") {
30325
+ if (request.name === "task") {
30326
+ return 'Mode profile "review" blocks the "task" tool to prevent delegated writes/execution.';
30327
+ }
30328
+ if (isMutatingTool) {
30329
+ return `Mode profile "${modeProfile}" blocked mutating tool "${request.name}". Switch to "/mode build" before making changes.`;
30330
+ }
30331
+ }
30332
+ return void 0;
30333
+ }
30130
30334
  async checkAndNotifyCompletion() {
30131
30335
  const allCallsAreTerminal = this.toolCalls.every((call) => call.status === "success" || call.status === "error" || call.status === "cancelled");
30132
30336
  if (this.toolCalls.length > 0 && allCallsAreTerminal) {
@@ -30677,6 +30881,7 @@ var SubAgentScope = class _SubAgentScope {
30677
30881
  args,
30678
30882
  isClientInitiated: true,
30679
30883
  prompt_id: promptId,
30884
+ agentName: this.name,
30680
30885
  response_id: responseId
30681
30886
  };
30682
30887
  const description = this.getToolDescription(toolName, args);
@@ -32536,18 +32741,18 @@ var GeminiClient = class {
32536
32741
  f
32537
32742
  ]));
32538
32743
  const openedFiles = [];
32539
- for (const [path66] of currentFiles.entries()) {
32540
- if (!lastFiles.has(path66)) {
32541
- openedFiles.push(path66);
32744
+ for (const [path67] of currentFiles.entries()) {
32745
+ if (!lastFiles.has(path67)) {
32746
+ openedFiles.push(path67);
32542
32747
  }
32543
32748
  }
32544
32749
  if (openedFiles.length > 0) {
32545
32750
  changes["filesOpened"] = openedFiles;
32546
32751
  }
32547
32752
  const closedFiles = [];
32548
- for (const [path66] of lastFiles.entries()) {
32549
- if (!currentFiles.has(path66)) {
32550
- closedFiles.push(path66);
32753
+ for (const [path67] of lastFiles.entries()) {
32754
+ if (!currentFiles.has(path67)) {
32755
+ closedFiles.push(path67);
32551
32756
  }
32552
32757
  }
32553
32758
  if (closedFiles.length > 0) {
@@ -32725,7 +32930,7 @@ var GeminiClient = class {
32725
32930
  if (hasTaskTool && subagents.length > 0) {
32726
32931
  systemReminders.push(getSubagentSystemReminder(subagents));
32727
32932
  }
32728
- if (this.config.getApprovalMode() === ApprovalMode.PLAN) {
32933
+ if (this.config.getApprovalMode() === ApprovalMode2.PLAN) {
32729
32934
  systemReminders.push(getPlanModeSystemReminder(this.config.getSdkMode()));
32730
32935
  }
32731
32936
  requestToSent = [...systemReminders, ...requestToSent];
@@ -33281,8 +33486,8 @@ function pathspec(...paths) {
33281
33486
  return key;
33282
33487
  }
33283
33488
  __name(pathspec, "pathspec");
33284
- function isPathSpec(path66) {
33285
- return path66 instanceof String && cache.has(path66);
33489
+ function isPathSpec(path67) {
33490
+ return path67 instanceof String && cache.has(path67);
33286
33491
  }
33287
33492
  __name(isPathSpec, "isPathSpec");
33288
33493
  function toPaths(pathSpec) {
@@ -33390,8 +33595,8 @@ function forEachLineWithContent(input, callback) {
33390
33595
  return toLinesWithContent(input, true).map((line) => callback(line));
33391
33596
  }
33392
33597
  __name(forEachLineWithContent, "forEachLineWithContent");
33393
- function folderExists(path66) {
33394
- return (0, import_file_exists.exists)(path66, import_file_exists.FOLDER);
33598
+ function folderExists(path67) {
33599
+ return (0, import_file_exists.exists)(path67, import_file_exists.FOLDER);
33395
33600
  }
33396
33601
  __name(folderExists, "folderExists");
33397
33602
  function append(target, item) {
@@ -33824,8 +34029,8 @@ function checkIsRepoRootTask() {
33824
34029
  commands,
33825
34030
  format: "utf-8",
33826
34031
  onError,
33827
- parser(path66) {
33828
- return /^\.(git)?$/.test(path66.trim());
34032
+ parser(path67) {
34033
+ return /^\.(git)?$/.test(path67.trim());
33829
34034
  }
33830
34035
  };
33831
34036
  }
@@ -34293,11 +34498,11 @@ function parseGrep(grep) {
34293
34498
  const paths = /* @__PURE__ */ new Set();
34294
34499
  const results = {};
34295
34500
  forEachLineWithContent(grep, (input) => {
34296
- const [path66, line, preview] = input.split(NULL);
34297
- paths.add(path66);
34298
- (results[path66] = results[path66] || []).push({
34501
+ const [path67, line, preview] = input.split(NULL);
34502
+ paths.add(path67);
34503
+ (results[path67] = results[path67] || []).push({
34299
34504
  line: asNumber(line),
34300
- path: path66,
34505
+ path: path67,
34301
34506
  preview
34302
34507
  });
34303
34508
  });
@@ -35098,14 +35303,14 @@ var init_hash_object = __esm2({
35098
35303
  init_task();
35099
35304
  }
35100
35305
  });
35101
- function parseInit(bare, path66, text) {
35306
+ function parseInit(bare, path67, text) {
35102
35307
  const response = String(text).trim();
35103
35308
  let result;
35104
35309
  if (result = initResponseRegex.exec(response)) {
35105
- return new InitSummary(bare, path66, false, result[1]);
35310
+ return new InitSummary(bare, path67, false, result[1]);
35106
35311
  }
35107
35312
  if (result = reInitResponseRegex.exec(response)) {
35108
- return new InitSummary(bare, path66, true, result[1]);
35313
+ return new InitSummary(bare, path67, true, result[1]);
35109
35314
  }
35110
35315
  let gitDir = "";
35111
35316
  const tokens = response.split(" ");
@@ -35116,7 +35321,7 @@ function parseInit(bare, path66, text) {
35116
35321
  break;
35117
35322
  }
35118
35323
  }
35119
- return new InitSummary(bare, path66, /^re/i.test(response), gitDir);
35324
+ return new InitSummary(bare, path67, /^re/i.test(response), gitDir);
35120
35325
  }
35121
35326
  __name(parseInit, "parseInit");
35122
35327
  var InitSummary;
@@ -35129,9 +35334,9 @@ var init_InitSummary = __esm2({
35129
35334
  static {
35130
35335
  __name(this, "InitSummary");
35131
35336
  }
35132
- constructor(bare, path66, existing, gitDir) {
35337
+ constructor(bare, path67, existing, gitDir) {
35133
35338
  this.bare = bare;
35134
- this.path = path66;
35339
+ this.path = path67;
35135
35340
  this.existing = existing;
35136
35341
  this.gitDir = gitDir;
35137
35342
  }
@@ -35144,7 +35349,7 @@ function hasBareCommand(command) {
35144
35349
  return command.includes(bareCommand);
35145
35350
  }
35146
35351
  __name(hasBareCommand, "hasBareCommand");
35147
- function initTask(bare = false, path66, customArgs) {
35352
+ function initTask(bare = false, path67, customArgs) {
35148
35353
  const commands = ["init", ...customArgs];
35149
35354
  if (bare && !hasBareCommand(commands)) {
35150
35355
  commands.splice(1, 0, bareCommand);
@@ -35153,7 +35358,7 @@ function initTask(bare = false, path66, customArgs) {
35153
35358
  commands,
35154
35359
  format: "utf-8",
35155
35360
  parser(text) {
35156
- return parseInit(commands.includes("--bare"), path66, text);
35361
+ return parseInit(commands.includes("--bare"), path67, text);
35157
35362
  }
35158
35363
  };
35159
35364
  }
@@ -36014,12 +36219,12 @@ var init_FileStatusSummary = __esm2({
36014
36219
  static {
36015
36220
  __name(this, "FileStatusSummary");
36016
36221
  }
36017
- constructor(path66, index, working_dir) {
36018
- this.path = path66;
36222
+ constructor(path67, index, working_dir) {
36223
+ this.path = path67;
36019
36224
  this.index = index;
36020
36225
  this.working_dir = working_dir;
36021
36226
  if (index === "R" || working_dir === "R") {
36022
- const detail = fromPathRegex.exec(path66) || [null, path66, path66];
36227
+ const detail = fromPathRegex.exec(path67) || [null, path67, path67];
36023
36228
  this.from = detail[2] || "";
36024
36229
  this.path = detail[1] || "";
36025
36230
  }
@@ -36053,14 +36258,14 @@ function splitLine(result, lineStr) {
36053
36258
  default:
36054
36259
  return;
36055
36260
  }
36056
- function data(index, workingDir, path66) {
36261
+ function data(index, workingDir, path67) {
36057
36262
  const raw = `${index}${workingDir}`;
36058
36263
  const handler = parsers6.get(raw);
36059
36264
  if (handler) {
36060
- handler(result, path66);
36265
+ handler(result, path67);
36061
36266
  }
36062
36267
  if (raw !== "##" && raw !== "!!") {
36063
- result.files.push(new FileStatusSummary(path66, index, workingDir));
36268
+ result.files.push(new FileStatusSummary(path67, index, workingDir));
36064
36269
  }
36065
36270
  }
36066
36271
  __name(data, "data");
@@ -36385,9 +36590,9 @@ var init_simple_git_api = __esm2({
36385
36590
  next
36386
36591
  );
36387
36592
  }
36388
- hashObject(path66, write2) {
36593
+ hashObject(path67, write2) {
36389
36594
  return this._runTask(
36390
- hashObjectTask(path66, write2 === true),
36595
+ hashObjectTask(path67, write2 === true),
36391
36596
  trailingFunctionArgument(arguments)
36392
36597
  );
36393
36598
  }
@@ -37080,8 +37285,8 @@ __export2(sub_module_exports, {
37080
37285
  subModuleTask: /* @__PURE__ */ __name(() => subModuleTask, "subModuleTask"),
37081
37286
  updateSubModuleTask: /* @__PURE__ */ __name(() => updateSubModuleTask, "updateSubModuleTask")
37082
37287
  });
37083
- function addSubModuleTask(repo, path66) {
37084
- return subModuleTask(["add", repo, path66]);
37288
+ function addSubModuleTask(repo, path67) {
37289
+ return subModuleTask(["add", repo, path67]);
37085
37290
  }
37086
37291
  __name(addSubModuleTask, "addSubModuleTask");
37087
37292
  function initSubModuleTask(customArgs) {
@@ -37427,8 +37632,8 @@ var require_git = __commonJS2({
37427
37632
  }
37428
37633
  return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
37429
37634
  };
37430
- Git2.prototype.submoduleAdd = function(repo, path66, then) {
37431
- return this._runTask(addSubModuleTask2(repo, path66), trailingFunctionArgument2(arguments));
37635
+ Git2.prototype.submoduleAdd = function(repo, path67, then) {
37636
+ return this._runTask(addSubModuleTask2(repo, path67), trailingFunctionArgument2(arguments));
37432
37637
  };
37433
37638
  Git2.prototype.submoduleUpdate = function(args, then) {
37434
37639
  return this._runTask(
@@ -37829,11 +38034,11 @@ function isTaskError(result) {
37829
38034
  return !!(result.exitCode && result.stdErr.length);
37830
38035
  }
37831
38036
  __name(isTaskError, "isTaskError");
37832
- function getErrorMessage2(result) {
38037
+ function getErrorMessage3(result) {
37833
38038
  return Buffer.concat([...result.stdOut, ...result.stdErr]);
37834
38039
  }
37835
- __name(getErrorMessage2, "getErrorMessage");
37836
- function errorDetectionHandler(overwrite = false, isError = isTaskError, errorMessage = getErrorMessage2) {
38040
+ __name(getErrorMessage3, "getErrorMessage");
38041
+ function errorDetectionHandler(overwrite = false, isError = isTaskError, errorMessage = getErrorMessage3) {
37837
38042
  return (error2, result) => {
37838
38043
  if (!overwrite && error2 || !isError(result)) {
37839
38044
  return error2;
@@ -38578,12 +38783,12 @@ var Mime = class {
38578
38783
  }
38579
38784
  return this;
38580
38785
  }
38581
- getType(path66) {
38582
- if (typeof path66 !== "string")
38786
+ getType(path67) {
38787
+ if (typeof path67 !== "string")
38583
38788
  return null;
38584
- const last2 = path66.replace(/^.*[/\\]/s, "").toLowerCase();
38789
+ const last2 = path67.replace(/^.*[/\\]/s, "").toLowerCase();
38585
38790
  const ext = last2.replace(/^.*\./s, "").toLowerCase();
38586
- const hasPath = last2.length < path66.length;
38791
+ const hasPath = last2.length < path67.length;
38587
38792
  const hasDot = ext.length < last2.length - 1;
38588
38793
  if (!hasDot && hasPath)
38589
38794
  return null;
@@ -40319,10 +40524,10 @@ function assignProp(target, prop, value) {
40319
40524
  });
40320
40525
  }
40321
40526
  __name(assignProp, "assignProp");
40322
- function getElementAtPath(obj, path66) {
40323
- if (!path66)
40527
+ function getElementAtPath(obj, path67) {
40528
+ if (!path67)
40324
40529
  return obj;
40325
- return path66.reduce((acc, key) => acc?.[key], obj);
40530
+ return path67.reduce((acc, key) => acc?.[key], obj);
40326
40531
  }
40327
40532
  __name(getElementAtPath, "getElementAtPath");
40328
40533
  function promiseAllObject(promisesObj) {
@@ -40662,11 +40867,11 @@ function aborted(x, startIndex = 0) {
40662
40867
  return false;
40663
40868
  }
40664
40869
  __name(aborted, "aborted");
40665
- function prefixIssues(path66, issues) {
40870
+ function prefixIssues(path67, issues) {
40666
40871
  return issues.map((iss) => {
40667
40872
  var _a3;
40668
40873
  (_a3 = iss).path ?? (_a3.path = []);
40669
- iss.path.unshift(path66);
40874
+ iss.path.unshift(path67);
40670
40875
  return iss;
40671
40876
  });
40672
40877
  }
@@ -49397,11 +49602,11 @@ var IDEConnectionStatus;
49397
49602
  IDEConnectionStatus2["Disconnected"] = "disconnected";
49398
49603
  IDEConnectionStatus2["Connecting"] = "connecting";
49399
49604
  })(IDEConnectionStatus || (IDEConnectionStatus = {}));
49400
- function getRealPath(path66) {
49605
+ function getRealPath(path67) {
49401
49606
  try {
49402
- return fs23.realpathSync(path66);
49607
+ return fs23.realpathSync(path67);
49403
49608
  } catch (_e) {
49404
- return path66;
49609
+ return path67;
49405
49610
  }
49406
49611
  }
49407
49612
  __name(getRealPath, "getRealPath");
@@ -50379,7 +50584,7 @@ var EditToolInvocation = class {
50379
50584
  * It needs to calculate the diff to show the user.
50380
50585
  */
50381
50586
  async shouldConfirmExecute(abortSignal) {
50382
- if (this.config.getApprovalMode() === ApprovalMode.AUTO_EDIT) {
50587
+ if (this.config.getApprovalMode() === ApprovalMode2.AUTO_EDIT) {
50383
50588
  return false;
50384
50589
  }
50385
50590
  let editData;
@@ -50411,7 +50616,7 @@ var EditToolInvocation = class {
50411
50616
  newContent: editData.newContent,
50412
50617
  onConfirm: /* @__PURE__ */ __name(async (outcome) => {
50413
50618
  if (outcome === ToolConfirmationOutcome.ProceedAlways) {
50414
- this.config.setApprovalMode(ApprovalMode.AUTO_EDIT);
50619
+ this.config.setApprovalMode(ApprovalMode2.AUTO_EDIT);
50415
50620
  }
50416
50621
  if (ideConfirmation) {
50417
50622
  const result = await ideConfirmation;
@@ -50687,19 +50892,19 @@ var ExitPlanModeToolInvocation = class extends BaseToolInvocation {
50687
50892
  switch (outcome) {
50688
50893
  case ToolConfirmationOutcome.ProceedAlways:
50689
50894
  this.wasApproved = true;
50690
- this.setApprovalModeSafely(ApprovalMode.AUTO_EDIT);
50895
+ this.setApprovalModeSafely(ApprovalMode2.AUTO_EDIT);
50691
50896
  break;
50692
50897
  case ToolConfirmationOutcome.ProceedOnce:
50693
50898
  this.wasApproved = true;
50694
- this.setApprovalModeSafely(ApprovalMode.DEFAULT);
50899
+ this.setApprovalModeSafely(ApprovalMode2.DEFAULT);
50695
50900
  break;
50696
50901
  case ToolConfirmationOutcome.Cancel:
50697
50902
  this.wasApproved = false;
50698
- this.setApprovalModeSafely(ApprovalMode.PLAN);
50903
+ this.setApprovalModeSafely(ApprovalMode2.PLAN);
50699
50904
  break;
50700
50905
  default:
50701
50906
  this.wasApproved = true;
50702
- this.setApprovalModeSafely(ApprovalMode.DEFAULT);
50907
+ this.setApprovalModeSafely(ApprovalMode2.DEFAULT);
50703
50908
  break;
50704
50909
  }
50705
50910
  }, "onConfirm")
@@ -53682,7 +53887,7 @@ var EditToolInvocation2 = class {
53682
53887
  * It needs to calculate the diff to show the user.
53683
53888
  */
53684
53889
  async shouldConfirmExecute(abortSignal) {
53685
- if (this.config.getApprovalMode() === ApprovalMode.AUTO_EDIT) {
53890
+ if (this.config.getApprovalMode() === ApprovalMode2.AUTO_EDIT) {
53686
53891
  return false;
53687
53892
  }
53688
53893
  let editData;
@@ -53714,7 +53919,7 @@ var EditToolInvocation2 = class {
53714
53919
  newContent: editData.newContent,
53715
53920
  onConfirm: /* @__PURE__ */ __name(async (outcome) => {
53716
53921
  if (outcome === ToolConfirmationOutcome.ProceedAlways) {
53717
- this.config.setApprovalMode(ApprovalMode.AUTO_EDIT);
53922
+ this.config.setApprovalMode(ApprovalMode2.AUTO_EDIT);
53718
53923
  }
53719
53924
  if (ideConfirmation) {
53720
53925
  const result = await ideConfirmation;
@@ -60927,8 +61132,8 @@ function mergeDuplicatesPreferLast(items, getKey) {
60927
61132
  }
60928
61133
  __name(mergeDuplicatesPreferLast, "mergeDuplicatesPreferLast");
60929
61134
  var overwriteMerge$1 = /* @__PURE__ */ __name((acc, src, options2) => [...src], "overwriteMerge$1");
60930
- function get(obj, path66) {
60931
- for (const key of path66) {
61135
+ function get(obj, path67) {
61136
+ for (const key of path67) {
60932
61137
  if (!obj) {
60933
61138
  return void 0;
60934
61139
  }
@@ -62151,8 +62356,8 @@ function withBrackets(str, brackets) {
62151
62356
  return lbr + str + rbr;
62152
62357
  }
62153
62358
  __name(withBrackets, "withBrackets");
62154
- function pathRewrite(path66, rewriter, baseUrl, metadata, elem) {
62155
- const modifiedPath = typeof rewriter === "function" ? rewriter(path66, metadata, elem) : path66;
62359
+ function pathRewrite(path67, rewriter, baseUrl, metadata, elem) {
62360
+ const modifiedPath = typeof rewriter === "function" ? rewriter(path67, metadata, elem) : path67;
62156
62361
  return modifiedPath[0] === "/" && baseUrl ? trimCharacterEnd(baseUrl, "/") + modifiedPath : modifiedPath;
62157
62362
  }
62158
62363
  __name(pathRewrite, "pathRewrite");
@@ -62500,9 +62705,9 @@ function handleDeprecatedOptions(options2) {
62500
62705
  options2.selectors.push(...tagDefinitions);
62501
62706
  options2.selectors = mergeDuplicatesPreferLast(options2.selectors, (s2) => s2.selector);
62502
62707
  }
62503
- function set(obj, path66, value) {
62504
- const valueKey = path66.pop();
62505
- for (const key of path66) {
62708
+ function set(obj, path67, value) {
62709
+ const valueKey = path67.pop();
62710
+ for (const key of path67) {
62506
62711
  let nested = obj[key];
62507
62712
  if (!nested) {
62508
62713
  nested = {};
@@ -62655,7 +62860,7 @@ ${textContent2}
62655
62860
  return `Fetching content from ${this.params.url} and processing with prompt: "${displayPrompt}"`;
62656
62861
  }
62657
62862
  async shouldConfirmExecute() {
62658
- if (this.config.getApprovalMode() === ApprovalMode.AUTO_EDIT) {
62863
+ if (this.config.getApprovalMode() === ApprovalMode2.AUTO_EDIT) {
62659
62864
  return false;
62660
62865
  }
62661
62866
  const confirmationDetails = {
@@ -62665,7 +62870,7 @@ ${textContent2}
62665
62870
  urls: [this.params.url],
62666
62871
  onConfirm: /* @__PURE__ */ __name(async (outcome) => {
62667
62872
  if (outcome === ToolConfirmationOutcome.ProceedAlways) {
62668
- this.config.setApprovalMode(ApprovalMode.AUTO_EDIT);
62873
+ this.config.setApprovalMode(ApprovalMode2.AUTO_EDIT);
62669
62874
  }
62670
62875
  }, "onConfirm")
62671
62876
  };
@@ -63003,7 +63208,7 @@ var WebSearchToolInvocation = class extends BaseToolInvocation {
63003
63208
  return ` (Searching the web via ${provider})`;
63004
63209
  }
63005
63210
  async shouldConfirmExecute(_abortSignal) {
63006
- if (this.config.getApprovalMode() === ApprovalMode.AUTO_EDIT) {
63211
+ if (this.config.getApprovalMode() === ApprovalMode2.AUTO_EDIT) {
63007
63212
  return false;
63008
63213
  }
63009
63214
  const confirmationDetails = {
@@ -63012,7 +63217,7 @@ var WebSearchToolInvocation = class extends BaseToolInvocation {
63012
63217
  prompt: `Search the web for: "${this.params.query}"`,
63013
63218
  onConfirm: /* @__PURE__ */ __name(async (outcome) => {
63014
63219
  if (outcome === ToolConfirmationOutcome.ProceedAlways) {
63015
- this.config.setApprovalMode(ApprovalMode.AUTO_EDIT);
63220
+ this.config.setApprovalMode(ApprovalMode2.AUTO_EDIT);
63016
63221
  }
63017
63222
  }, "onConfirm")
63018
63223
  };
@@ -63241,7 +63446,7 @@ var WriteFileToolInvocation = class extends BaseToolInvocation {
63241
63446
  return `Writing to ${shortenPath(relativePath)}`;
63242
63447
  }
63243
63448
  async shouldConfirmExecute(_abortSignal) {
63244
- if (this.config.getApprovalMode() === ApprovalMode.AUTO_EDIT) {
63449
+ if (this.config.getApprovalMode() === ApprovalMode2.AUTO_EDIT) {
63245
63450
  return false;
63246
63451
  }
63247
63452
  const correctedContentResult = await getCorrectedFileContent(this.config, this.params.file_path, this.params.content);
@@ -63273,7 +63478,7 @@ var WriteFileToolInvocation = class extends BaseToolInvocation {
63273
63478
  newContent: correctedContent,
63274
63479
  onConfirm: /* @__PURE__ */ __name(async (outcome) => {
63275
63480
  if (outcome === ToolConfirmationOutcome.ProceedAlways) {
63276
- this.config.setApprovalMode(ApprovalMode.AUTO_EDIT);
63481
+ this.config.setApprovalMode(ApprovalMode2.AUTO_EDIT);
63277
63482
  }
63278
63483
  if (ideConfirmation) {
63279
63484
  const result = await ideConfirmation;
@@ -64585,6 +64790,16 @@ var ModelAvailabilityService = class {
64585
64790
  consumed
64586
64791
  });
64587
64792
  }
64793
+ markTransient(model) {
64794
+ const currentState = this.health.get(model);
64795
+ if (currentState?.status === "terminal") {
64796
+ return;
64797
+ }
64798
+ this.setState(model, {
64799
+ status: "transient",
64800
+ reason: "transient_failure"
64801
+ });
64802
+ }
64588
64803
  consumeStickyAttempt(model) {
64589
64804
  const state = this.health.get(model);
64590
64805
  if (state?.status === "sticky_retry") {
@@ -64599,6 +64814,9 @@ var ModelAvailabilityService = class {
64599
64814
  if (state.status === "terminal") {
64600
64815
  return { available: false, reason: state.reason };
64601
64816
  }
64817
+ if (state.status === "transient") {
64818
+ return { available: false, reason: state.reason };
64819
+ }
64602
64820
  if (state.status === "sticky_retry" && state.consumed) {
64603
64821
  return { available: false, reason: state.reason };
64604
64822
  }
@@ -64620,6 +64838,9 @@ var ModelAvailabilityService = class {
64620
64838
  }
64621
64839
  resetTurn() {
64622
64840
  for (const [model, state] of this.health.entries()) {
64841
+ if (state.status === "transient") {
64842
+ this.clearState(model);
64843
+ }
64623
64844
  if (state.status === "sticky_retry") {
64624
64845
  this.setState(model, { ...state, consumed: false });
64625
64846
  }
@@ -67481,7 +67702,7 @@ function findImports(content) {
67481
67702
  j++;
67482
67703
  }
67483
67704
  const importPath = content.slice(i + 1, j);
67484
- if (importPath.length > 0 && (importPath[0] === "." || importPath[0] === "/" || isLetter(importPath[0]))) {
67705
+ if (isLikelyImportPath(importPath)) {
67485
67706
  imports.push({
67486
67707
  start: i,
67487
67708
  _end: j,
@@ -67503,6 +67724,19 @@ function isLetter(char) {
67503
67724
  code >= 97 && code <= 122;
67504
67725
  }
67505
67726
  __name(isLetter, "isLetter");
67727
+ function isLikelyImportPath(importPath) {
67728
+ if (importPath.length === 0) {
67729
+ return false;
67730
+ }
67731
+ if (importPath[0] === "." || importPath[0] === "/") {
67732
+ return true;
67733
+ }
67734
+ if (!isLetter(importPath[0])) {
67735
+ return false;
67736
+ }
67737
+ return importPath.includes(".");
67738
+ }
67739
+ __name(isLikelyImportPath, "isLikelyImportPath");
67506
67740
  function findCodeRegions(content) {
67507
67741
  const regions = [];
67508
67742
  const tokens = marked.lexer(content);
@@ -68211,42 +68445,7 @@ __name(generateAndSaveSummary, "generateAndSaveSummary");
68211
68445
 
68212
68446
  // packages/core/dist/src/policy/policy-engine.js
68213
68447
  init_esbuild_shims();
68214
-
68215
- // packages/core/dist/src/policy/types.js
68216
- init_esbuild_shims();
68217
- var PolicyDecision;
68218
- (function(PolicyDecision2) {
68219
- PolicyDecision2["ALLOW"] = "allow";
68220
- PolicyDecision2["DENY"] = "deny";
68221
- PolicyDecision2["ASK_USER"] = "ask_user";
68222
- })(PolicyDecision || (PolicyDecision = {}));
68223
- var VALID_HOOK_SOURCES = [
68224
- "project",
68225
- "user",
68226
- "system",
68227
- "extension"
68228
- ];
68229
- function getHookSource(input) {
68230
- const source = input["hook_source"];
68231
- if (typeof source === "string" && VALID_HOOK_SOURCES.includes(source)) {
68232
- return source;
68233
- }
68234
- return "project";
68235
- }
68236
- __name(getHookSource, "getHookSource");
68237
- var ApprovalMode2;
68238
- (function(ApprovalMode3) {
68239
- ApprovalMode3["DEFAULT"] = "default";
68240
- ApprovalMode3["AUTO_EDIT"] = "autoEdit";
68241
- ApprovalMode3["YOLO"] = "yolo";
68242
- ApprovalMode3["PLAN"] = "plan";
68243
- })(ApprovalMode2 || (ApprovalMode2 = {}));
68244
- var InProcessCheckerType;
68245
- (function(InProcessCheckerType2) {
68246
- InProcessCheckerType2["ALLOWED_PATH"] = "allowed-path";
68247
- })(InProcessCheckerType || (InProcessCheckerType = {}));
68248
-
68249
- // packages/core/dist/src/policy/policy-engine.js
68448
+ import path50 from "node:path";
68250
68449
  var PolicyEngine = class {
68251
68450
  static {
68252
68451
  __name(this, "PolicyEngine");
@@ -68255,21 +68454,29 @@ var PolicyEngine = class {
68255
68454
  defaultDecision;
68256
68455
  nonInteractive;
68257
68456
  allowHooks;
68457
+ wildcardRegexCache = /* @__PURE__ */ new Map();
68258
68458
  constructor(config2 = {}) {
68259
- this.rules = (config2.rules ?? []).sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
68459
+ this.rules = [...config2.rules ?? []].sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));
68260
68460
  this.defaultDecision = config2.defaultDecision ?? PolicyDecision.ASK_USER;
68261
68461
  this.nonInteractive = config2.nonInteractive ?? false;
68262
68462
  this.allowHooks = config2.allowHooks ?? true;
68263
68463
  }
68264
- check(toolCall, serverName) {
68265
- return this.getDecisionDetails(toolCall, serverName).decision;
68464
+ check(toolCall, serverName, context) {
68465
+ return this.getDecisionDetails(toolCall, serverName, context).decision;
68266
68466
  }
68267
- getDecisionReason(toolCall, serverName) {
68268
- return this.getDecisionDetails(toolCall, serverName).reason;
68467
+ getDecisionReason(toolCall, serverName, context) {
68468
+ return this.getDecisionDetails(toolCall, serverName, context).reason;
68269
68469
  }
68270
- getDecisionDetails(toolCall, serverName) {
68470
+ getDecisionDetails(toolCall, serverName, context) {
68471
+ const commandValue = this.extractCommandValue(toolCall.args);
68472
+ const externalDirectoryAccess = this.checkExternalDirectoryAccess(toolCall.args, context);
68271
68473
  const stringifiedArgs = toolCall.args && this.rules.some((rule) => rule.argsPattern) ? stableStringify(toolCall.args) : void 0;
68272
- const matchedRule = this.rules.find((rule) => this.ruleMatches(rule, toolCall.name, stringifiedArgs, serverName));
68474
+ let matchedRule;
68475
+ for (const rule of this.rules) {
68476
+ if (this.ruleMatches(rule, toolCall.name, stringifiedArgs, serverName, commandValue, externalDirectoryAccess, context?.agentName)) {
68477
+ matchedRule = rule;
68478
+ }
68479
+ }
68273
68480
  if (matchedRule) {
68274
68481
  const decision = this.applyNonInteractiveMode(matchedRule.decision);
68275
68482
  const deniedByNonInteractive2 = matchedRule.decision === PolicyDecision.ASK_USER && decision === PolicyDecision.DENY && this.nonInteractive;
@@ -68295,22 +68502,35 @@ var PolicyEngine = class {
68295
68502
  }
68296
68503
  addRule(rule) {
68297
68504
  this.rules.push(rule);
68298
- this.rules.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));
68505
+ this.rules.sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));
68299
68506
  }
68300
68507
  getRules() {
68301
68508
  return this.rules;
68302
68509
  }
68303
- ruleMatches(rule, toolName, stringifiedArgs, serverName) {
68304
- if (rule.toolName) {
68305
- if (rule.toolName.endsWith("__*")) {
68306
- const prefix = rule.toolName.slice(0, -3);
68307
- if (serverName && serverName !== prefix) {
68308
- return false;
68309
- }
68310
- if (!toolName?.startsWith(`${prefix}__`)) {
68311
- return false;
68312
- }
68313
- } else if (rule.toolName !== toolName) {
68510
+ ruleMatches(rule, toolName, stringifiedArgs, serverName, commandValue, externalDirectoryAccess, contextAgentName) {
68511
+ if (rule.agentName) {
68512
+ if (!contextAgentName) {
68513
+ return false;
68514
+ }
68515
+ if (rule.agentName.trim().toLowerCase() !== contextAgentName.trim().toLowerCase()) {
68516
+ return false;
68517
+ }
68518
+ }
68519
+ if (rule.toolName && !this.matchesToolPattern(rule.toolName, toolName, serverName)) {
68520
+ return false;
68521
+ }
68522
+ if (rule.commandPrefix) {
68523
+ if (!commandValue) {
68524
+ return false;
68525
+ }
68526
+ const prefixes = Array.isArray(rule.commandPrefix) ? rule.commandPrefix : [rule.commandPrefix];
68527
+ const matchedPrefix = prefixes.some((prefix) => this.matchesCommandPrefix(commandValue, prefix));
68528
+ if (!matchedPrefix) {
68529
+ return false;
68530
+ }
68531
+ }
68532
+ if (rule.permissionClass === "external_directory") {
68533
+ if (!externalDirectoryAccess) {
68314
68534
  return false;
68315
68535
  }
68316
68536
  }
@@ -68319,6 +68539,86 @@ var PolicyEngine = class {
68319
68539
  }
68320
68540
  return !rule.argsPattern;
68321
68541
  }
68542
+ matchesToolPattern(pattern, toolName, serverName) {
68543
+ if (!toolName) {
68544
+ return false;
68545
+ }
68546
+ if (!pattern.includes("*")) {
68547
+ return pattern === toolName;
68548
+ }
68549
+ if (pattern.endsWith("__*") && serverName) {
68550
+ const serverPrefix = pattern.slice(0, -3);
68551
+ if (serverName !== serverPrefix) {
68552
+ return false;
68553
+ }
68554
+ }
68555
+ return this.getWildcardRegex(pattern).test(toolName);
68556
+ }
68557
+ extractCommandValue(args) {
68558
+ if (!args || typeof args !== "object") {
68559
+ return void 0;
68560
+ }
68561
+ const command = args["command"];
68562
+ return typeof command === "string" ? command : void 0;
68563
+ }
68564
+ matchesCommandPrefix(command, prefix) {
68565
+ if (!prefix) {
68566
+ return false;
68567
+ }
68568
+ if (prefix.includes("*")) {
68569
+ const escaped = prefix.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
68570
+ return new RegExp(`^${escaped}(?:\\s|$)`).test(command);
68571
+ }
68572
+ return command === prefix || command.startsWith(`${prefix} `);
68573
+ }
68574
+ checkExternalDirectoryAccess(args, context) {
68575
+ const candidatePaths = this.collectPathCandidates(args);
68576
+ if (candidatePaths.length === 0) {
68577
+ return false;
68578
+ }
68579
+ const cwd3 = context?.cwd ?? process.cwd();
68580
+ const workspaceRoots = [cwd3, ...context?.workspaces ?? []].filter((value) => typeof value === "string" && value.length > 0).map((value) => path50.resolve(value));
68581
+ return candidatePaths.some((candidatePath) => {
68582
+ const resolvedPath = path50.resolve(cwd3, candidatePath);
68583
+ return !workspaceRoots.some((workspaceRoot) => this.isPathInsideWorkspace(resolvedPath, workspaceRoot));
68584
+ });
68585
+ }
68586
+ collectPathCandidates(args, prefix = "") {
68587
+ if (!args || typeof args !== "object") {
68588
+ return [];
68589
+ }
68590
+ const pathCandidates = [];
68591
+ const entries = Object.entries(args);
68592
+ for (const [key, value] of entries) {
68593
+ const fullKey = prefix ? `${prefix}.${key}` : key;
68594
+ const lowerKey = key.toLowerCase();
68595
+ const looksLikePathKey = lowerKey.includes("path") || lowerKey.includes("file") || lowerKey.includes("directory") || lowerKey === "source" || lowerKey === "destination";
68596
+ if (typeof value === "string") {
68597
+ if (looksLikePathKey) {
68598
+ pathCandidates.push(value);
68599
+ }
68600
+ continue;
68601
+ }
68602
+ if (typeof value === "object" && value !== null) {
68603
+ pathCandidates.push(...this.collectPathCandidates(value, fullKey));
68604
+ }
68605
+ }
68606
+ return pathCandidates;
68607
+ }
68608
+ isPathInsideWorkspace(resolvedPath, workspaceRoot) {
68609
+ const relative8 = path50.relative(workspaceRoot, resolvedPath);
68610
+ return relative8 === "" || !relative8.startsWith("..") && !path50.isAbsolute(relative8);
68611
+ }
68612
+ getWildcardRegex(pattern) {
68613
+ const cached2 = this.wildcardRegexCache.get(pattern);
68614
+ if (cached2) {
68615
+ return cached2;
68616
+ }
68617
+ const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
68618
+ const compiled = new RegExp(`^${escaped}$`);
68619
+ this.wildcardRegexCache.set(pattern, compiled);
68620
+ return compiled;
68621
+ }
68322
68622
  applyNonInteractiveMode(decision) {
68323
68623
  if (this.nonInteractive && decision === PolicyDecision.ASK_USER) {
68324
68624
  return PolicyDecision.DENY;
@@ -68339,6 +68639,16 @@ var PolicyEngine = class {
68339
68639
  if (typeof rule.priority === "number") {
68340
68640
  parts.push(`priority=${rule.priority}`);
68341
68641
  }
68642
+ if (rule.commandPrefix) {
68643
+ const prefixes = Array.isArray(rule.commandPrefix) ? rule.commandPrefix.join("|") : rule.commandPrefix;
68644
+ parts.push(`commandPrefix=${prefixes}`);
68645
+ }
68646
+ if (rule.permissionClass) {
68647
+ parts.push(`permissionClass=${rule.permissionClass}`);
68648
+ }
68649
+ if (rule.agentName) {
68650
+ parts.push(`agentName=${rule.agentName}`);
68651
+ }
68342
68652
  return parts.length > 0 ? `Denied by matching policy rule (${parts.join(", ")})` : "Denied by matching policy rule";
68343
68653
  }
68344
68654
  };
@@ -68516,12 +68826,12 @@ var CheckerRunner = class _CheckerRunner {
68516
68826
 
68517
68827
  // packages/core/dist/src/safety/registry.js
68518
68828
  init_esbuild_shims();
68519
- import * as path51 from "node:path";
68829
+ import * as path52 from "node:path";
68520
68830
  import * as fs43 from "node:fs";
68521
68831
 
68522
68832
  // packages/core/dist/src/safety/built-in.js
68523
68833
  init_esbuild_shims();
68524
- import * as path50 from "node:path";
68834
+ import * as path51 from "node:path";
68525
68835
  import * as fs42 from "node:fs";
68526
68836
  var AllowedPathChecker = class {
68527
68837
  static {
@@ -68562,15 +68872,15 @@ var AllowedPathChecker = class {
68562
68872
  }
68563
68873
  safelyResolvePath(inputPath, cwd3) {
68564
68874
  try {
68565
- const resolved = path50.resolve(cwd3, inputPath);
68875
+ const resolved = path51.resolve(cwd3, inputPath);
68566
68876
  let current = resolved;
68567
- while (current && current !== path50.dirname(current)) {
68877
+ while (current && current !== path51.dirname(current)) {
68568
68878
  if (fs42.existsSync(current)) {
68569
68879
  const canonical = fs42.realpathSync(current);
68570
- const relative8 = path50.relative(current, resolved);
68571
- return path50.join(canonical, relative8);
68880
+ const relative8 = path51.relative(current, resolved);
68881
+ return path51.join(canonical, relative8);
68572
68882
  }
68573
- current = path50.dirname(current);
68883
+ current = path51.dirname(current);
68574
68884
  }
68575
68885
  return resolved;
68576
68886
  } catch {
@@ -68578,8 +68888,8 @@ var AllowedPathChecker = class {
68578
68888
  }
68579
68889
  }
68580
68890
  isPathAllowed(targetPath, allowedDir) {
68581
- const relative8 = path50.relative(allowedDir, targetPath);
68582
- return relative8 === "" || !relative8.startsWith("..") && !path50.isAbsolute(relative8);
68891
+ const relative8 = path51.relative(allowedDir, targetPath);
68892
+ return relative8 === "" || !relative8.startsWith("..") && !path51.isAbsolute(relative8);
68583
68893
  }
68584
68894
  collectPathsToCheck(args, includedArgs, excludedArgs, prefix = "") {
68585
68895
  const paths = [];
@@ -68621,7 +68931,7 @@ var CheckerRegistry = class _CheckerRegistry {
68621
68931
  }
68622
68932
  const builtInPath = _CheckerRegistry.BUILT_IN_EXTERNAL_CHECKERS.get(name2);
68623
68933
  if (builtInPath) {
68624
- const fullPath = path51.join(this.checkersPath, builtInPath);
68934
+ const fullPath = path52.join(this.checkersPath, builtInPath);
68625
68935
  if (!fs43.existsSync(fullPath)) {
68626
68936
  throw new Error(`Built-in checker "${name2}" not found at ${fullPath}`);
68627
68937
  }
@@ -68690,13 +69000,13 @@ var ContextBuilder = class {
68690
69000
 
68691
69001
  // packages/core/dist/src/skills/skillManager.js
68692
69002
  init_esbuild_shims();
68693
- import * as path53 from "node:path";
69003
+ import * as path54 from "node:path";
68694
69004
  import { fileURLToPath as fileURLToPath2 } from "node:url";
68695
69005
 
68696
69006
  // packages/core/dist/src/skills/skillLoader.js
68697
69007
  init_esbuild_shims();
68698
69008
  import * as fs44 from "node:fs/promises";
68699
- import * as path52 from "node:path";
69009
+ import * as path53 from "node:path";
68700
69010
  var FRONTMATTER_REGEX = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n([\s\S]*))?/;
68701
69011
  function parseFrontmatter(content) {
68702
69012
  return parseSimpleFrontmatter(content);
@@ -68738,7 +69048,7 @@ __name(parseSimpleFrontmatter, "parseSimpleFrontmatter");
68738
69048
  async function loadSkillsFromDir(dir) {
68739
69049
  const discoveredSkills = [];
68740
69050
  try {
68741
- const absoluteSearchPath = path52.resolve(dir);
69051
+ const absoluteSearchPath = path53.resolve(dir);
68742
69052
  const stats = await fs44.stat(absoluteSearchPath).catch(() => null);
68743
69053
  if (!stats || !stats.isDirectory()) {
68744
69054
  return [];
@@ -68816,8 +69126,8 @@ var SkillManager = class {
68816
69126
  this.addSkillsWithPrecedence(projectSkills);
68817
69127
  }
68818
69128
  async discoverBuiltinSkills() {
68819
- const __dirname3 = path53.dirname(fileURLToPath2(import.meta.url));
68820
- const builtinDir = path53.join(__dirname3, "builtin");
69129
+ const __dirname3 = path54.dirname(fileURLToPath2(import.meta.url));
69130
+ const builtinDir = path54.join(__dirname3, "builtin");
68821
69131
  const builtinSkills = await loadSkillsFromDir(builtinDir);
68822
69132
  for (const skill of builtinSkills) {
68823
69133
  skill.isBuiltin = true;
@@ -69436,36 +69746,56 @@ var ModelRouterService = class {
69436
69746
  };
69437
69747
 
69438
69748
  // packages/core/dist/src/config/config.js
69439
- var ApprovalMode;
69749
+ var ApprovalMode2;
69440
69750
  (function(ApprovalMode3) {
69441
69751
  ApprovalMode3["PLAN"] = "plan";
69442
69752
  ApprovalMode3["DEFAULT"] = "default";
69443
69753
  ApprovalMode3["AUTO_EDIT"] = "auto-edit";
69444
69754
  ApprovalMode3["YOLO"] = "yolo";
69445
- })(ApprovalMode || (ApprovalMode = {}));
69446
- var APPROVAL_MODES = Object.values(ApprovalMode);
69755
+ })(ApprovalMode2 || (ApprovalMode2 = {}));
69756
+ var APPROVAL_MODES = Object.values(ApprovalMode2);
69447
69757
  var APPROVAL_MODE_INFO = {
69448
- [ApprovalMode.PLAN]: {
69449
- id: ApprovalMode.PLAN,
69758
+ [ApprovalMode2.PLAN]: {
69759
+ id: ApprovalMode2.PLAN,
69450
69760
  name: "Plan",
69451
69761
  description: "Analyze only, do not modify files or execute commands"
69452
69762
  },
69453
- [ApprovalMode.DEFAULT]: {
69454
- id: ApprovalMode.DEFAULT,
69763
+ [ApprovalMode2.DEFAULT]: {
69764
+ id: ApprovalMode2.DEFAULT,
69455
69765
  name: "Default",
69456
69766
  description: "Require approval for file edits or shell commands"
69457
69767
  },
69458
- [ApprovalMode.AUTO_EDIT]: {
69459
- id: ApprovalMode.AUTO_EDIT,
69768
+ [ApprovalMode2.AUTO_EDIT]: {
69769
+ id: ApprovalMode2.AUTO_EDIT,
69460
69770
  name: "Auto Edit",
69461
69771
  description: "Automatically approve file edits"
69462
69772
  },
69463
- [ApprovalMode.YOLO]: {
69464
- id: ApprovalMode.YOLO,
69773
+ [ApprovalMode2.YOLO]: {
69774
+ id: ApprovalMode2.YOLO,
69465
69775
  name: "YOLO",
69466
69776
  description: "Automatically approve all tools"
69467
69777
  }
69468
69778
  };
69779
+ var MODE_PROFILE_INFO = {
69780
+ build: {
69781
+ id: "build",
69782
+ name: "Build",
69783
+ description: "Implementation mode that enables coding and shell workflows with minimal friction.",
69784
+ approvalMode: ApprovalMode2.AUTO_EDIT
69785
+ },
69786
+ plan: {
69787
+ id: "plan",
69788
+ name: "Plan",
69789
+ description: "Planning mode that keeps the session focused on analysis before changes.",
69790
+ approvalMode: ApprovalMode2.PLAN
69791
+ },
69792
+ review: {
69793
+ id: "review",
69794
+ name: "Review",
69795
+ description: "Review mode that keeps tool usage read-oriented for audits and code review.",
69796
+ approvalMode: ApprovalMode2.DEFAULT
69797
+ }
69798
+ };
69469
69799
  var DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD = 25e3;
69470
69800
  var DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES = 1e3;
69471
69801
  var MCPServerConfig = class {
@@ -69534,6 +69864,21 @@ function normalizeConfigOutputFormat(format) {
69534
69864
  }
69535
69865
  }
69536
69866
  __name(normalizeConfigOutputFormat, "normalizeConfigOutputFormat");
69867
+ function normalizeStructuredOutputSettings(settings) {
69868
+ if (!settings) {
69869
+ return void 0;
69870
+ }
69871
+ if (typeof settings.schema !== "object" || settings.schema === null || Array.isArray(settings.schema)) {
69872
+ return void 0;
69873
+ }
69874
+ const retriesRaw = settings.retries ?? 2;
69875
+ const retries = Number.isFinite(retriesRaw) && retriesRaw >= 0 ? Math.floor(retriesRaw) : 2;
69876
+ return {
69877
+ schema: structuredClone(settings.schema),
69878
+ retries
69879
+ };
69880
+ }
69881
+ __name(normalizeStructuredOutputSettings, "normalizeStructuredOutputSettings");
69537
69882
  var Config = class {
69538
69883
  static {
69539
69884
  __name(this, "Config");
@@ -69558,6 +69903,7 @@ var Config = class {
69558
69903
  debugMode;
69559
69904
  inputFormat;
69560
69905
  outputFormat;
69906
+ structuredOutput;
69561
69907
  includePartialMessages;
69562
69908
  question;
69563
69909
  fullContext;
@@ -69574,6 +69920,7 @@ var Config = class {
69574
69920
  geminiMdFileCount;
69575
69921
  contextFileName;
69576
69922
  approvalMode;
69923
+ modeProfile;
69577
69924
  showMemoryUsage;
69578
69925
  accessibility;
69579
69926
  telemetrySettings;
@@ -69662,12 +70009,13 @@ var Config = class {
69662
70009
  this.modelConfigService = new ModelConfigService(params.modelConfigServiceConfig ?? DEFAULT_MODEL_CONFIGS);
69663
70010
  this.modelAvailabilityService = new ModelAvailabilityService();
69664
70011
  this.sandbox = params.sandbox;
69665
- this.targetDir = path54.resolve(params.targetDir);
70012
+ this.targetDir = path55.resolve(params.targetDir);
69666
70013
  this.workspaceContext = new WorkspaceContext(this.targetDir, params.includeDirectories ?? []);
69667
70014
  this.debugMode = params.debugMode;
69668
70015
  this.inputFormat = params.inputFormat ?? InputFormat.TEXT;
69669
70016
  const normalizedOutputFormat = normalizeConfigOutputFormat(params.outputFormat ?? params.output?.format);
69670
70017
  this.outputFormat = normalizedOutputFormat ?? OutputFormat.TEXT;
70018
+ this.structuredOutput = normalizeStructuredOutputSettings(params.structuredOutput ?? params.output?.structured);
69671
70019
  this.includePartialMessages = params.includePartialMessages ?? false;
69672
70020
  this.question = params.question;
69673
70021
  this.fullContext = params.fullContext ?? false;
@@ -69683,7 +70031,8 @@ var Config = class {
69683
70031
  this.userMemory = params.userMemory ?? "";
69684
70032
  this.geminiMdFileCount = params.geminiMdFileCount ?? 0;
69685
70033
  this.contextFileName = params.contextFileName;
69686
- this.approvalMode = params.approvalMode ?? ApprovalMode.DEFAULT;
70034
+ this.approvalMode = params.approvalMode ?? ApprovalMode2.DEFAULT;
70035
+ this.modeProfile = params.modeProfile;
69687
70036
  this.showMemoryUsage = params.showMemoryUsage ?? false;
69688
70037
  this.accessibility = params.accessibility ?? {};
69689
70038
  this.telemetrySettings = {
@@ -69740,6 +70089,9 @@ var Config = class {
69740
70089
  this.trustedFolder = params.trustedFolder;
69741
70090
  this.skipLoopDetection = params.skipLoopDetection ?? false;
69742
70091
  this.skipStartupContext = params.skipStartupContext ?? false;
70092
+ if (this.modeProfile) {
70093
+ this.setApprovalMode(MODE_PROFILE_INFO[this.modeProfile].approvalMode);
70094
+ }
69743
70095
  this.webSearch = params.webSearch;
69744
70096
  this.useRipgrep = params.useRipgrep ?? true;
69745
70097
  this.useBuiltinRipgrep = params.useBuiltinRipgrep ?? true;
@@ -70130,10 +70482,23 @@ var Config = class {
70130
70482
  return this.approvalMode;
70131
70483
  }
70132
70484
  setApprovalMode(mode) {
70133
- if (!this.isTrustedFolder() && mode !== ApprovalMode.DEFAULT && mode !== ApprovalMode.PLAN) {
70485
+ if (!this.isTrustedFolder() && mode !== ApprovalMode2.DEFAULT && mode !== ApprovalMode2.PLAN) {
70134
70486
  throw new Error("Cannot enable privileged approval modes in an untrusted folder.");
70135
70487
  }
70136
70488
  this.approvalMode = mode;
70489
+ if (this.modeProfile && MODE_PROFILE_INFO[this.modeProfile].approvalMode !== mode) {
70490
+ this.modeProfile = void 0;
70491
+ }
70492
+ }
70493
+ getModeProfile() {
70494
+ return this.modeProfile;
70495
+ }
70496
+ setModeProfile(modeProfile) {
70497
+ this.modeProfile = modeProfile;
70498
+ if (!modeProfile) {
70499
+ return;
70500
+ }
70501
+ this.setApprovalMode(MODE_PROFILE_INFO[modeProfile].approvalMode);
70137
70502
  }
70138
70503
  getShowMemoryUsage() {
70139
70504
  return this.showMemoryUsage;
@@ -70482,6 +70847,15 @@ var Config = class {
70482
70847
  getOutputFormat() {
70483
70848
  return this.outputFormat;
70484
70849
  }
70850
+ getStructuredOutput() {
70851
+ if (!this.structuredOutput) {
70852
+ return void 0;
70853
+ }
70854
+ return {
70855
+ schema: structuredClone(this.structuredOutput.schema),
70856
+ retries: this.structuredOutput.retries
70857
+ };
70858
+ }
70485
70859
  async getGitService() {
70486
70860
  if (!this.gitService) {
70487
70861
  this.gitService = new GitService(this.targetDir, this.storage);
@@ -70624,7 +70998,7 @@ init_esbuild_shims();
70624
70998
 
70625
70999
  // packages/core/dist/src/core/logger.js
70626
71000
  init_esbuild_shims();
70627
- import path55 from "node:path";
71001
+ import path56 from "node:path";
70628
71002
  import { promises as fs45 } from "node:fs";
70629
71003
  var LOG_FILE_NAME = "logs.json";
70630
71004
  var MessageSenderType;
@@ -70703,7 +71077,7 @@ var Logger = class {
70703
71077
  return;
70704
71078
  }
70705
71079
  this.papertDir = this.storage.getProjectTempDir();
70706
- this.logFilePath = path55.join(this.papertDir, LOG_FILE_NAME);
71080
+ this.logFilePath = path56.join(this.papertDir, LOG_FILE_NAME);
70707
71081
  try {
70708
71082
  await fs45.mkdir(this.papertDir, { recursive: true });
70709
71083
  let fileExisted = true;
@@ -70794,7 +71168,7 @@ var Logger = class {
70794
71168
  throw new Error("Checkpoint file path not set.");
70795
71169
  }
70796
71170
  const encodedTag = encodeTagName(tag2);
70797
- return path55.join(this.papertDir, `checkpoint-${encodedTag}.json`);
71171
+ return path56.join(this.papertDir, `checkpoint-${encodedTag}.json`);
70798
71172
  }
70799
71173
  async _getCheckpointPath(tag2) {
70800
71174
  const newPath = this._checkpointPath(tag2);
@@ -70807,7 +71181,7 @@ var Logger = class {
70807
71181
  throw error2;
70808
71182
  }
70809
71183
  }
70810
- const oldPath = path55.join(this.papertDir, `checkpoint-${tag2}.json`);
71184
+ const oldPath = path56.join(this.papertDir, `checkpoint-${tag2}.json`);
70811
71185
  try {
70812
71186
  await fs45.access(oldPath);
70813
71187
  return oldPath;
@@ -70824,10 +71198,10 @@ var Logger = class {
70824
71198
  debugLogger.error("Logger not initialized or checkpoint file path not set. Cannot save a checkpoint.");
70825
71199
  return;
70826
71200
  }
70827
- const path66 = this._checkpointPath(tag2);
71201
+ const path67 = this._checkpointPath(tag2);
70828
71202
  try {
70829
71203
  const checkpoint = Array.isArray(conversation) ? { history: conversation } : conversation;
70830
- await fs45.writeFile(path66, JSON.stringify(checkpoint, null, 2), "utf-8");
71204
+ await fs45.writeFile(path67, JSON.stringify(checkpoint, null, 2), "utf-8");
70831
71205
  } catch (error2) {
70832
71206
  debugLogger.error("Error writing to checkpoint file:", error2);
70833
71207
  }
@@ -70837,9 +71211,9 @@ var Logger = class {
70837
71211
  debugLogger.error("Logger not initialized or checkpoint file path not set. Cannot load checkpoint.");
70838
71212
  return { history: [] };
70839
71213
  }
70840
- const path66 = await this._getCheckpointPath(tag2);
71214
+ const path67 = await this._getCheckpointPath(tag2);
70841
71215
  try {
70842
- const fileContent = await fs45.readFile(path66, "utf-8");
71216
+ const fileContent = await fs45.readFile(path67, "utf-8");
70843
71217
  const parsedContent = JSON.parse(fileContent);
70844
71218
  if (Array.isArray(parsedContent)) {
70845
71219
  return { history: parsedContent };
@@ -70847,14 +71221,14 @@ var Logger = class {
70847
71221
  if (typeof parsedContent === "object" && parsedContent !== null && "history" in parsedContent) {
70848
71222
  return parsedContent;
70849
71223
  }
70850
- debugLogger.warn(`Checkpoint file at ${path66} has an unknown format. Returning empty checkpoint.`);
71224
+ debugLogger.warn(`Checkpoint file at ${path67} has an unknown format. Returning empty checkpoint.`);
70851
71225
  return { history: [] };
70852
71226
  } catch (error2) {
70853
71227
  const nodeError = error2;
70854
71228
  if (nodeError.code === "ENOENT") {
70855
71229
  return { history: [] };
70856
71230
  }
70857
- debugLogger.error(`Failed to read or parse checkpoint file ${path66}:`, error2);
71231
+ debugLogger.error(`Failed to read or parse checkpoint file ${path67}:`, error2);
70858
71232
  return { history: [] };
70859
71233
  }
70860
71234
  }
@@ -70875,7 +71249,7 @@ var Logger = class {
70875
71249
  throw error2;
70876
71250
  }
70877
71251
  }
70878
- const oldPath = path55.join(this.papertDir, `checkpoint-${tag2}.json`);
71252
+ const oldPath = path56.join(this.papertDir, `checkpoint-${tag2}.json`);
70879
71253
  if (newPath !== oldPath) {
70880
71254
  try {
70881
71255
  await fs45.unlink(oldPath);
@@ -71077,25 +71451,25 @@ __name(getAdminErrorMessage, "getAdminErrorMessage");
71077
71451
  // packages/core/dist/src/utils/filesearch/fileSearch.js
71078
71452
  init_esbuild_shims();
71079
71453
  var import_picomatch2 = __toESM(require_picomatch2(), 1);
71080
- import path58 from "node:path";
71454
+ import path59 from "node:path";
71081
71455
 
71082
71456
  // packages/core/dist/src/utils/filesearch/ignore.js
71083
71457
  init_esbuild_shims();
71084
71458
  var import_ignore4 = __toESM(require_ignore(), 1);
71085
71459
  var import_picomatch = __toESM(require_picomatch2(), 1);
71086
71460
  import fs46 from "node:fs";
71087
- import path56 from "node:path";
71461
+ import path57 from "node:path";
71088
71462
  var hasFileExtension = (0, import_picomatch.default)("**/*[*.]*");
71089
71463
  function loadIgnoreRules(options2) {
71090
71464
  const ignorer = new Ignore();
71091
71465
  if (options2.useGitignore) {
71092
- const gitignorePath = path56.join(options2.projectRoot, ".gitignore");
71466
+ const gitignorePath = path57.join(options2.projectRoot, ".gitignore");
71093
71467
  if (fs46.existsSync(gitignorePath)) {
71094
71468
  ignorer.add(fs46.readFileSync(gitignorePath, "utf8"));
71095
71469
  }
71096
71470
  }
71097
71471
  if (options2.usePapertignore) {
71098
- const papertignorePath = path56.join(options2.projectRoot, ".papertignore");
71472
+ const papertignorePath = path57.join(options2.projectRoot, ".papertignore");
71099
71473
  if (fs46.existsSync(papertignorePath)) {
71100
71474
  ignorer.add(fs46.readFileSync(papertignorePath, "utf8"));
71101
71475
  }
@@ -71225,7 +71599,7 @@ var ResultCache = class {
71225
71599
  // packages/core/dist/src/utils/filesearch/crawler.js
71226
71600
  init_esbuild_shims();
71227
71601
  var import_fdir = __toESM(require_dist4(), 1);
71228
- import path57 from "node:path";
71602
+ import path58 from "node:path";
71229
71603
 
71230
71604
  // packages/core/dist/src/utils/filesearch/crawlCache.js
71231
71605
  init_esbuild_shims();
@@ -71283,7 +71657,7 @@ var write = /* @__PURE__ */ __name((key, results, ttlMs) => {
71283
71657
 
71284
71658
  // packages/core/dist/src/utils/filesearch/crawler.js
71285
71659
  function toPosixPath(p) {
71286
- return p.split(path57.sep).join(path57.posix.sep);
71660
+ return p.split(path58.sep).join(path58.posix.sep);
71287
71661
  }
71288
71662
  __name(toPosixPath, "toPosixPath");
71289
71663
  async function crawl(options2) {
@@ -71300,7 +71674,7 @@ async function crawl(options2) {
71300
71674
  try {
71301
71675
  const dirFilter = options2.ignore.getDirectoryFilter();
71302
71676
  const api = new import_fdir.fdir().withRelativePaths().withDirs().withPathSeparator("/").exclude((_, dirPath) => {
71303
- const relativePath = path57.posix.relative(posixCrawlDirectory, dirPath);
71677
+ const relativePath = path58.posix.relative(posixCrawlDirectory, dirPath);
71304
71678
  return dirFilter(`${relativePath}/`);
71305
71679
  });
71306
71680
  if (options2.maxDepth !== void 0) {
@@ -71310,8 +71684,8 @@ async function crawl(options2) {
71310
71684
  } catch (_e) {
71311
71685
  return [];
71312
71686
  }
71313
- const relativeToCrawlDir = path57.posix.relative(posixCwd, posixCrawlDirectory);
71314
- const relativeToCwdResults = results.map((p) => path57.posix.join(relativeToCrawlDir, p));
71687
+ const relativeToCrawlDir = path58.posix.relative(posixCwd, posixCrawlDirectory);
71688
+ const relativeToCwdResults = results.map((p) => path58.posix.join(relativeToCrawlDir, p));
71315
71689
  if (options2.cache) {
71316
71690
  const cacheKey = getCacheKey(options2.crawlDirectory, options2.ignore.getFingerprint(), options2.maxDepth);
71317
71691
  write(cacheKey, relativeToCwdResults, options2.cacheTtl * 1e3);
@@ -72450,9 +72824,9 @@ var DirectoryFileSearch = class {
72450
72824
  throw new Error("Engine not initialized. Call initialize() first.");
72451
72825
  }
72452
72826
  pattern = pattern || "*";
72453
- const dir = pattern.endsWith("/") ? pattern : path58.dirname(pattern);
72827
+ const dir = pattern.endsWith("/") ? pattern : path59.dirname(pattern);
72454
72828
  const results = await crawl({
72455
- crawlDirectory: path58.join(this.options.projectRoot, dir),
72829
+ crawlDirectory: path59.join(this.options.projectRoot, dir),
72456
72830
  cwd: this.options.projectRoot,
72457
72831
  maxDepth: 0,
72458
72832
  ignore: this.ignore,
@@ -72675,9 +73049,9 @@ __name(subagentGenerator, "subagentGenerator");
72675
73049
  // packages/core/dist/src/utils/projectSummary.js
72676
73050
  init_esbuild_shims();
72677
73051
  import * as fs47 from "fs/promises";
72678
- import * as path59 from "path";
73052
+ import * as path60 from "path";
72679
73053
  async function getProjectSummaryInfo() {
72680
- const summaryPath = path59.join(process.cwd(), ".papert", "PROJECT_SUMMARY.md");
73054
+ const summaryPath = path60.join(process.cwd(), ".papert", "PROJECT_SUMMARY.md");
72681
73055
  try {
72682
73056
  await fs47.access(summaryPath);
72683
73057
  } catch {
@@ -72743,7 +73117,7 @@ init_esbuild_shims();
72743
73117
 
72744
73118
  // packages/core/dist/src/policy/config.js
72745
73119
  init_esbuild_shims();
72746
- import * as path61 from "node:path";
73120
+ import * as path62 from "node:path";
72747
73121
  import { fileURLToPath as fileURLToPath3 } from "node:url";
72748
73122
 
72749
73123
  // packages/core/dist/src/policy/index.js
@@ -72756,7 +73130,7 @@ var ADMIN_POLICY_TIER = 3;
72756
73130
  init_esbuild_shims();
72757
73131
  var import_toml = __toESM(require_toml(), 1);
72758
73132
  import fs48 from "node:fs";
72759
- import path60 from "node:path";
73133
+ import path61 from "node:path";
72760
73134
  function toTierName(tier) {
72761
73135
  if (tier === 3)
72762
73136
  return "admin";
@@ -72779,7 +73153,7 @@ function loadPoliciesFromToml(approvalMode, policyDirs, getPolicyTier2) {
72779
73153
  const tier = getPolicyTier2(dir);
72780
73154
  const tierName = toTierName(tier);
72781
73155
  for (const fileName of files) {
72782
- const filePath = path60.join(dir, fileName);
73156
+ const filePath = path61.join(dir, fileName);
72783
73157
  let parsed;
72784
73158
  try {
72785
73159
  parsed = import_toml.default.parse(fs48.readFileSync(filePath, "utf-8"));
@@ -72872,10 +73246,76 @@ __name(loadPoliciesFromToml, "loadPoliciesFromToml");
72872
73246
 
72873
73247
  // packages/core/dist/src/policy/config.js
72874
73248
  var __filename2 = fileURLToPath3(import.meta.url);
72875
- var __dirname2 = path61.dirname(__filename2);
72876
- var DEFAULT_CORE_POLICIES_DIR = path61.join(__dirname2, "policies");
72877
- var USER_POLICIES_DIR = path61.join(Storage.getGlobalPapertDir(), "policies");
72878
- var SYSTEM_POLICIES_DIR = path61.join(Storage.getGlobalPapertDir(), "system-policies");
73249
+ var __dirname2 = path62.dirname(__filename2);
73250
+ var DEFAULT_CORE_POLICIES_DIR = path62.join(__dirname2, "policies");
73251
+ var USER_POLICIES_DIR = path62.join(Storage.getGlobalPapertDir(), "policies");
73252
+ var SYSTEM_POLICIES_DIR = path62.join(Storage.getGlobalPapertDir(), "system-policies");
73253
+ function toPolicyDecision(decision) {
73254
+ if (decision === "allow") {
73255
+ return PolicyDecision.ALLOW;
73256
+ }
73257
+ if (decision === "deny") {
73258
+ return PolicyDecision.DENY;
73259
+ }
73260
+ return PolicyDecision.ASK_USER;
73261
+ }
73262
+ __name(toPolicyDecision, "toPolicyDecision");
73263
+ function parsePermissionDslString(entry) {
73264
+ const match = entry.trim().match(/^(allow|ask|deny)\s+([^\s(]+)(?:\((.+)\))?$/i);
73265
+ if (!match) {
73266
+ return null;
73267
+ }
73268
+ const [, decisionKeyword, toolPattern, commandPrefix] = match;
73269
+ const normalizedToolPattern = toolPattern.trim();
73270
+ if (!normalizedToolPattern) {
73271
+ return null;
73272
+ }
73273
+ const normalizedCommandPrefix = commandPrefix?.trim();
73274
+ if (normalizedToolPattern === "external_directory") {
73275
+ return {
73276
+ decision: toPolicyDecision(decisionKeyword.toLowerCase()),
73277
+ toolName: "*",
73278
+ permissionClass: "external_directory"
73279
+ };
73280
+ }
73281
+ return {
73282
+ decision: toPolicyDecision(decisionKeyword.toLowerCase()),
73283
+ toolName: normalizedToolPattern,
73284
+ ...normalizedCommandPrefix ? { commandPrefix: normalizedCommandPrefix } : {}
73285
+ };
73286
+ }
73287
+ __name(parsePermissionDslString, "parsePermissionDslString");
73288
+ function parsePermissionDslEntry(entry, forcedAgentName) {
73289
+ if (typeof entry === "string") {
73290
+ const parsed = parsePermissionDslString(entry);
73291
+ if (!parsed) {
73292
+ return null;
73293
+ }
73294
+ return {
73295
+ toolName: parsed.toolName,
73296
+ decision: parsed.decision,
73297
+ ...parsed.commandPrefix ? { commandPrefix: parsed.commandPrefix } : {},
73298
+ ...parsed.permissionClass ? { permissionClass: parsed.permissionClass } : {},
73299
+ ...forcedAgentName ? { agentName: forcedAgentName } : {}
73300
+ };
73301
+ }
73302
+ if (!entry || typeof entry.tool !== "string") {
73303
+ return null;
73304
+ }
73305
+ const toolName = entry.tool.trim();
73306
+ if (!toolName) {
73307
+ return null;
73308
+ }
73309
+ return {
73310
+ toolName,
73311
+ decision: toPolicyDecision(entry.decision),
73312
+ ...entry.commandPrefix ? { commandPrefix: entry.commandPrefix } : {},
73313
+ ...entry.permissionClass ? { permissionClass: entry.permissionClass } : {},
73314
+ ...forcedAgentName || entry.agentName ? { agentName: forcedAgentName ?? entry.agentName } : {},
73315
+ reason: entry.reason
73316
+ };
73317
+ }
73318
+ __name(parsePermissionDslEntry, "parsePermissionDslEntry");
72879
73319
  function getPolicyDirectories(defaultPoliciesDir) {
72880
73320
  const dirs = [];
72881
73321
  if (defaultPoliciesDir) {
@@ -72889,17 +73329,17 @@ function getPolicyDirectories(defaultPoliciesDir) {
72889
73329
  }
72890
73330
  __name(getPolicyDirectories, "getPolicyDirectories");
72891
73331
  function getPolicyTier(dir, defaultPoliciesDir) {
72892
- const normalizedDir = path61.resolve(dir);
72893
- if (defaultPoliciesDir && normalizedDir === path61.resolve(defaultPoliciesDir)) {
73332
+ const normalizedDir = path62.resolve(dir);
73333
+ if (defaultPoliciesDir && normalizedDir === path62.resolve(defaultPoliciesDir)) {
72894
73334
  return DEFAULT_POLICY_TIER;
72895
73335
  }
72896
- if (normalizedDir === path61.resolve(DEFAULT_CORE_POLICIES_DIR)) {
73336
+ if (normalizedDir === path62.resolve(DEFAULT_CORE_POLICIES_DIR)) {
72897
73337
  return DEFAULT_POLICY_TIER;
72898
73338
  }
72899
- if (normalizedDir === path61.resolve(USER_POLICIES_DIR)) {
73339
+ if (normalizedDir === path62.resolve(USER_POLICIES_DIR)) {
72900
73340
  return USER_POLICY_TIER;
72901
73341
  }
72902
- if (normalizedDir === path61.resolve(SYSTEM_POLICIES_DIR)) {
73342
+ if (normalizedDir === path62.resolve(SYSTEM_POLICIES_DIR)) {
72903
73343
  return ADMIN_POLICY_TIER;
72904
73344
  }
72905
73345
  return DEFAULT_POLICY_TIER;
@@ -72948,6 +73388,34 @@ function createPolicyEngineConfig(settings, approvalMode, defaultPoliciesDir) {
72948
73388
  }
72949
73389
  }
72950
73390
  }
73391
+ if (settings.tools?.permissions) {
73392
+ const parsedPermissionRules = settings.tools.permissions.map((entry) => parsePermissionDslEntry(entry)).filter((rule) => !!rule);
73393
+ parsedPermissionRules.forEach((rule, index) => {
73394
+ rules.push({
73395
+ ...rule,
73396
+ priority: 2.95 + index / 1e3
73397
+ });
73398
+ });
73399
+ }
73400
+ if (settings.tools?.agentPermissions) {
73401
+ let agentRuleOffset = 0;
73402
+ for (const [agentName, permissions] of Object.entries(settings.tools.agentPermissions)) {
73403
+ const normalizedAgentName = agentName.trim();
73404
+ if (!normalizedAgentName || !Array.isArray(permissions)) {
73405
+ continue;
73406
+ }
73407
+ const parsedAgentRules = permissions.map((entry) => parsePermissionDslEntry(entry, normalizedAgentName)).filter((rule) => !!rule);
73408
+ parsedAgentRules.forEach((rule, index) => {
73409
+ rules.push({
73410
+ ...rule,
73411
+ // Agent-scoped permission rules intentionally evaluate after global
73412
+ // rules so they can override behavior for that specific agent.
73413
+ priority: 2.98 + (agentRuleOffset + index) / 1e3
73414
+ });
73415
+ });
73416
+ agentRuleOffset += parsedAgentRules.length;
73417
+ }
73418
+ }
72951
73419
  return {
72952
73420
  rules,
72953
73421
  checkers,
@@ -73745,7 +74213,7 @@ import * as fs50 from "node:fs/promises";
73745
74213
  // packages/core/dist/src/scheduler/store.js
73746
74214
  init_esbuild_shims();
73747
74215
  import * as fs49 from "node:fs/promises";
73748
- import * as path62 from "node:path";
74216
+ import * as path63 from "node:path";
73749
74217
  async function loadSchedulerStore(storePath) {
73750
74218
  try {
73751
74219
  const raw = await fs49.readFile(storePath, "utf8");
@@ -73763,7 +74231,7 @@ async function loadSchedulerStore(storePath) {
73763
74231
  }
73764
74232
  __name(loadSchedulerStore, "loadSchedulerStore");
73765
74233
  async function saveSchedulerStore(storePath, store) {
73766
- await fs49.mkdir(path62.dirname(storePath), { recursive: true });
74234
+ await fs49.mkdir(path63.dirname(storePath), { recursive: true });
73767
74235
  await fs49.writeFile(storePath, JSON.stringify(store, null, 2));
73768
74236
  }
73769
74237
  __name(saveSchedulerStore, "saveSchedulerStore");
@@ -73933,15 +74401,15 @@ __name(emit, "emit");
73933
74401
  // packages/core/dist/src/scheduler/run-log.js
73934
74402
  init_esbuild_shims();
73935
74403
  import * as fs51 from "node:fs/promises";
73936
- import * as path63 from "node:path";
74404
+ import * as path64 from "node:path";
73937
74405
  function resolveRunLogPath(storePath, jobId) {
73938
- const baseDir = path63.join(path63.dirname(storePath), "runs");
73939
- return path63.join(baseDir, `${jobId}.jsonl`);
74406
+ const baseDir = path64.join(path64.dirname(storePath), "runs");
74407
+ return path64.join(baseDir, `${jobId}.jsonl`);
73940
74408
  }
73941
74409
  __name(resolveRunLogPath, "resolveRunLogPath");
73942
74410
  async function appendRunLogEntry(storePath, entry) {
73943
74411
  const logPath = resolveRunLogPath(storePath, entry.jobId);
73944
- await fs51.mkdir(path63.dirname(logPath), { recursive: true });
74412
+ await fs51.mkdir(path64.dirname(logPath), { recursive: true });
73945
74413
  await fs51.appendFile(logPath, `${JSON.stringify(entry)}
73946
74414
  `);
73947
74415
  }
@@ -74247,12 +74715,12 @@ var TaskScheduler = class {
74247
74715
 
74248
74716
  // packages/core/dist/src/scheduler/paths.js
74249
74717
  init_esbuild_shims();
74250
- import * as path64 from "node:path";
74718
+ import * as path65 from "node:path";
74251
74719
  var SCHEDULER_DIRNAME = "schedule";
74252
74720
  var SCHEDULER_STORE_FILENAME = "jobs.json";
74253
74721
  function resolveSchedulerStorePath(cwd3) {
74254
74722
  const storage = new Storage(cwd3);
74255
- return path64.join(storage.getProjectDir(), SCHEDULER_DIRNAME, SCHEDULER_STORE_FILENAME);
74723
+ return path65.join(storage.getProjectDir(), SCHEDULER_DIRNAME, SCHEDULER_STORE_FILENAME);
74256
74724
  }
74257
74725
  __name(resolveSchedulerStorePath, "resolveSchedulerStorePath");
74258
74726
 
@@ -74263,7 +74731,7 @@ init_esbuild_shims();
74263
74731
  init_esbuild_shims();
74264
74732
  import * as child_process from "node:child_process";
74265
74733
  import * as process8 from "node:process";
74266
- import * as path65 from "node:path";
74734
+ import * as path66 from "node:path";
74267
74735
  import * as fs52 from "node:fs";
74268
74736
  import * as os11 from "node:os";
74269
74737
  function getVsCodeCommand(platform3 = process8.platform) {
@@ -74290,11 +74758,11 @@ async function findVsCodeCommand(platform3 = process8.platform) {
74290
74758
  const locations = [];
74291
74759
  const homeDir = os11.homedir();
74292
74760
  if (platform3 === "darwin") {
74293
- locations.push("/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code", path65.join(homeDir, "Library/Application Support/Code/bin/code"));
74761
+ locations.push("/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code", path66.join(homeDir, "Library/Application Support/Code/bin/code"));
74294
74762
  } else if (platform3 === "linux") {
74295
- locations.push("/usr/share/code/bin/code", "/snap/bin/code", path65.join(homeDir, ".local/share/code/bin/code"));
74763
+ locations.push("/usr/share/code/bin/code", "/snap/bin/code", path66.join(homeDir, ".local/share/code/bin/code"));
74296
74764
  } else if (platform3 === "win32") {
74297
- locations.push(path65.join(process8.env["ProgramFiles"] || "C:\\Program Files", "Microsoft VS Code", "bin", "code.cmd"), path65.join(homeDir, "AppData", "Local", "Programs", "Microsoft VS Code", "bin", "code.cmd"));
74765
+ locations.push(path66.join(process8.env["ProgramFiles"] || "C:\\Program Files", "Microsoft VS Code", "bin", "code.cmd"), path66.join(homeDir, "AppData", "Local", "Programs", "Microsoft VS Code", "bin", "code.cmd"));
74298
74766
  }
74299
74767
  for (const location of locations) {
74300
74768
  if (fs52.existsSync(location)) {
@@ -74495,10 +74963,126 @@ init_esbuild_shims();
74495
74963
 
74496
74964
  // packages/core/dist/src/utils/checkpointUtils.js
74497
74965
  init_esbuild_shims();
74966
+ import { createHash as createHash4 } from "node:crypto";
74967
+ var CHECKPOINT_INTEGRITY_VERSION = 1;
74968
+ var CHECKPOINT_INTEGRITY_ALGORITHM = "sha256";
74498
74969
  var ContentSchema = external_exports.object({
74499
74970
  role: external_exports.string().optional(),
74500
74971
  parts: external_exports.array(external_exports.record(external_exports.unknown()))
74501
74972
  }).passthrough();
74973
+ function stableNormalize(value) {
74974
+ if (Array.isArray(value)) {
74975
+ return value.map((item) => stableNormalize(item));
74976
+ }
74977
+ if (value && typeof value === "object") {
74978
+ const sortedEntries = Object.entries(value).sort(([left2], [right2]) => left2.localeCompare(right2)).map(([key, nestedValue]) => [key, stableNormalize(nestedValue)]);
74979
+ return Object.fromEntries(sortedEntries);
74980
+ }
74981
+ return value;
74982
+ }
74983
+ __name(stableNormalize, "stableNormalize");
74984
+ function stableStringify2(value) {
74985
+ return JSON.stringify(stableNormalize(value));
74986
+ }
74987
+ __name(stableStringify2, "stableStringify");
74988
+ function getToolCallDataSchema(historyItemSchema) {
74989
+ const schema = historyItemSchema ?? external_exports.any();
74990
+ return external_exports.object({
74991
+ history: external_exports.array(schema).optional(),
74992
+ clientHistory: external_exports.array(ContentSchema).optional(),
74993
+ commitHash: external_exports.string().optional(),
74994
+ toolCall: external_exports.object({
74995
+ name: external_exports.string(),
74996
+ args: external_exports.record(external_exports.unknown())
74997
+ }),
74998
+ messageId: external_exports.string().optional()
74999
+ });
75000
+ }
75001
+ __name(getToolCallDataSchema, "getToolCallDataSchema");
75002
+ function getCheckpointEnvelopeSchema(historyItemSchema) {
75003
+ return external_exports.object({
75004
+ version: external_exports.number().int().positive(),
75005
+ createdAt: external_exports.string(),
75006
+ data: getToolCallDataSchema(historyItemSchema),
75007
+ integrity: external_exports.object({
75008
+ algorithm: external_exports.string(),
75009
+ hash: external_exports.string().min(1)
75010
+ })
75011
+ });
75012
+ }
75013
+ __name(getCheckpointEnvelopeSchema, "getCheckpointEnvelopeSchema");
75014
+ function computeCheckpointHash(data, version2 = CHECKPOINT_INTEGRITY_VERSION) {
75015
+ return createHash4(CHECKPOINT_INTEGRITY_ALGORITHM).update(stableStringify2({ version: version2, data })).digest("hex");
75016
+ }
75017
+ __name(computeCheckpointHash, "computeCheckpointHash");
75018
+ function parseCheckpointContent(rawContent, historyItemSchema) {
75019
+ let parsedJson;
75020
+ try {
75021
+ parsedJson = JSON.parse(rawContent);
75022
+ } catch {
75023
+ return {
75024
+ success: false,
75025
+ error: {
75026
+ code: "invalid_json",
75027
+ message: "Checkpoint JSON could not be parsed."
75028
+ }
75029
+ };
75030
+ }
75031
+ const envelopeSchema = getCheckpointEnvelopeSchema(historyItemSchema);
75032
+ const envelopeResult = envelopeSchema.safeParse(parsedJson);
75033
+ if (envelopeResult.success) {
75034
+ const envelope = envelopeResult.data;
75035
+ if (envelope.integrity.algorithm !== CHECKPOINT_INTEGRITY_ALGORITHM) {
75036
+ return {
75037
+ success: false,
75038
+ error: {
75039
+ code: "invalid_checkpoint",
75040
+ message: `Unsupported checkpoint integrity algorithm: ${envelope.integrity.algorithm}`
75041
+ }
75042
+ };
75043
+ }
75044
+ const expectedHash = computeCheckpointHash(envelope.data, envelope.version);
75045
+ if (expectedHash !== envelope.integrity.hash) {
75046
+ return {
75047
+ success: false,
75048
+ error: {
75049
+ code: "integrity_mismatch",
75050
+ message: "Checkpoint integrity hash mismatch."
75051
+ }
75052
+ };
75053
+ }
75054
+ return {
75055
+ success: true,
75056
+ checkpoint: {
75057
+ data: envelope.data,
75058
+ integrityVerified: true,
75059
+ version: envelope.version,
75060
+ createdAt: envelope.createdAt
75061
+ }
75062
+ };
75063
+ }
75064
+ const legacySchema = getToolCallDataSchema(historyItemSchema);
75065
+ const legacyResult = legacySchema.safeParse(parsedJson);
75066
+ if (!legacyResult.success) {
75067
+ return {
75068
+ success: false,
75069
+ error: {
75070
+ code: "invalid_checkpoint",
75071
+ message: "Checkpoint file is invalid or corrupted."
75072
+ }
75073
+ };
75074
+ }
75075
+ return {
75076
+ success: true,
75077
+ checkpoint: {
75078
+ data: legacyResult.data,
75079
+ integrityVerified: false,
75080
+ version: null,
75081
+ createdAt: null
75082
+ }
75083
+ };
75084
+ }
75085
+ __name(parseCheckpointContent, "parseCheckpointContent");
74502
75086
 
74503
75087
  // packages/core/dist/src/utils/tool-utils.js
74504
75088
  var normalizeIdentifier = /* @__PURE__ */ __name((identifier) => identifier.trim().replace(/^_+/, ""), "normalizeIdentifier");
@@ -74857,7 +75441,7 @@ __name(isShellCommandReadOnly, "isShellCommandReadOnly");
74857
75441
  // packages/core/dist/src/utils/shell-utils.js
74858
75442
  import { execFile as execFile3, execFileSync } from "node:child_process";
74859
75443
  import { accessSync, constants as fsConstants } from "node:fs";
74860
- var policyEngine = new PolicyEngine(createPolicyEngineConfig({}, ApprovalMode2.DEFAULT));
75444
+ var policyEngine = new PolicyEngine(createPolicyEngineConfig({}, ApprovalMode.DEFAULT));
74861
75445
  var SHELL_TOOL_NAMES2 = ["run_shell_command", "ShellTool"];
74862
75446
  function getShellConfiguration() {
74863
75447
  if (isWindows()) {
@@ -75169,8 +75753,8 @@ function resolveCommandPath(command) {
75169
75753
  }
75170
75754
  __name(resolveCommandPath, "resolveCommandPath");
75171
75755
  function isCommandAvailable(command) {
75172
- const { path: path66, error: error2 } = resolveCommandPath(command);
75173
- return { available: path66 !== null, error: error2 };
75756
+ const { path: path67, error: error2 } = resolveCommandPath(command);
75757
+ return { available: path67 !== null, error: error2 };
75174
75758
  }
75175
75759
  __name(isCommandAvailable, "isCommandAvailable");
75176
75760
  function isCommandAllowed(command, config2) {
@@ -76334,13 +76918,14 @@ export {
76334
76918
  init_ansi_regex,
76335
76919
  stripAnsi,
76336
76920
  require_shell_quote,
76337
- ApprovalMode2 as ApprovalMode,
76921
+ ApprovalMode,
76338
76922
  require_toml,
76339
76923
  createPolicyEngineConfig,
76340
76924
  getShellConfiguration,
76341
76925
  escapeShellArg,
76342
76926
  checkCommandPermissions,
76343
76927
  execCommand,
76928
+ resolveCommandPath,
76344
76929
  isCommandAvailable,
76345
76930
  isBinary,
76346
76931
  ShellExecutionService,
@@ -76359,6 +76944,7 @@ export {
76359
76944
  GitService,
76360
76945
  isWithinRoot,
76361
76946
  processSingleFileContent,
76947
+ ResultSchema,
76362
76948
  Client,
76363
76949
  require_cross_spawn,
76364
76950
  IDEConnectionStatus,
@@ -76370,10 +76956,12 @@ export {
76370
76956
  TodoWriteTool,
76371
76957
  MCPOAuthTokenStorage,
76372
76958
  MCPOAuthProvider,
76959
+ MCP_DEFAULT_TIMEOUT_MSEC,
76373
76960
  MCPServerStatus,
76374
76961
  MCPDiscoveryState,
76375
76962
  getMCPServerStatus,
76376
76963
  getMCPDiscoveryState,
76964
+ connectToMcpServer,
76377
76965
  createTransport,
76378
76966
  WriteFileTool,
76379
76967
  InputFormat,
@@ -76382,7 +76970,7 @@ export {
76382
76970
  ModelRegistry,
76383
76971
  DEFAULT_PAPERT_VISION_MODEL,
76384
76972
  DEFAULT_MODEL_PROVIDERS,
76385
- ApprovalMode as ApprovalMode2,
76973
+ ApprovalMode2,
76386
76974
  APPROVAL_MODES,
76387
76975
  APPROVAL_MODE_INFO,
76388
76976
  DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD,
@@ -76405,7 +76993,8 @@ export {
76405
76993
  TaskScheduler,
76406
76994
  resolveSchedulerStorePath,
76407
76995
  getIdeInstaller,
76408
- getMCPServerPrompts
76996
+ getMCPServerPrompts,
76997
+ parseCheckpointContent
76409
76998
  };
76410
76999
  /**
76411
77000
  * @license