pm-starter 2026.10.27 → 2026.10.29
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 +6 -0
- package/README.md +22 -1
- package/dist/baselines.d.ts +380 -0
- package/dist/baselines.d.ts.map +1 -0
- package/dist/baselines.js +1121 -0
- package/dist/baselines.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -2
- package/dist/index.js.map +1 -1
- package/dist/paginated-consumer.d.ts +64 -0
- package/dist/paginated-consumer.d.ts.map +1 -0
- package/dist/paginated-consumer.js +217 -0
- package/dist/paginated-consumer.js.map +1 -0
- package/docs/agent-task-cost-baselines.md +125 -0
- package/docs/cancellation-safe-consumer.md +125 -0
- package/docs/sdk-floor.json +49 -6
- package/docs/sdk-floor.md +27 -1
- package/manifest.json +1 -1
- package/package.json +14 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2026.10.28 - 2026-10-28
|
|
4
|
+
|
|
5
|
+
### Other
|
|
6
|
+
|
|
7
|
+
- Make the 2026.10.23 pm toolchain bump pass: the recipes test host double dropped the SDK's generic ReadPromise get signature ([pm-starter-7tp5](https://github.com/unbraind/pm-starter/blob/main/.agents/pm/chores/pm-starter-7tp5.toon))
|
|
8
|
+
|
|
3
9
|
## 2026.10.27 - 2026-10-27
|
|
4
10
|
|
|
5
11
|
### Other
|
package/README.md
CHANGED
|
@@ -117,7 +117,7 @@ acceptance is a separate concern. A changing source fails parity explicitly.
|
|
|
117
117
|
|
|
118
118
|
## Without git
|
|
119
119
|
|
|
120
|
-
All starter commands, the read-only exporters, both laboratories and the failure-first
|
|
120
|
+
All starter commands, the paginated consumer, the read-only exporters, both laboratories and the failure-first
|
|
121
121
|
recovery recipes work in a plain initialized tracker with no Git executable. Creating or running a laboratory needs
|
|
122
122
|
no repository. Cloning the starter and repository release/changelog automation need
|
|
123
123
|
Git. Laboratory commands require a host that injects the SDK (tested with 2026.10.20)
|
|
@@ -266,3 +266,24 @@ shell text or write item data. Each receipt asserts its native discriminator,
|
|
|
266
266
|
remedy and successful retry; the missing-item SDK classifier is labeled
|
|
267
267
|
explicitly. See the [runnable CLI and SDK examples](docs/failure-first-recipes.md)
|
|
268
268
|
for contracts, refusal codes and concurrency limits.
|
|
269
|
+
|
|
270
|
+
## Cancellation-safe paginated consumer
|
|
271
|
+
|
|
272
|
+
`pm starter consume --page-size 2 --max-pages 2 --json` consumes native host pages
|
|
273
|
+
under a cumulative task budget and returns a caller-owned checkpoint. Resume with
|
|
274
|
+
`--checkpoint '<checkpoint JSON>'`. The typed `consumePaginated` SDK API accepts
|
|
275
|
+
an AbortSignal, admits whole pages and retains the last admitted cursor on
|
|
276
|
+
cancellation. Output cursors preserve native snapshot refusals and typed remedies.
|
|
277
|
+
No source tracker writes or git repository are required.
|
|
278
|
+
|
|
279
|
+
See the [CLI and SDK recipe, cancellation boundaries and recovery contract](docs/cancellation-safe-consumer.md).
|
|
280
|
+
|
|
281
|
+
## Agent task cost baselines
|
|
282
|
+
|
|
283
|
+
`pm starter baseline --mode declare --scenario all --corpus-id example --json`
|
|
284
|
+
pins expected answers for orientation, targeted reads, and cursor resume. Replay
|
|
285
|
+
the emitted declarations with `--mode run`; `--mode probe` proves that one extra
|
|
286
|
+
full-list call increases both SDK call and delivered-byte budgets. Repeated runs
|
|
287
|
+
report distributions; byte/4 token figures are explicitly estimates. This is a
|
|
288
|
+
read-only consumer example, with no model-performance claim. It works without Git.
|
|
289
|
+
See [the protocols, typed SDK example, refusals and public-data validation](docs/agent-task-cost-baselines.md).
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import type { CommandHandlerContext, PmClient } from "@unbrained/pm-cli/sdk";
|
|
2
|
+
/** Closed scenario set. Callers cannot name an arbitrary workflow. */
|
|
3
|
+
export type TaskCostScenario = "orientation" | "targeted-read" | "resume";
|
|
4
|
+
/** Directory client versus a structured-clone transport of the same reads. */
|
|
5
|
+
export type TaskCostRuntime = "directory" | "synthetic-remote";
|
|
6
|
+
/** Request modes. Declare pins an answer; run checks it; probe adds one full list. */
|
|
7
|
+
export type TaskCostMode = "declare" | "run" | "probe";
|
|
8
|
+
/** Report schema shared by the producer and the validator. */
|
|
9
|
+
export declare const TASK_COST_REPORT_SCHEMA = "pm-starter/task-cost-report/v1";
|
|
10
|
+
/** Declaration schema shared by import, export and the measurement producer. */
|
|
11
|
+
export declare const TASK_COST_DECLARATION_SCHEMA = "pm-starter/task-cost-baseline/v1";
|
|
12
|
+
/** Maximum repeats. Distributions stay bounded for agent output. */
|
|
13
|
+
export declare const TASK_COST_MAX_REPEATS = 8;
|
|
14
|
+
/** Maximum resume pages so a large corpus cannot loop without a checkpoint. */
|
|
15
|
+
export declare const TASK_COST_MAX_RESUME_PAGES = 8;
|
|
16
|
+
/** Resume page size. Two pages are enough to prove continuation on fleet trackers. */
|
|
17
|
+
export declare const TASK_COST_RESUME_LIMIT = 50;
|
|
18
|
+
/** Corpus observation refuses above this certified item count. */
|
|
19
|
+
export declare const TASK_COST_MAX_CORPUS_ITEMS = 5000;
|
|
20
|
+
/** Exact ratio. Decisions use this, never a binary float. */
|
|
21
|
+
export interface ExactRational {
|
|
22
|
+
/** Numerator after reduction. */
|
|
23
|
+
readonly n: number;
|
|
24
|
+
/** Positive denominator after reduction. */
|
|
25
|
+
readonly d: number;
|
|
26
|
+
}
|
|
27
|
+
/** Caller-pinned baseline. Corpus version and expected answer are required to run. */
|
|
28
|
+
export interface TaskCostDeclaration {
|
|
29
|
+
readonly schema: typeof TASK_COST_DECLARATION_SCHEMA;
|
|
30
|
+
readonly id: string;
|
|
31
|
+
readonly scenario: TaskCostScenario;
|
|
32
|
+
readonly corpus: {
|
|
33
|
+
readonly id: string;
|
|
34
|
+
readonly version: string;
|
|
35
|
+
};
|
|
36
|
+
readonly expected_answer: string;
|
|
37
|
+
readonly repeats: number;
|
|
38
|
+
readonly target_id?: string;
|
|
39
|
+
}
|
|
40
|
+
/** Distribution of one measured quantity. Median is an exact rational. */
|
|
41
|
+
export interface TaskCostDistribution {
|
|
42
|
+
readonly min: number;
|
|
43
|
+
readonly max: number;
|
|
44
|
+
readonly median: ExactRational;
|
|
45
|
+
readonly samples: readonly number[];
|
|
46
|
+
}
|
|
47
|
+
/** byte/4 figure. The label is part of the contract so agents do not treat it as a measurement. */
|
|
48
|
+
export interface TaskCostEstimate {
|
|
49
|
+
readonly label: "estimate";
|
|
50
|
+
readonly method: "bytes_div_4";
|
|
51
|
+
readonly value: ExactRational;
|
|
52
|
+
/** Decimal rendering for humans. Never an input to a pass/fail decision. */
|
|
53
|
+
readonly display: string;
|
|
54
|
+
}
|
|
55
|
+
/** One scenario's measured cost and checked answer. */
|
|
56
|
+
export interface TaskCostScenarioReport {
|
|
57
|
+
readonly scenario: TaskCostScenario;
|
|
58
|
+
readonly corpus: {
|
|
59
|
+
readonly id: string;
|
|
60
|
+
readonly version: string;
|
|
61
|
+
};
|
|
62
|
+
readonly expected_answer: string;
|
|
63
|
+
readonly answer: string;
|
|
64
|
+
readonly answer_ok: true;
|
|
65
|
+
readonly identical_answer: true;
|
|
66
|
+
readonly tools: readonly string[];
|
|
67
|
+
readonly synthetic_remote: {
|
|
68
|
+
readonly calls: TaskCostDistribution;
|
|
69
|
+
readonly delivered_bytes: TaskCostDistribution;
|
|
70
|
+
readonly elapsed_ns: TaskCostDistribution;
|
|
71
|
+
};
|
|
72
|
+
readonly calls: TaskCostDistribution;
|
|
73
|
+
readonly delivered_bytes: TaskCostDistribution;
|
|
74
|
+
readonly elapsed_ns: TaskCostDistribution;
|
|
75
|
+
readonly elapsed_use: "display_only";
|
|
76
|
+
readonly estimate: TaskCostEstimate;
|
|
77
|
+
readonly ceil_estimate: {
|
|
78
|
+
readonly label: "estimate";
|
|
79
|
+
readonly method: "ceil(utf8_bytes / 4)";
|
|
80
|
+
readonly value: number;
|
|
81
|
+
};
|
|
82
|
+
readonly not_model_performance: true;
|
|
83
|
+
}
|
|
84
|
+
/** Proof that one extra certified full list increases both call and byte budgets. */
|
|
85
|
+
export interface TaskCostProbe {
|
|
86
|
+
readonly injected: "listAllComplete";
|
|
87
|
+
readonly worsened: true;
|
|
88
|
+
readonly clean_calls: ExactRational;
|
|
89
|
+
readonly wasted_calls: ExactRational;
|
|
90
|
+
readonly clean_bytes: ExactRational;
|
|
91
|
+
readonly wasted_bytes: ExactRational;
|
|
92
|
+
readonly delta_calls: ExactRational;
|
|
93
|
+
readonly delta_bytes: ExactRational;
|
|
94
|
+
}
|
|
95
|
+
/** Successful measurement. Every number has already passed the shared validator. */
|
|
96
|
+
export interface TaskCostSuccess {
|
|
97
|
+
readonly ok: true;
|
|
98
|
+
readonly schema: typeof TASK_COST_REPORT_SCHEMA;
|
|
99
|
+
readonly mode: TaskCostMode;
|
|
100
|
+
readonly not_model_performance: true;
|
|
101
|
+
readonly process_calls: 0;
|
|
102
|
+
readonly process_scope: "package_spawned_children";
|
|
103
|
+
readonly runtime: {
|
|
104
|
+
readonly engine: "node" | "bun";
|
|
105
|
+
readonly version: string;
|
|
106
|
+
};
|
|
107
|
+
readonly declarations: readonly TaskCostDeclaration[];
|
|
108
|
+
readonly corpus: {
|
|
109
|
+
readonly id: string;
|
|
110
|
+
readonly version: string;
|
|
111
|
+
readonly observed_digest: string;
|
|
112
|
+
readonly item_count: number;
|
|
113
|
+
};
|
|
114
|
+
readonly corpus_observation: {
|
|
115
|
+
readonly calls: 2;
|
|
116
|
+
readonly delivered_bytes: number;
|
|
117
|
+
readonly excluded_from_scenario_budget: true;
|
|
118
|
+
};
|
|
119
|
+
readonly scenarios: readonly TaskCostScenarioReport[];
|
|
120
|
+
readonly probe?: TaskCostProbe;
|
|
121
|
+
}
|
|
122
|
+
/** Typed refusal. Remediation is a fixed sentence, never a native exception. */
|
|
123
|
+
export interface TaskCostRefusal {
|
|
124
|
+
readonly ok: false;
|
|
125
|
+
readonly schema: typeof TASK_COST_REPORT_SCHEMA;
|
|
126
|
+
readonly exit_code: 1 | 2;
|
|
127
|
+
readonly code: "invalid_request" | "sdk_unavailable" | "source_unavailable" | "empty_tracker" | "answer_mismatch" | "corpus_mismatch" | "runtime_answer_mismatch" | "orientation_contract_unavailable" | "resume_contract_unavailable" | "item_not_found" | "status_registry_unavailable" | "budget_not_worsened" | "report_invalid";
|
|
128
|
+
readonly remediation: string;
|
|
129
|
+
}
|
|
130
|
+
/** Result shared by the SDK and the CLI. */
|
|
131
|
+
export type TaskCostResult = TaskCostSuccess | TaskCostRefusal;
|
|
132
|
+
/** Host-injected reads. The package never resolves an SDK install path. */
|
|
133
|
+
export type TaskCostClient = Pick<PmClient, "context" | "get" | "list" | "listAllComplete" | "schemaList">;
|
|
134
|
+
/** Injected host. Tests pass a real client; the CLI passes `ctx.sdk`. */
|
|
135
|
+
export interface TaskCostHost {
|
|
136
|
+
readonly client: TaskCostClient;
|
|
137
|
+
isItemNotFoundError?(error: unknown): boolean;
|
|
138
|
+
}
|
|
139
|
+
/** One configured status taken from the SDK schema list, including its role names. */
|
|
140
|
+
interface StatusDefinition {
|
|
141
|
+
readonly id: string;
|
|
142
|
+
readonly aliases: readonly string[];
|
|
143
|
+
readonly roles: readonly string[];
|
|
144
|
+
}
|
|
145
|
+
/** Role membership copied from registry role names. Status ids are never compared to literals such as "done". */
|
|
146
|
+
interface StatusRoleIndex {
|
|
147
|
+
readonly byToken: ReadonlyMap<string, string>;
|
|
148
|
+
readonly active: ReadonlySet<string>;
|
|
149
|
+
readonly blocked: ReadonlySet<string>;
|
|
150
|
+
readonly done: ReadonlySet<string>;
|
|
151
|
+
readonly canceled: ReadonlySet<string>;
|
|
152
|
+
readonly terminal: ReadonlySet<string>;
|
|
153
|
+
readonly openStatusId: string;
|
|
154
|
+
}
|
|
155
|
+
/** Describe the executing engine; accepts a version map for portable consumers and tests. */
|
|
156
|
+
export declare function taskCostRuntime(versions: Readonly<Record<string, string | undefined>>): TaskCostSuccess["runtime"];
|
|
157
|
+
/**
|
|
158
|
+
* Contract failure inside a producer, mapped to a typed refusal by the runner.
|
|
159
|
+
* The message is a stable remedy, not a native diagnostic.
|
|
160
|
+
*/
|
|
161
|
+
export declare class TaskCostContractError extends Error {
|
|
162
|
+
/** Stable refusal code the runner copies onto the result. */
|
|
163
|
+
readonly code: TaskCostRefusal["code"];
|
|
164
|
+
/**
|
|
165
|
+
* Create a producer-side contract failure.
|
|
166
|
+
*
|
|
167
|
+
* @param code - Refusal code the public result will carry.
|
|
168
|
+
* @param remediation - Fixed remedy, without native error text.
|
|
169
|
+
*/
|
|
170
|
+
constructor(code: TaskCostRefusal["code"], remediation: string);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Build a reduced exact ratio. The denominator is always positive.
|
|
174
|
+
*
|
|
175
|
+
* @param numerator - Safe integer.
|
|
176
|
+
* @param denominator - Non-zero safe integer.
|
|
177
|
+
* @returns Reduced rational.
|
|
178
|
+
*/
|
|
179
|
+
export declare function exactRational(numerator: number, denominator?: number): ExactRational;
|
|
180
|
+
/**
|
|
181
|
+
* Compare two rationals by cross-multiplication in bigint, so 1/2 and 2/4 match
|
|
182
|
+
* and a binary float cannot round an inclusive boundary the wrong way.
|
|
183
|
+
*
|
|
184
|
+
* @param left - Exact ratio.
|
|
185
|
+
* @param right - Exact ratio.
|
|
186
|
+
* @returns -1, 0 or 1.
|
|
187
|
+
*/
|
|
188
|
+
export declare function rationalCompare(left: ExactRational, right: ExactRational): -1 | 0 | 1;
|
|
189
|
+
/**
|
|
190
|
+
* Median of a non-empty bounded sample. Even counts use the exact mean of the
|
|
191
|
+
* two central integers, stored as a ratio rather than a float.
|
|
192
|
+
*
|
|
193
|
+
* @param samples - Safe non-negative integers, length 1 to 8.
|
|
194
|
+
* @returns Exact median.
|
|
195
|
+
*/
|
|
196
|
+
export declare function exactMedian(samples: readonly number[]): ExactRational;
|
|
197
|
+
/**
|
|
198
|
+
* Render a non-negative rational for display only. Decisions must use {@link rationalCompare}.
|
|
199
|
+
*
|
|
200
|
+
* @param value - Reduced non-negative ratio.
|
|
201
|
+
* @returns A decimal string with at most three fractional digits.
|
|
202
|
+
*/
|
|
203
|
+
export declare function formatRational(value: ExactRational): string;
|
|
204
|
+
/**
|
|
205
|
+
* Label an exact byte count divided by 4 as an estimate.
|
|
206
|
+
*
|
|
207
|
+
* @param bytes - Delivered UTF-8 byte count, or an exact median of counts.
|
|
208
|
+
* @returns Labeled estimate. The display string is not a decision input.
|
|
209
|
+
*/
|
|
210
|
+
export declare function bytesDiv4Estimate(bytes: number | ExactRational): TaskCostEstimate;
|
|
211
|
+
/**
|
|
212
|
+
* Subtract two rationals with bigint cross-multiplication so a half-step median stays exact.
|
|
213
|
+
*
|
|
214
|
+
* @param left - Minuend.
|
|
215
|
+
* @param right - Subtrahend.
|
|
216
|
+
* @returns Reduced difference.
|
|
217
|
+
*/
|
|
218
|
+
export declare function subtractRationals(left: ExactRational, right: ExactRational): ExactRational;
|
|
219
|
+
/**
|
|
220
|
+
* Integer ceiling of a non-negative rational. Used only to label the SDK's ceil(bytes/4) estimate.
|
|
221
|
+
*
|
|
222
|
+
* @param value - Non-negative exact ratio.
|
|
223
|
+
* @returns Smallest integer greater than or equal to the ratio.
|
|
224
|
+
*/
|
|
225
|
+
export declare function ceilRational(value: ExactRational): number;
|
|
226
|
+
/**
|
|
227
|
+
* Integer ceiling of bytes/4, matching the SDK estimator's documented formula.
|
|
228
|
+
* It is still an estimate and is not consulted by budget decisions.
|
|
229
|
+
*
|
|
230
|
+
* @param bytes - Delivered UTF-8 byte count.
|
|
231
|
+
* @returns Ceil(bytes/4) as a safe integer.
|
|
232
|
+
*/
|
|
233
|
+
export declare function ceilBytesDiv4(bytes: number): number;
|
|
234
|
+
/**
|
|
235
|
+
* Decide whether a wasted run is strictly more expensive in both calls and bytes.
|
|
236
|
+
* Comparison uses exact rationals, including when the median is a half-step.
|
|
237
|
+
*
|
|
238
|
+
* @param cleanCalls - Clean-run call median.
|
|
239
|
+
* @param cleanBytes - Clean-run byte median.
|
|
240
|
+
* @param wastedCalls - Wasted-run call median.
|
|
241
|
+
* @param wastedBytes - Wasted-run byte median.
|
|
242
|
+
* @returns True only when both quantities strictly increase.
|
|
243
|
+
*/
|
|
244
|
+
export declare function budgetWorsened(cleanCalls: ExactRational, cleanBytes: ExactRational, wastedCalls: ExactRational, wastedBytes: ExactRational): boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Build role sets from SDK-delivered role names. Status ids are stored only as
|
|
247
|
+
* members of those sets; they are never tested with string equality against "open" or "done".
|
|
248
|
+
*
|
|
249
|
+
* @param definitions - Dense status definitions from `schemaList`.
|
|
250
|
+
* @returns Lookup index and the registry's default-open status id.
|
|
251
|
+
*/
|
|
252
|
+
export declare function indexStatusRoles(definitions: readonly StatusDefinition[]): StatusRoleIndex;
|
|
253
|
+
/**
|
|
254
|
+
* Resolve a status token to its registry id. Unknown tokens stay unresolved.
|
|
255
|
+
*
|
|
256
|
+
* @param status - Status text from an SDK row.
|
|
257
|
+
* @param index - Role index built from the current registry.
|
|
258
|
+
* @returns Registry id, or undefined when the registry has no such status.
|
|
259
|
+
*/
|
|
260
|
+
export declare function resolveStatusId(status: string, index: StatusRoleIndex): string | undefined;
|
|
261
|
+
/**
|
|
262
|
+
* Parse `schemaList` statuses without accepting a hand-built role policy.
|
|
263
|
+
*
|
|
264
|
+
* @param value - SDK `schemaList` result.
|
|
265
|
+
* @returns Dense definitions, or undefined when the payload is not the SDK shape.
|
|
266
|
+
*/
|
|
267
|
+
export declare function parseSchemaListStatuses(value: unknown): StatusDefinition[] | undefined;
|
|
268
|
+
/**
|
|
269
|
+
* Canonical orientation answer: role counts plus a hash of id/role pairs.
|
|
270
|
+
*
|
|
271
|
+
* @param rows - Delivered focus rows.
|
|
272
|
+
* @param index - Current status registry.
|
|
273
|
+
* @returns Stable answer token.
|
|
274
|
+
*/
|
|
275
|
+
export declare function orientationAnswer(rows: readonly {
|
|
276
|
+
id: string;
|
|
277
|
+
status: string;
|
|
278
|
+
}[], index: StatusRoleIndex): string;
|
|
279
|
+
/**
|
|
280
|
+
* Answer for one targeted get: the id and its registry role, not the status name.
|
|
281
|
+
*
|
|
282
|
+
* @param id - Requested item id.
|
|
283
|
+
* @param status - Status text from the SDK get.
|
|
284
|
+
* @param index - Current status registry.
|
|
285
|
+
* @returns Stable answer token.
|
|
286
|
+
*/
|
|
287
|
+
export declare function targetedAnswer(id: string, status: string, index: StatusRoleIndex): string;
|
|
288
|
+
/**
|
|
289
|
+
* Answer for a resumed page sequence. Duplicate ids are visible in the token.
|
|
290
|
+
*
|
|
291
|
+
* @param pages - Number of SDK pages read.
|
|
292
|
+
* @param ids - Ids in delivery order, including duplicates if the cursor misbehaves.
|
|
293
|
+
* @param index - Current status registry.
|
|
294
|
+
* @param statuses - Status text parallel to `ids`.
|
|
295
|
+
* @returns Stable answer token.
|
|
296
|
+
*/
|
|
297
|
+
export declare function resumeAnswer(pages: number, ids: readonly string[], statuses: readonly string[], index: StatusRoleIndex): string;
|
|
298
|
+
/**
|
|
299
|
+
* Digest the certified corpus without putting item bodies into the answer.
|
|
300
|
+
*
|
|
301
|
+
* @param items - Certified complete-list rows.
|
|
302
|
+
* @returns `digest:` plus a hex sha256 of id, status and updated_at.
|
|
303
|
+
*/
|
|
304
|
+
export declare function corpusDigest(items: readonly {
|
|
305
|
+
id: string;
|
|
306
|
+
status: string;
|
|
307
|
+
updated_at: string;
|
|
308
|
+
}[]): string;
|
|
309
|
+
/**
|
|
310
|
+
* Clone SDK results so the synthetic runtime cannot share object identity with the directory runtime.
|
|
311
|
+
*
|
|
312
|
+
* @param client - Directory client.
|
|
313
|
+
* @returns Client whose methods return structured clones.
|
|
314
|
+
*/
|
|
315
|
+
export declare function syntheticRemoteClient(client: TaskCostClient): TaskCostClient;
|
|
316
|
+
/**
|
|
317
|
+
* Validate a finished report with the same numeric domain the producer uses.
|
|
318
|
+
* A bad scenario fails alone: the function reports the scenario name instead of discarding siblings.
|
|
319
|
+
*
|
|
320
|
+
* @param report - Producer output.
|
|
321
|
+
* @returns The same report when every number is finite and in domain.
|
|
322
|
+
*/
|
|
323
|
+
export declare function assertTaskCostReport(report: TaskCostSuccess): TaskCostSuccess;
|
|
324
|
+
/**
|
|
325
|
+
* Parse one untrusted declaration. Unknown keys, sparse data and non-finite numbers fail.
|
|
326
|
+
*
|
|
327
|
+
* @param input - Untrusted value.
|
|
328
|
+
* @returns Canonical declaration, or undefined.
|
|
329
|
+
*/
|
|
330
|
+
export declare function parseTaskCostDeclaration(input: unknown): TaskCostDeclaration | undefined;
|
|
331
|
+
/**
|
|
332
|
+
* Trim and turn CRLF into LF before a token is matched. This is the write-path normalizer.
|
|
333
|
+
*
|
|
334
|
+
* @param value - Untrusted string.
|
|
335
|
+
* @param max - Maximum length after normalization.
|
|
336
|
+
* @returns Normalized string, or undefined when the value is not a bounded string.
|
|
337
|
+
*/
|
|
338
|
+
export declare function canonicalToken(value: unknown, max: number): string | undefined;
|
|
339
|
+
/**
|
|
340
|
+
* Parse a measurement request. Flat fields and a declaration array share this schema.
|
|
341
|
+
*
|
|
342
|
+
* @param input - Untrusted SDK or CLI payload.
|
|
343
|
+
* @returns Canonical request pieces, or undefined.
|
|
344
|
+
*/
|
|
345
|
+
export declare function parseTaskCostRequest(input: unknown): {
|
|
346
|
+
mode: TaskCostMode;
|
|
347
|
+
scenario: TaskCostScenario | "all";
|
|
348
|
+
repeats: number;
|
|
349
|
+
corpusId: string;
|
|
350
|
+
corpusVersion?: string;
|
|
351
|
+
expectedAnswer?: string;
|
|
352
|
+
targetId?: string;
|
|
353
|
+
id?: string;
|
|
354
|
+
declarations?: TaskCostDeclaration[];
|
|
355
|
+
} | undefined;
|
|
356
|
+
/**
|
|
357
|
+
* Measure fixed scenarios and check answers on both supported runtimes.
|
|
358
|
+
* Corpus observation is excluded from the scenario call and byte budgets.
|
|
359
|
+
*
|
|
360
|
+
* @param host - Injected SDK client.
|
|
361
|
+
* @param input - Strict request object.
|
|
362
|
+
* @returns Compact report or a typed refusal.
|
|
363
|
+
*/
|
|
364
|
+
export declare function runTaskCostBaselines(host: TaskCostHost, input: unknown): Promise<TaskCostResult>;
|
|
365
|
+
/**
|
|
366
|
+
* Map CLI options onto the strict request. Host renderer flags are ignored, not rejected.
|
|
367
|
+
*
|
|
368
|
+
* @param options - Command options from the host.
|
|
369
|
+
* @returns Strict request object.
|
|
370
|
+
*/
|
|
371
|
+
export declare function taskCostRequestFromOptions(options: Record<string, unknown>): Record<string, unknown>;
|
|
372
|
+
/**
|
|
373
|
+
* Run the baseline command from the host-injected SDK only.
|
|
374
|
+
*
|
|
375
|
+
* @param ctx - Extension command context. `ctx.sdk` is required.
|
|
376
|
+
* @returns The same result the SDK function returns.
|
|
377
|
+
*/
|
|
378
|
+
export declare function runTaskCostCommand(ctx: Pick<CommandHandlerContext, "options" | "sdk">): Promise<TaskCostResult>;
|
|
379
|
+
export {};
|
|
380
|
+
//# sourceMappingURL=baselines.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baselines.d.ts","sourceRoot":"","sources":["../baselines.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE7E,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,eAAe,GAAG,QAAQ,CAAC;AAC1E,8EAA8E;AAC9E,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,kBAAkB,CAAC;AAC/D,sFAAsF;AACtF,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,KAAK,GAAG,OAAO,CAAC;AACvD,8DAA8D;AAC9D,eAAO,MAAM,uBAAuB,mCAAmC,CAAC;AACxE,gFAAgF;AAChF,eAAO,MAAM,4BAA4B,qCAAqC,CAAC;AAC/E,oEAAoE;AACpE,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,+EAA+E;AAC/E,eAAO,MAAM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