omp-vcc 0.1.9 → 0.1.11

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/README.md CHANGED
@@ -90,7 +90,7 @@ Additive VCC+shake is automatic. Eager chain: `chainShakeHint:true`. Explicit mo
90
90
 
91
91
  ```sh
92
92
  bunx tsc --noEmit
93
- bun test # 661 tests, 56 files, 2095 expects, 0 fail
93
+ bun test # 800 tests, 61 files, 2396 expects, 0 fail
94
94
  bun test tests/e2e --timeout 120000 # 124 E2E
95
95
  bun run smoke # 13 checks: 3 hooks + 6 cmds + 2 tools + dedup (+ pipeline)
96
96
  omp plugin link . && omp plugin doctor
@@ -94,11 +94,9 @@ export default function (pi: ExtensionAPI): void {
94
94
 
95
95
  const q = p.query?.trim();
96
96
 
97
- if (q && parseEntryRef(q)) {
98
- const ref = parseEntryRef(q);
99
- if (!ref) {
100
- return { content: [{ type: "text", text: "Invalid entry ref query." }], details: undefined };
101
- }
97
+ const entryRef = q ? parseEntryRef(q) : null;
98
+ if (entryRef) {
99
+ const ref = entryRef;
102
100
  if (lineageEntryIds) {
103
101
  const { rendered } = loadAllMessages(sessionFile, false, lineageEntryIds);
104
102
  const exists = rendered.some((m) => m.index === ref.index);
@@ -113,11 +111,9 @@ export default function (pi: ExtensionAPI): void {
113
111
  return { content: [{ type: "text", text }], details: undefined };
114
112
  }
115
113
 
116
- if (q && parseDrillDown(q)) {
117
- const parsed = parseDrillDown(q);
118
- if (!parsed) {
119
- return { content: [{ type: "text", text: "Invalid drill-down query." }], details: undefined };
120
- }
114
+ const drill = q ? parseDrillDown(q) : null;
115
+ if (drill) {
116
+ const parsed = drill;
121
117
  if (lineageEntryIds) {
122
118
  const { rendered } = loadAllMessages(sessionFile, false, lineageEntryIds);
123
119
  const exists = rendered.some((m) => m.index === parsed.index);
@@ -248,11 +244,9 @@ export default function (pi: ExtensionAPI): void {
248
244
  }
249
245
  } catch (err: unknown) {
250
246
  const msg = err instanceof Error ? err.message : String(err);
251
- if (msg === "Compaction cancelled" || msg === "Already compacted") {
252
- try { c.ui.notify("Nothing to compact", "warning"); } catch {}
253
- } else {
254
- try { c.ui.notify(`Compaction failed: ${msg}`, "error"); } catch {}
255
- }
247
+ const cancelled = msg === "Compaction cancelled" || msg === "Already compacted";
248
+ const note = cancelled ? "Nothing to compact" : `Compaction failed: ${msg}`;
249
+ try { c.ui.notify(note, cancelled ? "warning" : "error"); } catch {}
256
250
  }
257
251
  },
258
252
  });
@@ -204,13 +204,12 @@ export function parseDrillDown(query: string): {
204
204
  }
205
205
 
206
206
  if (suffix !== undefined) {
207
- // Parse "offset" or "offset:limit"
207
+ // Parse "offset" or "offset:limit". The pattern above admits only
208
+ // numeric suffixes, so offset always parses here.
208
209
  const parts = suffix.split(":");
209
210
  const offset = parseInt(parts[0], 10);
210
211
  const limit = parts[1] !== undefined ? parseInt(parts[1], 10) : undefined;
211
- if (!Number.isNaN(offset)) {
212
- return { index, pathPattern, full: false, offset, limit };
213
- }
212
+ return { index, pathPattern, full: false, offset, limit };
214
213
  }
215
214
 
216
215
  return {
@@ -84,7 +84,7 @@ export function migrateStalePluginEntries(home?: string): string {
84
84
  if (k.startsWith("@")) {
85
85
  const scopeDir = join(nm, k.split("/")[0]!);
86
86
  try {
87
- if (fsSync.readdirSync(scopeDir).length === 0) fsSync.rmSync(scopeDir, { force: true });
87
+ if (fsSync.readdirSync(scopeDir).length === 0) fsSync.rmSync(scopeDir, { force: true, recursive: true });
88
88
  } catch {}
89
89
  }
90
90
  } catch {}
@@ -119,7 +119,7 @@ export function migrateStalePluginEntries(home?: string): string {
119
119
  if (k.startsWith("@")) {
120
120
  const scopeDir = join(nm, k.split("/")[0]!);
121
121
  try {
122
- if (fsSync.readdirSync(scopeDir).length === 0) fsSync.rmSync(scopeDir, { force: true });
122
+ if (fsSync.readdirSync(scopeDir).length === 0) fsSync.rmSync(scopeDir, { force: true, recursive: true });
123
123
  } catch {}
124
124
  }
125
125
  } catch {}
@@ -145,7 +145,7 @@ export function migrateStalePluginEntries(home?: string): string {
145
145
  if (cand.startsWith("@")) {
146
146
  const scopeDir = join(nm, cand.split("/")[0]!);
147
147
  try {
148
- if (fsSync.readdirSync(scopeDir).length === 0) fsSync.rmSync(scopeDir, { force: true });
148
+ if (fsSync.readdirSync(scopeDir).length === 0) fsSync.rmSync(scopeDir, { force: true, recursive: true });
149
149
  } catch {}
150
150
  }
151
151
  } catch {}
@@ -126,11 +126,9 @@ const mergeFileLines = (prev: string, fresh: string): string => {
126
126
  return null;
127
127
  }
128
128
  const grouped = /^ \(\+(\d+) more( under (.+?))?\): (.*)$/.exec(tail);
129
- if (grouped) {
130
- const dir = grouped[3] ?? "";
131
- return { prefix: dir && !dir.endsWith("/") ? `${dir}/` : dir, rest: grouped[4] };
132
- }
133
- return null;
129
+ if (!grouped) return null;
130
+ const dir = grouped[3] ?? "";
131
+ return { prefix: dir && !dir.endsWith("/") ? `${dir}/` : dir, rest: grouped[4] };
134
132
  };
135
133
  for (const text of [prev, fresh]) {
136
134
  let current: { cat: string; prefix: string; rest: string } | null = null;
@@ -71,9 +71,7 @@ export const IMAGE_CONTENT_CHARS = 4800;
71
71
  const safeJsonStringify = (value: unknown): string => {
72
72
  try {
73
73
  return JSON.stringify(value ?? "") ?? "";
74
- } catch {
75
- return "";
76
- }
74
+ } catch { return ""; }
77
75
  };
78
76
 
79
77
  /**
@@ -32,8 +32,8 @@ try {
32
32
 
33
33
  export { PI_VCC_COMPACT_INSTRUCTION } from "./core/compact-args";
34
34
  export const OMP_VCC_COMPACT_INSTRUCTION = "__omp_vcc__";
35
- // Accept both pi and omp sentinels for backwards compat
36
- const isVccSentinel = (s: string | undefined) => s === PI_VCC_COMPACT_INSTRUCTION || s === OMP_VCC_COMPACT_INSTRUCTION;
35
+ // (Both pi/omp sentinels are matched inline at the explicit-mode bypass in
36
+ // the session_before_compact handler below.)
37
37
 
38
38
  export interface CompactionStats {
39
39
  summarized: number;
@@ -162,20 +162,6 @@ export const triggerInvisibleContinue = (pi: ExtensionAPI): void => {
162
162
  );
163
163
  };
164
164
 
165
- const clearPendingAutoContinue = () => {
166
- clearTimeout(pendingAutoContinueTimer as any);
167
- pendingAutoContinueTimer = null;
168
- };
169
-
170
- const scheduleAutoContinue = (pi: any) => {
171
- clearPendingAutoContinue();
172
- pendingAutoContinueTimer = setTimeout(() => {
173
- pendingAutoContinueTimer = null;
174
- try {
175
- triggerInvisibleContinue(pi);
176
- } catch {}
177
- }, 0);
178
- };
179
165
 
180
166
  export const getLastCompactionStats = (pi?: any) => {
181
167
  if (pi) {
@@ -1308,11 +1294,9 @@ export const registerPiVccCommand = (pi: any) => {
1308
1294
  }
1309
1295
  },
1310
1296
  onError: (err) => {
1311
- if (err.message === "Compaction cancelled" || err.message === "Already compacted") {
1312
- ctx.ui.notify("Nothing to compact", "warning");
1313
- } else {
1314
- ctx.ui.notify(`Compaction failed: ${err.message}`, "error");
1315
- }
1297
+ const cancelled = err.message === "Compaction cancelled" || err.message === "Already compacted";
1298
+ const msg = cancelled ? "Nothing to compact" : `Compaction failed: ${err.message}`;
1299
+ ctx.ui.notify(msg, cancelled ? "warning" : "error");
1316
1300
  },
1317
1301
  });
1318
1302
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omp-vcc",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "type": "module",
5
5
  "description": "Algorithmic VCC compaction for omp - fast lossless no-LLM",
6
6
  "author": "Zhu Lin <zhulin@czl.my>",