acp-kernel 0.0.96 → 0.0.97-pr.466.328

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.
@@ -1,30 +1,52 @@
1
1
  import type { CompressionState, CoreMessage } from "./types.js";
2
2
  /**
3
- * Re-mint live messages whose id collides with an already-FOLDED copy of the same
4
- * content (billion-context #1476). Runs as the FIRST pipeline node, before
5
- * assign-refs and prune, so the re-minted id is what gets ref'd and what prune sees.
3
+ * Re-mint live messages whose content identity collides with an already-FOLDED
4
+ * copy (#1476) — unless the collision is the host positionally replaying the
5
+ * very originals the block was folded from (#461). Runs as the FIRST pipeline
6
+ * node, before assign-refs and sync-blocks, so the id that survives this node
7
+ * is what gets ref'd, what sync sees, and what prune sees.
6
8
  *
7
- * Root cause: deriveMessageId's cluster counter restarts every conversion pass, so
8
- * text re-sent after its earlier copy was folded re-derives the SAME bare `h_…` id.
9
- * From that single collision: assignRefs is first-wins (`if (map.byRaw[id]) continue`)
10
- * and the folded original already owns `byRaw[h_…]`, so the fresh instance gets NO
11
- * ref; and prune drops any covered id that isn't the pinned first user message, so
12
- * the fresh user turn silently vanishes upstream.
9
+ * Two distinct situations produce a live message carrying a covered id:
13
10
  *
14
- * Why "covered base" is the discriminator: a base is covered iff an active block
15
- * lists it in effectiveMessageIds, i.e. its original is off the wire (replaced by a
16
- * summary). So any LIVE message carrying a covered id is a new instance, not the
17
- * original — and must get a distinct instance id. A NON-covered base keeps the
18
- * converter's numbering untouched: that is the shape where the old copy is still on
19
- * the wire and un-folded, where the in-pass occurrence count already keeps the pair
20
- * distinct, and touching the ids would only churn the prefix cache. Do not broaden
21
- * this to all bases.
11
+ * 1. POSITIONAL REPLAY (#461). Hosts that compress server-side resend their
12
+ * FULL raw history each request; after a fold the next request carries the
13
+ * folded originals verbatim and their deterministic ids re-derive
14
+ * identically (the cluster counter restarts per pass). Those resends ARE
15
+ * the originals: they must keep their ids so prune drops them and the
16
+ * rendered summary takes their place at the anchor (the pre-0.0.96
17
+ * contract). Re-minting them lets the folded content back onto the wire
18
+ * every turn, deactivates the block, and starves the summary of its
19
+ * carrier.
20
+ * 2. GENUINELY NEW INSTANCE (#1476). A fresh message matching folded content
21
+ * re-derives the SAME bare id in a pass where the original is not
22
+ * positionally resent (pruned view carrying the rendered summary, trimmed
23
+ * history, …). It must get a distinct instance id or assignRefs
24
+ * (first-wins on byRaw) starves it of a ref and prune silently deletes it.
22
25
  *
23
- * For each conflicting root, live instances are renumbered in arrival order to
24
- * root_1, root_2, … skipping any number a folded copy already claims. Deterministic
25
- * for a fixed (state, body): a live message whose root stays covered keeps the same
26
- * _k every turn (prefix-cache stable) and shifts only when a newer identical
27
- * instance joins the pass.
26
+ * The kernel cannot ask the host which case applies (no Ports surface), so the
27
+ * positional fingerprint distinguishes them deterministically: a block is
28
+ * REPLAYING when its rendered summary is absent AND every one of its covered
29
+ * bases is present — only a full resend of the folded population produces that
30
+ * shape. An occurrence under exclusively-replaying coverage keeps its id —
31
+ * note the single-base shape (its one covered base present, summary absent)
32
+ * IS replaying: the proxy-mode echo of a one-message fold. Only the other
33
+ * shapes (summary present, or a covered base missing while another
34
+ * representation keeps the block present) are treated as new instances and
35
+ * re-minted — erring toward shipping a duplicate rather than deleting a user
36
+ * turn.
37
+ *
38
+ * Coverage is judged per sync's own activation predicate (isBlockStillPresent,
39
+ * recomputed against THIS input) rather than the stored `active` flag: a block
40
+ * deactivated last turn (view lacked both raws and summary) reactivates this
41
+ * turn when the summary returns, and its coverage must already be visible here
42
+ * or a colliding new instance slips through un-minted and gets pruned.
43
+ * Consumed (tier-folded) and expanded blocks never cover.
44
+ *
45
+ * For each conflicting root, only the classified new instances are renumbered,
46
+ * in arrival order, to root_1, root_2, … skipping any number a folded copy
47
+ * claims and any number retained by a group member that keeps its id. Non-
48
+ * conflicting members are never touched (their refs must not churn).
49
+ * Deterministic for a fixed (state, body).
28
50
  */
29
51
  export declare function remintCoveredLiveIds(messages: CoreMessage[], state: CompressionState): CoreMessage[];
30
52
  //# sourceMappingURL=instance-reid.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"instance-reid.d.ts","sourceRoot":"","sources":["../src/instance-reid.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAahE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,WAAW,EAAE,EACvB,KAAK,EAAE,gBAAgB,GACtB,WAAW,EAAE,CAiCf"}
1
+ {"version":3,"file":"instance-reid.d.ts","sourceRoot":"","sources":["../src/instance-reid.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAmBhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,WAAW,EAAE,EACvB,KAAK,EAAE,gBAAgB,GACtB,WAAW,EAAE,CAwFf"}
package/dist/sync.d.ts CHANGED
@@ -1,7 +1,16 @@
1
- import type { CompressionState, CoreMessage } from "./types.js";
1
+ import type { CompressionBlock, CompressionState, CoreMessage } from "./types.js";
2
2
  export interface SyncResult {
3
3
  state: CompressionState;
4
4
  deactivated: string[];
5
5
  }
6
+ /**
7
+ * Whether a block still has any visible representation in a message pass: at
8
+ * least one of its covered raws is present (matched by base id, so sub-id
9
+ * projections count), or its rendered summary is. A block whose raw messages
10
+ * were replaced by its rendered summary (pruned view) is still present — the
11
+ * summary IS the block's visible representation. Without this, hosts passing
12
+ * pruned views would lose block activity every turn.
13
+ */
14
+ export declare function isBlockStillPresent(block: CompressionBlock, presentBases: ReadonlySet<string>, presentIds: ReadonlySet<string>): boolean;
6
15
  export declare function syncBlocks(messages: CoreMessage[], state: CompressionState): SyncResult;
7
16
  //# sourceMappingURL=sync.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEhE,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,gBAAgB,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,wBAAgB,UAAU,CACxB,QAAQ,EAAE,WAAW,EAAE,EACvB,KAAK,EAAE,gBAAgB,GACtB,UAAU,CAyFZ"}
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../src/sync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACZ,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,gBAAgB,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,gBAAgB,EACvB,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,EACjC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,GAC9B,OAAO,CAKT;AAED,wBAAgB,UAAU,CACxB,QAAQ,EAAE,WAAW,EAAE,EACvB,KAAK,EAAE,gBAAgB,GACtB,UAAU,CAkFZ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "acp-kernel",
3
- "version": "0.0.96",
3
+ "version": "0.0.97-pr.466.328",
4
4
  "description": "Framework-agnostic context-compression engine (model-driven, 3-tier LSM). Pure core: no host dependency.",
5
5
  "license": "MIT",
6
6
  "author": "ranxianglei",