@dudousxd/nestjs-agent-react 0.34.5 → 0.35.1

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.
@@ -1,7 +1,7 @@
1
1
  import * as _dudousxd_nestjs_agent_core_genui from '@dudousxd/nestjs-agent-core/genui';
2
2
  import { CatalogOptions, ComponentPresentation, ComponentDefinition } from '@dudousxd/nestjs-agent-core/genui';
3
3
  import { ComponentType, ReactNode } from 'react';
4
- import { h as GenuiRegistry } from './types-DZtFsWec.js';
4
+ import { j as GenuiRegistry } from './types-COuArD3c.js';
5
5
 
6
6
  interface ReactComponentRenderers<P extends object> {
7
7
  react?: ComponentType<P>;
@@ -1,7 +1,7 @@
1
1
  import * as _dudousxd_nestjs_agent_core_genui from '@dudousxd/nestjs-agent-core/genui';
2
2
  import { CatalogOptions, ComponentPresentation, ComponentDefinition } from '@dudousxd/nestjs-agent-core/genui';
3
3
  import { ComponentType, ReactNode } from 'react';
4
- import { h as GenuiRegistry } from './types-DZtFsWec.cjs';
4
+ import { j as GenuiRegistry } from './types-COuArD3c.cjs';
5
5
 
6
6
  interface ReactComponentRenderers<P extends object> {
7
7
  react?: ComponentType<P>;
@@ -11,12 +11,40 @@ interface GenerativeUIItem {
11
11
  props: Record<string, unknown>;
12
12
  version: number | null;
13
13
  toolCallId: string | null;
14
+ /**
15
+ * A preview drawn while the model is still writing the call (genui `streaming: 'partial'`):
16
+ * unvalidated, and replaced in place by the final frame under the same `id`.
17
+ */
18
+ partial?: true;
14
19
  }
15
20
  /** A node of a composed tree (`genui:tree` frames): `{ type, props, children? }`. */
16
21
  interface GenerativeUIElement {
17
22
  type: string;
18
23
  props: Record<string, unknown>;
19
24
  children?: GenerativeUIElement[];
25
+ /**
26
+ * The node's position (`root`, `root.0`, `root.0.2`), carried by partial frames. Stable as the
27
+ * tree grows, and the same rule names the final tree's nodes.
28
+ */
29
+ id?: string;
30
+ /** Partial frames only: the model has not finished writing this node. */
31
+ incomplete?: true;
32
+ /** Partial frames only: a `streaming: 'complete'` component held back until it closes (no props). */
33
+ held?: true;
34
+ }
35
+ /**
36
+ * What a tree node's renderer can learn about its node ({@link useGenuiNode}): which node it is,
37
+ * and whether the model is still writing it. Room is left for more states (data a node is bound
38
+ * to, loading) as separate fields — `incomplete` only ever means "still being written".
39
+ */
40
+ interface GenuiNodeState {
41
+ /** The node's position id (`root`, `root.1.0`): stable from the first preview to the final frame. */
42
+ id: string;
43
+ type: string;
44
+ /** The model has not finished writing this node: props (and children) may still grow. */
45
+ incomplete: boolean;
46
+ /** The node is a placeholder for a component that is only drawn whole (`streaming: 'complete'`). */
47
+ held: boolean;
20
48
  }
21
49
  /**
22
50
  * An app's renderer for one component: it receives the component's props spread, plus `children`
@@ -71,6 +99,11 @@ interface GenerativeUIOptions {
71
99
  root?: GenerativeUIElement;
72
100
  }>;
73
101
  }
102
+ /**
103
+ * Drawn in place of a tree node that is not drawable yet — a `held` node (its component streams
104
+ * `complete`) while the model writes it. Default: the `loading` element.
105
+ */
106
+ type GenuiPlaceholder = ReactNode | ((node: GenuiNodeState) => ReactNode);
74
107
  /** Why an item did not render. */
75
108
  type GenerativeUIProblem = {
76
109
  reason: 'unknown';
@@ -96,4 +129,4 @@ type GenerativeUIState = {
96
129
  status: 'problem';
97
130
  } & GenerativeUIProblem);
98
131
 
99
- export { type GenerativeUIItem as G, type ResolveComponent as R, GENUI_TREE_COMPONENT as a, type GenerativeUIElement as b, type GenerativeUIOptions as c, type GenerativeUIProblem as d, type GenerativeUIState as e, type GenuiCatalogLike as f, type GenuiIssueLike as g, type GenuiRegistry as h, type GenuiRenderer as i };
132
+ export { type GenerativeUIItem as G, type ResolveComponent as R, GENUI_TREE_COMPONENT as a, type GenerativeUIElement as b, type GenerativeUIOptions as c, type GenerativeUIProblem as d, type GenerativeUIState as e, type GenuiCatalogLike as f, type GenuiIssueLike as g, type GenuiNodeState as h, type GenuiPlaceholder as i, type GenuiRegistry as j, type GenuiRenderer as k };
@@ -11,12 +11,40 @@ interface GenerativeUIItem {
11
11
  props: Record<string, unknown>;
12
12
  version: number | null;
13
13
  toolCallId: string | null;
14
+ /**
15
+ * A preview drawn while the model is still writing the call (genui `streaming: 'partial'`):
16
+ * unvalidated, and replaced in place by the final frame under the same `id`.
17
+ */
18
+ partial?: true;
14
19
  }
15
20
  /** A node of a composed tree (`genui:tree` frames): `{ type, props, children? }`. */
16
21
  interface GenerativeUIElement {
17
22
  type: string;
18
23
  props: Record<string, unknown>;
19
24
  children?: GenerativeUIElement[];
25
+ /**
26
+ * The node's position (`root`, `root.0`, `root.0.2`), carried by partial frames. Stable as the
27
+ * tree grows, and the same rule names the final tree's nodes.
28
+ */
29
+ id?: string;
30
+ /** Partial frames only: the model has not finished writing this node. */
31
+ incomplete?: true;
32
+ /** Partial frames only: a `streaming: 'complete'` component held back until it closes (no props). */
33
+ held?: true;
34
+ }
35
+ /**
36
+ * What a tree node's renderer can learn about its node ({@link useGenuiNode}): which node it is,
37
+ * and whether the model is still writing it. Room is left for more states (data a node is bound
38
+ * to, loading) as separate fields — `incomplete` only ever means "still being written".
39
+ */
40
+ interface GenuiNodeState {
41
+ /** The node's position id (`root`, `root.1.0`): stable from the first preview to the final frame. */
42
+ id: string;
43
+ type: string;
44
+ /** The model has not finished writing this node: props (and children) may still grow. */
45
+ incomplete: boolean;
46
+ /** The node is a placeholder for a component that is only drawn whole (`streaming: 'complete'`). */
47
+ held: boolean;
20
48
  }
21
49
  /**
22
50
  * An app's renderer for one component: it receives the component's props spread, plus `children`
@@ -71,6 +99,11 @@ interface GenerativeUIOptions {
71
99
  root?: GenerativeUIElement;
72
100
  }>;
73
101
  }
102
+ /**
103
+ * Drawn in place of a tree node that is not drawable yet — a `held` node (its component streams
104
+ * `complete`) while the model writes it. Default: the `loading` element.
105
+ */
106
+ type GenuiPlaceholder = ReactNode | ((node: GenuiNodeState) => ReactNode);
74
107
  /** Why an item did not render. */
75
108
  type GenerativeUIProblem = {
76
109
  reason: 'unknown';
@@ -96,4 +129,4 @@ type GenerativeUIState = {
96
129
  status: 'problem';
97
130
  } & GenerativeUIProblem);
98
131
 
99
- export { type GenerativeUIItem as G, type ResolveComponent as R, GENUI_TREE_COMPONENT as a, type GenerativeUIElement as b, type GenerativeUIOptions as c, type GenerativeUIProblem as d, type GenerativeUIState as e, type GenuiCatalogLike as f, type GenuiIssueLike as g, type GenuiRegistry as h, type GenuiRenderer as i };
132
+ export { type GenerativeUIItem as G, type ResolveComponent as R, GENUI_TREE_COMPONENT as a, type GenerativeUIElement as b, type GenerativeUIOptions as c, type GenerativeUIProblem as d, type GenerativeUIState as e, type GenuiCatalogLike as f, type GenuiIssueLike as g, type GenuiNodeState as h, type GenuiPlaceholder as i, type GenuiRegistry as j, type GenuiRenderer as k };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dudousxd/nestjs-agent-react",
3
- "version": "0.34.5",
3
+ "version": "0.35.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/DavideCarvalho/nestjs-agent.git",
@@ -103,7 +103,7 @@
103
103
  "dist"
104
104
  ],
105
105
  "dependencies": {
106
- "@dudousxd/nestjs-agent-core": "0.44.1"
106
+ "@dudousxd/nestjs-agent-core": "0.45.1"
107
107
  },
108
108
  "peerDependencies": {
109
109
  "@ai-sdk/react": "^4.0.0",