@preapexis/piexis 0.1.2

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 (348) hide show
  1. package/.github/workflows/npm-publish.yml +63 -0
  2. package/AGENTS.md +58 -0
  3. package/PERMISSION_MODES_PLAN.md +279 -0
  4. package/README.md +207 -0
  5. package/WHAT_YOU_GET.md +153 -0
  6. package/eval/README.md +72 -0
  7. package/eval/permission-cases.json +28 -0
  8. package/eval/permissions.mjs +103 -0
  9. package/extensions/ask-question.ts +111 -0
  10. package/extensions/background-tasks.ts +433 -0
  11. package/extensions/background-worker.ts +50 -0
  12. package/extensions/glob.ts +32 -0
  13. package/extensions/mode.ts +397 -0
  14. package/extensions/ui.ts +134 -0
  15. package/lib/bash-approvals.ts +113 -0
  16. package/lib/bash-policy.ts +164 -0
  17. package/lib/mode-policy.ts +174 -0
  18. package/lib/path-policy.ts +182 -0
  19. package/lib/permission-classifier.ts +128 -0
  20. package/lib/permission-config.ts +91 -0
  21. package/lib/permission-denials.ts +32 -0
  22. package/lib/permission-intent.ts +128 -0
  23. package/lib/permission-taxonomy.ts +15 -0
  24. package/lib/task-broker.ts +65 -0
  25. package/lib/task-checkout.ts +39 -0
  26. package/lib/task-git.ts +44 -0
  27. package/lib/task-patch.ts +106 -0
  28. package/lib/task-permissions.ts +51 -0
  29. package/lib/task-report.ts +62 -0
  30. package/lib/task-worktree-policy.ts +56 -0
  31. package/package.json +51 -0
  32. package/prompts/commit.md +7 -0
  33. package/prompts/init.md +66 -0
  34. package/prompts/summary.md +14 -0
  35. package/skills/claude-api/LICENSE.txt +202 -0
  36. package/skills/claude-api/SKILL.md +572 -0
  37. package/skills/claude-api/csharp/claude-api/README.md +362 -0
  38. package/skills/claude-api/csharp/claude-api/batches.md +14 -0
  39. package/skills/claude-api/csharp/claude-api/files-api.md +25 -0
  40. package/skills/claude-api/csharp/claude-api/streaming.md +28 -0
  41. package/skills/claude-api/csharp/claude-api/tool-use.md +164 -0
  42. package/skills/claude-api/curl/examples.md +256 -0
  43. package/skills/claude-api/curl/managed-agents.md +371 -0
  44. package/skills/claude-api/go/claude-api/README.md +188 -0
  45. package/skills/claude-api/go/claude-api/files-api.md +23 -0
  46. package/skills/claude-api/go/claude-api/streaming.md +43 -0
  47. package/skills/claude-api/go/claude-api/tool-use.md +220 -0
  48. package/skills/claude-api/go/managed-agents/README.md +564 -0
  49. package/skills/claude-api/java/claude-api/README.md +238 -0
  50. package/skills/claude-api/java/claude-api/files-api.md +27 -0
  51. package/skills/claude-api/java/claude-api/streaming.md +24 -0
  52. package/skills/claude-api/java/claude-api/tool-use.md +228 -0
  53. package/skills/claude-api/java/managed-agents/README.md +443 -0
  54. package/skills/claude-api/php/claude-api/README.md +174 -0
  55. package/skills/claude-api/php/claude-api/batches.md +15 -0
  56. package/skills/claude-api/php/claude-api/files-api.md +13 -0
  57. package/skills/claude-api/php/claude-api/streaming.md +27 -0
  58. package/skills/claude-api/php/claude-api/tool-use.md +253 -0
  59. package/skills/claude-api/php/managed-agents/README.md +443 -0
  60. package/skills/claude-api/python/claude-api/README.md +565 -0
  61. package/skills/claude-api/python/claude-api/batches.md +198 -0
  62. package/skills/claude-api/python/claude-api/files-api.md +170 -0
  63. package/skills/claude-api/python/claude-api/sdk-upgrade.md +286 -0
  64. package/skills/claude-api/python/claude-api/streaming.md +179 -0
  65. package/skills/claude-api/python/claude-api/tool-use.md +627 -0
  66. package/skills/claude-api/python/managed-agents/README.md +335 -0
  67. package/skills/claude-api/ruby/claude-api/README.md +134 -0
  68. package/skills/claude-api/ruby/claude-api/streaming.md +16 -0
  69. package/skills/claude-api/ruby/claude-api/tool-use.md +41 -0
  70. package/skills/claude-api/ruby/managed-agents/README.md +394 -0
  71. package/skills/claude-api/shared/admin-api.md +179 -0
  72. package/skills/claude-api/shared/agent-design.md +101 -0
  73. package/skills/claude-api/shared/anthropic-cli.md +269 -0
  74. package/skills/claude-api/shared/claude-platform-on-aws.md +59 -0
  75. package/skills/claude-api/shared/cost-optimization.md +233 -0
  76. package/skills/claude-api/shared/error-codes.md +262 -0
  77. package/skills/claude-api/shared/live-sources.md +166 -0
  78. package/skills/claude-api/shared/managed-agents-api-reference.md +455 -0
  79. package/skills/claude-api/shared/managed-agents-client-patterns.md +220 -0
  80. package/skills/claude-api/shared/managed-agents-core.md +359 -0
  81. package/skills/claude-api/shared/managed-agents-environments.md +226 -0
  82. package/skills/claude-api/shared/managed-agents-events.md +290 -0
  83. package/skills/claude-api/shared/managed-agents-memory.md +201 -0
  84. package/skills/claude-api/shared/managed-agents-multiagent.md +260 -0
  85. package/skills/claude-api/shared/managed-agents-onboarding.md +82 -0
  86. package/skills/claude-api/shared/managed-agents-outcomes.md +108 -0
  87. package/skills/claude-api/shared/managed-agents-overview.md +77 -0
  88. package/skills/claude-api/shared/managed-agents-scheduled-deployments.md +156 -0
  89. package/skills/claude-api/shared/managed-agents-self-hosted-sandboxes.md +282 -0
  90. package/skills/claude-api/shared/managed-agents-tools.md +504 -0
  91. package/skills/claude-api/shared/managed-agents-webhooks.md +143 -0
  92. package/skills/claude-api/shared/model-migration.md +1872 -0
  93. package/skills/claude-api/shared/models.md +142 -0
  94. package/skills/claude-api/shared/platform-availability.md +53 -0
  95. package/skills/claude-api/shared/prompt-audit.md +223 -0
  96. package/skills/claude-api/shared/prompt-caching.md +292 -0
  97. package/skills/claude-api/shared/token-counting.md +56 -0
  98. package/skills/claude-api/shared/tool-use-concepts.md +526 -0
  99. package/skills/claude-api/typescript/claude-api/README.md +405 -0
  100. package/skills/claude-api/typescript/claude-api/batches.md +106 -0
  101. package/skills/claude-api/typescript/claude-api/files-api.md +98 -0
  102. package/skills/claude-api/typescript/claude-api/streaming.md +178 -0
  103. package/skills/claude-api/typescript/claude-api/tool-use.md +586 -0
  104. package/skills/claude-api/typescript/managed-agents/README.md +359 -0
  105. package/skills/code-review/SKILL.md +34 -0
  106. package/skills/code-review/agents/openai.yaml +3 -0
  107. package/skills/codebase-design/DEEPENING.md +37 -0
  108. package/skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
  109. package/skills/codebase-design/SKILL.md +40 -0
  110. package/skills/diagnosing-bugs/SKILL.md +38 -0
  111. package/skills/diagnosing-bugs/agents/openai.yaml +3 -0
  112. package/skills/diagnosing-bugs/scripts/hitl-loop.template.sh +44 -0
  113. package/skills/docx/LICENSE.txt +30 -0
  114. package/skills/docx/SKILL.md +93 -0
  115. package/skills/docx/scripts/__init__.py +1 -0
  116. package/skills/docx/scripts/accept_changes.py +135 -0
  117. package/skills/docx/scripts/comment.py +368 -0
  118. package/skills/docx/scripts/merge_runs.py +310 -0
  119. package/skills/docx/scripts/office/helpers/__init__.py +111 -0
  120. package/skills/docx/scripts/office/helpers/pptx_chart.py +170 -0
  121. package/skills/docx/scripts/office/helpers/pptx_slide.py +60 -0
  122. package/skills/docx/scripts/office/helpers/pptx_theme.py +114 -0
  123. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  124. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  125. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  126. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  127. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  128. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  129. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  130. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  131. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  132. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  133. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  134. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  135. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  136. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  137. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  138. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  139. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  140. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  141. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  142. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  143. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  144. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  145. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  146. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  147. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  148. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  149. package/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  150. package/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  151. package/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  152. package/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  153. package/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  154. package/skills/docx/scripts/office/schemas/mce/mc.xsd +75 -0
  155. package/skills/docx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
  156. package/skills/docx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
  157. package/skills/docx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
  158. package/skills/docx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
  159. package/skills/docx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
  160. package/skills/docx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  161. package/skills/docx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
  162. package/skills/docx/scripts/office/soffice.py +192 -0
  163. package/skills/docx/scripts/office/validate.py +173 -0
  164. package/skills/docx/scripts/office/validators/__init__.py +15 -0
  165. package/skills/docx/scripts/office/validators/base.py +875 -0
  166. package/skills/docx/scripts/office/validators/docx.py +466 -0
  167. package/skills/docx/scripts/office/validators/pptx.py +441 -0
  168. package/skills/docx/scripts/office/validators/redlining.py +299 -0
  169. package/skills/docx/scripts/templates/comments.xml +3 -0
  170. package/skills/docx/scripts/templates/commentsExtended.xml +3 -0
  171. package/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
  172. package/skills/docx/scripts/templates/commentsIds.xml +3 -0
  173. package/skills/docx/scripts/templates/people.xml +3 -0
  174. package/skills/frontend-design/LICENSE.txt +177 -0
  175. package/skills/frontend-design/SKILL.md +27 -0
  176. package/skills/grilling/SKILL.md +41 -0
  177. package/skills/lean-build/SKILL.md +22 -0
  178. package/skills/lean-build/agents/openai.yaml +4 -0
  179. package/skills/mcp-builder/LICENSE.txt +202 -0
  180. package/skills/mcp-builder/SKILL.md +235 -0
  181. package/skills/mcp-builder/reference/evaluation.md +602 -0
  182. package/skills/mcp-builder/reference/mcp_best_practices.md +249 -0
  183. package/skills/mcp-builder/reference/node_mcp_server.md +970 -0
  184. package/skills/mcp-builder/reference/python_mcp_server.md +719 -0
  185. package/skills/mcp-builder/scripts/connections.py +151 -0
  186. package/skills/mcp-builder/scripts/evaluation.py +373 -0
  187. package/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
  188. package/skills/mcp-builder/scripts/requirements.txt +2 -0
  189. package/skills/migration/SKILL.md +17 -0
  190. package/skills/migration/agents/openai.yaml +4 -0
  191. package/skills/pdf/LICENSE.txt +30 -0
  192. package/skills/pdf/SKILL.md +27 -0
  193. package/skills/pdf/forms.md +294 -0
  194. package/skills/pdf/reference.md +612 -0
  195. package/skills/pdf/scripts/check_bounding_boxes.py +65 -0
  196. package/skills/pdf/scripts/check_fillable_fields.py +11 -0
  197. package/skills/pdf/scripts/convert_pdf_to_images.py +33 -0
  198. package/skills/pdf/scripts/create_validation_image.py +37 -0
  199. package/skills/pdf/scripts/extract_form_field_info.py +122 -0
  200. package/skills/pdf/scripts/extract_form_structure.py +115 -0
  201. package/skills/pdf/scripts/fill_fillable_fields.py +98 -0
  202. package/skills/pdf/scripts/fill_pdf_form_with_annotations.py +107 -0
  203. package/skills/pptx/LICENSE.txt +30 -0
  204. package/skills/pptx/SKILL.md +240 -0
  205. package/skills/pptx/scripts/__init__.py +0 -0
  206. package/skills/pptx/scripts/add_slide.py +367 -0
  207. package/skills/pptx/scripts/clean.py +309 -0
  208. package/skills/pptx/scripts/office/helpers/__init__.py +111 -0
  209. package/skills/pptx/scripts/office/helpers/pptx_chart.py +170 -0
  210. package/skills/pptx/scripts/office/helpers/pptx_slide.py +60 -0
  211. package/skills/pptx/scripts/office/helpers/pptx_theme.py +114 -0
  212. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  213. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  214. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  215. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  216. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  217. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  218. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  219. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  220. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  221. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  222. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  223. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  224. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  225. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  226. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  227. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  228. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  229. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  230. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  231. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  232. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  233. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  234. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  235. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  236. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  237. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  238. package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  239. package/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  240. package/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  241. package/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  242. package/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  243. package/skills/pptx/scripts/office/schemas/mce/mc.xsd +75 -0
  244. package/skills/pptx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
  245. package/skills/pptx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
  246. package/skills/pptx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
  247. package/skills/pptx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
  248. package/skills/pptx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
  249. package/skills/pptx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  250. package/skills/pptx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
  251. package/skills/pptx/scripts/office/soffice.py +192 -0
  252. package/skills/pptx/scripts/office/validate.py +173 -0
  253. package/skills/pptx/scripts/office/validators/__init__.py +15 -0
  254. package/skills/pptx/scripts/office/validators/base.py +875 -0
  255. package/skills/pptx/scripts/office/validators/docx.py +466 -0
  256. package/skills/pptx/scripts/office/validators/pptx.py +441 -0
  257. package/skills/pptx/scripts/office/validators/redlining.py +299 -0
  258. package/skills/pptx/scripts/thumbnail.py +311 -0
  259. package/skills/safe-refactor/SKILL.md +16 -0
  260. package/skills/safe-refactor/agents/openai.yaml +4 -0
  261. package/skills/tdd/SKILL.md +18 -0
  262. package/skills/tdd/agents/openai.yaml +3 -0
  263. package/skills/tdd/mocking.md +59 -0
  264. package/skills/tdd/tests.md +77 -0
  265. package/skills/verify-and-stop/SKILL.md +16 -0
  266. package/skills/verify-and-stop/agents/openai.yaml +4 -0
  267. package/skills/webapp-testing/LICENSE.txt +202 -0
  268. package/skills/webapp-testing/SKILL.md +96 -0
  269. package/skills/webapp-testing/examples/console_logging.py +35 -0
  270. package/skills/webapp-testing/examples/element_discovery.py +40 -0
  271. package/skills/webapp-testing/examples/static_html_automation.py +33 -0
  272. package/skills/webapp-testing/scripts/with_server.py +106 -0
  273. package/skills/writing-for-agents/SKILL-MECHANICS.md +22 -0
  274. package/skills/writing-for-agents/SKILL.md +28 -0
  275. package/skills/writing-for-agents/agents/openai.yaml +3 -0
  276. package/skills/xlsx/LICENSE.txt +30 -0
  277. package/skills/xlsx/SKILL.md +101 -0
  278. package/skills/xlsx/scripts/office/helpers/__init__.py +111 -0
  279. package/skills/xlsx/scripts/office/helpers/pptx_chart.py +170 -0
  280. package/skills/xlsx/scripts/office/helpers/pptx_slide.py +60 -0
  281. package/skills/xlsx/scripts/office/helpers/pptx_theme.py +114 -0
  282. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  283. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  284. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  285. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  286. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  287. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  288. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  289. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  290. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  291. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  292. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  293. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  294. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  295. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  296. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  297. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  298. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  299. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  300. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  301. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  302. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  303. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  304. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  305. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  306. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  307. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  308. package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  309. package/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  310. package/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  311. package/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  312. package/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  313. package/skills/xlsx/scripts/office/schemas/mce/mc.xsd +75 -0
  314. package/skills/xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
  315. package/skills/xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
  316. package/skills/xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
  317. package/skills/xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
  318. package/skills/xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
  319. package/skills/xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  320. package/skills/xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
  321. package/skills/xlsx/scripts/office/soffice.py +192 -0
  322. package/skills/xlsx/scripts/office/validate.py +173 -0
  323. package/skills/xlsx/scripts/office/validators/__init__.py +15 -0
  324. package/skills/xlsx/scripts/office/validators/base.py +875 -0
  325. package/skills/xlsx/scripts/office/validators/docx.py +466 -0
  326. package/skills/xlsx/scripts/office/validators/pptx.py +441 -0
  327. package/skills/xlsx/scripts/office/validators/redlining.py +299 -0
  328. package/skills/xlsx/scripts/recalc.py +308 -0
  329. package/skills-lock.json +359 -0
  330. package/tests/auto-permissions.test.mjs +315 -0
  331. package/tests/background-tasks.test.mjs +27 -0
  332. package/tests/background-worker.test.mjs +60 -0
  333. package/tests/bash-permissions.test.mjs +276 -0
  334. package/tests/glob.test.mjs +31 -0
  335. package/tests/mode.test.mjs +62 -0
  336. package/tests/permission-evaluation.test.mjs +70 -0
  337. package/tests/permission-foundation.test.mjs +194 -0
  338. package/tests/permission-policy.test.mjs +158 -0
  339. package/tests/runtime/README.md +51 -0
  340. package/tests/runtime/harness.mjs +190 -0
  341. package/tests/runtime/permissions.test.mjs +192 -0
  342. package/tests/runtime/tui.test.mjs +60 -0
  343. package/tests/skills-routing.test.mjs +51 -0
  344. package/tests/task-integration.test.mjs +324 -0
  345. package/tests/task-permissions.test.mjs +178 -0
  346. package/tests/task-worktree-policy.test.mjs +53 -0
  347. package/themes/orange.json +82 -0
  348. package/tsconfig.json +13 -0
