DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
fix: preserve exact navigation record selection and document verification
Bingxi Zhao (Frank)1eb6b3998f2d
diff --git a/artifacts/dito-preview/dt-exp-home.png b/artifacts/dito-preview/dt-exp-home.pngnew file mode 100644index 000000000..cf461f2f4Binary files /dev/null and b/artifacts/dito-preview/dt-exp-home.png differdiff --git a/artifacts/dito-preview/dt-exp-qa.md b/artifacts/dito-preview/dt-exp-qa.mdnew file mode 100644index 000000000..8b92875d0--- /dev/null+++ b/artifacts/dito-preview/dt-exp-qa.md@@ -0,0 +1,55 @@+# dt-exp integration verification++Desktop application integration, 2026-10-12.++## Baseline and scope++`dt-exp` starts from latest local `dev`, `3cbecb247`. Its tree was verified byte-for-byte equal to the earlier local-dev snapshot `172a4d49b`; the feature commit was replayed onto the actual dev commit. Work continues in `/Users/frank/HKUDS/DeepTutor`.++The production app uses its existing pages, stores, settings and agent engine. Four sidebar categories group Home, Partners, Learning and Resources. Category switches preserve the working page. Learning creation opens the original feature flows. The former `/preview` remains a separate prototype reference with isolated fixtures; production routes do not use its transport.++## Data compatibility++- No storage-schema migration, record-ID rewrite, directory relocation, or destructive data conversion was introduced by the navigation change.+- Learning navigation reads each existing workspace and preserves its origin on every link. Duplicate book/question IDs in separate workspaces remain separate records.+- Practice navigation reads compact question metadata through the existing recycle predicate; answers, attempt state and attachments remain in their original store.+- Partner and group navigation uses existing visibility and actor-scoped session stores. Archived transcripts remain available in original history pages.+- Session selection uses the existing continuity API; explicit manual changes update the URL so refresh resumes the selected session.+- Learning-account restrictions remain enforced. The additive aggregate GET filters each allowed source before reading it; other dashboard operations stay gated.+- Original settings, history organization, rename/pin/archive operations, workspaces, reading state and feature detail views remain available.++## Runtime separation++Preview: `http://127.0.0.1:4180/chat`; API: `http://127.0.0.1:8016`.+All browser verification used `DEEPTUTOR_HOME=/tmp/deeptutor-dt-exp-runtime`, separate from normal user data. Test records are named with 验证. No credentials or user library were copied into this runtime. It has no configured LLM, so live generation/provider behavior was not exercised.++## Browser verification++Verified against a production build, with desktop layouts at 1280 and 1440 CSS pixels:++- Four-category switching preserves open work; real category lists load from the API.+- Original Settings sections remain complete; switching the isolated UI language to Chinese and applying changes succeeds.+- Resources retains history, notebooks, journal, questions, knowledge bases, personas, skills, MCP, CLI apps and memory.+- A reading collection created in the UI persists and can be reopened from Learning after reload.+- Existing practice record opens the original exercise UI; submitting its correct answer shows the original grading result.+- Books and Mastery creation open the original configuration/source-selection workflows.+- Partner navigation opens an existing JSONL transcript with its original body. Configure remains complete.+- Group session deep links select the exact stored discussion and load its history.+- Task Board creates a real card and persists its move into Doing.+- Co-Writer creates a real draft, edits Markdown, updates the preview, and reports saved state.+- Dito defaults to Auto while retaining the original manual capability menu.++Evidence: `dt-exp-practice.png`, `dt-exp-partners.png`, `dt-exp-writer.png` and `dt-exp-home.png` in this directory. Older JPGs document the earlier frontend prototype, not the integrated application's data.++## Automated verification++- Full WebUI Vitest baseline: 149 files, 663 tests passed; new session/navigation regression tests were additionally run after integration fixes.+- Node suite: 1,303 tests passed.+- Backend workspace + multi-user suites: 474 tests passed; after adding the HTTP policy regression, the focused compatibility/policy suite passed all 7 tests.+- Type checking, API contract regeneration/check, dependency architecture, i18n checks and Ruff passed.+- Full ESLint has no errors; existing and prototype translation warnings remain.+- Production build succeeds; all existing route JS budgets pass after deferring unused sidebar panels/history code. Budgets were not raised.++## Known limits++Model-backed generation, external channels and integrations require their normal configuration and were not live-tested in the isolated runtime. This iteration uses the existing chat/tool loop for Auto; it does not claim to add a new cross-capability autonomous planning engine. Mobile refinement was explicitly deferred by the user.diff --git a/artifacts/dito-preview/prototype-qa.md b/artifacts/dito-preview/prototype-qa.mdnew file mode 100644index 000000000..312e18e07--- /dev/null+++ b/artifacts/dito-preview/prototype-qa.md@@ -0,0 +1,114 @@+# Dito frontend preview QA — four-category desktop iteration++Result: verified for the local frontend prototype scope.++Preview: http://127.0.0.1:4173/preview#learning++Branch: `codex/dito-frontend-prototype`++## Scope and references++The user requested desktop browser work first. This iteration reorganizes the+existing WebUI around Home, Partners, Learning and Resources. Backend execution+and mobile refinement are outside this iteration.++References are the user's three Notion sidebar captures (b205598c, 4a06d37e,+d449b5d3) and read-only inspection of their existing Notion Chrome tab. Its+Home/Conversation/Meeting navigation was inspected and returned to Home.+The source conversation sidebar and the rendered Partners screenshot were+opened in the same comparison input. This is an adaptation for DeepTutor,+not a pixel-identical clone or a claim about Notion's source code.++## Implemented behavior++- Four top categories use a selected icon-and-label pill, keyboard navigation,+ quiet hover states and reduced-motion support. Switching a category changes+ the sidebar while preserving the open working document.+- Home exposes Dito, task board, Co-Writer and agents.+- Partners exposes configured companions, groups and independent sessions.+ Local configuration, group creation and example conversations persist.+- Learning exposes existing records and four creation choices: book, mastery,+ practice and immersive reading. New items are explicitly local drafts with+ editable titles and notes; they are not falsely presented as generated courses.+- Resources reuses the original Learning Space dashboard and category taxonomy.+ Detail pages are generic local previews, not the original full resource CRUD.+- Sidebar width, selection, subtle transitions and icon alignment are scoped to+ the prototype. The full desktop layout was inspected at 1440 × 960.++## Reused WebUI++- AppShell, SidebarShell, resize hook, existing theme/preferences.+- FeaturePage, PageHeader, LearningShell and LearningCardContent.+- StandaloneComposer / ChatComposer and its existing menus.+- ReadingProvider, ReaderPane, AnnotationList and reading controls.+- CoWriterWorkspace editor, preview, local saving and Markdown export.+- MasteryQuestionCard, MarkdownRenderer, Dialog and Tooltip.+- PartnerAvatar, SpaceDashboard and AgentsHub.+- Original Kanban page extracted unchanged into a reusable KanbanBoard;+ its normal route re-exports that component.++Shared component changes are optional props with existing defaults retained.+No backend or dependency changes were made. Primary checkout sources were not+modified. The worktree reuses the primary checkout's installed node_modules.++## Desktop evidence++- [Learning with persistent records](artifacts/dito-preview/learning-v2.jpg)+- [Partners, groups and sessions](artifacts/dito-preview/partners-v2.jpg)++Prior-iteration evidence remains available for the reused reader and writer:++- [Reader with Dito](artifacts/dito-preview/reader-desktop.jpg)+- [Existing Co-Writer](artifacts/dito-preview/writer-desktop.jpg)++No critical clipping or alignment issues remained in the scoped visual review.+The full framer-motion component initially conflicted with strict LazyMotion;+using its lightweight `m` component resolved that runtime error. Later browser+checks showed no new application errors.++## Functional verification++Verified through browser interaction in this iteration:++- Four-category switching, arrow-key selection, sidebar collapse and expansion.+- Switching sidebar category preserves the open reading document.+- Create a book draft, edit title/notes, reload, and recover the same record.+- Configure partners; create a two-member group and a separate group session;+ send an example message and see the session title update in the sidebar.+- Load the original task board; create a task and move it to Doing.+- Load original AgentsHub and original resource dashboard categories.+- Reopen the reader at its saved chapter, open the existing writer and return.+- Open a sample book's second chapter, render its formula.+- Answer the original practice card and see completed status in Learning.++Earlier iteration verification also covered reading highlights, annotation+navigation, quoted reading context and Co-Writer editing/save/reload/export.++Engineering checks on the final code:++- `npm run typecheck`: passed.+- `npm run architecture:check`: passed, 921 modules / 2919 dependencies.+- Targeted ESLint `--quiet`: passed. Chinese-only prototype copy still has+ the repository's normal i18n warnings.+- `git diff --check`: passed.+- Existing sidebar defaults, lazy history, task-board, Co-Writer integration+ and lazy notebook tests: 5 files, 12 tests passed.++## Prototype boundaries++`demo-transport.ts` intercepts API requests only on `/preview` and stores local+fixtures under `deeptutor.dito-preview.v1.*`. Normal routes retain their normal+transport. Task-board streaming is disabled only for this preview; normal+callers keep existing behavior.++Dito and partner replies are fixed examples. Models, external partner channels,+backend capability execution, parsing and real content generation are not+connected. Learning creation saves a draft. Resource details and totals remain+prototype fixtures; adding a detail entry does not update the dashboard totals.+Unsupported server operations return an explanatory response.++To restart from this worktree's `web/` directory:++```sh+npm run dev -- --webpack --hostname 127.0.0.1 --port 4173+```diff --git a/web/components/sidebar/NavigationPrimitives.tsx b/web/components/sidebar/NavigationPrimitives.tsxindex d28bd5a12..28bf95718 100644--- a/web/components/sidebar/NavigationPrimitives.tsx+++ b/web/components/sidebar/NavigationPrimitives.tsx@@ -1,4 +1,5 @@'use client'+import { isNavigationTargetActive } from '@/lib/navigation'import type { ReactNode } from 'react'import Link from 'next/link'import { usePathname, useSearchParams } from 'next/navigation'@@ -25,13 +26,8 @@ export function NavigationRow({const drawer = useSidebarDrawer()const pathname = usePathname()const search = useSearchParams()- const target = new URL(href, 'http://localhost')- const workspace = target.searchParams.get('dt_workspace') ?? target.searchParams.get('workspace')- const currentWorkspace = search.get('dt_workspace') ?? search.get('workspace') ?? ''const selected =- active ??- ((pathname === target.pathname || pathname.startsWith(`${target.pathname}/`)) &&- (workspace === null || workspace === currentWorkspace))+ active ?? isNavigationTargetActive(href, pathname, new URLSearchParams(search.toString()))return (<Tooltip label={label} description={detail} as="div" side="right"><Linkdiff --git a/web/lib/navigation.ts b/web/lib/navigation.tsindex 486ee6b60..d095c57cc 100644--- a/web/lib/navigation.ts+++ b/web/lib/navigation.ts@@ -29,3 +29,21 @@ export function partnerSessionHref(session: {const root = session.kind === 'group' ? '/partners/groups' : '/partners'return `${root}/${encodeURIComponent(session.owner_id)}?${new URLSearchParams({ session: session.session_key })}`}++/** Query identities matter: practice items share a page but not a record. */+export function isNavigationTargetActive(+ href: string,+ pathname: string,+ search: URLSearchParams+): boolean {+ const target = new URL(href, 'http://localhost')+ const workspace = target.searchParams.get('dt_workspace') ?? target.searchParams.get('workspace')+ const currentWorkspace = search.get('dt_workspace') ?? search.get('workspace') ?? ''+ return (+ (pathname === target.pathname || pathname.startsWith(`${target.pathname}/`)) &&+ (workspace === null || workspace === currentWorkspace) &&+ [...target.searchParams].every(+ ([key, value]) => key === 'dt_workspace' || key === 'workspace' || search.get(key) === value+ )+ )+}diff --git a/web/tests/navigation-records.spec.ts b/web/tests/navigation-records.spec.tsindex acc5c490c..3d578112a 100644--- a/web/tests/navigation-records.spec.ts+++ b/web/tests/navigation-records.spec.ts@@ -1,6 +1,6 @@import { expect, it } from 'vitest'import { allLearningActivity, type LearningSources } from '@/lib/learning-dashboard'-import { categoryForPath, partnerSessionHref } from '@/lib/navigation'+import { categoryForPath, partnerSessionHref, isNavigationTargetActive } from '@/lib/navigation'it('keeps old feature URLs in their new categories', () => {for (const path of ['/chat/old-session', '/co-writer/old-document', '/kanban', '/agents'])@@ -57,3 +57,18 @@ it('encodes partner identities and session keys independently without rewritingexpect(decodeURIComponent(url.pathname)).toBe('/partners/研究伙伴')expect(url.searchParams.get('session')).toBe('web:old/+?')})++it('highlights only the open question in its original workspace', () => {+ const path = '/learning/practice'+ const query = new URLSearchParams('question=7&dt_workspace=research')+ expect(+ isNavigationTargetActive('/learning/practice?question=7&dt_workspace=research', path, query)+ ).toBe(true)+ expect(+ isNavigationTargetActive('/learning/practice?question=8&dt_workspace=research', path, query)+ ).toBe(false)+ expect(isNavigationTargetActive('/learning/practice?question=7&dt_workspace=', path, query)).toBe(+ false+ )+ expect(isNavigationTargetActive('/learning', path, query)).toBe(true)+})