Skip to content

Commit 4a02f15

Browse files
committed
feat: harden tauri workspace and sync progress docs
1 parent 24166b4 commit 4a02f15

84 files changed

Lines changed: 10027 additions & 869 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/diataxis/en/explanation/agent-conversation-focus-mode-plan.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,89 @@ This is the current product-facing priority because it connects the existing lea
1313
single, discoverable interaction loop instead of leaving tutor, path, and focus behaviors split
1414
across separate UI surfaces.
1515

16+
## 2026-05-27 Tauri-First Reply Direction
17+
18+
Current branch reality is now asymmetric:
19+
20+
- the conversation contract is real,
21+
- the knowledge-point/action shell is real,
22+
- Tauri reader hardening is real,
23+
- scoped knowledge-workspace hydration is real,
24+
- but assistant reply rendering is still not real in the same sense.
25+
26+
If Tauri is temporarily allowed to lead and Godot is treated as a later adaptation target, the
27+
correct architecture center shifts:
28+
29+
- Tauri becomes the rich-render baseline,
30+
- the Reader markdown/math/mermaid pipeline becomes the render substrate,
31+
- Godot later consumes downgraded/materialized output instead of constraining Tauri-first UX now.
32+
33+
### Current code gap
34+
35+
The current backend/frontend contract is only partially product-complete:
36+
37+
- `src/learning/KnowledgeLearningPlatform.ts` returns `assistantMessage`, `citations`, `knowledgePoints`, memory signals, and trace data.
38+
- `src/frontend/agent_workspace.js` still consumes `assistantMessage` as a flat string.
39+
- `src/frontend/workspace_panes.js` still mounts conversation messages through plain `textContent`.
40+
41+
That means:
42+
43+
- grounded retrieval works,
44+
- action orchestration works,
45+
- but markdown, KaTeX, Mermaid, and structured HTML do not yet reach the agent reply surface.
46+
47+
### Tauri-first implementation program
48+
49+
1. **Response contract evolution**
50+
- Keep `assistantMessage` as a compatibility fallback.
51+
- Add an `assistantBlocks` shape for typed reply rendering.
52+
- Start with:
53+
- `main_markdown`
54+
- `citations`
55+
- `knowledge_actions`
56+
- `system_notice`
57+
- optional `html_artifact`
58+
- Primary touch points:
59+
- `src/learning/api.ts`
60+
- `src/learning/types.ts`
61+
- `src/learning/KnowledgeLearningPlatform.ts`
62+
- `src/server.ts`
63+
64+
2. **Shared render runtime extraction**
65+
- Reuse the mature Reader pipeline instead of creating a fourth markdown path.
66+
- Extract the reusable markdown/math/mermaid runtime from:
67+
- `src/frontend/reader.js`
68+
- `src/frontend/app.js`
69+
- `src/reader_renderer.ts`
70+
- `src/routes/render.ts`
71+
- The shared runtime should remain browser/Tauri-friendly and later support Godot materialization without being designed around it now.
72+
73+
3. **Message block renderer in the agent workspace**
74+
- Replace plain message mounting with a typed block renderer.
75+
- Keep conversation-card/result-presentation registries intact.
76+
- Introduce a dedicated assistant-reply renderer in:
77+
- `src/frontend/agent_workspace.js`
78+
- `src/frontend/workspace_panes.js`
79+
- `src/frontend/index.html`
80+
- `src/frontend/styles.css`
81+
82+
4. **HTML artifact path**
83+
- Do not inject arbitrary full HTML into the main chat DOM.
84+
- Treat large HTML payloads as artifacts with a sandboxed preview flow.
85+
- This should mirror the existing product direction already proven in external references like Cherry Studio, while staying stack-native to NoteConnection.
86+
87+
5. **Streaming and transition safety**
88+
- Keep current SSE + sync fallback behavior.
89+
- Stream into `main_markdown` blocks rather than directly mutating plain-text message nodes.
90+
- Preserve current `knowledgePoints` and capability execution behavior during the transition so the upgrade is forward-compatible rather than a rewrite.
91+
92+
### Acceptance criteria for this next slice
93+
94+
1. Tauri agent replies can render markdown headings, lists, tables, KaTeX, and Mermaid without leaving persistent error overlays in the visible chat surface.
95+
2. The reply surface still works when only legacy `assistantMessage` is present.
96+
3. Existing `knowledgePoints`, capability execution, and card registries remain backward-compatible.
97+
4. The same shared render substrate can later be materialized or downgraded for Godot instead of forcing Godot constraints into the Tauri-first UX now.
98+
1699
## Current Branch Status
17100

