ds4-context-engine 0.3.0-alpha.2 → 0.3.0-alpha.3

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/README.md CHANGED
@@ -16,7 +16,7 @@ bounded active context with provenance
16
16
  Pi provider
17
17
  ```
18
18
 
19
- > **Project status:** Stable `0.2.0` includes M0–M20 and frozen 0.2 contracts. Prerelease `0.3.0-alpha.2` hardens the confirmation-gated `context_persistence` tool by rejecting its output-only historical egress sentinel on input, without changing canonical Pin/Memory records, SQLite schema 15, or the reference history contract. npm `latest` remains `0.2.0`; the maintenance line targets Pi `0.84.3`.
19
+ > **Project status:** Stable `0.2.0` includes M0–M20 and frozen 0.2 contracts. Published prerelease `0.3.0-alpha.2` hardens the confirmation-gated `context_persistence` tool by rejecting its output-only historical egress sentinel on input, without changing canonical Pin/Memory records, SQLite schema 15, or the reference history contract. npm `alpha` points to `0.3.0-alpha.2`, `latest` remains `0.2.0`, and the maintenance line targets Pi `0.84.3`.
20
20
 
21
21
  ## Why DS4
22
22
 
@@ -32,7 +32,9 @@ Any mapping, model, output-limit, validation, or storage error returns `undefine
32
32
  ## Critical Exact Values
33
33
  ```
34
34
 
35
- Every section must occur once, in order, and contain content or `- None`. DS4 replaces each unique `Files Read` and `Files Modified` section with one exact path per bullet from Pi's sanitized file-operation inventory before validation; missing or duplicate sections still fail. Backticked exact values must occur in the serialized segment source, ordered child-summary content, or those known file-operation paths. A bounded unsupported exact-value bullet is removed as a whole and recorded as a validation warning; unsupported prose, more than eight affected bullets, or removal above 25% still fails closed to Pi. Segment and aggregate outputs are validated independently; either unrepaired failure prevents the whole graph batch from being installed.
35
+ Every section must occur once, in order, and contain content or `- None`. DS4 replaces each unique `Files Read` and `Files Modified` section with one exact path per bullet from Pi's sanitized file-operation inventory before validation; missing or duplicate sections still fail. Backticked exact values must occur in the serialized segment source, ordered child-summary content, or those known file-operation paths. A bounded unsupported exact-value bullet is removed as a whole and recorded as a validation warning; unsupported prose, more than eight affected bullets, or removal above 25% still fails closed to Pi. The prompt explicitly asks the model to omit a bullet whose complete backticked span cannot be copied verbatim. Segment and aggregate outputs are validated independently; either unrepaired failure prevents the whole graph batch from being installed.
36
+
37
+ An unrepaired exact-value failure reports only the stage, issue code, categorical repair status, unsupported-span count, and affected-bullet count. Repair statuses distinguish an unsupported location, more than eight bullets, removal above 25%, and an unexpected invalid second validation. The disputed text is intentionally absent from logs, UI notifications, and diagnostics because it may contain sensitive source material.
36
38
 
37
39
  ## Provenance and recovery
38
40
 
@@ -41,7 +41,7 @@ The reference adapter remains on its append-only `ds4-runtime-session-v1` histor
41
41
 
42
42
  ## Known alpha.1 limitation
43
43
 
44
- The published alpha.1 historical sanitizer replaces sensitive tool arguments with `[omitted-by-ds4-egress-policy]`. If a model copies that output-only marker into a later write—most plausibly after a cancelled confirmation—alpha.1 can show a new confirmation for the literal marker. Dogfooders must refuse that dialog; accepting it can append the marker as content or metadata, although it does not recover the omitted value. Current source rejects any incoming string argument containing the marker as `egress-placeholder` before confirmation or persistence. Publishing that hardening requires a new prerelease version; the immutable alpha.1 package is not replaced.
44
+ The published alpha.1 historical sanitizer replaces sensitive tool arguments with `[omitted-by-ds4-egress-policy]`. If a model copies that output-only marker into a later write—most plausibly after a cancelled confirmation—alpha.1 can show a new confirmation for the literal marker. Dogfooders must refuse that dialog; accepting it can append the marker as content or metadata, although it does not recover the omitted value. Published `0.3.0-alpha.2` rejects any incoming string argument containing the marker as `egress-placeholder` before confirmation or persistence. The immutable alpha.1 package is not replaced.
45
45
 
46
46
  ## Package/version policy
47
47
 
@@ -1,6 +1,6 @@
1
1
  # DS4 Context Engine 0.3.0-alpha.2
2
2
 
3
- Status: release candidate approved for manual publication.
3
+ Status: published prerelease on 2026-08-27; tag `v0.3.0-alpha.2`.
4
4
 
5
5
  This coordinated prerelease hardens the `context_persistence` provider-egress boundary discovered during alpha.1 dogfooding. It adds no new persistence format, migration, default-on feature, or model-callable action.
6
6
 
@@ -28,7 +28,7 @@ ds4-context-reference-adapter
28
28
  ds4-context-engine
29
29
  ```
