143 Commits

Author SHA1 Message Date
larryluozhang
1168103a43 fix(learner): allow own-scope settings and workspace writes via route templates
Follow-up to #1323 (which merged as the prefix surface map): three
learner-blocking gaps remained, and all three sit on URL prefixes that
also host admin-grade operations, so they are matched on the resolved
route template — the same pattern as _LEARNER_KB_READ_ROUTES.

- PUT /api/settings/ui — theme/language save into the caller's own
  per-user interface.json; learners currently get 403 changing language.
- PUT/DELETE /api/settings/draft — the settings UI saves through a
  per-user draft document; catalog apply stays admin-gated in the
  endpoint itself.
- /api/settings/workspace self-management — PUT root (select current
  binding), POST /validate, POST /registrations, PATCH
  /registrations/{id}. Data migration/export/root-migration/snapshot
  routes under the same prefix stay default-denied: they move data
  across scopes and carry no internal admin gate.
2026-09-28 13:19:09 +08:00
Bingxi Zhao (Frank)
176257b1f8 style: format knowledge source integrations 2026-09-27 11:15:15 +08:00
Bingxi Zhao (Frank)
958cef38b9 test(knowledge): cover saved legacy chat selection 2026-09-27 11:04:33 +08:00
Bingxi Zhao (Frank)
a824e4b01f fix(knowledge): preserve moved KB retrieval and scoped jobs 2026-09-27 11:04:33 +08:00
Bingxi Zhao (Frank)
b0385a315d feat(knowledge): choose storage and move individual bases 2026-09-27 11:04:33 +08:00
Bingxi Zhao (Frank)
550268e1e3 fix: support Malay as a persistent reply language 2026-09-27 04:37:15 +08:00
Bingxi Zhao (Frank)
75aa71ae5b Merge remote-tracking branch 'origin/dev' into codex/pr-1567-review 2026-09-27 02:58:27 +08:00
Bingxi Zhao (Frank)
7dd1f7f046 fix: allow learner task board through chat surface 2026-09-27 02:25:51 +08:00
krxi
2eb2f2de96 feat: add a workspace-scoped task board 2026-09-24 16:10:03 +03:00
polaris-smart
b9b41dd529 style(tests): ruff-format the role normalization tests 2026-09-24 08:19:40 +08:00
polaris-smart
1a746ae1e8 style(tests): ruff-format the gate-semantics tests 2026-09-24 08:19:39 +08:00
polaris-smart
5357e0c29d refactor(auth): gate learner-only paths on "non-admin" instead of "exactly user"
Align the five remaining two-value gate idioms with the "only 'admin'
elevates" invariant that #1556 now documents: self-service learner-profile
access (_require_local_learner), the admin-managed learner-profile
GET/PUT target checks, the identity-layer set_learner_profile writer, and
device-credential activation (_active_account) admit every non-admin role
instead of only "user".

While the admitted vocabulary is still {"admin", "user"} this is
behavior-preserving; once "teacher"/"student" exist, ordinary accounts
keep learner profiles and device logins instead of being silently
excluded. Admins stay excluded everywhere, including admins carrying a
learner preset.

Tests: a teacher with a learner preset manages their own profile through
the self-service endpoints and via an admin actor; admins (even with a
learner preset) stay rejected at the self-service, admin-managed,
storage, and device-credential layers; a device credential issued for a
teacher logs in and reports the teacher role, while issuance for an admin
still fails closed.
2026-09-24 08:19:39 +08:00
polaris-smart
85c6cad6b2 feat(auth): admit "teacher" and "student" role values in the single role whitelist
Extend the role vocabulary admitted by the single source of truth
(VALID_ROLES + normalize_role + the Role literal) that #1556 introduced.
Authorization stays least-privilege: only "admin" elevates, defaults are
unchanged, unknown values still degrade to "user", and the diff is fully
revertible one line per value. Capability wiring for the new roles stays
deployment policy; "parent" is deliberately out of scope.

