@lapis-notes/app-profile 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE.md +4 -0
  3. package/README.md +20 -2
  4. package/dist/index.d.ts +34 -0
  5. package/dist/index.js +43 -0
  6. package/dist/local-plugin-distribution.d.ts +3 -0
  7. package/dist/local-plugin-distribution.js +102 -0
  8. package/dist/native-chat/NativeChat.svelte +114 -0
  9. package/dist/native-chat/NativeChat.svelte.d.ts +15 -0
  10. package/dist/native-chat/conversation.d.ts +10 -0
  11. package/dist/native-chat/conversation.js +161 -0
  12. package/dist/native-chat/history.svelte.d.ts +14 -0
  13. package/dist/native-chat/history.svelte.js +18 -0
  14. package/dist/native-chat/index.d.ts +6 -0
  15. package/dist/native-chat/index.js +4 -0
  16. package/dist/native-chat/metadata.d.ts +14 -0
  17. package/dist/native-chat/metadata.js +74 -0
  18. package/dist/native-chat/navigation.d.ts +13 -0
  19. package/dist/native-chat/navigation.js +55 -0
  20. package/dist/native-chat/observer.d.ts +28 -0
  21. package/dist/native-chat/observer.js +343 -0
  22. package/dist/native-chat/participant-capture.d.ts +7 -0
  23. package/dist/native-chat/participant-capture.js +108 -0
  24. package/dist/native-chat/participant-observer.d.ts +24 -0
  25. package/dist/native-chat/participant-observer.js +125 -0
  26. package/dist/native-chat/participant-projection.d.ts +9 -0
  27. package/dist/native-chat/participant-projection.js +116 -0
  28. package/dist/native-chat/plugin.d.ts +5 -0
  29. package/dist/native-chat/plugin.js +60 -0
  30. package/dist/native-chat/queue-capture.d.ts +57 -0
  31. package/dist/native-chat/queue-capture.js +41 -0
  32. package/dist/native-chat/queue-observer.d.ts +16 -0
  33. package/dist/native-chat/queue-observer.js +190 -0
  34. package/dist/native-chat/queue-receipt.d.ts +3 -0
  35. package/dist/native-chat/queue-receipt.js +36 -0
  36. package/dist/native-chat/send.d.ts +11 -0
  37. package/dist/native-chat/send.js +42 -0
  38. package/dist/native-chat/session.d.ts +32 -0
  39. package/dist/native-chat/session.js +82 -0
  40. package/dist/native-chat/view.d.ts +20 -0
  41. package/dist/native-chat/view.js +90 -0
  42. package/dist/native-repository.d.ts +7 -0
  43. package/dist/native-repository.js +26 -0
  44. package/dist/plugin-browser.d.ts +3 -0
  45. package/dist/plugin-browser.js +55 -0
  46. package/dist/plugin-host-build.d.ts +12 -0
  47. package/dist/plugin-host-build.js +88 -0
  48. package/dist/workspace-session/NotesWorkspaceSession.svelte +261 -0
  49. package/dist/workspace-session/NotesWorkspaceSession.svelte.d.ts +8 -0
  50. package/dist/workspace-session/application.d.ts +9 -0
  51. package/dist/workspace-session/application.js +47 -0
  52. package/dist/workspace-session/database-status.d.ts +2 -0
  53. package/dist/workspace-session/database-status.js +37 -0
  54. package/dist/workspace-session/index.d.ts +2 -0
  55. package/dist/workspace-session/index.js +1 -0
  56. package/dist/workspace-session/leave.d.ts +9 -0
  57. package/dist/workspace-session/leave.js +25 -0
  58. package/dist/workspace-session/lifecycle.d.ts +14 -0
  59. package/dist/workspace-session/lifecycle.js +83 -0
  60. package/dist/workspace-session/types.d.ts +33 -0
  61. package/dist/workspace-session/types.js +1 -0
  62. package/package.json +98 -3
