0.10.0: Archify Sync, optional live collaboration on a model

Several people edit one model at once through a server you run yourself
(archify-vscode-ext-sync); the files stay ordinary files on each disk.
Sign-in through the browser, offline-first with later merge, teammates'
cursors in the Source view and text editors, and a Shared section on the
model page with people, versions, Compare and Restore.

Without a server nothing changes: the sync code is a separate bundle that
loads only when a model is shared, after a sign-in, or when a sync command
or invite link is used.
This commit is contained in:
root-at-skic committed 2026-11-06 22:55:01 +02:00
1 parent a9021312b0
commit c99f3e5fe8
27 files changed
+2899 -14

No files matched your search

+27
View File
@@ -14,6 +14,7 @@ import { viewerTheme } from '../util/settings';
import { handleWebviewMessage, WebviewMessage } from '../webview/messages';
import { graphPage, makeNonce, messagePage, modelPage, prepareDiagramHtml } from '../webview/page';
import { graphScriptUri, sourceScriptUri, viewer3dOption, viewerRoots } from '../webview/viewer3d';
import { liveBridge } from '../sync/liveBridge';
import { SourceSession } from './sourceSession';
import { DECISION_VIEW_TYPE, DIAGRAM_EDITOR_VIEW_TYPE, PREVIEW_VIEW_TYPE, REGISTRY_VIEW_TYPE } from './viewTypes';
@@ -55,6 +56,8 @@ class DiagramPreview implements vscode.Disposable {
readonly source: SourceSession | undefined;
private heldHtml: string | undefined;
private disposed = false;
/** main.archify: the model page has its Live slot and takes `live` messages. */
private liveShown = false;
constructor(
private readonly context: vscode.ExtensionContext,
@@ -80,6 +83,7 @@ class DiagramPreview implements vscode.Disposable {
if (!shown && this.heldHtml !== undefined) {
const html = this.heldHtml;
this.heldHtml = undefined;
this.liveShown = false;
this.panel.webview.html = html;
}
});
@@ -115,10 +119,25 @@ class DiagramPreview implements vscode.Disposable {
this.setGraph(false);
return;
}
if (message.type === 'liveReady') {
this.liveShown = true;
void this.postLive();
return;
}
if (message.type === 'liveAction') {
if (this.root) void liveBridge.act(this.root, message.action);
return;
}
void handleWebviewMessage(message, this.uri, this.panel);
}),
);
if (isMainFile(uri.path)) {
this.disposables.push(liveBridge.onDidChange((root) => {
if (!root || (this.root && root.toString() === this.root.toString())) void this.postLive();
}));
}
if (uri.scheme === 'file') {
const watcher = vscode.workspace.createFileSystemWatcher(
new vscode.RelativePattern(vscode.Uri.file(path.dirname(uri.fsPath)), path.basename(uri.fsPath)),
@@ -134,6 +153,13 @@ class DiagramPreview implements vscode.Disposable {
void this.update();
}
/** The Live section of a shared model's page; nothing when the model is not shared. */
private async postLive(): Promise<void> {
if (!this.liveShown || !this.root || this.disposed) return;
const live = await liveBridge.panel(this.root).catch(() => undefined);
if (this.liveShown) this.post({ type: 'live', live });
}
/** Posts to the webview; a panel closed mid-update is not an error. */
private post(message: unknown): void {
Promise.resolve(this.panel.webview.postMessage(message)).catch(() => undefined);
@@ -147,6 +173,7 @@ class DiagramPreview implements vscode.Disposable {
return;
}
this.heldHtml = undefined;
this.liveShown = false;
this.panel.webview.html = html;
}