Tests: parametrized passthrough over the four documented roles, set_role
round-trip for the new values, non-elevation assertions, and a "parent"
negative control proving the whitelist decides.
2026-09-24 08:19:39 +08:00
Bingxi Zhao (Frank)
8880529c65 Merge PR batch with local follow-up fixes
Preserve precise learner KB route guards, combine UI and response language domains, carry normalized EPUB extraction, and regenerate frontend contracts.

Update locale fallback coverage for the completed Ukrainian translation bundle.
2026-09-23 12:01:14 +08:00
Bingxi Zhao (Frank)
55e96e429e style: satisfy repository lint and format gates 2026-09-23 11:28:41 +08:00
Bingxi Zhao (Frank)
21b9307031 fix(reading): enforce current learner grants on saved sources and tabs 2026-09-23 11:27:03 +08:00
Bingxi Zhao (Frank)
baa3263a7a fix(auth): forward requested handoff host and avoid shared quota lockout 2026-09-23 11:25:53 +08:00
Bingxi Zhao (Frank)
c0d19dae04 fix(multi-user): preserve newer grant writes during preset rollback 2026-09-23 11:15:47 +08:00
Bingxi Zhao (Frank)
7730fd0c5f fix(grants): persist atomically and fail closed on corrupt data 2026-09-23 11:15:42 +08:00
Bingxi Zhao (Frank)
e750a8ddd0 fix(multi-user): restore prior grant if preset update fails 2026-09-23 11:00:37 +08:00
Bingxi Zhao (Frank)
705e9bf9d5 Merge branch 'codex/reading-learning-prs-20260923' into codex/pr-batch-root
# Conflicts:
#	deeptutor/reading/extract.py
#	deeptutor/reading/store.py
#	web/components/notebook/NotebookRecordRow.tsx
#	web/locales/en/app.json
#	web/locales/zh/app.json
2026-09-23 10:58:38 +08:00
Bingxi Zhao (Frank)
064034a283 Merge branch 'codex/evan-backend-prs-20260923' into codex/pr-batch-root
# Conflicts:
#	deeptutor/api/routers/settings.py
#	tests/api/test_settings_router.py
#	web/components/notebook/NotebookRecordRow.tsx
#	web/components/settings/SettingsOverview.tsx
#	web/context/app-shell-storage.ts
#	web/features/knowledge/api/sources.ts
#	web/features/settings/store/SettingsStore.tsx
2026-09-23 10:56:37 +08:00
Bingxi Zhao (Frank)
6ac8deed51 fix(multi-user): scope learner KB reads and persist grants before preset 2026-09-23 10:55:46 +08:00
Bingxi Zhao (Frank)
3d58ba5253 Rotate handoff tickets with a controlled invalid-token error 2026-09-23 10:51:14 +08:00
Bingxi Zhao (Frank)
e5598a72c5 Harden trusted handoff proxy and ticket lifetime; normalize CSV rows 2026-09-23 10:47:53 +08:00
Bingxi Zhao (Frank)
6a1913626a Fix response language normalization and circular import after #1345 2026-09-23 10:47:51 +08:00
Bingxi Zhao (Frank)
9612fa9e5f Merge latest origin/dev before PR batch integration 2026-09-23 10:38:20 +08:00
Bingxi Zhao (Frank)
915a5ae57b Merge commit 'refs/pr/1482' into codex/evan-backend-prs-20260923
# Conflicts:
#	deeptutor/api/routers/auth.py
#	tests/services/config/test_runtime_settings.py
#	web/locales/en/app.json
#	web/locales/zh/app.json
2026-09-23 10:29:26 +08:00
Bingxi Zhao (Frank)
0d3763e033 Merge commit 'refs/pr/1556' into codex/evan-backend-prs-20260923 2026-09-23 10:28:56 +08:00
Bingxi Zhao (Frank)
7dd8b2ac44 Merge commit 'refs/pr/1345' into codex/evan-backend-prs-20260923
# Conflicts:
#	web/components/settings/SettingsOverview.tsx
2026-09-23 10:27:55 +08:00
Bingxi Zhao (Frank)
24da87ae4e Merge PR #1368: account-scoped reading learning records 2026-09-23 10:27:53 +08:00
Bingxi Zhao (Frank)
a4d1e24c75 Merge commit 'refs/pr/1330' into codex/evan-backend-prs-20260923 2026-09-23 10:27:34 +08:00
Bingxi Zhao (Frank)
13605fca5e Merge PR #1375: derive learner preset from active learning policy 2026-09-23 10:26:41 +08:00
Hermes
3f621d403a refactor(auth): converge all role whitelists on normalize_role, add set_role tests
- models.py: add VALID_ROLES + normalize_role as the single source of truth
- identity.py: route _canonical_record/_migrate_legacy_users/load_users/set_role through normalize_role
- context.py: token payload role mapping via normalize_role
- services/auth.py + api/routers/auth.py: set_role guards validate against VALID_ROLES
- tests/multi_user/test_role_normalization.py: 16 tests, first set_role coverage in repo

