@vibesdotdev/integrations-omlx 0.0.0-stage → 1.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +126 -0
- package/README.md +14 -2
- package/dist/ai/index.d.ts +5 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +5 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/provider.plugin.d.ts +6 -0
- package/dist/ai/provider.plugin.d.ts.map +1 -0
- package/dist/ai/provider.plugin.js +88 -0
- package/dist/ai/provider.plugin.js.map +1 -0
- package/dist/ai/providers/local/llm/omlx/config/config.omlx.descriptor.d.ts +4194 -0
- package/dist/ai/providers/local/llm/omlx/config/config.omlx.descriptor.d.ts.map +1 -0
- package/dist/ai/providers/local/llm/omlx/config/config.omlx.descriptor.js +53 -0
- package/dist/ai/providers/local/llm/omlx/config/config.omlx.descriptor.js.map +1 -0
- package/dist/ai/providers/local/llm/omlx/config/schemas/index.d.ts +67 -0
- package/dist/ai/providers/local/llm/omlx/config/schemas/index.d.ts.map +1 -0
- package/dist/ai/providers/local/llm/omlx/config/schemas/index.js +39 -0
- package/dist/ai/providers/local/llm/omlx/config/schemas/index.js.map +1 -0
- package/dist/ai/providers/local/llm/omlx/index.d.ts +6 -0
- package/dist/ai/providers/local/llm/omlx/index.d.ts.map +1 -0
- package/dist/ai/providers/local/llm/omlx/index.js +5 -0
- package/dist/ai/providers/local/llm/omlx/index.js.map +1 -0
- package/dist/ai/providers/local/llm/omlx/model-ids.d.ts +19 -0
- package/dist/ai/providers/local/llm/omlx/model-ids.d.ts.map +1 -0
- package/dist/ai/providers/local/llm/omlx/model-ids.js +60 -0
- package/dist/ai/providers/local/llm/omlx/model-ids.js.map +1 -0
- package/dist/ai/providers/local/llm/omlx/provider.omlx.descriptor.d.ts +197 -0
- package/dist/ai/providers/local/llm/omlx/provider.omlx.descriptor.d.ts.map +1 -0
- package/dist/ai/providers/local/llm/omlx/provider.omlx.descriptor.js +177 -0
- package/dist/ai/providers/local/llm/omlx/provider.omlx.descriptor.js.map +1 -0
- package/dist/ai/providers/omlx/detection/index.d.ts +3 -0
- package/dist/ai/providers/omlx/detection/index.d.ts.map +1 -0
- package/dist/ai/providers/omlx/detection/index.js +2 -0
- package/dist/ai/providers/omlx/detection/index.js.map +1 -0
- package/dist/ai/providers/omlx/detection/system.d.ts +19 -0
- package/dist/ai/providers/omlx/detection/system.d.ts.map +1 -0
- package/dist/ai/providers/omlx/detection/system.js +64 -0
- package/dist/ai/providers/omlx/detection/system.js.map +1 -0
- package/dist/ai/providers/omlx/docs/ai.providers.omlx.docs.descriptor.d.ts +4 -0
- package/dist/ai/providers/omlx/docs/ai.providers.omlx.docs.descriptor.d.ts.map +1 -0
- package/dist/ai/providers/omlx/docs/ai.providers.omlx.docs.descriptor.js +39 -0
- package/dist/ai/providers/omlx/docs/ai.providers.omlx.docs.descriptor.js.map +1 -0
- package/dist/ai/providers/omlx/index.d.ts +6 -0
- package/dist/ai/providers/omlx/index.d.ts.map +1 -0
- package/dist/ai/providers/omlx/index.js +6 -0
- package/dist/ai/providers/omlx/index.js.map +1 -0
- package/dist/ai/providers/omlx/omlx.models.d.ts +20 -0
- package/dist/ai/providers/omlx/omlx.models.d.ts.map +1 -0
- package/dist/ai/providers/omlx/omlx.models.js +141 -0
- package/dist/ai/providers/omlx/omlx.models.js.map +1 -0
- package/dist/ai/providers/omlx/omlx.provider.impl.d.ts +54 -0
- package/dist/ai/providers/omlx/omlx.provider.impl.d.ts.map +1 -0
- package/dist/ai/providers/omlx/omlx.provider.impl.js +305 -0
- package/dist/ai/providers/omlx/omlx.provider.impl.js.map +1 -0
- package/dist/ai/providers/omlx/recommendations.d.ts +23 -0
- package/dist/ai/providers/omlx/recommendations.d.ts.map +1 -0
- package/dist/ai/providers/omlx/recommendations.js +111 -0
- package/dist/ai/providers/omlx/recommendations.js.map +1 -0
- package/dist/config/omlx.config.descriptor.d.ts +60 -0
- package/dist/config/omlx.config.descriptor.d.ts.map +1 -0
- package/dist/config/omlx.config.descriptor.js +47 -0
- package/dist/config/omlx.config.descriptor.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/discovery.d.ts +130 -0
- package/dist/schemas/discovery.d.ts.map +1 -0
- package/dist/schemas/discovery.js +51 -0
- package/dist/schemas/discovery.js.map +1 -0
- package/dist/schemas/settings.d.ts +11 -0
- package/dist/schemas/settings.d.ts.map +1 -0
- package/dist/schemas/settings.js +9 -0
- package/dist/schemas/settings.js.map +1 -0
- package/package.json +74 -4
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* oMLX provider type descriptor.
|
|
3
|
+
*
|
|
4
|
+
* Pure data: catalogs are read over HTTP via listModels, not a directory scan.
|
|
5
|
+
*
|
|
6
|
+
* oMLX 0.6+ serves OpenAI-compatible `/v1/chat/completions`, Anthropic
|
|
7
|
+
* `/v1/messages`, embeddings, transcription, and TTS on the same local origin.
|
|
8
|
+
* Wire specs are owned elsewhere; this descriptor only references their ids.
|
|
9
|
+
*
|
|
10
|
+
* AUTH: oMLX enforces an API key when `~/.omlx/api-key` exists and is open
|
|
11
|
+
* otherwise, so every endpoint is declared twice. The `auth:api-key` twin
|
|
12
|
+
* uses bearer auth and outranks its open sibling; the runtime's connection
|
|
13
|
+
* filter (`filterProviderVariantsForConnection`) drops `auth:*`-tagged
|
|
14
|
+
* variants when the connection carries no `apiKey`, so a keyless connection
|
|
15
|
+
* sends no Authorization header and a keyed one always does. The bearer
|
|
16
|
+
* token reference is replaced by the connection's own `apiKey` reference at
|
|
17
|
+
* assembly time; `OMLX_API_KEY` is only the documented default secret name.
|
|
18
|
+
*
|
|
19
|
+
* MODEL ID MAPPING: `mapModelId()` looks up the full canonical catalog id in
|
|
20
|
+
* `modelMap` for `explicit` rules, then the stripped catalog id, then strips
|
|
21
|
+
* `omlx:`. Nicknames such as `qwen3.8-flash-next-oq8` are pinned to live
|
|
22
|
+
* server ids; unmapped live ids pass through after the prefix is dropped.
|
|
23
|
+
*/
|
|
24
|
+
import { createAIProviderTypeDescriptor } from '@vibesdotdev/ai/providers-runtime/core/type-descriptor';
|
|
25
|
+
import { DEFAULT_OMLX_API_KEY_SECRET, DEFAULT_OMLX_BASE_URL, DEFAULT_OMLX_TIMEOUT_MS, omlxConnectionSchema } from "./config/schemas/index.js";
|
|
26
|
+
import { DEFAULT_OMLX_MODEL_ID, OMLX_MODEL_MAP, OMLX_PREFERRED_WIRE_IDS } from "./model-ids.js";
|
|
27
|
+
const modelIdRule = { kind: 'explicit', modelMap: OMLX_MODEL_MAP };
|
|
28
|
+
/** Auth method ids; the variant tag `auth:<id>` must match. */
|
|
29
|
+
export const OMLX_AUTH_METHOD_NONE = 'none';
|
|
30
|
+
export const OMLX_AUTH_METHOD_API_KEY = 'api-key';
|
|
31
|
+
/** Bearer twins must outrank their open siblings for the same modality. */
|
|
32
|
+
export const OMLX_API_KEY_VARIANT_PRIORITY_BOOST = 100;
|
|
33
|
+
const OMLX_API_KEY_AUTH = {
|
|
34
|
+
kind: 'bearer',
|
|
35
|
+
token: { source: 'secret', key: DEFAULT_OMLX_API_KEY_SECRET }
|
|
36
|
+
};
|
|
37
|
+
const OMLX_ENDPOINTS = [
|
|
38
|
+
{
|
|
39
|
+
id: 'openai-chat',
|
|
40
|
+
label: 'oMLX OpenAI-compatible',
|
|
41
|
+
description: 'oMLX /v1/chat/completions endpoint on the configured local host.',
|
|
42
|
+
specId: 'openai-chat',
|
|
43
|
+
modalities: ['text'],
|
|
44
|
+
priority: 10
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: 'openai-evaluation',
|
|
48
|
+
label: 'oMLX Evaluation (JSON-mode)',
|
|
49
|
+
description: 'Adapted structured evaluation over the local /v1/chat/completions endpoint: same batteries as native Jev, answers tagged adapted. Same wire shape as openai-chat plus the evaluation judge prompt and json_schema response format.',
|
|
50
|
+
specId: 'openai-evaluation',
|
|
51
|
+
modalities: ['evaluation'],
|
|
52
|
+
priority: 9
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'anthropic-messages',
|
|
56
|
+
label: 'oMLX Anthropic-compatible',
|
|
57
|
+
description: 'oMLX /v1/messages endpoint on the configured local host.',
|
|
58
|
+
specId: 'anthropic-messages',
|
|
59
|
+
modalities: ['text'],
|
|
60
|
+
priority: 5
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 'openai-embedding',
|
|
64
|
+
label: 'oMLX embeddings',
|
|
65
|
+
description: 'oMLX /v1/embeddings endpoint on the configured local host.',
|
|
66
|
+
specId: 'openai-embedding',
|
|
67
|
+
modalities: ['embedding'],
|
|
68
|
+
priority: 4
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 'openai-transcription',
|
|
72
|
+
label: 'oMLX transcription',
|
|
73
|
+
description: 'oMLX /v1/audio/transcriptions endpoint on the configured local host.',
|
|
74
|
+
specId: 'openai-transcription',
|
|
75
|
+
modalities: ['transcription'],
|
|
76
|
+
priority: 3
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: 'openai-tts',
|
|
80
|
+
label: 'oMLX text-to-speech',
|
|
81
|
+
description: 'oMLX /v1/audio/speech endpoint on the configured local host.',
|
|
82
|
+
specId: 'openai-tts',
|
|
83
|
+
modalities: ['audio'],
|
|
84
|
+
priority: 2
|
|
85
|
+
}
|
|
86
|
+
];
|
|
87
|
+
const omlxProviderTypeDescriptor = createAIProviderTypeDescriptor({
|
|
88
|
+
id: 'omlx',
|
|
89
|
+
version: '0.1.0-rc.0',
|
|
90
|
+
name: 'oMLX',
|
|
91
|
+
description: 'Local MLX-based desktop LLM server with an OpenAI-compatible HTTP API and an Anthropic Messages-compatible endpoint. Discover running models on consumer hardware; catalogs come from the server, not a filesystem scan.',
|
|
92
|
+
connectionSchema: omlxConnectionSchema,
|
|
93
|
+
defaults: {
|
|
94
|
+
baseUrl: DEFAULT_OMLX_BASE_URL,
|
|
95
|
+
timeout: DEFAULT_OMLX_TIMEOUT_MS,
|
|
96
|
+
defaultModel: DEFAULT_OMLX_MODEL_ID,
|
|
97
|
+
preferredModelIds: [...OMLX_PREFERRED_WIRE_IDS]
|
|
98
|
+
},
|
|
99
|
+
capabilities: {
|
|
100
|
+
modalities: ['text', 'image', 'evaluation', 'embedding', 'transcription', 'audio'],
|
|
101
|
+
authType: 'none',
|
|
102
|
+
authMethods: [
|
|
103
|
+
{
|
|
104
|
+
id: OMLX_AUTH_METHOD_NONE,
|
|
105
|
+
type: 'none',
|
|
106
|
+
label: 'No authentication',
|
|
107
|
+
description: 'Open local oMLX server without ~/.omlx/api-key.',
|
|
108
|
+
tokenSource: 'none',
|
|
109
|
+
credentialFields: [],
|
|
110
|
+
recommended: true,
|
|
111
|
+
enabled: true
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: OMLX_AUTH_METHOD_API_KEY,
|
|
115
|
+
type: 'bearer',
|
|
116
|
+
label: 'API key',
|
|
117
|
+
description: 'oMLX server API key (~/.omlx/api-key) stored with vibes secrets and referenced as apiKey; never inline.',
|
|
118
|
+
tokenSource: 'credential',
|
|
119
|
+
credentialFields: ['apiKey'],
|
|
120
|
+
enabled: true
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
streaming: true,
|
|
124
|
+
tools: true,
|
|
125
|
+
vision: true,
|
|
126
|
+
jsonMode: true,
|
|
127
|
+
functionCalling: true
|
|
128
|
+
},
|
|
129
|
+
category: 'local',
|
|
130
|
+
hardware: ['consumer'],
|
|
131
|
+
icon: '⚡',
|
|
132
|
+
priority: 90,
|
|
133
|
+
enabled: true,
|
|
134
|
+
tags: ['local', 'openai-compatible', 'anthropic-compatible', 'consumer', 'desktop', 'mlx'],
|
|
135
|
+
variants: OMLX_ENDPOINTS.flatMap((endpoint) => [
|
|
136
|
+
{
|
|
137
|
+
id: `${endpoint.id}-${OMLX_AUTH_METHOD_API_KEY}`,
|
|
138
|
+
label: `${endpoint.label} (API key)`,
|
|
139
|
+
description: `${endpoint.description} Sends the connection's apiKey as a bearer token.`,
|
|
140
|
+
transport: 'fetch',
|
|
141
|
+
specId: endpoint.specId,
|
|
142
|
+
modalities: endpoint.modalities,
|
|
143
|
+
endpoint: '{baseUrl}',
|
|
144
|
+
authMethodId: OMLX_AUTH_METHOD_API_KEY,
|
|
145
|
+
auth: OMLX_API_KEY_AUTH,
|
|
146
|
+
modelIdRule,
|
|
147
|
+
priority: endpoint.priority + OMLX_API_KEY_VARIANT_PRIORITY_BOOST,
|
|
148
|
+
enabled: true,
|
|
149
|
+
tags: [`auth:${OMLX_AUTH_METHOD_API_KEY}`]
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: endpoint.id,
|
|
153
|
+
label: endpoint.label,
|
|
154
|
+
description: endpoint.description,
|
|
155
|
+
transport: 'fetch',
|
|
156
|
+
specId: endpoint.specId,
|
|
157
|
+
modalities: endpoint.modalities,
|
|
158
|
+
endpoint: '{baseUrl}',
|
|
159
|
+
authMethodId: OMLX_AUTH_METHOD_NONE,
|
|
160
|
+
auth: { kind: 'none' },
|
|
161
|
+
modelIdRule,
|
|
162
|
+
priority: endpoint.priority,
|
|
163
|
+
enabled: true
|
|
164
|
+
}
|
|
165
|
+
])
|
|
166
|
+
});
|
|
167
|
+
export default Object.assign(omlxProviderTypeDescriptor, {
|
|
168
|
+
loadedModels: {
|
|
169
|
+
path: '/admin/api/models',
|
|
170
|
+
loginPath: '/admin/api/login',
|
|
171
|
+
loginKeyField: 'api_key',
|
|
172
|
+
listPath: 'models',
|
|
173
|
+
idField: 'id',
|
|
174
|
+
loadedField: 'loaded'
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
//# sourceMappingURL=provider.omlx.descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.omlx.descriptor.js","sourceRoot":"","sources":["../../../../../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,CAAC,EAAE;YACf,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,WAAW,EAAE,QAAQ,CAAC,WAAW;YACjC,SAAS,EAAE,OAAgB;YAC3B,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,QAAQ,EAAE,WAAW;YACrB,YAAY,EAAE,qBAAqB;YACnC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAe,EAAE;YAC/B,WAAW;YACX,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,OAAO,EAAE,IAAI;SACb;KACD,CAAC;CACF,CAAC,CAAC;AACH,eAAe,MAAM,CAAC,MAAM,CAAC,0BAA0B,EAAE;IACxD,YAAY,EAAE;QACb,IAAI,EAAE,mBAAmB;QACzB,SAAS,EAAE,kBAAkB;QAC7B,aAAa,EAAE,SAAS;QACxB,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,QAAQ;KACrB;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ai/providers/omlx/detection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC5E,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ai/providers/omlx/detection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type RuntimeRef } from '@vibesdotdev/kernel';
|
|
2
|
+
import type { DetectedProvider } from '@vibesdotdev/ai/providers-runtime/client/types';
|
|
3
|
+
import { type OmlxDiscoveryRuntime, type OmlxModelServices, type OmlxModelsProbe, type OmlxRequestAuth } from '../omlx.models.ts';
|
|
4
|
+
export interface OmlxDetectionServices {
|
|
5
|
+
probe(baseUrl: string, timeoutMs: number, auth?: OmlxRequestAuth): Promise<OmlxModelsProbe>;
|
|
6
|
+
}
|
|
7
|
+
export declare function createOmlxDetectionServices(runtime: OmlxDiscoveryRuntime, services?: OmlxModelServices): OmlxDetectionServices;
|
|
8
|
+
export { OmlxDetectionConfigSchema } from '../../../../schemas/settings.ts';
|
|
9
|
+
/**
|
|
10
|
+
* System detection has no connection to read a credential reference from, so
|
|
11
|
+
* it resolves `OMLX_API_KEY` through the supplied runtime credential authority. The value is only ever sent as a request header;
|
|
12
|
+
* the detected configuration carries an secret reference, never the value.
|
|
13
|
+
*
|
|
14
|
+
* A server that answers 401 is RUNNING — it is reported as such with an empty
|
|
15
|
+
* model list and a description naming the missing key, instead of being
|
|
16
|
+
* mistaken for a stopped server.
|
|
17
|
+
*/
|
|
18
|
+
export declare function detectOmlxSystem(runtime: RuntimeRef, services?: OmlxDetectionServices): Promise<DetectedProvider | null>;
|
|
19
|
+
//# sourceMappingURL=system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../../src/ai/providers/omlx/detection/system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAIzF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAKvF,OAAO,EAGN,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,qBAAqB;IACrC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAC5F;AAED,wBAAgB,2BAA2B,CAC1C,OAAO,EAAE,oBAAoB,EAC7B,QAAQ,CAAC,EAAE,iBAAiB,GAC1B,qBAAqB,CAIvB;AAGD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAE5E;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CACrC,OAAO,EAAE,UAAU,EACnB,QAAQ,GAAE,qBAA4D,GACpE,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAsClC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { CapabilityError, readPluginConfig } from '@vibesdotdev/kernel';
|
|
2
|
+
import { OmlxDetectionConfigSchema } from "../../../../schemas/settings.js";
|
|
3
|
+
import { loadOmlxSettings } from "../../../../config/omlx.config.descriptor.js";
|
|
4
|
+
import { omlxConnectionSchema } from "../../local/llm/omlx/config/schemas/index.js";
|
|
5
|
+
import { DEFAULT_OMLX_API_KEY_SECRET, OMLX_DISCOVERY_TIMEOUT_MS } from "../../local/llm/omlx/config/schemas/index.js";
|
|
6
|
+
import { describeOmlxProbeFailure, probeOmlxModels } from "../omlx.models.js";
|
|
7
|
+
export function createOmlxDetectionServices(runtime, services) {
|
|
8
|
+
return {
|
|
9
|
+
probe: (baseUrl, timeoutMs, auth) => probeOmlxModels(runtime, baseUrl, services, timeoutMs, auth)
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
const OMLX_DETECTED_NAME = 'oMLX (Local)';
|
|
13
|
+
export { OmlxDetectionConfigSchema } from "../../../../schemas/settings.js";
|
|
14
|
+
/**
|
|
15
|
+
* System detection has no connection to read a credential reference from, so
|
|
16
|
+
* it resolves `OMLX_API_KEY` through the supplied runtime credential authority. The value is only ever sent as a request header;
|
|
17
|
+
* the detected configuration carries an secret reference, never the value.
|
|
18
|
+
*
|
|
19
|
+
* A server that answers 401 is RUNNING — it is reported as such with an empty
|
|
20
|
+
* model list and a description naming the missing key, instead of being
|
|
21
|
+
* mistaken for a stopped server.
|
|
22
|
+
*/
|
|
23
|
+
export async function detectOmlxSystem(runtime, services = createOmlxDetectionServices(runtime)) {
|
|
24
|
+
const config = await readPluginConfig(runtime, 'integrations-omlx/ai', OmlxDetectionConfigSchema);
|
|
25
|
+
const settings = await loadOmlxSettings(runtime);
|
|
26
|
+
const baseUrl = (config?.baseUrl ?? settings.baseUrl).replace(/\/$/, '');
|
|
27
|
+
const credential = await runtime.resolveCredential({ source: 'secret', key: DEFAULT_OMLX_API_KEY_SECRET });
|
|
28
|
+
if (!credential.ok && credential.error.reason !== 'credential-not-set')
|
|
29
|
+
throw credential.error;
|
|
30
|
+
const apiKey = credential.ok ? credential.value : undefined;
|
|
31
|
+
const auth = apiKey ? { apiKey } : undefined;
|
|
32
|
+
const probe = await services.probe(baseUrl, OMLX_DISCOVERY_TIMEOUT_MS, auth);
|
|
33
|
+
const configuration = omlxConnectionSchema.parse({ baseUrl, timeout: settings.timeoutMs });
|
|
34
|
+
if (auth) {
|
|
35
|
+
configuration.apiKey = { source: 'secret', key: DEFAULT_OMLX_API_KEY_SECRET };
|
|
36
|
+
configuration.authType = 'bearer';
|
|
37
|
+
}
|
|
38
|
+
if (probe.ok) {
|
|
39
|
+
return {
|
|
40
|
+
providerType: 'omlx',
|
|
41
|
+
name: OMLX_DETECTED_NAME,
|
|
42
|
+
description: 'Local oMLX desktop runtime',
|
|
43
|
+
status: 'running',
|
|
44
|
+
models: probe.models.map((model) => model.id),
|
|
45
|
+
configuration
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (probe.reason === 'unauthorized') {
|
|
49
|
+
return {
|
|
50
|
+
providerType: 'omlx',
|
|
51
|
+
name: OMLX_DETECTED_NAME,
|
|
52
|
+
description: describeOmlxProbeFailure(probe, baseUrl, auth !== undefined),
|
|
53
|
+
status: 'running',
|
|
54
|
+
models: [],
|
|
55
|
+
configuration
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (probe.reason === 'unreachable')
|
|
59
|
+
return null;
|
|
60
|
+
throw new CapabilityError('oMLX detection catalog probe failed', 'UNAVAILABLE', {
|
|
61
|
+
reason: `omlx-catalog-${probe.reason}`, cause: probe.cause
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../../../../src/ai/providers/omlx/detection/system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAmB,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AAEpF,OAAO,EACN,2BAA2B,EAC3B,yBAAyB,EACzB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACN,wBAAwB,EACxB,eAAe,EAKf,MAAM,mBAAmB,CAAC;AAM3B,MAAM,UAAU,2BAA2B,CAC1C,OAA6B,EAC7B,QAA4B;IAE5B,OAAO;QACN,KAAK,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC;KACjG,CAAC;AACH,CAAC;AAED,MAAM,kBAAkB,GAAG,cAAc,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAE5E;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,OAAmB,EACnB,WAAkC,2BAA2B,CAAC,OAAO,CAAC;IAEtE,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,CAAC,CAAC;IAClG,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACjD,MAAM,OA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YAC7C,aAAa;SACb,CAAC;IACH,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,cAAc,EAAE,CAAC;QACrC,OAAO;YACN,YAAY,EAAE,MAAM;YACpB,IAAI,EAAE,kBAAkB;YACxB,WAAW,EAAE,wBAAwB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,KAAK,SAAS,CAAC;YACzE,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,EAAE;YACV,aAAa;SACb,CAAC;IACH,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,aAAa;QAAE,OAAO,IAAI,CAAC;IAChD,MAAM,IAAI,eAAe,CAAC,qCAAqC,EAAE,aAAa,EAAE;QAC/E,MAAM,EAAE,gBAAgB,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK;KAC1D,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.providers.omlx.docs.descriptor.d.ts","sourceRoot":"","sources":["../../../../../src/ai/providers/omlx/docs/ai.providers.omlx.docs.descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,QAAA,MAAM,UAAU,EAAE,mBAoCjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const descriptor = {
|
|
2
|
+
kind: 'docs/topic',
|
|
3
|
+
id: 'ai.providers.omlx',
|
|
4
|
+
title: 'oMLX provider',
|
|
5
|
+
summary: 'Discover locally served oMLX models over a bounded HTTP probe.',
|
|
6
|
+
body: {
|
|
7
|
+
type: 'markdown',
|
|
8
|
+
sourceType: 'raw',
|
|
9
|
+
source: `# oMLX provider
|
|
10
|
+
|
|
11
|
+
\`@vibesdotdev/integrations-omlx\` owns the consumer-scoped oMLX provider.
|
|
12
|
+
Descriptors are pure data. Local discovery uses \`fetch\` with a 2s timeout against
|
|
13
|
+
\`/v1/models\` and never returns secret material. Health uses \`GET /health\`.
|
|
14
|
+
Model readiness is read from \`GET /v1/models/status\` (\`loaded\` / \`is_loading\`),
|
|
15
|
+
not LM Studio's \`/api/v0/models\` path.
|
|
16
|
+
|
|
17
|
+
Preferred dogfood models, in order: \`Qwen3.8-Flash-Next-oQ8\`,
|
|
18
|
+
\`Qwen3.5-0.8B-MLX-8bit\`.
|
|
19
|
+
|
|
20
|
+
Generation resolves \`ai/generation\`; the host selects the external \`openai-chat\`
|
|
21
|
+
spec from the AI owner by default, with structured evaluation, \`anthropic-messages\`, embeddings, transcription, and TTS
|
|
22
|
+
variants available on the same local origin.
|
|
23
|
+
|
|
24
|
+
Configure \`integrations.omlx.baseUrl\` through runtime config; connection settings
|
|
25
|
+
override it. \`OMLX_BASE_URL\` is not read. API keys are runtime secret references,
|
|
26
|
+
never inline values. Catalog failures cannot report healthy; 404/405 readiness
|
|
27
|
+
responses fall back to catalog rows with unknown state. Fetch and body consumption
|
|
28
|
+
share a lifecycle deadline.
|
|
29
|
+
`
|
|
30
|
+
},
|
|
31
|
+
tags: ['ai', 'providers', 'omlx', 'local'],
|
|
32
|
+
parent: 'ai.providers',
|
|
33
|
+
order: 23,
|
|
34
|
+
surfaces: ['cli', 'web', 'in-app'],
|
|
35
|
+
hardware: ['consumer'],
|
|
36
|
+
enabled: true
|
|
37
|
+
};
|
|
38
|
+
export default descriptor;
|
|
39
|
+
//# sourceMappingURL=ai.providers.omlx.docs.descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.providers.omlx.docs.descriptor.js","sourceRoot":"","sources":["../../../../../src/ai/providers/omlx/docs/ai.providers.omlx.docs.descriptor.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAwB;IACvC,IAAI,EAAE,YAAY;IAClB,EAAE,EAAE,mBAAmB;IACvB,KAAK,EAAE,eAAe;IACtB,OAAO,EAAE,gEAAgE;IACzE,IAAI,EAAE;QACL,IAAI,EAAE,UAAU;QAChB,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;CAoBT;KACC;IACD,IAAI,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC;IAC1C,MAAM,EAAE,cAAc;IACtB,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC;IAClC,QAAQ,EAAE,CAAC,UAAU,CAAC;IACtB,OAAO,EAAE,IAAI;CACb,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { OmlxProviderType } from './omlx.provider.impl.ts';
|
|
2
|
+
export { detectOmlxSystem, createOmlxDetectionServices } from './detection/system.ts';
|
|
3
|
+
export { OmlxRecommendation } from './recommendations.ts';
|
|
4
|
+
export { default as omlxDocsDescriptor } from './docs/ai.providers.omlx.docs.descriptor.ts';
|
|
5
|
+
export { inspectOmlxModelReadiness, listOmlxModels, probeOmlxHealth, probeOmlxModels } from './omlx.models.ts';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ai/providers/omlx/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EACN,yBAAyB,EACzB,cAAc,EACd,eAAe,EACf,eAAe,EACf,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { OmlxProviderType } from "./omlx.provider.impl.js";
|
|
2
|
+
export { detectOmlxSystem, createOmlxDetectionServices } from "./detection/system.js";
|
|
3
|
+
export { OmlxRecommendation } from "./recommendations.js";
|
|
4
|
+
export { default as omlxDocsDescriptor } from "./docs/ai.providers.omlx.docs.descriptor.js";
|
|
5
|
+
export { inspectOmlxModelReadiness, listOmlxModels, probeOmlxHealth, probeOmlxModels } from "./omlx.models.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ai/providers/omlx/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EACN,yBAAyB,EACzB,cAAc,EACd,eAAe,EACf,eAAe,EACf,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type OmlxDiscoveryRuntime, type OmlxModelServices, type OmlxRequestAuth, type OmlxHealth, type OmlxModelsProbe, type OmlxListedModel, type OmlxModelReadiness } from '../../../schemas/discovery.ts';
|
|
2
|
+
export type * from '../../../schemas/discovery.ts';
|
|
3
|
+
export declare function normalizeOmlxBaseUrl(baseUrl?: string): string;
|
|
4
|
+
export declare function omlxNativeOrigin(baseUrl?: string): string;
|
|
5
|
+
export declare function probeOmlxHealth(runtime: OmlxDiscoveryRuntime, baseUrl?: string, services?: OmlxModelServices, timeoutMs?: number): Promise<OmlxHealth>;
|
|
6
|
+
export declare function probeOmlxModels(runtime: OmlxDiscoveryRuntime, baseUrl?: string, services?: OmlxModelServices, timeoutMs?: number, auth?: OmlxRequestAuth): Promise<OmlxModelsProbe>;
|
|
7
|
+
/**
|
|
8
|
+
* Human-readable cause for a failed catalog probe. `keyed` says whether the
|
|
9
|
+
* request carried a resolved key, so the message can tell "no key configured"
|
|
10
|
+
* from "the configured key was rejected" without ever naming the value.
|
|
11
|
+
*/
|
|
12
|
+
export declare function describeOmlxProbeFailure(probe: Pick<OmlxModelsProbe, 'reason' | 'httpStatus'>, baseUrl?: string, keyed?: boolean): string;
|
|
13
|
+
export declare function listOmlxModels(runtime: OmlxDiscoveryRuntime, baseUrl?: string, services?: OmlxModelServices, timeoutMs?: number, auth?: OmlxRequestAuth): Promise<OmlxListedModel[]>;
|
|
14
|
+
/**
|
|
15
|
+
* `/v1/models/status` readiness rows, or `null` when that endpoint did not
|
|
16
|
+
* answer 2xx (older servers, auth rejection, outage).
|
|
17
|
+
*/
|
|
18
|
+
export declare function probeOmlxModelStatus(runtime: OmlxDiscoveryRuntime, baseUrl?: string, services?: OmlxModelServices, timeoutMs?: number, auth?: OmlxRequestAuth): Promise<OmlxModelReadiness[] | null>;
|
|
19
|
+
export declare function inspectOmlxModelReadiness(runtime: OmlxDiscoveryRuntime, baseUrl?: string, services?: OmlxModelServices, timeoutMs?: number, auth?: OmlxRequestAuth): Promise<OmlxModelReadiness[]>;
|
|
20
|
+
//# sourceMappingURL=omlx.models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omlx.models.d.ts","sourceRoot":"","sources":["../../../../src/ai/providers/omlx/omlx.models.ts"],"names":[],"mappings":"AAOA,OAAO,EAGN,KAAK,oBAAoB,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EACvE,KAAK,UAAU,EAAE,KAAK,eAAe,EACrC,KAAK,eAAe,EAAE,KAAK,kBAAkB,EAC7C,MAAM,+BAA+B,CAAC;AACvC,mBAAmB,+BAA+B,CAAC;AAMnD,wBAAgB,oBAAoB,CAAC,OAAO,SAAwB,GAAG,MAAM,CAE5E;AAED,wBAAgB,gBAAgB,CAAC,OAAO,SAAwB,GAAG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DEFAULT_OMLX_BASE_URL, OMLX_DISCOVERY_TIMEOUT_MS } from "../local/llm/omlx/config/schemas/index.js";
|
|
3
|
+
import { OmlxCatalogSchema, OmlxHealthPayloadSchema, OmlxStatusPayloadSchema } from "../../../schemas/discovery.js";
|
|
4
|
+
const defaultServices = {
|
|
5
|
+
fetch: (input, init) => globalThis.fetch(input, init)
|
|
6
|
+
};
|
|
7
|
+
export function normalizeOmlxBaseUrl(baseUrl = DEFAULT_OMLX_BASE_URL) {
|
|
8
|
+
return baseUrl.replace(/\/$/, '');
|
|
9
|
+
}
|
|
10
|
+
export function omlxNativeOrigin(baseUrl = DEFAULT_OMLX_BASE_URL) {
|
|
11
|
+
const normalized = normalizeOmlxBaseUrl(baseUrl);
|
|
12
|
+
return normalized.replace(/\/v1$/i, '');
|
|
13
|
+
}
|
|
14
|
+
function authHeaders(auth) {
|
|
15
|
+
return auth?.apiKey ? { authorization: `Bearer ${auth.apiKey}` } : {};
|
|
16
|
+
}
|
|
17
|
+
async function fetchJson(runtime, url, services, timeoutMs, auth) {
|
|
18
|
+
try {
|
|
19
|
+
return await runtime.lifecycle.wait(async (signal) => {
|
|
20
|
+
const response = await services.fetch(url, { signal, headers: authHeaders(auth) });
|
|
21
|
+
try {
|
|
22
|
+
const body = await response.json();
|
|
23
|
+
return { ok: response.ok, status: response.status, body };
|
|
24
|
+
}
|
|
25
|
+
catch (cause) {
|
|
26
|
+
return { ok: false, status: response.status, body: undefined,
|
|
27
|
+
cause: new CapabilityError('oMLX response is not valid JSON', 'INVALID_INPUT', { reason: 'omlx-invalid-payload', cause }) };
|
|
28
|
+
}
|
|
29
|
+
}, { timeoutMs, reason: 'omlx discovery' });
|
|
30
|
+
}
|
|
31
|
+
catch (cause) {
|
|
32
|
+
return { ok: false, status: 0, body: undefined,
|
|
33
|
+
cause: new CapabilityError('oMLX request failed', 'UNAVAILABLE', { reason: 'omlx-transport-unavailable', cause }) };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export async function probeOmlxHealth(runtime, baseUrl = DEFAULT_OMLX_BASE_URL, services = defaultServices, timeoutMs = OMLX_DISCOVERY_TIMEOUT_MS) {
|
|
37
|
+
const result = await fetchJson(runtime, `${omlxNativeOrigin(baseUrl)}/health`, services, timeoutMs);
|
|
38
|
+
if (result.status === 0)
|
|
39
|
+
return { reachable: false, ready: false };
|
|
40
|
+
const parsed = OmlxHealthPayloadSchema.safeParse(result.body);
|
|
41
|
+
if (!parsed.success)
|
|
42
|
+
return { reachable: true, ready: false, status: 'invalid-payload', httpStatus: result.status };
|
|
43
|
+
const body = parsed.data;
|
|
44
|
+
return {
|
|
45
|
+
reachable: true, ready: result.ok && body.status === 'healthy',
|
|
46
|
+
status: body.status, httpStatus: result.status,
|
|
47
|
+
defaultModel: body.default_model, modelCount: body.engine_pool?.model_count,
|
|
48
|
+
loadedCount: body.engine_pool?.loaded_count
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function classifyFailure(status) {
|
|
52
|
+
if (status === 0)
|
|
53
|
+
return 'unreachable';
|
|
54
|
+
if (status >= 200 && status < 300)
|
|
55
|
+
return 'invalid-payload';
|
|
56
|
+
if (status === 401 || status === 403)
|
|
57
|
+
return 'unauthorized';
|
|
58
|
+
return 'error';
|
|
59
|
+
}
|
|
60
|
+
export async function probeOmlxModels(runtime, baseUrl = DEFAULT_OMLX_BASE_URL, services = defaultServices, timeoutMs = OMLX_DISCOVERY_TIMEOUT_MS, auth) {
|
|
61
|
+
const result = await fetchJson(runtime, `${normalizeOmlxBaseUrl(baseUrl)}/models`, services, timeoutMs, auth);
|
|
62
|
+
if (!result.ok) {
|
|
63
|
+
const reason = classifyFailure(result.status);
|
|
64
|
+
return reason === 'unreachable'
|
|
65
|
+
? { ok: false, models: [], reason, cause: result.cause }
|
|
66
|
+
: { ok: false, models: [], reason, httpStatus: result.status, cause: result.cause };
|
|
67
|
+
}
|
|
68
|
+
const payload = OmlxCatalogSchema.safeParse(result.body);
|
|
69
|
+
if (!payload.success)
|
|
70
|
+
return { ok: false, models: [], reason: 'invalid-payload', httpStatus: result.status,
|
|
71
|
+
cause: new CapabilityError('oMLX catalog payload is invalid', 'INVALID_INPUT', { reason: 'omlx-invalid-payload', cause: payload.error }) };
|
|
72
|
+
return { ok: true, httpStatus: result.status, models: payload.data.data.map(model => ({
|
|
73
|
+
id: model.id, ownedBy: model.owned_by, maxModelLen: model.max_model_len
|
|
74
|
+
})) };
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Human-readable cause for a failed catalog probe. `keyed` says whether the
|
|
78
|
+
* request carried a resolved key, so the message can tell "no key configured"
|
|
79
|
+
* from "the configured key was rejected" without ever naming the value.
|
|
80
|
+
*/
|
|
81
|
+
export function describeOmlxProbeFailure(probe, baseUrl = DEFAULT_OMLX_BASE_URL, keyed = false) {
|
|
82
|
+
const origin = 'the configured endpoint';
|
|
83
|
+
const status = probe.httpStatus ?? 0;
|
|
84
|
+
if (probe.reason === 'unauthorized') {
|
|
85
|
+
return keyed
|
|
86
|
+
? `oMLX at ${origin} rejected the configured API key (HTTP ${status}).`
|
|
87
|
+
: `oMLX at ${origin} is running but requires an API key (HTTP ${status}). ` +
|
|
88
|
+
`Store the ~/.omlx/api-key value with 'vibes secrets set ${DEFAULT_OMLX_API_KEY_SECRET}' ` +
|
|
89
|
+
`and reference it on the connection as apiKey { source: 'secret', key: '${DEFAULT_OMLX_API_KEY_SECRET}' }.`;
|
|
90
|
+
}
|
|
91
|
+
if (probe.reason === 'invalid-payload')
|
|
92
|
+
return 'oMLX returned an invalid catalog payload';
|
|
93
|
+
if (probe.reason === 'error') {
|
|
94
|
+
return `oMLX at ${origin} returned HTTP ${status} for /v1/models.`;
|
|
95
|
+
}
|
|
96
|
+
return `No response from the configured oMLX endpoint`;
|
|
97
|
+
}
|
|
98
|
+
export async function listOmlxModels(runtime, baseUrl = DEFAULT_OMLX_BASE_URL, services = defaultServices, timeoutMs = OMLX_DISCOVERY_TIMEOUT_MS, auth) {
|
|
99
|
+
const probe = await probeOmlxModels(runtime, baseUrl, services, timeoutMs, auth);
|
|
100
|
+
if (probe.ok)
|
|
101
|
+
return probe.models;
|
|
102
|
+
if (probe.reason === 'unreachable')
|
|
103
|
+
return [];
|
|
104
|
+
throw new CapabilityError(describeOmlxProbeFailure(probe, baseUrl, auth !== undefined), 'UNAVAILABLE', {
|
|
105
|
+
reason: `omlx-catalog-${probe.reason}`, cause: probe.cause
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function readinessFromStatusEntry(model) {
|
|
109
|
+
return {
|
|
110
|
+
id: model.id, state: model.is_loading ? 'loading' : model.loaded ? 'loaded' : 'not-loaded',
|
|
111
|
+
modelType: model.model_type, engineType: model.engine_type,
|
|
112
|
+
contextLength: model.model_context_length ?? model.max_context_window, thinkingDefault: model.thinking_default
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* `/v1/models/status` readiness rows, or `null` when that endpoint did not
|
|
117
|
+
* answer 2xx (older servers, auth rejection, outage).
|
|
118
|
+
*/
|
|
119
|
+
export async function probeOmlxModelStatus(runtime, baseUrl = DEFAULT_OMLX_BASE_URL, services = defaultServices, timeoutMs = OMLX_DISCOVERY_TIMEOUT_MS, auth) {
|
|
120
|
+
const status = await fetchJson(runtime, `${normalizeOmlxBaseUrl(baseUrl)}/models/status`, services, timeoutMs, auth);
|
|
121
|
+
if (status.status === 404 || status.status === 405)
|
|
122
|
+
return null;
|
|
123
|
+
if (!status.ok)
|
|
124
|
+
throw new CapabilityError('oMLX readiness probe failed', 'UNAVAILABLE', {
|
|
125
|
+
reason: 'omlx-readiness-unavailable', cause: status.cause
|
|
126
|
+
});
|
|
127
|
+
const payload = OmlxStatusPayloadSchema.safeParse(status.body);
|
|
128
|
+
if (!payload.success)
|
|
129
|
+
throw new CapabilityError('oMLX readiness payload is invalid', 'INVALID_INPUT', {
|
|
130
|
+
reason: 'omlx-invalid-payload', cause: payload.error
|
|
131
|
+
});
|
|
132
|
+
return payload.data.models.map(readinessFromStatusEntry);
|
|
133
|
+
}
|
|
134
|
+
export async function inspectOmlxModelReadiness(runtime, baseUrl = DEFAULT_OMLX_BASE_URL, services = defaultServices, timeoutMs = OMLX_DISCOVERY_TIMEOUT_MS, auth) {
|
|
135
|
+
const status = await probeOmlxModelStatus(runtime, baseUrl, services, timeoutMs, auth);
|
|
136
|
+
if (status)
|
|
137
|
+
return status;
|
|
138
|
+
const listed = await listOmlxModels(runtime, baseUrl, services, timeoutMs, auth);
|
|
139
|
+
return listed.map((model) => ({ id: model.id, state: 'unknown' }));
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=omlx.models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omlx.models.js","sourceRoot":"","sources":["../../../../src/ai/providers/omlx/omlx.models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACN,2BAA2B,EAC3B,qBAAqB,EACrB,yBAAyB,EACzB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACN,iBAAiB,EAAE,uBAAuB,EAAE,uBAAuB,EAKnE,MAAM,+BAA+B,CAAC;AAGvC,MAAM,eAAe,GAAsB;IAC1C,KAAK,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC;CACrD,CAAC;AAEF,MAAM,UAAU,oBAAoB,CAAC,OAAO,GAAG,qBAAqB;IACnE,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAO,GAAG,qBAAqB;IAC/D,MAAM,UAAU,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACjD,OAAO,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AACzC,CAAC;AAED,SAAS,WAAW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AI,CAAC,MAAM,CAAC,EAAE;QAAE,MAAM,IAAI,eAAe,CAAC,6BAA6B,EAAE,aAAa,EAAE;YACvF,MAAM,EAAE,4BAA4B,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK;SACzD,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,uBAAuB,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC/D,IAAI,CAAC,OAAO,CAAC,OAAO;QAAE,MAAM,IAAI,eAAe,CAAC,mCAAmC,EAAE,eAAe,EAAE;YACrG,MAAM,EAAE,sBAAsB,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK;SACpD,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC9C,OAA6B,EAC7B,OAAO,GAAG,qBAAqB,EAC/B,WAA8B,eAAe,EAC7C,SAAS,GAAG,yBAAyB,EACrC,IAAsB;IAEtB,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IACvF,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IACjF,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,SAAkB,EAAE,CAAC,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ConfigurationRecord } from '@vibesdotdev/ai/providers-runtime';
|
|
2
|
+
import type { AIProviderTypeContext, AIProviderTypeInterface, ConnectionValidationResult, DetectedProviderInstance, ModelRecommendation, ProviderGenerateOptions, ProviderGenerateResult, ProviderHealthCheckResult, ProviderOperationOptions } from '@vibesdotdev/ai/interfaces/provider-type';
|
|
3
|
+
import type { GenerationRequest } from '@vibesdotdev/ai/interfaces/adapter';
|
|
4
|
+
import { type AIModelDescriptor, type Modality } from '@vibesdotdev/ai/models/schemas';
|
|
5
|
+
import type { AIProviderDescriptor } from '@vibesdotdev/ai/providers-runtime/schemas/provider-descriptor';
|
|
6
|
+
import type { AIProviderTypeDescriptor } from '@vibesdotdev/ai/providers-runtime/schemas/type-descriptor';
|
|
7
|
+
import { DEFAULT_OMLX_TIMEOUT_MS } from '../local/llm/omlx/config/schemas/index.ts';
|
|
8
|
+
import { type OmlxModelServices, type OmlxRequestAuth } from './omlx.models.ts';
|
|
9
|
+
export declare class OmlxProviderType implements AIProviderTypeInterface {
|
|
10
|
+
readonly descriptor: AIProviderTypeDescriptor;
|
|
11
|
+
private readonly context;
|
|
12
|
+
private readonly services;
|
|
13
|
+
constructor(descriptor: AIProviderTypeDescriptor, context: AIProviderTypeContext, services?: OmlxModelServices);
|
|
14
|
+
generate<T extends Modality>(provider: AIProviderDescriptor, model: AIModelDescriptor, request: GenerationRequest<T>, options?: ProviderGenerateOptions): Promise<ProviderGenerateResult<T>>;
|
|
15
|
+
/**
|
|
16
|
+
* Materialize the connection's `apiKey` REFERENCE into a request credential.
|
|
17
|
+
* Prefers the owner-supplied `resolveCredential` (connection capability);
|
|
18
|
+
* falls back to the provider-type context (generation-time discovery passes
|
|
19
|
+
* no resolver). Returns `undefined` when the connection declares no key.
|
|
20
|
+
* Throws when a declared reference cannot be resolved.
|
|
21
|
+
*/
|
|
22
|
+
private resolveRequestAuth;
|
|
23
|
+
private connection;
|
|
24
|
+
detectInstalled(): Promise<DetectedProviderInstance[]>;
|
|
25
|
+
recommendModels(useCase: string): Promise<ModelRecommendation[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Live `/v1/models` catalog for one connection, sent with the connection's
|
|
28
|
+
* key when it declares one. A rejected probe THROWS (the catalog exists but
|
|
29
|
+
* could not be read) rather than returning `[]`, which the runtime would
|
|
30
|
+
* treat as an authoritative empty inventory.
|
|
31
|
+
*/
|
|
32
|
+
listModels(providerInstance: AIProviderDescriptor, options?: ProviderOperationOptions & {
|
|
33
|
+
modality?: string;
|
|
34
|
+
live?: boolean;
|
|
35
|
+
}): Promise<AIModelDescriptor[] | null>;
|
|
36
|
+
listDiscoveredModels(baseUrl?: string, auth?: OmlxRequestAuth): Promise<{
|
|
37
|
+
id: string;
|
|
38
|
+
ownedBy?: string | undefined;
|
|
39
|
+
maxModelLen?: number | undefined;
|
|
40
|
+
}[]>;
|
|
41
|
+
inspectReadiness(baseUrl?: string, auth?: OmlxRequestAuth): Promise<{
|
|
42
|
+
id: string;
|
|
43
|
+
state: "unknown" | "loaded" | "loading" | "not-loaded";
|
|
44
|
+
modelType?: string | undefined;
|
|
45
|
+
engineType?: string | undefined;
|
|
46
|
+
contextLength?: number | undefined;
|
|
47
|
+
thinkingDefault?: boolean | undefined;
|
|
48
|
+
}[]>;
|
|
49
|
+
checkHealth(config: ConfigurationRecord, options?: ProviderOperationOptions): Promise<ProviderHealthCheckResult>;
|
|
50
|
+
validateConnection(config: ConfigurationRecord): Promise<ConnectionValidationResult>;
|
|
51
|
+
dispose(): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
export { DEFAULT_OMLX_TIMEOUT_MS };
|
|
54
|
+
//# sourceMappingURL=omlx.provider.impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omlx.provider.impl.d.ts","sourceRoot":"","sources":["../../../../src/ai/providers/omlx/omlx.provider.impl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAK7E,OAAO,KAAK,EACX,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EAC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