@assistant-ui/react-generative-ui 0.0.4 → 0.0.5

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.
@@ -22,10 +22,15 @@ type PresentToolOptions = {
22
22
  */
23
23
  display?: "standalone";
24
24
  };
25
+ type BackendDefaultMetadata = {
26
+ unstable_backendDefault?: {
27
+ parameters?: boolean;
28
+ };
29
+ };
25
30
  /** The `present` tool, as the model sees it (no client `render`/`execute`). */
26
- type PresentTool = ToolDefinition<Record<string, unknown>, Record<string, never>>;
31
+ type PresentTool = ToolDefinition<Record<string, unknown>, Record<string, never>> & BackendDefaultMetadata;
27
32
  /** The `prompt_user` tool, as the model sees it (no client `render`). */
28
- type PromptUserTool = ToolDefinition<Record<string, unknown>, unknown>;
33
+ type PromptUserTool = ToolDefinition<Record<string, unknown>, unknown> & BackendDefaultMetadata;
29
34
  /** The tool `parameters` schema, built once per instance (see `buildPresentParameters`). */
30
35
  type PresentParameters = JSONSchema7;
31
36
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"JSONGenerativeUI.shared.d.ts","names":[],"sources":["../src/JSONGenerativeUI.shared.ts"],"mappings":";;;;;;KAKY,uBAAA;EAAA;;;;AAMkB;EAA5B,OAAA,EAAS,mBAAmB;AAAA;;KAIlB,kBAAA;EAOH;AAIT;;;;;EAJE,OAAO;AAAA;;KAIG,WAAA,GAAc,cAAA,CACxB,MAAA,mBACA,MAAA;;KAIU,cAAA,GAAiB,cAAc,CAAC,MAAA;;KAYhC,iBAAA,GAAoB,WAAW;AAZ3C;;;;AAAkD;AAAlD,iBAmBgB,eAAA,CACd,UAAA,EAAY,iBAAA,EACZ,OAAA,GAAU,kBAAA;;;;;;;;;;iBAcI,kBAAA,CAAmB,UAAA,EAAY,iBAAA;;;cAAA,WAAA;AAAA"}
1
+ {"version":3,"file":"JSONGenerativeUI.shared.d.ts","names":[],"sources":["../src/JSONGenerativeUI.shared.ts"],"mappings":";;;;;;KAKY,uBAAA;EAAA;;;;AAMkB;EAA5B,OAAA,EAAS,mBAAmB;AAAA;;KAIlB,kBAAA;EAOH;AACP;;;;AAIY;EALZ,OAAO;AAAA;AAAA,KAGJ,sBAAA;EACH,uBAAA;IACE,UAAU;EAAA;AAAA;;KAKF,WAAA,GAAc,cAAA,CACxB,MAAA,mBACA,MAAA,mBAEA,sBAAA;;KAGU,cAAA,GAAiB,cAAA,CAAe,MAAA,8BAC1C,sBAAA;;KAYU,iBAAA,GAAoB,WAAW;;AAhBnB;AAGxB;;;iBAoBgB,eAAA,CACd,UAAA,EAAY,iBAAA,EACZ,OAAA,GAAU,kBAAA;;;;;;;;;AArBY;iBAmCR,kBAAA,CAAmB,UAAA,EAAY,iBAAA;;;cAAA,WAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"JSONGenerativeUI.shared.js","names":[],"sources":["../src/JSONGenerativeUI.shared.ts"],"sourcesContent":["import type { ToolDefinition } from \"@assistant-ui/react\";\nimport type { JSONSchema7 } from \"json-schema\";\nimport type { GenerativeUILibrary } from \"./types\";\n\n/** Options for {@link JSONGenerativeUI}. */\nexport type JSONGenerativeUIOptions = {\n /**\n * The components the model is allowed to render, keyed by the `$type` it\n * selects them with. Author it with `defineGenerativeComponents({ ... })` so a\n * `\"use generative\"` build can split each `render` from its `properties`.\n */\n library: GenerativeUILibrary;\n};\n\n/** Options for {@link JSONGenerativeUI.present}. */\nexport type PresentToolOptions = {\n /**\n * Set `\"standalone\"` to render the component on its own surface (outside the\n * chain-of-thought trace), e.g. a full-bleed artifact like a card. Omit it for\n * the default inline rendering — there is no `\"inline\"` value because that is\n * already the default.\n */\n display?: \"standalone\";\n};\n\n/** The `present` tool, as the model sees it (no client `render`/`execute`). */\nexport type PresentTool = ToolDefinition<\n Record<string, unknown>,\n Record<string, never>\n>;\n\n/** The `prompt_user` tool, as the model sees it (no client `render`). */\nexport type PromptUserTool = ToolDefinition<Record<string, unknown>, unknown>;\n\nconst PRESENT_DESCRIPTION =\n \"Present a UI component to the user. Select a component with `$type` and \" +\n \"provide its props inline; nest components with `children`.\";\n\nconst PROMPT_USER_DESCRIPTION =\n \"Present a UI component to the user and wait for their response. Select a \" +\n \"component with `$type` and provide its props inline; nest components with \" +\n \"`children`. The user interacts with it and the result is returned to you.\";\n\n/** The tool `parameters` schema, built once per instance (see `buildPresentParameters`). */\nexport type PresentParameters = JSONSchema7;\n\n/**\n * The schema-only half of the `present` tool, shared by both builds. The server\n * build returns exactly this; the client build adds `execute` and `render`.\n * Takes the already-built `parameters` so it isn't recomputed per tool.\n */\nexport function presentToolBase(\n parameters: PresentParameters,\n options?: PresentToolOptions,\n) {\n return {\n type: \"frontend\" as const,\n description: PRESENT_DESCRIPTION,\n parameters,\n ...(options?.display !== undefined ? { display: options.display } : {}),\n };\n}\n\n/**\n * The schema-only half of the `prompt_user` tool, shared by both builds. The\n * server build returns exactly this; the client build adds `render`.\n */\nexport function promptUserToolBase(parameters: PresentParameters) {\n return {\n type: \"human\" as const,\n description: PROMPT_USER_DESCRIPTION,\n parameters,\n };\n}\n"],"mappings":";AAkCA,MAAM,sBACJ;AAGF,MAAM,0BACJ;;;;;;AAYF,SAAgB,gBACd,YACA,SACA;CACA,OAAO;EACL,MAAM;EACN,aAAa;EACb;EACA,GAAI,SAAS,YAAY,KAAA,IAAY,EAAE,SAAS,QAAQ,QAAQ,IAAI,CAAC;CACvE;AACF;;;;;AAMA,SAAgB,mBAAmB,YAA+B;CAChE,OAAO;EACL,MAAM;EACN,aAAa;EACb;CACF;AACF"}
1
+ {"version":3,"file":"JSONGenerativeUI.shared.js","names":[],"sources":["../src/JSONGenerativeUI.shared.ts"],"sourcesContent":["import type { ToolDefinition } from \"@assistant-ui/react\";\nimport type { JSONSchema7 } from \"json-schema\";\nimport type { GenerativeUILibrary } from \"./types\";\n\n/** Options for {@link JSONGenerativeUI}. */\nexport type JSONGenerativeUIOptions = {\n /**\n * The components the model is allowed to render, keyed by the `$type` it\n * selects them with. Author it with `defineGenerativeComponents({ ... })` so a\n * `\"use generative\"` build can split each `render` from its `properties`.\n */\n library: GenerativeUILibrary;\n};\n\n/** Options for {@link JSONGenerativeUI.present}. */\nexport type PresentToolOptions = {\n /**\n * Set `\"standalone\"` to render the component on its own surface (outside the\n * chain-of-thought trace), e.g. a full-bleed artifact like a card. Omit it for\n * the default inline rendering — there is no `\"inline\"` value because that is\n * already the default.\n */\n display?: \"standalone\";\n};\n\ntype BackendDefaultMetadata = {\n unstable_backendDefault?: {\n parameters?: boolean;\n };\n};\n\n/** The `present` tool, as the model sees it (no client `render`/`execute`). */\nexport type PresentTool = ToolDefinition<\n Record<string, unknown>,\n Record<string, never>\n> &\n BackendDefaultMetadata;\n\n/** The `prompt_user` tool, as the model sees it (no client `render`). */\nexport type PromptUserTool = ToolDefinition<Record<string, unknown>, unknown> &\n BackendDefaultMetadata;\n\nconst PRESENT_DESCRIPTION =\n \"Present a UI component to the user. Select a component with `$type` and \" +\n \"provide its props inline; nest components with `children`.\";\n\nconst PROMPT_USER_DESCRIPTION =\n \"Present a UI component to the user and wait for their response. Select a \" +\n \"component with `$type` and provide its props inline; nest components with \" +\n \"`children`. The user interacts with it and the result is returned to you.\";\n\n/** The tool `parameters` schema, built once per instance (see `buildPresentParameters`). */\nexport type PresentParameters = JSONSchema7;\n\n/**\n * The schema-only half of the `present` tool, shared by both builds. The server\n * build returns exactly this; the client build adds `execute` and `render`.\n * Takes the already-built `parameters` so it isn't recomputed per tool.\n */\nexport function presentToolBase(\n parameters: PresentParameters,\n options?: PresentToolOptions,\n) {\n return {\n type: \"frontend\" as const,\n description: PRESENT_DESCRIPTION,\n parameters,\n ...(options?.display !== undefined ? { display: options.display } : {}),\n };\n}\n\n/**\n * The schema-only half of the `prompt_user` tool, shared by both builds. The\n * server build returns exactly this; the client build adds `render`.\n */\nexport function promptUserToolBase(parameters: PresentParameters) {\n return {\n type: \"human\" as const,\n description: PROMPT_USER_DESCRIPTION,\n parameters,\n };\n}\n"],"mappings":";AA0CA,MAAM,sBACJ;AAGF,MAAM,0BACJ;;;;;;AAYF,SAAgB,gBACd,YACA,SACA;CACA,OAAO;EACL,MAAM;EACN,aAAa;EACb;EACA,GAAI,SAAS,YAAY,KAAA,IAAY,EAAE,SAAS,QAAQ,QAAQ,IAAI,CAAC;CACvE;AACF;;;;;AAMA,SAAgB,mBAAmB,YAA+B;CAChE,OAAO;EACL,MAAM;EACN,aAAa;EACb;CACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assistant-ui/react-generative-ui",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Generative UI components for assistant-ui",
5
5
  "keywords": [
6
6
  "generative-ui",
@@ -38,7 +38,7 @@
38
38
  ],
39
39
  "sideEffects": false,
40
40
  "dependencies": {
41
- "assistant-stream": "^0.3.21"
41
+ "assistant-stream": "^0.3.23"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@assistant-ui/react": "^0.14.14",
@@ -58,8 +58,8 @@
58
58
  "react-dom": "^19.2.7",
59
59
  "vitest": "^4.1.8",
60
60
  "zod": "^4.4.3",
61
- "@assistant-ui/react": "0.14.18",
62
- "@assistant-ui/x-buildutils": "0.0.12"
61
+ "@assistant-ui/react": "0.14.20",
62
+ "@assistant-ui/x-buildutils": "0.0.14"
63
63
  },
64
64
  "publishConfig": {
65
65
  "access": "public",
@@ -23,14 +23,22 @@ export type PresentToolOptions = {
23
23
  display?: "standalone";
24
24
  };
25
25
 
26
+ type BackendDefaultMetadata = {
27
+ unstable_backendDefault?: {
28
+ parameters?: boolean;
29
+ };
30
+ };
31
+
26
32
  /** The `present` tool, as the model sees it (no client `render`/`execute`). */
27
33
  export type PresentTool = ToolDefinition<
28
34
  Record<string, unknown>,
29
35
  Record<string, never>
30
- >;
36
+ > &
37
+ BackendDefaultMetadata;
31
38
 
32
39
  /** The `prompt_user` tool, as the model sees it (no client `render`). */
33
- export type PromptUserTool = ToolDefinition<Record<string, unknown>, unknown>;
40
+ export type PromptUserTool = ToolDefinition<Record<string, unknown>, unknown> &
41
+ BackendDefaultMetadata;
34
42
 
35
43
  const PRESENT_DESCRIPTION =
36
44
  "Present a UI component to the user. Select a component with `$type` and " +