billion-context-omp 0.1.8 → 0.2.0

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/runtime.d.ts CHANGED
@@ -22,6 +22,10 @@ export interface AcpRuntime {
22
22
  coreMessages: CoreMessage[];
23
23
  }>;
24
24
  commitFoldState(ctx: ExtensionContext, state: CompressionState, toolCallId?: string): void;
25
+ /** Track the per-session streak of consecutively REJECTED compress calls.
26
+ * `ok=false` increments and returns the new streak; `ok=true` resets to 0.
27
+ * A re-fold (rewritten stream prefix) drops the slot and starts at 0. */
28
+ noteCompressOutcome(ctx: ExtensionContext, ok: boolean): number;
25
29
  forgetSession(sid: string): void;
26
30
  /** Rebuild blocks from the persisted session view at session_start so /acp
27
31
  * and acp_status show them BEFORE the first LLM call of a resumed session.
@@ -6,6 +6,7 @@ import type { AdapterConfig, CompressConfig, DelegateConfig } from "./config.js"
6
6
  export interface UserAcpConfig {
7
7
  debug?: boolean;
8
8
  autoUpdate?: boolean;
9
+ transformMode?: "context" | "provider";
9
10
  modelContextLimit?: number;
10
11
  toolBashDefaultTimeout?: number;
11
12
  toolOutputMaxBytes?: number;
@@ -13,6 +14,10 @@ export interface UserAcpConfig {
13
14
  compress?: CompressConfig;
14
15
  displayUsage?: "merged" | "separate";
15
16
  prompts?: Partial<Prompts>;
17
+ /** Acknowledge the risks of user-supplied compression prompts (system-prompt
18
+ * injection surface). Only honored from the GLOBAL config — a project-local
19
+ * acp-omp.json under agent control cannot pre-acknowledge its own risk gate. */
20
+ acknowledgePromptsRisk?: boolean;
16
21
  /** Model for /compact summaries, as "provider:modelId" (e.g.
17
22
  * "zhipuai:glm-5.2"). Shortcut for compress.compressModel — normalized
18
23
  * into the nested path at load time. */
@@ -0,0 +1,53 @@
1
+ import type { AgentMessage } from "./messages.js";
2
+ import type { AnthropicRequestBody } from "acp-kernel/wire";
3
+ export type WireFormat = "anthropic" | "openai" | "unknown";
4
+ interface AnthropicBlock {
5
+ type?: string;
6
+ text?: string;
7
+ id?: string;
8
+ name?: string;
9
+ input?: unknown;
10
+ tool_use_id?: string;
11
+ content?: unknown;
12
+ is_error?: boolean;
13
+ cache_control?: unknown;
14
+ [k: string]: unknown;
15
+ }
16
+ interface AnthropicWireMessage {
17
+ role: string;
18
+ content: string | AnthropicBlock[];
19
+ [k: string]: unknown;
20
+ }
21
+ interface OpenAIWireMessage {
22
+ role: string;
23
+ content?: unknown;
24
+ tool_calls?: Array<{
25
+ id: string;
26
+ function?: {
27
+ name?: string;
28
+ arguments?: string;
29
+ };
30
+ }>;
31
+ tool_call_id?: string;
32
+ [k: string]: unknown;
33
+ }
34
+ export interface SynthesisResult {
35
+ stream: AgentMessage[];
36
+ back: Array<{
37
+ wi: number;
38
+ kind: "text" | "toolCall" | "toolResult";
39
+ }>;
40
+ format: WireFormat;
41
+ }
42
+ export declare function detectWireFormat(payload: unknown): WireFormat;
43
+ export declare function synthesizeStream(payload: unknown, format: WireFormat): SynthesisResult;
44
+ /** Rebuild the wire payload from the transformed stream. Survivors reuse the
45
+ * ORIGINAL wire message objects (patched text only) so every field we do not
46
+ * understand — cache_control, citations, provider extras — passes through
47
+ * byte-identical. Only synthesized messages (nudge) are built from scratch.
48
+ * Returns the ORIGINAL payload object when nothing changed (cache-safe). */
49
+ export declare function rebuildWirePayload(rebuilt: AgentMessage[], payload: unknown, synth: SynthesisResult): unknown;
50
+ /** True when the payload carries no messages we could fold (e.g. an empty
51
+ * tools-only probe). The caller bypasses instead of transforming. */
52
+ export declare function synthesisIsEmpty(synth: SynthesisResult): boolean;
53
+ export type { AnthropicRequestBody, OpenAIWireMessage, AnthropicWireMessage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "billion-context-omp",
3
- "version": "0.1.8",
3
+ "version": "0.2.0",
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,8 +68,9 @@
68
68
  "@oh-my-pi/pi-coding-agent": "17.3.2",
69
69
  "@oh-my-pi/pi-utils": "17.3.2",
70
70
  "@types/node": "^26.1.2",
71
- "acp-kernel": "0.0.24",
71
+ "acp-kernel": "0.0.25",
72
72
  "billion-context-kit": "0.2.0",
73
+ "bun-types": "^1.3.14",
73
74
  "tsup": "^8.5.1",
74
75
  "tsx": "^4.23.1",
75
76
  "typescript": "^7.0.2"