@hackbuild/ai-views 0.1.17 → 0.1.19

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.
@@ -3059,6 +3059,282 @@ var init_pins = __esmMin((() => {
3059
3059
  "vendor"
3060
3060
  ]
3061
3061
  }
3062
+ },
3063
+ "onnx-community/Qwen3.5-0.8B-ONNX-OPT": {
3064
+ "revision": "9a4c21d8f724176b0a7edaaed36303044451886e",
3065
+ "files": {
3066
+ "config.json": [
3067
+ "36fed6a902ccd06ef19a452bd5a0750bd88fe347d06ab75ef515615bac5b296d",
3068
+ 2849,
3069
+ "measured"
3070
+ ],
3071
+ "generation_config.json": [
3072
+ "dc0cbe66543f310896469b7b1448af792f403293a1080baaf04d586c57b23e48",
3073
+ 248,
3074
+ "measured"
3075
+ ],
3076
+ "onnx/decoder_model_merged_q4.onnx": [
3077
+ "7390858c80a67275d8cb81fb70f66a24d3b86fe333057c1312de09c184a2d41b",
3078
+ 576621,
3079
+ "vendor"
3080
+ ],
3081
+ "onnx/decoder_model_merged_q4.onnx_data": [
3082
+ "1a9165072dd51a9b6a917b6357a3686372b7429313022802cd4c9a730e8c9749",
3083
+ 483655680,
3084
+ "vendor"
3085
+ ],
3086
+ "onnx/decoder_model_merged_q4f16.onnx": [
3087
+ "bd556c6ba812cb7c46328d0caf05e9c3a7e3b8b644add85ae21ad7054524d387",
3088
+ 697833,
3089
+ "vendor"
3090
+ ],
3091
+ "onnx/decoder_model_merged_q4f16.onnx_data": [
3092
+ "e3459410bf09b756150fb590778f09a52dda85ca1426f65ecac18192fac18b91",
3093
+ 435777536,
3094
+ "vendor"
3095
+ ],
3096
+ "onnx/embed_tokens_q4.onnx": [
3097
+ "8773dcf4858f855bfce13def4356ca17e0bc516a477154496b6ffb6dd6d084dc",
3098
+ 857,
3099
+ "vendor"
3100
+ ],
3101
+ "onnx/embed_tokens_q4.onnx_data": [
3102
+ "9210b1d26eb14136d3522584d17da14cc5f4b82b6f5607e6d80d59424a8cbe99",
3103
+ 162897920,
3104
+ "vendor"
3105
+ ],
3106
+ "onnx/embed_tokens_q4f16.onnx": [
3107
+ "8218531ac44ae9978d50647f1d907c53c308f758514b992504238c77843c254d",
3108
+ 1064,
3109
+ "vendor"
3110
+ ],
3111
+ "onnx/embed_tokens_q4f16.onnx_data": [
3112
+ "ec4a1f13ff942653b52000a7a0ec40504110d8be9a0ecab2da4d3063588ed563",
3113
+ 147005440,
3114
+ "vendor"
3115
+ ],
3116
+ "onnx/vision_encoder_q4.onnx": [
3117
+ "9b62022e77de4b22ca0bbc4453083c0cdeb8f967ccf13931d4c24c6e7c776177",
3118
+ 185278,
3119
+ "vendor"
3120
+ ],
3121
+ "onnx/vision_encoder_q4.onnx_data": [
3122
+ "98aebedf02fc5414fd1c7f06a6580b42e272600ace9ecd33bfbc479a0c541c64",
3123
+ 68267008,
3124
+ "vendor"
3125
+ ],
3126
+ "onnx/vision_encoder_q4f16.onnx": [
3127
+ "1e76d0c16c1c196e7e6f33053284369e0bc82b10bdc2f14bdf103f86ae5eb11a",
3128
+ 213118,
3129
+ "vendor"
3130
+ ],
3131
+ "onnx/vision_encoder_q4f16.onnx_data": [
3132
+ "0847376fcef41cb3874a21f0eb1b75428502537e16f360bdbf854e71ef552319",
3133
+ 61919744,
3134
+ "vendor"
3135
+ ],
3136
+ "preprocessor_config.json": [
3137
+ "6a970fd06f30e6943b3e2c14d5d3b42d49b06cf99b99103d56689bef462d90f8",
3138
+ 336,
3139
+ "measured"
3140
+ ],
3141
+ "processor_config.json": [
3142
+ "14932921ca485d458a04dafd8069fbb0a4505622a48208d19ed247115801385b",
3143
+ 1300,
3144
+ "measured"
3145
+ ],
3146
+ "tokenizer.json": [
3147
+ "89da80cc6689bef4d90cc1028249436975ffb0814618f1d93c65310e05801a9b",
3148
+ 19226111,
3149
+ "vendor"
3150
+ ],
3151
+ "tokenizer_config.json": [
3152
+ "5dcac2c1306b11d1e18ec4c024a174bded2ca3178ce87b0aa590711696407f3d",
3153
+ 10069,
3154
+ "measured"
3155
+ ]
3156
+ }
3157
+ },
3158
+ "onnx-community/Qwen3.5-2B-ONNX": {
3159
+ "revision": "315216e893038beefcc6eba41ac168913dd0d879",
3160
+ "files": {
3161
+ "config.json": [
3162
+ "b028de63b0ed8b37107acaaf1475d40d6d4feb5721153674e7d1d0bdbfd0f258",
3163
+ 2993,
3164
+ "measured"
3165
+ ],
3166
+ "generation_config.json": [
3167
+ "dc0cbe66543f310896469b7b1448af792f403293a1080baaf04d586c57b23e48",
3168
+ 248,
3169
+ "measured"
3170
+ ],
3171
+ "onnx/decoder_model_merged_q4.onnx": [
3172
+ "33f9c1311878df2140e7286f76d9e3acb29d77d91f724210674b0b63d8330df5",
3173
+ 885982,
3174
+ "vendor"
3175
+ ],
3176
+ "onnx/decoder_model_merged_q4.onnx_data": [
3177
+ "c6f4807e1287961a354b0bc6f8d4c68c658f707a9541e771a297dfefaf4a1e14",
3178
+ 1209126912,
3179
+ "vendor"
3180
+ ],
3181
+ "onnx/decoder_model_merged_q4f16.onnx": [
3182
+ "aff64289c18b527ee16963444be405d08e7211c4fdca6f3fe53d9d4586703bf7",
3183
+ 1046438,
3184
+ "vendor"
3185
+ ],
3186
+ "onnx/decoder_model_merged_q4f16.onnx_data": [
3187
+ "e0d1375a8d30aa7db927ce05c60c4134345dca61150acdf05b9822bc06c7e54b",
3188
+ 1089777664,
3189
+ "vendor"
3190
+ ],
3191
+ "onnx/embed_tokens_q4.onnx": [
3192
+ "0255dd844858758f452d9678f1e2c91db178f21b7da254d29b12e7fe3d23e305",
3193
+ 857,
3194
+ "vendor"
3195
+ ],
3196
+ "onnx/embed_tokens_q4.onnx_data": [
3197
+ "9a6404d9b1c79ffc038d5c28deec04d419efb4594125453c991be38b4522ecb6",
3198
+ 325795840,
3199
+ "vendor"
3200
+ ],
3201
+ "onnx/embed_tokens_q4f16.onnx": [
3202
+ "802a072ff21f540eda7f343aa71dbb0354c8859caaf34f09b3bf8117725d7de8",
3203
+ 1064,
3204
+ "vendor"
3205
+ ],
3206
+ "onnx/embed_tokens_q4f16.onnx_data": [
3207
+ "650aa8eb39b7404ca2c908d78243c82b6fd88321feeb8fca175745806c6b3a81",
3208
+ 294010880,
3209
+ "vendor"
3210
+ ],
3211
+ "onnx/vision_encoder_q4.onnx": [
3212
+ "7ccbf866b2e0d0c59272c741715fd78764c8777f1063efe070d420191255c9fe",
3213
+ 338758,
3214
+ "vendor"
3215
+ ],
3216
+ "onnx/vision_encoder_q4.onnx_data": [
3217
+ "0ea0ab9559904e1e5150a0ca194136922c6b8f1dfaaa44cc5e174ca59b231bb3",
3218
+ 217952256,
3219
+ "vendor"
3220
+ ],
3221
+ "onnx/vision_encoder_q4f16.onnx": [
3222
+ "805dd77fc1501ce100574dd81d9181f9ce95def7f25c52fda99a5cbb9b691ae9",
3223
+ 393718,
3224
+ "vendor"
3225
+ ],
3226
+ "onnx/vision_encoder_q4f16.onnx_data": [
3227
+ "c54ed06141904a99fa05a9ffaf460ee05441d50dde54f784ec2ae71a43c58314",
3228
+ 196945920,
3229
+ "vendor"
3230
+ ],
3231
+ "preprocessor_config.json": [
3232
+ "6a970fd06f30e6943b3e2c14d5d3b42d49b06cf99b99103d56689bef462d90f8",
3233
+ 336,
3234
+ "measured"
3235
+ ],
3236
+ "processor_config.json": [
3237
+ "14932921ca485d458a04dafd8069fbb0a4505622a48208d19ed247115801385b",
3238
+ 1300,
3239
+ "measured"
3240
+ ],
3241
+ "tokenizer.json": [
3242
+ "89da80cc6689bef4d90cc1028249436975ffb0814618f1d93c65310e05801a9b",
3243
+ 19226111,
3244
+ "vendor"
3245
+ ],
3246
+ "tokenizer_config.json": [
3247
+ "5dcac2c1306b11d1e18ec4c024a174bded2ca3178ce87b0aa590711696407f3d",
3248
+ 10069,
3249
+ "measured"
3250
+ ]
3251
+ }
3252
+ },
3253
+ "onnx-community/Janus-Pro-1B-ONNX": {
3254
+ "revision": "04efdf2e36cb07a034b0d94f7322356b292f0418",
3255
+ "files": {
3256
+ "config.json": [
3257
+ "211520b35aa61bbc07db2cbdc9584abceb2b19d26ae5219998ad50037d6a9d71",
3258
+ 1888,
3259
+ "measured"
3260
+ ],
3261
+ "generation_config.json": [
3262
+ "44328aebd31137f591cce9bf3c82a290785e18cb293e99f2410de52b78f04066",
3263
+ 167,
3264
+ "measured"
3265
+ ],
3266
+ "onnx/gen_head_fp16.onnx": [
3267
+ "59563c2c872555def6959653ad078bfe93d3484f6f9e692e25160ac2dadf4eae",
3268
+ 75536078,
3269
+ "vendor"
3270
+ ],
3271
+ "onnx/gen_img_embeds_fp16.onnx": [
3272
+ "1501cac82ce8d4b26b27af5f9f993b1575e27a42a09d07ac508feaebb79aedde",
3273
+ 8695058,
3274
+ "vendor"
3275
+ ],
3276
+ "onnx/image_decode.onnx": [
3277
+ "5395223c9212df6dca1f29a540f7c5c78971c0d2ee7a3ac88a4e8f5f2b227fb8",
3278
+ 170460651,
3279
+ "vendor"
3280
+ ],
3281
+ "onnx/language_model_q4f16.onnx": [
3282
+ "bda78684bd85d4beda5558179e2a5da960f13969f111a8024f75be11cdef9a61",
3283
+ 698231365,
3284
+ "vendor"
3285
+ ],
3286
+ "onnx/lm_head_fp16.onnx": [
3287
+ "215ccbdb0efd6067e68b3057ba798802727d36795b064fd95dea5a4c79f8a733",
3288
+ 419430700,
3289
+ "vendor"
3290
+ ],
3291
+ "onnx/prepare_inputs_embeds_q4.onnx": [
3292
+ "380c548a75687004c47f7a988f474d03d052b2154292e2a4d001d74d4d2cc845",
3293
+ 1038802881,
3294
+ "vendor"
3295
+ ],
3296
+ "preprocessor_config.json": [
3297
+ "4dae4dc1bda762bdc84b887b2d3339f21935a15ff716b3049490d96935f7f12a",
3298
+ 346,
3299
+ "measured"
3300
+ ],
3301
+ "processor_config.json": [
3302
+ "0e9cc77ac444a91691215ac4e61d2c832b25c44ab006f1b7c85b91880478c5c4",
3303
+ 288,
3304
+ "measured"
3305
+ ],
3306
+ "special_tokens_map.json": [
3307
+ "0db13daead5880bf635018dd15996e4dbe7b4333860794cee2b5d6559edaecae",
3308
+ 344,
3309
+ "measured"
3310
+ ],
3311
+ "tokenizer.json": [
3312
+ "cd187abdb6927a04ff0214b2d3fa05f4131de66298c8b3b75fbc25ce5f7faff2",
3313
+ 4718995,
3314
+ "measured"
3315
+ ],
3316
+ "tokenizer_config.json": [
3317
+ "e72af0754f6460a71590afaae8e9666e709eabc35cd2a68fcd2a349f06bbd53e",
3318
+ 1355,
3319
+ "measured"
3320
+ ]
3321
+ }
3322
+ },
3323
+ "ggml-org/gemma-4-E2B-it-GGUF": {
3324
+ "revision": "2a8538c2e2d4687953a86c422c7c623cfd022880",
3325
+ "files": { "gemma-4-E2B-it-Q4_0.gguf": [
3326
+ "8e30dff3ac4c8434c49a7036fa15564bdbb6044e42bf04550bf1a096ad7e6a52",
3327
+ 2841481184,
3328
+ "vendor"
3329
+ ] }
3330
+ },
3331
+ "ggml-org/Qwen3.5-0.8B-GGUF": {
3332
+ "revision": "1c0b5292de5ccd62235595d1557c0d70d46c3d9d",
3333
+ "files": { "Qwen3.5-0.8B-Q4_0.gguf": [
3334
+ "57d1997790d1744fba5b40a7317df71ea5e2acee28c47e78f0cce39c0703f8cf",
3335
+ 563036064,
3336
+ "vendor"
3337
+ ] }
3062
3338
  }