@@ -0,0 +1,63 @@
1
+ name: CI and publish
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ release:
8
+ types: [published]
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ test:
15
+ name: Check and test
16
+ runs-on: ubuntu-24.04
17
+ steps:
18
+ - name: Checkout
19
+ uses: actions/checkout@v5
20
+
21
+ - name: Set up Node.js
22
+ uses: actions/setup-node@v5
23
+ with:
24
+ node-version: 24
25
+ cache: npm
26
+
27
+ - name: Install dependencies
28
+ run: npm ci --ignore-scripts
29
+
30
+ - name: Type-check
31
+ run: npm run check
32
+
33
+ - name: Test
34
+ run: npm test
35
+
36
+ - name: Check package contents
37
+ run: npm pack --dry-run
38
+
39
+ publish:
40
+ name: Publish to npm
41
+ if: github.event_name == 'release' && github.event.action == 'published'
42
+ needs: test
43
+ runs-on: ubuntu-24.04
44
+ permissions:
45
+ contents: read
46
+ id-token: write
47
+ steps:
48
+ - name: Checkout release tag
49
+ uses: actions/checkout@v5
50
+
51
+ - name: Set up Node.js
52
+ uses: actions/setup-node@v5
53
+ with:
54
+ node-version: 24
55
+ registry-url: https://registry.npmjs.org
56
+
57
+ - name: Install dependencies
58
+ run: npm ci --ignore-scripts
59
+
60
+ - name: Publish package
61
+ run: npm publish --provenance
62
+ env:
63
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/AGENTS.md ADDED
@@ -0,0 +1,58 @@
1
+ # Agents Guide
2
+
3
+ ## Project
4
+
5
+ Piexis (`@preapexis/piexis`) is a TypeScript Pi package providing permission-mode extensions, skills, prompts, and themes. It requires Node.js 24+ and a current Pi release; `README.md` names Pi 0.85.1 as tested.
6
+
7
+ ## Layout
8
+
9
+ - `extensions/mode.ts`: permission approvals, mode commands/flags, session restoration, and mode-specific agent instructions.
10
+ - `extensions/ask-question.ts`: sequential, interactive `AskQuestion` tool; requires the TUI to collect answers.
11
+ - `extensions/ui.ts`: local Pi header, footer, and activity/status integration.
12
+ - `lib/mode-policy.ts`: mode names, tool allowlists, and Accept Edits bash-command classification.
13
+ - `lib/permission-classifier.ts`: Auto-mode model review, response validation, timeout, and cancellation.
14
+ - `lib/permission-config.ts`: project configuration initialization and classifier model selection.
15
+ - `skills/`: bundled skills with task-specific `SKILL.md` guidance; `prompts/init.md`: bundled `/init` prompt; `themes/orange.json`: bundled theme.
16
+ - `package.json`: Pi resource manifest and npm scripts; `tsconfig.json`: strict TypeScript configuration.
17
+
18
+ ## Development
19
+
20
+ Commands supported by the manifest or README:
21
+
22
+ | Command | Purpose / caveat |
23
+ | --- | --- |
24
+ | `npm ci --ignore-scripts` | Install locked dependencies without lifecycle scripts. |
25
+ | `npm run check` | Type-check with `tsc --noEmit`. |
26
+ | `npm test` | Runs `node --test tests/*.test.mjs`, including extension and skill-routing contracts. |
27
+ | `npm run test:sandbox` | Runs `PIEXIS_REQUIRE_SANDBOX=1 node --test tests/mode-sandbox.test.mjs`; target is currently absent, and the script uses POSIX environment-assignment syntax. |
28
+ | `pi -e ./extensions/mode.ts` | Preview the permission extension only, not the bundled prompts, skills, themes, or other extensions. |
29
+
30
+ There are no separate build, lint, or format scripts. No CI configuration is present in this checkout; do not infer CI coverage from the README.
31
+
32
+ ## Current-checkout caveats
33
+
34
+ - Parts of `README.md` and `MODE.md` describe older or intended behavior. Check `extensions/` and `lib/` before relying on security or lifecycle claims.
35
+ - The sandbox workers, broker, guards, and test suites from the previous implementation are absent. Although `@anthropic-ai/sandbox-runtime` remains pinned in `package.json`, the current permission implementation does not invoke it. Do not claim OS containment, protected-path enforcement, or workspace-only writes.
36
+ - Plan currently blocks all tools except the read-tool allowlist and `AskQuestion`, including all bash calls and file edits. The README's writable `.pi/plans/*.md` exception and `delete_plan` tool are not implemented in the current source.
37
+ - The current default is Manual (`default`), not Auto. Old Build/YOLO mode names and user-level `readRoots`/`allowedDomains` configuration do not describe the current implementation.
38
+
39
+ ## Conventions
40
+
41
+ - Use ESM and strict TypeScript with NodeNext module resolution and ES2022 targeting. Local imports use explicit `.ts` extensions.
42
+ - Match nearby source style: two-space indentation, double-quoted strings, and semicolons. Extensions export a default registration function receiving `ExtensionAPI`; shared permission logic belongs in `lib/`.
43
+ - Keep changes focused and preserve existing permission checks, approval/cancellation behavior, and headless handling.
44
+ - Add or update tests for behavior changes. Historical tests used `node:test`, `node:assert/strict`, and `.test.mjs` files; use disposable fixtures, not real credentials.
45
+ - Do not commit generated output, secrets, dependency directories, or local configuration. `.pi/` and `.kilo/` are ignored local state, not package resources.
46
+
47
+ ## Security and workflow
48
+
49
+ - Permission-mode changes belong to the user. Do not bypass denied operations or change modes to evade restrictions.
50
+ - The six modes are `default`, `acceptEdits`, `plan`, `auto`, `dontAsk`, and `bypassPermissions`. `Alt+M` cycles the first four, omitting Auto when unavailable; `/plan` enters Plan. `dontAsk` and `bypassPermissions` are launch-only. Mode changes require an idle agent.
51
+ - Preserve Auto's fail-closed behavior on classifier failure or invalid responses. The classifier treats task/action contents as untrusted data and uses Pi's existing authentication; never persist credentials in project settings.
52
+ - Configuration lives under Pi's `CONFIG_DIR_NAME` (normally `.pi/`). Initialization creates missing `settings.json` and `permission-modes.json` without overwriting existing files. `PI_PERMISSION_CLASSIFIER=provider/model` overrides the configured classifier model.
53
+ - Session approvals are in-memory and scoped to a tool. Without permission UI, actions requiring approval are denied; `dontAsk` denies non-pre-approved actions. Bypass skips extension-level permission checks and is not isolation.
54
+ - Keep `AskQuestion` available in every permission mode.
55
+
56
+ ## Validation
57
+
58
+ For implementation changes, run `npm run check` and relevant tests when their files are available. Report missing suites and unexecuted checks explicitly; an empty or skipped run does not establish coverage or security. Review the diff and confirm that no credentials or unrelated files are included.
@@ -0,0 +1,279 @@
1
+ # Piexis Permission Modes Improvement Plan
2
+
3
+ ## Recommended direction
4
+
5
+ **Make Piexis similar in permission workflow—not a replica of Claude Code’s security architecture.**
6
+
7
+ Focus on:
8
+ - Fewer interruptions during ordinary coding.
9
+ - Auto decisions grounded in what the user actually requested.
10
+ - Clear approval boundaries for consequential actions.
11
+ - Consistent behavior between foreground and background agents.
12
+ - Understandable denials and permission controls.
13
+
14
+ **Exclude containers, OS sandboxing, network proxies, and claims of filesystem/network containment.**
15
+
16
+ This plan records the original baseline and proposed work; the comparison and future-tense descriptions below are historical, not a current behavior reference. Phases 1–4 have been implemented. Phase 5 adds documentation alignment, mode-restoration regression coverage, and a labeled offline classifier evaluation harness. Controlled Linux runtime checks now cover real Pi RPC/JSON flows, worker lifecycle, and TUI permission interactions through a pseudo-terminal (`tests/runtime/README.md`). Live-model evaluation, full visual/terminal compatibility, and cross-platform validation remain open. See `README.md` and `eval/README.md` for current behavior and validation limits.
17
+
18
+ ## Corrections to the comparison
19
+
20
+ The comparison table is useful as inspiration, but not an implementation specification:
21
+
22
+ - **Headless denial already exists:** approval-required calls are blocked without permission UI.
23
+ - **Deny-and-continue partly exists:** blocked tool calls already receive reasons. Missing pieces are retry limits and better guidance.
24
+ - **Sensitive-path checks exist**, but they inspect the requested path—not every file a recursive search or shell command might access.
25
+ - **Auto currently ignores all session approvals**, rather than carrying narrow ones forward.
26
+ - **Persistent allow/deny rules and trusted-environment configuration do not exist yet.**
27
+ - **Workers already exist**, with worktrees and an approval broker, but use a separate permission flow and have no Bash.
28
+ - Claude Code also has a `dontAsk` mode; that is not a Piexis-only advantage.
29
+ - Exact claims about Claude’s classifier stages and injection screening need current authoritative verification. We should not make those prerequisites.
30
+
31
+ ## Phase 1 — Make the existing permission foundation consistent
32
+
33
+ **Do this before expanding Auto.**
34
+
35
+ ### 1. Extract one permission evaluator
36
+
37
+ Move decision-making out of `extensions/mode.ts` into shared library code.
38
+
39
+ Inputs should include:
40
+ - Mode.
41
+ - Tool and validated arguments.
42
+ - Actual working directory and workspace boundary.
43
+ - User authorization context.
44
+ - Applicable approvals.
45
+ - Foreground or worker identity.
46
+
47
+ Return a structured result: **allow, deny, require approval, or require model review**, with a reason/category.
48
+
49
+ The extension should handle UI and lifecycle; the library should decide policy.
50
+
51
+ ### 2. Fix path-policy limitations
52
+
53
+ In `lib/path-policy.ts`:
54
+
55
+ - Resolve relative paths against the **tool’s actual working directory**, then compare against the repository boundary. Currently those two concepts are conflated.
56
+ - Check both requested and resolved paths for sensitive locations.
57
+ - Distinguish reading credentials from modifying execution/security configuration.
58
+ - Cover recursive searches: approving `grep` on the repository root must not imply that every descendant is ordinary.
59
+ - Add categories for credentials, Git internals/hooks, and Pi permission/extension configuration.
60
+ - Avoid treating every example environment file as a real secret; support narrow, explicit exceptions.
61
+
62
+ If recursive filtering requires wrapping built-in tools, do that explicitly rather than claiming the path check already provides it.
63
+
64
+ ### 3. Protect policy configuration
65
+
66
+ Ordinary edit permissions should not silently authorize changes to the configuration controlling those permissions.
67
+
68
+ Repository-provided trust settings must not automatically grant themselves additional authority. Widening permissions needs user confirmation.
69
+
70
+ **Deliverable:** one documented decision order and consistent path handling, with regression tests.
71
+
72
+ ## Phase 2 — Make Auto genuinely useful for ordinary development
73
+
74
+ ### 1. Pre-approve ordinary local edits
75
+
76
+ Auto should directly allow:
77
+ - Ordinary project-local reads/searches.
78
+ - Ordinary project-local `edit` and `write`.
79
+ - `AskQuestion`.
80
+
81
+ Exceptions remain for sensitive paths, policy/configuration changes, malformed requests, and external targets.
82
+
83
+ This is the highest-value usability improvement.
84
+
85
+ ### 2. Add user-intent context to the classifier
86
+
87
+ Extend `lib/permission-classifier.ts` beyond tool/path/command.
88
+
89
+ Include:
90
+ - Current user request.
91
+ - Relevant earlier user constraints from the active branch.
92
+ - Explicit approvals and their scopes.
93
+ - Working directory/workspace.
94
+ - Proposed action and deterministic risk findings.
95
+
96
+ Exclude:
97
+ - Assistant explanations and reasoning.
98
+ - Raw tool-output history.
99
+ - Worker summaries presented as authorization.
100
+ - Unnecessary file contents and secrets.
101
+
102
+ **Important:** a message with a `user` role is not automatically proof of human authorization. Pi extensions can inject user messages. Preserve provenance where available and treat ambiguous origins conservatively.
103
+
104
+ Handle session resume, branching, compaction, and changed instructions without carrying stale authorization forward.
105
+
106
+ ### 3. Introduce a small policy taxonomy
107
+
108
+ | Category | Proposed Auto behavior |
109
+ |---|---|
110
+ | Ordinary local development | Allow |
111
+ | External filesystem access | Review scope and intent |
112
+ | Destructive changes | Require specific authorization; deny ambiguity |
113
+ | Credential discovery/exposure | Deny automated exploration |
114
+ | Uploads/data egress | Review destination, payload, and intent |
115
+ | Production/shared-system changes | Require explicit target and authorization |
116
+ | Privilege/security changes | Deny unattended escalation |
117
+ | Safeguard bypasses | Require explicit authorization; never infer from “fix it” |
118
+ | Download-and-execute or opaque execution | Conservative review/denial |
119
+
120
+ Distinguish **using an existing authenticated CLI** from **reading/exporting its credentials**.
121
+
122
+ ### 4. Keep one model reviewer initially
123
+
124
+ Use:
125
+
126
+ **Deterministic checks → model review only when needed.**
127
+
128
+ That already provides a fast path. Do not add a second model until evaluation shows a measurable benefit.
129
+
130
+ **Deliverable:** Auto feels substantially less intrusive while making better authorization judgments.
131
+
132
+ ## Phase 3 — Improve Bash decisions and permission UX
133
+
134
+ ### Bash analysis
135
+
136
+ Add a bounded shell analyzer that identifies:
137
+ - Command chains and pipelines.
138
+ - Redirections.
139
+ - Command substitutions.
140
+ - Working-directory changes.
141
+ - Environment assignments and wrappers.
142
+ - Interpreter/script execution.
143
+ - Destructive Git operations.
144
+ - Uploads, deployments, and safeguard-bypass flags.
145
+
146
+ Use parsing, not only regular expressions. Unsupported syntax should lead to review—not automatic approval.
147
+
148
+ **Do not equate `npm test`, `make`, or `python script.py` with safety.** Those execute project-controlled code. A command’s name is not its complete effect.
149
+
150
+ Initially, allow only a small, carefully tested set of simple read-only commands without review. Everything else retains approval/classification.
151
+
152
+ ### Scoped approvals
153
+
154
+ Add:
155
+ - Exact command + working-directory grants.
156
+ - File/directory grants scoped to operation.
157
+ - Narrow command/subcommand rules.
158
+ - A user-facing `/permissions` command to inspect and revoke grants.
159
+
160
+ For Auto:
161
+ - Honor eligible narrow approvals after non-overridable checks.
162
+ - Ignore whole-Bash and blanket interpreter/executable grants.
163
+ - Do not reuse an execution approval blindly after the relevant script or policy changes.
164
+
165
+ Persistent rules can follow later; start with session rules to limit complexity.
166
+
167
+ ### Denial behavior
168
+
169
+ Provide concise reasons and a legitimate next step:
170
+ - Use a narrower action.
171
+ - Request clarification.
172
+ - Wait for explicit authorization.
173
+
174
+ Do not suggest switching tools to achieve the same denied effect.
175
+
176
+ Add configurable repeated-denial limits. Stop the agent’s run when it is stuck; do not automatically switch modes or broaden permissions. Headless runs should report a clear blocked outcome without waiting for dialogs.
177
+
178
+ **Deliverable:** fewer confusing prompts and no endless denial loops.
179
+
180
+ ## Phase 4 — Bring background tasks into the same permission system
181
+
182
+ Update `extensions/background-tasks.ts` and `extensions/background-worker.ts`.
183
+
184
+ ### 1. Recognize task tools individually
185
+
186
+ Auto should understand:
187
+ - Status and cancellation.
188
+ - Diff inspection.
189
+ - Task creation.
190
+ - Applying changes.
191
+ - Destructive cleanup.
192
+
193
+ Do not allow every custom tool simply because it exists.
194
+
195
+ Note that `task_diff` currently runs `git add -N` for untracked files: it needs adjustment before being treated as genuinely read-only.
196
+
197
+ ### 2. Give workers bounded delegated authority
198
+
199
+ Worker authorization should be the intersection of:
200
+ - The user’s authorized task.
201
+ - Parent permission policy.
202
+ - The worker’s delegated scope.
203
+
204
+ An assistant-written task brief must not expand user authorization.
205
+
206
+ Use the existing parent broker to evaluate worker actions through the shared policy. Handle mode changes, cancellation, session replacement, and broker failure explicitly.
207
+
208
+ ### 3. Add worker Bash only as an opt-in
209
+
210
+ Workers can then test/build/debug through the same approval/classifier pipeline.
211
+
212
+ But call this **permission-controlled command execution**, not sandboxed execution. Worktrees isolate Git changes, not host access.
213
+
214
+ Keep:
215
+ - No recursive delegation initially.
216
+ - Explicit approval before applying patches.
217
+ - Validated, confirmed cleanup.
218
+
219
+ ### 4. Review returned changes, not just worker prose
220
+
221
+ Treat worker output as untrusted task data. Inspect the actual patch for sensitive/configuration changes before applying it. Record what verification actually ran.
222
+
223
+ **Deliverable:** useful workers without building a new orchestration or sandbox platform.
224
+
225
+ ## Phase 5 — Polish, documentation, and evaluation
226
+
227
+ Preserve the six modes:
228
+
229
+ | Mode | Target behavior |
230
+ |---|---|
231
+ | Manual | Safe operations directly; approval otherwise |
232
+ | Accept Edits | Also allow ordinary local edits |
233
+ | Plan | Read-only exploration; no implicit transition to execution |
234
+ | Auto | Local coding directly; consequential actions reviewed against intent |
235
+ | Don’t Ask | Only pre-approved actions; no permission dialogs |
236
+ | Bypass | Skip Piexis permission checks, with clear warnings |
237
+
238
+ Keep mode changes user-controlled and idle-only.
239
+
240
+ Add tests covering:
241
+ - Nested working directories, symlinks, and recursive searches.
242
+ - Local edits versus sensitive/configuration edits.
243
+ - Shell chains, wrappers, scripts, and uploads.
244
+ - Intent changes, branching, and injected messages.
245
+ - Classifier timeout, cancellation, malformed responses, and unavailable models.
246
+ - Approval revocation and unsafe broad grants.
247
+ - Worker/foreground consistency.
248
+ - Headless denial limits.
249
+
250
+ Run `npm run check` and relevant tests during implementation. Build a labeled classifier evaluation set as well: mocked unit tests alone cannot measure model decision quality.
251
+
252
+ ## Deliberately deferred
253
+
254
+ - OS/container/network sandboxing.
255
+ - Network allowlisting presented as enforcement.
256
+ - Full shell/program semantic analysis.
257
+ - Two-model classification.
258
+ - A generic prompt-injection detector marketed as protection.
259
+ - Automatic acceptance of worker changes.
260
+ - Broad domain/org trust configuration before concrete use cases exist.
261
+
262
+ For injection resistance, prioritize provenance and keeping tool/worker text out of authorization decisions. Optional screening can come later.
263
+
264
+ ## Recommended first release
265
+
266
+ **Ship Phases 1–3 first.** They provide the biggest Claude-like improvement without ballooning the project. Integrate workers afterward.
267
+
268
+ ## Three decisions before implementation
269
+
270
+ These recommendations are pending user confirmation.
271
+
272
+ 1. **Auto escalation:** should uncertain/high-impact actions remain denied, or may Auto ask for explicit one-time approval?
273
+ **Recommendation:** deny the action first; allow a clear user-controlled approval path in interactive sessions.
274
+
275
+ 2. **Classifier privacy:** are you comfortable sending relevant user requests to the configured classifier provider?
276
+ **Recommendation:** yes, with bounded context, clear disclosure, and no raw tool history.
277
+
278
+ 3. **Worker Bash:** should workers eventually run tests/builds without containment?
279
+ **Recommendation:** opt-in only, after the shared permission pipeline is implemented.
package/README.md ADDED
@@ -0,0 +1,207 @@
1
+ # Piexis
2
+
3
+ Piexis is a Pi package with permission/approval controls, background Git-worktree tasks, prompts, skills, and UI resources. It requires Node.js 22.19+ and a current Pi release (local runtime checks passed with Pi 0.85.1 and 0.87.1 on Linux).
4
+
5
+ > [!WARNING]
6
+ > **Piexis permission controls are not a security boundary.** They help prevent accidental or unapproved agent tool actions; they do **not** provide OS-level sandboxing, filesystem isolation, workspace-only filesystem enforcement, protected-path enforcement, network isolation, or network allowlisting. Run Pi in an appropriate container, VM, sandbox, or restricted user account when executing untrusted code or allowing unattended/high-autonomy agents.
7
+
8
+ ## Install and use
9
+
10
+ ```sh
11
+ npm ci --ignore-scripts
12
+ pi install /absolute/path/to/piexis
13
+ ```
14
+
15
+ Installing the package loads its declared extensions, prompts, skills, and theme. Loading only `extensions/mode.ts` loads only the permission extension. Restart Pi or run `/reload` after installation.
16
+
17
+ Use `Alt+M` while the agent is idle to cycle Manual → Accept Edits → Plan → Auto (when configured). `/plan [task]` enters Plan mode. Start `dontAsk` and `bypassPermissions` only with `--permission-mode`; `--dangerously-skip-permissions` selects `bypassPermissions`.
18
+
19
+ ## Permission modes
20
+
21
+ | Mode | Behavior |
22
+ | --- | --- |
23
+ | **Manual** (`default`) | Project-local ordinary reads/searches, a tiny harmless Bash-builtin set, and `AskQuestion` are pre-approved; other actions need approval. **Allow once** applies only to the current call. |
24
+ | **Accept Edits** (`acceptEdits`) | Also pre-approves ordinary project-local `edit` and `write` calls. Bash outside the harmless-builtin set, external paths, and sensitive paths still require approval. |
25
+ | **Plan** (`plan`) | Allows project-local ordinary reads, task status/diff inspection/cancellation, and `AskQuestion`; Bash, external/sensitive path-tool reads, task creation/apply/cleanup, and file mutations are blocked. |
26
+ | **Auto** (`auto`) | Directly permits ordinary project-local reads, `edit`, and `write`. Sensitive paths, protected configuration edits, uncertain recursive searches, and malformed or unsupported paths/tools remain denied. Bash outside the harmless-builtin set and eligible narrow session grants, plus remaining known external actions, receive intent-aware model review. Missing authorization, timeout, error, or invalid review denies the action. |
27
+ | **Don't Ask** (`dontAsk`) | Permits only pre-approved reads/questions and harmless Bash builtins; denies other calls without a dialog. Launch-only. |
28
+ | **Bypass Permissions** (`bypassPermissions`) | Skips **Piexis extension-level permission checks**. It does not enter or escape a sandbox, and does not override OS permissions or other extensions. Task scope/confirmation safeguards remain. Launch-only. |
29
+
30
+ Approval UI is fail-closed: calls requiring approval are denied when no permission UI is available. Relative paths resolve against the tool's current working directory, independently of the repository boundary. Both requested and resolved paths are checked; a symlink that resolves outside the project is treated as external, and malformed or unresolvable paths are denied. This is a permission policy, not filesystem sandboxing.
31
+
32
+ `grep`, `find`, and `glob` receive a bounded, metadata-only subtree preflight. Sensitive descendants, symlinks, external trees, inspection errors, or exhaustion of the 2,000-entry/directory budget require fresh one-time approval in Manual/Accept Edits and are denied in Auto/Plan/Don't Ask. No file contents are read by this preflight. It deliberately does not assume ignore rules exclude sensitive files; large repositories (including their `.git` contents) may require narrowing the search directory. It does not filter tool results or prevent filesystem races.
33
+
34
+ Credential categories include environment files, common credential files, SSH/cloud/key directories, and Pi authentication files. Path-tool mutations (`edit`/`write`) beneath `.git` and Pi's configuration directory (`CONFIG_DIR_NAME`, normally `.pi`) require explicit approval, including settings, permission configuration, and extensions. Ordinary non-secret configuration reads remain permitted. `.env.example` is not automatically assumed secret-free: explicitly approve that exact file in Manual/Accept Edits without granting access to other environment files.
35
+
36
+ Session approvals are in-memory and never persisted. Filesystem approvals remain scoped to the file/directory and exact tool operation (`read`, `write`, `edit`, etc.). Broad grants do not authorize credential paths or protected path-tool configuration edits. Recursive-boundary requests offer only one-time approval or denial. Auto now honors eligible exact-file/directory grants and fingerprinted Bash grants after non-overridable checks, but only for the same verified current request. Whole-tool/project and legacy executable grants never bypass Auto review. Session approvals are cleared on branch navigation and session replacement.
37
+
38
+ The advanced Manual/Accept Edits option remains **Allow ALL bash actions for this session**. This is deliberately broad: it can still modify configuration or access host resources. The bounded Bash checks do not constrain arbitrary program or extension internals. `AskQuestion` remains available in every mode, including after a denial stop.
39
+
40
+ ### Permission decision order
41
+
42
+ `lib/mode-policy.ts` exposes the shared, UI-independent `evaluatePermission` function. Foreground mode handling and the parent task broker supply the mode, tool arguments, current directory, workspace boundary, and authorization context; actor identity itself grants no authority. Worker calls also require a live delegated authorization and pass capability/path-scope checks. Foreground grants are never inherited by workers. The host still validates tool schemas.
43
+
44
+ 1. `AskQuestion` retains its exception. Worker capability/path-scope checks precede the parent mode's Bypass exception.
45
+ 2. Reject malformed inputs and unresolvable paths.
46
+ 3. Apply Plan restrictions, bounded Bash analysis, and Auto non-overridable checks.
47
+ 4. Match eligible scoped approvals and mode defaults. Auto rejects broad/stale grants; unsupported shell forms cannot match a reusable narrow Bash grant.
48
+ 5. Return `require-approval`, or deny in Don't Ask. Model review and approval UI are handled by the extension and fail closed.
49
+
50
+ Repository configuration currently selects models only; there are no repository-provided allow rules or trusted-environment grants. Future permission-widening settings must require user confirmation rather than trusting repository declarations. Background tools are classified individually. Their handlers authorize task creation with the complete brief and require explicit confirmation for actual patch application and validated cleanup; this is not a blanket allow for custom tools.
51
+
52
+ ## Configuration
53
+
54
+ Launching Piexis does not create `.pi/` or project configuration. It uses in-memory defaults when `.pi/permission-modes.json` is absent. Run `/piexis-init` to explicitly create `.pi/settings.json` and `.pi/permission-modes.json`; existing files are never overwritten.
55
+
56
+ `permission-modes.json` can select Auto's authenticated classifier and permitted background models:
57
+
58
+ ```json
59
+ {
60
+ "version": 1,
61
+ "initialized": true,
62
+ "classifier": {
63
+ "provider": "anthropic",
64
+ "model": "claude-haiku-4-5",
65
+ "timeoutMs": 15000
66
+ },
67
+ "background": { "models": ["anthropic/claude-haiku-4-5"] }
68
+ }
69
+ ```
70
+
71
+ `PI_PERMISSION_CLASSIFIER=provider/model` overrides the configured classifier. Configuration contains no credentials; Pi authentication is reused.
72
+
73
+ ## Auto review policy and privacy
74
+
75
+ Auto uses **deterministic policy → one model reviewer**, not a multi-model pipeline. Ordinary local reads/edits do not call the reviewer. Review compares the proposed action against the current user request and earlier user constraints, rather than treating ordinary-looking command names as sufficient authorization.
76
+
77
+ | Review category | Rule |
78
+ | --- | --- |
79
+ | Ordinary development | Must serve the current requested task |
80
+ | External filesystem | Intent must cover the external target and operation |
81
+ | Destructive changes | Specific authorization for operation, target, and scope |
82
+ | Credential exploration/exposure | Denied; normal use of an authenticated CLI is distinct |
83
+ | Data egress | Authorization must cover destination, payload, and purpose |
84
+ | Production/shared systems | Explicit target and operation required |
85
+ | Privilege/security weakening | Denied in unattended Auto |
86
+ | Safeguard bypasses | Explicit authorization for the particular bypass |
87
+ | Opaque execution or ambiguity | Denied when effects/authorization cannot be established |
88
+
89
+ The taxonomy lives in `lib/permission-taxonomy.ts`. Shell syntax is boundedly parsed; full program semantics remain model-assessed. These are permission-review policies, not guarantees that every shell effect will be detected. Every model allow must cite the current user message and any supporting user messages using valid IDs. Unknown categories, missing/currently invalid evidence, malformed output, abnormal completion, and provider failure fail closed. The host rejects allows in prohibited categories even if the model returns them. Auto does not add approval dialogs or change modes on denial. Repeated denials stop the run under the limits below.
90
+
91
+ ### What is sent
92
+
93
+ For reviewed actions, the configured provider receives:
94
+ - Tool name and Bash command or requested filesystem path.
95
+ - Working directory, workspace boundary, and deterministic path-policy findings.
96
+ - Bounded, provenance-labelled user messages from the active branch.
97
+ - Eligible file/directory approval scopes from that same current request when review is still needed. Invalid or stale Bash grants are not forwarded as authorization.
98
+ - Bounded shell parsing results and risk findings; no script or Git configuration contents.
99
+ - For task creation and worker review, the proposed task/brief, selected model, and delegated path/Bash scope, explicitly marked as untrusted action data—not user authorization.
100
+
101
+ Other than the proposed delegation brief described above, it does **not** receive assistant prose/reasoning, raw tool-output history, worker result summaries, compaction summaries, file contents, edit/write replacement text, environment-variable objects, or Pi authentication credentials. The reviewer has no tool access. User prose, paths, commands, and approval strings can themselves contain secrets: recognition/redaction is best-effort, not a secret-detection guarantee. Do not use Auto when those details must not be disclosed to the selected provider. Recognizably secret-bearing or oversized review payloads are denied locally, without contacting the provider. Piexis does not log review payloads; Pi's normal user-message/session storage still applies.
102
+
103
+ ### Provenance and context limits
104
+
105
+ `lib/permission-intent.ts` observes Pi's `input` source and exactly matches delivered user text. It stores only a content digest, timestamp, and source in non-model session metadata, not another prompt copy. Only matched `interactive` (including normal CLI input) and `rpc` inputs count as user authorization. This is observational provenance inside a trusted extension runtime, not cryptographic proof of human identity or protection against malicious extensions.
106
+
107
+ Raw active-branch user entries preserve constraints across resume and compaction. Abandoned branches and generated summaries cannot supply authorization. Unknown/extension-injected messages are excluded; if the current request has no verified provenance, reviewed actions are denied. Older sessions without provenance need a new direct, self-contained request. Expanded/transformed prompts that do not match the observed input are conservatively unverified; submit the request directly instead. Changes to historical user entries invalidate completeness rather than silently dropping constraints. Undelivered queued input pauses reviewed actions; authorization is rechecked after model review so a changed request, branch, or session cannot reuse an in-flight allow.
108
+
109
+ The context budget is 16 verified messages, 6,000 characters per message, and 24,000 characters total. Omitted history, oversized messages, recognizable secret redaction, or unsupported non-text input marks the context incomplete. Reviewed actions then fail closed rather than allowing on a truncated authorization record; start a fresh session with the necessary constraints when history exceeds the budget. Direct local reads/edits remain available. Unit tests cover these contracts with mocked reviewers; they do not establish live-model classification accuracy.
110
+
111
+ ## Bash analysis and permission management
112
+
113
+ `lib/bash-policy.ts` implements a bounded literal-shell lexer/parser (16,000 characters, 256 tokens, 32 commands). It recognizes quoted words, command chains, pipelines, simple redirections, assignments, working-directory changes, wrappers/interpreters, and advisory destructive/network/shared-system/safeguard-bypass findings. Literal filesystem targets of supported commands/redirections receive path checks. This is not exhaustive command-effect analysis: it does not execute substitutions, inspect script bodies, or resolve arbitrary wrappers. Unsupported expansions, compound syntax, heredocs, descriptor redirections, and exhausted budgets require review/approval, never a narrow reusable grant.
114
+
115
+ Only standalone `pwd`, `pwd -L`, `pwd -P`, `true`, and `false` are automatic Bash fast paths outside Plan, and shell startup/function overrides disable that fast path. Chains, redirections, scripts, package commands, and Git commands are not automatically considered safe. Plan still blocks all Bash. A trusted shell/tool installation is assumed; this is not containment.
116
+
117
+ ### Reusable grants
118
+
119
+ For this first bounded implementation, reusable Bash grants cover only **Git status queries** with a fixed option vocabulary: `--short`/`-s`, `--branch`/`-b`, `--porcelain[=v1|=v2]`, and `--untracked-files=no|normal|all`. Choose either the exact command or that narrow query family. Both are bound to the canonical working directory and a fingerprint of the resolved Git executable's metadata, relevant environment, Git configuration, and Piexis settings/permission configuration. A changed fingerprint requires fresh approval/review. A status query can update Git's optional index caches; it is not part of the automatic read-only builtin set.
120
+
121
+ Configuration is inspected locally with bounded reads and never sent to the classifier. Unknown Git configuration keys, includes, aliases, hooks/fsmonitor/pager settings, shell startup overrides, script wrappers named Git, and linked worktrees decline reusable grants. Only a small set of inert core/user/remote/branch Git configuration keys is supported. Reuse is currently unavailable on Windows. Ordinary one-time approval or Auto review remains available when reuse is declined. Scripts (`npm test`, `make`, Python, shell scripts, etc.) do **not** receive reusable narrow grants; arbitrary dependency changes cannot therefore silently reuse such a grant. Full script-dependency analysis is not implemented.
122
+
123
+ Use:
124
+ - `/permissions` or `/permissions list` — inspect grants, IDs, mode, and denial count.
125
+ - `/permissions revoke <id>` — revoke one grant.
126
+ - `/permissions clear` — remove all grants.
127
+
128
+ Revocation/clearing requires an idle agent. These commands never widen permissions or change modes. Grant IDs are session-local; there are no persisted allow rules.
129
+
130
+ ### Denial limits
131
+
132
+ Denials include a reason and suggest a genuinely narrower action, clarification, or explicit authorization—not changing tools to perform the same denied effect. By default, **3 identical denials or 6 total denials per user request** stop the run via Pi's abort API. Successful intervening calls do not erase the budget. Configure limits at launch with `--permission-repeat-limit 3` and `--permission-denial-limit 6` (integers 1–50); repository configuration cannot silently raise them.
133
+
134
+ Once stopped, subsequent tool calls remain blocked except `AskQuestion` (and the deliberately launch-only Bypass mode). A newly delivered provenance-verified user request resets the budget; extension-injected messages and automatic retries do not. Pending sibling approvals cannot grant or execute after the stop. Already executing processes are subject to Pi's normal cancellation, not OS isolation.
135
+
136
+ Without permission UI, approval-required actions are immediately denied. At the threshold Piexis emits a `permission_blocked` diagnostic on **stderr**, records a count-only session stop entry, and aborts the run without waiting for input or forcing the whole host process to exit. Pi JSON/RPC consumers must inspect the blocked/aborted outcome; this extension does not promise a nonzero JSON-mode exit status.
137
+
138
+ ## Background tasks
139
+
140
+ `/task <work>` (or `background_task`) starts a worker from `HEAD` in a disposable **Git worktree**, with at most two running workers. The permission extension must be active. Worktrees isolate Git changes, **not host filesystem, process, credential, or network access**. Foreground uncommitted changes and the full conversation are not copied; a dirty foreground checkout produces a warning.
141
+
142
+ ### Delegation and approvals
143
+
144
+ - Status, cancellation, and diff inspection are recognized operations, including in Plan. Creation, application, and cleanup are denied in Plan/Don't Ask. Unknown custom tools remain unknown.
145
+ - Manual/Accept Edits require one-time approval for agent-requested task creation. A direct `/task <work>` command supplies explicit user authorization. Auto reviews creation against verified user intent; direct task commands receive their own in-memory user-request identifier.
146
+ - The proposed brief is untrusted action data. Optional `brief` fields include goal, context, constraints, files, acceptance criteria (`acceptanceCriteria`), decisions, and verification. Task plus brief is limited to 20,000 characters and is never silently truncated. Keep secrets out of descriptions: briefs go to the worker, may go to the classifier, and are stored in local task metadata.
147
+ - Optional `paths` narrows file-tool scope to relative files/directories (default `["."]`, maximum 32 entries). Traversal, external symlink targets, credentials/protected path-tool writes, uncertain recursive searches, and tools outside the worker capability set are denied. There are no recursive task-delegation tools.
148
+ - Every worker tool call goes through the parent broker and shared evaluator. Workers inherit no foreground session grants. Auto additionally reviews worker mutations against both the original user intent and the delegated brief. Manual approvals are one-time; missing UI, unavailable/expired brokers, and classifier failures deny rather than escalate.
149
+ - New user input, mode changes, grant revocation, branch navigation, session replacement, and shutdown invalidate outstanding task authorizations and cancel queued/running workers. Existing worktrees are retained. Worker denial limits inherit the parent's launch settings and stop that worker, not unrelated tasks.
150
+
151
+ ### Opt-in command execution
152
+
153
+ Start Pi with `--background-bash` to expose worker Bash for tests/builds/debugging. This is **permission-controlled command execution**, not sandboxing. It uses the same parent approval/classifier pipeline. Bash requires whole-worktree scope; narrower `paths` cannot be combined with this flag. Known literal external/protected targets are rejected, but parsing/model review cannot constrain arbitrary script effects or descendants. Cancellation revokes future approvals and terminates the worker process; it does not promise that all spawned descendants have stopped.
154
+
155
+ Workers load only their explicit guard extension and worker-only tool wrappers, with built-ins disabled, so a missing guard cannot fall back to unguarded tools. Project trust-gated resources and automatic context-file discovery are disabled; needed repository instructions can be read through the broker. Task text is passed as literal prompt data, not CLI options or `@file` arguments. Pi's trusted user-level runtime and authentication are still used.
156
+
157
+ ### Inspect, apply, and clean
158
+
159
+ Use `/task status`, `/task review <id>`, `/task diff <id>`, `/task cancel <id>`, `/task apply <id>`, `/task clean <id>`, and `/task interrupted` (or their corresponding tools where available).
160
+
161
+ `task_diff` snapshots actual tracked/untracked/deleted files using a **temporary index and object store**; it does not stage into the real index or write repository objects. Checkout and inspection use raw bytes rather than executing Git hooks or clean/smudge filters; this skips LFS hydration and normal checkout conversions. Submodules/special files and exhausted inspection budgets fail closed: 10,000 files, 4 MiB per file, 128 MiB total file bytes, and 8 MiB Git output. Active workers must stop before inspection. Diff display is bounded to 50,000 characters, and sensitive/configuration/symlink patch bodies are withheld rather than leaked through the inspection tool.
162
+
163
+ Apply always requires a user dialog showing the **actual changed paths**, sensitive/configuration warnings, and observed command results—even in Auto/Bypass. The patch digest and destination findings are checked again after confirmation, followed by Git apply validation. Worker prose cannot establish successful verification: observations come from post-execution tool records, not claimed test results or blocked tool-start events. Successful command completion is not proof of test coverage; verify again in the parent workspace after application. Repeatedly declined or headless agent-requested apply/cleanup actions use the foreground denial budget.
164
+
165
+ Cleanup confirms deletion and validates the Piexis ownership marker, temporary directory, Git worktree, and repository before removal. Completed unapplied changes are retained rather than discarded. Headless apply/cleanup is denied. Trusted Pi/Git executables are assumed. These checks are not protection against arbitrary host code or filesystem races.
166
+
167
+ Metadata lives at `<agent-dir>/piexis/tasks/<project-hash>.json`, not in the repository. Legacy `.pi/piexis-tasks.json` is imported if user-level state is absent; the source is retained. Interrupted worktrees can be reviewed/cleaned, but authorization, process handles, broker tokens, and user-intent snapshots are never restored from metadata. Fast tests use Git fixtures, mocked worker processes, and mocked reviewers. A separate [runtime suite](tests/runtime/README.md) checks actual Pi RPC/JSON flows, worker processes, and TUI permissions through a pseudo-terminal on Linux, using a deterministic local provider. Live-model accuracy, other platforms, and full visual/terminal compatibility remain unvalidated.
168
+
169
+ ## Select package resources
170
+
171
+ Piexis uses Pi's native package resource filtering; it does not add its own plugin manager. Run `pi config` (or `pi config --local` for a trusted project) to enable or disable discovered resources. In settings, the package object can narrow resources declared by this package:
172
+
173
+ ```json
174
+ {
175
+ "packages": [
176
+ {
177
+ "source": "npm:@preapexis/piexis",
178
+ "extensions": ["extensions/mode.ts", "extensions/ask-question.ts"],
179
+ "skills": ["skills/code-review", "skills/diagnosing-bugs", "skills/safe-refactor"],
180
+ "themes": []
181
+ }
182
+ ]
183
+ }
184
+ ```
185
+
186
+ Omit a resource type to load all resources of that type; use `[]` to load none; and use Pi glob exclusions such as `"!skills/docx/**"` to omit document workflows. This lets users keep permission controls while disabling the custom UI/theme, or retain coding skills while excluding DOCX/PDF/PPTX/XLSX skills. See Pi's package configuration documentation for the complete filtering syntax.
187
+
188
+ ## Development
189
+
190
+ ```sh
191
+ npm run check
192
+ npm test
193
+ npm run test:runtime
194
+ npm run eval:permissions -- --validate
195
+ ```
196
+
197
+ ### Local runtime checks
198
+
199
+ `npm run test:runtime` launches the resolved peer dependency's packaged Pi CLI with all manifest extensions, disposable repositories and agent directories, and a deterministic loopback provider. It uses no real credentials or paid model calls. Tests cover permission dialogs, six-mode behavior, reviewer failures/timeouts, worker Bash opt-in, patch confirmation, stale approvals, cancellation, and shutdown. The Linux PTY check exercises the bundled UI and mode shortcuts; it requires `script` and `stty` and is explicitly skipped elsewhere. See [runtime validation results and limits](tests/runtime/README.md).
200
+
201
+ ### Classifier evaluation
202
+
203
+ [`eval/permission-cases.json`](eval/permission-cases.json) contains 26 synthetic, labeled cases covering all policy categories, paired authorization changes, injection attempts, and worker scope. The offline runner validates the corpus, exports unlabeled requests using the production reviewer prompt, and scores externally collected model responses. It never executes fixture commands or automatically contacts a provider.
204
+
205
+ See [`eval/README.md`](eval/README.md) for the opt-in live-evaluation procedure, response format, coverage map, and remaining manual release checks. Raw false allows, host policy overrides, false denials, invalid responses, and missing cases are reported separately. Scorer unit tests are not evidence of live model accuracy; no live-model result is claimed.
206
+
207
+ There is currently no `tests/mode-sandbox.test.mjs`; consequently `npm run test:sandbox` cannot establish sandbox coverage. Unit tests do not establish containment or protection of host paths/network.