30
30
 
31
- Both adapters depend exactly on `ds4-context-core@0.3.0-alpha.2`. Publication uses the explicit npm `alpha` dist-tag; `latest` must remain `0.2.0`. GitHub Actions remains validation-only with OIDC and package-write permissions denied.
31
+ Both adapters depend exactly on `ds4-context-core@0.3.0-alpha.2`. The packages were published manually under the explicit npm `alpha` dist-tag while `latest` remains `0.2.0`. GitHub Actions remains validation-only with OIDC and package-write permissions denied.
32
32
 
33
33
  ## Dogfood evidence
34
34
 
@@ -48,8 +48,9 @@ Local candidate verification on Node.js `26.5.1`:
48
48
  - The committed candidate was replayed from detached clean checkout `30a5f0f`; `npm ci`, the 64-file/286-test suite, schema gate, package verification, and `git diff --check` passed.
49
49
  - `git diff --check`: passed.
50
50
  - Protected CI, compatibility golden, Pi fixture, and migration files: unchanged.
51
+ - `npm run registry:check -- 0.3.0-alpha.2`: passed against all three exact published versions; `alpha` resolves to `0.3.0-alpha.2` and `latest` remains `0.2.0` for every package.
51
52
 
52
- Exact registry verification, annotated tag, and GitHub prerelease creation remain post-publication gates.
53
+ Exact registry verification passed before the annotated tag and GitHub prerelease were created.
53
54
 
54
55
  ## Documentation
55
56
 
@@ -0,0 +1,58 @@
1
+ # DS4 Context Engine 0.3.0-alpha.3
2
+
3
+ Status: release candidate on 2026-08-30; publication and tag pending.
4
+
5
+ This coordinated prerelease hardens proactive compaction after investigation of an intermittent `unsupported-exact-value` fallback. It preserves strict exact-value grounding and Pi fallback behavior while making repair failures diagnosable without exposing disputed source text.
6
+
7
+ ## Fixed
8
+
9
+ - Tells the summary model to verify every complete backticked span verbatim and omit the whole bullet when the span is unsupported.
10
+ - Distinguishes bounded repair outcomes as `unsupported-location`, `too-many-bullets`, `removal-too-large`, and `post-prune-invalid`.
11
+ - Reports only compaction stage, validation issue code, categorical repair status, unsupported-span count, and affected-bullet count.
12
+ - Keeps rejected exact values out of logs, UI notifications, and diagnostics because they may contain sensitive source material.
13
+ - Preserves the existing limit of eight affected bullets, the 25% removal ceiling, strict second validation, and fallback to Pi default compaction.
14
+
15
+ No verbatim-comparison false positive was reproduced. A remaining unrepaired `unsupported-exact-value` result therefore continues to indicate unsupported prose, exceeded repair bounds, or an invalid post-prune summary rather than being accepted speculatively.
16
+
17
+ ## Compatibility and persistence
18
+
19
+ The summary contract and canonical compaction storage format are unchanged. Pi JSONL remains canonical and append-only; an invalid DS4 summary is never installed. SQLite remains a disposable projection. Schema 15, migrations 1–15, `ds4-context-config-v1`, `runtime-adapter-v1`, `ds4-context-persistence-tool-v1`, and `ds4-context-persistence-result-v1` are unchanged.
20
+
21
+ The change adds metadata-only diagnostic categories and no model-callable action, persistence mutation, default-on feature, or weaker validation path.
22
+
23
+ ## Package/version policy
24
+
25
+ The coordinated version is `0.3.0-alpha.3` for:
26
+
27
+ ```text
28
+ ds4-context-core
29
+ ds4-context-reference-adapter
30
+ ds4-context-engine
31
+ ```
32
+
33
+ Both adapters depend exactly on `ds4-context-core@0.3.0-alpha.3`. Publication uses the explicit npm `alpha` dist-tag so `latest` remains `0.2.0`. GitHub Actions remains validation-only with OIDC and package-write permissions denied.
34
+
35
+ ## Validation evidence
36
+
37
+ Local candidate verification on Node.js `26.5.1`:
38
+
39
+ - `npm ci`: passed.
40
+ - `npm run check`: 64 files and 288 tests passed.
41
+ - Focused compaction coverage: prompt grounding, bounded repair categories, second validation, privacy-safe diagnostics, and Pi fallback passed.
42
+ - `npm run quality:compare`: candidate quality `0.9875` versus baseline `0.808156`.
43
+ - `npm run schema:context-persistence`: 1,197 bytes and 300 estimated tokens; below the 1,500 absolute and 320 relative limits.
44
+ - `npm run latency:check -- <exact ds4-context-core@0.1.2>`: passed with ratio `1.052586`, at or below `1.10`.
45
+ - `npm run pack:check`: verified core (203 files), reference adapter (7 files), and Pi adapter (60 files) in a clean consumer.
46
+ - `npm pack --dry-run --json` for all three packages: passed with the same bounded inventories.
47
+ - The committed candidate was replayed from detached clean checkout `3e7bb32`; `npm ci`, the 64-file/288-test suite, quality, schema, package verification, and `git diff --check` passed.
48
+ - `git diff --check`: passed.
49
+ - Protected CI, compatibility golden, Pi fixture, migration, canonical Pin/Memory, and persistence-tool contract files: unchanged.
50
+
51
+ Exact registry verification, annotated tag creation, and GitHub prerelease creation remain pending until all three packages are published.
52
+
53
+ ## Documentation
54
+
55
+ - [`../COMPACTION.md`](../COMPACTION.md)
56
+ - [`../PRIVACY.md`](../PRIVACY.md)
57
+ - [`../RELEASING.md`](../RELEASING.md)
58
+ - [`0.3.0-alpha.2.md`](0.3.0-alpha.2.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ds4-context-engine",
3
- "version": "0.3.0-alpha.2",
3
+ "version": "0.3.0-alpha.3",
4
4
  "description": "Non-destructive, provider-independent context management for Pi.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -58,7 +58,7 @@
58
58
  ]
