draken 0.4.0 → 0.5.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 +37 -0
- package/MEMORY.md +8 -4
- package/README.md +12 -6
- package/SETUP.md +4 -2
- package/SOURCES.md +1 -1
- package/VOICE.md +5 -1
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +9 -0
- package/dist/db/schema.js.map +1 -1
- package/dist/memory/automatic.d.ts +1 -1
- package/dist/memory/automatic.d.ts.map +1 -1
- package/dist/memory/automatic.js +3 -2
- package/dist/memory/automatic.js.map +1 -1
- package/dist/memory/context.d.ts +1 -0
- package/dist/memory/context.d.ts.map +1 -1
- package/dist/memory/context.js +4 -0
- package/dist/memory/context.js.map +1 -1
- package/dist/sync/manager.d.ts.map +1 -1
- package/dist/sync/manager.js +13 -16
- package/dist/sync/manager.js.map +1 -1
- package/dist/voice/continuation.d.ts.map +1 -1
- package/dist/voice/continuation.js +7 -2
- package/dist/voice/continuation.js.map +1 -1
- package/dist/voice/history-delivery.d.ts +19 -0
- package/dist/voice/history-delivery.d.ts.map +1 -0
- package/dist/voice/history-delivery.js +57 -0
- package/dist/voice/history-delivery.js.map +1 -0
- package/dist/voice/history-focus.d.ts +4 -0
- package/dist/voice/history-focus.d.ts.map +1 -1
- package/dist/voice/history-focus.js +15 -0
- package/dist/voice/history-focus.js.map +1 -1
- package/dist/voice/live-context.d.ts +1 -1
- package/dist/voice/live-context.d.ts.map +1 -1
- package/dist/voice/live-context.js +2 -1
- package/dist/voice/live-context.js.map +1 -1
- package/dist/voice/live.d.ts.map +1 -1
- package/dist/voice/live.js +62 -28
- package/dist/voice/live.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-ClbxoVQK.js +131 -0
- package/public/assets/index-D79D-rxm.css +1 -0
- package/public/assets/{persona-BgbqhiLa.js → persona-CsDA3JtF.js} +1 -1
- package/public/index.html +3 -3
- package/public/persona.html +3 -3
- package/public/assets/index-BCDcSZkB.css +0 -1
- package/public/assets/index-SXgKBqZw.js +0 -131
- /package/public/assets/{index-S46UUaj8.js → index-B13h0MjX.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
This minor release combines automatic preparation for new installations with shorter conversational replies. The planned 0.4.2 changes are included here; 0.4.2 was not published.
|
|
6
|
+
|
|
7
|
+
- Give text chat its own short-answer instructions instead of opening-briefing headings: one paragraph or up to three bullets, usually 60–100 words excluding citations. Simple questions can be shorter; explicit requests for detail or another format still win.
|
|
8
|
+
- Keep the same concise style during the existing single citation/reconciliation correction. Evidence selection, later-report checking, model choice and invocation limits are unchanged. No hard word truncation or additional shortening-model pass; actual model adherence to the target is not guaranteed.
|
|
9
|
+
|
|
10
|
+
- New installations enable automatic preparation by default: scan enabled histories, update local search, summarize new work and prepare a briefing while the server runs. This includes configured model quota or API billing, not only local indexing; turn it off in Settings → Automatically prepare conversations.
|
|
11
|
+
- Preserve existing installations' behavior, including explicit off, no saved preference and older local-index-only permission. The default is stored only when initializing an empty database; restarts and settings reads do not reset choices or authorize wider work on upgrade.
|
|
12
|
+
- Keep the existing once-minute idle checks, 64-record batch threshold, saved invocation limits, explicit retry after provider failures and independent source/session permissions. No automatic microphone, call, decision or review.
|
|
13
|
+
- Explain the default and preparation costs in setup, Home, Settings and public documentation. Preparation usage remains a preparation-only estimate, not a provider invoice or total-spending tracker.
|
|
14
|
+
- No new tables, columns or dependencies. Existing original logs, conversations, notes, coverage, summaries and compatible vectors remain unchanged.
|
|
15
|
+
|
|
16
|
+
## 0.4.1
|
|
17
|
+
|
|
18
|
+
This release improves audio recall, makes preparation charts easier to read, and explains automatic compaction and cost tracking on Home and the public website.
|
|
19
|
+
|
|
20
|
+
### Audio evidence and continuity
|
|
21
|
+
|
|
22
|
+
- Native voice now uses the same bounded archive selection and later-report checking as chat: up to sixteen sources in a 32,000-byte historical packet. Original source permissions, captured cutoffs and qualifications are retained.
|
|
23
|
+
- New calls inherit project focus from actual saved user turns, not generated replies. Explicit switches still win. Questions about old historical or frozen checkpoints check later reports instead of merely repeating the old state.
|
|
24
|
+
- Larger evidence travels losslessly through bounded native context messages; the small handoff returns a completion receipt. Partial transfers are never marked ready, repeated lookups reuse delivery, and Stop/new turns prevent old transfers from continuing.
|
|
25
|
+
- Spoken answers keep the existing concise target. No extra pi generation or replacement voice engine is introduced. More input context is not a guarantee of unchanged native quota use.
|
|
26
|
+
- Native speech is not post-validated or retractable like text's citation-repair pass. Protocol tests and matching evidence packets do not establish physical-audio acceptance or exhaustive answer accuracy.
|
|
27
|
+
|
|
28
|
+
### Readable preparation costs and clearer guidance
|
|
29
|
+
|
|
30
|
+
- Add labelled USD/whole-batch Y-axes and gridlines, with matching rounded bar scales and readable mobile labels. Handle zero, tiny, large and unavailable costs without inventing prices.
|
|
31
|
+
- Explain automatic preparation/compaction and preparation spending estimates on the app Home page, README and public homepage. Compaction produces cached summaries; it does not modify or delete original logs.
|
|
32
|
+
- Keep cost boundaries explicit: recorded preparation estimates include retries and failures, but exclude chat, native voice, standalone post-conversation recaps and local machine/network costs. They are not invoices, total spending or quota balances.
|
|
33
|
+
- Opening the explanatory panel or dashboard does not enable automatic mode, start inference, capture audio or mark work reviewed.
|
|
34
|
+
|
|
35
|
+
### Upgrading from 0.4.0
|
|
36
|
+
|
|
37
|
+
- No schema migrations or dependency changes. Existing histories, notes, conversations, coverage, cached summaries and compatible vectors remain intact.
|
|
38
|
+
- Node.js 22.19+ and npm remain required. Back up original logs and Draken data, wait for active work to finish, stop the server, upgrade and restart. Existing automatic-preparation consent remains unchanged.
|
|
39
|
+
|
|
3
40
|
## 0.4.0
|
|
4
41
|
|
|
5
42
|
This release prepares conversations in the background, makes preparation usage visible, and improves text-answer reference handling.
|
package/MEMORY.md
CHANGED
|
@@ -16,13 +16,13 @@ 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
|
|
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.
|
|
20
20
|
|
|
21
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).
|
|
22
22
|
|
|
23
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; 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.
|
|
24
24
|
|
|
25
|
-
The hash-only search checkpoint still advances only after successful global preparation. Missing older checkpoints can be established by the combined
|
|
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.
|
|
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
|
|
|
@@ -32,17 +32,21 @@ Voice and **Chat instead** work questions prefer original session records, not o
|
|
|
32
32
|
|
|
33
33
|
Retrieval ranks both keywords and local vectors, deduplicates shared passages before the candidate limit, and gives original agent explanations their own candidate set. Current-status questions include the latest recorded agent explanation and favor recent records. Up to two named topics in a question can be searched separately so one does not crowd out the other. All candidates remain subject to source permissions and the prepared cutoff. Useful negative or historical evidence is not confirmation of a current defect.
|
|
34
34
|
|
|
35
|
-
Voice source
|
|
35
|
+
Voice uses the same up-to-32,000-byte, sixteen-source historical selection and later-report graph as text chat. An explicit E/C status question also carries its requested frozen excerpt (up to 3,500 bytes, combined envelope at most 36,000 bytes); it no longer bypasses archive update checking. Frozen source session/sequence metadata permits comparison with historical aliases without inferring chronology across sessions. Excerpts retain implementation details and closing qualifications; tool requests may be omitted with an explicit marker. A later passage can include its source's beginning for context. Native context appends remain bounded to 8,192 UTF-8 bytes: a larger evidence document travels losslessly as ordered, JSON-quoted fragments followed by a completion record, not a truncated handoff or another model-generated summary. There are at most twelve fragments plus one completion record; transport quoting adds overhead to the selection budget. Sources are published and continuation becomes eligible only after complete delivery. A failed transfer ends the call; Stop/new turns prevent further old fragments, completion and continuation. The helper's small handoff response carries only a completion receipt after the full context has been delivered.
|
|
36
|
+
|
|
37
|
+
New calls reconstruct project focus from the same bounded actual-user-turn history as chat; generated answers and retrieved instructions cannot select a project. Explicit project switches still win. The helper can refine a question or request an H reference (optionally with `offset 2000`); each user turn permits at most three distinct archive lookups and reuses both duplicate results and their delivery. Source IDs are supplied context for that turn, not verified per-claim citations or evidence of hearing/agreement. A failed or empty work lookup is not silently replaced by an old conversation. More native input context does not add pi calls or lengthen the spoken-answer target; it is not a guarantee of unchanged provider quota usage.
|
|
36
38
|
|
|
37
39
|
### Separate text chat
|
|
38
40
|
|
|
41
|
+
Chat has its own short-answer style rather than the opening briefing's headings: normally one paragraph or up to three bullets, targeting 60–100 words excluding citations, with shorter answers for simple questions and more detail only when requested. The same style is retained during the single citation/reconciliation correction. This does not reduce evidence selection, remove necessary qualifications, truncate a generated reply to a word count, or add another model request. Actual provider adherence is not guaranteed by synthetic prompt-contract tests.
|
|
42
|
+
|
|
39
43
|
`/syncs/:id/chat` uses the same project/topic planner and prepared-only source search, with an up-to-32,000-byte historical packet (at most 16 sources). Recent actual user questions in the sync's saved chat and native call transcripts establish follow-up scope; assistant replies cannot select a project. The text model receives qualified recent call transcripts as context, not evidence of hearing or agreement. Source-reference validation checks existence, not per-claim truth.
|
|
40
44
|
|
|
41
45
|
Text status questions additionally check for later related original assistant narratives in the same source session. The bounded lexical pass considers at most 4,096 admitted narratives, four starting threads and two further follow-up generations; it does not run another embedding model or rebuild the corpus. It checks individual pending sub-tasks, favors relevant implementation sections over repeated pending tables, and retains a latest related report. Sequence orders records within a session, not across sessions. Follow-ups can themselves be stale, so a client-completion report that still lists backend jobs as pending is checked against later backend reports. Candidate links are not verified supersession: later plans, contradictory reports, completed foundations and unfinished delivery/acceptance remain distinct.
|
|
42
46
|
|
|
43
47
|
Packets retain contiguous excerpts and, when clipped, separately labelled ending excerpts with original offsets so closing qualifications survive. An earlier linked checkpoint is omitted if its selected follow-ups cannot fit. Omitted candidates/threads are disclosed; no-match never establishes that no later completion record exists. These are language-dependent lexical candidates over admitted projections, not exhaustive whole-log or cross-session semantic verification.
|
|
44
48
|
|
|
45
|
-
Final answers use a stable per-request `R1`, `R2`, … label catalog, mapped by Draken to the admitted E/C/H source references before validation and persistence. Source excerpts, earlier briefings and discussion are quoted data: their embedded citation syntax does not create labels. Explicit source requests are mapped into the same catalog. Unknown labels are neither guessed nor dropped. If a text answer has missing/out-of-catalog citations or cites a linked old checkpoint while ignoring supplied later reports (including E/C aliases), Draken permits **one combined correction using the same final model and invocation/cancellation budget**. The rejected draft is never saved or shown. A second failure is visible and retains the user question without an assistant answer. **Checking source references** or **Checking later updates** identifies the actual correction stage. It can consume one additional final-model request; chat/repair usage remains outside the preparation-only estimate. This citation-consistency check is not proof that every claim is true.
|
|
49
|
+
Final answers use a stable per-request `R1`, `R2`, … label catalog, mapped by Draken to the admitted E/C/H source references before validation and persistence. Source excerpts, earlier briefings and discussion are quoted data: their embedded citation syntax does not create labels. Explicit source requests are mapped into the same catalog. Unknown labels are neither guessed nor dropped. If a text answer has missing/out-of-catalog citations or cites a linked old checkpoint while ignoring supplied later reports (including E/C aliases), Draken permits **one combined correction using the same final model and invocation/cancellation budget**. The rejected draft is never saved or shown. A second failure is visible and retains the user question without an assistant answer. **Checking source references** or **Checking later updates** identifies the actual correction stage. It can consume one additional final-model request; chat/repair usage remains outside the preparation-only estimate. This citation-consistency check is not proof that every claim is true. Native voice shares the larger evidence selection and deterministic later-report checking, but **not the pi answer-repair pass**: already-streamed speech cannot be retracted or certified by this citation guard. Its prompt keeps the same concise delivery target, including necessary caveats. Shared evidence does not establish identical generated answers or exhaustive recall.
|
|
46
50
|
|
|
47
51
|
Chat readiness checks the prepared receipt at its captured cutoff. New chat messages beyond that cutoff are passed directly as recent conversation and do not force an index rebuild on every turn. Original-file identity/import cursors, selection changes, missing originals and edits to already captured records still invalidate readiness. Fresh native-call readiness keeps its stricter current-record check. Both readiness endpoints only read metadata. Refresh is explicit; chat does not silently refresh the corpus, regenerate a briefing or switch providers.
|
|
48
52
|
|
package/README.md
CHANGED
|
@@ -10,7 +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.
|
|
13
|
+
**Draken 0.5.0** enables automatic preparation by default for new installations and keeps chat replies short unless you ask for detail. Existing preparation choices are preserved. See [the release notes](CHANGELOG.md#050).
|
|
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.
|
|
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.
|
|
14
18
|
|
|
15
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.
|
|
16
20
|
|
|
@@ -22,7 +26,7 @@ Draken remembers which evidence a finished sync covered, what you decided, and w
|
|
|
22
26
|
|
|
23
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.
|
|
24
28
|
|
|
25
|
-
> **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.
|
|
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.0](CHANGELOG.md#050).
|
|
26
30
|
|
|
27
31
|
```sh
|
|
28
32
|
npm install -g draken
|
|
@@ -54,9 +58,9 @@ Run setup/login as the server’s user with the same environment. `draken status
|
|
|
54
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.
|
|
55
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.
|
|
56
60
|
|
|
57
|
-
**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
|
|
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.
|
|
58
62
|
|
|
59
|
-
|
|
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.
|
|
60
64
|
|
|
61
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 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.
|
|
62
66
|
|
|
@@ -70,9 +74,11 @@ An old capped snapshot must be explicitly **expanded to full history** before ge
|
|
|
70
74
|
|
|
71
75
|
A square Draken portrait accompanies replies. **Searching your prepared history**, **Draken is thinking** and **Checking later updates** follow actual server job stages; they are status cues, not private model reasoning or streamed draft answers. Enter sends; Shift+Enter inserts a newline. **Stop reply** cancels owned work; retry is explicit. A retried delivery with the same request ID does not repeat generation. A new explicit retry after failure uses a new ID and may consume model quota.
|
|
72
76
|
|
|
77
|
+
Chat replies default to one short paragraph or at most three short bullets, usually 60–100 words plus citations; simple questions can be shorter. Ask for a detailed breakdown when you want one. The model still reads the same evidence and checks later reports: brevity does not mean weaker retrieval or dropped qualifications. This is a response-style instruction, not a hard word limit or an extra shortening-model pass. Opening briefings keep their separate format.
|
|
78
|
+
|
|
73
79
|
Replies use the sync's configured final text model through pi, with the briefing, recent conversation and project-aware original-history retrieval. The prepared archive has a displayed cutoff; new chat messages are supplied directly without rebuilding corpus embeddings after every turn. **Refresh history** admits later work. Changed, excluded or unavailable original sources still block readiness. Chat never opens a native call, implicitly regenerates a ready briefing, saves decisions or marks evidence reviewed. Chat quota/cost is separate from the preparation-only **Est. cost**.
|
|
74
80
|
|
|
75
|
-
For status questions,
|
|
81
|
+
For status questions, chat and native voice use the same bounded original-evidence selection and check later related reports before repeating old blockers, including follow-ups to a report that was itself superseded. New calls inherit project focus from actual saved user turns. Voice delivers the larger evidence packet through bounded native context parts while keeping spoken answers concise; it does not add a pi generation step. The following answer-repair check remains text-only; streamed speech is not post-validated. Client implementation, backend foundations, delivery enablement and device acceptance are kept distinct. The final model uses short per-answer reference labels, which Draken maps back to admitted original links; quoted historical citations never authorize new references. Bad/missing citations and ignored later follow-ups share one bounded same-model correction, with the same label catalog in both calls. A second validation failure remains visible without saving an unsupported draft. Retrieval and citation consistency do not independently verify the agent's claims; see [MEMORY.md](MEMORY.md#separate-text-chat) for bounds and voice differences.
|
|
76
82
|
|
|
77
83
|
### Model integration
|
|
78
84
|
|
|
@@ -121,7 +127,7 @@ The manager is a **read-only conversation**, not a worker. Its responses disting
|
|
|
121
127
|
|
|
122
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. Old source IDs are not treated as this snapshot's citations. Original histories remain available at their own URLs.
|
|
123
129
|
|
|
124
|
-
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. 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).
|
|
125
131
|
|
|
126
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.
|
|
127
133
|
|
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.5.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#050).
|
|
6
6
|
|
|
7
7
|
## Install and start
|
|
8
8
|
|
|
@@ -21,6 +21,8 @@ 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.
|
|
25
|
+
|
|
24
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.
|
|
25
27
|
|
|
26
28
|
## When pi is not installed
|
|
@@ -99,7 +101,7 @@ Home shows first-run guidance when no syncs exist, and a setup notice whenever s
|
|
|
99
101
|
|
|
100
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).
|
|
101
103
|
|
|
102
|
-
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.
|
|
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.
|
|
103
105
|
|
|
104
106
|
## Recovery and maintenance
|
|
105
107
|
|
package/SOURCES.md
CHANGED
|
@@ -8,7 +8,7 @@ Open **Settings → Agents & sessions**. Each adapter shows its configured direc
|
|
|
8
8
|
|
|
9
9
|
- Existing pi sessions and exclusions survive the migration. Pi history is enabled by default.
|
|
10
10
|
- **Codex and Claude history are off until explicitly enabled.** An existing background-indexing preference does not silently gain access to new transcripts.
|
|
11
|
-
- Enabling an agent persists its permission; it does not itself scan, download a model, summarize, create a sync or acquire a microphone. The next explicit scan/sync, or an
|
|
11
|
+
- Enabling an agent persists its permission; it does not itself scan, download a model, summarize, create a sync or acquire a microphone. The next explicit scan/sync, or an enabled background schedule (on by default for new installations), may read its logs.
|
|
12
12
|
- **Scan enabled agents** discovers and parses enabled roots only. New sessions from enabled agents are selected by default. Each session can be excluded independently.
|
|
13
13
|
- Disabled agents are excluded from new snapshots and historical retrieval. Disabling does not rewrite existing frozen snapshots or erase discussions, notes or derived files.
|
|
14
14
|
- Merely opening/polling Settings reads database metadata and directory existence, not transcript bodies.
|
package/VOICE.md
CHANGED
|
@@ -41,7 +41,11 @@ Capture follows a transient browser action, never a URL flag. Reloading or openi
|
|
|
41
41
|
|
|
42
42
|
Reply waiting is owned by the server's identified user transcript and pending-answer events. Unkeyed WebRTC user events can arrive late and must not switch an already pending reply back to listening, erase its waiting caption, or restart a settled reply. A lookup acknowledgement such as “I’ll check what’s recorded” is not meant to end the answer. Draken keeps the question pending and can automatically resume ChatGPT speech when its context arrives; you should not need to ask “have you checked?” Quiet captions in the dragon scene show **[Thinking...]**, **[Hmmm...]** and **[Hmmmmmm...]** during a pending reply, including silence after an acknowledgement. They change every five seconds without animation. **[Checking...]** and **[Looking that up...]** are used only while the local history worker reports fresh lookup activity; these labels are not proof of a match or exhaustive search. These are visual waiting cues—not the model’s private thoughts, spoken messages, a percentage or an ETA. They are never saved in the transcript or sent to the model. The separate waiting banner and elapsed-wait timer have been removed. Stop, a newer question, interruption, or ending the call cancels the old pending continuation. There is at most one automatic completion cue per question—not a retry loop or a fabricated user message. A failed lookup must be disclosed; a failed or silent continuation produces a visible notice instead of silently retrying.
|
|
43
43
|
|
|
44
|
-
Work questions use original
|
|
44
|
+
Work questions use the same original-project evidence selection and deterministic later-report checking as chat: up to sixteen sources in a 32,000-byte historical packet per lookup. A new call inherits project focus from actual saved user turns, not generated answers; explicit switches and follow-ups retain the same scope rules as chat. Old conversation recall remains available when requested. History is captured at the displayed preparation cutoff, not observed live.
|
|
45
|
+
|
|
46
|
+
The native context envelope remains bounded to 8 KiB. Larger evidence is delivered losslessly in ordered, JSON-quoted parts with a final completion record; the helper's small handoff returns a receipt rather than truncating evidence. Interrupted/failed transfers are not marked complete, and old-turn parts cannot restart speech after Stop. Three distinct archive lookups per turn and duplicate-result/delivery reuse remain. This sends more evidence without another pi call, changing voice engine or raising the concise speaking target. Native quota use is not guaranteed unchanged.
|
|
47
|
+
|
|
48
|
+
Supplied IDs and later-report candidates do not prove that each spoken claim was verified, heard or agreed with. The bounded pi answer-repair pass remains text-only; streamed speech is not post-validated or retractable. Protocol tests and evidence-packet comparisons are not physical-audio or exhaustive answer-quality acceptance. See [MEMORY.md](MEMORY.md) for retrieval limits.
|
|
45
49
|
|
|
46
50
|
One call may be active at a time, with a 30-minute limit, at most 60 user messages and a 90-second disconnect timeout. These are resource limits, not spending guarantees. A new call cannot start until helper cleanup is confirmed. The browser chooses its reservation UUID before sending creation, so End can release a reservation even if the create response is lost. If End overtakes creation, the server retains a bounded cancellation marker for five minutes; an already-created ID can never be reused. Network loss can still require the disconnect timeout or explicit End previous call.
|
|
47
51
|
|
package/dist/db/schema.d.ts.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/dist/db/schema.js
CHANGED
|
@@ -41,6 +41,10 @@ function getDb() {
|
|
|
41
41
|
}
|
|
42
42
|
function initSchema(database) {
|
|
43
43
|
database.transaction(() => {
|
|
44
|
+
// Seed the new-install default only for a genuinely empty database, before
|
|
45
|
+
// migrations create any objects. Existing databases (even without a saved
|
|
46
|
+
// preference) retain their old behavior; local-only consent is not upgraded.
|
|
47
|
+
const fresh = !database.prepare("SELECT 1 FROM sqlite_schema WHERE name NOT GLOB 'sqlite_*' LIMIT 1").get();
|
|
44
48
|
(0, agent_migration_1.renameAgentTables)(database);
|
|
45
49
|
const pointerOnly = database.prepare("SELECT 1 FROM sqlite_schema WHERE name='sync_settings'").get()
|
|
46
50
|
&& database.prepare("SELECT value FROM sync_settings WHERE key='storage_schema'").get()?.value === 'pointer-v2';
|
|
@@ -227,6 +231,11 @@ function initSchema(database) {
|
|
|
227
231
|
const sessionColumns = new Set(database.prepare('PRAGMA table_info(agent_sessions)').all().map(column => column.name));
|
|
228
232
|
if (!sessionColumns.has('scanned_bytes'))
|
|
229
233
|
database.exec('ALTER TABLE agent_sessions ADD COLUMN scanned_bytes INTEGER NOT NULL DEFAULT -1');
|
|
234
|
+
if (fresh) {
|
|
235
|
+
const seed = database.prepare('INSERT INTO sync_settings(key,value) VALUES (?,?)');
|
|
236
|
+
seed.run('auto_index', 'true');
|
|
237
|
+
seed.run('auto_prepare_conversations', 'true');
|
|
238
|
+
}
|
|
230
239
|
})();
|
|
231
240
|
}
|
|
232
241
|
function closeDb() {
|
package/dist/db/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":";;;;;AAQA,gCAEC;AAID,sBAaC;AAED,
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":";;;;;AAQA,gCAEC;AAID,sBAaC;AAED,gCAgMC;AAED,0BAGC;AAlOD,oEAAsC;AACtC,gDAAwB;AACxB,4CAAoB;AACpB,4CAAoB;AACpB,2DAAkE;AAClE,2DAA8D;AAC9D,uDAAqE;AAErE,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;AAED,IAAI,EAAE,GAA6B,IAAI,CAAC;AAExC,SAAgB,KAAK;IACnB,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;QACzB,YAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACpD,EAAE,GAAG,IAAI,wBAAQ,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC;QAC/C,uFAAuF;QACvF,YAAE,CAAC,SAAS,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,EAAE,KAAK,CAAC,CAAC;QACjD,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;QAChC,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;QAC/B,EAAE,CAAC,MAAM,CAAC,qBAAqB,C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AI,CAAC,cAAc,CAAC,GAAG,CAAC,eAAe,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,iFAAiF,CAAC,CAAC;QAC3I,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,mDAAmD,CAAC,CAAC;YACnF,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;YAC/B,IAAI,CAAC,GAAG,CAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC;QACjD,CAAC;IACD,CAAC,CAAC,EAAE,CAAC;AACP,CAAC;AAED,SAAgB,OAAO;IACrB,EAAE,EAAE,KAAK,EAAE,CAAC;IACZ,EAAE,GAAG,IAAI,CAAC;AACZ,CAAC"}
|
|
@@ -16,7 +16,7 @@ interface Operations {
|
|
|
16
16
|
problem?(): string;
|
|
17
17
|
completed?(at: string): void;
|
|
18
18
|
}
|
|
19
|
-
/** One
|
|
19
|
+
/** One enabled pipeline: source discovery, local search and a ready briefing.
|
|
20
20
|
* Full batches start at 64 changes or waiting entries; interrupted work resumes.
|
|
21
21
|
* Smaller new tails wait for foreground preparation, with no timed flush.
|
|
22
22
|
* Provider failures require explicit retry; cancellation retains cached work. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automatic.d.ts","sourceRoot":"","sources":["../../src/memory/automatic.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD,KAAK,KAAK,GAAG,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,iBAAiB,GAAG,mBAAmB,GAAG,OAAO,CAAC,CAAC;AAClG,UAAU,UAAU;IAClB,OAAO,IAAI,OAAO,CAAC;IAAC,IAAI,IAAI,OAAO,CAAC;IAAC,GAAG,IAAI,MAAM,CAAC;IACnD,IAAI,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;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AAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,CAW9D"}
|
package/dist/memory/automatic.js
CHANGED
|
@@ -14,7 +14,7 @@ const automatic_1 = require("../sync/automatic");
|
|
|
14
14
|
const service_1 = require("./service");
|
|
15
15
|
const CHECK_MS = 60_000, RETRY_MS = 5 * 60_000, BATCH = 64;
|
|
16
16
|
const initial = () => ({ phase: 'off', pending_records: 0, last_completed_at: null, error: '' });
|
|
17
|
-
/** One
|
|
17
|
+
/** One enabled pipeline: source discovery, local search and a ready briefing.
|
|
18
18
|
* Full batches start at 64 changes or waiting entries; interrupted work resumes.
|
|
19
19
|
* Smaller new tails wait for foreground preparation, with no timed flush.
|
|
20
20
|
* Provider failures require explicit retry; cancellation retains cached work. */
|
|
@@ -139,7 +139,8 @@ class AutoIndexer {
|
|
|
139
139
|
}
|
|
140
140
|
function createAutoIndexer(ops) { return new AutoIndexer(ops); }
|
|
141
141
|
// Old local-index-only consent must not silently become paid model consent on
|
|
142
|
-
// another installation.
|
|
142
|
+
// another installation. Fresh databases seed this combined scope at creation;
|
|
143
|
+
// existing databases and explicit choices are never defaulted by this getter.
|
|
143
144
|
const enabled = () => (0, schema_1.getDb)().prepare("SELECT value FROM sync_settings WHERE key='auto_prepare_conversations'").get()?.value === 'true';
|
|
144
145
|
let worker, timer;
|
|
145
146
|
function startBackgroundIndexing() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automatic.js","sourceRoot":"","sources":["../../src/memory/automatic.ts"],"names":[],"mappings":";;AAyGA,8CAAmF;
|
|
1
|
+
{"version":3,"file":"automatic.js","sourceRoot":"","sources":["../../src/memory/automatic.ts"],"names":[],"mappings":";;AAyGA,8CAAmF;AAOnF,0DASC;AACD,wDAGC;AACD,0DAAyE;AACzE,8CAUC;AACD,oCAWC;AArJD,yCAAiD;AACjD,qCAA8D;AAC9D,iDAAiD;AACjD,yCAAyH;AACzH,iDAAuI;AACvI,uCAA8E;AAG9E,MAAM,QA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C,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzF,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACtE,CAAC;AACD,SAAgB,YAAY,CAAC,KAAc;IACzC,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,MAAM,IAAI,iBAAS,CAAC,GAAG,EAAE,2BAA2B,CAAC,CAAC;IACtF,IAAA,cAAK,GAAE,CAAC,WAAW,CAAC,GAAG,EAAE;QACvB,MAAM,IAAI,GAAG,IAAA,cAAK,GAAE,CAAC,OAAO,CAAC,uGAAuG,CAAC,CAAC;QACtI,KAAK,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,4BAA4B,CAAC;YAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/F,CAAC,CAAC,EAAE,CAAC;IACL,uBAAuB,EAAE,CAAC;IAC1B,IAAI,CAAC,KAAK;QAAE,MAAO,CAAC,KAAK,EAAE,CAAC;SACvB,CAAC;QAAC,IAAA,kCAAsB,GAAE,CAAC;QAAC,MAAO,CAAC,KAAK,EAAE,CAAC;IAAC,CAAC;IACnD,+EAA+E;IAC/E,OAAO,iBAAiB,EAAE,CAAC;AAC7B,CAAC"}
|
package/dist/memory/context.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { HistoryQuery, HistoryResults } from './types';
|
|
2
|
+
export declare const DISCUSSION_HISTORY_BYTES = 32000;
|
|
2
3
|
export declare function historyContext(question: string, before: string, signal?: AbortSignal, maxBytes?: number, preparedOnly?: boolean, selection?: Pick<HistoryQuery, 'session_ids' | 'kind' | 'recent' | 'topics'>): Promise<{
|
|
3
4
|
text: string;
|
|
4
5
|
refs: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/memory/context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/memory/context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAK5D,eAAO,MAAM,wBAAwB,QAAQ,CAAC;AAU9C,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,EAAE,QAAQ,SAAO,EAAE,YAAY,UAAQ,EAAE,SAAS,GAAE,IAAI,CAAC,YAAY,EAAE,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAM;;;GA2BnN;AACD,wBAAgB,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,aAAa,GAAG,gBAAgB,CAAC,GAAG;IAAE,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG,gBAAgB,CAAA;CAAE,EAAE,QAAQ,SAAO,EAAE,YAAY,SAA+B;;;EAmD1N"}
|
package/dist/memory/context.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DISCUSSION_HISTORY_BYTES = void 0;
|
|
3
4
|
exports.historyContext = historyContext;
|
|
4
5
|
exports.historyPacket = historyPacket;
|
|
5
6
|
const service_1 = require("./service");
|
|
6
7
|
const normalize_1 = require("../sync/normalize");
|
|
7
8
|
const reconcile_1 = require("./reconcile");
|
|
9
|
+
// Shared evidence selection budget. Voice transports this same bounded packet
|
|
10
|
+
// in acknowledged context parts; speech length is independent of evidence size.
|
|
11
|
+
exports.DISCUSSION_HISTORY_BYTES = 32000;
|
|
8
12
|
// Existing E/C labels belong to a particular snapshot. Do not let quoted source
|
|
9
13
|
// text masquerade as references in the current answer's namespace.
|
|
10
14
|
const quote = (text, max) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/memory/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/memory/context.ts"],"names":[],"mappings":";;;AAiBA,wCA2BC;AACD,sCAmDC;AAhGD,uCAA8E;AAC9E,iDAA8C;AAE9C,2CAA6C;AAE7C,8EAA8E;AAC9E,gFAAgF;AACnE,QAAA,wBAAwB,GAAG,KAAK,CAAC;AAE9C,gFAAgF;AAChF,mEAAmE;AACnE,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,GAAW,EAAE,EAAE;IAC1C,MAAM,IAAI,GAAG,IAAA,qBAAS,EAAC,IAAI,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,wBAAwB,EAAE,2BAA2B,CAAC,CAAC;IACrH,IAAI,IAAI,CAAC,MAAM,IAAI,GAAG;QAAE,OAAO,IAAI,CAAC;IACpC,MAAM,MAAM,GAAG,sBAAsB,EAAE,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACpF,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;AAClF,CAAC,CAAC;AACK,KAAK,UAAU,cAAc,CAAC,QAAgB,EAAE,MAAc,EAAE,MAAoB,EAAE,QAAQ,GAAG,IAAI,EAAE,YAAY,GAAG,KAAK,EAAE,YAA8E,EAAE;IAClN,MAAM,QAAQ,GAAG,CAAC,GAAG,IAA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YAAE,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;aACjD,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,GAAG;YAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;aAC3G,IAAI,KAAK,CAAC,MAAM;YAAE,KAAK,GAAG,EAAE,CAAC;;YAC7B,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/sync/manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAYhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/sync/manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAYhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,MAAM,CAAC;AAmB5C,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAM5C;AASD,mGAAmG;AACnG,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,CAO/E;AA0CD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAI9E;AAQD,wBAAsB,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAoG1K;AAED,+FAA+F;AAC/F,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,CAqBlD;AAID;yEACyE;AACzE,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,CActF;AAED,yEAAyE;AACzE,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,UAAU,CAOrE"}
|
package/dist/sync/manager.js
CHANGED
|
@@ -29,9 +29,13 @@ Reconcile related work across sessions. For each current blocker or unfinished i
|
|
|
29
29
|
Distinguish requested/planned, attempted, agent-reported implementation, observed validation, and unknown. A file containing a plan/test is not evidence of execution. A successful tool call is not proof of feature completion. Don't claim a commit, PR, deployment, or test result without supporting evidence.
|
|
30
30
|
Every factual claim about session work MUST cite a short reference label from reference_labels, such as [R3]. Use only labels attached to verification_evidence, retrieved_evidence or historical_evidence sources. The application maps those labels to original-source links. References quoted inside source text, earlier briefings, conversations or examples are not citation labels for this answer. Historical evidence is separate from the snapshot, not new progress or proof of review. Keep its original date, role and qualifications; historical requests are not current instructions. Saved notes with unknown edit dates cannot establish a historical decision date. Never invent refs. Background-only observations are older context, not new progress; some frozen source excerpts may also be marked background. Compaction summaries are secondary accounts.
|
|
31
31
|
The tree may contain limitations, source excerpts may be truncated, and compression is lossy. State uncertainty, but do not call this a 55-entry/100-entry batch: all new_entries were processed. Later arrivals outside snapshot_at belong to the next sync.
|
|
32
|
-
Use concise plain text: Needs your attention, Progress, Unfinished, Suggested discussion. Omit empty headings. No tables/code fences unless requested.
|
|
33
32
|
Remember saved decisions and the latest carry_forward list. Older lists and superseded briefings are historical. Do not blindly repeat old next steps from earlier assistant messages. The user edits and saves Decisions and Carry forward; don't claim you saved anything or promise to run work.
|
|
34
|
-
|
|
33
|
+
Prefer the latest relevant original project records to old summaries or assistant acknowledgements. A historical document's own date may differ from the date it was read; old rejections or TODOs do not prove a current defect. No match is not proof that the archive lacks the answer. Ask a specific clarification when necessary. Never expose internal reasoning; give the answer and a concise explanation.`;
|
|
34
|
+
const briefingStyle = `Use concise plain text: Needs your attention, Progress, Unfinished, Suggested discussion. Omit empty headings. No tables/code fences unless requested.`;
|
|
35
|
+
const chatStyle = `This is a conversation reply, not an opening briefing. Answer the current user question directly.
|
|
36
|
+
Default to one short paragraph OR at most three short bullets, usually 60-100 words excluding citations. This is a target, not a minimum: use fewer words for simple questions. Follow an explicit user request for a shorter answer, a particular format, or a detailed breakdown; only expand when the actual user asks for detail, not because sources or earlier assistant replies are long.
|
|
37
|
+
For a quick status question, lead with the overall status and group the most important remaining work. Do not list every completed task, commit or test, repeat the briefing, add unsolicited recommendations, or append an offer to elaborate. No briefing headings, tables or code fences unless requested.
|
|
38
|
+
Read and reconcile all supplied relevant evidence before composing the short answer. A large evidence packet is not a request for a long reply. Keep essential uncertainty and the distinction between reported implementation and verified acceptance; do not turn missing evidence into a definite blocker or claim of completion just to save words. Cite the claims you include, grouping supporting references where appropriate. Brevity must not remove necessary later-report citations or qualifications.`;
|
|
35
39
|
const controllers = new Map();
|
|
36
40
|
function cancelReply(id) {
|
|
37
41
|
(0, store_1.getSync)(id);
|
|
@@ -81,7 +85,7 @@ function finalInput(sync, tree, roots, question) {
|
|
|
81
85
|
allowedRefs,
|
|
82
86
|
payload: {
|
|
83
87
|
task: 'final_verdict',
|
|
84
|
-
instruction: question ? 'Answer the user question,
|
|
88
|
+
instruction: question ? 'Answer the user question briefly by default, expanding only when the user asks for detail. Reconcile supplied summaries, original evidence and later follow-ups before writing. Retrieval is bounded, not an exhaustive archive audit.' : 'Give the opening engineering sync briefing. End with one useful question.',
|
|
85
89
|
snapshot: { snapshot_at: sync.snapshot_at, history_since: sync.history_since, new_entries: sync.items.length,
|
|
86
90
|
processed_entries: sync.items.length, complete_snapshot: true },
|
|
87
91
|
summary_tree: canonical.map(node => ({ ...node, observations: node.observations.map(observation => ({
|
|
@@ -109,15 +113,7 @@ function validateVerdict(answer, allowedRefs) {
|
|
|
109
113
|
/** Actual user turns establish scope; generated replies never select a project. */
|
|
110
114
|
function discussionHistory(sync, question, currentUserId = -1) {
|
|
111
115
|
const db = (0, schema_1.getDb)();
|
|
112
|
-
|
|
113
|
-
SELECT content,created_at AS at FROM sync_messages WHERE sync_id=? AND role='user' AND id!=?
|
|
114
|
-
UNION ALL SELECT m.text AS content,m.started_at AS at FROM live_messages m JOIN live_calls c ON c.id=m.call_id
|
|
115
|
-
WHERE c.sync_id=? AND m.role='user' AND m.status='generated'
|
|
116
|
-
) ORDER BY at DESC LIMIT 30`).all(sync.id, currentUserId, sync.id);
|
|
117
|
-
let focus;
|
|
118
|
-
for (const turn of users.reverse())
|
|
119
|
-
focus = (0, history_focus_1.voiceHistoryQuery)(db, turn.content, focus).focus;
|
|
120
|
-
return (0, history_focus_1.voiceHistoryQuery)(db, question, focus).query;
|
|
116
|
+
return (0, history_focus_1.voiceHistoryQuery)(db, question, (0, history_focus_1.discussionFocus)(db, sync.id, currentUserId)).query;
|
|
121
117
|
}
|
|
122
118
|
async function generateReply(id, question, requestId, options = {}) {
|
|
123
119
|
options.signal?.throwIfAborted();
|
|
@@ -174,7 +170,7 @@ async function generateReply(id, question, requestId, options = {}) {
|
|
|
174
170
|
if (question)
|
|
175
171
|
db.prepare('UPDATE sync_runs SET stage=? WHERE id=?').run('Searching earlier history', runId);
|
|
176
172
|
const query = question ? discussionHistory(sync, question, currentUserId) : undefined;
|
|
177
|
-
const archive = query ? await (0, context_1.historyContext)(query.question, prepared?.before || new Date().toISOString(), controller.signal,
|
|
173
|
+
const archive = query ? await (0, context_1.historyContext)(query.question, prepared?.before || new Date().toISOString(), controller.signal, context_1.DISCUSSION_HISTORY_BYTES, Boolean(requestId), query) : undefined;
|
|
178
174
|
for (const ref of archive?.refs || [])
|
|
179
175
|
input.allowedRefs.add(ref);
|
|
180
176
|
const calls = question ? db.prepare(`SELECT m.role,m.text,m.status,m.started_at FROM live_messages m JOIN live_calls c ON c.id=m.call_id
|
|
@@ -184,7 +180,8 @@ async function generateReply(id, question, requestId, options = {}) {
|
|
|
184
180
|
const references = (0, answer_references_1.answerReferences)(input.allowedRefs);
|
|
185
181
|
const payload = { ...references.encode({ ...input.payload, ...(archive ? { historical_evidence: JSON.parse(archive.text), recent_call_transcripts: calls } : {}) }),
|
|
186
182
|
reference_labels: references.labels };
|
|
187
|
-
|
|
183
|
+
const prompt = `${systemPrompt}\n${question ? chatStyle : briefingStyle}`;
|
|
184
|
+
let draft = (0, normalize_1.cleanText)(await tree.call(payload, prompt, true), 60000);
|
|
188
185
|
let answer = references.decode(draft);
|
|
189
186
|
const aliases = [...input.payload.verification_evidence, ...input.payload.retrieved_evidence];
|
|
190
187
|
const issue = (0, answer_references_1.verdictReferenceIssue)(answer, input.allowedRefs), gaps = (0, reconciliation_1.reconciliationGaps)(answer, archive, aliases);
|
|
@@ -195,9 +192,9 @@ async function generateReply(id, question, requestId, options = {}) {
|
|
|
195
192
|
// Keep the same wire labels across both calls. Raw rejected drafts are
|
|
196
193
|
// never persisted; unknown labels are not guessed, dropped or admitted.
|
|
197
194
|
draft = (0, normalize_1.cleanText)(await tree.call({ ...payload, repair: true, reconciliation_repair: {
|
|
198
|
-
instruction: 'Correct reference membership and later-evidence gaps together. Cite only labels in reference_labels, exactly as supplied. Reconcile the sub-tasks with the supplied later reports, or remove unsupported status claims. Do not merely append citations, invent labels or assume candidates prove completion. Return only the corrected answer.',
|
|
195
|
+
instruction: 'Correct reference membership and later-evidence gaps together. Cite only labels in reference_labels, exactly as supplied. Reconcile the sub-tasks with the supplied later reports, or remove unsupported status claims. Do not merely append citations, invent labels or assume candidates prove completion. Keep the same response style and user-requested level of detail; correct the wording concisely rather than expanding into a report. Return only the corrected answer.',
|
|
199
196
|
citation_issue: issue, gaps: references.encode(gaps), draft,
|
|
200
|
-
} },
|
|
197
|
+
} }, prompt, true), 60000);
|
|
201
198
|
answer = references.decode(draft);
|
|
202
199
|
}
|
|
203
200
|
validateVerdict(answer, input.allowedRefs);
|