21 Commits

Author SHA1 Message Date
Junlin Li
560a80a17f fix: explain missing LLM access in chat 2026-11-12 16:58:52 +08:00
yuanyyt
58afb10b57 fix: harden tutor-thread source recovery
Persist a structured selection_source beside the assistant prompt, and use
the legacy sidebar prompt's containing message, role and selection to
disambiguate repeated text. Scan every user message for a quote, refuse to
guess between several, and make the backfill conditional so a concurrent move
or detach wins.

Serialize PocketBase preference merges with a lock that spans event loops,
not one asyncio lock per loop, and validate client-supplied anchors on turns
and organization updates. Detach threads when the message they point at is
deleted.
2026-10-30 15:55:21 +08:00
Bingxi Zhao (Frank)
6bbcc00c55 Merge dev into preview, preserving preview features
Integrate dev fixes with preview's Python/TypeScript schedulers, chat queue, learning navigation, and live turn persistence.
2026-10-27 01:16:58 +08:00
Bingxi Zhao (Frank)
399297e7f0 feat: preserve TypeScript engine migration and workspace updates 2026-10-18 23:09:10 +08:00
dajiaohuang
019ed329c6 fix(session): preserve opaque PocketBase message cursors 2026-10-08 12:45:32 +08:00
Bingxi Zhao (Frank)
d15e35a378 fix(turns): make lost-ack resends reuse the original conversation (#1793) 2026-10-08 01:20:23 +08:00
Bingxi Zhao (Frank)
3a0ed2b560 fix(turns): surface and retry orphaned worker loss (#1570) 2026-09-27 04:55:15 +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
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
AoHanBei
00e2100adf feat(chat): search full conversation history (#1415) 2026-09-14 01:28:46 +08:00
Bingxi Zhao (Frank)
9feec62215 fix(turns): let a session blocked by a dead turn clear itself
`_begin_turn_sync` refuses a new turn while the session owns any row in
queued/running/waiting_input. That is right while a turn is alive and
catastrophic once one is not: a single row left behind by a lost worker,
a dropped socket or a restart blocked every later message in that
session, with no way out from the UI. Reporters described it precisely —
one window, no refresh, a conversation that never accepted another word
(#1297, #1359).

v1.6.7 closed the paths that manufacture those rows, but said nothing
about the ones already there. It shipped with "existing rows still need
clearing by hand" as a known issue, because the obvious fix — a periodic
sweep — needs an age threshold or it cancels a turn between its INSERT
and its first lease renewal, the worst failure a chat product has.

Reclaiming at the point of conflict removes that hazard rather than
managing it. The only rows ever considered are ones already blocking a
real request, so there is no window to get wrong, no timer, and no
threshold to guess. On a restart the leases are gone, so the first
message the user sends clears the row and goes through — the outcome the
sweep was for, without the sweep.

Liveness is the lease, never the row's age. A turn parked on an
`ask_user` card emits no events, so `updated_at` stops advancing while a
person is simply taking their time to answer; a live worker renews its
lease every few seconds whether or not it is producing output. So "no
lease" is the one signal that separates a zombie from a slow reader, and
a turn whose lease is live still gets its conflict — pinned by a test,
because that is what keeps this from becoming a way to run two turns on
one session.

Also names the exception. Both stores raised a bare RuntimeError with
the conflict spelled in the message; `ActiveTurnConflict` subclasses it,
so every existing handler keeps working, and a caller that can do
something about a stale row no longer has to match on text.

6921 passed, 24 skipped.
2026-09-11 12:43:41 +08:00
evan188199-tech
f9721b61c4 perf(session): lazily load turn event traces (#1191)
* perf(session): lazily load turn event traces

* fix(session): bound trace previews at the storage layer

---------

Co-authored-by: XZH <cto@xzh.ai>
Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-09-03 15:46:04 +08:00
Bingxi Zhao (Frank)
6e6e56aedb release: v1.6.3
Ship the breaking front- and back-end runtime and route refactor,
learner and guardian flows, grounded reading, knowledge and parser
updates, and recoverable long-running streams.

Release notes: assets/releases/ver1-6-3.md
2026-09-02 04:09:11 +08:00
Bingxi Zhao (Frank)
02ba56793e chore: checkpoint backend stabilization workspace 2026-09-01 21:28:15 +08:00
Bingxi Zhao (Frank)
d57d2983ef feat(mastery): complete v2 learning workflows 2026-08-28 14:58:43 +08:00
Bingxi Zhao (Frank)
308a0606f9 perf(chat): eliminate the post-stream "generating" stall
The spinner (and a frozen tab) outlived the LLM stream by seconds and
grew with conversation length:

- DONE now carries the persisted user/assistant message ids so the
  frontend reconciles its optimistic ids in place (lib/turn-reconcile)
  instead of refetching, re-normalizing, and re-rendering the whole
  session after every turn.
- The turn-event workspace mirror writes the whole batch in one append
  off the event loop instead of one synchronous open/write per event.
- PocketBase gains a batch append_turn_events that uploads in the
  background; the events.jsonl rglob flush in update_turn_status is
  gone, and add_message returns the real record id.
- The streaming autoscroll pin is mutation/load-driven instead of an
  unconditional 60fps scrollHeight read (forced layout) per frame.
2026-07-24 17:35:19 +08:00
Bingxi Zhao (Frank)
90a2c14c81 chore: backend + frontend follow-ons for v1.4.0-beta
Wires the new memory / capability / settings / quiz subsystems into
existing surfaces and finishes the chat-pipeline follow-on work.

Backend:
- Session services pick up the cumulative source inventory + new tool
  tags (turn_runtime, sqlite_store, pocketbase_store, protocol,
  base_session_manager).
- LlamaIndex RAG pipeline config / document_loader / retrievers
  tightened; rag/service.py routed to match.
- Sessions / unified_ws / settings / notebook routers updated for
  delete-chat-turn, multi-user, and the new tool surface.
- TutorBot manager + Zulip channel + openai_compat_provider follow-on
  fixes layered on top of the v1.3.10 SSL/Zulip sweeps.
- runtime/{banner, launcher, orchestrator}, services/setup/init,
  prompt/manager, json_parser refined for the runtime-settings
  rewrite.

Frontend:
- Co-Learn pages and session-surfaces removed (folded into chat).
- Chat composer / messages / trace / session panels, sidebars,
  common modals, markdown renderers, and i18n updated for the new
  ask_user / write_note / source-inventory flow.
- Admin, agents, co-writer, playground, book pages picked up the
  shared updates.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 18:08:22 +08:00
Bingxi Zhao (Frank)
1596807242 refactor chat capability & RAG pipeline(llamaindex) 2026-05-13 21:36:07 +08:00
Bingxi Zhao (Frank)
3d5c3a1eb5 improve chat 2026-05-12 02:20:30 +08:00
Bingxi Zhao (Frank)
72bcdd77d8 prepare v1.3.9 release 2026-05-09 02:53:14 +08:00
xor_xe
6ca2ecd64f feat: add optional PocketBase integration for auth and session storage
Introduces PocketBase as an optional sidecar for authentication and
session/KB storage, activated only when POCKETBASE_URL is set in .env.
Falls back to the existing SQLite/JSON backend when not configured.

Backend:
- SessionStoreProtocol (typing.Protocol) + get_session_store() factory
- PocketBaseSessionStore: JSONL write-ahead buffer, batch-flush on turn end
- pocketbase_client.py: singleton admin client, 60s in-memory token cache
- auth.py: additive PocketBase path (email-based login/register)
- CORS: explicit origins instead of wildcard (wildcard+credentials fails)
- WebSocket: validate token at connect time when AUTH_ENABLED

Infrastructure:
- docker-compose: pocketbase service with healthcheck + depends_on
- scripts/pb_setup.py: idempotent PocketBase collection bootstrap
- requirements/server.txt: pocketbase>=0.12.0

Frontend:
- Register/login: username field -> email field for PocketBase mode
- auth.ts: normalise FastAPI 422 errors to plain strings
- agents page: guard bots.map() against non-array responses
- settings page: graceful fetch error handling
- *.env.local added to .gitignore

Docs: README PocketBase sidecar setup section added
2026-04-17 21:42:29 +04:00