@rizom/brain 0.2.0-alpha.150 → 0.2.0-alpha.151

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,6 +1,6 @@
1
- import { ZodType, z } from 'zod/v4';
2
- import { VNode } from 'preact';
3
-
1
+ import { ZodType, z } from "zod/v4";
2
+ import { VNode } from "preact";
3
+ //#region ../../shared/content-formatters/src/types.d.ts
4
4
  /**
5
5
  * Interface for content formatters (human-editable content formatting)
6
6
  *
@@ -10,27 +10,28 @@ import { VNode } from 'preact';
10
10
  * content back into structured data.
11
11
  */
12
12
  interface ContentFormatter<T = unknown> {
13
- /**
14
- * Format structured data into human-editable markdown
15
- * @param data - The structured data to format
16
- * @returns Human-editable markdown representation
17
- */
18
- format(data: T): string;
19
- /**
20
- * Parse human-editable markdown back into structured data
21
- * @param content - The markdown content to parse
22
- * @returns Structured data parsed from the markdown
23
- * @throws Error if the content cannot be parsed
24
- */
25
- parse(content: string): T;
13
+ /**
14
+ * Format structured data into human-editable markdown
15
+ * @param data - The structured data to format
16
+ * @returns Human-editable markdown representation
17
+ */
18
+ format(data: T): string;
19
+ /**
20
+ * Parse human-editable markdown back into structured data
21
+ * @param content - The markdown content to parse
22
+ * @returns Structured data parsed from the markdown
23
+ * @throws Error if the content cannot be parsed
24
+ */
25
+ parse(content: string): T;
26
26
  }
27
-
27
+ //#endregion
28
+ //#region ../../shell/templates/src/types.d.ts
28
29
  /**
29
30
  * Component type for layouts - using Preact
30
31
  * Returns a Preact VNode
31
32
  */
32
33
  type ComponentType<P = unknown> = {
33
- bivarianceHack(props: P): VNode;
34
+ bivarianceHack(props: P): VNode;
34
35
  }["bivarianceHack"];
35
36
  type TemplateDataSchema<T> = ZodType<T, unknown>;
36
37
  /**
@@ -44,23 +45,23 @@ type TemplateDataSchema<T> = ZodType<T, unknown>;
44
45
  * head-script registration which fires on every page.
45
46
  */
46
47
  interface RuntimeScript {
47
- src: string;
48
- defer?: boolean;
49
- module?: boolean;
48
+ src: string;
49
+ defer?: boolean;
50
+ module?: boolean;
50
51
  }
51
52
  interface TemplateInput {
52
- name: string;
53
- description: string;
54
- schema: unknown;
55
- basePrompt?: string | undefined;
56
- useKnowledgeContext?: boolean | undefined;
57
- requiredPermission: "anchor" | "trusted" | "public";
58
- formatter?: unknown;
59
- layout?: {
60
- component?: unknown;
61
- fullscreen?: boolean | undefined;
62
- } | undefined;
63
- dataSourceId?: string | undefined;
53
+ name: string;
54
+ description: string;
55
+ schema: unknown;
56
+ basePrompt?: string | undefined;
57
+ useKnowledgeContext?: boolean | undefined;
58
+ requiredPermission: "anchor" | "trusted" | "public";
59
+ formatter?: unknown;
60
+ layout?: {
61
+ component?: unknown;
62
+ fullscreen?: boolean | undefined;
63
+ } | undefined;
64
+ dataSourceId?: string | undefined;
64
65
  }
65
66
  /**
66
67
  * Helper function to create a type-safe component that automatically parses props
@@ -76,23 +77,23 @@ declare function createTypedComponent<TSchema, TComponent = TSchema>(schema: Tem
76
77
  * This is the single source of truth for what constitutes a template
77
78
  */
78
79
  interface Template extends Omit<TemplateInput, "schema" | "layout" | "formatter"> {
79
- schema: TemplateDataSchema<unknown>;
80
- layout?: {
81
- component?: ComponentType<unknown>;
82
- fullscreen?: boolean;
83
- };
84
- formatter?: ContentFormatter<unknown>;
85
- /**
86
- * Whether to retrieve relevant entities from the knowledge base
87
- * and inject them as context before AI generation. Default: false.
88
- */
89
- useKnowledgeContext?: boolean;
90
- /**
91
- * Runtime script dependencies. Loaded only on routes where this
92
- * template actually renders — site-builder collects from all
93
- * templates on a route, dedupes by src, and injects into <head>.
94
- */
95
- runtimeScripts?: RuntimeScript[];
80
+ schema: TemplateDataSchema<unknown>;
81
+ layout?: {
82
+ component?: ComponentType<unknown>;
83
+ fullscreen?: boolean;
84
+ };
85
+ formatter?: ContentFormatter<unknown>;
86
+ /**
87
+ * Whether to retrieve relevant entities from the knowledge base
88
+ * and inject them as context before AI generation. Default: false.
89
+ */
90
+ useKnowledgeContext?: boolean;
91
+ /**
92
+ * Runtime script dependencies. Loaded only on routes where this
93
+ * template actually renders — site-builder collects from all
94
+ * templates on a route, dedupes by src, and injects into <head>.
95
+ */
96
+ runtimeScripts?: RuntimeScript[];
96
97
  }
