literally-aeo 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +6075 -5175
- package/dist/lib/agents/author-schema.js +5 -5
- package/dist/lib/agents/author-validation.js +9 -7
- package/dist/lib/agents/copy-validation.js +10 -10
- package/dist/lib/agents/copywriter-input.js +9 -9
- package/dist/lib/agents/facts.js +8 -8
- package/dist/lib/agents/narrative-facts.js +6 -6
- package/dist/lib/agents/verifier.js +14 -13
- package/dist/lib/analysis/domain-classifier.js +12 -10
- package/dist/lib/analysis/domain-labels.js +4 -4
- package/dist/lib/analysis/outreach.js +2 -2
- package/dist/lib/analysis/progress.js +9 -9
- package/dist/lib/analysis/retrieval.js +5 -5
- package/dist/lib/analysis/scoring.js +5 -5
- package/dist/lib/analysis/search-analyzer.js +6 -6
- package/dist/lib/analysis/sentiment.js +12 -10
- package/dist/lib/analysis/source-mix.js +2 -2
- package/dist/lib/author/examples.js +6 -6
- package/dist/lib/bundle/contracts.js +6 -6
- package/dist/lib/bundle/export.js +18 -18
- package/dist/lib/bundle/journal.js +7 -7
- package/dist/lib/bundle/project-journal.js +10 -10
- package/dist/lib/bundle/project.js +16 -16
- package/dist/lib/bundle/read.js +19 -19
- package/dist/lib/bundle/recorder.js +8 -8
- package/dist/lib/bundle/redact.js +7 -7
- package/dist/lib/bundle/trace-coverage.js +7 -7
- package/dist/lib/bundle/verify-integrity.js +9 -9
- package/dist/lib/bundle/verify-measurement.js +22 -13
- package/dist/lib/bundle/verify-report.js +24 -16
- package/dist/lib/bundle/verify.js +32 -24
- package/dist/lib/capture-manifest.js +6 -6
- package/dist/lib/checks/crawler-access.js +2 -2
- package/dist/lib/checks/money-pages.js +13 -0
- package/dist/lib/checks/renderability.js +2 -2
- package/dist/lib/checks/run-checks.js +12 -12
- package/dist/lib/chunks/{chunk-XAKME6NM.js → chunk-2C723CW7.js} +1 -1
- package/dist/lib/chunks/chunk-2FDSOZ6Q.js +287 -0
- package/dist/lib/chunks/{chunk-PWOYEIPF.js → chunk-2U5QSA6Q.js} +7 -7
- package/dist/lib/chunks/{chunk-6EI4CVRW.js → chunk-3ESH5NDR.js} +5 -1
- package/dist/lib/chunks/{chunk-7LBSNDRR.js → chunk-3S2FAVRE.js} +22 -3
- package/dist/lib/chunks/{chunk-LR27H2HZ.js → chunk-44NSZBCP.js} +6 -6
- package/dist/lib/chunks/{chunk-JBOOD6MU.js → chunk-4AWFF53U.js} +12 -4
- package/dist/lib/chunks/{chunk-MENTBQGB.js → chunk-4HPMLJKC.js} +4 -4
- package/dist/lib/chunks/{chunk-AAFHXNLU.js → chunk-4Q2WFZ5J.js} +11 -4
- package/dist/lib/chunks/{chunk-SD7LR26G.js → chunk-5JU2Y2I6.js} +2 -2
- package/dist/lib/chunks/{chunk-RPTADJXD.js → chunk-64JFN2Q5.js} +1 -1
- package/dist/lib/chunks/chunk-66UE4TT2.js +245 -0
- package/dist/lib/chunks/chunk-6N3C6E3D.js +105 -0
- package/dist/lib/chunks/{chunk-F2NSJ6PG.js → chunk-6RED3G6K.js} +7 -3
- package/dist/lib/chunks/{chunk-QJZTDZMB.js → chunk-7KLTOVIY.js} +9 -9
- package/dist/lib/chunks/{chunk-PXB4PWJI.js → chunk-7ZR3WDF2.js} +38 -5
- package/dist/lib/chunks/chunk-A5PF7UE2.js +86 -0
- package/dist/lib/chunks/{chunk-JXBLGCXZ.js → chunk-AB7DUTX5.js} +1 -1
- package/dist/lib/chunks/{chunk-WDT2Y7D7.js → chunk-AQCWKHTE.js} +11 -7
- package/dist/lib/chunks/{chunk-SQQ56UP2.js → chunk-ASHFEFCU.js} +3 -3
- package/dist/lib/chunks/{chunk-AK6YNTCV.js → chunk-ASIFUJG2.js} +1 -1
- package/dist/lib/chunks/{chunk-ZSEY7AHQ.js → chunk-BBK54RVK.js} +14 -11
- package/dist/lib/chunks/chunk-BQMUZLHO.js +17 -0
- package/dist/lib/chunks/{chunk-KSOHZKV5.js → chunk-CQNIPZH3.js} +21 -21
- package/dist/lib/chunks/{chunk-7HM6IZ3L.js → chunk-CVEXMYPW.js} +2 -2
- package/dist/lib/chunks/chunk-CXZIHHLJ.js +95 -0
- package/dist/lib/chunks/{chunk-75DMLOQ7.js → chunk-CYJNBVQB.js} +1 -1
- package/dist/lib/chunks/{chunk-FAUFE7MI.js → chunk-D7N5OLYL.js} +1 -1
- package/dist/lib/chunks/{chunk-E2YTTB6Q.js → chunk-DSK3PM4Z.js} +1 -1
- package/dist/lib/chunks/{chunk-TNL2GWYR.js → chunk-EUXNCXCR.js} +22 -0
- package/dist/lib/chunks/{chunk-FJL2V6P5.js → chunk-F4EQULFR.js} +6 -6
- package/dist/lib/chunks/{chunk-QGZ4QSUE.js → chunk-FHV4PBYG.js} +1 -1
- package/dist/lib/chunks/chunk-FK2JQHAX.js +30 -0
- package/dist/lib/chunks/{chunk-K2FZFESR.js → chunk-FONFW67K.js} +4 -4
- package/dist/lib/chunks/{chunk-W5X7WJYL.js → chunk-FPPHYGIO.js} +3 -3
- package/dist/lib/chunks/{chunk-XNTFOVCE.js → chunk-FYE4R5TY.js} +2 -2
- package/dist/lib/chunks/{chunk-FIC7JSR4.js → chunk-H2DOBJZC.js} +2 -2
- package/dist/lib/chunks/{chunk-R2AJYV6A.js → chunk-HEWHNSDP.js} +68 -36
- package/dist/lib/chunks/{chunk-RXSHKWZJ.js → chunk-HLC6OHGO.js} +2 -2
- package/dist/lib/chunks/{chunk-6HMHXSCS.js → chunk-HXXFRZTJ.js} +2 -2
- package/dist/lib/chunks/{chunk-JYFEXVWC.js → chunk-HYMWNGOK.js} +13 -6
- package/dist/lib/chunks/chunk-IH67TEGY.js +73 -0
- package/dist/lib/chunks/{chunk-JKPBXPCW.js → chunk-IMADI2YP.js} +1 -1
- package/dist/lib/chunks/{chunk-SLAPBFRH.js → chunk-JBGQFPTY.js} +4 -4
- package/dist/lib/chunks/{chunk-JQDQVG3D.js → chunk-JDU3ZCKO.js} +1 -1
- package/dist/lib/chunks/{chunk-2KH7LNK7.js → chunk-JGIX427K.js} +7 -7
- package/dist/lib/chunks/{chunk-7CW6U5WJ.js → chunk-JIE2ANVD.js} +1 -1
- package/dist/lib/chunks/{chunk-T5XQ6NXD.js → chunk-JJFOILZK.js} +2 -2
- package/dist/lib/chunks/{chunk-F7DBTXKG.js → chunk-JMIK2QN3.js} +4 -3
- package/dist/lib/chunks/chunk-JW7DTYSI.js +116 -0
- package/dist/lib/chunks/{chunk-BFWK3TBN.js → chunk-JXLCKACO.js} +2 -2
- package/dist/lib/chunks/{chunk-7WO3FFPS.js → chunk-K5NQDJLE.js} +1 -1
- package/dist/lib/chunks/{chunk-BXF4OC74.js → chunk-KI2FB4Y3.js} +30 -16
- package/dist/lib/chunks/{chunk-Y2CZ6FZY.js → chunk-KRWDELRS.js} +30 -7
- package/dist/lib/chunks/{chunk-SIJOQRRK.js → chunk-KRXOJJR7.js} +1 -1
- package/dist/lib/chunks/chunk-KSUI4DAY.js +15 -0
- package/dist/lib/chunks/chunk-KXFZ3CH3.js +98 -0
- package/dist/lib/chunks/{chunk-3OWJBGQE.js → chunk-LJCWZ5SZ.js} +14 -14
- package/dist/lib/chunks/{chunk-AJKV46SM.js → chunk-LNYQMWJO.js} +3 -3
- package/dist/lib/chunks/{chunk-DL6YQDTE.js → chunk-LOIAGEKN.js} +2 -2
- package/dist/lib/chunks/{chunk-I3UE52ZV.js → chunk-LPOIMPJK.js} +2 -2
- package/dist/lib/chunks/{chunk-66T7JC57.js → chunk-LUKP64NX.js} +2 -2
- package/dist/lib/chunks/chunk-MNG5TZRW.js +208 -0
- package/dist/lib/chunks/{chunk-SMPP7B7F.js → chunk-MPQXB7HN.js} +7 -7
- package/dist/lib/chunks/{chunk-6JICXLDA.js → chunk-MZ2KN3IH.js} +3 -3
- package/dist/lib/chunks/chunk-N62G4EWT.js +91 -0
- package/dist/lib/chunks/{chunk-7YDXD4MD.js → chunk-ODIXZHHX.js} +1 -1
- package/dist/lib/chunks/{chunk-MTDYBJXH.js → chunk-OTVHGRCO.js} +8 -8
- package/dist/lib/chunks/{chunk-YZEZRQIG.js → chunk-OVF27NAO.js} +69 -17
- package/dist/lib/chunks/chunk-P6LHGBYU.js +90 -0
- package/dist/lib/chunks/{chunk-U5USH2HB.js → chunk-PAL5SXIP.js} +1 -1
- package/dist/lib/chunks/{chunk-W5XYW6ZM.js → chunk-PT6PK2MJ.js} +26 -19
- package/dist/lib/chunks/{chunk-OD36HUXA.js → chunk-Q22FCF4A.js} +6 -7
- package/dist/lib/chunks/chunk-QKTKQSPS.js +292 -0
- package/dist/lib/chunks/{chunk-K4Y5NT4M.js → chunk-QO5TPMWS.js} +2 -2
- package/dist/lib/chunks/{chunk-VPXYGN4I.js → chunk-QUZYFAGP.js} +17 -22
- package/dist/lib/chunks/{chunk-HI3PD3KR.js → chunk-QVMPTT7R.js} +5 -5
- package/dist/lib/chunks/{chunk-OQFAMKLN.js → chunk-RGZY6YUQ.js} +5 -5
- package/dist/lib/chunks/{chunk-U6BW6LGX.js → chunk-RM2VVR7Y.js} +1 -1
- package/dist/lib/chunks/{chunk-AJO7XVXK.js → chunk-RMSH7RUG.js} +6 -6
- package/dist/lib/chunks/{chunk-V5B6UZ3E.js → chunk-RQGEPR6V.js} +1 -0
- package/dist/lib/chunks/{chunk-V5JJEEBT.js → chunk-RYB77E7O.js} +6 -5
- package/dist/lib/chunks/chunk-S24JGY7B.js +97 -0
- package/dist/lib/chunks/{chunk-6GKKALCI.js → chunk-SF4UJ2AY.js} +1 -1
- package/dist/lib/chunks/chunk-SJCUR4QX.js +94 -0
- package/dist/lib/chunks/{chunk-XAN4CRFP.js → chunk-SQ55KGHO.js} +1 -1
- package/dist/lib/chunks/{chunk-66DVMLGR.js → chunk-TKOQMB6A.js} +7 -7
- package/dist/lib/chunks/{chunk-UYDQXXDQ.js → chunk-TWK6IA4P.js} +1 -1
- package/dist/lib/chunks/{chunk-DVFFYY5G.js → chunk-U42I3SBR.js} +13 -9
- package/dist/lib/chunks/{chunk-FL6LN2K6.js → chunk-UECQONVZ.js} +5 -5
- package/dist/lib/chunks/{chunk-FDM2YNQL.js → chunk-VTY53IFN.js} +1 -1
- package/dist/lib/chunks/chunk-VYUC772A.js +338 -0
- package/dist/lib/chunks/{chunk-WCLKIPJV.js → chunk-WPCBE2NZ.js} +1 -1
- package/dist/lib/chunks/{chunk-3OE4UQIB.js → chunk-WRHGLRUK.js} +5 -5
- package/dist/lib/chunks/{chunk-3GPUCXVA.js → chunk-WUIY7BXR.js} +36 -19
- package/dist/lib/chunks/{chunk-7YYDUHJG.js → chunk-WZA4H4TG.js} +39 -13
- package/dist/lib/chunks/{chunk-NH4QGBJV.js → chunk-XBSA7MNJ.js} +7 -2
- package/dist/lib/chunks/chunk-XTBCXEH7.js +243 -0
- package/dist/lib/chunks/{chunk-ZQ3ER7JD.js → chunk-YPVJAXPP.js} +1 -1
- package/dist/lib/chunks/{chunk-SASE7U6E.js → chunk-YQD5ITKI.js} +1 -1
- package/dist/lib/chunks/{chunk-DDS4G4DO.js → chunk-YY4BH5XM.js} +6 -6
- package/dist/lib/chunks/{chunk-J5NPHPXY.js → chunk-Z3BZRBQF.js} +36 -2
- package/dist/lib/chunks/{chunk-XFUYEFQP.js → chunk-ZBQU2VU3.js} +1 -1
- package/dist/lib/chunks/{chunk-E3OGPTUY.js → chunk-ZHGABG7L.js} +2 -2
- package/dist/lib/chunks/chunk-ZZCRYG36.js +31 -0
- package/dist/lib/cli/bundle-commands.js +91 -74
- package/dist/lib/cli/run-commands.js +141 -96
- package/dist/lib/cli/status-command.js +77 -60
- package/dist/lib/codex-workflow/aggregate.js +20 -12
- package/dist/lib/codex-workflow/author-tools.js +7 -7
- package/dist/lib/codex-workflow/author.js +25 -23
- package/dist/lib/codex-workflow/capture.js +39 -18
- package/dist/lib/codex-workflow/checkpoint.js +7 -7
- package/dist/lib/codex-workflow/checks.js +9 -9
- package/dist/lib/codex-workflow/copy-editor.js +20 -19
- package/dist/lib/codex-workflow/copy-recovery.js +4 -4
- package/dist/lib/codex-workflow/copy.js +17 -16
- package/dist/lib/codex-workflow/finish.js +29 -25
- package/dist/lib/codex-workflow/host-models.js +2 -2
- package/dist/lib/codex-workflow/loop.js +54 -48
- package/dist/lib/codex-workflow/quality.js +4 -4
- package/dist/lib/codex-workflow/run-inputs.js +6 -6
- package/dist/lib/codex-workflow/run-source.js +16 -16
- package/dist/lib/codex-workflow/schemas.js +6 -6
- package/dist/lib/codex-workflow/session.js +8 -8
- package/dist/lib/codex-workflow/stage.js +32 -29
- package/dist/lib/codex-workflow/workdir.js +18 -11
- package/dist/lib/engine/audit-file.js +9 -8
- package/dist/lib/engine/author.js +40 -37
- package/dist/lib/engine/cost-estimate.js +37 -9
- package/dist/lib/engine/local-run.js +76 -59
- package/dist/lib/engine/preflight.js +37 -9
- package/dist/lib/engine/rejudge.js +82 -65
- package/dist/lib/engine/run-bindings.js +62 -0
- package/dist/lib/engine/run-status.js +77 -60
- package/dist/lib/engine/templates.js +10 -9
- package/dist/lib/grounding/controller.js +8 -7
- package/dist/lib/grounding/extract.js +8 -6
- package/dist/lib/grounding/grounding-runtime.js +22 -21
- package/dist/lib/grounding/model-usage.js +2 -2
- package/dist/lib/grounding/model.js +7 -5
- package/dist/lib/grounding/recorded-tools.js +9 -9
- package/dist/lib/harness/report/artifacts.js +5 -5
- package/dist/lib/lib/checkpoint.js +5 -5
- package/dist/lib/lib/log.js +1 -1
- package/dist/lib/models/accounting.js +1 -1
- package/dist/lib/models/batching.js +6 -4
- package/dist/lib/models/budget-protection.js +1 -1
- package/dist/lib/models/cost-coefficients.js +2 -1
- package/dist/lib/models/gateway-cost.js +7 -0
- package/dist/lib/models/structured.js +5 -3
- package/dist/lib/models/supported-models.js +1 -1
- package/dist/lib/pipeline.js +36 -17
- package/dist/lib/probes/adapter.js +6 -0
- package/dist/lib/probes/adapters/cli-agents.js +44 -0
- package/dist/lib/probes/adapters/cli-claude-code.js +21 -0
- package/dist/lib/probes/adapters/cli-codex.js +23 -0
- package/dist/lib/probes/adapters/cli-cursor.js +21 -0
- package/dist/lib/probes/adapters/cli-process.js +34 -0
- package/dist/lib/probes/adapters/dataforseo-ai-overview.js +20 -0
- package/dist/lib/probes/adapters/gateway-chat.js +30 -0
- package/dist/lib/probes/adapters/gateway-perplexity.js +19 -0
- package/dist/lib/probes/agent-cli-parsers.js +2 -2
- package/dist/lib/probes/agent-clis.js +26 -11
- package/dist/lib/probes/answer-text.js +21 -0
- package/dist/lib/probes/attempt.js +28 -0
- package/dist/lib/probes/bindings.js +69 -0
- package/dist/lib/probes/charged-trace.js +47 -3
- package/dist/lib/probes/dataforseo-locale.js +1 -1
- package/dist/lib/probes/dataforseo.js +8 -5
- package/dist/lib/probes/grounding-urls.js +6 -4
- package/dist/lib/probes/legacy-bindings.js +7 -0
- package/dist/lib/probes/limits.js +1 -1
- package/dist/lib/probes/probes.js +33 -12
- package/dist/lib/runner.js +17 -14
- package/dist/lib/schema.js +4 -4
- package/dist/lib/section-result.js +6 -6
- package/dist/lib/stores/artifacts.js +7 -7
- package/dist/lib/stores/files.js +20 -18
- package/dist/lib/stores/local-versions.js +5 -5
- package/dist/lib/stores/memory.js +20 -15
- package/dist/lib/stores/publication.js +11 -11
- package/dist/lib/stores/unit-record.js +28 -0
- package/dist/lib/viewer/server.js +33 -25
- package/dist/lib/workflow/schema.js +3 -3
- package/dist/types/bundle/contracts.d.ts +1 -1
- package/dist/types/capture-manifest.d.ts +1 -0
- package/dist/types/checks/money-pages.d.ts +19 -0
- package/dist/types/codex-workflow/capture.d.ts +13 -0
- package/dist/types/codex-workflow/workdir.d.ts +0 -1
- package/dist/types/engine/cost-estimate.d.ts +5 -1
- package/dist/types/engine/preflight.d.ts +6 -1
- package/dist/types/engine/run-bindings.d.ts +25 -0
- package/dist/types/models/accounting.d.ts +7 -0
- package/dist/types/models/cost-coefficients.d.ts +5 -5
- package/dist/types/models/gateway-cost.d.ts +3 -0
- package/dist/types/pipeline.d.ts +2 -0
- package/dist/types/probes/adapter.d.ts +112 -0
- package/dist/types/probes/adapters/cli-agents.d.ts +19 -0
- package/dist/types/probes/adapters/cli-claude-code.d.ts +4 -0
- package/dist/types/probes/adapters/cli-codex.d.ts +10 -0
- package/dist/types/probes/adapters/cli-cursor.d.ts +4 -0
- package/dist/types/probes/adapters/cli-process.d.ts +86 -0
- package/dist/types/probes/adapters/dataforseo-ai-overview.d.ts +12 -0
- package/dist/types/probes/adapters/gateway-chat.d.ts +32 -0
- package/dist/types/probes/adapters/gateway-perplexity.d.ts +10 -0
- package/dist/types/probes/agent-clis.d.ts +7 -49
- package/dist/types/probes/answer-text.d.ts +20 -0
- package/dist/types/probes/attempt.d.ts +113 -0
- package/dist/types/probes/bindings.d.ts +79 -0
- package/dist/types/probes/charged-trace.d.ts +2 -1
- package/dist/types/probes/dataforseo.d.ts +24 -1
- package/dist/types/probes/grounding-urls.d.ts +18 -5
- package/dist/types/probes/legacy-bindings.d.ts +36 -0
- package/dist/types/probes/limits.d.ts +12 -6
- package/dist/types/probes/probe-trace.d.ts +10 -0
- package/dist/types/probes/probes.d.ts +5 -3
- package/dist/types/stores/ports.d.ts +1 -0
- package/dist/types/stores/unit-record.d.ts +11 -0
- package/package.json +6 -6
- package/src/agents/author-validation.ts +22 -1
- package/src/analysis/progress.ts +10 -1
- package/src/bundle/contracts.ts +1 -1
- package/src/bundle/recorder.ts +47 -1
- package/src/capture-manifest.ts +6 -0
- package/src/checks/money-pages.ts +48 -0
- package/src/cli/run-commands.ts +37 -1
- package/src/codex-workflow/capture.ts +60 -0
- package/src/codex-workflow/workdir.ts +3 -4
- package/src/engine/audit-file.ts +20 -30
- package/src/engine/cost-estimate.ts +10 -4
- package/src/engine/local-run.ts +21 -2
- package/src/engine/preflight.ts +113 -17
- package/src/engine/rejudge.ts +5 -0
- package/src/engine/run-bindings.ts +142 -0
- package/src/grounding/extract.ts +1 -0
- package/src/grounding/model-usage.ts +4 -0
- package/src/lib/log.ts +17 -15
- package/src/models/accounting.ts +34 -0
- package/src/models/budget-protection.ts +1 -0
- package/src/models/cost-coefficients.ts +17 -13
- package/src/models/gateway-cost.ts +32 -0
- package/src/models/structured.ts +2 -10
- package/src/models/supported-models.ts +3 -3
- package/src/pipeline.ts +36 -17
- package/src/probes/adapter.ts +122 -0
- package/src/probes/adapters/cli-agents.ts +123 -0
- package/src/probes/adapters/cli-claude-code.ts +119 -0
- package/src/probes/adapters/cli-codex.ts +145 -0
- package/src/probes/adapters/cli-cursor.ts +95 -0
- package/src/probes/adapters/cli-process.ts +522 -0
- package/src/probes/adapters/dataforseo-ai-overview.ts +106 -0
- package/src/probes/adapters/gateway-chat.ts +339 -0
- package/src/probes/adapters/gateway-perplexity.ts +104 -0
- package/src/probes/agent-clis.ts +151 -1088
- package/src/probes/answer-text.ts +153 -0
- package/src/probes/attempt.ts +462 -0
- package/src/probes/bindings.ts +344 -0
- package/src/probes/charged-trace.ts +54 -13
- package/src/probes/dataforseo-locale.ts +13 -2
- package/src/probes/dataforseo.ts +265 -188
- package/src/probes/grounding-urls.ts +68 -19
- package/src/probes/legacy-bindings.ts +40 -0
- package/src/probes/limits.ts +31 -18
- package/src/probes/probe-trace.ts +10 -0
- package/src/probes/probes.ts +64 -736
- package/src/runner.ts +13 -0
- package/src/stores/files.ts +78 -54
- package/src/stores/memory.ts +4 -1
- package/src/stores/ports.ts +3 -0
- package/src/stores/unit-record.ts +151 -0
- package/dist/lib/chunks/chunk-BGAHZIL3.js +0 -563
- package/dist/lib/chunks/chunk-IB6RROHE.js +0 -204
- package/dist/lib/chunks/chunk-WZGI7UVM.js +0 -937
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import {
|
|
2
|
+
probeUsd
|
|
3
|
+
} from "./chunk-U42I3SBR.js";
|
|
4
|
+
import {
|
|
5
|
+
ProbeAdapterId
|
|
6
|
+
} from "./chunk-KSUI4DAY.js";
|
|
7
|
+
import {
|
|
8
|
+
extractAnthropicRetrieval,
|
|
9
|
+
extractGeminiRetrieval,
|
|
10
|
+
extractOpenAiRetrieval
|
|
11
|
+
} from "./chunk-S2SFHTJD.js";
|
|
12
|
+
import {
|
|
13
|
+
ProbeFailure,
|
|
14
|
+
classifyGatewayError,
|
|
15
|
+
errorMessage
|
|
16
|
+
} from "./chunk-7O3M6I2X.js";
|
|
17
|
+
import {
|
|
18
|
+
gatewayCostUsd
|
|
19
|
+
} from "./chunk-BQMUZLHO.js";
|
|
20
|
+
import {
|
|
21
|
+
createLog
|
|
22
|
+
} from "./chunk-BBK54RVK.js";
|
|
23
|
+
import {
|
|
24
|
+
isRecord
|
|
25
|
+
} from "./chunk-7PLK6VGC.js";
|
|
26
|
+
|
|
27
|
+
// src/probes/adapters/gateway-chat.ts
|
|
28
|
+
import { streamText } from "ai";
|
|
29
|
+
import { openai } from "@ai-sdk/openai";
|
|
30
|
+
import { google } from "@ai-sdk/google";
|
|
31
|
+
import { anthropic } from "@ai-sdk/anthropic";
|
|
32
|
+
var log = createLog("AISearchProbes");
|
|
33
|
+
var probeMaxOutputTokens = 2e3;
|
|
34
|
+
var chatProbeTimeoutMs = 18e4;
|
|
35
|
+
var searchPromptPrefix = "Search the web for current information to answer the following question. Return a complete answer, not just search results.\n\n";
|
|
36
|
+
var reportedCostOf = (costs) => {
|
|
37
|
+
if (costs.some((cost) => cost === void 0)) {
|
|
38
|
+
return {};
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
reportedCostUsd: costs.reduce((sum, cost) => sum + (cost ?? 0), 0)
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
var classifyGatewayFailure = (error) => {
|
|
45
|
+
return { kind: classifyGatewayError(error), message: errorMessage(error) };
|
|
46
|
+
};
|
|
47
|
+
var toProviderToolSet = (tools) => {
|
|
48
|
+
return tools;
|
|
49
|
+
};
|
|
50
|
+
var describeTools = (tools) => {
|
|
51
|
+
return Object.entries(tools).map(([name, tool]) => ({
|
|
52
|
+
name,
|
|
53
|
+
id: isRecord(tool) ? tool.id : void 0,
|
|
54
|
+
args: isRecord(tool) ? tool.args : void 0
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
var searchRequest = (model, promptText, tools) => {
|
|
58
|
+
return {
|
|
59
|
+
prompt: `${searchPromptPrefix}${promptText}`,
|
|
60
|
+
parameters: {
|
|
61
|
+
model,
|
|
62
|
+
maxOutputTokens: probeMaxOutputTokens,
|
|
63
|
+
toolChoice: "required",
|
|
64
|
+
tools: describeTools(tools)
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
var searchProbe = async ({
|
|
69
|
+
surface,
|
|
70
|
+
gateway,
|
|
71
|
+
model,
|
|
72
|
+
promptText,
|
|
73
|
+
method
|
|
74
|
+
}) => {
|
|
75
|
+
const tools = method.tools();
|
|
76
|
+
const { prompt } = searchRequest(model, promptText, tools);
|
|
77
|
+
let streamFailure;
|
|
78
|
+
const streamed = streamText({
|
|
79
|
+
onError: ({ error }) => {
|
|
80
|
+
streamFailure ??= error;
|
|
81
|
+
},
|
|
82
|
+
model: gateway(model),
|
|
83
|
+
prompt,
|
|
84
|
+
maxOutputTokens: probeMaxOutputTokens,
|
|
85
|
+
tools: toProviderToolSet(tools),
|
|
86
|
+
toolChoice: "required",
|
|
87
|
+
maxRetries: 0,
|
|
88
|
+
abortSignal: AbortSignal.timeout(chatProbeTimeoutMs)
|
|
89
|
+
});
|
|
90
|
+
const [
|
|
91
|
+
steps,
|
|
92
|
+
text,
|
|
93
|
+
sources,
|
|
94
|
+
finishReason,
|
|
95
|
+
toolCalls,
|
|
96
|
+
response,
|
|
97
|
+
providerMetadata
|
|
98
|
+
] = await Promise.all([
|
|
99
|
+
streamed.steps,
|
|
100
|
+
streamed.text,
|
|
101
|
+
streamed.sources,
|
|
102
|
+
streamed.finishReason,
|
|
103
|
+
streamed.toolCalls,
|
|
104
|
+
streamed.response,
|
|
105
|
+
streamed.providerMetadata
|
|
106
|
+
]).catch((error) => {
|
|
107
|
+
throw streamFailure ?? error;
|
|
108
|
+
});
|
|
109
|
+
let retrieval = method.extractRetrieval({
|
|
110
|
+
steps,
|
|
111
|
+
providerMetadata
|
|
112
|
+
});
|
|
113
|
+
if (retrieval.calls.length === 0) {
|
|
114
|
+
log.warn("Search-required probe yielded no retrieval calls; not stored", {
|
|
115
|
+
model: surface,
|
|
116
|
+
stepCount: steps.length,
|
|
117
|
+
partTypes: [
|
|
118
|
+
...new Set(steps.flatMap((step) => step.content.map((p) => p.type)))
|
|
119
|
+
]
|
|
120
|
+
});
|
|
121
|
+
retrieval = null;
|
|
122
|
+
}
|
|
123
|
+
const firstCost = gatewayCostUsd(providerMetadata);
|
|
124
|
+
if (text.trim().length > 0) {
|
|
125
|
+
return {
|
|
126
|
+
answerText: text,
|
|
127
|
+
sources: { format: "search", sources },
|
|
128
|
+
retrieval,
|
|
129
|
+
servedModel: response.modelId,
|
|
130
|
+
...reportedCostOf([firstCost])
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
log.warn("Search probe returned no answer text; synthesizing from search", {
|
|
134
|
+
model: surface,
|
|
135
|
+
finishReason,
|
|
136
|
+
toolCallCount: toolCalls.length,
|
|
137
|
+
sourceCount: sources.length
|
|
138
|
+
});
|
|
139
|
+
let followupFailure;
|
|
140
|
+
const followupStream = streamText({
|
|
141
|
+
onError: ({ error }) => {
|
|
142
|
+
followupFailure ??= error;
|
|
143
|
+
},
|
|
144
|
+
model: gateway(model),
|
|
145
|
+
messages: [
|
|
146
|
+
{ role: "user", content: prompt },
|
|
147
|
+
...response.messages,
|
|
148
|
+
{
|
|
149
|
+
role: "user",
|
|
150
|
+
content: "Using the web search results from the previous turn, answer the original question in a complete, readable response. Do not perform another search. If the search results were insufficient, say what was missing."
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
maxOutputTokens: probeMaxOutputTokens,
|
|
154
|
+
tools: toProviderToolSet(method.tools()),
|
|
155
|
+
toolChoice: "none",
|
|
156
|
+
maxRetries: 0,
|
|
157
|
+
abortSignal: AbortSignal.timeout(chatProbeTimeoutMs)
|
|
158
|
+
});
|
|
159
|
+
const [followupText, followupSources, followupMetadata] = await Promise.all([
|
|
160
|
+
followupStream.text,
|
|
161
|
+
followupStream.sources,
|
|
162
|
+
followupStream.providerMetadata
|
|
163
|
+
]).catch((error) => {
|
|
164
|
+
throw followupFailure ?? error;
|
|
165
|
+
});
|
|
166
|
+
if (followupText.trim().length > 0) {
|
|
167
|
+
return {
|
|
168
|
+
answerText: followupText,
|
|
169
|
+
sources: {
|
|
170
|
+
format: "search",
|
|
171
|
+
sources: sources.length > 0 ? sources : followupSources
|
|
172
|
+
},
|
|
173
|
+
retrieval,
|
|
174
|
+
servedModel: response.modelId,
|
|
175
|
+
...reportedCostOf([firstCost, gatewayCostUsd(followupMetadata)])
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
throw new ProbeFailure(
|
|
179
|
+
"empty_answer",
|
|
180
|
+
`${surface} completed a required web search but returned no answer text (tool calls: ${toolCalls.length}, sources: ${sources.length})`
|
|
181
|
+
);
|
|
182
|
+
};
|
|
183
|
+
var gatewayChatProfile = (id, retrieval) => {
|
|
184
|
+
return {
|
|
185
|
+
id,
|
|
186
|
+
observes: { retrieval, servedModel: "compare_to_requested" },
|
|
187
|
+
settings: [{ name: "AI_GATEWAY_API_KEY", secret: true }],
|
|
188
|
+
pool: "gateway",
|
|
189
|
+
retry: "chat",
|
|
190
|
+
estimateUsd: probeUsd[id],
|
|
191
|
+
billing: "metered",
|
|
192
|
+
resolvesRedirects: true
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
var gatewayChatMethods = {
|
|
196
|
+
[ProbeAdapterId.GATEWAY_OPENAI]: {
|
|
197
|
+
profile: gatewayChatProfile(ProbeAdapterId.GATEWAY_OPENAI, "full"),
|
|
198
|
+
tools: () => ({ web_search: openai.tools.webSearch({}) }),
|
|
199
|
+
extractRetrieval: (result) => extractOpenAiRetrieval(result.steps)
|
|
200
|
+
},
|
|
201
|
+
[ProbeAdapterId.GATEWAY_GOOGLE]: {
|
|
202
|
+
profile: gatewayChatProfile(ProbeAdapterId.GATEWAY_GOOGLE, "partial"),
|
|
203
|
+
tools: () => ({ google_search: google.tools.googleSearch({}) }),
|
|
204
|
+
extractRetrieval: (result) => extractGeminiRetrieval(result.providerMetadata)
|
|
205
|
+
},
|
|
206
|
+
[ProbeAdapterId.GATEWAY_ANTHROPIC]: {
|
|
207
|
+
profile: gatewayChatProfile(ProbeAdapterId.GATEWAY_ANTHROPIC, "full"),
|
|
208
|
+
tools: () => ({
|
|
209
|
+
web_search: anthropic.tools.webSearch_20250305({ maxUses: 5 })
|
|
210
|
+
}),
|
|
211
|
+
extractRetrieval: (result) => extractAnthropicRetrieval(result.steps)
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
var gatewayChatProfiles = {
|
|
215
|
+
[ProbeAdapterId.GATEWAY_OPENAI]: gatewayChatMethods[ProbeAdapterId.GATEWAY_OPENAI].profile,
|
|
216
|
+
[ProbeAdapterId.GATEWAY_GOOGLE]: gatewayChatMethods[ProbeAdapterId.GATEWAY_GOOGLE].profile,
|
|
217
|
+
[ProbeAdapterId.GATEWAY_ANTHROPIC]: gatewayChatMethods[ProbeAdapterId.GATEWAY_ANTHROPIC].profile
|
|
218
|
+
};
|
|
219
|
+
var createGatewayChatAdapter = (id, {
|
|
220
|
+
surface,
|
|
221
|
+
gateway,
|
|
222
|
+
model
|
|
223
|
+
}) => {
|
|
224
|
+
const method = gatewayChatMethods[id];
|
|
225
|
+
const adapter = {
|
|
226
|
+
...method.profile,
|
|
227
|
+
surface,
|
|
228
|
+
model,
|
|
229
|
+
request: (promptText) => searchRequest(model, promptText, method.tools()),
|
|
230
|
+
probe: (promptText) => searchProbe({ surface, gateway, model, promptText, method }),
|
|
231
|
+
classifyError: classifyGatewayFailure
|
|
232
|
+
};
|
|
233
|
+
return adapter;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
export {
|
|
237
|
+
probeMaxOutputTokens,
|
|
238
|
+
chatProbeTimeoutMs,
|
|
239
|
+
searchPromptPrefix,
|
|
240
|
+
reportedCostOf,
|
|
241
|
+
classifyGatewayFailure,
|
|
242
|
+
describeTools,
|
|
243
|
+
gatewayChatProfiles,
|
|
244
|
+
createGatewayChatAdapter
|
|
245
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import {
|
|
2
|
+
probeFailureKinds
|
|
3
|
+
} from "./chunk-7O3M6I2X.js";
|
|
4
|
+
import {
|
|
5
|
+
aeoSurfaceSchema,
|
|
6
|
+
retrievalLogSchema
|
|
7
|
+
} from "./chunk-EDQTINTL.js";
|
|
8
|
+
import {
|
|
9
|
+
isAgentSurface
|
|
10
|
+
} from "./chunk-AASWJR7Q.js";
|
|
11
|
+
|
|
12
|
+
// src/stores/unit-record.ts
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
var unitFields = {
|
|
15
|
+
sectionKey: z.string().min(1),
|
|
16
|
+
promptId: z.string().min(1),
|
|
17
|
+
promptText: z.string(),
|
|
18
|
+
surface: aeoSurfaceSchema,
|
|
19
|
+
runIndex: z.number().int().positive(),
|
|
20
|
+
runId: z.string().min(1).optional()
|
|
21
|
+
};
|
|
22
|
+
var probeSchema = z.object({
|
|
23
|
+
promptId: z.string().min(1),
|
|
24
|
+
promptText: z.string(),
|
|
25
|
+
promptCategory: z.string(),
|
|
26
|
+
modelName: aeoSurfaceSchema,
|
|
27
|
+
runIndex: z.number().int().positive(),
|
|
28
|
+
text: z.string(),
|
|
29
|
+
retrieval: retrievalLogSchema.optional(),
|
|
30
|
+
noOverview: z.literal(true).optional(),
|
|
31
|
+
reportedModel: z.string().optional(),
|
|
32
|
+
usedWebSearch: z.boolean().nullable().optional(),
|
|
33
|
+
agentCliVersion: z.string().optional(),
|
|
34
|
+
requestedModel: z.string().nullable().optional()
|
|
35
|
+
}).strict().superRefine((probe, context) => {
|
|
36
|
+
const agent = isAgentSurface(probe.modelName);
|
|
37
|
+
if (agent && (probe.usedWebSearch === void 0 || !probe.agentCliVersion)) {
|
|
38
|
+
context.addIssue({
|
|
39
|
+
code: "custom",
|
|
40
|
+
message: "A coding-agent probe names its web-tool use and CLI version."
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (!agent && probe.agentCliVersion !== void 0) {
|
|
44
|
+
context.addIssue({
|
|
45
|
+
code: "custom",
|
|
46
|
+
message: "A chat probe carries no CLI version."
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
var captureMetadataSchema = z.object({
|
|
51
|
+
requestedModel: z.string().nullable(),
|
|
52
|
+
reportedModel: z.string().nullable(),
|
|
53
|
+
parameters: z.record(z.string(), z.unknown()),
|
|
54
|
+
adapter: z.string().min(1).max(200).optional()
|
|
55
|
+
}).strict();
|
|
56
|
+
var capturedRowSchema = z.object({
|
|
57
|
+
status: z.literal("captured").optional(),
|
|
58
|
+
...unitFields,
|
|
59
|
+
capturedAt: z.iso.datetime(),
|
|
60
|
+
probe: probeSchema,
|
|
61
|
+
captureMetadata: captureMetadataSchema.optional()
|
|
62
|
+
}).strict().superRefine((row, context) => {
|
|
63
|
+
if (row.probe.modelName !== row.surface || row.probe.promptId !== row.promptId || row.probe.runIndex !== row.runIndex) {
|
|
64
|
+
context.addIssue({
|
|
65
|
+
code: "custom",
|
|
66
|
+
message: "The probe's surface, prompt and run differ from the row's."
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
var failedRowSchema = z.object({
|
|
71
|
+
status: z.literal("failed"),
|
|
72
|
+
...unitFields,
|
|
73
|
+
failedAt: z.iso.datetime(),
|
|
74
|
+
kind: z.enum(probeFailureKinds),
|
|
75
|
+
attempts: z.number().int().nonnegative(),
|
|
76
|
+
lastError: z.string()
|
|
77
|
+
}).strict();
|
|
78
|
+
var ProbeStoreIntegrityError = class extends Error {
|
|
79
|
+
constructor(message) {
|
|
80
|
+
super(message);
|
|
81
|
+
this.name = "ProbeStoreIntegrityError";
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
var isRecordLike = (row) => {
|
|
85
|
+
return typeof row === "object" && row !== null && !Array.isArray(row);
|
|
86
|
+
};
|
|
87
|
+
var parseUnitRecord = (row, where) => {
|
|
88
|
+
const failed = isRecordLike(row) && row.status === "failed";
|
|
89
|
+
const result = (failed ? failedRowSchema : capturedRowSchema).safeParse(row);
|
|
90
|
+
if (!result.success || !isRecordLike(row)) {
|
|
91
|
+
const issue = result.error?.issues[0];
|
|
92
|
+
const field = issue?.path.join(".") ?? "";
|
|
93
|
+
const reason = issue ? `${field === "" ? "" : `${field}: `}${issue.message}` : "not an object";
|
|
94
|
+
throw new ProbeStoreIntegrityError(
|
|
95
|
+
`Probe store row ${where} is invalid (${reason}). Please repair or remove the row; the run stops rather than probe a banked unit again.`
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
const record = failed || row.status === "captured" ? row : { ...row, status: "captured" };
|
|
99
|
+
return record;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export {
|
|
103
|
+
ProbeStoreIntegrityError,
|
|
104
|
+
parseUnitRecord
|
|
105
|
+
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
plannedProbeUnitsForSection,
|
|
6
6
|
unitRecordKey
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ODIXZHHX.js";
|
|
8
8
|
import {
|
|
9
9
|
contentHash
|
|
10
10
|
} from "./chunk-H2KDLDK6.js";
|
|
@@ -43,7 +43,10 @@ var captureSchema = unitSchema.extend({
|
|
|
43
43
|
requestedModel: z.string().nullable(),
|
|
44
44
|
reportedModel: z.string().nullable(),
|
|
45
45
|
cliVersion: z.string().nullable(),
|
|
46
|
-
parameters: z.record(z.string(), z.unknown()).nullable()
|
|
46
|
+
parameters: z.record(z.string(), z.unknown()).nullable(),
|
|
47
|
+
// Present only when the capture was not taken with its surface's
|
|
48
|
+
// legacy adapter (probe adapters spec §4.6).
|
|
49
|
+
adapter: z.string().optional()
|
|
47
50
|
}),
|
|
48
51
|
metadataProvenance: z.enum(["captured_record", "legacy_preserved_record"]),
|
|
49
52
|
digest
|
|
@@ -197,7 +200,8 @@ var buildCaptureManifest = (args) => {
|
|
|
197
200
|
requestedModel: record.captureMetadata?.requestedModel ?? null,
|
|
198
201
|
reportedModel: record.captureMetadata?.reportedModel ?? null,
|
|
199
202
|
cliVersion: "agentCliVersion" in record.probe ? record.probe.agentCliVersion : null,
|
|
200
|
-
parameters: record.captureMetadata?.parameters ?? null
|
|
203
|
+
parameters: record.captureMetadata?.parameters ?? null,
|
|
204
|
+
...record.captureMetadata?.adapter === void 0 ? {} : { adapter: record.captureMetadata.adapter }
|
|
201
205
|
},
|
|
202
206
|
metadataProvenance: record.captureMetadata ? "captured_record" : "legacy_preserved_record"
|
|
203
207
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bankDir,
|
|
3
3
|
runDirectoryState
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WUIY7BXR.js";
|
|
5
5
|
import {
|
|
6
6
|
FileProbeStore
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HEWHNSDP.js";
|
|
8
8
|
import {
|
|
9
9
|
localReportKey,
|
|
10
10
|
readAuditFile,
|
|
11
11
|
toAuditConfig
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-QUZYFAGP.js";
|
|
13
13
|
import {
|
|
14
14
|
budgetFile
|
|
15
15
|
} from "./chunk-2B5QF6UQ.js";
|
|
@@ -21,25 +21,25 @@ import {
|
|
|
21
21
|
} from "./chunk-GEFKDW7X.js";
|
|
22
22
|
import {
|
|
23
23
|
readRunInputs
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-HLC6OHGO.js";
|
|
25
25
|
import {
|
|
26
26
|
runJournalDir
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-7ZR3WDF2.js";
|
|
28
28
|
import {
|
|
29
29
|
readJournal
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-AB7DUTX5.js";
|
|
31
31
|
import {
|
|
32
32
|
hasErrorCode
|
|
33
33
|
} from "./chunk-2QLAFBCG.js";
|
|
34
34
|
import {
|
|
35
35
|
capturePlan
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-6RED3G6K.js";
|
|
37
37
|
import {
|
|
38
38
|
unitRecordKey
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-ODIXZHHX.js";
|
|
40
40
|
import {
|
|
41
41
|
chargedCall
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-EUXNCXCR.js";
|
|
43
43
|
|
|
44
44
|
// src/engine/run-status.ts
|
|
45
45
|
import { readFile, stat } from "node:fs/promises";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
openJournal,
|
|
6
6
|
putObject,
|
|
7
7
|
readJournal
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AB7DUTX5.js";
|
|
9
9
|
import {
|
|
10
10
|
mintRunId
|
|
11
11
|
} from "./chunk-W46Y7KBR.js";
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
operationKinds,
|
|
17
17
|
toolId,
|
|
18
18
|
toolVersion
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-JJFOILZK.js";
|
|
20
20
|
|
|
21
21
|
// src/bundle/recorder.ts
|
|
22
22
|
import { readFile, rename, stat } from "node:fs/promises";
|
|
@@ -229,10 +229,22 @@ var recordingAccounting = (accounting, recorder) => {
|
|
|
229
229
|
}
|
|
230
230
|
});
|
|
231
231
|
};
|
|
232
|
+
const release = async (callId) => {
|
|
233
|
+
await accounting.release(callId);
|
|
234
|
+
const handle = open.get(callId);
|
|
235
|
+
open.delete(callId);
|
|
236
|
+
requests.delete(callId);
|
|
237
|
+
responses.delete(callId);
|
|
238
|
+
await handle?.finish({
|
|
239
|
+
outcome: "cancelled",
|
|
240
|
+
details: { released: true }
|
|
241
|
+
});
|
|
242
|
+
};
|
|
232
243
|
const wrapped = {
|
|
233
244
|
deadlineAt: accounting.deadlineAt,
|
|
234
245
|
reserve,
|
|
235
246
|
settle,
|
|
247
|
+
release,
|
|
236
248
|
observe,
|
|
237
249
|
assertOwned: () => accounting.assertOwned()
|
|
238
250
|
};
|
|
@@ -265,20 +277,37 @@ var recorded = async ({
|
|
|
265
277
|
await handle.finish(finish(value));
|
|
266
278
|
return value;
|
|
267
279
|
};
|
|
280
|
+
var maxRecordedRedirects = 100;
|
|
281
|
+
var redirectDetails = (redirects) => {
|
|
282
|
+
if (!redirects || redirects.length === 0) {
|
|
283
|
+
return {};
|
|
284
|
+
}
|
|
285
|
+
return {
|
|
286
|
+
redirects: redirects.slice(0, maxRecordedRedirects),
|
|
287
|
+
...redirects.length > maxRecordedRedirects && {
|
|
288
|
+
redirectsOmitted: redirects.length - maxRecordedRedirects
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
};
|
|
268
292
|
var probeTraceOf = (recorder, kind) => {
|
|
269
293
|
const start = async (attempt) => {
|
|
270
294
|
const handle = await recorder.start({
|
|
271
295
|
kind,
|
|
272
296
|
role: attempt.surface,
|
|
273
297
|
attempt: attempt.attempt,
|
|
274
|
-
inputs: {
|
|
298
|
+
inputs: {
|
|
299
|
+
prompt: attempt.promptText,
|
|
300
|
+
// The request as dispatched, prefix and parameters included.
|
|
301
|
+
...attempt.request && { request: JSON.stringify(attempt.request) }
|
|
302
|
+
},
|
|
275
303
|
details: {
|
|
276
304
|
sectionKey: attempt.sectionKey ?? null,
|
|
277
305
|
surface: attempt.surface,
|
|
278
306
|
promptId: attempt.promptId,
|
|
279
307
|
runIndex: attempt.runIndex,
|
|
280
308
|
retryOf: attempt.retryOf ?? null,
|
|
281
|
-
requestedModel: attempt.requestedModel
|
|
309
|
+
requestedModel: attempt.requestedModel,
|
|
310
|
+
...attempt.adapter !== void 0 && { adapter: attempt.adapter }
|
|
282
311
|
}
|
|
283
312
|
});
|
|
284
313
|
const end = async (result) => {
|
|
@@ -300,7 +329,11 @@ var probeTraceOf = (recorder, kind) => {
|
|
|
300
329
|
// Reported by the provider or the CLI's own events; null when
|
|
301
330
|
// neither named one, never the requested model (§7.1).
|
|
302
331
|
reportedModel: result.reportedModel ?? null,
|
|
303
|
-
noOverview: result.noOverview === true
|
|
332
|
+
noOverview: result.noOverview === true,
|
|
333
|
+
// What the provider reported the attempt cost; null when it did
|
|
334
|
+
// not say, never the estimate.
|
|
335
|
+
costUsd: result.costUsd ?? null,
|
|
336
|
+
...redirectDetails(result.redirects)
|
|
304
337
|
}
|
|
305
338
|
});
|
|
306
339
|
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
aiOverviewEndpoint,
|
|
3
|
+
aiOverviewTask
|
|
4
|
+
} from "./chunk-XTBCXEH7.js";
|
|
5
|
+
import {
|
|
6
|
+
classifyGatewayFailure
|
|
7
|
+
} from "./chunk-66UE4TT2.js";
|
|
8
|
+
import {
|
|
9
|
+
probeUsd
|
|
10
|
+
} from "./chunk-U42I3SBR.js";
|
|
11
|
+
import {
|
|
12
|
+
ProbeAdapterId
|
|
13
|
+
} from "./chunk-KSUI4DAY.js";
|
|
14
|
+
import {
|
|
15
|
+
ProbeFailure
|
|
16
|
+
} from "./chunk-7O3M6I2X.js";
|
|
17
|
+
|
|
18
|
+
// src/probes/adapters/dataforseo-ai-overview.ts
|
|
19
|
+
var dataForSeoAiOverviewProfile = {
|
|
20
|
+
id: ProbeAdapterId.DATAFORSEO_AI_OVERVIEW,
|
|
21
|
+
observes: { retrieval: "none", servedModel: "none" },
|
|
22
|
+
settings: [
|
|
23
|
+
{ name: "DATAFORSEO_LOGIN", secret: false },
|
|
24
|
+
{ name: "DATAFORSEO_PASSWORD", secret: true }
|
|
25
|
+
],
|
|
26
|
+
pool: "dataforseo",
|
|
27
|
+
retry: "chat",
|
|
28
|
+
estimateUsd: probeUsd[ProbeAdapterId.DATAFORSEO_AI_OVERVIEW],
|
|
29
|
+
billing: "metered",
|
|
30
|
+
resolvesRedirects: true
|
|
31
|
+
};
|
|
32
|
+
var createDataForSeoAiOverviewAdapter = ({
|
|
33
|
+
surface,
|
|
34
|
+
client,
|
|
35
|
+
locale
|
|
36
|
+
}) => {
|
|
37
|
+
const retrieval = () => {
|
|
38
|
+
return {
|
|
39
|
+
exposure: dataForSeoAiOverviewProfile.observes.retrieval,
|
|
40
|
+
calls: []
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
const adapter = {
|
|
44
|
+
...dataForSeoAiOverviewProfile,
|
|
45
|
+
surface,
|
|
46
|
+
request: (promptText) => {
|
|
47
|
+
const { keyword, ...parameters } = aiOverviewTask(promptText, locale);
|
|
48
|
+
return {
|
|
49
|
+
prompt: keyword,
|
|
50
|
+
parameters: { endpoint: aiOverviewEndpoint, ...parameters }
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
probe: async (promptText) => {
|
|
54
|
+
if (!client) {
|
|
55
|
+
throw new ProbeFailure("auth", "DataForSEO credentials not configured");
|
|
56
|
+
}
|
|
57
|
+
const result = await client.getGoogleAIOverview(promptText, locale);
|
|
58
|
+
if (result.status === "no_overview") {
|
|
59
|
+
return {
|
|
60
|
+
answerText: "",
|
|
61
|
+
sources: { format: "none" },
|
|
62
|
+
retrieval: retrieval(),
|
|
63
|
+
noOverview: true
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (result.markdown.trim().length === 0 && result.references.length === 0) {
|
|
67
|
+
throw new ProbeFailure(
|
|
68
|
+
"empty_answer",
|
|
69
|
+
"google_ai_overview returned an AI Overview with no text"
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
answerText: result.markdown,
|
|
74
|
+
sources: { format: "ai_overview", references: result.references },
|
|
75
|
+
retrieval: retrieval()
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
classifyError: classifyGatewayFailure
|
|
79
|
+
};
|
|
80
|
+
return adapter;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export {
|
|
84
|
+
dataForSeoAiOverviewProfile,
|
|
85
|
+
createDataForSeoAiOverviewAdapter
|
|
86
|
+
};
|
|
@@ -3,16 +3,18 @@ import {
|
|
|
3
3
|
} from "./chunk-ZIGNJAPC.js";
|
|
4
4
|
import {
|
|
5
5
|
authorToolCaps
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SQ55KGHO.js";
|
|
7
|
+
import {
|
|
8
|
+
profileOf
|
|
9
|
+
} from "./chunk-MNG5TZRW.js";
|
|
7
10
|
import {
|
|
8
11
|
authorSearchLowUsd,
|
|
9
12
|
authorTokens,
|
|
10
13
|
costCoefficientsVersion,
|
|
11
14
|
hostTokensPerAnswer,
|
|
12
|
-
probeUsd,
|
|
13
15
|
searchUsdPerAnswer,
|
|
14
16
|
stageTokens
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-U42I3SBR.js";
|
|
16
18
|
|
|
17
19
|
// src/engine/cost-estimate.ts
|
|
18
20
|
var cents = (usd) => {
|
|
@@ -43,14 +45,16 @@ var sumOf = (ranges) => {
|
|
|
43
45
|
var estimateRunCost = ({
|
|
44
46
|
plan,
|
|
45
47
|
model,
|
|
46
|
-
grounding
|
|
48
|
+
grounding,
|
|
49
|
+
bindings
|
|
47
50
|
}) => {
|
|
48
51
|
const answers = plan.units.length;
|
|
49
52
|
const { cachedShare } = stageTokens;
|
|
50
53
|
const probes = sumOf(
|
|
51
|
-
[...plan.probesBySurface].map(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
[...plan.probesBySurface].map(([surface, count]) => {
|
|
55
|
+
const usd = profileOf(bindings[surface]).estimateUsd;
|
|
56
|
+
return rangeOf(usd.low * count, usd.high * count);
|
|
57
|
+
})
|
|
54
58
|
);
|
|
55
59
|
const stages = rangeOf(
|
|
56
60
|
tokensCost(
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
checkLlmsTxt,
|
|
3
3
|
runCrawlerAccessCheck
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DSK3PM4Z.js";
|
|
5
5
|
import {
|
|
6
6
|
runRenderabilityCheck
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CYJNBVQB.js";
|
|
8
8
|
import {
|
|
9
9
|
recorded
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7ZR3WDF2.js";
|
|
11
11
|
import {
|
|
12
12
|
createHostPacer,
|
|
13
13
|
guardedRequest
|