@hackbuild/ai-views 0.1.0 → 0.1.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 +248 -80
- package/dist/chat.d.ts +18 -2
- package/dist/chat.js +7 -1
- package/dist/elements.d.ts +7 -1
- package/dist/elements.js +1 -1
- package/dist/frame.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/jobs.d.ts +6 -1
- package/dist/jobs.js +4 -1
- package/dist/loaders.d.ts +100 -0
- package/dist/loaders.js +308 -0
- package/dist/memory.d.ts +9 -0
- package/dist/memory.js +3 -0
- package/dist/mount-chat.d.ts +4 -1
- package/dist/mount-chat.js +2 -1
- package/dist/mount-frame.d.ts +13 -1
- package/dist/mount-frame.js +3 -1
- package/dist/mount-mask.d.ts +19 -1
- package/dist/mount-mask.js +5 -1
- package/dist/mount-model.d.ts +11 -1
- package/dist/mount-model.js +25 -4
- package/dist/mount-transcribe.d.ts +11 -2
- package/dist/mount-transcribe.js +2 -2
- package/dist/pick.d.ts +17 -0
- package/dist/pick.js +6 -0
- package/dist/rows.d.ts +6 -0
- package/dist/rows.js +2 -0
- package/dist/single/elements.iife.js +107 -53
- package/dist/single/elements.js +106 -54
- package/dist/single/index.iife.js +17042 -6168
- package/dist/single/index.js +17040 -6169
- package/dist/single/vue.iife.js +111 -48
- package/dist/single/vue.js +112 -48
- package/dist/transcribe.d.ts +14 -2
- package/dist/transcribe.js +2 -2
- package/dist/vue.d.ts +22 -0
- package/dist/vue.js +22 -0
- package/llms.md +1233 -0
- package/package.json +14 -11
package/README.md
CHANGED
|
@@ -1,93 +1,261 @@
|
|
|
1
1
|
# @hackbuild/ai-views
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
3
|
+
Put a model picker, a chat, a transcriber, a mask studio or a camera frame on your page, drawn with the hackbuild-ui stylesheet, as custom elements or Vue components.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@hackbuild/ai-views) [](../../LICENSE)  
|
|
6
|
+
|
|
7
|
+
Browser status: no model run of this package has been verified in a real browser yet.
|
|
8
|
+
|
|
9
|
+
## What it does
|
|
10
|
+
|
|
11
|
+
- Gives each job (chat, speech to text, vision, detector, masks, image, voice, depth, embed, face swap, landmarks) a model picker whose rows say whether a model fits this machine and why not.
|
|
12
|
+
- Keeps the state behind every view in node safe objects: a pick, a jobs rack, a chat thread and list, a transcribe queue.
|
|
13
|
+
- Draws the views in light DOM with the page's hackbuild-ui stylesheet and never styles locally.
|
|
14
|
+
- Ships every view as a mount function, a custom element and a Vue 3 component, all on one code path.
|
|
15
|
+
- Replaces @hackbuild/ai-elements.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npm install @hackbuild/ai-views @virgilvox/hackbuild-ui
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
@virgilvox/hackbuild-ui is a required peer; the page also loads its stylesheet. Vue is an optional peer, needed only for the `/vue` entry.
|
|
24
|
+
|
|
25
|
+
| subpath | runtime | pin |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| `.` | none; node safe state | none |
|
|
28
|
+
| `./elements` | @virgilvox/hackbuild-ui (peer) | `>=0.10.0 <0.11.0` |
|
|
29
|
+
| `./vue` | vue (optional peer) and @virgilvox/hackbuild-ui | vue `^3.4.0` |
|
|
30
|
+
|
|
31
|
+
Model runtimes are never imported here. A picker loads only through the loader you pass, such as `weightsLoader(store)` or your own that starts a runtime.
|
|
32
|
+
|
|
33
|
+
## Quick start
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { importEsm } from "@hackbuild/ai-env";
|
|
37
|
+
import { ALL_RECORDS, chatThread, useModelPick, weightsLoader } from "@hackbuild/ai-views";
|
|
38
|
+
import { mountChatPane, mountComposer, mountModelSelect } from "@hackbuild/ai-views/elements";
|
|
39
|
+
import { loadWllama, wllamaUrls, type WllamaModule } from "@hackbuild/chat/wllama";
|
|
40
|
+
import { openWeightStore } from "@hackbuild/weights";
|
|
41
|
+
|
|
42
|
+
// a chat picker over the GGUF rows, files through the weight store; Qwen2.5 0.5B Instruct weights are Apache-2.0
|
|
43
|
+
const fetchFiles = weightsLoader(await openWeightStore());
|
|
44
|
+
const wllama = await importEsm<WllamaModule>(wllamaUrls().esm); // the runtime is passed in, never bundled
|
|
45
|
+
const thread = chatThread({ system: "answer in one line." });
|
|
46
|
+
const pick = useModelPick("chat", {
|
|
47
|
+
records: ALL_RECORDS.filter((r) => r.provider === "wllama"), chosen: "qwen2.5-0.5b-instruct-gguf",
|
|
48
|
+
loader: async (rec, ctx) => thread.setEngine(await loadWllama({ module: wllama, blobs: [...((await fetchFiles(rec, ctx)) as Map<string, Blob>).values()] })),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// the picker, the turns and the composer, drawn with the page's hackbuild-ui stylesheet
|
|
52
|
+
mountModelSelect(document.querySelector<HTMLElement>("#model")!, pick);
|
|
53
|
+
mountChatPane(document.querySelector<HTMLElement>("#chat")!, thread);
|
|
54
|
+
mountComposer(document.querySelector<HTMLElement>("#composer")!, thread);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Live example
|
|
58
|
+
|
|
59
|
+
The view demo pages run every view on stub providers with no weights: [hackbuild-browser-ai/views](https://hackbuild.github.io/hackbuild-browser-ai/views/). The package page is at [hackbuild-browser-ai/ai-views](https://hackbuild.github.io/hackbuild-browser-ai/ai-views/).
|
|
60
|
+
|
|
61
|
+
## Concepts
|
|
62
|
+
|
|
63
|
+
### three entries
|
|
64
|
+
|
|
65
|
+
`@hackbuild/ai-views` is node safe: `JOBS`, `jobRecords(job)`, `rowOf` (a record as a hackbuild-ui ModelRow), `useModelPick(job)`, `useJobsPick(jobs, presets)`, `weightsLoader(store)`, `weightsRemover(store)`, `defaultPick`, `chatThread`, `chatList`, `contextSegments`, `transcribeQueue`, the frame geometry and `traceRows`. `@hackbuild/ai-views/elements` holds the mount functions and `define()`. `@hackbuild/ai-views/vue` holds `ModelSelect`, `ModelJobs`, `ChatPane`, `Composer`, `ChatList`, `ContextMeter`, `MemoryInspector`, `TranscribeDrop`, `TranscriptView`, `TranscribeQueue`, `MaskStudio`, `MaskTools`, `MaskVerbs`, `MaskRack`, `FrameView` and `CameraFeed`; only this entry imports Vue.
|
|
66
|
+
|
|
67
|
+
### custom elements
|
|
68
|
+
|
|
69
|
+
Nothing registers on import. `define()` registers the elements bare, and `define("hb")` gives `<hb-model-select>` and so on; names already defined are left alone. Each element carries `.hb-view` (display contents), so a layout region of hackbuild-ui places its parts. A `for` attribute names the element whose state a part binds to:
|
|
70
|
+
|
|
71
|
+
```html
|
|
72
|
+
<model-select job="chat" variant="chip"></model-select>
|
|
73
|
+
<chat-pane id="chat"></chat-pane> <chat-composer for="chat"></chat-composer>
|
|
74
|
+
<transcribe-drop id="t"></transcribe-drop> <transcript-exports for="t"></transcript-exports>
|
|
75
|
+
<mask-studio id="m"></mask-studio> <mask-tools for="m"></mask-tools>
|
|
76
|
+
<frame-view id="f"></frame-view> <camera-feed for="f"></camera-feed>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Set `engine` on `<chat-pane>` to a @hackbuild/chat engine, or `pick`, `env`, `loader` and `records` on `<model-select>`. `<model-select>` fires `choose`, then `loaded` and `failed` once per load.
|
|
80
|
+
|
|
81
|
+
### vue
|
|
82
|
+
|
|
83
|
+
Each component mounts the same function the custom element does, on a host that shows as `.hb-view`; props in, events out. `ModelSelect` emits `pick`, `choose`, `loaded` and `failed`; `MaskStudio` emits `studio`, `FrameView` emits `view` and `CameraFeed` emits `feed` and `frame`, each handing over the mounted object.
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import { ModelSelect, ChatPane, Composer } from "@hackbuild/ai-views/vue";
|
|
87
|
+
import { chatThread } from "@hackbuild/ai-views";
|
|
88
|
+
const thread = chatThread({ engine });
|
|
89
|
+
// <ModelSelect job="chat" variant="chip" /> <ChatPane :thread="thread" /> <Composer :thread="thread" />
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### picks and loaders
|
|
93
|
+
|
|
94
|
+
A pick loads only through its loader (none is an error the row shows), runs it for every row, a no download row included, and keeps its result on `snapshot().loaded`; `remove()` deletes through `onRemove`. It starts on the first "start here" record that fits, else the first fast or steady one. `weightsLoader(store)` fetches a record's files through @hackbuild/weights; a record that loads through its runtime (WebLLM, MediaPipe and the like) takes `jobLoader(job)`. `useJobsPick` joins pickers as a rack with a line per job, presets with their download totals, and load all.
|
|
95
|
+
|
|
96
|
+
### real loads
|
|
97
|
+
|
|
98
|
+
`jobLoader(job, { store?, env?, allowGplPhonemizer? })` is the loader a page passes to `useModelPick(job, { loader })`. A load imports the runtime from its pinned CDN only when the person presses load, fetches weights through @hackbuild/weights where the runtime does not fetch its own, sends progress to the row, stops on the row's stop, and fails in plain words. One models hub serves every loader made with the same options object. Probe the machine with `probe()` from @hackbuild/ai-env and pass it to the pick as `env`.
|
|
99
|
+
|
|
100
|
+
| job | resolves to | runtimes |
|
|
101
|
+
|---|---|---|
|
|
102
|
+
| chat | a @hackbuild/chat `ChatEngine` | WebLLM, wllama (gguf through the weight store), transformers.js, the browser's built in model |
|
|
103
|
+
| transcribe | a `Transcriber` for TranscribeDrop | whisper on transformers.js, the dsp core inlined |
|
|
104
|
+
| detect | `(image) => FrameBox[]` | MediaPipe EfficientDet, YOLO on onnxruntime web |
|
|
105
|
+
| masks | `MaskModels`: click segment, and segment everything from a 4 by 3 grid of points | SlimSAM on transformers.js; FastSAM is refused until it has a decoder |
|
|
106
|
+
| depth | `(image) => { width, height, data }`, 0 to 1, larger is nearer | Depth Anything on transformers.js |
|
|
107
|
+
| vision | `(image, question?) => string`, a caption without a question | SmolVLM, LFM2-VL, Gemma on transformers.js |
|
|
108
|
+
| image | an imagegen `ImageGenerator` with its CLIP `tokenize` and `make(form)` | onnxruntime web; the tokenizer on transformers.js |
|
|
109
|
+
| voice | a loaded @hackbuild/speak `Engine` | the system voice (no download), bellows, pocket tts, kokoro (gpl phonemizer, opt in) |
|
|
110
|
+
| embed | an @hackbuild/embed `Embedder` | static potion files, transformers.js |
|
|
111
|
+
|
|
112
|
+
The bar chip shows the name cut short (`shortName`: "hermes 3 llama 3.2 3b" reads "hermes 3 3b") and the size, then the state once a load moves; the full name is its label.
|
|
113
|
+
|
|
114
|
+
### views
|
|
115
|
+
|
|
116
|
+
| view | element | what it does |
|
|
117
|
+
|---|---|---|
|
|
118
|
+
| ModelSelect | `<model-select job variant go>` | one line with the choice and one pink "load, size"; the bar chip; a sheet with search, the fits, uncensored and no download filters, groups, the row detail and the "your own" forms. `<model-jobs jobs>` (properties `env`, `loader`, `records`, `presets`) gives a line per job, presets with totals and "load all" |
|
|
119
|
+
| ChatPane, Composer | `<chat-pane>`, `<chat-composer for>`, `<chat-list for>`, `<chat-context for budget>` | the thread, reasoning in a fold, memory used per reply, copy and redo on the last reply; the chats list (new, open, rename, delete) and the context meter; Enter sends, Shift Enter adds a line, Escape stops |
|
|
120
|
+
| TranscribeDrop, TranscriptView | `<transcribe-drop>`, `<transcript-view for>`, `<transcribe-queue for>`, `<transcript-exports for>` | the drop zone becomes the transcript; a queue of files; lines with their time, edit in place with undo; txt, srt, vtt, json |
|
|
121
|
+
| MaskStudio | `<mask-studio>`, `<mask-tools for>`, `<mask-verbs for>`, `<mask-rack for part>` | click segment, wand, brush, eraser, lasso, polygon, rectangle, ellipse, flood, pan (the hackbuild-ui mask editor's tools), segment everything, smooth, expand, shrink, saved masks, undo, zoom; `mask()` gives ImageData and `exportAs()` a png Blob |
|
|
122
|
+
| FrameView, CameraFeed | `<frame-view>`, `<camera-feed for>` | boxes with word and score, landmarks, a count and the caption over a frame; the camera at a set rate |
|
|
123
|
+
| memory inspector | `<memory-inspector>` | one row per fused recall candidate, the used ones marked |
|
|
124
|
+
|
|
125
|
+
### jobs and records
|
|
126
|
+
|
|
127
|
+
Jobs and their records: chat (the chat rows of the @hackbuild/models catalogue), speech to text (six records), vision language (SmolVLM 256M and 500M, SmolVLM2 256M video, LFM2-VL 450M, Gemma 4 E2B), detector (EfficientDet lite0, YOLOv10 n, s and m), masks (SlimSAM, FastSAM-s), image (SD-Turbo, SD 1.5, and SDXL-Turbo greyed as not run yet), voice (Kokoro, Pocket TTS, the vocal tract, the system voice), depth, embed, landmarks and face swap (scrfd, ArcFace, inswapper). The records come from the packages that run them; a record listed in more than one place counts once. Every record carries its weight licence; the non commercial ones are marked in the picker.
|
|
128
|
+
|
|
129
|
+
## API overview
|
|
130
|
+
|
|
131
|
+
| export | what it does |
|
|
132
|
+
|---|---|
|
|
133
|
+
| [`useModelPick`](../../docs/api/ai-views/index.md#usemodelpick) | a model picker for one job |
|
|
134
|
+
| [`useJobsPick`](../../docs/api/ai-views/index.md#usejobspick) | pickers for several jobs as one rack |
|
|
135
|
+
| [`weightsLoader`](../../docs/api/ai-views/index.md#weightsloader) | a loader that fetches files through a weight store |
|
|
136
|
+
| [`jobLoader`](../../docs/api/ai-views/index.md#jobloader) | the real loader of a job: runtime and weights at load time |
|
|
137
|
+
| [`chatThread`](../../docs/api/ai-views/index.md#chatthread) | a chat thread over an engine |
|
|
138
|
+
| [`chatList`](../../docs/api/ai-views/index.md#chatlist) | several chats, one open |
|
|
139
|
+
| [`transcribeQueue`](../../docs/api/ai-views/index.md#transcribequeue) | a queue of files to transcribe, with edits and exports |
|
|
140
|
+
| [`JOBS`](../../docs/api/ai-views/index.md#jobs) | every job's words and capability test |
|
|
141
|
+
| [`ALL_RECORDS`](../../docs/api/ai-views/index.md#all_records) | every record the views know |
|
|
142
|
+
| [`rowOf`](../../docs/api/ai-views/index.md#rowof) | a record as one picker row |
|
|
143
|
+
| [`define`](../../docs/api/ai-views/elements.md#define) | register the custom elements |
|
|
144
|
+
| [`mountModelSelect`](../../docs/api/ai-views/elements.md#mountmodelselect) | the picker on a host |
|
|
145
|
+
| [`mountChatPane`](../../docs/api/ai-views/elements.md#mountchatpane), [`mountComposer`](../../docs/api/ai-views/elements.md#mountcomposer) | the turns and the message box |
|
|
146
|
+
| [`mountTranscribeDrop`](../../docs/api/ai-views/elements.md#mounttranscribedrop) | the drop zone that becomes the transcript |
|
|
147
|
+
| [`mountMaskStudio`](../../docs/api/ai-views/elements.md#mountmaskstudio) | the mask studio |
|
|
148
|
+
| [`mountFrameView`](../../docs/api/ai-views/elements.md#mountframeview), [`mountCameraFeed`](../../docs/api/ai-views/elements.md#mountcamerafeed) | a frame with results drawn over it, and the camera |
|
|
149
|
+
| [`ModelSelect`](../../docs/api/ai-views/vue.md#modelselect), [`ChatPane`](../../docs/api/ai-views/vue.md#chatpane) and the other components | the views as Vue components |
|
|
150
|
+
|
|
151
|
+
The full reference is in [docs/api/ai-views](../../docs/api/ai-views/README.md).
|
|
152
|
+
|
|
153
|
+
## Models and weights
|
|
154
|
+
|
|
155
|
+
This package runs no model; it lists records and loads them through the loader you pass. Weights are never bundled; `weightsLoader(store)` fetches them from the host in the table and @hackbuild/weights caches them. The 40 chat records are listed in [@hackbuild/models](../models/README.md#models-and-weights). Sizes are MiB of download; the source word is in each cell. Licences are as recorded on each record; several are non commercial or AGPL-3.0, and the picker marks them.
|
|
156
|
+
|
|
157
|
+
| model | id | size, MiB (source word in the cell) | licence | loads from |
|
|
158
|
+
|---|---|---|---|---|
|
|
159
|
+
| whisper large-v3-turbo | `whisper-large-v3-turbo` | 1534 (vendor) | MIT | Hugging Face `onnx-community/whisper-large-v3-turbo`, transformers.js |
|
|
160
|
+
| whisper base | `whisper-base` | 77 (vendor) | MIT | Hugging Face `onnx-community/whisper-base`, transformers.js |
|
|
161
|
+
| whisper small.en | `whisper-small.en` | 238 (vendor) | MIT (the OpenAI Whisper release; the Xenova ONNX card says apache-2.0) | Hugging Face `Xenova/whisper-small.en`, transformers.js |
|
|
162
|
+
| whisper base.en | `whisper-base.en` | 90 (inferred) | MIT (the OpenAI Whisper release; the Xenova ONNX card says apache-2.0) | Hugging Face `Xenova/whisper-base.en`, transformers.js |
|
|
163
|
+
| whisper tiny.en | `whisper-tiny.en` | 39 (vendor) | MIT (the OpenAI Whisper release; the Xenova ONNX card says apache-2.0) | Hugging Face `Xenova/whisper-tiny.en`, transformers.js |
|
|
164
|
+
| moonshine base | `moonshine-base` | 60 (vendor) | MIT (english models, per the model card; check before use) | Hugging Face `onnx-community/moonshine-base-ONNX`, transformers.js |
|
|
165
|
+
| depth anything v2 small | `depth-anything-v2-small` | 100 (inferred) | Apache-2.0 | Hugging Face `onnx-community/depth-anything-v2-small`, transformers.js |
|
|
166
|
+
| mediapipe efficientdet lite0 (coco, 80 classes) | `efficientdet-lite0` | 7 (inferred) | Apache-2.0 | `storage.googleapis.com`, MediaPipe |
|
|
167
|
+
| mediapipe selfie segmenter | `selfie-segmenter` | 1 (inferred) | Apache-2.0 | `storage.googleapis.com`, MediaPipe |
|
|
168
|
+
| mediapipe face landmarker with blendshapes | `face-landmarker` | 4 (inferred) | Apache-2.0 | `storage.googleapis.com`, MediaPipe |
|
|
169
|
+
| mediapipe hand landmarker | `hand-landmarker` | 8 (inferred) | Apache-2.0 | `storage.googleapis.com`, MediaPipe |
|
|
170
|
+
| mediapipe gesture recognizer (7 canned gestures) | `gesture-recognizer` | 8 (inferred) | unknown, check the mediapipe model card | `storage.googleapis.com`, MediaPipe |
|
|
171
|
+
| mediapipe pose landmarker lite | `pose-landmarker-lite` | 6 (inferred) | Apache-2.0 | `storage.googleapis.com`, MediaPipe |
|
|
172
|
+
| slimsam 77 uniform (point prompts) | `slimsam-77-uniform` | 38 (vendor) | Apache-2.0 | Hugging Face `Xenova/slimsam-77-uniform`, transformers.js |
|
|
173
|
+
| smolvlm 256m | `smolvlm-256m-instruct` | 260 (inferred) | Apache-2.0 | Hugging Face `HuggingFaceTB/SmolVLM-256M-Instruct`, transformers.js |
|
|
174
|
+
| lfm2-vl 450m | `lfm2-vl-450m` | 320 (inferred) | LFM Open License v1.0 | Hugging Face `onnx-community/LFM2-VL-450M-ONNX`, transformers.js |
|
|
175
|
+
| smolvlm 500m | `smolvlm-500m-instruct` | 463 (vendor) | Apache-2.0 | Hugging Face `HuggingFaceTB/SmolVLM-500M-Instruct`, transformers.js |
|
|
176
|
+
| smolvlm2 256m video | `smolvlm2-256m-video-instruct` | 252 (vendor) | Apache-2.0 | Hugging Face `HuggingFaceTB/SmolVLM2-256M-Video-Instruct`, transformers.js |
|
|
177
|
+
| depth anything v2 base | `depth-anything-v2-base` | 186 (vendor) | CC-BY-NC-4.0 (the model card's licence field) | Hugging Face `onnx-community/depth-anything-v2-base`, transformers.js |
|
|
178
|
+
| depth anything v1 small | `depth-anything-small-v1` | 48 (vendor) | Apache-2.0 (the upstream card; this export's card has no licence field) | Hugging Face `Xenova/depth-anything-small-hf`, transformers.js |
|
|
179
|
+
| gemma 4 e2b | `gemma-4-e2b-vision` | 3566 (vendor) | Apache-2.0 (the model card's licence field) | Hugging Face `onnx-community/gemma-4-E2B-it-ONNX`, transformers.js |
|
|
180
|
+
| yolov10 nano | `yolov10n` | 9 (vendor) | AGPL-3.0 (Ultralytics weights, the model card's licence field) | Hugging Face `onnx-community/yolov10n`, `onnx/model.onnx`, onnxruntime-web |
|
|
181
|
+
| yolov10 small | `yolov10s` | 28 (vendor) | AGPL-3.0 (Ultralytics weights, the model card's licence field) | Hugging Face `onnx-community/yolov10s`, `onnx/model.onnx`, onnxruntime-web |
|
|
182
|
+
| yolov10 medium | `yolov10m` | 59 (vendor) | AGPL-3.0 (Ultralytics weights, the model card's licence field) | Hugging Face `onnx-community/yolov10m`, `onnx/model.onnx`, onnxruntime-web |
|
|
183
|
+
| fastsam s | `fastsam-s` | 45 (vendor) | AGPL-3.0 upstream (Ultralytics FastSAM); the export's card says apache-2.0 | Hugging Face `anakhiu/fastsam-onnx`, `fastsam_s.onnx`, onnxruntime-web |
|
|
184
|
+
| face finder (scrfd 10g) | `scrfd-10g` | 16 (vendor) | InsightFace model pack: non-commercial research only (the buffalo_l pack terms) | Hugging Face `immich-app/buffalo_l`, `detection/model.onnx`, onnxruntime-web |
|
|
185
|
+
| face id (arcface r50) | `arcface-w600k-r50` | 166 (vendor) | InsightFace model pack: non-commercial research only (the buffalo_l pack terms) | Hugging Face `immich-app/buffalo_l`, `recognition/model.onnx`, onnxruntime-web |
|
|
186
|
+
| face swap (inswapper 128) | `inswapper-128` | 529 (vendor) | InsightFace: non-commercial research only; the mirror's card says gpl-3.0 | Hugging Face `hacksider/inswapper_128`, `inswapper_128.onnx`, onnxruntime-web |
|
|
187
|
+
| kokoro 82m | `kokoro-82m` | 310 (vendor) | Apache-2.0 (weights); the kokoro-js runtime phonemizes with eSpeak NG, GPL-3.0-or-later, loaded at run time and opt in | Hugging Face `onnx-community/Kokoro-82M-v1.0-ONNX`, kokoro-js |
|
|
188
|
+
| pocket tts | `pocket-tts` | 189 (inferred) | CC-BY-4.0 (weights), MIT (code) | Hugging Face `kyutai/pocket-tts`, the Pocket TTS worker |
|
|
189
|
+
| bellows voice | `bellows-voice` | 0 (vendor) | none, no weights (code MIT) | nothing to download, the vocal tract code |
|
|
190
|
+
| system voice | `web-speech` | 0 (vendor) | system voices, the platform's terms | nothing to download, the system voice |
|
|
191
|
+
| sd-turbo 512 | `sd-turbo` | 2397 (vendor) | Stability AI Non-Commercial Research Community License (the LICENSE in schmuell/sd-turbo-ort-web; upstream stabilityai/sd-turbo moved to the Community License in July 2024, this export did not) | Hugging Face `schmuell/sd-turbo-ort-web`, onnxruntime-web |
|
|
192
|
+
| stable diffusion 1.5 | `sd-1.5` | 1969 (vendor) | CreativeML OpenRAIL-M (use restrictions in its attachment A) | Hugging Face `microsoft/stable-diffusion-v1.5-webnn`, onnxruntime-web |
|
|
193
|
+
| sdxl-turbo 512 (listed, not run yet) | `sdxl-turbo` | 2548 (vendor) | Stability AI Community License (named in the card text; the repo has no licence field) | Hugging Face `webnn/sdxl-turbo`, onnxruntime-web |
|
|
194
|
+
| potion base 8M (static) | `potion-base-8m` | 30 (inferred) | MIT | Hugging Face `minishlab/potion-base-8M`, the static embedder |
|
|
195
|
+
| all-MiniLM-L6-v2 | `minilm-l6` | 23 (inferred) | Apache-2.0 | Hugging Face `Xenova/all-MiniLM-L6-v2`, transformers.js |
|
|
196
|
+
| bge-small-en-v1.5 | `bge-small-en` | 32 (vendor) | MIT | Hugging Face `Xenova/bge-small-en-v1.5`, transformers.js |
|
|
197
|
+
| face-api tiny landmarks (68 points) | `face-api-tiny` | 1 (inferred) | MIT | `cdn.jsdelivr.net`, face-api |
|
|
198
|
+
| all-minilm-l6-v2 | `all-minilm-l6-v2` | 23 (inferred) | Apache-2.0 | Hugging Face `Xenova/all-MiniLM-L6-v2`, transformers.js |
|
|
199
|
+
| htdemucs-fast | `htdemucs-fast` | 166 (inferred) | MIT | Hugging Face `StemSplitio/htdemucs-onnx`, `htdemucs_fp16weights.onnx`, onnxruntime-web |
|
|
200
|
+
|
|
201
|
+
## Browser support
|
|
202
|
+
|
|
203
|
+
| feature | needs | Chrome | Safari | Firefox | phone |
|
|
204
|
+
|---|---|---|---|---|---|
|
|
205
|
+
| state (`.` entry) | nothing | yes (inferred) | yes (inferred) | yes (inferred) | yes (inferred) |
|
|
206
|
+
| custom elements | `customElements` | yes (measured, headless) | yes (inferred) | yes (inferred) | yes (inferred) |
|
|
207
|
+
| Vue components | Vue 3.4 or later | yes (inferred) | yes (inferred) | yes (inferred) | yes (inferred) |
|
|
208
|
+
| CameraFeed | `getUserMedia` on a secure page | unknown | unknown | unknown | unknown |
|
|
209
|
+
| mask drawing by touch | pointer events | unknown | unknown | unknown | unknown |
|
|
210
|
+
|
|
211
|
+
No WebGPU or wasm here; the model you load brings its own needs, and its row says when it cannot run. The headless smoke runs the demo pages on stub providers; no real model has run through a view (see below).
|
|
212
|
+
|
|
213
|
+
## Errors and troubleshooting
|
|
214
|
+
|
|
215
|
+
| message | cause | what to do |
|
|
216
|
+
|---|---|---|
|
|
217
|
+
| `no loader for <id>: pass one to useModelPick, such as weightsLoader(store)` | a pick has no loader | pass `loader` to `useModelPick`, or set `loader` on `<model-select>` |
|
|
218
|
+
| `<model> loads through its runtime. the page passes a loader for it.` | `weightsLoader` got a record with no files to fetch (WebLLM, MediaPipe and the like) | pass a loader that starts that runtime |
|
|
219
|
+
| `this needs a model. pick one in the bar and load it.` (a reply, `NO_ENGINE`) | the thread has no engine | load a model and call `thread.setEngine`, or set `engine` on `<chat-pane>` |
|
|
220
|
+
| `no speech model loaded. pick one and load it.` (a failed file) | `<transcribe-drop>` has no transcriber | set its transcriber from @hackbuild/transcribe |
|
|
221
|
+
| `no custom elements in this environment` | `define()` ran without `customElements` or `HTMLElement` | call it on a page, or pass a registry and a base class |
|
|
222
|
+
| `the image did not load: ...`, `the cut failed: ...`, `segment everything failed: ...` (studio state) | the image or a segment model failed | read the message; check the model loaded |
|
|
223
|
+
|
|
224
|
+
## Works with
|
|
225
|
+
|
|
226
|
+
- [@hackbuild/models](../models/README.md) supplies the records, fit words and budget behind every picker row.
|
|
227
|
+
- [@hackbuild/weights](../weights/README.md) fetches and caches the files through `weightsLoader(store)` and deletes them through `weightsRemover(store)`.
|
|
228
|
+
- [@hackbuild/chat](../chat/README.md) gives the engine a chat thread streams from.
|
|
229
|
+
- [@hackbuild/transcribe](../transcribe/README.md) gives the transcriber a transcribe queue runs, and the txt, srt, vtt and json writers.
|
|
230
|
+
- [@hackbuild/memory](../memory/README.md) gives the recall the memory inspector shows.
|
|
231
|
+
- [@hackbuild/vision](../vision/README.md), [@hackbuild/speak](../speak/README.md), [@hackbuild/embed](../embed/README.md) and [@hackbuild/imagegen](../imagegen/README.md) supply the records of their jobs.
|
|
232
|
+
|
|
233
|
+
## Changelog and licences
|
|
234
|
+
|
|
235
|
+
Changes are in the repository [CHANGELOG](../../CHANGELOG.md). Code is MIT ([LICENSE](../../LICENSE)); this README is CC-BY-4.0 with its code samples also MIT. No weights ship here. Each record names its weight licence in the table above, among them Apache-2.0, MIT, CC-BY-NC-4.0, AGPL-3.0 (YOLOv10, FastSAM), the InsightFace non-commercial research terms, the Stability AI licences and CreativeML OpenRAIL-M. The quick start loads Qwen2.5 0.5B Instruct GGUF, weights Apache-2.0.
|
|
69
236
|
|
|
70
237
|
## What is verified, and what is not
|
|
71
238
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
-
|
|
83
|
-
|
|
239
|
+
### Verified on this machine
|
|
240
|
+
|
|
241
|
+
| date | check | result |
|
|
242
|
+
|---|---|---|
|
|
243
|
+
| 2026-11-25 | `npx vitest run packages/ai-views` | pass: every job has the records above with a speed word and a verdict; rows carry size, memory, backend, marks, detail and options, and a row that does not fit names why; a pick loads with progress, cancels and keeps a failure's words; presets total their download; the chat thread streams with the reasoning apart and memory used; the queue runs, edits with undo and exports; the frame mapping crops and mirrors; define registers every element |
|
|
244
|
+
| 2026-11-25 | `node tools/smoke-views.mjs`, headless | pass: one smoke per demo page on stub providers with no weights |
|
|
245
|
+
| 2026-11-25 | `npx vitest run packages/ai-views/test/loaders.test.ts` | pass: jobLoader loads a transformers.js chat model and a depth model through fake runtime modules, a WebLLM model through a fake module, refuses kokoro without the opt in and FastSAM in plain words, stops on abort, imports nothing before a load, makes no network request; the chip cuts a name and shows its size |
|
|
246
|
+
|
|
247
|
+
### Not verified by anything
|
|
248
|
+
|
|
249
|
+
- A real model through jobLoader or any view in this package: tests use fake runtime modules and the demos stubs; no weights were fetched. The transcribe, detect, masks, vision, image, voice and embed paths of jobLoader have no test of their own yet.
|
|
250
|
+
- Touch drawing on a phone.
|
|
251
|
+
- Screen readers.
|
|
84
252
|
|
|
85
253
|
## Size budget
|
|
86
254
|
|
|
87
255
|
| file | gzip (measured) | ceiling |
|
|
88
256
|
|---|---|---|
|
|
89
|
-
| `dist/index.js` (main entry, imports external) |
|
|
90
|
-
| `dist/single/elements.iife.js` (single file build) |
|
|
257
|
+
| `dist/index.js` (main entry, imports external) | 16,915 bytes | 17,760 bytes |
|
|
258
|
+
| `dist/single/elements.iife.js` (single file build) | 86,306 bytes | 90,621 bytes |
|
|
91
259
|
|
|
92
260
|
Measured 2026-11-25 by `node tools/lint-packages.mjs` (gzip level 9) from the packed
|
|
93
261
|
tarball. Generated from `tools/size-budget.json`; CI fails when a file moves more than
|
package/dist/chat.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The state behind ChatPane and Composer
|
|
2
|
+
* The state behind ChatPane and Composer: a
|
|
3
3
|
* thread of turns, one live reply streamed from a @hackbuild/chat engine
|
|
4
4
|
* with its reasoning kept apart for the think fold, the memory each reply
|
|
5
5
|
* used, stop, regenerate, and a markdown export. Framework free.
|
|
6
6
|
*/
|
|
7
7
|
import type { ChatEngine } from "@hackbuild/chat";
|
|
8
|
+
/** A memory recalled for a reply, with its label and score. */
|
|
8
9
|
export interface MemoryUsed {
|
|
9
10
|
label: string;
|
|
10
11
|
/** 0 to 1, shown beside the label. */
|
|
11
12
|
score?: number;
|
|
12
13
|
}
|
|
14
|
+
/** One chat turn: role, text, reasoning, time, whether it is done, memory used, stats and a note. */
|
|
13
15
|
export interface Turn {
|
|
14
16
|
id: number;
|
|
15
17
|
role: "user" | "assistant";
|
|
@@ -25,12 +27,17 @@ export interface Turn {
|
|
|
25
27
|
/** "stopped", "failed: ...". */
|
|
26
28
|
note?: string;
|
|
27
29
|
}
|
|
30
|
+
/** What a thread shows: its turns, whether a reply streams, and whether an engine is set. */
|
|
28
31
|
export interface ThreadSnapshot {
|
|
29
32
|
turns: readonly Turn[];
|
|
30
33
|
busy: boolean;
|
|
31
34
|
/** An engine is set; without one a reply says how to get one. */
|
|
32
35
|
ready: boolean;
|
|
33
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Options for `chatThread` and `chatList`: engine, system prompt, memory recall, the no engine
|
|
39
|
+
* reply, clock and reply token cap.
|
|
40
|
+
*/
|
|
34
41
|
export interface ThreadOptions {
|
|
35
42
|
engine?: ChatEngine | null;
|
|
36
43
|
system?: string;
|
|
@@ -42,6 +49,7 @@ export interface ThreadOptions {
|
|
|
42
49
|
/** Reply token cap. */
|
|
43
50
|
maxTokens?: number;
|
|
44
51
|
}
|
|
52
|
+
/** A chat thread: send, stop, regenerate, remove and clear turns, set the engine, and export as markdown. */
|
|
45
53
|
export interface ChatThread {
|
|
46
54
|
snapshot(): ThreadSnapshot;
|
|
47
55
|
subscribe(fn: (s: ThreadSnapshot) => void): () => void;
|
|
@@ -55,20 +63,24 @@ export interface ChatThread {
|
|
|
55
63
|
/** The thread as markdown, for an export. */
|
|
56
64
|
markdown(title?: string): string;
|
|
57
65
|
}
|
|
66
|
+
/** What a reply says when no chat engine is set. */
|
|
58
67
|
export declare const NO_ENGINE = "this needs a model. pick one in the bar and load it.";
|
|
68
|
+
/** Creates a chat thread that streams replies from an engine, with optional memory recall per message. */
|
|
59
69
|
export declare function chatThread(o?: ThreadOptions): ChatThread;
|
|
70
|
+
/** One chat in a chat list: id, title, last update and turn count. */
|
|
60
71
|
export interface ChatListItem {
|
|
61
72
|
id: string;
|
|
62
73
|
title: string;
|
|
63
74
|
updated: number;
|
|
64
75
|
count: number;
|
|
65
76
|
}
|
|
77
|
+
/** The chats of a list, newest first, and the id of the open one. */
|
|
66
78
|
export interface ChatListSnapshot {
|
|
67
79
|
items: readonly ChatListItem[];
|
|
68
80
|
current: string;
|
|
69
81
|
}
|
|
70
82
|
/**
|
|
71
|
-
* Several chats
|
|
83
|
+
* Several chats: a list with the newest first, one
|
|
72
84
|
* open. `thread` always speaks for the open chat, so a pane and a composer
|
|
73
85
|
* bound to it follow a switch.
|
|
74
86
|
*/
|
|
@@ -82,6 +94,10 @@ export interface ChatList {
|
|
|
82
94
|
remove(id: string): void;
|
|
83
95
|
setEngine(engine: ChatEngine | null): void;
|
|
84
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Creates a list of chat threads, newest first, with one open; its `thread` always speaks for the
|
|
99
|
+
* open chat.
|
|
100
|
+
*/
|
|
85
101
|
export declare function chatList(o?: ThreadOptions): ChatList;
|
|
86
102
|
/** Tokens the next request carries, by source, for a context meter: about 4 characters a token (inferred). */
|
|
87
103
|
export declare function contextSegments(s: ThreadSnapshot, system?: string): {
|
package/dist/chat.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The state behind ChatPane and Composer
|
|
2
|
+
* The state behind ChatPane and Composer: a
|
|
3
3
|
* thread of turns, one live reply streamed from a @hackbuild/chat engine
|
|
4
4
|
* with its reasoning kept apart for the think fold, the memory each reply
|
|
5
5
|
* used, stop, regenerate, and a markdown export. Framework free.
|
|
6
6
|
*/
|
|
7
7
|
import { statsText } from "@virgilvox/hackbuild-ui/vanilla";
|
|
8
|
+
/** What a reply says when no chat engine is set. */
|
|
8
9
|
export const NO_ENGINE = "this needs a model. pick one in the bar and load it.";
|
|
10
|
+
/** Creates a chat thread that streams replies from an engine, with optional memory recall per message. */
|
|
9
11
|
export function chatThread(o = {}) {
|
|
10
12
|
let engine = o.engine ?? null;
|
|
11
13
|
const now = o.now ?? (() => Date.now());
|
|
@@ -128,6 +130,10 @@ export function chatThread(o = {}) {
|
|
|
128
130
|
},
|
|
129
131
|
};
|
|
130
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Creates a list of chat threads, newest first, with one open; its `thread` always speaks for the
|
|
135
|
+
* open chat.
|
|
136
|
+
*/
|
|
131
137
|
export function chatList(o = {}) {
|
|
132
138
|
const now = o.now ?? (() => Date.now());
|
|
133
139
|
let engine = o.engine ?? null;
|
package/dist/elements.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import type { Env } from "@hackbuild/ai-env";
|
|
15
15
|
import type { ModelRecord } from "@hackbuild/models";
|
|
16
16
|
import { type Loader, type ModelPick } from "./pick.js";
|
|
17
|
-
export { mountModelSelect, mountModelJobs, pickSheet, gateWords, type ModelSelectOptions } from "./mount-model.js";
|
|
17
|
+
export { mountModelSelect, mountModelJobs, pickSheet, gateWords, chipWords, shortName, type ModelSelectOptions } from "./mount-model.js";
|
|
18
18
|
export { mountChatPane, mountComposer, mountChatList, mountContextMeter, turnHtml, type ChatPaneOptions, type ComposerOptions } from "./mount-chat.js";
|
|
19
19
|
export { mountTranscribeDrop, mountTranscriptView, mountTranscribeQueue, mountTranscriptExports, transcriptHtml, type TranscribeDropOptions, type TranscribeDropHandle, type TranscriptViewOptions } from "./mount-transcribe.js";
|
|
20
20
|
export { mountMaskStudio, mountMaskTools, mountMaskVerbs, mountMaskRack, type MaskStudio, type MaskModels, type MaskStudioOptions, type FoundMask, type StudioState, type StudioTool } from "./mount-mask.js";
|
|
@@ -23,13 +23,19 @@ export { mountMemoryInspector, type MemoryInspector } from "./memory.js";
|
|
|
23
23
|
type Base = new () => HTMLElement;
|
|
24
24
|
/** The tag names define() registers, before any prefix. */
|
|
25
25
|
export declare const ELEMENT_NAMES: readonly ["model-select", "model-jobs", "chat-pane", "chat-composer", "chat-list", "chat-context", "transcribe-drop", "transcript-view", "transcribe-queue", "transcript-exports", "mask-studio", "mask-tools", "mask-verbs", "mask-rack", "frame-view", "camera-feed", "memory-inspector"];
|
|
26
|
+
/** A tag name `define` registers, before any prefix. */
|
|
26
27
|
export type ElementName = (typeof ELEMENT_NAMES)[number];
|
|
28
|
+
/**
|
|
29
|
+
* The `<model-select>` element: set `pick`, `env`, `loader` or `records` on it before or after it
|
|
30
|
+
* connects.
|
|
31
|
+
*/
|
|
27
32
|
export interface ModelSelectElement extends HTMLElement {
|
|
28
33
|
pick: ModelPick;
|
|
29
34
|
env: Env | undefined;
|
|
30
35
|
loader: Loader | undefined;
|
|
31
36
|
records: readonly ModelRecord[] | undefined;
|
|
32
37
|
}
|
|
38
|
+
/** The part of a custom element registry `define` uses; `customElements` satisfies it. */
|
|
33
39
|
export interface DefineTarget {
|
|
34
40
|
get(name: string): unknown;
|
|
35
41
|
define(name: string, ctor: CustomElementConstructor): void;
|
package/dist/elements.js
CHANGED
|
@@ -21,7 +21,7 @@ import { mountModelJobs, mountModelSelect } from "./mount-model.js";
|
|
|
21
21
|
import { mountTranscribeDrop, mountTranscribeQueue, mountTranscriptExports, mountTranscriptView } from "./mount-transcribe.js";
|
|
22
22
|
import { transcribeQueue } from "./transcribe.js";
|
|
23
23
|
import { mountMemoryInspector } from "./memory.js";
|
|
24
|
-
export { mountModelSelect, mountModelJobs, pickSheet, gateWords } from "./mount-model.js";
|
|
24
|
+
export { mountModelSelect, mountModelJobs, pickSheet, gateWords, chipWords, shortName } from "./mount-model.js";
|
|
25
25
|
export { mountChatPane, mountComposer, mountChatList, mountContextMeter, turnHtml } from "./mount-chat.js";
|
|
26
26
|
export { mountTranscribeDrop, mountTranscriptView, mountTranscribeQueue, mountTranscriptExports, transcriptHtml } from "./mount-transcribe.js";
|
|
27
27
|
export { mountMaskStudio, mountMaskTools, mountMaskVerbs, mountMaskRack } from "./mount-mask.js";
|
package/dist/frame.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface FrameBox {
|
|
|
13
13
|
/** 0 to 1. */
|
|
14
14
|
score?: number;
|
|
15
15
|
}
|
|
16
|
+
/** Landmark points to draw on a frame, with the index pairs to join and a label. */
|
|
16
17
|
export interface FrameLandmarks {
|
|
17
18
|
points: {
|
|
18
19
|
x: number;
|
|
@@ -22,6 +23,7 @@ export interface FrameLandmarks {
|
|
|
22
23
|
edges?: [number, number][];
|
|
23
24
|
label?: string;
|
|
24
25
|
}
|
|
26
|
+
/** What to draw on a frame: boxes, landmarks, a caption and a corner tag. */
|
|
25
27
|
export interface FrameResults {
|
|
26
28
|
boxes?: FrameBox[];
|
|
27
29
|
landmarks?: FrameLandmarks[];
|
package/dist/index.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export { chatThread, chatList, contextSegments, NO_ENGINE, type ChatList, type C
|
|
|
5
5
|
export { transcribeQueue, type TranscribeQueue, type Transcriber, type RunResult, type RunContext, type Channel, type ExportKind, type QueueSnapshot } from "./transcribe.js";
|
|
6
6
|
export { fitMap, toView, boxWords, frameTag, labelColour, type FrameBox, type FrameLandmarks, type FrameResults } from "./frame.js";
|
|
7
7
|
export { traceRows, inspectorHtml, type TraceRow, type RecallLike } from "./memory.js";
|
|
8
|
+
export { jobLoader, asImage, RUNTIME_URLS, type JobLoaderOptions, type JobValues, type RuntimeModules, type DetectFn, type DepthFn, type AskFn, type ImageJob } from "./loaders.js";
|
package/dist/index.js
CHANGED
|
@@ -8,3 +8,4 @@ export { chatThread, chatList, contextSegments, NO_ENGINE } from "./chat.js";
|
|
|
8
8
|
export { transcribeQueue } from "./transcribe.js";
|
|
9
9
|
export { fitMap, toView, boxWords, frameTag, labelColour } from "./frame.js";
|
|
10
10
|
export { traceRows, inspectorHtml } from "./memory.js";
|
|
11
|
+
export { jobLoader, asImage, RUNTIME_URLS } from "./loaders.js";
|
package/dist/jobs.d.ts
CHANGED
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
* than one place counts once, the running package's copy first.
|
|
6
6
|
*/
|
|
7
7
|
import { type ModelRecord } from "@hackbuild/models";
|
|
8
|
-
/** face-api weights (MIT)
|
|
8
|
+
/** Base URL of the face-api weights (MIT) on the package CDN. */
|
|
9
9
|
export declare const FACE_API_BASE = "https://cdn.jsdelivr.net/npm/@vladmandic/face-api@1.7.12/model/";
|
|
10
|
+
/** A job a model picker serves, such as chat, transcribe, vision or masks. */
|
|
10
11
|
export type Job = "chat" | "transcribe" | "vision" | "detect" | "masks" | "image" | "voice" | "depth" | "embed" | "faceswap" | "landmarks";
|
|
12
|
+
/** A job's words (line label, sheet title, empty line) and which capabilities serve it. */
|
|
11
13
|
export interface JobDef {
|
|
12
14
|
/** The word on a job line: "brain", "ears". */
|
|
13
15
|
label: string;
|
|
@@ -17,10 +19,13 @@ export interface JobDef {
|
|
|
17
19
|
empty: string;
|
|
18
20
|
provides: (caps: readonly string[]) => boolean;
|
|
19
21
|
}
|
|
22
|
+
/** The words and capability test of every job. */
|
|
20
23
|
export declare const JOBS: Readonly<Record<Job, JobDef>>;
|
|
24
|
+
/** Every job name, in the order of `JOBS`. */
|
|
21
25
|
export declare const JOB_NAMES: Job[];
|
|
22
26
|
/** Every record the views know, the running package's copy of a duplicate first. */
|
|
23
27
|
export declare const ALL_RECORDS: readonly ModelRecord[];
|
|
24
28
|
/** The records that do a job, catalogue order kept. */
|
|
25
29
|
export declare function jobRecords(job: Job, records?: readonly ModelRecord[]): ModelRecord[];
|
|
30
|
+
/** Whether a string is a job name. */
|
|
26
31
|
export declare function isJob(s: string | null | undefined): s is Job;
|
package/dist/jobs.js
CHANGED
|
@@ -10,9 +10,10 @@ import { IMAGEGEN_PICKER_RECORDS, IMAGEGEN_RECORDS } from "@hackbuild/imagegen";
|
|
|
10
10
|
import { SPEAK_RECORDS } from "@hackbuild/speak";
|
|
11
11
|
import { TRANSCRIBE_RECORDS } from "@hackbuild/transcribe";
|
|
12
12
|
import { PICKER_RECORDS, VISION_RECORDS, faceApiRecord } from "@hackbuild/vision";
|
|
13
|
-
/** face-api weights (MIT)
|
|
13
|
+
/** Base URL of the face-api weights (MIT) on the package CDN. */
|
|
14
14
|
export const FACE_API_BASE = "https://cdn.jsdelivr.net/npm/@vladmandic/face-api@1.7.12/model/";
|
|
15
15
|
const has = (...want) => (caps) => caps.some((c) => want.includes(c));
|
|
16
|
+
/** The words and capability test of every job. */
|
|
16
17
|
export const JOBS = {
|
|
17
18
|
chat: { label: "brain", title: "pick a chat model", empty: "no model", provides: has("chat") },
|
|
18
19
|
transcribe: { label: "ears", title: "pick a speech model", empty: "no speech model", provides: has("transcribe") },
|
|
@@ -26,6 +27,7 @@ export const JOBS = {
|
|
|
26
27
|
faceswap: { label: "face swap", title: "pick the face swap models", empty: "no face model", provides: has("face.detect", "face.embed", "face.swap") },
|
|
27
28
|
landmarks: { label: "landmarks", title: "pick a landmark model", empty: "no landmarks", provides: has("landmarks.face", "landmarks.hand", "landmarks.pose", "landmarks.gesture") },
|
|
28
29
|
};
|
|
30
|
+
/** Every job name, in the order of `JOBS`. */
|
|
29
31
|
export const JOB_NAMES = Object.keys(JOBS);
|
|
30
32
|
/** Every record the views know, the running package's copy of a duplicate first. */
|
|
31
33
|
export const ALL_RECORDS = (() => {
|
|
@@ -44,6 +46,7 @@ export function jobRecords(job, records = ALL_RECORDS) {
|
|
|
44
46
|
const def = JOBS[job];
|
|
45
47
|
return records.filter((r) => def.provides(r.provides));
|
|
46
48
|
}
|
|
49
|
+
/** Whether a string is a job name. */
|
|
47
50
|
export function isJob(s) {
|
|
48
51
|
return !!s && s in JOBS;
|
|
49
52
|
}
|