Commit Graph

177 Commits

Author SHA1 Message Date
Bingxi Zhao (Frank)
b680f1d208 Merge #2296 from tanishqbaweja 2026-11-06 01:56:22 +08:00
Tanishq
aa4b6ec252 fix(question): keep a quiz question whose Markdown carries a fenced code sample
_parse_quiz_payload swapped the reply for the body of its first ``` fence
before parsing anything. The quiz FINISH schema asks for a bare JSON object
whose `question` is Markdown and whose coding answer is code, so that fence
is usually a code sample inside a string value. The parser decoded the
sample instead, got {}, and the question was lost: after one repair round
that hit the same parser, the learner got "[Generation failed] <topic>"
with N/A as the answer and the explanation.

Take a reply that is one complete JSON object as it is first, the order
parse_json_response already uses for the same case (#825). Wrapped replies
still go through the fence; when a fence inside a field cuts the wrapper's
body short, the first object in the whole reply is used instead.
2026-11-01 11:38:02 +05:30
RRFZ
ee678ec8c6 fix(video_lesson): read the layout check's browser output as UTF-8
check_layout ran headless Chrome with text=True and no encoding, so the
server decoded --dump-dom with its ANSI code page. The report quotes the
lesson's own text; on a cp936/cp932 server running outside UTF-8 mode
(as under `deeptutor start`) a lesson with non-ASCII text came back as
mojibake, the JSON no longer parsed, and the check returned None, which
callers treat as "no browser available". The layout QA silently never
ran for those lessons.

Decode the browser's output as UTF-8.
2026-10-31 21:05:32 -04:00
Bingxi Zhao (Frank)
9724cb551b Merge commit '3f027d9437f56b6cccbf0cf61265b0c7cd7467cd' into codex/validate-reviewed-integration 2026-10-31 18:53:15 +08:00
Bingxi Zhao (Frank)
ce4c39d6a3 Merge commit '0095956fb4639757e632c1b6187a3065c6dd33a4' into codex/validate-reviewed-integration
# Conflicts:
#	tests/agents/math_animator/test_retry_manager.py
2026-10-31 18:53:14 +08:00
Bingxi Zhao (Frank)
4a3dbff59c Merge commit '732064f43dfab590ab538268a955ca40e5b4a5a1' into codex/validate-reviewed-integration 2026-10-31 18:52:55 +08:00
Bingxi Zhao
7db39b4b03 Merge pull request #2142 from 1akashkalita/fix/animation-visual-review-option
Expose opt-in visual review for generated animations
2026-10-31 18:31:15 +08:00
Bingxi Zhao
13933a2c2c Merge pull request #2160 from kevin9327/fix/duration-unit-word-boundary
fix: read duration units only at a word boundary in the math animator
2026-10-31 18:28:25 +08:00
Bingxi Zhao (Frank)
0095956fb4 fix(math-animator): keep unavailable geometry checks advisory 2026-10-31 17:22:25 +08:00
Bingxi Zhao (Frank)
3f027d9437 fix(video): discover browsers cross-platform and distinguish unavailable reviews 2026-10-31 16:57:19 +08:00
Bingxi Zhao (Frank)
4d2678954d fix(manim): preserve review failures and reap cancelled geometry probes 2026-10-31 16:56:47 +08:00
Bingxi Zhao (Frank)
732064f43d fix(narration): retain PCM metadata and reap cancelled audio conversions 2026-10-31 16:54:27 +08:00
Amar Tinawi
32372c7916 feat(video_lesson): narrate with the Settings TTS provider
Video Lesson narration only ever used edge-tts, whatever TTS provider the
user configured. When the Settings provider is not Edge, speak each
sentence through synthesize_speech (so every catalog provider works:
OpenAI, a local OpenAI-compatible Kokoro/Piper server, MiniMax, ...),
decode it to PCM with ffmpeg for exact per-sentence caption offsets, join
the sentences with a short pause and encode the mp3 the player expects.
Any failure falls back to Edge for that line, then to silent captions.
Needs ffmpeg on PATH; without it the Settings path is skipped.
2026-10-30 15:29:17 +04:00
Amar Tinawi
645a54c621 fix(video_lesson): narrate with the Edge voice chosen in Settings
Narration always used the hard-coded VOICES default (en-US-AvaNeural /
zh-CN-XiaoxiaoNeural), ignoring Settings > Text-to-Speech. When the TTS
provider is Edge and its voice speaks the lesson's language, use it;
otherwise keep the default.
2026-10-30 15:18:45 +04:00
Amar Tinawi
8f1db978cc feat(math_animator): dry-run geometry check gates each render
Without a vision model the pipeline has no layout review, so overlapping
labels, lines through formulas and text cut off by the frame ship as-is.

layout_probe.py replays the scene with Manim's dry_run (no frames drawn,
a few seconds), snapshots every visible text and stroked VMobject after
each play()/wait(), and reports in scene units: text overlapping text,
strokes crossing text, and text or shapes past the (camera) frame edge.

When visual review is off and output is video, the probe runs before each
render. A failing layout is raised as a ManimRenderError, so the existing
repair loop fixes it before any frame is drawn (MAX_LAYOUT_ROUNDS = 3);
after that the scene renders as it stands, and the post-render review only
records what is left. The probe fails open: a crash or timeout skips it.

The English code-generator prompt gains layout rules and the Manim
Community API names the renderer rejects; the repair prompt says how to
fix layout findings.
2026-10-30 15:17:07 +04:00
Amar Tinawi
d6fd294284 feat(video_lesson): browser layout check with repair rounds
The build check proves a lesson compiles and plays; it cannot see a drawing
crossing a title or a card covering a label. After a lesson builds, open
the bundle in headless Chrome at a frame every 4 s, measure every visible
text box and sample points along every visible SVG stroke, and send
collisions back to the writer in 1920x1080 coordinates:

- text overlapping text
- strokes passing through text (dash-aware)
- opaque boxes covering text outside them
- anything drawn in the caption band (y > 880)

Up to 2 layout rounds (MAX_ATTEMPTS 3 -> 4). The last bundle that built is
kept, so a layout fix that then fails to compile still returns the lesson
that played. The check is advisory: no Chrome, a probe error or a timeout
skips it. The English writer prompt gains a layout contract (safe area,
planned boxes, label spacing) and layout-aware retry guidance.
2026-10-30 15:15:44 +04:00
kevin
8c76fca86e fix: read duration units only at a word boundary in the math animator 2026-10-29 18:37:52 +09:00
Akash Kalita
6e611fe5df fix: expose opt-in visual review for animations 2026-10-28 21:11:03 -07:00
Bingxi Zhao (Frank)
9aadac3e3b merge: integrate current dev with modular installation 2026-10-28 01:23:48 +08:00
Bingxi Zhao (Frank)
fbab59acbf feat: modularize installation and enforce feature dependency boundaries 2026-10-28 01:02:29 +08:00
Bingxi Zhao (Frank)
1abffcf0e7 Merge remote-tracking branch 'origin/dev' into HEAD 2026-10-27 21:43:24 +08:00
Cursor Agent
3650647a86 style: ruff-format cache_control assertions in test_agent_loop
Collapse the multi-line any/all comprehensions so ruff format --check
matches CI (ruff 0.16.0).

Co-authored-by: Nandana Dileep <nandanadileep@users.noreply.github.com>
2026-10-27 11:59:43 +00:00
Bingxi Zhao (Frank)
e347c0c2e0 fix: preserve tutoring replies and stabilize preview runtime
Keep learner-facing explanations visible across finish checks, persistence, and replay. Remove mastery prose heuristics and prioritize learner objections.

Coordinate service shutdown and descendant cleanup, and preserve video lesson identity and playable results across chat completion and reload.
2026-10-27 17:58:46 +08:00
nandanadileep
6299f773c2 fix: apply prompt caching in agent loop _call_llm 2026-10-27 00:49:02 +00:00
Bingxi Zhao (Frank)
e38a1f63a1 fix(video-lesson): isolate rendering without requiring Docker 2026-10-27 03:43:53 +08:00
Bingxi Zhao (Frank)
9410ef3ca2 docs(video-lesson): clarify runtime prerequisites 2026-10-27 01:49:05 +08:00
Bingxi Zhao (Frank)
cb0c0f523d Merge branch 'codex/pr2014-ready' into codex/pr2013-sandbox 2026-10-27 01:46:42 +08:00
Bingxi Zhao (Frank)
9237139fb8 fix(video-lesson): isolate render checks and clean up cancelled processes 2026-10-27 01:46:42 +08:00
Bingxi Zhao (Frank)
9d822fcdf0 fix(ci): align preview fixtures and formatting with current contracts 2026-10-27 01:44:57 +08:00
Bingxi Zhao (Frank)
addb783d2f Merge preview and CI fixes into video lesson branch 2026-10-27 01:40:39 +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)
28c11e2ae8 feat: update notes, chat interactions and workspace UI on preview
Remove course pages, APIs and the course_study capability. Add anchored note
threads and reviewed learning-block generation, queued and withdrawable chat
messages, quote attachments, side chats, and the calendar/favorites/navigation
updates.

Keep preview's existing backend architecture. Wire the new features through
its Python application and existing chat engine, retain legacy selected-text
requests, persist mid-turn messages in replay, and restore note context when
regenerating. Leave stored user data intact.

Validate frontend contracts, dependency boundaries, types, 1290 node tests,
840 rendered tests, lint, localization and the production build. Exercise
session/notes/API regressions, 53 chat-engine tests and 20 Python/native
integration tests with isolated runtime data.
2026-10-26 22:13:34 +08:00
SeleiXi
26c3a39174 feat(video_lesson): voice lessons with edge-tts
The writer now returns a narration line per scene. The host speaks each one
with Edge's free read-aloud voices, times the captions from the sentence
boundaries, and inlines the audio into the lesson page. edge-tts is an optional
extra (video-lesson); without it, or when the service fails, the scene keeps
captions timed from an estimated speaking rate and plays silently.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 23:58:03 +08:00
SeleiXi
40f50641a9 feat(video_lesson): add narrated scenes to the lesson kit
<Scenes> plays a lesson's scenes back to back and gives each one its voice-over
and captions from a per-lesson voice.ts. A scene stretches to fit its narration,
so the picture never cuts the voice short. The kit ships an empty voice.ts so
it still compiles on its own, and the player now shows a volume control.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 23:58:03 +08:00
SeleiXi
dfe4f285a8 feat(outputs): publish video lesson pages from a sandboxed origin
A video lesson's turn directory holds the model's source next to the
built page. Only artifacts/lesson.html is added to the public-output
allowlist; Lesson.tsx and anything else in the directory stay private.

The page runs model-written script, so it is served with
"Content-Security-Policy: sandbox allow-scripts allow-popups". It then
runs in an opaque origin even when opened in its own tab, without the
API's cookies or same-origin access.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 20:55:35 +08:00
SeleiXi
3182131158 feat(video_lesson): add the lesson writer agent
One agent writes Lesson.tsx. Its system prompt covers the Remotion rules
a lesson needs (frame-driven animation, sequences, the 1920x1080 frame),
an art direction meant to keep lessons from looking machine-made
(textbook and documentary references, a list of tells to avoid,
captions in a teacher's voice), and the kit's source.

The conversation is kept across attempts, so a failed compile or frame
check goes back to the model with the errors and its previous reply.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 20:55:35 +08:00
SeleiXi
53c08252d7 feat(video_lesson): add a Remotion lesson kit and build runtime
Groundwork for a capability that answers with an animated explainer the
learner plays in the browser, rather than a server-rendered video.

kit.tsx is the component library lessons are written against: a paper
page, serif titles, captions, pen marks, plots (curves, point sequences,
cobwebs), an honest-scale timeline and a China map, all in DeepTutor's
palette. Style comes from the kit, so the model only arranges content.

build.mjs compiles Lesson.tsx with esbuild, renders 25 sample frames in
Node and bundles the composition into @remotion/player. Lessons may
import only react, remotion and ./kit, and the frame check runs under
Node's permission model (no file writes, child processes or workers).
Errors thrown during rendering are reported through renderToPipeableStream
so the model sees the real message.

runtime.py installs the pinned npm packages on first use, then wraps a
bundle into one self-contained page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 20:55:34 +08:00
Bingxi Zhao (Frank)
ce48fc2d4c fix(math-animator): stop truncation retries at the output ceiling (#1914) 2026-10-19 01:52:28 +08:00
Bingxi Zhao (Frank)
1497994c9f Merge PR #1938: bound tutoring history and retain exact recall when condensation fails 2026-10-19 00:57:48 +08:00
Bingxi Zhao (Frank)
9aae961412 Merge PR #1957: separate private source evidence from explicit public presentation 2026-10-19 00:53:44 +08:00
Bingxi Zhao (Frank)
3196b6d792 Merge PR #1954: prepare source evidence through a generic capability prerequisite contract 2026-10-19 00:48:43 +08:00
Bingxi Zhao (Frank)
e8c0b1eed5 Merge PR #1962: count complete projected requests in context guard 2026-10-19 00:31:25 +08:00
wangkai
a40c6469fb fix(solve): keep the remaining plan in view after each step fold
solve_finish_step folds the finished step's tool chatter, and the same cut
dropped the solve_plan result and the step's own `next` pointer, leaving the
model only "[S1] ... — done.". Pass SolveSession.progress_text() as the
checkpoint state so every fold keeps the current plan (done / next / todo) in
view, including after a replan, and the persisted model turn carries it into
follow-up turns.

Closes #1968
2026-10-15 13:00:06 +08:00
wangkai
87a0317255 feat(agent-loop): let a context checkpoint carry replaceable state
A checkpoint may now carry an optional `state` next to `summary`. The fold
keeps appending summaries before the boundary as before and places `state`
in one system message after it, so the next fold replaces the state instead
of stacking stale copies. Checkpoints without `state` behave exactly as before.
2026-10-15 13:00:03 +08:00
Bingxi Zhao
0e784d5080 Merge pull request #1910 from YizukiAme/codex/fix-1909-image-compaction
fix(session): budget projected image replay before compaction
2026-10-15 03:23:49 +08:00
Bingxi Zhao
d348b42336 Merge branch 'dev' into codex/fix-1909-image-compaction 2026-10-15 02:04:18 +08:00
Bingxi Zhao
8b2e62accd Merge branch 'dev' into fix/agent-loop-preserve-multimodal-instruction 2026-10-15 02:04:12 +08:00
Bingxi Zhao (Frank)
e841f36c60 test: stabilize shared transport and browser audit contracts 2026-10-15 01:27:46 +08:00
cgycorey
8df56e7dfe fix(agents): count the full request in the context-window guard
The guard sized the request from message content alone. It ignored
assistant tool_calls arguments and the tool schemas sent with the call,
so a request over the window could go out untrimmed.

- Count each message with the counter history planning uses, leaving out
  the _context_snapshot key that _call_llm strips before sending.
- Pass the call's tool_schemas into the guard. The forced-finish round
  sends none, so it passes none.
- Keep a running total while tool results are snipped instead of
  re-estimating the whole request after every snip.
- Log a warning when nothing is left to trim and the request still does
  not fit, rather than passing it silently.

With the call's tool schemas, the 8k reproduction from #1961 now trims all
three tool results, taking the request from 10435 to 6514 tokens against a
7372-token budget.

Refs #1961
2026-10-14 10:18:59 +01:00
yepyhun
755686264d fix(mastery): separate source inspection from assessment delivery 2026-10-13 13:49:35 +02:00