literally-aeo 0.2.2 → 0.3.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/dist/cli.mjs +6031 -5158
- package/dist/lib/agents/author-schema.js +5 -5
- package/dist/lib/agents/author-validation.js +7 -7
- package/dist/lib/agents/copy-validation.js +9 -9
- package/dist/lib/agents/copywriter-input.js +8 -8
- package/dist/lib/agents/facts.js +7 -7
- package/dist/lib/agents/narrative-facts.js +6 -6
- package/dist/lib/agents/verifier.js +13 -12
- package/dist/lib/analysis/domain-classifier.js +12 -10
- package/dist/lib/analysis/domain-labels.js +4 -4
- package/dist/lib/analysis/outreach.js +2 -2
- package/dist/lib/analysis/progress.js +8 -8
- package/dist/lib/analysis/retrieval.js +5 -5
- package/dist/lib/analysis/scoring.js +5 -5
- package/dist/lib/analysis/search-analyzer.js +6 -6
- package/dist/lib/analysis/sentiment.js +12 -10
- package/dist/lib/analysis/source-mix.js +2 -2
- package/dist/lib/author/examples.js +6 -6
- package/dist/lib/bundle/contracts.js +6 -6
- package/dist/lib/bundle/export.js +18 -18
- package/dist/lib/bundle/journal.js +7 -7
- package/dist/lib/bundle/project-journal.js +10 -10
- package/dist/lib/bundle/project.js +16 -16
- package/dist/lib/bundle/read.js +19 -19
- package/dist/lib/bundle/recorder.js +8 -8
- package/dist/lib/bundle/redact.js +7 -7
- package/dist/lib/bundle/trace-coverage.js +7 -7
- package/dist/lib/bundle/verify-integrity.js +9 -9
- package/dist/lib/bundle/verify-measurement.js +22 -13
- package/dist/lib/bundle/verify-report.js +23 -15
- package/dist/lib/bundle/verify.js +31 -23
- package/dist/lib/capture-manifest.js +6 -6
- package/dist/lib/checks/crawler-access.js +2 -2
- package/dist/lib/checks/renderability.js +2 -2
- package/dist/lib/checks/run-checks.js +12 -12
- package/dist/lib/chunks/{chunk-3CMPR6ZZ.js → chunk-2C723CW7.js} +1 -1
- package/dist/lib/chunks/chunk-2FDSOZ6Q.js +287 -0
- package/dist/lib/chunks/{chunk-PWOYEIPF.js → chunk-2U5QSA6Q.js} +7 -7
- package/dist/lib/chunks/{chunk-6EI4CVRW.js → chunk-3ESH5NDR.js} +5 -1
- package/dist/lib/chunks/{chunk-VHKHYAC5.js → chunk-3S2FAVRE.js} +2 -2
- package/dist/lib/chunks/{chunk-LR27H2HZ.js → chunk-44NSZBCP.js} +6 -6
- package/dist/lib/chunks/{chunk-JBOOD6MU.js → chunk-4AWFF53U.js} +12 -4
- package/dist/lib/chunks/{chunk-MENTBQGB.js → chunk-4HPMLJKC.js} +4 -4
- package/dist/lib/chunks/{chunk-S6QOXJAL.js → chunk-4Q2WFZ5J.js} +11 -4
- package/dist/lib/chunks/{chunk-7DNLRXEY.js → chunk-5JU2Y2I6.js} +2 -2
- package/dist/lib/chunks/{chunk-KFAT65P7.js → chunk-64JFN2Q5.js} +1 -1
- package/dist/lib/chunks/chunk-66UE4TT2.js +245 -0
- package/dist/lib/chunks/chunk-6N3C6E3D.js +105 -0
- package/dist/lib/chunks/{chunk-F2NSJ6PG.js → chunk-6RED3G6K.js} +7 -3
- package/dist/lib/chunks/{chunk-HCUJ2J7P.js → chunk-7KLTOVIY.js} +9 -9
- package/dist/lib/chunks/{chunk-EOO5RBUW.js → chunk-7ZR3WDF2.js} +38 -5
- package/dist/lib/chunks/chunk-A5PF7UE2.js +86 -0
- package/dist/lib/chunks/{chunk-PKNODC6Y.js → chunk-AB7DUTX5.js} +1 -1
- package/dist/lib/chunks/{chunk-WDT2Y7D7.js → chunk-AQCWKHTE.js} +11 -7
- package/dist/lib/chunks/{chunk-UNCUG2YS.js → chunk-ASHFEFCU.js} +3 -3
- package/dist/lib/chunks/{chunk-BYHXNFWN.js → chunk-ASIFUJG2.js} +1 -1
- package/dist/lib/chunks/{chunk-ZSEY7AHQ.js → chunk-BBK54RVK.js} +14 -11
- package/dist/lib/chunks/chunk-BQMUZLHO.js +17 -0
- package/dist/lib/chunks/{chunk-QD3JXA3Y.js → chunk-CQNIPZH3.js} +18 -18
- package/dist/lib/chunks/{chunk-7HM6IZ3L.js → chunk-CVEXMYPW.js} +2 -2
- package/dist/lib/chunks/chunk-CXZIHHLJ.js +95 -0
- package/dist/lib/chunks/{chunk-75DMLOQ7.js → chunk-CYJNBVQB.js} +1 -1
- package/dist/lib/chunks/{chunk-FAUFE7MI.js → chunk-D7N5OLYL.js} +1 -1
- package/dist/lib/chunks/{chunk-E2YTTB6Q.js → chunk-DSK3PM4Z.js} +1 -1
- package/dist/lib/chunks/{chunk-TNL2GWYR.js → chunk-EUXNCXCR.js} +22 -0
- package/dist/lib/chunks/{chunk-FJL2V6P5.js → chunk-F4EQULFR.js} +6 -6
- package/dist/lib/chunks/{chunk-QGZ4QSUE.js → chunk-FHV4PBYG.js} +1 -1
- package/dist/lib/chunks/{chunk-K2FZFESR.js → chunk-FONFW67K.js} +4 -4
- package/dist/lib/chunks/{chunk-PIFTG6YW.js → chunk-FPPHYGIO.js} +2 -2
- package/dist/lib/chunks/{chunk-VXYQWE45.js → chunk-FYE4R5TY.js} +2 -2
- package/dist/lib/chunks/{chunk-JYCVBFH5.js → chunk-H2DOBJZC.js} +2 -2
- package/dist/lib/chunks/{chunk-XA27KAUV.js → chunk-HEWHNSDP.js} +68 -36
- package/dist/lib/chunks/{chunk-RXSHKWZJ.js → chunk-HLC6OHGO.js} +2 -2
- package/dist/lib/chunks/{chunk-6HMHXSCS.js → chunk-HXXFRZTJ.js} +2 -2
- package/dist/lib/chunks/{chunk-R5UPOEWE.js → chunk-HYMWNGOK.js} +10 -3
- package/dist/lib/chunks/chunk-IH67TEGY.js +73 -0
- package/dist/lib/chunks/{chunk-JKPBXPCW.js → chunk-IMADI2YP.js} +1 -1
- package/dist/lib/chunks/{chunk-AT3XMGES.js → chunk-JBGQFPTY.js} +4 -4
- package/dist/lib/chunks/{chunk-JQDQVG3D.js → chunk-JDU3ZCKO.js} +1 -1
- package/dist/lib/chunks/{chunk-2KH7LNK7.js → chunk-JGIX427K.js} +7 -7
- package/dist/lib/chunks/{chunk-7CW6U5WJ.js → chunk-JIE2ANVD.js} +1 -1
- package/dist/lib/chunks/{chunk-YEUCAPKP.js → chunk-JJFOILZK.js} +2 -2
- package/dist/lib/chunks/{chunk-F7DBTXKG.js → chunk-JMIK2QN3.js} +4 -3
- package/dist/lib/chunks/chunk-JW7DTYSI.js +116 -0
- package/dist/lib/chunks/{chunk-BFWK3TBN.js → chunk-JXLCKACO.js} +2 -2
- package/dist/lib/chunks/{chunk-7WO3FFPS.js → chunk-K5NQDJLE.js} +1 -1
- package/dist/lib/chunks/{chunk-BXF4OC74.js → chunk-KI2FB4Y3.js} +30 -16
- package/dist/lib/chunks/{chunk-Y2CZ6FZY.js → chunk-KRWDELRS.js} +30 -7
- package/dist/lib/chunks/{chunk-SIJOQRRK.js → chunk-KRXOJJR7.js} +1 -1
- package/dist/lib/chunks/chunk-KSUI4DAY.js +15 -0
- package/dist/lib/chunks/chunk-KXFZ3CH3.js +98 -0
- package/dist/lib/chunks/{chunk-XSER7WEB.js → chunk-LJCWZ5SZ.js} +14 -14
- package/dist/lib/chunks/{chunk-HGGRPOSA.js → chunk-LNYQMWJO.js} +3 -3
- package/dist/lib/chunks/{chunk-DL6YQDTE.js → chunk-LOIAGEKN.js} +2 -2
- package/dist/lib/chunks/{chunk-I3UE52ZV.js → chunk-LPOIMPJK.js} +2 -2
- package/dist/lib/chunks/{chunk-66T7JC57.js → chunk-LUKP64NX.js} +2 -2
- package/dist/lib/chunks/chunk-MNG5TZRW.js +208 -0
- package/dist/lib/chunks/{chunk-HGGOGCPX.js → chunk-MPQXB7HN.js} +7 -7
- package/dist/lib/chunks/{chunk-YGLWQFKL.js → chunk-MZ2KN3IH.js} +3 -3
- package/dist/lib/chunks/chunk-N62G4EWT.js +91 -0
- package/dist/lib/chunks/{chunk-7YDXD4MD.js → chunk-ODIXZHHX.js} +1 -1
- package/dist/lib/chunks/{chunk-GLUGYZQO.js → chunk-OTVHGRCO.js} +8 -8
- package/dist/lib/chunks/{chunk-RIJERFGU.js → chunk-OVF27NAO.js} +69 -17
- package/dist/lib/chunks/chunk-P6LHGBYU.js +90 -0
- package/dist/lib/chunks/{chunk-U5USH2HB.js → chunk-PAL5SXIP.js} +1 -1
- package/dist/lib/chunks/{chunk-W5XYW6ZM.js → chunk-PT6PK2MJ.js} +26 -19
- package/dist/lib/chunks/{chunk-OD36HUXA.js → chunk-Q22FCF4A.js} +6 -7
- package/dist/lib/chunks/chunk-QKTKQSPS.js +292 -0
- package/dist/lib/chunks/{chunk-K4Y5NT4M.js → chunk-QO5TPMWS.js} +2 -2
- package/dist/lib/chunks/{chunk-4GLW3ZRO.js → chunk-QUZYFAGP.js} +4 -4
- package/dist/lib/chunks/{chunk-T6XZQOXS.js → chunk-QVMPTT7R.js} +5 -5
- package/dist/lib/chunks/{chunk-OOLWU667.js → chunk-RGZY6YUQ.js} +5 -5
- package/dist/lib/chunks/{chunk-U6BW6LGX.js → chunk-RM2VVR7Y.js} +1 -1
- package/dist/lib/chunks/{chunk-AJO7XVXK.js → chunk-RMSH7RUG.js} +6 -6
- package/dist/lib/chunks/{chunk-V5B6UZ3E.js → chunk-RQGEPR6V.js} +1 -0
- package/dist/lib/chunks/{chunk-V5JJEEBT.js → chunk-RYB77E7O.js} +6 -5
- package/dist/lib/chunks/chunk-S24JGY7B.js +97 -0
- package/dist/lib/chunks/{chunk-6GKKALCI.js → chunk-SF4UJ2AY.js} +1 -1
- package/dist/lib/chunks/chunk-SJCUR4QX.js +94 -0
- package/dist/lib/chunks/{chunk-XAN4CRFP.js → chunk-SQ55KGHO.js} +1 -1
- package/dist/lib/chunks/{chunk-ZOGIJGU3.js → chunk-TKOQMB6A.js} +7 -7
- package/dist/lib/chunks/{chunk-UYDQXXDQ.js → chunk-TWK6IA4P.js} +1 -1
- package/dist/lib/chunks/{chunk-DVFFYY5G.js → chunk-U42I3SBR.js} +13 -9
- package/dist/lib/chunks/{chunk-PIF3GL62.js → chunk-UECQONVZ.js} +5 -5
- package/dist/lib/chunks/{chunk-FDM2YNQL.js → chunk-VTY53IFN.js} +1 -1
- package/dist/lib/chunks/chunk-VYUC772A.js +338 -0
- package/dist/lib/chunks/{chunk-WCLKIPJV.js → chunk-WPCBE2NZ.js} +1 -1
- package/dist/lib/chunks/{chunk-3OE4UQIB.js → chunk-WRHGLRUK.js} +5 -5
- package/dist/lib/chunks/{chunk-J7QKT5E7.js → chunk-WUIY7BXR.js} +34 -17
- package/dist/lib/chunks/{chunk-7YYDUHJG.js → chunk-WZA4H4TG.js} +39 -13
- package/dist/lib/chunks/{chunk-NH4QGBJV.js → chunk-XBSA7MNJ.js} +7 -2
- package/dist/lib/chunks/chunk-XTBCXEH7.js +243 -0
- package/dist/lib/chunks/{chunk-ZQ3ER7JD.js → chunk-YPVJAXPP.js} +1 -1
- package/dist/lib/chunks/{chunk-SASE7U6E.js → chunk-YQD5ITKI.js} +1 -1
- package/dist/lib/chunks/{chunk-LTCDLURT.js → chunk-YY4BH5XM.js} +6 -6
- package/dist/lib/chunks/{chunk-J5NPHPXY.js → chunk-Z3BZRBQF.js} +36 -2
- package/dist/lib/chunks/{chunk-XFUYEFQP.js → chunk-ZBQU2VU3.js} +1 -1
- package/dist/lib/chunks/{chunk-7YZPEX3T.js → chunk-ZHGABG7L.js} +2 -2
- package/dist/lib/chunks/chunk-ZZCRYG36.js +31 -0
- package/dist/lib/cli/bundle-commands.js +89 -73
- package/dist/lib/cli/run-commands.js +136 -92
- package/dist/lib/cli/status-command.js +75 -59
- package/dist/lib/codex-workflow/aggregate.js +20 -12
- package/dist/lib/codex-workflow/author-tools.js +7 -7
- package/dist/lib/codex-workflow/author.js +23 -22
- package/dist/lib/codex-workflow/capture.js +38 -17
- package/dist/lib/codex-workflow/checkpoint.js +7 -7
- package/dist/lib/codex-workflow/checks.js +9 -9
- package/dist/lib/codex-workflow/copy-editor.js +19 -18
- package/dist/lib/codex-workflow/copy-recovery.js +4 -4
- package/dist/lib/codex-workflow/copy.js +16 -15
- package/dist/lib/codex-workflow/finish.js +28 -24
- package/dist/lib/codex-workflow/host-models.js +2 -2
- package/dist/lib/codex-workflow/loop.js +51 -46
- package/dist/lib/codex-workflow/quality.js +4 -4
- package/dist/lib/codex-workflow/run-inputs.js +6 -6
- package/dist/lib/codex-workflow/run-source.js +16 -16
- package/dist/lib/codex-workflow/schemas.js +6 -6
- package/dist/lib/codex-workflow/session.js +8 -8
- package/dist/lib/codex-workflow/stage.js +30 -28
- package/dist/lib/codex-workflow/workdir.js +18 -11
- package/dist/lib/engine/audit-file.js +7 -7
- package/dist/lib/engine/author.js +38 -36
- package/dist/lib/engine/cost-estimate.js +37 -9
- package/dist/lib/engine/local-run.js +74 -58
- package/dist/lib/engine/preflight.js +37 -9
- package/dist/lib/engine/rejudge.js +80 -64
- package/dist/lib/engine/run-bindings.js +62 -0
- package/dist/lib/engine/run-status.js +75 -59
- package/dist/lib/engine/templates.js +8 -8
- package/dist/lib/grounding/controller.js +8 -7
- package/dist/lib/grounding/extract.js +8 -6
- package/dist/lib/grounding/grounding-runtime.js +22 -21
- package/dist/lib/grounding/model-usage.js +2 -2
- package/dist/lib/grounding/model.js +7 -5
- package/dist/lib/grounding/recorded-tools.js +9 -9
- package/dist/lib/harness/report/artifacts.js +5 -5
- package/dist/lib/lib/checkpoint.js +5 -5
- package/dist/lib/lib/log.js +1 -1
- package/dist/lib/models/accounting.js +1 -1
- package/dist/lib/models/batching.js +6 -4
- package/dist/lib/models/budget-protection.js +1 -1
- package/dist/lib/models/cost-coefficients.js +2 -1
- package/dist/lib/models/gateway-cost.js +7 -0
- package/dist/lib/models/structured.js +5 -3
- package/dist/lib/models/supported-models.js +1 -1
- package/dist/lib/pipeline.js +36 -17
- 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 +21 -0
- package/dist/lib/probes/adapters/cli-codex.js +23 -0
- package/dist/lib/probes/adapters/cli-cursor.js +21 -0
- package/dist/lib/probes/adapters/cli-process.js +34 -0
- package/dist/lib/probes/adapters/dataforseo-ai-overview.js +20 -0
- package/dist/lib/probes/adapters/gateway-chat.js +30 -0
- package/dist/lib/probes/adapters/gateway-perplexity.js +19 -0
- package/dist/lib/probes/agent-cli-parsers.js +2 -2
- package/dist/lib/probes/agent-clis.js +26 -11
- package/dist/lib/probes/answer-text.js +21 -0
- package/dist/lib/probes/attempt.js +28 -0
- package/dist/lib/probes/bindings.js +69 -0
- package/dist/lib/probes/charged-trace.js +47 -3
- package/dist/lib/probes/dataforseo-locale.js +1 -1
- package/dist/lib/probes/dataforseo.js +8 -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 +33 -12
- package/dist/lib/runner.js +17 -14
- package/dist/lib/schema.js +4 -4
- package/dist/lib/section-result.js +6 -6
- package/dist/lib/stores/artifacts.js +7 -7
- package/dist/lib/stores/files.js +19 -17
- package/dist/lib/stores/local-versions.js +5 -5
- package/dist/lib/stores/memory.js +19 -14
- package/dist/lib/stores/publication.js +10 -10
- package/dist/lib/stores/unit-record.js +28 -0
- package/dist/lib/viewer/server.js +32 -24
- package/dist/lib/workflow/schema.js +3 -3
- package/dist/types/bundle/contracts.d.ts +1 -1
- package/dist/types/capture-manifest.d.ts +1 -0
- package/dist/types/codex-workflow/capture.d.ts +13 -0
- package/dist/types/codex-workflow/workdir.d.ts +0 -1
- package/dist/types/engine/cost-estimate.d.ts +5 -1
- package/dist/types/engine/preflight.d.ts +6 -1
- package/dist/types/engine/run-bindings.d.ts +25 -0
- package/dist/types/models/accounting.d.ts +7 -0
- package/dist/types/models/cost-coefficients.d.ts +5 -5
- package/dist/types/models/gateway-cost.d.ts +3 -0
- package/dist/types/pipeline.d.ts +2 -0
- package/dist/types/probes/adapter.d.ts +112 -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-overview.d.ts +12 -0
- package/dist/types/probes/adapters/gateway-chat.d.ts +32 -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 +79 -0
- package/dist/types/probes/charged-trace.d.ts +2 -1
- package/dist/types/probes/dataforseo.d.ts +24 -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 +10 -0
- package/dist/types/probes/probes.d.ts +5 -3
- package/dist/types/stores/ports.d.ts +1 -0
- package/dist/types/stores/unit-record.d.ts +11 -0
- package/package.json +6 -6
- package/src/analysis/progress.ts +10 -1
- package/src/bundle/contracts.ts +1 -1
- package/src/bundle/recorder.ts +47 -1
- package/src/capture-manifest.ts +6 -0
- package/src/cli/run-commands.ts +37 -1
- package/src/codex-workflow/capture.ts +60 -0
- package/src/codex-workflow/workdir.ts +3 -4
- package/src/engine/cost-estimate.ts +10 -4
- package/src/engine/local-run.ts +21 -2
- package/src/engine/preflight.ts +113 -17
- package/src/engine/rejudge.ts +5 -0
- package/src/engine/run-bindings.ts +142 -0
- package/src/grounding/extract.ts +1 -0
- package/src/grounding/model-usage.ts +4 -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/cost-coefficients.ts +17 -13
- package/src/models/gateway-cost.ts +32 -0
- package/src/models/structured.ts +2 -10
- package/src/models/supported-models.ts +2 -2
- package/src/pipeline.ts +36 -17
- package/src/probes/adapter.ts +122 -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-overview.ts +106 -0
- package/src/probes/adapters/gateway-chat.ts +339 -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 +462 -0
- package/src/probes/bindings.ts +344 -0
- package/src/probes/charged-trace.ts +54 -13
- package/src/probes/dataforseo-locale.ts +13 -2
- package/src/probes/dataforseo.ts +265 -188
- package/src/probes/grounding-urls.ts +68 -19
- package/src/probes/legacy-bindings.ts +40 -0
- package/src/probes/limits.ts +31 -18
- package/src/probes/probe-trace.ts +10 -0
- package/src/probes/probes.ts +64 -736
- package/src/runner.ts +13 -0
- 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/dist/lib/chunks/chunk-BGAHZIL3.js +0 -563
- package/dist/lib/chunks/chunk-IB6RROHE.js +0 -204
- package/dist/lib/chunks/chunk-WZGI7UVM.js +0 -937
|
@@ -2,13 +2,17 @@ import {
|
|
|
2
2
|
describeSupportedModels,
|
|
3
3
|
findSupportedModel,
|
|
4
4
|
recommendedModelId
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FPPHYGIO.js";
|
|
6
6
|
import {
|
|
7
7
|
agentAuthEnv,
|
|
8
8
|
cliNameForSurface,
|
|
9
9
|
detectAgentClis,
|
|
10
10
|
versionForSurface
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-VYUC772A.js";
|
|
12
|
+
import {
|
|
13
|
+
probeAdapterProfiles,
|
|
14
|
+
profileOf
|
|
15
|
+
} from "./chunk-MNG5TZRW.js";
|
|
12
16
|
import {
|
|
13
17
|
codexBinaryVersion,
|
|
14
18
|
resolveCodexBinary
|
|
@@ -25,30 +29,68 @@ import path from "node:path";
|
|
|
25
29
|
var minimumNodeMajor = 24;
|
|
26
30
|
var gatewaySetting = "AI_GATEWAY_API_KEY";
|
|
27
31
|
var overviewSettings = ["DATAFORSEO_LOGIN", "DATAFORSEO_PASSWORD"];
|
|
28
|
-
var
|
|
32
|
+
var engineSecretSettingNames = [
|
|
29
33
|
"AI_GATEWAY_API_KEY",
|
|
30
34
|
"DATAFORSEO_PASSWORD",
|
|
31
35
|
"AEO_DATABASE_URL",
|
|
32
36
|
"AEO_SITE_DATABASE_URL",
|
|
33
37
|
"AEO_API_TOKEN",
|
|
34
|
-
"OPENAI_API_KEY",
|
|
35
|
-
"ANTHROPIC_API_KEY",
|
|
36
|
-
"CLAUDE_CODE_OAUTH_TOKEN",
|
|
37
38
|
"GOOGLE_GENERATIVE_AI_API_KEY",
|
|
38
|
-
"PERPLEXITY_API_KEY"
|
|
39
|
-
|
|
39
|
+
"PERPLEXITY_API_KEY"
|
|
40
|
+
];
|
|
41
|
+
var credentialSettingNames = [
|
|
42
|
+
.../* @__PURE__ */ new Set([
|
|
43
|
+
...engineSecretSettingNames,
|
|
44
|
+
...Object.values(probeAdapterProfiles).flatMap(
|
|
45
|
+
(profile) => profile.settings.filter((setting) => setting.secret).map((setting) => setting.name)
|
|
46
|
+
)
|
|
47
|
+
])
|
|
40
48
|
];
|
|
41
49
|
var runSettingNames = [
|
|
42
50
|
gatewaySetting,
|
|
43
51
|
...overviewSettings,
|
|
44
52
|
...Object.values(agentAuthEnv).flatMap((auth) => auth.anyOf)
|
|
45
53
|
];
|
|
54
|
+
var agentAuthDetail = (binding, auth) => {
|
|
55
|
+
if (auth.kind === "cli_session") {
|
|
56
|
+
return "uses the CLI login on this machine, checked by a canary before the run";
|
|
57
|
+
}
|
|
58
|
+
const account = profileOf(binding).settings.find(
|
|
59
|
+
(setting) => setting.name === auth.name
|
|
60
|
+
)?.billsAccount;
|
|
61
|
+
return account === void 0 ? `authenticates with ${auth.name}` : `authenticates with ${auth.name}, billed to that ${account} account outside the run's cap`;
|
|
62
|
+
};
|
|
46
63
|
var agentAuthMode = (surface, settings) => {
|
|
47
64
|
const name = agentAuthEnv[surface].anyOf.find(
|
|
48
65
|
(candidate) => settings.sourceOf(candidate) !== void 0
|
|
49
66
|
);
|
|
50
67
|
return name === void 0 ? { kind: "cli_session" } : { kind: "variable", name };
|
|
51
68
|
};
|
|
69
|
+
var sourceLabel = (name, settings) => {
|
|
70
|
+
const source = settings.sourceOf(name);
|
|
71
|
+
if (source === void 0) {
|
|
72
|
+
return `${name} not set`;
|
|
73
|
+
}
|
|
74
|
+
return `${name} from the ${source === "environment" ? "process environment" : "env file"}`;
|
|
75
|
+
};
|
|
76
|
+
var bindingLabel = (binding) => {
|
|
77
|
+
return binding.model === void 0 ? binding.adapter : `${binding.adapter} with ${binding.model}`;
|
|
78
|
+
};
|
|
79
|
+
var chatBindingCheck = (surface, binding, settings) => {
|
|
80
|
+
const required = profileOf(binding).settings.filter(
|
|
81
|
+
(setting) => setting.group === void 0
|
|
82
|
+
);
|
|
83
|
+
return {
|
|
84
|
+
name: `${surface} probes`,
|
|
85
|
+
ok: required.every(
|
|
86
|
+
(setting) => settings.sourceOf(setting.name) !== void 0
|
|
87
|
+
),
|
|
88
|
+
detail: [
|
|
89
|
+
bindingLabel(binding),
|
|
90
|
+
...required.map((setting) => sourceLabel(setting.name, settings))
|
|
91
|
+
].join("; ")
|
|
92
|
+
};
|
|
93
|
+
};
|
|
52
94
|
var settingCheck = (name, settings) => {
|
|
53
95
|
const source = settings.sourceOf(name);
|
|
54
96
|
return {
|
|
@@ -137,7 +179,7 @@ var codexCheck = async () => {
|
|
|
137
179
|
}
|
|
138
180
|
};
|
|
139
181
|
var runPreflight = async (args) => {
|
|
140
|
-
const { surfaces, settings } = args;
|
|
182
|
+
const { surfaces, settings, bindings } = args;
|
|
141
183
|
const nodeMajor = Number(process.versions.node.split(".")[0]);
|
|
142
184
|
const versions = await detectAgentClis();
|
|
143
185
|
const agents = surfaces.filter(isAgentSurface);
|
|
@@ -149,21 +191,30 @@ var runPreflight = async (args) => {
|
|
|
149
191
|
},
|
|
150
192
|
modelCheck(args.model),
|
|
151
193
|
// Every stage session runs on Codex, whatever is measured.
|
|
152
|
-
await codexCheck()
|
|
153
|
-
settingCheck(gatewaySetting, settings)
|
|
194
|
+
await codexCheck()
|
|
154
195
|
];
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
196
|
+
const chatSurfaces = surfaces.filter((surface) => !isAgentSurface(surface));
|
|
197
|
+
const required = /* @__PURE__ */ new Set([
|
|
198
|
+
gatewaySetting,
|
|
199
|
+
...chatSurfaces.flatMap(
|
|
200
|
+
(surface) => profileOf(bindings[surface]).settings.filter((setting) => setting.group === void 0).map((setting) => setting.name)
|
|
201
|
+
),
|
|
202
|
+
...args.groundingSearch ? overviewSettings : []
|
|
203
|
+
]);
|
|
204
|
+
checks.push(
|
|
205
|
+
...[...required].map((name) => settingCheck(name, settings)),
|
|
206
|
+
...chatSurfaces.map(
|
|
207
|
+
(surface) => chatBindingCheck(surface, bindings[surface], settings)
|
|
208
|
+
)
|
|
209
|
+
);
|
|
160
210
|
for (const surface of agents) {
|
|
161
211
|
const version = versionForSurface(surface, versions);
|
|
162
212
|
const auth = agentAuthMode(surface, settings);
|
|
213
|
+
const binding = bindingLabel(bindings[surface]);
|
|
163
214
|
checks.push({
|
|
164
215
|
name: `${surface} probes`,
|
|
165
216
|
ok: version !== null,
|
|
166
|
-
detail: version === null ?
|
|
217
|
+
detail: version === null ? `${binding}; \`${cliNameForSurface(surface)}\` not found on PATH` : `${binding}; ${cliNameForSurface(surface)} ${version}; ${agentAuthDetail(bindings[surface], auth)}`
|
|
167
218
|
});
|
|
168
219
|
}
|
|
169
220
|
for (const surface of agentSurfaces) {
|
|
@@ -186,6 +237,7 @@ var runPreflight = async (args) => {
|
|
|
186
237
|
|
|
187
238
|
export {
|
|
188
239
|
minimumNodeMajor,
|
|
240
|
+
engineSecretSettingNames,
|
|
189
241
|
credentialSettingNames,
|
|
190
242
|
runSettingNames,
|
|
191
243
|
agentAuthMode,
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import {
|
|
2
|
+
attemptRules,
|
|
3
|
+
runProbeUnit
|
|
4
|
+
} from "./chunk-2FDSOZ6Q.js";
|
|
5
|
+
import {
|
|
6
|
+
createChatAdapter
|
|
7
|
+
} from "./chunk-MNG5TZRW.js";
|
|
8
|
+
import {
|
|
9
|
+
createLog
|
|
10
|
+
} from "./chunk-BBK54RVK.js";
|
|
11
|
+
import {
|
|
12
|
+
chatRunsPerPrompt
|
|
13
|
+
} from "./chunk-LOIAGEKN.js";
|
|
14
|
+
import {
|
|
15
|
+
unlimited
|
|
16
|
+
} from "./chunk-PT6PK2MJ.js";
|
|
17
|
+
import {
|
|
18
|
+
chatSurfaces
|
|
19
|
+
} from "./chunk-AASWJR7Q.js";
|
|
20
|
+
|
|
21
|
+
// src/probes/probes.ts
|
|
22
|
+
var log = createLog("AISearchProbes");
|
|
23
|
+
var runProbesForPrompts = async (job, opts = {}) => {
|
|
24
|
+
const selected = job.surfaces ?? chatSurfaces;
|
|
25
|
+
const probed = chatSurfaces.filter((surface) => selected.includes(surface)).map((surface) => ({
|
|
26
|
+
surface,
|
|
27
|
+
runs: chatRunsPerPrompt(surface, job.chatProbes),
|
|
28
|
+
adapter: createChatAdapter(surface, {
|
|
29
|
+
geography: job.geography,
|
|
30
|
+
language: job.language,
|
|
31
|
+
dependencies: job.dependencies
|
|
32
|
+
})
|
|
33
|
+
}));
|
|
34
|
+
const limiter = job.limiter ?? unlimited();
|
|
35
|
+
const tasks = [];
|
|
36
|
+
for (const prompt of job.prompts) {
|
|
37
|
+
for (const { surface, runs, adapter } of probed) {
|
|
38
|
+
for (let run = 1; run <= runs; run++) {
|
|
39
|
+
if (job.filter && !job.filter({ promptId: prompt.id, surface, runIndex: run })) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const unit = {
|
|
43
|
+
promptId: prompt.id,
|
|
44
|
+
promptText: prompt.promptText,
|
|
45
|
+
runIndex: run
|
|
46
|
+
};
|
|
47
|
+
tasks.push(
|
|
48
|
+
runProbeUnit(adapter, unit, {
|
|
49
|
+
rules: attemptRules.chat,
|
|
50
|
+
trace: job.trace,
|
|
51
|
+
limiter,
|
|
52
|
+
signal: job.signal,
|
|
53
|
+
log,
|
|
54
|
+
logContext: {
|
|
55
|
+
...opts.logContext,
|
|
56
|
+
model: surface,
|
|
57
|
+
promptId: prompt.id,
|
|
58
|
+
run
|
|
59
|
+
},
|
|
60
|
+
toResult: (answer) => ({
|
|
61
|
+
promptId: prompt.id,
|
|
62
|
+
promptText: prompt.promptText,
|
|
63
|
+
promptCategory: prompt.category,
|
|
64
|
+
modelName: surface,
|
|
65
|
+
runIndex: run,
|
|
66
|
+
text: answer.text,
|
|
67
|
+
...answer.retrieval ? { retrieval: answer.retrieval } : {},
|
|
68
|
+
...answer.noOverview ? { noOverview: true } : {},
|
|
69
|
+
...answer.reportedModel ? { reportedModel: answer.reportedModel } : {}
|
|
70
|
+
}),
|
|
71
|
+
...job.onResult && { bank: job.onResult }
|
|
72
|
+
})
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const outcomes = await Promise.all(tasks);
|
|
78
|
+
const captured = outcomes.filter((o) => o.status === "captured").length;
|
|
79
|
+
log.info("Probes completed", {
|
|
80
|
+
...opts.logContext,
|
|
81
|
+
planned: outcomes.length,
|
|
82
|
+
captured,
|
|
83
|
+
failed: outcomes.length - captured
|
|
84
|
+
});
|
|
85
|
+
return outcomes;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export {
|
|
89
|
+
runProbesForPrompts
|
|
90
|
+
};
|
|
@@ -48,7 +48,8 @@ var Semaphore = class {
|
|
|
48
48
|
};
|
|
49
49
|
var ProbeLimiter = class {
|
|
50
50
|
#pools;
|
|
51
|
-
|
|
51
|
+
// When each paused pool or adapter may resume, by its key.
|
|
52
|
+
#resumeAtMs = /* @__PURE__ */ new Map();
|
|
52
53
|
constructor(limits) {
|
|
53
54
|
this.#pools = {
|
|
54
55
|
gateway: new Semaphore(limits.gateway),
|
|
@@ -60,43 +61,49 @@ var ProbeLimiter = class {
|
|
|
60
61
|
};
|
|
61
62
|
}
|
|
62
63
|
/**
|
|
63
|
-
* Holds new work
|
|
64
|
-
*
|
|
65
|
-
*
|
|
64
|
+
* Holds new work under `key` (a provider pool, or the pause key of one
|
|
65
|
+
* adapter) for `delayMs`, extending any pause already running. A
|
|
66
|
+
* rate-limited provider then sees one retry per window instead of every
|
|
67
|
+
* queued unit spending an attempt on the same 429.
|
|
66
68
|
*/
|
|
67
|
-
pause(
|
|
69
|
+
pause(key, delayMs) {
|
|
68
70
|
const resumeAtMs = Date.now() + delayMs;
|
|
69
|
-
this.#resumeAtMs
|
|
70
|
-
|
|
71
|
-
resumeAtMs
|
|
71
|
+
this.#resumeAtMs.set(
|
|
72
|
+
key,
|
|
73
|
+
Math.max(this.#resumeAtMs.get(key) ?? 0, resumeAtMs)
|
|
72
74
|
);
|
|
73
75
|
}
|
|
74
|
-
/** Runs `fn` once the provider
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
/** Runs `fn` once neither the provider nor the work's own pause key is
|
|
77
|
+
* paused and a slot on the provider's pool is free. */
|
|
78
|
+
async run(provider, fn, { signal, pauseKey } = {}) {
|
|
79
|
+
const keys = pauseKey === void 0 ? [provider] : [provider, pauseKey];
|
|
80
|
+
const release = await this.#acquire(provider, keys, signal);
|
|
77
81
|
try {
|
|
78
82
|
return await fn();
|
|
79
83
|
} finally {
|
|
80
84
|
release();
|
|
81
85
|
}
|
|
82
86
|
}
|
|
83
|
-
async #acquire(provider, signal) {
|
|
87
|
+
async #acquire(provider, keys, signal) {
|
|
84
88
|
for (; ; ) {
|
|
85
|
-
await this.#waitForResume(
|
|
89
|
+
await this.#waitForResume(keys, signal);
|
|
86
90
|
const release = await this.#pools[provider].acquire();
|
|
87
|
-
if (this.#getPauseMs(
|
|
91
|
+
if (this.#getPauseMs(keys) <= 0 || signal?.aborted) {
|
|
88
92
|
return release;
|
|
89
93
|
}
|
|
90
94
|
release();
|
|
91
95
|
}
|
|
92
96
|
}
|
|
93
|
-
async #waitForResume(
|
|
94
|
-
while (this.#getPauseMs(
|
|
95
|
-
await sleep(this.#getPauseMs(
|
|
97
|
+
async #waitForResume(keys, signal) {
|
|
98
|
+
while (this.#getPauseMs(keys) > 0 && !signal?.aborted) {
|
|
99
|
+
await sleep(this.#getPauseMs(keys), signal);
|
|
96
100
|
}
|
|
97
101
|
}
|
|
98
|
-
#getPauseMs(
|
|
99
|
-
|
|
102
|
+
#getPauseMs(keys) {
|
|
103
|
+
const now = Date.now();
|
|
104
|
+
return Math.max(
|
|
105
|
+
...keys.map((key) => (this.#resumeAtMs.get(key) ?? 0) - now)
|
|
106
|
+
);
|
|
100
107
|
}
|
|
101
108
|
};
|
|
102
109
|
var unlimited = () => {
|
|
@@ -8,9 +8,12 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
servedModelOf
|
|
10
10
|
} from "./chunk-ZVAKKRRD.js";
|
|
11
|
+
import {
|
|
12
|
+
gatewayCostUsd
|
|
13
|
+
} from "./chunk-BQMUZLHO.js";
|
|
11
14
|
import {
|
|
12
15
|
createLog
|
|
13
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-BBK54RVK.js";
|
|
14
17
|
import {
|
|
15
18
|
readEnv
|
|
16
19
|
} from "./chunk-PO2J5OQ3.js";
|
|
@@ -26,7 +29,7 @@ import {
|
|
|
26
29
|
} from "./chunk-RYCRL3YA.js";
|
|
27
30
|
import {
|
|
28
31
|
ModelBudgetError
|
|
29
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-EUXNCXCR.js";
|
|
30
33
|
|
|
31
34
|
// src/models/structured.ts
|
|
32
35
|
import { randomUUID } from "node:crypto";
|
|
@@ -59,10 +62,6 @@ var reasoningEffortOf = (role) => {
|
|
|
59
62
|
const gatewayEffort = gateway2 && "effort" in gateway2.reasoning ? gateway2.reasoning.effort : void 0;
|
|
60
63
|
return openai?.reasoningEffort ?? gatewayEffort;
|
|
61
64
|
};
|
|
62
|
-
var reportedNumber = (value) => {
|
|
63
|
-
const number = typeof value === "string" && value.trim() ? Number(value) : value;
|
|
64
|
-
return typeof number === "number" && Number.isFinite(number) && number >= 0 ? number : void 0;
|
|
65
|
-
};
|
|
66
65
|
var isGatewayCreditRefusal = (error) => {
|
|
67
66
|
return GatewayInternalServerError.isInstance(error) && error.statusCode === 402 && error.message.startsWith(
|
|
68
67
|
"A positive credit balance is required for all requests, including BYOK, so fallback providers remain available. Add credits at https://vercel.com/"
|
|
@@ -147,7 +146,7 @@ var gatewayTransport = async (input) => {
|
|
|
147
146
|
outputTokens: reported.outputTokens,
|
|
148
147
|
cachedInputTokens: reported.inputTokenDetails.cacheReadTokens,
|
|
149
148
|
reasoningTokens: reported.outputTokenDetails.reasoningTokens,
|
|
150
|
-
costUsd:
|
|
149
|
+
costUsd: gatewayCostUsd(providerMetadata)
|
|
151
150
|
};
|
|
152
151
|
try {
|
|
153
152
|
return { output: await result.output, text, usage };
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentStreamError,
|
|
3
|
+
RejectedWebToolError,
|
|
4
|
+
RetrievalConsistencyError
|
|
5
|
+
} from "./chunk-SF4UJ2AY.js";
|
|
6
|
+
import {
|
|
7
|
+
isWorkerInvocationError
|
|
8
|
+
} from "./chunk-565CYND6.js";
|
|
9
|
+
import {
|
|
10
|
+
ChildProcessError,
|
|
11
|
+
runChild
|
|
12
|
+
} from "./chunk-7QYZSP7Q.js";
|
|
13
|
+
import {
|
|
14
|
+
codexArgs,
|
|
15
|
+
resolveCodexBinary
|
|
16
|
+
} from "./chunk-U772TN32.js";
|
|
17
|
+
import {
|
|
18
|
+
ProbeFailure,
|
|
19
|
+
errorMessage,
|
|
20
|
+
isAuthError,
|
|
21
|
+
isCapacityError
|
|
22
|
+
} from "./chunk-7O3M6I2X.js";
|
|
23
|
+
import {
|
|
24
|
+
isRecord
|
|
25
|
+
} from "./chunk-7PLK6VGC.js";
|
|
26
|
+
|
|
27
|
+
// src/probes/adapters/cli-process.ts
|
|
28
|
+
import { mkdtemp, rm } from "node:fs/promises";
|
|
29
|
+
import { homedir, tmpdir } from "node:os";
|
|
30
|
+
import path from "node:path";
|
|
31
|
+
var authSettingNames = (profile) => {
|
|
32
|
+
return profile.settings.filter((setting) => setting.group === "auth").map((setting) => setting.name);
|
|
33
|
+
};
|
|
34
|
+
var agentProbeTimeoutMs = 5 * 60 * 1e3;
|
|
35
|
+
var agentKillGraceMs = 1e4;
|
|
36
|
+
var agentMaxBufferBytes = 64 * 1024 * 1024;
|
|
37
|
+
var localCommand = (command, args, env) => {
|
|
38
|
+
if (command !== "codex") {
|
|
39
|
+
return { command, args: [...args] };
|
|
40
|
+
}
|
|
41
|
+
const binary = resolveCodexBinary(env);
|
|
42
|
+
return { command: binary.command, args: codexArgs(binary, args) };
|
|
43
|
+
};
|
|
44
|
+
var cliOutputByError = /* @__PURE__ */ new WeakMap();
|
|
45
|
+
var attachCliOutput = (error, output) => {
|
|
46
|
+
if (typeof error === "object" && error !== null) {
|
|
47
|
+
cliOutputByError.set(error, output);
|
|
48
|
+
}
|
|
49
|
+
return error;
|
|
50
|
+
};
|
|
51
|
+
var workerFailureKinds = /* @__PURE__ */ new Map([
|
|
52
|
+
["capacity", "capacity"],
|
|
53
|
+
["auth", "auth"],
|
|
54
|
+
["timeout", "timeout"],
|
|
55
|
+
["parser", "parser"],
|
|
56
|
+
["rejected_web_tool", "rejected_web_tool"]
|
|
57
|
+
]);
|
|
58
|
+
var classifyAgentError = (error) => {
|
|
59
|
+
if (error instanceof ProbeFailure) {
|
|
60
|
+
return { kind: error.kind, message: error.message };
|
|
61
|
+
}
|
|
62
|
+
if (isWorkerInvocationError(error)) {
|
|
63
|
+
const kind = workerFailureKinds.get(error.kind) ?? "cli_error";
|
|
64
|
+
return { kind, message: error.detail ?? error.message };
|
|
65
|
+
}
|
|
66
|
+
if (error instanceof RejectedWebToolError) {
|
|
67
|
+
return { kind: "rejected_web_tool", message: error.message };
|
|
68
|
+
}
|
|
69
|
+
if (error instanceof RetrievalConsistencyError) {
|
|
70
|
+
return { kind: "parser", message: error.message };
|
|
71
|
+
}
|
|
72
|
+
if (error instanceof ChildProcessError) {
|
|
73
|
+
const { result } = error;
|
|
74
|
+
if (result.timedOut || result.aborted) {
|
|
75
|
+
return { kind: "timeout", message: error.message };
|
|
76
|
+
}
|
|
77
|
+
const signals = cliFailureSignals(result);
|
|
78
|
+
return {
|
|
79
|
+
kind: kindFromSignals(signals.errorTexts, "cli_error"),
|
|
80
|
+
message: signals.detail ? `${error.message} \u2014 ${signals.detail}` : error.message
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (error instanceof AgentStreamError) {
|
|
84
|
+
const output = cliOutputByError.get(error);
|
|
85
|
+
const signals = output ? cliFailureSignals({ code: 0, signal: null, ...output }) : { detail: "", errorTexts: [] };
|
|
86
|
+
return {
|
|
87
|
+
kind: error.kind === "cli_error" ? kindFromSignals(signals.errorTexts, "cli_error") : "parser",
|
|
88
|
+
message: signals.detail ? `${error.message} \u2014 ${signals.detail}` : error.message
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const message = errorMessage(error);
|
|
92
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
93
|
+
return { kind: "timeout", message };
|
|
94
|
+
}
|
|
95
|
+
return { kind: "cli_error", message };
|
|
96
|
+
};
|
|
97
|
+
var kindFromSignals = (errorTexts, fallback) => {
|
|
98
|
+
const joined = errorTexts.join("\n");
|
|
99
|
+
if (isCapacityError(joined)) {
|
|
100
|
+
return "capacity";
|
|
101
|
+
}
|
|
102
|
+
if (isAuthError(joined)) {
|
|
103
|
+
return "auth";
|
|
104
|
+
}
|
|
105
|
+
return fallback;
|
|
106
|
+
};
|
|
107
|
+
var cliFailureDetailChars = 300;
|
|
108
|
+
var describeExit = ({
|
|
109
|
+
code,
|
|
110
|
+
signal
|
|
111
|
+
}) => {
|
|
112
|
+
if (typeof code === "number") {
|
|
113
|
+
return `exit ${code}`;
|
|
114
|
+
}
|
|
115
|
+
if (signal) {
|
|
116
|
+
return `killed by ${signal}`;
|
|
117
|
+
}
|
|
118
|
+
return "";
|
|
119
|
+
};
|
|
120
|
+
var cliFailureSignals = (output) => {
|
|
121
|
+
const exit = describeExit(output);
|
|
122
|
+
const stderrText = output.stderr.trim();
|
|
123
|
+
const errorTexts = [];
|
|
124
|
+
let lastErrorEventText = null;
|
|
125
|
+
if (stderrText) {
|
|
126
|
+
errorTexts.push(stderrText);
|
|
127
|
+
}
|
|
128
|
+
const events = parseEventLines(output.stdout);
|
|
129
|
+
for (const event of events) {
|
|
130
|
+
if (!isErrorEvent(event)) {
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
const text = eventMessage(event);
|
|
134
|
+
if (text) {
|
|
135
|
+
errorTexts.push(text);
|
|
136
|
+
lastErrorEventText = text;
|
|
137
|
+
}
|
|
138
|
+
if (typeof event.error === "string") {
|
|
139
|
+
errorTexts.push(event.error);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
let detail;
|
|
143
|
+
if (lastErrorEventText) {
|
|
144
|
+
detail = `error event: ${lastErrorEventText.slice(0, cliFailureDetailChars)}`;
|
|
145
|
+
} else if (stderrText) {
|
|
146
|
+
detail = `stderr: ${stderrText.slice(0, cliFailureDetailChars)}`;
|
|
147
|
+
} else {
|
|
148
|
+
const last = lastCliMessage(events, output.stdout);
|
|
149
|
+
detail = last ? `last stdout message: ${last}` : "";
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
detail: [exit, detail].filter(Boolean).join(", "),
|
|
153
|
+
errorTexts
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
var describeCliFailure = (output) => {
|
|
157
|
+
return cliFailureSignals(output).detail;
|
|
158
|
+
};
|
|
159
|
+
var parseEventLines = (stdout) => {
|
|
160
|
+
const events = [];
|
|
161
|
+
for (const line of stdout.split("\n")) {
|
|
162
|
+
const trimmed = line.trim();
|
|
163
|
+
if (!trimmed.startsWith("{")) {
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
try {
|
|
167
|
+
const event = JSON.parse(trimmed);
|
|
168
|
+
if (isRecord(event)) {
|
|
169
|
+
events.push(event);
|
|
170
|
+
}
|
|
171
|
+
} catch {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return events;
|
|
176
|
+
};
|
|
177
|
+
var isErrorEvent = (event) => {
|
|
178
|
+
if (event.type === "error") {
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
if (typeof event.error === "string" || isRecord(event.error)) {
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
if (event.is_error === true) {
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
if (typeof event.subtype === "string" && /error/i.test(event.subtype)) {
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
const item = isRecord(event.item) ? event.item : null;
|
|
191
|
+
if (item && (item.error !== void 0 || item.status === "failed")) {
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
return false;
|
|
195
|
+
};
|
|
196
|
+
var lastCliMessage = (events, stdout) => {
|
|
197
|
+
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
198
|
+
const event = events[i];
|
|
199
|
+
if (!event) {
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
const text = eventMessage(event);
|
|
203
|
+
if (text) {
|
|
204
|
+
return text.slice(0, cliFailureDetailChars);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return stdout.trim().slice(-cliFailureDetailChars);
|
|
208
|
+
};
|
|
209
|
+
var eventMessage = (event) => {
|
|
210
|
+
const candidates = [event.result];
|
|
211
|
+
const message = isRecord(event.message) ? event.message : null;
|
|
212
|
+
if (Array.isArray(message?.content)) {
|
|
213
|
+
for (const block of message.content) {
|
|
214
|
+
if (isRecord(block) && typeof block.text === "string") {
|
|
215
|
+
candidates.push(block.text);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (isRecord(event.item)) {
|
|
220
|
+
candidates.push(event.item.text);
|
|
221
|
+
}
|
|
222
|
+
if (isRecord(event.msg)) {
|
|
223
|
+
candidates.push(event.msg.message);
|
|
224
|
+
}
|
|
225
|
+
candidates.push(event.message);
|
|
226
|
+
if (isRecord(event.error)) {
|
|
227
|
+
candidates.push(event.error.message);
|
|
228
|
+
}
|
|
229
|
+
candidates.push(event.error);
|
|
230
|
+
for (const candidate of candidates) {
|
|
231
|
+
if (typeof candidate === "string" && candidate.trim()) {
|
|
232
|
+
return unwrapApiErrorBody(candidate.trim());
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return null;
|
|
236
|
+
};
|
|
237
|
+
var unwrapApiErrorBody = (text) => {
|
|
238
|
+
if (!text.startsWith("{")) {
|
|
239
|
+
return text;
|
|
240
|
+
}
|
|
241
|
+
try {
|
|
242
|
+
const body = JSON.parse(text);
|
|
243
|
+
if (isRecord(body) && isRecord(body.error) && typeof body.error.message === "string") {
|
|
244
|
+
return typeof body.status === "number" ? `HTTP ${body.status}: ${body.error.message}` : body.error.message;
|
|
245
|
+
}
|
|
246
|
+
} catch {
|
|
247
|
+
}
|
|
248
|
+
return text;
|
|
249
|
+
};
|
|
250
|
+
var withScratchDir = async (runtime, surface, fn) => {
|
|
251
|
+
const dir = await mkdtemp(path.join(tmpdir(), "aeo-agent-probe-"));
|
|
252
|
+
try {
|
|
253
|
+
return await fn(dir);
|
|
254
|
+
} finally {
|
|
255
|
+
await rm(dir, { recursive: true, force: true });
|
|
256
|
+
if (surface === "claude_code" && !runtime.claudeConfigDir) {
|
|
257
|
+
await rm(claudeTranscriptDir(runtime.env, dir), {
|
|
258
|
+
recursive: true,
|
|
259
|
+
force: true
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
var claudeTranscriptDir = (env, cwd) => {
|
|
265
|
+
const configDir = env.CLAUDE_CONFIG_DIR ?? path.join(env.HOME ?? homedir(), ".claude");
|
|
266
|
+
return path.join(configDir, "projects", cwd.replaceAll("/", "-"));
|
|
267
|
+
};
|
|
268
|
+
var execCli = async (command, { cliArgs, cwd, runtime, env, signal }) => {
|
|
269
|
+
const local = localCommand(command, cliArgs, runtime.env);
|
|
270
|
+
const result = await runChild(local.command, local.args, {
|
|
271
|
+
cwd,
|
|
272
|
+
env,
|
|
273
|
+
timeoutMs: runtime.timeoutMs ?? agentProbeTimeoutMs,
|
|
274
|
+
maxBuffer: agentMaxBufferBytes,
|
|
275
|
+
killGraceMs: agentKillGraceMs,
|
|
276
|
+
signal
|
|
277
|
+
});
|
|
278
|
+
return { stdout: result.stdout, stderr: result.stderr };
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
export {
|
|
282
|
+
authSettingNames,
|
|
283
|
+
agentProbeTimeoutMs,
|
|
284
|
+
localCommand,
|
|
285
|
+
attachCliOutput,
|
|
286
|
+
classifyAgentError,
|
|
287
|
+
cliFailureSignals,
|
|
288
|
+
describeCliFailure,
|
|
289
|
+
withScratchDir,
|
|
290
|
+
claudeTranscriptDir,
|
|
291
|
+
execCli
|
|
292
|
+
};
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
} from "./chunk-TCOH3FGE.js";
|
|
5
5
|
import {
|
|
6
6
|
computeAISearchSummary
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FHV4PBYG.js";
|
|
8
8
|
import {
|
|
9
9
|
agentProbedPrompts
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-LOIAGEKN.js";
|
|
11
11
|
import {
|
|
12
12
|
evidenceChunkFileName
|
|
13
13
|
} from "./chunk-EDQTINTL.js";
|