Skip to content

feat(chat): 在原生 Web 会话界面同步已读并显示上下文用量 / synchronize reads and show measured conversation context in the workbench - #18

Draft
Facetomyself wants to merge 10 commits into
feat/web-workbench-project-documentsfrom
feat/web-workbench-conversation-status
Draft

Facetomyself wants to merge 10 commits into
feat/web-workbench-project-documentsfrom
feat/web-workbench-conversation-status

Conversation

@Facetomyself

@Facetomyself Facetomyself commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #17. Refs sqfcyily#67. Adds two visible desktop behaviors to the headless Workbench: native unread dots and the original model context ring. It is not a billing dashboard, auto-compacting agent, remote mobile relay, or tool runtime.

  • One owner's independent logins share read-state.json. Only a visible, focused, selected ordinary chat whose latest durable message has actually been rendered can acknowledge a read. The server compares the observed native history and real scoped event cursor, rechecks the login, and advances only to its own captured timestamp. A mark for a stale/busy/restarted view does not clear later messages. A duplicate acknowledgement does not rewrite the file or broadcast a second invalidation.
  • Read metadata stays separate from prompts and model calls. A strictly bounded flat JSON map preserves unrelated numeric spelling, data, UID/GID and safe native modes. A real write gets independent native locking and a descriptor-only attribute check; corrupt or unsupported source storage is not silently replaced. The same owner's other open clients reread after the existing scope-only list invalidation; notifications carry no filenames, message text or private configuration.
  • The context ring presents an explicitly attributed provider measurement (actual normalized input, not total billable tokens), or a saved-history estimate using shared desktop rules. Receipts are tied to the particular conversation/model/turn and checked native contents. A model change or missing receipt does not borrow an old count. Missing/disabled models clear the ring. Reading the model limits or mark does not contact a provider, change its settings, or trigger compaction. Real fixture transports cover OpenAI Chat, Anthropic (including cache creation/read input) and OpenAI Responses, plus normalization fallback, two logins and restart.
  • Native renderer components and ordinary desktop behavior are reused. A separate guarded test drives two real browser profiles and verifies the original read dot and context card. Production package verification supports both a disposable hosted Linux/amd64 runner and an explicitly pinned, prebuilt image on an authorized independent runner. The real-source two-CLI-process fixture is not a packaged Docker execution.
  • Inventory: 49 implemented / 39 partial / 94 without recorded scope / 4 desktop-only; platform is separate. chat.markRead is newly implemented. chat.contextUsage remains partial (no automatic compaction threshold or learned server rejection limit), as does chat.onRemoteChange (the complete desktop/phone remote change protocol remains separate).

Verified at a98573f

  • Local Linux/arm64: 489/489 headless tests and 188/188 workbench tests passed (zero failed, cancelled or skipped). Type checks, desktop Electron main/preload/renderer, mobile production assets and the standalone Workbench Vite bundle built. These build results do not imply a native Electron user interaction or Docker verification.
  • Genuine adapter + owner-HTTP tests: ordinary, intentionally sent requests to a controlled, local SSE provider produced OpenAI Chat 1,234, Anthropic 1,550 (1,100 uncached + 150 cache-created + 300 cache-read), and OpenAI Responses 1,666 input tokens. Counts persisted in native session files. Checking the status did not call a model. Changed models, removed pins, newer turns without valid usage, prior process cursors, a busy view and late older marks were distinguished; an estimate was not presented as measured. Automatic compaction is not claimed. A persisted map from a desktop clock ahead of the server did not consume the next response.
  • Real browser scenario ran locally in two fresh kernel-verified sandboxed Chrome for Testing 158 profiles using ordinary private pipes. The actual shared ContextRing reported 25% (3,200/12,800) on the original composer. Another model and a subsequent no-usage reply produced a labeled estimate; deleting the model cleared the stale meter. Two genuine confirmations, zero unattended read writes, same-socket scope-only invalidation, no redundant writes on revisits; precisely two intentional synthetic model calls. Final synthetic PNG SHA-256: context 14d8b528496c38e24e06374b0975f7520b93d5f7b7b0e6b52fb7243b972da968; inactive-thread indicator 3bd66389707d6edc6e8941a770d77011bff10347681db683c6ec378d0c921088. This evidence is not hosted ChromeDriver/W3C.
  • The older real clipboard/quote fixture still passed with exactly three upstream sends and three corresponding displayed read receipts; unrelated/anonymous/unarmed writes continued to fail its guard. The original workspace-document race and ambiguous-ACK verification passed unchanged with zero model requests.
  • Local production CLI --fixture-only used two distinct server process starts on persistent private data/keys: measured 2,345 versus saved-history estimate 28, one deliberate provider request; old cookie 401, old cursor 409, durable read timestamp and original native usage survived restart. It did not contact Docker. Fork Actions reported no run for this SHA, and the explicitly requested dispatch returned HTTP 422: “Actions has been disabled for this repository.” No fork settings, existing host deployment or other account was changed. Native linux/amd64 container recreation and hosted W3C for this change remain unverified; the pinned-image acceptance command is available for a disposable runner. The optional browser's previously verified Docker sandbox rejection is unchanged.
  • Exact-commit review workbook: 21 groups, 186 distinct methods (18 subscriptions), separate implemented platform value; 49 complete / 39 partial / 94 without recorded scope / 4 desktop-only, 537 commit-pinned source/test references. Repeated offline generation with node scripts/workbench/export-parity-workbook.mjs --repo Facetomyself/deva --pr 18 confirmed identical XLSX bytes, SHA-256 be57bde28c76741699f11b22b24e146a7596e474df596f62e4859c2390b9e6b1.

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