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
docagent_cli/__init__.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Deep Agents CLI - Interactive AI coding assistant."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING
|
|
6
|
+
|
|
7
|
+
from docagent_cli._version import __version__
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from collections.abc import Callable
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"__version__",
|
|
14
|
+
"cli_main", # noqa: F822 # resolved lazily by __getattr__
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def __getattr__(name: str) -> Callable[[], None]:
|
|
19
|
+
"""Lazy import for `cli_main` to avoid loading `main.py` at package import.
|
|
20
|
+
|
|
21
|
+
`main.py` pulls in `argparse`, signal handling, and other startup machinery
|
|
22
|
+
that isn't needed when submodules like `config` or `widgets` are
|
|
23
|
+
imported directly.
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
The requested callable.
|
|
27
|
+
|
|
28
|
+
Raises:
|
|
29
|
+
AttributeError: If *name* is not a lazily-provided attribute.
|
|
30
|
+
"""
|
|
31
|
+
if name == "cli_main":
|
|
32
|
+
from docagent_cli.main import cli_main
|
|
33
|
+
|
|
34
|
+
return cli_main
|
|
35
|
+
msg = f"module {__name__!r} has no attribute {name!r}"
|
|
36
|
+
raise AttributeError(msg)
|
docagent_cli/__main__.py
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""Lightweight types for the ask-user interrupt protocol.
|
|
2
|
+
|
|
3
|
+
Extracted from `ask_user` so `textual_adapter` can import `AskUserRequest` at
|
|
4
|
+
module level — and `app` can reference the types at type-check time — without
|
|
5
|
+
pulling in the langchain middleware stack.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from typing import Annotated, Literal, NotRequired
|
|
11
|
+
|
|
12
|
+
from pydantic import Field
|
|
13
|
+
from typing_extensions import TypedDict
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class Choice(TypedDict):
|
|
17
|
+
"""A single choice option for a multiple choice question."""
|
|
18
|
+
|
|
19
|
+
value: Annotated[str, Field(description="The display label for this choice.")]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Question(TypedDict):
|
|
23
|
+
"""A question to ask the user."""
|
|
24
|
+
|
|
25
|
+
question: Annotated[str, Field(description="The question text to display.")]
|
|
26
|
+
|
|
27
|
+
type: Annotated[
|
|
28
|
+
Literal["text", "multiple_choice"],
|
|
29
|
+
Field(
|
|
30
|
+
description=(
|
|
31
|
+
"Question type. 'text' for free-form input, 'multiple_choice' for "
|
|
32
|
+
"predefined options."
|
|
33
|
+
)
|
|
34
|
+
),
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
choices: NotRequired[
|
|
38
|
+
Annotated[
|
|
39
|
+
list[Choice],
|
|
40
|
+
Field(
|
|
41
|
+
description=(
|
|
42
|
+
"Options for multiple_choice questions. An 'Other' free-form "
|
|
43
|
+
"option is always appended automatically."
|
|
44
|
+
)
|
|
45
|
+
),
|
|
46
|
+
]
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
required: NotRequired[
|
|
50
|
+
Annotated[
|
|
51
|
+
bool,
|
|
52
|
+
Field(
|
|
53
|
+
description="Whether the user must answer. Defaults to true if omitted."
|
|
54
|
+
),
|
|
55
|
+
]
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class AskUserRequest(TypedDict):
|
|
60
|
+
"""Request payload sent via interrupt when asking the user questions."""
|
|
61
|
+
|
|
62
|
+
type: Literal["ask_user"]
|
|
63
|
+
"""Discriminator tag, always `'ask_user'`."""
|
|
64
|
+
|
|
65
|
+
questions: list[Question]
|
|
66
|
+
"""Questions to present to the user."""
|
|
67
|
+
|
|
68
|
+
tool_call_id: str
|
|
69
|
+
"""ID of the originating tool call, used to route the response back."""
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class AskUserAnswered(TypedDict):
|
|
73
|
+
"""Widget result when the user submits answers."""
|
|
74
|
+
|
|
75
|
+
type: Literal["answered"]
|
|
76
|
+
"""Discriminator tag, always `'answered'`."""
|
|
77
|
+
|
|
78
|
+
answers: list[str]
|
|
79
|
+
"""User-provided answers, one per question."""
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class AskUserCancelled(TypedDict):
|
|
83
|
+
"""Widget result when the user cancels the prompt."""
|
|
84
|
+
|
|
85
|
+
type: Literal["cancelled"]
|
|
86
|
+
"""Discriminator tag, always `'cancelled'`."""
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
AskUserWidgetResult = AskUserAnswered | AskUserCancelled
|
|
90
|
+
"""Discriminated union for the ask_user widget Future result."""
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""Lightweight runtime context type for CLI model overrides.
|
|
2
|
+
|
|
3
|
+
Extracted from `configurable_model` so hot-path modules (`app`,
|
|
4
|
+
`textual_adapter`) can import `CLIContext` without pulling in the langchain
|
|
5
|
+
middleware stack.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from typing import Any
|
|
11
|
+
|
|
12
|
+
from typing_extensions import TypedDict
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class CLIContext(TypedDict, total=False):
|
|
16
|
+
"""Runtime context passed via `context=` to the LangGraph graph.
|
|
17
|
+
|
|
18
|
+
Carries per-invocation overrides that `ConfigurableModelMiddleware`
|
|
19
|
+
reads from `request.runtime.context`.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
model: str | None
|
|
23
|
+
"""Model spec to swap at runtime (e.g. `'openai:gpt-4o'`)."""
|
|
24
|
+
|
|
25
|
+
model_params: dict[str, Any]
|
|
26
|
+
"""Invocation params (e.g. `temperature`, `max_tokens`) to merge
|
|
27
|
+
into `model_settings`."""
|
docagent_cli/_debug.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""Shared debug-logging configuration for verbose file-based tracing.
|
|
2
|
+
|
|
3
|
+
When the `DEEPAGENTS_CLI_DEBUG` environment variable is set, modules that handle
|
|
4
|
+
streaming or remote communication can enable detailed file-based logging. This
|
|
5
|
+
helper centralizes the setup so the env-var name, file path, and format are
|
|
6
|
+
defined in one place.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import logging
|
|
12
|
+
import os
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
|
|
15
|
+
from docagent_cli._env_vars import DEBUG, DEBUG_FILE
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def configure_debug_logging(target: logging.Logger) -> None:
|
|
19
|
+
"""Attach a file handler to *target* when `DEEPAGENTS_CLI_DEBUG` is set.
|
|
20
|
+
|
|
21
|
+
The log file defaults to `'/tmp/docagent_debug.log'` but can be overridden
|
|
22
|
+
with `DEEPAGENTS_CLI_DEBUG_FILE`. The handler appends so that multiple
|
|
23
|
+
modules share the same log file across a session.
|
|
24
|
+
|
|
25
|
+
Does nothing when `DEEPAGENTS_CLI_DEBUG` is not set.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
target: Logger to configure.
|
|
29
|
+
"""
|
|
30
|
+
if not os.environ.get(DEBUG):
|
|
31
|
+
return
|
|
32
|
+
|
|
33
|
+
debug_path = Path(
|
|
34
|
+
os.environ.get(
|
|
35
|
+
DEBUG_FILE,
|
|
36
|
+
"/tmp/docagent_debug.log", # noqa: S108
|
|
37
|
+
)
|
|
38
|
+
)
|
|
39
|
+
try:
|
|
40
|
+
handler = logging.FileHandler(str(debug_path), mode="a")
|
|
41
|
+
except OSError as exc:
|
|
42
|
+
import sys
|
|
43
|
+
|
|
44
|
+
print( # noqa: T201
|
|
45
|
+
f"Warning: could not open debug log file {debug_path}: {exc}",
|
|
46
|
+
file=sys.stderr,
|
|
47
|
+
)
|
|
48
|
+
return
|
|
49
|
+
handler.setLevel(logging.DEBUG)
|
|
50
|
+
handler.setFormatter(logging.Formatter("%(asctime)s %(name)s %(message)s"))
|
|
51
|
+
target.addHandler(handler)
|
|
52
|
+
target.setLevel(logging.DEBUG)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""Canonical registry of `DEEPAGENTS_CLI_*` environment variables.
|
|
2
|
+
|
|
3
|
+
Every env var the CLI reads whose name starts with `DEEPAGENTS_CLI_` must
|
|
4
|
+
be defined here as a module-level constant. A drift-detection test
|
|
5
|
+
(`tests/unit_tests/test_env_vars.py`) fails when a bare string literal
|
|
6
|
+
like `"DEEPAGENTS_CLI_FOO"` appears in source code instead of a constant
|
|
7
|
+
imported from this module.
|
|
8
|
+
|
|
9
|
+
Import the short-name constants (e.g. `AUTO_UPDATE`, `DEBUG`) and pass them
|
|
10
|
+
to `os.environ.get()` instead of using raw string literals. If the env var is
|
|
11
|
+
ever renamed, only the value here changes.
|
|
12
|
+
|
|
13
|
+
!!! note
|
|
14
|
+
|
|
15
|
+
`resolve_env_var` also supports a dynamic prefix override for API keys
|
|
16
|
+
and provider credentials: setting `DEEPAGENTS_CLI_{NAME}` takes priority
|
|
17
|
+
over `{NAME}`. For example, `DEEPAGENTS_CLI_OPENAI_API_KEY` overrides
|
|
18
|
+
`OPENAI_API_KEY`. Only call sites that use `resolve_env_var` benefit from
|
|
19
|
+
this -- direct `os.environ.get` lookups (like the constants below) do not.
|
|
20
|
+
Dynamic overrides are not listed here because they mirror third-party
|
|
21
|
+
variable names.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
from __future__ import annotations
|
|
25
|
+
|
|
26
|
+
# ---------------------------------------------------------------------------
|
|
27
|
+
# Constants — import these instead of bare string literals.
|
|
28
|
+
# Keep alphabetically sorted by constant name.
|
|
29
|
+
# ---------------------------------------------------------------------------
|
|
30
|
+
|
|
31
|
+
AUTO_UPDATE = "DEEPAGENTS_CLI_AUTO_UPDATE"
|
|
32
|
+
"""Enable automatic CLI updates ('1', 'true', or 'yes')."""
|
|
33
|
+
|
|
34
|
+
DEBUG = "DEEPAGENTS_CLI_DEBUG"
|
|
35
|
+
"""Enable verbose debug logging to a file."""
|
|
36
|
+
|
|
37
|
+
DEBUG_FILE = "DEEPAGENTS_CLI_DEBUG_FILE"
|
|
38
|
+
"""Path for the debug log file (default: `/tmp/docagent_debug.log`)."""
|
|
39
|
+
|
|
40
|
+
EXTRA_SKILLS_DIRS = "DEEPAGENTS_CLI_EXTRA_SKILLS_DIRS"
|
|
41
|
+
"""Colon-separated paths added to the skill containment allowlist."""
|
|
42
|
+
|
|
43
|
+
LANGSMITH_PROJECT = "DEEPAGENTS_CLI_LANGSMITH_PROJECT"
|
|
44
|
+
"""Override LangSmith project name for agent traces."""
|
|
45
|
+
|
|
46
|
+
NO_UPDATE_CHECK = "DEEPAGENTS_CLI_NO_UPDATE_CHECK"
|
|
47
|
+
"""Disable automatic update checking when set."""
|
|
48
|
+
|
|
49
|
+
SERVER_ENV_PREFIX = "DEEPAGENTS_CLI_SERVER_"
|
|
50
|
+
"""Environment variable prefix used to pass CLI config to the server subprocess."""
|
|
51
|
+
|
|
52
|
+
SHELL_ALLOW_LIST = "DEEPAGENTS_CLI_SHELL_ALLOW_LIST"
|
|
53
|
+
"""Comma-separated shell commands to allow (or 'recommended'/'all')."""
|
|
54
|
+
|
|
55
|
+
USER_ID = "DEEPAGENTS_CLI_USER_ID"
|
|
56
|
+
"""Attach a user identifier to LangSmith trace metadata."""
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
"""Typed configuration for the CLI-to-server subprocess communication channel.
|
|
2
|
+
|
|
3
|
+
The CLI spawns a `langgraph dev` subprocess and passes configuration via
|
|
4
|
+
environment variables prefixed with `DEEPAGENTS_CLI_SERVER_`. This module
|
|
5
|
+
provides a single
|
|
6
|
+
`ServerConfig` dataclass that both sides share so that the set of variables,
|
|
7
|
+
their serialization format, and their default values are defined in one place.
|
|
8
|
+
The CLI writes config with `to_env()` and the server graph reads it back
|
|
9
|
+
with `from_env()`.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import json
|
|
15
|
+
import logging
|
|
16
|
+
import os
|
|
17
|
+
from dataclasses import dataclass
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
from typing import TYPE_CHECKING, Any
|
|
20
|
+
|
|
21
|
+
from docagent_cli._env_vars import SERVER_ENV_PREFIX
|
|
22
|
+
|
|
23
|
+
if TYPE_CHECKING:
|
|
24
|
+
from docagent_cli.project_utils import ProjectContext
|
|
25
|
+
|
|
26
|
+
logger = logging.getLogger(__name__)
|
|
27
|
+
|
|
28
|
+
_DEFAULT_ASSISTANT_ID = "agent"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _read_env_bool(suffix: str, *, default: bool = False) -> bool:
|
|
32
|
+
"""Read a `DEEPAGENTS_CLI_SERVER_*` boolean from the environment.
|
|
33
|
+
|
|
34
|
+
Boolean env vars use the `'true'` / `'false'` convention (case insensitive).
|
|
35
|
+
Missing variables fall back to *default*.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
suffix: Variable name suffix after the `DEEPAGENTS_CLI_SERVER_` prefix.
|
|
39
|
+
default: Value when the variable is absent.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
Parsed boolean.
|
|
43
|
+
"""
|
|
44
|
+
raw = os.environ.get(f"{SERVER_ENV_PREFIX}{suffix}")
|
|
45
|
+
if raw is None:
|
|
46
|
+
return default
|
|
47
|
+
return raw.lower() == "true"
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _read_env_json(suffix: str) -> Any: # noqa: ANN401
|
|
51
|
+
"""Read a JSON-encoded `DEEPAGENTS_CLI_SERVER_*` variable.
|
|
52
|
+
|
|
53
|
+
Args:
|
|
54
|
+
suffix: Variable name suffix after the `DEEPAGENTS_CLI_SERVER_` prefix.
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
Parsed JSON value, or `None` if the variable is absent.
|
|
58
|
+
|
|
59
|
+
Raises:
|
|
60
|
+
ValueError: If the variable is present but not valid JSON.
|
|
61
|
+
"""
|
|
62
|
+
raw = os.environ.get(f"{SERVER_ENV_PREFIX}{suffix}")
|
|
63
|
+
if raw is None:
|
|
64
|
+
return None
|
|
65
|
+
try:
|
|
66
|
+
return json.loads(raw)
|
|
67
|
+
except json.JSONDecodeError as exc:
|
|
68
|
+
msg = (
|
|
69
|
+
f"Failed to parse {SERVER_ENV_PREFIX}{suffix} as JSON: {exc}. "
|
|
70
|
+
f"Value was: {raw[:200]!r}"
|
|
71
|
+
)
|
|
72
|
+
raise ValueError(msg) from exc
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _read_env_str(suffix: str) -> str | None:
|
|
76
|
+
"""Read an optional `DEEPAGENTS_CLI_SERVER_*` string variable.
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
suffix: Variable name suffix after the `DEEPAGENTS_CLI_SERVER_` prefix.
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
The string value, or `None` if absent.
|
|
83
|
+
"""
|
|
84
|
+
return os.environ.get(f"{SERVER_ENV_PREFIX}{suffix}")
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _read_env_optional_bool(suffix: str) -> bool | None:
|
|
88
|
+
"""Read a tri-state `DEEPAGENTS_CLI_SERVER_*` boolean (`True` / `False` / `None`).
|
|
89
|
+
|
|
90
|
+
Used for settings where `None` carries a distinct meaning (e.g. "not
|
|
91
|
+
specified, use default logic").
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
suffix: Variable name suffix after the `DEEPAGENTS_CLI_SERVER_` prefix.
|
|
95
|
+
|
|
96
|
+
Returns:
|
|
97
|
+
`True`, `False`, or `None` when the variable is absent.
|
|
98
|
+
"""
|
|
99
|
+
raw = os.environ.get(f"{SERVER_ENV_PREFIX}{suffix}")
|
|
100
|
+
if raw is None:
|
|
101
|
+
return None
|
|
102
|
+
return raw.lower() == "true"
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
@dataclass(frozen=True)
|
|
106
|
+
class ServerConfig:
|
|
107
|
+
"""Full configuration payload passed from the CLI to the server subprocess.
|
|
108
|
+
|
|
109
|
+
Serialized to/from `DEEPAGENTS_CLI_SERVER_*` environment variables so
|
|
110
|
+
that the server
|
|
111
|
+
graph (which runs in a separate Python interpreter) can reconstruct the
|
|
112
|
+
CLI's intent without sharing memory.
|
|
113
|
+
"""
|
|
114
|
+
|
|
115
|
+
model: str | None = None
|
|
116
|
+
model_params: dict[str, Any] | None = None
|
|
117
|
+
assistant_id: str = _DEFAULT_ASSISTANT_ID
|
|
118
|
+
system_prompt: str | None = None
|
|
119
|
+
auto_approve: bool = False
|
|
120
|
+
interrupt_shell_only: bool = False
|
|
121
|
+
shell_allow_list: list[str] | None = None
|
|
122
|
+
interactive: bool = True
|
|
123
|
+
enable_shell: bool = True
|
|
124
|
+
enable_ask_user: bool = False
|
|
125
|
+
enable_memory: bool = True
|
|
126
|
+
enable_skills: bool = True
|
|
127
|
+
sandbox_type: str | None = None
|
|
128
|
+
sandbox_id: str | None = None
|
|
129
|
+
sandbox_setup: str | None = None
|
|
130
|
+
cwd: str | None = None
|
|
131
|
+
project_root: str | None = None
|
|
132
|
+
mcp_config_path: str | None = None
|
|
133
|
+
no_mcp: bool = False
|
|
134
|
+
trust_project_mcp: bool | None = None
|
|
135
|
+
|
|
136
|
+
def __post_init__(self) -> None:
|
|
137
|
+
"""Normalize fields and validate invariants.
|
|
138
|
+
|
|
139
|
+
Raises:
|
|
140
|
+
ValueError: If `shell_allow_list` is an empty list.
|
|
141
|
+
"""
|
|
142
|
+
if self.sandbox_type == "none":
|
|
143
|
+
object.__setattr__(self, "sandbox_type", None)
|
|
144
|
+
if self.shell_allow_list is not None and len(self.shell_allow_list) == 0:
|
|
145
|
+
msg = "shell_allow_list must be None or non-empty"
|
|
146
|
+
raise ValueError(msg)
|
|
147
|
+
|
|
148
|
+
# ------------------------------------------------------------------
|
|
149
|
+
# Serialization
|
|
150
|
+
# ------------------------------------------------------------------
|
|
151
|
+
|
|
152
|
+
def to_env(self) -> dict[str, str | None]:
|
|
153
|
+
"""Serialize this config to a `DEEPAGENTS_CLI_SERVER_*` env-var mapping.
|
|
154
|
+
|
|
155
|
+
`None` values signal that the variable should be *cleared* from the
|
|
156
|
+
environment (rather than set to an empty string), so callers can
|
|
157
|
+
iterate and set or clear each variable in `os.environ`.
|
|
158
|
+
|
|
159
|
+
Returns:
|
|
160
|
+
Dict mapping env-var suffixes (without the prefix) to their
|
|
161
|
+
string values or `None`.
|
|
162
|
+
"""
|
|
163
|
+
return {
|
|
164
|
+
"MODEL": self.model,
|
|
165
|
+
"MODEL_PARAMS": (
|
|
166
|
+
json.dumps(self.model_params) if self.model_params is not None else None
|
|
167
|
+
),
|
|
168
|
+
"ASSISTANT_ID": self.assistant_id,
|
|
169
|
+
"SYSTEM_PROMPT": self.system_prompt,
|
|
170
|
+
"AUTO_APPROVE": str(self.auto_approve).lower(),
|
|
171
|
+
"INTERRUPT_SHELL_ONLY": str(self.interrupt_shell_only).lower(),
|
|
172
|
+
"SHELL_ALLOW_LIST": (
|
|
173
|
+
",".join(self.shell_allow_list)
|
|
174
|
+
if self.shell_allow_list is not None
|
|
175
|
+
else None
|
|
176
|
+
),
|
|
177
|
+
"INTERACTIVE": str(self.interactive).lower(),
|
|
178
|
+
"ENABLE_SHELL": str(self.enable_shell).lower(),
|
|
179
|
+
"ENABLE_ASK_USER": str(self.enable_ask_user).lower(),
|
|
180
|
+
"ENABLE_MEMORY": str(self.enable_memory).lower(),
|
|
181
|
+
"ENABLE_SKILLS": str(self.enable_skills).lower(),
|
|
182
|
+
"SANDBOX_TYPE": self.sandbox_type,
|
|
183
|
+
"SANDBOX_ID": self.sandbox_id,
|
|
184
|
+
"SANDBOX_SETUP": self.sandbox_setup,
|
|
185
|
+
"CWD": self.cwd,
|
|
186
|
+
"PROJECT_ROOT": self.project_root,
|
|
187
|
+
"MCP_CONFIG_PATH": self.mcp_config_path,
|
|
188
|
+
"NO_MCP": str(self.no_mcp).lower(),
|
|
189
|
+
"TRUST_PROJECT_MCP": (
|
|
190
|
+
str(self.trust_project_mcp).lower()
|
|
191
|
+
if self.trust_project_mcp is not None
|
|
192
|
+
else None
|
|
193
|
+
),
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
@classmethod
|
|
197
|
+
def from_env(cls) -> ServerConfig:
|
|
198
|
+
"""Reconstruct a `ServerConfig` from `DEEPAGENTS_CLI_SERVER_*` env vars.
|
|
199
|
+
|
|
200
|
+
This is the inverse of `to_env()` and is called inside the server
|
|
201
|
+
subprocess to recover the CLI's configuration.
|
|
202
|
+
|
|
203
|
+
Returns:
|
|
204
|
+
A `ServerConfig` populated from the environment.
|
|
205
|
+
"""
|
|
206
|
+
return cls(
|
|
207
|
+
model=_read_env_str("MODEL"),
|
|
208
|
+
model_params=_read_env_json("MODEL_PARAMS"),
|
|
209
|
+
assistant_id=_read_env_str("ASSISTANT_ID") or _DEFAULT_ASSISTANT_ID,
|
|
210
|
+
system_prompt=_read_env_str("SYSTEM_PROMPT"),
|
|
211
|
+
auto_approve=_read_env_bool("AUTO_APPROVE"),
|
|
212
|
+
interrupt_shell_only=_read_env_bool("INTERRUPT_SHELL_ONLY"),
|
|
213
|
+
shell_allow_list=(
|
|
214
|
+
[cmd.strip() for cmd in raw.split(",") if cmd.strip()]
|
|
215
|
+
if (raw := _read_env_str("SHELL_ALLOW_LIST"))
|
|
216
|
+
else None
|
|
217
|
+
)
|
|
218
|
+
or None,
|
|
219
|
+
interactive=_read_env_bool("INTERACTIVE", default=True),
|
|
220
|
+
enable_shell=_read_env_bool("ENABLE_SHELL", default=True),
|
|
221
|
+
enable_ask_user=_read_env_bool("ENABLE_ASK_USER"),
|
|
222
|
+
enable_memory=_read_env_bool("ENABLE_MEMORY", default=True),
|
|
223
|
+
enable_skills=_read_env_bool("ENABLE_SKILLS", default=True),
|
|
224
|
+
sandbox_type=_read_env_str("SANDBOX_TYPE"),
|
|
225
|
+
sandbox_id=_read_env_str("SANDBOX_ID"),
|
|
226
|
+
sandbox_setup=_read_env_str("SANDBOX_SETUP"),
|
|
227
|
+
cwd=_read_env_str("CWD"),
|
|
228
|
+
project_root=_read_env_str("PROJECT_ROOT"),
|
|
229
|
+
mcp_config_path=_read_env_str("MCP_CONFIG_PATH"),
|
|
230
|
+
no_mcp=_read_env_bool("NO_MCP"),
|
|
231
|
+
trust_project_mcp=_read_env_optional_bool("TRUST_PROJECT_MCP"),
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
# ------------------------------------------------------------------
|
|
235
|
+
# Factory
|
|
236
|
+
# ------------------------------------------------------------------
|
|
237
|
+
|
|
238
|
+
@classmethod
|
|
239
|
+
def from_cli_args(
|
|
240
|
+
cls,
|
|
241
|
+
*,
|
|
242
|
+
project_context: ProjectContext | None,
|
|
243
|
+
model_name: str | None,
|
|
244
|
+
model_params: dict[str, Any] | None,
|
|
245
|
+
assistant_id: str,
|
|
246
|
+
auto_approve: bool,
|
|
247
|
+
interrupt_shell_only: bool = False,
|
|
248
|
+
shell_allow_list: list[str] | None = None,
|
|
249
|
+
sandbox_type: str = "none",
|
|
250
|
+
sandbox_id: str | None,
|
|
251
|
+
sandbox_setup: str | None,
|
|
252
|
+
enable_shell: bool,
|
|
253
|
+
enable_ask_user: bool,
|
|
254
|
+
mcp_config_path: str | None,
|
|
255
|
+
no_mcp: bool,
|
|
256
|
+
trust_project_mcp: bool | None,
|
|
257
|
+
interactive: bool,
|
|
258
|
+
) -> ServerConfig:
|
|
259
|
+
"""Build a `ServerConfig` from parsed CLI arguments.
|
|
260
|
+
|
|
261
|
+
Handles path normalization (e.g. resolving relative MCP config paths
|
|
262
|
+
against the user's working directory) so that the raw serialized values
|
|
263
|
+
are always absolute and unambiguous.
|
|
264
|
+
|
|
265
|
+
Args:
|
|
266
|
+
project_context: Explicit user/project path context.
|
|
267
|
+
model_name: Model spec string.
|
|
268
|
+
model_params: Extra model kwargs.
|
|
269
|
+
assistant_id: Agent identifier.
|
|
270
|
+
auto_approve: Auto-approve all tools.
|
|
271
|
+
interrupt_shell_only: Validate shell commands via middleware instead
|
|
272
|
+
of HITL.
|
|
273
|
+
shell_allow_list: Restrictive shell allow-list to forward to the
|
|
274
|
+
server subprocess for `ShellAllowListMiddleware`.
|
|
275
|
+
sandbox_type: Sandbox type.
|
|
276
|
+
sandbox_id: Existing sandbox ID to reuse.
|
|
277
|
+
sandbox_setup: Path to setup script for the sandbox.
|
|
278
|
+
enable_shell: Enable shell execution tools.
|
|
279
|
+
enable_ask_user: Enable ask_user tool.
|
|
280
|
+
mcp_config_path: Path to MCP config.
|
|
281
|
+
no_mcp: Disable MCP.
|
|
282
|
+
trust_project_mcp: Trust project MCP servers.
|
|
283
|
+
interactive: Whether the agent is interactive.
|
|
284
|
+
|
|
285
|
+
Returns:
|
|
286
|
+
A fully resolved `ServerConfig`.
|
|
287
|
+
"""
|
|
288
|
+
normalized_mcp = _normalize_path(mcp_config_path, project_context, "MCP config")
|
|
289
|
+
|
|
290
|
+
return cls(
|
|
291
|
+
model=model_name,
|
|
292
|
+
model_params=model_params,
|
|
293
|
+
assistant_id=assistant_id,
|
|
294
|
+
auto_approve=auto_approve,
|
|
295
|
+
interrupt_shell_only=interrupt_shell_only,
|
|
296
|
+
shell_allow_list=shell_allow_list,
|
|
297
|
+
interactive=interactive,
|
|
298
|
+
enable_shell=enable_shell,
|
|
299
|
+
enable_ask_user=enable_ask_user,
|
|
300
|
+
sandbox_type=sandbox_type,
|
|
301
|
+
sandbox_id=sandbox_id,
|
|
302
|
+
sandbox_setup=_normalize_path(
|
|
303
|
+
sandbox_setup, project_context, "sandbox setup"
|
|
304
|
+
),
|
|
305
|
+
cwd=(
|
|
306
|
+
str(project_context.user_cwd) if project_context is not None else None
|
|
307
|
+
),
|
|
308
|
+
project_root=(
|
|
309
|
+
str(project_context.project_root)
|
|
310
|
+
if project_context is not None
|
|
311
|
+
and project_context.project_root is not None
|
|
312
|
+
else None
|
|
313
|
+
),
|
|
314
|
+
mcp_config_path=normalized_mcp,
|
|
315
|
+
no_mcp=no_mcp,
|
|
316
|
+
trust_project_mcp=trust_project_mcp,
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
def _normalize_path(
|
|
321
|
+
raw_path: str | None,
|
|
322
|
+
project_context: ProjectContext | None,
|
|
323
|
+
label: str,
|
|
324
|
+
) -> str | None:
|
|
325
|
+
"""Resolve a possibly-relative path to absolute.
|
|
326
|
+
|
|
327
|
+
The server subprocess runs in a different working directory, so relative
|
|
328
|
+
paths must be resolved against the user's original cwd before serialization.
|
|
329
|
+
|
|
330
|
+
Args:
|
|
331
|
+
raw_path: Path from CLI arguments (may be relative).
|
|
332
|
+
project_context: User/project context for path resolution.
|
|
333
|
+
label: Human-readable label for error messages (e.g. "MCP config").
|
|
334
|
+
|
|
335
|
+
Returns:
|
|
336
|
+
Absolute path string, or `None` when *raw_path* is `None` or empty.
|
|
337
|
+
|
|
338
|
+
Raises:
|
|
339
|
+
ValueError: If the path cannot be resolved.
|
|
340
|
+
"""
|
|
341
|
+
if not raw_path:
|
|
342
|
+
return None
|
|
343
|
+
try:
|
|
344
|
+
if project_context is not None:
|
|
345
|
+
return str(project_context.resolve_user_path(raw_path))
|
|
346
|
+
return str(Path(raw_path).expanduser().resolve())
|
|
347
|
+
except OSError as exc:
|
|
348
|
+
msg = (
|
|
349
|
+
f"Could not resolve {label} path {raw_path!r}: {exc}. "
|
|
350
|
+
"Ensure the path exists and is accessible."
|
|
351
|
+
)
|
|
352
|
+
raise ValueError(msg) from exc
|