18101
The branch has already crossed the "plan only" stage for this slice.

docs/diataxis/en/explanation/development-progress-dashboard.md

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,53 @@
33
This page is the implementation-facing dashboard for the Knowledge Mastery evolution plan.
44
It tracks what is already implemented, where the hard gaps remain, and how to verify progress from code and runtime behavior.
55

6+
## 2026-05-27 Tauri-First Conversation Rendering Reality Sync
7+
8+
- The branch has moved materially beyond the last Program F-only status snapshot.
9+
- Current code truth now spans five distinct slices that the older dashboard under-reported:
10+
- scoped knowledge-workspace grounding is now real rather than graph-only optimistic,
11+
- Tauri reader markdown/math/mermaid rendering is materially hardened,
12+
- provider settings and TOML template management are now productized in the frontend,
13+
- conversation preflight/CORS compatibility is fixed for turn-resume headers,
14+
- desktop/runtime debug capture tooling is now part of the repo rather than an ad hoc local workflow.
15+
16+
Implemented now at current HEAD:
17+
18+
- Knowledge workspace closure:
19+
- `src/frontend/source_manager.js` now publishes the active source target,
20+
- `src/frontend/agent_workspace.js` now forwards `activeTarget` and scoped prefixes with conversation requests,
21+
- `src/server.ts` now performs active-target-aware workspace hydration plus selective title-like hydration,
22+
- `src/routes/data.ts` no longer shadows the real build / restore-cache path with stub behavior,
23+
- `src/learning/KnowledgeLearningPlatform.ts` now exposes `workspaceReadiness`, `missDiagnostics`, title-hit planning, and request inspection helpers.
24+
- Reader/runtime rendering hardening:
25+
- `src/frontend/reader.js` now renders raw markdown, KaTeX, and Mermaid through one runtime path, with frontend render first and backend PNG fallback retained,
26+
- `src/frontend/app.js` now suppresses leaked Mermaid error artifacts so long-lived error blocks stop occupying the visible Tauri surface,
27+
- `src/notemd/MermaidProcessor.ts`, `src/reader_renderer.ts`, and `src/routes/render.ts` now strengthen parity and render-service behavior around Mermaid/Math handoff.
28+
- Provider and settings delivery:
29+
- `src/frontend/index.html`, `src/frontend/settings.js`, `src/notemd/AppConfigToml.ts`, `src/notemd/providerTemplates.ts`, and the locale bundles now expose a dedicated agent/provider settings page with preset templates and TOML materialization support,
30+
- the API-version field is now documented in-product instead of being left as unexplained raw config.
31+
- Runtime transport compatibility:
32+
- `src/middleware/cors.ts` now explicitly allows `x-agent-conversation-turn-id` and `x-agent-conversation-resume-turn-id`, which closes the preflight failure that previously broke browser/Tauri conversation retries.
33+
- Debug and evidence tooling:
34+
- the repository now ships runtime/webview/window capture helpers plus Mermaid stage/export tooling under `scripts/`, so live Tauri failures can be inspected with first-party evidence commands instead of one-off manual probing.
35+
36+
Current Tauri product gap:
37+
38+
- The agent reply area is still plain-text oriented.
39+
- `src/frontend/agent_workspace.js` still consumes `assistantMessage` as a flat string, and `src/frontend/workspace_panes.js` still mounts conversation messages via `node.textContent = message`.
40+
- This means the current Tauri chat shell can issue grounded requests and action cards, but it still does not reuse the mature Reader markdown/math/mermaid rendering path for assistant replies.
41+
- The next delivery step is therefore not another generic shell expansion. It is a Tauri-first reply-rendering upgrade that preserves the current contract while introducing a richer message model.
42+
43+
Code-vs-plan reality for this slice:
44+
45+
| Area | Prior expectation | Current HEAD reality | Status |
46+
|---|---|---|---|
47+
| Knowledge workspace grounding | scoped queries should resolve the selected corpus instead of only the loaded graph | active target, scope prefixes, title-like hydration, workspace readiness, and miss diagnostics are now wired across frontend, server, and KLP | Operational |
48+
| Tauri markdown reader parity | markdown, math, and Mermaid should survive real runtime conditions without persistent error overlays | reader/runtime paths now render Mermaid with frontend-first + backend-PNG fallback and suppress leaked error artifacts | Operational |
49+
| Provider settings | provider/model/API-key controls should be isolated and write durable TOML configuration | dedicated agent/provider settings surface plus preset/TOML template helpers are now present | Operational |
50+
| Conversation retry transport | turn/replay headers should survive browser/Tauri preflight | CORS now allows both conversation turn headers | Closed |
51+
| Tauri agent reply rendering | assistant replies should render rich markdown instead of plain text | reply area still uses `assistantMessage` + `textContent` and therefore remains rendering-incomplete | Open |
52+
653
## 2026-05-26 Program F Closure
754

