0
Fork 0
mirror of https://github.com/zeronsh/comet.git synced 2026-11-16 18:57:19 +00:00
Commit graph

9 commits

Author SHA1 Message Date
Wing
960a21734b Merge zeron/cloud-attachments-r2
# Conflicts:
#	crates/client/src/live/mod.rs
#	crates/client/src/session/mod.rs
#	crates/client/tests/support/mock_edge.rs
#	crates/sync/src/store.rs
#	crates/ui/src/state.rs
2026-11-07 19:37:42 -07:00
Wing
ae03b84a23 Send attachments for Cloud chats through R2 first
Attachment bytes only travelled over a direct peer link to the chat's host.
A Cloud machine may be asleep, so a slow wake or a sender going offline lost
the message after 15 minutes with "attachments never arrived".

A send to a Cloud-hosted chat now waits in a durable outbox while its bytes go
up to /blob/{chatId}/attachments/{uploadId}. Only then does the message enter
the chat. The machine fetches the bytes when it wakes, re-drains as an
UploadCommit does, and deletes the object. The 15-minute cap now applies only
when the store has nothing either.

Chats on a user's own computers, hosts without attachment-store-v1, and edges
without the route keep the peer path. The desktop engine and the mobile core
share the outbox. A permanent failure shows in the chat with a retry. Objects
are deleted on delivery, with a 7-day lifecycle rule as the fallback; see
docs/design/cloud-attachments.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 12:57:03 -07:00
Wing
7d469567c9 ChatRoom: write only the row on push
A push wrote 5 billed rows: the row, its batch_id index entry, headSeq,
backupDirty and pushOutcomes. Measured against the real runtime it now
writes 1 in a new room and 2 in an existing one. An ack still means the
row is durable, and the head can no longer disagree with the rows because
it is derived from them.

- headSeq comes from MAX(seq), the floor and the stored copy. The copy and
  the per-device push counts flush with the alarm, at most every 5 minutes.
- backupDirty is written once per backup cycle.
- New rooms have no batch_id index; a push checks the last 4096 rows for its
  batch id. Existing rooms keep their index. Nothing is rebuilt or deleted.

Rolling back past this needs CHAT_ROOM_WRITE_THROUGH=1 and one flush first:
older code reads the stored head and would collide on a stale one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 11:39:03 -07:00
Wing
5e927a011c
Engine: ReadToolOutput serves a command's whole output from its host (#1190)
The chat keeps a command's last 10 lines; expanding it now asks the
device that ran it for the rest, read from that host's run journal.

- `ReadToolOutput {chatId, toolId, offset}` -> `ToolOutputChunk`
  `{text, nextOffset, done, bytes, lines, trimmed, exitCode?}`: the last
  1 MB, 48 KB per chunk, each ending on a character.
- The same safety as the doc's tail: `zeron_doc::command_output_end`
  (shared with `command_output_tail`) withholds secret-printing commands'
  output and redacts before it cuts.
- Commands (Exec) only; another tool's output is refused.
- `RunJournal::tool_exchange` finds a tool's call and result newest-first,
  parsing only the lines that name it; a subagent's doc reads its root
  chat's journal.
- Relay-forwardable, answered only by the chat's host; not on the agent
  token's allow-list (an agent reads a chat as its doc keeps it).
- A missing journal or record answers `tool_output.unavailable`, a call
  with no result `tool_output.not_finished` (capability error codes).
- The doc part gains `outputLines` (only with `outputTruncated`), so the
  app can say "Show all N lines" before fetching.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 18:12:43 -07:00
Daniel Katulevskiy
a2113ac886
A command's output keeps a short tail in the chat, with its exit code (#1168)
* A command's output keeps a short tail in the chat, with its exit code

Tool rows have been one-liners since the 2026-08-10 call: the doc fold
dropped every tool's output, and the Claude Code and Codex adapters never
sent any. A command's row could not say how it ended.

