@pi-unipi/compactor 0.1.6 → 0.1.7

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-unipi/compactor",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Context engine for Pi — zero-LLM compaction, session continuity, sandbox execution, FTS5 search, and tool display optimization",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/session/db.ts CHANGED
@@ -4,8 +4,9 @@
4
4
 
5
5
  import { createHash } from "node:crypto";
6
6
  import { execFileSync } from "node:child_process";
7
+ import { existsSync, mkdirSync } from "node:fs";
7
8
  import { homedir } from "node:os";
8
- import { join } from "node:path";
9
+ import { dirname, join } from "node:path";
9
10
  import type { SessionEvent, StoredEvent, SessionMeta, ResumeRow } from "../types.js";
10
11
 
11
12
  export function getWorktreeSuffix(): string {
@@ -76,6 +77,9 @@ export class SessionDB {
76
77
  }
77
78
 
78
79
  async init(): Promise<void> {
80
+ const dir = dirname(this.dbPath);
81
+ if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
82
+
79
83
  const sqlite: any = await getSQLite();
80
84
  // Handle different SQLite API shapes:
81
85
  // - bun:sqlite exports Database as a named export