@@ -0,0 +1,261 @@
1
+ <script lang="ts">
2
+ import { provideApplicationState, type VaultProfile } from "@lapis-notes/api";
3
+ import { DEFAULT_APP_STATE_DIRECTORY } from "@lapis-notes/api/path";
4
+ import { WorkspaceShell } from "@lapis-notes/workspace";
5
+ import type { WorkspaceNavigation } from "@lapismd/design-core/workspace/app-shell";
6
+ import {
7
+ WorkspaceStartup,
8
+ type WorkspaceStartupFailure,
9
+ type WorkspaceStartupTask,
10
+ } from "@lapismd/design-core/workspace/startup";
11
+ import { onMount, untrack } from "svelte";
12
+ import { notesPluginProfile } from "../index";
13
+ import { createNativeChatPlugin } from "../native-chat/plugin";
14
+ import { registerNativeRepository } from "../native-repository";
15
+ import { createNotesApplication } from "./application";
16
+ import { registerSessionDatabaseStatus } from "./database-status";
17
+ import { createNotesSessionLifecycle } from "./lifecycle";
18
+ import type { NotesWorkspaceSessionProps } from "./types";
19
+
20
+ let options: NotesWorkspaceSessionProps = $props();
21
+ const application = untrack(() => createNotesApplication(options));
22
+ const { app } = application;
23
+ provideApplicationState(app);
24
+ const startupTasks: WorkspaceStartupTask[] = [
25
+ { id: "vault", label: "Open the vault", status: "pending" },
26
+ { id: "configuration", label: "Load app configuration", status: "pending" },
27
+ { id: "plugins", label: "Load configured core plugins", status: "pending" },
28
+ { id: "layout", label: "Restore the workspace layout", status: "pending" },
29
+ ];
30
+ let ready = $state(false);
31
+ let tasks = $state(structuredClone(startupTasks));
32
+ let failure = $state<WorkspaceStartupFailure | null>(null);
33
+ let booting = false;
34
+ let bootFlight: Promise<void> | undefined;
35
+ let corePluginsRegistered = false;
36
+ let stopMetadataTracking: (() => void) | undefined;
37
+ let releaseDatabase: (() => void) | undefined;
38
+ let releaseConfiguration: (() => void) | undefined;
39
+ let releaseRepository: (() => void) | undefined;
40
+ let recentVaults = $state.raw<VaultProfile[]>([]);
41
+ const lifecycle = createNotesSessionLifecycle({
42
+ app,
43
+ session: untrack(() => options.session),
44
+ fence: () => {
45
+ ready = false;
46
+ },
47
+ releaseObservers,
48
+ releaseServices: application.disposeServices,
49
+ releaseHostServices: application.disposeHostServices,
50
+ releaseApplication: () => {
51
+ releaseRepository?.();
52
+ application.release();
53
+ },
54
+ });
55
+
56
+ const workspaceNavigation = $derived.by<WorkspaceNavigation>(() => {
57
+ const profile = options.profile;
58
+ const candidates = recentVaults.filter(
59
+ (candidate) => candidate.kind !== "desktop-folder",
60
+ );
61
+ const profiles = (
62
+ candidates.some((candidate) => candidate.id === profile.id)
63
+ ? candidates
64
+ : [profile, ...candidates]
65
+ ).slice(0, 8);
66
+ return {
67
+ currentLabel: profile.name,
68
+ menuLabel: "Recent vaults",
69
+ items: profiles.map((candidate) => ({
70
+ id: candidate.id,
71
+ label: candidate.name,
72
+ description: candidate.kind,
73
+ disabled: candidate.id === profile.id,
74
+ })),
75
+ emptyLabel: "No recent vaults",
76
+ manageLabel: "Manage Vaults",
77
+ onSelect: (item) => {
78
+ const selected = profiles.find((candidate) => candidate.id === item.id);
79
+ if (selected) return options.onOpenRecent(selected);
80
+ },
81
+ onManage: () => options.onManageVaults(),
82
+ };
83
+ });
84
+
85
+ onMount(() => {
86
+ void initialize();
87
+ return () => {
88
+ void dispose(false);
89
+ };
90
+ });
91
+
92
+ function releaseObservers(): void {
93
+ stopMetadataTracking?.();
94
+ releaseDatabase?.();
95
+ releaseConfiguration?.();
96
+ stopMetadataTracking = releaseDatabase = releaseConfiguration = undefined;
97
+ }
98
+
99
+ function startMetadataCache(): void {
100
+ if (!lifecycle.canRecoverLeave() || stopMetadataTracking) return;
101
+ stopMetadataTracking = app.metadataTypeManager.trackChanges();
102
+ void app.metadataCache.load();
103
+ }
104
+
105
+ function setTask(
106
+ id: string,
107
+ status: WorkspaceStartupTask["status"],
108
+ detail?: string,
109
+ ): void {
110
+ tasks = tasks.map((task) =>
111
+ task.id === id
112
+ ? { ...task, status, detail: status === "active" ? detail : undefined }
113
+ : task,
114
+ );
115
+ }
116
+
117
+ async function teardownPartialBoot(): Promise<void> {
118
+ ready = false;
119
+ releaseObservers();
120
+ await app.vaultChanges.stop();
121
+ for (const plugin of [...app.plugins.plugins.values()].reverse()) {
122
+ await plugin.disable();
123
+ }
124
+ }
125
+
126
+ function initialize(retry = false): Promise<void> {
127
+ if (bootFlight) return bootFlight;
128
+ bootFlight = start(retry).finally(() => {
129
+ bootFlight = undefined;
130
+ });
131
+ return bootFlight;
132
+ }
133
+
134
+ async function start(retry: boolean): Promise<void> {
135
+ if (!lifecycle.canRecoverLeave() || booting) return;
136
+ booting = true;
137
+ failure = null;
138
+ tasks = structuredClone(startupTasks);
139
+ let activeTask = "vault";
140
+ try {
141
+ if (corePluginsRegistered || stopMetadataTracking)
142
+ await teardownPartialBoot();
143
+ if (!lifecycle.canRecoverLeave()) return;
144
+ setTask(activeTask, "active");
145
+ if (!corePluginsRegistered) {
146
+ app.plugins.registerStaticPlugins(notesPluginProfile);
147
+ if (options.repositoryFactory) {
148
+ releaseRepository = registerNativeRepository(
149
+ app,
150
+ options.repositoryFactory,
151
+ );
152
+ }
153
+ if (options.nativeChat)
154
+ app.plugins.registerStaticPlugins([
155
+ {
156
+ plugin: createNativeChatPlugin(options.nativeChat),
157
+ required: false,
158
+ enabledByDefault: false,
159
+ },
160
+ ]);
161
+ corePluginsRegistered = true;
162
+ }
163
+ await app.vault.load({ retry });
164
+ await application.syncHost.ready({ retry });
165
+ await app.vault.mkpath(DEFAULT_APP_STATE_DIRECTORY);
166
+ if (!lifecycle.canRecoverLeave()) return;
167
+ setTask(activeTask, "complete");
168
+ activeTask = "configuration";
169
+ setTask(activeTask, "active");
170
+ await app.configuration.load();
171
+ releaseConfiguration =
172
+ (await options.host?.configure?.(app)) ?? undefined;
173
+ if (!lifecycle.canRecoverLeave()) return;
174
+ setTask(activeTask, "complete");
175
+ activeTask = "plugins";
176
+ setTask(activeTask, "active");
177
+ await app.plugins.loadPlugins({
178
+ communityPlugins: "configured",
179
+ optionalCorePlugins: "configured",
180
+ onProgress: ({ name }) =>
181
+ setTask(activeTask, "active", `Loading ${name}`),
182
+ });
183
+ if (!lifecycle.canRecoverLeave()) return;
184
+ setTask(activeTask, "complete");
185
+ activeTask = "layout";
186
+ setTask(activeTask, "active");
187
+ await app.workspace.loadLayout();
188
+ recentVaults = await options.listProfiles();
189
+ releaseDatabase = registerSessionDatabaseStatus(
190
+ app,
191
+ options.session,
192
+ options.runtime,
193
+ );
194
+ await app.vaultChanges.start();
195
+ if (!lifecycle.canRecoverLeave()) return;
196
+ setTask(activeTask, "complete");
197
+ ready = true;
198
+ await options.onReady(app);
199
+ startMetadataCache();
200
+ } catch (error) {
201
+ ready = false;
202
+ setTask(activeTask, "failed");
203
+ failure = {
204
+ title: "Lapis Notes could not start",
205
+ description:
206
+ activeTask === "plugins"
207
+ ? "A configured core plugin failed while the workspace was starting."
208
+ : "The workspace could not complete its startup sequence.",
209
+ detail: error instanceof Error ? error.message : String(error),
210
+ actions: [
211
+ {
212
+ id: "retry",
213
+ label: "Retry",
214
+ icon: "refresh-cw",
215
+ onSelect: () => initialize(true),
216
+ },
217
+ ],
218
+ };
219
+ } finally {
220
+ booting = false;
221
+ }
222
+ }
223
+
224
+ export const persistLayout = lifecycle.persistLayout;
225
+ export const canRecoverLeave = lifecycle.canRecoverLeave;
226
+ export async function dispose(persist: boolean): Promise<void> {
227
+ await bootFlight;
228
+ await lifecycle.dispose(persist);
229
+ }
230
+ </script>
231
+
232
+ <section
233
+ class="notes-workspace-session"
234
+ data-notes-session-ready={ready}
235
+ data-web-runtime={options.runtime}
236
+ data-vault-id={options.profile.id}
237
+ aria-label="Notes workspace"
238
+ role="group"
239
+ >
240
+ {#if ready}
241
+ <WorkspaceShell
242
+ {app}
243
+ displayMode="desktop"
244
+ workspaceLabel={options.profile.name}
245
+ {workspaceNavigation}
246
+ />
247
+ {:else}
248
+ <WorkspaceStartup title="Opening Lapis Notes" {tasks} {failure} />
249
+ {/if}
250
+ </section>
251
+
252
+ <style>
253
+ .notes-workspace-session {
254
+ display: grid;
255
+ width: 100%;
256
+ height: 100%;
257
+ min-width: 0;
258
+ min-height: 0;
259
+ overflow: hidden;
260
+ }
261
+ </style>
@@ -0,0 +1,8 @@
1
+ import type { NotesWorkspaceSessionProps } from "./types";
2
+ declare const NotesWorkspaceSession: import("svelte").Component<NotesWorkspaceSessionProps, {
3
+ persistLayout: () => Promise<void>;
4
+ canRecoverLeave: () => boolean;
5
+ dispose: (persist: boolean) => Promise<void>;
6
+ }, "">;
7
+ type NotesWorkspaceSession = ReturnType<typeof NotesWorkspaceSession>;
8
+ export default NotesWorkspaceSession;
@@ -0,0 +1,9 @@
1
+ import { App } from "@lapis-notes/api";
2
+ import type { NotesWorkspaceSessionProps } from "./types";
3
+ export declare function createNotesApplication(options: NotesWorkspaceSessionProps): {
4
+ app: App;
5
+ syncHost: import("@lapis-notes/api").SyncHostService;
6
+ disposeServices: () => Promise<void>;
7
+ disposeHostServices: () => Promise<void>;
8
+ release(): void;
9
+ };
@@ -0,0 +1,47 @@
1
+ import { App, installApplicationCompatibility, registerDefaultDailyDocumentProvider, takeHostSyncService, } from "@lapis-notes/api";
2
+ import { appStatePath } from "@lapis-notes/api/path";
3
+ import { registerNotesPluginBrowser, registerNotesPluginSettings, } from "../index";
4
+ export function createNotesApplication(options) {
5
+ const app = new App({
6
+ version: "2026.6.3",
7
+ configPath: appStatePath("app.json"),
8
+ session: options.session,
9
+ syncHost: options.host?.syncHost,
10
+ pluginAssetServer: options.pluginAssetServer,
11
+ pluginDistributionOptions: options.pluginDistributionOptions,
12
+ unavailablePlugins: options.host?.unavailablePlugins ?? {
13
+ ...(options.nativeChat ? {} : { ai: "desktop-only" }),
14
+ terminal: "desktop-only",
15
+ },
16
+ workspaceShell: {
17
+ application: {
18
+ name: "Lapis Notes",
19
+ buildTime: null,
20
+ copyright: "Copyright © Lapis Notes contributors.",
21
+ },
22
+ notifications: true,
23
+ },
24
+ markdownRenderer: async () => { },
25
+ });
26
+ const syncHost = takeHostSyncService(app);
27
+ const releaseCompatibility = installApplicationCompatibility(app);
28
+ const releaseSettings = registerNotesPluginSettings(app);
29
+ const releaseBrowser = registerNotesPluginBrowser(app);
30
+ const daily = registerDefaultDailyDocumentProvider(app);
31
+ const releaseHost = options.host?.attach?.(app, syncHost);
32
+ return {
33
+ app,
34
+ syncHost,
35
+ disposeServices: () => syncHost.dispose(),
36
+ disposeHostServices: async () => {
37
+ await options.host?.dispose?.(app);
38
+ },
39
+ release() {
40
+ daily.dispose();
41
+ releaseBrowser();
42
+ releaseSettings();
43
+ releaseHost?.();
44
+ releaseCompatibility();
45
+ },
46
+ };
47
+ }
@@ -0,0 +1,2 @@
1
+ import type { App, VaultSession } from "@lapis-notes/api";
2
+ export declare function registerSessionDatabaseStatus(app: App, session: VaultSession, runtime: string): () => void;
@@ -0,0 +1,37 @@
1
+ import { getWorkspaceHostBinding } from "@lapis-notes/api/workspace-host";
2
+ export function registerSessionDatabaseStatus(app, session, runtime) {
3
+ let removeStatus;
4
+ const sync = (role) => {
5
+ removeStatus?.();
6
+ removeStatus = getWorkspaceHostBinding(app.workspace).controller.status.addItem({
7
+ id: "app:web-database-role",
8
+ label: role === "server"
9
+ ? "Server DB"
10
+ : role === "proxy"
11
+ ? "DB Proxy"
12
+ : "DB Owner",
13
+ icon: "database",
14
+ tooltip: role === "server"
15
+ ? "Application data is managed by the authenticated Lapis server."
16
+ : role === "proxy"
17
+ ? "Database requests are delegated to this vault's owner tab."
18
+ : "This tab owns the local Turso database for this vault.",
19
+ align: "right",
20
+ priority: 850,
21
+ });
22
+ };
23
+ const database = session.appDatabase;
24
+ const server = runtime === "node-server" || runtime === "rust-server";
25
+ sync(server
26
+ ? "server"
27
+ : database?.descriptor.role === "proxy"
28
+ ? "proxy"
29
+ : "owner");
30
+ const unsubscribe = server
31
+ ? undefined
32
+ : database?.onCoordinationModeChange?.((mode) => sync(mode === "turso-proxy" ? "proxy" : "owner"));
33
+ return () => {
34
+ unsubscribe?.();
35
+ removeStatus?.();
36
+ };
37
+ }
@@ -0,0 +1,2 @@
1
+ export { default as NotesWorkspaceSession } from "./NotesWorkspaceSession.svelte";
2
+ export type { NotesWorkspaceHost, NotesWorkspaceSessionProps, NotesWorkspaceSessionHandle, } from "./types";
@@ -0,0 +1 @@
1
+ export { default as NotesWorkspaceSession } from "./NotesWorkspaceSession.svelte";
@@ -0,0 +1,9 @@
1
+ type WorkspaceLeaveOptions = {
2
+ preflight(): Promise<void>;
3
+ commit(persistLayout: boolean): Promise<void>;
4
+ isDisposed(): boolean;
5
+ onRefused(error: unknown): void | Promise<void>;
6
+ };
7
+ /** Preparation cannot retire a live workspace; concurrent callers share its drain. */
8
+ export declare function createWorkspaceLeave(options: WorkspaceLeaveOptions): (persistLayout: boolean) => Promise<void>;
9
+ export {};
@@ -0,0 +1,25 @@
1
+ /** Preparation cannot retire a live workspace; concurrent callers share its drain. */
2
+ export function createWorkspaceLeave(options) {
3
+ let flight;
4
+ return (persistLayout) => {
5
+ if (flight)
6
+ return flight;
7
+ if (options.isDisposed())
8
+ return Promise.resolve();
9
+ flight = Promise.resolve()
10
+ .then(() => options.preflight())
11
+ .then(() => options.commit(persistLayout))
12
+ .catch(async (error) => {
13
+ if (!options.isDisposed())
14
+ await options.onRefused(error);
15
+ throw error;
16
+ })
17
+ .finally(() => {
18
+ // Before the fence, recovery may explicitly retry. Afterwards retain
19
+ // the complete result so incomplete cleanup cannot report success.
20
+ if (!options.isDisposed())
21
+ flight = undefined;
22
+ });
23
+ return flight;
24
+ };
25
+ }
@@ -0,0 +1,14 @@
1
+ import type { App, VaultSession } from "@lapis-notes/api";
2
+ export declare function createNotesSessionLifecycle(options: {
3
+ app: App;
4
+ session: VaultSession;
5
+ fence(): void;
6
+ releaseObservers(): void;
7
+ releaseServices(): Promise<void>;
8
+ releaseHostServices(): Promise<void>;
9
+ releaseApplication(): void;
10
+ }): {
11
+ persistLayout: () => Promise<void>;
12
+ dispose: (persistLayout: boolean) => Promise<void>;
13
+ canRecoverLeave: () => boolean;
14
+ };
@@ -0,0 +1,83 @@
1
+ import { appStatePath, DEFAULT_APP_STATE_DIRECTORY, } from "@lapis-notes/api/path";
2
+ import { prepareNativeChatLeave } from "../native-chat/plugin";
3
+ import { prepareNativeRepositoryLeave, resumeNativeRepositoryLeave, } from "../native-repository";
4
+ import { createWorkspaceLeave } from "./leave";
5
+ export function createNotesSessionLifecycle(options) {
6
+ const { app, session } = options;
7
+ let disposed = false;
8
+ const persistLayout = async () => {
9
+ if (disposed || !app.workspace.layoutReady)
10
+ return;
11
+ await app.workspace.flushLayout();
12
+ await session.vaultAdapter.mkdir(DEFAULT_APP_STATE_DIRECTORY, {
13
+ recursive: true,
14
+ });
15
+ await session.vaultAdapter.write(appStatePath("workspace.json"), JSON.stringify(app.workspace.getLayout(), null, 2));
16
+ };
17
+ const dispose = createWorkspaceLeave({
18
+ isDisposed: () => disposed,
19
+ preflight: async () => {
20
+ await prepareNativeRepositoryLeave(app);
21
+ await app.vaultChanges.stop();
22
+ await app.workspace.flushPluginChanges();
23
+ await app.plugins.flushPendingConfigWrites();
24
+ await app.fileEditingSessions.settleOperations();
25
+ await app.fileEditingSessions.preflightNativeRecovery();
26
+ },
27
+ onRefused: async (error) => {
28
+ const resumed = await Promise.allSettled([
29
+ resumeNativeRepositoryLeave(app),
30
+ app.vaultChanges.start(),
31
+ ]);
32
+ const errors = resumed.flatMap((result) => result.status === "rejected" ? [result.reason] : []);
33
+ const failure = errors.length
34
+ ? new AggregateError([error, ...errors], "Leaving failed and workspace observation could not resume")
35
+ : error;
36
+ app.notifications.notify({
37
+ title: "Vault could not close",
38
+ message: failure instanceof Error ? failure.message : String(failure),
39
+ severity: "error",
40
+ source: "workspace",
41
+ persist: true,
42
+ });
43
+ if (failure !== error)
44
+ throw failure;
45
+ },
46
+ commit: async (persist) => {
47
+ if (disposed)
48
+ return;
49
+ const failures = [];
50
+ const attempt = async (action) => {
51
+ try {
52
+ await action();
53
+ }
54
+ catch (error) {
55
+ failures.push(error);
56
+ }
57
+ };
58
+ await app.fileEditingSessions.guard(undefined, async () => {
59
+ await app.workspace.flushLayout();
60
+ if (persist)
61
+ await persistLayout();
62
+ disposed = true;
63
+ await attempt(() => app.nativeTasks?.detach());
64
+ await attempt(() => prepareNativeChatLeave(app, "detach"));
65
+ options.fence();
66
+ await attempt(() => app.workspace.disposeWorkspaceHost());
67
+ await attempt(options.releaseObservers);
68
+ await attempt(() => app.metadataCache.dispose());
69
+ for (const plugin of [...app.plugins.plugins.values()].reverse()) {
70
+ await attempt(() => plugin.disable());
71
+ }
72
+ });
73
+ await attempt(() => app.fileEditingSessions.dispose());
74
+ await attempt(options.releaseServices);
75
+ await attempt(() => session.close());
76
+ await attempt(options.releaseHostServices);
77
+ if (failures.length)
78
+ throw new AggregateError(failures, "Notes session cleanup did not complete");
79
+ options.releaseApplication();
80
+ },
81
+ });
82
+ return { persistLayout, dispose, canRecoverLeave: () => !disposed };
83
+ }
@@ -0,0 +1,33 @@
1
+ import type { App, AppPluginDistributionOptions, PluginAssetServer, SyncHostService, VaultProfile, VaultSession } from "@lapis-notes/api";
2
+ import type { NativeChatHost } from "../native-chat/index";
3
+ import type { RepositoryFactory } from "../native-repository";
4
+ type AppOptions = ConstructorParameters<typeof App>[0];
5
+ /** Browser permissions and platform registration remain owned by the host. */
6
+ export interface NotesWorkspaceHost {
7
+ syncHost?: AppOptions["syncHost"];
8
+ unavailablePlugins?: AppOptions["unavailablePlugins"];
9
+ attach?(app: App, syncHost: SyncHostService): () => void;
10
+ configure?(app: App): Promise<(() => void) | void>;
11
+ /** Close host attachments after the session, before releasing compatibility ownership. */
12
+ dispose?(app: App): Promise<void>;
13
+ }
14
+ export interface NotesWorkspaceSessionProps {
15
+ profile: VaultProfile;
16
+ session: VaultSession;
17
+ runtime: "web-pwa" | "node-server" | "rust-server";
18
+ onReady(app: App): void | Promise<void>;
19
+ onOpenRecent(profile: VaultProfile): Promise<void>;
20
+ onManageVaults(): Promise<void>;
21
+ listProfiles(): Promise<VaultProfile[]>;
22
+ pluginAssetServer?: PluginAssetServer;
23
+ pluginDistributionOptions?: AppPluginDistributionOptions;
24
+ nativeChat?: (app: App) => NativeChatHost;
25
+ repositoryFactory?: RepositoryFactory;
26
+ host?: NotesWorkspaceHost;
27
+ }
28
+ export interface NotesWorkspaceSessionHandle {
29
+ persistLayout(): Promise<void>;
30
+ canRecoverLeave(): boolean;
31
+ dispose(persistLayout: boolean): Promise<void>;
32
+ }
33
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,101 @@
1
1
  {
2
2
  "name": "@lapis-notes/app-profile",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "svelte": "./dist/index.js",
9
+ "import": "./dist/index.js",
10
+ "default": "./dist/index.js"
11
+ },
12
+ "./plugin-host-build": {
13
+ "types": "./dist/plugin-host-build.d.ts",
14
+ "svelte": "./dist/plugin-host-build.js",
15
+ "import": "./dist/plugin-host-build.js",
16
+ "default": "./dist/plugin-host-build.js"
17
+ },
18
+ "./native-chat": {
19
+ "types": "./dist/native-chat/index.d.ts",
20
+ "svelte": "./dist/native-chat/index.js",
21
+ "import": "./dist/native-chat/index.js",
22
+ "default": "./dist/native-chat/index.js"
23
+ },
24
+ "./native-repository": {
25
+ "types": "./dist/native-repository.d.ts",
26
+ "svelte": "./dist/native-repository.js",
27
+ "import": "./dist/native-repository.js",
28
+ "default": "./dist/native-repository.js"
29
+ },
30
+ "./workspace-session": {
31
+ "types": "./dist/workspace-session/index.d.ts",
32
+ "svelte": "./dist/workspace-session/index.js",
33
+ "import": "./dist/workspace-session/index.js",
34
+ "default": "./dist/workspace-session/index.js"
35
+ }
36
+ },
37
+ "dependencies": {
38
+ "@lapis-notes/api": "^0.2.4",
39
+ "@lapis-notes/file-explorer": "^0.2.1",
40
+ "@lapis-notes/markdown": "^0.2.1",
41
+ "@lapis-notes/search": "^0.1.4",
42
+ "@lapis-notes/source-editor": "^0.1.3",
43
+ "@lapis-notes/workspace": "^0.3.2",
44
+ "@lapismd/agent-ui": "^0.2.0",
45
+ "@lapismd/design-core": "^0.9.0",
46
+ "@lapis-notes/history": "^0.2.0"
47
+ },
48
+ "devDependencies": {
49
+ "@sveltejs/package": "^2.5.8",
50
+ "@sveltejs/vite-plugin-svelte": "^6.2.4",
51
+ "@tsconfig/svelte": "^5.0.5",
52
+ "publint": "^0.3.12",
53
+ "svelte": "5.56.10",
54
+ "svelte-check": "^4.3.1",
55
+ "typescript": "~5.8.3",
56
+ "vite": "^7.3.6",
57
+ "vitest": "^4.1.10",
58
+ "@types/node": "^24.0.0"
59
+ },
60
+ "license": "Apache-2.0",
61
+ "files": [
62
+ "README.md",
63
+ "CHANGELOG.md",
64
+ "LICENSE.md",
65
+ "dist",
66
+ "!dist/**/*.test.*",
67
+ "!dist/**/*.fixture.*"
68
+ ],
69
+ "peerDependencies": {
70
+ "svelte": "^5.56.10",
71
+ "vite": "^6.4.5 || ^7.3.6"
72
+ },
73
+ "description": "Shared Lapis Notes application profile and workspace session",
74
+ "repository": {
75
+ "type": "git",
76
+ "url": "git+https://github.com/lapismd/lapis-notes.git",
77
+ "directory": "packages/app-profile"
78
+ },
79
+ "homepage": "https://github.com/lapismd/lapis-notes/tree/main/packages/app-profile#readme",
80
+ "bugs": {
81
+ "url": "https://github.com/lapismd/lapis-notes/issues"
82
+ },
83
+ "publishConfig": {
84
+ "access": "public"
85
+ },
86
+ "svelte": "./dist/index.js",
87
+ "types": "./dist/index.d.ts",
88
+ "sideEffects": [
89
+ "**/*.css"
90
+ ],
91
+ "peerDependenciesMeta": {
92
+ "vite": {
93
+ "optional": true
94
+ }
95
+ },
96
+ "scripts": {
97
+ "build": "pnpm check && svelte-package --input src --output dist --tsconfig tsconfig.pack.json",
98
+ "check": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings --output human",
99
+ "test": "vitest run"
100
+ }
6
101
  }