veryfront 0.1.283 → 0.1.285
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/esm/deno.d.ts +0 -8
- package/esm/deno.js +8 -11
- package/esm/src/agent/agent-service.d.ts +28 -6
- package/esm/src/agent/agent-service.d.ts.map +1 -1
- package/esm/src/agent/agent-service.js +23 -1
- package/esm/src/agent/index.d.ts +1 -1
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/embedding/resolve.d.ts.map +1 -1
- package/esm/src/embedding/resolve.js +15 -2
- package/esm/src/embedding/veryfront-cloud/provider.d.ts.map +1 -1
- package/esm/src/embedding/veryfront-cloud/provider.js +2 -7
- package/esm/src/extensions/contracts.js +3 -1
- package/esm/src/extensions/interfaces/ai-provider.d.ts +50 -0
- package/esm/src/extensions/interfaces/ai-provider.d.ts.map +1 -0
- package/esm/src/extensions/interfaces/ai-provider.js +13 -0
- package/esm/src/extensions/interfaces/code-parser.d.ts +11 -0
- package/esm/src/extensions/interfaces/code-parser.d.ts.map +1 -1
- package/esm/src/extensions/interfaces/css-processor.d.ts +41 -22
- package/esm/src/extensions/interfaces/css-processor.d.ts.map +1 -1
- package/esm/src/extensions/interfaces/css-processor.js +10 -1
- package/esm/src/extensions/interfaces/index.d.ts +5 -4
- package/esm/src/extensions/interfaces/index.d.ts.map +1 -1
- package/esm/src/extensions/interfaces/index.js +1 -0
- package/esm/src/extensions/interfaces/schema-validator.d.ts +84 -5
- package/esm/src/extensions/interfaces/schema-validator.d.ts.map +1 -1
- package/esm/src/extensions/interfaces/schema-validator.js +5 -0
- package/esm/src/extensions/loader.d.ts +7 -0
- package/esm/src/extensions/loader.d.ts.map +1 -1
- package/esm/src/extensions/loader.js +12 -0
- package/esm/src/extensions/orchestrate.d.ts +2 -0
- package/esm/src/extensions/orchestrate.d.ts.map +1 -1
- package/esm/src/extensions/orchestrate.js +3 -0
- package/esm/src/extensions/recommendations.d.ts.map +1 -1
- package/esm/src/extensions/recommendations.js +4 -1
- package/esm/src/extensions/registries/ai-provider-registry.d.ts +11 -0
- package/esm/src/extensions/registries/ai-provider-registry.d.ts.map +1 -0
- package/esm/src/extensions/registries/ai-provider-registry.js +40 -0
- package/esm/src/html/styles-builder/plugin-loader.d.ts.map +1 -1
- package/esm/src/html/styles-builder/plugin-loader.js +4 -16
- package/esm/src/html/styles-builder/tailwind-compiler-cache.d.ts +8 -2
- package/esm/src/html/styles-builder/tailwind-compiler-cache.d.ts.map +1 -1
- package/esm/src/html/styles-builder/tailwind-compiler-cache.js +20 -3
- package/esm/src/provider/model-registry.d.ts.map +1 -1
- package/esm/src/provider/model-registry.js +33 -6
- package/esm/src/provider/runtime-loader/provider-embedding-responses.d.ts +1 -0
- package/esm/src/provider/runtime-loader/provider-embedding-responses.d.ts.map +1 -1
- package/esm/src/provider/runtime-loader/provider-embedding-responses.js +1 -1
- package/esm/src/provider/runtime-loader/provider-http.d.ts +9 -0
- package/esm/src/provider/runtime-loader/provider-http.d.ts.map +1 -1
- package/esm/src/provider/runtime-loader/provider-http.js +2 -2
- package/esm/src/provider/runtime-loader.d.ts +120 -9
- package/esm/src/provider/runtime-loader.d.ts.map +1 -1
- package/esm/src/provider/runtime-loader.js +13 -943
- package/esm/src/provider/veryfront-cloud/provider.d.ts.map +1 -1
- package/esm/src/provider/veryfront-cloud/provider.js +30 -15
- package/esm/src/sandbox/index.d.ts +1 -1
- package/esm/src/sandbox/index.d.ts.map +1 -1
- package/esm/src/sandbox/index.js +1 -1
- package/esm/src/sandbox/lazy-sandbox.d.ts +3 -0
- package/esm/src/sandbox/lazy-sandbox.d.ts.map +1 -1
- package/esm/src/sandbox/lazy-sandbox.js +22 -1
- package/esm/src/schemas/define.d.ts +31 -0
- package/esm/src/schemas/define.d.ts.map +1 -0
- package/esm/src/schemas/define.js +42 -0
- package/esm/src/schemas/index.d.ts +7 -2
- package/esm/src/schemas/index.d.ts.map +1 -1
- package/esm/src/schemas/index.js +10 -2
- package/esm/src/schemas/zod-adapter.d.ts +25 -0
- package/esm/src/schemas/zod-adapter.d.ts.map +1 -0
- package/esm/src/schemas/zod-adapter.js +120 -0
- package/esm/src/server/bootstrap.d.ts.map +1 -1
- package/esm/src/server/bootstrap.js +5 -0
- package/esm/src/transforms/plugins/babel-node-positions.d.ts +6 -7
- package/esm/src/transforms/plugins/babel-node-positions.d.ts.map +1 -1
- package/esm/src/transforms/plugins/babel-node-positions.js +10 -123
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -6
- package/src/deno.js +8 -11
- package/src/src/agent/agent-service.ts +91 -7
- package/src/src/agent/index.ts +4 -0
- package/src/src/embedding/resolve.ts +18 -7
- package/src/src/embedding/veryfront-cloud/provider.ts +4 -10
- package/src/src/extensions/contracts.ts +3 -3
- package/src/src/extensions/interfaces/ai-provider.ts +54 -0
- package/src/src/extensions/interfaces/code-parser.ts +12 -0
- package/src/src/extensions/interfaces/css-processor.ts +43 -22
- package/src/src/extensions/interfaces/index.ts +15 -11
- package/src/src/extensions/interfaces/schema-validator.ts +112 -5
- package/src/src/extensions/loader.ts +14 -0
- package/src/src/extensions/orchestrate.ts +5 -0
- package/src/src/extensions/recommendations.ts +4 -1
- package/src/src/extensions/registries/ai-provider-registry.ts +53 -0
- package/src/src/html/styles-builder/plugin-loader.ts +4 -16
- package/src/src/html/styles-builder/tailwind-compiler-cache.ts +27 -6
- package/src/src/provider/model-registry.ts +34 -15
- package/src/src/provider/runtime-loader/provider-embedding-responses.ts +1 -1
- package/src/src/provider/runtime-loader/provider-http.ts +2 -2
- package/src/src/provider/runtime-loader.ts +41 -1189
- package/src/src/provider/veryfront-cloud/provider.ts +35 -19
- package/src/src/sandbox/index.ts +5 -1
- package/src/src/sandbox/lazy-sandbox.ts +25 -1
- package/src/src/schemas/define.ts +48 -0
- package/src/src/schemas/index.ts +13 -2
- package/src/src/schemas/zod-adapter.ts +180 -0
- package/src/src/server/bootstrap.ts +5 -0
- package/src/src/transforms/plugins/babel-node-positions.ts +11 -173
- package/src/src/utils/version-constant.ts +1 -1
- package/esm/src/extensions/interfaces/ai-model-provider.d.ts +0 -94
- package/esm/src/extensions/interfaces/ai-model-provider.d.ts.map +0 -1
- package/esm/src/extensions/interfaces/ai-model-provider.js +0 -8
- package/src/src/extensions/interfaces/ai-model-provider.ts +0 -100
|
@@ -3,13 +3,57 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Default implementation: `@veryfront/ext-zod`
|
|
5
5
|
*
|
|
6
|
+
* The interface exposes a small DSL (inspired by zod) that lets core modules
|
|
7
|
+
* declare validation schemas without importing zod directly. Schemas are
|
|
8
|
+
* constructed lazily via `defineSchema()` so that an extension-provided
|
|
9
|
+
* implementation can be registered before any schema is materialized.
|
|
10
|
+
*
|
|
6
11
|
* @module extensions/interfaces/schema-validator
|
|
7
12
|
*/
|
|
8
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* An opaque schema definition that validates and infers type `T`.
|
|
15
|
+
*
|
|
16
|
+
* Implementations may use this as a nominal wrapper around a native validator
|
|
17
|
+
* (e.g. a zod schema). Core code only calls the methods defined here.
|
|
18
|
+
*/
|
|
9
19
|
export interface Schema<T = unknown> {
|
|
10
|
-
/** Brand field for nominal typing
|
|
20
|
+
/** Brand field for nominal typing — not used at runtime. */
|
|
11
21
|
readonly _output: T;
|
|
22
|
+
optional(): Schema<T | undefined>;
|
|
23
|
+
nullable(): Schema<T | null>;
|
|
24
|
+
nullish(): Schema<T | null | undefined>;
|
|
25
|
+
default(value: T | (() => T)): Schema<T>;
|
|
26
|
+
describe(description: string): Schema<T>;
|
|
27
|
+
refine(check: (value: T) => boolean, message?: string | {
|
|
28
|
+
message?: string;
|
|
29
|
+
}): Schema<T>;
|
|
30
|
+
transform<U>(fn: (value: T) => U): Schema<U>;
|
|
31
|
+
strict(): Schema<T>;
|
|
32
|
+
passthrough(): Schema<T>;
|
|
33
|
+
partial(): Schema<Partial<T>>;
|
|
34
|
+
extend<U extends Record<string, Schema<unknown>>>(shape: U): Schema<T & {
|
|
35
|
+
[K in keyof U]: InferSchema<U[K]>;
|
|
36
|
+
}>;
|
|
37
|
+
merge<U>(other: Schema<U>): Schema<T & U>;
|
|
38
|
+
min(value: number, message?: string): Schema<T>;
|
|
39
|
+
max(value: number, message?: string): Schema<T>;
|
|
40
|
+
int(message?: string): Schema<T>;
|
|
41
|
+
positive(message?: string): Schema<T>;
|
|
42
|
+
nonnegative(message?: string): Schema<T>;
|
|
43
|
+
regex(pattern: RegExp, message?: string): Schema<T>;
|
|
44
|
+
email(message?: string): Schema<T>;
|
|
45
|
+
url(message?: string): Schema<T>;
|
|
46
|
+
uuid(message?: string): Schema<T>;
|
|
47
|
+
datetime(message?: string): Schema<T>;
|
|
48
|
+
parse(data: unknown): T;
|
|
49
|
+
safeParse(data: unknown): ValidationResult<T>;
|
|
12
50
|
}
|
|
51
|
+
/** Extracts the inferred output type `T` from a `Schema<T>`. */
|
|
52
|
+
export type InferSchema<S> = S extends Schema<infer T> ? T : never;
|
|
53
|
+
/** Maps a raw object shape to its inferred object type. */
|
|
54
|
+
export type InferShape<S extends Record<string, Schema<unknown>>> = {
|
|
55
|
+
[K in keyof S]: InferSchema<S[K]>;
|
|
56
|
+
};
|
|
13
57
|
/** A single validation issue with location context. */
|
|
14
58
|
export interface ValidationIssue {
|
|
15
59
|
/** Dot-path to the offending field (e.g. `"user.email"`). */
|
|
@@ -30,17 +74,52 @@ export interface ValidationFailure {
|
|
|
30
74
|
success: false;
|
|
31
75
|
/** List of issues found during validation. */
|
|
32
76
|
issues: ValidationIssue[];
|
|
77
|
+
/** Native error thrown by the underlying validator (if any). */
|
|
78
|
+
error?: unknown;
|
|
33
79
|
}
|
|
34
80
|
/** Discriminated union of validation outcomes. */
|
|
35
81
|
export type ValidationResult<T> = ValidationSuccess<T> | ValidationFailure;
|
|
82
|
+
/**
|
|
83
|
+
* Namespace for `coerce.*` constructors — accepts input in any form and
|
|
84
|
+
* coerces to the target type before validation.
|
|
85
|
+
*/
|
|
86
|
+
export interface SchemaValidatorCoerce {
|
|
87
|
+
string(): Schema<string>;
|
|
88
|
+
number(): Schema<number>;
|
|
89
|
+
boolean(): Schema<boolean>;
|
|
90
|
+
date(): Schema<Date>;
|
|
91
|
+
}
|
|
36
92
|
/**
|
|
37
93
|
* SchemaValidator contract interface.
|
|
38
94
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
95
|
+
* Exposes a zod-inspired DSL. The `object(shape)`, `array(schema)`, etc.
|
|
96
|
+
* constructors produce opaque `Schema<T>` instances that can be further
|
|
97
|
+
* refined via chainables and finally validated with `.parse` / `.safeParse`.
|
|
41
98
|
*/
|
|
42
99
|
export interface SchemaValidator {
|
|
43
|
-
|
|
100
|
+
string(): Schema<string>;
|
|
101
|
+
number(): Schema<number>;
|
|
102
|
+
boolean(): Schema<boolean>;
|
|
103
|
+
date(): Schema<Date>;
|
|
104
|
+
null(): Schema<null>;
|
|
105
|
+
unknown(): Schema<unknown>;
|
|
106
|
+
any(): Schema<any>;
|
|
107
|
+
object<S extends Record<string, Schema<unknown>>>(shape: S): Schema<InferShape<S>>;
|
|
108
|
+
array<T>(element: Schema<T>): Schema<T[]>;
|
|
109
|
+
record<K extends string | number | symbol, V>(keys: Schema<K>, values: Schema<V>): Schema<Record<K, V>>;
|
|
110
|
+
union<T extends readonly [Schema<unknown>, ...Schema<unknown>[]]>(schemas: T): Schema<InferSchema<T[number]>>;
|
|
111
|
+
discriminatedUnion<K extends string, T extends readonly [Schema<unknown>, ...Schema<unknown>[]]>(discriminator: K, schemas: T): Schema<InferSchema<T[number]>>;
|
|
112
|
+
literal<T extends string | number | boolean | null>(value: T): Schema<T>;
|
|
113
|
+
enum<T extends readonly [string, ...string[]]>(values: T): Schema<T[number]>;
|
|
114
|
+
/** Coercing constructors — accept any input and coerce to the target. */
|
|
115
|
+
coerce: SchemaValidatorCoerce;
|
|
116
|
+
/**
|
|
117
|
+
* Convenience that runs validation on an already-constructed schema.
|
|
118
|
+
* Equivalent to `schema.safeParse(data)`; kept for ergonomic parity with
|
|
119
|
+
* earlier revisions of this contract.
|
|
120
|
+
*/
|
|
44
121
|
validate<T>(schema: Schema<T>, data: unknown): ValidationResult<T>;
|
|
45
122
|
}
|
|
123
|
+
/** Factory type accepted by `defineSchema`. */
|
|
124
|
+
export type SchemaFactory<T> = (v: SchemaValidator) => Schema<T>;
|
|
46
125
|
//# sourceMappingURL=schema-validator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-validator.d.ts","sourceRoot":"","sources":["../../../../src/src/extensions/interfaces/schema-validator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"schema-validator.d.ts","sourceRoot":"","sources":["../../../../src/src/extensions/interfaces/schema-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,MAAM,CAAC,CAAC,GAAG,OAAO;IACjC,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IAGpB,QAAQ,IAAI,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAClC,QAAQ,IAAI,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC7B,OAAO,IAAI,MAAM,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IACxC,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACzC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACzC,MAAM,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACzF,SAAS,CAAC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AAK,CAAC,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,EAC9D,OAAO,EAAE,CAAC,GACT,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAClC,kBAAkB,CAChB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,EAE1D,aAAa,EAAE,CAAC,EAChB,OAAO,EAAE,CAAC,GACT,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAClC,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACzE,IAAI,CAAC,CAAC,SAAS,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAE7E,yEAAyE;IACzE,MAAM,EAAE,qBAAqB,CAAC;IAE9B;;;;OAIG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;CACpE;AAED,+CAA+C;AAC/C,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,eAAe,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Default implementation: `@veryfront/ext-zod`
|
|
5
5
|
*
|
|
6
|
+
* The interface exposes a small DSL (inspired by zod) that lets core modules
|
|
7
|
+
* declare validation schemas without importing zod directly. Schemas are
|
|
8
|
+
* constructed lazily via `defineSchema()` so that an extension-provided
|
|
9
|
+
* implementation can be registered before any schema is materialized.
|
|
10
|
+
*
|
|
6
11
|
* @module extensions/interfaces/schema-validator
|
|
7
12
|
*/
|
|
8
13
|
export {};
|
|
@@ -7,6 +7,13 @@ import type { ExtensionLogger, ResolvedExtension } from "./types.js";
|
|
|
7
7
|
export declare class ExtensionLoader {
|
|
8
8
|
private logger;
|
|
9
9
|
private setupOrder;
|
|
10
|
+
private primed;
|
|
11
|
+
/**
|
|
12
|
+
* Register contracts that will be re-applied after each `setupAll()`
|
|
13
|
+
* teardown pass. Used by `orchestrateExtensions()` to seed infrastructure
|
|
14
|
+
* (e.g. `AIProviderRegistry`) before per-extension `setup()` runs.
|
|
15
|
+
*/
|
|
16
|
+
primeContracts(contracts: Record<string, unknown>): void;
|
|
10
17
|
constructor(logger: ExtensionLogger);
|
|
11
18
|
/**
|
|
12
19
|
* Flatten presets: extensions with `extends` are replaced by their children.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/src/extensions/loader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,KAAK,EAA+B,eAAe,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAElG,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,UAAU,CAA2B;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/src/extensions/loader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,KAAK,EAA+B,eAAe,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAElG,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,MAAM,CAA+B;IAE7C;;;;OAIG;IACH,cAAc,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;gBAI5C,MAAM,EAAE,eAAe;IAInC;;;;OAIG;IACH,cAAc,CAAC,UAAU,EAAE,iBAAiB,EAAE,GAAG,iBAAiB,EAAE;IAIpE,OAAO,CAAC,mBAAmB;IA8B3B;;;OAGG;IACH,eAAe,CAAC,UAAU,EAAE,iBAAiB,EAAE,GAAG,iBAAiB,EAAE;IA6ErE;;;OAGG;IACG,QAAQ,CACZ,UAAU,EAAE,iBAAiB,EAAE,EAC/B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACrC,OAAO,CAAC,IAAI,CAAC;IAgFhB;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAcnC"}
|
|
@@ -10,6 +10,15 @@ import { detectConflicts, selectContractProviders, validateExtension } from "./v
|
|
|
10
10
|
export class ExtensionLoader {
|
|
11
11
|
logger;
|
|
12
12
|
setupOrder = [];
|
|
13
|
+
primed = {};
|
|
14
|
+
/**
|
|
15
|
+
* Register contracts that will be re-applied after each `setupAll()`
|
|
16
|
+
* teardown pass. Used by `orchestrateExtensions()` to seed infrastructure
|
|
17
|
+
* (e.g. `AIProviderRegistry`) before per-extension `setup()` runs.
|
|
18
|
+
*/
|
|
19
|
+
primeContracts(contracts) {
|
|
20
|
+
this.primed = { ...this.primed, ...contracts };
|
|
21
|
+
}
|
|
13
22
|
constructor(logger) {
|
|
14
23
|
this.logger = logger;
|
|
15
24
|
}
|
|
@@ -126,6 +135,9 @@ export class ExtensionLoader {
|
|
|
126
135
|
// Idempotent: teardownAll clears setupOrder and resets the contract
|
|
127
136
|
// registry even when nothing is loaded yet.
|
|
128
137
|
await this.teardownAll();
|
|
138
|
+
for (const [name, impl] of Object.entries(this.primed)) {
|
|
139
|
+
register(name, impl);
|
|
140
|
+
}
|
|
129
141
|
// Check for contract conflicts before loading
|
|
130
142
|
const conflicts = detectConflicts(extensions);
|
|
131
143
|
if (conflicts.length > 0) {
|
|
@@ -23,6 +23,8 @@ export interface OrchestrateOptions {
|
|
|
23
23
|
extensions?: ExtensionConfigEntry[];
|
|
24
24
|
};
|
|
25
25
|
logger: ExtensionLogger;
|
|
26
|
+
/** Contracts to seed into the registry after teardown, before setup(). */
|
|
27
|
+
primeContracts?: Record<string, unknown>;
|
|
26
28
|
/** @internal Override discovery functions in tests. */
|
|
27
29
|
discovery?: {
|
|
28
30
|
discoverPackageExtensions: typeof defaultDiscovery.discoverPackageExtensions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrate.d.ts","sourceRoot":"","sources":["../../../src/src/extensions/orchestrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,gBAAgB,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,oBAAoB,IAAI,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAEV,oBAAoB,EACpB,eAAe,EAGhB,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE;QAAE,UAAU,CAAC,EAAE,oBAAoB,EAAE,CAAA;KAAE,CAAC;IAChD,MAAM,EAAE,eAAe,CAAC;IACxB,uDAAuD;IACvD,SAAS,CAAC,EAAE;QACV,yBAAyB,EAAE,OAAO,gBAAgB,CAAC,yBAAyB,CAAC;QAC7E,yBAAyB,EAAE,OAAO,gBAAgB,CAAC,yBAAyB,CAAC;QAC7E,uBAAuB,EAAE,OAAO,gBAAgB,CAAC,uBAAuB,CAAC;QACzE,eAAe,EAAE,OAAO,gBAAgB,CAAC,eAAe,CAAC;KAC1D,CAAC;IACF,mDAAmD;IACnD,WAAW,CAAC,EAAE,OAAO,kBAAkB,CAAC;CACzC;AAmCD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"orchestrate.d.ts","sourceRoot":"","sources":["../../../src/src/extensions/orchestrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,gBAAgB,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,oBAAoB,IAAI,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAEV,oBAAoB,EACpB,eAAe,EAGhB,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE;QAAE,UAAU,CAAC,EAAE,oBAAoB,EAAE,CAAA;KAAE,CAAC;IAChD,MAAM,EAAE,eAAe,CAAC;IACxB,0EAA0E;IAC1E,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,uDAAuD;IACvD,SAAS,CAAC,EAAE;QACV,yBAAyB,EAAE,OAAO,gBAAgB,CAAC,yBAAyB,CAAC;QAC7E,yBAAyB,EAAE,OAAO,gBAAgB,CAAC,yBAAyB,CAAC;QAC7E,uBAAuB,EAAE,OAAO,gBAAgB,CAAC,uBAAuB,CAAC;QACzE,eAAe,EAAE,OAAO,gBAAgB,CAAC,eAAe,CAAC;KAC1D,CAAC;IACF,mDAAmD;IACnD,WAAW,CAAC,EAAE,OAAO,kBAAkB,CAAC;CACzC;AAmCD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,eAAe,CAAC,CA+E1B"}
|
|
@@ -104,6 +104,9 @@ export async function orchestrateExtensions(options) {
|
|
|
104
104
|
const localResolved = await loadAllFactories(localPaths, "local-file", loadFactory);
|
|
105
105
|
const merged = disc.mergeExtensions(configResolved, packageResolved, projectResolved, localResolved, disables);
|
|
106
106
|
const loader = new ExtensionLoader(logger);
|
|
107
|
+
if (options.primeContracts) {
|
|
108
|
+
loader.primeContracts(options.primeContracts);
|
|
109
|
+
}
|
|
107
110
|
await loader.setupAll(merged, config);
|
|
108
111
|
return loader;
|
|
109
112
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recommendations.d.ts","sourceRoot":"","sources":["../../../src/src/extensions/recommendations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"recommendations.d.ts","sourceRoot":"","sources":["../../../src/src/extensions/recommendations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqBH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE1E"}
|
|
@@ -12,7 +12,10 @@ const recommendations = new Map([
|
|
|
12
12
|
["DatabaseClient", "@veryfront/ext-postgres"],
|
|
13
13
|
["AuthProvider", "@veryfront/ext-jwt"],
|
|
14
14
|
["TracingExporter", "@veryfront/ext-opentelemetry"],
|
|
15
|
-
["
|
|
15
|
+
["AIProviderRegistry", "@veryfront/ext-openai"],
|
|
16
|
+
["AIProvider:openai", "@veryfront/ext-openai"],
|
|
17
|
+
["AIProvider:anthropic", "@veryfront/ext-anthropic"],
|
|
18
|
+
["AIProvider:google", "@veryfront/ext-google"],
|
|
16
19
|
["EmbeddingProvider", "@veryfront/ext-embeddings"],
|
|
17
20
|
["CodeParser", "@veryfront/ext-babel"],
|
|
18
21
|
["SchemaValidator", "@veryfront/ext-zod"],
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default Map-backed implementation of the AIProviderRegistry contract.
|
|
3
|
+
*
|
|
4
|
+
* Preserves insertion order via Map (used by `list()`). Throws on
|
|
5
|
+
* duplicate id to surface silent collisions between extensions.
|
|
6
|
+
*
|
|
7
|
+
* @module extensions/registries/ai-provider-registry
|
|
8
|
+
*/
|
|
9
|
+
import type { AIProviderRegistry } from "../interfaces/ai-provider.js";
|
|
10
|
+
export declare function createAIProviderRegistry(): AIProviderRegistry;
|
|
11
|
+
//# sourceMappingURL=ai-provider-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-provider-registry.d.ts","sourceRoot":"","sources":["../../../../src/src/extensions/registries/ai-provider-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAc,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAyCnF,wBAAgB,wBAAwB,IAAI,kBAAkB,CAE7D"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default Map-backed implementation of the AIProviderRegistry contract.
|
|
3
|
+
*
|
|
4
|
+
* Preserves insertion order via Map (used by `list()`). Throws on
|
|
5
|
+
* duplicate id to surface silent collisions between extensions.
|
|
6
|
+
*
|
|
7
|
+
* @module extensions/registries/ai-provider-registry
|
|
8
|
+
*/
|
|
9
|
+
class AIProviderRegistryImpl {
|
|
10
|
+
providers = new Map();
|
|
11
|
+
register(provider) {
|
|
12
|
+
if (this.providers.has(provider.id)) {
|
|
13
|
+
throw new Error(`AIProvider "${provider.id}" is already registered. ` +
|
|
14
|
+
`Call unregister("${provider.id}") first if you intend to replace it.`);
|
|
15
|
+
}
|
|
16
|
+
this.providers.set(provider.id, provider);
|
|
17
|
+
}
|
|
18
|
+
unregister(id) {
|
|
19
|
+
this.providers.delete(id);
|
|
20
|
+
}
|
|
21
|
+
get(id) {
|
|
22
|
+
return this.providers.get(id);
|
|
23
|
+
}
|
|
24
|
+
require(id) {
|
|
25
|
+
const p = this.providers.get(id);
|
|
26
|
+
if (p)
|
|
27
|
+
return p;
|
|
28
|
+
const known = [...this.providers.keys()].join(", ") || "(none)";
|
|
29
|
+
throw new Error(`No AIProvider registered for "${id}". Known providers: ${known}.`);
|
|
30
|
+
}
|
|
31
|
+
has(id) {
|
|
32
|
+
return this.providers.has(id);
|
|
33
|
+
}
|
|
34
|
+
list() {
|
|
35
|
+
return [...this.providers.values()];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export function createAIProviderRegistry() {
|
|
39
|
+
return new AIProviderRegistryImpl();
|
|
40
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-loader.d.ts","sourceRoot":"","sources":["../../../../src/src/html/styles-builder/plugin-loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-loader.d.ts","sourceRoot":"","sources":["../../../../src/src/html/styles-builder/plugin-loader.ts"],"names":[],"mappings":"AAqHA;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA4D/E;AAED,wBAAsB,UAAU,CAC9B,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,GAC/B,OAAO,CAAC,OAAO,CAAC,CAwClB"}
|
|
@@ -7,9 +7,6 @@
|
|
|
7
7
|
* @module html/styles-builder/plugin-loader
|
|
8
8
|
*/
|
|
9
9
|
import * as dntShim from "../../../_dnt.shims.js";
|
|
10
|
-
import plugin from "tailwindcss/plugin";
|
|
11
|
-
import defaultTheme from "tailwindcss/defaultTheme";
|
|
12
|
-
import colors from "tailwindcss/colors";
|
|
13
10
|
import { serverLogger } from "../../utils/index.js";
|
|
14
11
|
import { getErrorBySlug, IMPORT_RESOLUTION_ERROR, NETWORK_ERROR, VeryfrontError, } from "../../errors/index.js";
|
|
15
12
|
import { getTailwindPluginBundleUrl } from "../../build/binary-plugin-includes.js";
|
|
@@ -53,19 +50,10 @@ catch {
|
|
|
53
50
|
enumerable: true,
|
|
54
51
|
});
|
|
55
52
|
}
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
dntShim.dntGlobalThis.__tailwindDefaultThemeShim = {
|
|
62
|
-
default: defaultTheme,
|
|
63
|
-
__esModule: true,
|
|
64
|
-
};
|
|
65
|
-
dntShim.dntGlobalThis.__tailwindColorsShim = {
|
|
66
|
-
default: colors,
|
|
67
|
-
__esModule: true,
|
|
68
|
-
};
|
|
53
|
+
// Global shims for `tailwindcss/plugin`, `tailwindcss/defaultTheme`, and
|
|
54
|
+
// `tailwindcss/colors` used by dynamically loaded plugin bundles are installed
|
|
55
|
+
// by the `@veryfront/ext-tailwind` extension's `setup()` hook — they depend on
|
|
56
|
+
// tailwindcss imports that live in the extension package, not in core.
|
|
69
57
|
function isRealDenoRuntime() {
|
|
70
58
|
return typeof dntShim.Deno !== "undefined" && typeof dntShim.Deno.version === "object";
|
|
71
59
|
}
|
|
@@ -5,10 +5,16 @@
|
|
|
5
5
|
* stylesheet hash. Prevents race conditions when concurrent requests use
|
|
6
6
|
* different stylesheets.
|
|
7
7
|
*
|
|
8
|
+
* The actual tailwindcss `compile()` call is routed through the
|
|
9
|
+
* `CSSProcessor` extension contract (default implementation:
|
|
10
|
+
* `@veryfront/ext-tailwind`). When no `CSSProcessor` is registered, the
|
|
11
|
+
* compile path returns a no-op compiler that emits empty CSS and logs an
|
|
12
|
+
* actionable install message.
|
|
13
|
+
*
|
|
8
14
|
* @module html/styles-builder/tailwind-compiler-cache
|
|
9
15
|
*/
|
|
10
|
-
import {
|
|
11
|
-
export declare function getCompiler(stylesheet: string, projectSlug?: string): Promise<
|
|
16
|
+
import type { CSSCompiler } from "../../extensions/interfaces/index.js";
|
|
17
|
+
export declare function getCompiler(stylesheet: string, projectSlug?: string): Promise<CSSCompiler>;
|
|
12
18
|
export declare function invalidateCompiler(): void;
|
|
13
19
|
/**
|
|
14
20
|
* Get compiler cache statistics for monitoring.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailwind-compiler-cache.d.ts","sourceRoot":"","sources":["../../../../src/src/html/styles-builder/tailwind-compiler-cache.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tailwind-compiler-cache.d.ts","sourceRoot":"","sources":["../../../../src/src/html/styles-builder/tailwind-compiler-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,sCAAsC,CAAC;AA2EtF,wBAAsB,WAAW,CAC/B,UAAU,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,WAAW,CAAC,CAgEtB;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAGzC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC1E,CAQA;AAED,wBAAgB,gBAAgB,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAalD"}
|
|
@@ -5,9 +5,15 @@
|
|
|
5
5
|
* stylesheet hash. Prevents race conditions when concurrent requests use
|
|
6
6
|
* different stylesheets.
|
|
7
7
|
*
|
|
8
|
+
* The actual tailwindcss `compile()` call is routed through the
|
|
9
|
+
* `CSSProcessor` extension contract (default implementation:
|
|
10
|
+
* `@veryfront/ext-tailwind`). When no `CSSProcessor` is registered, the
|
|
11
|
+
* compile path returns a no-op compiler that emits empty CSS and logs an
|
|
12
|
+
* actionable install message.
|
|
13
|
+
*
|
|
8
14
|
* @module html/styles-builder/tailwind-compiler-cache
|
|
9
15
|
*/
|
|
10
|
-
import {
|
|
16
|
+
import { tryResolve as tryResolveContract } from "../../extensions/contracts.js";
|
|
11
17
|
import { serverLogger } from "../../utils/index.js";
|
|
12
18
|
import { DEPENDENCY_MISSING, NETWORK_ERROR } from "../../errors/index.js";
|
|
13
19
|
import { getTailwindCSSUrl } from "../../utils/constants/cdn.js";
|
|
@@ -73,10 +79,22 @@ export async function getCompiler(stylesheet, projectSlug) {
|
|
|
73
79
|
return cached.compiler;
|
|
74
80
|
}
|
|
75
81
|
logger.debug("Creating new compiler", { hash, projectSlug });
|
|
82
|
+
const processor = tryResolveContract("CSSProcessor");
|
|
83
|
+
if (!processor) {
|
|
84
|
+
logger.warn("No CSSProcessor extension registered — CSS output will be empty. Install it with: deno add @veryfront/ext-tailwind");
|
|
85
|
+
const noopCompiler = { build: () => "" };
|
|
86
|
+
compilerCache.set(hash, {
|
|
87
|
+
compiler: noopCompiler,
|
|
88
|
+
createdAt: Date.now(),
|
|
89
|
+
pluginCache: new Map(),
|
|
90
|
+
pluginErrors: new Map(),
|
|
91
|
+
});
|
|
92
|
+
return noopCompiler;
|
|
93
|
+
}
|
|
76
94
|
const tailwindBase = await getTailwindBaseCSS();
|
|
77
95
|
const pluginCache = new Map();
|
|
78
96
|
const pluginErrors = new Map();
|
|
79
|
-
const newCompiler = await compile(stylesheet, {
|
|
97
|
+
const newCompiler = await processor.compile(stylesheet, {
|
|
80
98
|
base: "/",
|
|
81
99
|
loadStylesheet: (id) => {
|
|
82
100
|
if (id === "tailwindcss") {
|
|
@@ -92,7 +110,6 @@ export async function getCompiler(stylesheet, projectSlug) {
|
|
|
92
110
|
detail: `Failed to load plugin "${id}": plugin not installed`,
|
|
93
111
|
});
|
|
94
112
|
}
|
|
95
|
-
// deno-lint-ignore no-explicit-any -- dynamically loaded plugin cannot be statically verified against Tailwind's Plugin | Config type
|
|
96
113
|
return { module: loaded, base: "/", path: "/" };
|
|
97
114
|
},
|
|
98
115
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-registry.d.ts","sourceRoot":"","sources":["../../../src/src/provider/model-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"model-registry.d.ts","sourceRoot":"","sources":["../../../src/src/provider/model-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAwBH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,YAAY,CAAC;AAOrE;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,GAC5B,IAAI,CAEN;AAsJD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,IAAI,CAWvD;AAMD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,YAAY,CA6D9D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGtD;AAED;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,MAAM,EAAE,CAGtD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,YAAY,GAClB,OAAO,CAAC,IAAI,CAAC,CAKf;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C"}
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { createError, fromError, toError } from "../errors/veryfront-error.js";
|
|
16
16
|
import { getAnthropicEnvConfig, getGoogleGenAIEnvConfig, getOpenAIEnvConfig, } from "../config/env.js";
|
|
17
|
+
import { tryResolve } from "../extensions/contracts.js";
|
|
18
|
+
import { AIProviderRegistryName } from "../extensions/interfaces/index.js";
|
|
17
19
|
import { ProjectScopedRegistryManager } from "../registry/project-scoped-registry-manager.js";
|
|
18
20
|
import { serverLogger } from "../utils/index.js";
|
|
19
21
|
import { DEFAULT_LOCAL_MODEL } from "./local/model-catalog.js";
|
|
@@ -21,7 +23,7 @@ import { createLocalModel } from "./local/model-runtime-adapter.js";
|
|
|
21
23
|
import { throwIfLocalAIDisabled } from "./local/env.js";
|
|
22
24
|
import { verifyLocalRuntime } from "./local/local-engine.js";
|
|
23
25
|
import { getDefaultVeryfrontCloudModel, isVeryfrontCloudEnabled, } from "../platform/cloud/resolver.js";
|
|
24
|
-
import {
|
|
26
|
+
import { createGoogleModelRuntime } from "./runtime-loader.js";
|
|
25
27
|
import { createVeryfrontCloudModel } from "./veryfront-cloud/provider.js";
|
|
26
28
|
import { getModelRuntimeId, hasLocalModelRuntimeMarker } from "./runtime-inspection.js";
|
|
27
29
|
const localLogger = serverLogger.component("local-llm");
|
|
@@ -64,7 +66,18 @@ function autoInitializeFromEnv() {
|
|
|
64
66
|
message: "OPENAI_API_KEY not set. Set the environment variable or register a custom provider with registerModelProvider().",
|
|
65
67
|
}));
|
|
66
68
|
}
|
|
67
|
-
|
|
69
|
+
const registry = tryResolve(AIProviderRegistryName);
|
|
70
|
+
const provider = registry?.get("openai");
|
|
71
|
+
if (provider) {
|
|
72
|
+
return provider.createModel(id, {
|
|
73
|
+
credential: config.apiKey,
|
|
74
|
+
baseURL: config.baseURL,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
throw toError(createError({
|
|
78
|
+
type: "config",
|
|
79
|
+
message: "OpenAI provider not installed. Add @veryfront/ext-openai to use openai/* models.",
|
|
80
|
+
}));
|
|
68
81
|
});
|
|
69
82
|
}
|
|
70
83
|
if (!manager.has("anthropic")) {
|
|
@@ -76,10 +89,18 @@ function autoInitializeFromEnv() {
|
|
|
76
89
|
message: "ANTHROPIC_API_KEY not set. Set the environment variable or register a custom provider with registerModelProvider().",
|
|
77
90
|
}));
|
|
78
91
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
92
|
+
const registry = tryResolve(AIProviderRegistryName);
|
|
93
|
+
const provider = registry?.get("anthropic");
|
|
94
|
+
if (provider) {
|
|
95
|
+
return provider.createModel(id, {
|
|
96
|
+
credential: config.apiKey,
|
|
97
|
+
baseURL: config.baseURL,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
throw toError(createError({
|
|
101
|
+
type: "config",
|
|
102
|
+
message: "Anthropic provider not installed. Add @veryfront/ext-anthropic to use anthropic/* models.",
|
|
103
|
+
}));
|
|
83
104
|
});
|
|
84
105
|
}
|
|
85
106
|
if (!manager.has("google")) {
|
|
@@ -156,16 +177,22 @@ function isMissingProviderConfiguration(errorData) {
|
|
|
156
177
|
*/
|
|
157
178
|
export function findAvailableCloudModel() {
|
|
158
179
|
autoInitializeFromEnv();
|
|
180
|
+
const registry = tryResolve(AIProviderRegistryName);
|
|
159
181
|
for (const { provider, model, hasKey } of CLOUD_UPGRADE_CANDIDATES) {
|
|
160
182
|
if (!hasKey())
|
|
161
183
|
continue;
|
|
162
184
|
if (!manager.has(provider))
|
|
163
185
|
continue;
|
|
186
|
+
if (registry && !registry.has(provider) && !isBuiltinProvider(provider))
|
|
187
|
+
continue;
|
|
164
188
|
const resolvedModel = typeof model === "function" ? model() : model;
|
|
165
189
|
return `${provider}/${resolvedModel}`;
|
|
166
190
|
}
|
|
167
191
|
return null;
|
|
168
192
|
}
|
|
193
|
+
function isBuiltinProvider(provider) {
|
|
194
|
+
return provider === "google" || provider === "veryfront-cloud";
|
|
195
|
+
}
|
|
169
196
|
/**
|
|
170
197
|
* Resolve a "provider/model" string to a framework-compatible model runtime.
|
|
171
198
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare function isNumberArray(value: unknown): value is number[];
|
|
1
2
|
export declare function extractOpenAIEmbeddings(payload: unknown): number[][];
|
|
2
3
|
export declare function extractOpenAIUsageTokens(payload: unknown): number | undefined;
|
|
3
4
|
export declare function extractGoogleEmbedding(payload: unknown): number[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-embedding-responses.d.ts","sourceRoot":"","sources":["../../../../src/src/provider/runtime-loader/provider-embedding-responses.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"provider-embedding-responses.d.ts","sourceRoot":"","sources":["../../../../src/src/provider/runtime-loader/provider-embedding-responses.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,EAAE,CAE/D;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,EAAE,CAmBpE;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAK7E;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CAmBjE;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAK7E"}
|
|
@@ -30,6 +30,15 @@ export declare class ProviderQuotaError extends ProviderError {
|
|
|
30
30
|
/** Non-retryable 4xx/5xx that doesn't fit another bucket. */
|
|
31
31
|
export declare class ProviderRequestError extends ProviderError {
|
|
32
32
|
}
|
|
33
|
+
export declare function parseRetryAfterMs(header: string | null): number | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Inspect a non-2xx response and build the most specific ProviderError
|
|
36
|
+
* subclass we can. Reads the response body as text (it's already dead
|
|
37
|
+
* on the wire by this point). Body classification handles the cases
|
|
38
|
+
* where HTTP status alone is ambiguous — notably OpenAI
|
|
39
|
+
* `insufficient_quota` vs `rate_limit_exceeded` both arriving as 429.
|
|
40
|
+
*/
|
|
41
|
+
export declare function buildProviderError(provider: ProviderKind, response: Response): Promise<ProviderError>;
|
|
33
42
|
export declare function requestJson(options: {
|
|
34
43
|
url: string;
|
|
35
44
|
fetchImpl: typeof globalThis.fetch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-http.d.ts","sourceRoot":"","sources":["../../../../src/src/provider/runtime-loader/provider-http.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM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AAC;QACnB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB;CAUF;AAED,4EAA4E;AAC5E,qBAAa,uBAAwB,SAAQ,aAAa;CAAG;AAE7D,mFAAmF;AACnF,qBAAa,sBAAuB,SAAQ,aAAa;CAAG;AAE5D,2DAA2D;AAC3D,qBAAa,kBAAmB,SAAQ,aAAa;CAAG;AAExD,6DAA6D;AAC7D,qBAAa,oBAAqB,SAAQ,aAAa;CAAG;AAE1D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAY3E;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,aAAa,CAAC,CA6FxB;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IACnC,IAAI,EAAE,WAAW,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,YAAY,CAAC;CAC5B,GAAG,OAAO,CAAC,OAAO,CAAC,CASnB;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IACnC,IAAI,EAAE,WAAW,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,YAAY,CAAC;CAC5B,GAAG,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAkBtC"}
|
|
@@ -33,7 +33,7 @@ export class ProviderQuotaError extends ProviderError {
|
|
|
33
33
|
/** Non-retryable 4xx/5xx that doesn't fit another bucket. */
|
|
34
34
|
export class ProviderRequestError extends ProviderError {
|
|
35
35
|
}
|
|
36
|
-
function parseRetryAfterMs(header) {
|
|
36
|
+
export function parseRetryAfterMs(header) {
|
|
37
37
|
if (!header)
|
|
38
38
|
return undefined;
|
|
39
39
|
const asNumber = Number(header);
|
|
@@ -54,7 +54,7 @@ function parseRetryAfterMs(header) {
|
|
|
54
54
|
* where HTTP status alone is ambiguous — notably OpenAI
|
|
55
55
|
* `insufficient_quota` vs `rate_limit_exceeded` both arriving as 429.
|
|
56
56
|
*/
|
|
57
|
-
async function buildProviderError(provider, response) {
|
|
57
|
+
export async function buildProviderError(provider, response) {
|
|
58
58
|
const rawBody = await response.text();
|
|
59
59
|
const message = rawBody.trim() || `${response.status} ${response.statusText}`.trim();
|
|
60
60
|
const status = response.status;
|