Now a command (Exec: Claude Code's Bash, Codex's command execution, an ACP
agent's shell call) keeps the end of its output in its tool part: its last
50 lines or 4 KB, whichever is less, with `outputBytes` (the size it came
at), `outputTruncated` when earlier output was let go, and `exitCode`.
Every other tool's output (file reads, searches, fetches, MCP results) is
still dropped, as before.

- Claude Code: a Bash result's text is its output; a leading `Exit code N`
  line (`Exit code 137 [killed]` too) becomes the exit code, and a result
  without one exited 0, unless the command went to the background. Calls
  are recognised by id from their tool_use (parent, subagent and typed-fork
  transcripts).
- Codex: a command's `aggregatedOutput` and `exitCode` ride its result.
- Both send only the output's last 32 KB, bounding the run journal.
- The tail is redacted before it is cut (tokens, keys, credentials in urls,
  terminal escapes), with the redactor the sign-in flows use, moved from
  zeron-harness to zeron-proto so the doc fold can call it; zeron-harness
  re-exports it.

The output is not streamed while a command runs: the doc is a Loro doc
that keeps its history, so rewriting a 4 KB tail a few times a second would
grow a chat by megabytes over one long build.

* Command output tails: hardened redaction, no output from secret printers

A command's output tail persists in the chat's doc, which syncs to the
person's other devices and the cloud, so its redaction goes further than
the sign-in redactor's (`redact_command_output`, beside `redact_output`):

- private key blocks (PEM and OpenSSH, BEGIN through END, or to the end
  when cut) are dropped for one `[private key redacted]` line;
- an env-style assignment (`AWS_SECRET_ACCESS_KEY=…`, `export X=…`) hides
  its value whatever the key;
- keys naming a password, private key or webhook (`DB_PASS`, `pwd`,
  `private_key`, `slack_webhook`) are secret labels too, while `passed`
  and `compass` stay readable.

Everywhere, a webhook url (Slack, Discord, Telegram bot, Teams, Zapier, …)
now keeps only its host.

A command that prints secrets by nature keeps none of its output, only
"(output not kept: may contain secrets)": env, printenv, export -p, set,
cat/head/tail of .env*, *credentials*, *.pem, *.key, id_*, .netrc,
base64 -d, gpg -d, security find-*-password, pass show, op read,
aws configure get, gcloud auth print-access-token, gh auth token, az
account get-access-token. Pipelines, `&&`/`;` chains, sudo and shell
wrappers (Codex's `zsh -lc '…'`) are looked through.

* Command output tails: 10 lines / 1 KB in the chat

The doc keeps a command's last 10 lines or 1 KB, whichever is less (was
50 lines / 4 KB), with its exit code, size and truncated flag as before.
Redaction before the cut, line-boundary cuts, the single-long-line case
and the secret-command withholding are unchanged. The parts.rs decision
comment and docs/chat2-sync.md (A1) now describe this exception to the
2026-08-10 strip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Wing <44917547+wingleeio@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 15:00:21 -07:00
Wing
cc7da5c2aa
Zeron Cloud, provider switching, and the phone model picker (#966)
Cloud chats on machines of their own (delegation, sleep/wake, durable delete), a credential vault, Stripe billing with Cloud's own portal, per-account Cloud availability, the edge's Cloud model list, provider switching between turns, the phone's tabbed model picker, and desktop/phone/engine polish.
2026-10-22 03:18:13 -07:00
wing-anara
b0be3dea2f rename: comet -> zeron everywhere (binary, crates, env, data dir, iOS)
- binary/CLI `comet` -> `zeron`; crates comet-* -> zeron-*; COMET_* -> ZERON_*
- data dir ~/.comet-native -> ~/.zeron, with a one-shot rename migration
- services: comet-native.service -> zeron.service; launchd sh.zeron.comet ->
  sh.zeron.app; macOS bundle id dev.comet.native -> sh.zeron.app
- release artifacts comet-<ver>-* -> zeron-<ver>-*; drop the Comet.app
  tarball-path compat hack in package-macos.sh
- iOS: Comet -> Zeron targets/dirs, bundle id sh.zeron.Zeron, zeron:// scheme
- clients default to https://edge.zeron.sh; installer + landing on zeron.sh
- kept on purpose: repo name, worker names (comet-native-edge/comet-landing;
  DO storage is bound to the script name), R2 bucket names, and legacy
  comet.zeron.sh routes so 0.1.x clients keep working

zeron-<ver>-* artifacts don't exist until the next release, so curl-install
and landing downloads 404 between this deploy and the 0.2.0 tag.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-14 10:49:19 +00:00
wing-anara
1fc8fd56c6 Tool chips are one-liners again: outputs stay out of the doc, sidecar parked
Product call (2026-08-10): tool OUTPUTS never enter the synced doc — chips
render name + call info only, like pre-output builds. No summaries, no R2
sidecar uploads, no refs stamped. Full outputs live solely in the host's
local run journal; diff stats and is_error still fold (edit +N/−N rows and
failure coloring keep working).

The whole sidecar pipeline (blob routes, sidecar_payload/apply_sidecar_refs,
upload_tool_sidecar with '#' encoding, UI lazy-upgrade path) stays built and
tested but dormant — reintroduction is re-adding one call site in
sessions.rs (see the PARKED note in docs/chat2-sync.md A2). M1's rebuild
still returns sidecar payloads; the C3 cutover decides their fate.

summarize_tool_output survives for the rebuild path, now fence-aware (ACP
harnesses wrap outputs in ```-fences; the old first-line summary was always
"```console…") and small-outputs-pass-whole.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-10 06:43:57 +00:00
wing-anara
5208fad115 docs: chat2 dumb-relay sync plan — thin docs, log-relay DO, whale-healing migration
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-09 14:55:51 -07:00