Skip to content

CAP-930: stream each conversation run's output to Keep, sealed and scrubbed - #531

Merged
cvince merged 5 commits into
feat/onboarding-v2from
cap-930-output-stream
Dec 2, 2026
Merged

cvince merged 5 commits into
feat/onboarding-v2from
cap-930-output-stream

Conversation

@cvince

@cvince cvince commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Linear: CAP-930 (spec 3m, "Terminal view streams the CLI's output" and "How it is built"). Builds on CAP-980 (#530), the shared scrubber.

What

  • Every capy setup run in a Keep conversation sends what it wrote to stdout and stderr to Keep as sealed c2p output records: { v, run, seq, stream, text }. The record kind is bound in the AAD, so it is domain-separated from turn.
  • Each run starts with its command line and ends with the exact line the agent got (the same refusalJson / result line setupCommand prints), so every outcome, code and next step is visible in Keep.
  • No plaintext: everything goes through the CAP-980 scrubber (known env and decrypted values, key and token shapes, the #k= pin) before sealing; a scrubber failure withholds the text. Whole lines only, so a value written in two pieces is still seen whole. At most 200,000 characters a run.
  • Output written before the page's hello waits, scrubbed, in the recovery file and goes out after it.
  • The end record now follows the run's last output, so Keep sees the result line before the conversation closes.
  • The service needs no change: it stores any kind as ciphertext.

Order

Keep must ship first (keep-app CAP-930): today's Keep refuses an unknown record kind.

Tests

  • tests/conversation/setupConversation.test.ts: order across runs, pending output before the hello, result line before the end, a planted fake secret never in any sealed record or in the service's store, withheld on scrubber failure, partial lines, the cap.
  • Conversation, setup command and scrub tests pass. setupCli.test.ts fails the same way on feat/onboarding-v2 (needs a build).

…sealed output records

Every capy run in a Keep conversation sends what it wrote, scrubbed by the
CAP-980 scrubber, as c2p output records, ending with the exact line the agent
got. Output before the page's hello waits in the recovery file. The end record
now follows the run's last output.
@cvince cvince self-assigned this Dec 1, 2026
- a conversation's output stops at 1,000 records or 400,000 characters, so turns and the end always fit the service's caps
- waiting output is scrubbed again and split after the scrub, never sent over one record
- each stream keeps its own unfinished line; a run's cut lands on a line end
- per-stream UTF-8 decoding and write encodings are honoured
- output from before the page's hello stays in memory, never in the recovery file
…-output-stream

# Conflicts:
#	src/commands/setupConversation.ts
@cvince
cvince merged commit 9b20592 into feat/onboarding-v2 Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant