@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.
- package/dist/brain.js +35 -35
- package/dist/deploy.d.ts +8 -8
- package/dist/entities.d.ts +414 -421
- package/dist/index.d.ts +38 -46
- package/dist/index.js +2 -2
- package/dist/index.js.map +2 -2
- package/dist/interfaces.d.ts +211 -132
- package/dist/plugins.d.ts +967 -954
- package/dist/services.d.ts +399 -397
- package/dist/site.d.ts +63 -66
- package/dist/site.js +4 -4
- package/dist/site.js.map +1 -1
- package/dist/templates.d.ts +117 -115
- package/dist/themes.d.ts +3 -2
- package/package.json +4 -4
package/dist/templates.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ZodType, z } from
|
|
2
|
-
import { VNode } from
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
src: string;
|
|
49
|
+
defer?: boolean;
|
|
50
|
+
module?: boolean;
|
|
50
51
|
}
|
|
51
52
|
interface TemplateInput {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"typescript": "^
|
|
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"
|