Repository navigation
Read one thread or widget through page state, and print every write as JSON - #1374
Conversation
… as JSON `page state PAGE ID` replaces `thread read` and `page events --thread`: an id naming a message, a widget frozen into one, or another event a thread holds reads that thread with a page of its history; a page widget narrows the reading to what stands inside it. One resolver, `work.page_subject`, answers every command that takes an id, so `status --on`, `page state` and the thread commands agree; `page check` refuses an authored id in the log's event-id shape. Thread commands are open, reply, edit, resolve and summarize: `--title` on open and reply names the thread, `thread edit --title` renames it, and a refused title refuses the command before anything is posted. `page interactions` is gone (the trace file is read directly) and `page events` exits quietly when its reader closes the pipe. Every write prints the records it appended as `page events` prints them, `seq` included (a retried append now keeps it too); `--json` is gone. Commands whose output is a fact print JSON; documents and diagnostics stay text. Tests that held the old sentences, `--json` and the removed filters now assert the records, `page state` readings and the membership join directly. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
The new ID resolver drops undo events that belong to a thread. thread_memberships assigns an undo the thread membership of the gesture it withdraws, but id_subject asks event_threads, which returns no thread for undo. A frozen-widget action followed by its undo therefore yields a thread-owned undo in the log, yet page state PAGE <undo-id> and status --on <undo-id> reject the ID. I reproduced that mismatch with those three records. The shared resolver needs to account for indirect event membership too.
thread open --title and thread reply --title commit the message before attempting the title in a separate transaction (open, reply). If the title append fails, the command exits unsuccessfully even though it posted the message; argument evaluation also prevents _print_records from printing the successful write. A retry can post the same question or answer again. The preflight title check handles invalid text, but cannot make the two writes atomic. The message and title need one admitted write, or the CLI needs to report the committed message and stop promising an all-or-nothing command.
# Conflicts: # evals/README.md
# Conflicts: # evals/README.md
…fore its title An undo belongs to the thread of the gesture it withdraws (`thread_memberships`), but the id resolver asked `event_threads`, which names no thread for one, so `page state <undo-id>` and `status --on <undo-id>` refused an id the log puts in a thread. `id_subject` now follows an undo to what it withdrew and reads every other non-message event through the membership join. `thread open --title` and `thread reply --title` print the posted message before naming its thread. The title's text is checked before anything is posted, so the second write can fail only with the page itself; the message it followed is then already on screen rather than lost behind the refusal. The new eval case carries its A/B result in its header comment, where main now keeps each case's history. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Five more CLI consolidations, following #1355.
page state PAGE [ID].thread readwaspage statenarrowed to one thread plus a page of its messages; that is now the ID form ofpage state, with the same--after/--limit. An ID naming a widget on the page narrows the reading to what stands inside it: its element, the moves and reports on it or its parts, its Asks, workflows and updates, so narrowing to an Ask carries the pick on its choice.thread readandpage events --threadare gone, and the delivery's note on an elided thread points atpage stateinstead of the raw log.work.page_subject). A message, a widget frozen into one, or any other event whose history a thread holds (an undo through the gesture it withdraws) names that thread; a page widget, or a move or report on it, names the widget.status --on,page state IDand every thread command read ids through it; a thread command refuses a page widget.page checkand message markup now refuse an authored id in the log's event-id shape (eight hex digits), so a page id cannot name a message.open,reply,edit,resolve,summarize.--titleonopenandreplynames the thread in the same command, and the delivery clause for an untitled thread says to add it to the reply. Renaming isthread edit PAGE MESSAGE --title.thread titleis gone. A title whose text admission would refuse refuses the whole command before anything is posted; the message prints before its title record.page eventsis the one log follower.page interactionsis gone; the diagnostic trace isPAGE/interactions.jsonl, read directly.page eventstakes--afterand--followonly, and both paths exit quietly when the reader closes the pipe (page interactions | headused to end in aBrokenPipeError).thread open/reply/edit/resolve/summarize,page stamp,page report) prints the records it appended, one JSON line each, exactly aspage eventsprints them,seqincluded.--jsonis gone from all eight.statusprints the status it wrote (the unanswered-moves note goes to stderr),server start/runprint{"url"},server stop{"stopped"},page init{"page"},page mediaone{"path", "source"}line per image,page export{"file", "version", "bytes"},data setthe source's reading without the value,data clear{"source", "cleared"},package init/install{"package"},codex start{"task", "app_server", "started"}, andpage guidance PAGEits audiences as an array. Documents (page transcript,page guidance PAGE AUDIENCE) and diagnostics (page check,package check, errors) stay text.The appended record now carries its
seq, which the log derives from the line number, and so does a retried append's, so a write's output andpage eventsare the same record. The base-vs-candidate harnesses (dev/leaf_dev, the arrangement eval) find the server URL in either output shape, since an arm can be built from a revision before this change.Guidance, docs, the site's how-it-works transcript, scripts that read the server URL, and the tests are updated together.
evals/thread-named-in-its-replyis new: an untitled long thread, where the reply should carry--titleand the elided messages be read withpage state.Tests:
leaf thread titleevery time); no other case fell. Recorded in the case's header comment.uv run pytest tests: 1428 passed on the merge with main.npm run test:runtime: 152 passed.test_a_write_prints_the_records_it_appended,test_any_id_names_one_subject_for_every_command(page widget, Ask, move id, frozen widget and title-event ids acrosspage state,status --onandthread resolve; the eight-hex id refusal),test_a_reader_that_closes_the_pipe_ends_page_events_quietly.🤖 Generated with Claude Code