@prettier-ai/dsh-client-ui-model-selection 0.1.2-alpha.1 → 0.1.2-alpha.2
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/lib/client.js +9 -6
- package/lib/types/client/catalog.d.ts +8 -4
- package/package.json +18 -29
package/lib/client.js
CHANGED
|
@@ -13,7 +13,7 @@ window.__ModuleLoader__.load({
|
|
|
13
13
|
/** One Host-generation model catalog shared by every Session selector. */
|
|
14
14
|
/** Loads at most one model catalog for the current Host generation. */
|
|
15
15
|
var ModelCatalogDirectory = class {
|
|
16
|
-
|
|
16
|
+
ctx;
|
|
17
17
|
/** Current shared catalog value and load lifecycle. */
|
|
18
18
|
store = (0, _prettier_ai_dsh_client_store.createSnapshotStore)({
|
|
19
19
|
value: null,
|
|
@@ -22,9 +22,12 @@ window.__ModuleLoader__.load({
|
|
|
22
22
|
});
|
|
23
23
|
generation = 0;
|
|
24
24
|
inflight;
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
/**
|
|
26
|
+
* @param ctx - the providing plugin's context, whose `remote.session`
|
|
27
|
+
* namespace carries the Host-generation catalog.
|
|
28
|
+
*/
|
|
29
|
+
constructor(ctx) {
|
|
30
|
+
this.ctx = ctx;
|
|
28
31
|
}
|
|
29
32
|
/**
|
|
30
33
|
* Return the current generation's catalog, sharing its one in-flight load.
|
|
@@ -39,7 +42,7 @@ window.__ModuleLoader__.load({
|
|
|
39
42
|
draft.status = "loading";
|
|
40
43
|
draft.error = null;
|
|
41
44
|
});
|
|
42
|
-
const operation = this.session.modelCatalog().then((response) => {
|
|
45
|
+
const operation = this.ctx.remote.session.modelCatalog().then((response) => {
|
|
43
46
|
if (!response.ok) throw new Error(`${response.error.code}: ${response.error.message}`);
|
|
44
47
|
if (generation === this.generation) this.store.set({
|
|
45
48
|
value: response.value,
|
|
@@ -267,7 +270,7 @@ window.__ModuleLoader__.load({
|
|
|
267
270
|
constructor(ctx, config) {
|
|
268
271
|
super(ctx, "modelDirectories");
|
|
269
272
|
this.blockReason = config.blockReason;
|
|
270
|
-
this.catalog = new ModelCatalogDirectory(ctx
|
|
273
|
+
this.catalog = new ModelCatalogDirectory(ctx);
|
|
271
274
|
this.catalog.load().catch(() => {});
|
|
272
275
|
ctx.on("connection/reset", () => {
|
|
273
276
|
this.catalog.resetGeneration();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** One Host-generation model catalog shared by every Session selector. */
|
|
2
|
-
import type {
|
|
2
|
+
import type { Context as ClientContext } from '@prettier-ai/cordis';
|
|
3
|
+
import type { ModelCatalog } from '@prettier-ai/dsh-api-remotes/client';
|
|
3
4
|
import { type SnapshotStore } from '@prettier-ai/dsh-client-store';
|
|
4
5
|
/** Observable lifecycle of the shared model catalog. */
|
|
5
6
|
export interface ModelCatalogState {
|
|
@@ -9,13 +10,16 @@ export interface ModelCatalogState {
|
|
|
9
10
|
}
|
|
10
11
|
/** Loads at most one model catalog for the current Host generation. */
|
|
11
12
|
export declare class ModelCatalogDirectory {
|
|
12
|
-
private readonly
|
|
13
|
+
private readonly ctx;
|
|
13
14
|
/** Current shared catalog value and load lifecycle. */
|
|
14
15
|
readonly store: SnapshotStore<ModelCatalogState>;
|
|
15
16
|
private generation;
|
|
16
17
|
private inflight;
|
|
17
|
-
/**
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @param ctx - the providing plugin's context, whose `remote.session`
|
|
20
|
+
* namespace carries the Host-generation catalog.
|
|
21
|
+
*/
|
|
22
|
+
constructor(ctx: ClientContext);
|
|
19
23
|
/**
|
|
20
24
|
* Return the current generation's catalog, sharing its one in-flight load.
|
|
21
25
|
* @returns the loaded global catalog.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prettier-ai/dsh-client-ui-model-selection",
|
|
3
3
|
"description": "Model selection over the shared model catalog, Session projection, and session.selectModel",
|
|
4
|
-
"version": "0.1.2-alpha.
|
|
4
|
+
"version": "0.1.2-alpha.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -42,38 +42,27 @@
|
|
|
42
42
|
},
|
|
43
43
|
"license": "MIT",
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@prettier-ai/
|
|
46
|
-
"@prettier-ai/dsh-client-ui-commands": "^0.1.2-alpha.1",
|
|
47
|
-
"@prettier-ai/dsh-client-ui-conversation": "^0.1.2-alpha.1",
|
|
48
|
-
"@prettier-ai/dsh-api-remotes": "^0.1.2-alpha.1",
|
|
49
|
-
"@prettier-ai/dsh-api-session-controller": "^0.1.2-alpha.1",
|
|
50
|
-
"@prettier-ai/cordis": "^4.0.1",
|
|
51
|
-
"@prettier-ai/dsh-client-ui-input-trigger": "^0.1.2-alpha.1",
|
|
52
|
-
"@prettier-ai/dsh-typert-protocol": "^0.1.2-alpha.1",
|
|
53
|
-
"@prettier-ai/dsh-session": "^0.1.2-alpha.1",
|
|
54
|
-
"@prettier-ai/dsh-client-ui-renderer": "^0.1.2-alpha.1",
|
|
55
|
-
"@prettier-ai/dsh-client-ui-session": "^0.1.2-alpha.1",
|
|
56
|
-
"@prettier-ai/dsh-invariants": "^0.1.2-alpha.1"
|
|
45
|
+
"@prettier-ai/cordis": "^4.0.2"
|
|
57
46
|
},
|
|
58
47
|
"devDependencies": {
|
|
59
48
|
"@types/react": "~18.3.1",
|
|
60
49
|
"react": "^18.2.0",
|
|
61
|
-
"@prettier-ai/dsh-api-remotes": "^0.1.2-alpha.
|
|
62
|
-
"@prettier-ai/dsh-client-
|
|
63
|
-
"@prettier-ai/dsh-
|
|
64
|
-
"@prettier-ai/dsh-client-ui-conversation": "^0.1.2-alpha.
|
|
65
|
-
"@prettier-ai/dsh-
|
|
66
|
-
"@prettier-ai/dsh-client-
|
|
67
|
-
"@prettier-ai/dsh-client-ui-input-trigger": "^0.1.2-alpha.
|
|
68
|
-
"@prettier-ai/dsh-client-ui-primitives": "^0.1.2-alpha.
|
|
69
|
-
"@prettier-ai/dsh-client-ui-slots": "^0.1.2-alpha.
|
|
70
|
-
"@prettier-ai/
|
|
71
|
-
"@prettier-ai/dsh-
|
|
72
|
-
"@prettier-ai/
|
|
73
|
-
"@prettier-ai/dsh-client-
|
|
74
|
-
"@prettier-ai/dsh-
|
|
75
|
-
"@prettier-ai/dsh-
|
|
76
|
-
"@prettier-ai/dsh-client-ui-session": "^0.1.2-alpha.
|
|
50
|
+
"@prettier-ai/dsh-api-remotes": "^0.1.2-alpha.2",
|
|
51
|
+
"@prettier-ai/dsh-client-locale": "^0.1.2-alpha.2",
|
|
52
|
+
"@prettier-ai/dsh-client-test-runtime": "^0.1.2-alpha.2",
|
|
53
|
+
"@prettier-ai/dsh-client-ui-conversation": "^0.1.2-alpha.2",
|
|
54
|
+
"@prettier-ai/dsh-api-session-controller": "^0.1.2-alpha.2",
|
|
55
|
+
"@prettier-ai/dsh-client-ui-commands": "^0.1.2-alpha.2",
|
|
56
|
+
"@prettier-ai/dsh-client-ui-input-trigger": "^0.1.2-alpha.2",
|
|
57
|
+
"@prettier-ai/dsh-client-ui-primitives": "^0.1.2-alpha.2",
|
|
58
|
+
"@prettier-ai/dsh-client-ui-slots": "^0.1.2-alpha.2",
|
|
59
|
+
"@prettier-ai/cordis": "^4.0.2",
|
|
60
|
+
"@prettier-ai/dsh-invariants": "^0.1.2-alpha.2",
|
|
61
|
+
"@prettier-ai/dsh-session": "^0.1.2-alpha.2",
|
|
62
|
+
"@prettier-ai/dsh-client-ui-renderer": "^0.1.2-alpha.2",
|
|
63
|
+
"@prettier-ai/dsh-client-store": "^0.1.2-alpha.2",
|
|
64
|
+
"@prettier-ai/dsh-typert-protocol": "^0.1.2-alpha.2",
|
|
65
|
+
"@prettier-ai/dsh-client-ui-session": "^0.1.2-alpha.2"
|
|
77
66
|
},
|
|
78
67
|
"files": [
|
|
79
68
|
"lib/index.js",
|