15 Commits
Author SHA1 Message Date
CatoandClaude 4a1af07415 ModelSheet and ModelChip; a failed turn can carry its way on (0.46.0) (#118)
The model button, the bring-your-own-key sheet and the link under a failed
turn ("Get a pass") were built in Heidi. They are the chat's experience, so
they belong here: ModelChip for the header, ModelSheet driven by the
product's vendor allowlist and key check, and ChatFailure.action/retry so a
transport can say what the reader can do next and when Retry cannot help.


Claude-Session: https://claude.ai/code/session_019MDtmteJuDGFouA1itJ5tM

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-26 09:39:11 +01:00
CatoandClaude dc53be7893 feat(send-queue): a queued message keeps its conversation; an unanswered question says so (0.32.0) (#96)
Measured on Loki's chat, 2026-11-13: three quick messages in a new chat
became three conversations, two queued messages vanished on reload, and a
question whose answer died with the page showed nothing under it, forever.

- send-queue (pure): takeQueuedFor, queuedFor, storableQueue,
  serializeQueue, parseStoredQueue, unansweredTurn.
- ChatThread takes `unanswered` and says so, with Try again when onRetry
  is given; ChatApp passes it.

test/send-queue.test.js; verify (format, lint, typecheck, build, tests,
browser tests) passes.


Claude-Session: https://claude.ai/code/session_019MDtmtUQb9BM11ycpApwGq

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-13 16:42:49 +01:00
CatoandClaude ab1708b1bd Agents are members: an Agent mark and whom it works for (#80)
ChatSpeaker gains kind (agent | person) and onBehalfOf, drawn as
'Loki [Agent] · for Georgy' in the thread and on the streaming turn.
Labels translatable and optional; existing apps unchanged.


Claude-Session: https://claude.ai/code/session_019MDtmumjtt5TjdvRDGHoa5

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-11 13:07:05 +01:00
CatoandClaude d8fe1df86f feat(app): send handle, per-turn failures and the slots ChatApp adopters asked for (#45)
The first four products to move onto ChatApp (heidi#226, orangecat#1447,
solon#309, substrata#262) each listed what it could not do and wrote a
workaround. This closes those gaps, additively:

- ChatApp ref (ChatAppHandle: send, fill, focus, newChat, openConversation),
  initialMessage (once, StrictMode-safe) and deepLinkParam (fills, never
  sends unless deepLinkAutoSend)
- Retry re-sends the failed turn's pictures
- ChatTurnError: the failure reason travels with its own turn
- stopKeepsPartial, per ChatApp and per turn
- starters with lang, historySlot/historyEmpty, attachExtras rows in the
  attach sheet, chips on the sent message (chipsFor), onTemporaryEnd with
  turn.chatId, renderFooter(m, { isLatest, index, send, fill }), thread.after
- the live Stop button is a 44px target


Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-27 12:33:31 +01:00
CatoandClaude Opus 5.5 652e04a149 feat(app): ChatApp — the whole chat app every product shares (#43)
* docs: the fleet's chats side by side

Every product renders chatkit's Composer, most render ChatScreen and
ChatThread, but the app around them — chat list, New chat, Temporary chat,
titles, rename/delete, restore on reload, the queue, attachment defaults —
is written again in each product. One table, read from each repo's main
on 2026-10-27, with the file each cell comes from.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* feat(app): ChatApp, the whole chat app every product shares

The pieces were shared; the app was not. ChatApp composes ChatScreen,
Composer and ChatThread and owns what each product re-implemented:

- the header (Chats · title · New chat · More with Temporary chat, Share,
  Rename, Delete) as frosted pills, with headerStart/headerEnd slots;
- the chat list: a <dialog> drawer on a phone (Escape, focus trap and
  restore from the browser; opens on its close button, not the search
  box), a rail when wide; search, Today/Yesterday/Earlier, one row
  anatomy (title, date, one "…" → Rename · Delete as equal cells);
- New chat; Temporary chat that writes nothing and ends on leaving;
- titles from the first message (Heidi's rule) or makeTitle();
- the open chat restored on reload (or driven by conversationId);
- turns per conversation that keep running in the background, Stop that
  keeps what arrived, Retry on a failure, a queue behind a running answer;
- attachments on by default, staged above the text, shown in the turn.

Storage is an adapter: ConversationStore (list/get/create/append/rename/
remove) with localConversationStore (versioned, never throws, quota drops
the oldest) and httpConversationStore (Heidi's REST shape,
serverWritesTurns for routes that store turns themselves). The product
supplies the transport and its words.

Additive: ChatScreen, Composer and ChatThread behave as before;
ChatMessageData gains optional attachments and Composer an optional
stagedPosition. Unit tests cover grouping, titles, search, dates, restore
and both stores (with storage that throws and a quota); test/browser-app.mjs
drives demo/app.html at 390px and 1440px.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-27 10:16:21 +01:00
Cato 4e11709348 fix(scroll): let readers scroll up in embedded and streaming chats (#38)
* fix(scroll): preserve reading in page and nested conversations

* fix(scroll): distinguish reading gestures from layout-driven scrolling

* fix(ci): reuse the actual browser revision through release verification
2026-10-27 04:21:16 +01:00
CatoandClaude 6d67e87982 feat(thread): the callout's word through ChatThread's labels (#41)
0.16.0 let Markdown take alertLabels, but products render answers
through ChatThread, which did not pass them on: a German product would
have shown 'Caution' over 'Versuchen Sie nicht…'. ThreadLabels gains an
optional alerts map, passed to both the settled and the streaming answer.
Optional, so no product's labels object stops compiling.


Claude-Session: https://claude.ai/code/session_01YK5nTo2tfxq8V8mKtuRGJH

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-26 22:50:00 +01:00
CatoandClaude e669991a4f fix(replies): a heading the model writes over the reply buttons is never drawn (0.15.1) (#29)
Models end answers with their own "**Quick follow-up options**" (or
"Suggested replies", "Mögliche Rückfragen:", ...) right above the
quick_replies block; drawn over chatkit's buttons it reads as an empty
section (live on substrata.orangecat.ch).

- extractReplies drops the last block before the replies when it is a
  heading or a bold/italic-only line of at most six words with no sentence
  punctuation but a closing colon, plus an adjacent --- rule. Shape and
  position, no word list, so every language. A bold sentence stays.
- Streaming ({ streaming: true }, passed by ChatThread) holds back a last
  line that could still become such a label, so it never flashes.
- dropReplyLabel is exported; ChatThread applies it to app-supplied replies.
- REPLIES_INSTRUCTION: no heading or label before the block.


Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-23 13:28:57 +02:00
CatoandClaude Fable 5.1 b37c3d65ce feat(rich): chart blocks in answers, drawn by an injected renderer (0.15) (#28)
"Who produces gallium?" now carries a ranked bar chart, not a list. chatkit
stays dependency-free: it defines the data contract (`ChartBlock`, mirroring
@bitbaum/chartkit's props for line, bars, share, timeline, tiles) and a
renderer slot (`renderers={{ chart }}` on ChatScreen, ChatThread, ChatMessage,
Markdown and RichAnswerBlock); the app injects the drawing.

- Parser: each kind validated field by field (bounded lists, finite numbers,
  safe links). A malformed block is rejected by the parser and degrades to
  its caption and a table of the safe rows; without a renderer, or when one
  returns null, chatkit draws that table itself. A chart is never a blank.
- Instruction: when to draw (ranked 3+ rows -> bars, shares -> share, 3+
  points over time -> line, 3+ dated events -> timeline, 2-4 figures ->
  tiles), figures only from tool results, hrefs copied from the result.
- Copy and Listen read the figures as lines, never the wire JSON.
- Tests: node tests per kind, the fallback and the renderer paths; the
  browser test renders a bars block through a stub renderer and a line block
  through the fallback in demo/screen.html at 320/390/1280, with the
  broken-word scan and no horizontal overflow.


Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-23 11:09:15 +02:00
CatoandClaude 2724c26158 feat(feedback): thumbs under every answer, and the chat-review contract (0.14.0) (#25)
The feedback loop between a chat and the people improving it, as a package:

- Under every answer a thumb up and a thumb down (`onFeedback` on ChatThread,
  or `messageId` + `onFeedback` on AnswerActions). A thumb down opens a sheet
  that asks why — one tap on a reason from FEEDBACK_REASONS, words optional,
  then Send — so the product learns what the person wanted, not only that
  it failed. Nothing is sent until they send it. Every label is translatable.
- The nightly judge's contract in core: CHAT_REVIEW_INSTRUCTION, the
  ChatTranscript a product exports (turns with the assistant's steps, plus
  the thumbs), reviewPrompt(scope, transcript), and parseChatReview reading
  the verdicts back strictly (score 1–5, gaps from REVIEW_GAPS — dead_end,
  wrong_tool, no_web, misread, vague, no_next_step… — and one concrete fix).
  Loki runs the judge and files each gap into its feedback inbox.
- Icon-only actions are a full 44px wide, not only tall.


Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-22 18:25:21 +02:00
CatoandClaude Fable 5.1 3fe57d0559 feat(answers): answers that read like the ChatGPT app's (0.13.0) (#24)
* feat(answers): answers that read like the ChatGPT app's (0.13.0)

Measured screen by screen against the ChatGPT app on a phone, and closed
in the package so every product gets it:

- Headings are signposts: a size up, with air above them, so a long answer
  can be scanned and found again.
- Options are cards: a numbered list whose items open with a bold name gets
  a tile badge, the name a size up, a hairline between cards, and a pill
  for a short tag written right after the name (`[Recommended]`). The
  instruction asks the model to mark the option it recommends that way.
- Sources are chips: a `[F2, F1]` handle is drawn after the sentence as
  "Fleet AGENTS.md +1", linked when the record has a link, and moved after
  the full stop when the model wrote it before.
- Links in the words that leave the site say so: dotted underline, arrow.
- A layered figure, `{"type":"stack"}`: full-width boxes top to bottom, a
  row of tiles where a layer has parts (icons from a closed list, never
  markup), the words that cross each arrow, an accent tone, a caption.
  `diagram` stays for an arbitrary graph.
- "Thought for 3m 38s ›" above an answer from `message.thinking`, closed by
  default; `live.steps` shows the same row open while a turn runs, with
  the newest step marked. `ThinkingRow` and `formatThinkingDuration` are
  exported; `thoughtFor`, `thought`, `thinking` join the thread labels.

Tests: tag and citation placement (core), stack validation and text form
(core), the whole answer rendered on the server (render), and the stack
fitting six tiles on a 390px phone with the thought line above (browser).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

* fix(markdown): no space before the full stop when a citation chip moves after it

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-22 11:19:18 +02:00
Cato 3f0ce27029 feat: visual answers with galleries, diagrams and guided choices (0.11.0) (#21) 2026-10-21 12:39:04 +02:00
CatoandClaude 04dd6f86b8 feat: under every answer — Copy, Listen, Share; sources as a sheet; replies that lead (0.10.0) (#20)
The pieces of the ChatGPT app the owner put beside ours (2026-10-21), done
once here so Loki, OrangeCat and every chat in the fleet get them:

- `AnswerActions`: the row under an answer. Copy; Listen, reading the answer
  as prose (`plainTextForSpeech`, from loki) with the browser's voice or the
  `speaker` an app passes (loki's studio voice), with a small player — Stop
  and the time so far — while it reads; Share through the system sheet
  where one exists. `ChatThread` renders it under every answer.
- Sources on a touch screen are ONE "Sources · n" button that opens a sheet
  with every record (label, detail, link); chips stay on a mouse. `Sheet`
  (the attach sheet's <dialog>, extracted) and `SourcesRow` are exported.
- `AttachMenu` takes `extra` rows under Camera · Photos · Files, and then
  opens the sheet on a mouse too — an app's "one of my things" has no file
  dialog to live in.
- The replies instruction makes the model lead: 2–4 replies on every answer,
  the recommended next step first, drawn as the lead (`ck-reply-lead`).
- An empty box is one row on the narrowest phone: the placeholder is cut at
  the edge, never wrapped into a clipped second line.

Browser checks cover the player, the sources sheet on a touch screen and
chips on a mouse, and the one-row placeholder at 320px.


Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-21 06:21:21 +02:00
CatoandClaude 163c879163 feat(thread): suggested replies — one tap sends the likely next message (0.6.0) (#13)
OrangeCat's Cat ends an answer with two to four tappable replies; it was the
most convenient control in any of the fleet's chats and existed nowhere else.
It now lives here so every product gets it from one place.

- REPLIES_INSTRUCTION: the prompt text that asks the model for a
  ```quick_replies block in the same turn (no second call, no latency)
- extractReplies(): parses it back out, deduplicated and capped, and hides
  an unfinished block while streaming so no one watches JSON appear
- ChatThread onReply: buttons under the latest answer only, never while a
  turn runs; the block is stripped from every answer even without onReply
- ChatReplies: the same buttons for apps that render their own thread


Claude-Session: https://claude.ai/code/session_01Mg5wrkfw95JWfmAz8yRT1j

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-09 05:26:52 -07:00
CatoandClaude Opus 5.5 ed759a8516 feat: chatkit v0.1 — one chat for every product (#1)
* feat: chatkit v0.1 — one chat for every product

The fleet had 13 chats in 10 repos, each written fresh, each missing what
another had fixed. This extracts loki /loki (composer, thread, messages,
markdown, attachments) and adds heidi's microphone and orangecat's keyboard fix:

- Composer: auto-growing 16px textarea, Enter/Shift+Enter/IME, Send and Stop
  in one slot, attachments with paste, mic always present, every label
  translatable, app-specific controls in slots.
- useDictation: browser recogniser first; missing or SILENT (4 s watchdog,
  bounded permission wait) -> record and transcribe on the server; a dead
  recogniser remembered 30 days; every failure shown in words.
- ChatThread/ChatMessage: stick-to-bottom + jump button, speaker names once two
  agents speak, Copy on answers, Retry on the last one, failed turns visible.
- Markdown with no HTML path; javascript: links stay text.
- styles.css: --ck-* variables defaulting to @bitbaum/design-tokens.
- verify = format, lint, types, build, 18 unit/render tests and 21 browser
  checks (390px + desktop, light + dark, a sentence through a fake mic past a
  silent recogniser). Browser checks mutation-tested (14px input, 60 s
  watchdog) — both fail as they should.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(styles): --ck-* defaults at zero specificity on :root, so an app's own values win

Declared on the chat's elements they overrode any app setting --ck-* at the
root — the opposite of what the README promised. Found preparing loki, whose
colour variables are full OKLCH colours under the design-token names and so
must map them. New browser check: a :root --ck-accent reaches the chat.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 23:14:53 -07:00