Zero behavior change: legal roles pass through; unknown values keep the
same least-privilege degrade path; only guard error strings derived from
sorted(VALID_ROLES) differ.
2026-09-23 01:21:17 +08:00
larryluozhang
0c2666c010 fix(learner): complete surface map for first-party learner screens + flip preset on restrictions assignment (#1222)
Rebased onto current main (v1.6.9 layout): _learning_surface_for_path now
lives in deeptutor/api/routers/auth.py; change content unchanged.

- map /api/mastery-paths/* to chat (learner's own per-user progress data)
- map GET/HEAD/OPTIONS /api/knowledge-bases* to reading (browse-only;
  mutations still default-deny)
- pass request.method into the surface lookup
- put_guardian_restrictions: when the account has no learning_policy yet,
  seed the default learner grant and flip the preset to learner, avoiding
  the standard-preset+policy mix that renders the admin shell and 403-storms
- regression tests: tests/multi_user/test_learning_surface_map.py (22 tests)
2026-09-22 00:57:28 +08:00
Bingxi Zhao (Frank)
da856ad670 release: v1.6.9
Ship folder-based workspaces and data migration, daily practice, redesigned
provider and model settings, and streaming conversation improvements.
Synchronize README translations and document the archive/permanent-delete
upgrade behavior in assets/releases/ver1-6-9.md.

Reduce initial JavaScript by deduplicating English resources and loading
animation features after hydration. Keep the existing route size budgets.
Update regression fixtures and browser audits for scoped URLs and the new
settings and learning interfaces.
2026-09-21 02:30:40 +08:00
XZH
352897cd4e feat(auth): add secure public session handoff (#1467) 2026-09-15 19:17:37 -07:00
evan188199-tech
9b066b5f98 feat(sessions): add recycle bin for deleted chats (#1398)
* feat(sessions): add recycle bin for deleted chats

Implements soft-delete for chat sessions so users can restore
accidentally deleted conversations from a recycle bin.

Backend:
- Schema migration adds deleted_at REAL column to sessions
- delete_session becomes a soft-delete (sets deleted_at timestamp)
- New store methods: restore_session, purge_session, list_deleted_sessions
- Session list queries exclude soft-deleted sessions
- API endpoints: GET /sessions/recycle-bin, POST /{id}/restore,
  DELETE /{id}/purge (purge triggers attachment/mastery cleanup)

Frontend:
- RecycleBinSection: collapsible sidebar section listing deleted
  sessions with Restore and Delete permanently actions
- Wired into SidebarShell via recycleBinSlot prop
- API client functions for list, restore, and purge
- en/zh translations for all recycle-bin UI strings

Tests: 6 backend tests covering the soft-delete lifecycle

* style: apply ruff format to sqlite_store

* fix(sessions): preserve recycled chat artifacts

* feat(sessions): fold #1444's backend into this recycle bin

#1444 built the same feature from the other end. This PR had the SQLite
column, the routes and the sidebar UI; #1444 had the protocol declarations,
the PocketBase implementation and the CLI wording. Neither shipped alone —
this one left multi-user deployments answering AttributeError on
/recycle-bin, and #1444 built a bin nobody could see. Closes #1444; its
backend is here.

Kept from here: one `deleted_at` column. #1444 carried `is_deleted` beside it
in both backends, and `deleted_at IS NOT NULL` already says everything the
boolean did — PocketBase now derives the outward `is_deleted` field from the
timestamp instead of storing it twice.

Taken from #1444: the naming, which turns out to fix the residual both PRs
shipped with. `delete_session` keeps meaning what every existing caller
already meant by it — remove the row — so `reading.py`'s two internal
cleanups need no patch: a deleted reading workspace still takes its sessions
with it instead of depositing them in a learner's bin, where restoring one
would resurrect a session pointing at a workspace that no longer exists. The
chat surface's delete is a separate, explicitly named `soft_delete_session`,
and `hard_delete_session` empties the bin. Both backends agree, and the
protocol declares all five so a backend cannot silently lack one again.

`test_entries_cascade_on_session_purge` becomes two tests, because there are
now two deletions worth pinning: one the bin can undo, and one that skips it
and cascades immediately.

Co-Authored-By: sjagadee <srini.jagadeesh@gmail.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: XZH <cto@xzh.ai>
Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
Co-authored-by: sjagadee <srini.jagadeesh@gmail.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 01:43:35 +08:00
XZH
facbc020b9 feat(learner): add account-scoped reading learning records (#1109) 2026-09-11 07:18:02 -07:00
XZH
e609133475 fix(users): derive learner preset from active policy 2026-09-10 12:54:04 -07:00
XZH
634a6916f9 feat(settings): expand response language options 2026-09-09 13:33:11 -07:00
XZH
3de25361ea feat(users): add batch import and deletion 2026-09-09 03:17:29 -07:00
Bingxi Zhao
f31acc1235 Merge pull request #1231 from evan188199-tech/codex/fix/learner-courses-1228
fix(learner): restore course access (#1228)
2026-09-07 23:47:59 +08:00
Bingxi Zhao (Frank)
04040a2c06 release: v1.6.5
Ship a content workspace you choose, one exec tool for every language,
Mastery Path modes that gate its tools, and Settings that grades
readiness instead of listing faults.

Release notes: assets/releases/ver1-6-5.md
2026-09-06 13:46:29 +08:00
XZH
bf4b55e926 fix(learner): restore course access (#1228) 2026-09-04 06:32:36 -07:00
NoxsMedia
9cd1912c14 feat: add LightRAG indexing model controls and provenance (#1174)
* feat(knowledge): add LightRAG indexing model controls

* fix(knowledge): close NOX-21 review findings

* fix(knowledge): resolve NOX-21 review blockers

* fix(knowledge): identify unpublished LightRAG builds

* style: format LightRAG indexing changes

* fix(knowledge): align indexing controls with LightRAG model

* fix(knowledge): close indexing UI review blockers

* style: format knowledge router
2026-09-03 15:56:55 +08:00
Bingxi Zhao (Frank)
93df3d48b7 release: v1.6.4
Ship lighter isolated runtimes, richer Books and Mastery flows,
Reading/session polish, and explicit model API capabilities.

Release notes: assets/releases/ver1-6-4.md
2026-09-03 01:38:54 +08:00
Bingxi Zhao (Frank)
fc39543bc0 feat: integrate frontend backend and canonical routes 2026-09-01 22:24:29 +08:00
Bingxi Zhao (Frank)
02ba56793e chore: checkpoint backend stabilization workspace 2026-09-01 21:28:15 +08:00
Bingxi Zhao (Frank)
90351189a1 feat(learner): complete guardian management flows 2026-09-01 01:52:13 +08:00