billion-context-omp 0.2.7 → 0.2.9

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,5 +1,5 @@
1
1
  import { type BiliMessage } from "acp-kernel/wire";
2
- import { type CompressionState, type CoreMessage } from "acp-kernel";
2
+ import { type CompressionState, type Config, type CoreMessage } from "acp-kernel";
3
3
  import type { AgentMessage, BlockLike, StreamCompressCall } from "./messages.js";
4
4
  export type ProviderWireFormat = "anthropic" | "openai";
5
5
  /** Kernel format detection narrowed to the formats the omp pipeline can
@@ -10,6 +10,22 @@ export declare function payloadToCore(payload: unknown, fmt: ProviderWireFormat)
10
10
  cacheControls?: Map<string, unknown>;
11
11
  };
12
12
  export declare function coreToPayloadMessages(msgs: BiliMessage[], fmt: ProviderWireFormat, cacheControls?: Map<string, unknown>): unknown[];
13
+ export type Representability = {
14
+ ok: true;
15
+ } | {
16
+ ok: false;
17
+ reason: string;
18
+ };
19
+ /** Whether the payloadToCore → coreToPayloadMessages round-trip can rebuild
20
+ * this payload WITHOUT content loss. The sets above mirror the kernel
21
+ * codec switches; everything they do not parse is dropped or flattened on
22
+ * the rebuild. Unrepresentable payloads must fail the transform OPEN —
23
+ * pass through untouched rather than lose content (issue #3 review). */
24
+ export declare function payloadRepresentable(payload: unknown, fmt: ProviderWireFormat): Representability;
25
+ export type WireTagRenderScope = {
26
+ config: Config;
27
+ tokenCount: number;
28
+ };
13
29
  /** omp's wire tag contract (issue #66) on top of the kernel's "text-only"
14
30
  * render: the proxy keeps tool content pristine, but omp's nudge ranges
15
31
  * target tool results — the model must be able to cite them by ref, so tag
@@ -17,8 +33,16 @@ export declare function coreToPayloadMessages(msgs: BiliMessage[], fmt: Provider
17
33
  * kernel's "text-only" also tags assistant text — strip it: the model
18
34
  * echoes tags it sees on its own responses (the contract patchRefTag
19
35
  * enforced in the AgentMessage bridge). Tool-call args stay clean (replay
20
- * JSON-parses them). */
21
- export declare function applyWireTagContract(msgs: BiliMessage[], state: CompressionState): BiliMessage[];
36
+ * JSON-parses them).
37
+ *
38
+ * Rendering goes through the kernel's render-refs NODE so token counts in
39
+ * the tags come from the fold state's tokenSnapshot (written once per ref,
40
+ * reused forever) instead of being recomputed per call; the updated
41
+ * snapshot is written back into the fold state in place. Tool names are
42
+ * re-attached from the call pieces first — the codecs drop them on
43
+ * tool-result pieces and classifyType would render type="tool" where the
44
+ * context path (and the system-prompt contract) shows the real name. */
45
+ export declare function applyWireTagContract(msgs: BiliMessage[], state: CompressionState, scope: WireTagRenderScope): BiliMessage[];
22
46
  /** Stable cross-turn identity for the core-space LCP fold. The text carries
23
47
  * our own <acp> ref tags from the previous turn's output (the model sees
24
48
  * them and they ride back in the next request) — stripped before hashing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "billion-context-omp",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "One billion, not one million. Model-driven context management for the oh-my-pi (omp) coding agent.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -68,7 +68,7 @@
68
68
  "@oh-my-pi/pi-coding-agent": "17.3.8",
69
69
  "@oh-my-pi/pi-utils": "17.3.8",
70
70
  "@types/node": "^26.1.2",
71
- "acp-kernel": "0.0.28",
71
+ "acp-kernel": "0.0.31",
72
72
  "billion-context-kit": "0.2.0",
73
73
  "bun-types": "^1.3.14",
74
74
  "tsup": "^8.5.1",