openfox 1.6.75 → 1.6.76

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.
Files changed (65) hide show
  1. package/dist/{ask-3RK5YJZE.js → ask-5SSOA6SZ.js} +2 -2
  2. package/dist/{auth-LZZX63KI.js → auth-56SIRACI.js} +3 -6
  3. package/dist/auto-compaction-V3PA77WG.js +27 -0
  4. package/dist/{branch.api-XADFZZAA.js → branch.api-PWFW26KC.js} +2 -2
  5. package/dist/{chat-handler-KYMMXPP6.js → chat-handler-7DKHGTVO.js} +31 -29
  6. package/dist/{chunk-5UTTLO4D.js → chunk-5ZD3GZTK.js} +89 -49
  7. package/dist/{chunk-AFATQ5LJ.js → chunk-B5AP3RSV.js} +1 -1
  8. package/dist/{chunk-22CTURMH.js → chunk-BJYPTN5S.js} +1 -1
  9. package/dist/{chunk-DLINTLB7.js → chunk-BSTVRSV6.js} +7 -5
  10. package/dist/{chunk-7JPKRM6M.js → chunk-CMQCO27Y.js} +22 -12
  11. package/dist/{chunk-R4HADRYO.js → chunk-CQGTEGKL.js} +1 -1
  12. package/dist/{chunk-J5DV33SS.js → chunk-CUDAT6SS.js} +46 -18
  13. package/dist/{chunk-ETIXH35K.js → chunk-H5EICXF3.js} +499 -277
  14. package/dist/{chunk-XIZ6B6IS.js → chunk-K2V7EW5F.js} +541 -299
  15. package/dist/{chunk-PNBH3RAX.js → chunk-K44MW7JJ.js} +1 -1
  16. package/dist/{chunk-BLNFJ22S.js → chunk-KIOUKC3Z.js} +6 -4
  17. package/dist/{chunk-4CQ7CUQ6.js → chunk-LCQ3MPXD.js} +5 -5
  18. package/dist/{chunk-CTAIXOZJ.js → chunk-NDJ6FKSP.js} +1 -1
  19. package/dist/{chunk-IA4O65CR.js → chunk-NHJ2GVCF.js} +100 -68
  20. package/dist/{chunk-GQZGIMJO.js → chunk-OXI26S7U.js} +12 -7
  21. package/dist/{chunk-NBU6KIOD.js → chunk-PBGOZMVY.js} +4 -4
  22. package/dist/{chunk-B7E3BICY.js → chunk-RGRBWDZP.js} +2 -4
  23. package/dist/{chunk-VIGOXEZG.js → chunk-RQ4XSKUR.js} +15 -16
  24. package/dist/{chunk-KFBIHS3S.js → chunk-STYHKCG7.js} +20 -14
  25. package/dist/{chunk-55Z3DJ7G.js → chunk-TGWEH2BC.js} +10 -11
  26. package/dist/{chunk-TYUNDOX2.js → chunk-UKMRZDWM.js} +90 -41
  27. package/dist/{chunk-PFRQO5Z3.js → chunk-VAMTEAYI.js} +49 -27
  28. package/dist/{chunk-574HZVLE.js → chunk-VRGRAQDG.js} +2 -2
  29. package/dist/{chunk-JQBTYHUR.js → chunk-WR6QCJJO.js} +53 -15
  30. package/dist/{chunk-RBPOAAIZ.js → chunk-XKIEDGQF.js} +22 -18
  31. package/dist/cli/dev.js +2 -2
  32. package/dist/cli/index.js +2 -2
  33. package/dist/{config-6T4EHAP2.js → config-5CONAOL7.js} +7 -7
  34. package/dist/{events-LKEZ3YCW.js → events-BDXQOC7F.js} +6 -6
  35. package/dist/{folding-JN2WT44N.js → folding-2HW7FIKL.js} +2 -2
  36. package/dist/{inspect-proxy-Y4MRAVB7.js → inspect-proxy-Y75AXMRX.js} +3 -3
  37. package/dist/{manager-HM2J5VMW.js → manager-W7N3XQ4Q.js} +3 -3
  38. package/dist/orchestrator-KCHEENHK.js +43 -0
  39. package/dist/package.json +19 -3
  40. package/dist/{paths-ZRI56O63.js → paths-X46PPOI2.js} +2 -2
  41. package/dist/{processor-23O4HPSS.js → processor-6TS37IYH.js} +15 -11
  42. package/dist/{project-creator-LASKNQPA.js → project-creator-VD7MLOWE.js} +8 -5
  43. package/dist/{projects-HEUOWNSR.js → projects-XLMSDFTQ.js} +4 -4
  44. package/dist/{protocol-5AWNGFLH.js → protocol-4CTV7OZC.js} +3 -3
  45. package/dist/{protocol-DRBnujwe.d.ts → protocol-4xbfAlGO.d.ts} +3 -0
  46. package/dist/{provider-AKN355YH.js → provider-ESEBV3LL.js} +15 -11
  47. package/dist/{pwa-GHQCMCIU.js → pwa-76XP2DY2.js} +2 -2
  48. package/dist/{runtime-config-ZCK74XKM.js → runtime-config-CBJJJGBD.js} +2 -2
  49. package/dist/{serve-TW63YCNQ.js → serve-OLDABBV3.js} +29 -27
  50. package/dist/server/index.d.ts +6 -1
  51. package/dist/server/index.js +22 -22
  52. package/dist/server/public/__inspect__.js +2 -1
  53. package/dist/{service-74Z7JK2J.js → service-D6LC3CAM.js} +3 -2
  54. package/dist/{settings-NI4ITGV6.js → settings-TQNQB56H.js} +4 -4
  55. package/dist/shared/index.d.ts +2 -2
  56. package/dist/shared/index.js +2 -2
  57. package/dist/{store-2IF3ZSLD.js → store-OQ45KONN.js} +2 -2
  58. package/dist/{tools-RUAY6EVI.js → tools-BHYHS3RY.js} +18 -18
  59. package/dist/{vision-fallback-AXH3BGJC.js → vision-fallback-ED27LH6C.js} +3 -3
  60. package/dist/web/assets/{index-CWdKiSP8.js → index-DAuZ02-Q.js} +57 -57
  61. package/dist/web/index.html +1 -1
  62. package/dist/web/sw.js +1 -1
  63. package/package.json +19 -3
  64. package/dist/auto-compaction-OW4P2QWQ.js +0 -27
  65. package/dist/orchestrator-QP4O7MUM.js +0 -43
