draken 0.5.1 → 0.6.0

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 (202) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/MEMORY.md +10 -4
  3. package/PERSONA.md +9 -2
  4. package/README.md +8 -10
  5. package/SETUP.md +3 -3
  6. package/TRAY.md +2 -2
  7. package/VOICE.md +1 -1
  8. package/dist/auth/middleware.d.ts.map +1 -1
  9. package/dist/auth/middleware.js +0 -13
  10. package/dist/auth/middleware.js.map +1 -1
  11. package/dist/cli.js +6 -2
  12. package/dist/cli.js.map +1 -1
  13. package/dist/data-dir.d.ts +2 -0
  14. package/dist/data-dir.d.ts.map +1 -0
  15. package/dist/data-dir.js +12 -0
  16. package/dist/data-dir.js.map +1 -0
  17. package/dist/db/evidence.d.ts +2 -1
  18. package/dist/db/evidence.d.ts.map +1 -1
  19. package/dist/db/evidence.js +6 -5
  20. package/dist/db/evidence.js.map +1 -1
  21. package/dist/db/pointer-migration.js +4 -4
  22. package/dist/db/pointer-migration.js.map +1 -1
  23. package/dist/db/schema.d.ts +0 -1
  24. package/dist/db/schema.d.ts.map +1 -1
  25. package/dist/db/schema.js +7 -7
  26. package/dist/db/schema.js.map +1 -1
  27. package/dist/errors.d.ts +5 -0
  28. package/dist/errors.d.ts.map +1 -0
  29. package/dist/errors.js +12 -0
  30. package/dist/errors.js.map +1 -0
  31. package/dist/memory/context.d.ts +2 -9
  32. package/dist/memory/context.d.ts.map +1 -1
  33. package/dist/memory/context.js +7 -84
  34. package/dist/memory/context.js.map +1 -1
  35. package/dist/memory/embedding-contract.d.ts +5 -0
  36. package/dist/memory/embedding-contract.d.ts.map +1 -0
  37. package/dist/memory/embedding-contract.js +12 -0
  38. package/dist/memory/embedding-contract.js.map +1 -0
  39. package/dist/memory/embedding-pool.d.ts +1 -2
  40. package/dist/memory/embedding-pool.d.ts.map +1 -1
  41. package/dist/memory/embedding-pool.js +9 -9
  42. package/dist/memory/embedding-pool.js.map +1 -1
  43. package/dist/memory/embedding-worker.js +2 -1
  44. package/dist/memory/embedding-worker.js.map +1 -1
  45. package/dist/{voice/history-focus.d.ts → memory/focus.d.ts} +6 -6
  46. package/dist/memory/focus.d.ts.map +1 -0
  47. package/dist/{voice/history-focus.js → memory/focus.js} +6 -6
  48. package/dist/memory/focus.js.map +1 -0
  49. package/dist/memory/index.d.ts.map +1 -1
  50. package/dist/memory/index.js +12 -15
  51. package/dist/memory/index.js.map +1 -1
  52. package/dist/memory/model-assets.d.ts +5 -0
  53. package/dist/memory/model-assets.d.ts.map +1 -0
  54. package/dist/memory/model-assets.js +84 -0
  55. package/dist/memory/model-assets.js.map +1 -0
  56. package/dist/memory/model.d.ts +2 -7
  57. package/dist/memory/model.d.ts.map +1 -1
  58. package/dist/memory/model.js +13 -83
  59. package/dist/memory/model.js.map +1 -1
  60. package/dist/memory/packet.d.ts +9 -0
  61. package/dist/memory/packet.d.ts.map +1 -0
  62. package/dist/memory/packet.js +78 -0
  63. package/dist/memory/packet.js.map +1 -0
  64. package/dist/memory/passages.d.ts +15 -0
  65. package/dist/memory/passages.d.ts.map +1 -0
  66. package/dist/memory/passages.js +22 -0
  67. package/dist/memory/passages.js.map +1 -0
  68. package/dist/memory/readiness.d.ts.map +1 -1
  69. package/dist/memory/readiness.js +2 -6
  70. package/dist/memory/readiness.js.map +1 -1
  71. package/dist/memory/service.d.ts +2 -1
  72. package/dist/memory/service.d.ts.map +1 -1
  73. package/dist/memory/service.js +46 -22
  74. package/dist/memory/service.js.map +1 -1
  75. package/dist/memory/sources.d.ts +0 -1
  76. package/dist/memory/sources.d.ts.map +1 -1
  77. package/dist/memory/sources.js +3 -7
  78. package/dist/memory/sources.js.map +1 -1
  79. package/dist/memory/stamps.d.ts +3 -3
  80. package/dist/memory/stamps.d.ts.map +1 -1
  81. package/dist/memory/stamps.js +3 -3
  82. package/dist/memory/stamps.js.map +1 -1
  83. package/dist/memory/storage.d.ts.map +1 -1
  84. package/dist/memory/storage.js +3 -2
  85. package/dist/memory/storage.js.map +1 -1
  86. package/dist/memory/types.d.ts +2 -1
  87. package/dist/memory/types.d.ts.map +1 -1
  88. package/dist/memory/types.js +2 -1
  89. package/dist/memory/types.js.map +1 -1
  90. package/dist/pi/runtime.js +7 -7
  91. package/dist/pi/runtime.js.map +1 -1
  92. package/dist/pi/setup.d.ts +0 -1
  93. package/dist/pi/setup.d.ts.map +1 -1
  94. package/dist/pi/setup.js +2 -11
  95. package/dist/pi/setup.js.map +1 -1
  96. package/dist/routes/auth.d.ts.map +1 -1
  97. package/dist/routes/auth.js +0 -5
  98. package/dist/routes/auth.js.map +1 -1
  99. package/dist/routes/http.d.ts +6 -0
  100. package/dist/routes/http.d.ts.map +1 -0
  101. package/dist/routes/http.js +22 -0
  102. package/dist/routes/http.js.map +1 -0
  103. package/dist/routes/live-voice.d.ts.map +1 -1
  104. package/dist/routes/live-voice.js +18 -32
  105. package/dist/routes/live-voice.js.map +1 -1
  106. package/dist/routes/memory.d.ts.map +1 -1
  107. package/dist/routes/memory.js +8 -14
  108. package/dist/routes/memory.js.map +1 -1
  109. package/dist/routes/sync.d.ts.map +1 -1
  110. package/dist/routes/sync.js +57 -64
  111. package/dist/routes/sync.js.map +1 -1
  112. package/dist/routes/voice.d.ts.map +1 -1
  113. package/dist/routes/voice.js +7 -7
  114. package/dist/routes/voice.js.map +1 -1
  115. package/dist/server-ownership.d.ts +5 -0
  116. package/dist/server-ownership.d.ts.map +1 -0
  117. package/dist/server-ownership.js +34 -0
  118. package/dist/server-ownership.js.map +1 -0
  119. package/dist/server-state.js +3 -3
  120. package/dist/server-state.js.map +1 -1
  121. package/dist/server.d.ts.map +1 -1
  122. package/dist/server.js +40 -10
  123. package/dist/server.js.map +1 -1
  124. package/dist/sync/activity.d.ts +26 -0
  125. package/dist/sync/activity.d.ts.map +1 -0
  126. package/dist/sync/activity.js +80 -0
  127. package/dist/sync/activity.js.map +1 -0
  128. package/dist/{memory/automatic.d.ts → sync/background.d.ts} +5 -12
  129. package/dist/sync/background.d.ts.map +1 -0
  130. package/dist/{memory/automatic.js → sync/background.js} +29 -74
  131. package/dist/sync/background.js.map +1 -0
  132. package/dist/sync/collector.d.ts.map +1 -1
  133. package/dist/sync/collector.js +7 -6
  134. package/dist/sync/collector.js.map +1 -1
  135. package/dist/sync/manager.d.ts +1 -4
  136. package/dist/sync/manager.d.ts.map +1 -1
  137. package/dist/sync/manager.js +29 -49
  138. package/dist/sync/manager.js.map +1 -1
  139. package/dist/sync/models.d.ts +3 -0
  140. package/dist/sync/models.d.ts.map +1 -0
  141. package/dist/sync/models.js +12 -0
  142. package/dist/sync/models.js.map +1 -0
  143. package/dist/sync/pi.d.ts +1 -1
  144. package/dist/sync/pi.d.ts.map +1 -1
  145. package/dist/sync/pi.js +32 -19
  146. package/dist/sync/pi.js.map +1 -1
  147. package/dist/{voice → sync}/preparation.d.ts +0 -1
  148. package/dist/sync/preparation.d.ts.map +1 -0
  149. package/dist/{voice → sync}/preparation.js +10 -18
  150. package/dist/sync/preparation.js.map +1 -0
  151. package/dist/sync/retrieval.d.ts +3 -0
  152. package/dist/sync/retrieval.d.ts.map +1 -0
  153. package/dist/sync/retrieval.js +12 -0
  154. package/dist/sync/retrieval.js.map +1 -0
  155. package/dist/sync/source-files.d.ts +2 -4
  156. package/dist/sync/source-files.d.ts.map +1 -1
  157. package/dist/sync/source-files.js +5 -20
  158. package/dist/sync/source-files.js.map +1 -1
  159. package/dist/sync/store.d.ts +1 -14
  160. package/dist/sync/store.d.ts.map +1 -1
  161. package/dist/sync/store.js +32 -90
  162. package/dist/sync/store.js.map +1 -1
  163. package/dist/sync/tree.d.ts.map +1 -1
  164. package/dist/sync/tree.js +17 -22
  165. package/dist/sync/tree.js.map +1 -1
  166. package/dist/sync/usage.js +3 -3
  167. package/dist/sync/usage.js.map +1 -1
  168. package/dist/tray/launcher.js +2 -2
  169. package/dist/tray/launcher.js.map +1 -1
  170. package/dist/tray/worker.js +4 -4
  171. package/dist/tray/worker.js.map +1 -1
  172. package/dist/types.d.ts +1 -10
  173. package/dist/types.d.ts.map +1 -1
  174. package/dist/voice/history-delivery.js +3 -3
  175. package/dist/voice/history-delivery.js.map +1 -1
  176. package/dist/voice/live-context.js +3 -3
  177. package/dist/voice/live-context.js.map +1 -1
  178. package/dist/voice/live.d.ts +1 -0
  179. package/dist/voice/live.d.ts.map +1 -1
  180. package/dist/voice/live.js +57 -34
  181. package/dist/voice/live.js.map +1 -1
  182. package/package.json +1 -1
  183. package/public/assets/index-DXPfCm7z.js +131 -0
  184. package/public/index.html +1 -1
  185. package/voice/realtime/README.md +1 -1
  186. package/voice/realtime/helper-process.mjs +54 -0
  187. package/voice/realtime/native.mjs +55 -15
  188. package/voice/realtime/probe-server.mjs +24 -4
  189. package/voice/realtime/probe.mjs +49 -11
  190. package/voice/realtime/rpc.mjs +7 -32
  191. package/voice/realtime/setup.mjs +82 -19
  192. package/dist/memory/automatic.d.ts.map +0 -1
  193. package/dist/memory/automatic.js.map +0 -1
  194. package/dist/sync/automatic.d.ts +0 -7
  195. package/dist/sync/automatic.d.ts.map +0 -1
  196. package/dist/sync/automatic.js +0 -56
  197. package/dist/sync/automatic.js.map +0 -1
  198. package/dist/voice/history-focus.d.ts.map +0 -1
  199. package/dist/voice/history-focus.js.map +0 -1
  200. package/dist/voice/preparation.d.ts.map +0 -1
  201. package/dist/voice/preparation.js.map +0 -1
  202. package/public/assets/index-DrGvDGTG.js +0 -131
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### User-triggered syncs, automatic local indexing
6
+
7
+ - Automatic indexing accumulates searchable history without creating syncs, summaries, recaps or briefings and without provider model calls. Only an explicit user action creates a sync and prepares its briefing from all eligible accumulated entries.
8
+ - Rename the setting to **Automatically index history**. Preserve saved indexing choices, migrate legacy combined-only preferences, and retire automatic-briefing job controls. Existing automatic snapshots, conversations, notes, cached work and cost history remain intact; new requests do not silently claim or resume them.
9
+ - Keep local batching, durable checkpoints, foreground priority and bounded retries. See [MEMORY.md](MEMORY.md#optional-background-indexing) for the policy.
10
+
11
+ ### Ownership and reliability
12
+
13
+ - Separate shared retrieval, configuration, embedding assets and inference ownership. Live evidence requires verified original-backed pointers; migration-only historical compatibility and reusable vectors remain supported.
14
+ - Hold exclusive data-directory ownership until listeners and owned jobs/processes have drained. Suspended servers cannot be displaced by an expired heartbeat; unconfirmed cleanup retains ownership rather than allowing a second server to start.
15
+ - Confirm native helper/group exit for calls, metadata checks and terminal commands. Cancel stale browser source reads when switching sources, navigating or closing a call.
16
+ - Strengthen historical compatibility, process-lifetime, package and optional qualification regressions. Documentation retains current contracts rather than implementation/review transcripts.
17
+
18
+ ### Upgrading
19
+
20
+ Back up original agent logs and Draken state, finish active work, stop the server, install the new version and restart. The retired automatic-briefing settings are removed, but existing sync data is not deleted or rewritten. Local indexing can remain enabled without spending summary-provider quota. Node.js 22.19+ is still required; there are no dependency-version changes in this release. Synthetic qualification does not establish real-provider audio or physical-device acceptance.
21
+
3
22
  ## 0.5.1
4
23
 
5
24
  - Reflow overlong recap prose at existing spaces rather than rejecting it solely for line width. No words, qualifications or original point boundaries are dropped; the same five-line, 160-character-per-line and 600-character-total limits still apply. Other invalid output still gets at most one correction.
package/MEMORY.md CHANGED
@@ -16,16 +16,22 @@ Opening/reloading a page does not itself download the model, compute embeddings
16
16
 
17
17
  ### Optional background indexing
18
18
 
19
- **Settings → Automatically prepare conversations** is the single switch for scanning, local indexing, summary batches and the final briefing. It is on by default for new installations and works while the server runs, even without a browser. Existing installations retain their previous behavior, including off or no saved preference. Only empty-database initialization stores the new default; reads and restarts never reset it. It uses the configured pi summary/final models and their quota or API billing within the saved per-run invocation limit, and may download the pinned local embedding model on first use. It creates new immutable sync snapshots; existing snapshots, discussions and notes are not rewritten. It never starts audio, a call or review. Earlier local-index-only permission is not silently upgraded to paid model permission: the replacement switch records the combined scope.
19
+ **Settings → Automatically index history** controls scanning and local search indexing only. It is on by default for new installations and works while the server runs, even without a browser. Existing installations retain their saved indexing choice, including off; reads and restarts never reset it. On upgrade, an existing `auto_index` choice wins; only when it is absent is the legacy combined preference copied. A missing preference on an existing installation remains off. Retired automatic-briefing consent and job markers are removed, not resumed. Indexing may download the pinned local embedding model on first use and consumes local CPU, memory and disk, but makes no provider model calls. It never creates syncs, summaries, recaps or briefings, starts audio, or advances review. Existing snapshots (including past automatically created ones), cached summaries, conversations and notes remain ordinary retained history, not resumable automatic jobs.
20
20
 
21
- The app's single scheduler checks once a minute when no sync, call or foreground history work is active. A new background batch requires at least 64 changed source records or 64 entries waiting for a briefing, regardless of elapsed time; unfinished owned batches resume from their cached work. An already indexed backlog still receives its briefing. There is no timed flush. Smaller pending batches wait for a sync, **Prepare history**, or search; that foreground path has no minimum batch size. Background indexing records the same history readiness used by calls. If anything still needs preparation, Call remains disabled—clicking it cannot start a hidden indexing job. Metadata hashes detect additions, edits and removals once per original source entry (or discussion/note record). Session/file bookkeeping does not add records, and frozen aliases coalesce with the original rather than multiplying the count. Actual indexing still reconstructs and verifies admitted source bytes. Unchanged checks do not start an embedding request. Source records and embedding passages are different counts. New sessions from enabled agents retain the collector's included-by-default behavior; per-agent/per-session exclusions and the existing baseline remain respected. Codex and Claude sources require separate explicit opt-in in **Settings → Agents & sessions**, even if background indexing is already enabled. Summarization continues to use pi. See [SOURCES.md](SOURCES.md).
21
+ The app's single scheduler checks once a minute when no sync, call or foreground history work is active. A background indexing batch requires at least 64 changed source records, regardless of elapsed time. Entries accumulate for the next explicit sync; an already indexed backlog does not trigger a briefing. There is no timed flush. Smaller pending batches wait for a sync, **Prepare history**, or search; that foreground path has no minimum batch size. Background indexing records the same history readiness used by calls. If anything still needs preparation, Call remains disabled—clicking it cannot start a hidden indexing job. Metadata hashes detect additions, edits and removals once per original source entry (or discussion/note record). Session/file bookkeeping does not add records, and frozen aliases coalesce with the original rather than multiplying the count. Actual indexing still reconstructs and verifies admitted source bytes. Unchanged checks do not start an embedding request. Source records and embedding passages are different counts. New sessions from enabled agents retain the collector's included-by-default behavior; per-agent/per-session exclusions and the existing baseline remain respected. Codex and Claude sources require separate explicit opt-in in **Settings → Agents & sessions**, even if background indexing is already enabled. Explicit summarization continues to use pi. See [SOURCES.md](SOURCES.md).
22
22
 
23
- Foreground requests preempt and await the owned automatic job, including its provider call. Disabling cancels only that automatic job; completed vectors and summary nodes remain reusable. A provider/briefing failure is durably paused until explicit retry, rather than repeating paid calls on a timer. Local preparation failures retry no sooner than five minutes; foreground preemption waits at least one minute. Shutdown awaits owned work. Settings/progress GETs remain metadata-only. Home shows the same combined pipeline as Settings, including actual summary counts and model-call budget. Unassigned entries are separate from entries held in an unfinished batch; zero unassigned entries does not mean preparation succeeded. Failed batches show their stopped stage. Preparation-time recap validation records content-free reasons/line lengths in existing metrics, and overlong prose may be reflowed without losing words within the existing bounds; last completion and unfinished snapshot ownership survive restart. A ready untouched automatic snapshot is claimed once by the Home conversation action, preserving delivery idempotency and avoiding another briefing call. New arrivals belong to a new snapshot; earlier batches come along as qualified, lossy recaps, with originals available through retrieval.
23
+ Foreground requests preempt and await the owned automatic indexing job. Disabling cancels only that job; completed vectors remain reusable. Local preparation failures retry no sooner than five minutes; foreground preemption waits at least one minute. **Retry automatic indexing** permits an explicit retry in Settings. Shutdown awaits owned work. Settings/progress GETs remain metadata-only. Home and Settings show local indexing status, pending source changes, entries available for the next sync and the last completed indexing batch—not summary progress, model-call budgets or prepared-briefing links. The saved preference and last completion survive restart.
24
24
 
25
- The hash-only search checkpoint still advances only after successful global preparation. Missing older checkpoints can be established by the combined mode's preparation pass, reusing compatible vectors. Snapshot ownership uses private `auto:` request IDs until a foreground request claims the batch; it is not review coverage. Existing user conversations are not adopted as unfinished background jobs. No source-text copy, provider substitution, vector conversion or timed small-batch flush is introduced.
25
+ Only an explicit **Sync with Draken** or **Chat instead** action creates a new snapshot and starts its briefing. It includes all eligible accumulated entries not held by another open sync, preserving request-ID idempotency and explicit retry. No old automatic snapshot is claimed or resumed by a new request. Preparation usage history still includes past automatic work, retries and failures; indexing does not erase those costs. The hash-only search checkpoint still advances only after successful global preparation. Missing older checkpoints can be established by local preparation, reusing compatible vectors. No source-text copy, provider substitution, vector conversion or timed small-batch flush is introduced.
26
26
 
27
27
  A failed preparation/search reports an error. If a session file changed, moved or disappeared, scan sessions again before retrying; stale derived text is not a substitute for a verified source. Otherwise retry the question or **Prepare history**; completed embeddings are reused automatically. Cancel preparation on the sync page to stop that work. Cancelling a search or text reply stops its owned work too. Reloading does not start a call. An older cache without a call-readiness record needs one preparation pass, which reuses its compatible vectors. A completed index over a partial import is not sufficient: foreground call preparation first drains bounded import chunks to captured file ends. Missing, changed or incomplete originals block readiness. Later appends do not force preparation to chase a live stream forever; the call uses its displayed cutoff, and new work waits for another preparation. A ready sync offers **Refresh history** for an explicit local-only update without regenerating its briefing. See [SOURCES.md](SOURCES.md).
28
28
 
29
+ ### Regression boundaries
30
+
31
+ - `tests/source-batch.test.cjs` and `tests/automatic-index.test.cjs` cover accumulation across batches/restarts, committed checkpoints, small tails and cancellation without automatic snapshots or provider work.
32
+ - `tests/automatic-briefing.test.cjs` protects user-only generation, request-ID idempotency and preservation of old snapshots, notes, caches and coverage. Its name describes the behavior that must not return.
33
+ - `tests/automatic-defaults.test.cjs` covers preference migration; `tests/package-smoke.cjs` checks the same boundary in a fresh production-only installation.
34
+
29
35
  ## Work questions and follow-ups
30
36
 
31
37
  Voice and **Chat instead** work questions prefer original session records, not old Draken replies or repeated questions. Project names in admitted session metadata establish a scope that follows generic follow-ups; an explicit project change updates it. Explicit conversation recall still searches earlier discussion. This is a heuristic, not a guarantee that an ambiguous project name will be understood correctly.
package/PERSONA.md CHANGED
@@ -60,8 +60,15 @@ WebGL initialization/context loss switches to the static poster; voice continues
60
60
  npm test # Includes pure audio-clock/pose and module-boundary checks
61
61
  npm run test:ui # Includes preview, reduced motion, context loss and call regressions
62
62
 
63
- # Explicit opt-in: synthetic evidence/audio, real ChatGPT voice, staged frontend:
64
- DRAKEN_TEST_STATIC_DIR=/path/to/stage node tests/live-voice-real.cjs --allow-provider
63
+ # Validate the qualification fixture/current build without a provider or local model:
64
+ npm run build
65
+ node tests/live-voice-real.cjs --check
66
+
67
+ # Explicit opt-in: synthetic evidence/audio, real ChatGPT voice, current build:
68
+ node tests/live-voice-real.cjs --allow-provider
69
+ # Set DRAKEN_TEST_STATIC_DIR only when intentionally qualifying an alternate build.
65
70
  ```
66
71
 
72
+ The fixture-only check blocks voice API calls, supplies synthetic readiness metadata, and never starts a native call. It does not qualify provider access or real embeddings.
73
+
67
74
  Browser checks cover a chrome-free call image, cached blur reuse/resize, high-quality shader compilation (also exercised on software GL), audible sample mouth motion, stopping, desktop/mobile sizing, local-only requests, no preview microphone access, WebGL loss/retry, unavailable WebGL during a working call, and context disposal on hang-up. Native controller/peer tests cover speaker/headphone gating, interruption, mute, permission refusal and cleanup. Main UI tests cover supplied sources, generated/interrupted history, explicit retry and preservation of retired-engine records. No production snapshot is changed by these tests.
package/README.md CHANGED
@@ -10,11 +10,11 @@ A local-first engineering sync across your **pi, Codex CLI and Claude Code sessi
10
10
 
11
11
  **Sync with Draken → call or chat → keep a short recap.**
12
12
 
13
- **Draken 0.5.1** fixes overly strict recap line formatting, records useful validation diagnostics without rejected text, and distinguishes unassigned entries from unfinished preparation. Automatic preparation defaults and short chat replies from 0.5.0 are unchanged. See [the release notes](CHANGELOG.md#051).
13
+ **Draken 0.6.0** separates automatic local indexing from user-triggered syncs and strengthens server/helper shutdown and evidence ownership. See [the release notes](CHANGELOG.md#060).
14
14
 
15
- **Automatic preparation and compaction:** new installations index history, summarize new work and prepare a briefing automatically while the server runs. Turn this off in **Settings → Automatically prepare conversations** if you prefer manual preparation. Existing installations keep their previous behavior, including off and older local-index-only permission. Compaction means cached, derived summaries—not editing or deleting your original agent logs. Matching summaries and ready briefings are reused. This mode uses your configured models and their quota or API billing within the saved invocation limit; it never starts a call or marks work reviewed.
15
+ **Automatic local indexing:** new installations accumulate searchable history automatically while the server runs. Change this in **Settings → Automatically index history**. Existing installations keep their saved indexing choice, including off. Automatic work never creates syncs, summaries or briefings and makes no provider model calls. Only an explicit **Sync with Draken** or **Chat instead** action creates a new snapshot and starts its briefing. Original agent logs, existing snapshots, cached summaries, conversations and notes remain untouched. Nothing is marked reviewed automatically.
16
16
 
17
- **Track preparation spending estimates:** **Settings → Preparation usage** shows estimated USD cost, completed batches and model requests over time, with labelled cost/batch axes and exact bucket details. It includes manual/automatic preparation, retries and failed work. Missing prices stay unavailable or partial. This is **not total spending, a provider invoice or account quota**: chat, voice, standalone post-conversation recaps and local machine/network costs are excluded. Opening the dashboard only reads metadata.
17
+ **Track preparation spending estimates:** **Settings → Preparation usage** shows estimated USD cost, completed batches and model requests over time, with labelled cost/batch axes and exact bucket details. It retains preparation history, including past automatic work, retries and failed work. Missing prices stay unavailable or partial. This is **not total spending, a provider invoice or account quota**: chat, voice, standalone post-conversation recaps and local machine/network costs are excluded. Opening the dashboard only reads metadata.
18
18
 
19
19
  The home page is compact history cards. Each sync has its own `/syncs/:id` URL, with the full briefing, conversations, notes and evidence behind it. **Search history** (`/history`) adds local semantic + keyword retrieval across retained older records, with dated source links. It prepares itself automatically—no enable/update buttons or search-mode choices. Progress counts only new or changed passages, with cached history shown separately and a measured time estimate. Local indexing reuses existing vectors and uses up to two embedding lanes/six CPU threads on sufficiently capable machines; smaller machines stay single-lane. Text questions and calls use it by default. See [MEMORY.md](MEMORY.md) for source scope, first-use download and limitations.
20
20
 
@@ -26,7 +26,7 @@ Draken remembers which evidence a finished sync covered, what you decided, and w
26
26
 
27
27
  Requires Node.js **22.19+** and npm. Session-log indexing and evidence review do not require a model or pi executable. Generated briefings and discussion use **pi 1.4+**. Existing configured pi works unchanged; otherwise **`draken setup`** installs a pinned private runtime and **`draken login`** opens pi’s own authentication interface. See [SETUP.md](SETUP.md) for the full first-run flow, private directories and recovery.
28
28
 
29
- > **Upgrading?** Back up your original agent logs and Draken data first. Versions **0.1.6 and earlier** are the old task dashboard, not this application. See [what changed in 0.5.1](CHANGELOG.md#051).
29
+ > **Upgrading?** Back up your original agent logs and Draken data first. Versions **0.1.6 and earlier** are the old task dashboard, not this application. See [what changed in 0.6.0](CHANGELOG.md#060).
30
30
 
31
31
  ```sh
32
32
  npm install -g draken
@@ -58,9 +58,7 @@ Run setup/login as the server’s user with the same environment. `draken status
58
58
  4. Return home for compact cards, or open any `/syncs/:id` independently. Reopening/reloading a URL never starts capture. **Call Draken** resumes discussion of that frozen snapshot without collecting later activity.
59
59
  5. Use **Chat instead** for a separate text conversation, or expand the detail sections to inspect the briefing/evidence and explicitly save **Decisions** and **Carry into the next sync**. **Mark reviewed** is separate and optional before starting another sync; only that explicit action advances coverage.
60
60
 
61
- **Settings → Automatically prepare conversations** is one mode for the whole preparation pipeline: scan history, update local search, summarize new entries and prepare the opening briefing before you arrive. It is on by default only for new installations and persists across restarts. Existing installations retain their previous choice; an absent preference on upgrade remains off. Checks run once a minute while idle; 64 changed source records or waiting entries trigger a batch, and interrupted batches resume from cache. Smaller new tails wait for foreground preparation, with no timed flush. Home and Settings show the current stage, summary progress and last completed batch. Joining an unchanged prepared batch reuses its snapshot and briefing; later entries get a new snapshot with the earlier preparation as historical context. Existing conversations, notes and frozen evidence are never rewritten or marked reviewed. Calls and foreground work take priority.
62
-
63
- When enabled (including the new-install default), this single mode uses **configured pi summary/final models**, including account quota or API billing, bounded by each snapshot's saved invocation limit (120 by default). Provider failures pause automatic retries until an explicit retry; completed work is retained. There is no microphone capture or automatic call. An older local-index-only opt-in does not silently authorize this wider scope: enable the replacement switch once after upgrading. First use may download the pinned local search model. Agent/session exclusions remain respected; enabling other agents still requires their own source consent.
61
+ **Settings → Automatically index history** controls local-only background work. Entries remain available until you explicitly create a sync; old automatically created snapshots remain readable and are not silently resumed. Indexing uses local resources and may download pinned model files, but makes no provider calls. See [background indexing](MEMORY.md#optional-background-indexing) for batching, cancellation, saved preferences and upgrade behavior.
64
62
 
65
63
  **Settings → Agents & sessions** shows each supported agent’s configured directories, recorded sessions, workspace/file paths, last recorded changes, unreviewed counts, inclusion choices and missing-source status. **Scan enabled agents** explicitly refreshes this inventory; opening Settings only reads recorded metadata and directory presence. Readers support **pi v3 JSONL, self-contained Codex CLI rollouts and Claude Code transcripts**. Codex and Claude history require explicit per-agent opt-in; existing pi choices are preserved. The panel shows directory presence separately from recorded sessions, not an installation claim. Summaries still use pi. See [SOURCES.md](SOURCES.md) for paths, supported layouts, migration and limitations. Source selection/scanning lives in this settings panel. A fresh installation includes all indexed history; an existing fixed baseline is preserved. There are no ordinary model/budget controls or extra inference permission checkboxes. Failed preparation keeps its snapshot and cached work; retry explicitly. Opening a link after preparation requires an explicit call click.
66
64
 
@@ -117,7 +115,7 @@ Each run also retains metadata-only request timings, model/task/stage and repair
117
115
 
118
116
  Each sync card and detail page shows **Est. cost** for its preparation: chunk summaries, consolidation, preparation-time prior recaps, final briefing, and retries/rebuilds for that sync. Later questions, voice calls, standalone conversation recaps and local embeddings are excluded. Preparation consumes pi's bounded JSON event stream and saves only numeric usage, returned model names and the catalog-based USD estimate alongside existing metrics—not raw events, prompts, thinking or signatures. Reasoning is a subset of output, not an extra charge; provider cache reads/writes are distinct from Draken cache hits (which make no new request). The total uses prices reported at call time, never today's prices applied to old calls. **This is an API-equivalent estimate, not a subscription charge, quota measurement or provider invoice.** Missing/zero-filled usage or unavailable catalog pricing stays unavailable; mixed or interrupted records show a partial subtotal. Older syncs cannot be honestly backfilled from the padded planning estimates.
119
117
 
120
- Settings includes a **Preparation usage** dashboard with 6-hour, 1-day, 7-day and 14-day lookbacks, and 1-hour, 6-hour or 24-hour UTC buckets. It shows completed briefing batches, model requests and their recorded API-price estimate, across automatic and manual preparation—including retries, failed work and discarded snapshots. A batch is a snapshot's first successful briefing preparation; rebuilds add cost without counting it again. It is not proof of review or current call readiness. Request costs are placed at their start time, and completed batches at their completion time. New requests have durable timestamps, including pending/interrupted requests; older metrics use the run start and are explicitly approximate. Missing usage/pricing is unavailable or a partial subtotal, never a fabricated zero or a backfill from today's prices. These are estimates, not invoices or subscription/quota balances. Chat, native voice, post-conversation recaps and local machine/network costs are excluded. Opening Settings and changing the time range only read accounting metadata; polling stops when it closes.
118
+ Settings includes a **Preparation usage** dashboard with 6-hour, 1-day, 7-day and 14-day lookbacks, and 1-hour, 6-hour or 24-hour UTC buckets. It shows completed briefing batches, model requests and their recorded API-price estimate, across preparation history, including past automatic work, retries, failed work and discarded snapshots. A batch is a snapshot's first successful briefing preparation; rebuilds add cost without counting it again. It is not proof of review or current call readiness. Request costs are placed at their start time, and completed batches at their completion time. New requests have durable timestamps, including pending/interrupted requests; older metrics use the run start and are explicitly approximate. Missing usage/pricing is unavailable or a partial subtotal, never a fabricated zero or a backfill from today's prices. These are estimates, not invoices or subscription/quota balances. Chat, native voice, post-conversation recaps and local machine/network costs are excluded. Opening Settings and changing the time range only read accounting metadata; polling stops when it closes.
121
119
 
122
120
  The final model receives bounded summaries, raw verification excerpts, saved decisions, and recent conversation—not the entire transcript. Questions additionally retrieve up to 16 raw snapshot entries and automatically receive a bounded hybrid-search packet from retained earlier history, with separate global H citations. The separate chat surface requires prepared history and uses its captured cutoff; ordinary standalone search and the older discussion API can prepare the local index as needed. Wider history is not added to the frozen snapshot. Final citation validation checks reference existence and, for text status replies, whether cited checkpoints address their supplied follow-ups. Neither check proves that every claim is actually supported.
123
121
 
@@ -127,7 +125,7 @@ The manager is a **read-only conversation**, not a worker. Its responses disting
127
125
 
128
126
  The new workflow freezes the three most recent non-discarded syncs' briefing, discussion and explicit notes at snapshot creation. Their full supplied text passes through cached bounded map/reduce recap jobs; it does not silently select only the final messages. This remains **lossy summarization**, not exhaustive recall or independent verification. Recaps are 1–5 short lines (at most 600 characters), labelled historical summaries rather than agreement. Overlong prose lines can be reflowed at existing spaces without dropping words or qualifications, provided the same five-line/600-character limits still hold. Other invalid responses get one correction, not an unlimited retry. Preparation metrics record content-free validation reasons and line lengths, never rejected recap text. Old source IDs are not treated as this snapshot's citations. Original histories remain available at their own URLs.
129
127
 
130
- The card shows a short recap, or an explicitly labelled briefing preview until one exists, with its body clamped to three visual lines. A changed conversation marks an older recap as stale. Closing the call UI requests an asynchronous recap using the cheap model (maximum 32 invocations, also bounded by the sync's saved ceiling); interrupted browser exits cannot guarantee that request. **Make recap / Refresh recap** retries explicitly, and the next sync recomputes changed prior inputs from cache. Recaps never change notes, source snapshots or coverage. Enabled automatic preparation also permits these preparation recaps and briefing model calls in the background; merely browsing does not. Native recall can reuse these prior-sync recaps, but cannot quote original words from them; historical lookup automatically retrieves retained original excerpts across sessions and syncs through the local hybrid index, separately from frozen discussion and recaps; see [MEMORY.md](MEMORY.md).
128
+ The card shows a short recap, or an explicitly labelled briefing preview until one exists, with its body clamped to three visual lines. A changed conversation marks an older recap as stale. Closing the call UI requests an asynchronous recap using the cheap model (maximum 32 invocations, also bounded by the sync's saved ceiling); interrupted browser exits cannot guarantee that request. **Make recap / Refresh recap** retries explicitly, and the next sync recomputes changed prior inputs from cache. Recaps never change notes, source snapshots or coverage. Automatic indexing never runs these recap or briefing model calls; merely browsing does not start them either. Native recall can reuse these prior-sync recaps, but cannot quote original words from them; historical lookup automatically retrieves retained original excerpts across sessions and syncs through the local hybrid index, separately from frozen discussion and recaps; see [MEMORY.md](MEMORY.md).
131
129
 
132
130
  The migration adds presentation/recap-cache tables and removes the single-open-sync index without rewriting original rows. Once multiple open snapshots exist, do not blindly downgrade to the old one-open-sync schema. ChatGPT is the only voice engine. Removing the old engine does not remove its historical records, and updating the app does not require restoring an old database.
133
131
 
@@ -165,7 +163,7 @@ Current limits: discovery is eight directories deep; each scan reads up to 32 Mi
165
163
 
166
164
  Session logs can contain private source code, prompts, command output, and credentials.
167
165
 
168
- - **Provider-model use starts through conversation/preparation actions or the explicitly enabled combined automatic-preparation mode.** The combined action prepares previous recaps and a new briefing before calling; closing the call UI requests a derived recap. Voice turns do not invoke pi. Calls open a persistent OpenAI audio session at call start; idle/quota accounting is not established. There is no separate permission checkbox. Scanning and reading evidence stay local. History lookup automatically prepares/updates a local embedding index when needed; first use downloads pinned public weights. Text questions and calls receive relevant historical excerpts by default through their existing model. Merely opening a page performs no embedding inference; the explicitly enabled automatic-preparation schedule runs independently of browsing and can also use the configured summary/final models.
166
+ - **Provider-model use starts through explicit conversation/preparation interactions, never automatic indexing.** The Sync action prepares previous recaps and a new briefing before calling; closing the call UI requests a derived recap. Voice turns do not invoke pi. Calls open a persistent OpenAI audio session at call start; idle/quota accounting is not established. There is no separate permission checkbox. Scanning and reading evidence stay local. History lookup automatically prepares/updates a local embedding index when needed; first use downloads pinned public weights. Text questions and calls receive relevant historical excerpts by default through their existing model. Merely opening a page performs no embedding inference; the saved automatic-indexing schedule runs independently of browsing but never uses provider summary/final models.
169
167
  - Thinking blocks, system prompts, images, and opaque signatures are not indexed. Tool-call arguments are minimized; common secret patterns are redacted. **This is best-effort, not a guarantee that the remaining text is safe to share.** Inspect evidence and exclude sensitive sessions before calling a provider.
170
168
  - SQLite contains verified live-session and frozen-snapshot pointers, cached summaries, run metadata, decisions and conversations—not copies of original agent entry bodies. It lives outside the checkout in `~/.draken/draken.db` by default. **Original agent JSONL files are the authoritative archive, including for old snapshots.** Back up both those files and Draken's private state. Missing/changed originals are labelled unavailable; discussion and notes remain accessible, but generating replies, calling or reviewing that snapshot requires restoring its evidence. Search stores passage hashes, unique vectors, source links and contentless keyword postings, not passage bodies. See [MEMORY.md](MEMORY.md) for migration and storage details. There is no in-app retention/purge UI yet.
171
169
  - The server defaults to loopback with **no dashboard login**. Explicitly configured credentials (or `DRAKEN_NO_AUTH=false`) retain authentication even on loopback. Local API access still rejects cross-origin requests and unexpected Host headers.
package/SETUP.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Draken uses **pi for summaries, preparation recaps and text discussion**, regardless of which coding agent produced the imported history. It does not implement provider OAuth, translate another agent's credentials, or run Claude/Codex to summarize.
4
4
 
5
- > This guide is for **Draken 0.5.1**. Versions **0.1.6 and earlier** are the old task dashboard. Before upgrading, back up your original agent logs and Draken data; see [what changed](CHANGELOG.md#051).
5
+ > This guide is for **Draken 0.6.0**. Versions **0.1.6 and earlier** are the old task dashboard. Before upgrading, back up your original agent logs and Draken data; see [what changed](CHANGELOG.md#060).
6
6
 
7
7
  ## Install and start
8
8
 
@@ -21,7 +21,7 @@ Installation does not launch a server or register a background service. `draken`
21
21
  - `draken doctor`: checks the selected pi executable, version and configured model credentials. It does not create the application database, generate text or verify provider access/billing. A non-ready result exits nonzero.
22
22
  - A duplicate launch on an occupied HTTP/HTTPS port exits **before opening the database or recovering interrupted runs**.
23
23
 
24
- **Automatic preparation is on by default for new installations.** While the server runs, it scans enabled sources, updates local search and uses configured summary/briefing models and their quota or API billing within the saved invocation limit. First use may download the local search model. Turn it off in **Settings → Automatically prepare conversations** before configuring models if you prefer manual preparation. Existing installations keep their previous behavior, including off or no saved preference; older local-index-only consent is not upgraded to model usage. Provider failures pause until you explicitly retry in Settings after fixing setup. Source/session exclusions still apply, Codex and Claude remain separately opt-in, and no call, microphone or review starts automatically. **Settings → Preparation usage** shows preparation-only cost estimates, not total spending or quota.
24
+ **Automatic local indexing is on by default for new installations.** While the server runs, it checks enabled sources once a minute and indexes batches at 64 source changes. Smaller tails wait for explicit foreground preparation, with no timed flush. It accumulates searchable history without creating syncs, summaries or briefings and makes no provider model calls. Local embeddings use CPU, memory and disk; first use may download about 136 MB of pinned search model files. Change this in **Settings → Automatically index history**. Existing installations keep their saved indexing choice, including off. Calls and foreground work take priority; disabling cancels automatic indexing and retains completed embeddings. Local failures back off for at least five minutes, with **Retry automatic indexing** available in Settings. Source/session exclusions still apply, and Codex and Claude remain separately opt-in. Only your explicit **Sync with Draken** or **Chat instead** action starts a new snapshot and briefing using configured models and their quota or API billing. Existing snapshots and notes remain untouched; no call, microphone or review starts automatically. **Settings → Preparation usage** retains preparation-only cost estimates, including past automatic work, not total spending or quota.
25
25
 
26
26
  Loopback (`http://127.0.0.1:40333`) needs no dashboard login by default. LAN exposure still requires configured dashboard authentication and trusted HTTPS for microphone access. There is no automatic firewall change or certificate trust installation.
27
27
 
@@ -101,7 +101,7 @@ Home shows first-run guidance when no syncs exist, and a setup notice whenever s
101
101
 
102
102
  Choose **Settings → Agents & sessions**. Enable the history sources you want and use **Scan enabled agents**, or let the next explicit sync scan them. Source roots and permissions are independent of the private summarization runtime: installing pi does not enable Codex/Claude histories or change the original pi archive. See [SOURCES.md](SOURCES.md).
103
103
 
104
- Opening these instructions checks local metadata only. It does not install packages, refresh OAuth tokens, download embeddings, generate a summary, create a snapshot, acquire a microphone, or mark work reviewed. Enabled automatic preparation runs independently of these instructions; it is on by default for new installations and can be turned off in Settings.
104
+ Opening these instructions checks local metadata only. It does not install packages, refresh OAuth tokens, download embeddings, generate a summary, create a snapshot, acquire a microphone, or mark work reviewed. Enabled automatic local indexing runs independently of these instructions; it is on by default for new installations and can be turned off in Settings. It never creates snapshots or runs summary/briefing models.
105
105
 
106
106
  ## Recovery and maintenance
107
107
 
package/TRAY.md CHANGED
@@ -31,11 +31,11 @@ An already-running server is observed, not adopted. Stop is disabled for it, and
31
31
 
32
32
  ## How it works
33
33
 
34
- `draken tray` starts a detached Node companion and waits for native UI readiness before reporting success. One heartbeat lock per data directory prevents duplicate companions. After an unclean exit, stale-lock recovery takes approximately 30 seconds; there is no unconditional lock deletion or PID-based kill.
34
+ `draken tray` starts a detached Node companion and waits for native UI readiness before reporting success. One heartbeat lock per data directory prevents duplicate companions. After an unclean companion exit, stale-lock recovery takes approximately 30 seconds; there is no unconditional lock deletion or PID-based kill. This is not the server's exclusion mechanism: every server independently acquires non-expiring, kernel-backed data-directory ownership before database initialization/recovery. See [server ownership and shutdown](ARCHITECTURE.md#languages-and-build-output).
35
35
 
36
36
  The companion polls only the bounded `/api/auth/status` identity endpoint. The native UI receives a bounded private presentation file and heartbeat, not server credentials, provider environment variables, source text, or tokens. Menu clicks return only fixed action identifiers. If the companion stops updating, the helper closes itself after 15 seconds.
37
37
 
38
- An owned server reports its actual bound addresses and instance over a private parent/child IPC channel. Stop requests and parent disconnect use that channel, including on Windows, where `kill(SIGTERM)` would be an abrupt termination. There is no new HTTP shutdown endpoint. Lost helpers cause shutdown of the tray's owned server only; existing external servers are unaffected.
38
+ An owned server reports its actual bound addresses and instance over a private parent/child IPC channel. Stop requests and parent disconnect use that channel, including on Windows, where `kill(SIGTERM)` would be an abrupt termination. There is no new HTTP shutdown endpoint. Server shutdown retains directory ownership until resource exit is confirmed; an unconfirmed stop leaves the server in a failed stopping state and the tray cannot replace it. Lost helpers cause shutdown of the tray's owned server only; existing external servers are unaffected.
39
39
 
40
40
  Private state is under `<DRAKEN_DATA_DIR>/tray/` (default `~/.draken/tray/`):
41
41
 
package/VOICE.md CHANGED
@@ -51,7 +51,7 @@ One call may be active at a time, with a 30-minute limit, at most 60 user messag
51
51
 
52
52
  ## Evidence, records and recap
53
53
 
54
- - Voice questions do **not** start pi, local transcription or local synthesis. The call receives a bounded briefing, saved notes and source excerpts. Explicit source/history questions can request more data from the same frozen snapshot. Calls use bounded semantic + keyword retrieval across retained older records, using the local index described in [MEMORY.md](MEMORY.md). The local model/index must be prepared before calling is enabled; first preparation may take minutes. During the call, retrieval uses that prepared cutoff and verifies original sources without building new corpus embeddings. Expand **Conversation & details** for the full transcript, sources and any later history progress. Optional **Settings → Automatically prepare conversations** prepares both that history and a new briefing in one idle pipeline, starting new batches at 64 source changes or waiting entries and resuming incomplete owned batches. It uses the configured pi summary/final models before the conversation, but never starts capture, calls or review. Smaller batches wait for explicit preparation, and keep Call disabled if history is not ready. This block starts collapsed for every call; its progress polling reads metadata only. Those dated excerpts also go to ChatGPT; they are not new snapshot evidence. The embedding runtime is text-only and is not a replacement speech engine.
54
+ - Voice questions do **not** start pi, local transcription or local synthesis. The call receives a bounded briefing, saved notes and source excerpts. Explicit source/history questions can request more data from the same frozen snapshot. Calls use bounded semantic + keyword retrieval across retained older records, using the local index described in [MEMORY.md](MEMORY.md). The local model/index must be prepared before calling is enabled; first preparation may take minutes. During the call, retrieval uses that prepared cutoff and verifies original sources without building new corpus embeddings. Expand **Conversation & details** for the full transcript, sources and any later history progress. Optional **Settings → Automatically index history** accumulates searchable history locally in idle batches of at least 64 source changes. It never creates syncs, summaries or briefings and makes no provider model calls. Creating a sync and generating its briefing require an explicit user action; automatic indexing never starts capture, calls or review. Smaller batches wait for explicit preparation, and keep Call disabled if history is not ready. This block starts collapsed for every call; its progress polling reads metadata only. Those dated excerpts also go to ChatGPT; they are not new snapshot evidence. The embedding runtime is text-only and is not a replacement speech engine.
55
55
  - The read-only lookup service is not a coding model or a general web search. Tool-execution and approval requests are denied. Calls cannot edit files, deploy work, save decisions by model instruction, finish syncs or advance coverage.
56
56
  - Speech may paraphrase. **Sources supplied** means context was given to the model, not that every spoken claim was verified. Responses are not held for whole-answer JSON validation before playback.
57
57
  - History stores ordered user/assistant messages with generated/interrupted labels. It does not invent question–answer pairs, exact played words, human hearing or agreement. Historical records from the retired engine retain their original playback reports and are labelled separately.
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/auth/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG1D,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,UAAU;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,oBAAqB,SAAQ,OAAO;IACnD,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAID,wBAAgB,YAAY,IAAI,OAAO,CAStC;AAKD,wBA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I,CA0BjG;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAStD;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAO/E"}
@@ -29,18 +29,13 @@ function isNoAuthMode() {
29
29
  const credentialsConfigured = Boolean(process.env.DRAKEN_USERNAME || process.env.DRAKEN_PASSWORD || process.env.DRAKEN_JWT_SECRET);
30
30
  return isLoopbackHost(process.env.DRAKEN_HOST || '127.0.0.1') && !credentialsConfigured;
31
31
  }
32
- // Get auth configuration from environment variables
33
- // Returns null only if NO_AUTH mode is enabled
34
- // Throws error if auth is required but not properly configured
35
32
  function getAuthConfig() {
36
- // Loopback defaults to no login; an explicit override is also supported.
37
33
  if (isNoAuthMode()) {
38
34
  return null;
39
35
  }
40
36
  const username = process.env.DRAKEN_USERNAME;
41
37
  const password = process.env.DRAKEN_PASSWORD;
42
38
  const jwtSecret = process.env.DRAKEN_JWT_SECRET;
43
- // All three are required when auth is enabled
44
39
  const missing = [];
45
40
  if (!username)
46
41
  missing.push('DRAKEN_USERNAME');
@@ -59,23 +54,18 @@ function getAuthConfig() {
59
54
  tokenExpiry: process.env.DRAKEN_TOKEN_EXPIRY || '7d',
60
55
  };
61
56
  }
62
- // Validate auth config on startup (call this early in server initialization)
63
57
  function validateAuthConfig() {
64
58
  if (isNoAuthMode()) {
65
59
  console.log('Local mode: no dashboard login (loopback only).');
66
60
  return;
67
61
  }
68
- // This will throw if config is invalid
69
62
  const config = getAuthConfig();
70
63
  console.log(`Authentication enabled for user: ${config.username}`);
71
64
  }
72
- // Check if authentication is enabled
73
65
  function isAuthEnabled() {
74
66
  return !isNoAuthMode();
75
67
  }
76
- // Authentication middleware
77
68
  function authMiddleware(req, res, next) {
78
- // If NO_AUTH mode, allow all requests
79
69
  if (isNoAuthMode()) {
80
70
  return next();
81
71
  }
@@ -100,7 +90,6 @@ function authMiddleware(req, res, next) {
100
90
  }
101
91
  }
102
92
  }
