@happyvertical/smrt-inference 0.0.0-stage → 0.60.15

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.
Files changed (107) hide show
  1. package/AGENTS.md +201 -0
  2. package/CLAUDE.md +1 -0
  3. package/LICENSE +7 -0
  4. package/README.md +73 -2
  5. package/agents/fusions.md +92 -0
  6. package/agents/hosted.md +145 -0
  7. package/agents/resolver.md +65 -0
  8. package/agents/settings.md +84 -0
  9. package/dist/__smrt-register__.d.ts +2 -0
  10. package/dist/__smrt-register__.d.ts.map +1 -0
  11. package/dist/chunks/InferenceOverrideCollection-wl7sI-3C.js +398 -0
  12. package/dist/chunks/InferenceOverrideCollection-wl7sI-3C.js.map +1 -0
  13. package/dist/chunks/provider-config-4Bx8N52X.js +1847 -0
  14. package/dist/chunks/provider-config-4Bx8N52X.js.map +1 -0
  15. package/dist/classify.d.ts +32 -0
  16. package/dist/classify.d.ts.map +1 -0
  17. package/dist/config.d.ts +89 -0
  18. package/dist/config.d.ts.map +1 -0
  19. package/dist/errors.d.ts +51 -0
  20. package/dist/errors.d.ts.map +1 -0
  21. package/dist/executor.d.ts +45 -0
  22. package/dist/executor.d.ts.map +1 -0
  23. package/dist/fusion-store.d.ts +16 -0
  24. package/dist/fusion-store.d.ts.map +1 -0
  25. package/dist/fusion.d.ts +155 -0
  26. package/dist/fusion.d.ts.map +1 -0
  27. package/dist/gate.d.ts +143 -0
  28. package/dist/gate.d.ts.map +1 -0
  29. package/dist/gate.js +94 -0
  30. package/dist/gate.js.map +1 -0
  31. package/dist/hosted.d.ts +454 -0
  32. package/dist/hosted.d.ts.map +1 -0
  33. package/dist/index.d.ts +9 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +8 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/manifest.json +453 -0
  38. package/dist/models/InferenceOverride.d.ts +38 -0
  39. package/dist/models/InferenceOverride.d.ts.map +1 -0
  40. package/dist/models/InferenceOverrideCollection.d.ts +35 -0
  41. package/dist/models/InferenceOverrideCollection.d.ts.map +1 -0
  42. package/dist/models.d.ts +11 -0
  43. package/dist/models.d.ts.map +1 -0
  44. package/dist/models.js +2 -0
  45. package/dist/node.d.ts +110 -0
  46. package/dist/node.d.ts.map +1 -0
  47. package/dist/node.js +1361 -0
  48. package/dist/node.js.map +1 -0
  49. package/dist/provider-config.d.ts +113 -0
  50. package/dist/provider-config.d.ts.map +1 -0
  51. package/dist/register.d.ts +30 -0
  52. package/dist/register.d.ts.map +1 -0
  53. package/dist/resolver.d.ts +166 -0
  54. package/dist/resolver.d.ts.map +1 -0
  55. package/dist/resolver.js +288 -0
  56. package/dist/resolver.js.map +1 -0
  57. package/dist/server.d.ts +24 -0
  58. package/dist/server.d.ts.map +1 -0
  59. package/dist/server.js +985 -0
  60. package/dist/server.js.map +1 -0
  61. package/dist/settings/cache.d.ts +5 -0
  62. package/dist/settings/cache.d.ts.map +1 -0
  63. package/dist/settings/keys.d.ts +70 -0
  64. package/dist/settings/keys.d.ts.map +1 -0
  65. package/dist/settings/layers.d.ts +54 -0
  66. package/dist/settings/layers.d.ts.map +1 -0
  67. package/dist/settings/override-service.d.ts +119 -0
  68. package/dist/settings/override-service.d.ts.map +1 -0
  69. package/dist/settings/preferences.d.ts +137 -0
  70. package/dist/settings/preferences.d.ts.map +1 -0
  71. package/dist/settings/resolver.d.ts +34 -0
  72. package/dist/settings/resolver.d.ts.map +1 -0
  73. package/dist/settings/settings-service.d.ts +282 -0
  74. package/dist/settings/settings-service.d.ts.map +1 -0
  75. package/dist/settings/targets.d.ts +93 -0
  76. package/dist/settings/targets.d.ts.map +1 -0
  77. package/dist/smrt-knowledge.json +335 -0
  78. package/dist/smrt-knowledge.okf.md +80 -0
  79. package/dist/svelte/components/InferenceAliasEditor.svelte +210 -0
  80. package/dist/svelte/components/InferenceAliasEditor.svelte.d.ts +13 -0
  81. package/dist/svelte/components/InferenceAliasEditor.svelte.d.ts.map +1 -0
  82. package/dist/svelte/components/InferenceDefaultView.svelte +330 -0
  83. package/dist/svelte/components/InferenceDefaultView.svelte.d.ts +15 -0
  84. package/dist/svelte/components/InferenceDefaultView.svelte.d.ts.map +1 -0
  85. package/dist/svelte/components/InferenceFusionList.svelte +135 -0
  86. package/dist/svelte/components/InferenceFusionList.svelte.d.ts +16 -0
  87. package/dist/svelte/components/InferenceFusionList.svelte.d.ts.map +1 -0
  88. package/dist/svelte/components/InferenceSettingsPanel.svelte +345 -0
  89. package/dist/svelte/components/InferenceSettingsPanel.svelte.d.ts +65 -0
  90. package/dist/svelte/components/InferenceSettingsPanel.svelte.d.ts.map +1 -0
  91. package/dist/svelte/components/InferenceTierRow.svelte +199 -0
  92. package/dist/svelte/components/InferenceTierRow.svelte.d.ts +14 -0
  93. package/dist/svelte/components/InferenceTierRow.svelte.d.ts.map +1 -0
  94. package/dist/svelte/components/InferenceUsageTable.svelte +127 -0
  95. package/dist/svelte/components/InferenceUsageTable.svelte.d.ts +15 -0
  96. package/dist/svelte/components/InferenceUsageTable.svelte.d.ts.map +1 -0
  97. package/dist/svelte/index.d.ts +17 -0
  98. package/dist/svelte/index.d.ts.map +1 -0
  99. package/dist/svelte/index.js +14 -0
  100. package/dist/svelte/types.d.ts +197 -0
  101. package/dist/svelte/types.d.ts.map +1 -0
  102. package/dist/svelte/types.js +96 -0
  103. package/dist/types.d.ts +47 -0
  104. package/dist/types.d.ts.map +1 -0
  105. package/dist/types.js +13 -0
  106. package/dist/types.js.map +1 -0
  107. package/package.json +105 -3
