dsh-keys-manager 0.3.1 → 0.3.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/CHANGELOG.md +6 -0
- package/lib/capabilities.d.ts +26 -0
- package/lib/capabilities.js +50 -0
- package/lib/capabilities.js.map +1 -0
- package/lib/extra-capabilities.generated.d.ts +11 -0
- package/lib/extra-capabilities.generated.js +1349 -0
- package/lib/extra-capabilities.generated.js.map +1 -0
- package/lib/index.d.ts +21 -0
- package/lib/index.js +83 -5
- package/lib/index.js.map +1 -1
- package/package.json +3 -2
- package/scripts/generate-extra-capabilities.mjs +127 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to dsh-keys-manager are documented here. Assembled from `.changes/unreleased/` fragments by the release-prep workflow.
|
|
4
4
|
|
|
5
|
+
## [0.3.2] - 2026-11-10
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Extra-provider models that accept images are installed and repaired with `input: ["text", "image"]` from the pinned omp catalog instead of looking text-only.
|
|
10
|
+
|
|
5
11
|
## [0.3.1] - 2026-11-07
|
|
6
12
|
|
|
7
13
|
### Changed
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input modalities for the extra-provider model rows.
|
|
3
|
+
*
|
|
4
|
+
* DSH's remote model discovery reports no input modalities for a route its
|
|
5
|
+
* bundled catalog does not ship — which is every extra provider — so a profile
|
|
6
|
+
* written from that answer makes even an image model look text-only. The pinned
|
|
7
|
+
* omp catalog does know, so {@link EXTRA_IMAGE_MODELS} decides: a row whose id
|
|
8
|
+
* is listed is `text + image`, everything else is text.
|
|
9
|
+
*
|
|
10
|
+
* @module dsh-keys-manager/capabilities
|
|
11
|
+
*/
|
|
12
|
+
import type { ModelRecord } from './domain.js';
|
|
13
|
+
/**
|
|
14
|
+
* Fill the modalities of a discovery answer before it is written to a profile:
|
|
15
|
+
* a discovered modality list always wins (DSH knows its own bundled routes),
|
|
16
|
+
* an indexed id gets `text + image`, and every other row is plain text.
|
|
17
|
+
*/
|
|
18
|
+
export declare function mergeModelCapabilities(providerId: string, models: readonly ModelRecord[]): ModelRecord[];
|
|
19
|
+
/**
|
|
20
|
+
* Fill the image capability the index knows into rows of a profile this
|
|
21
|
+
* manager wrote before the index existed. Only a row the pin marks image and
|
|
22
|
+
* that carries no `input` at all changes; every other row is returned as it is,
|
|
23
|
+
* so a repaired profile is byte-identical except for those rows.
|
|
24
|
+
* `undefined` means there is nothing to repair and nothing to write.
|
|
25
|
+
*/
|
|
26
|
+
export declare function repairImageModalities(providerId: string, models: readonly ModelRecord[]): ModelRecord[] | undefined;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { EXTRA_IMAGE_MODELS } from './extra-capabilities.generated.js';
|
|
2
|
+
import { EXTRA_PROVIDER_MAP } from './providers.js';
|
|
3
|
+
const TEXT_INPUT = ['text'];
|
|
4
|
+
const TEXT_IMAGE_INPUT = ['text', 'image'];
|
|
5
|
+
/**
|
|
6
|
+
* The image-capable ids of one extra route: `[]` when the pin describes the
|
|
7
|
+
* route with no image model, `undefined` when the route is not an extra one
|
|
8
|
+
* (the installed DSH catalog answers for its own routes, not this index).
|
|
9
|
+
*/
|
|
10
|
+
function imageIds(providerId) {
|
|
11
|
+
if (!EXTRA_PROVIDER_MAP.has(providerId))
|
|
12
|
+
return undefined;
|
|
13
|
+
return EXTRA_IMAGE_MODELS[providerId] ?? [];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Fill the modalities of a discovery answer before it is written to a profile:
|
|
17
|
+
* a discovered modality list always wins (DSH knows its own bundled routes),
|
|
18
|
+
* an indexed id gets `text + image`, and every other row is plain text.
|
|
19
|
+
*/
|
|
20
|
+
export function mergeModelCapabilities(providerId, models) {
|
|
21
|
+
const image = imageIds(providerId);
|
|
22
|
+
if (image === undefined)
|
|
23
|
+
return [...models];
|
|
24
|
+
const imageSet = new Set(image);
|
|
25
|
+
return models.map(model => model.input !== undefined
|
|
26
|
+
? model
|
|
27
|
+
: { ...model, input: imageSet.has(model.id) ? [...TEXT_IMAGE_INPUT] : [...TEXT_INPUT] });
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Fill the image capability the index knows into rows of a profile this
|
|
31
|
+
* manager wrote before the index existed. Only a row the pin marks image and
|
|
32
|
+
* that carries no `input` at all changes; every other row is returned as it is,
|
|
33
|
+
* so a repaired profile is byte-identical except for those rows.
|
|
34
|
+
* `undefined` means there is nothing to repair and nothing to write.
|
|
35
|
+
*/
|
|
36
|
+
export function repairImageModalities(providerId, models) {
|
|
37
|
+
const image = imageIds(providerId);
|
|
38
|
+
if (image === undefined)
|
|
39
|
+
return undefined;
|
|
40
|
+
const imageSet = new Set(image);
|
|
41
|
+
let repaired = false;
|
|
42
|
+
const rows = models.map(model => {
|
|
43
|
+
if (model.input !== undefined || !imageSet.has(model.id))
|
|
44
|
+
return model;
|
|
45
|
+
repaired = true;
|
|
46
|
+
return { ...model, input: [...TEXT_IMAGE_INPUT] };
|
|
47
|
+
});
|
|
48
|
+
return repaired ? rows : undefined;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAEnD,MAAM,UAAU,GAAG,CAAC,MAAM,CAAU,CAAA;AACpC,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,OAAO,CAAU,CAAA;AAEnD;;;;GAIG;AACH,SAAS,QAAQ,CAAC,UAAkB;IAClC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC;QAAE,OAAO,SAAS,CAA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gB,CAAC,EAAE,CAAA;IACnD,CAAC,CAAC,CAAA;IACF,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;AACpC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by scripts/generate-extra-capabilities.mjs — do not edit by hand;
|
|
3
|
+
* run `pnpm run generate:capabilities` after bumping @oh-my-pi/pi-catalog.
|
|
4
|
+
*
|
|
5
|
+
* Source: @oh-my-pi/pi-catalog@18.12.6 src/models.json (sha256:b0d9516e8c6cb4254b720e1e2983635776f272057ea6624f753498a3ea883152).
|
|
6
|
+
*
|
|
7
|
+
* The model ids the pinned catalog marks image-capable, per extra-provider
|
|
8
|
+
* route. A route the catalog does not describe is absent: the pin has no
|
|
9
|
+
* answer for it, so its rows keep the modality the seed catalog gives them.
|
|
10
|
+
*/
|
|
11
|
+
export declare const EXTRA_IMAGE_MODELS: Readonly<Record<string, readonly string[]>>;
|