* feat(sessions): a token reads its sessions and what was said in them
An agent that starts Claude Code in a Loki session (tab-inject) could read
the screen (#1641) but not the conversation: the parsed transcript was only
readable over the cookie-only transcript stream, and since #1644 over
OrangeCat's signed rail.
- lib/session-reads: the list, one run, or one project with the last things
said in its conversation, moved out of the signed route unchanged, so two
doors share one copy
- GET /api/control/sessions: the same reads with a session or ck_ token
(?project=, ?runId=, ?items=), no-store
- every row names its session and carries openUrl, the same session in
Loki's Terminal on that run (lib/dispatch-card sessionOpenUrl)
- the list says it is cut at 25 and carries total, so a cut list is never
read as the whole one
- LOOP-WALK's Session walk names the read; tests pin both doors to the one lib
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtCjm3CvrFm3kYaTgy
* fix(sessions): the conversation read is current, on the session's builder, and never ends a person's view
Traced end to end before merge (2026-11-12):
- a cached conversation was served forever: after the first read sent
peek_stop the runner stopped streaming, so a later read returned the same
copy without the agent's answer. The cache now counts only while someone
is watching; otherwise the read waits for a frame posted after it asked.
- peek_start and peek_stop carried no channel, so the owner's laptop runner
could take a read meant for the cloud session (transcript null). They now
name the project's builder (projectPreferredChannel).
- the read counted its viewer under a key of its own, so its peek_stop could
end a person's live view of the same session on a phone. It now shares the
Terminal's viewer count (same user, tab and channel).
- a cloud link carried no source, so a phone that last chose 'Your computer'
opened the laptop's session of the same name. sessionOpenUrl names the
cloud builder, and each row's link uses the session's builder.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtCjm3CvrFm3kYaTgy
---------
Co-authored-by: Claude <noreply@anthropic.com>
* feat(sessions): starting a session answers with where a person opens it
An agent that starts Claude Code in a Loki session hands the owner the
session to look at, on a phone or a computer. The Terminal's address was
built only inside the app's own cards, so a caller had to guess it.
- lib/dispatch-card sessionOpenUrl: the full link to the session in Loki's
Terminal, on that run when there is one, This computer for a local one
- tab-inject (live, dispatch, queued), /api/inject and MCP loki_dispatch
(through inject-core, a parallel lane included) and agent/launch return
openUrl
- LOOP-WALK's Session walk says so; scripts/test/session-open-url pins it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtCjm3CvrFm3kYaTgy
* fix(sessions): a session's link names its builder
A cloud openUrl carried no source, so the Terminal opened whatever source
that browser last chose: a phone that last picked 'Your computer' opened the
laptop's session of the same name instead of the cloud one the agent drove
(traced 2026-11-12). sessionOpenUrl now says source=cloud for the cloud
builder, and the screen capture's openUrl (POST /api/control/peek-tab) is
the same full link instead of a bare path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtCjm3CvrFm3kYaTgy
---------
Co-authored-by: Claude <noreply@anthropic.com>
An agent could start a project's coding agent in a Loki session, type into
it and close it with a ck_ token (tab-inject, tab-inject-raw, close-tab),
and could even ask for a capture of its screen (POST peek-tab), but the
list of open sessions and the capture's answer took a browser session only.
It could not see that the session was up or read what the agent answered.
- GET /api/control/open-tabs takes a session or a token
- GET /api/control/peek-tab/[id] takes a session or a token, no-store
- POST /api/control/peek-tab takes an optional channel and returns
resultUrl and openUrl (the same session in Loki's Terminal)
- a plain shell's screen stays a signed-in browser's: a token gets 403 on
asking and 404 on reading (lib/peek-access)
- LOOP-WALK gains the Session walk; scripts/test/agent-session-read pins it
Claude-Session: https://claude.ai/code/session_019MDtmtCjm3CvrFm3kYaTgy
Co-authored-by: Claude <noreply@anthropic.com>