docagent-cli 0.0.35__py3-none-any.whl
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.
- docagent_cli/__init__.py +36 -0
- docagent_cli/__main__.py +6 -0
- docagent_cli/_ask_user_types.py +90 -0
- docagent_cli/_cli_context.py +27 -0
- docagent_cli/_debug.py +52 -0
- docagent_cli/_env_vars.py +56 -0
- docagent_cli/_server_config.py +352 -0
- docagent_cli/_session_stats.py +114 -0
- docagent_cli/_testing_models.py +144 -0
- docagent_cli/_version.py +17 -0
- docagent_cli/agent.py +1193 -0
- docagent_cli/app.py +4979 -0
- docagent_cli/app.tcss +283 -0
- docagent_cli/ask_user.py +301 -0
- docagent_cli/built_in_skills/__init__.py +5 -0
- docagent_cli/built_in_skills/doc-coauthoring/SKILL.md +375 -0
- docagent_cli/built_in_skills/docx/LICENSE.txt +30 -0
- docagent_cli/built_in_skills/docx/SKILL.md +590 -0
- docagent_cli/built_in_skills/docx/scripts/__init__.py +1 -0
- docagent_cli/built_in_skills/docx/scripts/accept_changes.py +135 -0
- docagent_cli/built_in_skills/docx/scripts/comment.py +318 -0
- docagent_cli/built_in_skills/docx/scripts/office/helpers/__init__.py +0 -0
- docagent_cli/built_in_skills/docx/scripts/office/helpers/merge_runs.py +199 -0
- docagent_cli/built_in_skills/docx/scripts/office/helpers/simplify_redlines.py +197 -0
- docagent_cli/built_in_skills/docx/scripts/office/pack.py +159 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/mce/mc.xsd +75 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- docagent_cli/built_in_skills/docx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- docagent_cli/built_in_skills/docx/scripts/office/soffice.py +183 -0
- docagent_cli/built_in_skills/docx/scripts/office/unpack.py +132 -0
- docagent_cli/built_in_skills/docx/scripts/office/validate.py +111 -0
- docagent_cli/built_in_skills/docx/scripts/office/validators/__init__.py +15 -0
- docagent_cli/built_in_skills/docx/scripts/office/validators/base.py +847 -0
- docagent_cli/built_in_skills/docx/scripts/office/validators/docx.py +446 -0
- docagent_cli/built_in_skills/docx/scripts/office/validators/pptx.py +275 -0
- docagent_cli/built_in_skills/docx/scripts/office/validators/redlining.py +247 -0
- docagent_cli/built_in_skills/docx/scripts/templates/comments.xml +3 -0
- docagent_cli/built_in_skills/docx/scripts/templates/commentsExtended.xml +3 -0
- docagent_cli/built_in_skills/docx/scripts/templates/commentsExtensible.xml +3 -0
- docagent_cli/built_in_skills/docx/scripts/templates/commentsIds.xml +3 -0
- docagent_cli/built_in_skills/docx/scripts/templates/people.xml +3 -0
- docagent_cli/built_in_skills/pdf/LICENSE.txt +30 -0
- docagent_cli/built_in_skills/pdf/SKILL.md +314 -0
- docagent_cli/built_in_skills/pdf/forms.md +294 -0
- docagent_cli/built_in_skills/pdf/reference.md +612 -0
- docagent_cli/built_in_skills/pdf/scripts/check_bounding_boxes.py +65 -0
- docagent_cli/built_in_skills/pdf/scripts/check_fillable_fields.py +11 -0
- docagent_cli/built_in_skills/pdf/scripts/convert_pdf_to_images.py +33 -0
- docagent_cli/built_in_skills/pdf/scripts/create_validation_image.py +37 -0
- docagent_cli/built_in_skills/pdf/scripts/extract_form_field_info.py +122 -0
- docagent_cli/built_in_skills/pdf/scripts/extract_form_structure.py +115 -0
- docagent_cli/built_in_skills/pdf/scripts/fill_fillable_fields.py +98 -0
- docagent_cli/built_in_skills/pdf/scripts/fill_pdf_form_with_annotations.py +107 -0
- docagent_cli/built_in_skills/pptx/LICENSE.txt +30 -0
- docagent_cli/built_in_skills/pptx/SKILL.md +232 -0
- docagent_cli/built_in_skills/pptx/editing.md +205 -0
- docagent_cli/built_in_skills/pptx/pptxgenjs.md +420 -0
- docagent_cli/built_in_skills/pptx/scripts/__init__.py +0 -0
- docagent_cli/built_in_skills/pptx/scripts/add_slide.py +195 -0
- docagent_cli/built_in_skills/pptx/scripts/clean.py +286 -0
- docagent_cli/built_in_skills/pptx/scripts/office/helpers/__init__.py +0 -0
- docagent_cli/built_in_skills/pptx/scripts/office/helpers/merge_runs.py +199 -0
- docagent_cli/built_in_skills/pptx/scripts/office/helpers/simplify_redlines.py +197 -0
- docagent_cli/built_in_skills/pptx/scripts/office/pack.py +159 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/mce/mc.xsd +75 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- docagent_cli/built_in_skills/pptx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- docagent_cli/built_in_skills/pptx/scripts/office/soffice.py +183 -0
- docagent_cli/built_in_skills/pptx/scripts/office/unpack.py +132 -0
- docagent_cli/built_in_skills/pptx/scripts/office/validate.py +111 -0
- docagent_cli/built_in_skills/pptx/scripts/office/validators/__init__.py +15 -0
- docagent_cli/built_in_skills/pptx/scripts/office/validators/base.py +847 -0
- docagent_cli/built_in_skills/pptx/scripts/office/validators/docx.py +446 -0
- docagent_cli/built_in_skills/pptx/scripts/office/validators/pptx.py +275 -0
- docagent_cli/built_in_skills/pptx/scripts/office/validators/redlining.py +247 -0
- docagent_cli/built_in_skills/pptx/scripts/thumbnail.py +289 -0
- docagent_cli/built_in_skills/remember/SKILL.md +118 -0
- docagent_cli/built_in_skills/skill-creator/LICENSE.txt +202 -0
- docagent_cli/built_in_skills/skill-creator/SKILL.md +485 -0
- docagent_cli/built_in_skills/skill-creator/agents/analyzer.md +274 -0
- docagent_cli/built_in_skills/skill-creator/agents/comparator.md +202 -0
- docagent_cli/built_in_skills/skill-creator/agents/grader.md +223 -0
- docagent_cli/built_in_skills/skill-creator/assets/eval_review.html +146 -0
- docagent_cli/built_in_skills/skill-creator/eval-viewer/generate_review.py +471 -0
- docagent_cli/built_in_skills/skill-creator/eval-viewer/viewer.html +1325 -0
- docagent_cli/built_in_skills/skill-creator/references/schemas.md +430 -0
- docagent_cli/built_in_skills/skill-creator/scripts/__init__.py +0 -0
- docagent_cli/built_in_skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- docagent_cli/built_in_skills/skill-creator/scripts/generate_report.py +326 -0
- docagent_cli/built_in_skills/skill-creator/scripts/improve_description.py +247 -0
- docagent_cli/built_in_skills/skill-creator/scripts/package_skill.py +136 -0
- docagent_cli/built_in_skills/skill-creator/scripts/quick_validate.py +103 -0
- docagent_cli/built_in_skills/skill-creator/scripts/run_eval.py +310 -0
- docagent_cli/built_in_skills/skill-creator/scripts/run_loop.py +328 -0
- docagent_cli/built_in_skills/skill-creator/scripts/utils.py +47 -0
- docagent_cli/built_in_skills/theme-factory/LICENSE.txt +202 -0
- docagent_cli/built_in_skills/theme-factory/SKILL.md +59 -0
- docagent_cli/built_in_skills/theme-factory/theme-showcase.pdf +0 -0
- docagent_cli/built_in_skills/theme-factory/themes/arctic-frost.md +19 -0
- docagent_cli/built_in_skills/theme-factory/themes/botanical-garden.md +19 -0
- docagent_cli/built_in_skills/theme-factory/themes/desert-rose.md +19 -0
- docagent_cli/built_in_skills/theme-factory/themes/forest-canopy.md +19 -0
- docagent_cli/built_in_skills/theme-factory/themes/golden-hour.md +19 -0
- docagent_cli/built_in_skills/theme-factory/themes/midnight-galaxy.md +19 -0
- docagent_cli/built_in_skills/theme-factory/themes/modern-minimalist.md +19 -0
- docagent_cli/built_in_skills/theme-factory/themes/ocean-depths.md +19 -0
- docagent_cli/built_in_skills/theme-factory/themes/sunset-boulevard.md +19 -0
- docagent_cli/built_in_skills/theme-factory/themes/tech-innovation.md +19 -0
- docagent_cli/built_in_skills/xlsx/LICENSE.txt +30 -0
- docagent_cli/built_in_skills/xlsx/SKILL.md +292 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/helpers/__init__.py +0 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/helpers/merge_runs.py +199 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/helpers/simplify_redlines.py +197 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/pack.py +159 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/mce/mc.xsd +75 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/soffice.py +183 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/unpack.py +132 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/validate.py +111 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/validators/__init__.py +15 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/validators/base.py +847 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/validators/docx.py +446 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/validators/pptx.py +275 -0
- docagent_cli/built_in_skills/xlsx/scripts/office/validators/redlining.py +247 -0
- docagent_cli/built_in_skills/xlsx/scripts/recalc.py +184 -0
- docagent_cli/clipboard.py +128 -0
- docagent_cli/command_registry.py +284 -0
- docagent_cli/config.py +2418 -0
- docagent_cli/configurable_model.py +162 -0
- docagent_cli/default_agent_prompt.md +12 -0
- docagent_cli/editor.py +142 -0
- docagent_cli/file_ops.py +473 -0
- docagent_cli/formatting.py +28 -0
- docagent_cli/hooks.py +206 -0
- docagent_cli/input.py +787 -0
- docagent_cli/integrations/__init__.py +1 -0
- docagent_cli/integrations/sandbox_factory.py +873 -0
- docagent_cli/integrations/sandbox_provider.py +71 -0
- docagent_cli/local_context.py +718 -0
- docagent_cli/main.py +1641 -0
- docagent_cli/mcp_tools.py +707 -0
- docagent_cli/mcp_trust.py +168 -0
- docagent_cli/media_utils.py +478 -0
- docagent_cli/model_config.py +1620 -0
- docagent_cli/non_interactive.py +948 -0
- docagent_cli/offload.py +371 -0
- docagent_cli/output.py +69 -0
- docagent_cli/project_utils.py +188 -0
- docagent_cli/py.typed +0 -0
- docagent_cli/remote_client.py +515 -0
- docagent_cli/server.py +520 -0
- docagent_cli/server_graph.py +196 -0
- docagent_cli/server_manager.py +365 -0
- docagent_cli/sessions.py +1262 -0
- docagent_cli/skills/__init__.py +18 -0
- docagent_cli/skills/commands.py +1090 -0
- docagent_cli/skills/load.py +192 -0
- docagent_cli/subagents.py +173 -0
- docagent_cli/system_prompt.md +247 -0
- docagent_cli/textual_adapter.py +1352 -0
- docagent_cli/theme.py +842 -0
- docagent_cli/token_state.py +31 -0
- docagent_cli/tool_display.py +298 -0
- docagent_cli/tools.py +236 -0
- docagent_cli/ui.py +420 -0
- docagent_cli/unicode_security.py +516 -0
- docagent_cli/update_check.py +454 -0
- docagent_cli/widgets/__init__.py +9 -0
- docagent_cli/widgets/_links.py +63 -0
- docagent_cli/widgets/approval.py +442 -0
- docagent_cli/widgets/ask_user.py +398 -0
- docagent_cli/widgets/autocomplete.py +691 -0
- docagent_cli/widgets/chat_input.py +1827 -0
- docagent_cli/widgets/diff.py +248 -0
- docagent_cli/widgets/history.py +188 -0
- docagent_cli/widgets/loading.py +177 -0
- docagent_cli/widgets/mcp_viewer.py +362 -0
- docagent_cli/widgets/message_store.py +675 -0
- docagent_cli/widgets/messages.py +1751 -0
- docagent_cli/widgets/model_selector.py +964 -0
- docagent_cli/widgets/status.py +372 -0
- docagent_cli/widgets/theme_selector.py +164 -0
- docagent_cli/widgets/thread_selector.py +1905 -0
- docagent_cli/widgets/tool_renderers.py +148 -0
- docagent_cli/widgets/tool_widgets.py +274 -0
- docagent_cli/widgets/welcome.py +339 -0
- docagent_cli-0.0.35.data/data/docagent_cli/default_agent_prompt.md +12 -0
- docagent_cli-0.0.35.dist-info/METADATA +200 -0
- docagent_cli-0.0.35.dist-info/RECORD +300 -0
- docagent_cli-0.0.35.dist-info/WHEEL +4 -0
- docagent_cli-0.0.35.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
"""Approval widget for HITL - using standard Textual patterns."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING, Any, ClassVar
|
|
6
|
+
|
|
7
|
+
from textual.binding import Binding, BindingType
|
|
8
|
+
from textual.containers import Container, Vertical, VerticalScroll
|
|
9
|
+
from textual.content import Content
|
|
10
|
+
from textual.message import Message
|
|
11
|
+
from textual.widgets import Static
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
import asyncio
|
|
15
|
+
|
|
16
|
+
from textual import events
|
|
17
|
+
from textual.app import ComposeResult
|
|
18
|
+
|
|
19
|
+
from docagent_cli import theme
|
|
20
|
+
from docagent_cli.config import (
|
|
21
|
+
SHELL_TOOL_NAMES,
|
|
22
|
+
get_glyphs,
|
|
23
|
+
is_ascii_mode,
|
|
24
|
+
)
|
|
25
|
+
from docagent_cli.unicode_security import (
|
|
26
|
+
check_url_safety,
|
|
27
|
+
detect_dangerous_unicode,
|
|
28
|
+
format_warning_detail,
|
|
29
|
+
iter_string_values,
|
|
30
|
+
looks_like_url_key,
|
|
31
|
+
render_with_unicode_markers,
|
|
32
|
+
strip_dangerous_unicode,
|
|
33
|
+
summarize_issues,
|
|
34
|
+
)
|
|
35
|
+
from docagent_cli.widgets.tool_renderers import get_renderer
|
|
36
|
+
|
|
37
|
+
# Max length for truncated shell command display
|
|
38
|
+
_SHELL_COMMAND_TRUNCATE_LENGTH: int = 120
|
|
39
|
+
_WARNING_PREVIEW_LIMIT: int = 3
|
|
40
|
+
_WARNING_TEXT_TRUNCATE_LENGTH: int = 220
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class ApprovalMenu(Container):
|
|
44
|
+
"""Approval menu using standard Textual patterns.
|
|
45
|
+
|
|
46
|
+
Key design decisions (following mistral-vibe reference):
|
|
47
|
+
- Container base class with compose()
|
|
48
|
+
- BINDINGS for key handling (not on_key)
|
|
49
|
+
- can_focus_children = False to prevent focus theft
|
|
50
|
+
- Simple Static widgets for options
|
|
51
|
+
- Standard message posting
|
|
52
|
+
- Tool-specific widgets via renderer pattern
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
can_focus = True
|
|
56
|
+
can_focus_children = False
|
|
57
|
+
|
|
58
|
+
# CSS is in app.tcss - no DEFAULT_CSS needed
|
|
59
|
+
|
|
60
|
+
BINDINGS: ClassVar[list[BindingType]] = [
|
|
61
|
+
Binding("up", "move_up", "Up", show=False),
|
|
62
|
+
Binding("k", "move_up", "Up", show=False),
|
|
63
|
+
Binding("down", "move_down", "Down", show=False),
|
|
64
|
+
Binding("j", "move_down", "Down", show=False),
|
|
65
|
+
Binding("enter", "select", "Select", show=False),
|
|
66
|
+
Binding("1", "select_approve", "Approve", show=False),
|
|
67
|
+
Binding("y", "select_approve", "Approve", show=False),
|
|
68
|
+
Binding("2", "select_auto", "Auto-approve", show=False),
|
|
69
|
+
Binding("a", "select_auto", "Auto-approve", show=False),
|
|
70
|
+
Binding("3", "select_reject", "Reject", show=False),
|
|
71
|
+
Binding("n", "select_reject", "Reject", show=False),
|
|
72
|
+
Binding("e", "toggle_expand", "Expand command", show=False),
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
class Decided(Message):
|
|
76
|
+
"""Message sent when user makes a decision."""
|
|
77
|
+
|
|
78
|
+
def __init__(self, decision: dict[str, str]) -> None:
|
|
79
|
+
"""Initialize a Decided message with the user's decision.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
decision: Dictionary containing the decision type (e.g., 'approve',
|
|
83
|
+
'reject', or 'auto_approve_all').
|
|
84
|
+
"""
|
|
85
|
+
super().__init__()
|
|
86
|
+
self.decision = decision
|
|
87
|
+
|
|
88
|
+
# Tools that don't need detailed info display (already shown in tool call)
|
|
89
|
+
_MINIMAL_TOOLS: ClassVar[frozenset[str]] = SHELL_TOOL_NAMES
|
|
90
|
+
|
|
91
|
+
def __init__(
|
|
92
|
+
self,
|
|
93
|
+
action_requests: list[dict[str, Any]] | dict[str, Any],
|
|
94
|
+
_assistant_id: str | None = None,
|
|
95
|
+
id: str | None = None, # noqa: A002 # Textual widget constructor uses `id` parameter
|
|
96
|
+
**kwargs: Any,
|
|
97
|
+
) -> None:
|
|
98
|
+
"""Initialize the ApprovalMenu widget.
|
|
99
|
+
|
|
100
|
+
Args:
|
|
101
|
+
action_requests: A single action request dictionary or a list of action
|
|
102
|
+
request dictionaries requiring approval. Each dictionary should
|
|
103
|
+
contain 'name' (tool name) and 'args' (tool arguments).
|
|
104
|
+
_assistant_id: Optional assistant ID (currently unused, reserved for
|
|
105
|
+
future use).
|
|
106
|
+
id: Optional widget ID. Defaults to 'approval-menu'.
|
|
107
|
+
**kwargs: Additional keyword arguments passed to the Container base class.
|
|
108
|
+
"""
|
|
109
|
+
super().__init__(id=id or "approval-menu", classes="approval-menu", **kwargs)
|
|
110
|
+
# Support both single request (legacy) and list of requests (batch)
|
|
111
|
+
if isinstance(action_requests, dict):
|
|
112
|
+
self._action_requests = [action_requests]
|
|
113
|
+
else:
|
|
114
|
+
self._action_requests = action_requests
|
|
115
|
+
|
|
116
|
+
# For display purposes, get tool names
|
|
117
|
+
self._tool_names = [r.get("name", "unknown") for r in self._action_requests]
|
|
118
|
+
self._selected = 0
|
|
119
|
+
self._future: asyncio.Future[dict[str, str]] | None = None
|
|
120
|
+
self._option_widgets: list[Static] = []
|
|
121
|
+
self._tool_info_container: Vertical | None = None
|
|
122
|
+
# Minimal display if ALL tools are bash/shell
|
|
123
|
+
self._is_minimal = all(name in self._MINIMAL_TOOLS for name in self._tool_names)
|
|
124
|
+
# For expandable shell commands
|
|
125
|
+
self._command_expanded = False
|
|
126
|
+
self._command_widget: Static | None = None
|
|
127
|
+
self._has_expandable_command = self._check_expandable_command()
|
|
128
|
+
self._security_warnings = self._collect_security_warnings()
|
|
129
|
+
|
|
130
|
+
def set_future(self, future: asyncio.Future[dict[str, str]]) -> None:
|
|
131
|
+
"""Set the future to resolve when user decides."""
|
|
132
|
+
self._future = future
|
|
133
|
+
|
|
134
|
+
def _check_expandable_command(self) -> bool:
|
|
135
|
+
"""Check if there's a shell command that can be expanded.
|
|
136
|
+
|
|
137
|
+
Returns:
|
|
138
|
+
Whether the single action request is an expandable shell command.
|
|
139
|
+
"""
|
|
140
|
+
if len(self._action_requests) != 1:
|
|
141
|
+
return False
|
|
142
|
+
req = self._action_requests[0]
|
|
143
|
+
if req.get("name", "") not in SHELL_TOOL_NAMES:
|
|
144
|
+
return False
|
|
145
|
+
command = str(req.get("args", {}).get("command", ""))
|
|
146
|
+
return len(command) > _SHELL_COMMAND_TRUNCATE_LENGTH
|
|
147
|
+
|
|
148
|
+
def _get_command_display(self, *, expanded: bool) -> Content:
|
|
149
|
+
"""Get the command display content (truncated or full).
|
|
150
|
+
|
|
151
|
+
Args:
|
|
152
|
+
expanded: Whether to show the full command or truncated version.
|
|
153
|
+
|
|
154
|
+
Returns:
|
|
155
|
+
Styled Content for the command display.
|
|
156
|
+
|
|
157
|
+
Raises:
|
|
158
|
+
RuntimeError: If called with empty action_requests.
|
|
159
|
+
"""
|
|
160
|
+
if not self._action_requests:
|
|
161
|
+
msg = "_get_command_display called with empty action_requests"
|
|
162
|
+
raise RuntimeError(msg)
|
|
163
|
+
req = self._action_requests[0]
|
|
164
|
+
command_raw = str(req.get("args", {}).get("command", ""))
|
|
165
|
+
command = strip_dangerous_unicode(command_raw)
|
|
166
|
+
issues = detect_dangerous_unicode(command_raw)
|
|
167
|
+
|
|
168
|
+
if expanded or len(command) <= _SHELL_COMMAND_TRUNCATE_LENGTH:
|
|
169
|
+
command_display = command
|
|
170
|
+
else:
|
|
171
|
+
command_display = (
|
|
172
|
+
command[:_SHELL_COMMAND_TRUNCATE_LENGTH] + get_glyphs().ellipsis
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
if not expanded and len(command) > _SHELL_COMMAND_TRUNCATE_LENGTH:
|
|
176
|
+
display = Content.from_markup(
|
|
177
|
+
"[bold]$cmd[/bold] [dim](press 'e' to expand)[/dim]",
|
|
178
|
+
cmd=command_display,
|
|
179
|
+
)
|
|
180
|
+
else:
|
|
181
|
+
display = Content.from_markup("[bold]$cmd[/bold]", cmd=command_display)
|
|
182
|
+
|
|
183
|
+
if not issues:
|
|
184
|
+
return display
|
|
185
|
+
|
|
186
|
+
raw_with_markers = render_with_unicode_markers(command_raw)
|
|
187
|
+
if not expanded and len(raw_with_markers) > _WARNING_TEXT_TRUNCATE_LENGTH:
|
|
188
|
+
raw_with_markers = (
|
|
189
|
+
raw_with_markers[:_WARNING_TEXT_TRUNCATE_LENGTH] + get_glyphs().ellipsis
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
return Content.assemble(
|
|
193
|
+
display,
|
|
194
|
+
Content.from_markup(
|
|
195
|
+
"\n[yellow]Warning:[/yellow] hidden chars detected ($summary)\n"
|
|
196
|
+
"[dim]raw: $raw[/dim]",
|
|
197
|
+
summary=summarize_issues(issues),
|
|
198
|
+
raw=raw_with_markers,
|
|
199
|
+
),
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
def compose(self) -> ComposeResult:
|
|
203
|
+
"""Compose the widget with Static children.
|
|
204
|
+
|
|
205
|
+
Layout: Tool info first (what's being approved), then options at bottom.
|
|
206
|
+
For bash/shell, skip tool info since it's already shown in tool call.
|
|
207
|
+
|
|
208
|
+
Yields:
|
|
209
|
+
Widgets for title, tool info, options, and help text.
|
|
210
|
+
"""
|
|
211
|
+
# Title - show count if multiple tools
|
|
212
|
+
count = len(self._action_requests)
|
|
213
|
+
if count == 1:
|
|
214
|
+
title = Content.from_markup(
|
|
215
|
+
">>> $name Requires Approval <<<", name=self._tool_names[0]
|
|
216
|
+
)
|
|
217
|
+
else:
|
|
218
|
+
title = Content(f">>> {count} Tool Calls Require Approval <<<")
|
|
219
|
+
yield Static(title, classes="approval-title")
|
|
220
|
+
|
|
221
|
+
if self._security_warnings:
|
|
222
|
+
parts: list[Content] = [
|
|
223
|
+
Content.from_markup(
|
|
224
|
+
"[yellow]Warning:[/yellow] Potentially deceptive text"
|
|
225
|
+
),
|
|
226
|
+
]
|
|
227
|
+
parts.extend(
|
|
228
|
+
Content.from_markup("\n[dim]- $w[/dim]", w=warning)
|
|
229
|
+
for warning in self._security_warnings[:_WARNING_PREVIEW_LIMIT]
|
|
230
|
+
)
|
|
231
|
+
if len(self._security_warnings) > _WARNING_PREVIEW_LIMIT:
|
|
232
|
+
remaining = len(self._security_warnings) - _WARNING_PREVIEW_LIMIT
|
|
233
|
+
parts.append(Content.styled(f"\n- +{remaining} more warning(s)", "dim"))
|
|
234
|
+
yield Static(
|
|
235
|
+
Content.assemble(*parts),
|
|
236
|
+
classes="approval-security-warning",
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
# For shell commands, show the command (expandable if long)
|
|
240
|
+
if self._is_minimal and len(self._action_requests) == 1:
|
|
241
|
+
self._command_widget = Static(
|
|
242
|
+
self._get_command_display(expanded=self._command_expanded),
|
|
243
|
+
classes="approval-command",
|
|
244
|
+
)
|
|
245
|
+
yield self._command_widget
|
|
246
|
+
|
|
247
|
+
# Tool info - only for non-minimal tools (diffs, writes show actual content)
|
|
248
|
+
if not self._is_minimal:
|
|
249
|
+
with VerticalScroll(classes="tool-info-scroll"):
|
|
250
|
+
self._tool_info_container = Vertical(classes="tool-info-container")
|
|
251
|
+
yield self._tool_info_container
|
|
252
|
+
|
|
253
|
+
# Separator between tool details and options
|
|
254
|
+
glyphs = get_glyphs()
|
|
255
|
+
yield Static(glyphs.box_horizontal * 40, classes="approval-separator")
|
|
256
|
+
|
|
257
|
+
# Options container at bottom
|
|
258
|
+
with Container(classes="approval-options-container"):
|
|
259
|
+
# Options - create 3 Static widgets
|
|
260
|
+
for i in range(3): # noqa: B007 # Loop variable unused - iterating for count only
|
|
261
|
+
widget = Static("", classes="approval-option")
|
|
262
|
+
self._option_widgets.append(widget)
|
|
263
|
+
yield widget
|
|
264
|
+
|
|
265
|
+
# Help text at the very bottom
|
|
266
|
+
glyphs = get_glyphs()
|
|
267
|
+
help_text = (
|
|
268
|
+
f"{glyphs.arrow_up}/{glyphs.arrow_down} navigate {glyphs.bullet} "
|
|
269
|
+
f"Enter select {glyphs.bullet} y/a/n quick keys {glyphs.bullet} Esc reject"
|
|
270
|
+
)
|
|
271
|
+
if self._has_expandable_command:
|
|
272
|
+
help_text += f" {glyphs.bullet} e expand"
|
|
273
|
+
yield Static(help_text, classes="approval-help")
|
|
274
|
+
|
|
275
|
+
async def on_mount(self) -> None:
|
|
276
|
+
"""Focus self on mount and update tool info."""
|
|
277
|
+
if is_ascii_mode():
|
|
278
|
+
colors = theme.get_theme_colors(self)
|
|
279
|
+
self.styles.border = ("ascii", colors.warning)
|
|
280
|
+
|
|
281
|
+
if not self._is_minimal:
|
|
282
|
+
await self._update_tool_info()
|
|
283
|
+
self._update_options()
|
|
284
|
+
self.focus()
|
|
285
|
+
|
|
286
|
+
async def _update_tool_info(self) -> None:
|
|
287
|
+
"""Mount the tool-specific approval widgets for all tools."""
|
|
288
|
+
if not self._tool_info_container:
|
|
289
|
+
return
|
|
290
|
+
|
|
291
|
+
# Clear existing content
|
|
292
|
+
await self._tool_info_container.remove_children()
|
|
293
|
+
|
|
294
|
+
# Mount info for each tool
|
|
295
|
+
for i, action_request in enumerate(self._action_requests):
|
|
296
|
+
tool_name = action_request.get("name", "unknown")
|
|
297
|
+
tool_args = action_request.get("args", {})
|
|
298
|
+
|
|
299
|
+
# Add tool header if multiple tools
|
|
300
|
+
if len(self._action_requests) > 1:
|
|
301
|
+
header = Static(
|
|
302
|
+
Content.from_markup(
|
|
303
|
+
"[bold]$num. $name[/bold]",
|
|
304
|
+
num=i + 1,
|
|
305
|
+
name=tool_name,
|
|
306
|
+
)
|
|
307
|
+
)
|
|
308
|
+
await self._tool_info_container.mount(header)
|
|
309
|
+
|
|
310
|
+
# Show description if present
|
|
311
|
+
description = action_request.get("description")
|
|
312
|
+
if description:
|
|
313
|
+
desc_widget = Static(
|
|
314
|
+
Content.from_markup("[dim]$desc[/dim]", desc=description),
|
|
315
|
+
classes="approval-description",
|
|
316
|
+
)
|
|
317
|
+
await self._tool_info_container.mount(desc_widget)
|
|
318
|
+
|
|
319
|
+
# Get the appropriate renderer for this tool
|
|
320
|
+
renderer = get_renderer(tool_name)
|
|
321
|
+
widget_class, data = renderer.get_approval_widget(tool_args)
|
|
322
|
+
approval_widget = widget_class(data)
|
|
323
|
+
await self._tool_info_container.mount(approval_widget)
|
|
324
|
+
|
|
325
|
+
def _update_options(self) -> None:
|
|
326
|
+
"""Update option widgets based on selection."""
|
|
327
|
+
count = len(self._action_requests)
|
|
328
|
+
if count == 1:
|
|
329
|
+
options = [
|
|
330
|
+
"1. Approve (y)",
|
|
331
|
+
"2. Auto-approve for this thread (a)",
|
|
332
|
+
"3. Reject (n)",
|
|
333
|
+
]
|
|
334
|
+
else:
|
|
335
|
+
options = [
|
|
336
|
+
f"1. Approve all {count} (y)",
|
|
337
|
+
"2. Auto-approve for this thread (a)",
|
|
338
|
+
f"3. Reject all {count} (n)",
|
|
339
|
+
]
|
|
340
|
+
|
|
341
|
+
for i, (text, widget) in enumerate(
|
|
342
|
+
zip(options, self._option_widgets, strict=True)
|
|
343
|
+
):
|
|
344
|
+
cursor = f"{get_glyphs().cursor} " if i == self._selected else " "
|
|
345
|
+
widget.update(f"{cursor}{text}")
|
|
346
|
+
|
|
347
|
+
# Update classes
|
|
348
|
+
widget.remove_class("approval-option-selected")
|
|
349
|
+
if i == self._selected:
|
|
350
|
+
widget.add_class("approval-option-selected")
|
|
351
|
+
|
|
352
|
+
def action_move_up(self) -> None:
|
|
353
|
+
"""Move selection up."""
|
|
354
|
+
self._selected = (self._selected - 1) % 3
|
|
355
|
+
self._update_options()
|
|
356
|
+
|
|
357
|
+
def action_move_down(self) -> None:
|
|
358
|
+
"""Move selection down."""
|
|
359
|
+
self._selected = (self._selected + 1) % 3
|
|
360
|
+
self._update_options()
|
|
361
|
+
|
|
362
|
+
def action_select(self) -> None:
|
|
363
|
+
"""Select current option."""
|
|
364
|
+
self._handle_selection(self._selected)
|
|
365
|
+
|
|
366
|
+
def action_select_approve(self) -> None:
|
|
367
|
+
"""Select approve option."""
|
|
368
|
+
self._selected = 0
|
|
369
|
+
self._update_options()
|
|
370
|
+
self._handle_selection(0)
|
|
371
|
+
|
|
372
|
+
def action_select_auto(self) -> None:
|
|
373
|
+
"""Select auto-approve option."""
|
|
374
|
+
self._selected = 1
|
|
375
|
+
self._update_options()
|
|
376
|
+
self._handle_selection(1)
|
|
377
|
+
|
|
378
|
+
def action_select_reject(self) -> None:
|
|
379
|
+
"""Select reject option."""
|
|
380
|
+
self._selected = 2
|
|
381
|
+
self._update_options()
|
|
382
|
+
self._handle_selection(2)
|
|
383
|
+
|
|
384
|
+
def action_toggle_expand(self) -> None:
|
|
385
|
+
"""Toggle shell command expansion."""
|
|
386
|
+
if not self._has_expandable_command or not self._command_widget:
|
|
387
|
+
return
|
|
388
|
+
self._command_expanded = not self._command_expanded
|
|
389
|
+
self._command_widget.update(
|
|
390
|
+
self._get_command_display(expanded=self._command_expanded)
|
|
391
|
+
)
|
|
392
|
+
|
|
393
|
+
def _handle_selection(self, option: int) -> None:
|
|
394
|
+
"""Handle the selected option."""
|
|
395
|
+
decision_map = {
|
|
396
|
+
0: "approve",
|
|
397
|
+
1: "auto_approve_all",
|
|
398
|
+
2: "reject",
|
|
399
|
+
}
|
|
400
|
+
decision = {"type": decision_map[option]}
|
|
401
|
+
|
|
402
|
+
# Resolve the future
|
|
403
|
+
if self._future and not self._future.done():
|
|
404
|
+
self._future.set_result(decision)
|
|
405
|
+
|
|
406
|
+
# Post message
|
|
407
|
+
self.post_message(self.Decided(decision))
|
|
408
|
+
|
|
409
|
+
def _collect_security_warnings(self) -> list[str]:
|
|
410
|
+
"""Collect warning strings for suspicious Unicode and URL values.
|
|
411
|
+
|
|
412
|
+
Recursively inspects all nested string values in action arguments.
|
|
413
|
+
|
|
414
|
+
Returns:
|
|
415
|
+
Warning strings for the current action request batch.
|
|
416
|
+
"""
|
|
417
|
+
warnings: list[str] = []
|
|
418
|
+
for action_request in self._action_requests:
|
|
419
|
+
tool_name = str(action_request.get("name", "unknown"))
|
|
420
|
+
args = action_request.get("args", {})
|
|
421
|
+
if not isinstance(args, dict):
|
|
422
|
+
continue
|
|
423
|
+
for arg_path, text in iter_string_values(args):
|
|
424
|
+
issues = detect_dangerous_unicode(text)
|
|
425
|
+
if issues:
|
|
426
|
+
warnings.append(
|
|
427
|
+
f"{tool_name}.{arg_path}: hidden Unicode "
|
|
428
|
+
f"({summarize_issues(issues)})"
|
|
429
|
+
)
|
|
430
|
+
if looks_like_url_key(arg_path):
|
|
431
|
+
result = check_url_safety(text)
|
|
432
|
+
if result.safe:
|
|
433
|
+
continue
|
|
434
|
+
detail = format_warning_detail(result.warnings)
|
|
435
|
+
if result.decoded_domain:
|
|
436
|
+
detail = f"{detail}; decoded host: {result.decoded_domain}"
|
|
437
|
+
warnings.append(f"{tool_name}.{arg_path}: {detail}")
|
|
438
|
+
return warnings
|
|
439
|
+
|
|
440
|
+
def on_blur(self, event: events.Blur) -> None: # noqa: ARG002 # Textual event handler signature
|
|
441
|
+
"""Re-focus on blur to keep focus trapped until decision is made."""
|
|
442
|
+
self.call_after_refresh(self.focus)
|