@dsh-ray/assistant-evaluation 0.0.1-seed.0 → 0.2.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/LICENSE +21 -0
- package/README.md +309 -1
- package/bin/dsh-benchmark.js +46 -0
- package/cordis.patch.yml +17 -0
- package/lib/attention-owner-questions.d.ts +104 -0
- package/lib/attention-owner-questions.d.ts.map +1 -0
- package/lib/attention-owner-questions.js +185 -0
- package/lib/attention-owner-questions.js.map +1 -0
- package/lib/attention-tuning.d.ts +513 -0
- package/lib/attention-tuning.d.ts.map +1 -0
- package/lib/attention-tuning.js +1242 -0
- package/lib/attention-tuning.js.map +1 -0
- package/lib/benchmark/cli.d.ts +6 -0
- package/lib/benchmark/cli.d.ts.map +1 -0
- package/lib/benchmark/cli.js +370 -0
- package/lib/benchmark/cli.js.map +1 -0
- package/lib/benchmark/corpus.d.ts +39 -0
- package/lib/benchmark/corpus.d.ts.map +1 -0
- package/lib/benchmark/corpus.js +183 -0
- package/lib/benchmark/corpus.js.map +1 -0
- package/lib/benchmark/deepseek.d.ts +15 -0
- package/lib/benchmark/deepseek.d.ts.map +1 -0
- package/lib/benchmark/deepseek.js +143 -0
- package/lib/benchmark/deepseek.js.map +1 -0
- package/lib/benchmark/families-corpus.d.ts +109 -0
- package/lib/benchmark/families-corpus.d.ts.map +1 -0
- package/lib/benchmark/families-corpus.js +587 -0
- package/lib/benchmark/families-corpus.js.map +1 -0
- package/lib/benchmark/families-runtime.d.ts +191 -0
- package/lib/benchmark/families-runtime.d.ts.map +1 -0
- package/lib/benchmark/families-runtime.js +1171 -0
- package/lib/benchmark/families-runtime.js.map +1 -0
- package/lib/benchmark/growth-runtime.d.ts +97 -0
- package/lib/benchmark/growth-runtime.d.ts.map +1 -0
- package/lib/benchmark/growth-runtime.js +437 -0
- package/lib/benchmark/growth-runtime.js.map +1 -0
- package/lib/benchmark/holdout-evidence.d.ts +126 -0
- package/lib/benchmark/holdout-evidence.d.ts.map +1 -0
- package/lib/benchmark/holdout-evidence.js +466 -0
- package/lib/benchmark/holdout-evidence.js.map +1 -0
- package/lib/benchmark/holdout-isolation.d.ts +27 -0
- package/lib/benchmark/holdout-isolation.d.ts.map +1 -0
- package/lib/benchmark/holdout-isolation.js +66 -0
- package/lib/benchmark/holdout-isolation.js.map +1 -0
- package/lib/benchmark/holdout-protocol.d.ts +68 -0
- package/lib/benchmark/holdout-protocol.d.ts.map +1 -0
- package/lib/benchmark/holdout-protocol.js +271 -0
- package/lib/benchmark/holdout-protocol.js.map +1 -0
- package/lib/benchmark/holdout-provider.d.ts +26 -0
- package/lib/benchmark/holdout-provider.d.ts.map +1 -0
- package/lib/benchmark/holdout-provider.js +382 -0
- package/lib/benchmark/holdout-provider.js.map +1 -0
- package/lib/benchmark/holdout.d.ts +83 -0
- package/lib/benchmark/holdout.d.ts.map +1 -0
- package/lib/benchmark/holdout.js +394 -0
- package/lib/benchmark/holdout.js.map +1 -0
- package/lib/benchmark/index.d.ts +12 -0
- package/lib/benchmark/index.d.ts.map +1 -0
- package/lib/benchmark/index.js +9 -0
- package/lib/benchmark/index.js.map +1 -0
- package/lib/benchmark/memory-corpus.d.ts +55 -0
- package/lib/benchmark/memory-corpus.d.ts.map +1 -0
- package/lib/benchmark/memory-corpus.js +153 -0
- package/lib/benchmark/memory-corpus.js.map +1 -0
- package/lib/benchmark/memory-runtime.d.ts +63 -0
- package/lib/benchmark/memory-runtime.d.ts.map +1 -0
- package/lib/benchmark/memory-runtime.js +75 -0
- package/lib/benchmark/memory-runtime.js.map +1 -0
- package/lib/benchmark/native-goal-services.d.ts +66 -0
- package/lib/benchmark/native-goal-services.d.ts.map +1 -0
- package/lib/benchmark/native-goal-services.js +52 -0
- package/lib/benchmark/native-goal-services.js.map +1 -0
- package/lib/benchmark/native-skills-runtime.d.ts +157 -0
- package/lib/benchmark/native-skills-runtime.d.ts.map +1 -0
- package/lib/benchmark/native-skills-runtime.js +337 -0
- package/lib/benchmark/native-skills-runtime.js.map +1 -0
- package/lib/benchmark/native-skills.d.ts +142 -0
- package/lib/benchmark/native-skills.d.ts.map +1 -0
- package/lib/benchmark/native-skills.js +259 -0
- package/lib/benchmark/native-skills.js.map +1 -0
- package/lib/benchmark/native.d.ts +77 -0
- package/lib/benchmark/native.d.ts.map +1 -0
- package/lib/benchmark/native.js +711 -0
- package/lib/benchmark/native.js.map +1 -0
- package/lib/benchmark/planning-runtime.d.ts +80 -0
- package/lib/benchmark/planning-runtime.d.ts.map +1 -0
- package/lib/benchmark/planning-runtime.js +313 -0
- package/lib/benchmark/planning-runtime.js.map +1 -0
- package/lib/benchmark/report.d.ts +4 -0
- package/lib/benchmark/report.d.ts.map +1 -0
- package/lib/benchmark/report.js +243 -0
- package/lib/benchmark/report.js.map +1 -0
- package/lib/benchmark/runner.d.ts +25 -0
- package/lib/benchmark/runner.d.ts.map +1 -0
- package/lib/benchmark/runner.js +124 -0
- package/lib/benchmark/runner.js.map +1 -0
- package/lib/benchmark/schema.d.ts +20 -0
- package/lib/benchmark/schema.d.ts.map +1 -0
- package/lib/benchmark/schema.js +183 -0
- package/lib/benchmark/schema.js.map +1 -0
- package/lib/benchmark/store.d.ts +18 -0
- package/lib/benchmark/store.d.ts.map +1 -0
- package/lib/benchmark/store.js +321 -0
- package/lib/benchmark/store.js.map +1 -0
- package/lib/benchmark/strategy-capabilities.d.ts +154 -0
- package/lib/benchmark/strategy-capabilities.d.ts.map +1 -0
- package/lib/benchmark/strategy-capabilities.js +304 -0
- package/lib/benchmark/strategy-capabilities.js.map +1 -0
- package/lib/benchmark/strategy-config.d.ts +29 -0
- package/lib/benchmark/strategy-config.d.ts.map +1 -0
- package/lib/benchmark/strategy-config.js +98 -0
- package/lib/benchmark/strategy-config.js.map +1 -0
- package/lib/benchmark/strategy-corpus-v2.d.ts +18 -0
- package/lib/benchmark/strategy-corpus-v2.d.ts.map +1 -0
- package/lib/benchmark/strategy-corpus-v2.js +143 -0
- package/lib/benchmark/strategy-corpus-v2.js.map +1 -0
- package/lib/benchmark/strategy-corpus.d.ts +30 -0
- package/lib/benchmark/strategy-corpus.d.ts.map +1 -0
- package/lib/benchmark/strategy-corpus.js +95 -0
- package/lib/benchmark/strategy-corpus.js.map +1 -0
- package/lib/benchmark/strategy-evidence.d.ts +161 -0
- package/lib/benchmark/strategy-evidence.d.ts.map +1 -0
- package/lib/benchmark/strategy-evidence.js +561 -0
- package/lib/benchmark/strategy-evidence.js.map +1 -0
- package/lib/benchmark/strategy-executor.d.ts +29 -0
- package/lib/benchmark/strategy-executor.d.ts.map +1 -0
- package/lib/benchmark/strategy-executor.js +180 -0
- package/lib/benchmark/strategy-executor.js.map +1 -0
- package/lib/benchmark/strategy-goal-runtime.d.ts +80 -0
- package/lib/benchmark/strategy-goal-runtime.d.ts.map +1 -0
- package/lib/benchmark/strategy-goal-runtime.js +283 -0
- package/lib/benchmark/strategy-goal-runtime.js.map +1 -0
- package/lib/benchmark/strategy-meter.d.ts +62 -0
- package/lib/benchmark/strategy-meter.d.ts.map +1 -0
- package/lib/benchmark/strategy-meter.js +330 -0
- package/lib/benchmark/strategy-meter.js.map +1 -0
- package/lib/benchmark/strategy-owner.d.ts +71 -0
- package/lib/benchmark/strategy-owner.d.ts.map +1 -0
- package/lib/benchmark/strategy-owner.js +282 -0
- package/lib/benchmark/strategy-owner.js.map +1 -0
- package/lib/benchmark/strategy-plan.d.ts +58 -0
- package/lib/benchmark/strategy-plan.d.ts.map +1 -0
- package/lib/benchmark/strategy-plan.js +81 -0
- package/lib/benchmark/strategy-plan.js.map +1 -0
- package/lib/benchmark/strategy-policy.d.ts +16 -0
- package/lib/benchmark/strategy-policy.d.ts.map +1 -0
- package/lib/benchmark/strategy-policy.js +77 -0
- package/lib/benchmark/strategy-policy.js.map +1 -0
- package/lib/benchmark/strategy-projection.d.ts +157 -0
- package/lib/benchmark/strategy-projection.d.ts.map +1 -0
- package/lib/benchmark/strategy-projection.js +171 -0
- package/lib/benchmark/strategy-projection.js.map +1 -0
- package/lib/benchmark/strategy.d.ts +17 -0
- package/lib/benchmark/strategy.d.ts.map +1 -0
- package/lib/benchmark/strategy.js +21 -0
- package/lib/benchmark/strategy.js.map +1 -0
- package/lib/benchmark/traex.d.ts +17 -0
- package/lib/benchmark/traex.d.ts.map +1 -0
- package/lib/benchmark/traex.js +139 -0
- package/lib/benchmark/traex.js.map +1 -0
- package/lib/benchmark/types.d.ts +190 -0
- package/lib/benchmark/types.d.ts.map +1 -0
- package/lib/benchmark/types.js +3 -0
- package/lib/benchmark/types.js.map +1 -0
- package/lib/benchmark/usage.d.ts +36 -0
- package/lib/benchmark/usage.d.ts.map +1 -0
- package/lib/benchmark/usage.js +84 -0
- package/lib/benchmark/usage.js.map +1 -0
- package/lib/index.d.ts +26 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +19 -0
- package/lib/index.js.map +1 -0
- package/lib/intake-attention-agreement-store.d.ts +33 -0
- package/lib/intake-attention-agreement-store.d.ts.map +1 -0
- package/lib/intake-attention-agreement-store.js +162 -0
- package/lib/intake-attention-agreement-store.js.map +1 -0
- package/lib/intake-attention-agreement.d.ts +126 -0
- package/lib/intake-attention-agreement.d.ts.map +1 -0
- package/lib/intake-attention-agreement.js +209 -0
- package/lib/intake-attention-agreement.js.map +1 -0
- package/lib/intake-evaluation-agreement.d.ts +204 -0
- package/lib/intake-evaluation-agreement.d.ts.map +1 -0
- package/lib/intake-evaluation-agreement.js +740 -0
- package/lib/intake-evaluation-agreement.js.map +1 -0
- package/lib/notification-outcomes.d.ts +63 -0
- package/lib/notification-outcomes.d.ts.map +1 -0
- package/lib/notification-outcomes.js +399 -0
- package/lib/notification-outcomes.js.map +1 -0
- package/lib/service.d.ts +694 -0
- package/lib/service.d.ts.map +1 -0
- package/lib/service.js +2992 -0
- package/lib/service.js.map +1 -0
- package/lib/sqlite.d.ts +15 -0
- package/lib/sqlite.d.ts.map +1 -0
- package/lib/sqlite.js +1247 -0
- package/lib/sqlite.js.map +1 -0
- package/lib/store.d.ts +175 -0
- package/lib/store.d.ts.map +1 -0
- package/lib/store.js +1722 -0
- package/lib/store.js.map +1 -0
- package/lib/tools.d.ts +4 -0
- package/lib/tools.d.ts.map +1 -0
- package/lib/tools.js +212 -0
- package/lib/tools.js.map +1 -0
- package/lib/types.d.ts +787 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +28 -0
- package/lib/types.js.map +1 -0
- package/lib/version.d.ts +2 -0
- package/lib/version.d.ts.map +1 -0
- package/lib/version.js +2 -0
- package/lib/version.js.map +1 -0
- package/lib/work-item-owner-proof.d.ts +4 -0
- package/lib/work-item-owner-proof.d.ts.map +1 -0
- package/lib/work-item-owner-proof.js +53 -0
- package/lib/work-item-owner-proof.js.map +1 -0
- package/package.json +235 -4
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { type StrategyBenchmarkPlan } from './strategy-plan.js';
|
|
2
|
+
import { type StrategyEvidenceObject } from './strategy-evidence.js';
|
|
3
|
+
import { type TokenUsageRates } from './usage.js';
|
|
4
|
+
import type { BenchmarkResult } from './types.js';
|
|
5
|
+
export declare const strategyProjectionProtocol = "dsh-native-goal-strategy-projection/v1";
|
|
6
|
+
/**
|
|
7
|
+
* Criterion reasons emitted with status 'failed' by the independent verifier
|
|
8
|
+
* (plugins/assistant-verifier drivers.ts failed() calls). Every one of these means
|
|
9
|
+
* the candidate delivered an artifact that was actually inspected and found wrong.
|
|
10
|
+
* artifact-unavailable / altered / timeout / io reasons are status 'unknown' and
|
|
11
|
+
* cannot distinguish an undelivered artifact from a tool failure, so they stay unknown.
|
|
12
|
+
*/
|
|
13
|
+
export declare const behaviorFailureReasons: readonly ["citation-mismatch", "citation-missing", "isolated-unexpected-exit-code", "isolated-unexpected-stdout", "readback-object-mismatch", "readback-revision-mismatch", "readback-value-mismatch", "repository-head-mismatch", "repository-requirements-not-met", "required-text-missing", "unexpected-exit-code", "unexpected-stdout"];
|
|
14
|
+
export type StrategyFailureClassification = 'achieved' | 'delivered-incorrect-behavior' | 'undelivered-or-unknown';
|
|
15
|
+
export interface StrategyCriterionAttribution {
|
|
16
|
+
readonly criterionId: string;
|
|
17
|
+
/** Raw CriterionResult.reason, preserved verbatim for audit. */
|
|
18
|
+
readonly reason: string;
|
|
19
|
+
/** True only for the independent-verifier behavior-failure whitelist; never inferred from model prose. */
|
|
20
|
+
readonly behaviorFailure: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface StrategyReceiptAttribution {
|
|
23
|
+
readonly contractId: string;
|
|
24
|
+
readonly taskKind: 'goal-step' | 'goal-outcome';
|
|
25
|
+
readonly objectiveStatus: 'achieved' | 'not-achieved' | 'unknown';
|
|
26
|
+
readonly quiescent: boolean;
|
|
27
|
+
readonly failedCriteria: readonly StrategyCriterionAttribution[];
|
|
28
|
+
}
|
|
29
|
+
export interface StrategySessionCost {
|
|
30
|
+
readonly modelCalls: number;
|
|
31
|
+
readonly inputTokens: number;
|
|
32
|
+
readonly outputTokens: number;
|
|
33
|
+
/** Null when any settled usage class lacks an exact tariff; never estimated. */
|
|
34
|
+
readonly costUsdMicros: number | null;
|
|
35
|
+
}
|
|
36
|
+
export interface StrategyCellProjection {
|
|
37
|
+
readonly cellId: string;
|
|
38
|
+
readonly caseId: string;
|
|
39
|
+
readonly variantId: string;
|
|
40
|
+
readonly repeat: number;
|
|
41
|
+
readonly status: 'completed' | 'unknown';
|
|
42
|
+
readonly verdict: 'achieved' | 'not-achieved' | 'unknown';
|
|
43
|
+
readonly attribution: {
|
|
44
|
+
readonly classification: StrategyFailureClassification;
|
|
45
|
+
/**
|
|
46
|
+
* 'receipt-behavior-failure': an independent quiescent receipt has a failed
|
|
47
|
+
* criterion on the behavior-failure whitelist.
|
|
48
|
+
* 'infrastructure-unknown': a failure object; the infrastructure reason is preserved.
|
|
49
|
+
* 'no-behavior-failure-receipt': completed cell without an auditable behavior failure.
|
|
50
|
+
* 'achieved': the cell achieved its outcome contract.
|
|
51
|
+
*/
|
|
52
|
+
readonly basis: 'achieved' | 'receipt-behavior-failure' | 'infrastructure-unknown' | 'no-behavior-failure-receipt';
|
|
53
|
+
/** Present only for failure objects; BenchmarkResult.reason is infrastructure-level. */
|
|
54
|
+
readonly infrastructureReason: BenchmarkResult['reason'] | null;
|
|
55
|
+
readonly receipts: readonly StrategyReceiptAttribution[];
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Settled-trace cost split by evidence-attributed session role. Null for unknown
|
|
59
|
+
* cells because the run was not quiescent and a partial split cannot support a
|
|
60
|
+
* paired conclusion.
|
|
61
|
+
*/
|
|
62
|
+
readonly costs: {
|
|
63
|
+
readonly parent: StrategySessionCost;
|
|
64
|
+
readonly children: StrategySessionCost;
|
|
65
|
+
} | null;
|
|
66
|
+
}
|
|
67
|
+
export interface StrategyCoordinationPair {
|
|
68
|
+
readonly caseId: string;
|
|
69
|
+
readonly repeat: number;
|
|
70
|
+
readonly directCellId: string | null;
|
|
71
|
+
readonly candidateCellId: string | null;
|
|
72
|
+
/** False when either arm is missing or unknown; such pairs cannot prove a cost. */
|
|
73
|
+
readonly comparable: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Two objective views of coordination cost, null unless comparable:
|
|
76
|
+
* - candidateChildren: strategy-child sessions only (zero on the direct arm by construction).
|
|
77
|
+
* - extra: whole-cell candidate minus direct, including any parent-call difference.
|
|
78
|
+
*/
|
|
79
|
+
readonly coordination: {
|
|
80
|
+
readonly candidateChildren: StrategySessionCost;
|
|
81
|
+
readonly extra: {
|
|
82
|
+
readonly modelCalls: number;
|
|
83
|
+
readonly inputTokens: number;
|
|
84
|
+
readonly outputTokens: number;
|
|
85
|
+
readonly costUsdMicros: number | null;
|
|
86
|
+
};
|
|
87
|
+
} | null;
|
|
88
|
+
}
|
|
89
|
+
export interface StrategyBenchmarkProjection {
|
|
90
|
+
readonly protocol: typeof strategyProjectionProtocol;
|
|
91
|
+
readonly version: 1;
|
|
92
|
+
/** True only when both base tariffs are configured; null costs accompany a false value. */
|
|
93
|
+
readonly tariffComplete: boolean;
|
|
94
|
+
readonly cells: readonly StrategyCellProjection[];
|
|
95
|
+
readonly pairs: readonly StrategyCoordinationPair[];
|
|
96
|
+
/** A measurement projection never grants promotion authority. */
|
|
97
|
+
readonly promotionAuthorized: false;
|
|
98
|
+
}
|
|
99
|
+
type SettledTrace = StrategyEvidenceObject['meter']['traces'][number];
|
|
100
|
+
/**
|
|
101
|
+
* Sums settled traces attributed to one session role, recomputing cost per trace.
|
|
102
|
+
* A settled trace always counts one model call. In observed-call-count mode the
|
|
103
|
+
* evidence meter freezes usage=null: the call still counts, tokens add nothing and
|
|
104
|
+
* the monetary total becomes null (never estimated). Token-mode traces are
|
|
105
|
+
* evidence-guaranteed to carry non-null usage, so usage=null is self-describing.
|
|
106
|
+
*/
|
|
107
|
+
export declare function accumulateSessionCost(traces: readonly SettledTrace[], sessions: ReadonlySet<string>, rates: Readonly<TokenUsageRates>): StrategySessionCost;
|
|
108
|
+
/** Terminal unknown cell: a failure object proves uncertainty, never an acceptance. */
|
|
109
|
+
export declare function unknownStrategyCellProjection(result: BenchmarkResult): StrategyCellProjection;
|
|
110
|
+
/** The only objective evidence fields the cell projection reads; the full object is structurally assignable. */
|
|
111
|
+
export interface ProjectedCellEvidence {
|
|
112
|
+
readonly meter: {
|
|
113
|
+
readonly traces: readonly SettledTrace[];
|
|
114
|
+
};
|
|
115
|
+
readonly native: {
|
|
116
|
+
readonly parent: {
|
|
117
|
+
readonly sessionId: string;
|
|
118
|
+
};
|
|
119
|
+
readonly strategies: readonly {
|
|
120
|
+
readonly children: readonly {
|
|
121
|
+
readonly sessionId: string;
|
|
122
|
+
}[];
|
|
123
|
+
}[];
|
|
124
|
+
readonly receipts: readonly ReceiptSignal[];
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
interface ReceiptSignal {
|
|
128
|
+
readonly contract: {
|
|
129
|
+
readonly id: string;
|
|
130
|
+
};
|
|
131
|
+
readonly taskKind: 'goal-step' | 'goal-outcome';
|
|
132
|
+
readonly quiescent: boolean;
|
|
133
|
+
readonly receipt: {
|
|
134
|
+
readonly objectiveStatus: 'achieved' | 'not-achieved' | 'unknown';
|
|
135
|
+
readonly results: readonly {
|
|
136
|
+
readonly criterionId: string;
|
|
137
|
+
readonly status: 'passed' | 'failed' | 'unknown';
|
|
138
|
+
readonly reason: string;
|
|
139
|
+
}[];
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Pure derivation over a reopened, already-verified evidence object. No binding
|
|
144
|
+
* checks are repeated here: callers must obtain `native` through the evidence store
|
|
145
|
+
* after verifyStrategyBenchmarkResults, never from candidate prose.
|
|
146
|
+
*/
|
|
147
|
+
export declare function projectStrategyCell(result: BenchmarkResult, native: Readonly<ProjectedCellEvidence>, rates: Readonly<TokenUsageRates>): StrategyCellProjection;
|
|
148
|
+
/** Pairs direct/adaptive-strategy arms by (caseId, repeat) over the planned schedule. */
|
|
149
|
+
export declare function pairStrategyCells(plan: StrategyBenchmarkPlan, cells: readonly StrategyCellProjection[]): readonly StrategyCoordinationPair[];
|
|
150
|
+
/**
|
|
151
|
+
* Reopens every evidence object (the caller must run verifyStrategyBenchmarkResults
|
|
152
|
+
* first) and derives the strategy-only projection. Rates are the frozen model
|
|
153
|
+
* tariffs; absent tariffs yield null costs rather than invented pricing.
|
|
154
|
+
*/
|
|
155
|
+
export declare function collectStrategyBenchmarkProjection(plan: StrategyBenchmarkPlan, results: readonly BenchmarkResult[], stateDirectory: string, workspaceDirectory: string, rates: Readonly<TokenUsageRates>): Readonly<StrategyBenchmarkProjection>;
|
|
156
|
+
export {};
|
|
157
|
+
//# sourceMappingURL=strategy-projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategy-projection.d.ts","sourceRoot":"","sources":["../../src/benchmark/strategy-projection.ts"],"names":[],"mappings":"AASA,OAAO,EAAgC,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC7F,OAAO,EAAyB,KAAK,s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evidence itself: it re-derives coordination cost splits and a
|
|
5
|
+
* conservative failure attribution from evidence that verifyStrategyBenchmarkResults
|
|
6
|
+
* has already reopened and bound. The shared BenchmarkMetrics/BenchmarkResult shape
|
|
7
|
+
* (persisted across suites and in the journal) is intentionally untouched.
|
|
8
|
+
*/
|
|
9
|
+
import { benchmarkSchedule } from './schema.js';
|
|
10
|
+
import { strategyBenchmarkJournalPlan } from './strategy-plan.js';
|
|
11
|
+
import { StrategyEvidenceStore } from './strategy-evidence.js';
|
|
12
|
+
import { tokenUsageCost } from './usage.js';
|
|
13
|
+
export const strategyProjectionProtocol = 'dsh-native-goal-strategy-projection/v1';
|
|
14
|
+
/**
|
|
15
|
+
* Criterion reasons emitted with status 'failed' by the independent verifier
|
|
16
|
+
* (plugins/assistant-verifier drivers.ts failed() calls). Every one of these means
|
|
17
|
+
* the candidate delivered an artifact that was actually inspected and found wrong.
|
|
18
|
+
* artifact-unavailable / altered / timeout / io reasons are status 'unknown' and
|
|
19
|
+
* cannot distinguish an undelivered artifact from a tool failure, so they stay unknown.
|
|
20
|
+
*/
|
|
21
|
+
export const behaviorFailureReasons = [
|
|
22
|
+
'citation-mismatch', 'citation-missing', 'isolated-unexpected-exit-code', 'isolated-unexpected-stdout',
|
|
23
|
+
'readback-object-mismatch', 'readback-revision-mismatch', 'readback-value-mismatch',
|
|
24
|
+
'repository-head-mismatch', 'repository-requirements-not-met', 'required-text-missing',
|
|
25
|
+
'unexpected-exit-code', 'unexpected-stdout',
|
|
26
|
+
];
|
|
27
|
+
const behaviorFailureReasonSet = new Set(behaviorFailureReasons);
|
|
28
|
+
/**
|
|
29
|
+
* Sums settled traces attributed to one session role, recomputing cost per trace.
|
|
30
|
+
* A settled trace always counts one model call. In observed-call-count mode the
|
|
31
|
+
* evidence meter freezes usage=null: the call still counts, tokens add nothing and
|
|
32
|
+
* the monetary total becomes null (never estimated). Token-mode traces are
|
|
33
|
+
* evidence-guaranteed to carry non-null usage, so usage=null is self-describing.
|
|
34
|
+
*/
|
|
35
|
+
export function accumulateSessionCost(traces, sessions, rates) {
|
|
36
|
+
let modelCalls = 0;
|
|
37
|
+
let inputTokens = 0;
|
|
38
|
+
let outputTokens = 0;
|
|
39
|
+
let costUsdMicros = 0;
|
|
40
|
+
for (const trace of traces) {
|
|
41
|
+
if (trace.phase !== 'settled' || trace.sessionId === null || !sessions.has(trace.sessionId))
|
|
42
|
+
continue;
|
|
43
|
+
modelCalls += 1;
|
|
44
|
+
if (trace.usage === null) {
|
|
45
|
+
costUsdMicros = null;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
inputTokens += trace.usage.inputTokens;
|
|
49
|
+
outputTokens += trace.usage.outputTokens;
|
|
50
|
+
const cost = tokenUsageCost(trace.usage, rates);
|
|
51
|
+
costUsdMicros = cost === null || costUsdMicros === null ? null : costUsdMicros + cost;
|
|
52
|
+
}
|
|
53
|
+
return Object.freeze({ modelCalls, inputTokens, outputTokens, costUsdMicros });
|
|
54
|
+
}
|
|
55
|
+
function receiptAttribution(receipts) {
|
|
56
|
+
return Object.freeze(receipts.map(entry => Object.freeze({
|
|
57
|
+
contractId: entry.contract.id, taskKind: entry.taskKind, objectiveStatus: entry.receipt.objectiveStatus, quiescent: entry.quiescent,
|
|
58
|
+
failedCriteria: Object.freeze(entry.receipt.results
|
|
59
|
+
.filter(result => result.status === 'failed')
|
|
60
|
+
.map(result => Object.freeze({ criterionId: result.criterionId, reason: result.reason, behaviorFailure: behaviorFailureReasonSet.has(result.reason) }))),
|
|
61
|
+
})));
|
|
62
|
+
}
|
|
63
|
+
/** Terminal unknown cell: a failure object proves uncertainty, never an acceptance. */
|
|
64
|
+
export function unknownStrategyCellProjection(result) {
|
|
65
|
+
return Object.freeze({
|
|
66
|
+
cellId: result.cell.id, caseId: result.cell.caseId, variantId: result.cell.variantId, repeat: result.cell.repeat,
|
|
67
|
+
status: 'unknown', verdict: 'unknown',
|
|
68
|
+
attribution: Object.freeze({ classification: 'undelivered-or-unknown', basis: 'infrastructure-unknown',
|
|
69
|
+
infrastructureReason: result.reason, receipts: Object.freeze([]) }),
|
|
70
|
+
costs: null,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Pure derivation over a reopened, already-verified evidence object. No binding
|
|
75
|
+
* checks are repeated here: callers must obtain `native` through the evidence store
|
|
76
|
+
* after verifyStrategyBenchmarkResults, never from candidate prose.
|
|
77
|
+
*/
|
|
78
|
+
export function projectStrategyCell(result, native, rates) {
|
|
79
|
+
benchmarkAssertCompleted(result);
|
|
80
|
+
const childSessions = new Set(native.native.strategies.flatMap(strategy => strategy.children.map(child => child.sessionId)));
|
|
81
|
+
const costs = Object.freeze({
|
|
82
|
+
parent: accumulateSessionCost(native.meter.traces, new Set([native.native.parent.sessionId]), rates),
|
|
83
|
+
children: accumulateSessionCost(native.meter.traces, childSessions, rates),
|
|
84
|
+
});
|
|
85
|
+
const receipts = receiptAttribution(native.native.receipts);
|
|
86
|
+
const hasBehaviorFailure = receipts.some(receipt => receipt.quiescent && receipt.failedCriteria.some(criterion => criterion.behaviorFailure));
|
|
87
|
+
const classification = result.verdict === 'achieved' ? 'achieved'
|
|
88
|
+
: result.verdict === 'not-achieved' && hasBehaviorFailure ? 'delivered-incorrect-behavior'
|
|
89
|
+
: 'undelivered-or-unknown';
|
|
90
|
+
const basis = classification === 'achieved' ? 'achieved'
|
|
91
|
+
: classification === 'delivered-incorrect-behavior' ? 'receipt-behavior-failure'
|
|
92
|
+
: 'no-behavior-failure-receipt';
|
|
93
|
+
return Object.freeze({
|
|
94
|
+
cellId: result.cell.id, caseId: result.cell.caseId, variantId: result.cell.variantId, repeat: result.cell.repeat,
|
|
95
|
+
status: 'completed', verdict: result.verdict,
|
|
96
|
+
attribution: Object.freeze({ classification, basis, infrastructureReason: null, receipts }),
|
|
97
|
+
costs,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function benchmarkAssertCompleted(result) {
|
|
101
|
+
if (result.status !== 'completed' || result.evidenceDigest === null)
|
|
102
|
+
throw new Error('strategy projection: completed result requires bound evidence');
|
|
103
|
+
}
|
|
104
|
+
function totalCellCost(costs) {
|
|
105
|
+
const costUsdMicros = costs.parent.costUsdMicros === null || costs.children.costUsdMicros === null
|
|
106
|
+
? null : costs.parent.costUsdMicros + costs.children.costUsdMicros;
|
|
107
|
+
return Object.freeze({
|
|
108
|
+
modelCalls: costs.parent.modelCalls + costs.children.modelCalls,
|
|
109
|
+
inputTokens: costs.parent.inputTokens + costs.children.inputTokens,
|
|
110
|
+
outputTokens: costs.parent.outputTokens + costs.children.outputTokens,
|
|
111
|
+
costUsdMicros,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/** Pairs direct/adaptive-strategy arms by (caseId, repeat) over the planned schedule. */
|
|
115
|
+
export function pairStrategyCells(plan, cells) {
|
|
116
|
+
const byKey = new Map(cells.map(cell => [`${cell.caseId} ${cell.variantId} ${cell.repeat}`, cell]));
|
|
117
|
+
const meta = [];
|
|
118
|
+
const seen = new Set();
|
|
119
|
+
for (const cell of benchmarkSchedule(strategyBenchmarkJournalPlan(plan))) {
|
|
120
|
+
const key = `${cell.caseId} ${cell.repeat}`;
|
|
121
|
+
if (!seen.has(key)) {
|
|
122
|
+
seen.add(key);
|
|
123
|
+
meta.push({ caseId: cell.caseId, repeat: cell.repeat });
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return Object.freeze(meta.map(({ caseId, repeat }) => {
|
|
127
|
+
const direct = byKey.get(`${caseId} direct ${repeat}`);
|
|
128
|
+
const candidate = byKey.get(`${caseId} adaptive-strategy ${repeat}`);
|
|
129
|
+
const comparable = direct !== undefined && candidate !== undefined && direct.status === 'completed' && candidate.status === 'completed'
|
|
130
|
+
&& direct.costs !== null && candidate.costs !== null;
|
|
131
|
+
let coordination = null;
|
|
132
|
+
if (comparable) {
|
|
133
|
+
const directTotal = totalCellCost(direct.costs);
|
|
134
|
+
const candidateTotal = totalCellCost(candidate.costs);
|
|
135
|
+
const extraCost = directTotal.costUsdMicros === null || candidateTotal.costUsdMicros === null ? null
|
|
136
|
+
: candidateTotal.costUsdMicros - directTotal.costUsdMicros;
|
|
137
|
+
coordination = Object.freeze({
|
|
138
|
+
candidateChildren: candidate.costs.children,
|
|
139
|
+
extra: Object.freeze({
|
|
140
|
+
modelCalls: candidateTotal.modelCalls - directTotal.modelCalls,
|
|
141
|
+
inputTokens: candidateTotal.inputTokens - directTotal.inputTokens,
|
|
142
|
+
outputTokens: candidateTotal.outputTokens - directTotal.outputTokens,
|
|
143
|
+
costUsdMicros: extraCost,
|
|
144
|
+
}),
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
return Object.freeze({ caseId, repeat, directCellId: direct?.cellId ?? null, candidateCellId: candidate?.cellId ?? null, comparable, coordination });
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Reopens every evidence object (the caller must run verifyStrategyBenchmarkResults
|
|
152
|
+
* first) and derives the strategy-only projection. Rates are the frozen model
|
|
153
|
+
* tariffs; absent tariffs yield null costs rather than invented pricing.
|
|
154
|
+
*/
|
|
155
|
+
export function collectStrategyBenchmarkProjection(plan, results, stateDirectory, workspaceDirectory, rates) {
|
|
156
|
+
const evidence = new StrategyEvidenceStore({ stateDirectory, candidateWorkspace: workspaceDirectory, createDirectories: false });
|
|
157
|
+
const tariffComplete = rates.inputUsdMicrosPerMillionTokens !== null && rates.outputUsdMicrosPerMillionTokens !== null;
|
|
158
|
+
const cells = [];
|
|
159
|
+
for (const result of results) {
|
|
160
|
+
if (result.status === 'unknown') {
|
|
161
|
+
cells.push(unknownStrategyCellProjection(result));
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
const cell = evidence.readCell(plan, result.cell, result.evidenceDigest);
|
|
165
|
+
const native = evidence.read(plan, result.cell, cell.nativeEvidenceDigest);
|
|
166
|
+
cells.push(projectStrategyCell(result, native, rates));
|
|
167
|
+
}
|
|
168
|
+
return Object.freeze({ protocol: strategyProjectionProtocol, version: 1, tariffComplete,
|
|
169
|
+
cells: Object.freeze(cells), pairs: pairStrategyCells(plan, cells), promotionAuthorized: false });
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=strategy-projection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategy-projection.js","sourceRoot":"","sources":["../../src/benchmark/strategy-projection.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,4BAA4B,EAA8B,MAAM,oBAAoB,CAAA;AAC7F,OAAO,EAAE,qBAAqB,EAA+B,MAAM,wBAAwB,CAAA;AAC3F,OAAO,EAAE,cAAc,EAAwB,MAAM,YAAY,CAAA;AAGjE,MAAM,CAAC,MAAM,0BAA0B,GAAG,wCAAwC,CAAA;AAElF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,mBAAmB,EAAE,kBAAkB,EAAE,+BAA+B,EAAE,4BAA4B;IACtG,0BAA0B,EAAE,4BAA4B,EAAE,yBAAyB;IACnF,0BAA0B,EAAE,iCAAiC,EAAE,uBAAuB;IACtF,sBAAsB,EAAE,mBAAmB;CACnC,CAAA;AACV,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAS,sBAAsB,CAAC,CAAA;AA2FxE;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAA+B,EAAE,QAA6B,EAAE,KAAgC;IACpI,IAAI,UAAU,GAAG,CAAC,CAAC;IAAC,IAAI,WAAW,GAAG,CAAC,CAAC;IAAC,IAAI,YAAY,GAAG,CAAC,CAAC;IAAC,IAAI,aAAa,GAAkB,CAAC,CAAA;IACnG,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,SAAS,KAAK,IAAI,IAAI,CAAC,QAA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AAC;QAChG,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,cAAe,CAAC,CAAA;QACzE,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAA;QAC1E,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA;IACxD,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,0BAA0B,EAAE,OAAO,EAAE,CAAC,EAAE,cAAc;QACrF,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC,CAAA;AACrG,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Host-only strategy benchmark building blocks; no model-visible tools are registered. */
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
+
import type { NativeAdapterBinding, NativeModelConfig } from './native.js';
|
|
4
|
+
import type { BenchmarkExecutionRequest } from './runner.js';
|
|
5
|
+
import { type StrategyBenchmarkPlan } from './strategy-plan.js';
|
|
6
|
+
export * from './strategy-plan.js';
|
|
7
|
+
export * from './strategy-meter.js';
|
|
8
|
+
export * from './strategy-owner.js';
|
|
9
|
+
export * from './strategy-goal-runtime.js';
|
|
10
|
+
export * from './strategy-evidence.js';
|
|
11
|
+
export * from './strategy-capabilities.js';
|
|
12
|
+
export * from './strategy-config.js';
|
|
13
|
+
export * from './strategy-corpus.js';
|
|
14
|
+
export * from './strategy-executor.js';
|
|
15
|
+
/** Request identity and call/output budgets are checked before installing the cell meter. */
|
|
16
|
+
export declare function installStrategyBenchmarkRequestMeter(ctx: Context, plan: StrategyBenchmarkPlan, request: BenchmarkExecutionRequest, model: Readonly<NativeModelConfig>, binding: Readonly<NativeAdapterBinding>): Readonly<import("./strategy-meter.js").StrategyBenchmarkMeter>;
|
|
17
|
+
//# sourceMappingURL=strategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategy.d.ts","sourceRoot":"","sources":["../../src/benchmark/strategy.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC1E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAE5D,OAAO,EAAkC,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAE/F,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,wBAAwB,CAAA;AACtC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AAEtC,6FAA6F;AAC7F,wBAAgB,oCAAoC,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,qBAAqB,EAC5F,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,oBAAoB,CAAC,kEAKhH"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { acceptanceDigest } from '@dsh-ray/task-acceptance-contract';
|
|
2
|
+
import { installStrategyBenchmarkMeter } from './strategy-meter.js';
|
|
3
|
+
import { strategyBenchmarkRequestLimits } from './strategy-plan.js';
|
|
4
|
+
export * from './strategy-plan.js';
|
|
5
|
+
export * from './strategy-meter.js';
|
|
6
|
+
export * from './strategy-owner.js';
|
|
7
|
+
export * from './strategy-goal-runtime.js';
|
|
8
|
+
export * from './strategy-evidence.js';
|
|
9
|
+
export * from './strategy-capabilities.js';
|
|
10
|
+
export * from './strategy-config.js';
|
|
11
|
+
export * from './strategy-corpus.js';
|
|
12
|
+
export * from './strategy-executor.js';
|
|
13
|
+
/** Request identity and call/output budgets are checked before installing the cell meter. */
|
|
14
|
+
export function installStrategyBenchmarkRequestMeter(ctx, plan, request, model, binding) {
|
|
15
|
+
const limits = strategyBenchmarkRequestLimits(plan, request);
|
|
16
|
+
if (acceptanceDigest(model) !== request.variant.versions.model)
|
|
17
|
+
throw new Error('strategy benchmark model configuration drift');
|
|
18
|
+
return installStrategyBenchmarkMeter(ctx, { budget: request.budget, modelCalls: limits.modelCalls,
|
|
19
|
+
maxOutputTokens: limits.maxOutputTokensPerCall, model, binding, signal: request.signal });
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=strategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategy.js","sourceRoot":"","sources":["../../src/benchmark/strategy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAGpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAA;AACnE,OAAO,EAAE,8BAA8B,EAA8B,MAAM,oBAAoB,CAAA;AAE/F,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,wBAAwB,CAAA;AACtC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AAEtC,6FAA6F;AAC7F,MAAM,UAAU,oCAAoC,CAAC,GAAY,EAAE,IAA2B,EAC5F,OAAkC,EAAE,KAAkC,EAAE,OAAuC;IAC/G,MAAM,MAAM,GAAG,8BAA8B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAC5D,IAAI,gBAAgB,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;IAC/H,OAAO,6BAA6B,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU;QAC/F,eAAe,EAAE,MAAM,CAAC,sBAAsB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;AAC7F,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trusted Host binding for the fixed TraeX ACP route (observed-call-count mode).
|
|
3
|
+
*
|
|
4
|
+
* This is deliberately an adapter module for `dsh-benchmark --adapter`; it does
|
|
5
|
+
* not activate the TraeX provider bundle. Unlike the DeepSeek binding there is no
|
|
6
|
+
* protocol expiry, no credential resolver and no input-token upper bound: the
|
|
7
|
+
* local TraeX login state authenticates the ACP subprocess and the strategy
|
|
8
|
+
* meter counts settled model calls while rejecting any provider-emitted usage.
|
|
9
|
+
*/
|
|
10
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
11
|
+
import type { NativeAdapterBinding, NativeModelConfig } from './native.js';
|
|
12
|
+
/** Create the trusted native benchmark binding for a fixed TraeX model. */
|
|
13
|
+
export declare function createNativeAdapter(model: Readonly<NativeModelConfig>, environment: Readonly<{
|
|
14
|
+
ctx: Context;
|
|
15
|
+
workspace: string;
|
|
16
|
+
}>): Promise<NativeAdapterBinding>;
|
|
17
|
+
//# sourceMappingURL=traex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traex.d.ts","sourceRoot":"","sources":["../../src/benchmark/traex.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AA6G1E,2EAA2E;AAC3E,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAkCvK"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
import { LlmAdapter } from '@deepseek-ai/dsh-llm';
|
|
10
|
+
const packageName = '@dsh-ray/traex-acp-provider';
|
|
11
|
+
const routeCapabilitiesPackage = '@dsh-ray/llm-route-capabilities';
|
|
12
|
+
const provider = 'traex-agent';
|
|
13
|
+
// The one route/model pair already proven against the real local TraeX login state (WP14).
|
|
14
|
+
const models = Object.freeze(['gpt-5.6-terra']);
|
|
15
|
+
const command = 'traex';
|
|
16
|
+
function runtime(value) {
|
|
17
|
+
if (value === null || typeof value !== 'object')
|
|
18
|
+
throw new Error('assistant-evaluation: TraeX adapter runtime is unavailable');
|
|
19
|
+
const candidate = value;
|
|
20
|
+
if (typeof candidate.TraexAcpAdapter !== 'function' || candidate.TRAEX_PROVIDER_ROUTE !== provider
|
|
21
|
+
|| typeof candidate.normalizeConfig !== 'function') {
|
|
22
|
+
throw new Error('assistant-evaluation: TraeX adapter runtime is incompatible');
|
|
23
|
+
}
|
|
24
|
+
return candidate;
|
|
25
|
+
}
|
|
26
|
+
function validateModel(model) {
|
|
27
|
+
if (model.observationMode !== 'observed-call-count') {
|
|
28
|
+
throw new Error('assistant-evaluation: TraeX benchmark requires observed-call-count observation mode');
|
|
29
|
+
}
|
|
30
|
+
if (model.provider !== provider)
|
|
31
|
+
throw new Error('assistant-evaluation: invalid TraeX provider');
|
|
32
|
+
if (!models.includes(model.model))
|
|
33
|
+
throw new Error('assistant-evaluation: invalid TraeX model');
|
|
34
|
+
if (model.temperature !== null && (!Number.isFinite(model.temperature) || model.temperature < 0 || model.temperature > 2)) {
|
|
35
|
+
throw new Error('assistant-evaluation: invalid TraeX temperature');
|
|
36
|
+
}
|
|
37
|
+
if (!Number.isSafeInteger(model.maxOutputTokens) || model.maxOutputTokens < 1) {
|
|
38
|
+
throw new Error('assistant-evaluation: invalid TraeX max output tokens');
|
|
39
|
+
}
|
|
40
|
+
// No token contract exists on this route: every tariff must stay null so a
|
|
41
|
+
// conclusion can never cite a token count or a monetary cost that was never measured.
|
|
42
|
+
for (const field of ['inputUsdMicrosPerMillionTokens', 'outputUsdMicrosPerMillionTokens', 'cacheReadUsdMicrosPerMillionTokens', 'cacheWriteUsdMicrosPerMillionTokens']) {
|
|
43
|
+
const value = model[field];
|
|
44
|
+
if (value !== null && value !== undefined)
|
|
45
|
+
throw new Error('assistant-evaluation: TraeX route must not declare token tariffs');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function validateRequest(model, options, disposed) {
|
|
49
|
+
if (disposed)
|
|
50
|
+
throw new Error('assistant-evaluation: TraeX benchmark adapter is disposed');
|
|
51
|
+
if (options.provider !== model.provider || options.model !== model.model || options.maxTokens !== model.maxOutputTokens
|
|
52
|
+
|| options.temperature !== (model.temperature ?? undefined))
|
|
53
|
+
throw new Error('assistant-evaluation: TraeX benchmark request drift');
|
|
54
|
+
}
|
|
55
|
+
function validateProvider(model, providerName, disposed) {
|
|
56
|
+
if (disposed)
|
|
57
|
+
throw new Error('assistant-evaluation: TraeX benchmark adapter is disposed');
|
|
58
|
+
if (providerName !== model.provider)
|
|
59
|
+
throw new Error('assistant-evaluation: TraeX benchmark request drift');
|
|
60
|
+
}
|
|
61
|
+
class FrozenTraexAdapter extends LlmAdapter {
|
|
62
|
+
model;
|
|
63
|
+
production;
|
|
64
|
+
#disposed = false;
|
|
65
|
+
constructor(model, production) {
|
|
66
|
+
super();
|
|
67
|
+
this.model = model;
|
|
68
|
+
this.production = production;
|
|
69
|
+
}
|
|
70
|
+
async *stream(options) {
|
|
71
|
+
validateRequest(this.model, options, this.#disposed);
|
|
72
|
+
for await (const chunk of this.production.stream(options))
|
|
73
|
+
yield chunk;
|
|
74
|
+
}
|
|
75
|
+
providerInfo(providerName) {
|
|
76
|
+
validateProvider(this.model, providerName, this.#disposed);
|
|
77
|
+
return this.production.providerInfo(providerName);
|
|
78
|
+
}
|
|
79
|
+
providerRetryPolicy(providerName) {
|
|
80
|
+
validateProvider(this.model, providerName, this.#disposed);
|
|
81
|
+
return this.production.providerRetryPolicy(providerName);
|
|
82
|
+
}
|
|
83
|
+
async listModels(providerName) {
|
|
84
|
+
validateProvider(this.model, providerName, this.#disposed);
|
|
85
|
+
const listed = await this.production.listModels(providerName);
|
|
86
|
+
return listed.filter(candidate => candidate.id === this.model.model);
|
|
87
|
+
}
|
|
88
|
+
async resolveModel(providerName, requestedModel, signal) {
|
|
89
|
+
validateProvider(this.model, providerName, this.#disposed);
|
|
90
|
+
if (requestedModel !== this.model.model)
|
|
91
|
+
throw new Error('assistant-evaluation: TraeX benchmark request drift');
|
|
92
|
+
return this.production.resolveModel(providerName, requestedModel, signal);
|
|
93
|
+
}
|
|
94
|
+
dispose() {
|
|
95
|
+
if (this.#disposed)
|
|
96
|
+
return;
|
|
97
|
+
this.#disposed = true;
|
|
98
|
+
this.production.shutdown();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/** Create the trusted native benchmark binding for a fixed TraeX model. */
|
|
102
|
+
export async function createNativeAdapter(model, environment) {
|
|
103
|
+
// Variable imports avoid an Evaluation-to-TraeX declaration-build cycle and keep
|
|
104
|
+
// the optional peer packages out of module load for suites that never use this route.
|
|
105
|
+
const [traexModule, routeCapabilities] = await Promise.all([import(__rewriteRelativeImportExtension(packageName)), import(__rewriteRelativeImportExtension(routeCapabilitiesPackage))]);
|
|
106
|
+
const traex = runtime(traexModule);
|
|
107
|
+
validateModel(model);
|
|
108
|
+
const frozenModel = Object.freeze({ ...model });
|
|
109
|
+
const config = traex.normalizeConfig({ enabled: true, command, cwd: environment.workspace, models: [frozenModel.model] });
|
|
110
|
+
const liveSessions = environment.ctx.get('sessions');
|
|
111
|
+
const agents = environment.ctx.get('agents');
|
|
112
|
+
// Fail closed: the trusted ACP subprocess cannot be constructed without a live
|
|
113
|
+
// session lookup and the loop request attestor.
|
|
114
|
+
if (liveSessions === undefined || agents === undefined) {
|
|
115
|
+
throw new Error('assistant-evaluation: TraeX benchmark requires live loop sessions and agents services');
|
|
116
|
+
}
|
|
117
|
+
const dependencies = {
|
|
118
|
+
// A local ACP subprocess must be bound to a live loop session, never a static workspace.
|
|
119
|
+
liveSessions,
|
|
120
|
+
requestAttestor: routeCapabilities.createAgentLoopRequestAttestor(agents, [provider]),
|
|
121
|
+
};
|
|
122
|
+
const production = new traex.TraexAcpAdapter(config, dependencies);
|
|
123
|
+
if (!(production instanceof LlmAdapter) || typeof production.shutdown !== 'function')
|
|
124
|
+
throw new Error('assistant-evaluation: TraeX adapter runtime is incompatible');
|
|
125
|
+
const adapter = new FrozenTraexAdapter(frozenModel, production);
|
|
126
|
+
let disposed = false;
|
|
127
|
+
// Intentionally no inputTokenUpperBound: the binding only carries the adapter,
|
|
128
|
+
// and the calls-mode meter enforces request contract, call/tool budgets and finish shape.
|
|
129
|
+
return Object.freeze({
|
|
130
|
+
adapter,
|
|
131
|
+
dispose() {
|
|
132
|
+
if (disposed)
|
|
133
|
+
return;
|
|
134
|
+
disposed = true;
|
|
135
|
+
adapter.dispose();
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=traex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traex.js","sourceRoot":"","sources":["../../src/benchmark/traex.ts"],"names":[],"mappings":";;;;;;;;AAUA,OAAO,EAAE,UAAU,EAA0C,MAAM,sBAAsB,CAAA;AAuBzF,MAAM,WAAW,GAAG,6BAA6B,CAAA;AACjD,MAAM,wBAAwB,GAAG,iCAAiC,CAAA;AAClE,MAAM,QAAQ,GAAG,aAAa,CAAA;AAC9B,2FAA2F;AAC3F,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAA;AAC/C,MAAM,OAAO,GAAG,OAAO,CAAA;AAEvB,SAAS,OAAO,CAAC,KAAc;IAC7B,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAA;IAC9H,MAAM,SAAS,GAAG,KAA8B,CAAA;IAChD,IAAI,OAAO,SAAS,CAAC,eAAe,KAAK,UAAU,IAAI,SAAS,CAAC,oBAAoB,KAAK,QAAQ;WAC7F,OAAO,SAAS,CAAC,eAAe,KAAK,UAAU,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAA;IAChF,CAAC;IACD,OAAO,SAAyB,CAAA;AAClC,CAAC;AAED,SAAS,aAAa,CAAC,KAAkC;IACvD,IAAI,KAAK,CAAC,eAAe,KAAK,qBAAqB,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,qFAAqF,CAAC,CAAA;IACxG,CAAC;IACD,IAAI,KAAK,CAAC,QAAQ,KAAK,QAAQ;QAAE,MAAM,IAAI,K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