@@ -6,7 +6,7 @@ import {
6
6
  cancelQuestionsForSession,
7
7
  hasPendingQuestion,
8
8
  provideAnswer
9
- } from "./chunk-22CTURMH.js";
9
+ } from "./chunk-BJYPTN5S.js";
10
10
  export {
11
11
  AskUserInterrupt,
12
12
  askUserTool,
@@ -16,4 +16,4 @@ export {
16
16
  hasPendingQuestion,
17
17
  provideAnswer
18
18
  };
19
- //# sourceMappingURL=ask-3RK5YJZE.js.map
19
+ //# sourceMappingURL=ask-5SSOA6SZ.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getAuthConfigPath
3
- } from "./chunk-R4HADRYO.js";
3
+ } from "./chunk-CQGTEGKL.js";
4
4
 
5
5
  // src/cli/auth.ts
6
6
  import { readFile, writeFile, mkdir, access } from "fs/promises";
@@ -30,10 +30,7 @@ async function authConfigExists(mode) {
30
30
  }
31
31
  }
32
32
  function encryptPassword(password, publicKey) {
33
- const encrypted = publicEncrypt(
34
- { key: publicKey, padding: 1 },
35
- Buffer.from(password)
36
- );
33
+ const encrypted = publicEncrypt({ key: publicKey, padding: 1 }, Buffer.from(password));
37
34
  return encrypted.toString("base64");
38
35
  }
39
36
  function hashPassword(password) {
@@ -50,4 +47,4 @@ export {
50
47
  saveAuthConfig,
51
48
  verifyPassword
52
49
  };
53
- //# sourceMappingURL=auth-LZZX63KI.js.map
50
+ //# sourceMappingURL=auth-56SIRACI.js.map
@@ -0,0 +1,27 @@
1
+ import {
2
+ maybeAutoCompactContext,
3
+ performManualContextCompaction,
4
+ resolveCompactionStatsIdentity
5
+ } from "./chunk-H5EICXF3.js";
6
+ import "./chunk-OXI26S7U.js";
7
+ import "./chunk-CMQCO27Y.js";
8
+ import "./chunk-XKIEDGQF.js";
9
+ import "./chunk-PBGOZMVY.js";
10
+ import "./chunk-VRGRAQDG.js";
11
+ import "./chunk-CUDAT6SS.js";
12
+ import "./chunk-5ZD3GZTK.js";
13
+ import "./chunk-KIOUKC3Z.js";
14
+ import "./chunk-VAMTEAYI.js";
15
+ import "./chunk-STYHKCG7.js";
16
+ import "./chunk-BJYPTN5S.js";
17
+ import "./chunk-NDJ6FKSP.js";
18
+ import "./chunk-CQGTEGKL.js";
19
+ import "./chunk-B5AP3RSV.js";
20
+ import "./chunk-BSTVRSV6.js";
21
+ import "./chunk-K44MW7JJ.js";
22
+ export {
23
+ maybeAutoCompactContext,
24
+ performManualContextCompaction,
25
+ resolveCompactionStatsIdentity
26
+ };
27
+ //# sourceMappingURL=auto-compaction-V3PA77WG.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-PNBH3RAX.js";
3
+ } from "./chunk-K44MW7JJ.js";
4
4
 
