billion-context-omp 0.2.3 → 0.2.5
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/dist/index.js +587 -701
- package/dist/index.js.map +1 -1
- package/dist/messages.d.ts +1 -1
- package/dist/runtime.d.ts +7 -5
- package/dist/wire-transform.d.ts +18 -0
- package/package.json +1 -1
- package/dist/auto-compress.d.ts +0 -69
package/dist/messages.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface StreamCompressCall {
|
|
|
20
20
|
}[];
|
|
21
21
|
}
|
|
22
22
|
export declare function findCompressCalls(message: AgentMessage): StreamCompressCall[];
|
|
23
|
-
export declare function extractText(content: unknown): string;
|
|
23
|
+
export declare function extractText(content: unknown, stripTags?: boolean): string;
|
|
24
24
|
export declare function messageIdentity(message: unknown): string;
|
|
25
25
|
export declare function matchesStoredText(stored: string, visible: string): boolean;
|
|
26
26
|
export declare function coreOutToAgentMessages(coreOut: CoreMessage[], originalById: Map<string, AgentMessage>): AgentMessage[];
|
package/dist/runtime.d.ts
CHANGED
|
@@ -30,11 +30,13 @@ export interface AcpRuntime {
|
|
|
30
30
|
* A re-fold (rewritten stream prefix) drops the slot and starts at 0. */
|
|
31
31
|
noteCompressOutcome(ctx: ExtensionContext, ok: boolean): number;
|
|
32
32
|
forgetSession(sid: string): void;
|
|
33
|
-
/** Rebuild blocks from the persisted session
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
/** Rebuild blocks from the persisted session at session_start so /acp and
|
|
34
|
+
* acp_status show them BEFORE the first LLM call of a resumed session.
|
|
35
|
+
* Provider mode folds the WIRE projection (viewToWireStream mirror — the
|
|
36
|
+
* authoritative fold runs on the wire-synthesized stream, which differs
|
|
37
|
+
* from the raw session view; issue #64). The slot is marked preview and
|
|
38
|
+
* always re-folded authoritatively at the first live event (the live
|
|
39
|
+
* stream is the truth source, not the persisted view). */
|
|
38
40
|
primeFold(ctx: ExtensionContext): void;
|
|
39
41
|
acquireLock(sid: string): Promise<() => void>;
|
|
40
42
|
}
|
package/dist/wire-transform.d.ts
CHANGED
|
@@ -47,6 +47,24 @@ export declare function synthesizeStream(payload: unknown, format: WireFormat):
|
|
|
47
47
|
* byte-identical. Only synthesized messages (nudge) are built from scratch.
|
|
48
48
|
* Returns the ORIGINAL payload object when nothing changed (cache-safe). */
|
|
49
49
|
export declare function rebuildWirePayload(rebuilt: AgentMessage[], payload: unknown, synth: SynthesisResult): unknown;
|
|
50
|
+
/** Rebuild the WIRE-SHAPE view of the persisted session (the mirror of the
|
|
51
|
+
* host's convertToLlm) and run it through the SAME synthesizeStream the
|
|
52
|
+
* live provider fold uses, so primeFold (provider mode) folds exactly the
|
|
53
|
+
* authoritative projection. The raw session view is NOT equivalent: for
|
|
54
|
+
* openai-style payloads the system prompt is a message in the wire body —
|
|
55
|
+
* it becomes the first core piece and takes m00001 — and the openai
|
|
56
|
+
* synthesis cannot recover tool names for `role:"tool"` entries (a
|
|
57
|
+
* compress result gets toolName "" instead of "compress", so it is not
|
|
58
|
+
* ref-BLOCKED there). Folding the raw view puts the fold in a different
|
|
59
|
+
* ref/fingerprint space: stored span fingerprints mismatch, the guard
|
|
60
|
+
* rejects every in-stream replay, and a resumed session shows
|
|
61
|
+
* "Blocks: none" until the first provider request (issue #64).
|
|
62
|
+
*
|
|
63
|
+
* Message shapes mirror the captured live payload (openai chat):
|
|
64
|
+
* system first; assistant text and/or tool_calls (content "" when only
|
|
65
|
+
* calls); one `role:"tool"` message per tool result; thinking dropped
|
|
66
|
+
* (the host does not carry it in this format). */
|
|
67
|
+
export declare function viewToWireStream(view: AgentMessage[], systemText: string): AgentMessage[];
|
|
50
68
|
/** True when the payload carries no messages we could fold (e.g. an empty
|
|
51
69
|
* tools-only probe). The caller bypasses instead of transforming. */
|
|
52
70
|
export declare function synthesisIsEmpty(synth: SynthesisResult): boolean;
|
package/package.json
CHANGED
package/dist/auto-compress.d.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { complete } from "@oh-my-pi/pi-ai";
|
|
2
|
-
import type { ExtensionContext } from "@oh-my-pi/pi-coding-agent";
|
|
3
|
-
import { type CoreMessage, type CompressionState, type CompressibleRange, type Prompts } from "acp-kernel";
|
|
4
|
-
import { type AgentMessage } from "./messages.js";
|
|
5
|
-
/** Reads `compressModel` from `~/.<CONFIG_DIR_NAME>/acp-omp.json as `provider:modelId`. */
|
|
6
|
-
export declare function readCompressModel(): string | null;
|
|
7
|
-
export declare function resolveCompressModel<T extends {
|
|
8
|
-
provider: string;
|
|
9
|
-
id: string;
|
|
10
|
-
}>(registry: {
|
|
11
|
-
find(provider: string, modelId: string): T | undefined;
|
|
12
|
-
}, currentModel: T | undefined, configured: string | null): {
|
|
13
|
-
model: T;
|
|
14
|
-
label: string;
|
|
15
|
-
} | null;
|
|
16
|
-
export declare function sliceRange(messages: CoreMessage[], state: CompressionState, startRef: string, endRef: string): CoreMessage[];
|
|
17
|
-
/** Pick the compressible span to compress. The kernel's recommended ranges are
|
|
18
|
-
* small groups (split at user boundaries and protected gaps) that routinely
|
|
19
|
-
* fall below `minCompressRange`, which the kernel would reject. Seed on the
|
|
20
|
-
* largest range and expand to adjacent ranges (smallest gap first) until the
|
|
21
|
-
* span covers enough text — counting every message in the span, matching the
|
|
22
|
-
* kernel's own validation. Returns null when even the whole compressible set
|
|
23
|
-
* is below the threshold. */
|
|
24
|
-
export declare function selectRangeSpan(ranges: CompressibleRange[], messages: CoreMessage[], state: CompressionState, minChars: number): {
|
|
25
|
-
startRef: string;
|
|
26
|
-
endRef: string;
|
|
27
|
-
tokens: number;
|
|
28
|
-
} | null;
|
|
29
|
-
export declare function formatSlice(slice: CoreMessage[], state: CompressionState): string;
|
|
30
|
-
export declare function parseSummary(text: string): string | null;
|
|
31
|
-
/** Build the summary-generation system prompt FROM the kernel's load-bearing
|
|
32
|
-
* compression rules (the same `Prompts` the compress tool and tier-1
|
|
33
|
-
* compression use), so /compact honors `acp-omp.json` prompt overrides and stays
|
|
34
|
-
* consistent with the rest of the ACP pipeline. `/compact` compresses an old
|
|
35
|
-
* contiguous range, so the tier-1 `howToCompressRules` are the right rule
|
|
36
|
-
* set (not tier-2/tier-3 distillation rules). */
|
|
37
|
-
export declare function buildSummaryPrompt(prompts: Prompts): string;
|
|
38
|
-
/** Generate ONE summary covering the FULL set of messages omp is about to
|
|
39
|
-
* discard on /compact (messagesToSummarize + turnPrefixMessages), matching
|
|
40
|
-
* native compaction semantics — the compaction entry omp stores afterwards
|
|
41
|
-
* is the durable record, and it truncates everything before firstKeptEntryId
|
|
42
|
-
* from the LLM view, so the summary must cover all of it. Kernel blocks are
|
|
43
|
-
* deliberately NOT used here: fold blocks only replay from in-stream
|
|
44
|
-
* compress tool calls, which the truncation removes. `previousSummary` (an
|
|
45
|
-
* earlier compaction's summary) is folded in so iterative compactions never
|
|
46
|
-
* drop it. Returns null on any failure so the caller falls back to Pi's
|
|
47
|
-
* native compaction. */
|
|
48
|
-
export declare function summarizeMessages(ctx: ExtensionContext, messages: AgentMessage[], prompts: Prompts, configuredModel?: string | null, opts?: {
|
|
49
|
-
previousSummary?: string;
|
|
50
|
-
customInstructions?: string;
|
|
51
|
-
signal?: AbortSignal;
|
|
52
|
-
completeFn?: typeof complete;
|
|
53
|
-
/** Fold-slot messageRefs — when provided, formatSlice renders stable
|
|
54
|
-
* mNNNNN refs instead of raw pN position ids (issue #14 Minor1: the
|
|
55
|
-
* model was shown p-ids it must never echo back). */
|
|
56
|
-
messageRefs?: CompressionState["messageRefs"];
|
|
57
|
-
}): Promise<{
|
|
58
|
-
summary: string;
|
|
59
|
-
model: string;
|
|
60
|
-
} | null>;
|
|
61
|
-
/** Generate a summary for a message range using the compression model. Shared
|
|
62
|
-
* entry point for the `/compact` handler. Returns null when no model is
|
|
63
|
-
* usable, the slice is empty, the model is unauthenticated, or the response
|
|
64
|
-
* is unparseable — the caller then returns `undefined` so Pi falls back to
|
|
65
|
-
* its native compaction. */
|
|
66
|
-
export declare function summarizeRange(ctx: ExtensionContext, messages: CoreMessage[], state: CompressionState, startRef: string, endRef: string, prompts: Prompts, configuredModel?: string | null): Promise<{
|
|
67
|
-
summary: string;
|
|
68
|
-
model: string;
|
|
69
|
-
} | null>;
|