@rizom/brain 0.2.0-alpha.62 → 0.2.0-alpha.63
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 +814 -731
- package/dist/entities.d.ts +71 -69
- package/dist/entities.js.map +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +28 -28
- package/dist/interfaces.js.map +2 -2
- package/dist/plugins.d.ts +196 -120
- package/dist/plugins.js +100 -100
- package/dist/plugins.js.map +16 -13
- package/dist/services.d.ts +73 -61
- package/dist/services.js.map +2 -2
- package/dist/site.js +105 -105
- package/dist/site.js.map +13 -13
- package/package.json +1 -1
package/dist/services.d.ts
CHANGED
|
@@ -89,6 +89,64 @@ declare class Logger {
|
|
|
89
89
|
setUseStderr(useStderr: boolean): void;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Context passed to all DataSource operations
|
|
94
|
+
* Contains internal state that should not be mixed with user query parameters
|
|
95
|
+
*/
|
|
96
|
+
interface BaseDataSourceContext {
|
|
97
|
+
/**
|
|
98
|
+
* Whether to filter to only published/complete content
|
|
99
|
+
* Set by site-builder: true for production, false for preview
|
|
100
|
+
*/
|
|
101
|
+
publishedOnly?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Scoped entity service that auto-applies publishedOnly filter
|
|
104
|
+
* Datasources should use this instead of their injected entityService
|
|
105
|
+
* to ensure consistent filtering behavior across environments
|
|
106
|
+
*/
|
|
107
|
+
entityService: EntityService;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* DataSource Interface
|
|
111
|
+
*
|
|
112
|
+
* Provides data for templates through fetch, generate, or transform operations.
|
|
113
|
+
* DataSources are registered in the DataSourceRegistry and referenced by templates
|
|
114
|
+
* via their dataSourceId property.
|
|
115
|
+
*/
|
|
116
|
+
interface DataSource {
|
|
117
|
+
/**
|
|
118
|
+
* Unique identifier for this data source
|
|
119
|
+
*/
|
|
120
|
+
id: string;
|
|
121
|
+
/**
|
|
122
|
+
* Human-readable name for this data source
|
|
123
|
+
*/
|
|
124
|
+
name: string;
|
|
125
|
+
/**
|
|
126
|
+
* Optional description of what this data source provides
|
|
127
|
+
*/
|
|
128
|
+
description?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Optional: Fetch existing data
|
|
131
|
+
* Used by data sources that aggregate or retrieve data (e.g., dashboard stats, API data)
|
|
132
|
+
* DataSources validate output using the provided schema
|
|
133
|
+
* @param query - Query parameters for fetching data
|
|
134
|
+
* @param outputSchema - Schema for validating output data
|
|
135
|
+
* @param context - Context with environment
|
|
136
|
+
*/
|
|
137
|
+
fetch?: <T>(query: unknown, outputSchema: z.ZodSchema<T>, context: BaseDataSourceContext) => Promise<T>;
|
|
138
|
+
/**
|
|
139
|
+
* Optional: Generate new content
|
|
140
|
+
* Used by data sources that create content (e.g., AI-generated content, reports)
|
|
141
|
+
*/
|
|
142
|
+
generate?: <T>(request: unknown, schema: z.ZodSchema<T>) => Promise<T>;
|
|
143
|
+
/**
|
|
144
|
+
* Optional: Transform content between formats
|
|
145
|
+
* Used by data sources that convert content (e.g., markdown to HTML, data formatting)
|
|
146
|
+
*/
|
|
147
|
+
transform?: <T>(content: unknown, format: string, schema: z.ZodSchema<T>) => Promise<T>;
|
|
148
|
+
}
|
|
149
|
+
|
|
92
150
|
/**
|
|
93
151
|
* Options for entity mutation operations (create, update, upsert)
|
|
94
152
|
*/
|
|
@@ -198,6 +256,19 @@ interface SearchOptions {
|
|
|
198
256
|
/** Score multipliers per entity type - applied after initial search */
|
|
199
257
|
weight?: Record<string, number>;
|
|
200
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* Configuration for entity type registration
|
|
261
|
+
*/
|
|
262
|
+
interface EntityTypeConfig {
|
|
263
|
+
/** Score multiplier for search results (default: 1.0) */
|
|
264
|
+
weight?: number;
|
|
265
|
+
/** Whether to generate embeddings for this entity type (default: true).
|
|
266
|
+
* Set to false for entity types with non-textual content (e.g., images). */
|
|
267
|
+
embeddable?: boolean;
|
|
268
|
+
/** Whether this entity type may be used as source material for derived projections (default: true).
|
|
269
|
+
* Set to false for projection outputs that would create feedback loops. */
|
|
270
|
+
projectionSource?: boolean;
|
|
271
|
+
}
|
|
201
272
|
/**
|
|
202
273
|
* Core entity service interface for read-only operations
|
|
203
274
|
* Used by core plugins that need entity access but shouldn't modify entities
|
|
@@ -258,12 +329,11 @@ interface ICoreEntityService {
|
|
|
258
329
|
entityType: string;
|
|
259
330
|
count: number;
|
|
260
331
|
}>>;
|
|
332
|
+
/** Get configuration for a specific entity type */
|
|
333
|
+
getEntityTypeConfig(type: string): EntityTypeConfig;
|
|
261
334
|
/** Get weight map for all registered entity types with non-default weights */
|
|
262
335
|
getWeightMap(): Record<string, number>;
|
|
263
336
|
}
|
|
264
|
-
/**
|
|
265
|
-
* Entity service interface for managing brain entities
|
|
266
|
-
*/
|
|
267
337
|
interface EntityService extends ICoreEntityService {
|
|
268
338
|
createEntity<T extends BaseEntity>(request: CreateEntityRequest<T>): Promise<EntityMutationResult>;
|
|
269
339
|
createEntityFromMarkdown(request: CreateEntityFromMarkdownRequest): Promise<EntityMutationResult>;
|
|
@@ -288,64 +358,6 @@ interface EntityService extends ICoreEntityService {
|
|
|
288
358
|
} | null>;
|
|
289
359
|
}
|
|
290
360
|
|
|
291
|
-
/**
|
|
292
|
-
* Context passed to all DataSource operations
|
|
293
|
-
* Contains internal state that should not be mixed with user query parameters
|
|
294
|
-
*/
|
|
295
|
-
interface BaseDataSourceContext {
|
|
296
|
-
/**
|
|
297
|
-
* Whether to filter to only published/complete content
|
|
298
|
-
* Set by site-builder: true for production, false for preview
|
|
299
|
-
*/
|
|
300
|
-
publishedOnly?: boolean;
|
|
301
|
-
/**
|
|
302
|
-
* Scoped entity service that auto-applies publishedOnly filter
|
|
303
|
-
* Datasources should use this instead of their injected entityService
|
|
304
|
-
* to ensure consistent filtering behavior across environments
|
|
305
|
-
*/
|
|
306
|
-
entityService: EntityService;
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* DataSource Interface
|
|
310
|
-
*
|
|
311
|
-
* Provides data for templates through fetch, generate, or transform operations.
|
|
312
|
-
* DataSources are registered in the DataSourceRegistry and referenced by templates
|
|
313
|
-
* via their dataSourceId property.
|
|
314
|
-
*/
|
|
315
|
-
interface DataSource {
|
|
316
|
-
/**
|
|
317
|
-
* Unique identifier for this data source
|
|
318
|
-
*/
|
|
319
|
-
id: string;
|
|
320
|
-
/**
|
|
321
|
-
* Human-readable name for this data source
|
|
322
|
-
*/
|
|
323
|
-
name: string;
|
|
324
|
-
/**
|
|
325
|
-
* Optional description of what this data source provides
|
|
326
|
-
*/
|
|
327
|
-
description?: string;
|
|
328
|
-
/**
|
|
329
|
-
* Optional: Fetch existing data
|
|
330
|
-
* Used by data sources that aggregate or retrieve data (e.g., dashboard stats, API data)
|
|
331
|
-
* DataSources validate output using the provided schema
|
|
332
|
-
* @param query - Query parameters for fetching data
|
|
333
|
-
* @param outputSchema - Schema for validating output data
|
|
334
|
-
* @param context - Context with environment
|
|
335
|
-
*/
|
|
336
|
-
fetch?: <T>(query: unknown, outputSchema: z.ZodSchema<T>, context: BaseDataSourceContext) => Promise<T>;
|
|
337
|
-
/**
|
|
338
|
-
* Optional: Generate new content
|
|
339
|
-
* Used by data sources that create content (e.g., AI-generated content, reports)
|
|
340
|
-
*/
|
|
341
|
-
generate?: <T>(request: unknown, schema: z.ZodSchema<T>) => Promise<T>;
|
|
342
|
-
/**
|
|
343
|
-
* Optional: Transform content between formats
|
|
344
|
-
* Used by data sources that convert content (e.g., markdown to HTML, data formatting)
|
|
345
|
-
*/
|
|
346
|
-
transform?: <T>(content: unknown, format: string, schema: z.ZodSchema<T>) => Promise<T>;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
361
|
/**
|
|
350
362
|
* Schema for pagination information
|
|
351
363
|
* Used by datasources that return paginated lists
|