Use the launch group catalog for shared projects

This commit is contained in:
Sander Grootendorst
2026-11-30 23:51:37 +01:00
parent 257ebd2775
commit b70a7aa5ee
14 changed files with 326 additions and 63 deletions
+19 -4
View File
@@ -15,7 +15,8 @@ import { mountProjectWorkspace } from '@isa-warden/isa-project-format/dom';
const client = createProjectClient({
bridge,
extensionId: 'example',
filesystemCommands: appInfo.filesystem?.commands,
sharedProjectsFolder: true,
filesystem: appInfo.filesystem,
scope: { workspaceId, groupId }
});
const view = mountProjectWorkspace(target, { client, bridge, extensionName: 'Example', locale: 'en' });
@@ -26,15 +27,29 @@ await client.close();
The shared UI provides a searchable project overview, recent activity, project creation, an active-project header, file/media browsing, transfer actions and a Tauri-compatible HTML confirmation for dirty project switches. English and Dutch labels are included. It inherits ISA extension theme tokens; detailed application workflows and planning remain in the extension. Components consume a captured client instance: remount with a new client when the launch context changes.
`client.activate(reference)` opens a listed or recent reference by reading its manifest through an existing grant. `client.create(name, operationId?)` creates an ordinary folder and publishes its manifest after the standard subdirectories exist. It retains the same operation ID and folder through uncertain retries in the current client. Callers with durable recovery journals should provide their persisted operation ID. Recent references are private, launch-scoped host preferences rather than canonical project state. Preference failures are observable on `session.preferenceError` and do not invalidate an already committed creation/switch.
`client.activate(reference)` opens a listed or recent reference after verifying its manifest. In shared group mode it also refreshes folder identity and access from the launch group's catalog. `client.create(name, operationId?)` creates an ordinary folder and publishes its manifest after the standard subdirectories exist. It retains the same operation ID and folder through uncertain retries in the current client. Callers with durable recovery journals should provide their persisted operation ID. Recent references are private, launch-scoped host preferences rather than canonical project state. Preference failures are observable on `session.preferenceError` and do not invalidate an already committed creation/switch.
Sessions capture their project path and abort signal. `readJson` returns an authoritative CAS base; `writeJson(relative, value, base, {operationId?})` requires that same file’s base and sends its revision/hash. `ensureDirectory(relative)` creates real parent directories in order; `openKv` does this for its parent before opening a store. A requested synchronized store uses offline storage when the granted parent is synchronized. Otherwise, new stores use the ordinary online filesystem contract. `openKv`, `applyKv` and `subscribeKv` use the captured project destination. Use `extensionPath` for extension-owned paths, `publishStatus` for summaries and `readStatuses` for the overview. Subscriptions and registered cleanup callbacks close on switching; late results cannot use a retired session. Mark unsaved work with `session.markDirty()`. Without explicit confirmation, dirty sessions block switching. Mounting the shared UI supplies a confirmation; applications can provide `beforeSwitch` to integrate an existing save/discard workflow.
## Project start screen
Use the ISA Match layout for a project-based extension. Show recent activity on the left and **Projects** (**Projecten**) on the right. Place **+ Create project** at the top right of the Projects panel. Populate this list on launch with `await client.list()`, which returns active projects discovered in the folders selected by the user. `client.recent()` supplies optional personal shortcuts. Use the project rows to open existing projects and the create button to launch the setup form.
Use `sharedProjectsFolder: true` with `filesystem: appInfo.filesystem` for the shared group overview. Declare `group_projects_read` and `filesystem_read` in the extension manifest. The host advertises `supportsSharedGroupProjects` and `filesystem_list_group_projects` when the launch group supports automatic project access. The client lists direct `/shared/*.isap` projects returned for the group and validates their manifests. Members can open these projects on their first visit. A writable extension with `filesystem_write` uses `filesystem_create_group_project` to create or import into the same group. Opening a writable project provisions the extension's namespace, where it can initialize its own data. Older hosts display an update instruction.
Use the shared `ProjectWorkspace` or `mountProjectWorkspace` with the extension display name, locale and launch-scoped client. Custom overviews call `client.pickFolder()` from a user action and refresh `client.list()` after a selection. The picker can select a container such as `/shared` or a single existing `.isap` folder. The extension remembers selected paths for the launch scope and reads only through its ordinary filesystem grants. Use `client.openListed(row)` to reopen a project, `client.create(name, operationId)` to create it in an editable container, and `client.setArchived(row, archived)` to update the manifest. Extensions need the host permissions for filesystem reads, optional writes, and private preferences.
### Other client configurations
Project extensions can declare `group_projects_read` alongside `filesystem_read` and pass the command list from `get_app_info` to the client. On a host advertising `filesystem_list_group_projects`, `client.list()` reads the launch group's catalog on every refresh. The host determines which project folders are available to the launch group and authorizes operations against their folder IDs. The same workspace can have many independent group catalogs. Writable extensions create projects in the group's extension root. ZIP import creates a new project identity and appears in the list once its contents have been written.
Use `client.withListedProject(row, action)` for project-specific background initialization. The callback receives a temporary session and leaves the active project and recent activity intact. ISA Projects initializes its first planning board with a stable ID when a writable shared project opens.
### Older hosts
Pass `groupFolder: true` to `createProjectClient` to use the extension’s folder for the current launch group as its default project location. This mode requires the host command `filesystem_ensure_group_folder`. The client lists projects from that folder and any additional folders the user has selected. New projects and project imports use the group folder.
### Project overview
Use the ISA Match layout for a project-based extension. Show recent activity on the left and **Projects** (**Projecten**) on the right. Place **+ Create project** at the top right of the Projects panel. Populate this list on launch with `await client.list()`, which returns active projects for the configured storage mode. `client.recent()` supplies optional personal shortcuts. Use the project rows to open existing projects and the create button to launch the setup form.
Use the shared `ProjectWorkspace` or `mountProjectWorkspace` with the extension display name, locale and launch-scoped client. Custom overviews in picker-based mode can call `client.pickFolder()` from a user action and refresh `client.list()` after a selection. The picker can select a container such as `/shared` or a single existing `.isap` folder. The extension remembers selected paths for the launch scope and reads only through its ordinary filesystem grants. Use `client.openListed(row)` to reopen a project, `client.create(name, operationId)` to create it in an editable container, and `client.setArchived(row, archived)` to update the manifest. Extensions need the host permissions for filesystem reads, optional writes, and private preferences.
Every project extension initializes its own data when a writable project first opens. The client ensures the extension directory exists, and the extension opens its workspace with the stored data. For a JSON-backed workspace, call `await session.ensureExtensionJson('data/current.json', () => initialState(session.manifest.name))` using the extension’s canonical relative path and default schema. The result includes the saved JSON value and version. The helper creates missing parents, uses a create-only write, and reads the committed record even if another client created it. An absent record on a read-only or archived project returns `status: 'absent'`. Unavailable or malformed data raises an error.