@@ -0,0 +1,453 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "timestamp": 0,
4
+ "packageName": "@happyvertical/smrt-inference",
5
+ "packageVersion": "0.60.15",
6
+ "objects": {
7
+ "@happyvertical/smrt-inference:InferenceOverride": {
8
+ "name": "inferenceoverride",
9
+ "className": "InferenceOverride",
10
+ "qualifiedName": "@happyvertical/smrt-inference:InferenceOverride",
11
+ "collection": "inferenceoverrides",
12
+ "filePath": "/home/runner/work/smrt/smrt/packages/inference/src/models/InferenceOverride.ts",
13
+ "packageName": "@happyvertical/smrt-inference",
14
+ "fields": {
15
+ "binding": {
16
+ "type": "text",
17
+ "required": true,
18
+ "default": "",
19
+ "_meta": {
20
+ "required": true
21
+ }
22
+ },
23
+ "tenantId": {
24
+ "type": "text",
25
+ "required": false,
26
+ "_meta": {
27
+ "sqlType": "UUID",
28
+ "nullable": true
29
+ }
30
+ },
31
+ "target": {
32
+ "type": "text",
33
+ "required": false,
34
+ "_meta": {
35
+ "nullable": true
36
+ }
37
+ },
38
+ "tenantAllowList": {
39
+ "type": "text",
40
+ "required": false,
41
+ "_meta": {
42
+ "nullable": true
43
+ }
44
+ }
45
+ },
46
+ "methods": {
47
+ "getValue": {
48
+ "name": "getValue",
49
+ "async": false,
50
+ "parameters": [],
51
+ "returnType": "unknown",
52
+ "isStatic": false,
53
+ "isPublic": true
54
+ },
55
+ "getTenantAllowList": {
56
+ "name": "getTenantAllowList",
57
+ "async": false,
58
+ "parameters": [],
59
+ "returnType": "string[] | null",
60
+ "isStatic": false,
61
+ "isPublic": true
62
+ },
63
+ "save": {
64
+ "name": "save",
65
+ "async": true,
66
+ "parameters": [
67
+ {
68
+ "name": "options",
69
+ "type": "SmrtSaveOptions",
70
+ "optional": true
71
+ }
72
+ ],
73
+ "returnType": "Promise<this>",
74
+ "isStatic": false,
75
+ "isPublic": true
76
+ },
77
+ "delete": {
78
+ "name": "delete",
79
+ "async": true,
80
+ "parameters": [],
81
+ "returnType": "Promise<void>",
82
+ "isStatic": false,
83
+ "isPublic": true
84
+ }
85
+ },
86
+ "decoratorConfig": {
87
+ "tableName": "_smrt_inference_overrides",
88
+ "conflictColumns": [
89
+ "binding",
90
+ "context"
91
+ ],
92
+ "api": false,
93
+ "cli": false,
94
+ "mcp": false,
95
+ "indexes": [
96
+ {
97
+ "name": "idx_smrt_inference_overrides_tenant",
98
+ "columns": [
99
+ "tenantId",
100
+ "binding"
101
+ ]
102
+ }
103
+ ]
104
+ },
105
+ "extends": "SmrtObject",
106
+ "exportName": "InferenceOverride",
107
+ "collectionExportName": "InferenceOverrideCollection",
108
+ "validationRules": [
109
+ {
110
+ "field": "binding",
111
+ "rule": "required",
112
+ "fieldType": "text"
113
+ }
114
+ ],
115
+ "schema": {
116
+ "tableName": "_smrt_inference_overrides",
117
+ "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_inference_overrides\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"binding\" TEXT NOT NULL DEFAULT '',\n \"tenant_id\" UUID,\n \"target\" TEXT,\n \"tenant_allow_list\" TEXT\n);",
118
+ "columns": {
119
+ "_sync_origin_device_id": {
120
+ "type": "TEXT"
121
+ },
122
+ "_sync_revision": {
123
+ "type": "INTEGER"
124
+ },
125
+ "id": {
126
+ "type": "UUID",
127
+ "primaryKey": true,
128
+ "referenceKind": "id",
129
+ "notNull": true
130
+ },
131
+ "slug": {
132
+ "type": "TEXT",
133
+ "notNull": true
134
+ },
135
+ "context": {
136
+ "type": "TEXT",
137
+ "notNull": true,
138
+ "default": ""
139
+ },
140
+ "created_at": {
141
+ "type": "TIMESTAMP",
142
+ "notNull": true,
143
+ "default": "current_timestamp"
144
+ },
145
+ "updated_at": {
146
+ "type": "TIMESTAMP",
147
+ "notNull": true,
148
+ "default": "current_timestamp"
149
+ },
150
+ "binding": {
151
+ "type": "TEXT",
152
+ "notNull": true,
153
+ "unique": false,
154
+ "default": ""
155
+ },
156
+ "tenant_id": {
157
+ "type": "UUID",
158
+ "notNull": false,
159
+ "unique": false
160
+ },
161
+ "target": {
162
+ "type": "TEXT",
163
+ "notNull": false,
164
+ "unique": false
165
+ },
166
+ "tenant_allow_list": {
167
+ "type": "TEXT",
168
+ "notNull": false,
169
+ "unique": false
170
+ }
171
+ },
172
+ "indexes": [
173
+ {
174
+ "name": "_smrt_inference_overrides_binding_context_idx",
175
+ "columns": [
176
+ "binding",
177
+ "context"
178
+ ],
179
+ "unique": true
180
+ },
181
+ {
182
+ "name": "_smrt_inference_overrides_slug_context_idx",
183
+ "columns": [
184
+ "slug",
185
+ "context"
186
+ ]
187
+ },
188
+ {
189
+ "name": "idx_smrt_inference_overrides_tenant",
190
+ "columns": [
191
+ "tenant_id",
192
+ "binding"
193
+ ]
194
+ },
195
+ {
196
+ "name": "_smrt_inference_overrides_created_at_idx",
197
+ "columns": [
198
+ "created_at"
199
+ ]
200
+ }
201
+ ],
202
+ "version": "4868b81b"
203
+ },
204
+ "importPath": "@happyvertical/smrt-inference/models"
205
+ },
206
+ "@happyvertical/smrt-inference:InferenceOverrideCollection": {
207
+ "name": "inferenceoverridecollection",
208
+ "className": "InferenceOverrideCollection",
209
+ "qualifiedName": "@happyvertical/smrt-inference:InferenceOverrideCollection",
210
+ "collection": "inferenceoverrides",
211
+ "description": "Reads and unauthorized writes of _smrt_inference_overrides.",
212
+ "filePath": "/home/runner/work/smrt/smrt/packages/inference/src/models/InferenceOverrideCollection.ts",
213
+ "packageName": "@happyvertical/smrt-inference",
214
+ "fields": {},
215
+ "methods": {
216
+ "getScopeMap": {
217
+ "name": "getScopeMap",
218
+ "async": true,
219
+ "parameters": [
220
+ {
221
+ "name": "scopeType",
222
+ "type": "InferenceOverrideScopeType",
223
+ "optional": false,
224
+ "resolvedType": "'app' | 'tenant'"
225
+ },
226
+ {
227
+ "name": "scopeId",
228
+ "type": "string",
229
+ "optional": false
230
+ }
231
+ ],
232
+ "returnType": "Promise<Map<string, InferenceOverride>>",
233
+ "isStatic": false,
234
+ "isPublic": true
235
+ },
236
+ "findByScope": {
237
+ "name": "findByScope",
238
+ "async": true,
239
+ "parameters": [
240
+ {
241
+ "name": "binding",
242
+ "type": "string",
243
+ "optional": false
244
+ },
245
+ {
246
+ "name": "scopeType",
247
+ "type": "InferenceOverrideScopeType",
248
+ "optional": false,
249
+ "resolvedType": "'app' | 'tenant'"
250
+ },
251
+ {
252
+ "name": "scopeId",
253
+ "type": "string",
254
+ "optional": false
255
+ }
256
+ ],
257
+ "returnType": "Promise<InferenceOverride | null>",
258
+ "isStatic": false,
259
+ "isPublic": true
260
+ },
261
+ "setOverride": {
262
+ "name": "setOverride",
263
+ "async": true,
264
+ "parameters": [
265
+ {
266
+ "name": "binding",
267
+ "type": "string",
268
+ "optional": false
269
+ },
270
+ {
271
+ "name": "scopeType",
272
+ "type": "InferenceOverrideScopeType",
273
+ "optional": false,
274
+ "resolvedType": "'app' | 'tenant'"
275
+ },
276
+ {
277
+ "name": "scopeId",
278
+ "type": "string",
279
+ "optional": false
280
+ },
281
+ {
282
+ "name": "change",
283
+ "type": "object",
284
+ "optional": false,
285
+ "memberTypes": [
286
+ "unknown",
287
+ "string[] | null"
288
+ ]
289
+ }
290
+ ],
291
+ "returnType": "Promise<InferenceOverride | null>",
292
+ "isStatic": false,
293
+ "isPublic": true
294
+ },
295
+ "removeOverride": {
296
+ "name": "removeOverride",
297
+ "async": true,
298
+ "parameters": [
299
+ {
300
+ "name": "binding",
301
+ "type": "string",
302
+ "optional": false
303
+ },
304
+ {
305
+ "name": "scopeType",
306
+ "type": "InferenceOverrideScopeType",
307
+ "optional": false,
308
+ "resolvedType": "'app' | 'tenant'"
309
+ },
310
+ {
311
+ "name": "scopeId",
312
+ "type": "string",
313
+ "optional": false
314
+ }
315
+ ],
316
+ "returnType": "Promise<boolean>",
317
+ "isStatic": false,
318
+ "isPublic": true
319
+ }
320
+ },
321
+ "decoratorConfig": {
322
+ "tableName": "_smrt_inference_overrides",
323
+ "api": false,
324
+ "mcp": false,
325
+ "cli": false
326
+ },
327
+ "extends": "SmrtCollection",
328
+ "extendsTypeArg": "InferenceOverride",
329
+ "exportName": "InferenceOverrideCollection",
330
+ "collectionExportName": "InferenceOverrideCollectionCollection",
331
+ "collectionOf": "@happyvertical/smrt-inference:InferenceOverride",
332
+ "inheritedExposure": [
333
+ "api",
334
+ "mcp",
335
+ "cli"
336
+ ],
337
+ "schema": {
338
+ "tableName": "_smrt_inference_overrides",
339
+ "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_inference_overrides\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"binding\" TEXT NOT NULL DEFAULT '',\n \"tenant_id\" UUID,\n \"target\" TEXT,\n \"tenant_allow_list\" TEXT\n);",
340
+ "columns": {
341
+ "_sync_origin_device_id": {
342
+ "type": "TEXT"
343
+ },
344
+ "_sync_revision": {
345
+ "type": "INTEGER"
346
+ },
347
+ "id": {
348
+ "type": "UUID",
349
+ "primaryKey": true,
350
+ "referenceKind": "id",
351
+ "notNull": true
352
+ },
353
+ "slug": {
354
+ "type": "TEXT",
355
+ "notNull": true
356
+ },
357
+ "context": {
358
+ "type": "TEXT",
359
+ "notNull": true,
360
+ "default": ""
361
+ },
362
+ "created_at": {
363
+ "type": "TIMESTAMP",
364
+ "notNull": true,
365
+ "default": "current_timestamp"
366
+ },
367
+ "updated_at": {
368
+ "type": "TIMESTAMP",
369
+ "notNull": true,
370
+ "default": "current_timestamp"
371
+ },
372
+ "binding": {
373
+ "type": "TEXT",
374
+ "notNull": true,
375
+ "unique": false,
376
+ "default": ""
377
+ },
378
+ "tenant_id": {
379
+ "type": "UUID",
380
+ "notNull": false,
381
+ "unique": false
382
+ },
383
+ "target": {
384
+ "type": "TEXT",
385
+ "notNull": false,
386
+ "unique": false
387
+ },
388
+ "tenant_allow_list": {
389
+ "type": "TEXT",
390
+ "notNull": false,
391
+ "unique": false
392
+ }
393
+ },
394
+ "indexes": [
395
+ {
396
+ "name": "_smrt_inference_overrides_binding_context_idx",
397
+ "columns": [
398
+ "binding",
399
+ "context"
400
+ ],
401
+ "unique": true
402
+ },
403
+ {
404
+ "name": "_smrt_inference_overrides_slug_context_idx",
405
+ "columns": [
406
+ "slug",
407
+ "context"
408
+ ]
409
+ },
410
+ {
411
+ "name": "idx_smrt_inference_overrides_tenant",
412
+ "columns": [
413
+ "tenant_id",
414
+ "binding"
415
+ ]
416
+ },
417
+ {
418
+ "name": "_smrt_inference_overrides_created_at_idx",
419
+ "columns": [
420
+ "created_at"
421
+ ]
422
+ }
423
+ ],
424
+ "version": "4868b81b"
425
+ },
426
+ "importPath": "@happyvertical/smrt-inference/models"
427
+ }
428
+ },
429
+ "moduleType": "smrt",
430
+ "smrtDependencies": [
431
+ "@happyvertical/smrt-core",
432
+ "@happyvertical/smrt-prompts",
433
+ "@happyvertical/smrt-secrets",
434
+ "@happyvertical/smrt-tenancy",
435
+ "@happyvertical/smrt-users"
436
+ ],
437
+ "browser": {
438
+ "status": "server-only",
439
+ "issues": [
440
+ "#3617",
441
+ "#3624",
442
+ "#3626",
443
+ "#3627"
444
+ ],
445
+ "via": [
446
+ "@happyvertical/smrt-profiles",
447
+ "@happyvertical/smrt-secrets",
448
+ "@happyvertical/smrt-tenancy",
449
+ "@happyvertical/smrt-users"
450
+ ]
451
+ },
452
+ "stampsConstructors": true
453
+ }
@@ -0,0 +1,38 @@
1
+ import { SmrtObject, type SmrtObjectOptions, type SmrtSaveOptions } from '@happyvertical/smrt-core';
2
+ /** `context` (and `scopeId`) of the app-wide row. */
3
+ export declare const APP_INFERENCE_SCOPE_ID = "__app__";
4
+ export interface InferenceOverrideOptions extends SmrtObjectOptions {
5
+ binding?: string;
6
+ tenantId?: string | null;
7
+ target?: string | null;
8
+ tenantAllowList?: string | null;
9
+ }
10
+ export declare class InferenceOverride extends SmrtObject {
11
+ binding: string;
12
+ tenantId: string | null;
13
+ /**
14
+ * JSON of the bound value; `null` inherits the lower layer. Tier rows hold
15
+ * a tier target, `default-tier` holds `{ tier }`, alias rows an alias, and
16
+ * fusion rows a fusion config entry.
17
+ */
18
+ target: string | null;
19
+ /**
20
+ * App rows of `tier:*` and `default-tier` only: JSON array of the target
21
+ * references a tenant may bind (`model:openai/*`, `alias:local`,
22
+ * `fusion:review-pair`, `tier:good`, `*`). No list allows nothing. This is
23
+ * the stored half of the tenant allow-list; the service's
24
+ * `tenantTargetPolicy` hook is the code half (#4667 caps the maximum
25
+ * hosted tier there).
26
+ */
27
+ tenantAllowList: string | null;
28
+ constructor(options?: InferenceOverrideOptions);
29
+ /** The parsed, validated stored value (`null` inherits). */
30
+ getValue(): unknown;
31
+ /** The parsed allow-list (`null` when the row carries none). */
32
+ getTenantAllowList(): string[] | null;
33
+ save(options?: SmrtSaveOptions): Promise<this>;
34
+ delete(): Promise<void>;
35
+ private normalizedValue;
36
+ private validateOverride;
37
+ }
38
+ //# sourceMappingURL=InferenceOverride.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InferenceOverride.d.ts","sourceRoot":"","sources":["../../src/models/InferenceOverride.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,KAAK,iBAAiB,EACtB,KAAK,eAAe,EAErB,MAAM,0BAA0B,CAAC;AAYlC,qDAAqD;AACrD,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAEhD,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAoBD,qBAaa,iBAAkB,SAAQ,UAAU;IAE/C,OAAO,EAAE,MAAM,CAAM;IAKrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE/B;;;;OAIG;IAEH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE7B;;;;;;;OAOG;IAEH,eAAe,EAAE,MAAM,GAAG,IAAI,CAAQ;gBAE1B,OAAO,GAAE,wBAA6B;IAUlD,4DAA4D;IAC5D,QAAQ,IAAI,OAAO;IAInB,gEAAgE;IAChE,kBAAkB,IAAI,MAAM,EAAE,GAAG,IAAI;IAOtB,IAAI,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAU9C,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAKtC,OAAO,CAAC,eAAe;IAqBvB,OAAO,CAAC,gBAAgB;CAiDzB"}
@@ -0,0 +1,35 @@
1
+ import { SmrtCollection } from '@happyvertical/smrt-core';
2
+ import { APP_INFERENCE_SCOPE_ID, InferenceOverride } from './InferenceOverride.js';
3
+ /** `app` (the `__app__` row) or one tenant. */
4
+ export type InferenceOverrideScopeType = 'app' | 'tenant';
5
+ /**
6
+ * Reads and unauthorized writes of `_smrt_inference_overrides`. Hosts write
7
+ * through `InferenceOverrideService` (authorizer-gated, fails closed); call
8
+ * {@link setOverride} / {@link removeOverride} directly only after your own
9
+ * authorization decision.
10
+ */
11
+ export declare class InferenceOverrideCollection extends SmrtCollection<InferenceOverride> {
12
+ static readonly _itemClass: typeof InferenceOverride;
13
+ /**
14
+ * Every row of one scope, keyed by binding id: one bounded read. An
15
+ * enumeration read: build the collection without list bounds (the
16
+ * settings service does) so a host-wide `maxListLimit` cannot drop a row.
17
+ */
18
+ getScopeMap(scopeType: InferenceOverrideScopeType, scopeId: string): Promise<Map<string, InferenceOverride>>;
19
+ /** The row for one binding at one scope. */
20
+ findByScope(binding: string, scopeType: InferenceOverrideScopeType, scopeId: string): Promise<InferenceOverride | null>;
21
+ /**
22
+ * Set the stored value (and, for app rows, optionally the tenant
23
+ * allow-list) of one binding at one scope, creating the row when needed.
24
+ * `undefined` leaves a column untouched; `null` clears it. A row left with
25
+ * neither a value nor an allow-list is deleted.
26
+ */
27
+ setOverride(binding: string, scopeType: InferenceOverrideScopeType, scopeId: string, change: {
28
+ target?: unknown;
29
+ tenantAllowList?: string[] | null;
30
+ }): Promise<InferenceOverride | null>;
31
+ /** Delete the row for one binding at one scope, if any. */
32
+ removeOverride(binding: string, scopeType: InferenceOverrideScopeType, scopeId: string): Promise<boolean>;
33
+ }
34
+ export { APP_INFERENCE_SCOPE_ID };
35
+ //# sourceMappingURL=InferenceOverrideCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InferenceOverrideCollection.d.ts","sourceRoot":"","sources":["../../src/models/InferenceOverrideCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAEhC,+CAA+C;AAC/C,MAAM,MAAM,0BAA0B,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE1D;;;;;GAKG;AACH,qBAAa,2BAA4B,SAAQ,cAAc,CAAC,iBAAiB,CAAC;IAChF,MAAM,CAAC,QAAQ,CAAC,UAAU,2BAAqB;IAE/C;;;;OAIG;IACG,WAAW,CACf,SAAS,EAAE,0BAA0B,EACrC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAQ1C,4CAA4C;IACtC,WAAW,CACf,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,0BAA0B,EACrC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAMpC;;;;;OAKG;IACG,WAAW,CACf,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,0BAA0B,EACrC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;KAAE,GAC9D,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAmCpC,2DAA2D;IACrD,cAAc,CAClB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,0BAA0B,EACrC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,CAAC;CAMpB;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @happyvertical/smrt-inference/models — the `_smrt_inference_overrides`
3
+ * model (#4754). Generated consumer registration imports it from here; apps
4
+ * write through `InferenceSettingsService` / `InferenceOverrideService` in
5
+ * `./server`, never through the collection directly unless they made their
6
+ * own authorization decision.
7
+ */
8
+ import './__smrt-register__.js';
9
+ export { APP_INFERENCE_SCOPE_ID, InferenceOverride, type InferenceOverrideOptions, } from './models/InferenceOverride.js';
10
+ export { InferenceOverrideCollection, type InferenceOverrideScopeType, } from './models/InferenceOverrideCollection.js';
11
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,KAAK,wBAAwB,GAC9B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,2BAA2B,EAC3B,KAAK,0BAA0B,GAChC,MAAM,yCAAyC,CAAC"}
package/dist/models.js ADDED
@@ -0,0 +1,2 @@
1
+ import { n as APP_INFERENCE_SCOPE_ID, r as InferenceOverride, t as InferenceOverrideCollection } from "./chunks/InferenceOverrideCollection-wl7sI-3C.js";
2
+ export { APP_INFERENCE_SCOPE_ID, InferenceOverride, InferenceOverrideCollection };
package/dist/node.d.ts ADDED
@@ -0,0 +1,110 @@
1
+ import { type InferenceCandidate, type InferenceCapabilities, type InferenceCapabilityEvidence, type InferenceConfig } from '@happyvertical/smrt-core';
2
+ import type { InferenceConfigIssue } from './types.js';
3
+ export type InferenceDoctorStatus = 'ok' | 'warn' | 'error';
4
+ /** Result of one reachability probe. */
5
+ export interface InferenceProbeResult {
6
+ /** True when the endpoint answered and accepted the credential. */
7
+ reachable: boolean;
8
+ /** True when no cheap probe is known for the provider. */
9
+ skipped?: boolean;
10
+ /** HTTP status, when one came back. */
11
+ status?: number;
12
+ durationMs: number;
13
+ /** Short, key-free explanation. */
14
+ detail: string;
15
+ /**
16
+ * What the model listing says about the candidate's model (#4758), when
17
+ * the endpoint answered and listed it with capability fields.
18
+ */
19
+ capabilities?: InferenceCapabilityEvidence;
20
+ }
21
+ /** One candidate of a binding. */
22
+ export interface InferenceDoctorCandidate {
23
+ label: string;
24
+ status: InferenceDoctorStatus;
25
+ problems: string[];
26
+ probe?: InferenceProbeResult;
27
+ /** With `probe`: the candidate's capabilities and their source (#4758). */
28
+ capabilities?: InferenceCapabilities;
29
+ }
30
+ /** One tier or alias binding. */
31
+ export interface InferenceDoctorBinding {
32
+ /** `tier:<name>` or `alias:<name>`. */
33
+ binding: string;
34
+ /** Key-free description of the target. */
35
+ target: string;
36
+ status: InferenceDoctorStatus;
37
+ problems: string[];
38
+ candidates: InferenceDoctorCandidate[];
39
+ }
40
+ /** The doctor's answer. `ok` is false when any binding cannot resolve. */
41
+ export interface InferenceDoctorReport {
42
+ ok: boolean;
43
+ /** False when no `inference` block is configured (every tier uses the configured client). */
44
+ configured: boolean;
45
+ bindings: InferenceDoctorBinding[];
46
+ issues: InferenceConfigIssue[];
47
+ }
48
+ /** Options for {@link checkInferenceBindings} and the probe. */
49
+ export interface CheckInferenceBindingsOptions {
50
+ /** Config to check. Default: core's merged `getInferenceConfig()`. */
51
+ config?: InferenceConfig;
52
+ /** Environment for key presence. Default `process.env`. */
53
+ env?: Record<string, string | undefined>;
54
+ /** Call each candidate's list endpoint. Default false (offline). */
55
+ probe?: boolean;
56
+ /** Probe timeout per candidate, ms. Default 3000. */
57
+ timeoutMs?: number;
58
+ /** Fetch implementation for probes. Default global `fetch`. */
59
+ fetch?: typeof fetch;
60
+ /** Recognized provider names. Default the AI SDK's provider list. */
61
+ providers?: readonly string[];
62
+ /**
63
+ * The SDK `getCapabilities()` answer for a candidate (the `provider`
64
+ * layer, #4758), when the host can supply one. Default: none; the doctor
65
+ * builds no SDK clients.
66
+ */
67
+ sdkCapabilities?: (candidate: InferenceCandidate) => unknown | Promise<unknown>;
68
+ }
69
+ /**
70
+ * Capability evidence for `model` from a list endpoint's body (#4758):
71
+ * OpenAI-compatible `data[]` entries (OpenRouter `context_length`,
72
+ * `supported_parameters`, `architecture.input_modalities`; LM Studio
73
+ * `max_context_length`; llama.cpp `meta.n_ctx_train`) and Gemini
74
+ * `models[].inputTokenLimit`. Unknown shapes give nothing.
75
+ */
76
+ export declare function inferenceCapabilitiesFromModelListing(body: unknown, model: string | undefined): InferenceCapabilityEvidence | undefined;
77
+ /**
78
+ * A candidate's capabilities from every layer the doctor can see (#4758):
79
+ * the host's SDK answer (when given), the preset table, the probe's
80
+ * evidence, the model heuristic, then assumed.
81
+ */
82
+ export declare function inferenceCandidateCapabilities(candidate: InferenceCandidate, options?: {
83
+ probe?: InferenceCapabilityEvidence;
84
+ sdkCapabilities?: CheckInferenceBindingsOptions['sdkCapabilities'];
85
+ }): Promise<InferenceCapabilities>;
86
+ /**
87
+ * The URL {@link probeInferenceCandidate} would call for a candidate, or
88
+ * `undefined` when no cheap probe is known. Key-free; the settings key rule
89
+ * (#4754) binds a key to this URL's origin.
90
+ */
91
+ export declare function inferenceProbeUrl(candidate: InferenceCandidate): string | undefined;
92
+ /**
93
+ * Probe one candidate's cheapest list endpoint (`/models`, Ollama
94
+ * `/api/tags`) with a short timeout. The key goes only to the candidate's
95
+ * own endpoint and never appears in the result.
96
+ */
97
+ export declare function probeInferenceCandidate(candidate: InferenceCandidate, options?: Pick<CheckInferenceBindingsOptions, 'env' | 'timeoutMs' | 'fetch'>): Promise<InferenceProbeResult>;
98
+ /**
99
+ * Walk every tier and alias binding; see the module comment. Never throws on
100
+ * a bad config: problems come back in the report, and `ok` is false when any
101
+ * binding cannot resolve.
102
+ */
103
+ export declare function checkInferenceBindings(options?: CheckInferenceBindingsOptions): Promise<InferenceDoctorReport>;
104
+ /** One line describing capabilities, e.g. `json no, tools yes, … (preset)`. */
105
+ export declare function formatInferenceCapabilities(capabilities: InferenceCapabilities): string;
106
+ /** The lines `smrt doctor --ai` prints for a report. */
107
+ export declare function formatInferenceDoctorReport(report: InferenceDoctorReport): string[];
108
+ export * from './hosted.js';
109
+ export type { InferenceConfigIssue } from './types.js';
110
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"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"}