@askdkc/dsh-cli 0.12.0 → 0.12.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/README.md +12 -9
- package/lib/types/components/ModelDialogLayer.d.ts +12 -0
- package/lib/types/components/ModelDialogLayer.d.ts.map +1 -0
- package/lib/types/components/ModelDialogLayer.js +39 -0
- package/lib/types/components/ModelPicker.d.ts +12 -41
- package/lib/types/components/ModelPicker.d.ts.map +1 -1
- package/lib/types/components/ModelPicker.js +15 -44
- package/lib/types/components/design-system/ListItem.d.ts.map +1 -1
- package/lib/types/components/design-system/ListItem.js +1 -1
- package/lib/types/dsh-adapter/channel/command-completions.d.ts.map +1 -1
- package/lib/types/dsh-adapter/channel/command-completions.js +11 -2
- package/lib/types/dsh-adapter/contract.d.ts +4 -3
- package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
- package/lib/types/dsh-adapter/contract.js +6 -3
- package/lib/types/i18n.d.ts +18 -26
- package/lib/types/i18n.d.ts.map +1 -1
- package/lib/types/i18n.js +5 -7
- package/lib/types/modelFavorites.d.ts +8 -0
- package/lib/types/modelFavorites.d.ts.map +1 -0
- package/lib/types/modelFavorites.js +59 -0
- package/lib/types/modelGroups.d.ts +3 -6
- package/lib/types/modelGroups.d.ts.map +1 -1
- package/lib/types/modelGroups.js +4 -7
- package/lib/types/modelPickerRows.d.ts +19 -0
- package/lib/types/modelPickerRows.d.ts.map +1 -0
- package/lib/types/modelPickerRows.js +54 -0
- package/lib/types/screens/Chat.d.ts.map +1 -1
- package/lib/types/screens/Chat.js +186 -237
- package/lib/types/screens/chatOverlay.d.ts.map +1 -1
- package/lib/types/screens/chatOverlay.js +2 -0
- package/node_modules/@askdkc/dsh-auth/package.json +10 -10
- package/node_modules/dsh-working-activity/package.json +9 -9
- package/package.json +92 -92
package/lib/types/modelGroups.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* `scripts/verify-model-picker-groups.mjs` can drive it headless; the
|
|
6
|
-
* recents row's localized label is resolved at render time (its `label`
|
|
7
|
-
* field is the {@link RECENTS_LABEL_PLACEHOLDER} sentinel).
|
|
2
|
+
* Shared literal model filtering and the retained group-derivation helpers.
|
|
3
|
+
* The centered picker builds its display rows in modelPickerRows.ts;
|
|
4
|
+
* older group consumers and their regression tests still use the helpers here.
|
|
8
5
|
*
|
|
9
6
|
* @module dsh-tui/modelGroups
|
|
10
7
|
*/
|
|
@@ -23,7 +20,7 @@ export function filterModels(models, query, providers) {
|
|
|
23
20
|
return models;
|
|
24
21
|
return models.filter(model => {
|
|
25
22
|
const providerName = providers.find(provider => provider.id === model.provider)?.name ?? '';
|
|
26
|
-
const fields = [model.name, model.id, model.provider, providerName].map(value => value.toLowerCase());
|
|
23
|
+
const fields = [model.name, model.id, model.provider, providerName, `${model.provider}/${model.id}`].map(value => value.toLowerCase());
|
|
27
24
|
return terms.every(term => fields.some(field => field.includes(term)));
|
|
28
25
|
});
|
|
29
26
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { LlmModelInfo, LlmProviderInfo } from './adapter/ports/channel-view.js';
|
|
2
|
+
import type { ModelRef } from './modelGroups.js';
|
|
3
|
+
export type ModelPickerRow = {
|
|
4
|
+
kind: 'heading';
|
|
5
|
+
key: string;
|
|
6
|
+
label: string;
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'model';
|
|
9
|
+
key: string;
|
|
10
|
+
section: string;
|
|
11
|
+
model: LlmModelInfo;
|
|
12
|
+
providerName: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function modelPickerRows(models: readonly LlmModelInfo[], providers: readonly LlmProviderInfo[], favorites: readonly ModelRef[], recents: readonly ModelRef[], query: string): readonly ModelPickerRow[];
|
|
15
|
+
export declare function focusedModelRow(rows: readonly ModelPickerRow[], index: number): Extract<ModelPickerRow, {
|
|
16
|
+
kind: 'model';
|
|
17
|
+
}> | undefined;
|
|
18
|
+
export declare function moveModelFocus(rows: readonly ModelPickerRow[], index: number, delta: number): number;
|
|
19
|
+
//# sourceMappingURL=modelPickerRows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modelPickerRows.d.ts","sourceRoot":"","sources":["../../src/modelPickerRows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAEpF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAEhD,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/C;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,YAAY,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAA;AAE9F,wBAAgB,eAAe,CAC7B,MAAM,EAAE,SAAS,YAAY,EAAE,EAC/B,SAAS,EAAE,SAAS,eAAe,EAAE,EACrC,SAAS,EAAE,SAAS,QAAQ,EAAE,EAC9B,OAAO,EAAE,SAAS,QAAQ,EAAE,EAC5B,KAAK,EAAE,MAAM,GACZ,SAAS,cAAc,EAAE,CAmC3B;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,cAAc,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,GAAG,SAAS,CAGtI;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,cAAc,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAQpG"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { filterModels } from './modelGroups.js';
|
|
2
|
+
export function modelPickerRows(models, providers, favorites, recents, query) {
|
|
3
|
+
const names = new Map(providers.map(provider => [provider.id, provider.name]));
|
|
4
|
+
const seen = new Set();
|
|
5
|
+
const catalog = models.filter(model => {
|
|
6
|
+
const key = `${model.provider}\0${model.id}`;
|
|
7
|
+
if (seen.has(key))
|
|
8
|
+
return false;
|
|
9
|
+
seen.add(key);
|
|
10
|
+
return true;
|
|
11
|
+
});
|
|
12
|
+
const row = (section, model) => ({
|
|
13
|
+
kind: 'model', key: `${section}:${model.provider}/${model.id}`, section, model,
|
|
14
|
+
providerName: names.get(model.provider) ?? model.provider,
|
|
15
|
+
});
|
|
16
|
+
const filtered = filterModels(catalog, query, providers);
|
|
17
|
+
if (query.trim())
|
|
18
|
+
return filtered.map(model => row('search', model));
|
|
19
|
+
const result = [];
|
|
20
|
+
const lookup = (ref) => catalog.find(model => model.provider === ref.provider && model.id === ref.id);
|
|
21
|
+
const favoriteModels = favorites.map(lookup).filter((model) => model !== undefined);
|
|
22
|
+
if (favoriteModels.length) {
|
|
23
|
+
result.push({ kind: 'heading', key: 'heading:favorites', label: 'Favorites' });
|
|
24
|
+
result.push(...favoriteModels.map(model => row('favorites', model)));
|
|
25
|
+
}
|
|
26
|
+
const recentModels = recents
|
|
27
|
+
.filter(ref => !favorites.some(favorite => favorite.provider === ref.provider && favorite.id === ref.id))
|
|
28
|
+
.map(lookup).filter((model) => model !== undefined);
|
|
29
|
+
if (recentModels.length) {
|
|
30
|
+
result.push({ kind: 'heading', key: 'heading:recent', label: 'Recent' });
|
|
31
|
+
result.push(...recentModels.map(model => row('recent', model)));
|
|
32
|
+
}
|
|
33
|
+
const order = [...new Set(catalog.map(model => model.provider))];
|
|
34
|
+
for (const provider of order) {
|
|
35
|
+
result.push({ kind: 'heading', key: `heading:${provider}`, label: names.get(provider) ?? provider });
|
|
36
|
+
result.push(...catalog.filter(model => model.provider === provider).map(model => row(provider, model)));
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
export function focusedModelRow(rows, index) {
|
|
41
|
+
const row = rows[index];
|
|
42
|
+
return row?.kind === 'model' ? row : undefined;
|
|
43
|
+
}
|
|
44
|
+
export function moveModelFocus(rows, index, delta) {
|
|
45
|
+
if (!rows.length)
|
|
46
|
+
return 0;
|
|
47
|
+
let next = index;
|
|
48
|
+
for (let attempt = 0; attempt < rows.length; attempt++) {
|
|
49
|
+
next = (next + delta + rows.length) % rows.length;
|
|
50
|
+
if (rows[next]?.kind === 'model')
|
|
51
|
+
return next;
|
|
52
|
+
}
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../src/screens/Chat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../src/screens/Chat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AA0BzB,OAAO,KAAK,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,iCAAiC,CAAA;AAE3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAwB,MAAM,0BAA0B,CAAA;AAC/E,OAAO,EAAE,aAAa,EAAe,MAAM,kCAAkC,CAAA;AAE7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAG5D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAkB3D,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAEjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAy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