@seasonkoh/webaz 0.1.1 → 0.1.2

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.
@@ -4,9 +4,12 @@
4
4
  */
5
5
  import Database from 'better-sqlite3';
6
6
  import path from 'path';
7
- import { fileURLToPath } from 'url';
8
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
- const DB_PATH = path.join(__dirname, '../../../webaz.db');
7
+ import os from 'os';
8
+ import fs from 'fs';
9
+ const DATA_DIR = path.join(os.homedir(), '.webaz');
10
+ if (!fs.existsSync(DATA_DIR))
11
+ fs.mkdirSync(DATA_DIR, { recursive: true });
12
+ const DB_PATH = path.join(DATA_DIR, 'webaz.db');
10
13
  export function initDatabase() {
11
14
  const db = new Database(DB_PATH);
12
15
  db.pragma('journal_mode = WAL'); // 更好的并发性能
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seasonkoh/webaz",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Agent-native decentralized commerce protocol. Humans and AI agents trade on the same protocol via MCP tools.",
5
5
  "main": "dist/mcp.js",
6
6
  "bin": {