Commit graph

2286 commits

Author SHA1 Message Date
Kayshen-X cd465f9899 fix(web): keep credential sync reset ahead of repaint wiring in mount
Task 7 reordered mount_ck so the daemon-dependent
web_credential_sync::start() runs only after the postMessage bridge
init gate. But start() bundled two things: a pure state reset
(*self = default) and a daemon policy fetch. Moving the whole call past
the gate also moved the reset past repaint_coalescer::install, so an
early repaint (e.g. during the 2s await_init in an iframe) could queue a
credential change via credential_changed() that the later reset silently
wiped — the pre-existing invariant guarded by
canvaskit_repaint_persists_local_settings_and_syncs_only_credential_changes.

Split the two phases: add web_credential_sync::reset() (pure state
clear, no daemon request) called BEFORE the first repaint and the rAF
coalescer install, and keep start() (now begin_policy_check only, the
daemon fetch) after the bridge gate. Both invariants hold: the reset
precedes repaint wiring, and no daemon request fires before the gate.
The daemon behavior is unchanged in the normal flow (reset() then
begin_policy_check equals the old start()), and strictly better in the
race edge — a change queued between reset and start is now preserved
instead of wiped.

Test updated to assert the reset (not the now-daemon-facing start)
precedes install; the semantic invariant it protects is unchanged and
is now expressed against the actual code order. start()'s ordering after
the gate stays covered by
canvaskit_mount_queues_an_initial_snapshot_only_when_local_credentials_exist.
2026-07-17 02:00:02 +08:00
Kayshen-X b6077ab09b fix(web): bind web save baseline to the serialized generation and revision 2026-07-17 01:22:07 +08:00
Kayshen-X 6de61689df fix(web): attach bridge token to the mcp server settings fetch
The Task 7 token audit missed a daemon-bound network call:
`agent_settings_mcp_server.rs::request_mcp_server_update` POSTs
`/api/mcp/server` via `window.fetch` (Reflect::get) and attached no
`X-OpenPencil-Token`. In managed mode (VS Code webview) the daemon's
auth gate rejects the request (fails closed), silently breaking the
MCP server start/stop toggle in the settings modal.

Fix: build the request URL from `daemon_base()` (absolute, matching
every other daemon call site in the crate) instead of a bare relative
path, and attach the token via a new shared `live_sync::daemon_token_for`
helper — factored out of `attach_daemon_headers` so XHR and non-XHR
call sites can't drift on the leak-guard policy (token only when set
AND the URL targets the daemon).

Corrected audit (grep -rn "XmlHttpRequest|fetch|Request::new"
crates/op-host-web/src, network-issuing sites only): 5 sites total —
the 4 live_sync XHR helpers + web_model_catalog + web_ai_transport +
iconify_web's fetch_text all already tokened via attach_daemon_headers
(iconify_web additionally verified to withhold the token from the
public Iconify CDN target); agent_settings_mcp_server's window.fetch
was the sole untokened site and is now fixed. No other window.fetch /
Request::new call sites exist in the crate.

Verification: cargo check --target wasm32-unknown-unknown -p
op-host-web --no-default-features --features canvaskit (pass, 1
pre-existing unrelated warning) / --features web (pass, clean);
cargo clippy -p op-host-web --all-targets -- -D warnings (pass, clean).
2026-07-17 01:17:08 +08:00
Kayshen-X 37c41db35a feat(web): postMessage bridge with token bootstrap and conflict resolution
Add the webview-facing postMessage bridge (vscode_bridge.rs): token
bootstrap via Init, OpenDocument probe-conditional push, uncapped
Snapshot flush, SaveCommitted, and UseLocal/AcceptRemote conflict
resolution. All three edge/state events (dirty-changed, sync-conflict,
opened) are emitted only from the tick observer draining SyncGate's
consumable latches; handlers only mutate the gate. Reorder mount_ck so
the bridge listener installs first, an iframe awaits Init (2s fallback),
and the 400ms pull tick starts only after the daemon sync-reset (managed:
token; direct: legacy reset moved out of index.html) completes.

Token audit (X-OpenPencil-Token attached only when url starts with
daemon_base(); public requests never carry it):
  live_sync.rs get                 -> daemon -> attach_daemon_headers
  live_sync.rs get_with_status     -> daemon -> attach_daemon_headers
  live_sync.rs post_json           -> daemon -> attach_daemon_headers
  live_sync.rs post_json_with_status -> daemon -> attach_daemon_headers
  web_model_catalog.rs:21 (/api/ai/models)   -> daemon -> attach_daemon_headers
  web_ai_transport.rs:93 (/api/ai/stream)    -> daemon -> attach_daemon_headers
  iconify_web.rs:311 fetch_text (daemon brand-catalog + public Iconify CDN)
      -> attach_daemon_headers with url-prefix guard: token only on the
         daemon URL, never on the public api.iconify.design requests
