agentgui 1.0.885 → 1.0.886

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/fixtures/data.db CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.885",
3
+ "version": "1.0.886",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "electron/main.js",
@@ -22,16 +22,27 @@ const OUT = path.resolve(argMap.out || path.join(ROOT, 'docs/screenshots'));
22
22
 
23
23
  function pickChrome() {
24
24
  if (process.env.CHROME && fs.existsSync(process.env.CHROME)) return process.env.CHROME;
25
+ const home = process.env.USERPROFILE || process.env.HOME || '';
25
26
  const candidates = [
27
+ // Linux
26
28
  '/usr/bin/chromium',
27
29
  '/usr/bin/chromium-browser',
28
30
  '/usr/bin/google-chrome',
29
31
  '/usr/bin/google-chrome-stable',
30
32
  '/snap/bin/chromium',
33
+ // macOS
31
34
  '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
35
+ '/Applications/Chromium.app/Contents/MacOS/Chromium',
36
+ // Windows — program files variants
37
+ 'C:/Program Files/Google/Chrome/Application/chrome.exe',
38
+ 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe',
39
+ path.join(home, 'AppData/Local/Google/Chrome/Application/chrome.exe'),
40
+ path.join(home, 'AppData/Local/Chromium/Application/chrome.exe'),
41
+ // puppeteer-core bundled chromium (if installed via npm)
42
+ ...(() => { try { return [require('puppeteer-core').executablePath()]; } catch { return []; } })(),
32
43
  ];
33
- for (const c of candidates) if (fs.existsSync(c)) return c;
34
- throw new Error('No chromium binary found. Set CHROME env var or apt install chromium.');
44
+ for (const c of candidates) if (c && fs.existsSync(c)) return c;
45
+ throw new Error('No chromium binary found. Set CHROME env var, install Google Chrome, or apt install chromium.');
35
46
  }
36
47
 
37
48
  async function findFreePort() {
@@ -15,9 +15,32 @@ import os from 'os';
15
15
  import crypto from 'crypto';
16
16
  import { fileURLToPath } from 'url';
17
17
  import { createRequire } from 'module';
18
+ import { initSchema } from '../database-schema.js';
19
+ import { migrateFromJson, migrateToACP, migrateConversationColumns } from '../database-migrations.js';
20
+ import { migrateACPSchema, migrateBackfillMessages, migrateFTS, migrateAutoVacuum } from '../database-migrations-acp.js';
18
21
 
19
22
  const require = createRequire(import.meta.url);
20
- const Database = require('better-sqlite3');
23
+
24
+ let Database;
25
+ try {
26
+ Database = (await import('bun:sqlite')).default;
27
+ } catch {
28
+ Database = require('better-sqlite3');
29
+ }
30
+
31
+ function openDb(path) {
32
+ try {
33
+ const db = new Database(path);
34
+ db.run('PRAGMA journal_mode = WAL');
35
+ db.run('PRAGMA foreign_keys = ON');
36
+ return db;
37
+ } catch {
38
+ const db = new Database(path);
39
+ db.pragma('journal_mode = WAL');
40
+ db.pragma('foreign_keys = ON');
41
+ return db;
42
+ }
43
+ }
21
44
 
22
45
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
23
46
  const ROOT = path.resolve(__dirname, '..');
@@ -146,35 +169,20 @@ function build() {
146
169
  fs.mkdirSync(OUT_DIR, { recursive: true });
147
170
  if (fs.existsSync(OUT_DB)) fs.unlinkSync(OUT_DB);
148
171
 
149
- const db = new Database(OUT_DB);
150
- db.pragma('journal_mode = WAL');
151
- db.pragma('foreign_keys = ON');
152
-
153
- // Inline the subset of the schema needed to render conversations.
154
- db.exec(`
155
- CREATE TABLE IF NOT EXISTS conversations (
156
- id TEXT PRIMARY KEY, agentId TEXT NOT NULL, title TEXT,
157
- created_at INTEGER NOT NULL, updated_at INTEGER NOT NULL,
158
- status TEXT DEFAULT 'active'
159
- );
160
- CREATE INDEX IF NOT EXISTS idx_conversations_agent ON conversations(agentId);
161
- CREATE INDEX IF NOT EXISTS idx_conversations_updated ON conversations(updated_at DESC);
162
-
163
- CREATE TABLE IF NOT EXISTS messages (
164
- id TEXT PRIMARY KEY, conversationId TEXT NOT NULL, role TEXT NOT NULL,
165
- content TEXT NOT NULL, created_at INTEGER NOT NULL
166
- );
167
- CREATE INDEX IF NOT EXISTS idx_messages_conversation ON messages(conversationId);
168
-
169
- CREATE TABLE IF NOT EXISTS sessions (
170
- id TEXT PRIMARY KEY, conversationId TEXT NOT NULL, status TEXT NOT NULL,
171
- started_at INTEGER NOT NULL, completed_at INTEGER, response TEXT, error TEXT
172
- );
173
- CREATE INDEX IF NOT EXISTS idx_sessions_conversation ON sessions(conversationId);
174
- `);
175
-
176
- const insConv = db.prepare(`INSERT INTO conversations (id, agentId, title, created_at, updated_at, status)
177
- VALUES (?, ?, ?, ?, ?, ?)`);
172
+ const db = openDb(OUT_DB);
173
+
174
+ // Use the real schema pipeline — same as database.js so fixture DB always matches production.
175
+ initSchema(db);
176
+ migrateFromJson(db, path.join(OUT_DIR, 'nonexistent.json'));
177
+ migrateToACP(db);
178
+ migrateConversationColumns(db);
179
+ migrateACPSchema(db);
180
+ migrateBackfillMessages(db);
181
+ migrateFTS(db);
182
+ migrateAutoVacuum(db);
183
+
184
+ const insConv = db.prepare(`INSERT INTO conversations (id, agentId, agentType, title, created_at, updated_at, status)
185
+ VALUES (?, ?, ?, ?, ?, ?, ?)`);
178
186
  const insMsg = db.prepare(`INSERT INTO messages (id, conversationId, role, content, created_at)
179
187
  VALUES (?, ?, ?, ?, ?)`);
180
188
  const insSess = db.prepare(`INSERT INTO sessions (id, conversationId, status, started_at, completed_at, response, error)
@@ -185,7 +193,7 @@ function build() {
185
193
  DEMO_TITLES.forEach((title, idx) => {
186
194
  const convId = det('conv', title);
187
195
  const ts = BASE_TS - idx * 3600 * 1000; // newest first
188
- insConv.run(convId, 'claude-code', title, ts, ts, 'active');
196
+ insConv.run(convId, 'claude-code', 'direct', title, ts, ts, 'active');
189
197
 
190
198
  const userText = realPrompts[idx] || synthUser(title);
191
199
  const assistantText = synthAssistant(title);