@tangle-network/agent-eval 0.218.1 → 0.219.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/CHANGELOG.md +21 -0
- package/dist/adapters/http.d.ts +3 -3
- package/dist/adapters/http.d.ts.map +1 -1
- package/dist/adapters/http.js +1 -0
- package/dist/adapters/http.js.map +1 -1
- package/dist/{agent-profile-DTt8uGP9.d.ts → agent-profile-D01Io2Xw.d.ts} +4 -4
- package/dist/{agent-profile-DTt8uGP9.d.ts.map → agent-profile-D01Io2Xw.d.ts.map} +1 -1
- package/dist/analyst/index.d.ts +13 -13
- package/dist/analyst/index.d.ts.map +1 -1
- package/dist/analyst/index.js +8 -8
- package/dist/analyst/index.js.map +1 -1
- package/dist/{analyze-runs-DjlZOVXx.d.ts → analyze-runs-BWAHBDAw.d.ts} +4 -4
- package/dist/{analyze-runs-DjlZOVXx.d.ts.map → analyze-runs-BWAHBDAw.d.ts.map} +1 -1
- package/dist/{benchmark-command-BupdHRyf.js → benchmark-command-BzmMTnvC.js} +10 -10
- package/dist/{benchmark-command-BupdHRyf.js.map → benchmark-command-BzmMTnvC.js.map} +1 -1
- package/dist/benchmarks/index.d.ts +5 -5
- package/dist/benchmarks/index.js +3 -3
- package/dist/benchmarks/index.js.map +1 -1
- package/dist/campaign/index.d.ts +8 -8
- package/dist/campaign/index.js +8 -8
- package/dist/{campaign-CGvUTnmc.js → campaign-BVPC6ODQ.js} +149 -10
- package/dist/campaign-BVPC6ODQ.js.map +1 -0
- package/dist/campaign-evidence-DunzcJGv.js.map +1 -1
- package/dist/{chat-client-B2pXlPdx.js → chat-client-CMQ8_h4J.js} +2 -2
- package/dist/{chat-client-B2pXlPdx.js.map → chat-client-CMQ8_h4J.js.map} +1 -1
- package/dist/{chat-json-call-Dm9c-b41.js → chat-json-call-BrZKn0L3.js} +2 -2
- package/dist/{chat-json-call-Dm9c-b41.js.map → chat-json-call-BrZKn0L3.js.map} +1 -1
- package/dist/cli.js +8 -8
- package/dist/{completion-verifier-DbLVf3i8.js → completion-verifier-Cigap8CG.js} +4 -4
- package/dist/{completion-verifier-DbLVf3i8.js.map → completion-verifier-Cigap8CG.js.map} +1 -1
- package/dist/contract/index.d.ts +11 -11
- package/dist/contract/index.js +7 -7
- package/dist/{cost-ledger-D0352Z4d.js → cost-ledger-BGZB6yY2.js} +75 -2
- package/dist/cost-ledger-BGZB6yY2.js.map +1 -0
- package/dist/{cost-ledger-Jk62OBfF.d.ts → cost-ledger-C1W3ICmP.d.ts} +26 -2
- package/dist/cost-ledger-C1W3ICmP.d.ts.map +1 -0
- package/dist/{default-registry-BJ-Pq6yL.js → default-registry-BrKmT01n.js} +3 -3
- package/dist/{default-registry-BJ-Pq6yL.js.map → default-registry-BrKmT01n.js.map} +1 -1
- package/dist/{default-registry-DXgLmoDI.d.ts → default-registry-Cwg_QN3d.d.ts} +6 -6
- package/dist/{default-registry-DXgLmoDI.d.ts.map → default-registry-Cwg_QN3d.d.ts.map} +1 -1
- package/dist/{define-agent-eval-BlH10zEw.d.ts → define-agent-eval-C2nFhHPu.d.ts} +8 -8
- package/dist/{define-agent-eval-BlH10zEw.d.ts.map → define-agent-eval-C2nFhHPu.d.ts.map} +1 -1
- package/dist/{define-agent-eval-BGdFKlrc.js → define-agent-eval-UQY3VbJ2.js} +4 -4
- package/dist/{define-agent-eval-BGdFKlrc.js.map → define-agent-eval-UQY3VbJ2.js.map} +1 -1
- package/dist/diagnosis/index.d.ts +2 -2
- package/dist/{dspy-rlm-engine-CSMwudLO.js → dspy-rlm-engine-Bn_Mt_LW.js} +3 -3
- package/dist/{dspy-rlm-engine-CSMwudLO.js.map → dspy-rlm-engine-Bn_Mt_LW.js.map} +1 -1
- package/dist/{engine-BvZ0R-36.d.ts → engine-BpGGw6cd.d.ts} +3 -3
- package/dist/{engine-BvZ0R-36.d.ts.map → engine-BpGGw6cd.d.ts.map} +1 -1
- package/dist/{evaluation-BOZ38vOH.d.ts → evaluation-CBdQt_kr.d.ts} +4 -4
- package/dist/{evaluation-BOZ38vOH.d.ts.map → evaluation-CBdQt_kr.d.ts.map} +1 -1
- package/dist/evaluation.d.ts +1 -1
- package/dist/evaluation.js +1 -1
- package/dist/{exact-types-CflbJ9f3.d.ts → exact-types-BYFmYq44.d.ts} +2 -2
- package/dist/{exact-types-CflbJ9f3.d.ts.map → exact-types-BYFmYq44.d.ts.map} +1 -1
- package/dist/experiment/index.d.ts +24 -1
- package/dist/experiment/index.d.ts.map +1 -1
- package/dist/experiment/index.js.map +1 -1
- package/dist/{external-optimizer-process-C3Wm7Vhn.js → external-optimizer-process-wOLfzsCC.js} +2 -2
- package/dist/{external-optimizer-process-C3Wm7Vhn.js.map → external-optimizer-process-wOLfzsCC.js.map} +1 -1
- package/dist/{external-optimizer-subprocess-B5gdLRZv.js → external-optimizer-subprocess-D670Oxf2.js} +3 -3
- package/dist/{external-optimizer-subprocess-B5gdLRZv.js.map → external-optimizer-subprocess-D670Oxf2.js.map} +1 -1
- package/dist/{feedback-trajectory-BWmhRBGu.d.ts → feedback-trajectory-DhB9WzYg.d.ts} +3 -3
- package/dist/{feedback-trajectory-BWmhRBGu.d.ts.map → feedback-trajectory-DhB9WzYg.d.ts.map} +1 -1
- package/dist/{findings-store-BtTzPL0d.js → findings-store-CvNo712L.js} +5 -5
- package/dist/{findings-store-BtTzPL0d.js.map → findings-store-CvNo712L.js.map} +1 -1
- package/dist/fuzz.d.ts +1 -1
- package/dist/fuzz.js +1 -1
- package/dist/hosted/index.js +1 -1
- package/dist/{index-CX-GAUpw.d.ts → index-CHxwfW5g.d.ts} +2 -2
- package/dist/{index-CX-GAUpw.d.ts.map → index-CHxwfW5g.d.ts.map} +1 -1
- package/dist/{index-BLGqZ81N.d.ts → index-CVFStrQD.d.ts} +8 -8
- package/dist/{index-BLGqZ81N.d.ts.map → index-CVFStrQD.d.ts.map} +1 -1
- package/dist/{index-CiRwLv2R.d.ts → index-D7fmC-1K.d.ts} +3 -4
- package/dist/index-D7fmC-1K.d.ts.map +1 -0
- package/dist/{index-DbMOXYnP.d.ts → index-DAXfpVf7.d.ts} +10 -10
- package/dist/{index-DbMOXYnP.d.ts.map → index-DAXfpVf7.d.ts.map} +1 -1
- package/dist/{index-B16FNdW5.d.ts → index-Q6DvdcwI.d.ts} +37 -11
- package/dist/index-Q6DvdcwI.d.ts.map +1 -0
- package/dist/index.d.ts +26 -26
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/{integrity-_qgZLA5p.d.ts → integrity-CCwvezWS.d.ts} +2 -2
- package/dist/{integrity-_qgZLA5p.d.ts.map → integrity-CCwvezWS.d.ts.map} +1 -1
- package/dist/judge-gate-Co5tuh57.js.map +1 -1
- package/dist/{judge-gate-DsL0yFcb.d.ts → judge-gate-Dc_mXQsL.d.ts} +2 -2
- package/dist/judge-gate-Dc_mXQsL.d.ts.map +1 -0
- package/dist/{kind-factory-Gy4fXixd.js → kind-factory-BhxbtUsQ.js} +2 -2
- package/dist/{kind-factory-Gy4fXixd.js.map → kind-factory-BhxbtUsQ.js.map} +1 -1
- package/dist/{llm-client-_Y6ic-tf.js → llm-client-DXuOTseU.js} +2 -2
- package/dist/{llm-client-_Y6ic-tf.js.map → llm-client-DXuOTseU.js.map} +1 -1
- package/dist/{llm-judge-Djxh-Uhs.js → llm-judge-Cc8vDJh_.js} +9 -8
- package/dist/llm-judge-Cc8vDJh_.js.map +1 -0
- package/dist/matrix/index.d.ts +2 -2
- package/dist/{matrix-CCSBna4q.d.ts → matrix-Cf-AGxGh.d.ts} +4 -4
- package/dist/{matrix-CCSBna4q.d.ts.map → matrix-Cf-AGxGh.d.ts.map} +1 -1
- package/dist/meta-eval/index.d.ts +2 -2
- package/dist/{mint-BRZXuwRi.d.ts → mint-CkzpVPdz.d.ts} +3 -3
- package/dist/{mint-BRZXuwRi.d.ts.map → mint-CkzpVPdz.d.ts.map} +1 -1
- package/dist/multishot/golden/index.d.ts +1 -1
- package/dist/multishot/index.d.ts +2 -2
- package/dist/multishot/index.js.map +1 -1
- package/dist/openapi.json +1 -1
- package/dist/{pareto-CTv8vozZ.js → pareto-BiBnQXAE.js} +304 -210
- package/dist/pareto-BiBnQXAE.js.map +1 -0
- package/dist/pipelines/index.d.ts.map +1 -1
- package/dist/pipelines/index.js.map +1 -1
- package/dist/{prime-protocol-BWG2DQIk.d.ts → prime-protocol-CckHBxGu.d.ts} +3 -3
- package/dist/{prime-protocol-BWG2DQIk.d.ts.map → prime-protocol-CckHBxGu.d.ts.map} +1 -1
- package/dist/{promotion-gate-CxEHRsZW.d.ts → promotion-gate-CkVZHagC.d.ts} +3 -3
- package/dist/{promotion-gate-CxEHRsZW.d.ts.map → promotion-gate-CkVZHagC.d.ts.map} +1 -1
- package/dist/{proposal-findings-n-5WBbEx.js → proposal-findings-E1aSC_cU.js} +2 -2
- package/dist/{proposal-findings-n-5WBbEx.js.map → proposal-findings-E1aSC_cU.js.map} +1 -1
- package/dist/{registry-ssNoHzwD.d.ts → registry-B_yG-1jh.d.ts} +5 -5
- package/dist/{registry-ssNoHzwD.d.ts.map → registry-B_yG-1jh.d.ts.map} +1 -1
- package/dist/render-Cs34y0iX.js.map +1 -1
- package/dist/reporting.d.ts +3 -3
- package/dist/{researcher-GU1tV4dn.d.ts → researcher-H0p44OYC.d.ts} +5 -5
- package/dist/{researcher-GU1tV4dn.d.ts.map → researcher-H0p44OYC.d.ts.map} +1 -1
- package/dist/{reward-DrZ71vnf.d.ts → reward-BeUgVVC_.d.ts} +2 -2
- package/dist/{reward-DrZ71vnf.d.ts.map → reward-BeUgVVC_.d.ts.map} +1 -1
- package/dist/{reward-hacking-E52wq86n.d.ts → reward-hacking-WTxUbtbb.d.ts} +2 -2
- package/dist/{reward-hacking-E52wq86n.d.ts.map → reward-hacking-WTxUbtbb.d.ts.map} +1 -1
- package/dist/rl.d.ts +8 -8
- package/dist/rollout/index.d.ts +3 -3
- package/dist/rollout-Dd1ucT_M.js.map +1 -1
- package/dist/{rubric-predictive-validity-DiwT8PbL.d.ts → rubric-predictive-validity-noY7uE03.d.ts} +2 -2
- package/dist/{rubric-predictive-validity-DiwT8PbL.d.ts.map → rubric-predictive-validity-noY7uE03.d.ts.map} +1 -1
- package/dist/{run-record-CaxbLq6Y.d.ts → run-record-C3awiXPf.d.ts} +2 -2
- package/dist/{run-record-CaxbLq6Y.d.ts.map → run-record-C3awiXPf.d.ts.map} +1 -1
- package/dist/schema-CvhfLjtZ.js.map +1 -1
- package/dist/search/index.d.ts +2 -2
- package/dist/search/index.js +2 -2
- package/dist/{search-kernel-p9JB3SmL.d.ts → search-kernel-Dloxd6gs.d.ts} +4 -4
- package/dist/{search-kernel-p9JB3SmL.d.ts.map → search-kernel-Dloxd6gs.d.ts.map} +1 -1
- package/dist/{search-ledger-ClpN4I3e.js → search-ledger-CZRqtFbW.js} +249 -242
- package/dist/search-ledger-CZRqtFbW.js.map +1 -0
- package/dist/{search-shipper-Bg2HW3Uv.js → search-shipper-Dn3NLsuH.js} +2 -2
- package/dist/{search-shipper-Bg2HW3Uv.js.map → search-shipper-Dn3NLsuH.js.map} +1 -1
- package/dist/{search-summary-CrBuvVnf.js → search-summary-D4bwYnAE.js} +2 -2
- package/dist/{search-summary-CrBuvVnf.js.map → search-summary-D4bwYnAE.js.map} +1 -1
- package/dist/{server-C6M0qR8h.js → server-8TS8XCvg.js} +3 -3
- package/dist/{server-C6M0qR8h.js.map → server-8TS8XCvg.js.map} +1 -1
- package/dist/{skillopt-optimization-method-5dlex7MJ.js → skillopt-optimization-method-DLKqdhcR.js} +106 -61
- package/dist/skillopt-optimization-method-DLKqdhcR.js.map +1 -0
- package/dist/{statistical-heldout-BHfLZHrm.d.ts → statistical-heldout-3z3I-kJN.d.ts} +3 -3
- package/dist/{statistical-heldout-BHfLZHrm.d.ts.map → statistical-heldout-3z3I-kJN.d.ts.map} +1 -1
- package/dist/{store-otlp-BteDAbHK.js → store-otlp-dyWE3wAG.js} +2 -2
- package/dist/{store-otlp-BteDAbHK.js.map → store-otlp-dyWE3wAG.js.map} +1 -1
- package/dist/{store-tool-spans-D5l_OfTJ.js → store-tool-spans-DIUgZbzu.js} +3 -3
- package/dist/{store-tool-spans-D5l_OfTJ.js.map → store-tool-spans-DIUgZbzu.js.map} +1 -1
- package/dist/{store-tool-spans-DZS0HWVf.d.ts → store-tool-spans-DPwXHQkH.d.ts} +7 -7
- package/dist/{store-tool-spans-DZS0HWVf.d.ts.map → store-tool-spans-DPwXHQkH.d.ts.map} +1 -1
- package/dist/{summary-report-CkbRcSuu.d.ts → summary-report-C8V49Jt3.d.ts} +3 -3
- package/dist/{summary-report-CkbRcSuu.d.ts.map → summary-report-C8V49Jt3.d.ts.map} +1 -1
- package/dist/{systemone-BMzDJb1i.d.ts → systemone-DVA7t76V.d.ts} +6 -6
- package/dist/{systemone-BMzDJb1i.d.ts.map → systemone-DVA7t76V.d.ts.map} +1 -1
- package/dist/{systemone-review-CwE6JGIp.d.ts → systemone-review-CUBMuTLi.d.ts} +2 -2
- package/dist/{systemone-review-CwE6JGIp.d.ts.map → systemone-review-CUBMuTLi.d.ts.map} +1 -1
- package/dist/systemone.d.ts +3 -3
- package/dist/{tool-groups-DyNz2JZ_.d.ts → tool-groups-LISbBWCg.d.ts} +3 -3
- package/dist/tool-groups-LISbBWCg.d.ts.map +1 -0
- package/dist/{trace-questions-xxwgsuMi.d.ts → trace-questions-C42fYEE4.d.ts} +4 -4
- package/dist/{trace-questions-xxwgsuMi.d.ts.map → trace-questions-C42fYEE4.d.ts.map} +1 -1
- package/dist/trace-repair/index.d.ts +3 -3
- package/dist/traces.d.ts +6 -6
- package/dist/traces.js +3 -3
- package/dist/trajectory-replay/index.js +24 -3
- package/dist/trajectory-replay/index.js.map +1 -1
- package/dist/{tree-B5e1uAeL.js → tree-DSqwJpL9.js} +3 -3
- package/dist/{tree-B5e1uAeL.js.map → tree-DSqwJpL9.js.map} +1 -1
- package/dist/{types-CW8ewATZ.d.ts → types-8yQzNm8u.d.ts} +4 -4
- package/dist/{types-CW8ewATZ.d.ts.map → types-8yQzNm8u.d.ts.map} +1 -1
- package/dist/{types-DtkO1G9L.d.ts → types-CHfn1zg5.d.ts} +69 -71
- package/dist/types-CHfn1zg5.d.ts.map +1 -0
- package/dist/{types-BKCzzmit.d.ts → types-D8GXK9Z5.d.ts} +3 -3
- package/dist/{types-BKCzzmit.d.ts.map → types-D8GXK9Z5.d.ts.map} +1 -1
- package/dist/{types-D-mgRzlh.d.ts → types-eMhdacVp.d.ts} +2 -2
- package/dist/{types-D-mgRzlh.d.ts.map → types-eMhdacVp.d.ts.map} +1 -1
- package/dist/wire/index.d.ts +3 -3
- package/dist/wire/index.js +1 -1
- package/docs/campaign-proposers.md +16 -0
- package/docs/concepts.md +31 -0
- package/docs/public-api.md +76 -75
- package/package.json +2 -5
- package/dist/campaign-CGvUTnmc.js.map +0 -1
- package/dist/cost-ledger-D0352Z4d.js.map +0 -1
- package/dist/cost-ledger-Jk62OBfF.d.ts.map +0 -1
- package/dist/index-B16FNdW5.d.ts.map +0 -1
- package/dist/index-CiRwLv2R.d.ts.map +0 -1
- package/dist/judge-gate-DsL0yFcb.d.ts.map +0 -1
- package/dist/llm-judge-Djxh-Uhs.js.map +0 -1
- package/dist/pareto-CTv8vozZ.js.map +0 -1
- package/dist/search-ledger-ClpN4I3e.js.map +0 -1
- package/dist/skillopt-optimization-method-5dlex7MJ.js.map +0 -1
- package/dist/tool-groups-DyNz2JZ_.d.ts.map +0 -1
- package/dist/types-DtkO1G9L.d.ts.map +0 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { s as ValidationError, t as AgentEvalError } from "./errors-BcOs5MKW.js";
|
|
2
2
|
import { a as hashCanonical, i as compareCodeUnits, r as canonicalString } from "./canonical-Dq2hOQ8L.js";
|
|
3
|
-
import { c as agentProfileModelId, o as agentProfileHash, r as verifyCompletion, s as agentProfileId, u as harnessAxisOf } from "./completion-verifier-
|
|
3
|
+
import { c as agentProfileModelId, o as agentProfileHash, r as verifyCompletion, s as agentProfileId, u as harnessAxisOf } from "./completion-verifier-Cigap8CG.js";
|
|
4
4
|
import { i as buildAgentProfileCell } from "./agent-profile-cell-B1V1gUZs.js";
|
|
5
5
|
import { c as validateRunRecord, i as modelHasSnapshot, n as UNKNOWN_MODEL, o as runTaskScore } from "./run-record-DhEJgoPz.js";
|
|
6
6
|
import { t as comparePairedArms } from "./paired-arms-Ct4LTKc1.js";
|
|
7
7
|
import { i as pairedBootstrap } from "./mean-BbA_JCzW.js";
|
|
8
8
|
import { o as pairHoldout } from "./statistical-heldout-Bksv92Th.js";
|
|
9
9
|
import { n as contentHash, t as canonicalJson } from "./verdict-cache-CL_7tePD.js";
|
|
10
|
-
import { $ as planCampaignRun, Q as runCampaign, et as resolveRunDir, nt as cellCachePath, rt as computeManifestHash, s as executeOptimizationMethod, u as combineComparisonCosts } from "./llm-judge-
|
|
10
|
+
import { $ as planCampaignRun, Q as runCampaign, et as resolveRunDir, nt as cellCachePath, rt as computeManifestHash, s as executeOptimizationMethod, u as combineComparisonCosts } from "./llm-judge-Cc8vDJh_.js";
|
|
11
11
|
import { n as campaignCellToRunRecord, r as projectCampaignCellQuality, t as campaignCellCostProvenance } from "./run-record-CysKLB93.js";
|
|
12
12
|
import { C as assertCodeSurfaceIdentity, D as surfaceContentHash, M as assertRealBackend, N as summarizeBackendIntegrity, P as assertCampaignDesign, R as campaignScenarioIdentity } from "./campaign-evidence-DunzcJGv.js";
|
|
13
13
|
import { a as mapConcurrent } from "./journal-C7om8Gum.js";
|
|
14
|
-
import { M as fsCampaignStorage } from "./external-optimizer-subprocess-
|
|
15
|
-
import "./pareto-
|
|
16
|
-
import "./search-ledger-
|
|
17
|
-
import "./search-summary-
|
|
18
|
-
import "./external-optimizer-process-
|
|
19
|
-
import "./skillopt-optimization-method-
|
|
14
|
+
import { M as fsCampaignStorage } from "./external-optimizer-subprocess-D670Oxf2.js";
|
|
15
|
+
import "./pareto-BiBnQXAE.js";
|
|
16
|
+
import "./search-ledger-CZRqtFbW.js";
|
|
17
|
+
import "./search-summary-D4bwYnAE.js";
|
|
18
|
+
import "./external-optimizer-process-wOLfzsCC.js";
|
|
19
|
+
import "./skillopt-optimization-method-DLKqdhcR.js";
|
|
20
20
|
import "./sequential-CimQrbjv.js";
|
|
21
21
|
import { createHash } from "node:crypto";
|
|
22
22
|
import { closeSync, constants, existsSync, fstatSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, readdirSync, readlinkSync, realpathSync, rmSync, statSync } from "node:fs";
|
|
@@ -24,6 +24,145 @@ import { z } from "zod";
|
|
|
24
24
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
25
25
|
import { devNull, tmpdir } from "node:os";
|
|
26
26
|
import { execFileSync } from "node:child_process";
|
|
27
|
+
//#region src/campaign/cost-breakdown.ts
|
|
28
|
+
/** Read the source rates for this execution, never a copied model price table.
|
|
29
|
+
* inputTokens includes cachedTokens. Seat credits are standard model credits;
|
|
30
|
+
* discounts and MCP charges require provider observations, not token guesses.
|
|
31
|
+
* The existing USD receipt remains the Router charge. Sandbox is additional.
|
|
32
|
+
*/
|
|
33
|
+
async function measureCampaignCost(input) {
|
|
34
|
+
const sources = [];
|
|
35
|
+
const unknown = {
|
|
36
|
+
kind: "uncaptured",
|
|
37
|
+
usd: null
|
|
38
|
+
};
|
|
39
|
+
if (input.routerUsd !== void 0) finite(input.routerUsd, "routerUsd");
|
|
40
|
+
const result = {
|
|
41
|
+
router: input.routerUsd === void 0 ? unknown : {
|
|
42
|
+
kind: "observed",
|
|
43
|
+
usd: input.routerUsd
|
|
44
|
+
},
|
|
45
|
+
sandbox: unknown,
|
|
46
|
+
seatCredits: {
|
|
47
|
+
kind: "uncaptured",
|
|
48
|
+
credits: null,
|
|
49
|
+
reason: "No seat usage supplied"
|
|
50
|
+
},
|
|
51
|
+
sources
|
|
52
|
+
};
|
|
53
|
+
const read = async (url) => {
|
|
54
|
+
const response = await fetch(url, { signal: input.signal ? AbortSignal.any([input.signal, AbortSignal.timeout(15e3)]) : AbortSignal.timeout(15e3) });
|
|
55
|
+
if (!response.ok) throw new Error(`Rate source HTTP ${response.status}`);
|
|
56
|
+
if (Number(response.headers.get("content-length")) > 1e6) throw new Error("Rate source too large");
|
|
57
|
+
const chunks = [];
|
|
58
|
+
let bytes = 0;
|
|
59
|
+
for await (const chunk of response.body ?? []) {
|
|
60
|
+
bytes += chunk.byteLength;
|
|
61
|
+
if (bytes > 1e6) throw new Error("Rate source too large");
|
|
62
|
+
chunks.push(chunk);
|
|
63
|
+
}
|
|
64
|
+
const text = Buffer.concat(chunks).toString("utf8");
|
|
65
|
+
return {
|
|
66
|
+
text,
|
|
67
|
+
snapshot: {
|
|
68
|
+
url,
|
|
69
|
+
readAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
70
|
+
sha256: createHash("sha256").update(text).digest("hex")
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
if (input.sandbox) {
|
|
75
|
+
for (const [key, value] of Object.entries(input.sandbox)) if (key !== "pool") finite(value, `sandbox.${key}`);
|
|
76
|
+
try {
|
|
77
|
+
const { text, snapshot } = await read("https://sandbox.tangle.tools/v1/pricing/sandboxes");
|
|
78
|
+
const card = JSON.parse(text).pools?.[input.sandbox.pool ?? "general"];
|
|
79
|
+
const rates = {};
|
|
80
|
+
for (const key of [
|
|
81
|
+
"cpuCoreHourUsd",
|
|
82
|
+
"memoryGBHourUsd",
|
|
83
|
+
"diskGBHourUsd",
|
|
84
|
+
"minChargeHourUsd"
|
|
85
|
+
]) {
|
|
86
|
+
finite(card?.[key], key);
|
|
87
|
+
rates[key] = card[key];
|
|
88
|
+
}
|
|
89
|
+
const s = input.sandbox;
|
|
90
|
+
const usd = Math.max(rates.minChargeHourUsd, s.cpu * rates.cpuCoreHourUsd + s.memoryGB * rates.memoryGBHourUsd + s.diskGB * rates.diskGBHourUsd) * s.seconds / 3600;
|
|
91
|
+
finite(usd, "sandbox USD estimate");
|
|
92
|
+
result.sandbox = {
|
|
93
|
+
kind: "estimated",
|
|
94
|
+
usd
|
|
95
|
+
};
|
|
96
|
+
sources.push({
|
|
97
|
+
...snapshot,
|
|
98
|
+
rates
|
|
99
|
+
});
|
|
100
|
+
} catch {}
|
|
101
|
+
}
|
|
102
|
+
if (input.seat) {
|
|
103
|
+
const { usage, model } = input.seat;
|
|
104
|
+
if (usage.usageUnknown || usage.cachedTokens === void 0) {
|
|
105
|
+
result.seatCredits = {
|
|
106
|
+
kind: "uncaptured",
|
|
107
|
+
credits: null,
|
|
108
|
+
reason: "Seat token or cached-input usage is unknown"
|
|
109
|
+
};
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
for (const key of [
|
|
113
|
+
"inputTokens",
|
|
114
|
+
"cachedTokens",
|
|
115
|
+
"outputTokens"
|
|
116
|
+
]) {
|
|
117
|
+
const value = usage[key];
|
|
118
|
+
if (!Number.isSafeInteger(value) || value < 0) throw new Error(`seat.${key} must be a known nonnegative token count`);
|
|
119
|
+
}
|
|
120
|
+
if (usage.cachedTokens > usage.inputTokens) throw new Error("cachedTokens exceeds inputTokens");
|
|
121
|
+
try {
|
|
122
|
+
const { text, snapshot } = await read("https://docs.z.ai/devpack/overview.md");
|
|
123
|
+
const modelName = model.split("/").at(-1).toLowerCase();
|
|
124
|
+
const section = text.split("#### Credit Calculation")[1]?.split("#### Estimated Token Allowance")[0];
|
|
125
|
+
if (!section) throw new Error("Credit calculation section unavailable");
|
|
126
|
+
const matching = [...section.matchAll(/<tr>\s*([\s\S]*?)<\/tr>/gu)].filter((row) => {
|
|
127
|
+
return [...row[1].matchAll(/<td\b[^>]*>([\s\S]*?)<\/td>/gu)].map((cell) => cell[1].trim()).some((cell) => cell.split(/\\|\n|</u)[0].trim().toLowerCase() === modelName);
|
|
128
|
+
});
|
|
129
|
+
if (matching.length !== 1) throw new Error(`No unique live credit row for '${model}'`);
|
|
130
|
+
const rateCells = [...matching[0][1].matchAll(/<td\b[^>]*>([\s\S]*?)<\/td>/gu)].map((cell) => cell[1].trim()).slice(-3);
|
|
131
|
+
if (rateCells.length !== 3 || rateCells.some((cell) => !/^(?:\d+)(?:\.\d+)?$/u.test(cell))) throw new Error("Invalid live credit multipliers");
|
|
132
|
+
const multipliers = rateCells.map(Number);
|
|
133
|
+
for (const rate of multipliers) finite(rate, "credit multiplier");
|
|
134
|
+
const divisor = Number(section.match(/Model credit usage[^\n]*\/\s*([\d,]+)/u)?.[1]?.replaceAll(",", ""));
|
|
135
|
+
if (!Number.isFinite(divisor) || divisor <= 0) throw new Error("No live credit divisor");
|
|
136
|
+
const [fresh, cached, output] = multipliers;
|
|
137
|
+
const credits = ((usage.inputTokens - usage.cachedTokens) * fresh + usage.cachedTokens * cached + usage.outputTokens * output) / divisor;
|
|
138
|
+
finite(credits, "standard seat credits");
|
|
139
|
+
result.seatCredits = {
|
|
140
|
+
kind: "estimated",
|
|
141
|
+
credits
|
|
142
|
+
};
|
|
143
|
+
sources.push({
|
|
144
|
+
...snapshot,
|
|
145
|
+
rates: {
|
|
146
|
+
inputMultiplier: fresh,
|
|
147
|
+
cachedInputMultiplier: cached,
|
|
148
|
+
outputMultiplier: output,
|
|
149
|
+
divisor
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
} catch (error) {
|
|
153
|
+
result.seatCredits = {
|
|
154
|
+
kind: "uncaptured",
|
|
155
|
+
credits: null,
|
|
156
|
+
reason: error instanceof Error ? error.message : "Credit source unavailable"
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return result;
|
|
161
|
+
}
|
|
162
|
+
function finite(value, label) {
|
|
163
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) throw new Error(`${label} must be finite and nonnegative`);
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
27
166
|
//#region src/campaign/cross-surface-context.ts
|
|
28
167
|
function validateCrossSurfaceInput(input) {
|
|
29
168
|
assertNonEmptyUnique(input.taskOrder, "taskOrder");
|
|
@@ -2956,6 +3095,6 @@ function resolveWorktreePath(surface, worktreeDir) {
|
|
|
2956
3095
|
return verifyCodeSurface(surface, worktreeDir).path;
|
|
2957
3096
|
}
|
|
2958
3097
|
//#endregion
|
|
2959
|
-
export { analyzeCrossSurfaceInteractions as S, neutralizationGate as _, createRetainedDispatch as a, loadEvalFixtureScenarios as b, runProfileMatrixSegment as c, scoreUserStory as d, scoreboardSummary as f, neutralizeText as g, sequentialOptimizationMethod as h, scoreDiscrimination as i, runProfileMatrix as l, scopedOptimizationMethod as m, resolveWorktreePath as n, createProfileMatrixPlan as o, userStoryScoreboard as p, verifyCodeSurface as r, finalizeProfileMatrix as s, gitWorktreeAdapter as t, renderScoreboardMarkdown as u, discoverEvalFixtures as v, planEvalFixtureRun as x, loadEvalFixture as y };
|
|
3098
|
+
export { measureCampaignCost as C, analyzeCrossSurfaceInteractions as S, neutralizationGate as _, createRetainedDispatch as a, loadEvalFixtureScenarios as b, runProfileMatrixSegment as c, scoreUserStory as d, scoreboardSummary as f, neutralizeText as g, sequentialOptimizationMethod as h, scoreDiscrimination as i, runProfileMatrix as l, scopedOptimizationMethod as m, resolveWorktreePath as n, createProfileMatrixPlan as o, userStoryScoreboard as p, verifyCodeSurface as r, finalizeProfileMatrix as s, gitWorktreeAdapter as t, renderScoreboardMarkdown as u, discoverEvalFixtures as v, planEvalFixtureRun as x, loadEvalFixture as y };
|
|
2960
3099
|
|
|
2961
|
-
//# sourceMappingURL=campaign-
|
|
3100
|
+
//# sourceMappingURL=campaign-BVPC6ODQ.js.map
|