All other daemon-talking modules route through the live_sync helpers and
inherit the token. No window.fetch / Request::new sites in the crate.
2026-07-17 01:06:14 +08:00
Kayshen-X 8dfd5bfbe7 feat(web): route live sync through the shared gate with conditional pushes 2026-07-17 00:25:20 +08:00
Kayshen-X f0111bfc4f feat(web): idempotent sync-reset and base-version conditional document writes 2026-07-17 00:07:03 +08:00
Kayshen-X 51770c07d7 feat(web): serve-one layer token auth and origin allowlist for managed daemon 2026-07-16 23:54:38 +08:00
Kayshen-X 0574ec36a9 feat(web): managed serve-web contract with handshake and parent-death lease 2026-07-16 23:28:08 +08:00
Kayshen-X c277cfd012 feat(editor): sync gate state machine and bridge protocol codec 2026-07-16 23:13:34 +08:00
Kayshen-X e01542c18c feat(editor): scope saved-revision acks to a document generation 2026-07-16 22:58:23 +08:00
Kayshen-X 0daddb3bf4 test: isolate tag environment in version guard fixtures 2026-07-16 22:09:56 +08:00
Fini f5ffbb7d14 fix(canvas): align generating label icon with text 2026-07-16 21:19:58 +08:00
Kayshen-X 70e2301aae fix(web): sharpen rendering and isolate local zode config 2026-07-16 21:15:10 +08:00
Kayshen-X f8abab21c1 docs: add linux do community link 2026-07-16 21:03:29 +08:00
Kayshen-X ada7e1c597 docs(release): expand v0.8.1 notes 2026-07-16 00:55:12 +08:00
Kayshen-X f8540d81d8 test(editor): isolate canvas indicator state 2026-07-16 00:15:18 +08:00
Kayshen-X d5131c99e7 fix(orchestrator): center resolved radial content 2026-07-15 23:49:58 +08:00
Kayshen-X 77a984948e fix(desktop): order chat tool events deterministically 2026-07-15 23:49:32 +08:00
Kayshen-X 52260c3155 fix(ci): retry ARM apt prerequisites 2026-07-15 23:22:22 +08:00
Kayshen-X d978a63d63 test(services): make settings temp paths portable 2026-07-15 23:13:08 +08:00
Kayshen-X c355719fd5 fix(ci): clear Rust workflow blockers 2026-07-15 22:47:39 +08:00
Kayshen-X ab1218eab0 fix(web): restore CanvasKit test coverage 2026-07-15 22:47:28 +08:00
Kayshen-X a37d9a8d3d fix(orchestrator): stabilize radial repair checks 2026-07-15 22:47:18 +08:00
Kayshen-X 0635927c42 fix(ci): install ripgrep for version guard 2026-07-15 22:47:01 +08:00
Kayshen-X 6721a02837 chore: update Jian submodule 2026-07-15 21:17:21 +08:00
Kayshen-X f82f4e4ea3 fix: enforce centralized version inputs 2026-07-15 21:17:21 +08:00
Kayshen-X e28506d0af fix: cover all version guard inputs 2026-07-15 21:17:21 +08:00
Kayshen-X 4f572730b9 fix: complete version synchronization guidance 2026-07-15 21:17:21 +08:00
Kayshen-X e5b7425f3a build: add version synchronization gate 2026-07-15 21:17:21 +08:00
Kayshen-X 68579c4c86 fix(release): detect punctuated version examples 2026-07-15 21:17:21 +08:00
Kayshen-X 84993cadc9 fix(release): gate publishing on Cargo version 2026-07-15 21:17:21 +08:00
Kayshen-X 567453bfc5 fix: reject commented version derivation checks 2026-07-15 21:17:21 +08:00
Kayshen-X d3fc4fed6d build: derive package versions from Cargo 2026-07-15 21:17:21 +08:00
Kayshen-X 983b2a3573 refactor(sdk): use TypeScript AST for version sync 2026-07-15 21:17:21 +08:00
Kayshen-X 4988343a4b fix(sdk): ignore escaped comment markers 2026-07-15 21:17:21 +08:00
Kayshen-X 78d9f5406e docs: update localized version sync commands 2026-07-15 21:17:21 +08:00
Kayshen-X 427e2b8263 fix(sdk): harden version synchronization 2026-07-15 21:17:21 +08:00
Kayshen-X bb905db75c fix(sdk): parse JSONC comments in version sync 2026-07-15 21:17:21 +08:00
Kayshen-X 1f789095a9 build(sdk): sync package versions from Cargo 2026-07-15 21:17:21 +08:00
Kayshen-X 7c8e2abfa7 test(cli): enforce complete bundle templating 2026-07-15 21:17:21 +08:00
Kayshen-X 83063bc279 refactor(cli): render bundled skill version from Cargo 2026-07-15 21:17:21 +08:00
Kayshen-X ec3dbf964d test: handle fixture version collision 2026-07-15 21:17:21 +08:00
Kayshen-X 5b0d1edb4c test: decouple document fixtures from product releases 2026-07-15 21:17:20 +08:00
Kayshen-X e0a2bd4e69 refactor: derive Rust product versions from Cargo 2026-07-15 21:17:20 +08:00
Kayshen-X b542a7e5d1 test(panels): align legacy gutter assertions 2026-07-15 21:17:20 +08:00
Kayshen-X 9bd9adf505 test(panels): strengthen layer gutter regressions 2026-07-15 21:17:20 +08:00
Kayshen-X 8e2cca4f6b fix(panels): align labels with layer action gutter 2026-07-15 21:17:20 +08:00
Kayshen-X d41da4fc64 fix: harden workspace version reader inputs 2026-07-15 21:17:20 +08:00
Fini 050fac23cd fix(agent): separate CLI generation and canvas modes 2026-07-15 21:10:11 +08:00
Fini fff96c8ad5 feat(agent): unify generation UX and CLI providers 2026-07-15 03:48:29 +08:00