literally-aeo 0.2.2 → 0.4.0
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/README.md +183 -14
- package/dist/author-tools.js +386 -283
- package/dist/cli.mjs +19943 -16532
- package/dist/lib/access/schema.js +6 -6
- package/dist/lib/agents/author-schema.js +12 -12
- package/dist/lib/agents/author-validation.js +15 -15
- package/dist/lib/agents/copy-validation.js +18 -17
- package/dist/lib/agents/copywriter-input.js +16 -15
- package/dist/lib/agents/credentials.js +1 -1
- package/dist/lib/agents/facts.js +15 -14
- package/dist/lib/agents/methodology.js +56 -0
- package/dist/lib/agents/narrative-facts.js +13 -13
- package/dist/lib/agents/verifier.js +22 -20
- package/dist/lib/analysis/domain-classifier.js +21 -19
- package/dist/lib/analysis/domain-labels.js +12 -12
- package/dist/lib/analysis/outreach.js +2 -2
- package/dist/lib/analysis/progress-schema.js +6 -2
- package/dist/lib/analysis/progress.js +17 -16
- package/dist/lib/analysis/rate-evidence.js +6 -0
- package/dist/lib/analysis/retrieval.js +12 -12
- package/dist/lib/analysis/scoring.js +12 -12
- package/dist/lib/analysis/search-analyzer.js +13 -13
- package/dist/lib/analysis/sentiment.js +20 -18
- package/dist/lib/analysis/source-mix.js +2 -2
- package/dist/lib/author/examples.js +13 -13
- package/dist/lib/bundle/contracts.js +19 -13
- package/dist/lib/bundle/export.js +86 -31
- package/dist/lib/bundle/isolation.js +2 -2
- package/dist/lib/bundle/journal.js +14 -14
- package/dist/lib/bundle/project-journal.js +18 -18
- package/dist/lib/bundle/project.js +87 -30
- package/dist/lib/bundle/read.js +87 -32
- package/dist/lib/bundle/recorder.js +16 -16
- package/dist/lib/bundle/redact.js +14 -14
- package/dist/lib/bundle/trace-coverage.js +14 -14
- package/dist/lib/bundle/verify-integrity.js +17 -17
- package/dist/lib/bundle/verify-measurement.js +31 -22
- package/dist/lib/bundle/verify-report.js +36 -26
- package/dist/lib/bundle/verify.js +45 -35
- package/dist/lib/capture-manifest.js +13 -13
- package/dist/lib/checks/crawler-access.js +2 -2
- package/dist/lib/checks/renderability.js +2 -2
- package/dist/lib/checks/run-checks.js +20 -20
- package/dist/lib/chunks/{chunk-4XIAXX7K.js → chunk-2A327DMI.js} +1 -1
- package/dist/lib/chunks/{chunk-7WO3FFPS.js → chunk-2FK6QVU6.js} +3 -3
- package/dist/lib/chunks/{chunk-F2NSJ6PG.js → chunk-2WS6RC35.js} +8 -4
- package/dist/lib/chunks/{chunk-6EI4CVRW.js → chunk-3ESH5NDR.js} +5 -1
- package/dist/lib/chunks/{chunk-WIBMVNIH.js → chunk-3F5ZP2EO.js} +4 -4
- package/dist/lib/chunks/{chunk-ZXQPD4OC.js → chunk-3TF4JGQA.js} +126 -5
- package/dist/lib/chunks/{chunk-BFWK3TBN.js → chunk-3YPAIXFG.js} +8 -8
- package/dist/lib/chunks/{chunk-PIFTG6YW.js → chunk-4332MUTU.js} +4 -4
- package/dist/lib/chunks/{chunk-K2FZFESR.js → chunk-4MOZ3DVS.js} +8 -7
- package/dist/lib/chunks/{chunk-KFAT65P7.js → chunk-4SCPKDJV.js} +1 -1
- package/dist/lib/chunks/{chunk-6HMHXSCS.js → chunk-4ZR2LPUD.js} +3 -3
- package/dist/lib/chunks/{chunk-QGZ4QSUE.js → chunk-55KFAM4X.js} +36 -5
- package/dist/lib/chunks/{chunk-FJL2V6P5.js → chunk-66OL2XA6.js} +13 -8
- package/dist/lib/chunks/{chunk-4QQJXCD2.js → chunk-6FRZN5SA.js} +13 -28
- package/dist/lib/chunks/{chunk-3OE4UQIB.js → chunk-6FXNXXY7.js} +116 -7
- package/dist/lib/chunks/chunk-6TJXJZUL.js +97 -0
- package/dist/lib/chunks/{chunk-YKJHFD64.js → chunk-72ZLXWD4.js} +21 -4
- package/dist/lib/chunks/{chunk-2FOKEIIN.js → chunk-744YWRX7.js} +1 -1
- package/dist/lib/chunks/{chunk-I3UE52ZV.js → chunk-77EQ3RT6.js} +4 -4
- package/dist/lib/chunks/{chunk-AJO7XVXK.js → chunk-7GHR6MOG.js} +12 -12
- package/dist/lib/chunks/{chunk-JYCVBFH5.js → chunk-7GJTWUI4.js} +2 -2
- package/dist/lib/chunks/{chunk-UNCUG2YS.js → chunk-7NQOQNE7.js} +3 -3
- package/dist/lib/chunks/chunk-7Y3S7LD5.js +160 -0
- package/dist/lib/chunks/{chunk-U64NCRRR.js → chunk-7ZQAAEOK.js} +7 -6
- package/dist/lib/chunks/{chunk-MENTBQGB.js → chunk-A4QTI7FN.js} +78 -19
- package/dist/lib/chunks/{chunk-Y2CZ6FZY.js → chunk-ADNYALFZ.js} +36 -7
- package/dist/lib/chunks/{chunk-CH7OCYDL.js → chunk-B5ZAFK6T.js} +1 -1
- package/dist/lib/chunks/{chunk-WDT2Y7D7.js → chunk-B6YKBZXD.js} +20 -11
- package/dist/lib/chunks/{chunk-ZSEY7AHQ.js → chunk-BBK54RVK.js} +14 -11
- package/dist/lib/chunks/{chunk-YGLWQFKL.js → chunk-BE7EDOJY.js} +3 -3
- package/dist/lib/chunks/{chunk-OD36HUXA.js → chunk-BECSPYFC.js} +7 -8
- package/dist/lib/chunks/{chunk-HGGOGCPX.js → chunk-BNKNZTYH.js} +17 -14
- package/dist/lib/chunks/{chunk-2KH7LNK7.js → chunk-BOLZJBPS.js} +56 -15
- package/dist/lib/chunks/chunk-BQMUZLHO.js +17 -0
- package/dist/lib/chunks/chunk-C22Q3TKU.js +90 -0
- package/dist/lib/chunks/chunk-C3AZMWQJ.js +109 -0
- package/dist/lib/chunks/{chunk-T6XZQOXS.js → chunk-CCSF7LP5.js} +7 -7
- package/dist/lib/chunks/{chunk-JBOOD6MU.js → chunk-CHDK5EQK.js} +57 -16
- package/dist/lib/chunks/{chunk-NZFMOQHU.js → chunk-CWEVVIZI.js} +11 -1
- package/dist/lib/chunks/{chunk-75DMLOQ7.js → chunk-CYJNBVQB.js} +1 -1
- package/dist/lib/chunks/{chunk-66T7JC57.js → chunk-CZRHH5HF.js} +85 -5
- package/dist/lib/chunks/{chunk-FAUFE7MI.js → chunk-D7N5OLYL.js} +1 -1
- package/dist/lib/chunks/chunk-DBQ3HVPX.js +73 -0
- package/dist/lib/chunks/{chunk-PKNODC6Y.js → chunk-DC6CS6GC.js} +1 -1
- package/dist/lib/chunks/{chunk-7YDXD4MD.js → chunk-DHQKAIOP.js} +2 -2
- package/dist/lib/chunks/{chunk-LTCDLURT.js → chunk-DIR4UIRF.js} +73 -24
- package/dist/lib/chunks/{chunk-E2YTTB6Q.js → chunk-DSK3PM4Z.js} +1 -1
- package/dist/lib/chunks/chunk-DWOTAT7R.js +312 -0
- package/dist/lib/chunks/chunk-E2JICEL3.js +446 -0
- package/dist/lib/chunks/{chunk-HXHFMFQU.js → chunk-E5COBP7A.js} +13 -2
- package/dist/lib/chunks/{chunk-XAN4CRFP.js → chunk-EUHVUF7I.js} +1 -1
- package/dist/lib/chunks/{chunk-TNL2GWYR.js → chunk-EUXNCXCR.js} +22 -0
- package/dist/lib/chunks/chunk-F3MHGDZG.js +97 -0
- package/dist/lib/chunks/chunk-F7LCGM6W.js +120 -0
- package/dist/lib/chunks/chunk-FJAZEGU6.js +354 -0
- package/dist/lib/chunks/chunk-FOJVAGAD.js +91 -0
- package/dist/lib/chunks/chunk-FXR6P7HY.js +14 -0
- package/dist/lib/chunks/chunk-GC4XJYQW.js +145 -0
- package/dist/lib/chunks/chunk-GQZHZSAQ.js +108 -0
- package/dist/lib/chunks/{chunk-BRENK356.js → chunk-GZC3ASNL.js} +1 -1
- package/dist/lib/chunks/{chunk-3CMPR6ZZ.js → chunk-H2JJCIZW.js} +1 -1
- package/dist/lib/chunks/{chunk-XSER7WEB.js → chunk-H33MFLSH.js} +12 -12
- package/dist/lib/chunks/chunk-H4IE2JE6.js +118 -0
- package/dist/lib/chunks/chunk-H4LZ3U26.js +31 -0
- package/dist/lib/chunks/{chunk-XFUYEFQP.js → chunk-HHGLGVOZ.js} +1 -1
- package/dist/lib/chunks/{chunk-52F5XYOW.js → chunk-I2KRWXXO.js} +15 -7
- package/dist/lib/chunks/chunk-IDNT2WBK.js +27 -0
- package/dist/lib/chunks/{chunk-R5UPOEWE.js → chunk-IUQ6C4Y6.js} +14 -4
- package/dist/lib/chunks/chunk-IXYVHA7C.js +101 -0
- package/dist/lib/chunks/{chunk-FDM2YNQL.js → chunk-J3BZ3WPV.js} +1 -1
- package/dist/lib/chunks/{chunk-U6BW6LGX.js → chunk-J63WQUKR.js} +10 -3
- package/dist/lib/chunks/{chunk-OOLWU667.js → chunk-JBEKIT7Z.js} +10 -10
- package/dist/lib/chunks/chunk-JEAZREDN.js +94 -0
- package/dist/lib/chunks/{chunk-2B5QF6UQ.js → chunk-JFUWSJZT.js} +46 -5
- package/dist/lib/chunks/{chunk-SIJOQRRK.js → chunk-JHOLYLI4.js} +4 -2
- package/dist/lib/chunks/chunk-JOLIDHZV.js +39 -0
- package/dist/lib/chunks/{chunk-HCUJ2J7P.js → chunk-JWH33YCK.js} +17 -16
- package/dist/lib/chunks/{chunk-HGGRPOSA.js → chunk-K5K27WBZ.js} +10 -9
- package/dist/lib/chunks/{chunk-7HM6IZ3L.js → chunk-KU53HTUY.js} +2 -2
- package/dist/lib/chunks/{chunk-PIF3GL62.js → chunk-LJTFZ52Y.js} +24 -12
- package/dist/lib/chunks/chunk-LMUTZ6O2.js +335 -0
- package/dist/lib/chunks/chunk-LTPLZSXI.js +86 -0
- package/dist/lib/chunks/{chunk-RXSHKWZJ.js → chunk-M3WZCV65.js} +3 -3
- package/dist/lib/chunks/{chunk-ZOGIJGU3.js → chunk-MN3YGXJH.js} +17 -17
- package/dist/lib/chunks/{chunk-ZQ3ER7JD.js → chunk-MSEGYN6W.js} +32 -14
- package/dist/lib/chunks/{chunk-JQDQVG3D.js → chunk-MWZIVYMK.js} +1 -1
- package/dist/lib/chunks/{chunk-WCLKIPJV.js → chunk-MX6YA6YH.js} +1 -1
- package/dist/lib/chunks/{chunk-GEFKDW7X.js → chunk-N4PQ6RPQ.js} +14 -2
- package/dist/lib/chunks/{chunk-EDQTINTL.js → chunk-N5IAPSLM.js} +52 -6
- package/dist/lib/chunks/{chunk-V5JJEEBT.js → chunk-NAPYHYA5.js} +6 -5
- package/dist/lib/chunks/{chunk-LR27H2HZ.js → chunk-NWUZJUJX.js} +8 -8
- package/dist/lib/chunks/{chunk-U5USH2HB.js → chunk-NZTOOSLX.js} +3 -3
- package/dist/lib/chunks/{chunk-S6QOXJAL.js → chunk-OQVEYTVV.js} +16 -7
- package/dist/lib/chunks/{chunk-GLUGYZQO.js → chunk-OXPPUUIO.js} +48 -60
- package/dist/lib/chunks/chunk-PPTUCXWS.js +95 -0
- package/dist/lib/chunks/{chunk-W5XYW6ZM.js → chunk-PT6PK2MJ.js} +26 -19
- package/dist/lib/chunks/{chunk-7DNLRXEY.js → chunk-PUZBLM7E.js} +9 -6
- package/dist/lib/chunks/{chunk-7YZPEX3T.js → chunk-PVW5W2MX.js} +9 -4
- package/dist/lib/chunks/{chunk-YEUCAPKP.js → chunk-QFIJSLAR.js} +26 -6
- package/dist/lib/chunks/{chunk-J5NPHPXY.js → chunk-QTUWCZ3X.js} +43 -8
- package/dist/lib/chunks/{chunk-6GKKALCI.js → chunk-R4BFYHLK.js} +2 -2
- package/dist/lib/chunks/chunk-R75F4MKU.js +162 -0
- package/dist/lib/chunks/{chunk-V5B6UZ3E.js → chunk-RQGEPR6V.js} +1 -0
- package/dist/lib/chunks/{chunk-TAPVCSCR.js → chunk-SCZ7PA4T.js} +1 -1
- package/dist/lib/chunks/{chunk-K4Y5NT4M.js → chunk-SFPPZGTA.js} +112 -26
- package/dist/lib/chunks/chunk-SN3DKEOY.js +11 -0
- package/dist/lib/chunks/{chunk-UYDQXXDQ.js → chunk-ST6IVXHT.js} +1 -1
- package/dist/lib/chunks/chunk-SXCTAL6V.js +116 -0
- package/dist/lib/chunks/chunk-SXVKFPC4.js +288 -0
- package/dist/lib/chunks/chunk-T4Z3GAEH.js +292 -0
- package/dist/lib/chunks/{chunk-RK57YZKM.js → chunk-T7DNKNMG.js} +81 -26
- package/dist/lib/chunks/{chunk-DL6YQDTE.js → chunk-TPPBTN3E.js} +50 -21
- package/dist/lib/chunks/{chunk-J7QKT5E7.js → chunk-UBH2P5IR.js} +91 -32
- package/dist/lib/chunks/{chunk-BYHXNFWN.js → chunk-UIXTXI7P.js} +9 -7
- package/dist/lib/chunks/chunk-UWXR24TV.js +38 -0
- package/dist/lib/chunks/chunk-V57HW7T4.js +86 -0
- package/dist/lib/chunks/{chunk-XA27KAUV.js → chunk-VCFLUGLQ.js} +80 -48
- package/dist/lib/chunks/{chunk-VL253W5C.js → chunk-VMDGYDZW.js} +3 -1
- package/dist/lib/chunks/{chunk-RIJERFGU.js → chunk-W6TGEP5C.js} +96 -26
- package/dist/lib/chunks/chunk-WB4ZBRF6.js +338 -0
- package/dist/lib/chunks/{chunk-F7DBTXKG.js → chunk-WQTDLVKV.js} +4 -3
- package/dist/lib/chunks/{chunk-VXYQWE45.js → chunk-WRH4CIFQ.js} +3 -3
- package/dist/lib/chunks/{chunk-JKPBXPCW.js → chunk-WSFXGX7S.js} +3 -3
- package/dist/lib/chunks/{chunk-BXF4OC74.js → chunk-WSWQCHSW.js} +32 -17
- package/dist/lib/chunks/{chunk-EOO5RBUW.js → chunk-WTAIFAQV.js} +42 -6
- package/dist/lib/chunks/{chunk-7YYDUHJG.js → chunk-WZA4H4TG.js} +39 -13
- package/dist/lib/chunks/{chunk-RYCRL3YA.js → chunk-X3HRV5CF.js} +12 -4
- package/dist/lib/chunks/{chunk-S2SFHTJD.js → chunk-XPUCJQIB.js} +39 -1
- package/dist/lib/chunks/{chunk-PWOYEIPF.js → chunk-Y2NZTYKV.js} +8 -8
- package/dist/lib/chunks/chunk-YLS4XX7B.js +105 -0
- package/dist/lib/chunks/{chunk-7CW6U5WJ.js → chunk-YPMRZX4U.js} +1 -1
- package/dist/lib/chunks/{chunk-SASE7U6E.js → chunk-YQD5ITKI.js} +1 -1
- package/dist/lib/chunks/{chunk-LTI2YYU3.js → chunk-YTEUQEJE.js} +1 -1
- package/dist/lib/chunks/{chunk-4GLW3ZRO.js → chunk-YYP547FI.js} +146 -22
- package/dist/lib/chunks/{chunk-QD3JXA3Y.js → chunk-ZDCKZEDJ.js} +56 -36
- package/dist/lib/chunks/{chunk-AT3XMGES.js → chunk-ZWTNELCS.js} +12 -6
- package/dist/lib/chunks/{chunk-VHKHYAC5.js → chunk-ZWWIXFCV.js} +3 -3
- package/dist/lib/chunks/{chunk-MA27TFEY.js → chunk-ZXL6FZX4.js} +8 -1
- package/dist/lib/cli/bundle-commands.js +137 -111
- package/dist/lib/cli/guide-command.js +1 -1
- package/dist/lib/cli/io.js +1 -1
- package/dist/lib/cli/run-commands.js +349 -168
- package/dist/lib/cli/status-command.js +114 -87
- package/dist/lib/codex-workflow/aggregate.js +41 -24
- package/dist/lib/codex-workflow/author-search.js +1 -1
- package/dist/lib/codex-workflow/author-tools.js +14 -14
- package/dist/lib/codex-workflow/author.js +35 -32
- package/dist/lib/codex-workflow/capture.js +53 -28
- package/dist/lib/codex-workflow/checkpoint.js +14 -14
- package/dist/lib/codex-workflow/checks.js +16 -16
- package/dist/lib/codex-workflow/copy-editor.js +29 -26
- package/dist/lib/codex-workflow/copy-recovery.js +13 -13
- package/dist/lib/codex-workflow/copy.js +32 -23
- package/dist/lib/codex-workflow/finish.js +67 -37
- package/dist/lib/codex-workflow/host-models.js +2 -2
- package/dist/lib/codex-workflow/loop.js +96 -72
- package/dist/lib/codex-workflow/prompts.js +1 -1
- package/dist/lib/codex-workflow/quality.js +13 -13
- package/dist/lib/codex-workflow/run-inputs.js +13 -13
- package/dist/lib/codex-workflow/run-source.js +24 -24
- package/dist/lib/codex-workflow/schemas.js +13 -13
- package/dist/lib/codex-workflow/session.js +15 -15
- package/dist/lib/codex-workflow/stage.js +49 -46
- package/dist/lib/codex-workflow/workdir.js +25 -18
- package/dist/lib/engine/audit-file.js +50 -16
- package/dist/lib/engine/author.js +77 -57
- package/dist/lib/engine/budget.js +3 -1
- package/dist/lib/engine/cost-estimate.js +46 -16
- package/dist/lib/engine/local-run.js +113 -85
- package/dist/lib/engine/preflight.js +47 -17
- package/dist/lib/engine/rejudge.js +121 -92
- package/dist/lib/engine/run-bindings.js +66 -0
- package/dist/lib/engine/run-configuration.js +3 -1
- package/dist/lib/engine/run-method.js +67 -0
- package/dist/lib/engine/run-models.js +48 -0
- package/dist/lib/engine/run-status.js +112 -85
- package/dist/lib/engine/templates.js +47 -17
- package/dist/lib/grounding/controller.js +10 -9
- package/dist/lib/grounding/extract.js +10 -8
- package/dist/lib/grounding/grounding-runtime.js +32 -31
- package/dist/lib/grounding/model-usage.js +2 -2
- package/dist/lib/grounding/model.js +9 -7
- package/dist/lib/grounding/recorded-tools.js +17 -17
- package/dist/lib/grounding/tools.js +5 -1
- package/dist/lib/harness/report/artifacts.js +12 -12
- package/dist/lib/harness/report/capture-coverage.js +4 -4
- package/dist/lib/lib/checkpoint.js +12 -12
- package/dist/lib/lib/compare.js +6 -0
- package/dist/lib/lib/log.js +1 -1
- package/dist/lib/lib/progress-comparison.js +3 -2
- package/dist/lib/models/accounting.js +1 -1
- package/dist/lib/models/batching.js +7 -5
- package/dist/lib/models/budget-protection.js +1 -1
- package/dist/lib/models/catalog.js +16 -0
- package/dist/lib/models/cost-coefficients.js +12 -1
- package/dist/lib/models/gateway-cost.js +7 -0
- package/dist/lib/models/local-profile.js +2 -2
- package/dist/lib/models/open-model.js +7 -0
- package/dist/lib/models/profiles.js +3 -1
- package/dist/lib/models/structured.js +6 -4
- package/dist/lib/models/supported-models.js +2 -2
- package/dist/lib/pipeline.js +50 -27
- package/dist/lib/probes/adapter.js +6 -0
- package/dist/lib/probes/adapters/cli-agents.js +44 -0
- package/dist/lib/probes/adapters/cli-claude-code.js +22 -0
- package/dist/lib/probes/adapters/cli-codex.js +24 -0
- package/dist/lib/probes/adapters/cli-cursor.js +22 -0
- package/dist/lib/probes/adapters/cli-process.js +35 -0
- package/dist/lib/probes/adapters/dataforseo-ai-mode.js +24 -0
- package/dist/lib/probes/adapters/dataforseo-ai-overview.js +21 -0
- package/dist/lib/probes/adapters/dataforseo-chatgpt-app.js +22 -0
- package/dist/lib/probes/adapters/gateway-chat.js +33 -0
- package/dist/lib/probes/adapters/gateway-perplexity.js +20 -0
- package/dist/lib/probes/agent-cli-parsers.js +4 -3
- package/dist/lib/probes/agent-clis.js +34 -19
- package/dist/lib/probes/answer-text.js +22 -0
- package/dist/lib/probes/attempt.js +29 -0
- package/dist/lib/probes/bindings.js +101 -0
- package/dist/lib/probes/charged-trace.js +49 -3
- package/dist/lib/probes/chat-retrieval.js +7 -2
- package/dist/lib/probes/dataforseo-locale.js +9 -3
- package/dist/lib/probes/dataforseo.js +16 -5
- package/dist/lib/probes/grounding-urls.js +6 -4
- package/dist/lib/probes/legacy-bindings.js +7 -0
- package/dist/lib/probes/limits.js +1 -1
- package/dist/lib/probes/probes.js +42 -19
- package/dist/lib/probes/web-tool-guard.js +3 -3
- package/dist/lib/report/contracts.js +7 -7
- package/dist/lib/report/core/progress-comparison.js +3 -2
- package/dist/lib/report/core/progress-schema.js +6 -2
- package/dist/lib/report/core/progress-statistics.js +8 -0
- package/dist/lib/report/core/rate-interval.js +6 -0
- package/dist/lib/report/core/retrieval.js +4 -1
- package/dist/lib/report/core/schema.js +23 -3
- package/dist/lib/report/core/surfaces.js +23 -1
- package/dist/lib/retrieval.js +4 -1
- package/dist/lib/runner.js +28 -25
- package/dist/lib/schema.js +37 -13
- package/dist/lib/section-result.js +15 -13
- package/dist/lib/stores/artifacts.js +15 -15
- package/dist/lib/stores/files.js +31 -27
- package/dist/lib/stores/local-versions.js +12 -12
- package/dist/lib/stores/memory.js +33 -27
- package/dist/lib/stores/publication.js +19 -18
- package/dist/lib/stores/unit-record.js +28 -0
- package/dist/lib/surfaces.js +23 -1
- package/dist/lib/viewer/page.js +1 -1
- package/dist/lib/viewer/server.js +47 -37
- package/dist/lib/workflow/schema.js +10 -10
- package/dist/types/agents/author-schema.d.ts +10 -10
- package/dist/types/agents/facts.d.ts +1 -1
- package/dist/types/agents/methodology.d.ts +26 -0
- package/dist/types/agents/verifier.d.ts +1 -1
- package/dist/types/analysis/domain-labels.d.ts +1 -1
- package/dist/types/analysis/rate-evidence.d.ts +11 -0
- package/dist/types/analysis/scoring.d.ts +17 -0
- package/dist/types/analysis/sentiment.d.ts +8 -4
- package/dist/types/bundle/contracts.d.ts +42 -20
- package/dist/types/bundle/project.d.ts +6 -0
- package/dist/types/bundle/recorder.d.ts +1 -1
- package/dist/types/bundle/trace-coverage.d.ts +4 -2
- package/dist/types/capture-manifest.d.ts +9 -4
- package/dist/types/codex-workflow/aggregate.d.ts +90 -12
- package/dist/types/codex-workflow/capture.d.ts +13 -0
- package/dist/types/codex-workflow/copy-editor.d.ts +40 -1
- package/dist/types/codex-workflow/copy.d.ts +136 -1
- package/dist/types/codex-workflow/run-inputs.d.ts +138 -32
- package/dist/types/codex-workflow/schemas.d.ts +20 -20
- package/dist/types/codex-workflow/stage.d.ts +7 -1
- package/dist/types/codex-workflow/workdir.d.ts +0 -1
- package/dist/types/engine/audit-file.d.ts +96 -6
- package/dist/types/engine/budget.d.ts +19 -6
- package/dist/types/engine/cost-estimate.d.ts +15 -2
- package/dist/types/engine/local-run.d.ts +12 -2
- package/dist/types/engine/preflight.d.ts +27 -6
- package/dist/types/engine/run-bindings.d.ts +52 -0
- package/dist/types/engine/run-configuration.d.ts +15 -3
- package/dist/types/engine/run-method.d.ts +58 -0
- package/dist/types/engine/run-models.d.ts +89 -0
- package/dist/types/engine/templates.d.ts +3 -1
- package/dist/types/grounding/tools.d.ts +10 -0
- package/dist/types/harness/report/artifacts.d.ts +48 -24
- package/dist/types/lib/compare.d.ts +3 -0
- package/dist/types/models/accounting.d.ts +7 -0
- package/dist/types/models/catalog.d.ts +52 -0
- package/dist/types/models/cost-coefficients.d.ts +77 -24
- package/dist/types/models/gateway-cost.d.ts +3 -0
- package/dist/types/models/local-profile.d.ts +5 -1
- package/dist/types/models/open-model.d.ts +10 -0
- package/dist/types/models/profiles.d.ts +113 -14
- package/dist/types/models/supported-models.d.ts +13 -3
- package/dist/types/pipeline.d.ts +2 -0
- package/dist/types/probes/adapter.d.ts +121 -0
- package/dist/types/probes/adapters/cli-agents.d.ts +19 -0
- package/dist/types/probes/adapters/cli-claude-code.d.ts +4 -0
- package/dist/types/probes/adapters/cli-codex.d.ts +10 -0
- package/dist/types/probes/adapters/cli-cursor.d.ts +4 -0
- package/dist/types/probes/adapters/cli-process.d.ts +86 -0
- package/dist/types/probes/adapters/dataforseo-ai-mode.d.ts +16 -0
- package/dist/types/probes/adapters/dataforseo-ai-overview.d.ts +12 -0
- package/dist/types/probes/adapters/dataforseo-chatgpt-app.d.ts +12 -0
- package/dist/types/probes/adapters/gateway-chat.d.ts +61 -0
- package/dist/types/probes/adapters/gateway-perplexity.d.ts +10 -0
- package/dist/types/probes/agent-clis.d.ts +7 -49
- package/dist/types/probes/answer-text.d.ts +20 -0
- package/dist/types/probes/attempt.d.ts +113 -0
- package/dist/types/probes/bindings.d.ts +168 -0
- package/dist/types/probes/charged-trace.d.ts +8 -1
- package/dist/types/probes/chat-retrieval.d.ts +2 -0
- package/dist/types/probes/dataforseo-locale.d.ts +16 -0
- package/dist/types/probes/dataforseo.d.ts +66 -1
- package/dist/types/probes/grounding-urls.d.ts +18 -5
- package/dist/types/probes/legacy-bindings.d.ts +36 -0
- package/dist/types/probes/limits.d.ts +12 -6
- package/dist/types/probes/probe-trace.d.ts +13 -0
- package/dist/types/probes/probes.d.ts +7 -5
- package/dist/types/report/contracts.d.ts +184 -30
- package/dist/types/report/core/progress-comparison.d.ts +19 -2
- package/dist/types/report/core/progress-schema.d.ts +13 -5
- package/dist/types/report/core/progress-statistics.d.ts +28 -0
- package/dist/types/report/core/rate-interval.d.ts +10 -0
- package/dist/types/report/core/retrieval.d.ts +5 -2
- package/dist/types/report/core/schema.d.ts +190 -30
- package/dist/types/report/core/surfaces.d.ts +38 -4
- package/dist/types/runner.d.ts +5 -0
- package/dist/types/schema.d.ts +126 -21
- package/dist/types/section-result.d.ts +7 -2
- package/dist/types/stores/ports.d.ts +1 -0
- package/dist/types/stores/unit-record.d.ts +11 -0
- package/dist/types/workflow/schema.d.ts +121 -41
- package/package.json +6 -6
- package/resources/guide/OPERATOR.md +35 -7
- package/src/agents/author-schema.ts +7 -0
- package/src/agents/credentials.ts +18 -3
- package/src/agents/facts.ts +116 -3
- package/src/agents/methodology.ts +168 -0
- package/src/agents/narrative-facts.ts +50 -13
- package/src/agents/verifier.ts +2 -1
- package/src/analysis/progress.ts +14 -2
- package/src/analysis/rate-evidence.ts +74 -0
- package/src/analysis/scoring.ts +53 -10
- package/src/bundle/contracts.ts +42 -5
- package/src/bundle/export.ts +24 -4
- package/src/bundle/project-journal.ts +7 -1
- package/src/bundle/project.ts +76 -7
- package/src/bundle/recorder.ts +50 -1
- package/src/bundle/trace-coverage.ts +13 -6
- package/src/bundle/verify-integrity.ts +1 -0
- package/src/bundle/verify-report.ts +9 -3
- package/src/capture-manifest.ts +6 -0
- package/src/cli/io.ts +2 -0
- package/src/cli/literally-aeo.ts +10 -6
- package/src/cli/run-commands.ts +268 -39
- package/src/codex-workflow/aggregate.ts +108 -15
- package/src/codex-workflow/capture.ts +62 -5
- package/src/codex-workflow/copy-editor.ts +13 -2
- package/src/codex-workflow/copy.ts +171 -2
- package/src/codex-workflow/finish.ts +39 -0
- package/src/codex-workflow/loop.ts +23 -2
- package/src/codex-workflow/prompts.ts +32 -42
- package/src/codex-workflow/schemas.ts +3 -1
- package/src/codex-workflow/stage.ts +40 -45
- package/src/codex-workflow/workdir.ts +3 -4
- package/src/engine/audit-file.ts +186 -13
- package/src/engine/author.ts +5 -2
- package/src/engine/budget.ts +70 -10
- package/src/engine/cost-estimate.ts +39 -9
- package/src/engine/guide/OPERATOR.md +35 -7
- package/src/engine/local-run.ts +109 -13
- package/src/engine/preflight.ts +170 -30
- package/src/engine/rejudge.ts +8 -2
- package/src/engine/run-bindings.ts +189 -0
- package/src/engine/run-configuration.ts +36 -6
- package/src/engine/run-method.ts +230 -0
- package/src/engine/run-models.ts +276 -0
- package/src/engine/run-status.ts +9 -4
- package/src/engine/templates.ts +7 -2
- package/src/grounding/controller.ts +2 -1
- package/src/grounding/extract.ts +1 -0
- package/src/grounding/model-usage.ts +4 -0
- package/src/grounding/tools.ts +18 -1
- package/src/lib/compare.ts +9 -0
- package/src/lib/log.ts +17 -15
- package/src/models/accounting.ts +34 -0
- package/src/models/budget-protection.ts +1 -0
- package/src/models/catalog.ts +500 -0
- package/src/models/cost-coefficients.ts +116 -27
- package/src/models/gateway-cost.ts +32 -0
- package/src/models/local-profile.ts +14 -8
- package/src/models/open-model.ts +70 -0
- package/src/models/profiles.ts +17 -4
- package/src/models/structured.ts +2 -10
- package/src/models/supported-models.ts +7 -5
- package/src/pipeline.ts +45 -19
- package/src/probes/adapter.ts +138 -0
- package/src/probes/adapters/cli-agents.ts +123 -0
- package/src/probes/adapters/cli-claude-code.ts +119 -0
- package/src/probes/adapters/cli-codex.ts +145 -0
- package/src/probes/adapters/cli-cursor.ts +95 -0
- package/src/probes/adapters/cli-process.ts +522 -0
- package/src/probes/adapters/dataforseo-ai-mode.ts +146 -0
- package/src/probes/adapters/dataforseo-ai-overview.ts +106 -0
- package/src/probes/adapters/dataforseo-chatgpt-app.ts +115 -0
- package/src/probes/adapters/gateway-chat.ts +453 -0
- package/src/probes/adapters/gateway-perplexity.ts +104 -0
- package/src/probes/agent-clis.ts +151 -1088
- package/src/probes/answer-text.ts +153 -0
- package/src/probes/attempt.ts +463 -0
- package/src/probes/bindings.ts +761 -0
- package/src/probes/charged-trace.ts +69 -13
- package/src/probes/chat-retrieval.ts +67 -0
- package/src/probes/dataforseo-locale.ts +153 -22
- package/src/probes/dataforseo.ts +474 -178
- package/src/probes/grounding-urls.ts +68 -19
- package/src/probes/legacy-bindings.ts +41 -0
- package/src/probes/limits.ts +31 -18
- package/src/probes/probe-trace.ts +13 -0
- package/src/probes/probes.ts +76 -738
- package/src/probes/web-tool-guard.ts +18 -8
- package/src/report/core/progress-comparison.ts +158 -44
- package/src/report/core/progress-schema.ts +25 -3
- package/src/report/core/progress-statistics.ts +194 -0
- package/src/report/core/rate-interval.ts +24 -0
- package/src/report/core/retrieval.ts +18 -4
- package/src/report/core/schema.ts +79 -4
- package/src/report/core/surfaces.ts +100 -9
- package/src/runner.ts +72 -4
- package/src/schema.ts +78 -17
- package/src/section-result.ts +141 -23
- package/src/stores/files.ts +78 -54
- package/src/stores/memory.ts +4 -1
- package/src/stores/ports.ts +3 -0
- package/src/stores/unit-record.ts +151 -0
- package/src/viewer/page.ts +126 -5
- package/dist/lib/chunks/chunk-AASWJR7Q.js +0 -42
- package/dist/lib/chunks/chunk-BGAHZIL3.js +0 -563
- package/dist/lib/chunks/chunk-DVFFYY5G.js +0 -74
- package/dist/lib/chunks/chunk-IB6RROHE.js +0 -204
- package/dist/lib/chunks/chunk-NH4QGBJV.js +0 -61
- package/dist/lib/chunks/chunk-WZGI7UVM.js +0 -937
|
@@ -1,937 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ProbeTraceError,
|
|
3
|
-
endAttempt,
|
|
4
|
-
startAttempt
|
|
5
|
-
} from "./chunk-GVOF5ZUG.js";
|
|
6
|
-
import {
|
|
7
|
-
AgentStreamError,
|
|
8
|
-
RejectedWebToolError,
|
|
9
|
-
RetrievalConsistencyError,
|
|
10
|
-
parseClaudeCodeStream,
|
|
11
|
-
parseCodexEvents,
|
|
12
|
-
parseCursorStream
|
|
13
|
-
} from "./chunk-6GKKALCI.js";
|
|
14
|
-
import {
|
|
15
|
-
isWorkerInvocationError,
|
|
16
|
-
requireWorkerTransport,
|
|
17
|
-
workerTransport
|
|
18
|
-
} from "./chunk-565CYND6.js";
|
|
19
|
-
import {
|
|
20
|
-
ChildProcessError,
|
|
21
|
-
childEnv,
|
|
22
|
-
runChild
|
|
23
|
-
} from "./chunk-7QYZSP7Q.js";
|
|
24
|
-
import {
|
|
25
|
-
codexArgs,
|
|
26
|
-
resolveCodexBinary
|
|
27
|
-
} from "./chunk-U772TN32.js";
|
|
28
|
-
import {
|
|
29
|
-
ProbeFailure,
|
|
30
|
-
agentProbeRetryPolicy,
|
|
31
|
-
errorMessage,
|
|
32
|
-
isAuthError,
|
|
33
|
-
isCapacityError,
|
|
34
|
-
retryDelayMs
|
|
35
|
-
} from "./chunk-7O3M6I2X.js";
|
|
36
|
-
import {
|
|
37
|
-
createLog
|
|
38
|
-
} from "./chunk-ZSEY7AHQ.js";
|
|
39
|
-
import {
|
|
40
|
-
getEnvironment,
|
|
41
|
-
readEnv
|
|
42
|
-
} from "./chunk-PO2J5OQ3.js";
|
|
43
|
-
import {
|
|
44
|
-
isRecord
|
|
45
|
-
} from "./chunk-7PLK6VGC.js";
|
|
46
|
-
import {
|
|
47
|
-
sleep,
|
|
48
|
-
unlimited
|
|
49
|
-
} from "./chunk-W5XYW6ZM.js";
|
|
50
|
-
import {
|
|
51
|
-
retrievalLogSchema
|
|
52
|
-
} from "./chunk-EDQTINTL.js";
|
|
53
|
-
import {
|
|
54
|
-
agentSurfaces,
|
|
55
|
-
surfaceRunCounts
|
|
56
|
-
} from "./chunk-AASWJR7Q.js";
|
|
57
|
-
|
|
58
|
-
// src/probes/agent-clis.ts
|
|
59
|
-
import { execFile } from "node:child_process";
|
|
60
|
-
import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
61
|
-
import { homedir, tmpdir } from "node:os";
|
|
62
|
-
import path from "node:path";
|
|
63
|
-
import { promisify } from "node:util";
|
|
64
|
-
import { z } from "zod";
|
|
65
|
-
var execFileAsync = promisify(execFile);
|
|
66
|
-
var log = createLog("AgentCliProbes");
|
|
67
|
-
var retryJitterRatio = 0.2;
|
|
68
|
-
var addJitter = (delayMs) => {
|
|
69
|
-
const factor = 1 - retryJitterRatio + Math.random() * 2 * retryJitterRatio;
|
|
70
|
-
return Math.round(delayMs * factor);
|
|
71
|
-
};
|
|
72
|
-
var agentProbeTimeoutMs = 5 * 60 * 1e3;
|
|
73
|
-
var agentKillGraceMs = 1e4;
|
|
74
|
-
var agentMaxBufferBytes = 64 * 1024 * 1024;
|
|
75
|
-
var defaultAgentRuntime = (env = getEnvironment()) => {
|
|
76
|
-
return { env, claudeConfigDir: null };
|
|
77
|
-
};
|
|
78
|
-
var detectAgentClis = async () => {
|
|
79
|
-
return {
|
|
80
|
-
claudeCode: await cliVersion("claude", ["--version"]),
|
|
81
|
-
codex: await cliVersion("codex", ["--version"]),
|
|
82
|
-
cursor: await cliVersion("cursor-agent", ["--version"])
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
var versionForSurface = (surface, versions) => {
|
|
86
|
-
switch (surface) {
|
|
87
|
-
case "claude_code":
|
|
88
|
-
return versions.claudeCode;
|
|
89
|
-
case "codex":
|
|
90
|
-
return versions.codex;
|
|
91
|
-
case "cursor":
|
|
92
|
-
return versions.cursor;
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
var assertAgentClis = (surfaces, versions) => {
|
|
96
|
-
const missing = surfaces.filter((s) => !versionForSurface(s, versions));
|
|
97
|
-
if (missing.length === 0) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
throw new Error(
|
|
101
|
-
[
|
|
102
|
-
`Missing agent CLI${missing.length === 1 ? "" : "s"} for surface${missing.length === 1 ? "" : "s"} in scope:`,
|
|
103
|
-
...missing.map(
|
|
104
|
-
(s) => ` - ${s} \u2014 \`${cliNameForSurface(s)}\` not found on PATH`
|
|
105
|
-
),
|
|
106
|
-
"Install and authenticate the CLI, or narrow the run with --surfaces to",
|
|
107
|
-
"leave the surface out (the snapshot then records it as unmeasured)."
|
|
108
|
-
].join("\n")
|
|
109
|
-
);
|
|
110
|
-
};
|
|
111
|
-
var agentAuthEnv = {
|
|
112
|
-
claude_code: {
|
|
113
|
-
anyOf: ["CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_API_KEY"],
|
|
114
|
-
purpose: "Claude Code probes (subscription token from `claude setup-token`, or an API key)"
|
|
115
|
-
},
|
|
116
|
-
codex: {
|
|
117
|
-
anyOf: ["OPENAI_API_KEY", "CODEX_HOME"],
|
|
118
|
-
purpose: "Codex probes (an API key, or a CODEX_HOME provisioned with `codex login --with-api-key`)"
|
|
119
|
-
},
|
|
120
|
-
cursor: {
|
|
121
|
-
anyOf: ["CURSOR_API_KEY"],
|
|
122
|
-
purpose: "Cursor probes"
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
var assertAgentAuth = (surfaces, env) => {
|
|
126
|
-
const transport = workerTransport();
|
|
127
|
-
if (readEnv("AEO_ISOLATED_ADAPTER") === "1" && !transport) {
|
|
128
|
-
requireWorkerTransport();
|
|
129
|
-
}
|
|
130
|
-
const missing = surfaces.filter(
|
|
131
|
-
(surface) => transport ? !transport.has(surface) : !agentAuthEnv[surface].anyOf.some((name) => env[name])
|
|
132
|
-
);
|
|
133
|
-
if (missing.length === 0) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
throw new Error(
|
|
137
|
-
[
|
|
138
|
-
"Non-interactive run: agent CLI auth must be provided by environment for every agent surface in scope:",
|
|
139
|
-
...missing.map(
|
|
140
|
-
(surface) => ` - ${surface} \u2014 one of ${agentAuthEnv[surface].anyOf.join(", ")} (${agentAuthEnv[surface].purpose})`
|
|
141
|
-
),
|
|
142
|
-
"Set them, or narrow the run with --surfaces."
|
|
143
|
-
].join("\n")
|
|
144
|
-
);
|
|
145
|
-
};
|
|
146
|
-
var cliNameForSurface = (surface) => {
|
|
147
|
-
switch (surface) {
|
|
148
|
-
case "claude_code":
|
|
149
|
-
return "claude";
|
|
150
|
-
case "codex":
|
|
151
|
-
return "codex";
|
|
152
|
-
case "cursor":
|
|
153
|
-
return "cursor-agent";
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
var agentAnswerSchema = z.object({
|
|
157
|
-
text: z.string(),
|
|
158
|
-
usedWebSearch: z.boolean().nullable(),
|
|
159
|
-
retrieval: retrievalLogSchema,
|
|
160
|
-
requestedModel: z.string().nullable().optional(),
|
|
161
|
-
reportedModel: z.string().optional()
|
|
162
|
-
});
|
|
163
|
-
var workerVersionSchema = z.string().nullish();
|
|
164
|
-
var getVersionSurface = (command) => {
|
|
165
|
-
if (command === "claude") {
|
|
166
|
-
return "claude_code";
|
|
167
|
-
}
|
|
168
|
-
if (command === "codex") {
|
|
169
|
-
return "codex";
|
|
170
|
-
}
|
|
171
|
-
return "cursor";
|
|
172
|
-
};
|
|
173
|
-
var probeForSurface = (surface) => {
|
|
174
|
-
const transport = workerTransport();
|
|
175
|
-
if (transport) {
|
|
176
|
-
return async (prompt, runtime, signal) => {
|
|
177
|
-
const answer = await transport.invoke(
|
|
178
|
-
surface,
|
|
179
|
-
{
|
|
180
|
-
task: "probe",
|
|
181
|
-
prompt,
|
|
182
|
-
timeoutMs: Math.min(
|
|
183
|
-
runtime.timeoutMs ?? agentProbeTimeoutMs,
|
|
184
|
-
3e5
|
|
185
|
-
)
|
|
186
|
-
},
|
|
187
|
-
signal
|
|
188
|
-
);
|
|
189
|
-
return agentAnswerSchema.parse(answer);
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
if (readEnv("AEO_ISOLATED_ADAPTER") === "1") {
|
|
193
|
-
requireWorkerTransport();
|
|
194
|
-
}
|
|
195
|
-
switch (surface) {
|
|
196
|
-
case "claude_code":
|
|
197
|
-
return runClaudeCodeProbe;
|
|
198
|
-
case "codex":
|
|
199
|
-
return runCodexProbe;
|
|
200
|
-
case "cursor":
|
|
201
|
-
return runCursorProbe;
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
var localCommand = (command, args) => {
|
|
205
|
-
if (command !== "codex") {
|
|
206
|
-
return { command, args: [...args] };
|
|
207
|
-
}
|
|
208
|
-
const binary = resolveCodexBinary();
|
|
209
|
-
return { command: binary.command, args: codexArgs(binary, args) };
|
|
210
|
-
};
|
|
211
|
-
var cliVersion = async (command, args) => {
|
|
212
|
-
try {
|
|
213
|
-
const transport = workerTransport();
|
|
214
|
-
if (transport) {
|
|
215
|
-
const version = await transport.invoke(getVersionSurface(command), {
|
|
216
|
-
task: "version"
|
|
217
|
-
});
|
|
218
|
-
return workerVersionSchema.parse(version) ?? null;
|
|
219
|
-
}
|
|
220
|
-
if (readEnv("AEO_ISOLATED_ADAPTER") === "1") {
|
|
221
|
-
requireWorkerTransport();
|
|
222
|
-
}
|
|
223
|
-
const local = localCommand(command, args);
|
|
224
|
-
const { stdout } = await execFileAsync(local.command, local.args, {
|
|
225
|
-
timeout: 15e3
|
|
226
|
-
});
|
|
227
|
-
return stdout.trim().split("\n")[0] ?? null;
|
|
228
|
-
} catch {
|
|
229
|
-
return null;
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
var canaryPrompt = "Reply with the single word OK and nothing else. Do not search the web.";
|
|
233
|
-
var runCanaryProbe = async (surface, runtime, { signal, trace } = {}) => {
|
|
234
|
-
const startedAt = Date.now();
|
|
235
|
-
let traced;
|
|
236
|
-
for (let attempt = 1; ; attempt += 1) {
|
|
237
|
-
signal?.throwIfAborted();
|
|
238
|
-
const retryOf = traced?.id;
|
|
239
|
-
traced = await startAttempt(trace, {
|
|
240
|
-
surface,
|
|
241
|
-
promptId: "canary",
|
|
242
|
-
promptText: canaryPrompt,
|
|
243
|
-
runIndex: 0,
|
|
244
|
-
attempt,
|
|
245
|
-
...retryOf === void 0 ? {} : { retryOf },
|
|
246
|
-
requestedModel: null
|
|
247
|
-
});
|
|
248
|
-
try {
|
|
249
|
-
const answer = await probeForSurface(surface)(
|
|
250
|
-
canaryPrompt,
|
|
251
|
-
{
|
|
252
|
-
...runtime,
|
|
253
|
-
timeoutMs: Math.min(runtime.timeoutMs ?? 12e4, 12e4)
|
|
254
|
-
},
|
|
255
|
-
signal
|
|
256
|
-
);
|
|
257
|
-
log.info("Canary probe passed", {
|
|
258
|
-
surface,
|
|
259
|
-
durationMs: Date.now() - startedAt,
|
|
260
|
-
chars: answer.text.length
|
|
261
|
-
});
|
|
262
|
-
const unrecorded = await endAttempt(traced, {
|
|
263
|
-
outcome: "succeeded",
|
|
264
|
-
text: answer.text,
|
|
265
|
-
retrieval: answer.retrieval,
|
|
266
|
-
requestedModel: answer.requestedModel ?? null,
|
|
267
|
-
...answer.reportedModel ? { reportedModel: answer.reportedModel } : {}
|
|
268
|
-
});
|
|
269
|
-
return unrecorded === null ? null : { kind: "persistence", message: unrecorded, surface };
|
|
270
|
-
} catch (error) {
|
|
271
|
-
const failure = classifyAgentError(error);
|
|
272
|
-
const unrecorded = await endAttempt(traced, {
|
|
273
|
-
outcome: signal?.aborted ? "cancelled" : "failed",
|
|
274
|
-
kind: failure.kind,
|
|
275
|
-
error: failure.message
|
|
276
|
-
});
|
|
277
|
-
signal?.throwIfAborted();
|
|
278
|
-
if (unrecorded !== null) {
|
|
279
|
-
return { kind: "persistence", message: unrecorded, surface };
|
|
280
|
-
}
|
|
281
|
-
const delay = retryDelayMs(failure.kind, attempt);
|
|
282
|
-
if (delay !== null) {
|
|
283
|
-
await sleep(delay, signal);
|
|
284
|
-
continue;
|
|
285
|
-
}
|
|
286
|
-
log.error("Canary probe failed", error, {
|
|
287
|
-
surface,
|
|
288
|
-
kind: failure.kind,
|
|
289
|
-
detail: failure.message
|
|
290
|
-
});
|
|
291
|
-
return { ...failure, surface };
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
var runCanaryProbes = async (surfaces, runtime, options = {}) => {
|
|
296
|
-
const failures = (await Promise.all(
|
|
297
|
-
surfaces.map((surface) => runCanaryProbe(surface, runtime, options))
|
|
298
|
-
)).filter((failure) => failure !== null);
|
|
299
|
-
const [firstFailure] = failures;
|
|
300
|
-
if (firstFailure) {
|
|
301
|
-
const kind = failures.find(
|
|
302
|
-
(failure) => ["auth", "rejected_web_tool"].includes(failure.kind)
|
|
303
|
-
)?.kind ?? firstFailure.kind;
|
|
304
|
-
throw new ProbeFailure(
|
|
305
|
-
kind,
|
|
306
|
-
[
|
|
307
|
-
"Agent canary probe failed; the CLI is installed but cannot answer (auth, network, or configuration):",
|
|
308
|
-
...failures.map(
|
|
309
|
-
({ surface, kind: kind2, message }) => ` - ${surface}: ${kind2} \u2014 ${message}`
|
|
310
|
-
).sort()
|
|
311
|
-
].join("\n")
|
|
312
|
-
);
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
var runAgentProbesForPrompts = async (args) => {
|
|
316
|
-
const surfaces = args.surfaces ?? agentSurfaces;
|
|
317
|
-
const limiter = args.limiter ?? unlimited();
|
|
318
|
-
const runtime = args.runtime ?? defaultAgentRuntime();
|
|
319
|
-
const specs = [];
|
|
320
|
-
for (const prompt of args.prompts) {
|
|
321
|
-
for (const surface of surfaces) {
|
|
322
|
-
if (!versionForSurface(surface, args.versions)) {
|
|
323
|
-
throw new Error(
|
|
324
|
-
`Agent CLI for ${surface} (${cliNameForSurface(surface)}) is not installed; the pre-flight check should have rejected this run.`
|
|
325
|
-
);
|
|
326
|
-
}
|
|
327
|
-
const runs = args.runsPerPrompt ?? surfaceRunCounts[surface];
|
|
328
|
-
for (let run = 1; run <= runs; run++) {
|
|
329
|
-
if (args.filter && !args.filter({ promptId: prompt.id, surface, runIndex: run })) {
|
|
330
|
-
continue;
|
|
331
|
-
}
|
|
332
|
-
specs.push({ surface, prompt, runIndex: run });
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
const outcomes = await Promise.all(
|
|
337
|
-
specs.map(
|
|
338
|
-
(spec) => runAgentUnit(spec, {
|
|
339
|
-
version: versionForSurface(spec.surface, args.versions) ?? "unknown",
|
|
340
|
-
limiter,
|
|
341
|
-
runtime,
|
|
342
|
-
signal: args.signal,
|
|
343
|
-
onResult: args.onResult,
|
|
344
|
-
trace: args.trace,
|
|
345
|
-
logContext: args.logContext
|
|
346
|
-
})
|
|
347
|
-
)
|
|
348
|
-
);
|
|
349
|
-
const rejectedWebToolSurfaces = surfaces.filter((surface) => {
|
|
350
|
-
const onSurface = outcomes.filter((o) => o.unit.surface === surface);
|
|
351
|
-
return onSurface.length > 0 && onSurface.every(
|
|
352
|
-
(o) => o.status === "failed" && o.kind === "rejected_web_tool"
|
|
353
|
-
);
|
|
354
|
-
});
|
|
355
|
-
const captured = outcomes.filter((o) => o.status === "captured").length;
|
|
356
|
-
log.info("Agent probes completed", {
|
|
357
|
-
...args.logContext,
|
|
358
|
-
planned: specs.length,
|
|
359
|
-
captured,
|
|
360
|
-
failed: specs.length - captured,
|
|
361
|
-
...rejectedWebToolSurfaces.length > 0 ? { rejectedWebToolSurfaces } : {}
|
|
362
|
-
});
|
|
363
|
-
return { outcomes, rejectedWebToolSurfaces };
|
|
364
|
-
};
|
|
365
|
-
var runAgentUnit = async (spec, ctx) => {
|
|
366
|
-
const unit = {
|
|
367
|
-
promptId: spec.prompt.id,
|
|
368
|
-
surface: spec.surface,
|
|
369
|
-
runIndex: spec.runIndex
|
|
370
|
-
};
|
|
371
|
-
const context = {
|
|
372
|
-
...ctx.logContext,
|
|
373
|
-
surface: spec.surface,
|
|
374
|
-
promptId: spec.prompt.id,
|
|
375
|
-
run: spec.runIndex
|
|
376
|
-
};
|
|
377
|
-
const probe = probeForSurface(spec.surface);
|
|
378
|
-
let attempt = 0;
|
|
379
|
-
let answer = null;
|
|
380
|
-
let traced;
|
|
381
|
-
for (; ; ) {
|
|
382
|
-
if (ctx.signal?.aborted) {
|
|
383
|
-
return {
|
|
384
|
-
status: "failed",
|
|
385
|
-
unit,
|
|
386
|
-
kind: "timeout",
|
|
387
|
-
attempts: attempt,
|
|
388
|
-
lastError: "run aborted before the unit executed"
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
attempt += 1;
|
|
392
|
-
const probeStartedAt = Date.now();
|
|
393
|
-
const retryOf = traced?.id;
|
|
394
|
-
traced = void 0;
|
|
395
|
-
try {
|
|
396
|
-
answer = await ctx.limiter.run(
|
|
397
|
-
spec.surface,
|
|
398
|
-
async () => {
|
|
399
|
-
traced = await startAttempt(ctx.trace, {
|
|
400
|
-
surface: spec.surface,
|
|
401
|
-
promptId: spec.prompt.id,
|
|
402
|
-
promptText: spec.prompt.promptText,
|
|
403
|
-
runIndex: spec.runIndex,
|
|
404
|
-
attempt,
|
|
405
|
-
...retryOf === void 0 ? {} : { retryOf },
|
|
406
|
-
// Known from the CLI's answer; recorded when the attempt ends.
|
|
407
|
-
requestedModel: null
|
|
408
|
-
});
|
|
409
|
-
return probe(spec.prompt.promptText, ctx.runtime, ctx.signal);
|
|
410
|
-
},
|
|
411
|
-
{ signal: ctx.signal }
|
|
412
|
-
);
|
|
413
|
-
log.info("Agent probe completed", {
|
|
414
|
-
...context,
|
|
415
|
-
attempt,
|
|
416
|
-
usedWebSearch: answer.usedWebSearch,
|
|
417
|
-
retrievalCalls: answer.retrieval.calls.length,
|
|
418
|
-
durationMs: Date.now() - probeStartedAt,
|
|
419
|
-
chars: answer.text.length
|
|
420
|
-
});
|
|
421
|
-
break;
|
|
422
|
-
} catch (error) {
|
|
423
|
-
if (error instanceof ProbeTraceError) {
|
|
424
|
-
return {
|
|
425
|
-
status: "failed",
|
|
426
|
-
unit,
|
|
427
|
-
kind: "persistence",
|
|
428
|
-
attempts: attempt,
|
|
429
|
-
lastError: error.message
|
|
430
|
-
};
|
|
431
|
-
}
|
|
432
|
-
const failure = classifyAgentError(error);
|
|
433
|
-
const unrecorded2 = await endAttempt(traced, {
|
|
434
|
-
outcome: ctx.signal?.aborted ? "cancelled" : "failed",
|
|
435
|
-
kind: failure.kind,
|
|
436
|
-
error: failure.message
|
|
437
|
-
});
|
|
438
|
-
if (unrecorded2 !== null) {
|
|
439
|
-
return {
|
|
440
|
-
status: "failed",
|
|
441
|
-
unit,
|
|
442
|
-
kind: "persistence",
|
|
443
|
-
attempts: attempt,
|
|
444
|
-
lastError: unrecorded2
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
const ladderDelayMs = retryDelayMs(
|
|
448
|
-
failure.kind,
|
|
449
|
-
attempt,
|
|
450
|
-
agentProbeRetryPolicy
|
|
451
|
-
);
|
|
452
|
-
const delayMs = ladderDelayMs === null ? null : addJitter(ladderDelayMs);
|
|
453
|
-
log.warn(
|
|
454
|
-
delayMs === null ? "Agent probe failed" : "Agent probe failed; retrying",
|
|
455
|
-
{
|
|
456
|
-
...context,
|
|
457
|
-
attempt,
|
|
458
|
-
kind: failure.kind,
|
|
459
|
-
...delayMs === null ? {} : { retryInMs: delayMs },
|
|
460
|
-
durationMs: Date.now() - probeStartedAt,
|
|
461
|
-
error: failure.message
|
|
462
|
-
}
|
|
463
|
-
);
|
|
464
|
-
if (delayMs === null) {
|
|
465
|
-
return {
|
|
466
|
-
status: "failed",
|
|
467
|
-
unit,
|
|
468
|
-
kind: failure.kind,
|
|
469
|
-
attempts: attempt,
|
|
470
|
-
lastError: failure.message
|
|
471
|
-
};
|
|
472
|
-
}
|
|
473
|
-
if (failure.kind === "capacity") {
|
|
474
|
-
ctx.limiter.pause(spec.surface, delayMs);
|
|
475
|
-
}
|
|
476
|
-
await sleep(delayMs, ctx.signal);
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
const text = answer.text.replaceAll("\0", "");
|
|
480
|
-
const unrecorded = await endAttempt(traced, {
|
|
481
|
-
outcome: "succeeded",
|
|
482
|
-
text,
|
|
483
|
-
retrieval: answer.retrieval,
|
|
484
|
-
requestedModel: answer.requestedModel ?? null,
|
|
485
|
-
...answer.reportedModel ? { reportedModel: answer.reportedModel } : {}
|
|
486
|
-
});
|
|
487
|
-
if (unrecorded !== null) {
|
|
488
|
-
return {
|
|
489
|
-
status: "failed",
|
|
490
|
-
unit,
|
|
491
|
-
kind: "persistence",
|
|
492
|
-
attempts: attempt,
|
|
493
|
-
lastError: unrecorded
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
const result = {
|
|
497
|
-
promptId: spec.prompt.id,
|
|
498
|
-
promptText: spec.prompt.promptText,
|
|
499
|
-
promptCategory: spec.prompt.category,
|
|
500
|
-
modelName: spec.surface,
|
|
501
|
-
runIndex: spec.runIndex,
|
|
502
|
-
text,
|
|
503
|
-
usedWebSearch: answer.usedWebSearch,
|
|
504
|
-
agentCliVersion: ctx.version,
|
|
505
|
-
retrieval: answer.retrieval,
|
|
506
|
-
requestedModel: answer.requestedModel ?? null,
|
|
507
|
-
...answer.reportedModel ? { reportedModel: answer.reportedModel } : {}
|
|
508
|
-
};
|
|
509
|
-
try {
|
|
510
|
-
await ctx.onResult?.(result);
|
|
511
|
-
} catch (error) {
|
|
512
|
-
log.error(
|
|
513
|
-
"Agent probe captured but could not be persisted",
|
|
514
|
-
error,
|
|
515
|
-
context
|
|
516
|
-
);
|
|
517
|
-
return {
|
|
518
|
-
status: "failed",
|
|
519
|
-
unit,
|
|
520
|
-
kind: "persistence",
|
|
521
|
-
attempts: attempt,
|
|
522
|
-
lastError: errorMessage(error)
|
|
523
|
-
};
|
|
524
|
-
}
|
|
525
|
-
return { status: "captured", unit, probe: result, attempts: attempt };
|
|
526
|
-
};
|
|
527
|
-
var cliOutputByError = /* @__PURE__ */ new WeakMap();
|
|
528
|
-
var attachCliOutput = (error, output) => {
|
|
529
|
-
if (typeof error === "object" && error !== null) {
|
|
530
|
-
cliOutputByError.set(error, output);
|
|
531
|
-
}
|
|
532
|
-
return error;
|
|
533
|
-
};
|
|
534
|
-
var workerFailureKinds = /* @__PURE__ */ new Map([
|
|
535
|
-
["capacity", "capacity"],
|
|
536
|
-
["auth", "auth"],
|
|
537
|
-
["timeout", "timeout"],
|
|
538
|
-
["parser", "parser"],
|
|
539
|
-
["rejected_web_tool", "rejected_web_tool"]
|
|
540
|
-
]);
|
|
541
|
-
var classifyAgentError = (error) => {
|
|
542
|
-
if (error instanceof ProbeFailure) {
|
|
543
|
-
return { kind: error.kind, message: error.message };
|
|
544
|
-
}
|
|
545
|
-
if (isWorkerInvocationError(error)) {
|
|
546
|
-
const kind = workerFailureKinds.get(error.kind) ?? "cli_error";
|
|
547
|
-
return { kind, message: error.detail ?? error.message };
|
|
548
|
-
}
|
|
549
|
-
if (error instanceof RejectedWebToolError) {
|
|
550
|
-
return { kind: "rejected_web_tool", message: error.message };
|
|
551
|
-
}
|
|
552
|
-
if (error instanceof RetrievalConsistencyError) {
|
|
553
|
-
return { kind: "parser", message: error.message };
|
|
554
|
-
}
|
|
555
|
-
if (error instanceof ChildProcessError) {
|
|
556
|
-
const { result } = error;
|
|
557
|
-
if (result.timedOut || result.aborted) {
|
|
558
|
-
return { kind: "timeout", message: error.message };
|
|
559
|
-
}
|
|
560
|
-
const signals = cliFailureSignals(result);
|
|
561
|
-
return {
|
|
562
|
-
kind: kindFromSignals(signals.errorTexts, "cli_error"),
|
|
563
|
-
message: signals.detail ? `${error.message} \u2014 ${signals.detail}` : error.message
|
|
564
|
-
};
|
|
565
|
-
}
|
|
566
|
-
if (error instanceof AgentStreamError) {
|
|
567
|
-
const output = cliOutputByError.get(error);
|
|
568
|
-
const signals = output ? cliFailureSignals({ code: 0, signal: null, ...output }) : { detail: "", errorTexts: [] };
|
|
569
|
-
return {
|
|
570
|
-
kind: error.kind === "cli_error" ? kindFromSignals(signals.errorTexts, "cli_error") : "parser",
|
|
571
|
-
message: signals.detail ? `${error.message} \u2014 ${signals.detail}` : error.message
|
|
572
|
-
};
|
|
573
|
-
}
|
|
574
|
-
const message = errorMessage(error);
|
|
575
|
-
if (error instanceof Error && error.name === "AbortError") {
|
|
576
|
-
return { kind: "timeout", message };
|
|
577
|
-
}
|
|
578
|
-
return { kind: "cli_error", message };
|
|
579
|
-
};
|
|
580
|
-
var kindFromSignals = (errorTexts, fallback) => {
|
|
581
|
-
const joined = errorTexts.join("\n");
|
|
582
|
-
if (isCapacityError(joined)) {
|
|
583
|
-
return "capacity";
|
|
584
|
-
}
|
|
585
|
-
if (isAuthError(joined)) {
|
|
586
|
-
return "auth";
|
|
587
|
-
}
|
|
588
|
-
return fallback;
|
|
589
|
-
};
|
|
590
|
-
var cliFailureDetailChars = 300;
|
|
591
|
-
var describeExit = ({
|
|
592
|
-
code,
|
|
593
|
-
signal
|
|
594
|
-
}) => {
|
|
595
|
-
if (typeof code === "number") {
|
|
596
|
-
return `exit ${code}`;
|
|
597
|
-
}
|
|
598
|
-
if (signal) {
|
|
599
|
-
return `killed by ${signal}`;
|
|
600
|
-
}
|
|
601
|
-
return "";
|
|
602
|
-
};
|
|
603
|
-
var cliFailureSignals = (output) => {
|
|
604
|
-
const exit = describeExit(output);
|
|
605
|
-
const stderrText = output.stderr.trim();
|
|
606
|
-
const errorTexts = [];
|
|
607
|
-
let lastErrorEventText = null;
|
|
608
|
-
if (stderrText) {
|
|
609
|
-
errorTexts.push(stderrText);
|
|
610
|
-
}
|
|
611
|
-
const events = parseEventLines(output.stdout);
|
|
612
|
-
for (const event of events) {
|
|
613
|
-
if (!isErrorEvent(event)) {
|
|
614
|
-
continue;
|
|
615
|
-
}
|
|
616
|
-
const text = eventMessage(event);
|
|
617
|
-
if (text) {
|
|
618
|
-
errorTexts.push(text);
|
|
619
|
-
lastErrorEventText = text;
|
|
620
|
-
}
|
|
621
|
-
if (typeof event.error === "string") {
|
|
622
|
-
errorTexts.push(event.error);
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
let detail;
|
|
626
|
-
if (lastErrorEventText) {
|
|
627
|
-
detail = `error event: ${lastErrorEventText.slice(0, cliFailureDetailChars)}`;
|
|
628
|
-
} else if (stderrText) {
|
|
629
|
-
detail = `stderr: ${stderrText.slice(0, cliFailureDetailChars)}`;
|
|
630
|
-
} else {
|
|
631
|
-
const last = lastCliMessage(events, output.stdout);
|
|
632
|
-
detail = last ? `last stdout message: ${last}` : "";
|
|
633
|
-
}
|
|
634
|
-
return {
|
|
635
|
-
detail: [exit, detail].filter(Boolean).join(", "),
|
|
636
|
-
errorTexts
|
|
637
|
-
};
|
|
638
|
-
};
|
|
639
|
-
var describeCliFailure = (output) => {
|
|
640
|
-
return cliFailureSignals(output).detail;
|
|
641
|
-
};
|
|
642
|
-
var parseEventLines = (stdout) => {
|
|
643
|
-
const events = [];
|
|
644
|
-
for (const line of stdout.split("\n")) {
|
|
645
|
-
const trimmed = line.trim();
|
|
646
|
-
if (!trimmed.startsWith("{")) {
|
|
647
|
-
continue;
|
|
648
|
-
}
|
|
649
|
-
try {
|
|
650
|
-
const event = JSON.parse(trimmed);
|
|
651
|
-
if (isRecord(event)) {
|
|
652
|
-
events.push(event);
|
|
653
|
-
}
|
|
654
|
-
} catch {
|
|
655
|
-
continue;
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
return events;
|
|
659
|
-
};
|
|
660
|
-
var isErrorEvent = (event) => {
|
|
661
|
-
if (event.type === "error") {
|
|
662
|
-
return true;
|
|
663
|
-
}
|
|
664
|
-
if (typeof event.error === "string" || isRecord(event.error)) {
|
|
665
|
-
return true;
|
|
666
|
-
}
|
|
667
|
-
if (event.is_error === true) {
|
|
668
|
-
return true;
|
|
669
|
-
}
|
|
670
|
-
if (typeof event.subtype === "string" && /error/i.test(event.subtype)) {
|
|
671
|
-
return true;
|
|
672
|
-
}
|
|
673
|
-
const item = isRecord(event.item) ? event.item : null;
|
|
674
|
-
if (item && (item.error !== void 0 || item.status === "failed")) {
|
|
675
|
-
return true;
|
|
676
|
-
}
|
|
677
|
-
return false;
|
|
678
|
-
};
|
|
679
|
-
var lastCliMessage = (events, stdout) => {
|
|
680
|
-
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
681
|
-
const event = events[i];
|
|
682
|
-
if (!event) {
|
|
683
|
-
continue;
|
|
684
|
-
}
|
|
685
|
-
const text = eventMessage(event);
|
|
686
|
-
if (text) {
|
|
687
|
-
return text.slice(0, cliFailureDetailChars);
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
return stdout.trim().slice(-cliFailureDetailChars);
|
|
691
|
-
};
|
|
692
|
-
var eventMessage = (event) => {
|
|
693
|
-
const candidates = [event.result];
|
|
694
|
-
const message = isRecord(event.message) ? event.message : null;
|
|
695
|
-
if (Array.isArray(message?.content)) {
|
|
696
|
-
for (const block of message.content) {
|
|
697
|
-
if (isRecord(block) && typeof block.text === "string") {
|
|
698
|
-
candidates.push(block.text);
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
if (isRecord(event.item)) {
|
|
703
|
-
candidates.push(event.item.text);
|
|
704
|
-
}
|
|
705
|
-
if (isRecord(event.msg)) {
|
|
706
|
-
candidates.push(event.msg.message);
|
|
707
|
-
}
|
|
708
|
-
candidates.push(event.message);
|
|
709
|
-
if (isRecord(event.error)) {
|
|
710
|
-
candidates.push(event.error.message);
|
|
711
|
-
}
|
|
712
|
-
candidates.push(event.error);
|
|
713
|
-
for (const candidate of candidates) {
|
|
714
|
-
if (typeof candidate === "string" && candidate.trim()) {
|
|
715
|
-
return unwrapApiErrorBody(candidate.trim());
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
return null;
|
|
719
|
-
};
|
|
720
|
-
var unwrapApiErrorBody = (text) => {
|
|
721
|
-
if (!text.startsWith("{")) {
|
|
722
|
-
return text;
|
|
723
|
-
}
|
|
724
|
-
try {
|
|
725
|
-
const body = JSON.parse(text);
|
|
726
|
-
if (isRecord(body) && isRecord(body.error) && typeof body.error.message === "string") {
|
|
727
|
-
return typeof body.status === "number" ? `HTTP ${body.status}: ${body.error.message}` : body.error.message;
|
|
728
|
-
}
|
|
729
|
-
} catch {
|
|
730
|
-
}
|
|
731
|
-
return text;
|
|
732
|
-
};
|
|
733
|
-
var withScratchDir = async (runtime, surface, fn) => {
|
|
734
|
-
const dir = await mkdtemp(path.join(tmpdir(), "aeo-agent-probe-"));
|
|
735
|
-
try {
|
|
736
|
-
return await fn(dir);
|
|
737
|
-
} finally {
|
|
738
|
-
await rm(dir, { recursive: true, force: true });
|
|
739
|
-
if (surface === "claude_code" && !runtime.claudeConfigDir) {
|
|
740
|
-
await rm(claudeTranscriptDir(runtime.env, dir), {
|
|
741
|
-
recursive: true,
|
|
742
|
-
force: true
|
|
743
|
-
});
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
};
|
|
747
|
-
var claudeTranscriptDir = (env, cwd) => {
|
|
748
|
-
const configDir = env.CLAUDE_CONFIG_DIR ?? path.join(env.HOME ?? homedir(), ".claude");
|
|
749
|
-
return path.join(configDir, "projects", cwd.replaceAll("/", "-"));
|
|
750
|
-
};
|
|
751
|
-
var claudeEnvKeys = [
|
|
752
|
-
"ANTHROPIC_API_KEY",
|
|
753
|
-
"CLAUDE_CODE_OAUTH_TOKEN",
|
|
754
|
-
"CLAUDE_CONFIG_DIR"
|
|
755
|
-
];
|
|
756
|
-
var codexEnvKeys = ["OPENAI_API_KEY", "CODEX_HOME"];
|
|
757
|
-
var cursorEnvKeys = ["CURSOR_API_KEY"];
|
|
758
|
-
var execCli = async (command, { cliArgs, cwd, runtime, env, signal }) => {
|
|
759
|
-
const local = localCommand(command, cliArgs);
|
|
760
|
-
const result = await runChild(local.command, local.args, {
|
|
761
|
-
cwd,
|
|
762
|
-
env,
|
|
763
|
-
timeoutMs: runtime.timeoutMs ?? agentProbeTimeoutMs,
|
|
764
|
-
maxBuffer: agentMaxBufferBytes,
|
|
765
|
-
killGraceMs: agentKillGraceMs,
|
|
766
|
-
signal
|
|
767
|
-
});
|
|
768
|
-
return { stdout: result.stdout, stderr: result.stderr };
|
|
769
|
-
};
|
|
770
|
-
var runClaudeCodeProbe = async (promptText, runtime, signal) => {
|
|
771
|
-
return withScratchDir(runtime, "claude_code", async (dir) => {
|
|
772
|
-
const settingsPath = path.join(dir, "probe-settings.json");
|
|
773
|
-
await writeFile(
|
|
774
|
-
settingsPath,
|
|
775
|
-
JSON.stringify({
|
|
776
|
-
permissions: {
|
|
777
|
-
// Bare tool names allow every use of the tool — the documented rule
|
|
778
|
-
// form ('WebFetch(*)' is not valid rule syntax and would leave
|
|
779
|
-
// fetches auto-denied in headless mode; the parser now turns that
|
|
780
|
-
// denial into a loud rejected-tool failure).
|
|
781
|
-
allow: ["WebSearch", "WebFetch"],
|
|
782
|
-
deny: ["Bash", "Read", "Edit", "Write"]
|
|
783
|
-
}
|
|
784
|
-
}),
|
|
785
|
-
"utf8"
|
|
786
|
-
);
|
|
787
|
-
const output = await execCli("claude", {
|
|
788
|
-
cliArgs: [
|
|
789
|
-
"-p",
|
|
790
|
-
promptText,
|
|
791
|
-
"--output-format",
|
|
792
|
-
"stream-json",
|
|
793
|
-
"--verbose",
|
|
794
|
-
"--settings",
|
|
795
|
-
settingsPath,
|
|
796
|
-
"--strict-mcp-config",
|
|
797
|
-
"--setting-sources",
|
|
798
|
-
"project"
|
|
799
|
-
],
|
|
800
|
-
cwd: dir,
|
|
801
|
-
runtime,
|
|
802
|
-
env: childEnv(
|
|
803
|
-
runtime.env,
|
|
804
|
-
claudeEnvKeys,
|
|
805
|
-
runtime.claudeConfigDir ? { CLAUDE_CONFIG_DIR: runtime.claudeConfigDir } : {}
|
|
806
|
-
),
|
|
807
|
-
signal
|
|
808
|
-
});
|
|
809
|
-
try {
|
|
810
|
-
return parseClaudeCodeStream(output.stdout);
|
|
811
|
-
} catch (error) {
|
|
812
|
-
throw attachCliOutput(error, output);
|
|
813
|
-
}
|
|
814
|
-
});
|
|
815
|
-
};
|
|
816
|
-
var codexProbeModel = (env) => {
|
|
817
|
-
const model = env.AEO_CODEX_PROBE_MODEL?.trim() ?? "";
|
|
818
|
-
return model === "" ? null : model;
|
|
819
|
-
};
|
|
820
|
-
var runCodexProbe = async (promptText, runtime, signal) => {
|
|
821
|
-
return withScratchDir(runtime, "codex", async (dir) => {
|
|
822
|
-
const lastMessagePath = path.join(dir, "last-message.txt");
|
|
823
|
-
const requestedModel = codexProbeModel(runtime.env);
|
|
824
|
-
const output = await execCli("codex", {
|
|
825
|
-
cliArgs: [
|
|
826
|
-
"exec",
|
|
827
|
-
"--json",
|
|
828
|
-
...requestedModel ? ["--model", requestedModel] : [],
|
|
829
|
-
"--sandbox",
|
|
830
|
-
readEnv("AEO_CODEX_SANDBOX") === "danger-full-access" ? "danger-full-access" : "read-only",
|
|
831
|
-
"--skip-git-repo-check",
|
|
832
|
-
"--ignore-user-config",
|
|
833
|
-
"--ephemeral",
|
|
834
|
-
"--cd",
|
|
835
|
-
dir,
|
|
836
|
-
"--output-last-message",
|
|
837
|
-
lastMessagePath,
|
|
838
|
-
"-c",
|
|
839
|
-
"tools.web_search=true",
|
|
840
|
-
promptText
|
|
841
|
-
],
|
|
842
|
-
cwd: dir,
|
|
843
|
-
runtime,
|
|
844
|
-
env: childEnv(runtime.env, codexEnvKeys),
|
|
845
|
-
signal
|
|
846
|
-
});
|
|
847
|
-
try {
|
|
848
|
-
const parsed = parseCodexEvents(output.stdout);
|
|
849
|
-
let lastMessage = parsed.lastMessage;
|
|
850
|
-
try {
|
|
851
|
-
const fromFile = (await readFile(lastMessagePath, "utf8")).trim();
|
|
852
|
-
if (fromFile) {
|
|
853
|
-
lastMessage = fromFile;
|
|
854
|
-
}
|
|
855
|
-
} catch {
|
|
856
|
-
}
|
|
857
|
-
if (!lastMessage) {
|
|
858
|
-
throw new AgentStreamError(
|
|
859
|
-
"cli_error",
|
|
860
|
-
"Codex returned no agent message"
|
|
861
|
-
);
|
|
862
|
-
}
|
|
863
|
-
return {
|
|
864
|
-
text: lastMessage,
|
|
865
|
-
requestedModel,
|
|
866
|
-
usedWebSearch: parsed.usedWebSearch,
|
|
867
|
-
retrieval: parsed.retrieval
|
|
868
|
-
};
|
|
869
|
-
} catch (error) {
|
|
870
|
-
throw attachCliOutput(error, output);
|
|
871
|
-
}
|
|
872
|
-
});
|
|
873
|
-
};
|
|
874
|
-
var cursorProjectConfig = {
|
|
875
|
-
permissions: {
|
|
876
|
-
allow: [],
|
|
877
|
-
deny: ["Shell(*)", "Write(*)", "Edit(*)", "Delete(*)"]
|
|
878
|
-
}
|
|
879
|
-
};
|
|
880
|
-
var runCursorProbe = async (promptText, runtime, signal) => {
|
|
881
|
-
return withScratchDir(runtime, "cursor", async (dir) => {
|
|
882
|
-
await mkdir(path.join(dir, ".cursor"), { recursive: true });
|
|
883
|
-
await writeFile(
|
|
884
|
-
path.join(dir, ".cursor", "cli.json"),
|
|
885
|
-
JSON.stringify(cursorProjectConfig),
|
|
886
|
-
"utf8"
|
|
887
|
-
);
|
|
888
|
-
const output = await execCli("cursor-agent", {
|
|
889
|
-
cliArgs: [
|
|
890
|
-
"-p",
|
|
891
|
-
promptText,
|
|
892
|
-
"--output-format",
|
|
893
|
-
"stream-json",
|
|
894
|
-
"--trust",
|
|
895
|
-
"--force"
|
|
896
|
-
],
|
|
897
|
-
cwd: dir,
|
|
898
|
-
runtime,
|
|
899
|
-
env: childEnv(runtime.env, cursorEnvKeys),
|
|
900
|
-
signal
|
|
901
|
-
});
|
|
902
|
-
try {
|
|
903
|
-
return parseCursorStream(output.stdout);
|
|
904
|
-
} catch (error) {
|
|
905
|
-
throw attachCliOutput(error, output);
|
|
906
|
-
}
|
|
907
|
-
});
|
|
908
|
-
};
|
|
909
|
-
var runAgentProbeDirect = async (surface, {
|
|
910
|
-
prompt,
|
|
911
|
-
runtime,
|
|
912
|
-
signal
|
|
913
|
-
}) => {
|
|
914
|
-
if (readEnv("AEO_ISOLATED_ADAPTER") === "1") {
|
|
915
|
-
throw new Error("Direct CLI launch prohibited in adapter.");
|
|
916
|
-
}
|
|
917
|
-
return probeForSurface(surface)(prompt, runtime, signal);
|
|
918
|
-
};
|
|
919
|
-
|
|
920
|
-
export {
|
|
921
|
-
defaultAgentRuntime,
|
|
922
|
-
detectAgentClis,
|
|
923
|
-
versionForSurface,
|
|
924
|
-
assertAgentClis,
|
|
925
|
-
agentAuthEnv,
|
|
926
|
-
assertAgentAuth,
|
|
927
|
-
cliNameForSurface,
|
|
928
|
-
canaryPrompt,
|
|
929
|
-
runCanaryProbe,
|
|
930
|
-
runCanaryProbes,
|
|
931
|
-
runAgentProbesForPrompts,
|
|
932
|
-
classifyAgentError,
|
|
933
|
-
cliFailureSignals,
|
|
934
|
-
describeCliFailure,
|
|
935
|
-
claudeTranscriptDir,
|
|
936
|
-
runAgentProbeDirect
|
|
937
|
-
};
|