5
5
  // src/server/branch.api.ts
6
6
  import { spawn } from "child_process";
@@ -45,4 +45,4 @@ function getGitBranch(cwd) {
45
45
  export {
46
46
  getCurrentBranch
47
47
  };
48
- //# sourceMappingURL=branch.api-XADFZZAA.js.map
48
+ //# sourceMappingURL=branch.api-PWFW26KC.js.map
@@ -5,35 +5,35 @@ import {
5
5
  generateSessionName,
6
6
  getSessionMessageCount,
7
7
  needsNameGenerationCheck
8
- } from "./chunk-4CQ7CUQ6.js";
8
+ } from "./chunk-LCQ3MPXD.js";
9
9
  import {
10
10
  runChatTurn
11
- } from "./chunk-IA4O65CR.js";
12
- import "./chunk-ETIXH35K.js";
13
- import "./chunk-GQZGIMJO.js";
14
- import "./chunk-7JPKRM6M.js";
15
- import "./chunk-RBPOAAIZ.js";
16
- import "./chunk-NBU6KIOD.js";
17
- import "./chunk-574HZVLE.js";
18
- import "./chunk-J5DV33SS.js";
11
+ } from "./chunk-NHJ2GVCF.js";
12
+ import "./chunk-H5EICXF3.js";
13
+ import "./chunk-OXI26S7U.js";
14
+ import "./chunk-CMQCO27Y.js";
15
+ import "./chunk-XKIEDGQF.js";
16
+ import "./chunk-PBGOZMVY.js";
17
+ import "./chunk-VRGRAQDG.js";
18
+ import "./chunk-CUDAT6SS.js";
19
19
  import {
20
20
  getEventStore
21
- } from "./chunk-5UTTLO4D.js";
22
- import "./chunk-BLNFJ22S.js";
23
- import "./chunk-PFRQO5Z3.js";
21
+ } from "./chunk-5ZD3GZTK.js";
22
+ import "./chunk-KIOUKC3Z.js";
23
+ import "./chunk-VAMTEAYI.js";
24
24
  import {
25
25
  createChatMessageMessage,
26
26
  createPhaseChangedMessage,
27
27
  createSessionRunningMessage
28
- } from "./chunk-KFBIHS3S.js";
29
- import "./chunk-22CTURMH.js";
30
- import "./chunk-CTAIXOZJ.js";
31
- import "./chunk-R4HADRYO.js";
32
- import "./chunk-AFATQ5LJ.js";
33
- import "./chunk-DLINTLB7.js";
28
+ } from "./chunk-STYHKCG7.js";
29
+ import "./chunk-BJYPTN5S.js";
30
+ import "./chunk-NDJ6FKSP.js";
31
+ import "./chunk-CQGTEGKL.js";
32
+ import "./chunk-B5AP3RSV.js";
33
+ import "./chunk-BSTVRSV6.js";
34
34
  import {
35
35
  logger
36
- } from "./chunk-PNBH3RAX.js";
36
+ } from "./chunk-K44MW7JJ.js";
37
37
 
38
38
  // src/server/session/chat-handler.ts
39
39
  var activeAgents = /* @__PURE__ */ new Map();
