literally-aeo 0.2.1 → 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 +6075 -5175
- package/dist/lib/agents/author-schema.js +5 -5
- package/dist/lib/agents/author-validation.js +9 -7
- package/dist/lib/agents/copy-validation.js +10 -10
- package/dist/lib/agents/copywriter-input.js +9 -9
- package/dist/lib/agents/facts.js +8 -8
- package/dist/lib/agents/narrative-facts.js +6 -6
- package/dist/lib/agents/verifier.js +14 -13
- 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 +9 -9
- 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 +24 -16
- package/dist/lib/bundle/verify.js +32 -24
- package/dist/lib/capture-manifest.js +6 -6
- package/dist/lib/checks/crawler-access.js +2 -2
- package/dist/lib/checks/money-pages.js +13 -0
- package/dist/lib/checks/renderability.js +2 -2
- package/dist/lib/checks/run-checks.js +12 -12
- package/dist/lib/chunks/{chunk-XAKME6NM.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-7LBSNDRR.js → chunk-3S2FAVRE.js} +22 -3
- 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-AAFHXNLU.js → chunk-4Q2WFZ5J.js} +11 -4
- package/dist/lib/chunks/{chunk-SD7LR26G.js → chunk-5JU2Y2I6.js} +2 -2
- package/dist/lib/chunks/{chunk-RPTADJXD.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-QJZTDZMB.js → chunk-7KLTOVIY.js} +9 -9
- package/dist/lib/chunks/{chunk-PXB4PWJI.js → chunk-7ZR3WDF2.js} +38 -5
- package/dist/lib/chunks/chunk-A5PF7UE2.js +86 -0
- package/dist/lib/chunks/{chunk-JXBLGCXZ.js → chunk-AB7DUTX5.js} +1 -1
- package/dist/lib/chunks/{chunk-WDT2Y7D7.js → chunk-AQCWKHTE.js} +11 -7
- package/dist/lib/chunks/{chunk-SQQ56UP2.js → chunk-ASHFEFCU.js} +3 -3
- package/dist/lib/chunks/{chunk-AK6YNTCV.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-KSOHZKV5.js → chunk-CQNIPZH3.js} +21 -21
- 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-FK2JQHAX.js +30 -0
- package/dist/lib/chunks/{chunk-K2FZFESR.js → chunk-FONFW67K.js} +4 -4
- package/dist/lib/chunks/{chunk-W5X7WJYL.js → chunk-FPPHYGIO.js} +3 -3
- package/dist/lib/chunks/{chunk-XNTFOVCE.js → chunk-FYE4R5TY.js} +2 -2
- package/dist/lib/chunks/{chunk-FIC7JSR4.js → chunk-H2DOBJZC.js} +2 -2
- package/dist/lib/chunks/{chunk-R2AJYV6A.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-JYFEXVWC.js → chunk-HYMWNGOK.js} +13 -6
- 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-SLAPBFRH.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-T5XQ6NXD.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-3OWJBGQE.js → chunk-LJCWZ5SZ.js} +14 -14
- package/dist/lib/chunks/{chunk-AJKV46SM.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-SMPP7B7F.js → chunk-MPQXB7HN.js} +7 -7
- package/dist/lib/chunks/{chunk-6JICXLDA.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-MTDYBJXH.js → chunk-OTVHGRCO.js} +8 -8
- package/dist/lib/chunks/{chunk-YZEZRQIG.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-VPXYGN4I.js → chunk-QUZYFAGP.js} +17 -22
- package/dist/lib/chunks/{chunk-HI3PD3KR.js → chunk-QVMPTT7R.js} +5 -5
- package/dist/lib/chunks/{chunk-OQFAMKLN.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-66DVMLGR.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-FL6LN2K6.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-3GPUCXVA.js → chunk-WUIY7BXR.js} +36 -19
- 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-DDS4G4DO.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-E3OGPTUY.js → chunk-ZHGABG7L.js} +2 -2
- package/dist/lib/chunks/chunk-ZZCRYG36.js +31 -0
- package/dist/lib/cli/bundle-commands.js +91 -74
- package/dist/lib/cli/run-commands.js +141 -96
- package/dist/lib/cli/status-command.js +77 -60
- 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 +25 -23
- package/dist/lib/codex-workflow/capture.js +39 -18
- 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 +20 -19
- package/dist/lib/codex-workflow/copy-recovery.js +4 -4
- package/dist/lib/codex-workflow/copy.js +17 -16
- package/dist/lib/codex-workflow/finish.js +29 -25
- package/dist/lib/codex-workflow/host-models.js +2 -2
- package/dist/lib/codex-workflow/loop.js +54 -48
- 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 +32 -29
- package/dist/lib/codex-workflow/workdir.js +18 -11
- package/dist/lib/engine/audit-file.js +9 -8
- package/dist/lib/engine/author.js +40 -37
- package/dist/lib/engine/cost-estimate.js +37 -9
- package/dist/lib/engine/local-run.js +76 -59
- package/dist/lib/engine/preflight.js +37 -9
- package/dist/lib/engine/rejudge.js +82 -65
- package/dist/lib/engine/run-bindings.js +62 -0
- package/dist/lib/engine/run-status.js +77 -60
- package/dist/lib/engine/templates.js +10 -9
- 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 +20 -18
- package/dist/lib/stores/local-versions.js +5 -5
- package/dist/lib/stores/memory.js +20 -15
- package/dist/lib/stores/publication.js +11 -11
- package/dist/lib/stores/unit-record.js +28 -0
- package/dist/lib/viewer/server.js +33 -25
- 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/checks/money-pages.d.ts +19 -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/agents/author-validation.ts +22 -1
- 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/checks/money-pages.ts +48 -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/audit-file.ts +20 -30
- 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 +3 -3
- 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
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type WorkerTransport } from '../../container/protocol';
|
|
2
|
+
import type { AeoAgentSurface, RetrievalLog } from '../../schema';
|
|
3
|
+
import type { ProbeAdapterProfile } from '../adapter';
|
|
4
|
+
import { type ProbeFailureKind } from '../failure';
|
|
5
|
+
/** authSettingNames is the variables a CLI may authenticate with, any one
|
|
6
|
+
* of which is enough: what preflight accepts and what the CLI's child
|
|
7
|
+
* environment is allowed to carry. */
|
|
8
|
+
export declare const authSettingNames: (profile: ProbeAdapterProfile) => string[];
|
|
9
|
+
export declare const agentProbeTimeoutMs: number;
|
|
10
|
+
export type AgentRuntime = {
|
|
11
|
+
env: NodeJS.ProcessEnv;
|
|
12
|
+
claudeConfigDir: string | null;
|
|
13
|
+
timeoutMs?: number;
|
|
14
|
+
transport?: WorkerTransport;
|
|
15
|
+
};
|
|
16
|
+
/** What one CLI run answered, as the parsers or a worker report it. */
|
|
17
|
+
export type AgentAnswer = {
|
|
18
|
+
text: string;
|
|
19
|
+
usedWebSearch: boolean | null;
|
|
20
|
+
retrieval: RetrievalLog;
|
|
21
|
+
requestedModel?: string | null;
|
|
22
|
+
reportedModel?: string;
|
|
23
|
+
};
|
|
24
|
+
export type AgentProbeFn = (promptText: string, runtime: AgentRuntime, signal?: AbortSignal) => Promise<AgentAnswer>;
|
|
25
|
+
/** What to spawn for an agent CLI on this machine. Codex is this package's
|
|
26
|
+
* own pinned dependency (specs/aeo-claude-operator-spec.md §4.3), run with
|
|
27
|
+
* the operator's Codex login when it is measured, unless the runtime's
|
|
28
|
+
* AEO_CODEX_BIN names another; the others come from PATH. */
|
|
29
|
+
export declare const localCommand: (command: string, args: readonly string[], env: NodeJS.ProcessEnv) => {
|
|
30
|
+
command: string;
|
|
31
|
+
args: string[];
|
|
32
|
+
};
|
|
33
|
+
export type AgentFailure = {
|
|
34
|
+
kind: ProbeFailureKind;
|
|
35
|
+
message: string;
|
|
36
|
+
};
|
|
37
|
+
type CliOutput = {
|
|
38
|
+
stdout: string;
|
|
39
|
+
stderr: string;
|
|
40
|
+
};
|
|
41
|
+
export declare const attachCliOutput: (error: unknown, output: CliOutput) => unknown;
|
|
42
|
+
export declare const classifyAgentError: (error: unknown) => AgentFailure;
|
|
43
|
+
export type CliFailureSignals = {
|
|
44
|
+
detail: string;
|
|
45
|
+
errorTexts: string[];
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* What the CLI said about its own failure: the last event it marked as an
|
|
49
|
+
* error, otherwise stderr when it wrote anything, otherwise the last message
|
|
50
|
+
* in its NDJSON stdout (the `result`, an error string, or the last text
|
|
51
|
+
* block), otherwise the raw stdout tail. Error events come before stderr
|
|
52
|
+
* because Codex always writes a stdin notice there, even when the real error
|
|
53
|
+
* is a structured event.
|
|
54
|
+
*/
|
|
55
|
+
export declare const cliFailureSignals: (output: {
|
|
56
|
+
code: number | null;
|
|
57
|
+
signal?: NodeJS.Signals | null;
|
|
58
|
+
stdout: string;
|
|
59
|
+
stderr: string;
|
|
60
|
+
}) => CliFailureSignals;
|
|
61
|
+
/** Log line for a failed CLI run; empty when there is nothing to say. */
|
|
62
|
+
export declare const describeCliFailure: (output: {
|
|
63
|
+
code: number | null;
|
|
64
|
+
signal?: NodeJS.Signals | null;
|
|
65
|
+
stdout: string;
|
|
66
|
+
stderr: string;
|
|
67
|
+
}) => string;
|
|
68
|
+
/**
|
|
69
|
+
* Creates an empty scratch directory so the agent sees no repo context, and
|
|
70
|
+
* removes it afterwards. Claude Code also writes its session transcript
|
|
71
|
+
* under `<config dir>/projects/<cwd slug>/` regardless of the scratch dir
|
|
72
|
+
* (hardening spec §2.8): with the operator's own config dir in use, that
|
|
73
|
+
* transcript — client prompt and answer — is deleted in the same finally.
|
|
74
|
+
*/
|
|
75
|
+
export declare const withScratchDir: <T>(runtime: AgentRuntime, surface: AeoAgentSurface, fn: (dir: string) => Promise<T>) => Promise<T>;
|
|
76
|
+
/** Where Claude Code keeps the transcript of a session run in `cwd`. */
|
|
77
|
+
export declare const claudeTranscriptDir: (env: NodeJS.ProcessEnv, cwd: string) => string;
|
|
78
|
+
type ExecCliOptions = {
|
|
79
|
+
cliArgs: string[];
|
|
80
|
+
cwd: string;
|
|
81
|
+
runtime: AgentRuntime;
|
|
82
|
+
env: NodeJS.ProcessEnv;
|
|
83
|
+
signal?: AbortSignal;
|
|
84
|
+
};
|
|
85
|
+
export declare const execCli: (command: string, { cliArgs, cwd, runtime, env, signal }: ExecCliOptions) => Promise<CliOutput>;
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AeoChatSurface } from '../../surfaces';
|
|
2
|
+
import { type ProbeAdapter, type ProbeAdapterProfile } from '../adapter';
|
|
3
|
+
import { type DataForSeoLocale, type DataForSeoProbeClient } from '../dataforseo';
|
|
4
|
+
export declare const dataForSeoAiOverviewProfile: ProbeAdapterProfile;
|
|
5
|
+
/** createDataForSeoAiOverviewAdapter asks through the run's client, in the
|
|
6
|
+
* run's market. Without a client (no credentials) every probe fails as
|
|
7
|
+
* an auth failure, as an unauthenticated request would. */
|
|
8
|
+
export declare const createDataForSeoAiOverviewAdapter: ({ surface, client, locale, }: {
|
|
9
|
+
surface: AeoChatSurface;
|
|
10
|
+
client: DataForSeoProbeClient | undefined;
|
|
11
|
+
locale: DataForSeoLocale;
|
|
12
|
+
}) => ProbeAdapter;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AeoChatSurface } from '../../surfaces';
|
|
2
|
+
import { ProbeAdapterId, type ChatModelProvider, type ProbeAdapter, type ProbeAdapterProfile, type ProbeFailureClass } from '../adapter';
|
|
3
|
+
export declare const probeMaxOutputTokens = 2000;
|
|
4
|
+
export declare const chatProbeTimeoutMs = 180000;
|
|
5
|
+
export declare const searchPromptPrefix = "Search the web for current information to answer the following question. Return a complete answer, not just search results.\n\n";
|
|
6
|
+
/** reportedCostOf sums the reported costs of a probe's calls; absent unless
|
|
7
|
+
* every call reported one. */
|
|
8
|
+
export declare const reportedCostOf: (costs: readonly (number | undefined)[]) => {
|
|
9
|
+
reportedCostUsd?: number;
|
|
10
|
+
};
|
|
11
|
+
/** classifyGatewayFailure keeps the error's kind and its message. */
|
|
12
|
+
export declare const classifyGatewayFailure: (error: unknown) => ProbeFailureClass;
|
|
13
|
+
/** describeTools names each provider tool a request carries, with its
|
|
14
|
+
* arguments: the tool is part of the method. */
|
|
15
|
+
export declare const describeTools: (tools: Record<string, unknown>) => {
|
|
16
|
+
name: string;
|
|
17
|
+
id: unknown;
|
|
18
|
+
args: unknown;
|
|
19
|
+
}[];
|
|
20
|
+
export type GatewayChatAdapterId = typeof ProbeAdapterId.GATEWAY_OPENAI | typeof ProbeAdapterId.GATEWAY_GOOGLE | typeof ProbeAdapterId.GATEWAY_ANTHROPIC;
|
|
21
|
+
export declare const gatewayChatProfiles: {
|
|
22
|
+
"gateway.openai@1": ProbeAdapterProfile;
|
|
23
|
+
"gateway.google@1": ProbeAdapterProfile;
|
|
24
|
+
"gateway.anthropic@1": ProbeAdapterProfile;
|
|
25
|
+
};
|
|
26
|
+
/** createGatewayChatAdapter is one search-required chat adapter, asking
|
|
27
|
+
* `model` on `surface` through the run's `gateway`. */
|
|
28
|
+
export declare const createGatewayChatAdapter: (id: GatewayChatAdapterId, { surface, gateway, model, }: {
|
|
29
|
+
surface: AeoChatSurface;
|
|
30
|
+
gateway: ChatModelProvider;
|
|
31
|
+
model: string;
|
|
32
|
+
}) => ProbeAdapter;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AeoChatSurface } from '../../surfaces';
|
|
2
|
+
import { type ChatModelProvider, type ProbeAdapter, type ProbeAdapterProfile } from '../adapter';
|
|
3
|
+
export declare const gatewayPerplexityProfile: ProbeAdapterProfile;
|
|
4
|
+
/** createGatewayPerplexityAdapter asks `model` on `surface` through the
|
|
5
|
+
* run's `gateway`. */
|
|
6
|
+
export declare const createGatewayPerplexityAdapter: ({ surface, gateway, model, }: {
|
|
7
|
+
surface: AeoChatSurface;
|
|
8
|
+
gateway: ChatModelProvider;
|
|
9
|
+
model: string;
|
|
10
|
+
}) => ProbeAdapter;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { AeoAgentSurface, RetrievalLog } from '../schema';
|
|
2
|
+
import { type AgentAnswer, type AgentFailure, type AgentRuntime } from './adapters/cli-process';
|
|
2
3
|
import type { ProbePromptInput, ProbeResult } from './probes';
|
|
3
|
-
import { type ProbeFailureKind } from './failure';
|
|
4
4
|
import { type ProbeLimiter } from './limits';
|
|
5
5
|
import type { ProbeOutcome } from './outcomes';
|
|
6
6
|
import { type ProbeTrace } from './probe-trace';
|
|
7
|
+
export type { AgentAnswer, AgentFailure, AgentRuntime, CliFailureSignals, } from './adapters/cli-process';
|
|
8
|
+
export { classifyAgentError, claudeTranscriptDir, cliFailureSignals, describeCliFailure, } from './adapters/cli-process';
|
|
7
9
|
export type AgentProbeResult = {
|
|
8
10
|
modelName: AeoAgentSurface;
|
|
9
11
|
usedWebSearch: boolean | null;
|
|
@@ -21,14 +23,10 @@ export type AgentProbeBatch = {
|
|
|
21
23
|
outcomes: AgentProbeOutcome[];
|
|
22
24
|
rejectedWebToolSurfaces: AeoAgentSurface[];
|
|
23
25
|
};
|
|
24
|
-
export type AgentRuntime = {
|
|
25
|
-
env: NodeJS.ProcessEnv;
|
|
26
|
-
claudeConfigDir: string | null;
|
|
27
|
-
timeoutMs?: number;
|
|
28
|
-
};
|
|
29
26
|
export declare const defaultAgentRuntime: (env?: NodeJS.ProcessEnv) => AgentRuntime;
|
|
30
|
-
/** Detects which agent CLIs
|
|
31
|
-
|
|
27
|
+
/** Detects which agent CLIs the runtime can start, and their versions:
|
|
28
|
+
* through its worker transport when it has one, else on this machine. */
|
|
29
|
+
export declare const detectAgentClis: (runtime?: AgentRuntime) => Promise<AgentCliVersions>;
|
|
32
30
|
export declare const versionForSurface: (surface: AeoAgentSurface, versions: AgentCliVersions) => string | null;
|
|
33
31
|
/**
|
|
34
32
|
* Pre-flight (correctness spec §3.6): every agent surface in scope needs its
|
|
@@ -41,16 +39,9 @@ export declare const agentAuthEnv: Readonly<Record<AeoAgentSurface, {
|
|
|
41
39
|
anyOf: readonly string[];
|
|
42
40
|
purpose: string;
|
|
43
41
|
}>>;
|
|
44
|
-
export declare const assertAgentAuth: (surfaces: readonly AeoAgentSurface[], env:
|
|
42
|
+
export declare const assertAgentAuth: (surfaces: readonly AeoAgentSurface[], { env, transport }: AgentRuntime) => void;
|
|
45
43
|
/** The CLI binary behind a surface, for pre-flight messages. */
|
|
46
44
|
export declare const cliNameForSurface: (surface: AeoAgentSurface) => string;
|
|
47
|
-
type AgentAnswer = {
|
|
48
|
-
text: string;
|
|
49
|
-
usedWebSearch: boolean | null;
|
|
50
|
-
retrieval: RetrievalLog;
|
|
51
|
-
requestedModel?: string | null;
|
|
52
|
-
reportedModel?: string;
|
|
53
|
-
};
|
|
54
45
|
export declare const canaryPrompt = "Reply with the single word OK and nothing else. Do not search the web.";
|
|
55
46
|
/**
|
|
56
47
|
* Canary pre-flight (§4.5): one cheap probe per agent surface in scope, so
|
|
@@ -91,42 +82,9 @@ export declare const runAgentProbesForPrompts: (args: {
|
|
|
91
82
|
signal?: AbortSignal;
|
|
92
83
|
logContext?: Record<string, unknown>;
|
|
93
84
|
}) => Promise<AgentProbeBatch>;
|
|
94
|
-
export type AgentFailure = {
|
|
95
|
-
kind: ProbeFailureKind;
|
|
96
|
-
message: string;
|
|
97
|
-
};
|
|
98
|
-
export declare const classifyAgentError: (error: unknown) => AgentFailure;
|
|
99
|
-
export type CliFailureSignals = {
|
|
100
|
-
detail: string;
|
|
101
|
-
errorTexts: string[];
|
|
102
|
-
};
|
|
103
|
-
/**
|
|
104
|
-
* What the CLI said about its own failure: the last event it marked as an
|
|
105
|
-
* error, otherwise stderr when it wrote anything, otherwise the last message
|
|
106
|
-
* in its NDJSON stdout (the `result`, an error string, or the last text
|
|
107
|
-
* block), otherwise the raw stdout tail. Error events come before stderr
|
|
108
|
-
* because Codex always writes a stdin notice there, even when the real error
|
|
109
|
-
* is a structured event.
|
|
110
|
-
*/
|
|
111
|
-
export declare const cliFailureSignals: (output: {
|
|
112
|
-
code: number | null;
|
|
113
|
-
signal?: NodeJS.Signals | null;
|
|
114
|
-
stdout: string;
|
|
115
|
-
stderr: string;
|
|
116
|
-
}) => CliFailureSignals;
|
|
117
|
-
/** Log line for a failed CLI run; empty when there is nothing to say. */
|
|
118
|
-
export declare const describeCliFailure: (output: {
|
|
119
|
-
code: number | null;
|
|
120
|
-
signal?: NodeJS.Signals | null;
|
|
121
|
-
stdout: string;
|
|
122
|
-
stderr: string;
|
|
123
|
-
}) => string;
|
|
124
|
-
/** Where Claude Code keeps the transcript of a session run in `cwd`. */
|
|
125
|
-
export declare const claudeTranscriptDir: (env: NodeJS.ProcessEnv, cwd: string) => string;
|
|
126
85
|
/** Called only inside a fixed isolated worker, or by the local CLI path. */
|
|
127
86
|
export declare const runAgentProbeDirect: (surface: AeoAgentSurface, { prompt, runtime, signal, }: {
|
|
128
87
|
prompt: string;
|
|
129
88
|
runtime: AgentRuntime;
|
|
130
89
|
signal?: AbortSignal;
|
|
131
90
|
}) => Promise<AgentAnswer>;
|
|
132
|
-
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RetrievalLog } from '../schema';
|
|
2
|
+
import type { ProbeAnswer } from './adapter';
|
|
3
|
+
import { type RedirectResolution } from './grounding-urls';
|
|
4
|
+
export declare const searchSourcesMarker = "Sources used by search:";
|
|
5
|
+
export declare const aiOverviewSourcesMarker = "Sources cited in AI Overview:";
|
|
6
|
+
/** renderAnswer is the answer's text with its source block. */
|
|
7
|
+
export declare const renderAnswer: (answer: ProbeAnswer) => string;
|
|
8
|
+
export type FinalAnswer = {
|
|
9
|
+
text: string;
|
|
10
|
+
retrieval: RetrievalLog | null;
|
|
11
|
+
/** Every redirect resolution attempted, for the journal; empty when the
|
|
12
|
+
* answer named no wrapper or the adapter keeps them. */
|
|
13
|
+
redirects: RedirectResolution[];
|
|
14
|
+
};
|
|
15
|
+
/** finalizeAnswer renders, strips U+0000 and resolves redirects, in that
|
|
16
|
+
* order. */
|
|
17
|
+
export declare const finalizeAnswer: (answer: ProbeAnswer, { resolvesRedirects, logContext, }: {
|
|
18
|
+
resolvesRedirects: boolean;
|
|
19
|
+
logContext?: Record<string, unknown>;
|
|
20
|
+
}) => Promise<FinalAnswer>;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { Log } from '../lib/log';
|
|
2
|
+
import type { RetrievalLog } from '../schema';
|
|
3
|
+
import type { ProbeAdapter, ProbeAnswer } from './adapter';
|
|
4
|
+
import { type ProbeFailureKind, type RetryPolicy } from './failure';
|
|
5
|
+
import { type ProbeLimiter } from './limits';
|
|
6
|
+
import type { ProbeOutcome } from './outcomes';
|
|
7
|
+
import { type ProbeAttemptHandle, type ProbeTrace } from './probe-trace';
|
|
8
|
+
type AttemptRules = {
|
|
9
|
+
/** The family's name in log lines. */
|
|
10
|
+
label: string;
|
|
11
|
+
policy: Readonly<Record<ProbeFailureKind, RetryPolicy>>;
|
|
12
|
+
/** ±20% on every retry delay, so units that failed together do not all
|
|
13
|
+
* retry in the same second. */
|
|
14
|
+
jitter: boolean;
|
|
15
|
+
/** Whether the attempt takes a slot on its adapter's pool. */
|
|
16
|
+
pooled: boolean;
|
|
17
|
+
completedLevel: 'debug' | 'info';
|
|
18
|
+
};
|
|
19
|
+
export declare const attemptRules: {
|
|
20
|
+
readonly chat: {
|
|
21
|
+
readonly label: "Probe";
|
|
22
|
+
readonly policy: Readonly<Record<"timeout" | "capacity" | "auth" | "cli_error" | "rejected_web_tool" | "parser" | "empty_answer" | "persistence", RetryPolicy>>;
|
|
23
|
+
readonly jitter: true;
|
|
24
|
+
readonly pooled: true;
|
|
25
|
+
readonly completedLevel: "debug";
|
|
26
|
+
};
|
|
27
|
+
readonly agent: {
|
|
28
|
+
readonly label: "Agent probe";
|
|
29
|
+
readonly policy: Readonly<Record<"timeout" | "capacity" | "auth" | "cli_error" | "rejected_web_tool" | "parser" | "empty_answer" | "persistence", RetryPolicy>>;
|
|
30
|
+
readonly jitter: true;
|
|
31
|
+
readonly pooled: true;
|
|
32
|
+
readonly completedLevel: "info";
|
|
33
|
+
};
|
|
34
|
+
readonly canary: {
|
|
35
|
+
readonly label: "Canary probe";
|
|
36
|
+
readonly policy: Readonly<Record<"timeout" | "capacity" | "auth" | "cli_error" | "rejected_web_tool" | "parser" | "empty_answer" | "persistence", RetryPolicy>>;
|
|
37
|
+
readonly jitter: false;
|
|
38
|
+
readonly pooled: false;
|
|
39
|
+
readonly completedLevel: "info";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
/** What the journal names an attempt by. */
|
|
43
|
+
export type AttemptUnit = {
|
|
44
|
+
promptId: string;
|
|
45
|
+
promptText: string;
|
|
46
|
+
runIndex: number;
|
|
47
|
+
};
|
|
48
|
+
export type AttemptHost = {
|
|
49
|
+
rules: AttemptRules;
|
|
50
|
+
trace?: ProbeTrace;
|
|
51
|
+
/** Required unless the rules take no pool. */
|
|
52
|
+
limiter?: ProbeLimiter;
|
|
53
|
+
signal?: AbortSignal;
|
|
54
|
+
log: Log;
|
|
55
|
+
logContext: Record<string, unknown>;
|
|
56
|
+
};
|
|
57
|
+
export type AttemptResult = {
|
|
58
|
+
status: 'answered';
|
|
59
|
+
answer: ProbeAnswer;
|
|
60
|
+
attempts: number;
|
|
61
|
+
durationMs: number;
|
|
62
|
+
/** The answered attempt's open operation; the caller ends it. */
|
|
63
|
+
handle: ProbeAttemptHandle | undefined;
|
|
64
|
+
} | {
|
|
65
|
+
status: 'failed';
|
|
66
|
+
kind: ProbeFailureKind;
|
|
67
|
+
lastError: string;
|
|
68
|
+
attempts: number;
|
|
69
|
+
/** The last error thrown, when one was: a provider error, or the
|
|
70
|
+
* ProbeTraceError of an operation that could not be opened. */
|
|
71
|
+
cause?: unknown;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* requestedModelOf is the model a probe asked for: the model its binding
|
|
75
|
+
* pins for a model API; otherwise the one the answer names (Codex learns
|
|
76
|
+
* it only when it answers); otherwise none.
|
|
77
|
+
*/
|
|
78
|
+
export declare const requestedModelOf: (bound: {
|
|
79
|
+
model?: string;
|
|
80
|
+
}, answeredModel?: string | null) => string | null;
|
|
81
|
+
/**
|
|
82
|
+
* runProbeAttempts asks `adapter` until it answers or its retry policy is
|
|
83
|
+
* spent. Each attempt opens its operation inside the pool slot, so the
|
|
84
|
+
* operation starts when the request does, and before it: no dispatch goes
|
|
85
|
+
* unrecorded. An answered attempt's operation is left open for the caller,
|
|
86
|
+
* who finalises the answer before ending it.
|
|
87
|
+
*/
|
|
88
|
+
export declare const runProbeAttempts: (adapter: ProbeAdapter, unit: AttemptUnit, host: AttemptHost) => Promise<AttemptResult>;
|
|
89
|
+
/** reportedModelOf applies the adapter's served-model rule. */
|
|
90
|
+
export declare const reportedModelOf: (adapter: ProbeAdapter, answer: ProbeAnswer) => string | undefined;
|
|
91
|
+
/** A unit's answer as it is banked and journaled. */
|
|
92
|
+
export type BankedAnswer = {
|
|
93
|
+
text: string;
|
|
94
|
+
retrieval: RetrievalLog | null;
|
|
95
|
+
requestedModel: string | null;
|
|
96
|
+
reportedModel?: string;
|
|
97
|
+
noOverview?: true;
|
|
98
|
+
usedWebSearch?: boolean | null;
|
|
99
|
+
};
|
|
100
|
+
export type UnitHost<P> = AttemptHost & {
|
|
101
|
+
/** The banked result of an answer. */
|
|
102
|
+
toResult: (answer: BankedAnswer) => P;
|
|
103
|
+
/** Banks a captured result. A throw fails the unit as `persistence`; the
|
|
104
|
+
* probe is never dispatched again (hardening spec §4.2). */
|
|
105
|
+
bank?: (result: P) => Promise<void>;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* runProbeUnit runs one planned unit to exactly one outcome: its answer
|
|
109
|
+
* finalised, its operation ended with what is banked, and the result
|
|
110
|
+
* banked; or the typed failure that stopped it.
|
|
111
|
+
*/
|
|
112
|
+
export declare const runProbeUnit: <P>(adapter: ProbeAdapter, unit: AttemptUnit, host: UnitHost<P>) => Promise<ProbeOutcome<P>>;
|
|
113
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { CapturedUnitRecord } from '../stores/ports';
|
|
2
|
+
import { type AeoChatSurface, type AeoSurface } from '../surfaces';
|
|
3
|
+
import { ProbeAdapterId, type ChatModelProvider, type ProbeAdapter, type ProbeAdapterProfile } from './adapter';
|
|
4
|
+
import { type DataForSeoProbeClient } from './dataforseo';
|
|
5
|
+
import { type ProbeBinding } from './legacy-bindings';
|
|
6
|
+
export type { ProbeBinding };
|
|
7
|
+
/** A run's frozen bindings: one per surface. */
|
|
8
|
+
export type RunBindings = Readonly<Record<AeoSurface, ProbeBinding>>;
|
|
9
|
+
/**
|
|
10
|
+
* Thrown before any dispatch when a run's frozen bindings cannot be
|
|
11
|
+
* honoured: a binding the installed engine cannot build, or a banked answer
|
|
12
|
+
* taken with another adapter. The run stops resumable (exit 2); nothing is
|
|
13
|
+
* probed under a binding the run did not freeze.
|
|
14
|
+
*/
|
|
15
|
+
export declare class RunBindingsError extends Error {
|
|
16
|
+
constructor(message: string);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* What a run hands its adapters (probe adapters spec §3.1): everything an
|
|
20
|
+
* adapter needs is passed in when it is created, never read from the
|
|
21
|
+
* environment or a module global.
|
|
22
|
+
*/
|
|
23
|
+
export type ProbeDependencies = {
|
|
24
|
+
/** The run's frozen bindings: which adapter measures each surface. */
|
|
25
|
+
bindings: RunBindings;
|
|
26
|
+
/** The run's gateway provider, created with its own key. */
|
|
27
|
+
gateway: ChatModelProvider;
|
|
28
|
+
/** The run's DataForSEO client; absent when the run has no credentials,
|
|
29
|
+
* which fails each AI Overview probe as an auth failure. */
|
|
30
|
+
dataForSeo?: DataForSeoProbeClient;
|
|
31
|
+
/** Adapters beyond the engine's own: consulted first for a chat surface,
|
|
32
|
+
* with the binding the run froze for it. A host or a test registers one
|
|
33
|
+
* here; nothing in the engine changes to add it. */
|
|
34
|
+
registry?: ChatAdapterRegistry;
|
|
35
|
+
};
|
|
36
|
+
/** An adapter for `surface` under `binding`, or undefined to leave it to
|
|
37
|
+
* the engine's own adapters. */
|
|
38
|
+
export type ChatAdapterRegistry = (surface: AeoChatSurface, binding: ProbeBinding) => ProbeAdapter | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* probeDependenciesOf creates a run's probe clients from its settings, for
|
|
41
|
+
* the local run and for a host alike: the engine builds the gateway with its
|
|
42
|
+
* own pinned provider package, which shapes every probe request. The
|
|
43
|
+
* gateway key is required: without one, the provider package would look
|
|
44
|
+
* for a key in the process environment on its own. The DataForSEO client is
|
|
45
|
+
* absent when its credentials are not set; preflight requires them for
|
|
46
|
+
* every surface in scope.
|
|
47
|
+
*/
|
|
48
|
+
export declare const probeDependenciesOf: (env: NodeJS.ProcessEnv, bindings: RunBindings) => ProbeDependencies;
|
|
49
|
+
export declare const defaultProbeBindings: RunBindings;
|
|
50
|
+
/** Every registered adapter's profile, by ID. */
|
|
51
|
+
export declare const probeAdapterProfiles: Readonly<Record<ProbeAdapterId, ProbeAdapterProfile>>;
|
|
52
|
+
/** The profile of the adapter a binding names. */
|
|
53
|
+
export declare const profileOf: (binding: ProbeBinding) => ProbeAdapterProfile;
|
|
54
|
+
/**
|
|
55
|
+
* availableBindings returns a run's frozen bindings once the installed
|
|
56
|
+
* engine can build every one of them, and otherwise names the binding the
|
|
57
|
+
* run needs.
|
|
58
|
+
*/
|
|
59
|
+
export declare const availableBindings: (frozen: Readonly<Record<string, {
|
|
60
|
+
adapter: string;
|
|
61
|
+
model?: string;
|
|
62
|
+
}>>) => RunBindings;
|
|
63
|
+
/** The adapter a banked answer was captured with: the one its capture
|
|
64
|
+
* metadata names, or, when it names none, its surface's legacy adapter. */
|
|
65
|
+
export declare const capturedAdapterOf: (record: CapturedUnitRecord) => string;
|
|
66
|
+
/**
|
|
67
|
+
* bankBindingMismatches lists the banked answers a run cannot reuse: those
|
|
68
|
+
* taken with another adapter than the surface's frozen binding. Unit keys
|
|
69
|
+
* do not carry the adapter, so without this check a changed binding would
|
|
70
|
+
* reuse answers measured another way.
|
|
71
|
+
*/
|
|
72
|
+
export declare const bankBindingMismatches: (records: readonly CapturedUnitRecord[], bindings: RunBindings) => CapturedUnitRecord[];
|
|
73
|
+
/** createChatAdapter is the adapter `surface` is bound to by default, asking
|
|
74
|
+
* in the run's market. */
|
|
75
|
+
export declare const createChatAdapter: (surface: AeoChatSurface, { geography, language, dependencies, }: {
|
|
76
|
+
geography: string;
|
|
77
|
+
language: string;
|
|
78
|
+
dependencies: ProbeDependencies;
|
|
79
|
+
}) => ProbeAdapter;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ModelBudgetError, type ModelCallAccounting } from '../models/accounting';
|
|
2
|
+
import { type RunBindings } from './bindings';
|
|
2
3
|
import type { ProbeTrace } from './probe-trace';
|
|
3
4
|
export type ChargedTrace = {
|
|
4
5
|
trace: ProbeTrace;
|
|
5
6
|
/** The first refusal of the cap, once an attempt was refused. */
|
|
6
7
|
exhausted: () => ModelBudgetError | undefined;
|
|
7
8
|
};
|
|
8
|
-
export declare const chargedProbeTrace: (trace: ProbeTrace, ledger: ModelCallAccounting) => ChargedTrace;
|
|
9
|
+
export declare const chargedProbeTrace: (trace: ProbeTrace, ledger: ModelCallAccounting, bindings: RunBindings) => ChargedTrace;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { resolveDataForSeoLocale } from './dataforseo-locale';
|
|
1
2
|
export type AIOverviewReference = {
|
|
2
3
|
source: string;
|
|
3
4
|
domain: string;
|
|
@@ -12,4 +13,26 @@ export type AIOverviewOutcome = {
|
|
|
12
13
|
} | {
|
|
13
14
|
status: 'no_overview';
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
+
/** Where a SERP is placed: a market resolveDataForSeoLocale mapped. */
|
|
17
|
+
export type DataForSeoLocale = NonNullable<ReturnType<typeof resolveDataForSeoLocale>>;
|
|
18
|
+
export type DataForSeoProbeClient = {
|
|
19
|
+
getGoogleAIOverview: (query: string, locale: DataForSeoLocale) => Promise<AIOverviewOutcome>;
|
|
20
|
+
};
|
|
21
|
+
export declare const aiOverviewEndpoint = "/serp/google/organic/live/advanced";
|
|
22
|
+
/** aiOverviewTask is the SERP task an AI Overview probe sends. */
|
|
23
|
+
export declare const aiOverviewTask: (query: string, locale: DataForSeoLocale) => {
|
|
24
|
+
keyword: string;
|
|
25
|
+
language_code: string;
|
|
26
|
+
location_code: number;
|
|
27
|
+
load_async_ai_overview: boolean;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* createDataForSeoProbeClient is one run's AI Overview client. Requests are
|
|
31
|
+
* spaced by the client's own throttle: callers queue behind one chain
|
|
32
|
+
* instead of all reading the last request time before any of them awaits
|
|
33
|
+
* (§3.5).
|
|
34
|
+
*/
|
|
35
|
+
export declare const createDataForSeoProbeClient: ({ login, password, }: {
|
|
36
|
+
login: string;
|
|
37
|
+
password: string;
|
|
38
|
+
}) => DataForSeoProbeClient;
|
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
import { groundingRedirectUrlPrefix, isGroundingRedirectUrl } from '../grounding';
|
|
2
2
|
export { groundingRedirectUrlPrefix, isGroundingRedirectUrl };
|
|
3
3
|
export declare const extractGroundingRedirectUrls: (text: string) => string[];
|
|
4
|
+
/** What resolving one wrapper URL found: its target, or why there is none,
|
|
5
|
+
* after how many requests. Recorded in the probe's journal operation. */
|
|
6
|
+
export type RedirectResolution = {
|
|
7
|
+
url: string;
|
|
8
|
+
target: string | null;
|
|
9
|
+
hops: number;
|
|
10
|
+
failure?: string;
|
|
11
|
+
};
|
|
4
12
|
/**
|
|
5
|
-
* Resolves every unique grounding-redirect URL in `urls` to its real target
|
|
6
|
-
*
|
|
7
|
-
* (callers keep the original URL), so a flaky
|
|
8
|
-
* Runs a sliding-window worker pool so one slow
|
|
9
|
-
* slot, not a whole batch.
|
|
13
|
+
* Resolves every unique grounding-redirect URL in `urls` to its real target
|
|
14
|
+
* and reports each attempt. `resolved` maps redirect URL → resolved URL;
|
|
15
|
+
* failures are absent from it (callers keep the original URL), so a flaky
|
|
16
|
+
* redirect never fails a run. Runs a sliding-window worker pool so one slow
|
|
17
|
+
* URL only delays its own slot, not a whole batch.
|
|
10
18
|
*/
|
|
19
|
+
export declare const traceGroundingRedirects: (urls: Iterable<string>, logContext?: Record<string, unknown>) => Promise<{
|
|
20
|
+
resolved: Map<string, string>;
|
|
21
|
+
resolutions: RedirectResolution[];
|
|
22
|
+
}>;
|
|
23
|
+
/** resolveGroundingRedirects is traceGroundingRedirects' map alone. */
|
|
11
24
|
export declare const resolveGroundingRedirects: (urls: Iterable<string>, logContext?: Record<string, unknown>) => Promise<Map<string, string>>;
|
|
12
25
|
/**
|
|
13
26
|
* Replaces resolved redirect URLs inside free text in a single pass. Each
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ProbeAdapterId } from './adapter';
|
|
2
|
+
export type ProbeBinding = {
|
|
3
|
+
adapter: ProbeAdapterId;
|
|
4
|
+
/** The model a model-API adapter asks for. */
|
|
5
|
+
model?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const legacyProbeBindings: {
|
|
8
|
+
readonly chatgpt: {
|
|
9
|
+
readonly adapter: "gateway.openai@1";
|
|
10
|
+
readonly model: "openai/gpt-5.4-mini";
|
|
11
|
+
};
|
|
12
|
+
readonly gemini: {
|
|
13
|
+
readonly adapter: "gateway.google@1";
|
|
14
|
+
readonly model: "google/gemini-3-flash";
|
|
15
|
+
};
|
|
16
|
+
readonly claude: {
|
|
17
|
+
readonly adapter: "gateway.anthropic@1";
|
|
18
|
+
readonly model: "anthropic/claude-sonnet-4.5";
|
|
19
|
+
};
|
|
20
|
+
readonly perplexity: {
|
|
21
|
+
readonly adapter: "gateway.perplexity@1";
|
|
22
|
+
readonly model: "perplexity/sonar-pro";
|
|
23
|
+
};
|
|
24
|
+
readonly google_ai_overview: {
|
|
25
|
+
readonly adapter: "dataforseo.ai_overview@1";
|
|
26
|
+
};
|
|
27
|
+
readonly claude_code: {
|
|
28
|
+
readonly adapter: "cli.claude_code@1";
|
|
29
|
+
};
|
|
30
|
+
readonly codex: {
|
|
31
|
+
readonly adapter: "cli.codex@1";
|
|
32
|
+
};
|
|
33
|
+
readonly cursor: {
|
|
34
|
+
readonly adapter: "cli.cursor@1";
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -11,18 +11,24 @@ export type ProbeLimits = z.infer<typeof probeLimitsSchema>;
|
|
|
11
11
|
export type ProbeProvider = keyof ProbeLimits;
|
|
12
12
|
type RunOptions = {
|
|
13
13
|
signal?: AbortSignal;
|
|
14
|
+
/** A pause of its own the work also waits out, beside its pool's: one
|
|
15
|
+
* adapter's capacity pause, so a 429 on one surface never holds back
|
|
16
|
+
* another surface sharing the pool. */
|
|
17
|
+
pauseKey?: string;
|
|
14
18
|
};
|
|
15
19
|
export declare class ProbeLimiter {
|
|
16
20
|
#private;
|
|
17
21
|
constructor(limits: ProbeLimits);
|
|
18
22
|
/**
|
|
19
|
-
* Holds new work
|
|
20
|
-
*
|
|
21
|
-
*
|
|
23
|
+
* Holds new work under `key` (a provider pool, or the pause key of one
|
|
24
|
+
* adapter) for `delayMs`, extending any pause already running. A
|
|
25
|
+
* rate-limited provider then sees one retry per window instead of every
|
|
26
|
+
* queued unit spending an attempt on the same 429.
|
|
22
27
|
*/
|
|
23
|
-
pause(
|
|
24
|
-
/** Runs `fn` once the provider
|
|
25
|
-
|
|
28
|
+
pause(key: string, delayMs: number): void;
|
|
29
|
+
/** Runs `fn` once neither the provider nor the work's own pause key is
|
|
30
|
+
* paused and a slot on the provider's pool is free. */
|
|
31
|
+
run<T>(provider: ProbeProvider, fn: () => Promise<T>, { signal, pauseKey }?: RunOptions): Promise<T>;
|
|
26
32
|
}
|
|
27
33
|
/** An unbounded limiter for tests and one-off scripts. */
|
|
28
34
|
export declare const unlimited: () => ProbeLimiter;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { RetrievalLog } from '../schema';
|
|
2
2
|
import type { AeoSurface } from '../surfaces';
|
|
3
|
+
import type { ProbeRequest } from './adapter';
|
|
4
|
+
import type { RedirectResolution } from './grounding-urls';
|
|
3
5
|
export type ProbeAttemptStart = {
|
|
4
6
|
sectionKey?: string;
|
|
5
7
|
surface: AeoSurface;
|
|
@@ -11,6 +13,11 @@ export type ProbeAttemptStart = {
|
|
|
11
13
|
retryOf?: string;
|
|
12
14
|
/** What the probe asks for, when it is known before dispatch. */
|
|
13
15
|
requestedModel: string | null;
|
|
16
|
+
/** The adapter dispatching the attempt (spec §4.9). */
|
|
17
|
+
adapter?: string;
|
|
18
|
+
/** The request as dispatched: the prompt with any prefix, and the
|
|
19
|
+
* parameters that shape the answer. */
|
|
20
|
+
request?: ProbeRequest;
|
|
14
21
|
};
|
|
15
22
|
export type ProbeAttemptEnd = {
|
|
16
23
|
outcome: 'succeeded';
|
|
@@ -21,6 +28,9 @@ export type ProbeAttemptEnd = {
|
|
|
21
28
|
noOverview?: true;
|
|
22
29
|
/** What the provider reported the attempt cost, when it did. */
|
|
23
30
|
costUsd?: number;
|
|
31
|
+
/** The redirect resolutions finalising the answer made: the network
|
|
32
|
+
* requests after the provider answered. */
|
|
33
|
+
redirects?: readonly RedirectResolution[];
|
|
24
34
|
} | {
|
|
25
35
|
outcome: 'failed' | 'cancelled';
|
|
26
36
|
kind: string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { AeoChatSurface,
|
|
2
|
-
import {
|
|
1
|
+
import type { AeoChatSurface, ChatProbeConfig, RetrievalLog } from '../schema';
|
|
2
|
+
import type { AeoSurface } from '../surfaces';
|
|
3
|
+
import { type ProbeDependencies } from './bindings';
|
|
3
4
|
import { type ProbeLimiter } from './limits';
|
|
4
5
|
import type { ProbeOutcome } from './outcomes';
|
|
5
|
-
|
|
6
|
+
import type { ProbeTrace } from './probe-trace';
|
|
6
7
|
export type ProbeResult = {
|
|
7
8
|
promptId: string;
|
|
8
9
|
promptText: string;
|
|
@@ -35,6 +36,7 @@ export type ProbeJob = {
|
|
|
35
36
|
trace?: ProbeTrace;
|
|
36
37
|
limiter?: ProbeLimiter;
|
|
37
38
|
signal?: AbortSignal;
|
|
39
|
+
dependencies: ProbeDependencies;
|
|
38
40
|
};
|
|
39
41
|
/**
|
|
40
42
|
* Runs every planned chat probe (prompt × surface × run) through the
|