@hanzo/ui 8.27.59 → 8.27.61
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/dist/backends/gui/code-editor.cjs +39 -18
- package/dist/backends/gui/code-editor.d.ts.map +1 -1
- package/dist/backends/gui/code-editor.js +39 -18
- package/dist/backends/gui/code-editor.js.map +1 -1
- package/dist/backends/gui/json-tree.cjs +4 -2
- package/dist/backends/gui/json-tree.d.ts.map +1 -1
- package/dist/backends/gui/json-tree.js +4 -2
- package/dist/backends/gui/json-tree.js.map +1 -1
- package/dist/backends/gui/json.cjs +68 -66
- package/dist/backends/gui/json.d.ts +3 -2
- package/dist/backends/gui/json.d.ts.map +1 -1
- package/dist/backends/gui/json.js +68 -66
- package/dist/backends/gui/json.js.map +1 -1
- package/dist/chat/Composer.cjs +1 -1
- package/dist/chat/Composer.d.ts +1 -1
- package/dist/chat/Composer.js +1 -1
- package/dist/gallery.cjs +4 -4
- package/dist/gallery.d.ts.map +1 -1
- package/dist/gallery.html +4 -5
- package/dist/gallery.js +5 -5
- package/dist/gallery.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.node.cjs +1 -1
- package/dist/index.node.js +1 -1
- package/dist/models/ModelPicker.cjs +191 -0
- package/dist/models/ModelPicker.d.ts +27 -0
- package/dist/models/ModelPicker.d.ts.map +1 -0
- package/dist/models/ModelPicker.js +189 -0
- package/dist/models/ModelPicker.js.map +1 -0
- package/dist/models/catalog.cjs +313 -184
- package/dist/models/catalog.d.ts +101 -38
- package/dist/models/catalog.d.ts.map +1 -1
- package/dist/models/catalog.js +295 -179
- package/dist/models/catalog.js.map +1 -1
- package/dist/models/index.cjs +33 -12
- package/dist/models/index.d.ts +7 -4
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +7 -6
- package/dist/models/index.js.map +1 -1
- package/dist/models/picker.logic.cjs +83 -0
- package/dist/models/picker.logic.d.ts +51 -0
- package/dist/models/picker.logic.d.ts.map +1 -0
- package/dist/models/picker.logic.js +74 -0
- package/dist/models/picker.logic.js.map +1 -0
- package/dist/product/limits.cjs +14 -13
- package/dist/product/limits.d.ts +9 -10
- package/dist/product/limits.d.ts.map +1 -1
- package/dist/product/limits.js +14 -12
- package/dist/product/limits.js.map +1 -1
- package/dist/styles.css +1 -2
- package/package.json +1 -1
- package/dist/models/ModelSelector.cjs +0 -80
- package/dist/models/ModelSelector.d.ts +0 -44
- package/dist/models/ModelSelector.d.ts.map +0 -1
- package/dist/models/ModelSelector.js +0 -78
- package/dist/models/ModelSelector.js.map +0 -1
package/dist/models/catalog.d.ts
CHANGED
|
@@ -1,27 +1,49 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @hanzo/ui/models —
|
|
2
|
+
* @hanzo/ui/models — the model catalog, as `GET /v1/models` answers it.
|
|
3
3
|
*
|
|
4
|
-
* Pure
|
|
5
|
-
*
|
|
4
|
+
* Pure and SSR-safe: no React, no browser globals. The picker and every host's
|
|
5
|
+
* explorer read the same rows through the same helpers, so a model is in the
|
|
6
|
+
* same group, with the same label and the same price, on every surface.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Every fact here is a field the gateway publishes — `class`, `family`,
|
|
9
|
+
* `inputs`, `outputs`, `supports_*`, `pricing`. Nothing is read from an id's
|
|
10
|
+
* spelling. A field the gateway leaves out is absent here too: a model with no
|
|
11
|
+
* price has no price, never a price of zero.
|
|
10
12
|
*/
|
|
13
|
+
import type { PausedModel } from '../product/limits.js';
|
|
14
|
+
/** The class a model is sold in, as the usage policy reads it. */
|
|
15
|
+
export type ModelClass = 'premium' | 'ours' | 'free';
|
|
16
|
+
/** Hanzo's own families. Every other model is grouped by who made it. */
|
|
17
|
+
export type ModelFamily = 'enso' | 'zen' | 'kai' | 'jev' | 'zoo';
|
|
18
|
+
/** What a model can be asked to do, from the modalities and capabilities it publishes. */
|
|
19
|
+
export type Capability = 'chat' | 'vision' | 'embeddings' | 'rerank' | 'image' | 'video' | 'audio' | 'decision' | 'tools' | 'reasoning';
|
|
20
|
+
/** List price, USD per 1M tokens, each side absent when the gateway lists none. */
|
|
21
|
+
export interface ModelPricing {
|
|
22
|
+
input_per_million?: number;
|
|
23
|
+
output_per_million?: number;
|
|
24
|
+
}
|
|
25
|
+
/** One row of `GET /v1/models`. */
|
|
11
26
|
export interface ModelCatalogEntry {
|
|
12
|
-
/** Gateway id, e.g. "claude-opus-4.8" */
|
|
13
27
|
id: string;
|
|
14
|
-
/**
|
|
28
|
+
/** Who made it: "anthropic", "openai", "zenlm", "hanzo", … */
|
|
15
29
|
owned_by?: string;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
30
|
+
name?: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
class?: ModelClass;
|
|
33
|
+
family?: ModelFamily;
|
|
20
34
|
premium?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
|
|
35
|
+
/** Release time, Unix seconds. */
|
|
36
|
+
created?: number;
|
|
23
37
|
context_window?: number;
|
|
24
|
-
|
|
38
|
+
max_output_tokens?: number;
|
|
39
|
+
/** Input modalities: "text", "image", "audio", "file", "video". */
|
|
40
|
+
inputs?: string[];
|
|
41
|
+
/** What it answers with: "text", "image", "audio", "transcript", "embeddings", "rerank", "decision". */
|
|
42
|
+
outputs?: string[];
|
|
43
|
+
supports_vision?: boolean;
|
|
44
|
+
supports_tools?: boolean;
|
|
45
|
+
supports_reasoning?: boolean;
|
|
46
|
+
pricing?: ModelPricing;
|
|
25
47
|
/** Absent, anyone may call it. `research`: it exists and nobody can call it yet. */
|
|
26
48
|
access?: 'research';
|
|
27
49
|
/** Where a person asks for access to a model they cannot call. */
|
|
@@ -30,38 +52,79 @@ export interface ModelCatalogEntry {
|
|
|
30
52
|
/**
|
|
31
53
|
* The models that exist and cannot be called, said once for every list of
|
|
32
54
|
* models: a picker draws each one disabled, a catalogue page draws it muted.
|
|
33
|
-
*
|
|
34
|
-
* No gateway serves them, and that is the point: `/v1/models` never answers for
|
|
35
|
-
* one, so nothing can route to it. A host that lists them appends these to what
|
|
36
|
-
* the gateway said.
|
|
55
|
+
* `/v1/models` never answers for one, so nothing can route to it.
|
|
37
56
|
*/
|
|
38
57
|
export declare const RESEARCH: ModelCatalogEntry[];
|
|
58
|
+
/** The catalog with the research models it does not already list, appended. */
|
|
59
|
+
export declare function withResearch(models: readonly ModelCatalogEntry[]): ModelCatalogEntry[];
|
|
60
|
+
/** One row, checked field by field: it is a network response. Null without an id. */
|
|
61
|
+
export declare function modelOf(v: unknown): ModelCatalogEntry | null;
|
|
39
62
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* owned_by map → llama id under any owner → capitalized owned_by → id prefix → "Other".
|
|
63
|
+
* The catalog from a `/v1/models` body (`{data: [...]}`) or its `data` array.
|
|
64
|
+
* Rows without an id are dropped; a repeated id keeps its first row.
|
|
43
65
|
*/
|
|
44
|
-
export declare function
|
|
66
|
+
export declare function parseModels(body: unknown): ModelCatalogEntry[];
|
|
45
67
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
68
|
+
* Fetch the catalog from an OpenAI-shaped `/models` endpoint. No caching, no
|
|
69
|
+
* state: the host owns both. Throws on a non-2xx answer.
|
|
48
70
|
*/
|
|
49
|
-
export declare function
|
|
50
|
-
|
|
51
|
-
|
|
71
|
+
export declare function fetchModelCatalog(baseUrl?: string, token?: string): Promise<ModelCatalogEntry[]>;
|
|
72
|
+
/** The families, in the order every surface leads with them. */
|
|
73
|
+
export declare const FAMILIES: readonly {
|
|
74
|
+
id: ModelFamily;
|
|
75
|
+
label: string;
|
|
52
76
|
}[];
|
|
77
|
+
export declare const CLASS_NAMES: Record<ModelClass, string>;
|
|
78
|
+
/** Who made a model, as the catalog keys it: `owned_by`, lowercased, without OpenRouter's `~` alias mark. */
|
|
79
|
+
export declare function makerOf(m: Pick<ModelCatalogEntry, 'owned_by'>): string;
|
|
80
|
+
/** A maker's display name. */
|
|
81
|
+
export declare function makerName(maker: string): string;
|
|
82
|
+
/** The name a model is shown by: the catalog's name, else its id. */
|
|
83
|
+
export declare function modelName(m: Pick<ModelCatalogEntry, 'id' | 'name'>): string;
|
|
84
|
+
/** The group a model is listed in: its Hanzo family, else its maker. */
|
|
85
|
+
export interface ModelGroup {
|
|
86
|
+
/** `family:zen`, `maker:anthropic`. */
|
|
87
|
+
key: string;
|
|
88
|
+
label: string;
|
|
89
|
+
family?: ModelFamily;
|
|
90
|
+
models: ModelCatalogEntry[];
|
|
91
|
+
}
|
|
92
|
+
export declare function groupKey(m: ModelCatalogEntry): string;
|
|
93
|
+
export declare function groupLabel(m: ModelCatalogEntry): string;
|
|
53
94
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* or by an id-segment heuristic.
|
|
95
|
+
* Models in groups: Hanzo's families first, in FAMILIES order, then every maker
|
|
96
|
+
* by name. Models keep the order they came in, so the caller sorts first.
|
|
57
97
|
*/
|
|
58
|
-
export declare function
|
|
59
|
-
/** Keep only chat-capable models. */
|
|
60
|
-
export declare function filterChatModels(models: ModelCatalogEntry[]): ModelCatalogEntry[];
|
|
98
|
+
export declare function groupModels(models: readonly ModelCatalogEntry[]): ModelGroup[];
|
|
61
99
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* consumers own caching. Throws on a non-2xx response.
|
|
100
|
+
* What a model can do, read from what it publishes. A model that names no
|
|
101
|
+
* outputs is read as a text model, the way the gateway serves it.
|
|
65
102
|
*/
|
|
66
|
-
export declare function
|
|
103
|
+
export declare function capabilitiesOf(m: ModelCatalogEntry): Capability[];
|
|
104
|
+
export declare function can(m: ModelCatalogEntry, c: Capability): boolean;
|
|
105
|
+
export declare const CAPABILITY_NAMES: Record<Capability, string>;
|
|
106
|
+
/** What `isPaused` reads of the payer's plan usage (`Limits` from `@hanzo/ui/product/limits`). */
|
|
107
|
+
export interface PauseSource {
|
|
108
|
+
classes: Partial<Record<ModelClass, {
|
|
109
|
+
state: string;
|
|
110
|
+
}>>;
|
|
111
|
+
paused?: readonly Pick<PausedModel, 'model'>[];
|
|
112
|
+
}
|
|
113
|
+
/** Whether `id` matches a paused entry: the same id, or a glob whose `*` stands for any run of characters. */
|
|
114
|
+
export declare function matchesPaused(id: string, pattern: string): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Whether the payer's plan has paused this model: its whole class is limited,
|
|
117
|
+
* or an entry in `paused` names it. It is still listed and still picked; the
|
|
118
|
+
* gateway refuses it or answers from Enso.
|
|
119
|
+
*/
|
|
120
|
+
export declare function isPaused(m: Pick<ModelCatalogEntry, 'id' | 'class'>, limits: PauseSource | null | undefined): boolean;
|
|
121
|
+
/** Case-insensitive search: every word of the query appears in the model's id, name, maker, group or description. */
|
|
122
|
+
export declare function matchesModel(m: ModelCatalogEntry, query: string): boolean;
|
|
123
|
+
export type ModelSort = 'name' | 'newest' | 'context' | 'price';
|
|
124
|
+
/** A sorted copy. Context and price put models without the figure last. */
|
|
125
|
+
export declare function sortModels(models: readonly ModelCatalogEntry[], by?: ModelSort): ModelCatalogEntry[];
|
|
126
|
+
/** "200K", "1M", "1.5M"; "" when the catalog states no window. */
|
|
127
|
+
export declare function formatContext(n: number | undefined): string;
|
|
128
|
+
/** "$3.00" per 1M tokens, "Free" at zero, "" when the catalog lists no price. */
|
|
129
|
+
export declare function formatPrice(n: number | undefined): string;
|
|
67
130
|
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/models/catalog.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/models/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,kEAAkE;AAClE,MAAM,MAAM,UAAU,G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