@pi-unipi/compactor 0.1.7 → 0.2.1

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/src/types.ts CHANGED
@@ -81,6 +81,7 @@ export type OwnCutResult =
81
81
  export interface CompactorStrategyConfig {
82
82
  enabled: boolean;
83
83
  mode: string;
84
+ autoDetect?: "git" | null;
84
85
  }
85
86
 
86
87
  export interface CompactorConfig {
@@ -96,13 +97,24 @@ export interface CompactorConfig {
96
97
  sandboxExecution: CompactorStrategyConfig & { mode: "all" | "safe-only" | "off"; allowedLanguages: string[]; outputLimit: number };
97
98
  toolDisplay: CompactorStrategyConfig & { mode: "opencode" | "balanced" | "verbose" | "custom"; diffLayout: "auto" | "split" | "unified"; diffIndicator: "bars" | "classic" | "none"; showThinkingLabels: boolean; showUserMessageBox: boolean; showBashSpinner: boolean; showPendingPreviews: boolean };
98
99
 
100
+ // Pipeline features
101
+ pipeline: {
102
+ ttlCache: boolean;
103
+ autoInjection: boolean;
104
+ proximityReranking: boolean;
105
+ timelineSort: boolean;
106
+ progressiveThrottling: boolean;
107
+ mmapPragma: boolean;
108
+ customNoisePatterns: string[];
109
+ };
110
+
99
111
  // Global settings
100
112
  overrideDefaultCompaction: boolean;
101
113
  debug: boolean;
102
114
  showTruncationHints: boolean;
103
115
  }
104
116
 
105
- export type CompactorPreset = "opencode" | "balanced" | "verbose" | "minimal" | "custom";
117
+ export type CompactorPreset = "precise" | "balanced" | "thorough" | "lean" | "opencode" | "verbose" | "minimal" | "custom";
106
118
 
107
119
  // ─────────────────────────────────────────────────────────
108
120
  // Session events (from context-mode)
@@ -254,6 +266,18 @@ export interface ToolDisplayConfig {
254
266
  showRtkCompactionHints: boolean;
255
267
  }
256
268
 
269
+ // ─────────────────────────────────────────────────────────
270
+ // Runtime counters (live session stats)
271
+ // ─────────────────────────────────────────────────────────
272
+
273
+ export interface RuntimeCounters {
274
+ sandboxRuns: number;
275
+ searchQueries: number;
276
+ recallQueries: number;
277
+ compactions: number;
278
+ totalTokensCompacted: number;
279
+ }
280
+
257
281
  // ─────────────────────────────────────────────────────────
258
282
  // Info-screen integration
259
283
  // ─────────────────────────────────────────────────────────
@@ -1,65 +0,0 @@
1
- ---
2
- name: compactor-ops
3
- description: Engineering ops orchestration — batch operations, project indexing, maintenance.
4
- ---
5
-
6
- # Compactor Ops
7
-
8
- Orchestrate batch operations, project indexing, and maintenance tasks.
9
-
10
- ## Project Indexing Workflow
11
-
12
- When starting work on a new codebase:
13
-
14
- 1. **Index project files** — `/unipi:compact-index` or `ctx_index` for specific files
15
- 2. **Verify index** — `/unipi:compact-stats` to check chunk count
16
- 3. **Test search** — `/unipi:compact-search <term>` to verify quality
17
-
18
- ## Batch Code Execution
19
-
20
- Use `ctx_batch_execute` for atomic multi-step operations:
21
-
22
- ```json
23
- {
24
- "items": [
25
- { "type": "execute", "language": "shell", "code": "ls -la src/" },
26
- { "type": "execute", "language": "python", "code": "import ast; print('OK')" },
27
- { "type": "search", "query": "authentication module" }
28
- ]
29
- }
30
- ```
31
-
32
- ## Maintenance Tasks
33
-
34
- ### Clear stale index
35
- ```
36
- /unipi:compact-purge
37
- /unipi:compact-index
38
- ```
39
-
40
- ### Reset configuration
41
- ```
42
- /unipi:compact-preset balanced
43
- ```
44
-
45
- ### Full diagnostics
46
- ```
47
- /unipi:compact-doctor
48
- ```
49
-
50
- ## Integration Patterns
51
-
52
- ### Before complex task
53
- 1. `/unipi:compact` — free up context
54
- 2. `/unipi:compact-index` — index relevant files
55
- 3. Start work with fresh context + indexed search
56
-
57
- ### After long session
58
- 1. `/unipi:compact-stats` — check savings
59
- 2. `/unipi:compact` — compact if needed
60
- 3. `/unipi:compact-recall <topic>` — verify recall quality
61
-
62
- ### Research workflow
63
- 1. `ctx_fetch_and_index` — index reference docs
64
- 2. `ctx_search` — find relevant sections
65
- 3. `ctx_execute` — test hypotheses in sandbox
@@ -1,120 +0,0 @@
1
- ---
2
- name: compactor-tools
3
- description: Reference card for all compactor tools — parameters, usage, examples.
4
- ---
5
-
6
- # Compactor Tools Reference
7
-
8
- ## compact
9
-
10
- Trigger manual context compaction.
11
-
12
- ```
13
- compact()
14
- ```
15
-
16
- - Returns compaction stats (summarized, kept, tokens estimated)
17
- - Actual work done by `session_before_compact` hook
18
- - Zero LLM calls — pure regex/text processing
19
-
20
- ## vcc_recall
21
-
22
- Search session history using BM25 or regex.
23
-
24
- ```
25
- vcc_recall(query: string, mode?: "bm25" | "regex", limit?: number, offset?: number, expand?: boolean)
26
- ```
27
-
28
- - **query**: Search terms
29
- - **mode**: `bm25` (default, ranked) or `regex` (pattern match)
30
- - **limit**: Max results (default 10)
31
- - **offset**: Pagination offset
32
- - **expand**: Return full message content for hits
33
-
34
- ## ctx_execute
35
-
36
- Run code in a sandboxed environment.
37
-
38
- ```
39
- ctx_execute(language: string, code: string, timeout?: number)
40
- ```
41
-
42
- **Supported languages:** javascript, typescript, python, shell, ruby, go, rust, php, perl, r, elixir
43
-
44
- - Only stdout enters context (stderr filtered)
45
- - 100MB output cap with process kill
46
- - 30s default timeout
47
- - Auto-detects Bun for JS/TS
48
-
49
- ## ctx_execute_file
50
-
51
- Execute a file with content injected as `FILE_CONTENT`.
52
-
53
- ```
54
- ctx_execute_file(language: string, path: string, timeout?: number)
55
- ```
56
-
57
- ## ctx_batch_execute
58
-
59
- Run multiple commands atomically.
60
-
61
- ```
62
- ctx_batch_execute(items: Array<ExecuteItem | SearchItem>)
63
- ```
64
-
65
- - Execute items: `{ type: "execute", language, code, timeout? }`
66
- - Search items: `{ type: "search", query, limit? }`
67
-
68
- ## ctx_index
69
-
70
- Index content into FTS5 for fast search.
71
-
72
- ```
73
- ctx_index(label: string, content?: string, filePath?: string, contentType?: "markdown"|"json"|"plain", chunkSize?: number)
74
- ```
75
-
76
- - Provide either `content` or `filePath`
77
- - Auto-chunks by content type
78
- - Deduplicates by label
79
-
80
- ## ctx_search
81
-
82
- Query indexed content.
83
-
84
- ```
85
- ctx_search(query: string, limit?: number, offset?: number)
86
- ```
87
-
88
- - Returns ranked results with title, content, source, rank
89
- - Supports pagination via offset/limit
90
-
91
- ## ctx_fetch_and_index
92
-
93
- Fetch URL → markdown → index.
94
-
95
- ```
96
- ctx_fetch_and_index(url: string, label?: string, chunkSize?: number)
97
- ```
98
-
99
- - Converts HTML to markdown
100
- - Auto-indexes for later search
101
-
102
- ## ctx_stats
103
-
104
- Context savings dashboard.
105
-
106
- ```
107
- ctx_stats()
108
- ```
109
-
110
- Returns: session events, compactions, tokens saved, indexed docs, sandbox runs, search queries.
111
-
112
- ## ctx_doctor
113
-
114
- Diagnostics checklist.
115
-
116
- ```
117
- ctx_doctor()
118
- ```
119
-
120
- Checks: config file, session DB, content store, runtimes (node, python3, bash).