@@ -61,7 +61,7 @@ async function startChatSession(sessionId, content, deps, options) {
61
61
  sessionManager.setRunning(sessionId, true);
62
62
  broadcastForSession(sessionId, createSessionRunningMessage(true));
63
63
  try {
64
- const { maybeAutoCompactContext } = await import("./auto-compaction-OW4P2QWQ.js");
64
+ const { maybeAutoCompactContext } = await import("./auto-compaction-V3PA77WG.js");
65
65
  await maybeAutoCompactContext({
66
66
  sessionManager,
67
67
  sessionId,
@@ -121,14 +121,16 @@ async function startChatSession(sessionId, content, deps, options) {
121
121
  }
122
122
  function startTurnWithCompletionChain(sessionId, controller, deps) {
123
123
  const { sessionManager, llmClient, statsIdentity, broadcastForSession } = deps;
124
- runChatTurn(buildRunChatTurnParams({
125
- sessionManager,
126
- sessionId,
127
- llmClient,
128
- statsIdentity,
129
- signal: controller.signal,
130
- onMessage: (msg) => broadcastForSession(sessionId, msg)
131
- })).catch((error) => {
124
+ runChatTurn(
125
+ buildRunChatTurnParams({
126
+ sessionManager,
127
+ sessionId,
128
+ llmClient,
129
+ statsIdentity,
130
+ signal: controller.signal,
131
+ onMessage: (msg) => broadcastForSession(sessionId, msg)
132
+ })
133
+ ).catch((error) => {
132
134
  if (error instanceof Error && error.message === "Aborted") {
133
135
  return;
134
136
  }
@@ -170,4 +172,4 @@ export {
170
172
  startChatSession,
171
173
  stopSessionExecution
172
174
  };
173
- //# sourceMappingURL=chat-handler-KYMMXPP6.js.map
175
+ //# sourceMappingURL=chat-handler-7DKHGTVO.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getDatabase
3
- } from "./chunk-BLNFJ22S.js";
3
+ } from "./chunk-KIOUKC3Z.js";
4
4
  import {
5
5
  buildContextMessagesFromEventHistory,
6
6
  buildMessagesFromStoredEvents,
@@ -9,13 +9,13 @@ import {
9
9
  foldSessionState,
10
10
  spreadOptionalMessageFields,
11
11
  stripPromptContextMessages
12
- } from "./chunk-PFRQO5Z3.js";
12
+ } from "./chunk-VAMTEAYI.js";
13
13
  import {
14
14
  getRuntimeConfig
15
- } from "./chunk-AFATQ5LJ.js";
15
+ } from "./chunk-B5AP3RSV.js";
16
16
  import {
17
17
  logger
18
- } from "./chunk-PNBH3RAX.js";
18
+ } from "./chunk-K44MW7JJ.js";
19
19
 
20
20
  // src/server/events/store.ts
21
21
  function createEventIterator(state, subscriber) {
@@ -307,7 +307,7 @@ var EventStore = class {
307
307
  /**
308
308
  * Delete all events up to (and including) a given sequence number.
309
309
  * This is used to clean up events that are now contained in a snapshot.
310
- *
310
+ *
311
311
  * @param sessionId - The session ID
312
312
  * @param upToSeq - The sequence number to delete up to (inclusive)
313
313
  * @returns The number of events deleted
@@ -322,9 +322,9 @@ var EventStore = class {
322
322
  * - All snapshot events
323
323
  * - State-changing events (criteria.set, criterion.updated, mode.changed, phase.changed, context.state, etc.)
324
324
  * - Events after the latest snapshot (current window)
325
- *
325
+ *
326
326
  * This is the recommended cleanup method that preserves all snapshots and state.
327
- *
327
+ *
328
328
  * @param sessionId - The session ID
329
329
  * @returns The number of events deleted
330
330
  */
@@ -333,7 +333,8 @@ var EventStore = class {
333
333
  if (latestSnapshotSeq === 0) {
334
334
  return 0;
335
335
  }
336
- const result = this.db.prepare(`
336
+ const result = this.db.prepare(
337
+ `
337
338
  DELETE FROM events
338
339
  WHERE session_id = ? AND seq > 1 AND seq < ?
339
340
  AND event_type NOT IN (
@@ -344,7 +345,8 @@ var EventStore = class {
344
345
  'todo.updated',
345
346
  'context.state'
346
347
  )
347
- `).run(sessionId, latestSnapshotSeq);
348
+ `
349
+ ).run(sessionId, latestSnapshotSeq);
348
350
  return result.changes;
349
351
  }
350
352
  /**
@@ -355,7 +357,8 @@ var EventStore = class {
355
357
  optimizeStorage() {
356
358
  let deletedSnapshots = 0;
357
359
  let strippedSnapshots = 0;
358
- const deleteResult = this.db.prepare(`
360
+ const deleteResult = this.db.prepare(
361
+ `
359
362
  DELETE FROM events
360
363
  WHERE event_type = 'turn.snapshot'
361
364
  AND id NOT IN (
@@ -367,7 +370,8 @@ var EventStore = class {
367
370
  AND e2.event_type = 'turn.snapshot'
368
371
  )
369
372
  )
370
- `).run();
373
+ `
374
+ ).run();
371
375
  deletedSnapshots = deleteResult.changes;
372
376
  const snapshots = this.db.prepare(`SELECT id, payload FROM events WHERE event_type = 'turn.snapshot'`).all();
373
377
  const updateStmt = this.db.prepare(`UPDATE events SET payload = ? WHERE id = ?`);
@@ -388,11 +392,13 @@ var EventStore = class {
388
392
  * @returns The sequence number of the latest snapshot, or 0 if none
389
393
  */
390
394
  getLatestSnapshotSeq(sessionId) {
391
- const row = this.db.prepare(`
395
+ const row = this.db.prepare(
396
+ `
392
397
  SELECT seq FROM events
393
398
  WHERE session_id = ? AND event_type = 'turn.snapshot'
394
399
  ORDER BY seq DESC LIMIT 1
395
- `).get(sessionId);
400
+ `
401
+ ).get(sessionId);
396
402
  return row?.seq ?? 0;
397
403
  }
398
404
  /**
@@ -413,11 +419,13 @@ var EventStore = class {
413
419
  const snapshotMessages = latestSnapshot?.data && typeof latestSnapshot.data === "object" && "messages" in latestSnapshot.data ? latestSnapshot.data.messages : [];
414
420
  const foldedState = foldSessionState(events, initialWindowId, 2e5, snapshotMessages);
415
421
  const newSnapshot = buildSnapshot(foldedState, latestSeq);
416
- const deleteResult = this.db.prepare(`
422
+ const deleteResult = this.db.prepare(
423
+ `
417
424
  DELETE FROM events
418
425
  WHERE session_id = ? AND seq <= ?
419
426
  AND event_type != 'session.initialized'
420
- `).run(sessionId, latestSeq);
427
+ `
428
+ ).run(sessionId, latestSeq);
421
429
  const snapshotEvent = this.append(sessionId, {
422
430
  type: "turn.snapshot",
423
431
  data: newSnapshot
@@ -442,22 +450,28 @@ var EventStore = class {
442
450
  findOrphanedSessions() {
443
451
  const cutoff = new Date(Date.now() - 5 * 60 * 1e3).toISOString();
444
452
  logger.debug("Looking for orphaned sessions", { cutoff });
445
- const sessions = this.db.prepare(`
453
+ const sessions = this.db.prepare(
454
+ `
446
455
  SELECT id, is_running
447
456
  FROM sessions
448
457
  WHERE is_running = 0 AND updated_at < ?
449
- `).all(cutoff);
458
+ `
459
+ ).all(cutoff);
450
460
  logger.debug("Idle sessions found", { count: sessions.length });
451
461
  const orphaned = [];
452
462
  for (const session of sessions) {
453
- const hasSnapshot = this.db.prepare(`
463
+ const hasSnapshot = this.db.prepare(
464
+ `
454
465
  SELECT 1 FROM events WHERE session_id = ? AND event_type = 'turn.snapshot' LIMIT 1
455
- `).get(session.id);
466
+ `
467
+ ).get(session.id);
456
468
  if (hasSnapshot) {
457
469
  const latestSnapshotSeq = this.getLatestSnapshotSeq(session.id);
458
- const eventsAfter = this.db.prepare(`
470
+ const eventsAfter = this.db.prepare(
471
+ `
459
472
  SELECT 1 FROM events WHERE session_id = ? AND seq > ? LIMIT 1
460
- `).get(session.id, latestSnapshotSeq);
473
+ `
474
+ ).get(session.id, latestSnapshotSeq);
461
475
  if (eventsAfter) {
462
476
  orphaned.push(session.id);
463
477
  }
@@ -502,11 +516,13 @@ function resetStaleRunningSessions(eventStore, db) {
502
516
  const sessions = db.prepare(`SELECT id FROM sessions`).all();
503
517
  let resetCount = 0;
504
518
  for (const { id: sessionId } of sessions) {
505
- const lastRunningEvent = db.prepare(`
519
+ const lastRunningEvent = db.prepare(
520
+ `
506
521
  SELECT payload FROM events
507
522
  WHERE session_id = ? AND event_type = 'running.changed'
508
523
  ORDER BY seq DESC LIMIT 1
509
- `).get(sessionId);
524
+ `
525
+ ).get(sessionId);
510
526
  if (lastRunningEvent) {
511
527
  const data = JSON.parse(lastRunningEvent.payload);
512
528
  if (data.isRunning === true) {
@@ -545,10 +561,12 @@ function createSession(projectId, workdir, title, providerId, providerModel) {
545
561
  const db = getDatabase();
546
562
  const now = (/* @__PURE__ */ new Date()).toISOString();
547
563
  const id = crypto.randomUUID();
548
- db.prepare(`
564
+ db.prepare(
565
+ `
549
566
  INSERT INTO sessions (id, project_id, workdir, phase, mode, workflow_phase, is_running, created_at, updated_at, title, provider_id, provider_model, danger_level)
550
567
  VALUES (?, ?, ?, 'idle', 'planner', 'plan', 0, ?, ?, ?, ?, ?, 'normal')
551
- `).run(id, projectId, workdir, now, now, title ?? null, providerId ?? null, providerModel ?? null);
568
+ `
569
+ ).run(id, projectId, workdir, now, now, title ?? null, providerId ?? null, providerModel ?? null);
552
570
  return {
553
571
  id,
554
572
  projectId,
@@ -576,9 +594,11 @@ function createSession(projectId, workdir, title, providerId, providerModel) {
576
594
  }
577
595
  function getSession(id) {
578
596
  const db = getDatabase();
579
- const row = db.prepare(`
597
+ const row = db.prepare(
598
+ `
580
599
  SELECT * FROM sessions WHERE id = ?
581
- `).get(id);
600
+ `
601
+ ).get(id);
582
602
  if (!row) {
583
603
  return null;
584
604
  }
@@ -610,30 +630,38 @@ function getSession(id) {
610
630
  function updateSessionProvider(id, providerId, providerModel) {
611
631
  const db = getDatabase();
612
632
  const now = (/* @__PURE__ */ new Date()).toISOString();
613
- db.prepare(`
633
+ db.prepare(
634
+ `
614
635
  UPDATE sessions SET provider_id = ?, provider_model = ?, updated_at = ? WHERE id = ?
615
- `).run(providerId, providerModel, now, id);
636
+ `
637
+ ).run(providerId, providerModel, now, id);
616
638
  }
617
639
  function updateSessionDangerLevel(id, dangerLevel) {
618
640
  const db = getDatabase();
619
641
  const now = (/* @__PURE__ */ new Date()).toISOString();
620
- db.prepare(`
642
+ db.prepare(
643
+ `
621
644
  UPDATE sessions SET danger_level = ?, updated_at = ? WHERE id = ?
622
- `).run(dangerLevel, now, id);
645
+ `
646
+ ).run(dangerLevel, now, id);
623
647
  }
624
648
  function updateSessionRunning(id, isRunning) {
625
649
  const db = getDatabase();
626
650
  const now = (/* @__PURE__ */ new Date()).toISOString();
627
- db.prepare(`
651
+ db.prepare(
652
+ `
628
653
  UPDATE sessions SET is_running = ?, updated_at = ? WHERE id = ?
629
- `).run(isRunning ? 1 : 0, now, id);
654
+ `
655
+ ).run(isRunning ? 1 : 0, now, id);
630
656
  }
631
657
  function updateSessionSummary(id, summary) {
632
658
  const db = getDatabase();
633
659
  const now = (/* @__PURE__ */ new Date()).toISOString();
634
- db.prepare(`
660
+ db.prepare(
661
+ `
635
662
  UPDATE sessions SET summary = ?, updated_at = ? WHERE id = ?
636
- `).run(summary, now, id);
663
+ `
664
+ ).run(summary, now, id);
637
665
  }
638
666
  function updateSessionMetadata(id, metadata) {
639
667
  const db = getDatabase();
@@ -657,23 +685,28 @@ function updateSessionMetadata(id, metadata) {
657
685
  values.push(metadata.iterationCount);
658
686
  }
659
687
  values.push(id);
660
- db.prepare(`
688
+ db.prepare(
689
+ `
661
690
  UPDATE sessions SET ${updates.join(", ")} WHERE id = ?
662
- `).run(...values);
691
+ `
692
+ ).run(...values);
663
693
  }
664
694
  function updateSessionMessageCount(id, delta) {
665
695
  try {
666
696
  const db = getDatabase();
667
697
  const now = (/* @__PURE__ */ new Date()).toISOString();
668
- db.prepare(`
698
+ db.prepare(
699
+ `
669
700
  UPDATE sessions SET message_count = message_count + ?, updated_at = ? WHERE id = ?
670
- `).run(delta, now, id);
701
+ `
702
+ ).run(delta, now, id);
671
703
  } catch {
672
704
  }
673
705
  }
674
706
  function listSessions() {
675
707
  const db = getDatabase();
676
- const rows = db.prepare(`
708
+ const rows = db.prepare(
709
+ `
677
710
  SELECT
678
711
  s.id,
679
712
  s.project_id,
@@ -689,12 +722,14 @@ function listSessions() {
689
722
  s.message_count
690
723
  FROM sessions s
691
724
  ORDER BY s.updated_at DESC
692
- `).all();
725
+ `
726
+ ).all();
693
727
  return rows.map(mapSessionSummaryRow);
694
728
  }
695
729
  function listSessionsByProject(projectId, limit = 20, offset = 0) {
696
730
  const db = getDatabase();
697
- const rows = db.prepare(`
731
+ const rows = db.prepare(
732
+ `
698
733
  SELECT
699
734
  s.id,
700
735
  s.project_id,
@@ -712,7 +747,8 @@ function listSessionsByProject(projectId, limit = 20, offset = 0) {
712
747
  WHERE s.project_id = ?
713
748
  ORDER BY s.updated_at DESC
714
749
  LIMIT ? OFFSET ?
715
- `).all(projectId, limit + 1, offset);
750
+ `
751
+ ).all(projectId, limit + 1, offset);
716
752
  const hasMore = rows.length > limit;
717
753
  const sessions = rows.slice(0, limit).map(mapSessionSummaryRow);
718
754
  return { sessions, hasMore };
@@ -1088,13 +1124,15 @@ function getRecentUserPromptsForSession(sessionId, limit = 10) {
1088
1124
  }
1089
1125
  const isRealUserMessage = (msg) => msg.role === "user" && !msg.isSystemGenerated && !msg.messageKind && !msg.subAgentType;
1090
1126
  const promptMap = /* @__PURE__ */ new Map();
1091
- const snapshotRow = db.prepare(`
1127
+ const snapshotRow = db.prepare(
1128
+ `
1092
1129
  SELECT payload, timestamp
1093
1130
  FROM events
1094
1131
  WHERE session_id = ? AND event_type = 'turn.snapshot'
1095
1132
  ORDER BY timestamp DESC
1096
1133
  LIMIT 1
1097
- `).get(sessionId);
1134
+ `
1135
+ ).get(sessionId);
1098
1136
  if (snapshotRow) {
1099
1137
  const snapshot = JSON.parse(snapshotRow.payload);
1100
1138
  for (const msg of snapshot.messages) {
@@ -1107,7 +1145,8 @@ function getRecentUserPromptsForSession(sessionId, limit = 10) {
1107
1145
  }
1108
1146
  }
1109
1147
  }
1110
- const rows = db.prepare(`
1148
+ const rows = db.prepare(
1149
+ `
1111
1150
  SELECT payload, timestamp
1112
1151
  FROM events
1113
1152
  WHERE session_id = ? AND event_type = 'message.start'
@@ -1117,7 +1156,8 @@ function getRecentUserPromptsForSession(sessionId, limit = 10) {
1117
1156
  AND json_extract(payload, '$.subAgentType') IS NULL
1118
1157
  ORDER BY timestamp DESC
1119
1158
  LIMIT ?
1120
- `).all(sessionId, limit);
1159
+ `
1160
+ ).all(sessionId, limit);
1121
1161
  for (const row of rows) {
1122
1162
  const message = JSON.parse(row.payload);
1123
1163
  promptMap.set(message.messageId, {
@@ -1127,7 +1167,7 @@ function getRecentUserPromptsForSession(sessionId, limit = 10) {
1127
1167
  });
1128
1168
  }
1129
1169
  return [...promptMap.values()].sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime()).slice(0, limit);
1130
- } catch (error) {
1170
+ } catch {
1131
1171
  return [];
1132
1172
  }
1133
1173
  }
@@ -1181,4 +1221,4 @@ export {
1181
1221
  compactContext,
1182
1222
  getRecentUserPromptsForSession
1183
1223
  };
1184
- //# sourceMappingURL=chunk-5UTTLO4D.js.map
1224
+ //# sourceMappingURL=chunk-5ZD3GZTK.js.map
@@ -67,4 +67,4 @@ export {
67
67
  setRuntimeConfig,
68
68
  getRuntimeConfig
69
69
  };
70
- //# sourceMappingURL=chunk-AFATQ5LJ.js.map
70
+ //# sourceMappingURL=chunk-B5AP3RSV.js.map
@@ -125,4 +125,4 @@ export {
125
125
  hasPendingQuestion,
126
126
  awaitAnswer
127
127
  };
128
- //# sourceMappingURL=chunk-22CTURMH.js.map
128
+ //# sourceMappingURL=chunk-BJYPTN5S.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-PNBH3RAX.js";
3
+ } from "./chunk-K44MW7JJ.js";
4
4
 
5
5
  // src/server/llm/vision-fallback.ts
6
6
  var DEFAULT_CONFIG = {
@@ -29,8 +29,8 @@ function isVisionFallbackEnabled() {
29
29
  async function ensureVisionFallbackConfigLoaded() {
30
30
  if (configLoaded) return;
31
31
  try {
32
- const { loadGlobalConfig, getVisionFallback } = await import("./config-6T4EHAP2.js");
33
- const { getRuntimeConfig } = await import("./runtime-config-ZCK74XKM.js");
32
+ const { loadGlobalConfig, getVisionFallback } = await import("./config-5CONAOL7.js");
33
+ const { getRuntimeConfig } = await import("./runtime-config-CBJJJGBD.js");
34
34
  const runtimeConfig = getRuntimeConfig();
35
35
  const mode = runtimeConfig.mode ?? "production";
36
36
  const globalConfig = await loadGlobalConfig(mode);
@@ -44,7 +44,9 @@ async function ensureVisionFallbackConfigLoaded() {
44
44
  configLoaded = true;
45
45
  logger.debug("Vision fallback config loaded from global config", { config });
46
46
  } catch (error) {
47
- logger.warn("Failed to load vision fallback config from global config", { error: error instanceof Error ? error.message : String(error) });
47
+ logger.warn("Failed to load vision fallback config from global config", {
48
+ error: error instanceof Error ? error.message : String(error)
49
+ });
48
50
  }
49
51
  }
50
52
  var IMAGE_PROMPT = `Describe this image in detail. Focus on:
@@ -135,4 +137,4 @@ export {
135
137
  describeImage,
136
138
  describeImageFromDataUrl
137
139
  };
138
- //# sourceMappingURL=chunk-DLINTLB7.js.map
140
+ //# sourceMappingURL=chunk-BSTVRSV6.js.map
@@ -1,16 +1,18 @@
1
1
  import {
2
2
  getDatabase
3
- } from "./chunk-BLNFJ22S.js";
3
+ } from "./chunk-KIOUKC3Z.js";
4
4
 
5
5
  // src/server/db/projects.ts
6
6
  function createProject(name, workdir) {
7
7
  const db = getDatabase();
8
8
  const now = (/* @__PURE__ */ new Date()).toISOString();
9
9
  const id = crypto.randomUUID();
10
- db.prepare(`
10
+ db.prepare(
11
+ `
11
12
  INSERT INTO projects (id, name, workdir, created_at, updated_at)
12
13
  VALUES (?, ?, ?, ?, ?)
13
- `).run(id, name, workdir, now, now);
14
+ `
15
+ ).run(id, name, workdir, now, now);
14
16
  return {
15
17
  id,
16
18
  name,
@@ -21,9 +23,11 @@ function createProject(name, workdir) {
21
23
  }
22
24
  function getProject(id) {
23
25
  const db = getDatabase();
24
- const row = db.prepare(`
26
+ const row = db.prepare(
27
+ `
25
28
  SELECT * FROM projects WHERE id = ?
26
- `).get(id);
29
+ `
30
+ ).get(id);
27
31
  if (!row) {
28
32
  return null;
29
33
  }
@@ -31,9 +35,11 @@ function getProject(id) {
31
35
  }
32
36
  function getProjectByWorkdir(workdir) {
33
37
  const db = getDatabase();
34
- const row = db.prepare(`
38
+ const row = db.prepare(
39
+ `
35
40
  SELECT * FROM projects WHERE workdir = ?
36
- `).get(workdir);
41
+ `
42
+ ).get(workdir);
37
43
  if (!row) {
38
44
  return null;
39
45
  }
@@ -41,9 +47,11 @@ function getProjectByWorkdir(workdir) {
41
47
  }
42
48
  function listProjects() {
43
49
  const db = getDatabase();
44
- const rows = db.prepare(`
50
+ const rows = db.prepare(
51
+ `
45
52
  SELECT * FROM projects ORDER BY updated_at DESC
46
- `).all();
53
+ `
54
+ ).all();
47
55
  return rows.map(rowToProject);
48
56
  }
49
57
  function updateProject(id, updates) {
@@ -60,9 +68,11 @@ function updateProject(id, updates) {
60
68
  values.push(updates.customInstructions);
61
69
  }
62
70
  values.push(id);
63
- const result = db.prepare(`
71
+ const result = db.prepare(
72
+ `
64
73
  UPDATE projects SET ${sets.join(", ")} WHERE id = ?
65
- `).run(...values);
74
+ `
75
+ ).run(...values);
66
76
  if (result.changes === 0) {
67
77
  return null;
68
78
  }
@@ -91,4 +101,4 @@ export {
91
101
  updateProject,
92
102
  deleteProject
93
103
  };
94
- //# sourceMappingURL=chunk-7JPKRM6M.js.map
104
+ //# sourceMappingURL=chunk-CMQCO27Y.js.map
@@ -63,4 +63,4 @@ export {
63
63
  getSkillsDir,
64
64
  ensureDataDirExists
65
65
  };
66
- //# sourceMappingURL=chunk-R4HADRYO.js.map
66
+ //# sourceMappingURL=chunk-CQGTEGKL.js.map