draken 0.5.1 → 0.7.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.
- package/CHANGELOG.md +40 -0
- package/MEMORY.md +43 -6
- package/PERSONA.md +9 -2
- package/README.md +14 -14
- package/SETUP.md +23 -3
- package/TRAY.md +4 -4
- package/VOICE.md +1 -1
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +0 -13
- package/dist/auth/middleware.js.map +1 -1
- package/dist/cli.js +6 -2
- package/dist/cli.js.map +1 -1
- package/dist/data-dir.d.ts +2 -0
- package/dist/data-dir.d.ts.map +1 -0
- package/dist/data-dir.js +12 -0
- package/dist/data-dir.js.map +1 -0
- package/dist/db/evidence.d.ts +2 -1
- package/dist/db/evidence.d.ts.map +1 -1
- package/dist/db/evidence.js +6 -5
- package/dist/db/evidence.js.map +1 -1
- package/dist/db/pointer-migration.js +4 -4
- package/dist/db/pointer-migration.js.map +1 -1
- package/dist/db/schema.d.ts +0 -1
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +31 -7
- package/dist/db/schema.js.map +1 -1
- package/dist/errors.d.ts +5 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +12 -0
- package/dist/errors.js.map +1 -0
- package/dist/memory/context.d.ts +2 -9
- package/dist/memory/context.d.ts.map +1 -1
- package/dist/memory/context.js +7 -84
- package/dist/memory/context.js.map +1 -1
- package/dist/memory/embedding-contract.d.ts +5 -0
- package/dist/memory/embedding-contract.d.ts.map +1 -0
- package/dist/memory/embedding-contract.js +12 -0
- package/dist/memory/embedding-contract.js.map +1 -0
- package/dist/memory/embedding-pool.d.ts +1 -2
- package/dist/memory/embedding-pool.d.ts.map +1 -1
- package/dist/memory/embedding-pool.js +9 -9
- package/dist/memory/embedding-pool.js.map +1 -1
- package/dist/memory/embedding-worker.js +2 -1
- package/dist/memory/embedding-worker.js.map +1 -1
- package/dist/{voice/history-focus.d.ts → memory/focus.d.ts} +6 -6
- package/dist/memory/focus.d.ts.map +1 -0
- package/dist/{voice/history-focus.js → memory/focus.js} +6 -6
- package/dist/memory/focus.js.map +1 -0
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/memory/index.js +12 -15
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/model-assets.d.ts +5 -0
- package/dist/memory/model-assets.d.ts.map +1 -0
- package/dist/memory/model-assets.js +84 -0
- package/dist/memory/model-assets.js.map +1 -0
- package/dist/memory/model.d.ts +2 -7
- package/dist/memory/model.d.ts.map +1 -1
- package/dist/memory/model.js +13 -83
- package/dist/memory/model.js.map +1 -1
- package/dist/memory/packet.d.ts +9 -0
- package/dist/memory/packet.d.ts.map +1 -0
- package/dist/memory/packet.js +78 -0
- package/dist/memory/packet.js.map +1 -0
- package/dist/memory/passages.d.ts +15 -0
- package/dist/memory/passages.d.ts.map +1 -0
- package/dist/memory/passages.js +22 -0
- package/dist/memory/passages.js.map +1 -0
- package/dist/memory/readiness.d.ts.map +1 -1
- package/dist/memory/readiness.js +2 -6
- package/dist/memory/readiness.js.map +1 -1
- package/dist/memory/service.d.ts +2 -1
- package/dist/memory/service.d.ts.map +1 -1
- package/dist/memory/service.js +46 -22
- package/dist/memory/service.js.map +1 -1
- package/dist/memory/sources.d.ts +0 -1
- package/dist/memory/sources.d.ts.map +1 -1
- package/dist/memory/sources.js +3 -7
- package/dist/memory/sources.js.map +1 -1
- package/dist/memory/stamps.d.ts +3 -3
- package/dist/memory/stamps.d.ts.map +1 -1
- package/dist/memory/stamps.js +3 -3
- package/dist/memory/stamps.js.map +1 -1
- package/dist/memory/storage.d.ts.map +1 -1
- package/dist/memory/storage.js +3 -2
- package/dist/memory/storage.js.map +1 -1
- package/dist/memory/types.d.ts +2 -1
- package/dist/memory/types.d.ts.map +1 -1
- package/dist/memory/types.js +2 -1
- package/dist/memory/types.js.map +1 -1
- package/dist/pi/runtime.js +7 -7
- package/dist/pi/runtime.js.map +1 -1
- package/dist/pi/setup.d.ts +0 -1
- package/dist/pi/setup.d.ts.map +1 -1
- package/dist/pi/setup.js +2 -11
- package/dist/pi/setup.js.map +1 -1
- package/dist/routes/auth.d.ts.map +1 -1
- package/dist/routes/auth.js +0 -5
- package/dist/routes/auth.js.map +1 -1
- package/dist/routes/http.d.ts +6 -0
- package/dist/routes/http.d.ts.map +1 -0
- package/dist/routes/http.js +22 -0
- package/dist/routes/http.js.map +1 -0
- package/dist/routes/live-voice.d.ts.map +1 -1
- package/dist/routes/live-voice.js +18 -32
- package/dist/routes/live-voice.js.map +1 -1
- package/dist/routes/memory.d.ts.map +1 -1
- package/dist/routes/memory.js +8 -14
- package/dist/routes/memory.js.map +1 -1
- package/dist/routes/sync.d.ts.map +1 -1
- package/dist/routes/sync.js +65 -65
- package/dist/routes/sync.js.map +1 -1
- package/dist/routes/voice.d.ts.map +1 -1
- package/dist/routes/voice.js +7 -7
- package/dist/routes/voice.js.map +1 -1
- package/dist/server-ownership.d.ts +5 -0
- package/dist/server-ownership.d.ts.map +1 -0
- package/dist/server-ownership.js +34 -0
- package/dist/server-ownership.js.map +1 -0
- package/dist/server-state.js +3 -3
- package/dist/server-state.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +40 -10
- package/dist/server.js.map +1 -1
- package/dist/sync/activity.d.ts +26 -0
- package/dist/sync/activity.d.ts.map +1 -0
- package/dist/sync/activity.js +80 -0
- package/dist/sync/activity.js.map +1 -0
- package/dist/{memory/automatic.d.ts → sync/background.d.ts} +7 -12
- package/dist/sync/background.d.ts.map +1 -0
- package/dist/sync/background.js +184 -0
- package/dist/sync/background.js.map +1 -0
- package/dist/sync/collector.d.ts.map +1 -1
- package/dist/sync/collector.js +7 -6
- package/dist/sync/collector.js.map +1 -1
- package/dist/sync/manager.d.ts +1 -4
- package/dist/sync/manager.d.ts.map +1 -1
- package/dist/sync/manager.js +29 -49
- package/dist/sync/manager.js.map +1 -1
- package/dist/sync/models.d.ts +3 -0
- package/dist/sync/models.d.ts.map +1 -0
- package/dist/sync/models.js +12 -0
- package/dist/sync/models.js.map +1 -0
- package/dist/sync/pi.d.ts +1 -1
- package/dist/sync/pi.d.ts.map +1 -1
- package/dist/sync/pi.js +32 -19
- package/dist/sync/pi.js.map +1 -1
- package/dist/{voice → sync}/preparation.d.ts +0 -1
- package/dist/sync/preparation.d.ts.map +1 -0
- package/dist/{voice → sync}/preparation.js +10 -18
- package/dist/sync/preparation.js.map +1 -0
- package/dist/sync/retrieval.d.ts +3 -0
- package/dist/sync/retrieval.d.ts.map +1 -0
- package/dist/sync/retrieval.js +12 -0
- package/dist/sync/retrieval.js.map +1 -0
- package/dist/sync/source-files.d.ts +2 -4
- package/dist/sync/source-files.d.ts.map +1 -1
- package/dist/sync/source-files.js +5 -20
- package/dist/sync/source-files.js.map +1 -1
- package/dist/sync/store.d.ts +5 -15
- package/dist/sync/store.d.ts.map +1 -1
- package/dist/sync/store.js +41 -90
- package/dist/sync/store.js.map +1 -1
- package/dist/sync/summary-preparation.d.ts +14 -0
- package/dist/sync/summary-preparation.d.ts.map +1 -0
- package/dist/sync/summary-preparation.js +205 -0
- package/dist/sync/summary-preparation.js.map +1 -0
- package/dist/sync/tree.d.ts +17 -1
- package/dist/sync/tree.d.ts.map +1 -1
- package/dist/sync/tree.js +109 -49
- package/dist/sync/tree.js.map +1 -1
- package/dist/sync/usage.d.ts +3 -1
- package/dist/sync/usage.d.ts.map +1 -1
- package/dist/sync/usage.js +27 -9
- package/dist/sync/usage.js.map +1 -1
- package/dist/tray/launcher.js +2 -2
- package/dist/tray/launcher.js.map +1 -1
- package/dist/tray/worker.js +4 -4
- package/dist/tray/worker.js.map +1 -1
- package/dist/types.d.ts +9 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/voice/history-delivery.js +3 -3
- package/dist/voice/history-delivery.js.map +1 -1
- package/dist/voice/live-context.js +3 -3
- package/dist/voice/live-context.js.map +1 -1
- package/dist/voice/live.d.ts +1 -0
- package/dist/voice/live.d.ts.map +1 -1
- package/dist/voice/live.js +57 -34
- package/dist/voice/live.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-5bTQNQYG.js +131 -0
- package/public/index.html +1 -1
- package/voice/realtime/README.md +1 -1
- package/voice/realtime/helper-process.mjs +54 -0
- package/voice/realtime/native.mjs +55 -15
- package/voice/realtime/probe-server.mjs +24 -4
- package/voice/realtime/probe.mjs +49 -11
- package/voice/realtime/rpc.mjs +7 -32
- package/voice/realtime/setup.mjs +82 -19
- package/dist/memory/automatic.d.ts.map +0 -1
- package/dist/memory/automatic.js +0 -200
- package/dist/memory/automatic.js.map +0 -1
- package/dist/sync/automatic.d.ts +0 -7
- package/dist/sync/automatic.d.ts.map +0 -1
- package/dist/sync/automatic.js +0 -56
- package/dist/sync/automatic.js.map +0 -1
- package/dist/voice/history-focus.d.ts.map +0 -1
- package/dist/voice/history-focus.js.map +0 -1
- package/dist/voice/preparation.d.ts.map +0 -1
- package/dist/voice/preparation.js.map +0 -1
- package/public/assets/index-DrGvDGTG.js +0 -131
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Optional paid summary preparation, without automatic syncs
|
|
6
|
+
|
|
7
|
+
- Add **Settings → Prepare summaries ahead**, a NEW explicit paid opt-in (`auto_summary`), default **off** on fresh installs and upgrades—even when `auto_index=true` or the retired 0.5 paid setting was enabled. It requires **Automatically index history** to be enabled. Local indexing keeps its existing defaults/preferences and makes no provider calls by itself.
|
|
8
|
+
- While idle, check once a minute and prepare at least 64 new/changed eligible accumulated records, independently of the local embedding checkpoint. Warm the same validated `summary_cache` leaves, reconciliation and compact final input used by explicit syncs. Background preparation does not own or create syncs, snapshots, coverage, messages or tree rows, and never runs the final model, briefings or recaps.
|
|
9
|
+
- Reuse completed closed chunks across appends and make no further calls for unchanged prepared input while its validated cache remains intact. Lost or corrupt cache outputs trigger a bounded rebuild rather than postponing recovery until Start chat. Changed unfinished per-session tails and aggregate reconciliation may still need on-demand work at **Start chat**; the final briefing is always explicit. This reduces repeated preparation, not a promise of instant chat.
|
|
10
|
+
- Bound paid work by the configured summary model and the same `max_invocations` allowance, without provider/model fallback. Foreground work cancels and awaits owned background provider work. Valid cache survives cancellation/restarts; spending is retained when resuming the same interrupted input. Paid failures pause retries until an explicit retry; local indexing failures retain their five-minute retry delay. Disabling either setting stops paid background work without deleting cache.
|
|
11
|
+
|
|
12
|
+
### Durable accounting and preservation
|
|
13
|
+
|
|
14
|
+
- Add metadata-only `background_runs` for durable input hashes, invocation counters and metrics, not source text. **Preparation usage** includes background spend, requests and failures. `completed_batches` remains the count of explicit snapshots' first successful briefings; a warm cache is neither a sync nor review.
|
|
15
|
+
- Settings/progress GETs only read metadata. Existing histories, conversations, notes, coverage, frozen snapshots and compatible caches are preserved. No dependency changes.
|
|
16
|
+
- Focused regressions: `tests/background-tree.test.cjs`, `tests/background-preparation.test.cjs` and `tests/automatic-index.test.cjs`; production-package and static-site checks protect default-off consent and release copy. Synthetic checks do not establish real-provider quality, latency, quota or physical-audio acceptance.
|
|
17
|
+
|
|
18
|
+
### Upgrading
|
|
19
|
+
|
|
20
|
+
Back up original agent logs and Draken state, finish active work, stop the server (including any tray-owned server), install 0.7.0 and restart with the same data directory and environment. Node.js 22.19+ remains required. To get preparation ahead, keep **Automatically index history** enabled and explicitly enable the NEW **Prepare summaries ahead** switch; upgrading never converts local indexing or retired paid consent into this permission. Leaving it off keeps provider use tied to explicit preparation/conversation actions. Do not use an older binary to undo the additive schema change. See [SETUP.md](SETUP.md#upgrade-to-070) and [MEMORY.md](MEMORY.md#optional-paid-summary-preparation).
|
|
21
|
+
|
|
22
|
+
Previously oversized summary batches split at a moving midpoint may need one-time recomputation. The new stable-prefix planner preserves completed boundaries on future appends; ordinary batch keys and compatible historical leaf caches are retained.
|
|
23
|
+
|
|
24
|
+
## 0.6.0
|
|
25
|
+
|
|
26
|
+
### User-triggered syncs, automatic local indexing
|
|
27
|
+
|
|
28
|
+
- 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.
|
|
29
|
+
- 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.
|
|
30
|
+
- Keep local batching, durable checkpoints, foreground priority and bounded retries. See [MEMORY.md](MEMORY.md#optional-background-indexing) for the policy.
|
|
31
|
+
|
|
32
|
+
### Ownership and reliability
|
|
33
|
+
|
|
34
|
+
- 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.
|
|
35
|
+
- 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.
|
|
36
|
+
- 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.
|
|
37
|
+
- Strengthen historical compatibility, process-lifetime, package and optional qualification regressions. Documentation retains current contracts rather than implementation/review transcripts.
|
|
38
|
+
|
|
39
|
+
### Upgrading
|
|
40
|
+
|
|
41
|
+
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.
|
|
42
|
+
|
|
3
43
|
## 0.5.1
|
|
4
44
|
|
|
5
45
|
- 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
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
There is no memory-enable switch, search-mode selector or wider-history checkbox. An existing sync offers **Prepare history** when its call history is not ready. Historical retrieval does not replace the complete-snapshot summary tree or advance review coverage.
|
|
6
6
|
|
|
7
|
-
## Automatic preparation
|
|
7
|
+
## Automatic local search preparation
|
|
8
8
|
|
|
9
9
|
The first request with eligible retained history downloads approximately **136 MB** of pinned model/tokenizer files from Hugging Face, verifies their SHA-256 checksums and prepares local embeddings. Later requests reuse them and automatically embed new or changed records. Empty history does not require a model download.
|
|
10
10
|
|
|
@@ -16,16 +16,53 @@ Opening/reloading a page does not itself download the model, compute embeddings
|
|
|
16
16
|
|
|
17
17
|
### Optional background indexing
|
|
18
18
|
|
|
19
|
-
**Settings → Automatically
|
|
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 or migrated into the new paid `auto_summary` opt-in. 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
|
|
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
|
|
23
|
+
Foreground requests preempt and await the owned automatic indexing job. Disabling cancels local indexing and also stops any separately opted-in paid background preparation, since paid work requires indexing enabled. Completed vectors and valid summary cache 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 ownership of a prepared briefing. The separate paid-preparation status does not turn local indexing into provider work. The saved preference and last completion survive restart.
|
|
24
24
|
|
|
25
|
-
|
|
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
|
+
### Optional paid summary preparation
|
|
30
|
+
|
|
31
|
+
**Draken 0.7.0 adds Settings → Prepare summaries ahead (`auto_summary`).** This is a NEW explicit paid opt-in, default **off** on fresh installations and upgrades, even when `auto_index=true` or the retired 0.5 paid setting was enabled. It requires **Automatically index history** to be enabled. Local indexing retains its defaults/preferences and makes no provider calls by itself. Opening `GET /api/settings/auto-summary` returns metadata (`enabled=false` on a fresh installation); neither this GET nor other settings/progress reads scan history, start inference or grant consent.
|
|
32
|
+
|
|
33
|
+
#### Read-only eligibility, shared summary cache
|
|
34
|
+
|
|
35
|
+
Paid preparation reads the accumulated entries eligible for the next explicit snapshot, respecting enabled agents, session selection, baseline, active-branch projection, verified originals, existing coverage and entries already held by open syncs. It does not reserve those entries or create/own `syncs`, `sync_items`, `sync_coverage`, `sync_messages`, `sync_runs` or `sync_tree_nodes` rows. It never runs the final model, generates a briefing or recap, starts a call, saves user notes or advances review. Existing histories, notes, coverage and frozen snapshots are unchanged.
|
|
36
|
+
|
|
37
|
+
The work warms the **same validated `summary_cache` leaves plus reconciliation/compact final input used by explicit sync**, with the same model/prompt/content identity and citation validation—not a separate rolling-memory summary or an unvalidated text shortcut. An explicit sync freezes all then-eligible accumulated evidence and consumes matching cache; warming cache is neither inclusion nor review. Completed closed chunks remain reusable across appends. Changed unfinished per-session tails and aggregate reconciliation may need on-demand work at **Start chat**; the final briefing and any prior-conversation recaps always remain explicit. Cache preparation can reduce repeated work, but does not promise zero latency.
|
|
38
|
+
|
|
39
|
+
#### Scheduling, ownership and recovery
|
|
40
|
+
|
|
41
|
+
- The scheduler checks **once a minute while idle**, requiring **at least 64 new/changed eligible records** for a new paid batch. This count is independent of the successful embedding checkpoint: local indexing cannot consume the paid backlog. Smaller tails wait for explicit foreground preparation or sufficient new changes; there is no timed small-tail flush.
|
|
42
|
+
- An unchanged successfully prepared input with intact cached outputs causes **no further provider calls**. Receipts include hashes of every validated leaf and parent used by the build. Lost or corrupt outputs invalidate the receipt and permit a bounded rebuild; failures still pause paid retries. Eligibility/input hashes, rather than elapsed time or embedding progress, identify paid work and reuse. Edits count once per stable agent/session/entry identity; removals count too. Derived session titles are presentation metadata, not a change to every record in the session. Model, recipe or context changes can invalidate preparation even without new entries.
|
|
43
|
+
- Use only the configured summary model and the same configured **`max_invocations`** allowance. Repairs consume that allowance. There is no provider/model fallback and no final-model call. This is an invocation bound, not a token/dollar or subscription-quota guarantee.
|
|
44
|
+
- Foreground work **cancels and awaits owned background provider work** before proceeding. Shutdown also drains owned work. A cancellation request is not confirmation that the child/provider process exited.
|
|
45
|
+
- Valid completed cache survives cancellation and restart. Resuming the same interrupted input retains spent invocations rather than resetting the allowance. An interrupted request may have incurred provider usage even if no reusable result was saved.
|
|
46
|
+
- **Paid failures pause retries until explicit retry.** A timer, restart or additional source activity must not turn failure into an unattended paid retry loop. Local indexing failures retain their independent delay of at least **five minutes**.
|
|
47
|
+
- Disabling **either** setting stops paid background work; completed cache is preserved. Re-enabling is not permission to erase spending or treat cached work as a successful briefing/review.
|
|
48
|
+
|
|
49
|
+
#### Durable metadata and usage
|
|
50
|
+
|
|
51
|
+
The additive **`background_runs`** table stores durable input/cache hashes, invocation counters, state, content-free request metrics and timestamped failed-attempt events. Cancellation between successful provider calls still counts as an interrupted attempt; resuming the same run must not erase it or count it twice. It stores **no source text**, prompts or source excerpts; validated derived summaries belong in `summary_cache`. Persistence distinguishes prepared, interrupted and failed work across restarts without manufacturing a snapshot. Original logs remain authoritative. Status reports the **last successful background pass**, not live readiness: it reads only counters/timestamps and never reopens transcripts or validates the cache during polling. Actual preparation and explicit syncs verify originals and cached outputs.
|
|
52
|
+
|
|
53
|
+
Ordinary existing batch keys and validated historical leaf caches remain compatible. Previously oversized batches split at a moving midpoint may need one-time recomputation: 0.7 uses stable prefixes so future appends do not move completed boundaries. No old cache or snapshot is deleted as part of this change.
|
|
54
|
+
|
|
55
|
+
**`preparationUsage` includes background spend, requests and failures**, alongside explicit preparation and retained historical accounting. Missing/interrupted pricing remains unavailable or partial, never fabricated zero. **`completed_batches` still counts explicit snapshots' first successful briefings**, not warmed chunks or background runs; repeated preparation does not make another reviewed/completed sync. Background cost must not be silently assigned to a later snapshot as though its cache hit made a new request. Opening the usage dashboard only reads metadata. Chat, voice, standalone post-conversation recaps and local resource costs remain outside this preparation-only estimate.
|
|
56
|
+
|
|
57
|
+
### Regression boundaries
|
|
58
|
+
|
|
59
|
+
- `tests/background-tree.test.cjs` covers snapshot-free shared-cache preparation, validated leaves/reconciliation/compact input, unchanged reuse and append/tail behavior.
|
|
60
|
+
- `tests/background-preparation.test.cjs` covers new paid consent, exact edit/removal thresholds, lost/corrupt cache recovery, ownership/cancellation, durable invocation spending, content-free ledger fields, pause-until-retry failures and preparation accounting without sync/review writes.
|
|
61
|
+
- `tests/summary-preparation-http.test.cjs` checks separate consent validation, cross-origin rejection and metadata-only status reads; `tests/ui/summary-preparation.spec.ts` checks opt-in, error recovery and explicit retry.
|
|
62
|
+
- `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.
|
|
63
|
+
- `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.
|
|
64
|
+
- `tests/automatic-defaults.test.cjs` covers preference migration; `tests/package-smoke.cjs` checks fresh `auto_index=true`, `auto_summary=false`, the disabled metadata-only auto-summary GET and zero background/provider activity in a production-only installation.
|
|
65
|
+
|
|
29
66
|
## Work questions and follow-ups
|
|
30
67
|
|
|
31
68
|
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.
|
|
@@ -107,7 +144,7 @@ Generated/interrupted speech stays qualified as generated/interrupted. Historica
|
|
|
107
144
|
|
|
108
145
|
Under `DRAKEN_DATA_DIR` (default `~/.draken`):
|
|
109
146
|
|
|
110
|
-
- `draken.db`: canonical live/frozen pointers and metadata, Draken conversations, notes and generated summaries; not rewritten by retrieval.
|
|
147
|
+
- `draken.db`: canonical live/frozen pointers and metadata, Draken conversations, notes and generated summaries; not rewritten by retrieval. Paid preparation writes validated `summary_cache` and metadata-only `background_runs`, never snapshot/review/conversation rows.
|
|
111
148
|
- `memory/index.sqlite` and sidecars: passage hashes/unique vectors, source-occurrence mappings and contentless keyword postings.
|
|
112
149
|
- `memory/model/`: three pinned model/tokenizer files, downloaded automatically when first needed.
|
|
113
150
|
|
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
|
-
#
|
|
64
|
-
|
|
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,13 @@ 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.
|
|
13
|
+
**Draken 0.7.0** adds optional paid summary preparation without automatic syncs. The NEW **Settings → Prepare summaries ahead** switch is **off by default**, including upgrades with local indexing already enabled. See [the release notes](CHANGELOG.md#070).
|
|
14
14
|
|
|
15
|
-
**Automatic
|
|
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. Local indexing alone 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
|
-
**
|
|
17
|
+
**Optional paid preparation:** enable **Prepare summaries ahead** explicitly, with **Automatically index history** also enabled, to warm cached summaries using your configured summary model and its quota/API billing. Once-minute idle checks start at 64 new/changed eligible records, independently of the embedding checkpoint. This prepares validated leaves, reconciliation and compact final input—not snapshots, final briefings, recaps or review. Unchanged prepared input makes no further calls; closed chunks survive appends, but changed per-session tails and reconciliation may still need work at **Start chat**. The final briefing always runs explicitly; preparation ahead is not an instant-chat guarantee. Disabling either switch stops paid background work and preserves valid cache. Paid failures pause until explicit retry; local indexing retains its five-minute retry delay. No retired paid setting is migrated into this new consent.
|
|
18
|
+
|
|
19
|
+
**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 background summary spend/requests/failures, past automatic work and retries. Completed batches still count only explicit snapshots' first successful briefings—not warm cache. 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
20
|
|
|
19
21
|
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
22
|
|
|
@@ -26,7 +28,7 @@ Draken remembers which evidence a finished sync covered, what you decided, and w
|
|
|
26
28
|
|
|
27
29
|
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
30
|
|
|
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.
|
|
31
|
+
> **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.7.0](CHANGELOG.md#070) and [upgrade instructions](SETUP.md#upgrade-to-070), including the new opt-in.
|
|
30
32
|
|
|
31
33
|
```sh
|
|
32
34
|
npm install -g draken
|
|
@@ -58,11 +60,9 @@ Run setup/login as the server’s user with the same environment. `draken status
|
|
|
58
60
|
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
61
|
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
62
|
|
|
61
|
-
**Settings → Automatically
|
|
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.
|
|
63
|
+
**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. The separate **Prepare summaries ahead** switch authorizes paid cache preparation only when indexing is enabled; an old `auto_index=true` does not enable it. See [background indexing](MEMORY.md#optional-background-indexing) and [paid preparation](MEMORY.md#optional-paid-summary-preparation) for batching, cancellation, saved preferences and upgrade behavior.
|
|
64
64
|
|
|
65
|
-
**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
|
|
65
|
+
**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. Explicit sync/chat actions authorize their own preparation; only optional paid background summaries require the separate new switch. Failed preparation keeps its snapshot and cached work; retry explicitly. Opening a link after preparation requires an explicit call click.
|
|
66
66
|
|
|
67
67
|
Closing the browser preserves the running job; reloading reconnects to progress. Restarting the server preserves the snapshot and completed summary nodes, but interrupts an active model call; retry to resume from cache. Discarding a sync leaves its evidence uncovered and retains the conversation in history. Chat retains the sent question even if its reply fails or is stopped; it never fabricates a completed assistant answer or marks anything reviewed. The older discussion API still saves only completed exchanges. Records from the retired local engine retain their original playback qualifications. Live calls retain ordered generated/interrupted transcripts and supplied context sources, without claiming exact playback or agreement. Reload ends the call and never resumes microphone capture automatically.
|
|
68
68
|
|
|
@@ -88,7 +88,7 @@ For briefings, conversation recaps and text discussion, Draken invokes `pi --pri
|
|
|
88
88
|
- **Final model:** defaults to `openai/gpt-6-astra`. Override with `DRAKEN_PI_FINAL_MODEL` or the legacy `DRAKEN_PI_MODEL`.
|
|
89
89
|
- Model and budget controls are intentionally absent from the UI for now. Existing syncs retain their saved settings; the advanced `/api/syncs/:id/models` PATCH endpoint remains available for changing an open sync.
|
|
90
90
|
- Selectors use pi's `provider/model` syntax. Catalog presence does not guarantee your subscription/API credential can access that model. Both models must support ordinary text generation; the summary model must reliably emit JSON.
|
|
91
|
-
- **Invocation ceiling:** `DRAKEN_PI_MAX_INVOCATIONS` defaults to 120 per briefing/question, including prior-conversation recaps, schema-repair attempts and the final verdict. This limits model-generating pi subprocess invocations, not local setup/status checks, provider-internal retries, tokens, or dollars. Exhaustion stops the run without losing cached work.
|
|
91
|
+
- **Invocation ceiling:** `DRAKEN_PI_MAX_INVOCATIONS` defaults to 120 per briefing/question, including prior-conversation recaps, schema-repair attempts and the final verdict. Paid background preparation uses the same configured `max_invocations` allowance for summary-model work, retaining spent invocations when resuming the same interrupted input. This limits model-generating pi subprocess invocations, not local setup/status checks, provider-internal retries, tokens, or dollars. Exhaustion stops the run without losing cached work. Neither path falls back to another provider/model.
|
|
92
92
|
|
|
93
93
|
### Summary tree
|
|
94
94
|
|
|
@@ -111,13 +111,13 @@ Summaries carry structured states, source IDs, and limitations. Models receive s
|
|
|
111
111
|
|
|
112
112
|
A schema failure gets one repair attempt containing a bounded prefix of the rejected response, the specific validation error, and the allowed labels. Empty evidence, unknown IDs, and excess distinct citations are separate errors. When citation count is the only problem, the retry selects references only for the overfull observations instead of rewriting the whole summary. Claims, states, limitations and already-valid citation lists remain unchanged. Selections must come from each observation's original candidates and still pass the 16-reference limit; nothing is blindly truncated, guessed or silently accepted. Citation-only repair preserves those fields and the two-invocation ceiling. Large-batch citation repair supplies complete candidate observations rather than duplicating the rejected response. If repair still fails, generation **stops**—it is not an ongoing job. The UI offers **Resume generation**, which directly continues using valid cached work. The short-label upgrade can reuse previously validated v1 leaf summaries.
|
|
113
113
|
|
|
114
|
-
Nodes are cached by content fingerprints, model selector, prompt text/version, and node type. Source IDs are independent of sync-local E/C citations, so identical inputs can reuse cache across retries and discarded snapshots. The new planner reuses validated v1/v2 leaf-cache islands and only repacks contiguous uncached ranges; existing cache rows are not wiped. Unchanged closed batches reuse their keys when history is appended; an unfinished tail and affected reconciliation are recomputed. Changed selection/background can still move boundaries. There is no endlessly rewritten project-memory summary.
|
|
114
|
+
Nodes are cached by content fingerprints, model selector, prompt text/version, and node type. Source IDs are independent of sync-local E/C citations, so identical inputs can reuse cache across retries and discarded snapshots. The new planner reuses validated v1/v2 leaf-cache islands and only repacks contiguous uncached ranges; existing cache rows are not wiped. Unchanged closed batches reuse their keys when history is appended; an unfinished tail and affected reconciliation are recomputed. Changed selection/background can still move boundaries. There is no endlessly rewritten project-memory summary. Optional paid background preparation reads eligible accumulated entries without reserving them, and warms these same validated cache keys, reconciliation and compact final input. It owns no sync, snapshot, coverage, message or tree rows. Foreground work cancels and awaits its owned provider work before proceeding; valid cache survives cancellation and restart.
|
|
115
115
|
|
|
116
116
|
Each run also retains metadata-only request timings, model/task/stage and repair status, input/output sizes, local token estimates, and completion/failure/cancellation state. No prompts or source excerpts go into this telemetry. **Model request timing** in the tree expands these details. Elapsed time includes pi startup, provider waiting and generation; these are not separately measured, and a completed subprocess result can still fail validation. Planning token estimates are not billed usage; real-history speed/quality comparisons remain unqualified. Existing runs acquire an empty metrics array through an additive migration; no histories, notes, coverage or embeddings are reset.
|
|
117
117
|
|
|
118
118
|
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
119
|
|
|
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
|
|
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 preparation history, including paid background summaries, past automatic work, retries, failed work and discarded snapshots. Metadata-only `background_runs` retains input hashes, counters and metrics, with no source text. `preparationUsage` includes its spend, requests and failures; `completed_batches` does not count cache preparation. A batch is an explicit 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
121
|
|
|
122
122
|
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
123
|
|
|
@@ -127,7 +127,7 @@ The manager is a **read-only conversation**, not a worker. Its responses disting
|
|
|
127
127
|
|
|
128
128
|
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
129
|
|
|
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.
|
|
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. Neither automatic local indexing nor paid background summary preparation 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
131
|
|
|
132
132
|
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
133
|
|
|
@@ -165,7 +165,7 @@ Current limits: discovery is eight directories deep; each scan reads up to 32 Mi
|
|
|
165
165
|
|
|
166
166
|
Session logs can contain private source code, prompts, command output, and credentials.
|
|
167
167
|
|
|
168
|
-
- **Provider-model use starts through conversation/preparation
|
|
168
|
+
- **Provider-model use starts through explicit conversation/preparation interactions or the NEW paid summary opt-in, never local indexing alone.** 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. Those explicit actions need no additional checkbox; unattended summary preparation requires **Prepare summaries ahead**, off by default. 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 by itself. Separately opted-in background summaries send eligible content through the configured summary model, never the final model.
|
|
169
169
|
- 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
170
|
- 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
171
|
- 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.
|
|
@@ -209,7 +209,7 @@ This is not a drop-in replacement for the old Docker/Claude task dashboard or it
|
|
|
209
209
|
|
|
210
210
|
Source builds, development commands, test/probe instructions and the code map live in [CONTRIBUTING.md](CONTRIBUTING.md). They are not needed for normal npm installation.
|
|
211
211
|
|
|
212
|
-
See [ACCEPTANCE.md](ACCEPTANCE.md) for automated gates, a short human product checklist and focused high-risk review areas. The public landing page lives in `site/`;
|
|
212
|
+
See [ACCEPTANCE.md](ACCEPTANCE.md) for automated gates, a short human product checklist and focused high-risk review areas. The public landing page lives in `site/`; changes there on `master`/`main` trigger the existing website deployment workflow. Its `scripts/site-release.cjs` gate validates the version copy and withholds deployment until npm `latest` matches the root package version. Release copy describes 0.7.0 after release, not evidence of a live deployment. Qualify and publish npm separately before allowing the gated website deployment; this documentation change does not merge, publish or deploy anything. Focused cache/consent regressions are `tests/background-tree.test.cjs`, `tests/background-preparation.test.cjs` and `tests/automatic-index.test.cjs`.
|
|
213
213
|
|
|
214
214
|
## License
|
|
215
215
|
|
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
|
+
> This guide is for **Draken 0.7.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#070).
|
|
6
6
|
|
|
7
7
|
## Install and start
|
|
8
8
|
|
|
@@ -21,10 +21,30 @@ 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
|
|
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 paid background summaries and past automatic work, not total spending or quota. Completed batches count explicit snapshots' first successful briefings, not cached preparation.
|
|
25
|
+
|
|
26
|
+
**Paid summaries are a separate, default-off choice.** To prepare ahead, explicitly enable the NEW **Settings → Prepare summaries ahead** switch while **Automatically index history** is enabled. Old `auto_index=true` and retired 0.5 paid consent do not enable it. This sends eligible accumulated entries to the configured summary model within the same `max_invocations` allowance, with no provider/model fallback. Once-minute idle checks require at least 64 new/changed eligible records, independently of the embedding checkpoint. It warms validated summary leaves, reconciliation and compact final input, not a snapshot, final briefing, recap or review. Unchanged prepared input makes no further calls; closed chunks are reusable across appends. Changed unfinished per-session tails and aggregate reconciliation may still need work at **Start chat**, and the final briefing is always explicit—not a zero-wait promise.
|
|
27
|
+
|
|
28
|
+
Foreground work cancels and awaits owned background provider work. Valid cache survives cancellation/restarts, with invocation spending retained for the same interrupted input. Paid failures pause until explicit retry, unlike local indexing's five-minute retry delay. Disabling either switch stops paid background work without deleting cache. See [the durable preparation policy](MEMORY.md#optional-paid-summary-preparation).
|
|
25
29
|
|
|
26
30
|
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
31
|
|
|
32
|
+
## Upgrade to 0.7.0
|
|
33
|
+
|
|
34
|
+
1. Back up original agent logs and the private Draken data directory. Preserve existing histories, conversations, notes, review coverage and frozen snapshots; do not replace them with an old database.
|
|
35
|
+
2. Finish active calls/preparation, stop the server, and quit any tray that owns it. Install the released version with `npm install -g draken@0.7.0`, then restart using the same user, environment and `DRAKEN_DATA_DIR`.
|
|
36
|
+
3. Check **Settings → Runtime & sign-in**. Existing pi/voice accounts and selected runtimes are unchanged; upgrading does not silently install or sign into a replacement runtime.
|
|
37
|
+
4. Keep or change **Automatically index history** as desired. Its existing preference is preserved. To get paid preparation ahead, explicitly enable the NEW **Prepare summaries ahead** switch. It defaults off on upgrades as well as fresh installations; no local-to-paid or retired-consent migration occurs.
|
|
38
|
+
5. Start a sync/chat explicitly for the final briefing. Warm cache is not a completed sync or review. If paid preparation fails, resolve the error and retry explicitly; disabling either setting stops paid work but preserves valid cache.
|
|
39
|
+
|
|
40
|
+
The additive `background_runs` table stores input hashes, counters and accounting metrics, not source text. No dependencies change in this release. Do not run an older binary to undo schema changes.
|
|
41
|
+
|
|
42
|
+
### Release qualification and website ordering
|
|
43
|
+
|
|
44
|
+
For a source release, build and test sequentially once the backend/client changes are ready. Run `tests/background-tree.test.cjs`, `tests/background-preparation.test.cjs` and `tests/automatic-index.test.cjs` against the new server build, then `node --test tests/site-browser.cjs` and `node tests/package-smoke.cjs` with the complete package build. The site check serves static files and needs Playwright/Chromium, not an application build or provider. The package smoke requires built `dist/` and `public/` and installs an isolated production-only tarball; it must observe `auto_summary=false`, a metadata-only disabled auto-summary GET, and no background runs/provider activity by default. Synthetic tests do not establish provider latency, quality or account billing.
|
|
45
|
+
|
|
46
|
+
Publish npm only through the separately authorized release process. The existing website workflow checks `scripts/site-release.cjs`: copy must match the package version and npm `latest` must be 0.7.0 before the site is deployed. Do not bypass this gate to publish release copy early. Updating docs/version/site files is not a merge, npm publication or live deployment.
|
|
47
|
+
|
|
28
48
|
## When pi is not installed
|
|
29
49
|
|
|
30
50
|
Run these **on the server, as its operating-system user, with the same environment**—especially `DRAKEN_DATA_DIR`, `DRAKEN_PI_BIN` and model settings:
|
|
@@ -101,7 +121,7 @@ Home shows first-run guidance when no syncs exist, and a setup notice whenever s
|
|
|
101
121
|
|
|
102
122
|
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
123
|
|
|
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
|
|
124
|
+
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. Local indexing alone never creates snapshots or runs summary/briefing models. If separately enabled, paid summary preparation also runs independently of browsing, but never creates snapshots or final briefings. Opening these instructions or settings GETs cannot grant that consent.
|
|
105
125
|
|
|
106
126
|
## Recovery and maintenance
|
|
107
127
|
|
package/TRAY.md
CHANGED
|
@@ -26,16 +26,16 @@ An already-running server is observed, not adopted. Stop is disabled for it, and
|
|
|
26
26
|
- No Electron/browser bundle, downloaded native tray binary, development compiler, global PATH change, administrator access, or paid code-signing certificate is required by this tray implementation.
|
|
27
27
|
- The packaged native scripts use OS frameworks. Draken does **not** change PowerShell execution policy, application-control policy, Gatekeeper, the firewall, or certificate trust. Managed/restricted desktops may refuse the helper; failure is reported rather than bypassed. Signing a future standalone installer is a separate concern.
|
|
28
28
|
- No Linux tray, SSH/headless tray, Windows service integration, start-at-login registration, background updater, daemon supervisor, embedded terminal, or new login implementation is included in this first version.
|
|
29
|
-
- Setup/login remain the existing explicit pi and native voice commands and browser guidance. The tray never installs pi, copies credentials, downloads a model, scans history, creates a sync, or captures audio itself. A server it starts retains the user's existing automatic-indexing preference and
|
|
30
|
-
- Stop/Quit can interrupt generation and active calls. Existing server shutdown preserves completed work and retains its normal recovery behavior; unfinished generation must be retried explicitly. No review coverage is advanced.
|
|
29
|
+
- Setup/login remain the existing explicit pi and native voice commands and browser guidance. The tray never installs pi, copies credentials, downloads a model, scans history, creates a sync, or captures audio itself. A server it starts retains the user's existing automatic-indexing preference and the separate **Prepare summaries ahead** paid opt-in. The new paid switch defaults off even when indexing was already enabled; the tray cannot grant that consent. Enabled server-side paid preparation requires local indexing and follows the [cache-only policy](MEMORY.md#optional-paid-summary-preparation), never creating snapshots, final briefings or review.
|
|
30
|
+
- Stop/Quit can interrupt generation and active calls. Existing server shutdown preserves completed work and retains its normal recovery behavior; unfinished foreground generation must be retried explicitly. Opted-in interrupted background cache work retains valid cache and spent invocations for the same input; paid failures remain paused until explicit retry. No review coverage is advanced.
|
|
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
|
|
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. Local indexing alone never creates syncs, summaries or briefings and makes no provider model calls. The NEW **Prepare summaries ahead** switch is a separate paid opt-in, default off even on upgrades with indexing enabled, and requires local indexing. It warms validated summary leaves plus reconciliation/compact final input using the configured summary model, not a final briefing or recap. Creating a sync and generating its final briefing always require an explicit user action; neither background path starts capture, calls or review. Changed unfinished per-session tails and reconciliation can still need work at **Start chat**; cached preparation is not an instant-call promise. Foreground work cancels and awaits owned background provider work. Disabling either setting stops paid work and preserves cache; paid failures pause until explicit retry, while local indexing retains its five-minute retry delay. See [paid preparation](MEMORY.md#optional-paid-summary-preparation) for independent 64-record batching, durable spending and accounting. 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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Q,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,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"}
|
package/dist/auth/middleware.js
CHANGED
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../src/auth/middleware.ts"],"names":[],"mappings":";;;;;AAoBA,wCAEC;AAID,oCASC;AAED,sCA2BC;AAED,gDAQC;AAED,sCAEC;AAED,wCA0BC;AAED,sCASC;AAED,kDAOC;AA7HD,gEAA+B;AAmB/B,SAAgB,cAAc,CAAC,IAAY;IACzC,OAAO,CAAC,WAAW,EAAE,WAAW,EAAE,KA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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
|
-
|
|
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,
|
|
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,sCAAwD;AAExD,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,MA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C,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 @@
|
|
|
1
|
+
{"version":3,"file":"data-dir.d.ts","sourceRoot":"","sources":["../src/data-dir.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,IAAI,MAAM,CAEnC"}
|
package/dist/data-dir.js
ADDED
|
@@ -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"}
|