3063
3339
  };
3064
3340
  }));
@@ -3995,6 +4271,184 @@ var init_catalog = __esmMin((() => {
3995
4271
  commercial: "unknown",
3996
4272
  runtime: "@wllama/wllama@3.8.1"
3997
4273
  },
4274
+ {
4275
+ id: "gemma-4-e2b-it-mlc",
4276
+ label: "Gemma 4 E2B",
4277
+ params: "E2B",
4278
+ quant: "q4f16_1",
4279
+ vramMB: 3387,
4280
+ vramSource: "vendor",
4281
+ censorship: "stock",
4282
+ tier: "medium",
4283
+ family: "gemma",
4284
+ tags: [],
4285
+ note: "google's gemma 4, the small one. text here; images run through the vision records.",
4286
+ group: "good",
4287
+ badge: "newest gemma",
4288
+ speed: "steady",
4289
+ verdict: "newest gemma, heavier",
4290
+ provides: ["chat"],
4291
+ provider: "webllm",
4292
+ source: { modelId: "gemma-4-E2B-it-q4f16_1-MLC" },
4293
+ sizeMB: 2700,
4294
+ sizeSource: "vendor",
4295
+ ctx: 4096,
4296
+ ladder: [{
4297
+ device: "webgpu",
4298
+ dtype: "q4f16_1",
4299
+ options: { modelId: "gemma-4-E2B-it-q4f16_1-MLC" }
4300
+ }, {
4301
+ device: "webgpu",
4302
+ dtype: "q4f32_1",
4303
+ options: { modelId: "gemma-4-E2B-it-q4f32_1-MLC" }
4304
+ }],
4305
+ quirks: { think: "none" },
4306
+ licence: "Apache-2.0 (the base model card)",
4307
+ commercial: true,
4308
+ runtime: "@mlc-ai/web-llm@0.2.86",
4309
+ notes: ["web-llm 0.2.86 or later lists it (vendor)"]
4310
+ },
4311
+ {
4312
+ id: "gemma-4-e2b-it-gguf",
4313
+ label: "Gemma 4 E2B",
4314
+ params: "E2B",
4315
+ quant: "Q4_0",
4316
+ censorship: "stock",
4317
+ tier: "medium",
4318
+ family: "gemma",
4319
+ tags: [],
4320
+ note: "google's gemma 4 e2b from ggml-org, the llama.cpp project's own build.",
4321
+ group: "good",
4322
+ badge: "newest gemma, gguf",
4323
+ speed: "steady",
4324
+ verdict: "newest gemma, gguf",
4325
+ provides: ["chat"],
4326
+ provider: "wllama",
4327
+ source: {
4328
+ repo: "ggml-org/gemma-4-E2B-it-GGUF",
4329
+ file: "gemma-4-E2B-it-Q4_0.gguf"
4330
+ },
4331
+ sizeMB: 2710,
4332
+ sizeSource: "vendor",
4333
+ ladder: [{
4334
+ device: "webgpu",
4335
+ dtype: "q4_0"
4336
+ }, {
4337
+ device: "wasm",
4338
+ dtype: "q4_0"
4339
+ }],
4340
+ quirks: { think: "none" },
4341
+ licence: "Apache-2.0 (the base model card)",
4342
+ commercial: true,
4343
+ runtime: "@wllama/wllama@3.8.1"
4344
+ },
4345
+ {
4346
+ id: "qwen3.5-0.8b-mlc",
4347
+ label: "Qwen3.5 0.8B",
4348
+ params: "0.8B",
4349
+ quant: "q4f32_1",
4350
+ vramMB: 1894,
4351
+ vramSource: "vendor",
4352
+ censorship: "stock",
4353
+ tier: "small",
4354
+ family: "qwen3.5",
4355
+ tags: ["low vram"],
4356
+ note: "the smallest qwen3.5. text in this runtime; images run through the vision records.",
4357
+ group: "tiny",
4358
+ badge: "newest qwen, small",
4359
+ speed: "fast",
4360
+ verdict: "newest qwen, small",
4361
+ provides: ["chat"],
4362
+ provider: "webllm",
4363
+ source: { modelId: "Qwen3.5-0.8B-q4f32_1-MLC" },
4364
+ sizeMB: 427,
4365
+ sizeSource: "vendor",
4366
+ ctx: 4096,
4367
+ ladder: [{
4368
+ device: "webgpu",
4369
+ dtype: "q4f32_1",
4370
+ options: { modelId: "Qwen3.5-0.8B-q4f32_1-MLC" }
4371
+ }, {
4372
+ device: "webgpu",
4373
+ dtype: "q4f16_1",
4374
+ options: { modelId: "Qwen3.5-0.8B-q4f16_1-MLC" }
4375
+ }],
4376
+ quirks: { toolCallTags: true },
4377
+ licence: "Apache-2.0 (the base model card)",
4378
+ commercial: true,
4379
+ runtime: "@mlc-ai/web-llm@0.2.84",
4380
+ notes: ["weak at this size: the 2b answers well (measured 2026-12-02)"]
4381
+ },
4382
+ {
4383
+ id: "qwen3.5-2b-mlc",
4384
+ label: "Qwen3.5 2B",
4385
+ params: "2B",
4386
+ quant: "q4f16_1",
4387
+ vramMB: 2245,
4388
+ vramSource: "vendor",
4389
+ censorship: "stock",
4390
+ tier: "small",
4391
+ family: "qwen3.5",
4392
+ tags: [],
4393
+ note: "qwen3.5 2b. text in this runtime; images run through the vision records.",
4394
+ group: "good",
4395
+ badge: "newest qwen",
4396
+ speed: "fast",
4397
+ verdict: "newest qwen, balanced",
4398
+ provides: ["chat"],
4399
+ provider: "webllm",
4400
+ source: { modelId: "Qwen3.5-2B-q4f16_1-MLC" },
4401
+ sizeMB: 1032,
4402
+ sizeSource: "vendor",
4403
+ ctx: 4096,
4404
+ ladder: [{
4405
+ device: "webgpu",
4406
+ dtype: "q4f16_1",
4407
+ options: { modelId: "Qwen3.5-2B-q4f16_1-MLC" }
4408
+ }, {
4409
+ device: "webgpu",
4410
+ dtype: "q4f32_1",
4411
+ options: { modelId: "Qwen3.5-2B-q4f32_1-MLC" }
4412
+ }],
4413
+ quirks: { toolCallTags: true },
4414
+ licence: "Apache-2.0 (the base model card)",
4415
+ commercial: true,
4416
+ runtime: "@mlc-ai/web-llm@0.2.84"
4417
+ },
4418
+ {
4419
+ id: "qwen3.5-0.8b-gguf",
4420
+ label: "Qwen3.5 0.8B",
4421
+ params: "0.8B",
4422
+ quant: "Q4_0",
4423
+ censorship: "stock",
4424
+ tier: "small",
4425
+ family: "qwen3.5",
4426
+ tags: ["no gpu"],
4427
+ note: "the smallest qwen3.5 from ggml-org. runs on the cpu too.",
4428
+ group: "tiny",
4429
+ badge: "newest qwen, cpu",
4430
+ speed: "fast",
4431
+ verdict: "newest qwen, cpu",
4432
+ provides: ["chat"],
4433
+ provider: "wllama",
4434
+ source: {
4435
+ repo: "ggml-org/Qwen3.5-0.8B-GGUF",
4436
+ file: "Qwen3.5-0.8B-Q4_0.gguf"
4437
+ },
4438
+ sizeMB: 537,
4439
+ sizeSource: "vendor",
4440
+ ladder: [{
4441
+ device: "webgpu",
4442
+ dtype: "q4_0"
4443
+ }, {
4444
+ device: "wasm",
4445
+ dtype: "q4_0"
4446
+ }],
4447
+ quirks: { toolCallTags: true },
4448
+ licence: "Apache-2.0 (the base model card)",
4449
+ commercial: true,
4450
+ runtime: "@wllama/wllama@3.8.1"
4451
+ },
3998
4452
  {
3999
4453
  id: "qwen3.5-0.8b-abliterated-gguf",
4000
4454
  label: "Qwen3.5 0.8B abliterated",
@@ -8176,6 +8630,67 @@ var init_records$3 = __esmMin((() => {
8176
8630
  ids2: "int64"
8177
8631
  }
8178
8632
  }
8633
+ }, {
8634
+ id: "janus-pro-1b",
8635
+ label: "janus-pro 1b 384",
8636
+ speed: "slow",
8637
+ verdict: "draws and sees",
8638
+ group: "good",
8639
+ provides: ["imagegen"],
8640
+ provider: "tjs",
8641
+ source: { modelId: "onnx-community/Janus-Pro-1B-ONNX" },
8642
+ sizeMB: 2304,
8643
+ sizeSource: "vendor",
8644
+ ladder: [{
8645
+ device: "webgpu",
8646
+ dtype: {
8647
+ prepare_inputs_embeds: "q4",
8648
+ language_model: "q4f16",
8649
+ lm_head: "fp16",
8650
+ gen_head: "fp16",
8651
+ gen_img_embeds: "fp16",
8652
+ image_decode: "fp32"
8653
+ },
8654
+ options: {
8655
+ loader: "imagegen.janus",
8656
+ device: {
8657
+ prepare_inputs_embeds: "wasm",
8658
+ language_model: "webgpu",
8659
+ lm_head: "webgpu",
8660
+ gen_head: "webgpu",
8661
+ gen_img_embeds: "webgpu",
8662
+ image_decode: "webgpu"
8663
+ }
8664
+ }
8665
+ }],
8666
+ licence: "DeepSeek Model License (weights; use restrictions apply), MIT (code)",
8667
+ commercial: true,
8668
+ place: "gpu",
8669
+ runtime: "@huggingface/transformers@4.3.2",
8670
+ notes: [
8671
+ "deepseek's janus-pro: one model that reads images and draws them, 576 image tokens per picture",
8672
+ "janus-pro 7b draws only through deepseek's python code; no browser or openai style build draws (vendor)",
8673
+ "needs shader-f16 on webgpu; transformers.js samples, so a seed does not repeat a picture"
8674
+ ],
8675
+ form: {
8676
+ steps: {
8677
+ min: 1,
8678
+ max: 1,
8679
+ default: 1
8680
+ },
8681
+ guidance: null,
8682
+ negative: false,
8683
+ sizes: [384],
8684
+ spacing: "trailing",
8685
+ note: "janus-pro 1b, deepseek. draws 384 pixel pictures token by token.",
8686
+ tokenizer: "onnx-community/Janus-Pro-1B-ONNX",
8687
+ graphs: {
8688
+ textEncoder: "",
8689
+ unet: "",
8690
+ vaeDecoder: ""
8691
+ },
8692
+ pipeline: "janus"
8693
+ }
8179
8694
  }];
8180
8695
  }));
