Repository navigation
L0 in-card chat (sys.chat) host side; AI-written text in the mail card - #263
Merged
Merged
Conversation
…d an in-card chat OctoScript#53 lets an L0 card show model-written text (marked AI-written) and chat with its app's agent (`sys.chat` + `ChatEntry`). The host side: - crates/l0-chat (octosense-l0-chat), shared by the glance cards and AppCard: answers sys.chat for the publishing app only; replaces any transcript the publisher put in `data`; a card's one write, `append`, is accepted only from what the person typed and recorded as a `user` entry; only the host appends `model` (the agent's reply) or `host` (a notice). Limits: 4 KB per message, one per 2 s per thread and none while answering, the last 200 entries, replies cut at 16 KB. Threads are files in the app's account folder (ADR 0004 §11: apps/<app>/accounts/<account>/chat/<thread>.json, 0600). - A Responder trait: the shell's AgentResponder runs a turn in the app's conversation on its host-owned peer (agents::conversation, octos.turn.start); no agent or not allowed is a host notice. Mail has no agent wiring yet, so OCTOSENSE_GLANCE_DEMO=mail keeps the canned demo answer. - glance.rs refuses a card whose sys.chat names another app and lowers with the host's transcript; L0Session dispatches with the payload's origin, performs chat writes, and the card window re-lowers when a reply arrives. - mail-request.card: summary, suggestion and draft are model-copy (Reply sets the draft into a text state); Ask is sys.chat + ChatEntry. The sys.dataset/sys.news_digest/sys.topics stand-ins are gone. - The hidden e2e follows the new layout and checks the chat write. Needs OctoScript#53 and Octoscript-Makepad#68 (pins not moved here). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A writable sys.chat is no longer a user-store collection: with_durable seeds AppCard's own transcript (octosense-l0-chat, publisher `appcard`) and tap_inner routes chat writes to it (host notice: its agent is not wired to answer in a card yet). - The module claims the storage the shell offers; chats go in apps/appcard/accounts/device/chat/. - l0_eval reads the kit's `ai` stamp and l0_widgets::to_dsl runs octoscript_node::ai::expand_ai_marks, so the mark is drawn on device. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…egenerate the catalog catalog.md regenerated with gen-catalog.py from OctoScript#53's TOML: ChatEntry and sys.chat, and the missing sys.digest, sys.dataset, sys.news_digest and sys.news_status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…0c (L0 AI text and chat merged) The two changes this pull request builds against are on their mains: OctoSense-org/OctoScript#53 (5991dfae, model-written text in text slots, strict actions, in-card chat) and OctoSense-org/OctoScript-Makepad#68 (8f103d0c, the l0_ai_text kit stamp and the AI-written mark; its runtime.json pins Octoscript 5991dfae and Makepad e29a0eaa, unchanged). native-runtime.lock.json (here and AppCard's) and the root manifest's Octoscript and Octoscript-Makepad revs move to them; the crates resolve from .sources through [patch], so Cargo.lock does not change. Checked: python3 tools/setup.py --update, then --check --cargo; python3 tools/native_apps.py --check; cargo check -p octosense; cargo test -p octosense-shell --features app-hub --lib (715 passed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
OctoScript#53 lets L0 cards show text the model wrote (marked AI-written) and adds an in-card chat with the app's agent:
source convo sys.chat(app, thread, fields)plusChatEntry. The checker admits the card, but the host decides who may chat, keeps the transcript, writes each role and runs the agent. This PR is that host side. It also moves the email action card MVP off its workarounds.Depends on OctoScript#53 and Octoscript-Makepad#68, and is stacked on #261 (feat/mail-card-mvp; retarget to main once it merges) (
l0_ai_textand the AI-written mark). At the current pins this branch does not build, becausel0_eval.rsreads the kit's newaiattribute. Pins are not moved here; see "Pin moves" below.What
crates/l0-chat(octosense-l0-chat) is the code both host paths use: the shell's glance cards and card window, and AppCard's L0 cards.appmust be the publishing app. A card naming another app is refused at publish (check_publisher).unavailabletranscript (seed) and writes nothing (perform).seedreplaces whatever the publisher put under asys.chatsource's name indata. A forgedmodelentry is never drawn.{id, role, text, at}. Ids are never reused.append, is accepted only when its payload is what the person typed (ValueOrigin::UserInput). It is recorded as auserentry.ChatStore::append_replywrites amodelentry (the agent's answer) or ahostentry (a notice). A payload shaped like{"role":"model",…}is just the text of auserentry.apps/<app>/accounts/<account>/chat/<thread>.json.device.L0Session::chat_moved).Respondertrait.AgentResponder: a turn in the app's conversation on the host-owned app peer (agents::conversation,octos.turn.startin the person's lane,TurnTrigger::AppSaysPerson).hostnotice saying why.octosservices, notools.json). UnderOCTOSENSE_GLANCE_DEMO=mailit answers with the existing canned demo reply (Canned).NoAgent, a host notice. Its agent is not wired to answer inside a card yet.Shell (glance).
glance.rschecks the publisher and seeds the host's transcript before lowering.glance_card::L0Sessionknows its publisher and dispatches withevent_payload_origin/dispatch_reporting_with_origin. It performssys.chatwrites throughglance_chat.rs.AppCard.
with_durableno longer treats a writablesys.chatas a user-store collection. It seeds the chat instead.tap_innerroutes chat writes.apps/appcard/accounts/device/chat/.l0_eval.rsreadsai, andl0_widgets::to_dslrunsoctoscript_node::ai::expand_ai_marks, so the mark is drawn on the device.Mail card.
mail-request.cardnow uses:model-copyfor the summary, the suggestion and the reply draft. Reply writes the draft into a text state withset(copy.draft).sys.chat+ChatEntryfor Ask.The
sys.datasetfields standing in for summary/draft, thesys.news_digesttranscript and thesys.topicsstand-in are gone. The hand-made "AI" eyebrows are dropped, because the kit's mark replaces them.Docs.
framework/catalog.mdis regenerated withgen-catalog.py. It addsChatEntryandsys.chat, plus the missingsys.digest,sys.dataset,sys.news_digestandsys.news_status.framework/l0.md§4: model-copy is shown and marked, never acted on; newsys.chatsection.docs/LEDGER-ARCHITECTURE.md§5.3: the new rule and the host's chat rules.CI:
apps.ymltests and lintsoctosense-l0-chat.Tests
All run against OctoScript#53 (
3ca709c) and Octoscript-Makepad#68 (51c4c51) checked out in.sources.octosense-l0-chat, 8 tests:modelreply, synchronous and later from another threadhostnotice--features mobile-apps):the_ai_written_mark_reaches_the_card_window: summary and suggestion are marked, the draft is marked until the person edits it, and in the chat only the agent's entry is marked.the_mail_card_asks_mails_agent_in_the_card: the field commit records theuserentry plus the cannedmodelreply, and a second message within 2 s is refused.a_published_transcript_is_not_the_hostsa_mail_toast_opens_its_own_card: also checks that another app cannot publish the card.an_app_without_an_agent_gets_a_host_noticeappcards_chat_is_the_hosts_and_its_own, plus the existing 200octos-apptests.desktop/scripts/mail_card_remote.shpasses in hidden windows, with a scratch home. Ask → ➤ storesapps/os.mail/accounts/device/chat/ana-contract.json.Pin moves (after OctoScript#53 and Octoscript-Makepad#68 merge)
Cargo.toml:octoscript-ui-l0,octoscript-core,octoscript-capabilities,octoscript-schemamovedbd48cf→ System-Apps 03350348: AppCard on the shells' runtime (6881fb6c) #53's merge commit.octoscript-makepadandoctoscript-nodemovee0df0b5→ the Octoscript-Makepad commit that has Tracking: ADR 0002 first slice — News (M1–M8) #68 and pins System-Apps 03350348: AppCard on the shells' runtime (6881fb6c) #53's merge inruntime.json(Tracking: ADR 0002 first slice — News (M1–M8) #68 still pins30a21b78). Update the comment above them too.native-runtime.lock.jsonandapps/appcard/native-runtime.lock.json:e0df0b5→ that same Octoscript-Makepad commit.e29a0eaa.phone/docs/makepad-fork.md,rom/docs/home-build.md.🤖 Generated with Claude Code