855
- The deep-student-derived next-phase program is now implemented through Program F at current HEAD.
@@ -84,10 +131,12 @@ Operational implication:
84131

85132
| File | Current Lines | Implication |
86133
|---|---:|---|
87-
| `src/server.ts` | 14,992 | routing is modularized, but the main server monolith is still large |
88-
| `src/learning/KnowledgeLearningPlatform.ts` | 7,706 | KLP still carries major implementation gravity despite domain extraction |
89-
| `src/frontend/path_app.js` | 4,649 | path workbench/controller split is incomplete |
90-
| `src/frontend/app.js` | 4,713 | graph runtime still keeps a large host-side control surface |
134+
| `src/server.ts` | 15,920 | routing is modularized, but the main server monolith is still large and now also carries more runtime orchestration |
135+
| `src/learning/KnowledgeLearningPlatform.ts` | 10,043 | KLP remains the dominant implementation gravity well and now also carries workspace-readiness and planner logic |
136+
| `src/frontend/path_app.js` | 4,943 | path workbench/controller split is still incomplete and now additionally carries reader-parity responsibilities |
137+
| `src/frontend/app.js` | 5,953 | graph runtime still keeps a large host-side control surface and now also carries Mermaid error-guard behavior |
138+
| `src/frontend/reader.js` | 1,334 | reader/runtime rendering is now a first-class subsystem rather than a lightweight helper |
139+
| `src/frontend/agent_workspace.js` | 3,214 | agent orchestration exists, but reply rendering still has not crossed from text shell to rich message surface |
91140
| `src/routes/knowledge.ts` | 690 | knowledge routes need another split before claiming route-layer compaction |
92141

93142
Use these numbers as the current HEAD truth. Older size-reduction tables later in this page remain useful as historical traceability, but they no longer describe the current branch state exactly.
@@ -101,6 +150,7 @@ It is the end-to-end delivery of:
101150
- local knowledge-point listing,
102151
- docked Tauri graph `focus mode` pane,
103152
- docked learning-path pane that can coexist with graph focus and be promoted fullscreen.
153+
- Tauri-first assistant reply rendering that can reuse the mature Reader markdown/math/mermaid pipeline.
104154

105155
Execution reference:
106156

