billion-context-omp 0.3.2 → 0.3.3-pr.146.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.
@@ -8,36 +8,11 @@ export declare function streamToCoreMessages(stream: AgentMessage[]): CoreMessag
8
8
  * skip replaying compress calls that were REJECTED live ("No changes
9
9
  * applied") — only calls that actually created blocks should rebuild them. */
10
10
  export declare function toolResultTexts(stream: AgentMessage[]): Map<string, string>;
11
- export interface StreamCompressCall {
12
- id: string;
13
- ranges: {
14
- startRef: string;
15
- endRef: string;
16
- summary: string;
17
- topic?: string;
18
- summaryMaxChars?: number;
19
- compressCallId: string;
20
- }[];
21
- }
11
+ export type { StreamCompressCall } from "acp-kernel/wire";
12
+ import type { StreamCompressCall } from "acp-kernel/wire";
22
13
  export declare function findCompressCalls(message: AgentMessage): StreamCompressCall[];
23
- /** Extract a compress tool's arguments from a stream toolCall. Two call
24
- * shapes exist: (1) top-level — our tools are registered with
25
- * loadMode:"essential" so omp's tools.xdev does NOT mount them as xd://
26
- * devices; the stream shows name:"compress" directly. (2) legacy xd:// —
27
- * sessions recorded before that change (or hosts with tools.xdev forcing
28
- * discoverable mounting) invoked compress through the write tool with path
29
- * "xd://compress" and the tool args JSON-encoded in the content field. Both
30
- * shapes must replay from the stream. Returns normalized compress args
31
- * (content array
32
- * plus optional topic / summaryMaxChars from wherever they live). */
33
- export declare function compressToolArgs(call: {
34
- name: string;
35
- arguments?: unknown;
36
- }): {
37
- content: unknown[];
38
- topic?: unknown;
39
- summaryMaxChars?: unknown;
40
- } | null;
14
+ import { compressToolArgs } from "acp-kernel/wire";
15
+ export { compressToolArgs };
41
16
  export declare function extractText(content: unknown, stripTags?: boolean): string;
42
17
  export declare function stripRefTag(text: string): string;
43
18
  export declare function messageIdentity(message: unknown): string;
@@ -1,6 +1,6 @@
1
1
  import { type BiliMessage, type MirrorMessage, type ResponsesProjection } from "acp-kernel/wire";
2
- import { type CompressionState, type Config, type CoreMessage } from "acp-kernel";
3
- import type { AgentMessage, BlockLike, StreamCompressCall } from "./messages.js";
2
+ import { type CompressionState, type Config } from "acp-kernel";
3
+ import type { AgentMessage } from "./messages.js";
4
4
  export type ProviderWireFormat = "anthropic" | "openai" | "responses";
5
5
  /** Kernel format detection narrowed to the formats the omp pipeline can
6
6
  * rebuild onto the wire. null = fail-open (pass the payload through).
@@ -78,84 +78,8 @@ export declare function applyWireTagContract(msgs: BiliMessage[], state: Compres
78
78
  * them and they ride back in the next request) — stripped before hashing
79
79
  * so re-folds of an unmutated prefix stay incremental. */
80
80
  export declare function coreIdentity(msg: BiliMessage): string;
81
- /** toolCallId toolName from the stream's tool-call pieces. The kernel
82
- * codecs do not carry tool names on tool-result pieces, so protection
83
- * checks (compress results stay ref-BLOCKED) resolve the name here. */
84
- export declare function toolCallNames(msgs: BiliMessage[]): Map<string, string>;
85
- export declare function toolResultTextsCore(msgs: BiliMessage[]): Map<string, string>;
86
- /** Compress calls carried by a core tool-call piece. Same two shapes as the
87
- * AgentMessage stream (direct compress; legacy xd://compress via write),
88
- * with the arguments JSON-encoded in the piece's text. */
89
- export declare function findCompressCallsCore(msg: BiliMessage): StreamCompressCall[];
90
- /** Span fingerprint in content-hash space: hash the content keys of the
91
- * exact first/last covered pieces. Boundary ids are pre-resolved (byRef /
92
- * block lookup) — unlike the pN-space spanFingerprint there is no
93
- * position parsing, ids are unique per piece. */
94
- export declare function spanFingerprintCore(coreMessages: CoreMessage[], startId: string, endId: string): string;
95
- /** Index-based span fingerprint (issue #91 replay fallback): hash the content
96
- * keys of the pieces AT the given stream positions. The stored fp still
97
- * decides keep/drop — the position is only a recovery hint for a drifted
98
- * boundary whose content-hash id no longer matches, so a benign tail drift
99
- * (first-4096 intact) is kept while a real rewrite mismatches. */
100
- export declare function spanFingerprintCoreIdx(coreMessages: CoreMessage[], startIdx: number, endIdx: number): string;
101
- /** Resolve a range boundary to the exact id of the piece it names, in
102
- * content-hash space. Message refs go through byRef; block refs resolve to
103
- * the earliest (min) or latest (max) covered piece by STREAM ORDER
104
- * (index in coreMessages — the hash ids carry no position). */
105
- export declare function boundaryRawCore(ref: string, byRef: Record<string, string>, blocks: BlockLike[], coreMessages: CoreMessage[], pick: "min" | "max"): string;
106
- /** Resolve a range boundary to its STREAM INDEX in content-hash space. byRef /
107
- * block lookup first (the exact piece it names, by array order); on a missed
108
- * id (a drift re-hashed the piece so its carried ref dangles) fall back to
109
- * the compress-time recorded index — the position hint, issue #91. -1 =
110
- * unresolvable. */
111
- export declare function boundaryIndexCore(ref: string, byRef: Record<string, string>, blocks: BlockLike[], coreMessages: CoreMessage[], pick: "min" | "max", fallbackIdx?: number): number;
112
- /** Structured replay-guard verdict (issue #91, rework): the position
113
- * fallback recovers the STREAM INDEX of a drifted boundary, but the kernel
114
- * resolves ranges by REF — so when a recorded m-ref dangles, the replay
115
- * must re-apply that boundary under the CURRENT ref of the recovered piece.
116
- * `remap` carries exactly that (only dangling m-refs are remapped; block
117
- * refs resolve themselves inside the kernel and are never touched). */
118
- export type ReplayRangeVerdict = {
119
- /** Stale: the range must be dropped (master semantics, unchanged). */
120
- reject?: string;
121
- /** Dangling m-refs recovered by position, remapped to current refs. */
122
- remap?: {
123
- startRef?: string;
124
- endRef?: string;
125
- };
126
- /** True when the result text carried a [pos=] pair for this range —
127
- * with `reject` set it marks a RECOVERY FAILURE (always logged). */
128
- hint?: boolean;
129
- /** Diagnostics — always logged when a recovery happens. */
130
- recovered?: {
131
- pos: string;
132
- startIdx: number;
133
- endIdx: number;
134
- };
135
- };
136
- /** Current m-ref of the piece at stream index idx (inverse byRef scan).
137
- * "" when the piece has no ref (protected) — the replay must fail closed
138
- * rather than hand the kernel a ref it does not know. Replay-time only
139
- * (replayed compress calls), so the O(refs) scan stays off the hot path. */
140
- export declare function refOfPieceCore(coreMessages: BiliMessage[], idx: number, byRef: Record<string, string>): string;
141
- export declare function staleRangeCore(r: {
142
- startRef: string;
143
- endRef: string;
144
- }, rangeIndex: number, resultText: string, coreMessages: BiliMessage[], callIndex: number, byRef: Record<string, string>, blocks: BlockLike[]): ReplayRangeVerdict;
145
- /** One fingerprint per range for the replay guard, content-hash space
146
- * (mirrors rangeFingerprints for the pN space). */
147
- export declare function rangeFingerprintsCore(ranges: Array<{
148
- startRef: string;
149
- endRef: string;
150
- }>, coreMessages: BiliMessage[], byRef: Record<string, string>, blocks: BlockLike[]): string[];
151
- /** One boundary-index pair per range for the replay fallback (issue #91),
152
- * aligned with rangeFingerprintsCore: the stream index of each range's exact
153
- * first/last covered piece at record time ("-1" pair when a boundary can't
154
- * be positioned), so the replay can recover a drifted boundary by position. */
155
- export declare function rangePositionsCore(ranges: Array<{
156
- startRef: string;
157
- endRef: string;
158
- }>, coreMessages: CoreMessage[], byRef: Record<string, string>, blocks: BlockLike[]): string[];
81
+ export { toolCallNames, toolResultTextsCore, findCompressCallsCore, spanFingerprintCore, spanFingerprintCoreIdx, boundaryRawCore, boundaryIndexCore, refOfPieceCore, staleRangeCore, rangeFingerprintsCore, rangePositionsCore, } from "acp-kernel/wire";
82
+ export type { ReplayRangeVerdict } from "acp-kernel/wire";
159
83
  /** Map the persisted session view onto the kernel's neutral MirrorMessage:
160
84
  * the only omp-side shape knowledge left in this module — ref-tag
161
85
  * stripping (a persisted-format concern, messages.ts) and the pi block
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "billion-context-omp",
3
- "version": "0.3.2",
3
+ "version": "0.3.3-pr.146.13",
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.41",
71
+ "acp-kernel": "0.0.43",
72
72
  "bun-types": "^1.3.14",
73
73
  "tsup": "^8.5.1",
74
74
  "tsx": "^4.23.1",