@pi-unipi/compactor 2.0.7 → 2.0.8

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/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@pi-unipi/compactor",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "Context engine for Pi — zero-LLM compaction, session continuity, sandbox execution, and tool display optimization",
5
5
  "type": "module",
6
+ "main": "src/index.ts",
6
7
  "license": "MIT",
7
8
  "author": "Neuron Mr White",
8
9
  "repository": {
@@ -42,12 +43,13 @@
42
43
  },
43
44
  "dependencies": {
44
45
  "@pi-unipi/core": "*",
45
- "@pi-unipi/info-screen": "*"
46
+ "@pi-unipi/info-screen": "*",
47
+ "@earendil-works/pi-agent-core": "^0.75.5"
46
48
  },
47
49
  "peerDependencies": {
48
- "@mariozechner/pi-coding-agent": "*",
49
- "@mariozechner/pi-tui": "*",
50
- "@sinclair/typebox": "*"
50
+ "@earendil-works/pi-coding-agent": "^0.75.5",
51
+ "@earendil-works/pi-tui": "^0.75.5",
52
+ "typebox": "^1.1.38"
51
53
  },
52
54
  "devDependencies": {
53
55
  "@types/node": "^25.6.0",
@@ -5,7 +5,7 @@
5
5
  * Dependencies (sessionDB, sessionId) are injected at registration time.
6
6
  */
7
7
 
8
- import type { ExtensionAPI, ExtensionCommandContext } from "@mariozechner/pi-coding-agent";
8
+ import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
9
9
  import { loadConfig, saveConfig } from "../config/manager.js";
10
10
  import { applyPreset, parsePreset } from "../config/presets.js";
11
11
  import { COMPACTOR_INSTRUCTION } from "@pi-unipi/core";
@@ -7,8 +7,8 @@ export type OwnCutCancelReason =
7
7
  | "too_few_live_messages"
8
8
  | "no_user_message";
9
9
 
10
- import type { SessionEntry, SessionMessageEntry, CompactionEntry } from "@mariozechner/pi-coding-agent";
11
- import type { AgentMessage } from "@mariozechner/pi-agent-core";
10
+ import type { SessionEntry, SessionMessageEntry, CompactionEntry } from "@earendil-works/pi-coding-agent";
11
+ import type { AgentMessage } from "@earendil-works/pi-agent-core";
12
12
 
13
13
  export type OwnCutResult =
14
14
  | { ok: true; messages: AgentMessage[]; firstKeptEntryId: string; compactAll: boolean }
@@ -2,15 +2,15 @@
2
2
  * Hook integration — session_before_compact + session_compact
3
3
  */
4
4
 
5
- import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
6
- import { convertToLlm } from "@mariozechner/pi-coding-agent";
5
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
6
+ import { convertToLlm } from "@earendil-works/pi-coding-agent";
7
7
  import type {
8
8
  SessionEntry,
9
9
  SessionMessageEntry,
10
10
  SessionBeforeCompactEvent,
11
11
  SessionCompactEvent,
12
- } from "@mariozechner/pi-coding-agent";
13
- import type { AgentMessage } from "@mariozechner/pi-agent-core";
12
+ } from "@earendil-works/pi-coding-agent";
13
+ import type { AgentMessage } from "@earendil-works/pi-agent-core";
14
14
  import { compile } from "./summarize.js";
15
15
  import { loadConfig } from "../config/manager.js";
16
16
  import { buildOwnCut, type OwnCutResult } from "./cut.js";
@@ -2,7 +2,7 @@
2
2
  * Stage 1: Normalize — Message[] → NormalizedBlock[]
3
3
  */
4
4
 
5
- import type { Message } from "@mariozechner/pi-ai";
5
+ import type { Message } from "@earendil-works/pi-ai";
6
6
  import type { NormalizedBlock } from "../types.js";
7
7
  import { textOf } from "./content.js";
8
8
  import { sanitize } from "./sanitize.js";
@@ -2,7 +2,7 @@
2
2
  * Main compile() orchestrator — all 6 stages
3
3
  */
4
4
 
5
- import type { Message } from "@mariozechner/pi-ai";
5
+ import type { Message } from "@earendil-works/pi-ai";
6
6
  import type { CompileInput, FileOps } from "../types.js";
