pm-context 2026.10.29 → 2026.11.13

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 CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026.11.13 - 2026-11-13
4
+
5
+ ### Fixed
6
+
7
+ - Abandon prepared releases without usable notes and validate the exact new section ([pm-context-empty-prepared-release](https://github.com/unbraind/pm-context/blob/main/.agents/pm/issues/pm-context-empty-prepared-release.toon))
8
+
9
+ ## 2026.10.31 - 2026-10-31
10
+
11
+ ### Fixed
12
+
13
+ - Restore generated notes for the prepared 2026.10.29 release ([pm-context-release-notes-1029](https://github.com/unbraind/pm-context/blob/main/.agents/pm/issues/pm-context-release-notes-1029.toon))
14
+ - Resume must consume a verified same-version changelog recovery ([pm-context-resume-recovery-sha](https://github.com/unbraind/pm-context/blob/main/.agents/pm/issues/pm-context-resume-recovery-sha.toon))
15
+
16
+ ## 2026.10.29 - 2026-10-29
17
+
18
+ ### Added
19
+
20
+ - Factor shared criterion evidence into one revision-bound fragment ([pm-context-shared-fragment-evidence](https://github.com/unbraind/pm-context/blob/main/.agents/pm/features/pm-context-shared-fragment-evidence.toon))
21
+
22
+ ### Fixed
23
+
24
+ - Reject sparse evidence acquisition contracts before planning ([pm-context-acquisition-boundary](https://github.com/unbraind/pm-context/blob/main/.agents/pm/issues/pm-context-acquisition-boundary.toon))
25
+
3
26
  ## 2026.10.28 - 2026-10-28
4
27
 
5
28
  ### Added
@@ -9,6 +32,7 @@
9
32
  ### Other
10
33
 
11
34
  - Stop Hound from linting generated dist/ output ([pm-context-hound-generated-dist](https://github.com/unbraind/pm-context/blob/main/.agents/pm/chores/pm-context-hound-generated-dist.toon))
35
+ - Point the npm homepage at the package catalog and link the author ([pm-context-78wz](https://github.com/unbraind/pm-context/blob/main/.agents/pm/chores/pm-context-78wz.toon))
12
36
 
13
37
  ## 2026.10.26 - 2026-10-26
14
38
 
@@ -16,6 +40,14 @@
16
40
 
17
41
  - Plan the cheapest next reads for missing criterion evidence ([pm-context-next-evidence](https://github.com/unbraind/pm-context/blob/main/.agents/pm/features/pm-context-next-evidence.toon))
18
42
 
43
+ ### Fixed
44
+
45
+ - Saved acquisition plans retain numeric estimates through JSON round trips ([pm-context-json-estimates](https://github.com/unbraind/pm-context/blob/main/.agents/pm/issues/pm-context-json-estimates.toon))
46
+
47
+ ### Other
48
+
49
+ - Use SDK reads for file focus and resumable deltas ([pm-context-sdk-adoption-1025](https://github.com/unbraind/pm-context/blob/main/.agents/pm/tasks/pm-context-sdk-adoption-1025.toon))
50
+
19
51
  ## 2026.10.25 - 2026-10-25
20
52
 
21
53
  ### Added
@@ -35,6 +67,10 @@
35
67
  - Certify complete context corpora and recover abandoned receipt locks ([pm-context-pbcw](https://github.com/unbraind/pm-context/blob/main/.agents/pm/tasks/pm-context-pbcw.toon))
36
68
  - Correct tracker reconciliation review evidence for PR 163 ([pm-context-r163](https://github.com/unbraind/pm-context/blob/main/.agents/pm/chores/pm-context-r163.toon))
37
69
 
70
+ ## 2026.10.24 - 2026-10-24
71
+
72
+ No changes.
73
+
38
74
  ## 2026.10.23 - 2026-10-23
39
75
 
40
76
  ### Added
@@ -65,6 +101,22 @@
65
101
 
66
102
  - Closed: Daily Release workflow is failing ([pm-context-github-356cb2a080ed-81](https://github.com/unbraind/pm-context/blob/main/.agents/pm/issues/pm-context-github-356cb2a080ed-81.toon))
67
103
 
104
+ ## 2026.10.20 - 2026-10-20
105
+
106
+ No changes.
107
+
108
+ ## 2026.10.18 - 2026-10-18
109
+
110
+ No changes.
111
+
112
+ ## 2026.10.17 - 2026-10-17
113
+
114
+ No changes.
115
+
116
+ ## 2026.10.16 - 2026-10-16
117
+
118
+ No changes.
119
+
68
120
  ## 2026.10.14 - 2026-10-14
69
121
 
70
122
  ### Fixed
@@ -77,12 +129,28 @@
77
129
 
78
130
  - pm context-usage: report which served context an agent actually used ([pm-context-ci6v](https://github.com/unbraind/pm-context/blob/main/.agents/pm/features/pm-context-ci6v.toon))
79
131
 
132
+ ## 2026.10.11 - 2026-10-11
133
+
134
+ No changes.
135
+
136
+ ## 2026.10.10 - 2026-10-10
137
+
138
+ No changes.
139
+
140
+ ## 2026.10.9 - 2026-10-09
141
+
142
+ No changes.
143
+
80
144
  ## 2026.10.5 - 2026-10-05
81
145
 
82
146
  ### Other
83
147
 
84
148
  - Auto-merge green Dependabot updates and group the pm toolchain into one daily PR ([pm-context-h34i](https://github.com/unbraind/pm-context/blob/main/.agents/pm/tasks/pm-context-h34i.toon))
85
149
 
150
+ ## 2026.10.3 - 2026-10-03
151
+
152
+ No changes.
153
+
86
154
  ## 2026.9.26 - 2026-09-26
87
155
 
88
156
  ### Other
@@ -117,6 +185,10 @@
117
185
 
118
186
  - Certify pm CLI 2026.9.10 and pick up the canonical auditor fixes the lockfile was holding back ([pm-context-syd5](https://github.com/unbraind/pm-context/blob/main/.agents/pm/chores/pm-context-syd5.toon))
119
187
 
188
+ ## 2026.9.9 - 2026-09-09
189
+
190
+ No changes.
191
+
120
192
  ## 2026.9.8 - 2026-09-08
121
193
 
122
194
  ### Security
@@ -145,9 +217,9 @@
145
217
 
146
218
  ### Fixed
147
219
 
148
- - Refuse the unattested publish fallback after provenance failure ([pm-context-fuhi](https://github.com/unbraind/pm-context/blob/main/.agents/pm/issues/pm-context-fuhi.toon))
149
220
  - Preserve append-only provenance history during review repair ([pm-context-9xfx](https://github.com/unbraind/pm-context/blob/main/.agents/pm/issues/pm-context-9xfx.toon))
150
221
  - Make the affinity tiebreak test use one shared instant ([pm-context-hxj5](https://github.com/unbraind/pm-context/blob/main/.agents/pm/issues/pm-context-hxj5.toon))
222
+ - Refuse the unattested publish fallback after provenance failure ([pm-context-fuhi](https://github.com/unbraind/pm-context/blob/main/.agents/pm/issues/pm-context-fuhi.toon))
151
223
 
152
224
  ## 2026.8.28 - 2026-08-28
153
225
 
@@ -222,12 +294,20 @@
222
294
 
223
295
  - Resolve pm-changelog to the release that derives release dates in UTC ([pm-context-6rua](https://github.com/unbraind/pm-context/blob/main/.agents/pm/chores/pm-context-6rua.toon))
224
296
 
297
+ ## 2026.8.3 - 2026-08-03
298
+
299
+ No changes.
300
+
225
301
  ## 2026.8.1 - 2026-08-01
226
302
 
227
303
  ### Fixed
228
304
 
229
305
  - Release commits discard the rebuilt dist, so the git-install path serves the previous version ([pm-context-bbsp](https://github.com/unbraind/pm-context/blob/main/.agents/pm/issues/pm-context-bbsp.toon))
230
306
 
307
+ ## 2026.7.31 - 2026-07-31
308
+
309
+ No changes.
310
+
231
311
  ## 2026.7.29 - 2026-07-29
232
312
 
233
313
  ### Added
@@ -284,12 +364,28 @@
284
364
 
285
365
  - Closed: Recommend pm merge reconcile (2026.7.22) over raw history-repair in Multi-agent merge safety docs ([pm-context-164t](https://github.com/unbraind/pm-context/blob/main/.agents/pm/issues/pm-context-164t.toon))
286
366
 
367
+ ## 2026.7.22 - 2026-07-22
368
+
369
+ No changes.
370
+
371
+ ## 2026.7.20 - 2026-07-20
372
+
373
+ No changes.
374
+
287
375
  ## 2026.7.14 - 2026-07-14
288
376
 
289
377
  ### Fixed
290
378
 
291
379
  - context-pack and context-handoff write rendered output to stderr instead of stdout ([pm-context-ubca](https://github.com/unbraind/pm-context/blob/main/.agents/pm/issues/pm-context-ubca.toon))
292
380
 
381
+ ## 2026.7.13 - 2026-07-13
382
+
383
+ No changes.
384
+
385
+ ## 2026.7.11 - 2026-07-11
386
+
387
+ No changes.
388
+
293
389
  ## 2026.7.10-1 - 2026-07-10
294
390
 
295
391
  ### Added
@@ -315,6 +411,10 @@
315
411
 
316
412
  - Ecosystem release readiness pass 2026-07-06 ([pm-context-m959](https://github.com/unbraind/pm-context/blob/main/.agents/pm/tasks/pm-context-m959.toon))
317
413
 
414
+ ## 2026.7.7 - 2026-07-07
415
+
416
+ No changes.
417
+
318
418
  ## 2026.7.6 - 2026-07-06
319
419
 
320
420
  ### Fixed
@@ -339,6 +439,10 @@
339
439
 
340
440
  - Daily Release publish step runs prepublishOnly post-tag: align npm publish with --ignore-scripts ([pm-context-wvup](https://github.com/unbraind/pm-context/blob/main/.agents/pm/tasks/pm-context-wvup.toon))
341
441
 
442
+ ## 2026.6.10 - 2026-06-10
443
+
444
+ No changes.
445
+
342
446
  ## 2026.6.9 - 2026-06-09
343
447
 
344
448
  ### Added
@@ -346,12 +450,24 @@
346
450
  - Add compact format alias and recent activity section ([pm-context-8vgi](https://github.com/unbraind/pm-context/blob/main/.agents/pm/features/pm-context-8vgi.toon))
347
451
  - Add --neighborhood-depth for transitive context neighbors ([pm-context-qbmf](https://github.com/unbraind/pm-context/blob/main/.agents/pm/features/pm-context-qbmf.toon))
348
452
 
453
+ ## 2026.6.8 - 2026-06-08
454
+
455
+ No changes.
456
+
457
+ ## 2026.6.7-2 - 2026-06-07
458
+
459
+ No changes.
460
+
461
+ ## 2026.6.7-1 - 2026-06-06
462
+
463
+ No changes.
464
+
349
465
  ## 2026.6.7 - 2026-06-06
350
466
 
351
467
  ### Added
352
468
 
353
- - Build initial context pack command ([pm-context-0gyf](https://github.com/unbraind/pm-context/blob/main/.agents/pm/features/pm-context-0gyf.toon))
354
469
  - Add agent handoff digest mode to context packs ([pm-context-opzn](https://github.com/unbraind/pm-context/blob/main/.agents/pm/features/pm-context-opzn.toon))
470
+ - Build initial context pack command ([pm-context-0gyf](https://github.com/unbraind/pm-context/blob/main/.agents/pm/features/pm-context-0gyf.toon))
355
471
 
356
472
  ### Other
357
473
 
package/README.md CHANGED
@@ -568,6 +568,9 @@ See [validation and measured public data](docs/task-phase-validation.md).
568
568
 
569
569
  ## Without git
570
570
 
571
+ `context-reduce` and its saved-packet `--check` work in plain trackers without Git.
572
+ They read SDK-native fields and revisions without creating tracker state.
573
+
571
574
  Next-evidence acquisition plans, criterion evidence packs, item-selected packs, handoffs, usage reports, `context-pack since`, freshness record/resume and `context-witnesses` work in a
572
575
  plain initialized tracker without invoking Git. Corpus reads use `listAllComplete`
573
576
  with extension hooks disabled and re-certify its full-corpus receipt before packing,
@@ -609,3 +612,28 @@ SDK and CLI packets share one strict validation boundary. All arrays must be
609
612
  dense and within the documented bounds; sparse arrays refuse with
610
613
  `INVALID_PACKET` before planning or serialization. Valid v1 packets and saved
611
614
  plans retain their existing contract hashes.
615
+
616
+ Changelog history explicitly includes empty version windows, including the
617
+ package version awaiting release. A version with no qualifying closed tracker
618
+ changes is recorded as “No changes.”
619
+
620
+ ## Answer-sensitive context reduction
621
+
622
+ `pm context-reduce` accepts an explicit finite decision table and source-fragment
623
+ influence declarations. It checks every input combination and omits only fields
624
+ whose declared variables cannot change the answer, retaining a branch proof and
625
+ source revision for every omission. Unsupported predicates keep evidence and
626
+ report `unknown`. This complements evidence packing and deduplication.
627
+
628
+ ```sh
629
+ pm context-reduce --packet routing.json --format toon
630
+ pm context-reduce --packet routing.json --json > reduced.json
631
+ pm context-reduce --packet routing.json --check reduced.json --json
632
+ ```
633
+
634
+ Use [the example](docs/examples/answer-reduction.json) with your item IDs. The
635
+ [contract and SDK guide](docs/answer-reduction.md) explains bounds, proof scope,
636
+ `full` comparison output, typed remedies, and revision revalidation. The public
637
+ tracker benchmark reduced JSON from **7,600 to 2,526 bytes (66.76%)**, including
638
+ proofs, while preserving all four routing combinations. This guarantee applies
639
+ to the caller's declared task; dependencies are never inferred from prose.
@@ -0,0 +1,90 @@
1
+ import { PmCliError } from "@unbrained/pm-cli/sdk";
2
+ import type { SharedEvidenceReader } from "./shared-evidence.ts";
3
+ /** Exact JSON values; numbers are finite and bounded, with no coercion or rounding. */
4
+ export type AnswerValue = string | number | boolean | null;
5
+ /** A finite domain supplied by the task owner, not inferred from source prose. */
6
+ export interface AnswerVariable {
7
+ id: string;
8
+ values: AnswerValue[];
9
+ }
10
+ /** Only eq and neq are evaluated; other named operations make the result unknown. */
11
+ export interface AnswerPredicate {
12
+ variable: string;
13
+ op: string;
14
+ value: AnswerValue;
15
+ }
16
+ /** Ordered first-match rule; all predicates in when must hold. Empty when always matches. */
17
+ export interface AnswerRule {
18
+ when: AnswerPredicate[];
19
+ answer: string;
20
+ }
21
+ /** The caller asserts that this field can affect the answer only through these variables. */
22
+ export interface AnswerFragment {
23
+ id: string;
24
+ item: string;
25
+ field: string;
26
+ variables: string[];
27
+ }
28
+ /** One strict declaration schema for SDK, CLI, saved packets and verification. */
29
+ export interface AnswerReductionRequest {
30
+ contract_revision: string;
31
+ variables: AnswerVariable[];
32
+ rules: AnswerRule[];
33
+ fallback: string;
34
+ fragments: AnswerFragment[];
35
+ }
36
+ /** Matching cofactor digests certify equal answer vectors for each domain branch. */
37
+ export interface AnswerIrrelevanceProof {
38
+ variable: string;
39
+ contexts: number;
40
+ branches: {
41
+ value: AnswerValue;
42
+ answers_sha256: string;
43
+ }[];
44
+ }
45
+ /** Each field is independently revision-bound; missing sources remain explicit unknowns. */
46
+ export interface ReducedAnswerFragment {
47
+ id: string;
48
+ revision: string | null;
49
+ state: "retained" | "omitted" | "unavailable";
50
+ proof_variables: string[];
51
+ value_json: string | null;
52
+ }
53
+ /** Self-contained finite routing table plus checkable declaration and omission certificates. */
54
+ export interface AnswerReduction {
55
+ protocol: "pm-context-answer-reduction/v1";
56
+ basis: "declared-domains-and-fragment-dependencies;not-inferred-semantics";
57
+ contract: AnswerReductionRequest;
58
+ representation: "full" | "reduced";
59
+ state: "proved" | "unknown";
60
+ combinations: number;
61
+ relevant_variables: string[];
62
+ routing: {
63
+ inputs: AnswerValue[];
64
+ answer: string;
65
+ }[];
66
+ proofs: AnswerIrrelevanceProof[];
67
+ fragments: ReducedAnswerFragment[];
68
+ remedy: string;
69
+ }
70
+ /** Host-compatible refusals never expose source contents or private input paths. */
71
+ export declare class AnswerReductionError extends PmCliError {
72
+ /** Machine-readable categories survive both SDK and CLI error boundaries. */
73
+ readonly code: "INVALID_REQUEST" | "INVALID_ARGUMENT" | "INPUT_UNAVAILABLE" | "INVALID_OUTPUT" | "STALE_PACKET";
74
+ /** Corrective action available alongside the host next_steps field. */
75
+ readonly remedy: string;
76
+ constructor(code: AnswerReductionError["code"], remedy: string);
77
+ }
78
+ /** Validate once before reads; preserve declared order because it defines first-match semantics. */
79
+ export declare function parseAnswerReductionRequest(value: unknown): AnswerReductionRequest;
80
+ /** Read bounded stable UTF-8 JSON with the package's existing file-reader contract. */
81
+ export declare function readAnswerReductionJson(path: string): unknown;
82
+ /** Verify shape and certificates using the producer, including every emitted numeric domain. */
83
+ export declare function parseAnswerReduction(value: unknown): AnswerReduction;
84
+ /** Read every declared field through the caller's authoritative adapter; failures stay local. */
85
+ export declare function reduceAnswerContext(input: AnswerReductionRequest, read: SharedEvidenceReader, representation?: AnswerReduction["representation"]): Promise<AnswerReduction>;
86
+ /** Compact, lossless transports share the same producer-derived validator. */
87
+ export declare function encodeAnswerReduction(packet: AnswerReduction, format: "json" | "toon"): string;
88
+ /** Recompute all proofs and reread current revisions; replay cannot bless a stale packet. */
89
+ export declare function validateAnswerReduction(saved: unknown, input: AnswerReductionRequest, read: SharedEvidenceReader): Promise<AnswerReduction>;
90
+ //# sourceMappingURL=answer-reduction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"answer-reduction.d.ts","sourceRoot":"","sources":["../answer-reduction.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAKjE,uFAAuF;AACvF,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAC3D,kFAAkF;AAClF,MAAM,WAAW,cAAc;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,EAAE,CAAA;CAAE;AACrE,qFAAqF;AACrF,MAAM,WAAW,eAAe;IAAG,QAAQ,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAE;AACrF,6FAA6F;AAC7F,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+1,238 @@
1
+ /** Exhaustive answer-preserving reduction over an explicitly declared finite task. */
2
+ import { createHash } from "node:crypto";
3
+ import { isDeepStrictEqual, types } from "node:util";
4
+ import { encodeToon as encode } from "@unbrained/pm-cli/sdk/testing";
5
+ import { PmCliError } from "@unbrained/pm-cli/sdk";
6
+ import { isUtf8 } from "node:buffer";
7
+ import { readFreshnessFile } from "./freshness.js";
8
+ /** Saved JSON and newly produced packets share the same UTF-8 byte ceiling. */
9
+ const MAX_PACKET_BYTES = 33554432;
10
+ /** Host-compatible refusals never expose source contents or private input paths. */
11
+ export class AnswerReductionError extends PmCliError {
12
+ /** Corrective action available alongside the host next_steps field. */
13
+ remedy;
14
+ constructor(code, remedy) {
15
+ super(`${code}: ${remedy}`, 2, { code, nextSteps: [remedy] });
16
+ this.remedy = remedy;
17
+ }
18
+ }
19
+ /** Reject exotic objects, hidden keys and accessor/serialization hooks at the boundary. */
20
+ function record(value) {
21
+ return value !== null && typeof value === "object" && !types.isProxy(value) && Object.getPrototypeOf(value) === Object.prototype;
22
+ }
23
+ /** Strict keys also reject nonenumerable additions and getters before reading them. */
24
+ function keys(value, allowed) {
25
+ return Reflect.ownKeys(value).every((key) => {
26
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
27
+ return typeof key === "string" && allowed.includes(key) && "value" in descriptor && descriptor.enumerable;
28
+ });
29
+ }
30
+ /** Dense, bounded arrays have only their own indexed data properties and length. */
31
+ function dense(value, maximum) {
32
+ return !types.isProxy(value) && Array.isArray(value) && Object.getPrototypeOf(value) === Array.prototype && value.length <= maximum && Reflect.ownKeys(value).length === value.length + 1 && Array.from({ length: value.length }, (_, i) => Object.getOwnPropertyDescriptor(value, i)).every((entry) => entry !== undefined && "value" in entry && entry.enumerable);
33
+ }
34
+ /** Coordinates are opaque identifiers; prototype-like names are safe Map keys. */
35
+ function id(value) { return typeof value === "string" && /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$/.test(value); }
36
+ /** Text preserves whitespace exactly; only empty/blank declarations are refused. */
37
+ function label(value) { return typeof value === "string" && value.length <= 256 && value.trim().length > 0; }
38
+ /** Scalar domains avoid arithmetic and preserve distinctions between strings and numbers. */
39
+ function scalar(value) { return value === null || typeof value === "boolean" || (typeof value === "string" && value.length <= 256) || (typeof value === "number" && Number.isFinite(value) && Math.abs(value) <= 1e12); }
40
+ /** Bound arbitrary SDK JSON traversal, counting string/key UTF-16 code units. */
41
+ function json(value, budget, depth = 0, sdk = false) {
42
+ if (--budget.nodes < 0 || depth > 24)
43
+ return false;
44
+ if (typeof value === "string") {
45
+ budget.chars -= value.length;
46
+ return budget.chars >= 0;
47
+ }
48
+ if (value === null || typeof value === "boolean")
49
+ return true;
50
+ if (typeof value === "number")
51
+ return Number.isFinite(value);
52
+ if (dense(value, 100000))
53
+ return value.every((entry) => json(entry, budget, depth + 1, sdk));
54
+ return record(value) && keys(value, Object.keys(value)) && Object.entries(value).every(([key, entry]) => json(key, budget, depth + 1, sdk) && ((sdk && entry === undefined) || json(entry, budget, depth + 1, sdk)));
55
+ }
56
+ /** Validate once before reads; preserve declared order because it defines first-match semantics. */
57
+ export function parseAnswerReductionRequest(value) {
58
+ const fail = () => new AnswerReductionError("INVALID_REQUEST", "Supply contract_revision, 0-8 unique variables {id,values:1-8 unique JSON scalars}, 0-64 ordered rules {when:[{variable,op,value}],answer}, fallback and 0-64 fragments {id,item,field,variables}. Use dense arrays, at most 4096 combinations and 262144 UTF-8 bytes, finite numbers within +/-1e12, text up to 256 characters, no unknown keys. Predicates must name declared variables; eq/neq values must belong to their domain.");
59
+ if (!record(value) || !keys(value, ["contract_revision", "variables", "rules", "fallback", "fragments"]) || !label(value.contract_revision) || !label(value.fallback) || !dense(value.variables, 8) || !dense(value.rules, 64) || !dense(value.fragments, 64))
60
+ throw fail();
61
+ const domains = new Map();
62
+ let combinations = 1;
63
+ for (const row of value.variables) {
64
+ if (!record(row) || !keys(row, ["id", "values"]) || !id(row.id) || domains.has(row.id) || !dense(row.values, 8) || row.values.length === 0 || !row.values.every(scalar) || new Set(row.values).size !== row.values.length)
65
+ throw fail();
66
+ domains.set(row.id, row.values);
67
+ combinations *= row.values.length;
68
+ }
69
+ if (combinations > 4096)
70
+ throw fail();
71
+ for (const rule of value.rules) {
72
+ if (!record(rule) || !keys(rule, ["when", "answer"]) || !label(rule.answer) || !dense(rule.when, 8))
73
+ throw fail();
74
+ for (const predicate of rule.when) {
75
+ if (!record(predicate) || !keys(predicate, ["variable", "op", "value"]) || !id(predicate.variable) || !domains.has(predicate.variable) || !id(predicate.op) || !scalar(predicate.value) || (["eq", "neq"].includes(predicate.op) && !domains.get(predicate.variable).includes(predicate.value)))
76
+ throw fail();
77
+ }
78
+ }
79
+ const fragments = new Set();
80
+ for (const row of value.fragments) {
81
+ if (!record(row) || !keys(row, ["id", "item", "field", "variables"]) || !id(row.id) || fragments.has(row.id) || !id(row.item) || !id(row.field) || !dense(row.variables, 8) || !row.variables.every((entry) => typeof entry === "string" && domains.has(entry)) || new Set(row.variables).size !== row.variables.length)
82
+ throw fail();
83
+ fragments.add(row.id);
84
+ }
85
+ if (Buffer.byteLength(JSON.stringify(value)) > 262144)
86
+ throw fail();
87
+ return JSON.parse(JSON.stringify(value));
88
+ }
89
+ /** Read bounded stable UTF-8 JSON with the package's existing file-reader contract. */
90
+ export function readAnswerReductionJson(path) {
91
+ try {
92
+ const bytes = readFreshnessFile(path, MAX_PACKET_BYTES);
93
+ if (!isUtf8(bytes))
94
+ throw new Error();
95
+ return JSON.parse(bytes.toString("utf8"));
96
+ }
97
+ catch {
98
+ throw new AnswerReductionError("INPUT_UNAVAILABLE", "Supply stable readable UTF-8 JSON: declarations are limited to 262144 bytes, saved output to 33554432 bytes.");
99
+ }
100
+ }
101
+ /** Enumerate the full Cartesian product in declared variable/value order. */
102
+ function inputs(variables) {
103
+ return variables.reduce((rows, variable) => rows.flatMap((row) => variable.values.map((value) => [...row, value])), [[]]);
104
+ }
105
+ /** Hash exact ordered answer vectors; equality decisions themselves never depend on hashes. */
106
+ function hash(value) { return createHash("sha256").update(JSON.stringify(value)).digest("hex"); }
107
+ /** Exhaustively compare cofactors while fixing every other variable, including interactions. */
108
+ function analyze(contract) {
109
+ const combinations = inputs(contract.variables);
110
+ const known = contract.rules.every((rule) => rule.when.every((predicate) => predicate.op === "eq" || predicate.op === "neq"));
111
+ const proofs = [];
112
+ const indices = new Map(contract.variables.map((variable, i) => [variable.id, i]));
113
+ const answers = known ? combinations.map((row) => contract.rules.find((rule) => rule.when.every((predicate) => predicate.op === "eq" ? row[indices.get(predicate.variable)] === predicate.value : row[indices.get(predicate.variable)] !== predicate.value))?.answer ?? contract.fallback) : [];
114
+ if (known)
115
+ for (const [index, variable] of contract.variables.entries()) {
116
+ const vectors = variable.values.map((value) => answers.filter((_, i) => combinations[i][index] === value));
117
+ if (vectors.every((vector) => isDeepStrictEqual(vector, vectors[0])))
118
+ proofs.push({ variable: variable.id, contexts: vectors[0].length, branches: variable.values.map((value, i) => ({ value, answers_sha256: hash(vectors[i]) })) });
119
+ }
120
+ const irrelevant = new Set(proofs.map((proof) => proof.variable));
121
+ const relevant = contract.variables.filter((variable) => !irrelevant.has(variable.id)).map((variable) => variable.id);
122
+ const routing = new Map();
123
+ if (known)
124
+ combinations.forEach((row, i) => {
125
+ const projected = row.filter((_, index) => !irrelevant.has(contract.variables[index].id));
126
+ routing.set(JSON.stringify(projected), { inputs: projected, answer: answers[i] });
127
+ });
128
+ return { known, combinations: combinations.length, relevant, routing: [...routing.values()], proofs, irrelevant };
129
+ }
130
+ /** One projection path produces packets and validates their certificates and omission decisions. */
131
+ function project(contract, sources, representation) {
132
+ const analysis = analyze(contract);
133
+ const fragments = contract.fragments.map((fragment, i) => {
134
+ const source = sources[i];
135
+ const omitted = source.revision !== null && analysis.known && representation === "reduced" && fragment.variables.every((id) => analysis.irrelevant.has(id));
136
+ return { id: fragment.id, revision: source.revision, state: source.revision === null ? "unavailable" : omitted ? "omitted" : "retained", proof_variables: omitted ? fragment.variables : [], value_json: omitted ? null : source.value_json };
137
+ });
138
+ const known = analysis.known && fragments.every((fragment) => fragment.state !== "unavailable");
139
+ return { protocol: "pm-context-answer-reduction/v1", basis: "declared-domains-and-fragment-dependencies;not-inferred-semantics", contract, representation, state: known ? "proved" : "unknown", combinations: analysis.combinations, relevant_variables: analysis.relevant, routing: analysis.routing, proofs: analysis.proofs, fragments, remedy: known ? "Proof applies only to declared domains and fragment dependencies. Revalidate after source or contract changes." : "Keep unknown evidence. Restore unavailable fields or replace unsupported predicates with an explicit finite eq/neq table, then regenerate." };
140
+ }
141
+ /** Verify shape and certificates using the producer, including every emitted numeric domain. */
142
+ export function parseAnswerReduction(value) {
143
+ const fail = () => new AnswerReductionError("INVALID_OUTPUT", "Regenerate using reduceAnswerContext; retain the complete contract, routing, branch proofs and revision-bound fragments. Use full or reduced representation and finite bounded JSON.");
144
+ if (!json(value, { nodes: 100000, chars: 8388608 }) || !record(value) || !keys(value, ["protocol", "basis", "contract", "representation", "state", "combinations", "relevant_variables", "routing", "proofs", "fragments", "remedy"]) || (value.representation !== "full" && value.representation !== "reduced"))
145
+ throw fail();
146
+ // Structural validation makes serialization safe; include the encoder's newline.
147
+ if (Buffer.byteLength(JSON.stringify(value)) + 1 > MAX_PACKET_BYTES)
148
+ throw fail();
149
+ let contract;
150
+ try {
151
+ contract = parseAnswerReductionRequest(value.contract);
152
+ }
153
+ catch {
154
+ throw fail();
155
+ }
156
+ if (!dense(value.fragments, 64) || value.fragments.length !== contract.fragments.length)
157
+ throw fail();
158
+ const sources = value.fragments.map((row) => {
159
+ if (!record(row) || !keys(row, ["id", "revision", "state", "proof_variables", "value_json"]) || !(row.revision === null || (typeof row.revision === "string" && /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,255}$/.test(row.revision))))
160
+ throw fail();
161
+ if (row.revision === null || row.state === "omitted") {
162
+ if (row.value_json !== null)
163
+ throw fail();
164
+ }
165
+ else {
166
+ if (typeof row.value_json !== "string")
167
+ throw fail();
168
+ try {
169
+ if (!json(JSON.parse(row.value_json), { nodes: 100000, chars: 8388608 }))
170
+ throw fail();
171
+ }
172
+ catch {
173
+ throw fail();
174
+ }
175
+ }
176
+ return { revision: row.revision, value_json: row.value_json };
177
+ });
178
+ const expected = project(contract, sources, value.representation);
179
+ if (!isDeepStrictEqual(value, expected))
180
+ throw fail();
181
+ return expected;
182
+ }
183
+ /** Read every declared field through the caller's authoritative adapter; failures stay local. */
184
+ export async function reduceAnswerContext(input, read, representation = "reduced") {
185
+ const contract = parseAnswerReductionRequest(input);
186
+ if (representation !== "full" && representation !== "reduced")
187
+ throw new AnswerReductionError("INVALID_ARGUMENT", "Use full or reduced representation.");
188
+ const sources = [];
189
+ const budget = { nodes: 100000, chars: 4000000 };
190
+ // Reserve the packet's fixed strings, including the longer unavailable remedy.
191
+ // Accepted sources add their revision, serialized value and possible proof ids.
192
+ const packetBudget = { nodes: 100000, chars: 8388608 };
193
+ const baseline = project(contract, contract.fragments.map(() => ({ revision: null, value_json: null })), representation);
194
+ if (!json(baseline, packetBudget))
195
+ throw new AnswerReductionError("INVALID_REQUEST", "Reduce domain widths, answer lengths or combinations so routing and proofs fit the 8388608 packet string/key character budget before reading evidence.");
196
+ let bytesRemaining = MAX_PACKET_BYTES - Buffer.byteLength(JSON.stringify(baseline)) - 1;
197
+ if (bytesRemaining < 0)
198
+ throw new AnswerReductionError("INVALID_REQUEST", "Reduce escaped domain widths, answer lengths or combinations so routing and proofs fit the 33554432 UTF-8 JSON byte budget before reading evidence.");
199
+ for (const fragment of contract.fragments) {
200
+ try {
201
+ const source = await read({ item: fragment.item, field: fragment.field });
202
+ const remaining = { ...budget };
203
+ if (!record(source) || !keys(source, ["revision", "value"]) || typeof source.revision !== "string" || !/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,255}$/.test(source.revision) || !json(source.value, remaining, 0, true))
204
+ throw new Error();
205
+ const value_json = JSON.stringify(source.value);
206
+ const chars = value_json.length + source.revision.length + fragment.variables.reduce((sum, variable) => sum + variable.length, 0);
207
+ if (chars > packetBudget.chars)
208
+ throw new Error();
209
+ const bytes = Buffer.byteLength(JSON.stringify({ revision: source.revision, value_json, proof_variables: fragment.variables }));
210
+ if (bytes > bytesRemaining)
211
+ throw new Error();
212
+ bytesRemaining -= bytes;
213
+ packetBudget.chars -= chars;
214
+ Object.assign(budget, remaining);
215
+ sources.push({ revision: source.revision, value_json });
216
+ }
217
+ catch {
218
+ sources.push({ revision: null, value_json: null });
219
+ }
220
+ }
221
+ return parseAnswerReduction(project(contract, sources, representation));
222
+ }
223
+ /** Compact, lossless transports share the same producer-derived validator. */
224
+ export function encodeAnswerReduction(packet, format) {
225
+ if (format !== "json" && format !== "toon")
226
+ throw new AnswerReductionError("INVALID_ARGUMENT", "Use --format json or toon.");
227
+ const checked = parseAnswerReduction(packet);
228
+ return `${format === "json" ? JSON.stringify(checked) : encode(checked)}\n`;
229
+ }
230
+ /** Recompute all proofs and reread current revisions; replay cannot bless a stale packet. */
231
+ export async function validateAnswerReduction(saved, input, read) {
232
+ const packet = parseAnswerReduction(saved);
233
+ const current = await reduceAnswerContext(input, read, packet.representation);
234
+ if (!isDeepStrictEqual(packet, current))
235
+ throw new AnswerReductionError("STALE_PACKET", "Regenerate against current SDK revisions and the current decision contract; saved content alone is not a revision key.");
236
+ return current;
237
+ }
238
+ //# sourceMappingURL=answer-reduction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"answer-reduction.js","sourceRoot":"","sources":["../answer-reduction.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,UAAU,IAAI,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,iBA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