@happyvertical/smrt-inference 0.0.0-stage → 0.60.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +206 -0
- package/CLAUDE.md +1 -0
- package/LICENSE +7 -0
- package/README.md +73 -2
- package/agents/fusions.md +105 -0
- package/agents/hosted.md +161 -0
- package/agents/resolver.md +65 -0
- package/agents/settings.md +107 -0
- package/dist/__smrt-register__.d.ts +2 -0
- package/dist/__smrt-register__.d.ts.map +1 -0
- package/dist/chunks/InferenceOverrideCollection-Dat4TrK5.js +423 -0
- package/dist/chunks/InferenceOverrideCollection-Dat4TrK5.js.map +1 -0
- package/dist/chunks/provider-config-BSpIQRVM.js +1873 -0
- package/dist/chunks/provider-config-BSpIQRVM.js.map +1 -0
- package/dist/classify.d.ts +32 -0
- package/dist/classify.d.ts.map +1 -0
- package/dist/config.d.ts +89 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/errors.d.ts +51 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/executor.d.ts +45 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/fusion-store.d.ts +16 -0
- package/dist/fusion-store.d.ts.map +1 -0
- package/dist/fusion.d.ts +155 -0
- package/dist/fusion.d.ts.map +1 -0
- package/dist/gate.d.ts +143 -0
- package/dist/gate.d.ts.map +1 -0
- package/dist/gate.js +94 -0
- package/dist/gate.js.map +1 -0
- package/dist/hosted.d.ts +461 -0
- package/dist/hosted.d.ts.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.json +453 -0
- package/dist/models/InferenceOverride.d.ts +38 -0
- package/dist/models/InferenceOverride.d.ts.map +1 -0
- package/dist/models/InferenceOverrideCollection.d.ts +35 -0
- package/dist/models/InferenceOverrideCollection.d.ts.map +1 -0
- package/dist/models.d.ts +11 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +2 -0
- package/dist/node.d.ts +110 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +1414 -0
- package/dist/node.js.map +1 -0
- package/dist/provider-config.d.ts +113 -0
- package/dist/provider-config.d.ts.map +1 -0
- package/dist/register.d.ts +30 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/resolver.d.ts +166 -0
- package/dist/resolver.d.ts.map +1 -0
- package/dist/resolver.js +291 -0
- package/dist/resolver.js.map +1 -0
- package/dist/server.d.ts +25 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +1138 -0
- package/dist/server.js.map +1 -0
- package/dist/settings/cache.d.ts +5 -0
- package/dist/settings/cache.d.ts.map +1 -0
- package/dist/settings/keys.d.ts +70 -0
- package/dist/settings/keys.d.ts.map +1 -0
- package/dist/settings/layers.d.ts +68 -0
- package/dist/settings/layers.d.ts.map +1 -0
- package/dist/settings/override-service.d.ts +119 -0
- package/dist/settings/override-service.d.ts.map +1 -0
- package/dist/settings/preferences.d.ts +137 -0
- package/dist/settings/preferences.d.ts.map +1 -0
- package/dist/settings/resolver.d.ts +41 -0
- package/dist/settings/resolver.d.ts.map +1 -0
- package/dist/settings/settings-service.d.ts +355 -0
- package/dist/settings/settings-service.d.ts.map +1 -0
- package/dist/settings/targets.d.ts +112 -0
- package/dist/settings/targets.d.ts.map +1 -0
- package/dist/settings/transcripts.d.ts +33 -0
- package/dist/settings/transcripts.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +341 -0
- package/dist/smrt-knowledge.okf.md +80 -0
- package/dist/svelte/components/InferenceAliasEditor.svelte +210 -0
- package/dist/svelte/components/InferenceAliasEditor.svelte.d.ts +13 -0
- package/dist/svelte/components/InferenceAliasEditor.svelte.d.ts.map +1 -0
- package/dist/svelte/components/InferenceDefaultView.svelte +330 -0
- package/dist/svelte/components/InferenceDefaultView.svelte.d.ts +15 -0
- package/dist/svelte/components/InferenceDefaultView.svelte.d.ts.map +1 -0
- package/dist/svelte/components/InferenceFusionList.svelte +141 -0
- package/dist/svelte/components/InferenceFusionList.svelte.d.ts +16 -0
- package/dist/svelte/components/InferenceFusionList.svelte.d.ts.map +1 -0
- package/dist/svelte/components/InferenceSettingsPanel.svelte +392 -0
- package/dist/svelte/components/InferenceSettingsPanel.svelte.d.ts +84 -0
- package/dist/svelte/components/InferenceSettingsPanel.svelte.d.ts.map +1 -0
- package/dist/svelte/components/InferenceTierRow.svelte +199 -0
- package/dist/svelte/components/InferenceTierRow.svelte.d.ts +14 -0
- package/dist/svelte/components/InferenceTierRow.svelte.d.ts.map +1 -0
- package/dist/svelte/components/InferenceTranscriptSettings.svelte +165 -0
- package/dist/svelte/components/InferenceTranscriptSettings.svelte.d.ts +18 -0
- package/dist/svelte/components/InferenceTranscriptSettings.svelte.d.ts.map +1 -0
- package/dist/svelte/components/InferenceUsageTable.svelte +177 -0
- package/dist/svelte/components/InferenceUsageTable.svelte.d.ts +21 -0
- package/dist/svelte/components/InferenceUsageTable.svelte.d.ts.map +1 -0
- package/dist/svelte/index.d.ts +17 -0
- package/dist/svelte/index.d.ts.map +1 -0
- package/dist/svelte/index.js +14 -0
- package/dist/svelte/types.d.ts +262 -0
- package/dist/svelte/types.d.ts.map +1 -0
- package/dist/svelte/types.js +124 -0
- package/dist/types.d.ts +47 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -0
- package/package.json +105 -3
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Presentational types for the inference settings UI (#4754).
|
|
3
|
+
*
|
|
4
|
+
* Deliberately free of `@happyvertical/smrt-core`, the AI SDK and the
|
|
5
|
+
* `@smrt()` model, so the browser bundle stays a thin presentation layer.
|
|
6
|
+
* Field names match the rows `InferenceSettingsService` returns
|
|
7
|
+
* (`./server`), so a row is structurally assignable to its view with no
|
|
8
|
+
* mapping step.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
export declare const INFERENCE_SETTINGS_TIERS: readonly ["cheap", "good", "great", "best"];
|
|
13
|
+
export type InferenceSettingsTier = (typeof INFERENCE_SETTINGS_TIERS)[number];
|
|
14
|
+
export declare const INFERENCE_SETTINGS_MODES: readonly ["byo", "local", "hosted", "off"];
|
|
15
|
+
export type InferenceSettingsMode = (typeof INFERENCE_SETTINGS_MODES)[number];
|
|
16
|
+
export type InferenceSettingsLevelView = 'default' | 'config' | 'app' | 'tenant';
|
|
17
|
+
export type InferenceSettingsScope = 'app' | 'tenant';
|
|
18
|
+
/**
|
|
19
|
+
* A tier target as the panel reads and emits it: a model, an alias or a
|
|
20
|
+
* fusion. Never a key, never an endpoint (an endpoint belongs in an alias).
|
|
21
|
+
* `null` means "same as default".
|
|
22
|
+
*/
|
|
23
|
+
export interface InferenceTargetView {
|
|
24
|
+
kind?: string;
|
|
25
|
+
provider?: string;
|
|
26
|
+
model?: string;
|
|
27
|
+
alias?: string;
|
|
28
|
+
fusion?: string;
|
|
29
|
+
candidates?: unknown[];
|
|
30
|
+
}
|
|
31
|
+
/** The user's choices for the default view, plus whether a key is stored. */
|
|
32
|
+
export interface InferenceDefaultsView {
|
|
33
|
+
mode?: InferenceSettingsMode;
|
|
34
|
+
provider?: string;
|
|
35
|
+
baseUrl?: string;
|
|
36
|
+
model?: string;
|
|
37
|
+
defaultTier?: InferenceSettingsTier;
|
|
38
|
+
/** Whether the host holds a key for {@link provider}. The key itself never comes back. */
|
|
39
|
+
keySet?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/** What Save emits from the default view. Never contains a key. */
|
|
42
|
+
export interface InferenceDefaultsChange {
|
|
43
|
+
mode: InferenceSettingsMode;
|
|
44
|
+
provider?: string;
|
|
45
|
+
baseUrl?: string;
|
|
46
|
+
model?: string;
|
|
47
|
+
defaultTier?: InferenceSettingsTier;
|
|
48
|
+
}
|
|
49
|
+
/** What the replace-key action emits. The host stores it through smrt-secrets. */
|
|
50
|
+
export interface InferenceKeyChange {
|
|
51
|
+
provider: string;
|
|
52
|
+
key: string;
|
|
53
|
+
/** Set when the provider choice is a #4674 preset. */
|
|
54
|
+
preset?: string;
|
|
55
|
+
/**
|
|
56
|
+
* The base URL shown when the key was entered. The host binds the key to
|
|
57
|
+
* this endpoint's origin (`bindInferenceKey()`), not to saved choices.
|
|
58
|
+
*/
|
|
59
|
+
baseUrl?: string;
|
|
60
|
+
}
|
|
61
|
+
/** One provider choice (`InferenceProviderOption` from `./server`). */
|
|
62
|
+
export interface InferenceProviderView {
|
|
63
|
+
id: string;
|
|
64
|
+
label: string;
|
|
65
|
+
kind: 'preset' | 'provider';
|
|
66
|
+
baseUrl?: string;
|
|
67
|
+
requiresApiKey: boolean;
|
|
68
|
+
needsBaseUrl?: boolean;
|
|
69
|
+
local?: boolean;
|
|
70
|
+
}
|
|
71
|
+
/** Local discovery results (#4674). */
|
|
72
|
+
export interface InferenceDiscoveryView {
|
|
73
|
+
service: string;
|
|
74
|
+
baseUrl: string;
|
|
75
|
+
models: string[];
|
|
76
|
+
}
|
|
77
|
+
/** What Test connection asks the host to probe. Never carries a key. */
|
|
78
|
+
export interface InferenceConnectionRequest {
|
|
79
|
+
provider?: string;
|
|
80
|
+
preset?: string;
|
|
81
|
+
baseUrl?: string;
|
|
82
|
+
model?: string;
|
|
83
|
+
}
|
|
84
|
+
/** Key-free probe result (`InferenceConnectionResult`). */
|
|
85
|
+
export interface InferenceTestResultView {
|
|
86
|
+
reachable: boolean;
|
|
87
|
+
skipped?: boolean;
|
|
88
|
+
status?: number;
|
|
89
|
+
durationMs?: number;
|
|
90
|
+
detail: string;
|
|
91
|
+
}
|
|
92
|
+
/** One tier row (`InferenceTierSettingsRow`). */
|
|
93
|
+
export interface InferenceTierView {
|
|
94
|
+
tier: InferenceSettingsTier;
|
|
95
|
+
effectiveTarget?: InferenceTargetView | null;
|
|
96
|
+
effectiveLabel: string;
|
|
97
|
+
supplyingLevel?: InferenceSettingsLevelView;
|
|
98
|
+
appTarget?: InferenceTargetView | null;
|
|
99
|
+
tenantTarget?: InferenceTargetView | null;
|
|
100
|
+
/** What reverting the app scope produces. */
|
|
101
|
+
appRevertLabel?: string;
|
|
102
|
+
/** What reverting the tenant scope produces (`null`: not computed). */
|
|
103
|
+
inheritedLabel?: string | null;
|
|
104
|
+
tenantAllowList?: string[] | null;
|
|
105
|
+
tenantBlocked?: boolean;
|
|
106
|
+
}
|
|
107
|
+
/** `auto`'s default tier (`InferenceDefaultTierSetting`). */
|
|
108
|
+
export interface InferenceDefaultTierView {
|
|
109
|
+
effectiveTier: InferenceSettingsTier;
|
|
110
|
+
supplyingLevel?: InferenceSettingsLevelView;
|
|
111
|
+
appTier?: InferenceSettingsTier | null;
|
|
112
|
+
tenantTier?: InferenceSettingsTier | null;
|
|
113
|
+
appRevertTier?: InferenceSettingsTier;
|
|
114
|
+
inheritedTier?: InferenceSettingsTier | null;
|
|
115
|
+
tenantAllowList?: string[] | null;
|
|
116
|
+
tenantBlocked?: boolean;
|
|
117
|
+
}
|
|
118
|
+
/** One candidate of an alias chain. `apiKeyEnv` names a variable; there is never a key. */
|
|
119
|
+
export interface InferenceCandidateView {
|
|
120
|
+
provider?: string;
|
|
121
|
+
model?: string;
|
|
122
|
+
baseUrl?: string;
|
|
123
|
+
apiKeyEnv?: string;
|
|
124
|
+
preset?: string;
|
|
125
|
+
alias?: string;
|
|
126
|
+
params?: Record<string, unknown>;
|
|
127
|
+
}
|
|
128
|
+
/** One alias (`InferenceAliasSetting`). */
|
|
129
|
+
export interface InferenceAliasView {
|
|
130
|
+
name: string;
|
|
131
|
+
source?: 'config' | 'app';
|
|
132
|
+
candidates: InferenceCandidateView[];
|
|
133
|
+
description?: string;
|
|
134
|
+
inConfig?: boolean;
|
|
135
|
+
}
|
|
136
|
+
/** One fusion (`InferenceFusionSetting`). */
|
|
137
|
+
export interface InferenceFusionView {
|
|
138
|
+
name: string;
|
|
139
|
+
source: 'registry' | 'config' | 'app';
|
|
140
|
+
definition: Record<string, unknown>;
|
|
141
|
+
description?: string;
|
|
142
|
+
editable?: boolean;
|
|
143
|
+
/** Lower sources this definition replaces by name (#4800). */
|
|
144
|
+
shadows?: Array<'registry' | 'config'>;
|
|
145
|
+
/** Why the executor would refuse to run it (#4800); absent when it runs. */
|
|
146
|
+
issues?: Array<{
|
|
147
|
+
path: string;
|
|
148
|
+
message: string;
|
|
149
|
+
}>;
|
|
150
|
+
}
|
|
151
|
+
/** Usage report (`reportAiUsage()`, #4751), structurally. */
|
|
152
|
+
export interface InferenceUsageView {
|
|
153
|
+
by: string[];
|
|
154
|
+
costBasis?: string;
|
|
155
|
+
/** The report window, passed on to transcript links. */
|
|
156
|
+
since?: Date | string | null;
|
|
157
|
+
until?: Date | string | null;
|
|
158
|
+
buckets: Array<{
|
|
159
|
+
key: Record<string, string | null | undefined>;
|
|
160
|
+
calls: number;
|
|
161
|
+
totalTokens: number;
|
|
162
|
+
estimatedCost: number;
|
|
163
|
+
uncostedCalls?: number;
|
|
164
|
+
outcomes?: Record<string, number>;
|
|
165
|
+
/** Calls with a stored transcript (`usage({ transcripts: true })`, #4781). */
|
|
166
|
+
transcripts?: number;
|
|
167
|
+
}>;
|
|
168
|
+
}
|
|
169
|
+
export type InferenceUsageDimension = 'model' | 'tier' | 'prompt' | 'fusion' | 'template';
|
|
170
|
+
/** The app's transcript setting values (#4781). */
|
|
171
|
+
export interface InferenceTranscriptValuesView {
|
|
172
|
+
enabled?: boolean;
|
|
173
|
+
sample?: number;
|
|
174
|
+
maxBytes?: number;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* The app's transcript setting (`getTranscriptSettings()`, #4781). App
|
|
178
|
+
* level only; tenants cannot override it. Never transcript content.
|
|
179
|
+
*/
|
|
180
|
+
export interface InferenceTranscriptSettingsView {
|
|
181
|
+
enabled: boolean;
|
|
182
|
+
sample: number;
|
|
183
|
+
maxBytes: number;
|
|
184
|
+
supplyingLevel?: 'default' | 'config' | 'app' | 'env';
|
|
185
|
+
appValue?: InferenceTranscriptValuesView | null;
|
|
186
|
+
appRevert?: {
|
|
187
|
+
enabled: boolean;
|
|
188
|
+
sample: number;
|
|
189
|
+
maxBytes: number;
|
|
190
|
+
};
|
|
191
|
+
/** `SMRT_INFERENCE_TRANSCRIPTS` forces `enabled` (`null`: unset). */
|
|
192
|
+
envEnabled?: boolean | null;
|
|
193
|
+
/** Retention sweep window in days; `null`: not pruned. Read-only. */
|
|
194
|
+
retentionDays?: number | null;
|
|
195
|
+
promptOverrides?: string[];
|
|
196
|
+
}
|
|
197
|
+
/** What saving the transcript setting emits. Always the app row; `null` reverts it. */
|
|
198
|
+
export interface InferenceTranscriptSettingsChange {
|
|
199
|
+
settings: {
|
|
200
|
+
enabled: boolean;
|
|
201
|
+
sample: number;
|
|
202
|
+
maxBytes: number;
|
|
203
|
+
} | null;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Filters a Usage-tab row hands the host's transcript route (#4781): the
|
|
207
|
+
* `listAiTranscripts()` filters a bucket can name, plus the report window.
|
|
208
|
+
*/
|
|
209
|
+
export interface InferenceTranscriptLinkFilters {
|
|
210
|
+
promptKey?: string;
|
|
211
|
+
templateHash?: string;
|
|
212
|
+
outcome?: string;
|
|
213
|
+
/** ISO timestamps of the report window. */
|
|
214
|
+
since?: string;
|
|
215
|
+
until?: string;
|
|
216
|
+
}
|
|
217
|
+
export interface InferenceTierChange {
|
|
218
|
+
tier: InferenceSettingsTier;
|
|
219
|
+
scope: InferenceSettingsScope;
|
|
220
|
+
target: InferenceTargetView | null;
|
|
221
|
+
}
|
|
222
|
+
export interface InferenceDefaultTierChange {
|
|
223
|
+
scope: InferenceSettingsScope;
|
|
224
|
+
tier: InferenceSettingsTier | null;
|
|
225
|
+
}
|
|
226
|
+
export interface InferenceAliasChange {
|
|
227
|
+
name: string;
|
|
228
|
+
/** `null` removes the app definition. */
|
|
229
|
+
candidates: InferenceCandidateView[] | null;
|
|
230
|
+
description?: string;
|
|
231
|
+
}
|
|
232
|
+
export interface InferenceFusionChange {
|
|
233
|
+
name: string;
|
|
234
|
+
/** `null` removes the config entry. */
|
|
235
|
+
definition: Record<string, unknown> | null;
|
|
236
|
+
}
|
|
237
|
+
/** Human label for a supplying level. */
|
|
238
|
+
export declare function inferenceLevelLabel(level: InferenceSettingsLevelView | undefined): string;
|
|
239
|
+
/** Key-free label of a target. Mirrors `describeInferenceTarget()` in `./server`. */
|
|
240
|
+
export declare function describeTargetView(target: InferenceTargetView | null | undefined): string;
|
|
241
|
+
/** Key-free label of a candidate (`provider/model`, `preset:<id>/model`, `alias <name>`). */
|
|
242
|
+
export declare function candidateViewLabel(candidate: InferenceCandidateView): string;
|
|
243
|
+
/** Allow-list reference of a target. Mirrors `inferenceTargetRef()` in `./server`. */
|
|
244
|
+
export declare function targetViewRef(target: InferenceTargetView): string;
|
|
245
|
+
/**
|
|
246
|
+
* Whether a reference is on an allow-list (exact, trailing `*`, or `*`).
|
|
247
|
+
* Display only: the server enforces the list on every tenant write.
|
|
248
|
+
*/
|
|
249
|
+
export declare function isRefAllowed(ref: string, allowList: readonly string[] | null | undefined): boolean;
|
|
250
|
+
/** What reverting a tier at `scope` produces (the prompts revert invariant). */
|
|
251
|
+
export declare function tierRevertPreview(row: InferenceTierView, scope: InferenceSettingsScope): string;
|
|
252
|
+
/** The tier `auto` returns to when the scope reverts. */
|
|
253
|
+
export declare function defaultTierRevertPreview(view: InferenceDefaultTierView, scope: InferenceSettingsScope): InferenceSettingsTier;
|
|
254
|
+
/**
|
|
255
|
+
* The transcript-route filters for one usage bucket (and, optionally, one
|
|
256
|
+
* outcome label): the prompt key and template hash when the report was
|
|
257
|
+
* grouped by them, and the report window.
|
|
258
|
+
*/
|
|
259
|
+
export declare function transcriptLinkFilters(view: Pick<InferenceUsageView, 'since' | 'until'>, key: Record<string, string | null | undefined>, outcome?: string): InferenceTranscriptLinkFilters;
|
|
260
|
+
/** Usage columns to render: only the dimensions the report was grouped by. */
|
|
261
|
+
export declare function usageColumns(view: InferenceUsageView): string[];
|
|
262
|
+
//#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wBAAwB,EAC9B,KAAK,EAAE,sBAAsB,GAC5B,qBAAqB,CAGvB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,OAAO,CAAC,EACjD,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,EAC9C,OAAO,CAAC,EAAE,MAAM,GACf,8BAA8B,CAoBhC;AAED,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAE/D"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Presentational types for the inference settings UI (#4754).
|
|
3
|
+
*
|
|
4
|
+
* Deliberately free of `@happyvertical/smrt-core`, the AI SDK and the
|
|
5
|
+
* `@smrt()` model, so the browser bundle stays a thin presentation layer.
|
|
6
|
+
* Field names match the rows `InferenceSettingsService` returns
|
|
7
|
+
* (`./server`), so a row is structurally assignable to its view with no
|
|
8
|
+
* mapping step.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
export const INFERENCE_SETTINGS_TIERS = [
|
|
13
|
+
'cheap',
|
|
14
|
+
'good',
|
|
15
|
+
'great',
|
|
16
|
+
'best',
|
|
17
|
+
];
|
|
18
|
+
export const INFERENCE_SETTINGS_MODES = [
|
|
19
|
+
'byo',
|
|
20
|
+
'local',
|
|
21
|
+
'hosted',
|
|
22
|
+
'off',
|
|
23
|
+
];
|
|
24
|
+
/** Human label for a supplying level. */
|
|
25
|
+
export function inferenceLevelLabel(level) {
|
|
26
|
+
switch (level) {
|
|
27
|
+
case 'tenant':
|
|
28
|
+
return 'Tenant override';
|
|
29
|
+
case 'app':
|
|
30
|
+
return 'App override';
|
|
31
|
+
case 'config':
|
|
32
|
+
return 'Config';
|
|
33
|
+
default:
|
|
34
|
+
return 'Default';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** Key-free label of a target. Mirrors `describeInferenceTarget()` in `./server`. */
|
|
38
|
+
export function describeTargetView(target) {
|
|
39
|
+
if (!target || Object.keys(target).length === 0) {
|
|
40
|
+
return 'Same as default (configured client)';
|
|
41
|
+
}
|
|
42
|
+
if (target.kind === 'fusion' || target.fusion) {
|
|
43
|
+
return `Fusion ${target.fusion ?? '?'}`;
|
|
44
|
+
}
|
|
45
|
+
if (target.alias)
|
|
46
|
+
return `Alias ${target.alias}`;
|
|
47
|
+
if (Array.isArray(target.candidates)) {
|
|
48
|
+
return `${target.candidates.length} inline candidate(s)`;
|
|
49
|
+
}
|
|
50
|
+
return `${target.provider ?? 'default'}/${target.model ?? 'default model'}`;
|
|
51
|
+
}
|
|
52
|
+
/** Key-free label of a candidate (`provider/model`, `preset:<id>/model`, `alias <name>`). */
|
|
53
|
+
export function candidateViewLabel(candidate) {
|
|
54
|
+
if (candidate.alias)
|
|
55
|
+
return `alias ${candidate.alias}`;
|
|
56
|
+
const model = candidate.model ?? 'default';
|
|
57
|
+
if (candidate.preset)
|
|
58
|
+
return `preset:${candidate.preset}/${model}`;
|
|
59
|
+
return `${candidate.provider ?? 'default'}/${model}`;
|
|
60
|
+
}
|
|
61
|
+
/** Allow-list reference of a target. Mirrors `inferenceTargetRef()` in `./server`. */
|
|
62
|
+
export function targetViewRef(target) {
|
|
63
|
+
if (target.kind === 'fusion' || target.fusion) {
|
|
64
|
+
return `fusion:${target.fusion ?? ''}`;
|
|
65
|
+
}
|
|
66
|
+
if (target.alias)
|
|
67
|
+
return `alias:${target.alias}`;
|
|
68
|
+
return `model:${target.provider ?? 'default'}/${target.model ?? 'default'}`;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Whether a reference is on an allow-list (exact, trailing `*`, or `*`).
|
|
72
|
+
* Display only: the server enforces the list on every tenant write.
|
|
73
|
+
*/
|
|
74
|
+
export function isRefAllowed(ref, allowList) {
|
|
75
|
+
return (allowList ?? []).some((pattern) => pattern === '*'
|
|
76
|
+
? true
|
|
77
|
+
: pattern.endsWith('*')
|
|
78
|
+
? ref.startsWith(pattern.slice(0, -1))
|
|
79
|
+
: ref === pattern);
|
|
80
|
+
}
|
|
81
|
+
/** What reverting a tier at `scope` produces (the prompts revert invariant). */
|
|
82
|
+
export function tierRevertPreview(row, scope) {
|
|
83
|
+
if (scope === 'app')
|
|
84
|
+
return row.appRevertLabel ?? row.effectiveLabel;
|
|
85
|
+
return row.inheritedLabel ?? row.appRevertLabel ?? row.effectiveLabel;
|
|
86
|
+
}
|
|
87
|
+
/** The tier `auto` returns to when the scope reverts. */
|
|
88
|
+
export function defaultTierRevertPreview(view, scope) {
|
|
89
|
+
if (scope === 'app')
|
|
90
|
+
return view.appRevertTier ?? view.effectiveTier;
|
|
91
|
+
return view.inheritedTier ?? view.appRevertTier ?? view.effectiveTier;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The transcript-route filters for one usage bucket (and, optionally, one
|
|
95
|
+
* outcome label): the prompt key and template hash when the report was
|
|
96
|
+
* grouped by them, and the report window.
|
|
97
|
+
*/
|
|
98
|
+
export function transcriptLinkFilters(view, key, outcome) {
|
|
99
|
+
const filters = {};
|
|
100
|
+
if (typeof key.prompt === 'string' && key.prompt) {
|
|
101
|
+
filters.promptKey = key.prompt;
|
|
102
|
+
}
|
|
103
|
+
if (typeof key.template === 'string' && key.template) {
|
|
104
|
+
filters.templateHash = key.template;
|
|
105
|
+
}
|
|
106
|
+
if (outcome)
|
|
107
|
+
filters.outcome = outcome;
|
|
108
|
+
const iso = (value) => value instanceof Date
|
|
109
|
+
? value.toISOString()
|
|
110
|
+
: typeof value === 'string' && value
|
|
111
|
+
? value
|
|
112
|
+
: undefined;
|
|
113
|
+
const since = iso(view.since);
|
|
114
|
+
const until = iso(view.until);
|
|
115
|
+
if (since)
|
|
116
|
+
filters.since = since;
|
|
117
|
+
if (until)
|
|
118
|
+
filters.until = until;
|
|
119
|
+
return filters;
|
|
120
|
+
}
|
|
121
|
+
/** Usage columns to render: only the dimensions the report was grouped by. */
|
|
122
|
+
export function usageColumns(view) {
|
|
123
|
+
return view.by.filter((dimension) => dimension.length > 0);
|
|
124
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public shapes of the chain executor (#4752). The config shapes
|
|
3
|
+
* (`InferenceCandidate`, `InferenceAlias`, `InferenceTarget`) live in core,
|
|
4
|
+
* which owns the names; this package owns the behavior.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Why a candidate did not answer. Classified from the SDK error class, its
|
|
8
|
+
* code and the HTTP status through the cause chain, never from message text.
|
|
9
|
+
*
|
|
10
|
+
* - `quota`: billing or a rate limit that will not reset soon.
|
|
11
|
+
* - `credential`: missing, rejected or unauthorized key.
|
|
12
|
+
* - `missing-model`: the provider does not know the model.
|
|
13
|
+
* - `transient`: timeout, network, 5xx, or a short rate limit; retried once.
|
|
14
|
+
* - `refusal`: the provider's safety system or the model declined.
|
|
15
|
+
* - `missing-capability`: the candidate lacks a capability the request
|
|
16
|
+
* needs (JSON mode, tools) and the caller permitted no fallback (#4758).
|
|
17
|
+
* Detected before the call, so no model ran; core's typed capability
|
|
18
|
+
* refusal classifies the same way.
|
|
19
|
+
*/
|
|
20
|
+
export declare const INFERENCE_FAILURE_CLASSES: readonly ["quota", "credential", "missing-model", "transient", "refusal", "missing-capability"];
|
|
21
|
+
export type InferenceFailureClass = (typeof INFERENCE_FAILURE_CLASSES)[number];
|
|
22
|
+
/**
|
|
23
|
+
* A substitution reason: the failure class that moved the call on, `partial`
|
|
24
|
+
* for a candidate that streamed text and then failed, or `unclassified` for
|
|
25
|
+
* the terminal entry of a call ended by an error that is not a routing
|
|
26
|
+
* failure (rethrown as the caller's own error).
|
|
27
|
+
*/
|
|
28
|
+
export type InferenceSubstitutionReason = InferenceFailureClass | 'partial' | 'unclassified';
|
|
29
|
+
/**
|
|
30
|
+
* One step of a call's fallback trail, recorded in the `substitutions` usage
|
|
31
|
+
* tag (a JSON array). `from` and `to` are candidate labels
|
|
32
|
+
* (`provider/model`, `preset:<id>/model`, or `default` for the configured
|
|
33
|
+
* client); `to` is `null` when nothing took over.
|
|
34
|
+
*/
|
|
35
|
+
export interface InferenceSubstitution {
|
|
36
|
+
from: string;
|
|
37
|
+
to: string | null;
|
|
38
|
+
reason: InferenceSubstitutionReason;
|
|
39
|
+
}
|
|
40
|
+
/** One problem found in an `inference` config block. */
|
|
41
|
+
export interface InferenceConfigIssue {
|
|
42
|
+
/** Dotted config path of the offender, e.g. `inference.aliases.frontier`. */
|
|
43
|
+
path: string;
|
|
44
|
+
code: 'alias-empty' | 'alias-unknown' | 'alias-cycle' | 'candidate-invalid' | 'candidate-key-without-endpoint' | 'preset-unknown' | 'fusion-invalid' | 'fusion-unknown' | 'fusion-nested' | 'fusion-prompt-unknown';
|
|
45
|
+
message: string;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,iGAO5B,CAAC;AAEX,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/E;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GACnC,qBAAqB,GACrB,SAAS,GACT,cAAc,CAAC;AAEnB;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,MAAM,EAAE,2BAA2B,CAAC;CACrC;AAED,wDAAwD;AACxD,MAAM,WAAW,oBAAoB;IACnC,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EACA,aAAa,GACb,eAAe,GACf,aAAa,GACb,mBAAmB,GACnB,gCAAgC,GAChC,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,GAChB,eAAe,GACf,uBAAuB,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/types.ts
|
|
2
|
+
var INFERENCE_FAILURE_CLASSES = [
|
|
3
|
+
"quota",
|
|
4
|
+
"credential",
|
|
5
|
+
"missing-model",
|
|
6
|
+
"transient",
|
|
7
|
+
"refusal",
|
|
8
|
+
"missing-capability"
|
|
9
|
+
];
|
|
10
|
+
//#endregion
|
|
11
|
+
export { INFERENCE_FAILURE_CLASSES };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["/**\n * Public shapes of the chain executor (#4752). The config shapes\n * (`InferenceCandidate`, `InferenceAlias`, `InferenceTarget`) live in core,\n * which owns the names; this package owns the behavior.\n */\n\n/**\n * Why a candidate did not answer. Classified from the SDK error class, its\n * code and the HTTP status through the cause chain, never from message text.\n *\n * - `quota`: billing or a rate limit that will not reset soon.\n * - `credential`: missing, rejected or unauthorized key.\n * - `missing-model`: the provider does not know the model.\n * - `transient`: timeout, network, 5xx, or a short rate limit; retried once.\n * - `refusal`: the provider's safety system or the model declined.\n * - `missing-capability`: the candidate lacks a capability the request\n * needs (JSON mode, tools) and the caller permitted no fallback (#4758).\n * Detected before the call, so no model ran; core's typed capability\n * refusal classifies the same way.\n */\nexport const INFERENCE_FAILURE_CLASSES = [\n 'quota',\n 'credential',\n 'missing-model',\n 'transient',\n 'refusal',\n 'missing-capability',\n] as const;\n\nexport type InferenceFailureClass = (typeof INFERENCE_FAILURE_CLASSES)[number];\n\n/**\n * A substitution reason: the failure class that moved the call on, `partial`\n * for a candidate that streamed text and then failed, or `unclassified` for\n * the terminal entry of a call ended by an error that is not a routing\n * failure (rethrown as the caller's own error).\n */\nexport type InferenceSubstitutionReason =\n | InferenceFailureClass\n | 'partial'\n | 'unclassified';\n\n/**\n * One step of a call's fallback trail, recorded in the `substitutions` usage\n * tag (a JSON array). `from` and `to` are candidate labels\n * (`provider/model`, `preset:<id>/model`, or `default` for the configured\n * client); `to` is `null` when nothing took over.\n */\nexport interface InferenceSubstitution {\n from: string;\n to: string | null;\n reason: InferenceSubstitutionReason;\n}\n\n/** One problem found in an `inference` config block. */\nexport interface InferenceConfigIssue {\n /** Dotted config path of the offender, e.g. `inference.aliases.frontier`. */\n path: string;\n code:\n | 'alias-empty'\n | 'alias-unknown'\n | 'alias-cycle'\n | 'candidate-invalid'\n | 'candidate-key-without-endpoint'\n | 'preset-unknown'\n | 'fusion-invalid'\n | 'fusion-unknown'\n | 'fusion-nested'\n | 'fusion-prompt-unknown';\n message: string;\n}\n"],"mappings":";AAoBO,IAAM,4BAA4B;CACvC;CACA;CACA;CACA;CACA;CACA;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,108 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-inference",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.60.16",
|
|
4
|
+
"description": "Inference alias chains with classified failures, recorded fallback and ladder degradation, consumer-defined fusions, per-user and per-tenant bindings, the InferenceSettingsPanel, hosted provisioning and spend gate, and the smrt doctor --ai binding check, for SMRT inference tiers",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"CLAUDE.md",
|
|
11
|
+
"AGENTS.md",
|
|
12
|
+
"agents"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./node": {
|
|
20
|
+
"types": "./dist/node.d.ts",
|
|
21
|
+
"import": "./dist/node.js"
|
|
22
|
+
},
|
|
23
|
+
"./resolver": {
|
|
24
|
+
"types": "./dist/resolver.d.ts",
|
|
25
|
+
"import": "./dist/resolver.js"
|
|
26
|
+
},
|
|
27
|
+
"./models": {
|
|
28
|
+
"types": "./dist/models.d.ts",
|
|
29
|
+
"import": "./dist/models.js"
|
|
30
|
+
},
|
|
31
|
+
"./server": {
|
|
32
|
+
"types": "./dist/server.d.ts",
|
|
33
|
+
"import": "./dist/server.js"
|
|
34
|
+
},
|
|
35
|
+
"./svelte": {
|
|
36
|
+
"types": "./dist/svelte/index.d.ts",
|
|
37
|
+
"svelte": "./dist/svelte/index.js",
|
|
38
|
+
"import": "./dist/svelte/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./manifest": "./dist/manifest.json",
|
|
41
|
+
"./manifest.json": "./dist/manifest.json",
|
|
42
|
+
"./gate": {
|
|
43
|
+
"types": "./dist/gate.d.ts",
|
|
44
|
+
"import": "./dist/gate.js"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@happyvertical/ai": "^0.111.8",
|
|
49
|
+
"@happyvertical/smrt-config": "0.60.16",
|
|
50
|
+
"@happyvertical/smrt-core": "0.60.16",
|
|
51
|
+
"@happyvertical/smrt-prompts": "0.60.16",
|
|
52
|
+
"@happyvertical/smrt-secrets": "0.60.16",
|
|
53
|
+
"@happyvertical/smrt-tenancy": "0.60.16",
|
|
54
|
+
"@happyvertical/smrt-users": "0.60.16",
|
|
55
|
+
"@happyvertical/sql": "^0.111.8"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@happyvertical/smrt-vitest": "0.60.16",
|
|
59
|
+
"@sveltejs/package": "^2.5.8",
|
|
60
|
+
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|
|
61
|
+
"@types/node": "24.13.6",
|
|
62
|
+
"jsdom": "^29.1.1",
|
|
63
|
+
"svelte": "^5.57.1",
|
|
64
|
+
"svelte-check": "^4.7.6",
|
|
65
|
+
"typescript": "6.0.3",
|
|
66
|
+
"vite": "8.1.6",
|
|
67
|
+
"vitest": "4.1.10"
|
|
68
|
+
},
|
|
69
|
+
"peerDependencies": {
|
|
70
|
+
"svelte": "^5.57.0"
|
|
71
|
+
},
|
|
72
|
+
"peerDependenciesMeta": {
|
|
73
|
+
"svelte": {
|
|
74
|
+
"optional": true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"keywords": [
|
|
78
|
+
"smrt",
|
|
79
|
+
"ai",
|
|
80
|
+
"inference",
|
|
81
|
+
"fallback",
|
|
82
|
+
"routing",
|
|
83
|
+
"settings",
|
|
84
|
+
"svelte"
|
|
85
|
+
],
|
|
86
|
+
"author": "HappyVertical",
|
|
87
|
+
"license": "MIT",
|
|
88
|
+
"publishConfig": {
|
|
89
|
+
"registry": "https://registry.npmjs.org",
|
|
90
|
+
"access": "public"
|
|
91
|
+
},
|
|
92
|
+
"repository": {
|
|
93
|
+
"type": "git",
|
|
94
|
+
"url": "https://github.com/happyvertical/smrt.git",
|
|
95
|
+
"directory": "packages/inference"
|
|
96
|
+
},
|
|
97
|
+
"scripts": {
|
|
98
|
+
"build": "vite build --mode library && svelte-package -i src/svelte -o dist/svelte --tsconfig tsconfig.svelte.json && node ../../scripts/prune-svelte-package-artifacts.js dist/svelte",
|
|
99
|
+
"build:watch": "vite build --mode library --watch",
|
|
100
|
+
"clean": "rm -rf dist",
|
|
101
|
+
"dev": "vite dev",
|
|
102
|
+
"test": "vitest run",
|
|
103
|
+
"test:postgres": "node ../../scripts/run-with-ci-postgres.mjs -- pnpm exec vitest run optional.test.ts",
|
|
104
|
+
"test:watch": "vitest",
|
|
105
|
+
"typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.test.json && node ../../scripts/svelte-check-a11y.mjs --tsconfig ./tsconfig.svelte.json",
|
|
106
|
+
"verify:pack": "node ../../scripts/verify-package-types-exports.js ."
|
|
107
|
+
}
|
|
6
108
|
}
|