8181
8696
  // packages/imagegen/src/xl.ts
@@ -8341,10 +8856,77 @@ var init_xl = __esmMin((() => {
8341
8856
  };
8342
8857
  EOT = 49407;
8343
8858
  }));
8859
+ // packages/imagegen/src/janus.ts
8860
+ /** RGB or RGBA pixels from transformers.js as RGBA. */
8861
+ function rgbaOf(img) {
8862
+ const n = img.width * img.height;
8863
+ if (img.channels === 4) return new Uint8ClampedArray(img.data);
8864
+ const out = new Uint8ClampedArray(n * 4);
8865
+ for (let i = 0; i < n; i++) {
8866
+ out[i * 4] = img.data[i * img.channels];
8867
+ out[i * 4 + 1] = img.data[i * img.channels + (img.channels > 1 ? 1 : 0)];
8868
+ out[i * 4 + 2] = img.data[i * img.channels + (img.channels > 2 ? 2 : 0)];
8869
+ out[i * 4 + 3] = 255;
8870
+ }
8871
+ return out;
8872
+ }
8873
+ /** The transformers.js loader for Janus image records, registered by `attachImagegen(hub, tjs)` as "imagegen.janus". */
8874
+ async function janusImageLoader(ctx) {
8875
+ const id = ctx.record.source.modelId;
8876
+ const P = ctx.tjs.AutoProcessor;
8877
+ const M = ctx.tjs.MultiModalityCausalLM;
8878
+ if (!P || !M) throw new Error("janus needs transformers.js 3.1.0 or later (MultiModalityCausalLM)");
8879
+ const processor = await P.from_pretrained(id);
8880
+ const model = await M.from_pretrained(id, ctx.options);
8881
+ return {
8882
+ async draw(prompt, o = {}) {
8883
+ const t0 = performance.now();
8884
+ const inputs = await processor([{
8885
+ role: "<|User|>",
8886
+ content: prompt
8887
+ }], { chat_template: "text_to_image" });
8888
+ const total = processor.num_image_tokens;
8889
+ o.signal?.throwIfAborted();
8890
+ let done = -1;
8891
+ const streamer = {
8892
+ put: () => {
8893
+ o.signal?.throwIfAborted();
8894
+ if (++done > 0) o.onToken?.(done, total);
8895
+ },
8896
+ end: () => {}
8897
+ };
8898
+ const t1 = performance.now();
8899
+ const [img] = await model.generate_images({
8900
+ ...inputs,
8901
+ min_new_tokens: total,
8902
+ max_new_tokens: total,
8903
+ do_sample: true,
8904
+ streamer
8905
+ });
8906
+ if (!img) throw new Error("janus returned no image");
8907
+ const t2 = performance.now();
8908
+ return {
8909
+ width: img.width,
8910
+ height: img.height,
8911
+ rgba: rgbaOf(img),
8912
+ seed: 0,
8913
+ seeded: false,
8914
+ ms: {
8915
+ text: t1 - t0,
8916
+ unet: t2 - t1,
8917
+ vae: 0
8918
+ }
8919
+ };
8920
+ },
8921
+ dispose: () => model.dispose?.()
8922
+ };
8923
+ }
8924
+ var init_janus$1 = __esmMin((() => {}));
8344
8925
  // packages/imagegen/src/hub.ts