97
98
  /**
98
99
  * Helper to create a template with automatic component wrapping
@@ -102,33 +103,35 @@ interface Template extends Omit<TemplateInput, "schema" | "layout" | "formatter"
102
103
  * @param TComponent - Type expected by component (after enrichment)
103
104
  */
104
105
  declare function createTemplate<TSchema = unknown, TComponent = TSchema>(template: Omit<Template, "layout" | "schema"> & {
105
- schema: TemplateDataSchema<TSchema>;
106
- layout?: {
107
- component?: ComponentType<TComponent>;
108
- fullscreen?: boolean;
109
- };
110
- runtimeScripts?: RuntimeScript[];
106
+ schema: TemplateDataSchema<TSchema>;
107
+ layout?: {
108
+ component?: ComponentType<TComponent>;
109
+ fullscreen?: boolean;
110
+ };
111
+ runtimeScripts?: RuntimeScript[];
111
112
  }): Template;
112
113
  /**
113
114
  * Template schema for validation
114
115
  */
115
116
  declare const TemplateSchema: z.ZodType<TemplateInput>;
116
-
117
+ //#endregion
118
+ //#region ../../shared/utils/src/progress.d.ts
117
119
  /**
118
120
  * Progress notification for long-running operations
119
121
  */
120
122
  interface ProgressNotification {
121
- progress: number;
122
- total?: number;
123
- message?: string;
124
- rate?: number;
125
- eta?: number;
123
+ progress: number;
124
+ total?: number;
125
+ message?: string;
126
+ rate?: number;
127
+ eta?: number;
126
128
  }
127
129
  /**
128
130
  * Progress callback type
129
131
  */
130
132
  type ProgressCallback = (notification: ProgressNotification) => Promise<void>;
131
-
133
+ //#endregion
134
+ //#region ../../shell/templates/src/render-types.d.ts
132
135
  /**
133
136
  * Site content entity types
134
137
  */
@@ -146,75 +149,75 @@ type WebRenderer<T = unknown> = ComponentType<T> | string;
146
149
  type ImageRenderer<T = unknown> = ComponentType<T> | string;
147
150
  type PdfRenderer<T = unknown> = ComponentType<T> | string;
148
151
  interface ViewTemplateSchemaOutput {
149
- name: string;
150
- schema: unknown;
151
- description?: string | undefined;
152
- pluginId: string;
153
- renderers: {
154
- web?: RendererFunction | string | undefined;
155
- image?: RendererFunction | string | undefined;
156
- pdf?: RendererFunction | string | undefined;
157
- };
152
+ name: string;
153
+ schema: unknown;
154
+ description?: string | undefined;
155
+ pluginId: string;
156
+ renderers: {
157
+ web?: RendererFunction | string | undefined;
158
+ image?: RendererFunction | string | undefined;
159
+ pdf?: RendererFunction | string | undefined;
160
+ };
158
161
  }
159
162
  declare const ViewTemplateSchema: z.ZodType<ViewTemplateSchemaOutput>;
160
163
  /**
161
164
  * View template with support for multiple output formats
162
165
  */
163
166
  interface ViewTemplate<T = unknown> {
164
- name: string;
165
- schema: TemplateDataSchema<T>;
166
- description?: string;
167
- pluginId: string;
168
- renderers: {
169
- web?: WebRenderer<T>;
170
- image?: ImageRenderer<T>;
171
- pdf?: PdfRenderer<T>;
172
- };
173
- fullscreen?: boolean;
174
- providerId?: string;
175
- formatter?: ContentFormatter<T>;
176
- /** Runtime script dependencies (see Template.runtimeScripts). */
177
- runtimeScripts?: RuntimeScript[];
167
+ name: string;
168
+ schema: TemplateDataSchema<T>;
169
+ description?: string;
170
+ pluginId: string;
171
+ renderers: {
172
+ web?: WebRenderer<T>;
173
+ image?: ImageRenderer<T>;
174
+ pdf?: PdfRenderer<T>;
175
+ };
176
+ fullscreen?: boolean;
177
+ providerId?: string;
178
+ formatter?: ContentFormatter<T>;
179
+ /** Runtime script dependencies (see Template.runtimeScripts). */
180
+ runtimeScripts?: RuntimeScript[];
178
181
  }
179
182
  /**
180
183
  * View template registry interface
181
184
  */