59
59
  },
60
60
  "dependencies": {
61
- "ds4-context-core": "0.3.0-alpha.2"
61
+ "ds4-context-core": "0.3.0-alpha.3"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@earendil-works/pi-ai": "0.84.3",
@@ -5,8 +5,8 @@ import type {
5
5
  SessionBeforeCompactEvent,
6
6
  } from "@earendil-works/pi-coding-agent";
7
7
  import {
8
+ analyzeUnsupportedExactValueBullets,
8
9
  groundSummaryFileSections,
9
- pruneUnsupportedExactValueBullets,
10
10
  validateSummary,
11
11
  type SummaryValidationInput,
12
12
  type SummaryValidationResult,
@@ -102,13 +102,16 @@ export async function generateValidatedSummary(
102
102
  message: "Deterministic validation disabled by configuration",
103
103
  }],
104
104
  };
105
+ let exactRepair: ReturnType<typeof analyzeUnsupportedExactValueBullets> | undefined;
106
+ let exactRepairFailure: "post-prune-invalid" | undefined;
105
107
  if (validation.status === "invalid") {
106
108
  const errors = validation.issues.filter((issue) => issue.severity === "error");
107
109
  const exactOnly = errors.length > 0
108
110
  && errors.every((issue) => issue.code === "unsupported-exact-value");
109
- const pruned = exactOnly
110
- ? pruneUnsupportedExactValueBullets(content, validationInput)
111
+ exactRepair = exactOnly
112
+ ? analyzeUnsupportedExactValueBullets(content, validationInput)
111
113
  : undefined;
114
+ const pruned = exactRepair?.result;
112
115
  if (pruned) {
113
116
  const repairedValidation = validateSummary(pruned.content, validationInput);
114
117
  if (repairedValidation.status !== "invalid") {
@@ -124,12 +127,18 @@ export async function generateValidatedSummary(
124
127
  },
125
128
  ],
126
129
  };
130
+ } else {
131
+ validation = repairedValidation;
132
+ exactRepairFailure = "post-prune-invalid";
127
133
  }
128
134
  }
129
135
  }
130
136
  if (validation.status === "invalid") {
131
137
  const codes = unique(validation.issues.map((issue) => issue.code)).join(", ");
132
- throw new Error(`Compaction ${input.stage} summary validation failed: ${codes}`);
138
+ const repairDiagnostics = exactRepair
139
+ ? `; repair=${exactRepairFailure ?? exactRepair.status}; unsupportedSpans=${exactRepair.unsupportedSpans}; affectedBullets=${exactRepair.affectedBullets}`
140
+ : "";
141
+ throw new Error(`Compaction ${input.stage} summary validation failed: ${codes}${repairDiagnostics}`);
133
142
  }
134
143
  return { content, validation, usage: response.usage };
135
144
  }
@@ -1,4 +1,4 @@
1
- export const EXTENSION_VERSION = "0.3.0-alpha.2";
1
+ export const EXTENSION_VERSION = "0.3.0-alpha.3";
2
2
  export const SUPPORTED_PI_VERSION = "0.84.3";
3
3
  export const OBSERVER_PLANNER_VERSION = "observer-model-aware-v1";
4
4
  export const PLANNER_VERSION = "managed-learned-ranking-v1";