Skip to content

Commit d170f8d

Browse files
chore: the change file and the skill for NOTE_OPEN, a guest's controls and gzipped island files
1 parent 51ba4eb commit d170f8d

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"architect-web" = "minor"
3+
"architect-desktop" = "patch"
4+
---
5+
6+
Added `NOTE_OPEN {path}` to what a frame's view may ask of the web app: the note opens only where the viewer may already open it (a share link's guest: a note the link lists), and reads nothing. A share link's guest is shown no control that needs a vault or a write (no Files, Open, New note, Vault, Search or navigator drawer); signed in, they are back (#910). The node sends an island's scripts, modules, sheets and wasm under `/_ext/` gzipped to a browser that takes it, and a note's view is handed its own files and those of the notes it lists, not every file of the link (#908, #602).

‎apps/web/src/ext_host.rs‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ pub const MAX_MESSAGE: usize = 64 * 1024;
8787
/// its source's state, so it reads nothing.
8888
pub use architect_playhead::FRAME_ASKS as INTENTS;
8989

90-
/// A view's ask to open a note beside the one it is drawn on: `{path}`,
91-
/// the note's vault path, as the note's own text names it (a setlist's
92-
/// row names its song's note). The app opens it only where the viewer may
90+
/// A view's ask to open a note beside the one it is drawn on.
91+
///
92+
/// `{path}` is the note's vault path, as the note's own text names it (a
93+
/// setlist's row names its song's note). The app opens it only where the viewer may
9394
/// already open it: for a share link's guest, a note the link lists
9495
/// ([`note_ask`] checks the path's shape; the app's opener checks the
9596
/// rest). It reads nothing and moves no file: it is the press the viewer
@@ -100,6 +101,8 @@ pub const NOTE_OPEN: &str = "NOTE_OPEN";
100101
/// a note (`architect_playhead::model::vault_path`: no scheme, no `..`,
101102
/// at most 1024 bytes) ending in `.md`; a `#heading` after it is left off.
102103
#[must_use]
104+
// A note's file is `.md`, lower case, as the vault writes it.
105+
#[allow(clippy::case_sensitive_file_extension_comparisons)]
103106
pub fn note_ask(args: &Value) -> Option<String> {
104107
let path = args.get("path")?.as_str()?;
105108
let path = path.split_once('#').map_or(path, |(p, _)| p);

‎skills/architect/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ Still not in architect: remote token introspection (I34). Until it lands, Task's
183183
- **Offline write:** call → `Mutation::run_queued` with a `CallTransport`; document → `use_synced_doc_keyed` with File/Turso/IndexedDB persistence; rows → `use_persisted_store_list` over `LocalRows`.
184184
- **Peer-synced document:** stable doc id (UUID v5 from the shared key), `DocRegistry` with `with_authorizer`, pairwise `crdt::peer::exchange` (`DocPeerHost`, `SelfLane`, `pull`). Serve it peer to peer with `architect_devices::serve` + `crdt::p2p::node_router` (devices admitted by the node's `architect_devices::Admission`: the account pass, enrolment, pairing; never hand-roll a device list, an enrolment table or a pairing code); share one document live with `Shares::share` → a `fts-doc:` `DocLink`, joined with `LinkKey` on a `DocSyncClient`. Version the doc with `crdt::schema` (`SchemaStamp`, `migrate`). Loro gotchas: subscription closures must not own a strong `CrdtDoc`; imports don't fire local-update subscriptions; create the text container once and sync before forking edits.
185185
- **The app is the node; run it headless / deploy it:** there is no separate server binary or node to install. The window starts the node in-process (`apps/desktop/src/app.rs` `start_node`, once per running app, not in the sandbox, not on iOS yet #820) through the same `apps/desktop/src/node/mod.rs` `start_parts` as `serve`, from the same `Config` over the window's defaults (`apps/desktop/src/node/config.rs` `app_defaults`: HTTP on `127.0.0.1:7420`, state in `<app dir>/node`, platform the machine's; on the account as the app's signed-in account, `AccountSource`, unless a session file is configured); a difference between the window and `serve` is a config default, never a second code path. `architect-desktop serve [--config <file>]` is the Architect app's node with no window (`apps/desktop/src/node/mod.rs` `start`). It joins the account as a device of `Config::platform` (`server` for `serve`) (`architect_devices::account::pass`, offering `ARCHITECT_ORG`), serves its documents over iroh (`architect_devices::serve` + `crdt::p2p::node_router`), holds the vaults in `ARCHITECT_VAULTS` as a sync peer (`vault_collab::VaultCollab`, named on the peer lane by `apps/desktop/src/node/catalog.rs` `VaultCatalog`, kept live with each peer by a `crdt::peer::bridge` per note, `apps/desktop/src/node/live.rs`, up to `ARCHITECT_LIVE_MAX`, and swept with `crdt::peer::pull_with(.., Foreign::AdoptFirst)` as the fallback; a note seeded on two nodes is settled by `crdt::peer::adopt_lineage`), builds `ARCHITECT_SITES`, hosts an issuer org's enrolments and vaults (`ARCHITECT_HOST_ORG`; several orgs from one process on one origin with `ARCHITECT_HOST_ORGS=a,b` or `*`, #538: a lane each, `apps/desktop/src/node/org.rs` `mount`, each serving only its own org's vaults, notes, index, live documents and shares, `VaultOrgs` (`of`, `holds`, `serves`, `of_name`), a vault its org's by id or `ARCHITECT_VAULT_ORGS`, `Config::hosted` / `Hosted` / `org_of_vault`, `NodeStatus::hosted`, enrolled devices held to their org by `crdt::p2p::NodeAccess::org_docs_of`; a link's code at the root, `/<code>`, goes to `/s/<code>/`: `DeviceEnrolment`, `Notes` and `DocSync` at `/org/{slug}/vox` for an issuer-session bearer, `OrgLane::with_vaults`/`opens`, so a signed-in web client edits a note live; enrolled devices sync as their role allows via `crdt::p2p::NodeAccess::org_docs`) or enrols itself at the node that does (`ARCHITECT_ENROL_AT`/`ARCHITECT_ENROL_ORG`, `apps/desktop/src/node/org.rs`), and serves `/health`, `/node/status` (HTTP face; `NodeStatus` `relays` and `iroh_addrs` say where its iroh endpoint is reachable: none and loopback alone with `ARCHITECT_IROH=local`) and `/vox` (the public `Node` service) and, with `ARCHITECT_MCP_TOKEN_FILE`, `/mcp` (`NODE_STATUS`, `NOTES_LIST`/`NOTES_READ`/`NOTES_WRITE`/`NOTES_CREATE`). Config is a TOML file then `ARCHITECT_*` env (`apps/desktop/src/node/config.rs` `Config`); secrets are files. Build it without the window with `--no-default-features --features vox` (feature `gui` is the window); the image is `nix build .#architect-image` (`flake.nix`), published on a tag as `ghcr.io/fasttrackstudios/architect:X.Y.Z` by `.github/workflows/release.yml` (which also publishes `architect-web`, the Linux AppImage `scripts/desktop/linux.sh`, the macOS dmg `scripts/desktop/macos.sh` (untested) and signed `SHA256SUMS`). Self-host with the chart `deploy/chart/architect` (two Deployments, `web` and `node`, one host; the node owns `/vox`, `/org`, `/mcp`, `/health`, `/s`, `/node`, `/blobs`, `/.well-known`: `values.yaml` `node.paths`, checked by `deploy/chart/architect/tests/routes.sh`; any new node route goes in that list), or the binary with `deploy/systemd/architect-node.service`. Its share links and Sites draw the fences extensions claim (#488): first those installed on it (`ARCHITECT_EXTENSIONS`, default `<data dir>/extensions/<id>/`; `features/sites/src/installed.rs` `InstalledBlocks`: an `[[embeds]] page` by `PageBlocks`, a WASI component's `[[embeds]] view` by `ComponentBlocks` with feature `node-wasi`, which the release's node has), then the distribution's compiled-in ones (`apps/desktop/src/node/mod.rs` `start_with` given `Distribution::blocks`: each linked extension's `[[embeds]] page`, its page shipped in `Extension::files`, plus the distribution's own `Distribution::block` renderers, or an embedder's `FnBlock`s); drawn per audience at build time, rebuilt live, made safe by `features/sites/src/sanitize.rs` `sanitize` (allow-lists on decoded values: SVG drawing elements and basic HTML, geometry, `class`, `aria-*`, `data-*`; URLs relative, `https:`, `mailto:`, raster `data:` images; no script, handler, form, SMIL or `<foreignObject>`; block images relative or `data:` only; CSS blunt: no quote, comment, escape, `var()`, custom property, at-rule, loader or `position` but static/relative; SVG sheets scoped under the site's per-block box class, `Block::scope`/`sanitize_block`/`BLOCK_BOX_STYLE`), and served with a Content-Security-Policy (`apps/desktop/src/node/shares.rs` `content_security_policy`, also on the node's Sites). Where files live is each node's holding rule (#904): `ARCHITECT_FILES_HOLD_PATHS`, `ARCHITECT_FILES_SKIP_PATHS`, `ARCHITECT_FILES_HOLD_MAX` (`Config::hold_rule` → `architect_files::HoldRule`), what goes to its bucket narrowed by `ARCHITECT_BLOB_S3_MAX` / `ARCHITECT_BLOB_S3_SKIP_PATHS` (`Config::bucket_rule`); a storage server is `serve` on the machine that holds the files, signed in with a code by `architect-desktop serve register` (`apps/desktop/src/node/register.rs` `sign_in`, `write_session`), platform `storage`; a vault's attachments sync between nodes with `ARCHITECT_VAULT_FILES=true` (`apps/desktop/src/node/files.rs` `hold_vault`, `not_an_attachment`). Test: `apps/desktop/tests/node.rs`. Docs: `docs/content/guide/deploy.md`.
186-
- **Build your own Architect (#491):** a binary crate, `main` = `architect_desktop::run(architect_desktop::distribution::architect().named("Studio").bundle_id(..).linked(&X))` (`apps/distribution/src/lib.rs` `Distribution`; `Distribution::new` for none of the first-party extensions); its `Cargo.toml` depends on `architect-desktop` with `default-features = false, features = ["vox"]`, forwards `gui = ["architect-desktop/gui"]` as its default, and copies architect's root `[patch]` tables. For iOS (#640), the same crate's `main` calls `architect_mobile::run(dist)` under `cfg(target_os = "ios")` (`apps/mobile/src/lib.rs` `run`; `architect-mobile` an iOS-only dependency, `architect-desktop` a not-iOS one, the `Distribution` from `architect_distribution`), and `cargo xtask dist ios|ios-sim --manifest-path <it>` builds the app on a Mac (`apps/mobile/ios/build-app.sh --manifest-path`); only linked extensions run there (no downloaded native code: App Store 2.5.2, 4.7), and each must build for `aarch64-apple-ios`. `cargo xtask dist desktop node web node-image web-image --manifest-path <its Cargo.toml>` builds it the release's way (`xtask/src/dist.rs`). The window links its list, the node draws its extensions' blocks, the web app reads `/app/distribution.json` and draws the node's islands (`/_ext/islands.json`) in sandboxed frames beside a song note, and the view an island claims for a note's `type` at its head (`SiteIsland::embed(view, note_types)`; `SiteIsland::embed_note(view, note_types, properties)` + `SiteIsland::reads(["documents"])` to be handed the note; the first island listed that claims a type draws it, only its bundle fetched; `apps/web/src/app/embed.rs`; what of the note a view gets is `apps/web/src/ext_host.rs` `note_props` by `Audience`: a member the note, a guest (#648, #669) title, type, declared properties and the body the link's node gave (`GuestNote::source`), never a vault path, both without `%%comments%%` (`features/spaces/src/view.rs` `without_comments`); with `SiteIsland::reads(["documents", "files"])` also `files` (`ViewFile`: images as `data:` URLs, `.lrc` as text; 2 MiB a file, 8 MiB and 32 a note, `architect_spaces::view` `within_caps`), a member's from their vault (`apps/web/src/view_files.rs` `member_files`), a guest's only the node's, fetched and digest-checked (`apps/web/src/app/guest.rs`, at `/s/<code>/` since #646); asks `PLAYHEAD_SET`/`PLAYHEAD_ITEM` too, none before ready or while hidden) (`apps/web/src/app/frames.rs` `ExtensionFrame`, decisions in `apps/web/src/ext_host.rs`; `apps/web/test/app-ext-host.test.mjs`); linked extensions don't run in a browser yet (#495). Guide: `docs/content/guide/your-own-architect.md`.
186+
- **Build your own Architect (#491):** a binary crate, `main` = `architect_desktop::run(architect_desktop::distribution::architect().named("Studio").bundle_id(..).linked(&X))` (`apps/distribution/src/lib.rs` `Distribution`; `Distribution::new` for none of the first-party extensions); its `Cargo.toml` depends on `architect-desktop` with `default-features = false, features = ["vox"]`, forwards `gui = ["architect-desktop/gui"]` as its default, and copies architect's root `[patch]` tables. For iOS (#640), the same crate's `main` calls `architect_mobile::run(dist)` under `cfg(target_os = "ios")` (`apps/mobile/src/lib.rs` `run`; `architect-mobile` an iOS-only dependency, `architect-desktop` a not-iOS one, the `Distribution` from `architect_distribution`), and `cargo xtask dist ios|ios-sim --manifest-path <it>` builds the app on a Mac (`apps/mobile/ios/build-app.sh --manifest-path`); only linked extensions run there (no downloaded native code: App Store 2.5.2, 4.7), and each must build for `aarch64-apple-ios`. `cargo xtask dist desktop node web node-image web-image --manifest-path <its Cargo.toml>` builds it the release's way (`xtask/src/dist.rs`). The window links its list, the node draws its extensions' blocks, the web app reads `/app/distribution.json` and draws the node's islands (`/_ext/islands.json`) in sandboxed frames beside a song note, and the view an island claims for a note's `type` at its head (`SiteIsland::embed(view, note_types)`; `SiteIsland::embed_note(view, note_types, properties)` + `SiteIsland::reads(["documents"])` to be handed the note; the first island listed that claims a type draws it, only its bundle fetched; `apps/web/src/app/embed.rs`; what of the note a view gets is `apps/web/src/ext_host.rs` `note_props` by `Audience`: a member the note, a guest (#648, #669) title, type, declared properties and the body the link's node gave (`GuestNote::source`), never a vault path, both without `%%comments%%` (`features/spaces/src/view.rs` `without_comments`); with `SiteIsland::reads(["documents", "files"])` also `files` (`ViewFile`: images as `data:` URLs, `.lrc` as text; 2 MiB a file, 8 MiB and 32 a note, `architect_spaces::view` `within_caps`), a member's from their vault (`apps/web/src/view_files.rs` `member_files`), a guest's only the node's, fetched and digest-checked (`apps/web/src/app/guest.rs`, at `/s/<code>/` since #646); asks `PLAYHEAD_SET`/`PLAYHEAD_ITEM` too, and `NOTE_OPEN {path}` (`apps/web/src/ext_host.rs` `NOTE_OPEN`, `note_ask`: the note beside its own, opened only where the viewer may open it; a guest: a note the link lists), none before ready or while hidden) (`apps/web/src/app/frames.rs` `ExtensionFrame`, decisions in `apps/web/src/ext_host.rs`; `apps/web/test/app-ext-host.test.mjs`); linked extensions don't run in a browser yet (#495). Guide: `docs/content/guide/your-own-architect.md`.
187187
- **Make an extension part of the standard release (a core extension, #631):** it stays in its own repo; add a `[[core]]` entry to `extensions/core-extensions.toml` (id, publisher, source, version, tag, rev, `[core.signature]`, and `[core.linked]` crate/features/platforms/extension/blocks/patch and/or `[core.packaged]` archive/sha256/folder/island, one form per platform), then `cargo xtask core verify` and `cargo xtask core sync` and commit the list with `dist/standard` (`docs/content/guide/core-extensions.md`). Only on the owner's request; never copy the extension's code into architect. A linked extension may not pull Task crates (they pin architect v0.10.0): `cargo xtask core check` fails on one.
188188
- **The web front end:** one static site, its own image (`nix build .#architect-web-image`): the site at `/` (`apps/site`, prerendered: the landing page, `/download`, `/changelog`, `/extensions`, its release data fetched strictly for the tag in a release build), the docs at `/docs/` and the web app at `/app/` (`apps/web/src/lib.rs`: OIDC redirect + PKCE as client `architect` through `auth_client::oidc`, settings from `/app/config.json` `Config`, the sign-in back at `/auth/callback`; `/app/?demo` (`DEMO`, `Route::Demo`) mounts the app itself on dioxus-web (`apps/web/src/app/mod.rs`: `AppShell`, the workspace and the navigator over a `MemorySource` (`apps/web/src/app/vault.rs`), ⌘K/⌘O, settings) on the demo vault built in (`apps/web/src/demo.rs`), in the tab's memory (the demo vault is the extension showcase's too, its `Showcase` note; `/app/?showcase`, `SHOWCASE`, opens the same); signed in, on the account's org vaults over the node's `/org/{slug}/vox` (`apps/web/src/app/org.rs` `OrgVaults`: `vault_proto::notes` `NotesClient` lists and reads, `LiveNote` keeps an open note live on `DocSync`, typed in only once attached, the text area uncontrolled with the caret kept, typing merged by Loro at the version the text area showed (`apps/web/src/live_text.rs` `LiveText`, `merge_at`); new notes by `Notes::create`, never over another; the issuer's access token as the `vox.bearer.` subprotocol, the lane re-dialled on each renewal (`OrgVaults::redial`), Sign out revoking the grant at `/oauth2/revoke`; renames, moves and deletes read-only (`apps/web/src/read_only.rs` `NodeLayout`); the node re-checks a live note's bearer every `ARCHITECT_LANE_RECHECK_SECS` and refuses a foreign `Origin` (`ARCHITECT_LANE_ORIGINS`); a proxy must keep `Sec-WebSocket-Protocol` out of its access log; `just web-org-test`); the page's CSP has no `unsafe-eval`, so `apps/web/src/app/page.rs` `SafeDocument` answers `document::eval` without eval (and feeds the shell's keyboard natively, `use_keyboard_feed`), and a note is edited as markdown in a text area (the editor's web view evaluates JS); the wasm is built with Cargo's `web` profile), built by `scripts/web-bundle.sh` and served by the VPS as the release asset `architect-web-<X.Y.Z>.tar.gz` (the one deployment), or by static-web-server with `apps/web/sws.toml`; the serving contract is `scripts/web-routes.md` (path, `<path>.html`, `<path>/index.html`, else `404.html` with a 404; no SPA fallback: an unrouted node path is a 404, never the app), checked by `scripts/check-web-bundle.sh`. `just web`, `just web-test` (`apps/web/test/web.test.mjs`, headless Firefox). Which distribution a bundle is: `/app/distribution.json` (`apps/web/src/lib.rs` `Distribution`, written by `scripts/web-bundle.sh` from `ARCHITECT_DISTRIBUTION`), its name and its compiled-in extensions shown. The sandbox's browser demo is `apps/sandbox/web` (`just sandbox-web`). Docs: `docs/content/guide/web.md`.
189189
- **Self-update a binary:** `architect::release::Updater::new(app, repo, platform_asset(app)).run(Target { current, exe, key }, &opts)`; an app image placed elsewhere (a launcher's folder) uses `Updater::find` + `fetch_verified` + `persist_executable`, as `features/updates/src/engine.rs` `Engine` does for the Architect app; sign `SHA256SUMS` with the org release key in the release workflow (`docs/content/architecture/release.md`).

0 commit comments

Comments
 (0)