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
|
@@ -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
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { UnitRecord } from './ports';
|
|
2
|
+
/** A stored row that no release could have written. */
|
|
3
|
+
export declare class ProbeStoreIntegrityError extends Error {
|
|
4
|
+
constructor(message: string);
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* parseUnitRecord validates a stored row and returns it as a unit record,
|
|
8
|
+
* unchanged but for the `status` a row from before unit outcomes lacks.
|
|
9
|
+
* `where` names the row in the error (a file line, a unit key).
|
|
10
|
+
*/
|
|
11
|
+
export declare const parseUnitRecord: (row: unknown, where: string) => UnitRecord;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "literally-aeo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Literally.dev AEO: run an AI visibility audit locally and verify its evidence offline.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -88,11 +88,11 @@
|
|
|
88
88
|
"vitest": "^4.1.10"
|
|
89
89
|
},
|
|
90
90
|
"scripts": {
|
|
91
|
-
"build": "node scripts/build.mjs",
|
|
92
|
-
"typecheck": "tsc --noEmit",
|
|
93
|
-
"lint": "eslint --max-warnings=0",
|
|
94
|
-
"test": "vitest run",
|
|
95
|
-
"test:watch": "vitest",
|
|
91
|
+
"build": "sh scripts/capped.sh node scripts/build.mjs",
|
|
92
|
+
"typecheck": "sh scripts/capped.sh tsc --noEmit",
|
|
93
|
+
"lint": "sh scripts/capped.sh eslint --max-warnings=0",
|
|
94
|
+
"test": "sh scripts/capped.sh vitest run",
|
|
95
|
+
"test:watch": "sh scripts/capped.sh vitest",
|
|
96
96
|
"format": "prettier --write .",
|
|
97
97
|
"cli": "tsx src/cli/literally-aeo.ts"
|
|
98
98
|
}
|
package/src/analysis/progress.ts
CHANGED
|
@@ -206,6 +206,9 @@ export const projectProgressMeasurement = (
|
|
|
206
206
|
const cliVersion =
|
|
207
207
|
capture?.probeProfile.cliVersion ?? row?.agentCliVersion ?? null;
|
|
208
208
|
const parameters = capture?.probeProfile.parameters ?? null;
|
|
209
|
+
// Hashed exactly when recorded: a capture without it was taken with its
|
|
210
|
+
// surface's legacy adapter, and digests as earlier releases did.
|
|
211
|
+
const adapter = capture?.probeProfile.adapter;
|
|
209
212
|
const hasParameters =
|
|
210
213
|
parameters !== null && Object.keys(parameters).length > 0;
|
|
211
214
|
// Empty strings carry no metadata, so these checks are truthiness checks.
|
|
@@ -244,7 +247,13 @@ export const projectProgressMeasurement = (
|
|
|
244
247
|
cliVersion,
|
|
245
248
|
collectionMetadataKnown,
|
|
246
249
|
collectionMethodDigest: collectionMetadataKnown
|
|
247
|
-
? contentHash({
|
|
250
|
+
? contentHash({
|
|
251
|
+
requestedModel,
|
|
252
|
+
reportedModel,
|
|
253
|
+
cliVersion,
|
|
254
|
+
parameters,
|
|
255
|
+
...(adapter === undefined ? {} : { adapter }),
|
|
256
|
+
})
|
|
248
257
|
: null,
|
|
249
258
|
};
|
|
250
259
|
});
|
package/src/bundle/contracts.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { canonicalDigest } from './json';
|
|
|
13
13
|
export const toolId = 'literally-aeo';
|
|
14
14
|
// The package version, recorded in every journal and bundle; the build and
|
|
15
15
|
// version.spec.ts refuse a mismatch with package.json.
|
|
16
|
-
export const toolVersion = '0.
|
|
16
|
+
export const toolVersion = '0.3.0';
|
|
17
17
|
// Version 2: config.json may set chatProbes, and agentProbes.runsPerPrompt
|
|
18
18
|
// above 2. A verifier that reads only version 1 then refuses the bundle as
|
|
19
19
|
// unsupported instead of dropping its depth and failing it.
|
package/src/bundle/recorder.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
ModelCallReservation,
|
|
8
8
|
ModelCallUsage,
|
|
9
9
|
} from '../models/accounting';
|
|
10
|
+
import type { RedirectResolution } from '../probes/grounding-urls';
|
|
10
11
|
import type { ProbeAttemptEnd, ProbeTrace } from '../probes/probe-trace';
|
|
11
12
|
import { hasErrorCode } from '../stores/fs-errors';
|
|
12
13
|
import {
|
|
@@ -384,10 +385,27 @@ export const recordingAccounting = (
|
|
|
384
385
|
});
|
|
385
386
|
};
|
|
386
387
|
|
|
388
|
+
// A released call was never dispatched: its operation ends cancelled,
|
|
389
|
+
// with no response and no cost.
|
|
390
|
+
const release = async (callId: string) => {
|
|
391
|
+
await accounting.release(callId);
|
|
392
|
+
|
|
393
|
+
const handle = open.get(callId);
|
|
394
|
+
|
|
395
|
+
open.delete(callId);
|
|
396
|
+
requests.delete(callId);
|
|
397
|
+
responses.delete(callId);
|
|
398
|
+
await handle?.finish({
|
|
399
|
+
outcome: 'cancelled',
|
|
400
|
+
details: { released: true },
|
|
401
|
+
});
|
|
402
|
+
};
|
|
403
|
+
|
|
387
404
|
const wrapped: ModelCallAccounting = {
|
|
388
405
|
deadlineAt: accounting.deadlineAt,
|
|
389
406
|
reserve,
|
|
390
407
|
settle,
|
|
408
|
+
release,
|
|
391
409
|
observe,
|
|
392
410
|
assertOwned: () => accounting.assertOwned(),
|
|
393
411
|
};
|
|
@@ -441,6 +459,25 @@ export const recorded = async <T>({
|
|
|
441
459
|
return value;
|
|
442
460
|
};
|
|
443
461
|
|
|
462
|
+
// An answer can name any number of wrappers; the journal keeps the first
|
|
463
|
+
// hundred resolutions and says how many it left out.
|
|
464
|
+
const maxRecordedRedirects = 100;
|
|
465
|
+
|
|
466
|
+
const redirectDetails = (
|
|
467
|
+
redirects: readonly RedirectResolution[] | undefined,
|
|
468
|
+
): Record<string, unknown> => {
|
|
469
|
+
if (!redirects || redirects.length === 0) {
|
|
470
|
+
return {};
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
return {
|
|
474
|
+
redirects: redirects.slice(0, maxRecordedRedirects),
|
|
475
|
+
...(redirects.length > maxRecordedRedirects && {
|
|
476
|
+
redirectsOmitted: redirects.length - maxRecordedRedirects,
|
|
477
|
+
}),
|
|
478
|
+
};
|
|
479
|
+
};
|
|
480
|
+
|
|
444
481
|
/**
|
|
445
482
|
* probeTraceOf records probe attempts (or canaries) as operations: the
|
|
446
483
|
* prompt as input; the answer and its retrieval log as outputs; the
|
|
@@ -455,7 +492,11 @@ export const probeTraceOf = (
|
|
|
455
492
|
kind,
|
|
456
493
|
role: attempt.surface,
|
|
457
494
|
attempt: attempt.attempt,
|
|
458
|
-
inputs: {
|
|
495
|
+
inputs: {
|
|
496
|
+
prompt: attempt.promptText,
|
|
497
|
+
// The request as dispatched, prefix and parameters included.
|
|
498
|
+
...(attempt.request && { request: JSON.stringify(attempt.request) }),
|
|
499
|
+
},
|
|
459
500
|
details: {
|
|
460
501
|
sectionKey: attempt.sectionKey ?? null,
|
|
461
502
|
surface: attempt.surface,
|
|
@@ -463,6 +504,7 @@ export const probeTraceOf = (
|
|
|
463
504
|
runIndex: attempt.runIndex,
|
|
464
505
|
retryOf: attempt.retryOf ?? null,
|
|
465
506
|
requestedModel: attempt.requestedModel,
|
|
507
|
+
...(attempt.adapter !== undefined && { adapter: attempt.adapter }),
|
|
466
508
|
},
|
|
467
509
|
});
|
|
468
510
|
|
|
@@ -491,6 +533,10 @@ export const probeTraceOf = (
|
|
|
491
533
|
// neither named one, never the requested model (§7.1).
|
|
492
534
|
reportedModel: result.reportedModel ?? null,
|
|
493
535
|
noOverview: result.noOverview === true,
|
|
536
|
+
// What the provider reported the attempt cost; null when it did
|
|
537
|
+
// not say, never the estimate.
|
|
538
|
+
costUsd: result.costUsd ?? null,
|
|
539
|
+
...redirectDetails(result.redirects),
|
|
494
540
|
},
|
|
495
541
|
});
|
|
496
542
|
};
|
package/src/capture-manifest.ts
CHANGED
|
@@ -43,6 +43,9 @@ const captureSchema = unitSchema
|
|
|
43
43
|
reportedModel: z.string().nullable(),
|
|
44
44
|
cliVersion: z.string().nullable(),
|
|
45
45
|
parameters: z.record(z.string(), z.unknown()).nullable(),
|
|
46
|
+
// Present only when the capture was not taken with its surface's
|
|
47
|
+
// legacy adapter (probe adapters spec §4.6).
|
|
48
|
+
adapter: z.string().optional(),
|
|
46
49
|
}),
|
|
47
50
|
metadataProvenance: z.enum(['captured_record', 'legacy_preserved_record']),
|
|
48
51
|
digest,
|
|
@@ -277,6 +280,9 @@ export const buildCaptureManifest = (args: {
|
|
|
277
280
|
? record.probe.agentCliVersion
|
|
278
281
|
: null,
|
|
279
282
|
parameters: record.captureMetadata?.parameters ?? null,
|
|
283
|
+
...(record.captureMetadata?.adapter === undefined
|
|
284
|
+
? {}
|
|
285
|
+
: { adapter: record.captureMetadata.adapter }),
|
|
280
286
|
},
|
|
281
287
|
metadataProvenance: record.captureMetadata
|
|
282
288
|
? ('captured_record' as const)
|
package/src/cli/run-commands.ts
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
type RunCostEstimate,
|
|
21
21
|
} from '../engine/cost-estimate';
|
|
22
22
|
import {
|
|
23
|
+
bankDir,
|
|
23
24
|
openLocalRun,
|
|
24
25
|
planLocalRun,
|
|
25
26
|
PreflightFailedError,
|
|
@@ -32,6 +33,12 @@ import {
|
|
|
32
33
|
runSettingNames,
|
|
33
34
|
} from '../engine/preflight';
|
|
34
35
|
import { prepareRejudgment } from '../engine/rejudge';
|
|
36
|
+
import {
|
|
37
|
+
defaultProbeBindings,
|
|
38
|
+
profileOf,
|
|
39
|
+
RunBindingsError,
|
|
40
|
+
} from '../probes/bindings';
|
|
41
|
+
import { estimateBindingsOf } from '../engine/run-bindings';
|
|
35
42
|
import {
|
|
36
43
|
readAuthorEvidence,
|
|
37
44
|
readBrief,
|
|
@@ -175,6 +182,7 @@ export const runDoctor = async (flags: Flags) => {
|
|
|
175
182
|
model: file.model,
|
|
176
183
|
groundingSearch: usesGroundingSearch(request),
|
|
177
184
|
rendersPages: file.moneyPages.length > 0,
|
|
185
|
+
bindings: await estimateBindingsOf(path.join(runDirOf(flags), bankDir)),
|
|
178
186
|
});
|
|
179
187
|
const ok = checks.every((check) => check.ok);
|
|
180
188
|
|
|
@@ -206,10 +214,30 @@ export const runPlan = async (flags: Flags) => {
|
|
|
206
214
|
const state = await runDirectoryState(dir);
|
|
207
215
|
const bySurface = Object.fromEntries(plan.probesBySurface);
|
|
208
216
|
const model = resolveSupportedModel(file.model);
|
|
217
|
+
const bindings = await estimateBindingsOf(path.join(dir, bankDir));
|
|
209
218
|
const estimate = estimateRunCost({
|
|
210
219
|
plan,
|
|
211
220
|
model,
|
|
212
221
|
grounding: request.grounding,
|
|
222
|
+
bindings,
|
|
223
|
+
});
|
|
224
|
+
// A coding agent bills its own plan, or, on an API key, that provider
|
|
225
|
+
// account per use: either way outside the cap, which the plan says.
|
|
226
|
+
const agentBilling = plan.agentSurfaces.flatMap((surface) => {
|
|
227
|
+
const accounts = profileOf(bindings[surface]).settings.flatMap((setting) =>
|
|
228
|
+
setting.billsAccount === undefined
|
|
229
|
+
? []
|
|
230
|
+
: [`on ${setting.name}, that ${setting.billsAccount} account`],
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
return accounts.length === 0
|
|
234
|
+
? []
|
|
235
|
+
: [
|
|
236
|
+
formatLine(
|
|
237
|
+
`${surface} billing`,
|
|
238
|
+
`on its own login, your plan; ${accounts.join('; ')}, outside this run's cap`,
|
|
239
|
+
),
|
|
240
|
+
];
|
|
213
241
|
});
|
|
214
242
|
const summary = {
|
|
215
243
|
brand: config.brand.name,
|
|
@@ -246,6 +274,7 @@ export const runPlan = async (flags: Flags) => {
|
|
|
246
274
|
formatLine(`Section ${section.key}`, `${section.questions} questions`),
|
|
247
275
|
),
|
|
248
276
|
formatLine('Surfaces', summary.surfaces.join(', ')),
|
|
277
|
+
...agentBilling,
|
|
249
278
|
...Object.entries(bySurface).map(([surface, count]) =>
|
|
250
279
|
formatLine(` ${surface}`, `${count} answers`),
|
|
251
280
|
),
|
|
@@ -295,6 +324,7 @@ export const runRun = async (flags: Flags) => {
|
|
|
295
324
|
plan,
|
|
296
325
|
model: resolveSupportedModel(file.model),
|
|
297
326
|
grounding: request.grounding,
|
|
327
|
+
bindings: await estimateBindingsOf(path.join(dir, bankDir)),
|
|
298
328
|
}),
|
|
299
329
|
});
|
|
300
330
|
|
|
@@ -309,6 +339,7 @@ export const runRun = async (flags: Flags) => {
|
|
|
309
339
|
model: file.model,
|
|
310
340
|
groundingSearch: usesGroundingSearch(request),
|
|
311
341
|
rendersPages: file.moneyPages.length > 0,
|
|
342
|
+
bindings: await estimateBindingsOf(path.join(dir, bankDir)),
|
|
312
343
|
});
|
|
313
344
|
const failing = checks.filter((check) => !check.ok);
|
|
314
345
|
|
|
@@ -416,6 +447,7 @@ export const runAuthor = async (flags: Flags, usage: string) => {
|
|
|
416
447
|
settings,
|
|
417
448
|
dir,
|
|
418
449
|
groundingSearch: true,
|
|
450
|
+
bindings: defaultProbeBindings,
|
|
419
451
|
});
|
|
420
452
|
const failing = checks.filter((check) => !check.ok);
|
|
421
453
|
|
|
@@ -540,6 +572,7 @@ export const runRejudge = async (flags: Flags, usage: string) => {
|
|
|
540
572
|
plan: { units: plan.units, probesBySurface: new Map() },
|
|
541
573
|
model: resolveSupportedModel(file.model),
|
|
542
574
|
grounding: request.grounding,
|
|
575
|
+
bindings: defaultProbeBindings,
|
|
543
576
|
}),
|
|
544
577
|
});
|
|
545
578
|
|
|
@@ -560,6 +593,8 @@ export const runRejudge = async (flags: Flags, usage: string) => {
|
|
|
560
593
|
dir,
|
|
561
594
|
model: file.model,
|
|
562
595
|
groundingSearch: usesGroundingSearch(request),
|
|
596
|
+
// Nothing is probed again; the settings checked are the same.
|
|
597
|
+
bindings: defaultProbeBindings,
|
|
563
598
|
});
|
|
564
599
|
const failing = checks.filter((check) => !check.ok);
|
|
565
600
|
|
|
@@ -724,7 +759,8 @@ const executeRun = async ({
|
|
|
724
759
|
if (
|
|
725
760
|
err instanceof PreflightFailedError ||
|
|
726
761
|
err instanceof WriterLockHeldError ||
|
|
727
|
-
err instanceof BudgetCapMissingError
|
|
762
|
+
err instanceof BudgetCapMissingError ||
|
|
763
|
+
err instanceof RunBindingsError
|
|
728
764
|
) {
|
|
729
765
|
writeErr(err.message);
|
|
730
766
|
|