@svadmin/ai-elements 0.10.3 → 0.11.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/README.md CHANGED
@@ -5,7 +5,7 @@ Composable AI interaction components for Svelte 5 and SVAdmin. The package uses
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- bun add @svadmin/ai-elements @svadmin/core @sinclair/typebox @tanstack/svelte-query svelte
8
+ bun add @svadmin/ai-elements @svadmin/core typebox @tanstack/svelte-query svelte
9
9
  ```
10
10
 
11
11
  Import the package stylesheet once in your application CSS:
@@ -100,7 +100,7 @@ default, so undeclared model-provided props are rejected even when the caller
100
100
  does not set `additionalProperties: false`:
101
101
 
102
102
  ```ts
103
- import { Type } from '@sinclair/typebox';
103
+ import { Type } from 'typebox';
104
104
  import { defineGeneratedComponent } from '@svadmin/ai-elements';
105
105
  import InventorySummary from './InventorySummary.svelte';
106
106
 
@@ -121,7 +121,7 @@ Admin tools use the same TypeBox boundary. Call tools through
121
121
  implementation runs:
122
122
 
123
123
  ```ts
124
- import { Type } from '@sinclair/typebox';
124
+ import { Type } from 'typebox';
125
125
  import { defineAdminTool, executeAdminTool } from '@svadmin/core';
126
126
 
127
127
  const searchInventory = defineAdminTool({
@@ -1,4 +1,4 @@
1
- import type { TObject } from '@sinclair/typebox';
1
+ import type { TObject } from 'typebox';
2
2
  import type { Component, Snippet } from 'svelte';
3
3
  import { type GeneratedComponentSchemaProps } from '../../generated-components.js';
4
4
  export interface JSXPreviewComponentProps {
@@ -1,4 +1,4 @@
1
- import type { StaticDecode, TObject } from '@sinclair/typebox';
1
+ import type { StaticDecode, TObject } from 'typebox';
2
2
  import type { Component } from 'svelte';
3
3
  export type GeneratedComponentProps = Record<string, unknown>;
4
4
  export type GeneratedComponentSchemaProps<Schema extends TObject> = StaticDecode<Schema> extends infer Props extends Record<string, unknown> ? Props : never;
@@ -1,4 +1,4 @@
1
- import { Value } from '@sinclair/typebox/value';
1
+ import { Value } from 'typebox/value';
2
2
  /** Defines Agent-rendered components with a TypeBox schema as the runtime props boundary. */
3
3
  export function defineGeneratedComponent(definition) {
4
4
  return {
@@ -7,7 +7,11 @@ export function defineGeneratedComponent(definition) {
7
7
  };
8
8
  }
9
9
  export function decodeGeneratedObjectProps(schema, input) {
10
- const decoded = Value.Decode(strictGeneratedObjectSchema(schema), input);
10
+ const strict = strictGeneratedObjectSchema(schema);
11
+ if (!Value.Check(strict, input)) {
12
+ throw new TypeError('Generated component props must match the registered schema.');
13
+ }
14
+ const decoded = Value.Decode(strict, input);
11
15
  if (decoded === null || typeof decoded !== 'object' || Array.isArray(decoded)) {
12
16
  throw new TypeError('Generated component props must decode to an object.');
13
17
  }
@@ -38,5 +42,7 @@ export function createGeneratedComponentPrompt(registry, options = {}) {
38
42
  function strictGeneratedObjectSchema(schema) {
39
43
  if (schema.additionalProperties === false)
40
44
  return schema;
41
- return { ...schema, additionalProperties: false };
45
+ const clone = Value.Clone(schema);
46
+ clone.additionalProperties = false;
47
+ return clone;
42
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svadmin/ai-elements",
3
- "version": "0.10.3",
3
+ "version": "0.11.0",
4
4
  "description": "Composable Svelte 5 AI interaction components for SVAdmin",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -56,7 +56,7 @@
56
56
  }
57
57
  },
58
58
  "peerDependencies": {
59
- "@svadmin/core": "^0.58.0",
59
+ "@svadmin/core": "^0.59.0",
60
60
  "@tanstack/svelte-query": "^6.1.48",
61
61
  "svelte": "^5.56.10"
62
62
  },
@@ -68,7 +68,7 @@
68
68
  "dependencies": {
69
69
  "@lucide/svelte": "^1.35.0",
70
70
  "@rive-app/webgl2": "^2.41.0",
71
- "@sinclair/typebox": "^0.34.52",
71
+ "typebox": "^1.3.34",
72
72
  "@xyflow/svelte": "^1.6.5",
73
73
  "type-fest": "^4.41.0",
74
74
  "clsx": "^2.1.1",