182
185
  interface ViewTemplateRegistry {
183
- get(name: string): ViewTemplate<unknown> | undefined;
184
- list(): ViewTemplate<unknown>[];
185
- validate(templateName: string, content: unknown): boolean;
186
+ get(name: string): ViewTemplate<unknown> | undefined;
187
+ list(): ViewTemplate<unknown>[];
188
+ validate(templateName: string, content: unknown): boolean;
186
189
  }
187
190
  interface SiteBuilderOptionsInput {
188
- enableContentGeneration?: boolean | undefined;
189
- outputDir: string;
190
- workingDir?: string | undefined;
191
- environment?: "preview" | "production" | undefined;
192
- siteConfig?: {
193
- title: string;
194
- description: string;
195
- url?: string | undefined;
196
- } | undefined;
191
+ enableContentGeneration?: boolean | undefined;
192
+ outputDir: string;
193
+ workingDir?: string | undefined;
194
+ environment?: "preview" | "production" | undefined;
195
+ siteConfig?: {
196
+ title: string;
197
+ description: string;
198
+ url?: string | undefined;
199
+ } | undefined;
197
200
  }
198
201
  interface SiteBuilderOptions {
199
- enableContentGeneration: boolean;
200
- outputDir: string;
201
- workingDir?: string | undefined;
202
- environment: "preview" | "production";
203
- siteConfig?: {
204
- title: string;
205
- description: string;
206
- url?: string | undefined;
207
- } | undefined;
202
+ enableContentGeneration: boolean;
203
+ outputDir: string;
204
+ workingDir?: string | undefined;
205
+ environment: "preview" | "production";
206
+ siteConfig?: {
207
+ title: string;
208
+ description: string;
209
+ url?: string | undefined;
210
+ } | undefined;
208
211
  }
209
212
  /**
210
213
  * Site builder options
211
214
  */
212
215
  declare const SiteBuilderOptionsSchema: z.ZodType<SiteBuilderOptions, SiteBuilderOptionsInput>;
213
216
  interface BuildResult {
214
- success: boolean;
215
- routesBuilt: number;
216
- errors?: string[] | undefined;
217
- warnings?: string[] | undefined;
217
+ success: boolean;
218
+ routesBuilt: number;
219
+ errors?: string[] | undefined;
220
+ warnings?: string[] | undefined;
218
221
  }
219
222
  /**
220
223
  * Build result schema
@@ -224,8 +227,7 @@ declare const BuildResultSchema: z.ZodType<BuildResult>;
224
227
  * Site builder interface
225
228
  */
226
229
  interface SiteBuilder {
227
- build(options: SiteBuilderOptions, progress?: ProgressCallback): Promise<BuildResult>;
230
+ build(options: SiteBuilderOptions, progress?: ProgressCallback): Promise<BuildResult>;
228
231
  }
229
-
230
- export { BuildResultSchema, SiteBuilderOptionsSchema, SiteContentEntityTypeSchema, TemplateSchema, ViewTemplateSchema, createTemplate, createTypedComponent };
231
- export type { BuildResult, ComponentType, OutputFormat, RuntimeScript, SiteBuilder, SiteBuilderOptions, SiteContentEntityType, Template, TemplateInput, ViewTemplate, ViewTemplateRegistry, WebRenderer };
232
+ //#endregion
233
+ export { type BuildResult, BuildResultSchema, type ComponentType, type OutputFormat, type RuntimeScript, type SiteBuilder, type SiteBuilderOptions, SiteBuilderOptionsSchema, type SiteContentEntityType, SiteContentEntityTypeSchema, type Template, type TemplateInput, TemplateSchema, type ViewTemplate, type ViewTemplateRegistry, ViewTemplateSchema, type WebRenderer, createTemplate, createTypedComponent };
package/dist/themes.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ //#region ../../shared/theme-base/src/index.d.ts
1
2
  /**
2
3
  * Compose a complete theme by prepending shared base utilities.
3
4
  *
@@ -5,5 +6,5 @@
5
6
  * should use @layer theme-override to guarantee correct cascade order.
6
7
  */
7
8
  declare function composeTheme(themeCSS: string): string;
8
-
9
- export { composeTheme };
9
+ //#endregion
10
+ export { composeTheme };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rizom/brain",
3
- "version": "0.2.0-alpha.150",
3
+ "version": "0.2.0-alpha.151",
4
4
  "description": "Brain runtime + CLI — scaffold, run, and manage AI brain instances",
5
5
  "keywords": [
6
6
  "brain",
@@ -48,9 +48,9 @@
48
48
  "@brains/typescript-config": "workspace:*",
49
49
  "@brains/utils": "workspace:*",
50
50
  "@types/bun": "^1.3.14",
51
- "rollup": "^4.62.0",
52
- "rollup-plugin-dts": "^6.4.1",
53
- "typescript": "^6.0.3"
51
+ "rolldown": "^1.0.0",
52
+ "rolldown-plugin-dts": "^0.27.4",
53
+ "typescript": "^7.0.2"
54
54
  },
55
55
  "engines": {
56
56
  "bun": ">=1.3.3"