7
7
  import { normalizeMessages } from "./normalize.js";
8
8
  import { filterNoise } from "./filter-noise.js";
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  import type { DiffLayout } from "../types.js";
6
- import { visibleWidth, truncateToWidth } from "@mariozechner/pi-tui";
6
+ import { visibleWidth, truncateToWidth } from "@earendil-works/pi-tui";
7
7
 
8
8
  export function selectDiffLayout(
9
9
  terminalWidth: number,
@@ -3,7 +3,7 @@
3
3
  * syntax highlighting, and Nerd Font detection
4
4
  */
5
5
 
6
- import { visibleWidth, truncateToWidth } from "@mariozechner/pi-tui";
6
+ import { visibleWidth, truncateToWidth } from "@earendil-works/pi-tui";
7
7
 
8
8
  export type DiffLayout = "auto" | "split" | "unified";
9
9
  export type DiffIndicator = "bars" | "classic" | "nerd" | "none";
@@ -18,7 +18,7 @@
18
18
  * edit tool's Box nesting (approx 4-6 chars of padding).
19
19
  */
20
20
 
21
- import { visibleWidth, truncateToWidth } from "@mariozechner/pi-tui";
21
+ import { visibleWidth, truncateToWidth } from "@earendil-works/pi-tui";
22
22
 
23
23
  /** Rendering overhead from Box nesting in edit tool components */
24
24
  const RENDER_OVERHEAD = 6;
@@ -6,7 +6,7 @@
6
6
  * measurement when pi-tui is unavailable.
7
7
  */
8
8
 
9
- import { visibleWidth, truncateToWidth } from "@mariozechner/pi-tui";
9
+ import { visibleWidth, truncateToWidth } from "@earendil-works/pi-tui";
10
10
 
11
11
  /**
12
12
  * Clamp each line to maxWidth visible columns.
package/src/index.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * @pi-unipi/compactor — Extension entry point
3
3
  */
4
4
 
5
- import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
5
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
6
6
  import { MODULES, UNIPI_EVENTS, COMPACTOR_COMMANDS, COMPACTOR_TOOLS, COMPACTOR_INSTRUCTION, emitEvent } from "@pi-unipi/core";
7
7
  import { scaffoldConfig, loadConfig } from "./config/manager.js";
8
8
  import { registerCompactionHooks } from "./compaction/hooks.js";
@@ -7,8 +7,8 @@
7
7
  * branch directly.
8
8
  */
9
9
 
10
- import type { SessionEntry } from "@mariozechner/pi-coding-agent";
11
- import type { AgentMessage } from "@mariozechner/pi-agent-core";
10
+ import type { SessionEntry } from "@earendil-works/pi-coding-agent";
11
+ import type { AgentMessage } from "@earendil-works/pi-agent-core";
12
12
  import { normalizeMessages } from "../compaction/normalize.js";
13
13
  import { sanitize } from "../compaction/sanitize.js";
14
14
  import { textOf } from "../compaction/content.js";
@@ -13,8 +13,8 @@
13
13
  * ctx_stats, ctx_doctor
14
14
  */
15
15
 
16
- import { Type } from "@sinclair/typebox";
17
- import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent";
16
+ import { Type } from "typebox";
17
+ import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
18
18
  import { compactTool } from "./compact.js";
19
19
  import { vccRecall, type RecallInput } from "./vcc-recall.js";
20
20
  import { ctxExecute, type CtxExecuteInput } from "./ctx-execute.js";
@@ -140,7 +140,7 @@ export function registerCompactorTools(pi: ExtensionAPI, deps: CompactorToolDeps
140
140
  label: "Compact",
141
141
  description: "Trigger manual context compaction. Reduces session history while preserving continuity. Use dryRun:true to preview without compacting.",
142
142
  parameters: CompactParams,
143
- async execute(_toolCallId: string, params: any): Promise<import("@mariozechner/pi-coding-agent").AgentToolResult<unknown>> {
143
+ async execute(_toolCallId: string, params: any): Promise<import("@earendil-works/pi-coding-agent").AgentToolResult<unknown>> {
144
144
  if (params.dryRun) {
145
145
  const blocks = deps.getBlocks();
146
146
  const totalMessages = blocks.length;
@@ -160,7 +160,7 @@ export function registerCompactorTools(pi: ExtensionAPI, deps: CompactorToolDeps
160
160
  } as any));
161
161
 
162
162
  // 2. session_recall (new) / vcc_recall (deprecated) — search session history
163
- const recallExec = async (_toolCallId: string, params: any, _signal?: AbortSignal, _onUpdate?: unknown, ctx?: ExtensionContext): Promise<import("@mariozechner/pi-coding-agent").AgentToolResult<unknown>> => {
163
+ const recallExec = async (_toolCallId: string, params: any, _signal?: AbortSignal, _onUpdate?: unknown, ctx?: ExtensionContext): Promise<import("@earendil-works/pi-coding-agent").AgentToolResult<unknown>> => {
164
164
  const c = deps.getCounters?.();
165
165
  if (c) { c.recallQueries++; }
166
166
  const config = loadConfig(ctx?.cwd ?? process.cwd());
@@ -190,7 +190,7 @@ export function registerCompactorTools(pi: ExtensionAPI, deps: CompactorToolDeps
190
190
  pi.registerTool({ name: "vcc_recall", label: "Session Recall", description: "Search session history using BM25 or regex. (DEPRECATED: use session_recall instead)", parameters: VccRecallParams, async execute(tcId: string, p: any) { deprecationLog("vcc_recall", "session_recall"); return recallExec(tcId, p); } } as any);
191
191
 
192
192
  // 3. sandbox (new) / ctx_execute (deprecated) — run code in sandbox
193
- const sandboxExec = async (_toolCallId: string, params: any): Promise<import("@mariozechner/pi-coding-agent").AgentToolResult<unknown>> => {
193
+ const sandboxExec = async (_toolCallId: string, params: any): Promise<import("@earendil-works/pi-coding-agent").AgentToolResult<unknown>> => {
194
194
  try {
195
195
  const c = deps.getCounters?.();
196
196
  if (c) { c.sandboxRuns++; }
@@ -210,7 +210,7 @@ export function registerCompactorTools(pi: ExtensionAPI, deps: CompactorToolDeps
210
210
  pi.registerTool({ name: "ctx_execute", label: "Sandbox", description: "Run code in sandbox. (DEPRECATED: use sandbox instead)", parameters: CtxExecuteParams, async execute(tcId: string, p: any) { deprecationLog("ctx_execute", "sandbox"); return sandboxExec(tcId, p); } } as any);
211
211
 
212
212
  // 4. sandbox_file (new) / ctx_execute_file (deprecated) — execute file
213
- const sandboxFileExec = async (_toolCallId: string, params: any): Promise<import("@mariozechner/pi-coding-agent").AgentToolResult<unknown>> => {
213
+ const sandboxFileExec = async (_toolCallId: string, params: any): Promise<import("@earendil-works/pi-coding-agent").AgentToolResult<unknown>> => {
214
214
  try {
215
215
  const c = deps.getCounters?.();
216
216
  if (c) { c.sandboxRuns++; }
@@ -229,7 +229,7 @@ export function registerCompactorTools(pi: ExtensionAPI, deps: CompactorToolDeps
229
229
  pi.registerTool({ name: "ctx_execute_file", label: "Sandbox File", description: "Execute file in sandbox. (DEPRECATED: use sandbox_file instead)", parameters: CtxExecuteFileParams, async execute(tcId: string, p: any) { deprecationLog("ctx_execute_file", "sandbox_file"); return sandboxFileExec(tcId, p); } } as any);
230
230
 
231
231
  // 5. sandbox_batch (new) / ctx_batch_execute (deprecated) — atomic batch (execute only)
232
- const sandboxBatchExec = async (_toolCallId: string, params: any): Promise<import("@mariozechner/pi-coding-agent").AgentToolResult<unknown>> => {
232
+ const sandboxBatchExec = async (_toolCallId: string, params: any): Promise<import("@earendil-works/pi-coding-agent").AgentToolResult<unknown>> => {
233
233
  try {
234
234
  const c = deps.getCounters?.();
235
235
  if (c) { c.sandboxRuns++; }
@@ -248,7 +248,7 @@ export function registerCompactorTools(pi: ExtensionAPI, deps: CompactorToolDeps
248
248
  pi.registerTool({ name: "ctx_batch_execute", label: "Sandbox Batch", description: "Run batch operations. (DEPRECATED: use sandbox_batch instead)", parameters: CtxBatchExecuteParams, async execute(tcId: string, p: any) { deprecationLog("ctx_batch_execute", "sandbox_batch"); return sandboxBatchExec(tcId, p); } } as any);
249
249
 
250
250
  // 6. compactor_stats (new) / ctx_stats (deprecated) — context savings dashboard
251
- const statsExec = async (): Promise<import("@mariozechner/pi-coding-agent").AgentToolResult<unknown>> => {
251
+ const statsExec = async (): Promise<import("@earendil-works/pi-coding-agent").AgentToolResult<unknown>> => {
252
252
  try {
253
253
  const result = await ctxStats(deps.sessionDB, deps.getSessionId(), deps.getCounters?.());
254
254
  const lines = [
@@ -268,7 +268,7 @@ export function registerCompactorTools(pi: ExtensionAPI, deps: CompactorToolDeps
268
268
  pi.registerTool({ name: "ctx_stats", label: "Compactor Stats", description: "Show stats dashboard. (DEPRECATED: use compactor_stats instead)", parameters: CtxStatsParams, async execute() { deprecationLog("ctx_stats", "compactor_stats"); return statsExec(); } } as any);
269
269
 
270
270
  // 7. compactor_doctor (new) / ctx_doctor (deprecated) — diagnostics checklist
271
- const doctorExec = async (): Promise<import("@mariozechner/pi-coding-agent").AgentToolResult<unknown>> => {
271
+ const doctorExec = async (): Promise<import("@earendil-works/pi-coding-agent").AgentToolResult<unknown>> => {
272
272
  try {
273
273
  const result = await ctxDoctor(deps.sessionDB);
274
274
  const icon = (s: string) => (s === "pass" ? "✅" : s === "warn" ? "⚠️" : "❌");
@@ -291,7 +291,7 @@ export function registerCompactorTools(pi: ExtensionAPI, deps: CompactorToolDeps
291
291
  label: "Context Budget",
292
292
  description: "Estimate remaining context window (% full, tokens left) and get advice on whether to compact.",
293
293
  parameters: Type.Object({}),
294
- async execute(_toolCallId: string, _params: any, _signal?: AbortSignal, _onUpdate?: unknown, ctx?: ExtensionContext): Promise<import("@mariozechner/pi-coding-agent").AgentToolResult<unknown>> {
294
+ async execute(_toolCallId: string, _params: any, _signal?: AbortSignal, _onUpdate?: unknown, ctx?: ExtensionContext): Promise<import("@earendil-works/pi-coding-agent").AgentToolResult<unknown>> {
295
295
  const config = loadConfig(ctx?.cwd ?? process.cwd());
296
296
  const liveUsage = ctx?.getContextUsage?.();
297
297
  let estimatedTokens: number | undefined = liveUsage?.tokens ?? undefined;
@@ -7,9 +7,9 @@
7
7
  * preset preview, per-project override.
8
8
  */
9
9
 
10
- import type { Component, TUI } from "@mariozechner/pi-tui";
11
- import { truncateToWidth, visibleWidth, SettingsList, type SettingItem, type SettingsListTheme } from "@mariozechner/pi-tui";
12
- import type { Theme, KeybindingsManager } from "@mariozechner/pi-coding-agent";
10
+ import type { Component, TUI } from "@earendil-works/pi-tui";
11
+ import { truncateToWidth, visibleWidth, SettingsList, type SettingItem, type SettingsListTheme } from "@earendil-works/pi-tui";
12
+ import type { Theme, KeybindingsManager } from "@earendil-works/pi-coding-agent";
13
13
  import { loadConfig, saveConfig, projectConfigPath } from "../config/manager.js";
14
14
  import { applyPreset, detectPreset } from "../config/presets.js";
15
15
  import type { CompactorPreset } from "../types.js";
package/src/types.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * @pi-unipi/compactor — Shared TypeScript types
3
3
  */
4
4
 
5
- import type { Message } from "@mariozechner/pi-ai";
5
+ import type { Message } from "@earendil-works/pi-ai";
6
6
 
7
7
  // ─────────────────────────────────────────────────────────
8
8
  // Normalized blocks (from pi-vcc)