103
- // Generate JWT token
104
93
  function generateToken(username) {
105
94
  const config = getAuthConfig();
106
95
  if (!config) {
@@ -110,13 +99,11 @@ function generateToken(username) {
110
99
  expiresIn: config.tokenExpiry,
111
100
  });
112
101
  }
113
- // Validate credentials
114
102
  function validateCredentials(username, password) {
115
103
  const config = getAuthConfig();
116
104
  if (!config) {
117
105
  return false;
118
106
  }
119
- // Simple comparison - credentials are from env vars
120
107
  return username === config.username && password === config.password;
121
108
  }
122
109
  //# sourceMappingURL=middleware.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../src/auth/middleware.ts"],"names":[],"mappings":";;;;;AAoBA,wCAEC;AAID,oCASC;AAKD,sCA6BC;AAGD,gDASC;AAGD,sCAEC;AAGD,wCA2BC;AAGD,sCASC;AAGD,kDAQC;AA1ID,gEAA+B;AAmB/B,SAAgB,cAAc,CAAC,IAAY;IACzC,OAAO,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC1D,CAAC;AAED,+EAA+E;AAC/E,iFAAiF;AACjF,SAAgB,YAAY;IAC1B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAC5C,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,IAAI,QAAQ,KAAK,MAAM;YAAE,OAAO,IAAI,CAAC;QACrC,IAAI,QAAQ,KAAK,OAAO;YAAE,OAAO,KAAK,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC7F,CAAC;IACD,MAAM,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnI,OAAO,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,WA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CAAC,iBAAiB,EAAE,CAAC;YACzC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;QAC1E,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAgB,aAAa,CAAC,QAAgB;IAC5C,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,sBAAG,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,MAAM,CAAC,SAAS,EAAE;QAC9C,SAAS,EAAE,MAAM,CAAC,WAA2C;KAC9D,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,mBAAmB,CAAC,QAAgB,EAAE,QAAgB;IACpE,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,QAAQ,KAAK,MAAM,CAAC,QAAQ,IAAI,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC;AACtE,CAAC"}
