@valbuild/server 0.117.0 → 0.118.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 CHANGED
@@ -1,5 +1,38 @@
1
1
  # @valbuild/server
2
2
 
3
+ ## 0.118.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#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
8
+ actually reach.
9
+
10
+ The content server now asks each provider what a key may use and reports the
11
+ answer; the Studio offers exactly that, beside the composer. Which model to use
12
+ is a per-message decision — something cheap for a typo, something strong for a
13
+ hard question — so the control sits where the message is written rather than in
14
+ a settings panel.
15
+
16
+ The choice is remembered per browser and re-checked against what is on offer
17
+ each time the assistant starts, so a model an account has lost access to is
18
+ quietly replaced instead of being sent and refused.
19
+
20
+ A content server that does not report models, or could not reach a provider,
21
+ leaves the built-in catalog as the fallback, filtered to reachable providers.
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [[`198ba8b`](https://github.com/valbuild/val/commit/198ba8bd8e6c921660e97f5cd26fb17f2d5f3f95), [`198ba8b`](https://github.com/valbuild/val/commit/198ba8bd8e6c921660e97f5cd26fb17f2d5f3f95), [`fe6a398`](https://github.com/valbuild/val/commit/fe6a3981691394e6f34d4d80ec17febd356a98cc)]:
26
+ - @valbuild/ui@0.118.0
27
+ - @valbuild/shared@0.118.0
28
+
29
+ ## 0.117.1
30
+
31
+ ### Patch Changes
32
+
33
+ - Updated dependencies [[`0ae7bac`](https://github.com/valbuild/val/commit/0ae7bac8a186460bc2b31f2ded89b00027bafb55)]:
34
+ - @valbuild/ui@0.117.1
35
+
3
36
  ## 0.117.0
4
37
 
5
38
  ### Minor Changes
@@ -9527,13 +9527,39 @@ const ValServer = (valModules, options, callbacks) => {
9527
9527
  // providers are reachable is the content server's to decide, and
9528
9528
  // this only has to carry the answer without editorialising.
9529
9529
  const providers = Array.isArray(json.providers) ? json.providers.filter(provider => typeof provider === "string") : undefined;
9530
+ // Same posture as `providers`: forwarded, shape-checked, not
9531
+ // interpreted. Which models a key can reach is the content
9532
+ // server's answer to give, and a malformed entry is dropped rather
9533
+ // than allowed to sink the whole response.
9534
+ const models = Array.isArray(json.models) ? json.models.flatMap(entry => {
9535
+ if (typeof entry !== "object" || entry === null) {
9536
+ return [];
9537
+ }
9538
+ const model = entry;
9539
+ if (typeof model.provider !== "string" || typeof model.model !== "string" || typeof model.label !== "string") {
9540
+ return [];
9541
+ }
9542
+ return [{
9543
+ provider: model.provider,
9544
+ model: model.model,
9545
+ label: model.label,
9546
+ contextWindow: typeof model.contextWindow === "number" ? model.contextWindow : null
9547
+ }];
9548
+ }) : undefined;
9530
9549
  return {
9531
9550
  status: 200,
9532
9551
  json: {
9533
9552
  nonce: json.nonce,
9534
9553
  wsUrl,
9535
- ...(providers ? {
9554
+ // Explicit, because the distinction matters and truthiness
9555
+ // is a bad way to express it: an empty array means "no
9556
+ // reachable provider", which the client must be able to tell
9557
+ // apart from an older server that reports nothing at all.
9558
+ ...(providers !== undefined ? {
9536
9559
  providers
9560
+ } : {}),
9561
+ ...(models !== undefined ? {
9562
+ models
9537
9563
  } : {})
9538
9564
  }
9539
9565
  };
@@ -9527,13 +9527,39 @@ const ValServer = (valModules, options, callbacks) => {
9527
9527
  // providers are reachable is the content server's to decide, and
9528
9528
  // this only has to carry the answer without editorialising.
9529
9529
  const providers = Array.isArray(json.providers) ? json.providers.filter(provider => typeof provider === "string") : undefined;
9530
+ // Same posture as `providers`: forwarded, shape-checked, not
9531
+ // interpreted. Which models a key can reach is the content
9532
+ // server's answer to give, and a malformed entry is dropped rather
9533
+ // than allowed to sink the whole response.
9534
+ const models = Array.isArray(json.models) ? json.models.flatMap(entry => {
9535
+ if (typeof entry !== "object" || entry === null) {
9536
+ return [];
9537
+ }
9538
+ const model = entry;
9539
+ if (typeof model.provider !== "string" || typeof model.model !== "string" || typeof model.label !== "string") {
9540
+ return [];
9541
+ }
9542
+ return [{
9543
+ provider: model.provider,
9544
+ model: model.model,
9545
+ label: model.label,
9546
+ contextWindow: typeof model.contextWindow === "number" ? model.contextWindow : null
9547
+ }];
9548
+ }) : undefined;
9530
9549
  return {
9531
9550
  status: 200,
9532
9551
  json: {
9533
9552
  nonce: json.nonce,
9534
9553
  wsUrl,
9535
- ...(providers ? {
9554
+ // Explicit, because the distinction matters and truthiness
9555
+ // is a bad way to express it: an empty array means "no
9556
+ // reachable provider", which the client must be able to tell
9557
+ // apart from an older server that reports nothing at all.
9558
+ ...(providers !== undefined ? {
9536
9559
  providers
9560
+ } : {}),
9561
+ ...(models !== undefined ? {
9562
+ models
9537
9563
  } : {})
9538
9564
  }
9539
9565
  };
@@ -9493,13 +9493,39 @@ const ValServer = (valModules, options, callbacks) => {
9493
9493
  // providers are reachable is the content server's to decide, and
9494
9494
  // this only has to carry the answer without editorialising.
9495
9495
  const providers = Array.isArray(json.providers) ? json.providers.filter(provider => typeof provider === "string") : undefined;
9496
+ // Same posture as `providers`: forwarded, shape-checked, not
9497
+ // interpreted. Which models a key can reach is the content
9498
+ // server's answer to give, and a malformed entry is dropped rather
9499
+ // than allowed to sink the whole response.
9500
+ const models = Array.isArray(json.models) ? json.models.flatMap(entry => {
9501
+ if (typeof entry !== "object" || entry === null) {
9502
+ return [];
9503
+ }
9504
+ const model = entry;
9505
+ if (typeof model.provider !== "string" || typeof model.model !== "string" || typeof model.label !== "string") {
9506
+ return [];
9507
+ }
9508
+ return [{
9509
+ provider: model.provider,
9510
+ model: model.model,
9511
+ label: model.label,
9512
+ contextWindow: typeof model.contextWindow === "number" ? model.contextWindow : null
9513
+ }];
9514
+ }) : undefined;
9496
9515
  return {
9497
9516
  status: 200,
9498
9517
  json: {
9499
9518
  nonce: json.nonce,
9500
9519
  wsUrl,
9501
- ...(providers ? {
9520
+ // Explicit, because the distinction matters and truthiness
9521
+ // is a bad way to express it: an empty array means "no
9522
+ // reachable provider", which the client must be able to tell
9523
+ // apart from an older server that reports nothing at all.
9524
+ ...(providers !== undefined ? {
9502
9525
  providers
9526
+ } : {}),
9527
+ ...(models !== undefined ? {
9528
+ models
9503
9529
  } : {})
9504
9530
  }
9505
9531
  };
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "./package.json": "./package.json"
17
17
  },
18
18
  "types": "dist/valbuild-server.cjs.d.ts",
19
- "version": "0.117.0",
19
+ "version": "0.118.0",
20
20
  "devDependencies": {
21
21
  "@prettier/sync": "^0.6.1",
22
22
  "@types/jest": "^30.0.0"
@@ -30,8 +30,8 @@
30
30
  "zod": "^4.4.3",
31
31
  "zod-validation-error": "^5.0.0",
32
32
  "@valbuild/core": "0.117.0",
33
- "@valbuild/shared": "0.117.0",
34
- "@valbuild/ui": "0.117.0"
33
+ "@valbuild/shared": "0.118.0",
34
+ "@valbuild/ui": "0.118.0"
35
35
  },
36
36
  "engines": {
37
37
  "node": "^20.19.0 || >=22"