@lapis-notes/app-profile 0.1.0 → 0.2.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.
- package/CHANGELOG.md +24 -0
- package/README.md +3 -0
- package/dist/native-chat/plugin.js +6 -0
- package/dist/workspace-session/NotesWorkspaceSession.svelte +26 -21
- package/dist/workspace-session/native-chat-registration.d.ts +3 -0
- package/dist/workspace-session/native-chat-registration.js +10 -0
- package/dist/workspace-session/startup-plugin-retirement.d.ts +3 -0
- package/dist/workspace-session/startup-plugin-retirement.js +8 -0
- package/package.json +12 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @lapis-notes/app-profile
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#127](https://github.com/lapismd/lapis-notes/pull/127)
|
|
8
|
+
[`40fd72e`](https://github.com/lapismd/lapis-notes/commit/40fd72ee9581ab804acbe1736a985d33e451c009)
|
|
9
|
+
Thanks [@stevejuma](https://github.com/stevejuma)! - Restore the complete
|
|
10
|
+
shared workspace session and optional native Repository registration to built
|
|
11
|
+
public exports. Consume the released API and History remotes cohort through
|
|
12
|
+
normal registry ranges while retaining current browser appearance, native Chat
|
|
13
|
+
startup/retry and guarded session lifetime.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#128](https://github.com/lapismd/lapis-notes/pull/128)
|
|
18
|
+
[`acdb5bc`](https://github.com/lapismd/lapis-notes/commit/acdb5bc6a3636fd536b21eb3c1409ee3418f1e15)
|
|
19
|
+
Thanks [@stevejuma](https://github.com/stevejuma)! - Keep the mounted
|
|
20
|
+
workspace inert and its session-ready marker false until initial layout
|
|
21
|
+
projection and the host readiness callback finish.
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
[[`2645d4b`](https://github.com/lapismd/lapis-notes/commit/2645d4ba3689a6a153d8fe2face6773589ccb1c0)]:
|
|
24
|
+
- @lapis-notes/api@0.6.4
|
|
25
|
+
- @lapis-notes/workspace@0.4.6
|
|
26
|
+
|
|
3
27
|
## 0.1.0
|
|
4
28
|
|
|
5
29
|
- Prepare the shared Notes application profile and workspace session for public
|
package/README.md
CHANGED
|
@@ -17,5 +17,8 @@ A refused leave retains the live application and permits an explicit retry.
|
|
|
17
17
|
A host may supply `host.dispose(app)` to close attachments after the session;
|
|
18
18
|
the compatibility lease remains installed until that awaited cleanup succeeds.
|
|
19
19
|
|
|
20
|
+
The native Repository type surface includes the released History SDK dependency;
|
|
21
|
+
hosts still supply every native reader and transport.
|
|
22
|
+
|
|
20
23
|
Other public entries are the default profile, `plugin-host-build`, `native-chat`
|
|
21
24
|
and `native-repository`. Every entry resolves built package output.
|
|
@@ -10,6 +10,7 @@ export function prepareNativeChatLeave(app, reason) {
|
|
|
10
10
|
export function createNativeChatPlugin(factory) {
|
|
11
11
|
return class NativeChatPlugin extends Plugin {
|
|
12
12
|
session;
|
|
13
|
+
#retired = false;
|
|
13
14
|
views = new Set();
|
|
14
15
|
navigation;
|
|
15
16
|
constructor(app) {
|
|
@@ -25,6 +26,10 @@ export function createNativeChatPlugin(factory) {
|
|
|
25
26
|
this.navigation = new NativeChatNavigation(app);
|
|
26
27
|
}
|
|
27
28
|
async onload() {
|
|
29
|
+
if (this.#retired) {
|
|
30
|
+
this.session = new NativeChatSession(factory(this.app));
|
|
31
|
+
this.#retired = false;
|
|
32
|
+
}
|
|
28
33
|
for (const [type, title, icon] of [
|
|
29
34
|
["ai", "AI", "sparkles"],
|
|
30
35
|
["ai-conversation-history", "AI conversations", "history"],
|
|
@@ -54,6 +59,7 @@ export function createNativeChatPlugin(factory) {
|
|
|
54
59
|
async onunload() {
|
|
55
60
|
await Promise.all([...this.views].map((view) => view.close()));
|
|
56
61
|
await this.session.close(modes.get(this.app) ?? "disable");
|
|
62
|
+
this.#retired = true;
|
|
57
63
|
modes.delete(this.app);
|
|
58
64
|
}
|
|
59
65
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { provideApplicationState, type VaultProfile } from "@lapis-notes/api";
|
|
3
3
|
import { DEFAULT_APP_STATE_DIRECTORY } from "@lapis-notes/api/path";
|
|
4
|
+
import { getWorkspaceHostBinding } from "@lapis-notes/api/workspace-host";
|
|
4
5
|
import { WorkspaceShell } from "@lapis-notes/workspace";
|
|
5
6
|
import type { WorkspaceNavigation } from "@lapismd/design-core/workspace/app-shell";
|
|
6
7
|
import {
|
|
@@ -8,9 +9,10 @@
|
|
|
8
9
|
type WorkspaceStartupFailure,
|
|
9
10
|
type WorkspaceStartupTask,
|
|
10
11
|
} from "@lapismd/design-core/workspace/startup";
|
|
11
|
-
import { onMount, untrack } from "svelte";
|
|
12
|
+
import { onMount, tick, untrack } from "svelte";
|
|
12
13
|
import { notesPluginProfile } from "../index";
|
|
13
|
-
import {
|
|
14
|
+
import { registerSessionNativeChat } from "./native-chat-registration";
|
|
15
|
+
import { retirePluginsForRetry } from "./startup-plugin-retirement";
|
|
14
16
|
import { registerNativeRepository } from "../native-repository";
|
|
15
17
|
import { createNotesApplication } from "./application";
|
|
16
18
|
import { registerSessionDatabaseStatus } from "./database-status";
|
|
@@ -27,6 +29,7 @@
|
|
|
27
29
|
{ id: "plugins", label: "Load configured core plugins", status: "pending" },
|
|
28
30
|
{ id: "layout", label: "Restore the workspace layout", status: "pending" },
|
|
29
31
|
];
|
|
32
|
+
let interactive = $state(false);
|
|
30
33
|
let ready = $state(false);
|
|
31
34
|
let tasks = $state(structuredClone(startupTasks));
|
|
32
35
|
let failure = $state<WorkspaceStartupFailure | null>(null);
|
|
@@ -42,6 +45,7 @@
|
|
|
42
45
|
app,
|
|
43
46
|
session: untrack(() => options.session),
|
|
44
47
|
fence: () => {
|
|
48
|
+
interactive = false;
|
|
45
49
|
ready = false;
|
|
46
50
|
},
|
|
47
51
|
releaseObservers,
|
|
@@ -115,23 +119,22 @@
|
|
|
115
119
|
}
|
|
116
120
|
|
|
117
121
|
async function teardownPartialBoot(): Promise<void> {
|
|
122
|
+
interactive = false;
|
|
118
123
|
ready = false;
|
|
119
124
|
releaseObservers();
|
|
120
|
-
await app.vaultChanges.stop();
|
|
121
|
-
|
|
122
|
-
await plugin.disable();
|
|
123
|
-
}
|
|
125
|
+
await app.vaultChanges.stop().catch(() => undefined);
|
|
126
|
+
await retirePluginsForRetry(app);
|
|
124
127
|
}
|
|
125
128
|
|
|
126
|
-
function initialize(
|
|
129
|
+
function initialize(): Promise<void> {
|
|
127
130
|
if (bootFlight) return bootFlight;
|
|
128
|
-
bootFlight = start(
|
|
131
|
+
bootFlight = start().finally(() => {
|
|
129
132
|
bootFlight = undefined;
|
|
130
133
|
});
|
|
131
134
|
return bootFlight;
|
|
132
135
|
}
|
|
133
136
|
|
|
134
|
-
async function start(
|
|
137
|
+
async function start(): Promise<void> {
|
|
135
138
|
if (!lifecycle.canRecoverLeave() || booting) return;
|
|
136
139
|
booting = true;
|
|
137
140
|
failure = null;
|
|
@@ -151,17 +154,11 @@
|
|
|
151
154
|
);
|
|
152
155
|
}
|
|
153
156
|
if (options.nativeChat)
|
|
154
|
-
app.
|
|
155
|
-
{
|
|
156
|
-
plugin: createNativeChatPlugin(options.nativeChat),
|
|
157
|
-
required: false,
|
|
158
|
-
enabledByDefault: false,
|
|
159
|
-
},
|
|
160
|
-
]);
|
|
157
|
+
registerSessionNativeChat(app, options.nativeChat, options.runtime);
|
|
161
158
|
corePluginsRegistered = true;
|
|
162
159
|
}
|
|
163
|
-
await app.vault.load(
|
|
164
|
-
await application.syncHost.ready(
|
|
160
|
+
await app.vault.load();
|
|
161
|
+
await application.syncHost.ready();
|
|
165
162
|
await app.vault.mkpath(DEFAULT_APP_STATE_DIRECTORY);
|
|
166
163
|
if (!lifecycle.canRecoverLeave()) return;
|
|
167
164
|
setTask(activeTask, "complete");
|
|
@@ -192,12 +189,19 @@
|
|
|
192
189
|
options.runtime,
|
|
193
190
|
);
|
|
194
191
|
await app.vaultChanges.start();
|
|
192
|
+
await getWorkspaceHostBinding(app.workspace).controller.start();
|
|
195
193
|
if (!lifecycle.canRecoverLeave()) return;
|
|
196
194
|
setTask(activeTask, "complete");
|
|
197
195
|
ready = true;
|
|
196
|
+
await tick();
|
|
197
|
+
await app.workspace.flushLayout();
|
|
198
|
+
if (!lifecycle.canRecoverLeave()) return;
|
|
198
199
|
await options.onReady(app);
|
|
200
|
+
if (!lifecycle.canRecoverLeave()) return;
|
|
201
|
+
interactive = true;
|
|
199
202
|
startMetadataCache();
|
|
200
203
|
} catch (error) {
|
|
204
|
+
interactive = false;
|
|
201
205
|
ready = false;
|
|
202
206
|
setTask(activeTask, "failed");
|
|
203
207
|
failure = {
|
|
@@ -212,7 +216,7 @@
|
|
|
212
216
|
id: "retry",
|
|
213
217
|
label: "Retry",
|
|
214
218
|
icon: "refresh-cw",
|
|
215
|
-
onSelect: () => initialize(
|
|
219
|
+
onSelect: () => initialize(),
|
|
216
220
|
},
|
|
217
221
|
],
|
|
218
222
|
};
|
|
@@ -231,16 +235,17 @@
|
|
|
231
235
|
|
|
232
236
|
<section
|
|
233
237
|
class="notes-workspace-session"
|
|
234
|
-
data-notes-session-ready={
|
|
238
|
+
data-notes-session-ready={interactive}
|
|
235
239
|
data-web-runtime={options.runtime}
|
|
236
240
|
data-vault-id={options.profile.id}
|
|
237
241
|
aria-label="Notes workspace"
|
|
238
242
|
role="group"
|
|
243
|
+
aria-busy={!interactive}
|
|
244
|
+
inert={ready && !interactive}
|
|
239
245
|
>
|
|
240
246
|
{#if ready}
|
|
241
247
|
<WorkspaceShell
|
|
242
248
|
{app}
|
|
243
|
-
displayMode="desktop"
|
|
244
249
|
workspaceLabel={options.profile.name}
|
|
245
250
|
{workspaceNavigation}
|
|
246
251
|
/>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createNativeChatPlugin, } from "../native-chat/index";
|
|
2
|
+
export function registerSessionNativeChat(app, factory, runtime) {
|
|
3
|
+
app.plugins.registerStaticPlugins([
|
|
4
|
+
{
|
|
5
|
+
plugin: createNativeChatPlugin(factory),
|
|
6
|
+
required: false,
|
|
7
|
+
enabledByDefault: runtime === "rust-server",
|
|
8
|
+
},
|
|
9
|
+
]);
|
|
10
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { prepareNativeChatLeave } from "../native-chat/index";
|
|
2
|
+
/** Retire this App's plugin observations before retrying startup. */
|
|
3
|
+
export async function retirePluginsForRetry(app) {
|
|
4
|
+
prepareNativeChatLeave(app, "detach");
|
|
5
|
+
for (const plugin of [...app.plugins.plugins.values()].reverse()) {
|
|
6
|
+
await plugin.disable().catch(() => undefined);
|
|
7
|
+
}
|
|
8
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lapis-notes/app-profile",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -35,15 +35,16 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@lapis-notes/api": "^0.
|
|
39
|
-
"@lapis-notes/file-explorer": "^0.2.
|
|
40
|
-
"@lapis-notes/markdown": "^0.
|
|
41
|
-
"@lapis-notes/search": "^0.1.
|
|
42
|
-
"@lapis-notes/source-editor": "^0.1.
|
|
43
|
-
"@lapis-notes/workspace": "^0.
|
|
44
|
-
"@lapismd/agent-ui": "^0.2.
|
|
45
|
-
"@lapismd/design-core": "^0.
|
|
46
|
-
"@lapis-notes/history": "^0.
|
|
38
|
+
"@lapis-notes/api": "^0.6.4",
|
|
39
|
+
"@lapis-notes/file-explorer": "^0.2.8",
|
|
40
|
+
"@lapis-notes/markdown": "^0.3.1",
|
|
41
|
+
"@lapis-notes/search": "^0.1.12",
|
|
42
|
+
"@lapis-notes/source-editor": "^0.1.11",
|
|
43
|
+
"@lapis-notes/workspace": "^0.4.6",
|
|
44
|
+
"@lapismd/agent-ui": "^0.2.6",
|
|
45
|
+
"@lapismd/design-core": "^0.13.3",
|
|
46
|
+
"@lapis-notes/history": "^0.4.0",
|
|
47
|
+
"@lapismd/jj-history": "^0.1.0"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
50
|
"@sveltejs/package": "^2.5.8",
|
|
@@ -55,7 +56,7 @@
|
|
|
55
56
|
"typescript": "~5.8.3",
|
|
56
57
|
"vite": "^7.3.6",
|
|
57
58
|
"vitest": "^4.1.10",
|
|
58
|
-
"@types/node": "^
|
|
59
|
+
"@types/node": "^26.1.2"
|
|
59
60
|
},
|
|
60
61
|
"license": "Apache-2.0",
|
|
61
62
|
"files": [
|