Add portable ISA extension development and native UI skills

This commit is contained in:
Peter Willemsen
2026-10-21 12:30:00 +00:00
commit b8fda81e00
30 changed files with 4320 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
---
name: isa-extension-development
description: Build, debug, package, and update standalone ISA Warden iframe extensions, their manifests, bridge calls, project persistence, and dashboard workers.
---
# ISA extension development
Work in the extension repository. Read its AGENTS.md and package scripts first. The host checkout is optional for extension builds; do not change or publish the host to deliver an extension update.
Read [the specification index](references/README.md) and only the chapters relevant to the requested work. These references are a versioned snapshot: use `isa-ext update-skill` to refresh them intentionally. Treat undocumented host capabilities as unavailable; check `get_app_info` before relying on optional capabilities. Never import private host application modules or call Tauri directly from iframe code.
Preserve manifest IDs and persisted/wire formats unless the task requires a migration. Request only needed permissions. Keep canonical workspace inventory separate from explicit group availability; do not silently fall back to workspace-wide resources in group context. For project persistence read [project sync](references/20-dashboard-backed-project-sync.md) and [workspace files](references/dashboard-workspace-files.md). Never interpret unavailable inventory as confirmed deletion.
Use the extension's vendored shared UI contracts and host theme tokens; do not introduce Tailwind, copy host internals, or hardcode a competing theme. Keep copy minimal, English/Dutch strings synchronized where supported, and errors readable. Read [styling](references/14-strict-styling-requirements.md) for notification and state behavior.
Run the repository's full build/package command, then relevant existing tests. A successful bundle alone does not prove host bridge behavior. Add regression coverage for parsing, persistence, isolation, cancellation, or other concrete risks; skip tests that merely assert copy, CSS, or fixed catalog values. Verify the generated `.isax` manifest and payload, and report which host interactions were actually exercised. Do not commit build output, node_modules, targets, credentials, or user project data.
For native host interaction use the installed `isa-extension-ui-control` skill. Plain Vite preview can verify layout but cannot prove native host capabilities. Extension builds and unit tests must remain usable without locating or launching the native app.
@@ -0,0 +1,11 @@
# Core principles
ISA Warden extensions must follow these principles:
1. Prefer host capabilities over reimplementing host behavior.
2. Respect current-user and workspace rights.
3. Reuse the ISA Warden design system before adding custom styling.
4. Default to the host stack where practical.
5. Keep permissions minimal and explicit.
6. Treat custom local databases as an exception, not a default.
7. Document implemented versus planned capabilities clearly.
@@ -0,0 +1,32 @@
# Preferred extension architecture
ISA Warden itself is primarily built with:
- Svelte and Vite in [`chat-ui-3/package.json`](../../package.json)
- Rust and Tauri in [`chat-ui-3/src-tauri/Cargo.toml`](../../src-tauri/Cargo.toml)
The preferred extension architecture is therefore:
- **UI:** Svelte-based web UI
- **Native/backend logic:** Rust native binary when native logic is needed
- **Host integration:** browser bridge via [`window.isaExtensionBridge`](../../src/lib/extension-bridge.js:163)
### 2.1 Default implementation guidance
Use the following default decision order:
1. Use a browser-only extension if the host already provides the needed capabilities.
2. Add Rust native logic only when the extension needs long-running work, local services, parsing, local binaries, or OS-facing behavior.
3. Use host APIs before building a parallel service layer.
### 2.2 Allowed alternatives
Alternative stacks are allowed, but they are not preferred.
If an extension diverges from the preferred stack, it must still:
- package correctly
- integrate with the host bridge
- comply with rights and permission rules
- comply with styling rules in this specification
- clearly document build and runtime tradeoffs
@@ -0,0 +1,173 @@
# Extension package layout
The current extension package shape is:
```text
my-extension/
├── extension.json
├── package.json
├── index.html
├── mod.js # mod extensions only
└── native/
├── linux-x86_64/my-native-bin
├── linux-aarch64/my-native-bin
├── macos-aarch64/my-native-bin
└── windows-x86_64/my-native-bin.exe
```
### 3.1 Required files
- [`extension.json`](https://git.isawarden.com/peter/hello-world-extension/src/branch/main/extension.json)
- one entry file referenced by `entry`
- `package.json` with a `build` script that ends by running `isa-ext package`
### 3.2 Optional files
- native binaries under `native/`
- packaged frontend assets under `app/` or another folder referenced by `entry`
- assets needed by the extension UI
- an optional extension icon asset referenced by `icon.path`
- extension-local build scripts
- extension-local README
- one classic JavaScript host module referenced by `modEntry`, only when the manifest requests the `mod` permission
Model recommendations do not require a separate file. Their small portable
descriptors live inline in the source `extension.json`. Follow the complete
[model-recommendation author workflow](21-model-recommendations.md#212-author-workflow)
before publishing them.
### 3.3 Recommended source layout
For complex extensions, a source layout separate from packaged assets is recommended.
The pattern used by
[`chat-ui-3/extensions/meeting-warden/README.md`](../../extensions/meeting-warden/README.md)
is a good reference:
```text
my-extension/
├── extension.json
├── package.json
├── app/
├── native/
├── src/svelte-ui/
├── extension-native/
└── README.md
```
### 3.4 Dashboard distribution package
Dashboard-distributed extensions use a directory package with the suffix `.isax`.
Clients do not read directory listings. Given a package root URL, clients derive exactly two child URLs:
```text
<package-root-url>/extension.json
<package-root-url>/payload.tar.xz
```
The package root must contain:
- `extension.json`: the canonical extension manifest plus distribution metadata shown in dashboard administration screens
- `payload.tar.xz`: an archive containing the installable extension assets, without another `extension.json`
Dashboard administrators can also add this package from the desktop app with
the Add Extension **Browse** action. The picker accepts the `.isax` directory
itself (not a loose archive or JSON file), validates both files and the
installable payload locally, then uploads `payload.tar.xz` as one extension
artifact. The extension record stores the artifact ID; it never stores a
short-lived signed download URL. URL-based packages continue to use the two
HTTP child URLs above.
The distribution `extension.json` must include:
- `id`: stable extension identifier
- `name`
- `version`
- `author`
- `description`
- `entry`: safe relative iframe entry path
- `payloadSha256`: SHA-256 hex digest of `payload.tar.xz`
The optional fields are:
- `minimumIsaWardenVersion`: the lowest compatible ISA Warden host release as an exact semantic version
- `modelRecommendations`: validated model descriptors copied from the source
manifest so an administrator can review them before installing the payload
- `icon`: validated Lucide or packaged-asset metadata
- `permissions`: the normalized permission list
- `modEntry`: the safe relative host-module path when `permissions` contains `mod`
Future fields are accepted but not required:
- `changelog`
- `license`
- `screenshots`
- `signature`
The archive payload must extract directly into one installable extension root. It contains entry assets and optional `native/` assets, but not `extension.json`. During preview or installation, the host writes the package-root manifest into the extracted root and runs the same validator used by local installs in [`validate_extension()`](../../src-tauri/src/extensions/commands.rs:112).
The package-root manifest is the only manifest and is authoritative for preview, install, and update. The host rejects malformed minimum versions and packages whose minimum is newer than its own application version.
### 3.5 `isa-ext` build CLI
ISA Warden extensions are finalized with the Rust CLI at [`chat-ui-3/extensions/isa-ext`](../../extensions/isa-ext/Cargo.toml).
Each extension may use any local build system it needs, such as Vite, Parcel, Rust, or plain files, but the final dashboard bundle must be produced with `isa-ext package`.
Install the CLI from this repository:
```sh
cargo install --path chat-ui-3/extensions/isa-ext
```
Then package an extension with the installed command:
```sh
isa-ext package chat-ui-3/extensions/hello-world
```
The package command validates `extension.json`, verifies the manifest entry file, creates `<id>.isax/payload.tar.xz` without the source manifest, and writes the canonical package-root manifest with `payloadSha256`. When `minimumIsaWardenVersion` is present, `isa-ext` validates its semantic-version syntax and preserves it. When `modelRecommendations` is present, `isa-ext` also validates its versioned portable model contract and preserves it inline. The CLI validates `icon`, `permissions`, and `modEntry`; an unsafe or missing icon asset, a `modEntry` without `mod`, `mod` without `modEntry`, an unsafe path, or a missing module asset fails packaging. Inspecting this generated public block is a required step in the [recommendation validation workflow](21-model-recommendations.md#2111-validation-before-publication).
Every repository extension root has a `package.json` with a common finalization step:
```json
{
"scripts": {
"build": "npm run package",
"package": "isa-ext package ."
}
}
```
Complex extensions can add their own pre-package steps:
```json
{
"scripts": {
"build": "npm run build:ui && npm run package",
"build:ui": "npm --prefix src/svelte-ui run build",
"package": "isa-ext package ."
}
}
```
### 3.6 Scaffolding a minimal extension
`isa-ext scaffold` creates a small pale Hello World proof-of-concept extension with `extension.json`, `index.html`, `app.js`, `styles.css`, and `package.json`.
Interactive mode:
```sh
isa-ext scaffold
```
Non-interactive mode:
```sh
isa-ext scaffold --name "Acme Hello" --author "Acme" --directory acme-hello
```
The scaffolded `package.json` uses `isa-ext package .` for its `build` script, so generated projects can be packaged with:
```sh
npm run build
```
@@ -0,0 +1,332 @@
# Manifest specification
The extension manifest is [`extension.json`](https://git.isawarden.com/peter/hello-world-extension/src/branch/main/extension.json).
Example:
```json
{
"id": "hello-world",
"name": "Hello World Extension",
"version": "1.0.0",
"author": "ISA Warden",
"description": "Demo extension that validates host commands and client-server style native API calls.",
"entry": "index.html",
"permissions": [
"get_app_info",
"get_thread_list",
"get_full_thread_object",
"new_thread",
"stream_chat",
"list_extensions",
"get_extension_info",
"native_code"
],
"native": {
"binaries": [
{
"id": "hello-native-linux",
"path": "native/linux-x86_64/hello-native-demo",
"targets": ["linux-x86_64", "linux"],
"functions": ["hello.native_server"],
"protocol": "stdio-json-v1",
"args": []
}
]
}
}
```
### 4.1 Required top-level fields
- `id`: stable extension identifier
- `name`: user-facing name
- `version`: extension version string
- `entry`: entry file path inside the extension package
### 4.2 Recommended top-level fields
- `author`
- `description`
- `icon`
- `permissions`
The optional `modelRecommendations` field is documented in
[section 4.7](#47-model-recommendations).
The optional `modEntry` field is valid only with the `mod` permission and is documented in [section 4.8](#48-privileged-host-modules).
The optional `minimumIsaWardenVersion` field is the install-time compatibility gate and declares the oldest compatible ISA Warden host as an exact semantic version, for example `"0.7.39"`. Discovery, validation, preview, install, and update reject a malformed value or a manifest whose minimum is newer than the running host. Dashboard packages copy this field into their distribution manifest, and the public and payload values must match exactly. This gate does not version runtime command APIs; extensions must continue detecting runtime capabilities by checking the host-advertised command arrays. Omit the field when the extension has no explicit minimum beyond the host's existing manifest contract.
### 4.2.1 Extension icon
An extension chooses its launchpad icon in its own manifest. Use a host-supported Lucide icon for normal product concepts:
```json
{
"icon": {
"type": "lucide",
"name": "file-search-2"
}
}
```
The name uses the kebab-case Lucide icon name, such as `file-search-2`, `tractor`, or `chart-no-axes-combined`. The host resolves it against its installed `lucide-svelte` version.
Use a packaged asset for a brand or domain-specific icon:
```json
{
"icon": {
"type": "asset",
"path": "assets/icon.svg"
}
}
```
Asset paths must be safe relative forward-slash paths inside the extension and must end in `.svg`, `.png`, `.jpg`, or `.jpeg`. The packager rejects a missing icon file. The host renders custom icons as images and does not inject their SVG markup into the app document. An absent, malformed, unavailable, or unsupported icon uses the generic Puzzle fallback.
### 4.3 Native block
If native functionality is used, `native` must define one or more binaries.
Binary fields:
- `id`
- `path`
- `targets`
- `functions`
- `protocol`
- `args`
### 4.4 Manifest validation rules
The current validator is implemented in
[`validate_extension()`](../../src-tauri/src/extensions/commands/management.rs).
Rules:
- manifest must parse correctly
- `minimumIsaWardenVersion`, when present, must be a valid semantic version no newer than the running ISA Warden host
- entry file must exist
- declared icon metadata must be valid and a custom icon asset must exist
- declared native assets must exist
- if `native` exists, `permissions` must include `native_code`
- if `permissions` includes `native_code`, `native` must exist
- a native function may appear in multiple binaries only if their target sets do not overlap
- if `permissions` includes `mod`, `modEntry` must name an existing safe relative classic JavaScript file
- `modEntry` without the exact `mod` permission is invalid
- `modEntry` must not be empty, absolute, drive-prefixed, backslash-separated, or contain `.` or `..` path segments
### 4.4.1 Dashboard workers
The privileged `dashboard_worker` permission is valid only with a non-empty `workers` array. Worker IDs and function names are unique, entries are safe relative packaged `.mjs` paths, and the only initial runtime/protocol pair is `javascript-esm-v1` with `isa-extension-worker-v1`. Public distribution metadata must exactly match the verified payload. Installation and every metadata or digest update require fresh administrator consent; declaration alone never grants model, file, tool, project, storage, or email access. See [Dashboard extension workers](extension-workers.md).
### 4.5 Audio and transcription permissions
A typical record-and-transcribe extension declares both media permissions:
```json
{
"permissions": [
"get_app_info",
"audio_capture",
"transcribe_audio"
]
}
```
- `audio_capture` allows an extension to enumerate microphone inputs and manage
opaque, host-owned local recordings. The host asks the user for a separate,
revocable microphone grant before the first recording starts.
- `transcribe_audio` allows an extension to list speech-to-text models assigned
to its exact launch group and transcribe one of its own local recordings.
The permissions are independent: an extension that only manages existing
recordings can request `audio_capture`, while the normal microphone-to-transcript
flow needs both. Use capability discovery before rendering either workflow;
declaring a permission does not guarantee that the current host or launch
context can provide it.
Neither permission exposes audio bytes, local paths, model credentials, or
dashboard credentials. An extension that persists transcript text in shared
group storage must also request the relevant `filesystem_read` and
`filesystem_write` permissions. Add `filesystem_delete` only when the extension
actually deletes shared files.
### 4.6 Shared project permissions
Extensions that participate in a cross-extension project workflow can request:
```json
{
"permissions": [
"get_app_info",
"projects_read",
"projects_write"
]
}
```
- `projects_read` enables `projects_list` for the active launch group.
- `projects_write` enables `projects_create` and `projects_set_archived` for
that group.
The permissions are independent and appear under `get_app_info().projects` as
`canRead`, `canWrite`, and the exact available commands. The host discards any
extension-supplied workspace or group scope and injects the frozen launch
context. These permissions expose project identity and metadata only; they do
not grant raw filesystem access to the project registry. Store extension-owned
project data in the extension group folder and key it by the returned project
id.
Archiving is a reversible metadata change, not deletion. It preserves the
project id and does not remove extension-owned files associated with that id.
Only show archive or restore actions when `projects_set_archived` is present in
the advertised project commands.
### 4.7 Model recommendations
An extension can recommend portable dashboard model records:
Use [Model recommendations](21-model-recommendations.md) for the complete
author workflow, host processing sequence, administrator follow-up, retry
behavior, and runtime limitations. This section defines the wire format.
```json
{
"modelRecommendations": {
"schemaVersion": 1,
"items": [
{
"key": "analysis-model",
"importance": "required",
"name": "Local analysis model",
"reason": "Analyses meeting content on this device.",
"modelTypes": ["chatLlm"],
"location": "local",
"safetyLevel": "high",
"modelSettings": {
"contextLength": 8192
},
"source": {
"normalHttp": {
"url": "https://models.example/acme/analysis.gguf",
"outputFile": "acme/analysis.gguf",
"autoDownload": false,
"mmprojPath": "acme/analysis-mmproj.gguf"
}
}
},
{
"key": "summary-model",
"importance": "recommended",
"name": "Remote summary model",
"reason": "Creates concise summaries.",
"modelTypes": ["chatLlm"],
"location": "cloud",
"safetyLevel": "medium",
"source": {
"openAICompatibleAPI": {
"baseUrl": "https://api.example/v1",
"model": "summary-1"
}
}
}
]
}
}
```
`modelRecommendations` is optional. A complete version 1 example is available
as [`examples/model-recommendations-v1.json`](examples/model-recommendations-v1.json).
When present:
- `schemaVersion` must be `1`.
- `items` must contain at least one recommendation.
- `key` is unique within the extension and contains only lowercase ASCII
letters, digits, `_`, and `-`.
- `importance` is `required` or `recommended`. Required items cannot be
deselected during installation review; this MVP does not enforce them at
extension runtime.
- `name` and `reason` are non-empty user-facing strings.
- `modelTypes` is a non-empty, duplicate-free list containing
`chatLlm`, `text2Video`, `text2Image`, `textEmbedding`, `other`, or
`speechToText`.
- `safetyLevel` is `high`, `medium`, or `low`.
- `modelSettings`, when present, is a JSON object without credential fields.
The source is an externally tagged union with exactly one of these variants:
- `normalHttp` contains `url`, `outputFile`, and optional `autoDownload`,
`mmprojPath`, and `mtpPath`. Its `location` must be `local`.
`autoDownload` must be omitted or `false`; adding the dashboard record never
implicitly downloads its bytes. Output and companion paths may contain
nested `/` segments but must be safe relative portable paths: absolute
paths, drive prefixes, backslashes, empty segments, `.` and `..` are
rejected.
- `openAICompatibleAPI` contains only `baseUrl` and the provider `model`
identifier. Its `location` must be `privateServer` or `cloud`. It must never
contain an API key.
Source URLs must use HTTPS. HTTP is accepted only for an explicit development
endpoint on `localhost` or a loopback IP address. URL userinfo and credential
query parameters are rejected. Portable recommendation
objects are strict: unknown source fields such as `apiKey`, and recursively
nested credential-looking fields in `modelSettings`, make the manifest
invalid.
`isa-ext package` validates this contract and copies it unchanged in meaning
to the public distribution `extension.json`. The host validates it again
during preview. API keys are supplied by the administrator in the review UI
and are never copied into either manifest. A recommendation key remains
installation metadata and is not exposed as a runtime model ID.
### 4.8 Privileged host modules
A host mod is declared separately from the iframe entry:
```json
{
"id": "tootsy",
"name": "Tootsy",
"version": "1.0.0",
"entry": "index.html",
"permissions": ["mod"],
"modEntry": "mod.js"
}
```
`entry` always remains the normal sandboxed iframe application. `modEntry` is a classic, self-registering JavaScript file that is loaded in the main application document only after the host validates the installed manifest and the user accepts the host-controlled warning for the current activation session. The warning is required because this permission can visibly change ISA Warden, add host UI such as buttons, and execute code outside the extension iframe sandbox.
The module must synchronously register exactly once while its script is evaluated:
```js
window.__ISA_WARDEN_EXTENSION_MOD_HOST__.register({
extensionId: 'my-extension',
activate(context) {
const style = context.appendStyle(':root { --my-accent: rebeccapurple; }');
const root = context.appendRoot('extensionToolbar');
const button = context.document.createElement('button');
button.type = 'button';
button.textContent = 'My action';
root.append(button);
context.addEventListener(button, 'click', () => {
context.document.documentElement.style.setProperty('--my-accent-active', '1');
});
return () => {
context.document.documentElement.style.removeProperty('--my-accent-active');
root.remove();
style.remove();
};
}
});
```
The registration `extensionId` must exactly match the installed manifest. The host rejects missing, late, wrong-ID, and duplicate registrations.
The activation context contains `extensionId`, `document`, `mountPoints`, `minimizeExtensionView()`, `onDispose(callback)`, `appendStyle(cssText)`, `appendRoot(mountPointName = 'appShell')`, and `addEventListener(target, type, listener, options)`. The named `appShell` and `extensionToolbar` mount points are backed by host elements marked `data-isa-extension-mod-mount="appShell"` and `data-isa-extension-mod-mount="extensionToolbar"`. A mod whose primary result is a host theme may call `minimizeExtensionView()` after activation so the themed host becomes visible while the extension and its tracked contributions remain active. `appendStyle`, `appendRoot`, and `addEventListener` create tracked contributions owned by the extension; `activate` may additionally return one cleanup function. The host runs registered and returned cleanup and removes all tracked contributions when the view reloads, closes, is uninstalled, fails activation, or is replaced.
These lifecycle helpers reduce accidental leaks; they are not a security sandbox. Once accepted, a mod runs in the host realm and can directly access the document. Request `mod` only when iframe theme tokens and bridge APIs cannot implement the feature.
@@ -0,0 +1,88 @@
# Installation lifecycle
Current local install behavior is implemented in:
- [`validate_extension()`](../../src-tauri/src/extensions/commands.rs:100)
- [`install_dashboard_extension()`](../../src-tauri/src/extensions/commands.rs)
- [`install_developer_extension_from_path()`](../../src-tauri/src/extensions/commands.rs)
- [`uninstall_extension()`](../../src-tauri/src/extensions/commands.rs)
### 5.1 Dashboard install
Non-developer extensions are installed from dashboard extension records. The installer downloads the dashboard payload, verifies its SHA-256 digest, validates the extracted extension, and copies it into the managed extension root.
When the public manifest contains `modelRecommendations`, installation has an
additional administrator review:
1. The host validates the recommendation schema before any dashboard mutation.
2. Each recommendation is compared with the current workspace model inventory.
Display name alone never counts as a match.
3. Required missing models remain selected. Recommended missing models are
selected by default but can be deselected.
4. The host adds selected missing models through the existing model API with
an empty group list, then adds the extension.
5. Created models remain workspace-only until an administrator links them
to groups. The extension itself keeps the existing optional link to the
group from which the add-extension flow was opened.
The complete publisher and administrator procedure is in
[Model recommendations](21-model-recommendations.md).
An existing `normalHttp` model matches only when its normalized URL and output
filename match and the workspace model contains every declared model type. An
existing `openAICompatibleAPI` model matches only when its normalized base URL
and provider model identifier match and the workspace model contains every
declared model type. Its stored API key is deliberately ignored during
matching and is never exposed to the extension.
A missing OpenAI-compatible recommendation requires the administrator to enter
an API key. That key stays in transient review state until it is passed to the
existing add-model command; it is never added to extension metadata or
`manifestJson`.
This MVP is deliberately additive rather than transactional. Models are added
one by one before the extension:
- If any selected model fails, the extension is not added and the review stays
open.
- If a later model or extension operation fails, models already created in the
workspace remain there.
- Retrying re-runs exact matching and reuses those models instead of deleting
or duplicating them.
A `normalHttp` recommendation registers a workspace model record only. It
always uses `autoDownload: false`; downloading model bytes to the current
device remains a separate model-library action. Likewise, adding a model to a
workspace does not make it available to any group. These two follow-up actions
must not be presented as part of the extension installation.
The automated recommendation review currently runs only in the dashboard
**Add Extension** flow. Developer mounting validates the manifest without
provisioning models, extension updates do not retroactively process changed
recommendations, and uninstalling an extension does not remove models created
during its installation.
### 5.2 Developer install
Developer installation mounts an extension source directory as a developer extension and is intended for development users/builds only.
### 5.3 Uninstall
Uninstall removes the installed or developer-mounted extension and stops extension native processes when supported.
### 5.3.1 Worker grant lifecycle
A package requesting `dashboard_worker` is staged and verified before an administrator can grant it. The grant binds the exact payload digest, version, entries, runtime, protocol, and functions. Automatic updates never retain a stale grant, and unlink, uninstall, or privilege change revokes grants and fences active jobs. See [Dashboard extension workers](extension-workers.md).
### 5.4 Mod review and activation
An extension requesting `mod` has two distinct lifecycle decisions:
1. Before a manual dashboard install, update, or developer mount mutates extension inventory, the host previews validated metadata and warns that the extension can change ISA Warden and inject code outside the iframe sandbox.
2. Before each current-session host activation, the host reads authoritative installed extension info and asks for an interactive acknowledgement. Declining leaves the iframe entry usable and loads no host script, style, root, or listener.
For dashboard packages, the public distribution `permissions` and `modEntry` must match the SHA-256-verified extracted payload manifest. A mismatch fails preview, installation, or update. An update that adds or removes `mod`, or changes `modEntry`, is treated as a privilege change and must be reviewed.
Automatic dashboard synchronization may download and install a mod package, but it never activates `modEntry` unattended. The host module remains inert until a user opens the extension in the main application and accepts the activation warning. Detached extension windows remain iframe-only and do not mount main-shell contributions.
On close, reload, replacement, update, activation error, or host disposal, the host invokes module cleanup and removes its tracked styles, roots, scripts, and listeners. Uninstall still removes the installed extension after active contributions have been disposed.
@@ -0,0 +1,356 @@
# Browser Bridge API
Hosted extensions use `window.isaExtensionBridge` inside the extension iframe.
The host injects workspace authentication; extensions must not handle dashboard
tokens directly.
## Host mods are not bridge APIs
The browser bridge never exposes `parent.document`, evaluates extension strings, or activates host modules. A normal extension, including one that sends forged `postMessage` traffic or happens to contain an undeclared JavaScript file, cannot style the parent application or add host UI.
Only an installed extension with the exact `mod` permission and a validated `modEntry` can cross that boundary. After an interactive host warning, the separately loaded classic script registers through `window.__ISA_WARDEN_EXTENSION_MOD_HOST__` in the host realm. That privileged registration and lifecycle context are documented in [Manifest specification: privileged host modules](04-manifest-specification.md#48-privileged-host-modules); they are deliberately unavailable inside the iframe.
Keep the iframe app functional when mod activation is declined or unavailable. All ordinary data access, host commands, and extension UI continue to use `window.isaExtensionBridge`.
## Core Methods
### `invoke(command, args)`
Calls a host command directly.
```js
await window.isaExtensionBridge.invoke('get_app_info', {});
```
### `invokeNative(functionName, args)`
Calls a function exposed by the extension's own native binary.
### `on(eventName, callback)` And `off(eventName, callback)`
Subscribe and unsubscribe from host bridge events.
### `getAppInfo()`
Convenience wrapper for `get_app_info`.
Both native and dashboard web hosts return `workspace.id`, `workspace.activeGroup`, and `extensionRuntime` for the extension's immutable launch context. `workspace.currentUserPermissions` contains the authenticated user's fresh effective rights for that launch workspace, read through `GetAvailableResources` on each request. Selecting another workspace elsewhere in the host does not change this lookup.
`workspace.isAdmin` is true only when these effective workspace rights contain the complete workspace-administrator permission set. A system-administrator label, group role, email address, or developer installation does not grant this flag. The host checks that the account and launch are still current after asynchronous work; late results never grant administrator access.
`workspace.accessError` is `null` for a completed access check, including a denied check when the workspace is absent or its effective rights are insufficient. It is `"unavailable"` when resources or rights cannot be read, and `"context_changed"` when the account or launch changed while checking. Both error states return `currentUserPermissions: []` and `isAdmin: false`; other app-info metadata and capabilities remain available. Extensions should distinguish these errors from a confirmed denial, refresh access before a management action, and discard prepared management actions after access is lost. These UI checks do not replace the dashboard's resource authorization or change existing group-file permissions.
### `addLog(message, metadata)`
Writes a host-visible extension log entry.
### `streamChat(options, handlers)`
Invokes host chat streaming with the active extension thread context. Native and dashboard web hosts report classified provider failures with the same `{ code, message }` error contract: `provider_http_rejected` means the provider rejected the HTTP request, and `output_limit` means generation ended at its output limit before completing the answer. Messages are static and omit provider bodies, URLs, and credentials. Other failures retain generic host error handling.
Model settings are merged before request overrides; a request output-token limit replaces an inherited alternate limit (`max_tokens` or `max_completion_tokens`). The model editor’s `maxTokens` setting is normalized to `max_tokens` before merging; an explicit provider token-limit field takes precedence when both forms occur in one settings object. The existing default applies only when neither limit is supplied. Browser round-metrics events do not become answer content.
RSX supplier enrichment shares website evidence, prompts, final-answer parsing, normalization, and validated File B persistence across both hosts. It retries once only for invalid JSON or `output_limit`, with the same model, evidence, and options and a shorter answer instruction. Provider rejection, authorization, cancellation, and persistence failures are not retried; failed generation attempts leave existing enrichment intact. Reasoning is excluded from final-answer parsing.
## Private settings helpers
`localstorage_get({key,sync?})`, `localstorage_put({key,value,sync?})`, `localstorage_delete({key,sync?})`, and `localstorage_list({prefix?,sync?})` return promises. `sync` defaults to `false`. These host APIs store JSON privately; they do not use the extension frame's browser `window.localStorage`. See [private localstorage API](07-host-command-api-reference.md#private-localstorage-api) for scope, result shapes, cached reads, online writes, and failure handling.
## Filesystem Model
Dashboard files can be visible to a user through workspace permissions and group
links. That visibility does not automatically grant an extension access. An
extension gets filesystem access only through:
- `ensureGroupFolder()` for extension-owned group storage.
- `openWorkspaceFile()` for a user-selected file grant.
- `openWorkspaceFolder()` for a user-selected folder grant.
Local grants are scoped by extension id, workspace id, and launch group. Users
can revoke them in Settings. Read-only grants allow reads and listings but block
uploads, replacements, and deletes.
## Filesystem Helpers
### `ensureGroupFolder()`
Creates or finds the extension's folder for the selected launch group and
returns its real workspace file id and path.
```js
const folder = await window.isaExtensionBridge.ensureGroupFolder();
console.log(folder.path);
```
The folder is created only when requested. Extensions should place shared
syncable files below the returned path. Access to this folder is derived from
the extension being assigned to the selected launch group.
### `openWorkspaceFile(args)`
Opens the host workspace-file picker and stores a local file grant if the user
confirms the selection.
```js
const selected = await window.isaExtensionBridge.openWorkspaceFile({
access: 'read'
});
```
Use `access: 'read'` for read-only grants or `access: 'read_write'` when the
extension needs to update the selected file.
### `openWorkspaceFolder(args)`
Opens the host workspace-folder picker and stores a local folder grant.
```js
const selected = await window.isaExtensionBridge.openWorkspaceFolder({
access: 'read_write'
});
```
### `listDir(args)`
Lists files below a granted folder or the extension group folder, merging dashboard inventory with locally available syncable entries.
```js
const listing = await window.isaExtensionBridge.listDir({
path: folder.path,
recursive: false
});
```
The response uses `files`, not `entries`, and reports whether it is authoritative. Use exactly one of `path` or `pathPrefix`; `recursive` defaults to `true`.
### `getFiles(args)`
Reads one or more granted files by canonical path. Returned file IDs are metadata only and are never read selectors. The host always checks its clean local sync cache first for syncable files, then retrieves only unresolved files from the dashboard.
```js
const response = await window.isaExtensionBridge.getFiles({
files: [{ path: selected.path }]
});
const file = response.items[0];
```
The response has an `items` array, with one result per requested path. Each item includes text or base64 bytes depending on content. Supply `cachePolicy: "dashboard-required"` per file only when a canonical dashboard read is needed, such as before CAS writes or when establishing authoritative absence.
### `uploadFiles(args)`
Uploads or replaces one or more files below a read-write grant. A single upload is represented by a one-item `files` list.
```js
await window.isaExtensionBridge.uploadFiles({
files: [{
path: `${folder.path}/state.json`,
text: JSON.stringify({ ok: true }),
contentType: 'application/json',
metadata: { syncable: 'true' },
progressId: 'state-upload'
}]
});
```
Progress is emitted as `filesystem-upload-progress`, scoped by the host to the
frozen workspace and group, and should be filtered by `progressId` when
concurrent uploads are possible.
### `deleteFile(args)`
Deletes a granted file or folder. Read-only grants reject delete. Folder trees
may be deleted with `recursive: true`; conditional deletion accepts
`expectedSyncRevision` and `expectedContentHash`.
### `discardPendingFile(args)`
Discards only a conflicted local pending version of a syncable file and restores
the last dashboard-confirmed cache version. It cannot discard an ordinary dirty
or synced file.
### `getDownloadLinkFile(args)`
Creates a signed URL for a granted file. This remains available for explicit download workflows, but syncable content should be read with `getFiles` so a complete local copy can be returned without an S3 round trip.
## Syncable Files
Extensions may mark small group-folder files as syncable with
`metadata.syncable = 'true'`. The host handles local cache, offline queueing,
group-wide download, and conflict handling. Extensions should not build their
own offline sync for syncable files.
The opt-in is the exact string `'true'`. The group folder and read-write grant
must first be provisioned while online. After that, `uploadFiles` durably saves
syncable `text`, `bytesBase64`, or snapshotted `filePath` content locally before
contacting the dashboard. A successful pending/local result means the content
is readable offline and survives restart; remote acceptance is confirmed later
by host reconciliation. New filenames below the provisioned folder follow the
same rule. Conflicts retain the local bytes, while invalid paths, missing login,
revoked/read-only grants, and group mismatches do not create queued content.
Reading that content requires only `getFiles`; the extension never needs to request a dashboard download link for a syncable file.
Uploads without this exact metadata value keep the online-only behavior.
Filesystem responses expose host sync metadata where available, including
`syncStatus`, `syncRevision`, `contentHash`, `baseContentHash`, `pendingUpload`,
`pendingState`, `conflictCount`, and `lastSyncedAt`.
## Shared Project Helpers
Shared projects provide one stable, group-scoped identity that multiple
extensions can use. Discover the API before showing a project picker:
```js
const bridge = window.isaExtensionBridge;
const appInfo = await bridge.getAppInfo();
if (appInfo.projects?.canRead) {
const { projects } = await bridge.listProjects();
console.log(projects);
}
```
`listProjects()` invokes `projects_list`. `createProject({ name })` invokes
`projects_create` and requires `projects_write`. The default list contains only
active projects. Pass `includeArchived: true` when an archive or restore view
also needs archived project metadata:
```js
const { projects: allProjects } = await bridge.listProjects({
includeArchived: true
});
const result = await bridge.createProject({ name: 'Renovatie West' });
console.log(result.project.id, result.created);
```
Project objects contain `id`, `name`, RFC 3339 `createdAt` and `updatedAt`
strings, `canWrite`, `archived`, and nullable RFC 3339 `archivedAt`. The id is
the canonical dashboard workspace-file id; use it as the foreign key in
extension-owned data. `created` is `false` when an idempotent create finds the
same canonical project.
The Project API exposes the `setProjectArchived(args)` helper when `projects_set_archived` is advertised. It requires `projects_write` and a dashboard that
advertises `shared-projects-archive-v1`:
```js
if (appInfo.projects?.commands?.includes('projects_set_archived')) {
const archived = await bridge.setProjectArchived({
projectId: result.project.id,
archived: true
});
await bridge.setProjectArchived({
projectId: archived.project.id,
archived: false
});
}
```
The response contains the updated `project` and an idempotent `changed` flag.
Setting the current state again returns `changed: false`. Archive and restore
never change the project id or remove extension-owned data; restoring makes the
same identity active again.
The host injects the frozen `workspaceId` and `groupId`; iframe values for those
fields are discarded. Project registry folders are system-owned, read-only
identity records. They are not extension storage, so use `ensureGroupFolder()`
for JSON, Markdown, transcripts, and other extension-owned project content.
## Audio And Transcription Helpers
Discover the runtime surface before using it:
```js
const bridge = window.isaExtensionBridge;
const appInfo = await bridge.getAppInfo();
if (!appInfo.audioCapture?.enabled || !appInfo.transcription?.enabled) {
// Render an unavailable state instead of starting the workflow.
}
```
`audioCapture` and `transcription` expose their `commands` and `events`. Transcription also reports that the current API is batch-only, has no
live transcription, and can transport optional speaker labels. This host-level
capability does not mean every transcription model separates speakers. Treat
`supportsSpeakerLabels` on each `transcription_list_providers` descriptor as the
authoritative model-specific value.
The bridge provides convenience methods for the canonical commands:
- `listAudioInputDevices()`
- `getActiveRecording()` and `getRecording(args)`
- `listRecordings()`
- `startRecording(args)`, `pauseRecording(args)`, `resumeRecording(args)`
- `stopRecording(args)`, `cancelRecording(args)`, `deleteRecording(args)`
- `listTranscriptionProviders()`
- `startTranscription(args)`, `getTranscription(args)`
- `cancelTranscription(args)`, `deleteTranscription(args)`
Recording methods exchange opaque IDs and safe state only. They never return a
path, blob URL, base64, or audio bytes. The host injects and overwrites
`workspaceId`, `groupId`, and `extensionId` for every scoped media command. An
extension passes only workflow inputs such as `deviceId`, `recordingId`,
`modelId`, and `jobId`; it cannot select or widen its own authorization scope.
```js
const devices = await bridge.listAudioInputDevices();
const recording = await bridge.startRecording({
deviceId: devices.find((device) => device.isDefault)?.deviceId
});
await bridge.stopRecording({ recordingId: recording.recordingId });
const providers = await bridge.listTranscriptionProviders();
if (!providers.length) throw new Error('No speech-to-text model is available to this group');
const started = await bridge.startTranscription({
recordingId: recording.recordingId,
modelId: providers[0].id,
language: 'nl'
});
const unsubscribe = bridge.on('transcription-completed', (event) => {
if (event.jobId === started.jobId) void bridge.getTranscription({ jobId: started.jobId });
});
// Retain this callback and call it when the component or extension view is disposed.
const dispose = () => unsubscribe();
```
The first start for a local model may initiate its host-managed download and
reject temporarily. A production flow must handle that handshake, persist the
job ID, reconcile missed events, and clean up in the right order. See the
[complete audio and transcription quick start](19-audio-and-transcription.md).
## Bridge Events
Current event names include:
- `app:ready`
- `filesystem-upload-progress`
- `stream-chat-token`
- `stream-chat-summarization-needed`
- `chat-models:changed`
- `theme:changed`
- `audio-capture-state-changed`
- `transcription-progress`
- `transcription-segment`
- `transcription-completed`
- `transcription-failed`
- `filesystem-sync-state-changed`
- `bridge:script-loaded-v2`
- `bridge:window-error`
- `bridge:unhandled-rejection`
## Unified file selection
`bridge.selectFiles(options)` and `bridge.select_files(options)` invoke the host's `select_files` command in both native and browser extensions. The extension must declare `filesystem_read`. Options include `filters` (extensions or MIME types), `multiple`, `maxCount`, and `accessPolicy` (`read-only` for imports or `editable` for editing workflows). Selection captures the extension launch workspace/group and is canceled when that launch ends.
The host presents the shared Computer / Group files modal. Computer files are immutable byte snapshots and never writable references to original local paths. Group selections grant only the selected file; folder adapters grant only the selected subtree. Editable workflows start read-only. Writable group references require `filesystem_write`, applicable group permissions, and the user's explicit choice. Optional sharing is a host action into an existing authorized group folder.
The response is `{ canceled, selections }`. Each selection contains `filename`, `mimeType`, `size`, `sha256`, `source`, `effectiveAccess`, `bytesBase64`, and an optional canonical `groupFile` reference. `extensions/shared/file-selection.js` supplies `selectImportFiles(options)` for existing parsers; it locks read-only access and returns ordinary `File` objects. Cancellation returns an empty list.
`openWorkspaceFile` and `openWorkspaceFolder` remain supported adapters to this modal with group-only selection and their existing `{ canceled, grant, file }` result envelope. Requesting `access: 'read'` locks the notice and grant to read-only. Filenames do not confer identity or replace existing files.
@@ -0,0 +1,874 @@
# Host Command API Reference
The extension host command dispatcher exposes platform commands through
`window.isaExtensionBridge.invoke(command, args)`. Browser helpers may wrap these
commands, but extensions can always call the canonical command names directly.
## Dashboard web filesystem behavior
The dashboard web UI exposes the same extension filesystem commands and request shapes as the native app. Every web read policy, including `cache-only`, reads the dashboard. A failed network request remains unavailable or an error; it never produces authoritative absence or an empty successful inventory. The cache and offline behavior described below applies to the native host.
Web uploads, deletes, conflict resolution, and atomic JSON operations execute immediately against dashboard storage, including files marked syncable. Successful writes have `pendingUpload: false`; atomic results have `pending: false`. Browser uploads accept `text` and `bytesBase64`, including empty values; native OS `filePath` sources are rejected. The host sends binary chunks internally while keeping `filesystem_upload_files` as the sole public upload command.
Web `filesystem_query_index` reads authorized dashboard inventory with exact-path or prefix selection, exclusive path cursors, ascending or descending ordering, and limits from 1 to 256. It returns `source: "dashboard"`, `snapshotComplete: true` after a successful inventory read, and `reconciliationRevision: 0` to indicate that no local reconciliation exists. It has no pending browser state.
Workspace file and folder pickers support read and read-write grants. The host remembers versioned grant settings per dashboard origin, authenticated user, workspace, group, extension, and verified package identity. It restores them only after server validation, pruning stale or unauthorized settings. Unavailable localStorage permits session-only grants. Grant settings contain no credentials, launch tokens, signed links, or file contents. Revocation removes remembered and live grants across tabs.
A grant remains anchored to its real file or folder ID and persisted ancestry. Current launch-group visibility and dashboard permissions are checked on every operation and upload stage. Read-only grants cannot write, and recursive deletion cannot remove a granted root. Download URLs remain under the app's sandboxed extension asset route under the existing CSP; the launch-authorized streaming proxy pins and rechecks the file snapshot. Extension polling discovers changes from other clients; the web host advertises no offline cache or authoritative reconciliation events.
## Capability Discovery
Use `get_app_info` to discover the surfaces enabled for the extension.
```js
const appInfo = await window.isaExtensionBridge.invoke('get_app_info', {});
console.log(appInfo.filesystem.commands);
console.log(appInfo.projects);
console.log(appInfo.audioCapture);
console.log(appInfo.transcription);
```
Do not infer capability support from the host version or from a manifest alone.
Check `enabled` and the advertised command before showing an action.
This reference spans native and browser host adapters. A command listed below is not necessarily enabled in the browser gateway. The current verified launch's command arrays, manifest permissions, resource authorization and executor health remain authoritative.
Browser `storage_*` holds origin/account/extension-scoped JSON drafts independently of the chat-store lock. Browser filesystem capabilities report `filesystem.persistence.mode = "dashboard-confirmed"`, `offlineWrites = false`, and `authoritativeWrites` only when upload is advertised. Atomic JSON capabilities report `read` and `write` separately. Browser uploads, deletes and atomic writes require dashboard acknowledgment, including for files whose server metadata is syncable. The native offline journal and indexed-cache events described below do not apply to the browser. Check [implementation status](18-implemented-versus-planned-behavior.md) for staged gateways and outstanding live verification.
The Filesystem API exposes workspace-file identity only as returned `fileId` metadata, always uses `path` for canonical filesystem selectors, and does not accept legacy storage-id aliases. Check the advertised command list for supported operations.
The public filesystem command list is:
- `filesystem_ensure_group_folder`
- `filesystem_open_workspace_file`
- `filesystem_open_workspace_folder`
- `filesystem_list_dir`
- `filesystem_get_files`
- `filesystem_query_index`
- `filesystem_upload_files`
- `filesystem_delete_file`
- `filesystem_discard_pending_file`
- `filesystem_get_download_link_file`
The public shared-project command list is:
- `projects_list`
- `projects_create`
- `projects_set_archived`
The atomic JSON command list is:
- `atomic_json_get`
- `atomic_json_apply`
## Implemented Host Commands
Common non-filesystem commands include:
- `get_app_info`
- `get_extension_info`
- `get_native_capabilities`
- `get_settings`
- `set_settings`
- `open_file_dialog`
- `get_thread_list`
- `list_extension_threads`
- `get_full_thread_object`
- `new_thread`
- `create_extension_thread`
- `set_extension_thread_attachment`
- `update_thread`
- `localstorage_put`
- `localstorage_get`
- `localstorage_delete`
- `localstorage_list`
- `projects_list`
- `projects_create`
- `projects_set_archived`
- `atomic_json_get`
- `atomic_json_apply`
- `upsert_document_snapshot`
- `send_email`
- `mcp_list_resources`
- `mcp_invoke_tool`
- `calculator`
- `web_search`
- `extract_webpage_text`
- `browse_and_extract`
- `documents_in_conversation`
- `search_documents`
- `read_document`
## Atomic JSON workspace files
Atomic JSON commands provide operation-based updates to any valid JSON workspace file covered by the extension's ordinary exact-file or folder grant. The extension must declare `atomic_json_read` or `atomic_json_write`; the host supplies and enforces the immutable workspace, group, and extension scope. The target is an absolute canonical `path`, and traversal or access outside the granted scope is rejected.
`atomic_json_get` is the typed companion to `atomic_json_apply`. For a syncable target it materializes the strictly committed RIBLT copy plus all durable unacknowledged operations without using generic pending whole-file bytes. For a non-syncable target it reads the dashboard immediately. Its result distinguishes `found`, `absent`, and `unavailable`; malformed JSON is an error rather than absence. Any valid JSON root is accepted, including objects, arrays, scalars, and `null`. When `pending` is true, `value` includes the local operation overlay while revision, hash, and byte size still describe the committed generation.
`atomic_json_apply` accepts the same canonical target plus ordered operations. The optional boolean `syncable` is only a creation hint: exact `true` opts a missing file into durable local/RIBLT synchronization, while omission or `false` creates dashboard-first. An existing file always retains its authoritative persisted mode, even when the hint differs. Non-syncable applies succeed only after dashboard acceptance; a provisioned syncable target, or a missing target requested with exact `true`, can be saved durably while offline. Operation paths are arrays of literal object-key segments, so dots and slashes inside one key are not separators.
```json
{
"path": "/groups/_group_ids/.../extensions/isa-match-rsx-to-quote/suppliers/enrichments.json",
"syncable": true,
"operations": [
{ "kind": "upsert", "path": ["supplier.example/id"], "value": { "rating": 4 } },
{ "kind": "remove", "path": ["supplier-456"] }
]
}
```
For syncable files the host journals only unacknowledged operations, retries immutable batches through the ordinary file-sync worker, and emits scoped `filesystem-index-changed` events when pending or committed materialization changes. Dashboard acknowledgment durably removes the acknowledged batch immediately; until a later RIBLT generation arrives, a read can expose an older committed value or report unavailable with no accepted-operation overlay. There is no atomic tombstone or incarnation barrier: deletion removes the ordinary file, a later accepted apply recreates from `{}`, operations apply to the valid JSON present when they arrive, and the last dashboard write to arrive wins. The resulting JSON remains visible, downloadable, and manageable through normal dashboard file inventory.
## Filesystem Authorization
Dashboard group links decide what a user can see in a workspace. Extension
filesystem access is narrower and local to the running user profile.
- `filesystem_ensure_group_folder` creates or finds extension-owned storage for
the selected launch group.
- `filesystem_open_workspace_file` and `filesystem_open_workspace_folder`
require explicit user selection and persist a local grant.
- Grants are scoped by extension id, workspace id, and launch group.
- `read` grants allow listing, reading, sync-index inspection, and signed download links.
- `read_write` grants also allow upload, replacement, and delete.
- A read-only grant must reject upload, replacement, and delete.
- The selected workspace and group are captured when the iframe starts and stay
immutable until that iframe is deliberately reloaded.
- The host overwrites `workspaceId` and `groupId` on every `filesystem_*`
request. Extension-supplied scope cannot retarget a mounted extension.
- Delayed responses from a previous iframe generation are discarded.
`get_app_info().extensionRuntime.launchContextId` is the stable serialized
identity of `(workspaceId, groupId)` and may key durable context-local recovery
state. It does not change merely because the iframe reloads. The host's
per-iframe generation token is separate and is not exposed to extensions.
## `filesystem_ensure_group_folder`
Creates or finds the extension's group folder. The command must fail clearly if
the extension was launched without a selected group.
Request:
```json
{}
```
Response:
```json
{
"status": "ok",
"folderId": "workspace_file:...",
"path": "/groups/id-67726f75702d616c706861/extensions/id-7273782d62657374656b616e616c79736572",
}
```
The host supplies the trusted workspace, group, and extension IDs to one atomic
dashboard operation. Folder identity is link-backed and stable across group
renames; the returned persisted path must be retained and must not be rebuilt
from the display name. Concurrent ensure calls converge on the same real folder
row. Structurally ambiguous legacy links fail closed with identifiers for
administrator diagnosis.
## `filesystem_open_workspace_file`
Opens a workspace-file picker and persists a local file grant if the user
confirms.
Request:
```json
{
"workspaceId": "workspace:...",
"access": "read",
"mode": "file"
}
```
Response:
```json
{
"status": "ok",
"fileId": "workspace_file:...",
"path": "/models/model.gguf",
"name": "model.gguf",
"kind": "file",
"access": "read"
}
```
Cancellation returns a documented canceled result or rejects consistently,
depending on the host implementation.
## `filesystem_open_workspace_folder`
Opens a workspace-folder picker and persists a local folder grant.
Request:
```json
{
"workspaceId": "workspace:...",
"access": "read_write",
"mode": "folder"
}
```
Response:
```json
{
"status": "ok",
"folderId": "workspace_file:...",
"path": "/project-inputs",
"name": "project-inputs",
"kind": "folder",
"access": "read_write"
}
```
## `filesystem_list_dir`
Lists files below one granted folder or extension group-folder path. Dashboard inventory and locally available syncable files share one response. Pending or otherwise locally newer syncable metadata replaces a dashboard entry at the same canonical path.
Request:
```json
{
"path": "/groups/id-67726f75702d616c706861/extensions/id-7273782d62657374656b616e616c79736572"
"recursive": false
}
```
Response:
```json
{
"status": "ok",
"source": "dashboard+cache",
"authoritative": true,
"files": [
{
"path": "/groups/id-67726f75702d616c706861/extensions/id-7273782d62657374656b616e616c79736572/state.json",
"name": "state.json",
"kind": "file",
"fileId": "workspace_file:...",
"contentType": "application/json",
"fileSize": 1234,
"canRead": true,
"canWrite": true,
"availabilityStatus": "online",
"synced": true,
"lastSyncedAt": null
}
]
}
```
Use exactly one of `path` or `pathPrefix`. `recursive` defaults to `true`; set it to `false` for direct children only. When the dashboard is unavailable, a non-empty local sync inventory is returned with `source: "cache"` and `authoritative: false`.
## `filesystem_get_files`
Reads one or a bounded batch of granted files by canonical path. File IDs are returned as record-identity metadata but are not accepted as content-read selectors. The default local-first policy reads a complete clean synced cache entry for each syncable file, then retrieves only unresolved items from the dashboard. Use `cachePolicy: "dashboard-required"` when a canonical dashboard read is necessary before a CAS write, canonical application, or an authoritative absence decision.
Each request item selects exactly one canonical `path`. File IDs as selectors, duplicate paths, paths outside the extension's immutable granted root, unsupported encodings, and oversized requests are rejected. `expectedFileId`, `expectedSyncRevision`, and `expectedContentHash` are optional preconditions. An explicit `expectedFileId` requires a dashboard read and rejects a replacement record at the same path. A missing, incomplete, pending, corrupt, or mismatched cache entry causes a dashboard retrieval unless the policy prohibits it; it is never proof of remote absence.
Hosts advertise `supportsExpectedFileId` and `supportsAuthoritativeAbsence`. A confirmed missing file under a currently authorized folder returns `{status: "absent", found: false, source: "dashboard", authoritative: true, path}`. Missing content, revoked access, authentication failures, and connectivity failures do not establish authoritative absence.
Request:
```json
{
"workspaceId": "workspace-alpha",
"files": [
{
"path": "/groups/id-67726f75702d616c706861/extensions/id-7273782d62657374656b616e616c79736572/enrichment/acme.json",
"expectedSyncRevision": "42",
"expectedContentHash": "4d14...64-hex-sha-256...b2"
}
]
}
```
The response includes bounded `items`. Each item has `path`, `status`, and optional `error`; a successful item additionally returns text and coupled sync revision/content-hash metadata. An unsuccessful item does not fail unrelated items.
Response:
```json
{
"status": "ok",
"items": [
{
"status": "ok",
"path": "/groups/id-67726f75702d616c706861/extensions/id-7273782d62657374656b616e616c79736572/state.json",
"fileId": "workspace_file:...",
"filename": "state.json",
"contentType": "application/json",
"fileSize": 1234,
"text": "{\"status\":\"complete\"}",
"bytesBase64": null
}
]
}
```
## `filesystem_upload_files`
Uploads one or more files to granted paths. This is the only upload command: uploading one file means sending a one-item `files` list. Each item's path includes its final filename, and each item independently selects dashboard-first behavior or the local sync queue through `metadata.syncable`.
Request:
```json
{
"files": [
{
"path": "/groups/id-67726f75702d616c706861/extensions/id-7273782d62657374656b616e616c79736572/state.json",
"text": "{\"status\":\"complete\"}",
"contentType": "application/json",
"metadata": { "syncable": "true" },
"progressId": "upload-1"
}
]
}
```
For idempotent online writes, `metadata.client_operation_id` may contain a
stable lowercase or uppercase 64-hex operation identity. Retrying the same
logical operation must reuse the exact path, content, and operation identity;
the host forwards the value unchanged and the dashboard rejects reuse for a
different request.
Progress event:
```json
{
"event": "filesystem-upload-progress",
"extensionId": "rsx-bestekanalyser",
"workspaceId": "workspace-alpha",
"groupId": "group-alpha",
"progressId": "upload-1",
"filename": "state.json",
"bytesReceived": 12345,
"totalBytes": 50000,
"progress": 24.69,
"status": "uploading",
"isComplete": false
}
```
An offline pending upload has the same shape but may return `"fileId": null`
until the dashboard creates or resolves the real workspace-file row. `fileId`
is never a backing object-storage ID and a path is never substituted as an ID.
Response:
```json
{
"status": "ok",
"items": [
{
"status": "ok",
"path": "/groups/id-67726f75702d616c706861/extensions/id-7273782d62657374656b616e616c79736572/state.json",
"fileId": "workspace_file:...",
"filename": "state.json"
}
]
}
```
## `filesystem_delete_file`
Deletes a granted file or folder by canonical path. File IDs are rejected as request selectors, and read-only grants reject this command.
Optional request fields are `recursive`, `expectedSyncRevision`, and
`expectedContentHash`. Recursive deletion requires a path and cannot delete the
root of a persisted folder grant.
## `filesystem_discard_pending_file`
Discards a conflicted local pending version by `path`. The extension, workspace,
launch group, grant, and path must all match. The host returns either
`restored_committed_cache` or `removed_pending_cache`.
## `filesystem_get_download_link_file`
Creates a signed download URL for a granted file by canonical path. File IDs and legacy artifact-ID aliases are rejected as request selectors. A successful authoritative response may include `fileId` as record identity metadata. Syncable files do not require this operation: `filesystem_get_files` reads their complete local content directly when available.
## Syncable Files
Set `metadata.syncable = "true"` for small files that should participate in the
host sync queue. The host owns local caching, offline queueing, group-wide
download, and conflict state. Extensions should not implement a second sync
queue for these files.
The value must be the exact string `"true"`. After the extension group folder
and its read-write grant have been provisioned online, a syncable upload is
first committed to the local synced-file store. A successful pending/local
response means those bytes are durable and immediately available to offline
`filesystem_get_files` and `filesystem_list_dir` calls, including after an app
restart; it does not mean that the dashboard has accepted them yet. The host
wakes its sync worker and uploads after reconnect. Pending state clears only
after a reconciliation confirms the matching remote revision and hash.
The same contract applies to `text`, `bytesBase64`, and the snapshotted bytes
from `filePath`, including empty content. Repeated local saves use the newest
complete bytes. A conflict retains those bytes for resolution and is not
silently retried. Invalid paths, missing authentication, read-only or revoked
grants, and group-scope mismatches fail without creating a pending entry.
Creating the extension group folder and its initial grant remains online-only.
Once provisioned, both replacements and new filenames below that folder can be
queued offline. Uploads without the exact opt-in remain online-only.
The extension does not request or follow a dashboard download link for syncable files. `filesystem_get_files` reads complete local sync content first and the host obtains remote bytes only for unresolved items.
## Shared Project Commands
These commands use the active launch group. Listing and creation require a
dashboard advertising `shared-projects-v1`; archive and restore additionally
require `shared-projects-archive-v1`. The host overwrites `workspaceId` and
`groupId`; extensions cannot select another scope.
`get_app_info().projects` includes `enabled`, `canRead`, `canWrite`, and the available `commands`. `projects_read` enables
`projects_list`; `projects_write` enables `projects_create` and
`projects_set_archived`. Check the advertised command before rendering an
archive or restore action.
### `projects_list`
The extension sends no scope fields. `includeArchived` is optional and defaults
to `false`:
```js
const result = await window.isaExtensionBridge.invoke('projects_list', {});
const withArchive = await window.isaExtensionBridge.invoke('projects_list', {
includeArchived: true
});
```
Response:
```json
{
"status": "ok",
"projects": [
{
"id": "shared-projects-project-...",
"name": "Renovatie West",
"createdAt": "2026-07-22T19:00:00Z",
"updatedAt": "2026-07-22T19:00:00Z",
"canWrite": true,
"archived": false,
"archivedAt": null
}
]
}
```
Results are sorted by most recent `updatedAt`, then name and id. Timestamps are
RFC 3339/ISO-8601 strings. The default response omits archived projects;
`includeArchived: true` returns active and archived projects so clients can
offer restore without mistaking an archived id for a deleted or unknown
project. `archivedAt` is `null` for an active project. `canWrite` is false when
the extension lacks `projects_write`; it permits the dedicated project write
commands and association of extension-owned data, but never raw mutation of the
registry folder through the filesystem API.
### `projects_create`
Request:
```json
{
"name": "Renovatie West"
}
```
Response:
```json
{
"status": "ok",
"created": true,
"project": {
"id": "shared-projects-project-...",
"name": "Renovatie West",
"createdAt": "2026-07-22T19:00:00Z",
"updatedAt": "2026-07-22T19:00:00Z",
"canWrite": true,
"archived": false,
"archivedAt": null
}
}
```
The name is trimmed, case-sensitive, and limited to 160 characters and 512
UTF-8 bytes. Empty names, traversal segments, separators, and control
characters are rejected. Repeating the same canonical create returns the same
project with `created: false`; no duplicate folder is made. A group supports at
most 500 projects, including archived entries. Creating with the name of an
archived project returns that same archived identity; use
`projects_set_archived` to restore it explicitly.
### `projects_set_archived`
This soft-archives or restores a project without deleting its registry identity
or any extension-owned data.
Archive request:
```json
{
"projectId": "shared-projects-project-...",
"archived": true
}
```
Response:
```json
{
"status": "ok",
"changed": true,
"project": {
"id": "shared-projects-project-...",
"name": "Renovatie West",
"createdAt": "2026-07-22T19:00:00Z",
"updatedAt": "2026-07-23T09:00:00Z",
"canWrite": true,
"archived": true,
"archivedAt": "2026-07-23T09:00:00Z"
}
}
```
Restore the project by sending the same `projectId` with `archived: false`.
Both transitions are idempotent: requesting the current state returns
`changed: false`. The project id, name, parent, and canonical path remain
unchanged. Files and records stored by extensions under their own group folders
are not moved or removed.
The project id is a stable foreign key shared by extensions. Project registry
folders are system-owned, read-only metadata and cannot be used as raw
extension storage. Persist extension-owned files under the extension's group
folder and include the project id in their schema or metadata.
## Audio Capture Commands
These commands require `audio_capture` and a frozen workspace/group context:
- `audio_list_input_devices`
- `audio_get_active_recording`
- `audio_get_recording`
- `audio_list_recordings`
- `audio_start_recording`
- `audio_pause_recording`
- `audio_resume_recording`
- `audio_stop_recording`
- `audio_cancel_recording`
- `audio_delete_recording`
The browser bridge supplies the frozen `workspaceId`, `groupId`, and
`extensionId`; iframe arguments for those fields are discarded. The extension
only supplies the fields shown below.
`audio_list_input_devices` returns:
```json
[
{
"deviceId": "opaque-device-id",
"label": "Built-in Microphone",
"isDefault": true
}
]
```
Start request:
```json
{
"deviceId": "opaque-device-id",
"maxDurationMs": 14400000
}
```
`deviceId` is optional and selects the host default when omitted.
`maxDurationMs` is optional and is capped by the host. The response is an audio
recording state:
```json
{
"recordingId": "recording-...",
"status": "recording",
"device": {
"deviceId": "opaque-device-id",
"label": "Built-in Microphone",
"isDefault": true
},
"startedAt": "2026-07-22T19:00:00Z",
"updatedAt": "2026-07-22T19:00:02Z",
"durationMs": 2000,
"bytesWritten": 64000,
"mimeType": "audio/wav",
"sampleRateHz": 48000,
"channels": 1,
"peakLevel": 0.42,
"recovered": false,
"expiresAt": "2026-07-23T19:00:00Z",
"canPause": true,
"canResume": false,
"canStop": true,
"canCancel": true,
"errorCode": null,
"errorMessage": null
}
```
Recording statuses are `starting`, `recording`, `paused`, `stopped`,
`cancelled`, and `failed`. All recording-specific commands use
`{ "recordingId": "..." }`:
- `audio_get_recording`, `audio_pause_recording`, `audio_resume_recording`,
`audio_stop_recording`, and `audio_cancel_recording` return recording state.
- `audio_get_active_recording` returns the scoped active state or `null`.
- `audio_list_recordings` returns all recording states in the launch scope.
- `audio_delete_recording` returns
`{ "recordingId": "...", "deleted": true }`. An active recording must first
be stopped or cancelled, and a recording leased by a transcription job cannot
be deleted yet.
The response never includes audio bytes or a local path. Only one recording can
be active in the app. A global host control remains available if the extension
iframe is minimized. State changes arrive through
`audio-capture-state-changed`; its payload contains `sequence`, the scoped IDs,
and the latest `state` object.
## Transcription Commands
These commands require `transcribe_audio`:
- `transcription_list_providers`
- `transcription_start`
- `transcription_get`
- `transcription_cancel`
- `transcription_delete`
`transcription_list_providers` returns only speech-to-text models linked to the
exact launch group. Provider credentials and local model paths are removed:
```json
[
{
"id": "model:...",
"name": "ggerganov/whisper.cpp · ggml-small",
"providerKind": "localWhisper",
"location": "local",
"modelType": "speechToText",
"supportsSpeakerLabels": false
}
]
```
`providerKind` is `localWhisper` or `openAiCompatible`. A listed local provider
is authorized for the group, but its model asset may still be downloading or
not yet downloaded. `supportsSpeakerLabels` describes that exact model
configuration; it is not implied by `providerKind`.
Start request:
```json
{
"recordingId": "opaque-recording-id",
"modelId": "model:...",
"language": "nl",
"prompt": "Optional vocabulary hint"
}
```
`recordingId` and `modelId` are required. Empty optional values are removed;
`language` is limited to 32 characters and `prompt` to 16,000 characters. The
recording must be stopped and belong to the same extension, workspace, and
group.
Start response:
```json
{
"jobId": "transcription-...",
"status": "queued"
}
```
Persist `jobId` immediately. There is no command that lists transcription jobs,
so it is required to recover state after the extension iframe is remounted.
### Local model download handshake
The first `transcription_start` for a local provider also verifies the model
asset. When the host starts downloading it, the bridge rejects before creating
a job with the plain error message `transcription_model_downloading`. Keep the
recording, show a waiting state, and retry that same request after a short delay.
There is currently no public download-progress event.
`transcription_model_not_downloaded` means the host could not establish a
downloaded or downloadable model and should be surfaced as a terminal setup
problem. `transcription_model_unavailable` means the model is no longer present
in the frozen launch group's resources. Refresh the provider list after group
or dashboard changes and when the extension becomes visible again.
### Remote provider consent
An OpenAI-compatible provider opens a host confirmation for every start. If the
user declines, the bridge rejects with `external_transcription_cancelled` and no
job is created. Consent fields, provider endpoints, and API keys sent by an
iframe are ignored. The host resolves credentials and binds its single-use
consent token to the exact extension, scope, recording, and model.
### Speaker-aware remote providers
Provider request behavior is host-owned. An extension selects an authorized
`modelId`; it cannot inject a response format, chunking mode, endpoint, or
provider-specific multipart field into `transcription_start`.
An OpenAI-compatible speech-to-text model can be configured by a workspace
administrator with:
```json
{
"transcription": {
"responseFormat": "diarized_json",
"chunkingStrategy": "auto"
}
}
```
The host then advertises `supportsSpeakerLabels: true` for that provider, asks
for diarized output, and preserves each returned opaque speaker key on
`segments[].speaker`. Extensions may display or explicitly map those keys, but
must not infer a real identity from a label such as `A`.
When the host must divide one recording into independent provider uploads, it
scopes returned speaker keys to their upload part before merging results.
Provider-local labels are not assumed to identify the same person across
separate uploads.
### Query, cancel, and delete
All job commands use `{ "jobId": "transcription-..." }`.
`transcription_get` returns:
```json
{
"job": {
"id": "transcription-...",
"sourceId": "recording-...",
"modelId": "model:...",
"providerKind": "localWhisper",
"status": "completed",
"phase": "completed",
"progressPct": 100,
"segmentCount": 1,
"requestedLanguage": "nl",
"detectedLanguage": "nl",
"errorCode": null,
"errorMessage": null,
"createdAt": "2026-07-22T19:01:00Z",
"updatedAt": "2026-07-22T19:01:08Z",
"completedAt": "2026-07-22T19:01:08Z"
},
"result": {
"id": "transcription-result-...",
"jobId": "transcription-...",
"sourceId": "recording-...",
"modelId": "model:...",
"providerKind": "localWhisper",
"text": "Welkom bij de vergadering.",
"language": "nl",
"durationMs": 8000,
"segments": [
{
"index": 0,
"startMs": 0,
"endMs": 8000,
"text": "Welkom bij de vergadering.",
"speaker": null,
"confidence": null
}
],
"createdAt": "2026-07-22T19:01:08Z"
}
}
```
Job statuses are `queued`, `running`, `completed`, `failed`, `cancelled`, and
`interrupted`. Phases are `queued`, `openingRecording`, `preparingModel`,
`transcribing`, `finalizing`, `completed`, `failed`, and `cancelled`. A result is
`null` until the job completes.
`transcription_cancel` is idempotent for terminal jobs and returns the job.
`transcription_delete` accepts terminal jobs only and returns
`{ "deleted": true, "jobId": "..." }`. Cancel a running job before deleting it.
### Transcription events and errors
The four browser events are `transcription-progress`,
`transcription-segment`, `transcription-completed`, and `transcription-failed`.
Their common payload is:
```json
{
"extensionId": "meeting-warden",
"workspaceId": "workspace:...",
"groupId": "group:...",
"jobId": "transcription-...",
"status": "running",
"phase": "transcribing",
"progressPct": 45,
"segmentCount": 1,
"errorCode": null,
"errorMessage": null,
"segment": null
}
```
Only `transcription-segment` carries a segment. Treat events as hints: an iframe
can miss them while minimized, closed, or remounted, so reconcile each relevant
event and restored `jobId` with `transcription_get`. Failed job views and events
include a host-safe `errorMessage` in addition to the stable `errorCode`.
Host-command failures serialize `{ "code", "message", "retryable" }` using
snake_case codes. The current codes are `cancelled`,
`external_consent_required`, `group_required`, `internal`, `invalid_request`,
`invalid_state`, `model_download_required`, `model_not_available`,
`permission_denied`, `provider_error`, `provider_unavailable`, `scope_mismatch`,
`source_not_found`, and `unsupported_audio`.
The serialized object is normally carried inside the bridge `Error.message`.
Bridge preflight failures described above are plain message sentinels, so robust
code should normalize the message and must not assume every rejection has an
`error.code` field.
## Private localstorage API
The manifest `storage` permission enables asynchronous `localstorage_get`, `localstorage_put`, `localstorage_delete`, and `localstorage_list`. Values are JSON. Reads return a value or `null`, mutations return `{ok:true}`, and lists return `{key,value}` entries. No old command aliases exist.
```js
await bridge.localstorage_put({ key: 'recovery-draft', value: { text: 'draft' } });
const draft = await bridge.localstorage_get({ key: 'recovery-draft' });
await bridge.localstorage_put({ key: 'preferences', value: { compact: true }, sync: true });
const preferences = await bridge.localstorage_get({ key: 'preferences', sync: true });
const settings = await bridge.localstorage_list({ prefix: 'pref', sync: true });
await bridge.localstorage_delete({ key: 'preferences', sync: true });
```
`sync` defaults to `false`: the host persists private local keys by account/profile and extension. Synced keys additionally belong to the authenticated dashboard user, workspace, group, and extension record. Scope comes from the host; extensions cannot supply identity overrides. The local and synced namespaces are independent; changing `sync` does not migrate values. Use one mode consistently for each setting.
Synced reads query the dashboard first and cache acknowledged values, including absence. Connectivity failures may use confirmed cached reads while host session/context remains valid; lists require a confirmed complete result for the requested prefix. Authentication, permission, revocation, and malformed-response errors reject without cache fallback. Offline caches cannot discover revocations made while disconnected. Writes and deletes require online dashboard acknowledgment, reject on failure, and never queue offline writes. Surface rejected persistence promises to the user.
This API is distinct from browser `window.localStorage`, which opaque extension frames cannot access, and from `filesystem_*` or `atomic_json_*`, which manage project files. Keep recovery drafts, queues, and migration journals local; shared project documents belong in dashboard-backed file persistence.
@@ -0,0 +1,61 @@
# Native bridge contract
Transport for native bridge calls uses `stdio-json-v1`.
Inside `args.request`, ISA Warden currently documents a `native-json` envelope.
### 8.1 Request frame
```json
{
"protocol": "native-json",
"id": "req-1",
"type": "request",
"method": "task.start",
"params": { "job": "demo" }
}
```
### 8.2 Response frame
```json
{
"protocol": "native-json",
"id": "req-1",
"type": "response",
"result": { "taskId": "task-123" }
}
```
### 8.3 Event frame
```json
{
"protocol": "native-json",
"type": "event",
"event": "task.progress",
"taskId": "task-123",
"data": { "progress": 40 }
}
```
### 8.4 Error frame
```json
{
"protocol": "native-json",
"id": "req-1",
"type": "error",
"error": "invalid params"
}
```
### 8.5 Native function naming
Use stable namespaced function names.
Examples already in the repo:
- `hello.native_server`
- `data_warden.native_server`
- `rsx.create_project`
@@ -0,0 +1,56 @@
# Threads and conversation model
Thread-related behavior is implemented in [`chat-ui-3/src-tauri/src/extensions/commands.rs`](../../src-tauri/src/extensions/commands.rs:974).
### 9.1 General host threads
Use:
- [`extension_new_thread()`](../../src-tauri/src/extensions/commands.rs:1173)
- [`extension_get_thread_list()`](../../src-tauri/src/extensions/commands.rs:974)
- [`extension_get_full_thread_object()`](../../src-tauri/src/extensions/commands.rs:1152)
- [`extension_update_thread()`](../../src-tauri/src/extensions/commands.rs:1207)
These represent host-owned chat threads.
### 9.2 Extension-scoped threads
Use:
- [`extension_create_extension_thread()`](../../src-tauri/src/extensions/commands.rs:1111)
- [`extension_list_extension_threads()`](../../src-tauri/src/extensions/commands.rs:1064)
Extension-scoped threads require `extensionContext`.
The browser host adds the frozen `workspaceId`, `groupId`, and calling
`extensionId` to that context. Values supplied by iframe code for those fields
are ignored. Listing and deletion therefore match only threads in the same
extension launch scope.
### 9.3 Required `extensionContext` fields
Validated by [`ensure_extension_thread_context_defaults()`](../../src-tauri/src/extensions/commands.rs:1612):
- `appName`
- `threadKind`
- `entityType`
- `entityId`
Host-controlled:
- `extensionId`
- `workspaceId`
- `groupId`
Optional:
- `hiddenFromMainThreadList`
`hiddenFromMainThreadList` defaults to `true` in [`ensure_extension_thread_context_defaults()`](../../src-tauri/src/extensions/commands.rs:1675).
### 9.4 Hidden extension threads
General thread listing excludes hidden extension threads using [`is_hidden_extension_thread()`](../../src-tauri/src/extensions/commands.rs:1593).
### 9.5 Returned thread identifiers
Serialized thread responses include `threadId` through [`serialize_thread_with_flat_id()`](../../src-tauri/src/extensions/commands.rs:1714).
@@ -0,0 +1,36 @@
# Documents and retrieval model
Documents in the extension system fall into two categories.
### 10.1 Thread-attached documents
Chat retrieval works against thread-attached files.
The retrieval settings struct is [`DocumentRetrievalSettings`](../../src-tauri/src/commands/stream_chat_command.rs:63):
```json
{
"maxChunks": 8,
"taggedFiles": ["opaque-document-id"]
}
```
Only files attached to the thread are accepted by [`validated_tagged_files()`](../../src-tauri/src/commands/stream_chat_command.rs:71) unless a specialized path explicitly provides a different mapping.
### 10.2 Document snapshots for retrieval/search
Invoke `upsert_document_snapshot` with `threadId`, the selected `modelId`, a display-only `documentName`, `content`, and optional `maxChunkSize`. Create the scoped extension thread before preparing the snapshot. The host validates its immutable launch workspace/group and extension ownership, then routes processing according to the selected model's execution location.
The reply includes opaque `documentId` and `documentName` references, `threadId`, `modelId`, processing state and display metadata. Attach that opaque reference to the same thread and use it in `taggedFiles`. Native local snapshots use the shared document processor and scoped native identity registry. Remote snapshots use private dashboard attachments and dashboard processing. Sources and indexes expire under the workspace retention policy.
`get_document_snapshot` validates an existing reference and returns its current thread/model scope and readiness. `delete_document_snapshot` accepts the opaque reference as `documentName`; the host removes only that extension's authorized snapshot, without deleting a shared group original. Cache entries must match both the conversation and selected model before reuse.
### 10.3 Important rule
Being present in vector storage does not automatically make a document part of every chat. Retrieval still depends on how the thread and request identify allowed files.
### 10.4 Dashboard conversation documents
Dashboard chat accepts opaque `StreamChat.attachment_ids`, resolved against server-owned `conversation_document` records for the authenticated owner, selected workspace/group and conversation. Canonical list/read/search executors receive only this captured scope and recheck current authorization during execution. A display name is used only to resolve an unambiguous already-authorized document. Uploading a private chat attachment does not grant an extension access to that attachment or create a browsable group file.
Use `ProcessConversationAttachment` with `workspace_file_id`, workspace/group/conversation and an expected sync revision to ingest an already-authorized group file without a desktop download. The resulting `document_id` belongs to this conversation; the source artifact remains a persistent workspace-file generation. Existing extension filesystem grants and launch scope continue to govern access to group sources.
@@ -0,0 +1,74 @@
# Persistence and database strategy
Extensions must follow a layered persistence model.
### 11.1 Default rule
Do not introduce a custom extension-owned database unless host storage and thread/document APIs are insufficient.
### 11.2 Storage hierarchy
#### A. Ephemeral UI state
Use in-memory UI state only.
Examples:
- active tab
- filter toggles
- selection state
#### B. Small extension-owned persistent data
Use the host `localstorage_*` commands: [native storage](../../src-tauri/src/extensions/storage.rs) or the [browser localstorage adapter](../../src/lib/platform/web/extension-localstorage.ts). Local keys retain device-local semantics; `sync: true` keys use authenticated dashboard settings. Neither is canonical dashboard project storage.
Commands:
- `localstorage_put`
- `localstorage_get`
- `localstorage_delete`
- `localstorage_list`
Rules:
- local storage is isolated by host account/profile and extension ID; optional `sync: true` settings additionally use authenticated dashboard user, workspace, group, and extension scope
- local and synced keys are independent; see [private localstorage API](07-host-command-api-reference.md#private-localstorage-api) for cache and online write rules
- use this for small configuration and lightweight persistent state
The separate browser `storage_*` commands use the [draft storage adapter](../../src/lib/platform/web/extension-storage.ts). This adapter keeps bounded JSON values in host-owned account-scoped local storage, with a 4 MiB extension limit and explicit storage-denial/quota errors. It works independently of the chat worker lock. Reload preserves values; an account-local browser reset removes only that account's preferences, conversation database and extension drafts. It preserves other accounts and server project files. Extension frames do not receive direct access to the host's storage, session or credentials. Check the advertised storage commands before use.
#### C. Host-owned conversational/workspace state
Use thread commands when the data belongs to chat or workspace interaction state.
#### D. Dashboard-backed extension project state
Use the host filesystem bridge for canonical extension-owned data that must be shared through a dashboard. Follow [Dashboard-backed extension project sync](20-dashboard-backed-project-sync.md); device-local extension storage must not become a fallback source of truth for shared projects.
Browser dashboard file writes use online confirmation. A file's syncable metadata does not create a browser offline queue or turn device-local drafts into accepted shared data. Native offline/RIBLT behavior is a separate host capability. Browser upload/delete/atomic-write adapters remain subject to gateway enablement and the outstanding live storage/authorization tests described in the [cloud write plan](../../../plans/cloud-extension-write-support.md).
#### E. Searchable document memory
Use [`extension_upsert_document_snapshot()`](../../src-tauri/src/extensions/commands.rs:1311) for retrieval-oriented text snapshots.
#### F. Custom native database
Only use a custom native DB when the extension has complex domain persistence requirements that cannot be reasonably expressed through host storage layers.
### 11.3 Custom database requirements
If an extension uses its own database, its documentation must define:
- why host persistence is insufficient
- engine choice
- file location
- schema versioning strategy
- migration strategy
- reset behavior
- uninstall behavior
- backup/export expectations
- scope rules for user, workspace, and entity ownership
Extension documentation must explicitly address schema drift and stale datastore risks.
Legacy unscoped native values remain in the offline profile namespace. They are not assigned to an arbitrary dashboard account; authenticated local values are isolated by dashboard origin and account. Changing `sync` never migrates values between namespaces.
@@ -0,0 +1,77 @@
# Rights-aware dashboard resource access
Dashboard resources are exposed through [`GetAvailableResourcesReply`](../../../isa_dashboard/isa_dashboard_proto/proto/isa_dashboard.proto:104) and surfaced in [`get_available_resources()`](../../src-tauri/src/dashboard_commands/get_available_resources.rs:21).
Current resource classes include:
- workspaces
- members
- models
- agents
- tools
- servers
- pending invites
Workspace-level data also includes:
- permission definitions
- current user permissions
### 12.1 Effective permission model
Permissions are defined in [`isa_dashboard/isa_dashboard_server_lib/src/routes/permissions.rs`](../../../isa_dashboard/isa_dashboard_server_lib/src/routes/permissions.rs) and enforced through [`require_permission()`](../../../isa_dashboard/isa_dashboard_server_lib/src/routes/permissions.rs:175).
Examples include:
- `manage_workspace`
- `manage_roles`
- `invite_users`
- `manage_users`
- `manage_groups`
- `manage_group_members`
- `manage_models`
- `manage_agents`
- `manage_tools`
- `manage_extensions`
- `manage_servers`
- `link_resources`
- `view_feedback`
- `delete_feedback`
### 12.2 Delegated user authority rule
Extensions must operate inside the authority of the current user.
An extension must not be treated as independently privileged.
Runtime access should be understood as:
```text
allowed = user_has_rights
AND resource_is_visible_in_context
AND extension_manifest_declares_capability
AND host_policy_allows_extension_use
```
### 12.3 Tools, servers, and future MCP
The dashboard model already includes tools and servers in workspace resources.
Extensions should only be allowed to use resources that are visible and allowed for the current user and workspace context.
If future extension-facing MCP/server invocation APIs are introduced, they must follow the same delegated-user authority model.
### 12.4 Model recommendation authority
Model recommendations do not grant authority to an extension. During the
dashboard add flow, the acting administrator still needs `manage_extensions`
to create the extension and `manage_models` to create selected missing models.
Linking either resource to a group requires `link_resources` or the
corresponding group `manage_resources` authority.
Every selected missing recommendation is first created in workspace inventory
with no group links. The extension may be linked to the current group while its
model remains workspace-only. Runtime access must therefore use the exact
launch group's authorized resources and must never treat a recommendation as
permission or as a workspace-wide fallback. See
[Model recommendations](21-model-recommendations.md#219-administrator-permissions-and-follow-up).
@@ -0,0 +1,40 @@
# Dashboard distribution and marketplace expectations
Marketplace and distribution architecture is described in [`docs/marketplace_spec.md`](../../../docs/marketplace_spec.md:1).
This extension specification treats distribution as a governance and lifecycle layer on top of runtime packaging.
### 13.1 Documentation requirements for distributed extensions
Distributed extensions must clearly disclose:
- publisher/author identity
- version and compatibility
- requested permissions
- whether native code is included
- whether email send is used
- whether dashboard resources are used
- every required or recommended model, its external source, and why it is used
- whether tools/servers/MCP-like resources are used
- persistence behavior
- data retention and uninstall behavior
For model recommendations, publishers must also disclose that model records
are added to workspace inventory, group linking and local file download remain
separate administrator actions, local model licensing and device requirements,
remote-provider data handling and costs, and that uninstalling the extension
does not remove provisioned models. Follow
[Model recommendations](21-model-recommendations.md).
### 13.2 Lifecycle topics that must be documented
- publication
- review/approval
- installation scope
- updates
- revocation
- audit logging
### 13.3 Trust model
When dashboard distribution is used, package identity, signing, and update continuity must be treated as first-class concerns, consistent with the goals described in [`docs/marketplace_spec.md`](../../../docs/marketplace_spec.md:29).
@@ -0,0 +1,303 @@
# Strict styling requirements
Extensions must follow the ISA Warden design system as closely as possible.
### 14.0 Extension styling platform
ISA Warden now exposes a small extension styling platform for iframe content:
- shared starter stylesheet: [`extensions/shared/isa-extension-theme.css`](../../extensions/shared/isa-extension-theme.css)
- shared theme helper: [`extensions/shared/isa-extension-theme.js`](../../extensions/shared/isa-extension-theme.js)
- shared notification stylesheet: [`extensions/shared/isa-extension-notifications.css`](../../extensions/shared/isa-extension-notifications.css)
- shared notification state and error helpers: [`extensions/shared/isa-extension-notifications.js`](../../extensions/shared/isa-extension-notifications.js)
- host theme event: `theme:changed`
- bridge helpers: `window.isaExtensionBridge.getTheme()`, `window.isaExtensionBridge.onThemeChanged(callback)`, and `window.isaExtensionBridge.applyHostThemeClasses(themeState)`
Recommended extension entry setup:
```html
<link rel="stylesheet" href="../shared/isa-extension-theme.css" />
<link rel="stylesheet" href="../shared/isa-extension-notifications.css" />
<script type="module">
import { initHostThemeBridge } from '../shared/isa-extension-theme.js';
initHostThemeBridge();
</script>
```
Packaged extensions may copy these shared files into their package if the relative path differs. Keep the filenames and public API unchanged when possible so examples remain portable.
The host sends this theme payload to extension iframes when the iframe loads and when the host theme changes:
```json
{
"theme": "dark",
"effectiveTheme": "dark",
"systemPrefersDark": true,
"designTokenVersion": 1,
"designTokens": {
"--isa-extension-panel-bg": "rgb(17 24 34 / 0.96)",
"--isa-extension-panel-text": "rgb(248 250 252 / 0.97)"
}
}
```
Extension code should treat `designTokens` as the stable styling contract. The token names are extension-facing compatibility names, even when their values are sourced from host-internal CSS variables.
Payload values are self-contained: a value may be concrete CSS or reference
another `--isa-extension-*` token, but it must never reference host-private
variables such as `--brand-*` or `--color-*`. The shared theme helper rejects
non-portable values and removes previously applied inline tokens when a later
theme payload omits them, allowing the stylesheet fallback for the active theme
to take effect again.
Use these starter classes before adding local primitives:
- `isa-extension-shell`
- `isa-extension-panel`
- `isa-extension-card`
- `isa-extension-heading`
- `isa-extension-muted`
- `isa-extension-button`, `isa-extension-button--primary`, `isa-extension-button--danger`, `isa-extension-icon-button`
- `isa-extension-input`, `isa-extension-textarea`, `isa-extension-select`, `isa-extension-label`
- `isa-extension-modal-backdrop`, `isa-extension-modal`
- `isa-extension-notice`, `isa-extension-notice--success`, `isa-extension-notice--warning`, `isa-extension-notice--error`
- `isa-extension-badge`
- `isa-extension-table`
- `isa-extension-prose`
Extension-local CSS should consume `--isa-extension-*` variables for shell, panel, card, text, border, focus, action, radius, and shadow roles. Domain-specific colors may still be added, but they must be defined as local tokens and remain isolated to domain-specific UI.
### 14.1 Design-system-first rule
Before adding local styling, extension authors must:
1. reuse an existing semantic class from [`chat-ui-3/src/app.css`](../../src/app.css)
2. reuse an existing token from [`chat-ui-3/src/app.css`](../../src/app.css)
3. extend a nearby semantic pattern
4. only then add extension-local styling
Custom styling is the exception, not the default.
### 14.2 Required surface rules
Use these host surface patterns where possible:
- [`app-shell-panel`](../../src/app.css:991) for main panel surfaces
- [`app-shell-card`](../../src/app.css:1050) for card surfaces
Do not create a separate panel/card visual system when these fit the use case.
### 14.3 Border radius rules
Use host radius tokens and semantic utilities:
- [`radius-panel`](../../src/app.css:2306)
- [`radius-control`](../../src/app.css:2310)
Rules:
- panels, cards, and modal shells must use panel radius semantics
- inputs, buttons, icon buttons, selectors, and similar controls must use control radius semantics
- hardcoded radius values for standard components are forbidden unless a documented exception exists
### 14.4 Button rules
Use shared button styles where applicable:
- [`btn-primary`](../../src/app.css:1958)
- [`btn-secondary`](../../src/app.css:2000)
- [`btn-outline`](../../src/app.css:2019)
- [`btn-ghost`](../../src/app.css:2050)
Do not create a second generic button system for standard actions.
### 14.5 Form and control rules
Use shared control patterns, including:
- [`form-select`](../../src/app.css:1733)
- shared control border/radius/focus treatment near [`chat-ui-3/src/app.css`](../../src/app.css:1749)
Inputs, selects, and textareas must align with host focus, disabled, error, and success treatment.
### 14.6 Selector and flyout rules
Use the selector system where the control is selector-like:
- [`selector-trigger`](../../src/app.css:5737)
- [`selector-flyout-surface`](../../src/app.css:5812)
- [`selector-flyout`](../../src/app.css:5825)
Do not create a separate dropdown/flyout visual system when the selector system fits.
### 14.7 Modal rules
Use shared modal shells and surfaces where applicable:
- [`modal-content`](../../src/app.css:2563)
- [`modal-shell`](../../src/app.css:2590)
- [`modal-close-button`](../../src/app.css:2669)
- [`modal-section`](../../src/app.css:2761)
- [`modal-section-subtle`](../../src/app.css:2773)
- [`modal-surface-panel`](../../src/app.css:2846)
Do not hand-roll modal shells when host modal primitives fit the use case.
### 14.8 Color rules
Rules:
- use semantic tokens and shared class colors from [`chat-ui-3/src/app.css`](../../src/app.css)
- do not hardcode standard text, surface, border, or button colors when shared tokens/classes already cover the need
- brand-specific colors are only allowed where there is a genuine product or domain reason and accessibility remains valid
### 14.9 Dark and light mode requirements
Every extension UI must support both themes.
Verify:
- text contrast
- icon contrast
- border visibility
- hover and focus states
- selected and disabled states
### 14.10 Prohibited styling patterns
Extensions must not:
- create a parallel generic button system when host buttons fit
- create a separate dropdown/flyout system when selector primitives fit
- hardcode standard border radii
- hardcode standard surface/text colors without need
- create a modal shell from scratch when shared modal primitives fit
- assume only one theme exists
### 14.11 Notifications and transient messages
Every extension must use the framework-neutral shared notification contract:
- state and error helpers: [`extensions/shared/isa-extension-notifications.js`](../../extensions/shared/isa-extension-notifications.js)
- canonical layout and appearance: [`extensions/shared/isa-extension-notifications.css`](../../extensions/shared/isa-extension-notifications.css)
Import the stylesheet after `isa-extension-theme.css` and mount exactly one
notification centre at the extension application root. A modal, route, panel, or
individual workflow must publish to that root-owned centre; it must never mount a
second local stack. The shared stylesheet fixes the stack to the bottom-right,
accounts for safe-area insets, switches to a responsive mobile inset, bounds and
scrolls long stacks, and supplies semantic tone, countdown, focus, and
reduced-motion styles.
The shared JavaScript module exports:
```js
MAX_NOTIFICATION_COUNT;
NOTIFICATION_TIMEOUT_MS;
NOTIFICATION_EXIT_DURATION_MS;
NOTIFICATION_DISMISS_DELAY_MS;
getNotificationTone(kind, message);
appendNotification(notifications, candidate, options);
dismissNotification(notifications, notificationId);
dismissNotificationsByKey(notifications, notificationKey);
normalizeExtensionError(error, { fallback });
```
Notification renderers use this complete, framework-neutral record:
```js
const notification = {
id,
key,
tone,
title,
message,
detail,
action,
actionLabel,
createdAt,
timeoutStartedAt
};
```
When `id`, `createdAt`, or `timeoutStartedAt` is omitted,
`appendNotification` generates it. `title` remains empty when omitted so the
renderer can supply a localized title for the semantic tone.
`appendNotification` caps the list at 20 by default, suppresses an adjacent
unkeyed duplicate, and updates a keyed notification in place. Use a stable `key`
for durable operational conditions such as a remote project update. Restart the
dismiss timer when a keyed record receives a new `timeoutStartedAt`. Begin exit
styling after `NOTIFICATION_DISMISS_DELAY_MS`, then remove the record after
`NOTIFICATION_EXIT_DURATION_MS`.
Use the shared classes as the renderer contract:
- `.isa-extension-notification-center`
- `.isa-extension-notification-header`
- `.isa-extension-notification-clear`
- `.isa-extension-notification-list`
- `.isa-extension-notification` with `data-tone="success|warning|error|info"`
- `.isa-extension-notification-icon`
- `.isa-extension-notification-content`
- `.isa-extension-notification-title`
- `.isa-extension-notification-message`
- `.isa-extension-notification-detail`
- `.isa-extension-notification-action`
- `.isa-extension-notification-dismiss`
- `.isa-extension-notification-timer`
Set `data-transition-managed="true"` when the renderer supplies its own enter
and exit transition; otherwise the shared stylesheet supplies the default enter
animation.
Set `role="alert"` and an assertive live region only for errors. Use
`role="status"` and polite announcements for all other tones. Notifications must
not steal focus. The clear control clears the complete stack; dismiss controls
remove one record. Recovery actions stay inside the relevant notification and
are executed by the extension renderer.
Call `normalizeExtensionError` before presenting caught host or bridge errors.
It recursively unwraps JSON serialized into `Error.message` and returns only
`{ code, message, retryable }`. Translate known error codes into concise,
extension-local copy and pass translated fallback copy:
```js
const normalized = normalizeExtensionError(error, {
fallback: translate('errors.unexpected')
});
const message = translateKnownErrorCode(normalized.code) || normalized.message;
notifications = appendNotification(notifications, {
tone: 'error',
title: translate('notifications.error'),
message
});
```
Never display a serialized error object as the notification message. Unknown
technical detail may be placed in `detail` when it helps recovery, but the
primary `message` must remain readable.
Keep field validation, typed-confirmation errors, loading/progress, empty states, and durable sync or storage-health status next to the control or surface they describe. These are contextual states, not transient notifications. A general operation failure may also create a notification, but do not duplicate the same text both inline and in the notification centre.
Operational outcomes such as save, delete, import, export, archive, restore,
recording, transcription, and analysis success or failure belong in the root
notification centre. Contextual state that remains true without a recent
operation belongs inline. Do not show the same message both inline and as a
notification.
Use only shared `--isa-extension-*` tokens for notification styling. The
implementation in
[`isa-match-rsx-to-quote`](https://git.isawarden.com/ISAWarden/isa-match-rsx-to-quote/src/branch/main/src/svelte-ui/components/NotificationCenter.svelte)
remains the Svelte reference, but new extensions must consume the shared
framework-neutral files instead of copying its local implementation.
### 14.12 Host styling with `mod`
The iframe design-token contract remains the required styling path for normal extensions. Without the explicit `mod` permission, extension CSS is isolated to its iframe and must not style or add UI to the parent application.
A mod may apply application-wide styling only from its separately declared `modEntry` after the host warning has been accepted. Prefer `context.appendStyle(cssText)` and `context.appendRoot('appShell' | 'extensionToolbar')` so contributions are tagged, tracked, and removed on disposal. Use the named mount points rather than locating incidental component internals, and reuse host semantic classes and tokens when the mounted control can do so.
Every direct host mutation must have explicit cleanup through `context.onDispose` or the function returned from `activate`. Event listeners should use `context.addEventListener`, and helper-created styles and roots must not be moved out of their tracked owner. Test cleanup after close and reload as well as light, dark, hover, focus, active, and disabled states.
The permission warning is not styling guidance and does not make host CSS stable or sandboxed. Avoid broad resets, fragile selectors, inaccessible contrast, or changes that obscure the host-owned active-mod indicator and dialogs.
@@ -0,0 +1,47 @@
# Iconography requirements
### 15.1 Preferred icon system
Use [`lucide-svelte`](../../package.json:34) for generic UI iconography.
This keeps extensions visually aligned with the host app.
### 15.2 Shared icon patterns
Relevant host icon patterns include:
- [`icon-btn`](../../src/app.css:2445)
- [`icon`](../../src/app.css:2458)
- [`chat-icons`](../../src/app.css:2464)
- [`panel-icon`](../../src/app.css:1041)
- [`app-shell-sidebar-title-icon`](../../src/app.css:1427)
- [`SidebarGradientIcon`](../../src/routes/components/SidebarGradientIcon.svelte:1)
Use [`SidebarGradientIcon`](../../src/routes/components/SidebarGradientIcon.svelte:1) for sidebar and title-style gradient icon treatment when matching host patterns.
Extension authors choose the launchpad icon through the manifest `icon` field. Prefer a supported Lucide name for a product concept and use a packaged SVG, PNG, JPG, or JPEG only for brand identity or a domain-specific visual. See the [manifest icon contract](04-manifest-specification.md#421-extension-icon).
### 15.3 Accessibility rules for icons
- decorative icons must be hidden from assistive technology or placed in a decorative context
- icon-only buttons must provide `aria-label`
- icons must not be the only carrier of critical meaning
### 15.4 Size guidance
Prefer a small shared scale unless a component pattern already defines the size:
- 14px for compact inline/status icons
- 16px for standard actions
- 18px for common section/header icons
- 20px to 24px for emphasis, summary, or hero-style icons
### 15.5 Custom SVG policy
Custom SVGs are allowed for:
- brand identity
- model/provider/resource logos
- domain-specific visuals not well represented by Lucide
Custom SVGs are not preferred for generic actions like close, save, delete, refresh, open, search, or settings.
@@ -0,0 +1,12 @@
# AI generation rules
AI systems generating extensions should follow these defaults:
1. Default to Svelte UI.
2. Default to Rust native logic when native code is needed.
3. Default to host bridge APIs before inventing custom services.
4. Default to minimal permissions.
5. Default to shared semantic styling primitives.
6. Default to Lucide-based iconography.
7. Default to extension storage and host thread/document APIs before creating a custom database.
8. Treat custom DBs, custom icon systems, and major visual divergence as exception-only decisions that require explicit justification.
@@ -0,0 +1,123 @@
# Validation Checklist
For an extension that declares `modelRecommendations`, first follow the
end-to-end procedure in
[Model recommendations](21-model-recommendations.md#2111-validation-before-publication).
Packaging:
- Run the extension root `npm run build`.
- Confirm `dist/<id>.isax/extension.json` exists.
- Confirm `dist/<id>.isax/payload.tar.xz` exists.
- Confirm the distribution `payloadSha256` matches the packaged payload.
- If the source requests `mod`, confirm the package-root manifest contains the normalized `permissions` and exact `modEntry`, and confirm the payload contains that module.
- Confirm `payload.tar.xz` does not contain `extension.json`.
- For local dashboard registration, select the final `.isax` directory with
Browse and confirm it contains regular `extension.json` and
`payload.tar.xz` files. Confirm a package with either file missing, a wrong
suffix, a payload digest mismatch, links, traversal entries, or an invalid
install manifest is rejected before upload.
- Confirm the local flow uploads the payload as an artifact with resource type
`extension` and that installation resolves a fresh permission-checked signed
link rather than persisting one.
- If the source manifest has `modelRecommendations`, confirm the validated
`schemaVersion: 1` block is present inline in the distribution
`extension.json`.
- Confirm recommendations use unique portable keys, supported model types,
valid source/location combinations, HTTPS or loopback URLs, safe relative
output paths, and no credential fields.
- Confirm `normalHttp.autoDownload` is absent or `false` and every
`openAICompatibleAPI` source omits `apiKey`.
Before shipping an extension or documenting a new capability, verify:
- Manifest parses and the entry file exists.
- Declared native assets exist.
- Only required permissions are requested.
- A `mod` extension has one existing safe relative `modEntry`; a non-mod extension has no `modEntry`.
- The mod script registers its exact extension ID exactly once, synchronously, and keeps the iframe entry usable when activation is declined.
- Mod styles, roots, direct DOM state, and listeners are removed after reload, close, update, activation failure, and replacement.
- Helper-created host contributions use `appendStyle`, `appendRoot`, or `addEventListener`; every remaining direct host mutation has registered or returned cleanup.
- Automatic installation leaves the host module inert until an interactive activation acknowledgement.
- Normal bridge traffic cannot invoke the host loader, access the parent document, or create host contributions.
- Host mod UI uses documented mount points, does not hide the host warning/status, and has usable light, dark, hover, focus, active, and disabled states.
- Implemented APIs match the real host dispatcher.
- `get_app_info` advertises the filesystem commands the extension uses.
- Extension storage uses `ensureGroupFolder()` only when group-shared storage is
needed.
- Existing workspace files are accessed only after `openWorkspaceFile()` or
`openWorkspaceFolder()` returns a local grant.
- Read-only grants reject upload, replacement, and delete.
- Syncable files are written below the returned extension group folder with
`metadata.syncable = "true"`.
- The extension does not implement its own offline sync for syncable files.
- Dashboard-backed project files follow
[the project-sync standard](20-dashboard-backed-project-sync.md), omit
`metadata.syncable` unless offline editing is an explicit requirement, and
reconcile incoming canonical changes while mounted.
- Canonical inventory preserves unavailable/invalid outcomes and never treats
them as confirmed remote deletion.
- Local grants can be revoked in Settings and access stops after revocation.
- Project pickers check `get_app_info.projects.commands`; archive and restore
are shown only when `projects_set_archived` is advertised.
- The default project list hides archived projects. Archive management calls
`projects_list` with `includeArchived: true` and distinguishes `archived`
projects from deleted or unknown ids.
- Project archive and restore are idempotent, preserve the stable project id,
and never delete, move, or orphan extension-owned project files.
- Audio extensions request `audio_capture`, survive iframe minimization, and
expose a working host-level stop control.
- The extension checks `get_app_info.audioCapture` and
`get_app_info.transcription` before showing media actions.
- The microphone grant is host-owned and revocable; revocation stops an active
recording for that extension.
- Audio responses, events, shared files, logs, and project metadata contain no
audio bytes or local audio paths.
- Missing launch groups and empty speech-to-text provider lists produce clear
unavailable states without a workspace-wide model fallback.
- First-use local model download handles only `transcription_model_downloading`
as retryable waiting; `transcription_model_not_downloaded` is surfaced.
- The job ID is persisted immediately, restored views call `transcription_get`,
and event listeners are removed when the view is disposed.
- `failed`, `cancelled`, and `interrupted` jobs are handled, active jobs are
cancelled before deletion, and only terminal jobs are deleted.
- Remote transcription requires host confirmation for every job and never
trusts iframe-provided consent, endpoint, or API-key values.
- Speech-to-text models are resolved only from the exact launch group; there is
no workspace-wide fallback.
- Transcript/project persistence succeeds durably before local audio cleanup.
- Light and dark themes both work.
- One notification centre is mounted at the extension root and imports the
shared `isa-extension-notifications.js` and `.css` contracts.
- Operational messages appear only in the root notification centre; contextual
validation, progress, empty, and durable status remain inline.
- The same outcome is not duplicated inline and in a notification, notification
history is bounded/deduplicated, and keyed conditions update in place.
- Error notifications pass caught values through `normalizeExtensionError`;
known error codes are translated and serialized JSON is never primary copy.
- Notifications support individual dismiss, clear-all, timeout countdown,
recovery actions, mobile/safe-area layout, and reduced motion.
- Error notifications use alert semantics; all other tones use polite status
semantics and appearing notifications do not steal focus.
- Email payloads use the documented contract only.
- Dashboard distribution metadata and disclosure are complete if the extension
is intended for distribution.
- Required model recommendations cannot be deselected; recommended items can
be toggled individually and selected together.
- Existing recommendation matching uses exact HTTP URL/output or API base
URL/provider-model identity plus compatible model types, never display name.
- Selected missing models are created in workspace inventory with no implicit
group links.
- API keys entered during recommendation review never appear in extension
metadata, stored manifest JSON, logs, or subsequent UI state.
- A required model failure prevents extension creation, leaves the review
retryable, and a retry reuses models created by an earlier partial attempt.
- Adding a `normalHttp` recommendation does not start a model-byte download;
device download and group assignment remain separate actions.
- Recommendation keys are not used as runtime model IDs; the extension
discovers only models authorized for its exact launch context.
- The extension remains usable or shows a clear setup state when no
recommendation is linked to the launch group.
- Documentation tells existing administrators that recommendation changes in
an update are not provisioned automatically and uninstall leaves models in
workspace inventory.
@@ -0,0 +1,81 @@
# Implemented Versus Planned Behavior
ISA Warden extension docs must distinguish active runtime behavior from planned
marketplace or host features.
The general command catalog includes native host behavior. Browser availability is the permission-filtered command list returned for the current verified launch, rather than every command appearing in these chapters.
## Browser parity implementation snapshot
| Area | Implemented source and validation boundary |
| --- | --- |
| Device-local `storage_*` | Origin/account/extension-scoped host storage; real Chromium and Firefox tests cover reload, isolation, quota/denial and account reset. It is not shared project persistence. |
| Group folders, reads and projects | Existing authenticated launch gateway operations with immutable workspace/group/extension scope and current resource checks. |
| Upload/delete/atomic writes | Online adapters reuse dashboard workspace-file/artifact routes; no offline browser success. The launch list includes these commands when the manifest permits them, after the server suite and local authorization-guard test passed. Live two-user visibility, multipart/CAS and cleanup-failure proof remains required. |
| Connection-bound chat, extension threads and direct tools | Shared host/server adapters exist; launch capabilities, current resource access and executor health decide availability. These do not provide durable detached execution. |
| Images and host integration | Verified-package icon resolution, browser clipboard/link handling and supported chat image payloads use host boundaries. Browser filesystem paths, native windows/mods/binaries, audio and cross-root grants remain unavailable. |
The [cloud/native features plan](../../../plans/chat-ui-3/cloud-native-parity/features-plan.md) owns full functional acceptance. Passing local persistence and adapter tests does not prove every live gateway, provider, mail or artifact workflow.
## Native and shared runtime catalog
Implemented runtime behavior documented here:
- Host command invocation through `window.isaExtensionBridge.invoke(...)`.
- Extension app info and capability discovery.
- Extension-owned key/value storage commands.
- Host-mediated local file picking through `open_file_dialog`.
- Group-folder extension storage through `filesystem_ensure_group_folder`.
- User-mediated workspace file and folder grants through
`filesystem_open_workspace_file` and `filesystem_open_workspace_folder`.
- Canonical workspace-file commands using the `filesystem_*` names.
- Active-group shared project discovery, idempotent creation, and reversible
soft archive through `projects_list`, `projects_create`, and
`projects_set_archived`. Project identities remain stable across archive and
restore and are reusable across extensions.
- Syncable extension files under the returned group folder, with host-managed
durable offline queueing, restart-safe reads and lists, reconnect replay for
replacements and new files, and dashboard-confirmed conflict handling. The
folder and read-write grant must already have been provisioned online.
- Desktop microphone capture as opaque host-owned WAV recordings, including
pause/resume, restart recovery, a global stop control, revocable grants, and
local TTL cleanup.
- Batch transcription through exact-group `speechToText` models, using local
Whisper or a host-confirmed OpenAI-compatible provider.
- Version 1 model recommendations in dashboard extension manifests, including
add-flow validation, exact workspace matching, administrator review, and
workspace-only creation through the existing model API.
- Optional speaker-aware segments from configured diarization-capable remote
providers. Support is advertised per transcription model; speaker identities
remain opaque until an extension or user maps them explicitly.
- Host-managed first-use download checks for local transcription models. A model
may be listed before its asset is ready, and the extension retries the
documented download sentinel; download progress is not exposed yet.
- Safe scoped audio, transcription, and filesystem-sync bridge events.
- Explicit `mod` manifests with a separate validated `modEntry`, trusted dashboard distribution cross-checks, interactive host activation warnings, synchronous self-registration, named main-shell mount points, and tracked cleanup for host styles, roots, and listeners.
Planned or intentionally absent behavior:
- Large read-only local download for non-syncable files.
- Extension-owned offline sync queues for files already marked syncable.
- Automatic extension workspace folders at launch.
- Runtime access to arbitrary group-visible files without a local user grant.
- Marketplace policy automation beyond the currently implemented host checks.
- Recommendation bundles for tools, agents, servers, groups, or files.
- Runtime lookup by recommendation key, automatic group linking, automatic
recommendation processing on extension update, and model cleanup on
extension uninstall.
- System/loopback audio, live transcription, local speaker diarization, and
shared raw audio.
- Durable or unattended approval for host-realm mod execution; automatically installed mods remain inactive until acknowledged in the current session.
Restart recovery means recovering persisted recording/job state through query
commands. Active capture is stopped during host shutdown, and unfinished
transcription becomes `interrupted`; inference is not resumed automatically.
When extending this specification:
- Label implemented runtime APIs as implemented.
- Label broader ecosystem ideas as planned or policy guidance.
- Do not present future MCP/server invocation behavior as available unless it is
backed by implemented source.
@@ -0,0 +1,341 @@
# Audio Capture And Transcription
ISA Warden owns microphone capture and transcription so extensions do not need
direct media-device, filesystem, model, or credential access. This capability is
implemented for the Tauri desktop host. The current API is batch-only: record
first, stop the recording, and then start transcription.
## Host and dashboard setup
Before an extension can list a transcription provider, the dashboard must make
one available to its exact launch group:
1. Add a model to workspace inventory with purpose `speechToText`.
2. Link that model explicitly to the group from which the extension is launched.
3. Link a dashboard-installed extension to the same group.
A distributed extension may declare a `speechToText`
[`modelRecommendations`](21-model-recommendations.md) item to help an
administrator create the workspace model during **Add Extension**. That
recommendation does not perform steps 2 or 3, does not download local model
bytes, and does not replace runtime `transcription_list_providers` discovery.
For local Whisper, the dashboard Hugging Face manager's transcription filter
searches automatic-speech-recognition repositories and accepts whisper.cpp GGML
files named like `ggml-small.bin`. These models use `providerKind: "localWhisper"`;
an OpenAI-compatible model uses `providerKind: "openAiCompatible"` and keeps its
endpoint and API key in the host.
A speech-to-text model does not need to appear in the host's normal chat-model
selector. That selector and its vision indicator describe chat capabilities;
`transcription_list_providers` is the authoritative extension inventory.
Dashboard-installed extensions must be linked to the launch group. An
explicitly mounted developer extension is treated as locally trusted during
development and may use that exact group's models without a dashboard extension
record. This exception does not widen workspace or group model visibility.
## Manifest and capability discovery
A record-and-transcribe extension normally declares:
```json
{
"permissions": [
"get_app_info",
"audio_capture",
"transcribe_audio"
]
}
```
Add `filesystem_read` and `filesystem_write` only when derived transcript or
project files must be shared through dashboard-backed group storage.
Check capabilities at runtime:
```js
const bridge = window.isaExtensionBridge;
const appInfo = await bridge.getAppInfo();
if (!appInfo.audioCapture?.enabled) {
throw new Error(appInfo.audioCapture?.disabledReason || 'Audio capture is unavailable');
}
if (!appInfo.transcription?.enabled) {
throw new Error(appInfo.transcription?.disabledReason || 'Transcription is unavailable');
}
```
The host injects and overwrites the extension ID and frozen workspace/group
context for every media command. Never send credentials, consent flags,
workspace IDs, or group IDs from extension code.
## Privacy boundary
Raw audio is local and ephemeral. The host stores a WAV recording below private
app data, gives the extension only an opaque `recordingId`, and never uploads
audio to dashboard workspace files. There is no audio publish/share command and
no API for audio bytes, base64, blob URLs, or local paths.
An extension may share derived text, transcript segments, minutes, and project
metadata through the normal group-scoped filesystem API. Delete the local
recording only after those derived files have been committed durably to the host
sync store. Abandoned recordings expire after 24 hours by default.
For an OpenAI-compatible transcription model, the host asks the user on every
job before sending audio. Approval creates a short-lived, single-use host token
bound to the exact extension, workspace, group, recording, and model. The host
resolves the endpoint and API key; iframe arguments cannot override them or
forge consent. Local Whisper does not send audio off-device.
## Record a meeting
```js
const devices = await bridge.listAudioInputDevices();
const preferredDevice = devices.find((device) => device.isDefault) ?? devices[0];
if (!preferredDevice) throw new Error('No microphone is available');
const recording = await bridge.startRecording({
deviceId: preferredDevice.deviceId,
maxDurationMs: 4 * 60 * 60 * 1000
});
// Keep recording.recordingId in extension state immediately.
// Later, after the user presses Stop:
const stopped = await bridge.stopRecording({
recordingId: recording.recordingId
});
```
The first start opens a host-owned microphone consent dialog. The grant is
stored locally per extension and can be revoked in Settings. Revocation stops
an active recording and blocks future starts.
Only one recording can be active across ISA Warden. Capture continues when the
extension iframe is minimized, and the global recording control lets the user
pause, resume, or stop it. Recording states are `starting`, `recording`,
`paused`, `stopped`, `cancelled`, and `failed`.
Subscribe before starting when possible, and always remove listeners when the
view is disposed:
```js
const unlistenAudio = bridge.on('audio-capture-state-changed', ({ state }) => {
if (state.recordingId === recording.recordingId) renderRecordingState(state);
});
// Retain this function and call it during component teardown.
const disposeAudioListener = () => unlistenAudio();
```
Events are not a state store. On mount, call `getActiveRecording()`,
`listRecordings()`, or `getRecording({ recordingId })` to reconcile anything
that happened while the iframe was absent.
## List providers
```js
const providers = await bridge.listTranscriptionProviders();
// Example descriptor:
// {
// id: 'model:...',
// name: 'ggerganov/whisper.cpp · ggml-small',
// providerKind: 'localWhisper',
// location: 'local',
// modelType: 'speechToText',
// supportsSpeakerLabels: false
// }
```
An empty list means the frozen launch group currently has no authorized
speech-to-text model. Refresh after dashboard/group changes, on window focus or
visibility restoration, and immediately before starting a job. Do not fall back
to a workspace-wide model or another group's model.
Provider listing is authorization discovery, not local download status. A local
model may be listed before its model file is ready.
`supportsSpeakerLabels` is model-specific. The host transcription capability
can transport labels, but local Whisper and ordinary remote transcription
models still return unlabeled segments.
## Configure speaker-aware remote transcription
Speaker separation is provider behavior selected through trusted model
configuration, not an extension request flag. Configure a compatible remote
speech-to-text model with:
```json
{
"transcription": {
"responseFormat": "diarized_json",
"chunkingStrategy": "auto"
}
}
```
For OpenAI's diarization model, the host sends `diarized_json` with automatic
server chunking and omits prompt and timestamp-granularity fields that the model
does not support. The normalized result keeps provider labels on
`segments[].speaker`.
Speaker labels are opaque identities within provider output. Extensions may
offer explicit mapping to participant names, but must not guess those names.
When the host creates multiple independent uploads, it scopes labels per upload
part so identical provider-local labels are not silently merged across parts.
## Start and recover transcription
The first start for a local model may initiate a host-managed download. In that
case `startTranscription()` rejects before a job is created with the message
`transcription_model_downloading`. Keep the stopped recording, show a waiting
state, and retry only that sentinel after a short delay. There is currently no
public model-download progress event.
```js
const delay = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
function bridgeErrorMessage(error) {
return String(error?.message ?? error ?? 'unknown_error');
}
async function startTranscriptionWhenReady(request, shouldContinue = () => true) {
while (shouldContinue()) {
try {
return await bridge.startTranscription(request);
} catch (error) {
const message = bridgeErrorMessage(error);
if (!message.includes('transcription_model_downloading')) throw error;
await delay(3000);
}
}
throw new Error('transcription_start_cancelled');
}
const provider = providers[0];
const started = await startTranscriptionWhenReady({
recordingId: stopped.recordingId,
modelId: provider.id,
language: 'nl',
prompt: 'Optional names or domain vocabulary'
});
// Persist this in extension state/storage immediately; there is no list-jobs API.
const jobId = started.jobId;
```
`transcription_model_not_downloaded` is not a waiting signal: the host could
not establish a downloaded or downloadable asset. Show a setup error.
`transcription_model_unavailable` means the selected model is no longer
available to the exact launch group, so refresh providers. For a remote model,
declining the host dialog rejects with `external_transcription_cancelled` and
does not create a job.
After a job exists, events can reduce polling latency, but `transcription_get`
remains authoritative:
```js
const terminalStatuses = new Set(['completed', 'failed', 'cancelled', 'interrupted']);
let wakePoll = () => {};
const unlistenProgress = bridge.on('transcription-progress', (event) => {
if (event.jobId === jobId) wakePoll();
});
const unlistenSegment = bridge.on('transcription-segment', (event) => {
if (event.jobId === jobId && event.segment) renderPartialSegment(event.segment);
});
const unlistenCompleted = bridge.on('transcription-completed', (event) => {
if (event.jobId === jobId) wakePoll();
});
const unlistenFailed = bridge.on('transcription-failed', (event) => {
if (event.jobId === jobId) wakePoll();
});
async function waitForTranscription(id) {
for (;;) {
const query = await bridge.getTranscription({ jobId: id });
renderTranscriptionJob(query.job);
if (query.job.status === 'completed' && query.result) return query.result;
if (terminalStatuses.has(query.job.status)) {
throw new Error(query.job.errorMessage || query.job.errorCode || query.job.status);
}
await Promise.race([
delay(1000),
new Promise((resolve) => {
wakePoll = resolve;
})
]);
}
}
let result;
try {
result = await waitForTranscription(jobId);
} finally {
unlistenProgress();
unlistenSegment();
unlistenCompleted();
unlistenFailed();
}
```
Persisted jobs survive iframe remounts. Store `jobId`, then call
`getTranscription({ jobId })` on mount. An unfinished job becomes `interrupted`
after a full host restart; ISA Warden preserves its state but does not resume
the inference automatically.
The full response and event schemas, status values, phases, limits, and error
contract are in the [host command reference](07-host-command-api-reference.md#transcription-commands).
## Share derived text, then clean up
Raw audio cannot be shared. To make a transcript or project available through
the dashboard, write the derived content below the extension's group folder as
a syncable file:
```js
const folder = await bridge.ensureGroupFolder();
const safeName = `meeting-${new Date().toISOString().replaceAll(':', '-')}.json`;
await bridge.uploadFiles({
files: [{
path: `${folder.path}/${safeName}`,
text: JSON.stringify({
title: 'Weekly project meeting',
transcript: result.text,
language: result.language,
durationMs: result.durationMs,
segments: result.segments
}),
contentType: 'application/json',
metadata: { syncable: 'true' }
}]
});
```
A successful local or pending syncable upload means the host has durably stored
the complete bytes and can reconcile them with dashboard storage later. Only
after that success should the extension remove local media state:
```js
await bridge.deleteTranscription({ jobId });
await bridge.deleteRecording({ recordingId: stopped.recordingId });
```
`deleteTranscription` accepts terminal jobs only. A recording cannot be deleted
while an active transcription still leases it; after a completion event, a very
short retry may be needed while the worker releases that lease. Never delete a
recording merely because an event arrived before the transcript/project write
has succeeded.
## Lifecycle summary
Local Whisper normalizes the host WAV input to mono 16 kHz and runs one local
job at a time. Long remote inputs are split into bounded overlapping WAV chunks
and merged with adjusted timestamps. Configured remote providers may return
speaker-aware segments; local Whisper does not. The current implementation does
not provide system/loopback audio or live transcription.
@@ -0,0 +1,238 @@
# Dashboard-backed extension project sync
This chapter defines the standard persistence contract for extension-owned
projects that must be visible to multiple users or devices through a dashboard.
ISA Quote is the reference implementation for dashboard-backed file transport.
The word **sync** is used carefully here. A file can be dashboard-backed without
being opted into the host's offline file-sync queue.
## Dashboard web UI
The persistence, cache, queue, and reconciliation descriptions in this chapter distinguish the native host from the dashboard web UI. On web, every filesystem read policy—including `cache-only`—reads authoritative dashboard state, and `filesystem_query_index` queries current authorized dashboard inventory. Network failures remain unavailable or errors. Web inventory returns `source: "dashboard"`, `snapshotComplete: true` only on success, and `reconciliationRevision: 0` because there is no local reconciliation.
Web writes apply immediately even with `metadata.syncable = "true"` or the atomic JSON `syncable` creation hint. They preserve dashboard sync metadata for native clients and return no browser pending upload or journal. Extensions continue polling for changes from other clients. Web creates no file-content cache, offline queue, RIBLT worker, or OPFS storage. Portable upload sources are `text` and `bytesBase64`; `filePath` remains native-only.
The shared workspace pickers can grant read or read-write access outside the extension root. The browser host remembers only versioned grant settings per origin, account, workspace, group, extension, and verified package; the server validates restored IDs, paths, ancestry, group links, and permissions before use. Revocation clears live and remembered grants across tabs. Grants work for the current launch group and cannot recursively delete their own root.
## 20.1 Persistence modes
Extensions must distinguish these persistence modes:
| Mode | API | Shared through dashboard | Works offline after provisioning |
| --- | --- | --- | --- |
| Device-local state | `localstorage_*` with omitted or false `sync` | No | Yes |
| Private synced settings | `localstorage_*` with `sync: true` | Yes, per authenticated user/workspace/group/extension | Confirmed cached reads only |
| Dashboard-backed file | `filesystem_*` without `metadata.syncable` | Yes, immediately after a successful request | No |
| Host-syncable file | `filesystem_*` with exact `metadata.syncable = "true"` | Yes, after host reconciliation | Native host only; browser writes remain online |
Browser hosts advertise `filesystem.persistence.mode = "dashboard-confirmed"` and `offlineWrites = false`. A successful browser mutation means dashboard acceptance, even when the file is marked syncable for native interoperability. Browser `atomic_json_apply.syncable` is a server-side creation hint only and never enables a local operation journal. Browser account/extension KV can hold recovery drafts, but a failed or disconnected shared save must remain a visible failed/unconfirmed operation. Upload/delete/atomic-write availability must come from the current gateway command list; implementation and live-verification status are tracked in the [cloud write plan](../../../plans/cloud-extension-write-support.md).
Dashboard-backed project state uses dashboard-backed files by default. It is the
portable baseline because it uses the ordinary authenticated dashboard file
API and does not depend on the optional `workspace-file-riblt-v1` protocol.
Use host-syncable files only when offline editing is an explicit product
requirement. A locally accepted syncable write is durable on that device, but
is not confirmation that the dashboard or another user has received it.
Extensions must not build another offline queue on top of the host queue.
Atomic object-key updates use `atomic_json_get` and `atomic_json_apply` against the same ordinary canonical workspace files and permissions. `atomic_json_apply.syncable` is an optional boolean creation hint: exact `true` makes a missing file host-syncable, while omission or `false` creates it dashboard-first; it never changes an existing file's persisted mode. All valid JSON roots are accepted, although upsert and remove retain their documented object-key semantics. A syncable get overlays durable unacknowledged operations on the strictly committed RIBLT generation; a non-syncable get reads the dashboard. Callers must preserve explicit absent, unavailable, malformed, and permission-error outcomes instead of treating each as an empty object.
An acknowledged atomic batch is removed from the local journal immediately. The ordinary RIBLT cache can therefore lag the accepted dashboard value until reconciliation, and a read in that window can return the older committed generation or unavailable. `filesystem-index-changed` is the single scoped wake-up event for both pending journal and reconciled file changes. Atomic operations add no tombstone: delete removes the ordinary file, a later operation recreates an absent path from `{}`, and dashboard mutations and whole-file replacements take effect in arrival order.
`localstorage_*`, including synced private settings, is never the canonical source for shared project data. It may hold
preferences, recovery drafts, conflict sidecars, and resumable migration
journals.
## 20.2 Project identity is not project storage
There are two valid project identity models:
1. A dashboard Shared Project Registry ID from `projects_list`,
`projects_create`, and `projects_set_archived`. Use this when project identity
must be shared across extensions.
2. An extension-owned project ID stored in the canonical project document. ISA
Quote uses this model.
Registry records contain group-scoped identity and lifecycle metadata only.
Their system-owned registry folders are not writable project storage or sync
roots. When an extension uses a registry project, it stores that ID as a
foreign key in its own canonical files.
In both models, project contents live below the extension's authoritative group
folder.
## 20.3 Capability and root discovery
An extension using dashboard-backed project files must:
- request `get_app_info`, `filesystem_read`, and `filesystem_write`;
- request `filesystem_delete` only when its lifecycle deletes shared files;
- request `projects_read` or `projects_write` only when it uses the Shared
Project Registry;
- check the advertised filesystem commands before enabling shared writes;
- call `filesystem_ensure_group_folder` once per mounted launch before reading
or writing canonical data;
- use the returned path exactly and never derive a path from a mutable group
name; and
- keep all access in the immutable workspace, group, and extension scope
supplied by the host.
A cached root may be used as an offline read fallback, keyed by immutable launch
scope. It must not suppress authoritative root discovery on a later online
launch. Calling the ensure command also registers the current root with the
host event bridge.
First-time group-folder provisioning is online-only.
## 20.4 Canonical layout
Each extension documents one deterministic layout. New extensions should use:
```text
<extension-root>/
projects/<project-id>/
project-state/current.json
assets/<immutable-id>-<sha256>.<ext>
```
Existing schemas may retain another documented layout. For example, ISA Scribe
uses `meetings/<meeting-id>/project.json`.
The mutable project document is the commit point. Immutable transcripts,
sources, exports, and other assets are uploaded before it. An optional manifest
or aggregate index is a derived accelerator only; canonical inventory must be
able to repair it.
For ISA Quote acceptance, `projects/<project-id>/workflow/award/current.json` is the only canonical commit point. `workflow/export-state/current.json` and the workspace file manifest are derived state: failure to update either one queues repair but does not roll back or invalidate a successfully committed award. Repeated writes use one stable operation ID. Every mutation must use the authoritative award entry on which the UI state was based as its CAS base; an internal fresh read may validate that base but must never silently rebase a stale full-document mutation. A remote CAS conflict is resolved by loading the newest award instead of issuing a compensating write. Manifest repair rereads the current canonical award and only repairs its index entry. Export repair is tied to the committed award revision and is discarded when that award has already been superseded.
Derived workflow repair journals are keyed by immutable launch context and project ID. The launch-context identity always contains the workspace ID, including launches without a group, and adds the group ID when present. A late canonical commit may journal a repair under its captured context after the UI has switched workspaces, but reconciliation may run only when that exact context is active. A resolved canonical upload acknowledgement remains valid for its captured context after a switch; derived index and export work is journaled for that old context instead of being run in the new one. A journal from workspace A must never read or write project data in workspace B, even when both workspaces contain the same project ID.
## 20.5 Writes and metadata
Dashboard-first canonical writes follow the ISA Quote transport pattern:
```js
await bridge.invoke('filesystem_upload_files', {
workspaceId,
files: [{
path: canonicalPath,
filename: 'current.json',
text: JSON.stringify(project),
contentType: 'application/json; charset=utf-8',
resourceType: 'example.project_state',
replaceExisting: true,
metadata: {
kind: 'project_state',
schemaVersion: '1',
projectId,
updatedAt: project.updatedAt
}
}]
});
```
All metadata values must be strings. `kind`, `schemaVersion`, the relevant
project identity, and `updatedAt` should be present on canonical files.
`resourceType` should be stable and extension-specific.
Do not add `syncable: "true"` to dashboard-first writes. That exact value
selects a different transport: the optional local/offline reconciliation queue.
For writes:
- upload immutable assets with `replaceExisting: false`;
- upload the canonical project document last;
- replace a mutable canonical path with `replaceExisting: true`;
- pass `expectedSyncRevision` and `expectedContentHash` when the host returned them, while continuing to address the file by canonical path;
- use a stable 64-hex `metadata.client_operation_id` when retrying one
idempotent online create.
The Filesystem API exposes only `filesystem_upload_files` for writes, for one to 256 items. Dashboard-first and syncable items share the same request envelope; every syncable item must carry the exact `metadata.syncable = "true"` value, and every returned item is an independent locally durable pending result. A missing dashboard file ID is normal until reconciliation confirms a new path. Use the local path and content hash as provisional identity, observe `filesystem-sync-state-changed`, query `filesystem_query_index`, or inspect sync metadata returned by `filesystem_list_dir` and `filesystem_get_files` only when upload statistics matter to the extension, and do not block the local UI on dashboard acceptance. The host replays queued files with bounded concurrency and prioritizes smaller files.
A project is saved only after the canonical upload succeeds. A failed derived
index update is a repair condition, not a failed canonical commit.
Canonical reads distinguish four explicit policies:
- `dashboard-required` bypasses pending and clean caches, never falls back to cached bytes, and is mandatory before CAS writes or applying a remote canonical document;
- `dashboard-first` preserves a pending local edit, otherwise reads the dashboard and uses a clean cache only when the dashboard is unavailable; and
- `cache-preferred` may return a complete clean cache immediately and is reserved for non-authoritative presentation reads; and
- `cache-only` reads pending or complete clean local bytes without requesting a dashboard link or download. A content miss returns an item-level `status: "unavailable"`, `authoritative: false`, `source: "cache"`, and `reason: "cache-miss"` result so callers can poll without treating the miss as an authoritative deletion.
The read surface consists of `filesystem_list_dir` and `filesystem_get_files`. Listing merges dashboard inventory with locally available syncable entries and returns whether the inventory is authoritative. With `cachePolicy: "cache-only"`, listing performs no dashboard RPC and returns only files whose bytes are already completely readable from the local sync cache; an empty list is non-authoritative and suitable for polling. `filesystem_get_files` is the bounded, unified content command for one file or a batch. Its default local-first policy uses only complete clean host-cache entries for syncable files, then retrieves unresolved paths from the dashboard. It is selected solely by canonical paths and validates supplied revision/hash preconditions before exposing an item. A missing cache path or metadata mismatch is not evidence that a dashboard file was deleted. Use `cache-only` for local polling that must never cause network retrieval. Canonical project application, authoritative absence checks, remote inventory, and CAS preparation must specify `cachePolicy: "dashboard-required"` with canonical paths and every available revision/hash precondition.
An authoritative file response couples the downloaded bytes with the workspace file ID, canonical path, artifact ID, sync revision, optional server SHA-256, and update timestamp obtained for that same file generation. When a server hash is present, the host verifies the downloaded bytes before exposing it as a CAS hash. A historical file without a server hash may still be authoritative by identity and revision, but the client must keep its server hash empty and must never promote a locally calculated digest to a server CAS precondition.
Creating a canonical path must be create-only after an authoritative `absent` result. Replacing it requires the file ID and every available revision/hash precondition from the authoritative read. Dashboard upload initialization and extension intermediate-folder creation share a transactional workspace path fence, re-read their parent and target inside the transaction, and use bounded reconciliation after an uncertain commit. This closes the first-create race as well as the ordinary replacement race.
Each canonical project document carries a monotone `generation`. Every successful content or lifecycle transition advances it from the highest authoritatively discovered generation for that project. Candidate selection compares document generation first, then the coupled server revision, and uses timestamps only as a compatibility fallback for legacy documents. A listing timestamp or derived manifest timestamp must never make an older document win. Project-create reconciliation likewise requires a `dashboard-required` `found` or `absent` result; cached bytes cannot confirm whether a create committed.
## 20.6 Incoming reconciliation
A successful outbound write is only half of project sync. Every project
extension must also discover dashboard changes while it remains open.
The extension must:
- inventory canonical project documents at startup;
- refresh at a bounded interval; 30 seconds is the default when the host does not advertise an authoritative indexed-cache event capability;
- when that capability is available, consume its scoped change batches immediately and run an authoritative recovery audit at least every five minutes;
- refresh when the iframe regains focus or becomes visible on hosts without the indexed-cache event capability;
- refresh the Shared Project Registry too, when it is used;
- validate document schema, identity, and canonical path before accepting it;
- merge remote additions, updates, archives, and removals;
- retain the last usable generation when an inventory request is unavailable;
- isolate a malformed project instead of disabling the complete repository; and
- never overwrite an unsaved, dirty, pending, or conflicted local draft.
Canonical inventory code must preserve `found`, `absent`, `invalid`, and
`unavailable` as distinct outcomes. Convenience helpers that collapse errors to
`null` or `[]` must not drive deletion or migration decisions.
When active, archived, tombstone, and purge candidates exist, inventory reads every candidate returned by the authoritative listing before selecting the winner. The lifecycle inside the selected canonical document is authoritative; its physical path may remain stable across archive and restore to preserve file identity and CAS continuity. Tombstones and purge markers are physical canonical JSON files with a higher project generation, not manifest-only flags. When a stale active write races a marker and both expose the same explicit generation, the deletion marker wins before timestamps are considered; only a deliberate recreation based on that marker may advance to the next generation and become active again. The manifest is repaired from the selected canonical file and is never allowed to select or republish an older canonical document. Canonical inventory therefore remains usable when the derived manifest is unavailable.
Generic filesystem state events may trigger an immediate refresh, but they are not an authoritative reconciliation mechanism. A host may advertise a dedicated post-reconciliation indexed-cache event whose changed/deleted paths are safe to use as an accelerator. The extension must still inventory at startup, preserve unavailable-versus-absent semantics, and run the bounded authoritative recovery audit because dashboard-first writes do not depend on the offline sync worker.
## 20.7 Conflicts and deletion
When replacement preconditions report a conflict, automatic saving stops. Keep
the local draft and its last known base, then offer an explicit choice such as
loading the shared version or saving the local work as a copy. Never silently
overwrite or rebase a newer shared document.
Deletes use validated canonical paths and the latest revision/hash preconditions when available. An unavailable inventory is not proof that a project was deleted. Archiving a Shared Project Registry record must preserve its ID and must not move or delete extension-owned files.
For an extension-owned project delete or purge, commit and verify the physical tombstone or purge marker before deleting project files or local derived state. Cleanup must inventory both the active and archive paths directly from the dashboard and proceed only when both listings are authoritative. Cleanup must preserve the marker. If inventory or cleanup is interrupted, the higher-generation marker and local project state remain available for retry; the marker still wins over leftover project bytes and prevents resurrection.
## 20.8 Validation
At minimum, test:
- device A saves and a separate device B repository discovers the project;
- a mounted device discovers a remote create, update, archive, and removal;
- focus and interval refresh retain dirty local work;
- a transient unavailable listing retains the last usable generation;
- one malformed canonical document does not hide valid projects;
- root discovery runs on each mounted online launch;
- immutable assets commit before the mutable project document;
- replacement conflicts do not silently overwrite remote content;
- stale cached project bytes are never combined with metadata from a newer listing;
- equal or misleading timestamps cannot beat a higher canonical project generation;
- archive, restore, delete, and deterministic-ID recreation preserve monotone generations without reusing a tombstone as a live write base;
- canonical reads still select the correct project or purge marker while the derived manifest is unavailable;
- interrupted delete cleanup leaves a physical higher-generation marker that prevents old project bytes from being resurrected;
- an unavailable active or archive inventory stops shared and local delete cleanup after the canonical marker commit;
- switching between a group and a group-less context clears the old extension root and manifest before another project read or write;
- an authoritative retry bypasses a stale host cache;
- a committed award remains successful when export-state or manifest repair fails;
- a stale second client cannot overwrite a newer canonical award;
- an old repair journal cannot replay an older award or export over a newer award;
- a repair journal captured in workspace A cannot replay in workspace B, even for the same project ID;
- Shared Project Registry IDs remain stable across archive and restore; and
- the extension's full package build succeeds.
If offline editing is enabled, also test restart-offline reads, offline saves,
reconnect confirmation, and simultaneous-edit conflict handling against a
dashboard that advertises the exact file-sync protocol.
@@ -0,0 +1,321 @@
# Model Recommendations
`modelRecommendations` lets an extension publisher describe portable models
that make the extension useful. During the dashboard **Add Extension** flow,
the host reviews those declarations with the administrator and can add selected
missing model records to the workspace before adding the extension.
This is an implemented, model-only provisioning aid. It is not a general
resource bundle and does not currently provision tools, agents, servers,
groups, files, or model-to-group links.
## 21.1 What a recommendation does
A recommendation can:
- explain why an extension benefits from a model;
- mark that exact model as required or recommended during installation review;
- recognize an exact model that is already in workspace inventory;
- create a missing `normalHttp` or `openAICompatibleAPI` workspace model by
calling the existing dashboard model API;
- ask the administrator for an API key when a missing API model is selected.
A recommendation does not:
- give extension code a model object or runtime model ID;
- make `key` available through `get_app_info` or another bridge command;
- make a workspace model available to a group;
- download local model bytes during extension installation;
- prove that a remote endpoint is reachable or that local bytes are ready;
- guarantee that a required model remains available after installation;
- reprocess recommendations automatically when an installed extension updates;
- delete a model when the extension is uninstalled.
The model becomes an administrator-owned workspace resource. Extension code
must continue to use the documented capability and provider discovery APIs and
must handle the model being unavailable at runtime.
## 21.2 Author workflow
Use this sequence for every extension that publishes model recommendations:
1. Decide whether the extension needs one exact portable model or merely
benefits from it.
2. Add a versioned `modelRecommendations` block inline to the source
`extension.json`.
3. Use a stable extension-local `key` for each item. Do not use a dashboard
record ID or a credential as the key.
4. Choose `required` only when the administrator should not be able to install
the extension without selecting that exact model. Otherwise use
`recommended`.
5. Declare either a `normalHttp` source or an `openAICompatibleAPI` source.
6. Run the extension's normal build. Its final step must run
`isa-ext package`.
7. Inspect the generated
`dist/<id>.isax/extension.json` and confirm the block is
present without credentials.
8. Preview the package through **Add Extension** and test existing, missing,
deselected, failed, and retry states.
9. Test the extension at runtime with no linked group model. The extension must
show a clear unavailable/setup state instead of assuming installation made
the model usable.
A complete version 1 block is available in
[`examples/model-recommendations-v1.json`](examples/model-recommendations-v1.json).
The formal manifest contract is in
[Manifest specification](04-manifest-specification.md#47-model-recommendations).
## 21.3 Choosing required or recommended
`importance` controls only the dashboard installation review:
| Value | Installation behavior | Runtime meaning |
| ------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `required` | Selected and locked. A missing selected model must be added successfully before the extension is created. | No runtime guarantee. The model can still be unlinked, deleted, not downloaded, or unavailable to the launch group. |
| `recommended` | Selected by default, but the administrator can deselect it individually or with the recommended-model selection action. | The extension must work without it or clearly disable the optional feature that needs it. |
Use `required` sparingly. Exact matching is based on source identity, not on
general model capability. If multiple providers or models can satisfy the
feature, recommend a preferred model and let the extension discover an
available compatible provider at runtime.
## 21.4 Manifest fields
The top-level `modelRecommendations` block contains `schemaVersion: 1` and a
non-empty `items` array. Each array entry is one of the recommendation objects
shown in the source examples below.
Every item uses these fields:
| Field | Required | Processing |
| --------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `key` | Yes | Stable identity inside this extension manifest. Lowercase ASCII letters, digits, `_`, and `-` only. It is installation metadata, not a runtime resource handle. |
| `importance` | Yes | `required` or `recommended`; controls selection in the review. |
| `name` | Yes | Administrator-facing model name. It is used when creating a model but never for existing-model matching. |
| `reason` | Yes | Short administrator-facing explanation of why the extension uses the model. |
| `modelTypes` | Yes | Non-empty, duplicate-free list of `chatLlm`, `text2Video`, `text2Image`, `textEmbedding`, `other`, or `speechToText`. An existing model must contain every declared type; extra existing types are allowed. |
| `location` | Yes | `local` for `normalHttp`; `privateServer` or `cloud` for `openAICompatibleAPI`. |
| `safetyLevel` | Yes | `high`, `medium`, or `low`; copied to a newly created model record. |
| `modelSettings` | No | Plain JSON object copied to a newly created model record. It is not merged into an existing model and may not contain credential-looking fields. |
| `source` | Yes | Exactly one supported source variant described below. |
The host validates the public distribution manifest before showing a review.
Invalid schema versions, empty item lists, duplicate keys, unsupported enum
values, unknown source fields, unsafe paths, and credentials reject the
preview instead of being ignored.
## 21.5 Normal HTTP models
Use `normalHttp` for a model whose files can be downloaded to the current
device later through the normal model-library flow:
```json
{
"key": "local-analysis",
"importance": "recommended",
"name": "Local analysis",
"reason": "Runs analysis on this device.",
"modelTypes": ["chatLlm"],
"location": "local",
"safetyLevel": "high",
"source": {
"normalHttp": {
"url": "https://models.example/acme/analysis.gguf",
"outputFile": "acme/analysis.gguf",
"autoDownload": false,
"mmprojPath": "acme/analysis-mmproj.gguf"
}
}
}
```
Processing rules:
- `url` must use HTTPS. Plain HTTP is accepted only for `localhost` or a
loopback IP during development.
- URL userinfo and credential-like query parameters are rejected.
- `outputFile`, `mmprojPath`, and `mtpPath` are portable relative output paths,
not local absolute paths and not separate URLs.
- `autoDownload` must be omitted or `false`. The host also forces it to
`false` in the add-model request.
- Adding the extension creates only the workspace model record. It does not
download any files.
- A later normal model download derives a companion URL by replacing the main
`outputFile` suffix in `url` with `mmprojPath` or `mtpPath`. When companion
files are declared, keep the URL and output paths aligned so that replacement
is possible.
- Normal HTTP model files do not currently have a publisher-declared content
digest in this contract. Use a stable trusted HTTPS source and never describe
automatic download as part of extension installation.
`localFile` and `dashboardArtifact` are deliberately unsupported in public
recommendations because their paths or identifiers are not portable between
workspaces.
## 21.6 OpenAI-compatible API models
Use `openAICompatibleAPI` for a remote provider:
```json
{
"key": "remote-summary",
"importance": "recommended",
"name": "Remote summary",
"reason": "Creates concise summaries.",
"modelTypes": ["chatLlm"],
"location": "cloud",
"safetyLevel": "medium",
"source": {
"openAICompatibleAPI": {
"baseUrl": "https://api.example/v1",
"model": "summary-1"
}
}
}
```
The source contains only `baseUrl` and the provider's `model` identifier. Never
publish `apiKey`, authorization headers, bearer tokens, query credentials, or
credentials inside `modelSettings`.
If no exact workspace model exists, the review asks the administrator for the
API key. The key is removed from review state as the request is submitted and
is passed only to the existing add-model command, which stores it with the
workspace model. It is never written to the source manifest, public
distribution manifest, extension `manifestJson`, logs, or extension runtime.
## 21.7 How the host processes recommendations
The dashboard add flow processes a valid block in this order:
1. Fetch and validate the public distribution `extension.json`.
2. Compare every item with the current workspace model inventory.
3. Show required/recommended selection, existing-model status, missing-model
status, and API-key configuration where needed.
4. Immediately before submission, refresh workspace inventory and run exact
matching again.
5. Add each selected missing model sequentially through `add_model`, always
with an empty `groupIds` list.
6. Add the extension only after all selected missing models have succeeded.
7. If the add flow was opened for a group, attempt the existing extension-to-
group link. Model-to-group links are not created.
Existing-model identity is intentionally narrow:
- `normalHttp`: canonical URL with the fragment removed, exact
`outputFile`, and every declared model type. A trailing slash on a download
path remains significant.
- `openAICompatibleAPI`: normalized `baseUrl` with an optional trailing slash
ignored, exact provider `model`, and every declared model type. The stored
API key is ignored.
Display name, reason, location, safety level, and `modelSettings` are not used
for matching. If an existing source match needs different settings, the
administrator must review or update that existing model separately.
## 21.8 Failure and retry behavior
Model creation and extension creation use separate existing dashboard calls;
the complete sequence is not one database transaction.
- If any selected model fails, the extension is not created and the review
stays open on the failing item.
- Models created earlier in the sequence remain in workspace inventory.
- A retry refreshes inventory and recognizes those exact models instead of
intentionally creating them again.
- If model creation succeeds but extension creation fails, the models remain
and the administrator can retry adding the extension.
- If extension creation succeeds but its optional current-group link fails,
the extension remains in the workspace and the retry is limited to that
group link.
- Cancelling after a partial failure does not roll back created resources.
Do not promise all-or-nothing installation in extension copy or documentation.
## 21.9 Administrator permissions and follow-up
The acting user needs:
- `manage_extensions` to add the extension;
- `manage_models` when selected missing models must be created;
- `link_resources`, or the corresponding group `manage_resources` authority,
to link extensions or models to a group.
After installation, the administrator must separately:
1. link each workspace model to every group that should use it;
2. download local model bytes on each device that will run a `normalHttp`
model;
3. verify remote endpoint policy, connectivity, and credentials where an API
model is used.
An extension can therefore be linked to a group while its recommended model is
still workspace-only. Group-scoped runtime code must not fall back to an
unlinked workspace model.
### Required extension documentation
The extension's own README or marketplace description must tell administrators:
- which feature uses each model and whether it is required or recommended;
- who publishes the model or operates the endpoint;
- for local models, the expected download size, license, and device
requirements when known;
- for remote models, what data leaves the device and any provider terms,
privacy, or cost implications;
- that group assignment and local model download remain separate steps;
- what fallback or unavailable state the extension provides without the model;
- whether an extension update requires manual model changes;
- that uninstalling the extension leaves provisioned workspace models intact.
## 21.10 Runtime, updates, and uninstall
Recommendation `key` has no runtime binding. Extensions must not store it as if
it were a dashboard model ID. Use the normal runtime discovery API for the
feature. For example, transcription extensions call
`transcription_list_providers` and use only the models available to their exact
launch group; see
[Audio capture and transcription](19-audio-and-transcription.md).
The automated review currently runs only when an administrator uses the
dashboard **Add Extension** flow:
- mounting a developer extension validates its manifest but does not provision
its recommendations;
- changing recommendations in a later package or extension update does not
automatically add, change, or remove models in existing workspaces;
- uninstalling the extension does not remove models that were created during
its installation.
Treat recommendation keys as stable across versions, document material source
changes in release notes, and tell existing administrators when an update
requires manual model changes.
## 21.11 Validation before publication
Run the extension's documented full build, normally:
```sh
npm run build
```
Then verify:
- `isa-ext package` completed without a recommendation validation error;
- the public distribution manifest contains the expected `schemaVersion: 1`
block;
- required and recommended choices are intentional;
- no source URL, settings object, generated manifest, or log contains a
credential;
- an exact existing model is recognized without relying on its display name;
- missing API models require administrator input;
- selected missing models are workspace-only after creation;
- local model bytes are not downloaded automatically;
- retry after a forced model or extension failure does not intentionally
duplicate models;
- the extension handles no group-visible runtime model;
- extension documentation explains any manual group-link, device-download, or
endpoint requirements.
The repository-wide checklist is in
[Validation checklist](17-validation-checklist.md).
@@ -0,0 +1,36 @@
# ISA Warden Extensions Specification
This documentation is the canonical specification for building ISA Warden extensions.
It is intended for:
- extension authors
- ISA Warden maintainers
- AI systems that generate or modify extensions
If a capability is not documented here, it must not be assumed to exist.
## Chapters
1. [Core principles](01-core-principles.md)
2. [Preferred extension architecture](02-preferred-architecture.md)
3. [Extension package layout](03-package-layout.md)
4. [Manifest specification](04-manifest-specification.md)
5. [Installation lifecycle](05-installation-lifecycle.md)
6. [Browser bridge API](06-browser-bridge-api.md)
7. [Host command API reference](07-host-command-api-reference.md)
8. [Native bridge contract](08-native-bridge-contract.md)
9. [Threads and conversation model](09-threads-and-conversation-model.md)
10. [Documents and retrieval model](10-documents-and-retrieval-model.md)
11. [Persistence and database strategy](11-persistence-and-database-strategy.md)
12. [Rights-aware dashboard resource access](12-rights-aware-dashboard-resource-access.md)
13. [Dashboard distribution and marketplace expectations](13-dashboard-distribution-and-marketplace.md)
14. [Strict styling requirements](14-strict-styling-requirements.md)
15. [Iconography requirements](15-iconography-requirements.md)
16. [AI generation rules](16-ai-generation-rules.md)
17. [Validation checklist](17-validation-checklist.md)
18. [Notes on implemented versus planned behavior](18-implemented-versus-planned-behavior.md)
19. [Audio capture and transcription quick start](19-audio-and-transcription.md)
20. [Dashboard-backed extension project sync](20-dashboard-backed-project-sync.md)
21. [Model recommendations: authoring and host processing](21-model-recommendations.md)
22. [Dashboard extension workers](extension-workers.md)
@@ -0,0 +1,128 @@
# UI terminology and native/web boundaries
The dashboard web UI launched with `./isa_dashboard/run_local_remote_dashboard.sh --web-ui` is the browser build of `chat-ui-3`. The native app uses the same Svelte frontend source with a different platform implementation. The dashboard server hosts the browser assets and provides backend services; the browser renders the UI.
This document defines the vocabulary and source locations for discussing UI changes. See [web architecture](chat-ui-3-web-architecture.md) for detailed execution, storage, authentication, and security contracts, [web deployment](chat-ui-3-web-deployment.md) for hosting, and the [design system](chat-ui-3-design-system.md) for styling.
The [cloud/native parity audit, UI plan and features plan](../plans/chat-ui-3/cloud-native-parity/README.md) track the work to align cloud with the native reference through shared components and behavior, with focused platform adapters.
## Terms to use in requests and reviews
| Term | Meaning in this repository |
| --- | --- |
| **Shared UI** | Svelte pages, components, styling, and translations used by both build targets. Shared source can still contain capability-gated controls or target-specific initialization. |
| **Native app** or **desktop app** | The `native` build of `chat-ui-3`, displayed in a Tauri webview and backed by the local Rust/Tauri process. “Native” describes its host and capabilities; its presentation is still Svelte/HTML/CSS. |
| **Dashboard web UI** or **browser app** | The `web` build of `chat-ui-3`, opened in an ordinary browser and served by the dashboard. This means the whole browser application, including login, chat, dashboard management, and supported extensions. |
| **Cloud/web version** | Informal name for the dashboard web UI. Prefer “dashboard web UI” when specifying a UI change. It can run on localhost, an organization's server, or cloud infrastructure. |
| **Dashboard management UI** | The workspace/resource administration interface opened from the sidebar's dashboard button. It is shared UI under `src/routes/components/dashboard/`, available within both app targets subject to permissions and capabilities. |
| **Dashboard server** | The Rust backend under `isa_dashboard/`. It handles accounts, workspaces, permissions, resources, and supported remote execution. Native clients can also connect to it. |
| **Platform shell** | Target-specific startup and service setup selected through `$platform`: `NativeShell.svelte` or `WebShell.svelte`. It wraps the shared route content. |
| **Platform adapter** | Code that provides an operation using the current host: for example Tauri commands on native or dashboard HTTP/gRPC-Web requests in the browser. |
| **Capability** | A declared platform feature used to select UI behavior, such as `desktopWindows` or `localModels`. A capability flag does not establish user permission or guarantee a configured, healthy backend executor. |
| **Extension UI** | An extension's own iframe content. Distinguish it from the shared extension launchpad and toolbar, and from the platform-specific iframe host and bridge. |
| **Thread synchronization** | The optional workspace setting that synchronizes conversation records with the dashboard. Serving the browser app does not automatically enable it. |
| **Cloud-managed session** | A separate server-side generation/session feature controlled by workspace settings. It is not a synonym for opening the browser app or using a remote model. |
Avoid “dashboard” alone when the distinction matters: specify **dashboard server**, **dashboard management UI**, or **dashboard web UI**. Likewise, distinguish **local browser storage**, **native local storage**, and **dashboard storage**; “local” does not necessarily mean native.
## How the launched browser app is assembled
1. The [local launcher](../isa_dashboard/run_local_remote_dashboard.sh) prepares dependencies and loopback configuration and builds the dashboard server with embedded web UI support. The default browser URL is `http://localhost:19912`; use the URL printed by the launcher when configuration overrides are present.
2. The [embedding build script](../isa_dashboard/isa_dashboard_web_ui/build.rs) invokes `pnpm run build:web` or consumes a source-hash-checked prebuilt bundle. It embeds the resulting static assets into the Rust build. This command serves an embedded build, not a Vite live-reload server; frontend edits need a rebuilt/restarted dashboard to appear there.
3. [Vite configuration](../chat-ui-3/vite.config.ts) selects `ISA_UI_TARGET=web` and resolves `$platform` to `src/lib/platform/web`. [SvelteKit configuration](../chat-ui-3/svelte.config.js) selects the web command adapter and static output. Standalone builds normally write to `build/web` or `build/native`; embedding overrides the output directory.
4. The browser loads the shared [root layout](../chat-ui-3/src/routes/+layout.svelte), which imports translations and `app.css`. [AppShell.svelte](../chat-ui-3/src/lib/AppShell.svelte) delegates to the selected platform shell.
5. [WebShell.svelte](../chat-ui-3/src/lib/platform/web/WebShell.svelte) loads `/web-ui-config.json`, sets up browser authentication and dashboard services, restores a session or presents browser login, loads account-scoped preferences, and initializes account-scoped chat storage. Shared route content uses those services once available. Chat storage has its own loading/unavailable state; dashboard functionality can remain available while another tab holds the chat database lock.
6. The shared [main page](../chat-ui-3/src/routes/+page.svelte) composes the sidebar, conversation settings, messages, and extension presentation. Platform capabilities determine which host-dependent controls and initialization paths apply.
```mermaid
flowchart TD
Source[chat-ui-3 shared Svelte UI] --> Native[Native build and platform adapters]
Source --> Web[Web build and platform adapters]
Native --> Tauri[Tauri webview and local Rust process]
Tauri -->|native gRPC client| Server[Dashboard server]
Web --> Embedded[Assets embedded in dashboard server]
Embedded --> Browser[Browser renders the UI]
Browser -->|HTTP and gRPC-Web| Server
```
The native app's connection to a dashboard and the browser app's connection to its dashboard are different transport paths to backend functionality. The launcher name “local remote dashboard” describes a locally running server used to exercise remote-dashboard behavior; it does not turn the browser into a native client.
## What is shared and what differs
| Area | Shared across targets | Native-specific behavior | Browser-specific behavior |
| --- | --- | --- | --- |
| Layout and appearance | Main route, sidebar, message components, semantic CSS tokens, English/Dutch translations, workspace branding | Desktop/window integration where enabled | Browser viewport and web startup/error states |
| Dashboard management | Dashboard modal and workspace, group, model, agent, tool, file, and extension components | Operations through native command/client plumbing | Supported operations through browser adapters and allowlisted server APIs; shared screens do not imply complete command parity |
| Login and startup | `auth/AuthenticationModal.svelte` owns forms, validation, pending/errors and native-led layout; root layout initializes appearance before either shell | Native login adapter, local-account and dashboard selection operations | Thin `WebLogin.svelte` adapter, fixed dashboard endpoint, cookie session and CSRF handling; no local-account bypass |
| Commands and events | Many existing component-facing command names and data shapes | Generated Specta bindings and Tauri commands/events | Registered browser implementations behind the web command adapter; unsupported commands fail explicitly, with a few compatibility no-ops |
| Conversations | Thread/message presentation, canonical records, shared Rust text-only-copy transformation and remote request/parser behavior | Local Rust storage and native model execution wiring | Account/origin-scoped SurrealDB storage through a WASM worker backed by IndexedDB; remote generation through the dashboard |
| Models and tools | Model-facing builtin contracts and shared Rust Rig integration for supported remote-model execution | Local models and native host tool implementations are possible | Browser does not run Rig or local models; dashboard resolves authorized remote models, credentials, and available server tools |
| Preferences | One settings owner, defaults/normalization and saver | Native settings persistence and native reset/relaunch | Versioned account/origin allowlist independent of chat lock; coordinated scoped browser reset |
| Files | Workspace/group resource concepts and supported management UI | Local filesystem access and native sync/download integrations | Browser upload/download flows where implemented; no general native filesystem access. `localFiles: false` does not mean all dashboard file operations are unavailable |
| OS integration | Capability-gated entry points | Desktop windows, updater, local audio capture and related native operations | These native capabilities are disabled |
| Extensions | Launchpad, toolbar, `extensions/ExtensionFrame.svelte`, exclusive status lifecycle and theme subscription | Native extension host and detachable windows | Separate web host/bridge, authorized assets on the app listener with opaque sandbox origins, one live extension iframe, launch-scoped browser threads and connection-bound remote chat; document/image context and native operations are unavailable |
Implemented adapters and capability flags are distinct from completed runtime proof; see the [architecture verification boundaries](chat-ui-3-web-architecture.md#verification-boundaries).
Shared Settings and resource controls use `supportsCommand` at the existing `$platform` seam to check the current command adapter. Compatibility no-ops do not advertise support. Platform capabilities additionally gate OS services and execution paths; browser `imageAttachments` and `executionSettings` now route supported content/options through shared Rust execution rules, while native filesystem and OS operations remain unavailable. Provider compatibility and live execution require separate validation. Unknown conflict counts and redacted resource fields remain unknown rather than becoming zero or empty.
“Unified” means shared presentation or an explicit shared contract. It does not mean identical storage, authentication, transport, execution, or feature availability. In particular, native connection settings and browser session handling are separate even when the resulting management screen looks the same.
## Source map for UI work
Paths below are relative to `chat-ui-3/` unless otherwise stated.
| Change being discussed | Start here |
| --- | --- |
| Shared page layout and panel composition | `src/routes/+page.svelte`, `src/routes/+layout.svelte` |
| Main sidebar and dashboard entry point | `src/routes/components/sidebar.svelte`, `SidebarDashboardAccess.svelte` in the same directory |
| Dashboard management UI | `src/routes/components/dashboard/Dashboard.svelte` and neighboring components |
| Conversation settings and messages | `src/routes/components/conversationSettingsContent.svelte`, `thread_messages.svelte`, `chat_message.svelte` |
| Shared tokens, styles, and language | `src/app.css`, `src/styles/app/`, `src/langs/en/`, `src/langs/nl/`; follow [design-system guidance](chat-ui-3-design-system.md) |
| Browser startup/login/storage status | `src/lib/platform/web/WebShell.svelte`, thin `WebLogin.svelte`, shared `auth/AuthenticationModal.svelte` and `RuntimeStatus.svelte`; chat storage status belongs to the main page |
| Native startup/login | `src/lib/platform/native/NativeShell.svelte`, native branches in `src/routes/+page.svelte`, `src/routes/components/login_modal.svelte` |
| Build selection and platform capabilities | `vite.config.ts`, `svelte.config.js`, `src/lib/platform/capabilities.ts`, `src/lib/platform/contracts.ts` |
| Preference persistence and local reset | `src/lib/settingsNormalization.js`, `Settings.svelte.js`, `platform/web/preferences.ts`, `local-reset.ts`; account lifecycle belongs to `WebShell.svelte` |
| Browser command and API behavior | `src/lib/platform/web/native-bindings-stub.ts`, `dashboard-resource-commands.ts`, `dashboard.ts`, `rpc-registry.ts`, `tauri-stub.ts` |
| Native command behavior | Generated `src/lib/bindings.ts` (do not edit manually), `src-tauri/src/commands/`, `src-tauri/src/dashboard_commands/` |
| Extension launchpad versus iframe host | `src/routes/components/ExtensionLaunchpad.svelte`; native `src/routes/components/ExtensionTab.svelte`; web `src/lib/platform/web/WebExtensionTab.svelte`, `extension-chat.ts`, and `extension-chat-threads.ts` |
| Backend hosting or authorization | Repository `isa_dashboard/isa_dashboard_web_ui/`, `isa_dashboard/isa_dashboard_server_lib/`, and `isa_dashboard/isa_dashboard_server_cli/` |
Some shared components still import Tauri APIs or `$bindings`. The web build aliases these imports to browser compatibility modules. An import that compiles in both targets is not evidence that its operation works in the browser. Trace the selected implementation and its capability guard before changing such a call.
## Browser hosting, synchronization, and execution are separate
Three independent concepts often get called “cloud”: serving the browser application (`[web_ui].enabled`), synchronizing threads (`thread_sync_enabled`), and admitting cloud-managed sessions (`cloud_managed_sessions_enabled`). Cloud session admission requires thread synchronization; browser hosting alone enables neither workspace setting.
Ordinary connection-bound web generation streams through the dashboard and is cancelled on disconnect. Existing cloud-session admission and stored-event replay APIs do not yet provide the completed durable executor, live execution watcher, or restart recovery. A `durableCloudSessions` capability flag is not proof of that completed behavior. See the [architecture's execution and storage section](chat-ui-3-web-architecture.md#chat-execution-and-storage) before promising background completion or cross-client conversation behavior.
Workspace inventory and group availability also remain distinct. A shared model picker or management component must respect the current workspace, group, permissions, and executor availability; visually sharing a component does not widen access.
Both extension bridges carry the captured launch workspace/group into thread and document operations. Native extension streaming validates its persisted thread through the scoped bridge and supplies `NativeGenerationContext` to the general streaming command; setup must still belong to the active launch before generation starts. Thread updates preserve stored ownership and context. Upload operation identities use the same shared preparation helper on both targets. Capability reporting must describe supported commands and actual tool executor availability. Browser `stop_stream` cancels launch streams; native model-wide stopping is not an equivalent extension operation and is not advertised as one.
## How to specify and validate a change
Describe a request with **target + surface + behavior**. Examples:
- “Dashboard web UI: change the browser login layout.” This targets the web login component and shell.
- “Both targets: reduce spacing in the dashboard management model list.” This targets shared dashboard components and styling.
- “Dashboard web UI only: hide the unavailable local-model action in conversation settings.” This targets capability-dependent behavior in shared presentation.
- “Extension UI: change the extension's own project picker.” This targets the extension package, rather than the launchpad or host toolbar.
For a shared component edit, consider its effect on both targets. For a web-only change, identify the web shell/adapter or explicit capability condition that limits its scope. Styling and translations remain shared unless deliberately scoped.
After Svelte or JavaScript changes, the repository requires `pnpm run build -l error` from `chat-ui-3`; its default target is native. Browser changes also need web validation: `pnpm run build:web`, relevant platform/web contract tests, and a browser check against the rebuilt launcher output. A successful native build alone does not verify browser behavior. The [dashboard web UI testing skill](../.agents/skills/dashboard-web-ui-testing/SKILL.md) describes reproduction and browser diagnostics. Apply the repository's Rust and extension validation rules when those areas change.
Check the affected light/dark, focus, hover, disabled, loading, empty, and error states as applicable. For browser failures, distinguish failure to load assets, failure to restore authentication, unavailable chat storage, rejected backend requests, and accidental native-only calls; they belong to different layers even if each appears as a blank or incomplete page.
## Shared file acquisition
Both targets mount `src/lib/FileSelectionHost.svelte` inside their platform shell. Its `src/routes/components/FileSelectionModal.svelte` serves chat attachments, extension document/import selection, file/folder grant selection, and dashboard management uploads and explicit replacements. `src/lib/fileSelection.ts` owns the typed request/result and snapshot helper contract; `src/lib/platform/file-selection-adapter.ts` resolves managed native copies or browser `File` objects and authenticated scoped dashboard transfers. Profile/branding images, extension packages, model uploads, and output-directory selection retain their separate workflows. Ordinary browser chat prepares selected, dropped, and pasted PNG, JPEG, GIF, and WebP images as model-ready thumbnail attachments through the shared image pipeline, with a two-image pending limit. Document attachments use scoped native storage for native execution and dashboard conversation attachments for dashboard execution. Remote host image capability permits sending images; acceptance depends on the selected provider model.
The shared upload destination uses `GroupFolderTree.svelte` on native and web. Its first row is the captured group name; only server-authorized ordinary folders are shown. Extension and system storage are unavailable throughout user file selection. Search, keyboard navigation, and inline folder creation share the same component and permission-aware behavior. Root creation requires the existing workspace administrator/link permissions; subfolders require write access to their real parent. The group heading is not a storage resource or upload destination.
## Model execution and attachments
The shared chat UI selects explicit native or dashboard deployments. Native local chat and tools execute in the native app; both native remote and browser remote chat execute on the dashboard server. Auxiliary-only OCR and embedding models appear in dashboard management, outside the chat picker. The browser cannot select native deployments. Private attachment location follows this selected deployment, independently of persistent group sharing. Model templates, hosted replica administration and workspace attachment retention are shared dashboard management UI.
The shared composer prepares document attachments with the `images` strategy when the selected model advertises vision support. Generation renders authorized PDF/DOCX sources into page images for vision models, within the existing 16-image request limit; other formats use extracted text. Text-only models use extraction and retrieval. Repeated selection reuses current prepared attachments within the same account, workspace, group, conversation, source revision and processing strategy. Reuse must recheck authorization and expiry. The shared conversation attachments panel exposes failed preparation details, and native Application Logs records attachment/OCR failures.
@@ -0,0 +1,363 @@
# Dashboard Workspace Files
This document describes the dashboard workspace file and folder model used by
`isa_dashboard`, `chat-ui-3`, and hosted extensions.
## Persisted Files And Folders
Workspace files and folders are stored as real `workspace_file` records in
SurrealDB. Each record has a canonical absolute path and a stable record id.
Examples:
```text
/models/model.gguf
/groups/team-alpha/extensions/rsx-bestekanalyser/diagnostics
```
File and folder identity is the `workspace_file` id. Paths are display and
lookup metadata; clients must not invent virtual ids for missing parent folders.
If a UI needs breadcrumbs for a file path, it should derive them for display
without treating those breadcrumbs as browseable folders.
Workspace-file content reads and the generic download, replacement, and deletion APIs resolve files only by canonical path. They do not accept a workspace-file id as a lookup selector. Authoritative download and upload replies still return the persisted workspace-file id for cache identity, synchronization, and compare-and-swap bookkeeping, and replacement artifacts retain the resolved id as trusted server metadata. Administrative mutations may continue to address an already-selected record by its id.
The hosted-extension read surface uses `filesystem_list_dir` for one recursively or directly listed path and `filesystem_get_files` for one or a bounded batch of file contents. Listing merges dashboard inventory with locally available syncable files and reports whether the result is authoritative. With `cachePolicy: "cache-only"`, listing performs no dashboard RPC and returns only pending or complete clean files whose bytes are locally readable. Content reads always attempt a complete clean local sync-cache entry first for syncable files, then retrieve only unresolved files from the dashboard with bounded concurrency and shared HTTP connection pooling. Optional sync revision and server content-hash preconditions are checked before bytes are exposed. Missing, incomplete, corrupt, pending, or mismatched cache entries are not evidence of dashboard deletion. Use `cachePolicy: "cache-only"` when polling local availability must never request a dashboard link or download; a content miss is returned per item as non-authoritative `unavailable` with `reason: "cache-miss"`. Use `cachePolicy: "dashboard-required"` for canonical application, authoritative absence, or CAS preparation; the default local-first policy is suitable for ordinary reads and presentation hydration.
## Group Visibility
Workspace inventory and group usability are separate.
- A workspace file or folder can exist without being visible to every group.
- A folder linked to a group grants that group visibility to descendants.
- A file linked directly to a group grants visibility to that file only.
- A direct file link does not make the parent folder browseable and does not
expose sibling files.
- If the first accessible item is below hidden parent folders, file browsers may
show that item at the nearest visible level for navigation. The stored
`workspace_file` id and canonical path do not change.
- Removing a group link removes only that group availability. It does not delete
the workspace file or folder.
Administrative file browsers may show workspace inventory according to the
admin's workspace permissions. Group-context reads and writes must use the
group-link visibility model and must not fall back to workspace-wide access.
## Extension Group Folders
Extensions do not receive an automatic workspace tree at launch. When an
extension needs shared group storage, it asks the host to ensure a group folder.
The host sends the immutable launch workspace id, group id, and extension id to
the dashboard's atomic `EnsureExtensionGroupFolder` operation. The operation
verifies group membership and extension assignment, resolves or creates one
real `workspace_file` folder, links it to the group, and enables its sync root in
one SurrealDB transaction.
A source-mounted developer extension is the sole exception to the dashboard
extension-assignment check. The trusted desktop host marks that install type,
and the dashboard accepts the exception only when the authenticated user is a
full workspace administrator. Its root remains unlinked from the group, so
ordinary group members do not inherit access. Packaged extensions and
non-administrators always require the normal workspace inventory plus explicit
group assignment. The host does not expose developer mounts or their commands
to non-administrators.
The folder id and its persisted group link are the storage authority. Group
names and path slugs are not identities. Newly provisioned roots use a reserved,
group-ID-derived path whose identity segments are deterministic hashes:
```text
/groups/_group_ids/<stable-identity>/extensions/<id>
```
The selected launch group's extension assignment permits the ensure operation;
the resulting folder link authorizes that folder and its descendants for the
group. Workspace-file permission checks, sync authorization, mutation checks,
and RIBLT snapshots use this persisted link and folder ancestry. They do not
recompute a path from the current group name. The technical path may omit real
records for its display-only intermediate breadcrumb segments; the returned
root is the first real folder and descendants store its folder id as their
parent.
Existing linked extension roots keep their real folder id and persisted path
across group renames, including legacy paths of the form
`/groups/<group-name-slug>/extensions/<id>`. When a group has no linked root, the
ensure operation may adopt exactly one unlinked folder at its current legacy
path. Adoption links and syncs that existing folder without copying or moving
content. New roots never use the mutable group-name path, so groups whose names
produce the same slug receive different folders.
The operation fails with `FailedPrecondition` instead of guessing when it finds
structural ambiguity: more than one matching root linked to the group, one root
linked to multiple groups, multiple rows at a candidate canonical path, an
occupant of the wrong kind or extension at that path, or competing legacy and
stable candidates. The diagnostic includes workspace, group, folder, path, and
conflicting-group identifiers as applicable. An administrator should inspect
the reported `workspace_file` rows and `workspace_folder_group_link` records,
remove or relink only the incorrect structural records, and retry. Automatic
repair never merges, copies, or deletes extension project JSON based on names,
timestamps, or content similarity.
The host returns the real folder id, persisted path, and display-only group
name. Extensions should store syncable files below the returned path. The
selected group is captured when the extension starts; changing the active group
elsewhere in the app must not silently move an already running extension to a
different group.
For deployment, first audit existing extension roots and resolve ambiguous
links, then deploy dashboard/proto stable-root support, then deploy the host's
immutable-context and atomic ensure integration, and finally deploy extension
reconciliation changes. Do not enable new-root creation from a newer host
against a dashboard that does not understand linked legacy-root adoption.
## Shared Project Registry
Shared projects are canonical identities for workflows that span multiple
extensions. For each group the dashboard owns one registry root:
```text
/groups/id-<hex-group-id>/projects
```
The root may have no persisted structural ancestor; its canonical path remains
the same. The root and every direct project child are deterministic
`workspace_file` records owned by `system:shared-projects`, with no extension
owner, artifact, or sync state. They are user-private and read-only. One exact
folder link makes the root and its children visible only to the matching group.
The real project identity exposed to extensions is the child
`workspace_file` id, not its mutable presentation in an extension.
Only the dedicated `ListSharedProjects`, `CreateSharedProject`, and
`SetSharedProjectArchived` routes access this namespace. They validate
workspace/group scope and current group membership or workspace-admin access.
Mutations recheck authorization inside their transaction. Create adds the root,
group link, and project atomically. IDs are derived from workspace, group, and
the trimmed case-sensitive project name, which makes concurrent and repeated
creates idempotent. Generic workspace-file creation is blocked below
system-owned registry folders, including for extension contexts and admins.
Archiving sets optional `archived_at` metadata on the project record and updates
its timestamp in one transaction. Restore clears that metadata. Both operations
are idempotent and preserve the project id, name, parent, canonical path, root
link, and all extension-owned data associated with the id. The default list
excludes archived records; callers opt in with `include_archived` when they need
an archive or restore view. The dashboard advertises this lifecycle extension
as `shared-projects-archive-v1`.
Creating the first shared project also enables group artifact resources in the
same transaction, matching ordinary folder-link behavior. Registry folders are
not sync roots and are not writable project storage. Extensions keep their own
files in their extension group folder and associate those files with the shared
project id. Project names are case-sensitive, limited to 160 characters and
512 UTF-8 bytes, and a group is capped at 500 registry entries including
archived projects.
The normative extension-level persistence, commit, reconciliation, and
validation contract is documented in
[`chat-ui-3/docs/extensions/20-dashboard-backed-project-sync.md`](../chat-ui-3/docs/extensions/20-dashboard-backed-project-sync.md).
It distinguishes ordinary dashboard-backed writes from files explicitly opted
into the optional offline file-sync queue.
## User-Selected Grants
Extensions cannot read or write arbitrary group-visible files just because the
current user can see them in the dashboard. Access to existing workspace files is
local to the user's profile and granted through explicit user interaction:
- `openWorkspaceFile` grants one file.
- `openWorkspaceFolder` grants a folder subtree.
- Grants are scoped by extension id, workspace id, and selected launch group.
- Read-only grants allow list/read/download but reject upload, replacement, and
delete.
- Users can review and revoke local extension file grants in Settings.
These local grants are not synced to the dashboard and are not visible to other
users.
## Syncable Extension Files
Small shared extension files can be marked syncable with metadata such as:
```json
{ "syncable": "true" }
```
Syncable files under the extension group folder are cached locally for the
uploader, queued when offline, and synced to other users in the same group when
dashboard sync is available. Extensions should not implement their own offline
sync layer for these files. Merge conflicts remain dashboard-managed through the
workspace file conflict flow.
The opt-in is the exact string value `syncable = "true"` and applies to text,
base64 byte, and snapshotted local-file upload sources, including empty files.
The extension group folder and writable local grant must already have been
created while authenticated; first-time provisioning remains online-only. Once
provisioned, a local save can replace an existing synced file or create a new
file below that folder without dashboard availability. Successful local save
means the bytes are durable and available to offline reads and lists after an
app restart, not that the server has accepted them.
The single sync worker is woken after enqueue and replays pending content in the
original extension and group scope. Repeated saves are latest-write-wins, and a
reply for older bytes cannot clear newer pending content. Accepted uploads stay
awaiting confirmation until reconciliation observes their revision and hash;
conflicts retain the local bytes and stop retrying. Invalid paths, missing
provisioned grants, read-only or revoked grants, and group mismatches are rejected
before local persistence. Non-syncable uploads remain online-only.
The Filesystem API uses `filesystem_upload_files` as the only upload command for bounded batches of up to 256 files in one workspace and launch group; uploading one file uses a one-item list. Dashboard-first and syncable files share this envelope. The host validates every path and source before atomically publishing the syncable subset to the local sync index, returns one result per file, and leaves syncable dashboard replay to the sync worker. Syncable items use the exact `metadata.syncable = "true"` opt-in.
ISA Quote stores the canonical supplier-enrichment map as the ordinary workspace file `suppliers/enrichments.json` below its ensured extension root. Atomic JSON commands may target any canonical workspace path allowed by the extension's ordinary exact-file or folder grant, and accept every valid JSON root. `atomic_json_apply` takes an optional boolean `syncable` creation hint: exact `true` makes an absent file syncable, while omission or `false` uses dashboard-first creation. The hint never changes an existing file's authoritative `sync_enabled` mode. Non-syncable reads and applies require the dashboard; syncable files use the committed RIBLT cache plus a durable operation-only journal and can accept offline changes after their writable scope is provisioned.
The dashboard applies each accepted batch to the valid JSON currently at the path, or recreates an absent target from `{}`, writes one immutable artifact generation, and transactionally advances the ordinary workspace-file pointer and revision. Acknowledgment immediately removes exactly that in-flight batch from the journal, so the committed cache may temporarily remain older or unavailable until RIBLT reconciliation; extensions must distinguish that state from absence. Pending and reconciled changes use scoped `filesystem-index-changed` notifications. Atomic JSON has no separate document store, synthetic committed row, whole-file pending upload, or tombstone: a delete removes the file, a later apply recreates it, and atomic batches, deletes, and ordinary replacements take effect in dashboard arrival order.
Pending replay prioritizes smaller files and overlaps at most eight file uploads per workspace. Chunks within one file remain ordered, parent-folder creation remains scoped to the provisioned extension root, and one failed file does not stop sibling uploads before the worker reports the aggregate retry condition. Extensions may observe per-file pending, uploading, awaiting-confirmation, conflict, and error transitions or query the local file index, but local availability must not wait for those dashboard transitions.
Large read-only local downloads for non-syncable files are intentionally not a
runtime contract yet. Add that path only when a concrete extension needs it.
## Remote Cache Reconciliation
Exactly compatible remote dashboards advertise the
`workspace-file-riblt-v1` capability after the dashboard boot migration has
completed. The desktop app then reconciles each workspace every 60 seconds over
one bounded bidirectional RIBLT stream. A version mismatch, unknown version,
missing capability, or unimplemented stream disables file synchronization and
does not fall back to the legacy list/link polling path. Embedded local
dashboards do not start the worker; a remote dashboard whose artifact provider
is named `local` still synchronizes through its authenticated HTTP URL.
The available-resources response supplies a separate, explicit file-sync
workspace list derived from persisted group and direct workspace memberships.
Only IDs in that list start reconciliation. Display inventory remains a wider
UI contract: the synthetic Public workspace and invitation-only workspace
placeholders stay visible where applicable, but do not start file sync. A
workspace that disappears or becomes unavailable after the response is retired
only for the current worker epoch; reconciliation continues for the other
eligible workspaces, and a later resource refresh starts a new epoch from the
server's current eligibility list.
The server snapshot is the app-level readable union (`extension_id = None`) of
file-kind records that are sync-enabled and reference a complete artifact.
Normal workspace permissions, ownership, group file links, linked-folder
ancestry, and extension group folders determine this union. Hashless legacy
files remain eligible. Hidden rows contribute no symbols, counts, metadata, or
download links.
Manifest version 1 contains only stable file ID, canonical persisted path,
tagged optional extension ID, artifact ID, sync revision, tagged optional
server-declared SHA-256, file size, and tagged optional content type. It is
postcard encoded and BLAKE3 domain separated. The terminal digest hashes the
sorted manifest-symbol set. Any canonicalization change requires a new
manifest/capability version and a coordinated dashboard/app release.
### Orphan Quarantine
A sync-enabled file is eligible for a RIBLT snapshot only when its persisted topology reaches its declared sync root. The declared root must exist in the same workspace, be a sync-enabled folder rooted in itself, and the file's real `parent_id` chain must be acyclic and reach that root. Display-only breadcrumb segments do not require rows. A legacy path, old revision, absent client-operation metadata, or adopted extension-root naming convention is never evidence of an orphan by itself.
When snapshot construction finds a missing or invalid root, missing parent, parent cycle, or parent chain that does not reach the declared root, it excludes that file while continuing to synchronize valid accessible siblings. Runtime discovery marks the file `quarantined_orphan` and creates or reopens one deterministic `orphaned_sync_file` attention record for the workspace and file. Failure to persist that review bookkeeping is logged, but does not admit the invalid file to the snapshot or abort healthy synchronization.
Workspace administrators can resolve the attention record by deleting the file or retrying after an explicit structural repair. Retry restores normal synchronization only after the same topology validation succeeds; it never guesses a parent or changes group availability. Deletion removes the file, its group links, and open quarantine records transactionally. An artifact record is removed only when a transaction-scoped reference check proves it is exclusive, and physical object cleanup occurs after commit so storage failures can be reported without restoring unsafe database state.
The stream phases are:
1. client start; server challenge and ordered coded cells;
2. client resolved server-only symbols; server bounded metadata batches;
3. client requests only content it cannot reuse; server returns one expiring
link wave at a time and waits for its acknowledgement;
4. both peers verify exact totals and the terminal digest before the client
applies anything.
Snapshot, cell, difference, batch, file, byte, time, per-user, global-session,
and client staging limits are enforced. Protocol, authorization, integrity,
snapshot-drift, or resource-limit failures retain the prior local generation
and retry only with a fresh stream. Signed URLs are never persisted. A present
server SHA-256 is checked against downloaded bytes before it is used as a reuse
key. An absent hash is normal; a mismatching hash remains server metadata while
the actual local SHA-256 addresses the immutable blob and produces a diagnostic.
The desktop cache stores immutable content-addressed blobs and one complete
workspace index generation. It flushes the new generation and atomically moves
a small recoverable `CURRENT` pointer only after all required downloads and
terminal checks succeed. Readers therefore see either the complete old or the
complete new generation. Startup recovers a previous pointer and migrates the
old per-scope indexes without inventing unavailable artifact/hash state.
Before index mutation, every reused blob is authorized by current server
artifact/hash metadata, checked for existence and expected size, and leased
under the workspace cache lock. Reused and downloaded blob leases remain held
through the atomic generation commit, so concurrent generation cleanup cannot
remove in-flight content. If the planned cache generation changed before apply,
the attempt aborts without mutation and reconciles again from fresh state.
Pending edits keep their last accepted manifest and symbol unchanged, with
pending bytes and optimistic revision/hash stored separately. Upload results
are durable `accepted`, `conflict`, or `pending` outcomes. Accepted edits remain
awaiting confirmation until a terminal reconciliation observes the resulting
server revision; conflicts keep the local bytes. Zero-byte creates and
replacements use the authenticated finalize operation so provider storage and
replacement semantics complete on the server.
## RIBLT Boot Migration And Sync Inheritance
Dashboard startup runs the resumable `workspace-file-riblt-v1` migration before
publishing the database handle. Each workspace is normalized transactionally,
then recorded in `dashboard_migration_state`; the global completion marker is
written and the capability advertised only after all workspaces succeed. The
migration preserves absent hashes, clears malformed declared hashes, reconciles
size/content type and a nonzero revision from complete canonical artifacts, and
leaves ambiguous incomplete uploads untouched.
Existing descendants of a synced folder inherit the nearest valid persisted
sync root. New folders and uploaded files inherit the same `sync_enabled`,
`sync_root_id`, and revision state in their creation transaction. This changes
sync eligibility only: it does not change ownership, permissions, workspace
inventory, group links, or group visibility.
## Related Code
- `isa_dashboard/isa_dashboard_server_lib/src/routes/workspace_file_common.rs`
implements common file operations.
- `isa_dashboard/isa_dashboard_server_lib/src/routes/workspace_file_proto.rs`
converts workspace file records into proto objects.
- `isa_dashboard/isa_dashboard_server_lib/src/routes/workspace_file_access.rs`
validates canonical paths and enforces workspace-file authorization.
- `isa_dashboard/isa_dashboard_server_lib/src/routes/workspace_file_permissions.rs`
contains group-link and permission helpers.
- `chat-ui-3/src/routes/components/dashboard/WorkspaceFileBrowser.svelte`
displays workspace inventory and group-visible files.
- `chat-ui-3/src/routes/components/dashboard/WorkspaceFileModal.svelte`
edits file and folder metadata.
## Unified file selection
The shared `FileSelectionModal.svelte` is mounted once inside the platform shell. Chat, extension import actions, extension file/folder grants, and administrative upload/replacement flows open it through `requestFileSelection`. Computer selection starts with a private snapshot; native snapshots use unique managed filenames, and browser snapshots use `File` bytes. Computer imports never grant access to the original file. Import-only callers have a fixed read-only notice; an editing-capable extension must declare filesystem-write permission and the user must explicitly enable editing of a selected group reference.
`ListWorkspaceFiles`, `CreateWorkspaceFileDownloadLink`, and workspace upload initialization accept optional `group_id`. When present, the server requires current membership in exactly that group and uses only its persisted file/folder links, including inherited descendants and directly linked files with hidden parents. Administrator status, ownership, and another group's links do not expand that inventory. Unscoped dashboard management retains its administrative behavior. Scoped browsing includes folders and complete readable file generations; hashless files remain selectable but cannot produce duplicate offers.
“Also upload to group” starts unchecked and uses an inline folder tree rooted at the captured group’s display name. Names and authorized parent IDs form the tree; canonical technical path prefixes, including a legacy `general` segment, are not displayed. The group root is navigation only; uploads require a real writable ordinary folder. Search retains ancestors, disclosure and selection are separate, and readable read-only parents remain navigable. The upload session persists that scope and rechecks membership, visibility, and write permission at initialization and completion. A filename collision is a conflict; changing the filename creates a separate file, while replacement remains an explicitly configured administrative action. Completed uploads retain canonical ID, path, accepted hash, and revision and are reused on retries within the same selection request. Duplicate reuse requires explicit selection and fresh authorization; content equality never grants access or changes a read-only grant.
User-facing selection sends `user_picker=true`. The dashboard requires the selected group and excludes extension-owned/scoped rows, system-owned rows, and their descendants by persisted ancestry and canonical containment. The same restriction covers listing/counting, downloads, uploads and completion, duplicate suggestions, folder creation, and explicit extension picker grants. Dedicated extension roots and administrative storage management retain their separate authorization. A versioned `picker_context` supplies the current group name and root-creation capability; clients disable group selection against older dashboards without this policy.
`CreateGroupFolder` accepts the selected group, optional real parent ID, folder name, and retry operation ID. Root creation preserves existing administrator/link permissions and atomically creates the folder, links only the selected group, and enables its artifact resources. Subfolders require current ordinary-parent write access and inherit its existing links and sync configuration. Stable group-ID paths remain canonical storage metadata. Duplicate names conflict; retries reuse the same committed result. Inline creation retains pending files, shows errors beside the name, and selects the newly created folder after refreshing inventory. Cancelling the picker does not remove a committed folder.
Native user-picker grants are versioned after dashboard validation. Legacy unvalidated grants require reselection. Current grants retain the ordinary-resource constraint on subsequent operations; they do not grant access to an extension subtree nested inside an ordinary folder. Native user-picked resources require current dashboard authorization instead of serving offline cached bytes; cache-only requests return unavailable or an explicit online-validation error. Dedicated extension-root caching retains its existing behavior.
Selection captures workspace/group and caller scope, accepts an abort signal, and holds completion open for retryable upload, grant, and storage errors. Scope changes cancel outstanding work and discard late results. Private remote documents use dashboard attachment records outside workspace inventory and group browsing, bound to owner, workspace, captured group and conversation. They are processed on the dashboard and become scoped conversation document IDs; originals and derived indexes share the workspace retention deadline. Native local documents retain original source paths and only derived data expires. See `docs/model-execution-and-managed-servers.md` for deployment routing.
Ongoing extension filesystem operations also revalidate the captured group. Native legacy list, download, folder-create, delete, upload, and explicit-replacement requests carry `WorkspaceFileExtensionScope`; uploads persist this scope through transactional completion. A native Developer installation may retain its own unlinked extension root only through a host-derived `developer_root_id`: the server requires a current full administrator, a real extension-owned folder, and no links to another group. User-picked resources never receive this exception. Packaged browser extensions always use strict selected-group authorization.
Browser group-file downloads use the authenticated, same-origin `/web-files/download` streaming endpoint, which checks the session, origin, CSRF token, selected-group authorization, and expected canonical generation before and after transfer. It resolves the signed object URL on the server, so selecting a group file does not require S3 bucket CORS headers. Native downloads stream through `downloadSelectedFileSnapshot` into managed copies with size/hash validation, cancellation, and partial-file cleanup. Both adapters recheck the selected inventory before returning a downloaded snapshot.
## Private Conversation Attachments
Private chat uploads use `resource_type = "private_attachment"` through `InitUpload`, with a selected `group_id` and `metadata.conversation_id`. The upload transaction creates a separate `conversation_document` row; private sources never create `workspace_file` rows or group file links. Group sharing remains an independent workspace-file operation. A private upload requires current selected-group membership and the workspace artifact endpoint, without requiring the group to enable persistent shared artifacts.
`ProcessConversationAttachment` resolves a completed private artifact owned by the caller, or an explicitly selected `workspace_file_id` with workspace, group and optional expected sync revision. Group sources retain their canonical artifact references without downloading through a desktop. Its reply identifies the derived document by opaque `document_id`; display names and source artifact IDs are not document selectors. `StreamChat.attachment_ids` captures those document IDs separately from the client-provided thread JSON. Every tool call resolves the captured owner, workspace, execution group, conversation, lifetime and current group-file authorization again.
Document extraction, page rendering/OCR orchestration and Markdown chunking live in the Tauri-independent `isa-document-processing` crate. Dashboard processing resolves authorized group auxiliary models server-side, preserves the embedding model revision and dimensions, and publishes a complete chunk generation in one transaction. Text-only processing does not request OCR; hybrid PDF/DOCX and OCR-only processing require an authorized OCR deployment. Query embedding uses the same recorded deployment and revision. `GetConversationAttachmentIndex` and `EmbedConversationDocumentQuery` expose authorized preprocessing results to local hosts without disclosing model credentials.
The workspace `private_attachment_retention_ms` policy defaults to seven days and can be changed by `UpdateWorkspaceChatSettings`. The creation deadline applies to source bytes and all extracted text, embeddings and staging; reads do not extend it. A native switch or fallback may submit its original `expires_at_unix_ms` in upload metadata; the server accepts only a deadline at or before its own workspace-policy deadline. Expired rows deny access immediately. Periodic cleanup first marks rows expired and clears their chunk payload transactionally, then delegates physical artifact removal to retryable artifact lifecycle cleanup. Late processing completions must match their operation ID and a live document before publication. Group-file source artifacts and user originals are preserved. Interrupted processing becomes retryable after its bounded processing deadline.
`CreateConversationAttachmentDownloadLink` requires document, workspace, group and conversation IDs and rechecks their exact server-owned scope before issuing a bounded source URL. Local artifact originals live under a reserved private prefix; raw GET/HEAD requests to that prefix fail. Opaque local download grants bind the authenticated owner, document, source artifact and deadline, and the local listener rechecks current source/group authorization and expiry on every request. Deleting physical bytes later never makes an expired local grant usable.
Extension-derived group-file snapshots preserve their source authorization. Browser snapshots retain a hash of the live launch capability, source path and picker grant identity; generation, document tools and private download grants recheck the current launch, manifest and source access. Replacing or restarting a browser launch requires rebuilding these snapshots. Native grant removal immediately invalidates matching local snapshots and durably queues remote snapshot deletion; reconnect and remote document or generation entry points flush that queue before use. Cleanup deletes derived data and never deletes shared source files.
@@ -0,0 +1,41 @@
{
"schemaVersion": 1,
"items": [
{
"key": "local-analysis",
"importance": "required",
"name": "Local analysis",
"reason": "Analyses documents on this device.",
"modelTypes": ["chatLlm"],
"location": "local",
"safetyLevel": "high",
"modelSettings": {
"contextLength": 8192,
"maxTokens": 1024
},
"source": {
"normalHttp": {
"url": "https://models.example/acme/analysis.gguf",
"outputFile": "acme/analysis.gguf",
"autoDownload": false,
"mmprojPath": "acme/analysis-mmproj.gguf"
}
}
},
{
"key": "remote-summary",
"importance": "recommended",
"name": "Remote summary",
"reason": "Creates concise summaries.",
"modelTypes": ["chatLlm"],
"location": "cloud",
"safetyLevel": "medium",
"source": {
"openAICompatibleAPI": {
"baseUrl": "https://api.example/v1",
"model": "summary-1"
}
}
}
]
}
@@ -0,0 +1,32 @@
# Dashboard extension workers
## Package contract and consent
A worker-capable extension declares the exact `dashboard_worker` permission and a versioned `workers` array. Each worker has a unique safe relative packaged `.mjs` entry, unique functions, runtime `javascript-esm-v1`, and protocol `isa-extension-worker-v1`. A permission without workers, workers without the permission, unsafe paths, duplicate functions, or unsupported runtimes fail validation. Public and verified payload manifests must match exactly.
The permission is privileged. Installation or update requires an initially unchecked administrator consent and creates a grant bound to workspace, extension ID/version, exact payload SHA-256, worker metadata, approver, and time. A digest or metadata change invalidates the grant; automatic updates never preserve it. `stream_chat`, `native_code`, or `manage_extensions` alone is insufficient.
## Admission and authorization
Worker start/list/get/watch/cancel/delete use the existing extension bridge envelope. Start requires a current exact-digest grant, explicit extension linkage in the immutable workspace/group launch scope, a healthy runner, and both `thread_sync_enabled` and `cloud_managed_sessions_enabled`. Every operation inside the worker separately requires its ordinary permission and current resource links. Server scope replaces any worker-supplied actor, workspace, group, extension, model, tool, thread, file, or document identifier. Nested workers are forbidden.
Jobs, events, checkpoints, leases, idempotency records, and bounded terminal results are owner scoped. Closing the UI or logging out does not cancel a job. Cancellation, extension unlink/update/delete, access loss, destructive synchronization disablement, expiry, or quota failure revokes the lease and fences late output. Unleased queued jobs may be retried. An expired job resumes only from a committed extension checkpoint and stable next operation ID; an unknown non-idempotent side effect becomes `interrupted` and requires explicit retry.
## Runner security contract
The dashboard process never receives a Docker/Podman socket and the browser surface never exposes runner or engine control. The separate runner leases only server-selected verified bundle digest, extension version, worker entry, immutable scope, fixed runtime image digest, and limits. It rejects extension-supplied images, Containerfiles, commands, arguments, mounts, devices, ports, network modes, and runtime flags.
The administrator explicitly chooses `docker` or `podman` and an allowed local Unix socket or separately authenticated transport. Plaintext TCP is rejected. Admission stays closed until the adapter proves supported engine/API version, rootless or user-namespace mode, digest identity, non-root UID, read-only root, tmpfs scratch, all capabilities dropped, `no-new-privileges`, confinement, CPU/memory/PID/time/output bounds, no network/ports/mounts/devices, bounded stdio, and kill/remove/orphan cleanup. Requested settings are insufficient; effective container inspection must confirm them. No worker receives dashboard JWTs, provider keys, engine endpoints, or host files.
Communication is bounded newline-delimited stdio through the runner. The runner associates frames with the active lease and proxies allowlisted capability calls. Mutations and checkpoints require stable operation IDs so a lease retry cannot duplicate messages, files, email, tools, or other effects.
## Portable extension modules
Browser and Node ESM entries should import the same pure workflow modules and inject the appropriate high-level SDK transport. Worker graphs must not import DOM/Svelte stores, browser Workers, Node native addons, dynamic network modules, or disallowed built-ins. Browser `postMessage` and worker stdio transports implement the same request/event/error contract.
`hello-world` is the only end-to-end worker demonstration in this release. It checkpoints a deterministic workflow, performs multiple sequential cloud turns, emits progress and a terminal result, and supports list/reattach/cancel/delete after the app closes. `isa-match-rsx-to-quote` is an architectural reference only and must not declare or start a dashboard worker in this release.
## Administration
Pin the shared Node ESM runtime by digest and upgrade it explicitly after Docker and Podman conformance. Prefer rootless engines. Configure quotas, retry/backoff, secret-redacted diagnostics, orphan reconciliation, and a drain/cancel policy before disabling synchronization. Deleting a job physically removes its events, checkpoints, and result; shared workspace files retain their normal canonical lifecycle.