14 KiB
ISA Project format
Version 1 is an ordinary workspace <name>.isap folder containing project.json, extensions/<extension-id>/ and assets/. The manifest contains formatVersion: 1, stable id, display name, UTC createdAt/updatedAt timestamps, and optional archived state. Canonical dashboard folder IDs are storage identities; names and paths do not grant access. Imports allocate a new identity and folder.
Extension namespaces organize data and are not permission boundaries. An ordinary writable folder grant permits supported edits across namespaces. Preserve unknown manifest fields, files and extension data. Each extension documents its canonical data; ISA Projects owns planning and detailed progress. Common summaries live in extensions/<extension-id>/status.json with schemaVersion: 1, status (not-started, in-progress, blocked, complete), updatedAt, and optional completion between 0 and 100. Summary data is editable project content and never grants publishing authority.
Public APIs
The root export is framework-neutral ESM with TypeScript declarations. @isa-warden/isa-project-format/dom exports DOM mounting functions. @isa-warden/isa-project-format/svelte exports ProjectWorkspace, ProjectHeader and ProjectPicker components; Svelte is an optional peer for consumers of those components. Extension packages bundle these modules and the ZIP dependency at build time. No remote runtime imports are required.
import { createProjectClient } from '@isa-warden/isa-project-format';
import { mountProjectWorkspace } from '@isa-warden/isa-project-format/dom';
const client = createProjectClient({
bridge,
extensionId: 'example',
sharedProjectsFolder: true,
filesystem: appInfo.filesystem,
scope: { workspaceId, groupId }
});
const view = mountProjectWorkspace(target, { client, bridge, extensionName: 'Example', locale: 'en' });
// On extension teardown:
view.destroy();
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 after verifying its manifest. In shared group mode it opens the single selected folder through the host and revalidates its identity and access in the launch group. 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 sharedProjectsFolder: true with filesystem: appInfo.filesystem for the shared group overview. Declare group_projects_read and filesystem_read in the extension manifest. On a host advertising filesystem_list_group_projects and filesystem_open_group_project, the overview reads the active group's existing file inventory. It lists the active group’s .isap folders with valid manifests, including projects created in other extensions. Each row reports whether the extension already has its own instance in the project (hasInstance). Listing projects gives the extension no file grants. Selecting a project asks the host for access to that folder using the member's current rights and the extension's declared filesystem permissions. A writable session can create the extension's instance inside the selected project. filesystem_create_group_project reserves an ordinary folder for a new project or import. The client creates the standard subdirectories and publishes project.json last. The dashboard creates these folders in the originating group’s project directory. Workspace admins retain administrative access. A creator who leaves the group has no ownership exception.
Other client configurations
The default client uses the user's selected folders for listing and creation, including on hosts that advertise the group project catalog.
Use client.withListedProject(row, action) for an explicitly selected project that requires a temporary session. 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.
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.
For directory-backed collections, initialize the empty collection in the selected project. If the schema needs a default item, derive its UUID using await defaultProjectRecordId(session.manifest.id, extensionId) so simultaneous first opens use the same path. Users can add optional details or import content after the workspace opens.
Specialist viewers for shared data
The dashboard exposes versioned datasets through ordinary workspace files. Each extension obtains its own launch-scoped grant through openWorkspaceAsset. A group supplies the requesting user's access context. The workspace owns the data and its checkpoints.
| Asset | Canonical store | Contents |
|---|---|---|
suppliers |
/shared/suppliers/catalog.kv |
Stable supplier IDs, profiles, overrides, import history and enrichments. catalog/meta.active selects the generation. |
prices |
/shared/prices/prices.kv |
Comparable price observations, keyed by stable observation ID in the list observations/v1. |
bid_history |
/shared/bid_history/inschrijfhistorie.json |
Historical bids by ID and lot, with criterion scores and feedback. |
Declare the asset’s workspace_asset_<asset>_read permission and filesystem_read. Editors also need its write permission, filesystem_write and effective write access to the folder. KV datasets additionally require kv_store_read and, for editing, kv_store_write. For JSON datasets, pass the snapshot from createSharedFolderReader(...).readJson(relative) to writeWorkspaceAssetJson(context, relative, value, snapshot) with a writable asset grant in context.folder. Store a supplier ID on a project line. Resolve the ID against the supplier asset when displaying current details. Keep original offers, recipients and sent messages in the project.
import { openWorkspaceAsset } from '@isa-warden/isa-project-format/shared-folder';
import { openPriceAsset } from '@isa-warden/isa-project-format/prices';
const folder = await openWorkspaceAsset({ bridge, scope, asset: 'suppliers', access: 'read' });
const path = folder.path + '/catalog.kv';
const subscription = await bridge.invoke('kv_store_subscribe', { path, keys: ['catalog/meta'] });
try {
const active = subscription.entries.find(entry => entry.key === 'catalog/meta')?.value?.active;
// Subscribe to catalog/<active>/supplier/<id>/profile for the linked IDs in batches.
// Follow mergedInto on old profiles. Rebind the profile subscription when active changes.
} finally {
await bridge.invoke('kv_store_unsubscribe', { path, subscriptionId: subscription.subscriptionId });
}
const prices = await openPriceAsset({ bridge, scope, access: 'read' });
const page = await prices.query({ search: 'asfalt', limit: 30 });
Price values contain supplier, description, specItem, numeric unitPrice (including zero), unit, currency and receivedAt (ISO date or empty). Optional supplierId links to the shared supplier and validUntil holds an ISO date. A writer assigns one stable observation ID per source observation or quotation version. New writers can use a persisted UUID. Project paths, quotations, review notes and commercial terms belong in the project.
To add price observations, open the price asset with access: 'read_write' and call importRows([{ id, value }]). Keep the same ID on retries. Re-imports preserve edited values and can attach a supplier ID to an existing observation. Queries accept date ranges, exact field filters, facets and revision-checked paging. Follow the supplier schema's publication rules to update profiles and indexes together. A read-only viewer should handle a missing dataset as a distinct state and surface authorization or transport errors. For arbitrary files in an authorised project or workspace folder, createSharedFolderReader supports relative file reads and consistent KV snapshots.
ZIP transfer
exportProject, importProject, exportProjectToDialog and importProjectFromDialog use existing host file and KV transfer primitives. Exports include media and unknown files, and capture consistent live KV snapshots instead of stale checkpoint artifacts. A versioned .isa-transfer.json sidecar maps logical KV contents to their canonical paths; the KV files are rebuilt through host operations on import, retaining list item identities/order. Runtime grants, service approvals and credentials are not part of the transfer format. Imported audit fields are historical reference data; server-owned authorization remains outside the project.
Imports validate the whole ZIP and transfer metadata before creating a project. Validation rejects traversal, absolute/backslash paths, links, duplicate/case/Unicode path collisions, overlapping headers, malformed compression/CRC, unsupported versions and bounded decompression failures. Transfer limits may be lowered: default archive and total expanded data limits are 512 MiB, individual entries 256 MiB, and entry count 10,000. Media above 16 MiB uses the host’s authorized download link and a bounded streamed fetch, verifies the snapshot hash and size, then renews authorization before completing. Other host transport limits can still be lower; a failed read is an explicit transfer failure and is never silently omitted. Export checks file generations/inventory and live KV revisions again before producing an archive. Transfers fence cancellation with the captured session.
Run npm run build to check ESM syntax, compile-check Svelte components and execute the focused format, lifecycle and real ZIP regression suites. The shared UI and large-media transport still require native/browser integration validation as part of the complete extension release.
Before an export, supply beforeExport(session) to the transfer UI when an editor uses debounced saves. It must flush that captured session or reject; the library revalidates the session and dirty state before reading the archive. Late work must never target a replacement project session.