@@ -117,7 +167,10 @@ Current branch status for this slice:
117167
- clicking `Learning Path` now mounts the existing path workspace (`path-container` + sidebars) into the docked learning-path pane instead of stopping at a text-only preview (`src/frontend/workspace_panes.js`, `src/frontend/agent_workspace.js`),
118168
- the graph surface now reserves workspace width so conversation + graph-focus + learning-path can coexist in one host-owned layout (`src/frontend/styles.css`),
119169
- graph-focus fullscreen now promotes the real graph workspace instead of only enlarging a metadata card (`src/frontend/workspace_panes.js`, `src/frontend/styles.css`),
170+
- the scoped-knowledge conversation flow is now materially more honest about corpus readiness: active folder target flows into the request contract, the server selectively hydrates likely title-matching documents into the workspace, and conversation traces now include readiness + miss diagnostics instead of only returning an empty top-k result (`src/frontend/source_manager.js`, `src/frontend/agent_workspace.js`, `src/server.ts`, `src/routes/data.ts`, `src/learning/KnowledgeLearningPlatform.ts`),
120171
- the new agent workspace shell now has i18n coverage for static shell strings plus runtime button/empty-state messaging, existing knowledge-card actions / localized system messages now re-render on language change instead of staying in the previous locale, conversation card rerender is now centralized through a card-kind renderer registry, and a source-level parity guard now checks append-kind vs registry alignment (`src/frontend/index.html`, `src/frontend/locales/en.json`, `src/frontend/locales/zh.json`, `src/frontend/workspace_panes.js`, `src/frontend/agent_workspace.js`, `src/agent_workspace.frontend.test.ts`),
172+
- provider/model/API-key settings are now isolated into a dedicated agent settings page with preset-template and TOML-template flows, but reply rendering in that same workspace still remains plain-text and is therefore the next obvious Tauri-first closure item (`src/frontend/index.html`, `src/frontend/settings.js`, `src/notemd/AppConfigToml.ts`, `src/notemd/providerTemplates.ts`),
173+
- the reader/runtime render stack is now substantially more robust for Tauri markdown usage: raw markdown, KaTeX, Mermaid frontend render, Mermaid backend PNG fallback, and leaked Mermaid error suppression are all present; the missing step is to reuse that stack inside the agent reply surface instead of keeping it isolated to the Reader (`src/frontend/reader.js`, `src/frontend/app.js`, `src/reader_renderer.ts`, `src/routes/render.ts`, `src/notemd/MermaidProcessor.ts`),
121174
- locale governance now includes backend-to-frontend capability label-key parity blocking: emitted conversation capability `labelKey` values must resolve to non-empty bilingual `agentWorkspace.actions.*` entries (`src/learning/KnowledgeLearningPlatform.ts`, `src/frontend/locales/en.json`, `src/frontend/locales/zh.json`, `src/agent_workspace.locale.contract.test.ts`),
122175
- modular knowledge-route closure now includes live browser strict proof instead of snapshot-only recovery: conversation response wiring, capability-triggered request routes, card-title localization, and graph-focus compatibility now pass `STRICT`, `UI_STRICT`, and `UI_DYNAMIC_STRICT` against real browser/network traces (`src/routes/knowledge.ts`, `src/learning/KnowledgeLearningPlatform.ts`, `src/frontend/app.js`, `src/frontend/locales/en.json`, `src/frontend/locales/zh.json`, `scripts/verify-agent-workspace-browser.js`),
123176
- locale governance now also blocks capability failure-message drift: emitted `failure.messageKey` values must resolve to bilingual `agentWorkspace.messages.*` entries with aligned interpolation placeholders and stable fallback placeholder sets (`src/learning/KnowledgeLearningPlatform.ts`, `src/frontend/locales/en.json`, `src/frontend/locales/zh.json`, `src/agent_workspace.locale.contract.test.ts`),

0 commit comments

Comments
 (0)