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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Range } from '../models/cost-coefficients';
|
|
2
2
|
import type { SupportedModel } from '../models/supported-models';
|
|
3
|
+
import { type RunBindings } from '../probes/bindings';
|
|
3
4
|
import type { RunPlan } from '../runner';
|
|
4
5
|
export type CostRange = Range<number>;
|
|
5
6
|
export type RunCostEstimate = {
|
|
@@ -29,10 +30,13 @@ type EstimateRunOptions = {
|
|
|
29
30
|
plan: Pick<RunPlan, 'units' | 'probesBySurface'>;
|
|
30
31
|
model: SupportedModel;
|
|
31
32
|
grounding: 'full' | 'extraction_only';
|
|
33
|
+
/** The bindings the run measures with: each surface's probes cost what
|
|
34
|
+
* its bound adapter costs. */
|
|
35
|
+
bindings: RunBindings;
|
|
32
36
|
};
|
|
33
37
|
/** estimateRunCost estimates a whole run as planned; a resume spends less,
|
|
34
38
|
* because banked answers are never probed again. */
|
|
35
|
-
export declare const estimateRunCost: ({ plan, model, grounding, }: EstimateRunOptions) => RunCostEstimate;
|
|
39
|
+
export declare const estimateRunCost: ({ plan, model, grounding, bindings, }: EstimateRunOptions) => RunCostEstimate;
|
|
36
40
|
/** estimateAuthorCost estimates one author session and its research. */
|
|
37
41
|
export declare const estimateAuthorCost: (model: SupportedModel) => AuthorCostEstimate;
|
|
38
42
|
/** One line a person reads: "$12.40 to $38.10 (estimate)". */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type RunBindings } from '../probes/bindings';
|
|
1
2
|
import { type AeoAgentSurface, type AeoSurface } from '../schema';
|
|
2
3
|
import type { Settings } from './env-file';
|
|
3
4
|
export declare const minimumNodeMajor = 24;
|
|
@@ -6,7 +7,8 @@ export type PreflightCheck = {
|
|
|
6
7
|
ok: boolean;
|
|
7
8
|
detail: string;
|
|
8
9
|
};
|
|
9
|
-
export declare const
|
|
10
|
+
export declare const engineSecretSettingNames: readonly ["AI_GATEWAY_API_KEY", "DATAFORSEO_PASSWORD", "AEO_DATABASE_URL", "AEO_SITE_DATABASE_URL", "AEO_API_TOKEN", "GOOGLE_GENERATIVE_AI_API_KEY", "PERPLEXITY_API_KEY"];
|
|
11
|
+
export declare const credentialSettingNames: readonly string[];
|
|
10
12
|
/** Every setting a run may read, for applying the env file. */
|
|
11
13
|
export declare const runSettingNames: string[];
|
|
12
14
|
/** How an agent surface authenticates on this machine: a variable, or the
|
|
@@ -31,4 +33,7 @@ export declare const runPreflight: (args: {
|
|
|
31
33
|
groundingSearch?: boolean;
|
|
32
34
|
/** Money pages are rendered in Chromium by the renderability check. */
|
|
33
35
|
rendersPages?: boolean;
|
|
36
|
+
/** The bindings the run measures with: each surface's adapter, whose
|
|
37
|
+
* settings preflight requires. */
|
|
38
|
+
bindings: RunBindings;
|
|
34
39
|
}) => Promise<PreflightCheck[]>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type RunBindings } from '../probes/bindings';
|
|
2
|
+
export declare const bindingsFile = "bindings.json";
|
|
3
|
+
/**
|
|
4
|
+
* estimateBindingsOf is the bindings a run directory's estimate prices: its
|
|
5
|
+
* frozen bindings once it has usable ones, else the defaults a new run
|
|
6
|
+
* would freeze. Read-only. A frozen binding the engine cannot build is the
|
|
7
|
+
* run's start to refuse (exit 2), not the estimate's.
|
|
8
|
+
*/
|
|
9
|
+
export declare const estimateBindingsOf: (bankPath: string) => Promise<RunBindings>;
|
|
10
|
+
/**
|
|
11
|
+
* resolveRunBindings returns the bindings a run measures with: the frozen
|
|
12
|
+
* ones on a resume, refused when the installed engine cannot build them;
|
|
13
|
+
* otherwise the defaults for a new run, or the legacy bindings for a run
|
|
14
|
+
* that started before bindings were frozen, written before they are used.
|
|
15
|
+
*/
|
|
16
|
+
export declare const resolveRunBindings: (bankPath: string, { startedBefore }: {
|
|
17
|
+
startedBefore: boolean;
|
|
18
|
+
}) => Promise<RunBindings>;
|
|
19
|
+
/**
|
|
20
|
+
* carryFrozenBindings gives a derived run directory (a rejudgment) the
|
|
21
|
+
* bindings its reused answers were captured under: the source's frozen
|
|
22
|
+
* file, or, from before bindings were frozen, the legacy bindings. Never
|
|
23
|
+
* the installed defaults.
|
|
24
|
+
*/
|
|
25
|
+
export declare const carryFrozenBindings: (sourceBank: string, targetBank: string) => Promise<void>;
|
|
@@ -79,6 +79,13 @@ export type ModelCallAccounting = {
|
|
|
79
79
|
reserve(call: ModelCallReservation): Promise<void>;
|
|
80
80
|
assertOwned(): Promise<void>;
|
|
81
81
|
settle(callId: string, usage: ModelCallUsage): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Withdraws a reservation whose call was never dispatched (its operation
|
|
84
|
+
* could not be recorded first). Unlike a settlement at $0, it records no
|
|
85
|
+
* cost the provider did not report: the call leaves the ledger. A settled
|
|
86
|
+
* call cannot be released.
|
|
87
|
+
*/
|
|
88
|
+
release(callId: string): Promise<void>;
|
|
82
89
|
/** Present when the run records its execution: the request before
|
|
83
90
|
* dispatch, the response before settlement. A failure stops the call. */
|
|
84
91
|
observe?(callId: string, evidence: ModelCallEvidence): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ProbeAdapterId } from '../probes/adapter';
|
|
2
2
|
import type { TokenUsage } from './pricing';
|
|
3
|
-
export declare const costCoefficientsVersion =
|
|
3
|
+
export declare const costCoefficientsVersion = 2;
|
|
4
4
|
export type TokenRange = {
|
|
5
5
|
input: number;
|
|
6
6
|
output: number;
|
|
@@ -85,9 +85,9 @@ export declare const searchUsdPerAnswer: {
|
|
|
85
85
|
readonly low: 0.001;
|
|
86
86
|
readonly high: 0.01;
|
|
87
87
|
};
|
|
88
|
-
/** One probe unit, by
|
|
89
|
-
*
|
|
90
|
-
export declare const probeUsd: Record<
|
|
88
|
+
/** One probe unit, by adapter, in USD. The coding-agent CLIs run on the
|
|
89
|
+
* operator's own plan and bill nothing to the run's cap. */
|
|
90
|
+
export declare const probeUsd: Readonly<Record<ProbeAdapterId, Range<number>>>;
|
|
91
91
|
/** The calibrated workload a Codex session is: a batch of answer files
|
|
92
92
|
* (analyze, qualify, review), the whole report (write) or a brief
|
|
93
93
|
* (author). Each stage's descriptor names its own. */
|
package/dist/types/pipeline.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { type AgentCliVersions, type AgentProbeResult, type AgentRuntime } from
|
|
|
4
4
|
import type { ProbeFailureKind } from './probes/failure';
|
|
5
5
|
import type { ProbeLimiter } from './probes/limits';
|
|
6
6
|
import { type ProbeTrace } from './probes/probe-trace';
|
|
7
|
+
import type { ProbeDependencies } from './probes/bindings';
|
|
7
8
|
import { type AnalysisStore, type ProbeStore } from './stores/ports';
|
|
8
9
|
import type { BrandMentionAnswer } from './analysis/sentiment';
|
|
9
10
|
import type { InternalModelContext } from './models/context';
|
|
@@ -61,6 +62,7 @@ export type SectionRunArgs = {
|
|
|
61
62
|
agentRuntime?: AgentRuntime;
|
|
62
63
|
trace?: ProbeTrace;
|
|
63
64
|
signal?: AbortSignal;
|
|
65
|
+
probeDependencies: ProbeDependencies;
|
|
64
66
|
logContext: Record<string, unknown>;
|
|
65
67
|
};
|
|
66
68
|
export type AnalyzedRun = {
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { LanguageModel } from 'ai';
|
|
2
|
+
import type { Range } from '../models/cost-coefficients';
|
|
3
|
+
import type { RetrievalExposure, RetrievalLog } from '../schema';
|
|
4
|
+
import type { AeoSurface } from '../surfaces';
|
|
5
|
+
import type { AIOverviewReference } from './dataforseo';
|
|
6
|
+
import type { ProbeFailureKind } from './failure';
|
|
7
|
+
import type { ProbeProvider } from './limits';
|
|
8
|
+
/** Every registered adapter, with its version. A change to an adapter's
|
|
9
|
+
* request or parsing bumps its version. */
|
|
10
|
+
export declare const ProbeAdapterId: {
|
|
11
|
+
readonly GATEWAY_OPENAI: "gateway.openai@1";
|
|
12
|
+
readonly GATEWAY_GOOGLE: "gateway.google@1";
|
|
13
|
+
readonly GATEWAY_ANTHROPIC: "gateway.anthropic@1";
|
|
14
|
+
readonly GATEWAY_PERPLEXITY: "gateway.perplexity@1";
|
|
15
|
+
readonly DATAFORSEO_AI_OVERVIEW: "dataforseo.ai_overview@1";
|
|
16
|
+
readonly CLI_CLAUDE_CODE: "cli.claude_code@1";
|
|
17
|
+
readonly CLI_CODEX: "cli.codex@1";
|
|
18
|
+
readonly CLI_CURSOR: "cli.cursor@1";
|
|
19
|
+
};
|
|
20
|
+
export type ProbeAdapterId = (typeof ProbeAdapterId)[keyof typeof ProbeAdapterId];
|
|
21
|
+
/** A setting an adapter reads. Settings that share a group are
|
|
22
|
+
* alternatives: any one of them is enough. `billsAccount` names the
|
|
23
|
+
* provider account an auth setting bills per use, outside the run's cap;
|
|
24
|
+
* plan and doctor disclose it. */
|
|
25
|
+
export type ProbeSetting = {
|
|
26
|
+
name: string;
|
|
27
|
+
secret: boolean;
|
|
28
|
+
group?: 'auth';
|
|
29
|
+
billsAccount?: string;
|
|
30
|
+
};
|
|
31
|
+
/** The retry family whose rules the host applies (attempt.ts). */
|
|
32
|
+
export type ProbeRetryFamily = 'chat' | 'agent';
|
|
33
|
+
/** `metered`: every attempt is reserved against the run's budget;
|
|
34
|
+
* `subscription`: the operator's own plan pays, and nothing is reserved. */
|
|
35
|
+
export type ProbeBilling = 'metered' | 'subscription';
|
|
36
|
+
/** How the host reads the model an answer names: through servedModelOf
|
|
37
|
+
* against the requested model, as the CLI reported it, or not at all. */
|
|
38
|
+
export type ServedModelRule = 'compare_to_requested' | 'raw' | 'none';
|
|
39
|
+
/** What an adapter is, independent of a run: what it observes, what it
|
|
40
|
+
* needs, which pool and retry rules it runs under, and what it costs. */
|
|
41
|
+
export type ProbeAdapterProfile = {
|
|
42
|
+
id: ProbeAdapterId;
|
|
43
|
+
observes: {
|
|
44
|
+
retrieval: RetrievalExposure;
|
|
45
|
+
servedModel: ServedModelRule;
|
|
46
|
+
};
|
|
47
|
+
settings: readonly ProbeSetting[];
|
|
48
|
+
pool: Exclude<ProbeProvider, 'analyzer'>;
|
|
49
|
+
retry: ProbeRetryFamily;
|
|
50
|
+
estimateUsd: Range<number>;
|
|
51
|
+
billing: ProbeBilling;
|
|
52
|
+
/** Google's grounding redirects in the answer and its retrieval log are
|
|
53
|
+
* resolved to their targets before the answer is banked. */
|
|
54
|
+
resolvesRedirects: boolean;
|
|
55
|
+
};
|
|
56
|
+
/** The sources an answer cites, rendered after the body (answer-text.ts). */
|
|
57
|
+
export type AnswerSources = {
|
|
58
|
+
format: 'search';
|
|
59
|
+
sources: readonly unknown[];
|
|
60
|
+
} | {
|
|
61
|
+
format: 'ai_overview';
|
|
62
|
+
references: readonly AIOverviewReference[];
|
|
63
|
+
} | {
|
|
64
|
+
format: 'none';
|
|
65
|
+
};
|
|
66
|
+
export type ProbeAnswer = {
|
|
67
|
+
/** The body, without the source block. */
|
|
68
|
+
answerText: string;
|
|
69
|
+
sources: AnswerSources;
|
|
70
|
+
/** null: the log could not be captured. */
|
|
71
|
+
retrieval: RetrievalLog | null;
|
|
72
|
+
/** Google AI Overview's honest absence. */
|
|
73
|
+
noOverview?: true;
|
|
74
|
+
/** The model asked for, when the request names it only at answer time
|
|
75
|
+
* (Codex); null when the CLI's own default answered. */
|
|
76
|
+
requestedModel?: string | null;
|
|
77
|
+
/** The model the provider or CLI named, raw; observes.servedModel says
|
|
78
|
+
* how the host reads it. */
|
|
79
|
+
servedModel?: string;
|
|
80
|
+
reportedCostUsd?: number;
|
|
81
|
+
/** Coding agents only; null stays unknown. */
|
|
82
|
+
usedWebSearch?: boolean | null;
|
|
83
|
+
};
|
|
84
|
+
export type ProbeContext = {
|
|
85
|
+
signal?: AbortSignal;
|
|
86
|
+
};
|
|
87
|
+
/** A request as the adapter dispatches it: the prompt it sends, with any
|
|
88
|
+
* prefix, and the parameters that shape the answer. Recorded when an
|
|
89
|
+
* attempt starts (spec §4.9). */
|
|
90
|
+
export type ProbeRequest = {
|
|
91
|
+
prompt: string;
|
|
92
|
+
parameters: Readonly<Record<string, unknown>>;
|
|
93
|
+
};
|
|
94
|
+
/** The models a chat adapter asks through, by model ID: the run's Vercel AI
|
|
95
|
+
* Gateway provider, created with the run's own key. */
|
|
96
|
+
export type ChatModelProvider = (modelId: string) => LanguageModel;
|
|
97
|
+
export type ProbeFailureClass = {
|
|
98
|
+
kind: ProbeFailureKind;
|
|
99
|
+
message: string;
|
|
100
|
+
};
|
|
101
|
+
/** One adapter instance, serving one surface. */
|
|
102
|
+
export type ProbeAdapter = ProbeAdapterProfile & {
|
|
103
|
+
surface: AeoSurface;
|
|
104
|
+
/** The model the binding pins, for an adapter that calls a model API. */
|
|
105
|
+
model?: string;
|
|
106
|
+
/** The request `probe` dispatches for `promptText`, built from the same
|
|
107
|
+
* values the dispatch uses. */
|
|
108
|
+
request: (promptText: string) => ProbeRequest;
|
|
109
|
+
probe: (promptText: string, ctx: ProbeContext) => Promise<ProbeAnswer>;
|
|
110
|
+
/** The message is journaled, so it never carries the prompt. */
|
|
111
|
+
classifyError: (error: unknown) => ProbeFailureClass;
|
|
112
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AeoAgentSurface } from '../../surfaces';
|
|
2
|
+
import type { ProbeAdapter, ProbeAdapterProfile } from '../adapter';
|
|
3
|
+
import { type AgentProbeFn, type AgentRuntime } from './cli-process';
|
|
4
|
+
export declare const cliAdapterProfiles: {
|
|
5
|
+
claude_code: ProbeAdapterProfile;
|
|
6
|
+
codex: ProbeAdapterProfile;
|
|
7
|
+
cursor: ProbeAdapterProfile;
|
|
8
|
+
};
|
|
9
|
+
/** probeForSurface is one CLI run: through the runtime's worker transport
|
|
10
|
+
* when it has one, else on this machine. */
|
|
11
|
+
export declare const probeForSurface: (surface: AeoAgentSurface) => AgentProbeFn;
|
|
12
|
+
/**
|
|
13
|
+
* createCliAdapter is the adapter of `surface`'s CLI, running each attempt
|
|
14
|
+
* with `runtime`: its environment, its config directory, its deadline and,
|
|
15
|
+
* hosted, its worker transport.
|
|
16
|
+
*/
|
|
17
|
+
export declare const createCliAdapter: (surface: AeoAgentSurface, { runtime }: {
|
|
18
|
+
runtime: AgentRuntime;
|
|
19
|
+
}) => ProbeAdapter;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ProbeAdapterProfile } from '../adapter';
|
|
2
|
+
import { type AgentProbeFn } from './cli-process';
|
|
3
|
+
export declare const codexProfile: ProbeAdapterProfile;
|
|
4
|
+
/** The parameters a Codex probe runs with, as its request records them. */
|
|
5
|
+
export declare const codexRequestParameters: (env: NodeJS.ProcessEnv) => {
|
|
6
|
+
cli: string;
|
|
7
|
+
model: string | null;
|
|
8
|
+
sandbox: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const runCodexProbe: AgentProbeFn;
|
|
@@ -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 {};
|