@bastani/atomic 0.6.8 → 0.7.0-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.
- package/bin/atomic +65 -0
- package/package.json +17 -82
- package/postinstall.mjs +47 -0
- package/.agents/skills/ado-commit/SKILL.md +0 -94
- package/.agents/skills/ado-create-pr/SKILL.md +0 -211
- package/.agents/skills/advanced-evaluation/SKILL.md +0 -404
- package/.agents/skills/advanced-evaluation/references/bias-mitigation.md +0 -288
- package/.agents/skills/advanced-evaluation/references/evaluation-pipeline.md +0 -43
- package/.agents/skills/advanced-evaluation/references/implementation-patterns.md +0 -315
- package/.agents/skills/advanced-evaluation/references/metrics-guide.md +0 -331
- package/.agents/skills/advanced-evaluation/scripts/evaluation_example.py +0 -392
- package/.agents/skills/ast-grep/SKILL.md +0 -325
- package/.agents/skills/ast-grep/references/rule_reference.md +0 -297
- package/.agents/skills/bdi-mental-states/SKILL.md +0 -313
- package/.agents/skills/bdi-mental-states/references/bdi-ontology-core.md +0 -207
- package/.agents/skills/bdi-mental-states/references/framework-integration.md +0 -582
- package/.agents/skills/bdi-mental-states/references/rdf-examples.md +0 -315
- package/.agents/skills/bdi-mental-states/references/sparql-competency.md +0 -420
- package/.agents/skills/bun/SKILL.md +0 -233
- package/.agents/skills/context-compression/SKILL.md +0 -274
- package/.agents/skills/context-compression/references/evaluation-framework.md +0 -213
- package/.agents/skills/context-compression/scripts/compression_evaluator.py +0 -862
- package/.agents/skills/context-compression/tests/test_compression_evaluator.py +0 -56
- package/.agents/skills/context-degradation/SKILL.md +0 -208
- package/.agents/skills/context-degradation/references/patterns.md +0 -314
- package/.agents/skills/context-degradation/scripts/degradation_detector.py +0 -614
- package/.agents/skills/context-fundamentals/SKILL.md +0 -203
- package/.agents/skills/context-fundamentals/references/context-components.md +0 -283
- package/.agents/skills/context-fundamentals/scripts/context_manager.py +0 -533
- package/.agents/skills/context-optimization/SKILL.md +0 -197
- package/.agents/skills/context-optimization/references/optimization_techniques.md +0 -272
- package/.agents/skills/context-optimization/scripts/compaction.py +0 -562
- package/.agents/skills/create-spec/SKILL.md +0 -249
- package/.agents/skills/docx/LICENSE.txt +0 -30
- package/.agents/skills/docx/SKILL.md +0 -592
- package/.agents/skills/docx/scripts/__init__.py +0 -1
- package/.agents/skills/docx/scripts/accept_changes.py +0 -135
- package/.agents/skills/docx/scripts/comment.py +0 -318
- package/.agents/skills/docx/scripts/office/helpers/__init__.py +0 -0
- package/.agents/skills/docx/scripts/office/helpers/merge_runs.py +0 -199
- package/.agents/skills/docx/scripts/office/helpers/simplify_redlines.py +0 -197
- package/.agents/skills/docx/scripts/office/pack.py +0 -159
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +0 -1499
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +0 -146
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +0 -1085
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +0 -11
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +0 -3081
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +0 -23
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +0 -185
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +0 -287
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +0 -1676
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +0 -28
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +0 -144
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +0 -174
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +0 -25
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +0 -18
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +0 -59
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +0 -56
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +0 -195
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +0 -582
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +0 -25
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +0 -4439
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +0 -570
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +0 -509
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +0 -12
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +0 -108
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +0 -96
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +0 -3646
- package/.agents/skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +0 -116
- package/.agents/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +0 -42
- package/.agents/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +0 -50
- package/.agents/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +0 -49
- package/.agents/skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +0 -33
- package/.agents/skills/docx/scripts/office/schemas/mce/mc.xsd +0 -75
- package/.agents/skills/docx/scripts/office/schemas/microsoft/wml-2010.xsd +0 -560
- package/.agents/skills/docx/scripts/office/schemas/microsoft/wml-2012.xsd +0 -67
- package/.agents/skills/docx/scripts/office/schemas/microsoft/wml-2018.xsd +0 -14
- package/.agents/skills/docx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +0 -20
- package/.agents/skills/docx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +0 -13
- package/.agents/skills/docx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +0 -4
- package/.agents/skills/docx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +0 -8
- package/.agents/skills/docx/scripts/office/soffice.py +0 -183
- package/.agents/skills/docx/scripts/office/unpack.py +0 -132
- package/.agents/skills/docx/scripts/office/validate.py +0 -111
- package/.agents/skills/docx/scripts/office/validators/__init__.py +0 -15
- package/.agents/skills/docx/scripts/office/validators/base.py +0 -847
- package/.agents/skills/docx/scripts/office/validators/docx.py +0 -446
- package/.agents/skills/docx/scripts/office/validators/pptx.py +0 -275
- package/.agents/skills/docx/scripts/office/validators/redlining.py +0 -247
- package/.agents/skills/docx/scripts/templates/comments.xml +0 -3
- package/.agents/skills/docx/scripts/templates/commentsExtended.xml +0 -3
- package/.agents/skills/docx/scripts/templates/commentsExtensible.xml +0 -3
- package/.agents/skills/docx/scripts/templates/commentsIds.xml +0 -3
- package/.agents/skills/docx/scripts/templates/people.xml +0 -3
- package/.agents/skills/evaluation/SKILL.md +0 -253
- package/.agents/skills/evaluation/references/metrics.md +0 -339
- package/.agents/skills/evaluation/scripts/evaluator.py +0 -627
- package/.agents/skills/explain-code/SKILL.md +0 -232
- package/.agents/skills/filesystem-context/SKILL.md +0 -289
- package/.agents/skills/filesystem-context/references/implementation-patterns.md +0 -549
- package/.agents/skills/filesystem-context/scripts/filesystem_context.py +0 -425
- package/.agents/skills/find-skills/SKILL.md +0 -144
- package/.agents/skills/gh-commit/SKILL.md +0 -245
- package/.agents/skills/gh-create-pr/SKILL.md +0 -95
- package/.agents/skills/hosted-agents/SKILL.md +0 -262
- package/.agents/skills/hosted-agents/references/infrastructure-patterns.md +0 -700
- package/.agents/skills/hosted-agents/scripts/sandbox_manager.py +0 -590
- package/.agents/skills/impeccable/SKILL.md +0 -178
- package/.agents/skills/impeccable/agents/openai.yaml +0 -4
- package/.agents/skills/impeccable/reference/adapt.md +0 -190
- package/.agents/skills/impeccable/reference/animate.md +0 -175
- package/.agents/skills/impeccable/reference/audit.md +0 -134
- package/.agents/skills/impeccable/reference/bolder.md +0 -113
- package/.agents/skills/impeccable/reference/brand.md +0 -114
- package/.agents/skills/impeccable/reference/clarify.md +0 -174
- package/.agents/skills/impeccable/reference/cognitive-load.md +0 -106
- package/.agents/skills/impeccable/reference/color-and-contrast.md +0 -105
- package/.agents/skills/impeccable/reference/colorize.md +0 -154
- package/.agents/skills/impeccable/reference/craft.md +0 -193
- package/.agents/skills/impeccable/reference/critique.md +0 -213
- package/.agents/skills/impeccable/reference/delight.md +0 -302
- package/.agents/skills/impeccable/reference/distill.md +0 -111
- package/.agents/skills/impeccable/reference/document.md +0 -427
- package/.agents/skills/impeccable/reference/extract.md +0 -70
- package/.agents/skills/impeccable/reference/harden.md +0 -347
- package/.agents/skills/impeccable/reference/heuristics-scoring.md +0 -234
- package/.agents/skills/impeccable/reference/interaction-design.md +0 -195
- package/.agents/skills/impeccable/reference/layout.md +0 -141
- package/.agents/skills/impeccable/reference/live.md +0 -594
- package/.agents/skills/impeccable/reference/motion-design.md +0 -109
- package/.agents/skills/impeccable/reference/onboard.md +0 -234
- package/.agents/skills/impeccable/reference/optimize.md +0 -258
- package/.agents/skills/impeccable/reference/overdrive.md +0 -130
- package/.agents/skills/impeccable/reference/personas.md +0 -178
- package/.agents/skills/impeccable/reference/polish.md +0 -232
- package/.agents/skills/impeccable/reference/product.md +0 -62
- package/.agents/skills/impeccable/reference/quieter.md +0 -99
- package/.agents/skills/impeccable/reference/responsive-design.md +0 -114
- package/.agents/skills/impeccable/reference/shape.md +0 -151
- package/.agents/skills/impeccable/reference/spatial-design.md +0 -100
- package/.agents/skills/impeccable/reference/teach.md +0 -156
- package/.agents/skills/impeccable/reference/typeset.md +0 -124
- package/.agents/skills/impeccable/reference/typography.md +0 -159
- package/.agents/skills/impeccable/reference/ux-writing.md +0 -107
- package/.agents/skills/impeccable/scripts/cleanup-deprecated.mjs +0 -284
- package/.agents/skills/impeccable/scripts/command-metadata.json +0 -94
- package/.agents/skills/impeccable/scripts/design-parser.mjs +0 -820
- package/.agents/skills/impeccable/scripts/detect-csp.mjs +0 -198
- package/.agents/skills/impeccable/scripts/is-generated.mjs +0 -69
- package/.agents/skills/impeccable/scripts/live-accept.mjs +0 -595
- package/.agents/skills/impeccable/scripts/live-browser.js +0 -4781
- package/.agents/skills/impeccable/scripts/live-inject.mjs +0 -445
- package/.agents/skills/impeccable/scripts/live-poll.mjs +0 -186
- package/.agents/skills/impeccable/scripts/live-server.mjs +0 -694
- package/.agents/skills/impeccable/scripts/live-wrap.mjs +0 -571
- package/.agents/skills/impeccable/scripts/live.mjs +0 -247
- package/.agents/skills/impeccable/scripts/load-context.mjs +0 -141
- package/.agents/skills/impeccable/scripts/modern-screenshot.umd.js +0 -14
- package/.agents/skills/impeccable/scripts/pin.mjs +0 -214
- package/.agents/skills/init/SKILL.md +0 -140
- package/.agents/skills/liteparse/SKILL.md +0 -223
- package/.agents/skills/memory-systems/SKILL.md +0 -221
- package/.agents/skills/memory-systems/references/implementation.md +0 -551
- package/.agents/skills/memory-systems/scripts/memory_store.py +0 -616
- package/.agents/skills/multi-agent-patterns/SKILL.md +0 -259
- package/.agents/skills/multi-agent-patterns/references/frameworks.md +0 -433
- package/.agents/skills/multi-agent-patterns/scripts/coordination.py +0 -613
- package/.agents/skills/opentui/SKILL.md +0 -202
- package/.agents/skills/opentui/references/animation/REFERENCE.md +0 -431
- package/.agents/skills/opentui/references/components/REFERENCE.md +0 -144
- package/.agents/skills/opentui/references/components/code-diff.md +0 -672
- package/.agents/skills/opentui/references/components/containers.md +0 -417
- package/.agents/skills/opentui/references/components/inputs.md +0 -531
- package/.agents/skills/opentui/references/components/text-display.md +0 -386
- package/.agents/skills/opentui/references/core/REFERENCE.md +0 -145
- package/.agents/skills/opentui/references/core/api.md +0 -543
- package/.agents/skills/opentui/references/core/configuration.md +0 -168
- package/.agents/skills/opentui/references/core/gotchas.md +0 -393
- package/.agents/skills/opentui/references/core/patterns.md +0 -449
- package/.agents/skills/opentui/references/keyboard/REFERENCE.md +0 -617
- package/.agents/skills/opentui/references/layout/REFERENCE.md +0 -337
- package/.agents/skills/opentui/references/layout/patterns.md +0 -444
- package/.agents/skills/opentui/references/react/REFERENCE.md +0 -174
- package/.agents/skills/opentui/references/react/api.md +0 -436
- package/.agents/skills/opentui/references/react/configuration.md +0 -302
- package/.agents/skills/opentui/references/react/gotchas.md +0 -443
- package/.agents/skills/opentui/references/react/patterns.md +0 -501
- package/.agents/skills/opentui/references/solid/REFERENCE.md +0 -201
- package/.agents/skills/opentui/references/solid/api.md +0 -564
- package/.agents/skills/opentui/references/solid/configuration.md +0 -316
- package/.agents/skills/opentui/references/solid/gotchas.md +0 -427
- package/.agents/skills/opentui/references/solid/patterns.md +0 -560
- package/.agents/skills/opentui/references/testing/REFERENCE.md +0 -614
- package/.agents/skills/pdf/LICENSE.txt +0 -30
- package/.agents/skills/pdf/SKILL.md +0 -316
- package/.agents/skills/pdf/forms.md +0 -294
- package/.agents/skills/pdf/reference.md +0 -612
- package/.agents/skills/pdf/scripts/check_bounding_boxes.py +0 -65
- package/.agents/skills/pdf/scripts/check_fillable_fields.py +0 -11
- package/.agents/skills/pdf/scripts/convert_pdf_to_images.py +0 -33
- package/.agents/skills/pdf/scripts/create_validation_image.py +0 -37
- package/.agents/skills/pdf/scripts/extract_form_field_info.py +0 -122
- package/.agents/skills/pdf/scripts/extract_form_structure.py +0 -115
- package/.agents/skills/pdf/scripts/fill_fillable_fields.py +0 -98
- package/.agents/skills/pdf/scripts/fill_pdf_form_with_annotations.py +0 -107
- package/.agents/skills/playwright-cli/SKILL.md +0 -390
- package/.agents/skills/playwright-cli/references/element-attributes.md +0 -23
- package/.agents/skills/playwright-cli/references/playwright-tests.md +0 -39
- package/.agents/skills/playwright-cli/references/request-mocking.md +0 -87
- package/.agents/skills/playwright-cli/references/running-code.md +0 -241
- package/.agents/skills/playwright-cli/references/session-management.md +0 -225
- package/.agents/skills/playwright-cli/references/spec-driven-testing.md +0 -305
- package/.agents/skills/playwright-cli/references/storage-state.md +0 -275
- package/.agents/skills/playwright-cli/references/test-generation.md +0 -134
- package/.agents/skills/playwright-cli/references/tracing.md +0 -139
- package/.agents/skills/playwright-cli/references/video-recording.md +0 -143
- package/.agents/skills/pptx/LICENSE.txt +0 -30
- package/.agents/skills/pptx/SKILL.md +0 -234
- package/.agents/skills/pptx/editing.md +0 -205
- package/.agents/skills/pptx/pptxgenjs.md +0 -420
- package/.agents/skills/pptx/scripts/__init__.py +0 -0
- package/.agents/skills/pptx/scripts/add_slide.py +0 -195
- package/.agents/skills/pptx/scripts/clean.py +0 -286
- package/.agents/skills/pptx/scripts/office/helpers/__init__.py +0 -0
- package/.agents/skills/pptx/scripts/office/helpers/merge_runs.py +0 -199
- package/.agents/skills/pptx/scripts/office/helpers/simplify_redlines.py +0 -197
- package/.agents/skills/pptx/scripts/office/pack.py +0 -159
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +0 -1499
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +0 -146
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +0 -1085
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +0 -11
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +0 -3081
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +0 -23
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +0 -185
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +0 -287
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +0 -1676
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +0 -28
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +0 -144
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +0 -174
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +0 -25
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +0 -18
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +0 -59
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +0 -56
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +0 -195
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +0 -582
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +0 -25
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +0 -4439
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +0 -570
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +0 -509
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +0 -12
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +0 -108
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +0 -96
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +0 -3646
- package/.agents/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +0 -116
- package/.agents/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +0 -42
- package/.agents/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +0 -50
- package/.agents/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +0 -49
- package/.agents/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +0 -33
- package/.agents/skills/pptx/scripts/office/schemas/mce/mc.xsd +0 -75
- package/.agents/skills/pptx/scripts/office/schemas/microsoft/wml-2010.xsd +0 -560
- package/.agents/skills/pptx/scripts/office/schemas/microsoft/wml-2012.xsd +0 -67
- package/.agents/skills/pptx/scripts/office/schemas/microsoft/wml-2018.xsd +0 -14
- package/.agents/skills/pptx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +0 -20
- package/.agents/skills/pptx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +0 -13
- package/.agents/skills/pptx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +0 -4
- package/.agents/skills/pptx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +0 -8
- package/.agents/skills/pptx/scripts/office/soffice.py +0 -183
- package/.agents/skills/pptx/scripts/office/unpack.py +0 -132
- package/.agents/skills/pptx/scripts/office/validate.py +0 -111
- package/.agents/skills/pptx/scripts/office/validators/__init__.py +0 -15
- package/.agents/skills/pptx/scripts/office/validators/base.py +0 -847
- package/.agents/skills/pptx/scripts/office/validators/docx.py +0 -446
- package/.agents/skills/pptx/scripts/office/validators/pptx.py +0 -275
- package/.agents/skills/pptx/scripts/office/validators/redlining.py +0 -247
- package/.agents/skills/pptx/scripts/thumbnail.py +0 -289
- package/.agents/skills/project-development/SKILL.md +0 -293
- package/.agents/skills/project-development/references/case-studies.md +0 -388
- package/.agents/skills/project-development/references/pipeline-patterns.md +0 -610
- package/.agents/skills/project-development/scripts/pipeline_template.py +0 -796
- package/.agents/skills/prompt-engineer/SKILL.md +0 -265
- package/.agents/skills/prompt-engineer/references/advanced_patterns.md +0 -271
- package/.agents/skills/prompt-engineer/references/core_prompting.md +0 -137
- package/.agents/skills/prompt-engineer/references/quality_improvement.md +0 -193
- package/.agents/skills/research-codebase/SKILL.md +0 -229
- package/.agents/skills/ripgrep/SKILL.md +0 -384
- package/.agents/skills/skill-creator/LICENSE.txt +0 -202
- package/.agents/skills/skill-creator/SKILL.md +0 -487
- package/.agents/skills/skill-creator/agents/analyzer.md +0 -274
- package/.agents/skills/skill-creator/agents/comparator.md +0 -202
- package/.agents/skills/skill-creator/agents/grader.md +0 -223
- package/.agents/skills/skill-creator/assets/eval_review.html +0 -146
- package/.agents/skills/skill-creator/eval-viewer/generate_review.py +0 -471
- package/.agents/skills/skill-creator/eval-viewer/viewer.html +0 -1325
- package/.agents/skills/skill-creator/references/schemas.md +0 -430
- package/.agents/skills/skill-creator/scripts/__init__.py +0 -0
- package/.agents/skills/skill-creator/scripts/aggregate_benchmark.py +0 -401
- package/.agents/skills/skill-creator/scripts/generate_report.py +0 -326
- package/.agents/skills/skill-creator/scripts/improve_description.py +0 -247
- package/.agents/skills/skill-creator/scripts/package_skill.py +0 -136
- package/.agents/skills/skill-creator/scripts/quick_validate.py +0 -103
- package/.agents/skills/skill-creator/scripts/run_eval.py +0 -310
- package/.agents/skills/skill-creator/scripts/run_loop.py +0 -328
- package/.agents/skills/skill-creator/scripts/utils.py +0 -47
- package/.agents/skills/sl-commit/SKILL.md +0 -53
- package/.agents/skills/sl-submit-diff/SKILL.md +0 -57
- package/.agents/skills/tdd/SKILL.md +0 -111
- package/.agents/skills/tdd/deep-modules.md +0 -33
- package/.agents/skills/tdd/interface-design.md +0 -31
- package/.agents/skills/tdd/mocking.md +0 -59
- package/.agents/skills/tdd/refactoring.md +0 -10
- package/.agents/skills/tdd/tests.md +0 -61
- package/.agents/skills/tool-design/SKILL.md +0 -273
- package/.agents/skills/tool-design/references/architectural_reduction.md +0 -210
- package/.agents/skills/tool-design/references/best_practices.md +0 -176
- package/.agents/skills/tool-design/scripts/description_generator.py +0 -528
- package/.agents/skills/typescript-advanced-types/SKILL.md +0 -720
- package/.agents/skills/typescript-expert/SKILL.md +0 -434
- package/.agents/skills/typescript-expert/references/tsconfig-strict.json +0 -92
- package/.agents/skills/typescript-expert/references/typescript-cheatsheet.md +0 -383
- package/.agents/skills/typescript-expert/references/utility-types.ts +0 -335
- package/.agents/skills/typescript-expert/scripts/ts_diagnostic.py +0 -203
- package/.agents/skills/typescript-react-reviewer/SKILL.md +0 -201
- package/.agents/skills/typescript-react-reviewer/references/antipatterns.md +0 -510
- package/.agents/skills/typescript-react-reviewer/references/checklist.md +0 -267
- package/.agents/skills/typescript-react-reviewer/references/react19-patterns.md +0 -305
- package/.agents/skills/workflow-creator/SKILL.md +0 -553
- package/.agents/skills/workflow-creator/references/agent-sessions.md +0 -891
- package/.agents/skills/workflow-creator/references/agent-setup-recipe.md +0 -266
- package/.agents/skills/workflow-creator/references/computation-and-validation.md +0 -201
- package/.agents/skills/workflow-creator/references/control-flow.md +0 -470
- package/.agents/skills/workflow-creator/references/failure-modes.md +0 -1014
- package/.agents/skills/workflow-creator/references/getting-started.md +0 -392
- package/.agents/skills/workflow-creator/references/registry-and-validation.md +0 -141
- package/.agents/skills/workflow-creator/references/running-workflows.md +0 -418
- package/.agents/skills/workflow-creator/references/session-config.md +0 -431
- package/.agents/skills/workflow-creator/references/state-and-data-flow.md +0 -356
- package/.agents/skills/workflow-creator/references/user-input.md +0 -234
- package/.agents/skills/workflow-creator/references/workflow-inputs.md +0 -392
- package/.agents/skills/xlsx/LICENSE.txt +0 -30
- package/.agents/skills/xlsx/SKILL.md +0 -294
- package/.agents/skills/xlsx/scripts/office/helpers/__init__.py +0 -0
- package/.agents/skills/xlsx/scripts/office/helpers/merge_runs.py +0 -199
- package/.agents/skills/xlsx/scripts/office/helpers/simplify_redlines.py +0 -197
- package/.agents/skills/xlsx/scripts/office/pack.py +0 -159
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +0 -1499
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +0 -146
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +0 -1085
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +0 -11
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +0 -3081
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +0 -23
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +0 -185
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +0 -287
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +0 -1676
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +0 -28
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +0 -144
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +0 -174
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +0 -25
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +0 -18
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +0 -59
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +0 -56
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +0 -195
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +0 -582
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +0 -25
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +0 -4439
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +0 -570
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +0 -509
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +0 -12
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +0 -108
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +0 -96
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +0 -3646
- package/.agents/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +0 -116
- package/.agents/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +0 -42
- package/.agents/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +0 -50
- package/.agents/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +0 -49
- package/.agents/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +0 -33
- package/.agents/skills/xlsx/scripts/office/schemas/mce/mc.xsd +0 -75
- package/.agents/skills/xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +0 -560
- package/.agents/skills/xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +0 -67
- package/.agents/skills/xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +0 -14
- package/.agents/skills/xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +0 -20
- package/.agents/skills/xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +0 -13
- package/.agents/skills/xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +0 -4
- package/.agents/skills/xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +0 -8
- package/.agents/skills/xlsx/scripts/office/soffice.py +0 -183
- package/.agents/skills/xlsx/scripts/office/unpack.py +0 -132
- package/.agents/skills/xlsx/scripts/office/validate.py +0 -111
- package/.agents/skills/xlsx/scripts/office/validators/__init__.py +0 -15
- package/.agents/skills/xlsx/scripts/office/validators/base.py +0 -847
- package/.agents/skills/xlsx/scripts/office/validators/docx.py +0 -446
- package/.agents/skills/xlsx/scripts/office/validators/pptx.py +0 -275
- package/.agents/skills/xlsx/scripts/office/validators/redlining.py +0 -247
- package/.agents/skills/xlsx/scripts/recalc.py +0 -184
- package/.claude/agents/code-simplifier.md +0 -52
- package/.claude/agents/codebase-analyzer.md +0 -166
- package/.claude/agents/codebase-locator.md +0 -122
- package/.claude/agents/codebase-online-researcher.md +0 -148
- package/.claude/agents/codebase-pattern-finder.md +0 -247
- package/.claude/agents/codebase-research-analyzer.md +0 -179
- package/.claude/agents/codebase-research-locator.md +0 -145
- package/.claude/agents/debugger.md +0 -91
- package/.claude/agents/orchestrator.md +0 -19
- package/.claude/agents/planner.md +0 -295
- package/.claude/agents/reviewer.md +0 -98
- package/.claude/agents/worker.md +0 -165
- package/.claude/settings.json +0 -27
- package/.github/agents/code-simplifier.md +0 -52
- package/.github/agents/codebase-analyzer.md +0 -166
- package/.github/agents/codebase-locator.md +0 -122
- package/.github/agents/codebase-online-researcher.md +0 -146
- package/.github/agents/codebase-pattern-finder.md +0 -247
- package/.github/agents/codebase-research-analyzer.md +0 -179
- package/.github/agents/codebase-research-locator.md +0 -145
- package/.github/agents/debugger.md +0 -98
- package/.github/agents/orchestrator.md +0 -27
- package/.github/agents/planner.md +0 -305
- package/.github/agents/reviewer.md +0 -95
- package/.github/agents/worker.md +0 -237
- package/.github/lsp.json +0 -93
- package/.mcp.json +0 -20
- package/.opencode/agents/code-simplifier.md +0 -62
- package/.opencode/agents/codebase-analyzer.md +0 -171
- package/.opencode/agents/codebase-locator.md +0 -127
- package/.opencode/agents/codebase-online-researcher.md +0 -152
- package/.opencode/agents/codebase-pattern-finder.md +0 -252
- package/.opencode/agents/codebase-research-analyzer.md +0 -183
- package/.opencode/agents/codebase-research-locator.md +0 -149
- package/.opencode/agents/debugger.md +0 -99
- package/.opencode/agents/orchestrator.md +0 -27
- package/.opencode/agents/planner.md +0 -309
- package/.opencode/agents/reviewer.md +0 -103
- package/.opencode/agents/worker.md +0 -165
- package/.opencode/opencode.json +0 -25
- package/README.md +0 -1624
- package/assets/settings.schema.json +0 -51
- package/dist/commands/cli/claude-inflight-hook.d.ts +0 -100
- package/dist/commands/cli/claude-inflight-hook.d.ts.map +0 -1
- package/dist/commands/cli/claude-stop-hook.d.ts +0 -80
- package/dist/commands/cli/claude-stop-hook.d.ts.map +0 -1
- package/dist/lib/atomic-temp.d.ts +0 -8
- package/dist/lib/atomic-temp.d.ts.map +0 -1
- package/dist/lib/path-root-guard.d.ts +0 -4
- package/dist/lib/path-root-guard.d.ts.map +0 -1
- package/dist/lib/spawn.d.ts +0 -102
- package/dist/lib/spawn.d.ts.map +0 -1
- package/dist/lib/terminal-env.d.ts +0 -9
- package/dist/lib/terminal-env.d.ts.map +0 -1
- package/dist/sdk/components/attached-statusline.d.ts +0 -26
- package/dist/sdk/components/attached-statusline.d.ts.map +0 -1
- package/dist/sdk/components/color-utils.d.ts +0 -4
- package/dist/sdk/components/color-utils.d.ts.map +0 -1
- package/dist/sdk/components/compact-switcher.d.ts +0 -10
- package/dist/sdk/components/compact-switcher.d.ts.map +0 -1
- package/dist/sdk/components/connectors.d.ts +0 -16
- package/dist/sdk/components/connectors.d.ts.map +0 -1
- package/dist/sdk/components/edge.d.ts +0 -4
- package/dist/sdk/components/edge.d.ts.map +0 -1
- package/dist/sdk/components/error-boundary.d.ts +0 -23
- package/dist/sdk/components/error-boundary.d.ts.map +0 -1
- package/dist/sdk/components/graph-theme.d.ts +0 -18
- package/dist/sdk/components/graph-theme.d.ts.map +0 -1
- package/dist/sdk/components/header.d.ts +0 -3
- package/dist/sdk/components/header.d.ts.map +0 -1
- package/dist/sdk/components/hooks.d.ts +0 -15
- package/dist/sdk/components/hooks.d.ts.map +0 -1
- package/dist/sdk/components/layout.d.ts +0 -27
- package/dist/sdk/components/layout.d.ts.map +0 -1
- package/dist/sdk/components/node-card.d.ts +0 -10
- package/dist/sdk/components/node-card.d.ts.map +0 -1
- package/dist/sdk/components/orchestrator-panel-contexts.d.ts +0 -16
- package/dist/sdk/components/orchestrator-panel-contexts.d.ts.map +0 -1
- package/dist/sdk/components/orchestrator-panel-store.d.ts +0 -52
- package/dist/sdk/components/orchestrator-panel-store.d.ts.map +0 -1
- package/dist/sdk/components/orchestrator-panel-types.d.ts +0 -18
- package/dist/sdk/components/orchestrator-panel-types.d.ts.map +0 -1
- package/dist/sdk/components/orchestrator-panel.d.ts +0 -86
- package/dist/sdk/components/orchestrator-panel.d.ts.map +0 -1
- package/dist/sdk/components/renderer-background.d.ts +0 -9
- package/dist/sdk/components/renderer-background.d.ts.map +0 -1
- package/dist/sdk/components/session-graph-panel.d.ts +0 -7
- package/dist/sdk/components/session-graph-panel.d.ts.map +0 -1
- package/dist/sdk/components/status-helpers.d.ts +0 -6
- package/dist/sdk/components/status-helpers.d.ts.map +0 -1
- package/dist/sdk/components/statusline.d.ts +0 -5
- package/dist/sdk/components/statusline.d.ts.map +0 -1
- package/dist/sdk/components/tui-diagnostics.d.ts +0 -56
- package/dist/sdk/components/tui-diagnostics.d.ts.map +0 -1
- package/dist/sdk/components/workflow-picker-panel.d.ts +0 -126
- package/dist/sdk/components/workflow-picker-panel.d.ts.map +0 -1
- package/dist/sdk/define-workflow.d.ts +0 -107
- package/dist/sdk/define-workflow.d.ts.map +0 -1
- package/dist/sdk/errors.d.ts +0 -46
- package/dist/sdk/errors.d.ts.map +0 -1
- package/dist/sdk/index.d.ts +0 -26
- package/dist/sdk/index.d.ts.map +0 -1
- package/dist/sdk/primitives/inputs.d.ts +0 -36
- package/dist/sdk/primitives/inputs.d.ts.map +0 -1
- package/dist/sdk/primitives/metadata.d.ts +0 -40
- package/dist/sdk/primitives/metadata.d.ts.map +0 -1
- package/dist/sdk/primitives/run.d.ts +0 -57
- package/dist/sdk/primitives/run.d.ts.map +0 -1
- package/dist/sdk/primitives/sessions.d.ts +0 -128
- package/dist/sdk/primitives/sessions.d.ts.map +0 -1
- package/dist/sdk/providers/claude.d.ts +0 -392
- package/dist/sdk/providers/claude.d.ts.map +0 -1
- package/dist/sdk/providers/copilot.d.ts +0 -55
- package/dist/sdk/providers/copilot.d.ts.map +0 -1
- package/dist/sdk/providers/opencode.d.ts +0 -27
- package/dist/sdk/providers/opencode.d.ts.map +0 -1
- package/dist/sdk/registry.d.ts +0 -27
- package/dist/sdk/registry.d.ts.map +0 -1
- package/dist/sdk/runtime/attached-footer.d.ts +0 -31
- package/dist/sdk/runtime/attached-footer.d.ts.map +0 -1
- package/dist/sdk/runtime/cc-debounce.d.ts +0 -29
- package/dist/sdk/runtime/cc-debounce.d.ts.map +0 -1
- package/dist/sdk/runtime/executor-env.d.ts +0 -20
- package/dist/sdk/runtime/executor-env.d.ts.map +0 -1
- package/dist/sdk/runtime/executor.d.ts +0 -265
- package/dist/sdk/runtime/executor.d.ts.map +0 -1
- package/dist/sdk/runtime/graph-inference.d.ts +0 -35
- package/dist/sdk/runtime/graph-inference.d.ts.map +0 -1
- package/dist/sdk/runtime/orchestrator-entry.d.ts +0 -26
- package/dist/sdk/runtime/orchestrator-entry.d.ts.map +0 -1
- package/dist/sdk/runtime/panel.d.ts +0 -9
- package/dist/sdk/runtime/panel.d.ts.map +0 -1
- package/dist/sdk/runtime/port-discovery.d.ts +0 -71
- package/dist/sdk/runtime/port-discovery.d.ts.map +0 -1
- package/dist/sdk/runtime/status-writer.d.ts +0 -101
- package/dist/sdk/runtime/status-writer.d.ts.map +0 -1
- package/dist/sdk/runtime/theme.d.ts +0 -33
- package/dist/sdk/runtime/theme.d.ts.map +0 -1
- package/dist/sdk/runtime/tmux.d.ts +0 -307
- package/dist/sdk/runtime/tmux.d.ts.map +0 -1
- package/dist/sdk/runtime/version-compat.d.ts +0 -28
- package/dist/sdk/runtime/version-compat.d.ts.map +0 -1
- package/dist/sdk/types.d.ts +0 -435
- package/dist/sdk/types.d.ts.map +0 -1
- package/dist/sdk/worker-shared.d.ts +0 -42
- package/dist/sdk/worker-shared.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/deep-research-codebase/claude/index.d.ts +0 -81
- package/dist/sdk/workflows/builtin/deep-research-codebase/claude/index.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/deep-research-codebase/copilot/index.d.ts +0 -37
- package/dist/sdk/workflows/builtin/deep-research-codebase/copilot/index.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/batching.d.ts +0 -43
- package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/batching.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/heuristic.d.ts +0 -14
- package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/heuristic.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/prompts.d.ts +0 -136
- package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/prompts.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/scout.d.ts +0 -58
- package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/scout.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/scratch.d.ts +0 -43
- package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/scratch.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/deep-research-codebase/opencode/index.d.ts +0 -37
- package/dist/sdk/workflows/builtin/deep-research-codebase/opencode/index.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/open-claude-design/claude/index.d.ts +0 -68
- package/dist/sdk/workflows/builtin/open-claude-design/claude/index.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/open-claude-design/copilot/index.d.ts +0 -56
- package/dist/sdk/workflows/builtin/open-claude-design/copilot/index.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/open-claude-design/helpers/constants.d.ts +0 -72
- package/dist/sdk/workflows/builtin/open-claude-design/helpers/constants.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/open-claude-design/helpers/design-system.d.ts +0 -46
- package/dist/sdk/workflows/builtin/open-claude-design/helpers/design-system.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/open-claude-design/helpers/export.d.ts +0 -32
- package/dist/sdk/workflows/builtin/open-claude-design/helpers/export.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/open-claude-design/helpers/import.d.ts +0 -33
- package/dist/sdk/workflows/builtin/open-claude-design/helpers/import.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/open-claude-design/helpers/prompts.d.ts +0 -106
- package/dist/sdk/workflows/builtin/open-claude-design/helpers/prompts.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/open-claude-design/helpers/scan.d.ts +0 -50
- package/dist/sdk/workflows/builtin/open-claude-design/helpers/scan.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/open-claude-design/helpers/validation.d.ts +0 -12
- package/dist/sdk/workflows/builtin/open-claude-design/helpers/validation.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/open-claude-design/opencode/index.d.ts +0 -58
- package/dist/sdk/workflows/builtin/open-claude-design/opencode/index.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/ralph/claude/index.d.ts +0 -37
- package/dist/sdk/workflows/builtin/ralph/claude/index.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/ralph/copilot/index.d.ts +0 -34
- package/dist/sdk/workflows/builtin/ralph/copilot/index.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/ralph/helpers/copilot-reviewer.d.ts +0 -25
- package/dist/sdk/workflows/builtin/ralph/helpers/copilot-reviewer.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/ralph/helpers/git.d.ts +0 -69
- package/dist/sdk/workflows/builtin/ralph/helpers/git.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/ralph/helpers/prompts.d.ts +0 -266
- package/dist/sdk/workflows/builtin/ralph/helpers/prompts.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/ralph/helpers/review.d.ts +0 -24
- package/dist/sdk/workflows/builtin/ralph/helpers/review.d.ts.map +0 -1
- package/dist/sdk/workflows/builtin/ralph/opencode/index.d.ts +0 -33
- package/dist/sdk/workflows/builtin/ralph/opencode/index.d.ts.map +0 -1
- package/dist/sdk/workflows/index.d.ts +0 -32
- package/dist/sdk/workflows/index.d.ts.map +0 -1
- package/dist/services/config/additional-instructions.d.ts +0 -67
- package/dist/services/config/additional-instructions.d.ts.map +0 -1
- package/dist/services/config/atomic-config.d.ts +0 -42
- package/dist/services/config/atomic-config.d.ts.map +0 -1
- package/dist/services/config/definitions.d.ts +0 -52
- package/dist/services/config/definitions.d.ts.map +0 -1
- package/dist/services/config/index.d.ts +0 -7
- package/dist/services/config/index.d.ts.map +0 -1
- package/dist/services/config/scm-sync.d.ts +0 -37
- package/dist/services/config/scm-sync.d.ts.map +0 -1
- package/dist/services/config/settings-schema.d.ts +0 -2
- package/dist/services/config/settings-schema.d.ts.map +0 -1
- package/dist/services/system/copy.d.ts +0 -84
- package/dist/services/system/copy.d.ts.map +0 -1
- package/dist/services/system/detect.d.ts +0 -75
- package/dist/services/system/detect.d.ts.map +0 -1
- package/dist/theme/colors.d.ts +0 -35
- package/dist/theme/colors.d.ts.map +0 -1
- package/src/cli.ts +0 -397
- package/src/commands/builtin-registry.ts +0 -37
- package/src/commands/cli/chat/index.test.ts +0 -252
- package/src/commands/cli/chat/index.ts +0 -430
- package/src/commands/cli/chat.ts +0 -8
- package/src/commands/cli/claude-ask-hook.test.ts +0 -128
- package/src/commands/cli/claude-ask-hook.ts +0 -84
- package/src/commands/cli/claude-inflight-hook.test.ts +0 -598
- package/src/commands/cli/claude-inflight-hook.ts +0 -359
- package/src/commands/cli/claude-session-start-hook.ts +0 -61
- package/src/commands/cli/claude-stop-hook.test.ts +0 -317
- package/src/commands/cli/claude-stop-hook.ts +0 -441
- package/src/commands/cli/completions.ts +0 -24
- package/src/commands/cli/config.ts +0 -80
- package/src/commands/cli/footer.tsx +0 -248
- package/src/commands/cli/init/index.ts +0 -41
- package/src/commands/cli/init/onboarding.ts +0 -61
- package/src/commands/cli/init.ts +0 -8
- package/src/commands/cli/management-commands.ts +0 -112
- package/src/commands/cli/session.test.ts +0 -830
- package/src/commands/cli/session.ts +0 -447
- package/src/commands/cli/workflow-command.test.ts +0 -618
- package/src/commands/cli/workflow-inputs.test.ts +0 -353
- package/src/commands/cli/workflow-inputs.ts +0 -266
- package/src/commands/cli/workflow-list.test.ts +0 -235
- package/src/commands/cli/workflow-list.ts +0 -0
- package/src/commands/cli/workflow-status.test.ts +0 -451
- package/src/commands/cli/workflow-status.ts +0 -330
- package/src/commands/cli/workflow.ts +0 -196
- package/src/completions/bash.ts +0 -102
- package/src/completions/fish.ts +0 -136
- package/src/completions/index.ts +0 -7
- package/src/completions/powershell.ts +0 -195
- package/src/completions/zsh.ts +0 -150
- package/src/lib/atomic-temp.test.ts +0 -86
- package/src/lib/atomic-temp.ts +0 -62
- package/src/lib/common-ignore.ts +0 -46
- package/src/lib/merge.ts +0 -103
- package/src/lib/path-root-guard.ts +0 -38
- package/src/lib/spawn.test.ts +0 -109
- package/src/lib/spawn.ts +0 -678
- package/src/lib/terminal-env.test.ts +0 -343
- package/src/lib/terminal-env.ts +0 -100
- package/src/scripts/bump-version.ts +0 -94
- package/src/scripts/bundle-configs.ts +0 -116
- package/src/scripts/clean-dist.test.ts +0 -53
- package/src/scripts/clean-dist.ts +0 -37
- package/src/scripts/constants-base.ts +0 -14
- package/src/scripts/constants.ts +0 -35
- package/src/sdk/components/attached-statusline.tsx +0 -86
- package/src/sdk/components/color-utils.ts +0 -20
- package/src/sdk/components/compact-switcher.tsx +0 -78
- package/src/sdk/components/connectors.test.ts +0 -707
- package/src/sdk/components/connectors.ts +0 -160
- package/src/sdk/components/edge.tsx +0 -13
- package/src/sdk/components/error-boundary.tsx +0 -38
- package/src/sdk/components/graph-theme.ts +0 -37
- package/src/sdk/components/header.tsx +0 -85
- package/src/sdk/components/hooks.ts +0 -21
- package/src/sdk/components/layout.test.ts +0 -1245
- package/src/sdk/components/layout.ts +0 -223
- package/src/sdk/components/node-card.tsx +0 -91
- package/src/sdk/components/orchestrator-panel-contexts.ts +0 -35
- package/src/sdk/components/orchestrator-panel-store.test.ts +0 -847
- package/src/sdk/components/orchestrator-panel-store.ts +0 -187
- package/src/sdk/components/orchestrator-panel-types.ts +0 -23
- package/src/sdk/components/orchestrator-panel.tsx +0 -262
- package/src/sdk/components/renderer-background.ts +0 -49
- package/src/sdk/components/session-graph-panel.tsx +0 -471
- package/src/sdk/components/status-helpers.ts +0 -33
- package/src/sdk/components/statusline.tsx +0 -68
- package/src/sdk/components/tui-diagnostics.ts +0 -273
- package/src/sdk/components/workflow-picker-panel.tsx +0 -1613
- package/src/sdk/define-workflow.test.ts +0 -354
- package/src/sdk/define-workflow.ts +0 -275
- package/src/sdk/errors.test.ts +0 -83
- package/src/sdk/errors.ts +0 -77
- package/src/sdk/index.test.ts +0 -92
- package/src/sdk/index.ts +0 -101
- package/src/sdk/primitives/inputs.ts +0 -48
- package/src/sdk/primitives/metadata.ts +0 -63
- package/src/sdk/primitives/run.ts +0 -81
- package/src/sdk/primitives/sessions.test.ts +0 -594
- package/src/sdk/primitives/sessions.ts +0 -328
- package/src/sdk/providers/claude.ts +0 -1450
- package/src/sdk/providers/copilot.test.ts +0 -365
- package/src/sdk/providers/copilot.ts +0 -185
- package/src/sdk/providers/headless-hil-policy.test.ts +0 -211
- package/src/sdk/providers/opencode.ts +0 -88
- package/src/sdk/registry.ts +0 -132
- package/src/sdk/runtime/attached-footer.ts +0 -155
- package/src/sdk/runtime/cc-debounce.ts +0 -104
- package/src/sdk/runtime/executor-env.ts +0 -45
- package/src/sdk/runtime/executor.test.ts +0 -1321
- package/src/sdk/runtime/executor.ts +0 -2136
- package/src/sdk/runtime/graph-inference.ts +0 -50
- package/src/sdk/runtime/orchestrator-entry.ts +0 -110
- package/src/sdk/runtime/panel.tsx +0 -9
- package/src/sdk/runtime/port-discovery.test.ts +0 -573
- package/src/sdk/runtime/port-discovery.ts +0 -496
- package/src/sdk/runtime/status-writer.test.ts +0 -245
- package/src/sdk/runtime/status-writer.ts +0 -201
- package/src/sdk/runtime/theme.ts +0 -71
- package/src/sdk/runtime/tmux.conf +0 -112
- package/src/sdk/runtime/tmux.ts +0 -785
- package/src/sdk/runtime/version-compat.ts +0 -68
- package/src/sdk/types.ts +0 -548
- package/src/sdk/worker-shared.test.ts +0 -163
- package/src/sdk/worker-shared.ts +0 -155
- package/src/sdk/workflows/builtin/deep-research-codebase/claude/index.ts +0 -569
- package/src/sdk/workflows/builtin/deep-research-codebase/copilot/index.ts +0 -481
- package/src/sdk/workflows/builtin/deep-research-codebase/helpers/batching.ts +0 -65
- package/src/sdk/workflows/builtin/deep-research-codebase/helpers/heuristic.ts +0 -24
- package/src/sdk/workflows/builtin/deep-research-codebase/helpers/ignore-by-default.d.ts +0 -8
- package/src/sdk/workflows/builtin/deep-research-codebase/helpers/prompts.ts +0 -958
- package/src/sdk/workflows/builtin/deep-research-codebase/helpers/scout.ts +0 -505
- package/src/sdk/workflows/builtin/deep-research-codebase/helpers/scratch.ts +0 -115
- package/src/sdk/workflows/builtin/deep-research-codebase/opencode/index.ts +0 -530
- package/src/sdk/workflows/builtin/open-claude-design/claude/index.ts +0 -500
- package/src/sdk/workflows/builtin/open-claude-design/copilot/index.ts +0 -508
- package/src/sdk/workflows/builtin/open-claude-design/helpers/constants.ts +0 -159
- package/src/sdk/workflows/builtin/open-claude-design/helpers/design-system.ts +0 -88
- package/src/sdk/workflows/builtin/open-claude-design/helpers/export.ts +0 -193
- package/src/sdk/workflows/builtin/open-claude-design/helpers/import.ts +0 -52
- package/src/sdk/workflows/builtin/open-claude-design/helpers/prompts.ts +0 -1110
- package/src/sdk/workflows/builtin/open-claude-design/helpers/scan.ts +0 -117
- package/src/sdk/workflows/builtin/open-claude-design/helpers/validation.ts +0 -38
- package/src/sdk/workflows/builtin/open-claude-design/opencode/index.ts +0 -610
- package/src/sdk/workflows/builtin/ralph/claude/index.ts +0 -272
- package/src/sdk/workflows/builtin/ralph/copilot/index.ts +0 -298
- package/src/sdk/workflows/builtin/ralph/helpers/copilot-reviewer.ts +0 -105
- package/src/sdk/workflows/builtin/ralph/helpers/git.ts +0 -201
- package/src/sdk/workflows/builtin/ralph/helpers/prompts.ts +0 -1108
- package/src/sdk/workflows/builtin/ralph/helpers/review.ts +0 -33
- package/src/sdk/workflows/builtin/ralph/opencode/index.ts +0 -290
- package/src/sdk/workflows/index.ts +0 -116
- package/src/services/config/additional-instructions.ts +0 -273
- package/src/services/config/atomic-config.ts +0 -210
- package/src/services/config/atomic-global-config.ts +0 -348
- package/src/services/config/config-path.ts +0 -19
- package/src/services/config/definitions.ts +0 -125
- package/src/services/config/index.ts +0 -7
- package/src/services/config/scm-sync.ts +0 -185
- package/src/services/config/settings-schema.ts +0 -2
- package/src/services/config/settings.ts +0 -144
- package/src/services/system/agents.ts +0 -95
- package/src/services/system/auth.test.ts +0 -343
- package/src/services/system/auth.ts +0 -140
- package/src/services/system/auto-sync.ts +0 -128
- package/src/services/system/copy.ts +0 -392
- package/src/services/system/detect.ts +0 -161
- package/src/services/system/file-lock.ts +0 -289
- package/src/services/system/install-ui.ts +0 -296
- package/src/services/system/skills.ts +0 -58
- package/src/theme/colors.ts +0 -96
- package/src/theme/logo.ts +0 -123
- package/src/version.ts +0 -7
|
@@ -1,1321 +0,0 @@
|
|
|
1
|
-
import { test, expect, describe, beforeEach, afterEach, mock } from "bun:test";
|
|
2
|
-
import { mkdtempSync, writeFileSync, chmodSync, rmSync } from "node:fs";
|
|
3
|
-
import { tmpdir } from "node:os";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
import {
|
|
6
|
-
renderMessagesToText,
|
|
7
|
-
hasContent,
|
|
8
|
-
escBash,
|
|
9
|
-
escPwsh,
|
|
10
|
-
watchCopilotSessionForHIL,
|
|
11
|
-
watchCopilotSessionForElicitation,
|
|
12
|
-
shouldOverrideCopilotCliPath,
|
|
13
|
-
discoverCopilotBinary,
|
|
14
|
-
applyContainerEnvDefaults,
|
|
15
|
-
normalizeExternalCopilotOptions,
|
|
16
|
-
buildPaneCommand,
|
|
17
|
-
waitForServer,
|
|
18
|
-
type CopilotHILSessionSurface,
|
|
19
|
-
} from "./executor.ts";
|
|
20
|
-
import type { SavedMessage } from "../types.ts";
|
|
21
|
-
import type { SessionEvent } from "@github/copilot-sdk";
|
|
22
|
-
import type { SessionPromptResponse } from "@opencode-ai/sdk/v2";
|
|
23
|
-
import type { SessionMessage } from "@anthropic-ai/claude-agent-sdk";
|
|
24
|
-
|
|
25
|
-
// ---------------------------------------------------------------------------
|
|
26
|
-
// Test helpers — minimal cast factories
|
|
27
|
-
// ---------------------------------------------------------------------------
|
|
28
|
-
|
|
29
|
-
function makeCopilotAssistantEvent(content: string): SavedMessage {
|
|
30
|
-
return {
|
|
31
|
-
provider: "copilot",
|
|
32
|
-
data: {
|
|
33
|
-
id: "evt-001",
|
|
34
|
-
timestamp: "2024-01-01T00:00:00Z",
|
|
35
|
-
parentId: null,
|
|
36
|
-
type: "assistant.message",
|
|
37
|
-
data: {
|
|
38
|
-
messageId: "msg-001",
|
|
39
|
-
content,
|
|
40
|
-
toolCalls: [],
|
|
41
|
-
},
|
|
42
|
-
} as unknown as SessionEvent,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function makeCopilotSessionStartEvent(): SavedMessage {
|
|
47
|
-
return {
|
|
48
|
-
provider: "copilot",
|
|
49
|
-
data: {
|
|
50
|
-
id: "evt-000",
|
|
51
|
-
timestamp: "2024-01-01T00:00:00Z",
|
|
52
|
-
parentId: null,
|
|
53
|
-
type: "session.start",
|
|
54
|
-
data: {
|
|
55
|
-
sessionId: "sess-001",
|
|
56
|
-
version: 1,
|
|
57
|
-
producer: "copilot-agent",
|
|
58
|
-
copilotVersion: "1.0.0",
|
|
59
|
-
startTime: "2024-01-01T00:00:00Z",
|
|
60
|
-
},
|
|
61
|
-
} as unknown as SessionEvent,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function makeOpenCodeMessage(parts: Array<{ type: string; text?: string; id?: string }>): SavedMessage {
|
|
66
|
-
return {
|
|
67
|
-
provider: "opencode",
|
|
68
|
-
data: {
|
|
69
|
-
info: {
|
|
70
|
-
id: "msg-oc-001",
|
|
71
|
-
sessionID: "sess-oc-001",
|
|
72
|
-
role: "assistant",
|
|
73
|
-
time: { created: 1000 },
|
|
74
|
-
parentID: "parent-001",
|
|
75
|
-
modelID: "gpt-4",
|
|
76
|
-
providerID: "openai",
|
|
77
|
-
mode: "auto",
|
|
78
|
-
agent: "agent",
|
|
79
|
-
path: { cwd: "/tmp" },
|
|
80
|
-
tokens: { input: 0, output: 0, cache: { read: 0, write: 0 } },
|
|
81
|
-
},
|
|
82
|
-
parts: parts.map((p, i) =>
|
|
83
|
-
p.type === "text"
|
|
84
|
-
? { id: p.id ?? `part-${i}`, sessionID: "sess-oc-001", messageID: "msg-oc-001", type: "text" as const, text: p.text ?? "" }
|
|
85
|
-
: { id: `part-${i}`, sessionID: "sess-oc-001", messageID: "msg-oc-001", type: p.type as "reasoning", text: "" },
|
|
86
|
-
),
|
|
87
|
-
} as unknown as SessionPromptResponse,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function makeClaudeMessage(
|
|
92
|
-
type: "user" | "assistant" | "system",
|
|
93
|
-
message: unknown,
|
|
94
|
-
): SavedMessage {
|
|
95
|
-
return {
|
|
96
|
-
provider: "claude",
|
|
97
|
-
data: {
|
|
98
|
-
type,
|
|
99
|
-
uuid: "uuid-001",
|
|
100
|
-
session_id: "sess-cl-001",
|
|
101
|
-
message,
|
|
102
|
-
parent_tool_use_id: null,
|
|
103
|
-
} as SessionMessage,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// ---------------------------------------------------------------------------
|
|
108
|
-
// renderMessagesToText
|
|
109
|
-
// ---------------------------------------------------------------------------
|
|
110
|
-
|
|
111
|
-
describe("renderMessagesToText", () => {
|
|
112
|
-
test("returns empty string for empty array", () => {
|
|
113
|
-
expect(renderMessagesToText([])).toBe("");
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
// --- Copilot ---
|
|
117
|
-
|
|
118
|
-
test("renders a copilot assistant.message under an Assistant header", () => {
|
|
119
|
-
const messages: SavedMessage[] = [
|
|
120
|
-
makeCopilotAssistantEvent("Hello from Copilot"),
|
|
121
|
-
];
|
|
122
|
-
expect(renderMessagesToText(messages)).toBe(
|
|
123
|
-
"### Assistant\n\nHello from Copilot",
|
|
124
|
-
);
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
test("skips copilot non-assistant events (session.start)", () => {
|
|
128
|
-
const messages: SavedMessage[] = [makeCopilotSessionStartEvent()];
|
|
129
|
-
expect(renderMessagesToText(messages)).toBe("");
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
test("only renders copilot assistant.message events when mixed with other event types", () => {
|
|
133
|
-
const messages: SavedMessage[] = [
|
|
134
|
-
makeCopilotSessionStartEvent(),
|
|
135
|
-
makeCopilotAssistantEvent("First response"),
|
|
136
|
-
makeCopilotSessionStartEvent(),
|
|
137
|
-
makeCopilotAssistantEvent("Second response"),
|
|
138
|
-
];
|
|
139
|
-
expect(renderMessagesToText(messages)).toBe(
|
|
140
|
-
"### Assistant\n\nFirst response\n\n### Assistant\n\nSecond response",
|
|
141
|
-
);
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
// --- OpenCode ---
|
|
145
|
-
|
|
146
|
-
test("renders opencode text parts under an Assistant header", () => {
|
|
147
|
-
const messages: SavedMessage[] = [
|
|
148
|
-
makeOpenCodeMessage([
|
|
149
|
-
{ type: "text", text: "Line one" },
|
|
150
|
-
{ type: "text", text: "Line two" },
|
|
151
|
-
]),
|
|
152
|
-
];
|
|
153
|
-
expect(renderMessagesToText(messages)).toBe(
|
|
154
|
-
"### Assistant\n\nLine one\n\nLine two",
|
|
155
|
-
);
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
test("filters out non-text parts from opencode messages", () => {
|
|
159
|
-
const messages: SavedMessage[] = [
|
|
160
|
-
makeOpenCodeMessage([
|
|
161
|
-
{ type: "reasoning", text: "thinking..." },
|
|
162
|
-
{ type: "subtask", text: "" },
|
|
163
|
-
]),
|
|
164
|
-
];
|
|
165
|
-
expect(renderMessagesToText(messages)).toBe("");
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
test("includes only text parts when opencode message has mixed part types", () => {
|
|
169
|
-
const messages: SavedMessage[] = [
|
|
170
|
-
makeOpenCodeMessage([
|
|
171
|
-
{ type: "reasoning", text: "thinking..." },
|
|
172
|
-
{ type: "text", text: "The answer is 42" },
|
|
173
|
-
{ type: "subtask", text: "" },
|
|
174
|
-
]),
|
|
175
|
-
];
|
|
176
|
-
expect(renderMessagesToText(messages)).toBe(
|
|
177
|
-
"### Assistant\n\nThe answer is 42",
|
|
178
|
-
);
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
// --- Claude ---
|
|
182
|
-
|
|
183
|
-
test("renders a claude assistant string message under an Assistant header", () => {
|
|
184
|
-
const messages: SavedMessage[] = [
|
|
185
|
-
makeClaudeMessage("assistant", "Plain string output"),
|
|
186
|
-
];
|
|
187
|
-
expect(renderMessagesToText(messages)).toBe(
|
|
188
|
-
"### Assistant\n\nPlain string output",
|
|
189
|
-
);
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
test("renders claude assistant message with content as string under an Assistant header", () => {
|
|
193
|
-
const messages: SavedMessage[] = [
|
|
194
|
-
makeClaudeMessage("assistant", { content: "Content field string" }),
|
|
195
|
-
];
|
|
196
|
-
expect(renderMessagesToText(messages)).toBe(
|
|
197
|
-
"### Assistant\n\nContent field string",
|
|
198
|
-
);
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
test("joins claude text blocks with a double newline under a single Assistant header", () => {
|
|
202
|
-
const messages: SavedMessage[] = [
|
|
203
|
-
makeClaudeMessage("assistant", {
|
|
204
|
-
content: [
|
|
205
|
-
{ type: "text", text: "Block one" },
|
|
206
|
-
{ type: "text", text: "Block two" },
|
|
207
|
-
],
|
|
208
|
-
}),
|
|
209
|
-
];
|
|
210
|
-
expect(renderMessagesToText(messages)).toBe(
|
|
211
|
-
"### Assistant\n\nBlock one\n\nBlock two",
|
|
212
|
-
);
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
test("renders a claude user string message under a User header", () => {
|
|
216
|
-
const messages: SavedMessage[] = [
|
|
217
|
-
makeClaudeMessage("user", "user prompt"),
|
|
218
|
-
];
|
|
219
|
-
expect(renderMessagesToText(messages)).toBe("### User\n\nuser prompt");
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
test("skips claude system messages", () => {
|
|
223
|
-
const messages: SavedMessage[] = [
|
|
224
|
-
makeClaudeMessage("system", "system instructions"),
|
|
225
|
-
];
|
|
226
|
-
expect(renderMessagesToText(messages)).toBe("");
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
test("returns empty string for a claude assistant message with an unknown content shape", () => {
|
|
230
|
-
const unknownMsg = { weird: "shape", count: 99 };
|
|
231
|
-
const messages: SavedMessage[] = [
|
|
232
|
-
makeClaudeMessage("assistant", unknownMsg),
|
|
233
|
-
];
|
|
234
|
-
expect(renderMessagesToText(messages)).toBe("");
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
test("renders tool_use blocks inline with text under a single Assistant header", () => {
|
|
238
|
-
const messages: SavedMessage[] = [
|
|
239
|
-
makeClaudeMessage("assistant", {
|
|
240
|
-
content: [
|
|
241
|
-
{ type: "text", text: "I'll read the file" },
|
|
242
|
-
{
|
|
243
|
-
type: "tool_use",
|
|
244
|
-
id: "tu-1",
|
|
245
|
-
name: "Read",
|
|
246
|
-
input: { path: "/tmp/foo" },
|
|
247
|
-
},
|
|
248
|
-
{ type: "text", text: "Here's what I found" },
|
|
249
|
-
],
|
|
250
|
-
}),
|
|
251
|
-
];
|
|
252
|
-
expect(renderMessagesToText(messages)).toBe(
|
|
253
|
-
[
|
|
254
|
-
"### Assistant",
|
|
255
|
-
"",
|
|
256
|
-
"I'll read the file",
|
|
257
|
-
"",
|
|
258
|
-
"**→ `Read`**",
|
|
259
|
-
"",
|
|
260
|
-
"```json",
|
|
261
|
-
"{\n \"path\": \"/tmp/foo\"\n}",
|
|
262
|
-
"```",
|
|
263
|
-
"",
|
|
264
|
-
"Here's what I found",
|
|
265
|
-
].join("\n"),
|
|
266
|
-
);
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
test("skips claude `thinking` blocks in the rendered transcript", () => {
|
|
270
|
-
const messages: SavedMessage[] = [
|
|
271
|
-
makeClaudeMessage("assistant", {
|
|
272
|
-
content: [
|
|
273
|
-
{ type: "thinking", thinking: "internal reasoning…", signature: "sig" },
|
|
274
|
-
{ type: "text", text: "Public answer" },
|
|
275
|
-
],
|
|
276
|
-
}),
|
|
277
|
-
];
|
|
278
|
-
expect(renderMessagesToText(messages)).toBe(
|
|
279
|
-
"### Assistant\n\nPublic answer",
|
|
280
|
-
);
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
test("omits `tool_result` payloads entirely — only the call and subsequent assistant turns survive", () => {
|
|
284
|
-
const big = "x".repeat(5_000);
|
|
285
|
-
const messages: SavedMessage[] = [
|
|
286
|
-
makeClaudeMessage("assistant", {
|
|
287
|
-
content: [
|
|
288
|
-
{
|
|
289
|
-
type: "tool_use",
|
|
290
|
-
id: "tu-42",
|
|
291
|
-
name: "Read",
|
|
292
|
-
input: { file_path: "/tmp/note.md" },
|
|
293
|
-
},
|
|
294
|
-
],
|
|
295
|
-
}),
|
|
296
|
-
makeClaudeMessage("user", {
|
|
297
|
-
content: [
|
|
298
|
-
{ type: "tool_result", tool_use_id: "tu-42", content: big },
|
|
299
|
-
],
|
|
300
|
-
}),
|
|
301
|
-
makeClaudeMessage("assistant", {
|
|
302
|
-
content: [{ type: "text", text: "Done." }],
|
|
303
|
-
}),
|
|
304
|
-
];
|
|
305
|
-
const rendered = renderMessagesToText(messages);
|
|
306
|
-
|
|
307
|
-
// The tool call itself is present, with its input JSON.
|
|
308
|
-
expect(rendered).toContain("**→ `Read`**");
|
|
309
|
-
expect(rendered).toContain("/tmp/note.md");
|
|
310
|
-
|
|
311
|
-
// The follow-up assistant turn is present.
|
|
312
|
-
expect(rendered).toContain("### Assistant\n\nDone.");
|
|
313
|
-
|
|
314
|
-
// The tool_result payload is completely absent — not truncated, not
|
|
315
|
-
// labelled, not present in any form. This is the context-rot guard:
|
|
316
|
-
// even a 5_000-char result must not leak into the transcript.
|
|
317
|
-
expect(rendered).not.toContain("xxxxx");
|
|
318
|
-
expect(rendered).not.toContain("← `Read` result");
|
|
319
|
-
expect(rendered).not.toContain("← `Read`");
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
test("truncates very long tool_use `input` payloads with a `[+N chars]` suffix", () => {
|
|
323
|
-
const bigCommand = "echo " + "a".repeat(5_000);
|
|
324
|
-
const messages: SavedMessage[] = [
|
|
325
|
-
makeClaudeMessage("assistant", {
|
|
326
|
-
content: [
|
|
327
|
-
{
|
|
328
|
-
type: "tool_use",
|
|
329
|
-
id: "tu-big",
|
|
330
|
-
name: "Bash",
|
|
331
|
-
input: { command: bigCommand },
|
|
332
|
-
},
|
|
333
|
-
],
|
|
334
|
-
}),
|
|
335
|
-
];
|
|
336
|
-
const rendered = renderMessagesToText(messages);
|
|
337
|
-
expect(rendered).toContain("**→ `Bash`**");
|
|
338
|
-
// Input budget is 800 chars of JSON — the long command must be truncated.
|
|
339
|
-
expect(rendered).toContain("chars]");
|
|
340
|
-
expect(rendered.length).toBeLessThan(bigCommand.length);
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
test("skips a user message whose only content is `tool_result` blocks", () => {
|
|
344
|
-
const messages: SavedMessage[] = [
|
|
345
|
-
makeClaudeMessage("user", {
|
|
346
|
-
content: [
|
|
347
|
-
{
|
|
348
|
-
type: "tool_result",
|
|
349
|
-
tool_use_id: "tu-a",
|
|
350
|
-
content: "would-be-noisy output",
|
|
351
|
-
},
|
|
352
|
-
],
|
|
353
|
-
}),
|
|
354
|
-
];
|
|
355
|
-
expect(renderMessagesToText(messages)).toBe("");
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
// --- Mixed providers ---
|
|
359
|
-
|
|
360
|
-
test("joins messages from mixed providers with double newlines and provider-appropriate headers", () => {
|
|
361
|
-
const messages: SavedMessage[] = [
|
|
362
|
-
makeCopilotAssistantEvent("Copilot says hello"),
|
|
363
|
-
makeOpenCodeMessage([{ type: "text", text: "OpenCode says hello" }]),
|
|
364
|
-
makeClaudeMessage("assistant", "Claude says hello"),
|
|
365
|
-
];
|
|
366
|
-
expect(renderMessagesToText(messages)).toBe(
|
|
367
|
-
[
|
|
368
|
-
"### Assistant",
|
|
369
|
-
"",
|
|
370
|
-
"Copilot says hello",
|
|
371
|
-
"",
|
|
372
|
-
"### Assistant",
|
|
373
|
-
"",
|
|
374
|
-
"OpenCode says hello",
|
|
375
|
-
"",
|
|
376
|
-
"### Assistant",
|
|
377
|
-
"",
|
|
378
|
-
"Claude says hello",
|
|
379
|
-
].join("\n"),
|
|
380
|
-
);
|
|
381
|
-
});
|
|
382
|
-
|
|
383
|
-
test("skips blank entries when building joined output", () => {
|
|
384
|
-
const messages: SavedMessage[] = [
|
|
385
|
-
makeCopilotSessionStartEvent(),
|
|
386
|
-
makeCopilotAssistantEvent("Only one has content"),
|
|
387
|
-
makeOpenCodeMessage([{ type: "reasoning", text: "ignored" }]),
|
|
388
|
-
];
|
|
389
|
-
expect(renderMessagesToText(messages)).toBe(
|
|
390
|
-
"### Assistant\n\nOnly one has content",
|
|
391
|
-
);
|
|
392
|
-
});
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
// ---------------------------------------------------------------------------
|
|
396
|
-
// hasContent type guard
|
|
397
|
-
// ---------------------------------------------------------------------------
|
|
398
|
-
|
|
399
|
-
describe("hasContent", () => {
|
|
400
|
-
test("returns true for object with string content property", () => {
|
|
401
|
-
expect(hasContent({ content: "hello" })).toBe(true);
|
|
402
|
-
});
|
|
403
|
-
|
|
404
|
-
test("returns false for empty object", () => {
|
|
405
|
-
expect(hasContent({})).toBe(false);
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
test("returns false for null", () => {
|
|
409
|
-
expect(hasContent(null)).toBe(false);
|
|
410
|
-
});
|
|
411
|
-
|
|
412
|
-
test("returns false when content is a number instead of a string", () => {
|
|
413
|
-
expect(hasContent({ content: 42 })).toBe(false);
|
|
414
|
-
});
|
|
415
|
-
|
|
416
|
-
test("returns false for a plain string value", () => {
|
|
417
|
-
expect(hasContent("hello")).toBe(false);
|
|
418
|
-
});
|
|
419
|
-
|
|
420
|
-
test("returns false for undefined", () => {
|
|
421
|
-
expect(hasContent(undefined)).toBe(false);
|
|
422
|
-
});
|
|
423
|
-
});
|
|
424
|
-
|
|
425
|
-
// ---------------------------------------------------------------------------
|
|
426
|
-
// escBash — shell escaping for bash double-quoted strings
|
|
427
|
-
// ---------------------------------------------------------------------------
|
|
428
|
-
|
|
429
|
-
describe("escBash", () => {
|
|
430
|
-
test("returns empty string unchanged", () => {
|
|
431
|
-
expect(escBash("")).toBe("");
|
|
432
|
-
});
|
|
433
|
-
|
|
434
|
-
test("passes through plain alphanumeric text", () => {
|
|
435
|
-
expect(escBash("hello world 123")).toBe("hello world 123");
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
test("escapes double quotes", () => {
|
|
439
|
-
expect(escBash('say "hello"')).toBe('say \\"hello\\"');
|
|
440
|
-
});
|
|
441
|
-
|
|
442
|
-
test("escapes backslashes", () => {
|
|
443
|
-
expect(escBash("a\\b")).toBe("a\\\\b");
|
|
444
|
-
});
|
|
445
|
-
|
|
446
|
-
test("escapes dollar signs", () => {
|
|
447
|
-
expect(escBash("$HOME")).toBe("\\$HOME");
|
|
448
|
-
});
|
|
449
|
-
|
|
450
|
-
test("escapes backticks", () => {
|
|
451
|
-
expect(escBash("`whoami`")).toBe("\\`whoami\\`");
|
|
452
|
-
});
|
|
453
|
-
|
|
454
|
-
test("escapes exclamation marks (history expansion)", () => {
|
|
455
|
-
expect(escBash("hello!")).toBe("hello\\!");
|
|
456
|
-
});
|
|
457
|
-
|
|
458
|
-
test("replaces newlines with spaces", () => {
|
|
459
|
-
expect(escBash("line1\nline2\nline3")).toBe("line1 line2 line3");
|
|
460
|
-
});
|
|
461
|
-
|
|
462
|
-
test("replaces carriage returns with spaces", () => {
|
|
463
|
-
expect(escBash("line1\r\nline2")).toBe("line1 line2");
|
|
464
|
-
});
|
|
465
|
-
|
|
466
|
-
test("collapses consecutive newlines into a single space", () => {
|
|
467
|
-
expect(escBash("a\n\n\nb")).toBe("a b");
|
|
468
|
-
});
|
|
469
|
-
|
|
470
|
-
test("strips null bytes", () => {
|
|
471
|
-
expect(escBash("ab\0cd")).toBe("abcd");
|
|
472
|
-
});
|
|
473
|
-
|
|
474
|
-
test("preserves single quotes (literal in double-quoted bash strings)", () => {
|
|
475
|
-
expect(escBash("it's fine")).toBe("it's fine");
|
|
476
|
-
});
|
|
477
|
-
|
|
478
|
-
test("preserves parentheses, braces, and brackets (safe in double quotes)", () => {
|
|
479
|
-
expect(escBash("(a) {b} [c]")).toBe("(a) {b} [c]");
|
|
480
|
-
});
|
|
481
|
-
|
|
482
|
-
test("preserves pipe, ampersand, and semicolon (safe in double quotes)", () => {
|
|
483
|
-
expect(escBash("a | b & c ; d")).toBe("a | b & c ; d");
|
|
484
|
-
});
|
|
485
|
-
|
|
486
|
-
test("handles a string with all special characters combined", () => {
|
|
487
|
-
expect(escBash('$`"\\!\0')).toBe('\\$\\`\\"\\\\\\!');
|
|
488
|
-
});
|
|
489
|
-
|
|
490
|
-
test("handles unicode characters", () => {
|
|
491
|
-
expect(escBash("héllo wörld 日本語")).toBe("héllo wörld 日本語");
|
|
492
|
-
});
|
|
493
|
-
|
|
494
|
-
test("handles very long strings without error", () => {
|
|
495
|
-
const long = "a".repeat(10_000);
|
|
496
|
-
expect(escBash(long)).toBe(long);
|
|
497
|
-
});
|
|
498
|
-
});
|
|
499
|
-
|
|
500
|
-
// ---------------------------------------------------------------------------
|
|
501
|
-
// escPwsh — shell escaping for PowerShell double-quoted strings
|
|
502
|
-
// ---------------------------------------------------------------------------
|
|
503
|
-
|
|
504
|
-
describe("escPwsh", () => {
|
|
505
|
-
test("returns empty string unchanged", () => {
|
|
506
|
-
expect(escPwsh("")).toBe("");
|
|
507
|
-
});
|
|
508
|
-
|
|
509
|
-
test("passes through plain text", () => {
|
|
510
|
-
expect(escPwsh("hello world")).toBe("hello world");
|
|
511
|
-
});
|
|
512
|
-
|
|
513
|
-
test("escapes backticks (PowerShell escape character)", () => {
|
|
514
|
-
expect(escPwsh("a`b")).toBe("a``b");
|
|
515
|
-
});
|
|
516
|
-
|
|
517
|
-
test("escapes double quotes", () => {
|
|
518
|
-
expect(escPwsh('say "hi"')).toBe('say `"hi`"');
|
|
519
|
-
});
|
|
520
|
-
|
|
521
|
-
test("escapes dollar signs", () => {
|
|
522
|
-
expect(escPwsh("$env:HOME")).toBe("`$env:HOME");
|
|
523
|
-
});
|
|
524
|
-
|
|
525
|
-
test("converts newlines to backtick-n", () => {
|
|
526
|
-
expect(escPwsh("line1\nline2")).toBe("line1`nline2");
|
|
527
|
-
});
|
|
528
|
-
|
|
529
|
-
test("converts carriage returns to backtick-r", () => {
|
|
530
|
-
expect(escPwsh("line1\rline2")).toBe("line1`rline2");
|
|
531
|
-
});
|
|
532
|
-
|
|
533
|
-
test("strips null bytes", () => {
|
|
534
|
-
expect(escPwsh("ab\0cd")).toBe("abcd");
|
|
535
|
-
});
|
|
536
|
-
|
|
537
|
-
test("handles combined special characters", () => {
|
|
538
|
-
expect(escPwsh('$`"\0')).toBe('`$```"');
|
|
539
|
-
});
|
|
540
|
-
});
|
|
541
|
-
|
|
542
|
-
// ---------------------------------------------------------------------------
|
|
543
|
-
// watchCopilotSessionForHIL — event-driven HIL detection via tool.execution_*
|
|
544
|
-
// ---------------------------------------------------------------------------
|
|
545
|
-
|
|
546
|
-
/**
|
|
547
|
-
* Minimal mock of the Copilot session surface that records handlers by event
|
|
548
|
-
* type and lets tests dispatch synthetic events. Mirrors the structural
|
|
549
|
-
* `on()` contract of `CopilotHILSessionSurface`.
|
|
550
|
-
*/
|
|
551
|
-
function makeMockCopilotSession(): CopilotHILSessionSurface & {
|
|
552
|
-
dispatch: (type: string, data: unknown) => void;
|
|
553
|
-
handlerCount: (type: string) => number;
|
|
554
|
-
} {
|
|
555
|
-
const handlers = new Map<string, Set<(event: { data?: unknown }) => void>>();
|
|
556
|
-
return {
|
|
557
|
-
on(eventType, handler) {
|
|
558
|
-
let set = handlers.get(eventType);
|
|
559
|
-
if (!set) {
|
|
560
|
-
set = new Set();
|
|
561
|
-
handlers.set(eventType, set);
|
|
562
|
-
}
|
|
563
|
-
set.add(handler);
|
|
564
|
-
return () => {
|
|
565
|
-
set!.delete(handler);
|
|
566
|
-
};
|
|
567
|
-
},
|
|
568
|
-
dispatch(type, data) {
|
|
569
|
-
const set = handlers.get(type);
|
|
570
|
-
if (set) for (const h of set) h({ data });
|
|
571
|
-
},
|
|
572
|
-
handlerCount(type) {
|
|
573
|
-
return handlers.get(type)?.size ?? 0;
|
|
574
|
-
},
|
|
575
|
-
};
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
describe("watchCopilotSessionForHIL", () => {
|
|
579
|
-
test("fires onHIL(true) on ask_user start and onHIL(false) on matching complete", () => {
|
|
580
|
-
const session = makeMockCopilotSession();
|
|
581
|
-
const calls: boolean[] = [];
|
|
582
|
-
const unsubscribe = watchCopilotSessionForHIL(session, (w) =>
|
|
583
|
-
calls.push(w),
|
|
584
|
-
);
|
|
585
|
-
|
|
586
|
-
session.dispatch("tool.execution_start", {
|
|
587
|
-
toolName: "ask_user",
|
|
588
|
-
toolCallId: "tc-1",
|
|
589
|
-
});
|
|
590
|
-
expect(calls).toEqual([true]);
|
|
591
|
-
|
|
592
|
-
session.dispatch("tool.execution_complete", { toolCallId: "tc-1" });
|
|
593
|
-
expect(calls).toEqual([true, false]);
|
|
594
|
-
|
|
595
|
-
unsubscribe();
|
|
596
|
-
});
|
|
597
|
-
|
|
598
|
-
test("ignores tool.execution_start for non-ask_user tools", () => {
|
|
599
|
-
const session = makeMockCopilotSession();
|
|
600
|
-
const calls: boolean[] = [];
|
|
601
|
-
const unsubscribe = watchCopilotSessionForHIL(session, (w) =>
|
|
602
|
-
calls.push(w),
|
|
603
|
-
);
|
|
604
|
-
|
|
605
|
-
session.dispatch("tool.execution_start", {
|
|
606
|
-
toolName: "edit_file",
|
|
607
|
-
toolCallId: "tc-2",
|
|
608
|
-
});
|
|
609
|
-
session.dispatch("tool.execution_complete", { toolCallId: "tc-2" });
|
|
610
|
-
expect(calls).toEqual([]);
|
|
611
|
-
|
|
612
|
-
unsubscribe();
|
|
613
|
-
});
|
|
614
|
-
|
|
615
|
-
test("ignores complete events for toolCallIds it did not mark active", () => {
|
|
616
|
-
const session = makeMockCopilotSession();
|
|
617
|
-
const calls: boolean[] = [];
|
|
618
|
-
const unsubscribe = watchCopilotSessionForHIL(session, (w) =>
|
|
619
|
-
calls.push(w),
|
|
620
|
-
);
|
|
621
|
-
|
|
622
|
-
// complete arrives for a tool we never started (e.g. another tool's id)
|
|
623
|
-
session.dispatch("tool.execution_complete", { toolCallId: "tc-unknown" });
|
|
624
|
-
expect(calls).toEqual([]);
|
|
625
|
-
|
|
626
|
-
unsubscribe();
|
|
627
|
-
});
|
|
628
|
-
|
|
629
|
-
test("only fires onHIL(false) after the last overlapping ask_user completes", () => {
|
|
630
|
-
const session = makeMockCopilotSession();
|
|
631
|
-
const calls: boolean[] = [];
|
|
632
|
-
const unsubscribe = watchCopilotSessionForHIL(session, (w) =>
|
|
633
|
-
calls.push(w),
|
|
634
|
-
);
|
|
635
|
-
|
|
636
|
-
session.dispatch("tool.execution_start", {
|
|
637
|
-
toolName: "ask_user",
|
|
638
|
-
toolCallId: "tc-a",
|
|
639
|
-
});
|
|
640
|
-
session.dispatch("tool.execution_start", {
|
|
641
|
-
toolName: "ask_user",
|
|
642
|
-
toolCallId: "tc-b",
|
|
643
|
-
});
|
|
644
|
-
// onHIL(true) fires exactly once on the first start
|
|
645
|
-
expect(calls).toEqual([true]);
|
|
646
|
-
|
|
647
|
-
session.dispatch("tool.execution_complete", { toolCallId: "tc-a" });
|
|
648
|
-
// still one active — must not fire onHIL(false) yet
|
|
649
|
-
expect(calls).toEqual([true]);
|
|
650
|
-
|
|
651
|
-
session.dispatch("tool.execution_complete", { toolCallId: "tc-b" });
|
|
652
|
-
expect(calls).toEqual([true, false]);
|
|
653
|
-
|
|
654
|
-
unsubscribe();
|
|
655
|
-
});
|
|
656
|
-
|
|
657
|
-
test("skips ask_user start events that are missing a toolCallId", () => {
|
|
658
|
-
const session = makeMockCopilotSession();
|
|
659
|
-
const calls: boolean[] = [];
|
|
660
|
-
const unsubscribe = watchCopilotSessionForHIL(session, (w) =>
|
|
661
|
-
calls.push(w),
|
|
662
|
-
);
|
|
663
|
-
|
|
664
|
-
session.dispatch("tool.execution_start", { toolName: "ask_user" });
|
|
665
|
-
expect(calls).toEqual([]);
|
|
666
|
-
|
|
667
|
-
unsubscribe();
|
|
668
|
-
});
|
|
669
|
-
|
|
670
|
-
test("unsubscribe removes both listeners", () => {
|
|
671
|
-
const session = makeMockCopilotSession();
|
|
672
|
-
const unsubscribe = watchCopilotSessionForHIL(session, () => {});
|
|
673
|
-
|
|
674
|
-
expect(session.handlerCount("tool.execution_start")).toBe(1);
|
|
675
|
-
expect(session.handlerCount("tool.execution_complete")).toBe(1);
|
|
676
|
-
|
|
677
|
-
unsubscribe();
|
|
678
|
-
|
|
679
|
-
expect(session.handlerCount("tool.execution_start")).toBe(0);
|
|
680
|
-
expect(session.handlerCount("tool.execution_complete")).toBe(0);
|
|
681
|
-
});
|
|
682
|
-
});
|
|
683
|
-
|
|
684
|
-
// ---------------------------------------------------------------------------
|
|
685
|
-
// watchCopilotSessionForElicitation — HIL detection via elicitation events
|
|
686
|
-
// ---------------------------------------------------------------------------
|
|
687
|
-
|
|
688
|
-
describe("watchCopilotSessionForElicitation", () => {
|
|
689
|
-
test("fires onHIL(true) on elicitation.requested event", () => {
|
|
690
|
-
const session = makeMockCopilotSession();
|
|
691
|
-
const calls: boolean[] = [];
|
|
692
|
-
const unsubscribe = watchCopilotSessionForElicitation(session, (w) =>
|
|
693
|
-
calls.push(w),
|
|
694
|
-
);
|
|
695
|
-
|
|
696
|
-
session.dispatch("elicitation.requested", { requestId: "req-1" });
|
|
697
|
-
expect(calls).toEqual([true]);
|
|
698
|
-
|
|
699
|
-
unsubscribe();
|
|
700
|
-
});
|
|
701
|
-
|
|
702
|
-
test("fires onHIL(false) on elicitation.completed with matching requestId", () => {
|
|
703
|
-
const session = makeMockCopilotSession();
|
|
704
|
-
const calls: boolean[] = [];
|
|
705
|
-
const unsubscribe = watchCopilotSessionForElicitation(session, (w) =>
|
|
706
|
-
calls.push(w),
|
|
707
|
-
);
|
|
708
|
-
|
|
709
|
-
session.dispatch("elicitation.requested", { requestId: "req-1" });
|
|
710
|
-
expect(calls).toEqual([true]);
|
|
711
|
-
|
|
712
|
-
session.dispatch("elicitation.completed", { requestId: "req-1" });
|
|
713
|
-
expect(calls).toEqual([true, false]);
|
|
714
|
-
|
|
715
|
-
unsubscribe();
|
|
716
|
-
});
|
|
717
|
-
|
|
718
|
-
test("only fires onHIL(true) once and onHIL(false) only after last overlapping request completes", () => {
|
|
719
|
-
const session = makeMockCopilotSession();
|
|
720
|
-
const calls: boolean[] = [];
|
|
721
|
-
const unsubscribe = watchCopilotSessionForElicitation(session, (w) =>
|
|
722
|
-
calls.push(w),
|
|
723
|
-
);
|
|
724
|
-
|
|
725
|
-
session.dispatch("elicitation.requested", { requestId: "req-a" });
|
|
726
|
-
session.dispatch("elicitation.requested", { requestId: "req-b" });
|
|
727
|
-
// onHIL(true) fires exactly once on the first request
|
|
728
|
-
expect(calls).toEqual([true]);
|
|
729
|
-
|
|
730
|
-
session.dispatch("elicitation.completed", { requestId: "req-a" });
|
|
731
|
-
// req-b still active — must not fire onHIL(false) yet
|
|
732
|
-
expect(calls).toEqual([true]);
|
|
733
|
-
|
|
734
|
-
session.dispatch("elicitation.completed", { requestId: "req-b" });
|
|
735
|
-
expect(calls).toEqual([true, false]);
|
|
736
|
-
|
|
737
|
-
unsubscribe();
|
|
738
|
-
});
|
|
739
|
-
|
|
740
|
-
test("ignores elicitation.completed for an unknown requestId", () => {
|
|
741
|
-
const session = makeMockCopilotSession();
|
|
742
|
-
const calls: boolean[] = [];
|
|
743
|
-
const unsubscribe = watchCopilotSessionForElicitation(session, (w) =>
|
|
744
|
-
calls.push(w),
|
|
745
|
-
);
|
|
746
|
-
|
|
747
|
-
session.dispatch("elicitation.completed", { requestId: "req-unknown" });
|
|
748
|
-
expect(calls).toEqual([]);
|
|
749
|
-
|
|
750
|
-
unsubscribe();
|
|
751
|
-
});
|
|
752
|
-
|
|
753
|
-
test("ignores elicitation.requested payload without a requestId", () => {
|
|
754
|
-
const session = makeMockCopilotSession();
|
|
755
|
-
const calls: boolean[] = [];
|
|
756
|
-
const unsubscribe = watchCopilotSessionForElicitation(session, (w) =>
|
|
757
|
-
calls.push(w),
|
|
758
|
-
);
|
|
759
|
-
|
|
760
|
-
session.dispatch("elicitation.requested", {});
|
|
761
|
-
expect(calls).toEqual([]);
|
|
762
|
-
|
|
763
|
-
unsubscribe();
|
|
764
|
-
});
|
|
765
|
-
|
|
766
|
-
test("unsubscribe removes both elicitation listeners and subsequent events are not received", () => {
|
|
767
|
-
const session = makeMockCopilotSession();
|
|
768
|
-
const calls: boolean[] = [];
|
|
769
|
-
const unsubscribe = watchCopilotSessionForElicitation(session, (w) =>
|
|
770
|
-
calls.push(w),
|
|
771
|
-
);
|
|
772
|
-
|
|
773
|
-
expect(session.handlerCount("elicitation.requested")).toBe(1);
|
|
774
|
-
expect(session.handlerCount("elicitation.completed")).toBe(1);
|
|
775
|
-
|
|
776
|
-
unsubscribe();
|
|
777
|
-
|
|
778
|
-
expect(session.handlerCount("elicitation.requested")).toBe(0);
|
|
779
|
-
expect(session.handlerCount("elicitation.completed")).toBe(0);
|
|
780
|
-
|
|
781
|
-
// Events fired after unsubscribe must not reach the original handler
|
|
782
|
-
session.dispatch("elicitation.requested", { requestId: "req-post" });
|
|
783
|
-
session.dispatch("elicitation.completed", { requestId: "req-post" });
|
|
784
|
-
expect(calls).toEqual([]);
|
|
785
|
-
});
|
|
786
|
-
|
|
787
|
-
test("MCP-initiated elicitation (non-empty elicitationSource) triggers onHIL(true) and onHIL(false) same as agent-initiated", () => {
|
|
788
|
-
const session = makeMockCopilotSession();
|
|
789
|
-
const calls: boolean[] = [];
|
|
790
|
-
const unsubscribe = watchCopilotSessionForElicitation(session, (w) =>
|
|
791
|
-
calls.push(w),
|
|
792
|
-
);
|
|
793
|
-
|
|
794
|
-
// Simulate MCP-initiated elicitation with a non-empty elicitationSource
|
|
795
|
-
session.dispatch("elicitation.requested", {
|
|
796
|
-
requestId: "req-mcp-1",
|
|
797
|
-
elicitationSource: "mcp-server://my-tool",
|
|
798
|
-
message: "Please provide your API key",
|
|
799
|
-
});
|
|
800
|
-
expect(calls).toEqual([true]);
|
|
801
|
-
|
|
802
|
-
session.dispatch("elicitation.completed", {
|
|
803
|
-
requestId: "req-mcp-1",
|
|
804
|
-
action: "accept",
|
|
805
|
-
});
|
|
806
|
-
expect(calls).toEqual([true, false]);
|
|
807
|
-
|
|
808
|
-
unsubscribe();
|
|
809
|
-
});
|
|
810
|
-
|
|
811
|
-
test("calling unsubscribe twice does not throw", () => {
|
|
812
|
-
const session = makeMockCopilotSession();
|
|
813
|
-
const unsubscribe = watchCopilotSessionForElicitation(session, () => {});
|
|
814
|
-
|
|
815
|
-
unsubscribe();
|
|
816
|
-
// Second call must be safe — no throw, no error
|
|
817
|
-
expect(() => unsubscribe()).not.toThrow();
|
|
818
|
-
});
|
|
819
|
-
|
|
820
|
-
test("ask_user watcher and elicitation watcher on same session track HIL independently", () => {
|
|
821
|
-
const session = makeMockCopilotSession();
|
|
822
|
-
const hilCalls: boolean[] = [];
|
|
823
|
-
const elicitationCalls: boolean[] = [];
|
|
824
|
-
|
|
825
|
-
const unsubHIL = watchCopilotSessionForHIL(session, (w) =>
|
|
826
|
-
hilCalls.push(w),
|
|
827
|
-
);
|
|
828
|
-
const unsubElicitation = watchCopilotSessionForElicitation(session, (w) =>
|
|
829
|
-
elicitationCalls.push(w),
|
|
830
|
-
);
|
|
831
|
-
|
|
832
|
-
// Fire an ask_user event — only the HIL watcher should see it
|
|
833
|
-
session.dispatch("tool.execution_start", {
|
|
834
|
-
toolName: "ask_user",
|
|
835
|
-
toolCallId: "tc-concurrent",
|
|
836
|
-
});
|
|
837
|
-
expect(hilCalls).toEqual([true]);
|
|
838
|
-
expect(elicitationCalls).toEqual([]);
|
|
839
|
-
|
|
840
|
-
// Fire an elicitation event — only the elicitation watcher should see it
|
|
841
|
-
session.dispatch("elicitation.requested", {
|
|
842
|
-
requestId: "req-concurrent",
|
|
843
|
-
});
|
|
844
|
-
expect(hilCalls).toEqual([true]);
|
|
845
|
-
expect(elicitationCalls).toEqual([true]);
|
|
846
|
-
|
|
847
|
-
// Complete the ask_user — only HIL watcher fires false
|
|
848
|
-
session.dispatch("tool.execution_complete", { toolCallId: "tc-concurrent" });
|
|
849
|
-
expect(hilCalls).toEqual([true, false]);
|
|
850
|
-
expect(elicitationCalls).toEqual([true]);
|
|
851
|
-
|
|
852
|
-
// Complete the elicitation — only elicitation watcher fires false
|
|
853
|
-
session.dispatch("elicitation.completed", { requestId: "req-concurrent" });
|
|
854
|
-
expect(hilCalls).toEqual([true, false]);
|
|
855
|
-
expect(elicitationCalls).toEqual([true, false]);
|
|
856
|
-
|
|
857
|
-
unsubHIL();
|
|
858
|
-
unsubElicitation();
|
|
859
|
-
});
|
|
860
|
-
});
|
|
861
|
-
|
|
862
|
-
// ---------------------------------------------------------------------------
|
|
863
|
-
// Copilot SDK 0.3 external-server auth option normalization
|
|
864
|
-
// ---------------------------------------------------------------------------
|
|
865
|
-
|
|
866
|
-
describe("normalizeExternalCopilotOptions", () => {
|
|
867
|
-
test("moves client-level GitHub token to the session for cliUrl clients", () => {
|
|
868
|
-
const result = normalizeExternalCopilotOptions({
|
|
869
|
-
gitHubToken: "client-token",
|
|
870
|
-
logLevel: "error",
|
|
871
|
-
});
|
|
872
|
-
|
|
873
|
-
expect(result).toEqual({
|
|
874
|
-
clientOptions: { logLevel: "error" },
|
|
875
|
-
sessionGitHubToken: "client-token",
|
|
876
|
-
});
|
|
877
|
-
});
|
|
878
|
-
|
|
879
|
-
test("keeps an explicit session GitHub token when both levels are set", () => {
|
|
880
|
-
const result = normalizeExternalCopilotOptions(
|
|
881
|
-
{ gitHubToken: "client-token" },
|
|
882
|
-
"session-token",
|
|
883
|
-
);
|
|
884
|
-
|
|
885
|
-
expect(result).toEqual({
|
|
886
|
-
clientOptions: {},
|
|
887
|
-
sessionGitHubToken: "session-token",
|
|
888
|
-
});
|
|
889
|
-
});
|
|
890
|
-
|
|
891
|
-
test("rejects useLoggedInUser because external Copilot servers own auth", () => {
|
|
892
|
-
expect(() =>
|
|
893
|
-
normalizeExternalCopilotOptions({ useLoggedInUser: false }),
|
|
894
|
-
).toThrow("useLoggedInUser");
|
|
895
|
-
});
|
|
896
|
-
});
|
|
897
|
-
|
|
898
|
-
// ---------------------------------------------------------------------------
|
|
899
|
-
// Copilot CLI path discovery (Bun-without-node containers)
|
|
900
|
-
// ---------------------------------------------------------------------------
|
|
901
|
-
|
|
902
|
-
describe("discoverCopilotBinary / shouldOverrideCopilotCliPath", () => {
|
|
903
|
-
let sandbox: string;
|
|
904
|
-
let savedPath: string | undefined;
|
|
905
|
-
let savedCliPath: string | undefined;
|
|
906
|
-
|
|
907
|
-
beforeEach(() => {
|
|
908
|
-
sandbox = mkdtempSync(join(tmpdir(), "atomic-cli-probe-"));
|
|
909
|
-
savedPath = process.env.PATH;
|
|
910
|
-
savedCliPath = process.env.COPILOT_CLI_PATH;
|
|
911
|
-
delete process.env.COPILOT_CLI_PATH;
|
|
912
|
-
});
|
|
913
|
-
|
|
914
|
-
afterEach(() => {
|
|
915
|
-
if (savedPath === undefined) delete process.env.PATH;
|
|
916
|
-
else process.env.PATH = savedPath;
|
|
917
|
-
if (savedCliPath === undefined) delete process.env.COPILOT_CLI_PATH;
|
|
918
|
-
else process.env.COPILOT_CLI_PATH = savedCliPath;
|
|
919
|
-
rmSync(sandbox, { recursive: true, force: true });
|
|
920
|
-
});
|
|
921
|
-
|
|
922
|
-
function putExe(dir: string, name: string, contents = "#!/bin/sh\necho $0"): string {
|
|
923
|
-
const p = join(dir, name);
|
|
924
|
-
writeFileSync(p, contents);
|
|
925
|
-
chmodSync(p, 0o755);
|
|
926
|
-
return p;
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
test("finds an executable 'copilot' on PATH", () => {
|
|
930
|
-
const bin = putExe(sandbox, "copilot");
|
|
931
|
-
process.env.PATH = sandbox;
|
|
932
|
-
expect(discoverCopilotBinary()).toBe(bin);
|
|
933
|
-
});
|
|
934
|
-
|
|
935
|
-
test("returns undefined when no copilot on PATH", () => {
|
|
936
|
-
process.env.PATH = sandbox;
|
|
937
|
-
expect(discoverCopilotBinary()).toBeUndefined();
|
|
938
|
-
});
|
|
939
|
-
|
|
940
|
-
test("returns undefined when PATH is unset", () => {
|
|
941
|
-
delete process.env.PATH;
|
|
942
|
-
expect(discoverCopilotBinary()).toBeUndefined();
|
|
943
|
-
});
|
|
944
|
-
|
|
945
|
-
test("returns undefined when PATH is empty", () => {
|
|
946
|
-
process.env.PATH = "";
|
|
947
|
-
expect(discoverCopilotBinary()).toBeUndefined();
|
|
948
|
-
});
|
|
949
|
-
|
|
950
|
-
test("skips non-executable files named 'copilot' on Unix", () => {
|
|
951
|
-
if (process.platform === "win32") return;
|
|
952
|
-
const p = join(sandbox, "copilot");
|
|
953
|
-
writeFileSync(p, "not executable");
|
|
954
|
-
chmodSync(p, 0o644);
|
|
955
|
-
process.env.PATH = sandbox;
|
|
956
|
-
expect(discoverCopilotBinary()).toBeUndefined();
|
|
957
|
-
});
|
|
958
|
-
|
|
959
|
-
test("shouldOverrideCopilotCliPath: false when COPILOT_CLI_PATH is user-set", () => {
|
|
960
|
-
putExe(sandbox, "copilot");
|
|
961
|
-
process.env.PATH = sandbox;
|
|
962
|
-
process.env.COPILOT_CLI_PATH = "/somewhere/else/copilot";
|
|
963
|
-
expect(shouldOverrideCopilotCliPath()).toBe(false);
|
|
964
|
-
});
|
|
965
|
-
|
|
966
|
-
test("shouldOverrideCopilotCliPath: false when node is also on PATH (SDK default works)", () => {
|
|
967
|
-
putExe(sandbox, "copilot");
|
|
968
|
-
putExe(sandbox, "node");
|
|
969
|
-
process.env.PATH = sandbox;
|
|
970
|
-
expect(shouldOverrideCopilotCliPath()).toBe(false);
|
|
971
|
-
});
|
|
972
|
-
|
|
973
|
-
test("shouldOverrideCopilotCliPath: true when bun + copilot but no node", () => {
|
|
974
|
-
putExe(sandbox, "copilot");
|
|
975
|
-
// Sandboxing PATH to a dir without `node` is what makes this test
|
|
976
|
-
// deterministic regardless of the host's installed toolchain.
|
|
977
|
-
process.env.PATH = sandbox;
|
|
978
|
-
// We're running this test under Bun, so process.versions.bun is set
|
|
979
|
-
expect(!!process.versions.bun).toBe(true);
|
|
980
|
-
expect(shouldOverrideCopilotCliPath()).toBe(true);
|
|
981
|
-
});
|
|
982
|
-
|
|
983
|
-
test("shouldOverrideCopilotCliPath: false when PATH is unset", () => {
|
|
984
|
-
delete process.env.PATH;
|
|
985
|
-
expect(shouldOverrideCopilotCliPath()).toBe(false);
|
|
986
|
-
});
|
|
987
|
-
|
|
988
|
-
test("applyContainerEnvDefaults sets COPILOT_CLI_PATH when override is needed", () => {
|
|
989
|
-
const bin = putExe(sandbox, "copilot");
|
|
990
|
-
process.env.PATH = sandbox;
|
|
991
|
-
applyContainerEnvDefaults();
|
|
992
|
-
expect(process.env.COPILOT_CLI_PATH).toBe(bin);
|
|
993
|
-
});
|
|
994
|
-
|
|
995
|
-
test("applyContainerEnvDefaults does NOT overwrite user-set COPILOT_CLI_PATH", () => {
|
|
996
|
-
putExe(sandbox, "copilot");
|
|
997
|
-
process.env.PATH = sandbox;
|
|
998
|
-
process.env.COPILOT_CLI_PATH = "/custom/copilot";
|
|
999
|
-
applyContainerEnvDefaults();
|
|
1000
|
-
expect(process.env.COPILOT_CLI_PATH).toBe("/custom/copilot");
|
|
1001
|
-
});
|
|
1002
|
-
});
|
|
1003
|
-
|
|
1004
|
-
// ---------------------------------------------------------------------------
|
|
1005
|
-
// buildPaneCommand
|
|
1006
|
-
// ---------------------------------------------------------------------------
|
|
1007
|
-
|
|
1008
|
-
describe("buildPaneCommand", () => {
|
|
1009
|
-
test("copilot: command contains --ui-server and --port 0", () => {
|
|
1010
|
-
const { command } = buildPaneCommand("copilot");
|
|
1011
|
-
expect(command).toContain("--ui-server");
|
|
1012
|
-
expect(command).toContain("--port 0");
|
|
1013
|
-
});
|
|
1014
|
-
|
|
1015
|
-
test("copilot: command invokes the copilot binary as the first token", () => {
|
|
1016
|
-
const { command } = buildPaneCommand("copilot");
|
|
1017
|
-
// Accept either a bare name (binary not on PATH in test env) or an
|
|
1018
|
-
// absolute path resolved via Bun.which — both end in "copilot".
|
|
1019
|
-
expect(command).toMatch(/^("[^"]*\/)?[^\s"]*copilot"?\s/);
|
|
1020
|
-
});
|
|
1021
|
-
|
|
1022
|
-
test("opencode: command contains --port 0 but not --ui-server", () => {
|
|
1023
|
-
const { command } = buildPaneCommand("opencode");
|
|
1024
|
-
expect(command).toContain("--port 0");
|
|
1025
|
-
expect(command).not.toContain("--ui-server");
|
|
1026
|
-
});
|
|
1027
|
-
|
|
1028
|
-
test("opencode: command invokes the opencode binary as the first token", () => {
|
|
1029
|
-
const { command } = buildPaneCommand("opencode");
|
|
1030
|
-
expect(command).toMatch(/^("[^"]*\/)?[^\s"]*opencode"?\s/);
|
|
1031
|
-
});
|
|
1032
|
-
|
|
1033
|
-
test("claude: command resolves to a shell and does not contain --port", () => {
|
|
1034
|
-
const { command } = buildPaneCommand("claude");
|
|
1035
|
-
// SHELL is typically already absolute (e.g. /bin/zsh) so it passes through
|
|
1036
|
-
// unchanged; bare fallbacks ("sh"/"pwsh") get resolved via Bun.which.
|
|
1037
|
-
const expected =
|
|
1038
|
-
process.env.SHELL || (process.platform === "win32" ? "pwsh" : "sh");
|
|
1039
|
-
const stripped = command.replace(/^"|"$/g, "");
|
|
1040
|
-
if (expected.includes("/") || expected.includes("\\")) {
|
|
1041
|
-
expect(stripped).toBe(expected);
|
|
1042
|
-
} else {
|
|
1043
|
-
// Bare fallback either resolved via Bun.which or returned as-is.
|
|
1044
|
-
expect(stripped.endsWith(expected) || stripped === expected).toBe(true);
|
|
1045
|
-
}
|
|
1046
|
-
expect(command).not.toContain("--port");
|
|
1047
|
-
});
|
|
1048
|
-
|
|
1049
|
-
test("claude: scopes temp files to the user's Atomic temp directory", () => {
|
|
1050
|
-
const { envVars } = buildPaneCommand("claude");
|
|
1051
|
-
expect(envVars.TMPDIR).toMatch(/\/\.atomic\/tmp$/);
|
|
1052
|
-
expect(envVars.TMP).toBe(envVars.TMPDIR);
|
|
1053
|
-
expect(envVars.TEMP).toBe(envVars.TMPDIR);
|
|
1054
|
-
});
|
|
1055
|
-
|
|
1056
|
-
test("claude: explicit temp env overrides the Atomic default", () => {
|
|
1057
|
-
const { envVars } = buildPaneCommand("claude", {
|
|
1058
|
-
envVars: { TMPDIR: "/custom/tmp", TMP: "/custom/tmp", TEMP: "/custom/tmp" },
|
|
1059
|
-
});
|
|
1060
|
-
expect(envVars.TMPDIR).toBe("/custom/tmp");
|
|
1061
|
-
expect(envVars.TMP).toBe("/custom/tmp");
|
|
1062
|
-
expect(envVars.TEMP).toBe("/custom/tmp");
|
|
1063
|
-
});
|
|
1064
|
-
|
|
1065
|
-
test("overrides.envVars merges with defaults for copilot", () => {
|
|
1066
|
-
const { envVars } = buildPaneCommand("copilot", {
|
|
1067
|
-
envVars: { MY_VAR: "hello" },
|
|
1068
|
-
});
|
|
1069
|
-
// Default copilot env var preserved
|
|
1070
|
-
expect(envVars.COPILOT_ALLOW_ALL).toBe("true");
|
|
1071
|
-
// Override merged in
|
|
1072
|
-
expect(envVars.MY_VAR).toBe("hello");
|
|
1073
|
-
});
|
|
1074
|
-
|
|
1075
|
-
test("overrides.chatFlags replaces defaults for copilot", () => {
|
|
1076
|
-
const { command } = buildPaneCommand("copilot", {
|
|
1077
|
-
chatFlags: ["--custom-flag"],
|
|
1078
|
-
});
|
|
1079
|
-
expect(command).toContain("--custom-flag");
|
|
1080
|
-
// Default flags should be absent
|
|
1081
|
-
expect(command).not.toContain("--add-dir");
|
|
1082
|
-
});
|
|
1083
|
-
|
|
1084
|
-
test("extraChatFlags appended to copilot command", () => {
|
|
1085
|
-
const { command } = buildPaneCommand("copilot", {}, ["--extra-flag"]);
|
|
1086
|
-
expect(command).toContain("--extra-flag");
|
|
1087
|
-
});
|
|
1088
|
-
|
|
1089
|
-
test("extraChatFlags not appended to opencode command", () => {
|
|
1090
|
-
const { command } = buildPaneCommand("opencode", {}, ["--extra-flag"]);
|
|
1091
|
-
expect(command).not.toContain("--extra-flag");
|
|
1092
|
-
});
|
|
1093
|
-
|
|
1094
|
-
test("copilot: respects COPILOT_CLI_PATH env var for binary resolution", () => {
|
|
1095
|
-
const origCliPath = process.env["COPILOT_CLI_PATH"];
|
|
1096
|
-
process.env["COPILOT_CLI_PATH"] = "/custom/path/copilot";
|
|
1097
|
-
try {
|
|
1098
|
-
const { command } = buildPaneCommand("copilot");
|
|
1099
|
-
// The command should start with the COPILOT_CLI_PATH binary.
|
|
1100
|
-
expect(command.startsWith("/custom/path/copilot ")).toBe(true);
|
|
1101
|
-
} finally {
|
|
1102
|
-
if (origCliPath === undefined) delete process.env["COPILOT_CLI_PATH"];
|
|
1103
|
-
else process.env["COPILOT_CLI_PATH"] = origCliPath;
|
|
1104
|
-
}
|
|
1105
|
-
});
|
|
1106
|
-
});
|
|
1107
|
-
|
|
1108
|
-
// ---------------------------------------------------------------------------
|
|
1109
|
-
// waitForServer
|
|
1110
|
-
// ---------------------------------------------------------------------------
|
|
1111
|
-
|
|
1112
|
-
// Three non-empty lines — enough to break the TUI-render loop.
|
|
1113
|
-
const PANE_CONTENT_READY = "line one\nline two\nline three\n";
|
|
1114
|
-
|
|
1115
|
-
// ---------------------------------------------------------------------------
|
|
1116
|
-
// waitForServer — module-level captures for mock.module cleanup
|
|
1117
|
-
// ---------------------------------------------------------------------------
|
|
1118
|
-
|
|
1119
|
-
// Snapshot the real function values BEFORE any mock.module call.
|
|
1120
|
-
// We can't hold the module namespace reference because mock.module mutates it
|
|
1121
|
-
// in-place, so we must copy the property values into a plain object snapshot.
|
|
1122
|
-
const _tmuxMod = await import("./tmux.ts");
|
|
1123
|
-
const realTmuxSnapshot = { ..._tmuxMod };
|
|
1124
|
-
const _portMod = await import("./port-discovery.ts");
|
|
1125
|
-
const realPortDiscoverySnapshot = { ..._portMod };
|
|
1126
|
-
let realCopilotSdkSnapshot: Record<string, unknown> | null = null;
|
|
1127
|
-
try {
|
|
1128
|
-
const _copilotMod = await import("@github/copilot-sdk");
|
|
1129
|
-
realCopilotSdkSnapshot = { ..._copilotMod };
|
|
1130
|
-
} catch {
|
|
1131
|
-
// optional dependency — not installed in all environments
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
describe("waitForServer", () => {
|
|
1135
|
-
// Save and restore Bun.sleep so we can make it instant in async tests.
|
|
1136
|
-
let originalSleep: typeof Bun.sleep;
|
|
1137
|
-
|
|
1138
|
-
beforeEach(() => {
|
|
1139
|
-
originalSleep = Bun.sleep;
|
|
1140
|
-
// Make Bun.sleep a no-op so probe retry loops resolve immediately.
|
|
1141
|
-
(globalThis as { Bun: { sleep: (ms: number) => Promise<void> } }).Bun.sleep =
|
|
1142
|
-
() => Promise.resolve();
|
|
1143
|
-
});
|
|
1144
|
-
|
|
1145
|
-
afterEach(() => {
|
|
1146
|
-
(globalThis as { Bun: { sleep: typeof Bun.sleep } }).Bun.sleep =
|
|
1147
|
-
originalSleep;
|
|
1148
|
-
// Restore module mocks so they don't leak into subsequent test files.
|
|
1149
|
-
// Use snapshot copies (not live references) because mock.module mutates
|
|
1150
|
-
// the module namespace in-place.
|
|
1151
|
-
mock.module("./tmux.ts", () => realTmuxSnapshot);
|
|
1152
|
-
mock.module("./port-discovery.ts", () => realPortDiscoverySnapshot);
|
|
1153
|
-
if (realCopilotSdkSnapshot !== null) {
|
|
1154
|
-
mock.module("@github/copilot-sdk", () => realCopilotSdkSnapshot!);
|
|
1155
|
-
}
|
|
1156
|
-
});
|
|
1157
|
-
|
|
1158
|
-
test('returns "" immediately for agent "claude" without touching tmux', async () => {
|
|
1159
|
-
// No mocks for tmux — any call would throw because real tmux isn't running.
|
|
1160
|
-
const result = await waitForServer("claude", "%0");
|
|
1161
|
-
expect(result).toBe("");
|
|
1162
|
-
});
|
|
1163
|
-
|
|
1164
|
-
test("copilot: throws when getPanePid returns null", async () => {
|
|
1165
|
-
mock.module("./tmux.ts", () => ({
|
|
1166
|
-
capturePane: () => PANE_CONTENT_READY,
|
|
1167
|
-
getPanePid: () => null,
|
|
1168
|
-
// preserve other named exports as stubs
|
|
1169
|
-
spawnMuxAttach: () => {},
|
|
1170
|
-
}));
|
|
1171
|
-
|
|
1172
|
-
let err: Error | undefined;
|
|
1173
|
-
try {
|
|
1174
|
-
await waitForServer("copilot", "%0");
|
|
1175
|
-
} catch (e) {
|
|
1176
|
-
err = e as Error;
|
|
1177
|
-
}
|
|
1178
|
-
expect(err?.message).toContain("failed to resolve agent PID");
|
|
1179
|
-
});
|
|
1180
|
-
|
|
1181
|
-
test("copilot: throws when port discovery times out (getListeningPortForPid returns null)", async () => {
|
|
1182
|
-
mock.module("./tmux.ts", () => ({
|
|
1183
|
-
capturePane: () => PANE_CONTENT_READY,
|
|
1184
|
-
getPanePid: () => 12345,
|
|
1185
|
-
spawnMuxAttach: () => {},
|
|
1186
|
-
}));
|
|
1187
|
-
|
|
1188
|
-
mock.module("./port-discovery.ts", () => ({
|
|
1189
|
-
getListeningPortForPid: async () => null,
|
|
1190
|
-
PORT_DISCOVERY_TIMEOUT_MS: 100,
|
|
1191
|
-
}));
|
|
1192
|
-
|
|
1193
|
-
let err: Error | undefined;
|
|
1194
|
-
try {
|
|
1195
|
-
await waitForServer("copilot", "%0");
|
|
1196
|
-
} catch (e) {
|
|
1197
|
-
err = e as Error;
|
|
1198
|
-
}
|
|
1199
|
-
expect(err?.message).toContain("did not bind a TCP port");
|
|
1200
|
-
});
|
|
1201
|
-
|
|
1202
|
-
test("copilot: throws when SDK probe fails (CopilotClient.start rejects)", async () => {
|
|
1203
|
-
mock.module("./tmux.ts", () => ({
|
|
1204
|
-
capturePane: () => PANE_CONTENT_READY,
|
|
1205
|
-
getPanePid: () => 12345,
|
|
1206
|
-
spawnMuxAttach: () => {},
|
|
1207
|
-
}));
|
|
1208
|
-
|
|
1209
|
-
mock.module("./port-discovery.ts", () => ({
|
|
1210
|
-
getListeningPortForPid: async () => 50001,
|
|
1211
|
-
PORT_DISCOVERY_TIMEOUT_MS: 100,
|
|
1212
|
-
}));
|
|
1213
|
-
|
|
1214
|
-
mock.module("@github/copilot-sdk", () => ({
|
|
1215
|
-
CopilotClient: class {
|
|
1216
|
-
start() {
|
|
1217
|
-
return Promise.reject(new Error("connection refused"));
|
|
1218
|
-
}
|
|
1219
|
-
listSessions() {
|
|
1220
|
-
return Promise.resolve([]);
|
|
1221
|
-
}
|
|
1222
|
-
stop() {
|
|
1223
|
-
return Promise.resolve();
|
|
1224
|
-
}
|
|
1225
|
-
},
|
|
1226
|
-
}));
|
|
1227
|
-
|
|
1228
|
-
// SERVER_PROBE_TIMEOUT_MS is 60_000 but Bun.sleep is mocked to instant,
|
|
1229
|
-
// so the loop burns through retries until Date.now() passes the deadline.
|
|
1230
|
-
// To avoid a real 60s wall-clock wait we mock Date.now temporarily.
|
|
1231
|
-
const realDateNow = Date.now;
|
|
1232
|
-
let callCount = 0;
|
|
1233
|
-
Date.now = () => {
|
|
1234
|
-
callCount++;
|
|
1235
|
-
// First few calls (port-deadline checks, probe-deadline setup): allow.
|
|
1236
|
-
// After 10 calls assume probe deadline has passed.
|
|
1237
|
-
return callCount > 10 ? realDateNow() + 999_999 : realDateNow();
|
|
1238
|
-
};
|
|
1239
|
-
|
|
1240
|
-
let err: Error | undefined;
|
|
1241
|
-
try {
|
|
1242
|
-
try {
|
|
1243
|
-
await waitForServer("copilot", "%0");
|
|
1244
|
-
} catch (e) {
|
|
1245
|
-
err = e as Error;
|
|
1246
|
-
}
|
|
1247
|
-
} finally {
|
|
1248
|
-
Date.now = realDateNow;
|
|
1249
|
-
}
|
|
1250
|
-
expect(err?.message).toContain("copilot SDK probe did not respond");
|
|
1251
|
-
});
|
|
1252
|
-
|
|
1253
|
-
test("copilot: returns localhost:<port> when SDK probe succeeds", async () => {
|
|
1254
|
-
mock.module("./tmux.ts", () => ({
|
|
1255
|
-
capturePane: () => PANE_CONTENT_READY,
|
|
1256
|
-
getPanePid: () => 12345,
|
|
1257
|
-
spawnMuxAttach: () => {},
|
|
1258
|
-
}));
|
|
1259
|
-
|
|
1260
|
-
mock.module("./port-discovery.ts", () => ({
|
|
1261
|
-
getListeningPortForPid: async () => 50001,
|
|
1262
|
-
PORT_DISCOVERY_TIMEOUT_MS: 100,
|
|
1263
|
-
}));
|
|
1264
|
-
|
|
1265
|
-
mock.module("@github/copilot-sdk", () => ({
|
|
1266
|
-
CopilotClient: class {
|
|
1267
|
-
start() {
|
|
1268
|
-
return Promise.resolve();
|
|
1269
|
-
}
|
|
1270
|
-
listSessions() {
|
|
1271
|
-
return Promise.resolve([]);
|
|
1272
|
-
}
|
|
1273
|
-
stop() {
|
|
1274
|
-
return Promise.resolve();
|
|
1275
|
-
}
|
|
1276
|
-
},
|
|
1277
|
-
}));
|
|
1278
|
-
|
|
1279
|
-
const result = await waitForServer("copilot", "%0");
|
|
1280
|
-
expect(result).toBe("localhost:50001");
|
|
1281
|
-
});
|
|
1282
|
-
|
|
1283
|
-
test("copilot: probe does not pass useLoggedInUser to CopilotClient (external server owns auth)", async () => {
|
|
1284
|
-
mock.module("./tmux.ts", () => ({
|
|
1285
|
-
capturePane: () => PANE_CONTENT_READY,
|
|
1286
|
-
getPanePid: () => 12345,
|
|
1287
|
-
spawnMuxAttach: () => {},
|
|
1288
|
-
}));
|
|
1289
|
-
|
|
1290
|
-
mock.module("./port-discovery.ts", () => ({
|
|
1291
|
-
getListeningPortForPid: async () => 50002,
|
|
1292
|
-
PORT_DISCOVERY_TIMEOUT_MS: 100,
|
|
1293
|
-
}));
|
|
1294
|
-
|
|
1295
|
-
let capturedOptions: unknown;
|
|
1296
|
-
mock.module("@github/copilot-sdk", () => ({
|
|
1297
|
-
CopilotClient: class {
|
|
1298
|
-
constructor(opts: unknown) {
|
|
1299
|
-
capturedOptions = opts;
|
|
1300
|
-
}
|
|
1301
|
-
start() {
|
|
1302
|
-
return Promise.resolve();
|
|
1303
|
-
}
|
|
1304
|
-
listSessions() {
|
|
1305
|
-
return Promise.resolve([]);
|
|
1306
|
-
}
|
|
1307
|
-
stop() {
|
|
1308
|
-
return Promise.resolve();
|
|
1309
|
-
}
|
|
1310
|
-
},
|
|
1311
|
-
}));
|
|
1312
|
-
|
|
1313
|
-
await waitForServer("copilot", "%0");
|
|
1314
|
-
const opts = capturedOptions as Record<string, unknown>;
|
|
1315
|
-
expect(opts).toBeDefined();
|
|
1316
|
-
// cliUrl must be set — connecting to an existing server
|
|
1317
|
-
expect(opts["cliUrl"]).toBe("localhost:50002");
|
|
1318
|
-
// useLoggedInUser must NOT be set — external server owns auth
|
|
1319
|
-
expect(Object.prototype.hasOwnProperty.call(opts, "useLoggedInUser")).toBe(false);
|
|
1320
|
-
});
|
|
1321
|
-
});
|