@valbuild/shared 0.117.0 → 0.120.0
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/CHANGELOG.md +66 -0
- package/dist/declarations/src/internal/ApiRoutes.d.ts +6 -0
- package/internal/dist/valbuild-shared-internal.cjs.dev.js +41 -21
- package/internal/dist/valbuild-shared-internal.cjs.prod.js +41 -21
- package/internal/dist/valbuild-shared-internal.esm.js +41 -21
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,71 @@
|
|
|
1
1
|
# @valbuild/shared
|
|
2
2
|
|
|
3
|
+
## 0.120.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#589](https://github.com/valbuild/val/pull/589) [`c2d3c0e`](https://github.com/valbuild/val/commit/c2d3c0e6c2010c0a94c725d9dbaa618998773e8a) Thanks [@freekh](https://github.com/freekh)! - **Breaking:** `s.richtext()` options are flat.
|
|
8
|
+
|
|
9
|
+
The `style`, `block` and `inline` groups are gone — every option is a key of its
|
|
10
|
+
own. The names are unchanged, so updating a schema is only a matter of removing
|
|
11
|
+
the wrappers:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// before
|
|
15
|
+
s.richtext({
|
|
16
|
+
style: { bold: true, italic: true },
|
|
17
|
+
block: { h1: true, ul: true },
|
|
18
|
+
inline: { a: true, img: s.image() },
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// after
|
|
22
|
+
s.richtext({
|
|
23
|
+
bold: true,
|
|
24
|
+
italic: true,
|
|
25
|
+
h1: true,
|
|
26
|
+
ul: true,
|
|
27
|
+
a: true,
|
|
28
|
+
img: s.image(),
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The groups never carried any meaning the option names did not already have, and
|
|
33
|
+
they cost something real: an option name and its `ValRichText` theme key were
|
|
34
|
+
spelled differently (`block.h1` vs `theme.h1`), so the type that keeps a theme
|
|
35
|
+
exhaustive had to restate all thirteen options by hand. It is now a mapped type
|
|
36
|
+
over the options themselves — which also fixes an inconsistency in it: enabling
|
|
37
|
+
links with a schema (`a: s.route()`) rather than `a: true` now requires an `a`
|
|
38
|
+
key in the theme, the way `img` always has.
|
|
39
|
+
|
|
40
|
+
`ValRichText` themes were already flat and are unchanged. The serialized schema
|
|
41
|
+
that the server sends the Studio is flat too, so a project must not mix
|
|
42
|
+
`@valbuild/*` versions across this release.
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- Updated dependencies [[`c2d3c0e`](https://github.com/valbuild/val/commit/c2d3c0e6c2010c0a94c725d9dbaa618998773e8a)]:
|
|
47
|
+
- @valbuild/core@0.120.0
|
|
48
|
+
|
|
49
|
+
## 0.118.0
|
|
50
|
+
|
|
51
|
+
### Minor Changes
|
|
52
|
+
|
|
53
|
+
- [#574](https://github.com/valbuild/val/pull/574) [`198ba8b`](https://github.com/valbuild/val/commit/198ba8bd8e6c921660e97f5cd26fb17f2d5f3f95) Thanks [@freekh](https://github.com/freekh)! - The assistant lets you pick which model answers, from the models your key can
|
|
54
|
+
actually reach.
|
|
55
|
+
|
|
56
|
+
The content server now asks each provider what a key may use and reports the
|
|
57
|
+
answer; the Studio offers exactly that, beside the composer. Which model to use
|
|
58
|
+
is a per-message decision — something cheap for a typo, something strong for a
|
|
59
|
+
hard question — so the control sits where the message is written rather than in
|
|
60
|
+
a settings panel.
|
|
61
|
+
|
|
62
|
+
The choice is remembered per browser and re-checked against what is on offer
|
|
63
|
+
each time the assistant starts, so a model an account has lost access to is
|
|
64
|
+
quietly replaced instead of being sent and refused.
|
|
65
|
+
|
|
66
|
+
A content server that does not report models, or could not reach a provider,
|
|
67
|
+
leaves the built-in catalog as the fallback, filtered to reachable providers.
|
|
68
|
+
|
|
3
69
|
## 0.117.0
|
|
4
70
|
|
|
5
71
|
### Patch Changes
|
|
@@ -1035,6 +1035,12 @@ export declare const Api: {
|
|
|
1035
1035
|
nonce: z.ZodString;
|
|
1036
1036
|
wsUrl: z.ZodString;
|
|
1037
1037
|
providers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1038
|
+
models: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1039
|
+
provider: z.ZodString;
|
|
1040
|
+
model: z.ZodString;
|
|
1041
|
+
label: z.ZodString;
|
|
1042
|
+
contextWindow: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1043
|
+
}, z.core.$strip>>>;
|
|
1038
1044
|
}, z.core.$strip>;
|
|
1039
1045
|
}, z.core.$strip>, z.ZodObject<{
|
|
1040
1046
|
status: z.ZodLiteral<500>;
|
|
@@ -1123,25 +1123,24 @@ var SerializedImageSchema = zod.z.object({
|
|
|
1123
1123
|
});
|
|
1124
1124
|
var RichTextOptions = zod.z.lazy(function () {
|
|
1125
1125
|
return zod.z.object({
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
}).optional()
|
|
1126
|
+
// Set by `.maxLength()` / `.minLength()`, not by the options argument.
|
|
1127
|
+
// These z.objects strip unknown keys, so leaving them out drops the
|
|
1128
|
+
// length constraints in transit.
|
|
1129
|
+
maxLength: zod.z.number().optional(),
|
|
1130
|
+
minLength: zod.z.number().optional(),
|
|
1131
|
+
bold: zod.z["boolean"]().optional(),
|
|
1132
|
+
italic: zod.z["boolean"]().optional(),
|
|
1133
|
+
lineThrough: zod.z["boolean"]().optional(),
|
|
1134
|
+
h1: zod.z["boolean"]().optional(),
|
|
1135
|
+
h2: zod.z["boolean"]().optional(),
|
|
1136
|
+
h3: zod.z["boolean"]().optional(),
|
|
1137
|
+
h4: zod.z["boolean"]().optional(),
|
|
1138
|
+
h5: zod.z["boolean"]().optional(),
|
|
1139
|
+
h6: zod.z["boolean"]().optional(),
|
|
1140
|
+
ul: zod.z["boolean"]().optional(),
|
|
1141
|
+
ol: zod.z["boolean"]().optional(),
|
|
1142
|
+
a: zod.z.union([zod.z["boolean"](), SerializedRouteSchema, SerializedStringSchema]).optional(),
|
|
1143
|
+
img: zod.z.union([zod.z["boolean"](), SerializedImageSchema]).optional()
|
|
1145
1144
|
});
|
|
1146
1145
|
});
|
|
1147
1146
|
var SerializedRichTextSchema = zod.z.object({
|
|
@@ -2203,7 +2202,28 @@ var Api = {
|
|
|
2203
2202
|
* reject the whole response over a name this version has not heard
|
|
2204
2203
|
* of. Unknown entries are simply ignored.
|
|
2205
2204
|
*/
|
|
2206
|
-
providers: zod.z.array(zod.z.string()).optional()
|
|
2205
|
+
providers: zod.z.array(zod.z.string()).optional(),
|
|
2206
|
+
/**
|
|
2207
|
+
* The models those keys can actually use, as the providers report
|
|
2208
|
+
* them.
|
|
2209
|
+
*
|
|
2210
|
+
* Which models *exist* is something only the provider knows: it
|
|
2211
|
+
* depends on the account, its tier, and what has shipped since this
|
|
2212
|
+
* Studio was built. So the server asks and passes the answer on,
|
|
2213
|
+
* and the picker offers exactly this.
|
|
2214
|
+
*
|
|
2215
|
+
* Optional and loosely typed for the same reason as `providers`: a
|
|
2216
|
+
* content server that does not report them, or reports a provider
|
|
2217
|
+
* this version has not heard of, must not invalidate the whole
|
|
2218
|
+
* response. Absent or empty means fall back to the built-in
|
|
2219
|
+
* catalog.
|
|
2220
|
+
*/
|
|
2221
|
+
models: zod.z.array(zod.z.object({
|
|
2222
|
+
provider: zod.z.string(),
|
|
2223
|
+
model: zod.z.string(),
|
|
2224
|
+
label: zod.z.string(),
|
|
2225
|
+
contextWindow: zod.z.number().nullable().optional()
|
|
2226
|
+
})).optional()
|
|
2207
2227
|
})
|
|
2208
2228
|
}), zod.z.object({
|
|
2209
2229
|
status: zod.z.literal(500),
|
|
@@ -3646,7 +3666,7 @@ function getInlineImgInfo(richtextSchema) {
|
|
|
3646
3666
|
if (richtextSchema.type !== "richtext") return {
|
|
3647
3667
|
kind: "not-allowed"
|
|
3648
3668
|
};
|
|
3649
|
-
var img = (_richtextSchema$optio = richtextSchema.options) === null || _richtextSchema$optio === void 0
|
|
3669
|
+
var img = (_richtextSchema$optio = richtextSchema.options) === null || _richtextSchema$optio === void 0 ? void 0 : _richtextSchema$optio.img;
|
|
3650
3670
|
if (!img) return {
|
|
3651
3671
|
kind: "not-allowed"
|
|
3652
3672
|
};
|
|
@@ -1123,25 +1123,24 @@ var SerializedImageSchema = zod.z.object({
|
|
|
1123
1123
|
});
|
|
1124
1124
|
var RichTextOptions = zod.z.lazy(function () {
|
|
1125
1125
|
return zod.z.object({
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
}).optional()
|
|
1126
|
+
// Set by `.maxLength()` / `.minLength()`, not by the options argument.
|
|
1127
|
+
// These z.objects strip unknown keys, so leaving them out drops the
|
|
1128
|
+
// length constraints in transit.
|
|
1129
|
+
maxLength: zod.z.number().optional(),
|
|
1130
|
+
minLength: zod.z.number().optional(),
|
|
1131
|
+
bold: zod.z["boolean"]().optional(),
|
|
1132
|
+
italic: zod.z["boolean"]().optional(),
|
|
1133
|
+
lineThrough: zod.z["boolean"]().optional(),
|
|
1134
|
+
h1: zod.z["boolean"]().optional(),
|
|
1135
|
+
h2: zod.z["boolean"]().optional(),
|
|
1136
|
+
h3: zod.z["boolean"]().optional(),
|
|
1137
|
+
h4: zod.z["boolean"]().optional(),
|
|
1138
|
+
h5: zod.z["boolean"]().optional(),
|
|
1139
|
+
h6: zod.z["boolean"]().optional(),
|
|
1140
|
+
ul: zod.z["boolean"]().optional(),
|
|
1141
|
+
ol: zod.z["boolean"]().optional(),
|
|
1142
|
+
a: zod.z.union([zod.z["boolean"](), SerializedRouteSchema, SerializedStringSchema]).optional(),
|
|
1143
|
+
img: zod.z.union([zod.z["boolean"](), SerializedImageSchema]).optional()
|
|
1145
1144
|
});
|
|
1146
1145
|
});
|
|
1147
1146
|
var SerializedRichTextSchema = zod.z.object({
|
|
@@ -2203,7 +2202,28 @@ var Api = {
|
|
|
2203
2202
|
* reject the whole response over a name this version has not heard
|
|
2204
2203
|
* of. Unknown entries are simply ignored.
|
|
2205
2204
|
*/
|
|
2206
|
-
providers: zod.z.array(zod.z.string()).optional()
|
|
2205
|
+
providers: zod.z.array(zod.z.string()).optional(),
|
|
2206
|
+
/**
|
|
2207
|
+
* The models those keys can actually use, as the providers report
|
|
2208
|
+
* them.
|
|
2209
|
+
*
|
|
2210
|
+
* Which models *exist* is something only the provider knows: it
|
|
2211
|
+
* depends on the account, its tier, and what has shipped since this
|
|
2212
|
+
* Studio was built. So the server asks and passes the answer on,
|
|
2213
|
+
* and the picker offers exactly this.
|
|
2214
|
+
*
|
|
2215
|
+
* Optional and loosely typed for the same reason as `providers`: a
|
|
2216
|
+
* content server that does not report them, or reports a provider
|
|
2217
|
+
* this version has not heard of, must not invalidate the whole
|
|
2218
|
+
* response. Absent or empty means fall back to the built-in
|
|
2219
|
+
* catalog.
|
|
2220
|
+
*/
|
|
2221
|
+
models: zod.z.array(zod.z.object({
|
|
2222
|
+
provider: zod.z.string(),
|
|
2223
|
+
model: zod.z.string(),
|
|
2224
|
+
label: zod.z.string(),
|
|
2225
|
+
contextWindow: zod.z.number().nullable().optional()
|
|
2226
|
+
})).optional()
|
|
2207
2227
|
})
|
|
2208
2228
|
}), zod.z.object({
|
|
2209
2229
|
status: zod.z.literal(500),
|
|
@@ -3646,7 +3666,7 @@ function getInlineImgInfo(richtextSchema) {
|
|
|
3646
3666
|
if (richtextSchema.type !== "richtext") return {
|
|
3647
3667
|
kind: "not-allowed"
|
|
3648
3668
|
};
|
|
3649
|
-
var img = (_richtextSchema$optio = richtextSchema.options) === null || _richtextSchema$optio === void 0
|
|
3669
|
+
var img = (_richtextSchema$optio = richtextSchema.options) === null || _richtextSchema$optio === void 0 ? void 0 : _richtextSchema$optio.img;
|
|
3650
3670
|
if (!img) return {
|
|
3651
3671
|
kind: "not-allowed"
|
|
3652
3672
|
};
|
|
@@ -1119,25 +1119,24 @@ var SerializedImageSchema = z.object({
|
|
|
1119
1119
|
});
|
|
1120
1120
|
var RichTextOptions = z.lazy(function () {
|
|
1121
1121
|
return z.object({
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
}).optional()
|
|
1122
|
+
// Set by `.maxLength()` / `.minLength()`, not by the options argument.
|
|
1123
|
+
// These z.objects strip unknown keys, so leaving them out drops the
|
|
1124
|
+
// length constraints in transit.
|
|
1125
|
+
maxLength: z.number().optional(),
|
|
1126
|
+
minLength: z.number().optional(),
|
|
1127
|
+
bold: z["boolean"]().optional(),
|
|
1128
|
+
italic: z["boolean"]().optional(),
|
|
1129
|
+
lineThrough: z["boolean"]().optional(),
|
|
1130
|
+
h1: z["boolean"]().optional(),
|
|
1131
|
+
h2: z["boolean"]().optional(),
|
|
1132
|
+
h3: z["boolean"]().optional(),
|
|
1133
|
+
h4: z["boolean"]().optional(),
|
|
1134
|
+
h5: z["boolean"]().optional(),
|
|
1135
|
+
h6: z["boolean"]().optional(),
|
|
1136
|
+
ul: z["boolean"]().optional(),
|
|
1137
|
+
ol: z["boolean"]().optional(),
|
|
1138
|
+
a: z.union([z["boolean"](), SerializedRouteSchema, SerializedStringSchema]).optional(),
|
|
1139
|
+
img: z.union([z["boolean"](), SerializedImageSchema]).optional()
|
|
1141
1140
|
});
|
|
1142
1141
|
});
|
|
1143
1142
|
var SerializedRichTextSchema = z.object({
|
|
@@ -2199,7 +2198,28 @@ var Api = {
|
|
|
2199
2198
|
* reject the whole response over a name this version has not heard
|
|
2200
2199
|
* of. Unknown entries are simply ignored.
|
|
2201
2200
|
*/
|
|
2202
|
-
providers: z.array(z.string()).optional()
|
|
2201
|
+
providers: z.array(z.string()).optional(),
|
|
2202
|
+
/**
|
|
2203
|
+
* The models those keys can actually use, as the providers report
|
|
2204
|
+
* them.
|
|
2205
|
+
*
|
|
2206
|
+
* Which models *exist* is something only the provider knows: it
|
|
2207
|
+
* depends on the account, its tier, and what has shipped since this
|
|
2208
|
+
* Studio was built. So the server asks and passes the answer on,
|
|
2209
|
+
* and the picker offers exactly this.
|
|
2210
|
+
*
|
|
2211
|
+
* Optional and loosely typed for the same reason as `providers`: a
|
|
2212
|
+
* content server that does not report them, or reports a provider
|
|
2213
|
+
* this version has not heard of, must not invalidate the whole
|
|
2214
|
+
* response. Absent or empty means fall back to the built-in
|
|
2215
|
+
* catalog.
|
|
2216
|
+
*/
|
|
2217
|
+
models: z.array(z.object({
|
|
2218
|
+
provider: z.string(),
|
|
2219
|
+
model: z.string(),
|
|
2220
|
+
label: z.string(),
|
|
2221
|
+
contextWindow: z.number().nullable().optional()
|
|
2222
|
+
})).optional()
|
|
2203
2223
|
})
|
|
2204
2224
|
}), z.object({
|
|
2205
2225
|
status: z.literal(500),
|
|
@@ -3642,7 +3662,7 @@ function getInlineImgInfo(richtextSchema) {
|
|
|
3642
3662
|
if (richtextSchema.type !== "richtext") return {
|
|
3643
3663
|
kind: "not-allowed"
|
|
3644
3664
|
};
|
|
3645
|
-
var img = (_richtextSchema$optio = richtextSchema.options) === null || _richtextSchema$optio === void 0
|
|
3665
|
+
var img = (_richtextSchema$optio = richtextSchema.options) === null || _richtextSchema$optio === void 0 ? void 0 : _richtextSchema$optio.img;
|
|
3646
3666
|
if (!img) return {
|
|
3647
3667
|
kind: "not-allowed"
|
|
3648
3668
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valbuild/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.120.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Val shared types and utilities",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"zod": "^4.4.3",
|
|
33
33
|
"zod-validation-error": "^5.0.0",
|
|
34
|
-
"@valbuild/core": "0.
|
|
34
|
+
"@valbuild/core": "0.120.0"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
37
|
"CHANGELOG.md",
|