8345
8926
  /** Add the image records to the hub's registry. */
8346
- function attachImagegen(hub) {
8927
+ function attachImagegen(hub, tjs) {
8347
8928
  hub.registry.add(...IMAGEGEN_RECORDS);
8929
+ tjs?.loader("imagegen.janus", janusImageLoader);
8348
8930
  }
8349
8931
  /** The sessions of a loaded model, by the form's graph names: three, or four with SDXL's second text encoder. */
8350
8932
  function sessionsOf(m, form) {
@@ -8392,6 +8974,7 @@ async function loadImagegen(hub, what = "imagegen", o = {}) {
8392
8974
  }
8393
8975
  const loaded = await hub.use(what, o);
8394
8976
  const form = formOf(loaded.record) ?? IMAGEGEN_RECORDS[0].form;
8977
+ if (form.pipeline === "janus") return janusGenerator(hub, loaded, form);
8395
8978
  let sessions;
8396
8979
  try {
8397
8980
  sessions = sessionsOf(loaded.value, form);
@@ -8461,11 +9044,40 @@ function stubImagegenModel() {
8461
9044
  }
8462
9045
  };
8463
9046
  }
9047
+ /** The generator for a Janus record: no onnx sessions or tokenizer of its own; the prompt goes to the model's own processor. */
9048
+ function janusGenerator(hub, loaded, form) {
9049
+ return {
9050
+ loaded,
9051
+ record: loaded.record,
9052
+ form,
9053
+ sessions: {},
9054
+ async generate(_tokenize, req) {
9055
+ const { runOptions, signal, prompt, onStep } = req;
9056
+ const t0 = performance.now();
9057
+ return hub.run(loaded, () => loaded.value.draw(prompt, {
9058
+ ...signal ? { signal } : {},
9059
+ ...onStep ? { onToken: (step, steps) => onStep({
9060
+ stage: "denoise",
9061
+ step,
9062
+ steps,
9063
+ ms: performance.now() - t0
9064
+ }) } : {}
9065
+ }), {
9066
+ ...runOptions ?? {},
9067
+ ...signal ? { signal } : {}
9068
+ });
9069
+ },
9070
+ release() {
9071
+ hub.release(loaded);
9072
+ }
9073
+ };
9074
+ }
8464
9075
  var FormError;
8465
9076
  var init_hub = __esmMin((() => {
8466
9077
  init_pipeline();
8467
9078
  init_records$3();
8468
9079
  init_xl();
9080
+ init_janus$1();
8469
9081
  FormError = class extends Error {
8470
9082
  name = "FormError";
8471
9083
  };
@@ -8487,12 +9099,14 @@ var src_exports$5 = /* @__PURE__ */ __exportAll({
8487
9099
  gaussian: () => gaussian,
8488
9100
  generate: () => generate,
8489
9101
  generateXl: () => generateXl,
9102
+ janusImageLoader: () => janusImageLoader,
8490
9103
  leadingTimesteps: () => leadingTimesteps,
8491
9104
  loadImagegen: () => loadImagegen,
8492
9105
  loadLabel: () => loadLabel,
8493
9106
  mulberry32: () => mulberry32,
8494
9107
  padIds: () => padIds,
8495
9108
  padIds2: () => padIds2,
9109
+ rgbaOf: () => rgbaOf,
8496
9110
  sessionsOf: () => sessionsOf,
8497
9111
  sigmas: () => sigmas,
8498
9112
  stubImagegenModel: () => stubImagegenModel,
@@ -8506,6 +9120,7 @@ var init_src$6 = __esmMin((() => {
8506
9120
  init_records$3();
8507
9121
  init_hub();
8508
9122
  init_xl();
9123
+ init_janus$1();
8509
9124
  }));
8510
9125
  // packages/speak/src/text.ts
8511
9126
  /**
@@ -12560,7 +13175,7 @@ function yoloRecord(o) {
12560
13175
  notes: ["640 letterbox, per class nms at iou 0.45, at most 13 boxes"]
12561
13176
  };
12562
13177
  }
12563
- var MP_MODELS, mediapipeLadder, mp, VISION_RECORDS, yolo10, PICKER_RECORDS;
13178
+ var MP_MODELS, mediapipeLadder, mp, VISION_RECORDS, yolo10, PICKER_RECORDS, ENDPOINT_RECORDS;
12564
13179
  var init_records = __esmMin((() => {
12565
13180
  init_src$9();
12566
13181
  MP_MODELS = "https://storage.googleapis.com/mediapipe-models/";
@@ -12808,6 +13423,94 @@ var init_records = __esmMin((() => {
12808
13423
  runtime: "@huggingface/transformers@4.3.2",
12809
13424
  notes: ["about 3.3 GB (vendor)"]
12810
13425
  },
13426
+ {
13427
+ id: "qwen3.5-0.8b-vision",
13428
+ label: "qwen3.5 0.8b",
13429
+ speed: "fast",
13430
+ verdict: "small, reads text",
13431
+ group: "good",
13432
+ provides: ["vision.caption", "vision.ask"],
13433
+ provider: "tjs",
13434
+ source: { modelId: "onnx-community/Qwen3.5-0.8B-ONNX-OPT" },
13435
+ sizeMB: 615,
13436
+ sizeSource: "vendor",
13437
+ ladder: LADDERS.vlmGpuOnly(),
13438
+ quirks: {
13439
+ maxTokensAction: 96,
13440
+ maxImageSide: 768
13441
+ },
13442
+ licence: "Apache-2.0 (the model card's licence field)",
13443
+ commercial: true,
13444
+ place: "gpu",
13445
+ runtime: "@huggingface/transformers@4.3.2",
13446
+ notes: ["qwen3.5 takes images in every size; there is no separate qwen3.5-vl (vendor)", "transformers.js 4.0.0 or later (Qwen3_5ForConditionalGeneration)"]
13447
+ },
13448
+ {
13449
+ id: "qwen3.5-2b-vision",
13450
+ label: "qwen3.5 2b",
13451
+ speed: "steady",
13452
+ verdict: "sharper answers, heavier",
13453
+ group: "good",
13454
+ provides: ["vision.caption", "vision.ask"],
13455
+ provider: "tjs",
13456
+ source: { modelId: "onnx-community/Qwen3.5-2B-ONNX" },
13457
+ sizeMB: 1508,
13458
+ sizeSource: "vendor",
13459
+ ladder: LADDERS.vlmGpuOnly(),
13460
+ quirks: {
13461
+ maxTokensAction: 96,
13462
+ maxImageSide: 768
13463
+ },
13464
+ licence: "Apache-2.0 (the model card's licence field)",
13465
+ commercial: true,
13466
+ place: "gpu",
13467
+ runtime: "@huggingface/transformers@4.3.2",
13468
+ notes: ["transformers.js 4.0.0 or later (Qwen3_5ForConditionalGeneration)"]
13469
+ },
13470
+ {
13471
+ id: "janus-pro-1b-vision",
13472
+ label: "janus-pro 1b",
13473
+ speed: "slow",
13474
+ verdict: "sees and draws, heavy",
13475
+ group: "good",
13476
+ provides: ["vision.caption", "vision.ask"],
13477
+ provider: "tjs",
13478
+ source: { modelId: "onnx-community/Janus-Pro-1B-ONNX" },
13479
+ sizeMB: 2304,
13480
+ sizeSource: "vendor",
13481
+ ladder: [{
13482
+ device: "webgpu",
13483
+ dtype: {
13484
+ prepare_inputs_embeds: "q4",
13485
+ language_model: "q4f16",
13486
+ lm_head: "fp16",
13487
+ gen_head: "fp16",
13488
+ gen_img_embeds: "fp16",
13489
+ image_decode: "fp32"
13490
+ },
13491
+ options: {
13492
+ loader: "vision.janus",
13493
+ device: {
13494
+ prepare_inputs_embeds: "wasm",
13495
+ language_model: "webgpu",
13496
+ lm_head: "webgpu",
13497
+ gen_head: "webgpu",
13498
+ gen_img_embeds: "webgpu",
13499
+ image_decode: "webgpu"
13500
+ }
13501
+ }
13502
+ }],
13503
+ quirks: { maxTokensAction: 96 },
13504
+ licence: "DeepSeek Model License (weights; use restrictions apply), MIT (code)",
13505
+ commercial: true,
13506
+ place: "gpu",
13507
+ runtime: "@huggingface/transformers@4.3.2",
13508
+ notes: [
13509
+ "needs shader-f16 on webgpu",
13510
+ "janus-pro 7b is over 4 GB at q4: run it on your endpoint (janus-pro-7b-endpoint)",
13511
+ "the same weights draw pictures through @hackbuild/imagegen"
13512
+ ]
13513
+ },
12811
13514
  yolo10("n", 9, "instant", "nano, quick"),
12812
13515
  yolo10("s", 28, "fast", "small, sharper"),
12813
13516
  yolo10("m", 59, "steady", "medium, best boxes"),
@@ -12911,6 +13614,56 @@ var init_records = __esmMin((() => {
12911
13614
  notes: ["128 px faces; paste the result back with a feathered mask"]
12912
13615
  }
12913
13616
  ];
13617
+ ENDPOINT_RECORDS = [
13618
+ {
13619
+ id: "janus-pro-7b-endpoint",
13620
+ label: "janus-pro 7b, your endpoint",
13621
+ speed: "steady",
13622
+ verdict: "larger janus, sees only",
13623
+ group: "endpoint",
13624
+ provides: ["vision.caption", "vision.ask"],
13625
+ provider: "remote",
13626
+ source: { modelId: "janus-pro-7b" },
13627
+ sizeMB: 0,
13628
+ sizeSource: "vendor",
13629
+ ladder: [{ device: "remote" }],
13630
+ licence: "DeepSeek Model License (weights; use restrictions apply), MIT (code)",
13631
+ commercial: true,
13632
+ notes: ["llama-server -m Janus-Pro-7B.Q4_K_M.gguf --mmproj Janus-Pro-7B.mmproj-Q8_0.gguf (mradermacher/Janus-Pro-7B-GGUF, 4.22 GB plus 0.35 GB, vendor)", "image understanding only: llama.cpp drops the image generation weights; ollama has no official tag"]
13633
+ },
13634
+ {
13635
+ id: "gemma-4-e4b-endpoint",
13636
+ label: "gemma 4 e4b, your endpoint",
13637
+ speed: "steady",
13638
+ verdict: "on your machine",
13639
+ group: "endpoint",
13640
+ provides: ["vision.caption", "vision.ask"],
13641
+ provider: "remote",
13642
+ source: { modelId: "gemma4:e4b" },
13643
+ sizeMB: 0,
13644
+ sizeSource: "vendor",
13645
+ ladder: [{ device: "remote" }],
13646
+ licence: "Apache-2.0 (the model card's licence field)",
13647
+ commercial: true,
13648
+ notes: ["ollama pull gemma4:e4b; gemma4:12b, 26b and 31b take images too"]
13649
+ },
13650
+ {
13651
+ id: "qwen3.5-9b-endpoint",
13652
+ label: "qwen3.5 9b, your endpoint",
13653
+ speed: "steady",
13654
+ verdict: "on your machine",
13655
+ group: "endpoint",
13656
+ provides: ["vision.caption", "vision.ask"],
13657
+ provider: "remote",
13658
+ source: { modelId: "qwen3.5:9b" },
13659
+ sizeMB: 0,
13660
+ sizeSource: "vendor",
13661
+ ladder: [{ device: "remote" }],
13662
+ licence: "Apache-2.0 (the model card's licence field)",
13663
+ commercial: true,
13664
+ notes: ["ollama pull qwen3.5:9b; every qwen3.5 size takes images"]
13665
+ }
13666
+ ];
12914
13667
  }));
12915
13668
  // packages/vision/src/segment.ts
12916
13669
  /** True when the prompt has a point or a box. */
@@ -12984,10 +13737,18 @@ var init_segment = __esmMin((() => {
12984
13737
  };
12985
13738
  }));
12986
13739
  // packages/vision/src/loaders.ts
13740
+ /** @internal an image input as a transformers.js RawImage. */
12987
13741
  async function toRaw(tjs, img) {
12988
13742
  const R = tjs.RawImage;
12989
13743
  return R?.read ? R.read(img) : img;
12990
13744
  }
13745
+ /** @internal a RawImage resized down so its longest side is at most `side`; smaller images and no cap pass through. */
13746
+ async function capped(img, side) {
13747
+ const r = img;
13748
+ if (!side || !r.width || !r.height || !r.resize) return img;
13749
+ const k = side / Math.max(r.width, r.height);
13750
+ return k >= 1 ? img : r.resize(Math.round(r.width * k), Math.round(r.height * k));
13751
+ }
12991
13752
  /** Normalize a depth pipeline result. predicted_depth keeps the raw range; depth is the 8 bit image. */
12992
13753
  function depthFromOutput(out) {
12993
13754
  const pd = out.predicted_depth;
@@ -13048,7 +13809,7 @@ async function vlmLoader(ctx) {
13048
13809
  text: question ?? "Describe this image in one sentence."
13049
13810
  }]
13050
13811
  }], { add_generation_prompt: true });
13051
- const raw = [await toRaw(ctx.tjs, image)];
13812
+ const raw = [await capped(await toRaw(ctx.tjs, image), ctx.record.quirks?.maxImageSide)];
13052
13813
  const inputs = await (imagesFirst ? processor(raw, text) : processor(text, raw));
13053
13814
  const ids = await model.generate({
13054
13815
  ...inputs,
@@ -13126,6 +13887,39 @@ var init_loaders = __esmMin((() => {
13126
13887
  throw new Error(`the transformers.js module has none of ${names.join(", ")}`);
13127
13888
  };
13128
13889
  }));
13890
+ // packages/vision/src/janus.ts
13891
+ /** One user turn with an image, in the Janus chat format. */
13892
+ function janusTurn(question, image) {
13893
+ return {
13894
+ role: "<|User|>",
13895
+ content: `<image_placeholder>\n${question}`,
13896
+ images: [image]
13897
+ };
13898
+ }
13899
+ /** The transformers.js loader for Janus records: its processor and `MultiModalityCausalLM` wrapped as a {@link Vlm}. */
13900
+ async function janusLoader(ctx) {
13901
+ const id = ctx.record.source.modelId;
13902
+ const processor = await cls(ctx.tjs, "AutoProcessor").from_pretrained(id);
13903
+ const model = await cls(ctx.tjs, "MultiModalityCausalLM").from_pretrained(id, ctx.options);
13904
+ const cap = ctx.record.quirks?.maxTokensAction ?? 96;
13905
+ return {
13906
+ async ask(image, question, o = {}) {
13907
+ const inputs = await processor([janusTurn(question ?? "Describe this image in one sentence.", await toRaw(ctx.tjs, image))]);
13908
+ const ids = await model.generate({
13909
+ ...inputs,
13910
+ max_new_tokens: o.maxTokens ?? cap,
13911
+ do_sample: false
13912
+ });
13913
+ const start = inputs.input_ids.dims[inputs.input_ids.dims.length - 1];
13914
+ const gen = ids.slice ? ids.slice(null, [start, null]) : ids;
13915
+ return (processor.batch_decode(gen, { skip_special_tokens: true })[0] ?? "").trim();
13916
+ },
13917
+ dispose: () => model.dispose?.()
13918
+ };
13919
+ }
13920
+ var init_janus = __esmMin((() => {
13921
+ init_loaders();
13922
+ }));
13129
13923
  // packages/vision/src/yolo.ts
13130
13924
  /** The scale and padding that fit a `w` by `h` image into a `size` square (640 by default), centred. */
13131
13925
  function letterboxParams(w, h, size = 640) {
@@ -13459,6 +14253,7 @@ function attachVision(hub, tjs) {
13459
14253
  tjs.loader("vision.caption", vlmLoader);
13460
14254
  tjs.loader("vision.ask", vlmLoader);
13461
14255
  tjs.loader("segment", samLoader);
14256
+ tjs.loader("vision.janus", janusLoader);
13462
14257
  }
13463
14258
  }
13464
14259
  async function withModel(hub, what, fn, o = {}) {
@@ -13495,8 +14290,8 @@ function detect(hub, image, o = {}) {
13495
14290
  function ensureRecord(hub, id) {
13496
14291
  const have = hub.registry.get(id);
13497
14292
  if (have) return have;
13498
- const rec = PICKER_RECORDS.find((r) => r.id === id);
13499
- if (!rec) throw new Error(`${id} is neither registered nor a picker record`);
14293
+ const rec = PICKER_RECORDS.find((r) => r.id === id) ?? ENDPOINT_RECORDS.find((r) => r.id === id);
14294
+ if (!rec) throw new Error(`${id} is neither registered nor a picker or endpoint record`);
13500
14295
  hub.registry.add(rec);
13501
14296
  return rec;
13502
14297
  }
@@ -13584,14 +14379,21 @@ async function landmarks(hub, kind, image, o = {}) {
13584
14379
  }
13585
14380
  /** Caption an image. VLM calls are serialized on one chain. */
13586
14381
  function caption(hub, image, o = {}) {
13587
- return hub.chain("vlm")(() => withModel(hub, target("vision.caption", o), (m) => m.ask(image, void 0, o.maxTokens ? { maxTokens: o.maxTokens } : {}), o));
14382
+ return hub.chain("vlm")(() => withModel(hub, target("vision.caption", o), (m) => m.ask(image, void 0, {
14383
+ ...o.maxTokens ? { maxTokens: o.maxTokens } : {},
14384
+ ...o.signal ? { signal: o.signal } : {}
14385
+ }), o));
13588
14386
  }
13589
14387
  /** Answer a question about an image with the routed vision language model. VLM calls are serialized on one chain. */
13590
14388
  function ask(hub, image, question, o = {}) {
13591
- return hub.chain("vlm")(() => withModel(hub, target("vision.ask", o), (m) => m.ask(image, question, o.maxTokens ? { maxTokens: o.maxTokens } : {}), o));
14389
+ return hub.chain("vlm")(() => withModel(hub, target("vision.ask", o), (m) => m.ask(image, question, {
14390
+ ...o.maxTokens ? { maxTokens: o.maxTokens } : {},
14391
+ ...o.signal ? { signal: o.signal } : {}
14392
+ }), o));
13592
14393
  }
13593
14394
  var target;
13594
14395
  var init_api = __esmMin((() => {
14396
+ init_janus();
13595
14397
  init_loaders();
13596
14398
  init_fastsam();
13597
14399
  init_records();
@@ -13599,6 +14401,98 @@ var init_api = __esmMin((() => {
13599
14401
  init_yolo();
13600
14402
  target = (cap, o) => o.model ? { id: o.model } : cap;
13601
14403
  }));
14404
+ // packages/vision/src/endpoint.ts
14405
+ function base64(bytes) {
14406
+ let s = "";
14407
+ for (let i = 0; i < bytes.length; i += 32768) s += String.fromCharCode(...bytes.subarray(i, i + 32768));
14408
+ return btoa(s);
14409
+ }
14410
+ /**
14411
+ * An image input as a URL an endpoint can read: a string passes through
14412
+ * (data or http URL), a Blob becomes a data URL, and pixels, canvases,
14413
+ * video frames and bitmaps are drawn and encoded as JPEG.
14414
+ */
14415
+ async function imageUrl(image) {
14416
+ if (typeof image === "string") return image;
14417
+ if (typeof Blob !== "undefined" && image instanceof Blob) return `data:${image.type || "image/png"};base64,${base64(new Uint8Array(await image.arrayBuffer()))}`;
14418
+ const src = image;
14419
+ const w = src.videoWidth || src.displayWidth || src.width || 0;
14420
+ const h = src.videoHeight || src.displayHeight || src.height || 0;
14421
+ if (!w || !h || typeof OffscreenCanvas === "undefined") throw new Error("vision endpoint: pass a url, a blob, pixels or something a canvas can draw");
14422
+ const c = new OffscreenCanvas(w, h);
14423
+ const g = c.getContext("2d");
14424
+ if (isPixels(image)) g.putImageData(new ImageData(new Uint8ClampedArray(image.data), w, h), 0, 0);
14425
+ else g.drawImage(image, 0, 0, w, h);
14426
+ return imageUrl(await c.convertToBlob({
14427
+ type: "image/jpeg",
14428
+ quality: .85
14429
+ }));
14430
+ }
14431
+ /** The chat completions body for one image and one question. */
14432
+ function endpointBody(model, url, question, maxTokens) {
14433
+ return {
14434
+ model,
14435
+ stream: false,
14436
+ max_tokens: maxTokens,
14437
+ messages: [{
14438
+ role: "user",
14439
+ content: [{
14440
+ type: "text",
14441
+ text: question
14442
+ }, {
14443
+ type: "image_url",
14444
+ image_url: { url }
14445
+ }]
14446
+ }]
14447
+ };
14448
+ }
14449
+ /** A {@link Vlm} that asks the endpoint's model about each image. */
14450
+ function endpointVlm(o) {
14451
+ const f = o.fetch ?? globalThis.fetch.bind(globalThis);
14452
+ const url = o.base.replace(/\/+$/, "") + "/chat/completions";
14453
+ return { async ask(image, question, opts = {}) {
14454
+ const body = endpointBody(o.model, await (o.toUrl ?? imageUrl)(image), question ?? "Describe this image in one sentence.", opts.maxTokens ?? o.maxTokens ?? 128);
14455
+ const headers = {
14456
+ "content-type": "application/json",
14457
+ ...o.headers
14458
+ };
14459
+ if (o.apiKey) headers.authorization = `Bearer ${o.apiKey}`;
14460
+ const res = await f(url, {
14461
+ method: "POST",
14462
+ headers,
14463
+ body: JSON.stringify(body),
14464
+ ...opts.signal ? { signal: opts.signal } : {}
14465
+ });
14466
+ if (!res.ok) {
14467
+ const text = (await res.text()).slice(0, 200);
14468
+ throw new Error(`vision endpoint ${res.status}: ${o.apiKey ? text.split(o.apiKey).join("[key]") : text}`);
14469
+ }
14470
+ const c = (await res.json()).choices?.[0]?.message?.content;
14471
+ return (typeof c === "string" ? c : Array.isArray(c) ? c.map((p) => p.text ?? "").join("") : "").trim();
14472
+ } };
14473
+ }
14474
+ /**
14475
+ * The hub factory for remote vision records (`provider: "remote"`): each
14476
+ * record's `source.modelId` names the endpoint's model. A hub has one
14477
+ * factory per provider, so a hub that also runs remote chat passes that
14478
+ * factory as `others`, and records that are not vision go to it. Register
14479
+ * with `hub.provide("remote", endpointVisionProvider({ base, others }))`.
14480
+ */
14481
+ function endpointVisionProvider(o) {
14482
+ const { others, ...vlm } = o;
14483
+ return async (ctx) => {
14484
+ if (ctx.record.provides.some((c) => c === "vision.ask" || c === "vision.caption")) return endpointVlm({
14485
+ ...vlm,
14486
+ model: ctx.record.source.modelId ?? ctx.record.id
14487
+ });
14488
+ if (others) return others(ctx);
14489
+ throw new Error(`${ctx.record.id}: the vision endpoint runs vision records; pass others for the rest`);
14490
+ };
14491
+ }
14492
+ var isPixels;
14493
+ var init_endpoint = __esmMin((() => {
14494
+ isPixels = (x) => !!x && typeof x === "object" && typeof x.width === "number" && typeof x.height === "number" && !!x.data;
14495
+ }));
13602
14496
  // packages/vision/src/mediapipe.ts
13603
14497
  /** The URL @mediapipe/tasks-vision is imported from, on jsDelivr. */
13604
14498
  function tasksVisionUrls(version = TASKS_VISION) {
@@ -15172,6 +16066,7 @@ var src_exports$1 = /* @__PURE__ */ __exportAll({
15172
16066
  DEFAULT_REACTIONS: () => DEFAULT_REACTIONS,
15173
16067
  DEPTH_WORKER_SOURCE: () => DEPTH_WORKER_SOURCE,
15174
16068
  DETECT_SIZES: () => DETECT_SIZES,
16069
+ ENDPOINT_RECORDS: () => ENDPOINT_RECORDS,
15175
16070
  EmbeddingCache: () => EmbeddingCache,
15176
16071
  LOOK_PATTERN: () => LOOK_PATTERN,
15177
16072
  MP_MODELS: () => MP_MODELS,
@@ -15207,6 +16102,9 @@ var src_exports$1 = /* @__PURE__ */ __exportAll({
15207
16102
  edgeMask: () => edgeMask,
15208
16103
  emptyMask: () => emptyMask,
15209
16104
  encodePng: () => encodePng,
16105
+ endpointBody: () => endpointBody,
16106
+ endpointVisionProvider: () => endpointVisionProvider,
16107
+ endpointVlm: () => endpointVlm,
15210
16108
  ensureRecord: () => ensureRecord,
15211
16109
  exportInstances: () => exportInstances,
15212
16110
  faceApiProvider: () => faceApiProvider,
@@ -15217,9 +16115,12 @@ var src_exports$1 = /* @__PURE__ */ __exportAll({
15217
16115
  fixedVlm: () => fixedVlm,
15218
16116
  gazeTarget: () => gazeTarget,
15219
16117
  hasPrompt: () => hasPrompt,
16118
+ imageUrl: () => imageUrl,
15220
16119
  instanceAt: () => instanceAt,
15221
16120
  iou: () => iou,
15222
16121
  isEnd2End: () => isEnd2End,
16122
+ janusLoader: () => janusLoader,
16123
+ janusTurn: () => janusTurn,
15223
16124
  landmarkChain: () => landmarkChain,
15224
16125
  landmarks: () => landmarks,
15225
16126
  letterboxParams: () => letterboxParams,
@@ -15273,6 +16174,8 @@ var init_src$2 = __esmMin((() => {
15273
16174
  init_records();
15274
16175
  init_api();
15275
16176
  init_loaders();
16177
+ init_janus();
16178
+ init_endpoint();
15276
16179
  init_mediapipe();
15277
16180
  init_faceapi();
15278
16181
  init_yolo();
@@ -18181,7 +19084,10 @@ function webllmDriver(o) {
18181
19084
  }
18182
19085
  };
18183
19086
  }
18184
- /** Create an MLCEngine with the context ladder, IndexedDB cache on, and wrap it. */
19087
+ /**
19088
+ * Create an MLCEngine with the context ladder and WebLLM's IndexedDB cache (`cacheBackend:
19089
+ * "indexeddb"`; WebLLM's default is the Cache API, where `webllmCache` would find nothing), and wrap it.
19090
+ */
18185
19091
  async function loadWebLLM(o) {
18186
19092
  const want = o.contextWindow ?? 4096;
18187
19093
  const ladder = [.../* @__PURE__ */ new Set([
@@ -18191,7 +19097,7 @@ async function loadWebLLM(o) {
18191
19097
  2048
18192
19098
  ])].filter((n) => n <= want);
18193
19099
  const appConfig = {
18194
- useIndexedDBCache: true,
19100
+ cacheBackend: "indexeddb",
18195
19101
  model_list: [...o.customModels ?? [], ...o.module.prebuiltAppConfig?.model_list ?? []]
18196
19102
  };
18197
19103
  const errors = [];
@@ -18212,7 +19118,7 @@ async function loadWebLLM(o) {
18212
19118
  throw new ChatError$1("load", `webllm could not load ${o.modelId}: ${errors.join("; ")}`);
18213
19119
  }
18214
19120
  /**
18215
- * Map WebLLM 0.2.84 progress text to a phase: "Fetching param cache" and
19121
+ * Map WebLLM progress text (0.2.84 to 0.2.89) to a phase: "Fetching param cache" and
18216
19122
  * "Loading model from cache" are fetch, "Loading GPU shader modules" is
18217
19123
  * compile, "Finish loading" is ready. Unknown text keeps the last phase a
18218
19124
  * caller saw; this returns fetch for it.
@@ -18253,8 +19159,8 @@ function openExisting(idb, name) {
18253
19159
  /**
18254
19160
  * List and evict the WebLLM cache per model, so the weights manager shows
18255
19161
  * it as a second group ("kept by webllm") beside the one weight store.
18256
- * Reads the IndexedDB layout WebLLM 0.2.84 writes with
18257
- * `useIndexedDBCache: true`; nothing is imported from WebLLM. Pass the
19162
+ * Reads the IndexedDB layout WebLLM 0.2.84 to 0.2.89 writes with
19163
+ * `cacheBackend: "indexeddb"` (as `loadWebLLM` sets it); nothing is imported from WebLLM. Pass the
18258
19164
  * same model_list the engine was built with (prebuilt plus custom).
18259
19165
  */
18260
19166
  function webllmCache(o) {
@@ -18518,7 +19424,7 @@ init_src$12();
18518
19424
  init_src$11();
18519
19425
  /** Pinned CDN modules jobLoader imports at load time. */
18520
19426
  const RUNTIME_URLS = {
18521
- webllm: ["https://esm.run/@mlc-ai/web-llm@0.2.84", "https://cdn.jsdelivr.net/npm/@mlc-ai/web-llm@0.2.84/+esm"],
19427
+ webllm: ["https://esm.run/@mlc-ai/web-llm@0.2.89", "https://cdn.jsdelivr.net/npm/@mlc-ai/web-llm@0.2.89/+esm"],
18522
19428
  bellows: ["https://cdn.jsdelivr.net/npm/bellows-voice@0.8.0/engine/+esm"],
18523
19429
  kokoro: ["https://cdn.jsdelivr.net/npm/kokoro-js@1.2.1/+esm"]
18524
19430
  };
@@ -18580,6 +19486,8 @@ async function makeRuntime(o) {
18580
19486
  tjs.loader("vision.caption", vision.vlmLoader);
18581
19487
  tjs.loader("vision.ask", vision.vlmLoader);
18582
19488
  tjs.loader("segment", vision.samLoader);
19489
+ tjs.loader("vision.janus", vision.janusLoader);
19490
+ tjs.loader("imagegen.janus", async (ctx) => (await Promise.resolve().then(() => (init_src$6(), src_exports$5))).janusImageLoader(ctx));
18583
19491
  tjs.loader("chat", async (ctx) => {
18584
19492
  const { createEngine } = await Promise.resolve().then(() => (init_src(), src_exports));
18585
19493
  const generator = await ctx.tjs.pipeline("text-generation", ctx.record.source.modelId ?? ctx.record.id, ctx.options);
@@ -18634,7 +19542,8 @@ async function makeRuntime(o) {
18634
19542
  async function webllmFactory(ctx, m) {
18635
19543
  const w = await Promise.resolve().then(() => (init_webllm(), webllm_exports));
18636
19544
  const mod = await (m.webllm ?? (() => importEsm(RUNTIME_URLS.webllm)))();
18637
- const id = ctx.record.source.modelId ?? ctx.record.id;
19545
+ const rungId = ctx.rung.options?.modelId;
19546
+ const id = typeof rungId === "string" ? rungId : ctx.record.source.modelId ?? ctx.record.id;
18638
19547
  return w.loadWebLLM({
18639
19548
  module: mod,
18640
19549
  modelId: id,
@@ -18863,7 +19772,7 @@ async function adapt(job, rec, value, rt, ctx) {
18863
19772
  }
18864
19773
  case "image": {
18865
19774
  const gen = await (await Promise.resolve().then(() => (init_src$6(), src_exports$5))).loadImagegen(hub, { id: rec.id }, { ...ctx.signal ? { signal: ctx.signal } : {} });
18866
- const tokenize = await clipTokenizer(rt, gen.form.tokenizer);
19775
+ const tokenize = gen.form.pipeline === "janus" ? async () => /* @__PURE__ */ new Int32Array(0) : await clipTokenizer(rt, gen.form.tokenizer);
18867
19776
  return Object.assign(gen, {
18868
19777
  tokenize,
18869
19778
  make: (o) => gen.generate(tokenize, o)