@hackbuild/ai-views 0.1.0 → 0.1.1

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.
@@ -3872,7 +3872,7 @@ function ladderFor(rec, env) {
3872
3872
  skipped
3873
3873
  };
3874
3874
  }
3875
- /** The onnxruntime-web ladder the earlier transcription tool walks after one fetch: webgpu at basic, all, disabled, then wasm. */
3875
+ /** The onnxruntime-web ladder to walk after one fetch: webgpu at basic, all, disabled, then wasm. */
3876
3876
  function ortLadder() {
3877
3877
  return [
3878
3878
  {
@@ -3906,6 +3906,7 @@ function ortLadder() {
3906
3906
  ];
3907
3907
  }
3908
3908
  // packages/models/src/pins.ts
3909
+ /** Pinned commits and file hashes per Hugging Face repo, written by tools/pin-weights.mjs. */
3909
3910
  const PINS = {
3910
3911
  "HuggingFaceTB/SmolLM2-135M-Instruct": {
3911
3912
  "revision": "12fd25f77366fa6b3b4b768ec3050bf629380bac",
@@ -6754,6 +6755,7 @@ const PINS = {
6754
6755
  * added to a registry, so every loader resolves `resolve/<commit>/` URLs,
6755
6756
  * and pinnedSha gives the SHA-256 for such a URL.
6756
6757
  */
6758
+ /** The pin of a repo, or undefined when the repo is not pinned. */
6757
6759
  function pinOf(repo) {
6758
6760
  return repo && Object.hasOwn(PINS, repo) ? PINS[repo] : void 0;
6759
6761
  }
@@ -6763,15 +6765,15 @@ function pinnedBase(repo, fallback = "main") {
6763
6765
  }
6764
6766
  // packages/models/src/catalog.ts
6765
6767
  /**
6766
- * Starter records. Sizes marked "inferred" come from the builds' tables or
6768
+ * Starter records. Sizes marked "inferred" come from published tables or
6767
6769
  * from parameter count times bits and are not measured downloads. Chat rows
6768
6770
  * marked "measured" sum the Content-Length of a HEAD request on every file
6769
6771
  * the runtime loads, at the repo head of 2026-11-24, in MiB; no weight was
6770
6772
  * downloaded. WebLLM rows count the Hugging Face repo and leave out the
6771
6773
  * model library wasm, which comes from another host. Licences on the older rows are the ones on each model card as
6772
6774
  * of 2026-11-22; on the chat rows added 2026-11-24 they are the model card
6773
- * licence field the Hugging Face API returns, or the design harvest's
6774
- * string, and were not checked (owner decision). Recheck before shipping a
6775
+ * licence field the Hugging Face API returns, or a recorded string, and
6776
+ * were not checked (owner decision). Recheck before shipping a
6775
6777
  * product on them. Add your own records with registry.add().
6776
6778
  *
6777
6779
  * vramMB marked "computed" on the 14 WebLLM rows added 2026-11-25 is the
@@ -6780,13 +6782,13 @@ function pinnedBase(repo, fallback = "main") {
6780
6782
  * Rows with sizeSource "vendor" added 2026-11-25 sum the file sizes of the
6781
6783
  * Hugging Face listing of the repo (no download), converted to MiB.
6782
6784
  * Every row carries a speed word and a verdict of one to four words: what
6783
- * a person picks by, in the owner's voice, as the earlier tools wrote them.
6785
+ * a person picks by, in the owner's voice.
6784
6786
  *
6785
6787
  * Catalogue facts (params, quant, VRAM, censorship, tags, note) are copied
6786
- * from the owners' tool labels and the WebLLM catalogue as recorded in the
6787
- * design harvest; VRAM figures are the catalogue's own (vendor). Licence
6788
+ * from the owner's model labels and the WebLLM catalogue; VRAM figures are the catalogue's own (vendor). Licence
6788
6789
  * strings are shown as recorded and were not verified for these facts.
6789
6790
  */
6791
+ /** The starter model records, each with its size source and weight licence. */
6790
6792
  const CATALOG = [
6791
6793
  {
6792
6794
  id: "smollm2-135m-instruct",
@@ -7342,7 +7344,7 @@ const CATALOG = [
7342
7344
  tier: "large",
7343
7345
  family: "gemma",
7344
7346
  tags: [],
7345
- note: "an uncensored gemma 4 brain. the earlier clone chat's default; it warns with no webgpu.",
7347
+ note: "an uncensored gemma 4 brain. it warns with no webgpu.",
7346
7348
  group: "uncensored",
7347
7349
  badge: "best",
7348
7350
  speed: "slow",
@@ -7376,7 +7378,7 @@ const CATALOG = [
7376
7378
  tier: "medium",
7377
7379
  family: "gemma",
7378
7380
  tags: [],
7379
- note: "lighter gemma 4. the earlier room's default with webgpu.",
7381
+ note: "lighter gemma 4. a chat default with webgpu.",
7380
7382
  group: "uncensored",
7381
7383
  badge: "lighter",
7382
7384
  speed: "steady",
@@ -7552,7 +7554,7 @@ const CATALOG = [
7552
7554
  tier: "small",
7553
7555
  family: "qwen3.5",
7554
7556
  tags: ["no gpu"],
7555
- note: "the earlier room's default with no webgpu. thin for long chats.",
7557
+ note: "a chat default with no webgpu. thin for long chats.",
7556
7558
  group: "uncensored",
7557
7559
  badge: "faster",
7558
7560
  speed: "fast",
@@ -7684,7 +7686,7 @@ const CATALOG = [
7684
7686
  tier: "small",
7685
7687
  family: "qwen3",
7686
7688
  tags: ["think"],
7687
- note: "a small qwen3 with a think trace. an earlier room's deliberator.",
7689
+ note: "a small qwen3 with a think trace. fits a deliberator role.",
7688
7690
  group: "reasoning",
7689
7691
  badge: "think, easier on memory",
7690
7692
  speed: "fast",
@@ -8354,25 +8356,25 @@ function tjsLadder(spec) {
8354
8356
  }
8355
8357
  return spec.wasmFirst ? [...cpu, ...gpu] : [...gpu, ...cpu];
8356
8358
  }
8357
- /** onnxruntime-web rungs: the earlier transcription tool walk, or wasm only when the graph is known to fail on webgpu. */
8359
+ /** onnxruntime-web rungs: webgpu then wasm, or wasm only when the graph is known to fail on webgpu. */
8358
8360
  function ortRungs(opts = {}) {
8359
8361
  const all = ortLadder();
8360
8362
  return opts.webgpu === false ? all.filter((r) => r.device === "wasm") : all;
8361
8363
  }
8362
- /** Ladders by name, from the builds. Each model record may copy one or write its own. */
8364
+ /** Ladders by name, one per model family. Each model record may copy one or write its own. */
8363
8365
  const LADDERS = {
8364
- /** an earlier relief bench runDepth. */
8366
+ /** Depth: fp16 then fp32 on webgpu, q8 then fp32 on wasm. */
8365
8367
  depth: () => tjsLadder({
8366
8368
  webgpu: ["fp16", "fp32"],
8367
8369
  wasm: ["q8", "fp32"]
8368
8370
  }),
8369
- /** earlier builds: perception models on cpu by default. */
8371
+ /** Perception models on cpu by default. */
8370
8372
  perceptionCpu: () => tjsLadder({
8371
8373
  webgpu: ["fp32"],
8372
8374
  wasm: ["q8", "fp32"],
8373
8375
  wasmFirst: true
8374
8376
  }),
8375
- /** whisper-large-v3-turbo (weights MIT), as the earlier transcription tool ran it. */
8377
+ /** whisper-large-v3-turbo (weights MIT). */
8376
8378
  whisperTurbo: () => tjsLadder({
8377
8379
  webgpu: [{
8378
8380
  encoder_model: "fp16",
@@ -8397,7 +8399,7 @@ const LADDERS = {
8397
8399
  decoder_model_merged: "q8"
8398
8400
  }]
8399
8401
  }),
8400
- /** SmolVLM (weights Apache-2.0): fp16 embed and vision, q4 decoder on webgpu; q8 vision on wasm, as earlier builds ran it. */
8402
+ /** SmolVLM (weights Apache-2.0): fp16 embed and vision, q4 decoder on webgpu; q8 vision on wasm. */
8401
8403
  smolvlm: () => tjsLadder({
8402
8404
  webgpu: [{
8403
8405
  embed_tokens: "fp32",
@@ -8415,7 +8417,7 @@ const LADDERS = {
8415
8417
  }],
8416
8418
  freshHeapRetry: true
8417
8419
  }),
8418
- /** earlier builds: q4f16 on webgpu only. */
8420
+ /** q4f16 on webgpu only. */
8419
8421
  vlmGpuOnly: () => tjsLadder({ webgpu: ["q4f16", "q4"] }),
8420
8422
  ort: ortRungs
8421
8423
  };
@@ -8424,6 +8426,7 @@ const LADDERS = {
8424
8426
  * Embedder records for the models hub. Sizes are inferred from the model
8425
8427
  * repos' file lists; licences are the model cards' as of 2026-11-22.
8426
8428
  */
8429
+ /** Hub records for potion-base-8M, all-MiniLM-L6-v2 and bge-small-en-v1.5. */
8427
8430
  const EMBED_RECORDS = [
8428
8431
  {
8429
8432
  id: "potion-base-8m",
@@ -8443,7 +8446,7 @@ const EMBED_RECORDS = [
8443
8446
  licence: "MIT",
8444
8447
  commercial: true,
8445
8448
  place: "main",
8446
- notes: ["256 dims, no runtime, about 0.08 ms per sentence in an earlier build (measured there, not here)", "misses paraphrase"]
8449
+ notes: ["256 dims, no runtime, about 0.08 ms per sentence (measured outside this repository)", "misses paraphrase"]
8447
8450
  },
8448
8451
  {
8449
8452
  id: "minilm-l6",
@@ -8465,7 +8468,7 @@ const EMBED_RECORDS = [
8465
8468
  commercial: true,
8466
8469
  place: "cpu-worker",
8467
8470
  runtime: "@huggingface/transformers@4.3.2",
8468
- notes: ["384 dims; webgpu with q8 garbled other models in earlier builds, so q8 stays on wasm"]
8471
+ notes: ["384 dims; webgpu with q8 garbled other models, so q8 stays on wasm"]
8469
8472
  },
8470
8473
  {
8471
8474
  id: "bge-small-en",
@@ -8511,6 +8514,7 @@ const free512 = { freeDimensionOverrides: {
8511
8514
  height_latent: 64,
8512
8515
  width_latent: 64
8513
8516
  } };
8517
+ /** The image models {@link attachImagegen} registers: SD-Turbo and SD 1.5, each with its licence, size and form. */
8514
8518
  const IMAGEGEN_RECORDS = [{
8515
8519
  id: "sd-turbo",
8516
8520
  label: "sd-turbo 512",
@@ -8535,9 +8539,9 @@ const IMAGEGEN_RECORDS = [{
8535
8539
  place: "gpu",
8536
8540
  runtime: "onnxruntime-web@1.27.0",
8537
8541
  notes: [
8538
- "webgpu only in an earlier build, no wasm floor",
8542
+ "webgpu only, no wasm floor",
8539
8543
  "tokenizer: Xenova/clip-vit-base-patch16 through transformers.js (CLIP weights MIT)",
8540
- "graph file paths inferred from an earlier build, not checked against the repo"
8544
+ "graph file paths inferred, not checked against the repo"
8541
8545
  ],
8542
8546
  form: {
8543
8547
  steps: {
@@ -8577,7 +8581,7 @@ const IMAGEGEN_RECORDS = [{
8577
8581
  place: "gpu",
8578
8582
  runtime: "onnxruntime-web@1.27.0",
8579
8583
  notes: [
8580
- "about 2 GB by an earlier bench's label (vendor); the repo, its file paths and its input dtypes are inferred and not checked",
8584
+ "about 2 GB (vendor); the repo, its file paths and its input dtypes are inferred and not checked",
8581
8585
  "runs the unet twice a step for guidance, so a step costs about twice an sd-turbo step (inferred)",
8582
8586
  "tokenizer: Xenova/clip-vit-base-patch16 through transformers.js (CLIP weights MIT)"
8583
8587
  ],
@@ -8634,7 +8638,7 @@ const IMAGEGEN_PICKER_RECORDS = [{
8634
8638
  commercial: "unknown",
8635
8639
  place: "gpu",
8636
8640
  runtime: "onnxruntime-web@1.27.0",
8637
- notes: ["two text encoders; the pipeline in this package runs one, so this record is listed and not run yet", "an earlier image bench offered it as the highest quality of three"],
8641
+ notes: ["two text encoders; the pipeline in this package runs one, so this record is listed and not run yet", "the highest quality of the three image models"],
8638
8642
  form: {
8639
8643
  steps: {
8640
8644
  min: 1,
@@ -8651,6 +8655,7 @@ const IMAGEGEN_PICKER_RECORDS = [{
8651
8655
  }
8652
8656
  }];
8653
8657
  // packages/speak/src/records.ts
8658
+ /** Model records for the voices this package drives, for pickers and the models registry. */
8654
8659
  const SPEAK_RECORDS = [
8655
8660
  {
8656
8661
  id: "kokoro-82m",
@@ -8675,7 +8680,7 @@ const SPEAK_RECORDS = [
8675
8680
  commercial: true,
8676
8681
  place: "cpu-worker",
8677
8682
  runtime: "kokoro-js@1.2.1",
8678
- notes: ["webgpu with q8 gave garbled audio in an earlier build", "fp32 weights (about 330 MB, inferred) do not cache on file://, so webgpu needs http"]
8683
+ notes: ["webgpu with q8 has given garbled audio", "fp32 weights (about 330 MB, inferred) do not cache on file://, so webgpu needs http"]
8679
8684
  },
8680
8685
  {
8681
8686
  id: "pocket-tts",
@@ -8743,8 +8748,7 @@ const SPEAK_RECORDS = [
8743
8748
  // packages/transcribe/src/records.ts
8744
8749
  /**
8745
8750
  * Speech to text records for the models hub. Ladders and dtypes are
8746
- * the earlier transcription tool's per model table; sizes are inferred from the builds'
8747
- * notes, except rows marked vendor: those sum the quantized encoder and
8751
+ * one per model table; sizes are inferred from the model notes, except rows marked vendor: those sum the quantized encoder and
8748
8752
  * decoder in the hub listing (no download, 2026-11-25), in MiB. Licences are the model cards' as of 2026-11-22.
8749
8753
  */
8750
8754
  const asr = (r) => ({
@@ -8756,6 +8760,7 @@ const asr = (r) => ({
8756
8760
  runtime: "@huggingface/transformers@4.3.2",
8757
8761
  ...r
8758
8762
  });
8763
+ /** The Whisper and Moonshine model records for the models hub. */
8759
8764
  const TRANSCRIBE_RECORDS = [
8760
8765
  asr({
8761
8766
  id: "whisper-large-v3-turbo",
@@ -8769,7 +8774,7 @@ const TRANSCRIBE_RECORDS = [
8769
8774
  ladder: LADDERS.whisperTurbo(),
8770
8775
  licence: "MIT",
8771
8776
  place: "gpu",
8772
- notes: ["best accuracy, multilingual, wants webgpu (as earlier builds did)", "download per rung: 1.5 gb fp16 encoder and q4 decoder, 2.7 gb fp32 encoder, 1.0 gb q8 on wasm (vendor)"]
8777
+ notes: ["best accuracy, multilingual, wants webgpu", "download per rung: 1.5 gb fp16 encoder and q4 decoder, 2.7 gb fp32 encoder, 1.0 gb q8 on wasm (vendor)"]
8773
8778
  }),
8774
8779
  asr({
8775
8780
  id: "whisper-base",
@@ -8806,7 +8811,7 @@ const TRANSCRIBE_RECORDS = [
8806
8811
  sizeMB: 90,
8807
8812
  ladder: LADDERS.whisperSmall(false),
8808
8813
  licence: "MIT (the OpenAI Whisper release; the Xenova ONNX card says apache-2.0)",
8809
- notes: ["english only; the earlier transcription tool's no gpu default"]
8814
+ notes: ["english only; the default with no gpu"]
8810
8815
  }),
8811
8816
  asr({
8812
8817
  id: "whisper-tiny.en",
@@ -8855,6 +8860,7 @@ const TRANSCRIBE_RECORDS = [
8855
8860
  * only for a URL the app supplies; YOLOv10 n, s and m, FastSAM and the face
8856
8861
  * swap set sit in PICKER_RECORDS.
8857
8862
  */
8863
+ /** The MediaPipe model storage base URL the MediaPipe records load from. */
8858
8864
  const MP_MODELS = "https://storage.googleapis.com/mediapipe-models/";
8859
8865
  /** MediaPipe ladder: GPU delegate (webgl), then the CPU delegate (wasm). */
8860
8866
  const mediapipeLadder = () => [{ device: "webgl" }, { device: "wasm" }];
@@ -8875,6 +8881,7 @@ const mp = (id, provides, path, sizeMB, label, verdict = "light, on the gpu", gr
8875
8881
  place: "main",
8876
8882
  runtime: "@mediapipe/tasks-vision@1.2.3"
8877
8883
  });
8884
+ /** The vision records registered by `attachVision`: Depth Anything V2 small, MediaPipe detection, segmentation and landmarks, SlimSAM, SmolVLM 256M and LFM2-VL 450M. */
8878
8885
  const VISION_RECORDS = [
8879
8886
  {
8880
8887
  id: "depth-anything-v2-small",
@@ -8892,7 +8899,7 @@ const VISION_RECORDS = [
8892
8899
  commercial: true,
8893
8900
  place: "cpu-worker",
8894
8901
  runtime: "@huggingface/transformers@4.3.2",
8895
- notes: ["earlier builds: fp16 on webgpu, fp32 on the same device after a failure"]
8902
+ notes: ["fp16 on webgpu, fp32 on the same device after a failure"]
8896
8903
  },
8897
8904
  mp("efficientdet-lite0", "detect", "object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite", 7, "mediapipe efficientdet lite0 (coco, 80 classes)", "light, 80 things"),
8898
8905
  mp("selfie-segmenter", "segment.person", "image_segmenter/selfie_segmenter/float16/latest/selfie_segmenter.tflite", 1, "mediapipe selfie segmenter"),
@@ -8924,7 +8931,7 @@ const VISION_RECORDS = [
8924
8931
  commercial: true,
8925
8932
  place: "cpu-worker",
8926
8933
  runtime: "@huggingface/transformers@4.3.2",
8927
- notes: ["earlier builds: one image embedding, then any number of point prompts"]
8934
+ notes: ["one image embedding, then any number of point prompts"]
8928
8935
  },
8929
8936
  {
8930
8937
  id: "smolvlm-256m-instruct",
@@ -8967,13 +8974,12 @@ const VISION_RECORDS = [
8967
8974
  commercial: "unknown",
8968
8975
  place: "gpu",
8969
8976
  runtime: "@huggingface/transformers@4.3.2",
8970
- notes: ["earlier builds: q4f16 on webgpu only; the licence limits commercial use by revenue, read it before shipping"]
8977
+ notes: ["q4f16 on webgpu only; the licence limits commercial use by revenue, read it before shipping"]
8971
8978
  }
8972
8979
  ];
8973
8980
  /**
8974
8981
  * Records listed for pickers and never registered by default, so a hub's
8975
- * routing by capability keeps its small defaults: larger alternates the
8976
- * earlier tools offered (smolvlm 500m and 2 video, gemma 4 e2b, two more
8982
+ * routing by capability keeps its small defaults: larger alternates (smolvlm 500m and 2 video, gemma 4 e2b, two more
8977
8983
  * depth models), and records under licences that limit use (YOLOv10 and
8978
8984
  * FastSAM are AGPL-3.0 upstream, Ultralytics; the face swap set is
8979
8985
  * InsightFace, non-commercial). A hub that runs one adds it itself. Sizes
@@ -9007,8 +9013,9 @@ const yolo10 = (size, mb, speed, verdict) => ({
9007
9013
  licence: "AGPL-3.0 (Ultralytics weights, the model card's licence field)",
9008
9014
  commercial: false,
9009
9015
  place: "gpu",
9010
- notes: ["output [1, 300, 6] after the model's own selection, so no nms pass (vendor, the yolov10 paper)", "an earlier room offered nano, small and medium"]
9016
+ notes: ["output [1, 300, 6] after the model's own selection, so no nms pass (vendor, the yolov10 paper)", "comes in nano, small and medium"]
9011
9017
  });
9018
+ /** Records listed for pickers and never registered by default: larger alternates, and records under licences that limit use (YOLOv10, FastSAM, the face swap set). */
9012
9019
  const PICKER_RECORDS = [
9013
9020
  {
9014
9021
  id: "smolvlm-500m-instruct",
@@ -9051,7 +9058,7 @@ const PICKER_RECORDS = [
9051
9058
  commercial: true,
9052
9059
  place: "cpu-worker",
9053
9060
  runtime: "@huggingface/transformers@4.3.2",
9054
- notes: ["an earlier room offered it beside smolvlm 256m and 500m"]
9061
+ notes: ["an option beside smolvlm 256m and 500m"]
9055
9062
  },
9056
9063
  {
9057
9064
  id: "depth-anything-v2-base",
@@ -9108,7 +9115,7 @@ const PICKER_RECORDS = [
9108
9115
  commercial: true,
9109
9116
  place: "gpu",
9110
9117
  runtime: "@huggingface/transformers@4.3.2",
9111
- notes: ["an earlier dog sim used it as the cortex at about 3.3 GB (vendor there)"]
9118
+ notes: ["about 3.3 GB (vendor)"]
9112
9119
  },
9113
9120
  yolo10("n", 9, "instant", "nano, quick"),
9114
9121
  yolo10("s", 28, "fast", "small, sharper"),
@@ -9137,7 +9144,7 @@ const PICKER_RECORDS = [
9137
9144
  licence: "AGPL-3.0 upstream (Ultralytics FastSAM); the export's card says apache-2.0",
9138
9145
  commercial: false,
9139
9146
  place: "cpu-worker",
9140
- notes: ["an earlier mask tool found every mask in one pass on onnxruntime-web (93 MB there, vendor)", "segment everything: prototype masks, nms, then a pick by click"]
9147
+ notes: ["finds every mask in one pass on onnxruntime-web (93 MB, vendor)", "segment everything: prototype masks, nms, then a pick by click"]
9141
9148
  },
9142
9149
  {
9143
9150
  id: "scrfd-10g",
@@ -9210,7 +9217,7 @@ const PICKER_RECORDS = [
9210
9217
  licence: "InsightFace: non-commercial research only; the mirror's card says gpl-3.0",
9211
9218
  commercial: false,
9212
9219
  place: "gpu",
9213
- notes: ["128 px faces; an earlier face swap tool pasted the result back with a feathered mask"]
9220
+ notes: ["128 px faces; paste the result back with a feathered mask"]
9214
9221
  }
9215
9222
  ];
9216
9223
  /** A face landmark fallback record over face-api.js tiny nets (code MIT; weights MIT from @vladmandic/face-api). */
@@ -9239,9 +9246,10 @@ function faceApiRecord(baseUrl) {
9239
9246
  * records come from the packages that run them; a record listed in more
9240
9247
  * than one place counts once, the running package's copy first.
9241
9248
  */
9242
- /** face-api weights (MIT) as an earlier face swap tool loaded them, from the package CDN. */
9249
+ /** Base URL of the face-api weights (MIT) on the package CDN. */
9243
9250
  const FACE_API_BASE = "https://cdn.jsdelivr.net/npm/@vladmandic/face-api@1.7.12/model/";
9244
9251
  const has = (...want) => (caps) => caps.some((c) => want.includes(c));
9252
+ /** The words and capability test of every job. */
9245
9253
  const JOBS = {
9246
9254
  chat: {
9247
9255
  label: "brain",
@@ -9350,9 +9358,11 @@ const GROUPS = {
9350
9358
  "no download": "none",
9351
9359
  own: "own"
9352
9360
  };
9361
+ /** Whether a record has nothing to download: a built in, system or zero size model. */
9353
9362
  function isNoDownload(r) {
9354
9363
  return !!r.noDownload || r.sizeMB === 0 || r.provider === "prompt-api" || r.provider === "system";
9355
9364
  }
9365
+ /** Whether a record's censorship is "uncensored" or "abliterated". */
9356
9366
  function isUncensored(r) {
9357
9367
  return r.censorship === "uncensored" || r.censorship === "abliterated";
9358
9368
  }
@@ -9585,6 +9595,7 @@ function defaultPick(records, env, estimate) {
9585
9595
  }).unfit === void 0);
9586
9596
  return (fits.find((r) => r.group === "start here") ?? fits.find((r) => r.speed === "fast" || r.speed === "steady") ?? fits[0] ?? records[0])?.id ?? "";
9587
9597
  }
9598
+ /** Creates a model picker for a job, with rows that say whether each model fits this machine. */
9588
9599
  function useModelPick(job, o = {}) {
9589
9600
  const def = JOBS[job];
9590
9601
  let records = jobRecords(job, o.records ?? ALL_RECORDS);
@@ -9930,13 +9941,14 @@ function contextSegments(s, system = "") {
9930
9941
  }
9931
9942
  // packages/ai-views/src/mount-chat.ts
9932
9943
  /**
9933
- * ChatPane and Composer in the DOM, after the earlier chat tools: the
9944
+ * ChatPane and Composer in the DOM: the
9934
9945
  * thread as hackbuild-ui messages, the reasoning in a fold that is open
9935
9946
  * while it streams, the memory a reply used in a fold under it, copy and
9936
9947
  * redo on the last reply only, and a composer whose send is the one pink
9937
9948
  * action and turns into stop while a reply streams.
9938
9949
  */
9939
9950
  const paras = (t) => t.split(/\n{2,}/).map((p) => p.trim()).filter(Boolean).map((p) => `<div class="hb-msg-text">${esc(p).replace(/\n/g, "<br>")}</div>`).join("");
9951
+ /** The HTML of one chat turn, with its reasoning fold, memory used and stats. */
9940
9952
  function turnHtml(t, o) {
9941
9953
  if (t.role === "user") return `<div class="hb-msg is-user" data-turn="${t.id}"><span class="hb-msg-who"><span class="hb-msg-name">you</span></span><div class="hb-msg-parts">${paras(t.text)}</div></div>`;
9942
9954
  const live = !t.done;
@@ -10075,11 +10087,11 @@ function mountContextMeter(host, thread, o = {}) {
10075
10087
  }
10076
10088
  // packages/ai-views/src/mount-transcribe.ts
10077
10089
  /**
10078
- * TranscribeDrop, TranscriptView and their rack parts in the DOM, after the
10079
- * earlier transcription tool: the drop zone is the page until a file is in
10090
+ * TranscribeDrop, TranscriptView and their rack parts in the DOM: the drop zone is the page until a file is in
10080
10091
  * it, then the transcript is. Lines carry their time, edit in place (one
10081
10092
  * undo step each), and export as txt, srt, vtt and json once there is text.
10082
10093
  */
10094
+ /** The HTML of one channel's transcript, or an empty note when there is none. */
10083
10095
  function transcriptHtml(c, o = {}) {
10084
10096
  if (!c) return `<p class="hb-lay-empty-note">nothing yet. drop a file.</p>`;
10085
10097
  const st = di(c.status);
@@ -10236,7 +10248,7 @@ function mountTranscriptExports(host, queue, o = {}) {
10236
10248
  }
10237
10249
  // packages/ai-views/src/mount-mask.ts
10238
10250
  /**
10239
- * MaskStudio, after the earlier mask studio: drop an image, press a thing
10251
+ * MaskStudio: drop an image, press a thing
10240
10252
  * to cut it out (a click segment model such as SlimSAM), fix the mask by
10241
10253
  * hand with the wand, brush and lasso of hackbuild-ui maskEditor (x swaps
10242
10254
  * add and erase, [ and ] size the brush, ctrl z undoes), zoom and fit, and
@@ -10280,6 +10292,10 @@ function thumbOf(img) {
10280
10292
  t.getContext("2d")?.drawImage(c, 0, 0, t.width, t.height);
10281
10293
  return t.toDataURL("image/png");
10282
10294
  }
10295
+ /**
10296
+ * Mounts a mask studio on a host: drop or open an image, then cut masks with the point, wand, brush
10297
+ * and lasso tools or a segment model.
10298
+ */
10283
10299
  function mountMaskStudio(host, o = {}) {
10284
10300
  let models = o.models ?? {};
10285
10301
  const l = listeners();
@@ -10631,6 +10647,7 @@ function mountMaskRack(host, studio, part, o = {}) {
10631
10647
  // packages/ai-views/src/memory.ts
10632
10648
  const n3 = (x) => Number.isFinite(x) ? x.toFixed(3) : "none";
10633
10649
  const rank = (r) => r >= 0 ? `#${r + 1}` : "none";
10650
+ /** The rows of a recall trace as text, marking the hits handed to the model. */
10634
10651
  function traceRows(r, maxText = 80) {
10635
10652
  const used = new Set(r.hits.map((h) => h.item.id));
10636
10653
  return r.trace.map((t, i) => ({
@@ -10645,11 +10662,13 @@ function traceRows(r, maxText = 80) {
10645
10662
  used: used.has(t.id)
10646
10663
  }));
10647
10664
  }
10665
+ /** The HTML of a recall trace table, or an empty note before any recall. */
10648
10666
  function inspectorHtml(rec) {
10649
10667
  if (!rec) return `<p class="hb-lay-empty-note">no recall yet. ask something to see what memory finds.</p>`;
10650
10668
  const rows = traceRows(rec);
10651
10669
  return `<p class="hb-lay-empty-note" role="status">"${esc(rec.query)}", ${esc(rec.mode)} recall, ${rows.length} found, ${rows.filter((x) => x.used).length} used.</p><div class="hb-scroll-x" data-ux="detail"><table class="hb-table"><thead><tr><th class="num">#</th><th>kind</th><th>text</th><th>bm25</th><th>cosine</th><th class="num">rrf</th><th class="num">score</th></tr></thead><tbody>` + rows.map((x) => `<tr class="${x.used ? "is-mark" : ""}" data-used="${x.used}"><td class="num">${x.rank}</td><td>${esc(x.kind)}</td><td>${esc(x.text)}</td><td>${esc(x.bm25)}</td><td>${esc(x.cos)}</td><td class="num">${x.rrf}</td><td class="num">${x.score}</td></tr>`).join("") + `</tbody></table></div>`;
10652
10670
  }
10671
+ /** Shows a recall trace as a table on a host. */
10653
10672
  function mountMemoryInspector(host, rec = null) {
10654
10673
  host.innerHTML = inspectorHtml(rec);
10655
10674
  return {
@@ -10705,7 +10724,7 @@ function labelColour(label, palette) {
10705
10724
  }
10706
10725
  // packages/ai-views/src/mount-frame.ts
10707
10726
  /**
10708
- * FrameView and CameraFeed, after the eyes view of an earlier room: a
10727
+ * FrameView and CameraFeed: a
10709
10728
  * frame in a hackbuild-ui camera tile with what the models found drawn
10710
10729
  * over it (boxes with their word and score, landmark points and lines),
10711
10730
  * a count in the corner and the caption under it. CameraFeed opens the
@@ -10718,6 +10737,7 @@ const css = (el, name, fb) => {
10718
10737
  return fb;
10719
10738
  }
10720
10739
  };
10740
+ /** Draws a frame in a camera tile on a host, with boxes, landmarks, a corner tag and a caption over it. */
10721
10741
  function mountFrameView(host, o = {}) {
10722
10742
  host.innerHTML = `<div class="hb-frameview"><figure class="hb-camtile" aria-label="frame"><div class="hb-camtile-none" role="status">${esc(o.empty ?? "no frame yet")}</div><canvas aria-hidden="true"></canvas><span class="hb-camtile-tag is-tl" hidden></span></figure><p class="hb-frameview-cap" data-caption aria-live="polite" hidden></p></div>`;
10723
10743
  const fig = host.querySelector("figure");
@@ -10873,6 +10893,7 @@ function mountFrameView(host, o = {}) {
10873
10893
  dispose: () => l.off()
10874
10894
  };
10875
10895
  }
10896
+ /** Opens the camera into a host and hands the video to `onFrame` at the set rate while it is live. */
10876
10897
  function mountCameraFeed(host, o = {}) {
10877
10898
  const video = document.createElement("video");
10878
10899
  video.autoplay = true;
@@ -10976,6 +10997,7 @@ function hosted(setupMount, deps = () => []) {
10976
10997
  });
10977
10998
  };
10978
10999
  }
11000
+ /** Vue component for a model picker of one job; emits `pick`, `choose`, `loaded` and `failed`. */
10979
11001
  const ModelSelect = /* @__PURE__ */ defineComponent({
10980
11002
  name: "ModelSelect",
10981
11003
  props: {
@@ -11037,6 +11059,7 @@ const ModelSelect = /* @__PURE__ */ defineComponent({
11037
11059
  p.go
11038
11060
  ])
11039
11061
  });
11062
+ /** Vue component for the turns of a chat thread. */
11040
11063
  const ChatPane = /* @__PURE__ */ defineComponent({
11041
11064
  name: "ChatPane",
11042
11065
  props: {
@@ -11063,6 +11086,7 @@ const ChatPane = /* @__PURE__ */ defineComponent({
11063
11086
  emptyNote: p.emptyNote
11064
11087
  }), (p) => [p.thread])
11065
11088
  });
11089
+ /** Vue component for the message box of a chat thread. */
11066
11090
  const Composer = /* @__PURE__ */ defineComponent({
11067
11091
  name: "Composer",
11068
11092
  props: {
@@ -11077,6 +11101,7 @@ const Composer = /* @__PURE__ */ defineComponent({
11077
11101
  },
11078
11102
  setup: hosted((host, p) => mountComposer(host, p.thread, { placeholder: p.placeholder }), (p) => [p.thread])
11079
11103
  });
11104
+ /** Vue component for the drop zone that becomes the transcript; emits `sample`. */
11080
11105
  const TranscribeDrop = /* @__PURE__ */ defineComponent({
11081
11106
  name: "TranscribeDrop",
11082
11107
  props: {
@@ -11102,6 +11127,7 @@ const TranscribeDrop = /* @__PURE__ */ defineComponent({
11102
11127
  } : {}
11103
11128
  }), (p) => [p.queue])
11104
11129
  });
11130
+ /** Vue component for the selected transcript, or its export buttons when `exports` is set. */
11105
11131
  const TranscriptView = /* @__PURE__ */ defineComponent({
11106
11132
  name: "TranscriptView",
11107
11133
  props: {
@@ -11116,6 +11142,10 @@ const TranscriptView = /* @__PURE__ */ defineComponent({
11116
11142
  },
11117
11143
  setup: hosted((host, p) => p.exports ? mountTranscriptExports(host, p.queue) : mountTranscriptView(host, p.queue), (p) => [p.queue, p.exports])
11118
11144
  });
11145
+ /**
11146
+ * Vue component for a mask studio; emits `studio` with the mounted studio and `sample` when the
11147
+ * sample button is pressed.
11148
+ */
11119
11149
  const MaskStudio = /* @__PURE__ */ defineComponent({
11120
11150
  name: "MaskStudio",
11121
11151
  props: {
@@ -11152,6 +11182,7 @@ const MaskStudio = /* @__PURE__ */ defineComponent({
11152
11182
  });
11153
11183
  }
11154
11184
  });
11185
+ /** Vue component for the tool rail of a mask studio. */
11155
11186
  const MaskTools = /* @__PURE__ */ defineComponent({
11156
11187
  name: "MaskTools",
11157
11188
  props: { studio: {
@@ -11160,6 +11191,7 @@ const MaskTools = /* @__PURE__ */ defineComponent({
11160
11191
  } },
11161
11192
  setup: hosted((host, p) => mountMaskTools(host, p.studio), (p) => [p.studio])
11162
11193
  });
11194
+ /** Vue component for the undo, redo and zoom row of a mask studio. */
11163
11195
  const MaskVerbs = /* @__PURE__ */ defineComponent({
11164
11196
  name: "MaskVerbs",
11165
11197
  props: { studio: {
@@ -11168,6 +11200,7 @@ const MaskVerbs = /* @__PURE__ */ defineComponent({
11168
11200
  } },
11169
11201
  setup: hosted((host, p) => mountMaskVerbs(host, p.studio), (p) => [p.studio])
11170
11202
  });
11203
+ /** Vue component for one rack part of a mask studio: found, mask, saved or export. */
11171
11204
  const MaskRack = /* @__PURE__ */ defineComponent({
11172
11205
  name: "MaskRack",
11173
11206
  props: {
@@ -11186,6 +11219,7 @@ const MaskRack = /* @__PURE__ */ defineComponent({
11186
11219
  },
11187
11220
  setup: hosted((host, p) => mountMaskRack(host, p.studio, p.part, { name: p.name }), (p) => [p.studio, p.part])
11188
11221
  });
11222
+ /** Vue component for a jobs rack: a line per job, presets and load all. */
11189
11223
  const ModelJobs = /* @__PURE__ */ defineComponent({
11190
11224
  name: "ModelJobs",
11191
11225
  props: {
@@ -11200,6 +11234,7 @@ const ModelJobs = /* @__PURE__ */ defineComponent({
11200
11234
  },
11201
11235
  setup: hosted((host, p) => mountModelJobs(host, p.jobs, { go: p.go }), (p) => [p.jobs, p.go])
11202
11236
  });
11237
+ /** Vue component for the file list of a transcribe queue. */
11203
11238
  const TranscribeQueue = /* @__PURE__ */ defineComponent({
11204
11239
  name: "TranscribeQueue",
11205
11240
  props: { queue: {
@@ -11208,6 +11243,7 @@ const TranscribeQueue = /* @__PURE__ */ defineComponent({
11208
11243
  } },
11209
11244
  setup: hosted((host, p) => mountTranscribeQueue(host, p.queue), (p) => [p.queue])
11210
11245
  });
11246
+ /** Vue component that shows a recall trace as a table. */
11211
11247
  const MemoryInspector = /* @__PURE__ */ defineComponent({
11212
11248
  name: "MemoryInspector",
11213
11249
  props: { recall: {
@@ -11226,6 +11262,7 @@ const MemoryInspector = /* @__PURE__ */ defineComponent({
11226
11262
  });
11227
11263
  }
11228
11264
  });
11265
+ /** Vue component for the chat list rail of a `chatList`. */
11229
11266
  const ChatList = /* @__PURE__ */ defineComponent({
11230
11267
  name: "ChatList",
11231
11268
  props: {
@@ -11240,6 +11277,7 @@ const ChatList = /* @__PURE__ */ defineComponent({
11240
11277
  },
11241
11278
  setup: hosted((host, p) => mountChatList(host, p.list, { label: p.label }), (p) => [p.list])
11242
11279
  });
11280
+ /** Vue component that shows what the next request carries against the context budget. */
11243
11281
  const ContextMeter = /* @__PURE__ */ defineComponent({
11244
11282
  name: "ContextMeter",
11245
11283
  props: {
@@ -11261,6 +11299,10 @@ const ContextMeter = /* @__PURE__ */ defineComponent({
11261
11299
  system: () => p.system
11262
11300
  }), (p) => [p.thread])
11263
11301
  });
11302
+ /**
11303
+ * Vue component that draws a frame with boxes, landmarks and a caption; emits `view` with the
11304
+ * mounted view.
11305
+ */
11264
11306
  const FrameView = /* @__PURE__ */ defineComponent({
11265
11307
  name: "FrameView",
11266
11308
  props: {
@@ -11297,6 +11339,7 @@ const FrameView = /* @__PURE__ */ defineComponent({
11297
11339
  });
11298
11340
  }
11299
11341
  });
11342
+ /** Vue component that opens the camera; emits `feed` with the feed and `frame` with the video at `fps`. */
11300
11343
  const CameraFeed = /* @__PURE__ */ defineComponent({
11301
11344
  name: "CameraFeed",
11302
11345
  props: { fps: {
@@ -1,12 +1,12 @@
1
1
  /**
2
- * The state behind TranscribeDrop and TranscriptView, after the earlier
3
- * transcription tool: drop files, they queue as channels, run one at a
2
+ * The state behind TranscribeDrop and TranscriptView: drop files, they queue as channels, run one at a
4
3
  * time, and each becomes a transcript with timestamps that a person can
5
4
  * edit (with undo) and export as txt, srt, vtt or json. The engine is a
6
5
  * function the page passes, so a stub runs the view with no weights.
7
6
  */
8
7
  import { type Dropped, type Seg } from "@hackbuild/transcribe";
9
8
  import { type StripFigure, type StripStatus } from "@virgilvox/hackbuild-ui/vanilla";
9
+ /** What a transcriber returns: segments, dropped lines, duration, language and model. */
10
10
  export interface RunResult {
11
11
  segments: Seg[];
12
12
  dropped?: Dropped[];
@@ -15,6 +15,7 @@ export interface RunResult {
15
15
  language?: string;
16
16
  model?: string;
17
17
  }
18
+ /** What a transcriber gets: an abort signal and a progress callback. */
18
19
  export interface RunContext {
19
20
  signal: AbortSignal;
20
21
  /** 0 to 1. */
@@ -24,6 +25,10 @@ export interface RunContext {
24
25
  export type Transcriber = (file: Blob & {
25
26
  name: string;
26
27
  }, ctx: RunContext) => Promise<RunResult>;
28
+ /**
29
+ * One file in a transcribe queue: name, size, status, progress, segments, dropped lines and the
30
+ * error if it failed.
31
+ */
27
32
  export interface Channel {
28
33
  id: number;
29
34
  name: string;
@@ -39,7 +44,9 @@ export interface Channel {
39
44
  error?: string;
40
45
  meta: StripFigure[];
41
46
  }
47
+ /** A transcript export format: txt, srt, vtt or json. */
42
48
  export type ExportKind = "txt" | "srt" | "vtt" | "json";
49
+ /** What a transcribe queue shows: channels, the selected one, whether it runs, and undo state. */
43
50
  export interface QueueSnapshot {
44
51
  channels: readonly Channel[];
45
52
  selected: number | null;
@@ -47,6 +54,10 @@ export interface QueueSnapshot {
47
54
  canUndo: boolean;
48
55
  canRedo: boolean;
49
56
  }
57
+ /**
58
+ * A transcribe queue: add files, start and stop, select, edit lines with undo, and export a channel
59
+ * as txt, srt, vtt or json.
60
+ */
50
61
  export interface TranscribeQueue {
51
62
  snapshot(): QueueSnapshot;
52
63
  subscribe(fn: (s: QueueSnapshot) => void): () => void;
@@ -74,6 +85,7 @@ export interface TranscribeQueue {
74
85
  } | null;
75
86
  setTranscriber(t: Transcriber): void;
76
87
  }
88
+ /** Creates a transcribe queue that runs each file through `run`, one at a time. */
77
89
  export declare function transcribeQueue(o: {
78
90
  run: Transcriber;
79
91
  autostart?: boolean;