5 Commits
Author SHA1 Message Date
CatoandClaude e690b2254a Messenger: people talking to people, and to the agents among them (0.29.0) (#82)
* Messenger: people talking to people, and to the agents among them (0.26.0)

OrangeCat's direct messages were built in the app, so what was wrong with
them could not be fixed for the next product: an agent's answer in a
conversation between two people looked like the other person's, nothing
said an agent was taking part, top bar and a two-row box took half a
phone, and nothing could be attached. This is the messenger as a package.

@bitbaum/chatkit/messenger: Messenger (the whole screen) and its parts
useMessenger, ConversationList, MessageThread, MessageAttachments. The app
implements MessengerTransport; the package has no database, websocket or
storage. styles/messenger.css is the embedded sheet plus the Messenger's
section, without ChatApp.

- An agent is told from a person by the shape of its face, an Agent mark
  with whom it answered for, and an outlined bubble; the top bar says it
  is in the conversation; naming it shows that it is thinking, and says
  so if it never answers.
- Files: Camera, Photos, Videos, Files, checked against the attachment
  policy before an upload starts, photos shrunk in the browser, progress
  and Try again per file, a full-screen viewer, a film drawn as its still.
- The thread: runs, day lines, a New line, ticks from readState, a failed
  message kept with Try again, earlier messages loaded above with the
  reader's place kept, one bubble per message however often it arrives.
- Composer: layout="inline", attachmentsAlone, attach.take, attach.accept,
  a "videos" source, files dropped onto the box. Defaults unchanged.

The state is one pure function (messengerReducer), tested in Node.
test/browser-messenger.mjs drives demo/messenger.html at 390px, 320px
dark and 1280px. It found two defects before any product did: a read mark
that cleared the badge without telling the server, and a page of history
that pulled the reader to the end of the thread.

threadkit 0.1.2 (attachment policy, mention matcher, readState) is merged
and tagged but not on npm, so those rules are carried word for word in
src/thread-rules.ts with threadkit's own tests; the file says when it goes.

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

* test(messenger): wait for the opened conversation before reading its thread

Side by side, the conversation that was open can still be on screen with a
"New" line of its own, so the check read the old thread on a slow runner.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 16:26:03 +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 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 dce645fff5 feat: @bitbaum/chatkit/attach for any uploader, and the file-input check every app runs (0.4.0) (#9)
- `@bitbaum/chatkit/attach`: AttachMenu, ATTACH_SOURCE_INPUT, isTextFile,
  acceptFamilies and shrinkImage without the composer, so an app with no chat
  (avatars, product photos, receipts) uses the same picker instead of
  re-rolling a file input. AttachMenu takes `sources` (an image uploader offers
  Camera + Photos; one source skips the sheet) and a `trigger`.
- `chatkit-check-file-inputs` (bin): fails CI on a literal accept that mixes
  file families — the shape that hid screenshots on Android in loki, orangecat
  and evig. Same rule as the package (acceptFamilies), so there is one
  definition; a justified exception is marked on the line.
- shrinkImage moves out of the composer hook into src/image.ts (unchanged).
- README: install releases from npm, never a commit — heidi and substrata
  stayed on the broken paperclip because they pinned old versions.


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

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-07 04:43:16 -07:00
CatoandClaude Opus 5.5 f9f906ba11 feat(composer): Camera / Photos / Files sheet instead of one mixed file input (#7)
* feat(composer): Camera / Photos / Files sheet instead of one mixed file input

On Android the paperclip opened a chooser of capture apps (Camera, Camera,
Recorder, "Photos & Videos") with no way to the file browser: one input with
a mixed accept (image/*,text/*,audio/*) is answered that way. Attaching a
screenshot to Loki was effectively impossible from a phone.

- AttachMenu: on a touch screen the paperclip opens a bottom sheet with three
  sources, each its own input (ATTACH_SOURCE_INPUT is the SSOT): Camera
  captures, Photos opens the system photo picker, Files has no accept and
  opens the real document browser. With a mouse it opens the dialog directly.
- isTextFile: Files takes anything, so what can be read inline is decided
  after the pick. A PDF gets a sentence instead of being pasted as bytes.
- The sheet is portalled to <body> so a composer inside a transformed or
  clipped panel still gets a full-screen sheet. react-dom becomes a peer.
- Tests: unit (sources, text detection), SSR (one input per source), browser
  (sheet on a phone, 44px targets, Escape, Photos picker accept, PDF note,
  direct dialog with a mouse). CHROMIUM_PATH lets the browser suite run
  against a preinstalled Chromium.

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

* refactor(attach): the sheet is a native <dialog>, not a portal

showModal() renders in the top layer, so a composer inside a transformed or
clipped panel still gets a full-screen sheet without react-dom, and the
browser supplies Escape, the focus trap and focus restore. react-dom is no
longer a peer. A tap on the backdrop closes it (browser-tested).

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-05 04:53:02 -07:00