package/dist/cli.js CHANGED
@@ -105,8 +105,12 @@ Native voice has a separate account. No startup action captures audio or calls m
105
105
  return (0, setup_1.loginPi)();
106
106
  if (args[0] === 'doctor' && args.length === 1)
107
107
  return (0, setup_1.doctor)();
108
- if (args[0] === 'voice' && args.length === 2)
109
- return (0, setup_1.voiceSetup)(args[1]);
108
+ if (args[0] === 'voice' && args.length === 2) {
109
+ if (args[1] === 'login' && !process.stdin.isTTY)
110
+ throw new Error('Run draken voice login in an interactive terminal on the server.');
111
+ const { voiceSetup } = require('../voice/realtime/setup.mjs');
112
+ return voiceSetup(args[1]);
113
+ }
110
114
  if (args[0] === 'status' && args.length === 1) {
111
115
  const target = (0, server_state_1.serverTarget)(), url = target.url;
112
116
  try {
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4CAAoB;AACpB,gDAAwB;AACxB,qCAAuC;AACvC,iDAA8C;AAC9C,mDAA8C;AAC9C,8CAA6C;AAC7C,sCAAoE;AAEpE,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;AACrG,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC,IAAI,CAAC,MAAM;QAAE,OAAO,IAAA,oBAAW,GAAE,CAAC;IACvC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,MAAM;QAAE,OAAO,IAAA,qBAAU,GAAE,CAAC;IACjE,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,eAAe,IAAI,OAAO,CAAC,IAAI;QAAE,OAAO,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC/F,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,eAAe,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACrE,MAAM,EAAE,aAAa,EAAE,GAAG,wDAAa,eAAe,GAAC,CAAC;QACxD,OAAO,aAAa,EAAE,CA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AAE,gEAAgE,CAAC,CAAC;QACxN,CAAC;QAAC,MAAM,CAAC;YAAC,OAAO,CAAC,KAAK,CAAC,+BAA+B,GAAG,qMAAqM,CAAC,CAAC;YAAC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QAAC,CAAC;QACzR,OAAO;IACT,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,sBAAsB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AAC9E,CAAC;AACD,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wCAAwC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function getDataDir(): string;
2
+ //# sourceMappingURL=data-dir.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-dir.d.ts","sourceRoot":"","sources":["../src/data-dir.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,IAAI,MAAM,CAEnC"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getDataDir = getDataDir;
7
+ const path_1 = __importDefault(require("path"));
8
+ const os_1 = __importDefault(require("os"));
9
+ function getDataDir() {
10
+ return path_1.default.resolve(process.env.DRAKEN_DATA_DIR || path_1.default.join(os_1.default.homedir(), '.draken'));
11
+ }
12
+ //# sourceMappingURL=data-dir.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-dir.js","sourceRoot":"","sources":["../src/data-dir.ts"],"names":[],"mappings":";;;;;AAGA,gCAEC;AALD,gDAAwB;AACxB,4CAAoB;AAEpB,SAAgB,UAAU;IACxB,OAAO,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC;AACzF,CAAC"}
@@ -22,7 +22,8 @@ export interface FrozenPointer {
22
22
  }
23
23
  export declare const recordPointer: (row: RecordPointer) => RecordPointer;
24
24
  export declare function encodeEvidence(item: Evidence, pointer: FrozenPointer): string;
25
- /** Frozen membership, attribution and projection; original bytes stay in pi.
25
+ /** Live frozen membership, attribution and projection require original records.
26
+ * Copied-text compatibility belongs to migration, not snapshot reads.
26
27
  * Share one reader per snapshot/request rather than reopening a file per item. */
27
28
  export declare class EvidenceReader {
28
29
  private db;
@@ -1 +1 @@
1
- {"version":3,"file":"evidence.d.ts","sourceRoot":"","sources":["../../src/db/evidence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAgC,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC5F,OAAO,EAAgB,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC1F,OAAO,EAA4C,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGpH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;IACf,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,aAAa,CAAC;IACxB,aAAa,EAAE,oBAAoB,CAAC;IACpC,IAAI,CAAC,EAAE,aAAa,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,oBAAoB,CAAA;KAAE,CAAC;IACpG,IAAI,CAAC,EAAE;QA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AC;IACf,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,aAAa,CAAC;IACxB,aAAa,EAAE,oBAAoB,CAAC;IACpC,IAAI,CAAC,EAAE,aAAa,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,oBAAoB,CAAA;KAAE,CAAC;IACpG,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,oBAAoB,CAAA;KAAE,CAAC;IAC9D,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,IAAI,CAAC;CAC1B;AAGD,eAAO,MAAM,aAAa,GAAI,KAAK,aAAa,KAAG,aAAqH,CAAC;AACzK,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAG7E;AAED;;kFAEkF;AAClF,qBAAa,cAAc;IAGb,OAAO,CAAC,EAAE;IAFtB,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,KAAK,CAAyC;gBAClC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,GAAE,SAA4B,EAAE,KAAK,CAAC,EAAE,kBAAkB;IACzG,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM;IA2BvD,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,mBAAmB,UAAQ,GAAG,QAAQ;IAehF,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM;IAkB9B,KAAK;CACN"}
@@ -5,7 +5,6 @@ exports.encodeEvidence = encodeEvidence;
5
5
  const normalize_1 = require("../sync/normalize");
6
6
  const jsonl_1 = require("../sync/jsonl");
7
7
  const registry_1 = require("../sources/registry");
8
- const retained_text_1 = require("./retained-text");
9
8
  const pointers = new WeakMap();
10
9
  const UNAVAILABLE_EVIDENCE = 'Original session evidence is unavailable or changed. Restore the original session file; Draken does not keep a text copy.';
11
10
  const recordPointer = (row) => ({ record_offset: row.record_offset, record_bytes: row.record_bytes, record_hash: row.record_hash });
@@ -14,7 +13,8 @@ function encodeEvidence(item, pointer) {
14
13
  const { text: _text, unavailable: _unavailable, ...metadata } = item;
15
14
  return JSON.stringify({ ...metadata, source_key: (0, normalize_1.sourceKey)(item), source_pointer: pointer });
16
15
  }
17
- /** Frozen membership, attribution and projection; original bytes stay in pi.
16
+ /** Live frozen membership, attribution and projection require original records.
17
+ * Copied-text compatibility belongs to migration, not snapshot reads.
18
18
  * Share one reader per snapshot/request rather than reopening a file per item. */
19
19
  class EvidenceReader {
20
20
  db;
@@ -62,11 +62,11 @@ class EvidenceReader {
62
62
  }
63
63
  read(value, tolerateUnavailable = false) {
64
64
  const encoded = typeof value === 'string' ? JSON.parse(value) : value;
65
- if (!encoded.source_pointer)
66
- return (0, retained_text_1.thawEvidence)(this.db, encoded); // Legacy migration/import reader only.
67
65
  const { source_pointer, source_key, ...metadata } = encoded;
68
66
  let item;
69
67
  try {
68
+ if (!source_pointer)
69
+ throw new Error(UNAVAILABLE_EVIDENCE);
70
70
  item = { ...metadata, text: this.project(metadata, source_pointer) };
71
71
  }
72
72
  catch (error) {
@@ -74,7 +74,8 @@ class EvidenceReader {
74
74
  throw error;
75
75
  item = { ...metadata, text: '', source_key, unavailable: UNAVAILABLE_EVIDENCE };
76
76
  }
77
- pointers.set(item, source_pointer);
77
+ if (source_pointer)
78
+ pointers.set(item, source_pointer);
78
79
  return item;
79
80
  }
80
81
  freeze(item) {
@@ -1 +1 @@
1
- {"version":3,"file":"evidence.js","sourceRoot":"","sources":["../../src/db/evidence.ts"],"names":[],"mappings":";;;AAoBA,wCAGC;AArBD,iDAA4F;AAC5F,yCAA0F;AAC1F,kDAAoH;AACpH,mDAA+C;AAY/C,MAAM,QAAQ,GAAG,IAAI,OAAO,EAA2B,CAAC;AACxD,MA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AC;QACxF,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAAC,OAAO,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;IACD,KAAK,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CACrD;AAjED,wCAiEC"}
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.entryTable = entryTable;
7
7
  exports.migratePointers = migratePointers;
8
8
  const fs_1 = __importDefault(require("fs"));
9
- const source_files_1 = require("../sync/source-files");
9
+ const jsonl_1 = require("../sync/jsonl");
10
10
  const normalize_1 = require("../sync/normalize");
11
11
  const retained_text_1 = require("./retained-text");
12
12
  function entryTable(name, legacy = true) {
@@ -52,9 +52,9 @@ function migratePointers(db) {
52
52
  const found = new Map();
53
53
  let fd;
54
54
  try {
55
- fd = (0, source_files_1.openSessionFile)(session.path, (0, source_files_1.getSessionRoot)(), session.file_identity);
56
- (0, source_files_1.verifySessionHeader)(fd, session.id);
57
- for (const pointer of (0, source_files_1.fileRecords)(fd, Math.min(fs_1.default.fstatSync(fd).size, session.byte_offset))) {
55
+ fd = (0, jsonl_1.openSessionFile)(session.path, (0, jsonl_1.getSessionRoot)(), session.file_identity);
56
+ (0, jsonl_1.verifySessionHeader)(fd, session.id);
57
+ for (const pointer of (0, jsonl_1.fileRecords)(fd, Math.min(fs_1.default.fstatSync(fd).size, session.byte_offset))) {
58
58
  if (!wanted.has(pointer.value?.id))
59
59
  continue;
60
60
  const entry = (0, normalize_1.normalizeEntry)(pointer.value);
@@ -1 +1 @@
1
- {"version":3,"file":"pointer-migration.js","sourceRoot":"","sources":["../../src/db/pointer-migration.ts"],"names":[],"mappings":";;;;;AAMA,gCAiBC;AAKD,0CAgEC;AA5FD,4CAAoB;AAEpB,uDAA6H;AAC7H,iDAAyE;AACzE,mDAA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AAC,2KAA2K,CAAC,CAAC;QACrL,MAAM,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,uEAAuE,CAAC,CAAC;QACnG,KAAK,MAAM,GAAG,IAAI,EAAE,CAAC,OAAO,CAAC,wDAAwD,CAAC,CAAC,GAAG,EAAW,EAAE,CAAC;YACtG,MAAM,CAAC,GAAG,CAAC,IAAA,8BAAc,EAAC,EAAE,EAAE,IAAA,4BAAY,EAAC,EAAE,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;QAClG,CAAC;QACD,KAAK,MAAM,GAAG,IAAI,EAAE,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC,GAAG,EAAW,EAAE,CAAC;YACjF,MAAM,OAAO,GAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,CAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAA,8BAAc,EAAC,EAAE,EAAE,IAAA,4BAAY,EAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5H,EAAE,CAAC,OAAO,CAAC,4CAA4C,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAChG,CAAC;QACD,EAAE,CAAC,OAAO,CAAC,4EAA4E,CAAC,CAAC,GAAG,EAAE,CAAC;IACjG,CAAC,CAAC,EAAE,CAAC;AACP,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import Database from 'better-sqlite3';
2
- export declare function getDataDir(): string;
3
2
  export declare function getDb(): Database.Database;
4
3
  export declare function initSchema(database: Database.Database): void;
5
4
  export declare function closeDb(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAQtC,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAID,wBAAgB,KAAK,IAAI,QAAQ,CAAC,QAAQ,CAazC;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAgM5D;AAED,wBAAgB,OAAO,IAAI,IAAI,CAG9B"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAUtC,wBAAgB,KAAK,IAAI,QAAQ,CAAC,QAAQ,CAazC;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAoM5D;AAED,wBAAgB,OAAO,IAAI,IAAI,CAG9B"}