@rizom/brain 0.2.0-alpha.62 → 0.2.0-alpha.64
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 +1090 -920
- package/dist/entities.d.ts +71 -69
- package/dist/entities.js +2 -2
- package/dist/entities.js.map +3 -3
- 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 +274 -122
- package/dist/plugins.js +99 -99
- package/dist/plugins.js.map +23 -20
- package/dist/services.d.ts +73 -61
- package/dist/services.js +2 -2
- package/dist/services.js.map +3 -3
- package/dist/site.js +107 -107
- package/dist/site.js.map +25 -22
- package/package.json +1 -1
package/dist/plugins.d.ts
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Context passed to all DataSource operations
|
|
5
|
+
* Contains internal state that should not be mixed with user query parameters
|
|
6
|
+
*/
|
|
7
|
+
interface BaseDataSourceContext {
|
|
8
|
+
/**
|
|
9
|
+
* Whether to filter to only published/complete content
|
|
10
|
+
* Set by site-builder: true for production, false for preview
|
|
11
|
+
*/
|
|
12
|
+
publishedOnly?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Scoped entity service that auto-applies publishedOnly filter
|
|
15
|
+
* Datasources should use this instead of their injected entityService
|
|
16
|
+
* to ensure consistent filtering behavior across environments
|
|
17
|
+
*/
|
|
18
|
+
entityService: EntityService;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* DataSource Interface
|
|
22
|
+
*
|
|
23
|
+
* Provides data for templates through fetch, generate, or transform operations.
|
|
24
|
+
* DataSources are registered in the DataSourceRegistry and referenced by templates
|
|
25
|
+
* via their dataSourceId property.
|
|
26
|
+
*/
|
|
27
|
+
interface DataSource {
|
|
28
|
+
/**
|
|
29
|
+
* Unique identifier for this data source
|
|
30
|
+
*/
|
|
31
|
+
id: string;
|
|
32
|
+
/**
|
|
33
|
+
* Human-readable name for this data source
|
|
34
|
+
*/
|
|
35
|
+
name: string;
|
|
36
|
+
/**
|
|
37
|
+
* Optional description of what this data source provides
|
|
38
|
+
*/
|
|
39
|
+
description?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Optional: Fetch existing data
|
|
42
|
+
* Used by data sources that aggregate or retrieve data (e.g., dashboard stats, API data)
|
|
43
|
+
* DataSources validate output using the provided schema
|
|
44
|
+
* @param query - Query parameters for fetching data
|
|
45
|
+
* @param outputSchema - Schema for validating output data
|
|
46
|
+
* @param context - Context with environment
|
|
47
|
+
*/
|
|
48
|
+
fetch?: <T>(query: unknown, outputSchema: z.ZodSchema<T>, context: BaseDataSourceContext) => Promise<T>;
|
|
49
|
+
/**
|
|
50
|
+
* Optional: Generate new content
|
|
51
|
+
* Used by data sources that create content (e.g., AI-generated content, reports)
|
|
52
|
+
*/
|
|
53
|
+
generate?: <T>(request: unknown, schema: z.ZodSchema<T>) => Promise<T>;
|
|
54
|
+
/**
|
|
55
|
+
* Optional: Transform content between formats
|
|
56
|
+
* Used by data sources that convert content (e.g., markdown to HTML, data formatting)
|
|
57
|
+
*/
|
|
58
|
+
transform?: <T>(content: unknown, format: string, schema: z.ZodSchema<T>) => Promise<T>;
|
|
59
|
+
}
|
|
60
|
+
|
|
3
61
|
/**
|
|
4
62
|
* Options for entity mutation operations (create, update, upsert)
|
|
5
63
|
*/
|
|
@@ -116,6 +174,7 @@ type CreateInterceptionResult = {
|
|
|
116
174
|
kind: "continue";
|
|
117
175
|
input: CreateInput;
|
|
118
176
|
};
|
|
177
|
+
type CreateInterceptor = (input: CreateInput, executionContext: CreateExecutionContext) => Promise<CreateInterceptionResult>;
|
|
119
178
|
/**
|
|
120
179
|
* Interface for entity adapter - handles conversion between entities and markdown
|
|
121
180
|
* following the hybrid storage model
|
|
@@ -192,21 +251,24 @@ interface EntityTypeConfig {
|
|
|
192
251
|
/** Whether to generate embeddings for this entity type (default: true).
|
|
193
252
|
* Set to false for entity types with non-textual content (e.g., images). */
|
|
194
253
|
embeddable?: boolean;
|
|
254
|
+
/** Whether this entity type may be used as source material for derived projections (default: true).
|
|
255
|
+
* Set to false for projection outputs that would create feedback loops. */
|
|
256
|
+
projectionSource?: boolean;
|
|
195
257
|
}
|
|
196
258
|
/**
|
|
197
259
|
* Core entity service interface for read-only operations
|
|
198
260
|
* Used by core plugins that need entity access but shouldn't modify entities
|
|
199
261
|
*/
|
|
200
|
-
interface GetEntityRequest
|
|
262
|
+
interface GetEntityRequest {
|
|
201
263
|
entityType: string;
|
|
202
264
|
id: string;
|
|
203
265
|
}
|
|
204
|
-
type GetEntityRawRequest = GetEntityRequest
|
|
205
|
-
interface ListEntitiesRequest
|
|
266
|
+
type GetEntityRawRequest = GetEntityRequest;
|
|
267
|
+
interface ListEntitiesRequest {
|
|
206
268
|
entityType: string;
|
|
207
269
|
options?: ListOptions | undefined;
|
|
208
270
|
}
|
|
209
|
-
interface CountEntitiesRequest
|
|
271
|
+
interface CountEntitiesRequest {
|
|
210
272
|
entityType: string;
|
|
211
273
|
options?: Pick<ListOptions, "publishedOnly" | "filter"> | undefined;
|
|
212
274
|
}
|
|
@@ -230,7 +292,7 @@ interface UpsertEntityRequest<T extends BaseEntity> {
|
|
|
230
292
|
entity: T;
|
|
231
293
|
options?: EntityJobOptions | undefined;
|
|
232
294
|
}
|
|
233
|
-
interface EntitySearchRequest
|
|
295
|
+
interface EntitySearchRequest {
|
|
234
296
|
query: string;
|
|
235
297
|
options?: SearchOptions | undefined;
|
|
236
298
|
}
|
|
@@ -238,27 +300,48 @@ interface SearchWithDistancesRequest {
|
|
|
238
300
|
query: string;
|
|
239
301
|
}
|
|
240
302
|
interface ICoreEntityService {
|
|
241
|
-
getEntity<T extends BaseEntity>(request: GetEntityRequest
|
|
303
|
+
getEntity<T extends BaseEntity>(request: GetEntityRequest): Promise<T | null>;
|
|
242
304
|
/**
|
|
243
305
|
* Get entity without content resolution (raw)
|
|
244
306
|
* Used internally to avoid recursion when resolving image references
|
|
245
307
|
*/
|
|
246
308
|
getEntityRaw<T extends BaseEntity>(request: GetEntityRawRequest): Promise<T | null>;
|
|
247
|
-
listEntities<T extends BaseEntity>(request: ListEntitiesRequest
|
|
248
|
-
search<T extends BaseEntity = BaseEntity>(request: EntitySearchRequest
|
|
309
|
+
listEntities<T extends BaseEntity>(request: ListEntitiesRequest): Promise<T[]>;
|
|
310
|
+
search<T extends BaseEntity = BaseEntity>(request: EntitySearchRequest): Promise<SearchResult<T>[]>;
|
|
249
311
|
getEntityTypes(): string[];
|
|
250
312
|
hasEntityType(type: string): boolean;
|
|
251
|
-
countEntities(request: CountEntitiesRequest
|
|
313
|
+
countEntities(request: CountEntitiesRequest): Promise<number>;
|
|
252
314
|
getEntityCounts(): Promise<Array<{
|
|
253
315
|
entityType: string;
|
|
254
316
|
count: number;
|
|
255
317
|
}>>;
|
|
318
|
+
/** Get configuration for a specific entity type */
|
|
319
|
+
getEntityTypeConfig(type: string): EntityTypeConfig;
|
|
256
320
|
/** Get weight map for all registered entity types with non-default weights */
|
|
257
321
|
getWeightMap(): Record<string, number>;
|
|
258
322
|
}
|
|
259
323
|
/**
|
|
260
324
|
* Entity service interface for managing brain entities
|
|
261
325
|
*/
|
|
326
|
+
interface IEntitiesNamespace {
|
|
327
|
+
/** Register a new entity type with schema and adapter */
|
|
328
|
+
register<TEntity extends BaseEntity>(entityType: string, schema: z.ZodSchema<TEntity>, adapter: EntityAdapter<TEntity>, config?: EntityTypeConfig): void;
|
|
329
|
+
/** Get the adapter for an entity type */
|
|
330
|
+
getAdapter<TEntity extends BaseEntity>(entityType: string): EntityAdapter<TEntity> | undefined;
|
|
331
|
+
/** Extend an adapter's frontmatterSchema with additional fields */
|
|
332
|
+
extendFrontmatterSchema(type: string, extension: z.ZodObject<z.ZodRawShape>): void;
|
|
333
|
+
/** Get effective frontmatter schema (base + extensions) for an entity type */
|
|
334
|
+
getEffectiveFrontmatterSchema(type: string): z.ZodObject<z.ZodRawShape> | undefined;
|
|
335
|
+
/** Update an existing entity */
|
|
336
|
+
update<TEntity extends BaseEntity>(entity: TEntity): Promise<{
|
|
337
|
+
entityId: string;
|
|
338
|
+
jobId: string;
|
|
339
|
+
}>;
|
|
340
|
+
/** Register a data source for dynamic content */
|
|
341
|
+
registerDataSource(dataSource: DataSource): void;
|
|
342
|
+
/** Register a create interceptor for this plugin's entity type */
|
|
343
|
+
registerCreateInterceptor(entityType: string, interceptor: CreateInterceptor): void;
|
|
344
|
+
}
|
|
262
345
|
interface EntityService extends ICoreEntityService {
|
|
263
346
|
createEntity<T extends BaseEntity>(request: CreateEntityRequest<T>): Promise<EntityMutationResult>;
|
|
264
347
|
createEntityFromMarkdown(request: CreateEntityFromMarkdownRequest): Promise<EntityMutationResult>;
|
|
@@ -284,78 +367,102 @@ interface EntityService extends ICoreEntityService {
|
|
|
284
367
|
}
|
|
285
368
|
|
|
286
369
|
/**
|
|
287
|
-
*
|
|
288
|
-
* Contains internal state that should not be mixed with user query parameters
|
|
289
|
-
*/
|
|
290
|
-
interface BaseDataSourceContext {
|
|
291
|
-
/**
|
|
292
|
-
* Whether to filter to only published/complete content
|
|
293
|
-
* Set by site-builder: true for production, false for preview
|
|
294
|
-
*/
|
|
295
|
-
publishedOnly?: boolean;
|
|
296
|
-
/**
|
|
297
|
-
* Scoped entity service that auto-applies publishedOnly filter
|
|
298
|
-
* Datasources should use this instead of their injected entityService
|
|
299
|
-
* to ensure consistent filtering behavior across environments
|
|
300
|
-
*/
|
|
301
|
-
entityService: EntityService;
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* DataSource Interface
|
|
305
|
-
*
|
|
306
|
-
* Provides data for templates through fetch, generate, or transform operations.
|
|
307
|
-
* DataSources are registered in the DataSourceRegistry and referenced by templates
|
|
308
|
-
* via their dataSourceId property.
|
|
370
|
+
* User permission level schema
|
|
309
371
|
*/
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
* Unique identifier for this data source
|
|
313
|
-
*/
|
|
314
|
-
id: string;
|
|
315
|
-
/**
|
|
316
|
-
* Human-readable name for this data source
|
|
317
|
-
*/
|
|
318
|
-
name: string;
|
|
319
|
-
/**
|
|
320
|
-
* Optional description of what this data source provides
|
|
321
|
-
*/
|
|
322
|
-
description?: string;
|
|
323
|
-
/**
|
|
324
|
-
* Optional: Fetch existing data
|
|
325
|
-
* Used by data sources that aggregate or retrieve data (e.g., dashboard stats, API data)
|
|
326
|
-
* DataSources validate output using the provided schema
|
|
327
|
-
* @param query - Query parameters for fetching data
|
|
328
|
-
* @param outputSchema - Schema for validating output data
|
|
329
|
-
* @param context - Context with environment
|
|
330
|
-
*/
|
|
331
|
-
fetch?: <T>(query: unknown, outputSchema: z.ZodSchema<T>, context: BaseDataSourceContext) => Promise<T>;
|
|
332
|
-
/**
|
|
333
|
-
* Optional: Generate new content
|
|
334
|
-
* Used by data sources that create content (e.g., AI-generated content, reports)
|
|
335
|
-
*/
|
|
336
|
-
generate?: <T>(request: unknown, schema: z.ZodSchema<T>) => Promise<T>;
|
|
337
|
-
/**
|
|
338
|
-
* Optional: Transform content between formats
|
|
339
|
-
* Used by data sources that convert content (e.g., markdown to HTML, data formatting)
|
|
340
|
-
*/
|
|
341
|
-
transform?: <T>(content: unknown, format: string, schema: z.ZodSchema<T>) => Promise<T>;
|
|
342
|
-
}
|
|
372
|
+
declare const UserPermissionLevelSchema: z.ZodEnum<["anchor", "trusted", "public"]>;
|
|
373
|
+
type UserPermissionLevel = z.infer<typeof UserPermissionLevelSchema>;
|
|
343
374
|
|
|
344
375
|
declare const ChatContextSchema: z.ZodObject<{
|
|
345
|
-
userPermissionLevel: z.ZodOptional<z.ZodEnum<["
|
|
376
|
+
userPermissionLevel: z.ZodOptional<z.ZodEnum<["anchor", "trusted", "public"]>>;
|
|
346
377
|
interfaceType: z.ZodOptional<z.ZodString>;
|
|
347
378
|
channelId: z.ZodOptional<z.ZodString>;
|
|
348
379
|
channelName: z.ZodOptional<z.ZodString>;
|
|
380
|
+
actor: z.ZodOptional<z.ZodObject<{
|
|
381
|
+
actorId: z.ZodString;
|
|
382
|
+
canonicalId: z.ZodOptional<z.ZodString>;
|
|
383
|
+
interfaceType: z.ZodString;
|
|
384
|
+
role: z.ZodEnum<["user", "assistant", "system"]>;
|
|
385
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
386
|
+
username: z.ZodOptional<z.ZodString>;
|
|
387
|
+
isBot: z.ZodOptional<z.ZodBoolean>;
|
|
388
|
+
}, "strip", z.ZodTypeAny, {
|
|
389
|
+
interfaceType: string;
|
|
390
|
+
actorId: string;
|
|
391
|
+
role: "user" | "assistant" | "system";
|
|
392
|
+
canonicalId?: string | undefined;
|
|
393
|
+
displayName?: string | undefined;
|
|
394
|
+
username?: string | undefined;
|
|
395
|
+
isBot?: boolean | undefined;
|
|
396
|
+
}, {
|
|
397
|
+
interfaceType: string;
|
|
398
|
+
actorId: string;
|
|
399
|
+
role: "user" | "assistant" | "system";
|
|
400
|
+
canonicalId?: string | undefined;
|
|
401
|
+
displayName?: string | undefined;
|
|
402
|
+
username?: string | undefined;
|
|
403
|
+
isBot?: boolean | undefined;
|
|
404
|
+
}>>;
|
|
405
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
406
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
407
|
+
channelId: z.ZodOptional<z.ZodString>;
|
|
408
|
+
channelName: z.ZodOptional<z.ZodString>;
|
|
409
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
410
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
411
|
+
}, "strip", z.ZodTypeAny, {
|
|
412
|
+
channelId?: string | undefined;
|
|
413
|
+
channelName?: string | undefined;
|
|
414
|
+
messageId?: string | undefined;
|
|
415
|
+
threadId?: string | undefined;
|
|
416
|
+
metadata?: Record<string, unknown> | undefined;
|
|
417
|
+
}, {
|
|
418
|
+
channelId?: string | undefined;
|
|
419
|
+
channelName?: string | undefined;
|
|
420
|
+
messageId?: string | undefined;
|
|
421
|
+
threadId?: string | undefined;
|
|
422
|
+
metadata?: Record<string, unknown> | undefined;
|
|
423
|
+
}>>;
|
|
349
424
|
}, "strip", z.ZodTypeAny, {
|
|
350
|
-
userPermissionLevel?: "
|
|
425
|
+
userPermissionLevel?: "anchor" | "trusted" | "public" | undefined;
|
|
351
426
|
interfaceType?: string | undefined;
|
|
352
427
|
channelId?: string | undefined;
|
|
353
428
|
channelName?: string | undefined;
|
|
429
|
+
actor?: {
|
|
430
|
+
interfaceType: string;
|
|
431
|
+
actorId: string;
|
|
432
|
+
role: "user" | "assistant" | "system";
|
|
433
|
+
canonicalId?: string | undefined;
|
|
434
|
+
displayName?: string | undefined;
|
|
435
|
+
username?: string | undefined;
|
|
436
|
+
isBot?: boolean | undefined;
|
|
437
|
+
} | undefined;
|
|
438
|
+
source?: {
|
|
439
|
+
channelId?: string | undefined;
|
|
440
|
+
channelName?: string | undefined;
|
|
441
|
+
messageId?: string | undefined;
|
|
442
|
+
threadId?: string | undefined;
|
|
443
|
+
metadata?: Record<string, unknown> | undefined;
|
|
444
|
+
} | undefined;
|
|
354
445
|
}, {
|
|
355
|
-
userPermissionLevel?: "
|
|
446
|
+
userPermissionLevel?: "anchor" | "trusted" | "public" | undefined;
|
|
356
447
|
interfaceType?: string | undefined;
|
|
357
448
|
channelId?: string | undefined;
|
|
358
449
|
channelName?: string | undefined;
|
|
450
|
+
actor?: {
|
|
451
|
+
interfaceType: string;
|
|
452
|
+
actorId: string;
|
|
453
|
+
role: "user" | "assistant" | "system";
|
|
454
|
+
canonicalId?: string | undefined;
|
|
455
|
+
displayName?: string | undefined;
|
|
456
|
+
username?: string | undefined;
|
|
457
|
+
isBot?: boolean | undefined;
|
|
458
|
+
} | undefined;
|
|
459
|
+
source?: {
|
|
460
|
+
channelId?: string | undefined;
|
|
461
|
+
channelName?: string | undefined;
|
|
462
|
+
messageId?: string | undefined;
|
|
463
|
+
threadId?: string | undefined;
|
|
464
|
+
metadata?: Record<string, unknown> | undefined;
|
|
465
|
+
} | undefined;
|
|
359
466
|
}>;
|
|
360
467
|
type ChatContext = z.infer<typeof ChatContextSchema>;
|
|
361
468
|
declare const PendingConfirmationSchema: z.ZodObject<{
|
|
@@ -482,6 +589,16 @@ declare const AppInfoSchema: z.ZodObject<{
|
|
|
482
589
|
version: z.ZodString;
|
|
483
590
|
uptime: z.ZodNumber;
|
|
484
591
|
entities: z.ZodNumber;
|
|
592
|
+
entityCounts: z.ZodArray<z.ZodObject<{
|
|
593
|
+
entityType: z.ZodString;
|
|
594
|
+
count: z.ZodNumber;
|
|
595
|
+
}, "strip", z.ZodTypeAny, {
|
|
596
|
+
entityType: string;
|
|
597
|
+
count: number;
|
|
598
|
+
}, {
|
|
599
|
+
entityType: string;
|
|
600
|
+
count: number;
|
|
601
|
+
}>, "many">;
|
|
485
602
|
embeddings: z.ZodNumber;
|
|
486
603
|
ai: z.ZodObject<{
|
|
487
604
|
model: z.ZodString;
|
|
@@ -538,23 +655,61 @@ declare const AppInfoSchema: z.ZodObject<{
|
|
|
538
655
|
label: z.ZodString;
|
|
539
656
|
url: z.ZodString;
|
|
540
657
|
pluginId: z.ZodString;
|
|
541
|
-
priority: z.ZodNumber
|
|
658
|
+
priority: z.ZodDefault<z.ZodNumber>;
|
|
659
|
+
visibility: z.ZodDefault<z.ZodEnum<["anchor", "trusted", "public"]>>;
|
|
542
660
|
}, "strip", z.ZodTypeAny, {
|
|
543
661
|
pluginId: string;
|
|
544
662
|
label: string;
|
|
545
663
|
url: string;
|
|
546
664
|
priority: number;
|
|
665
|
+
visibility: "anchor" | "trusted" | "public";
|
|
547
666
|
}, {
|
|
548
667
|
pluginId: string;
|
|
549
668
|
label: string;
|
|
550
669
|
url: string;
|
|
670
|
+
priority?: number | undefined;
|
|
671
|
+
visibility?: "anchor" | "trusted" | "public" | undefined;
|
|
672
|
+
}>, "many">;
|
|
673
|
+
interactions: z.ZodArray<z.ZodObject<{
|
|
674
|
+
id: z.ZodString;
|
|
675
|
+
label: z.ZodString;
|
|
676
|
+
description: z.ZodOptional<z.ZodString>;
|
|
677
|
+
href: z.ZodString;
|
|
678
|
+
kind: z.ZodEnum<["human", "agent", "admin", "protocol"]>;
|
|
679
|
+
pluginId: z.ZodString;
|
|
680
|
+
priority: z.ZodDefault<z.ZodNumber>;
|
|
681
|
+
visibility: z.ZodDefault<z.ZodEnum<["anchor", "trusted", "public"]>>;
|
|
682
|
+
status: z.ZodDefault<z.ZodEnum<["available", "coming-soon", "disabled"]>>;
|
|
683
|
+
}, "strip", z.ZodTypeAny, {
|
|
684
|
+
status: "available" | "coming-soon" | "disabled";
|
|
685
|
+
pluginId: string;
|
|
686
|
+
label: string;
|
|
551
687
|
priority: number;
|
|
688
|
+
visibility: "anchor" | "trusted" | "public";
|
|
689
|
+
id: string;
|
|
690
|
+
href: string;
|
|
691
|
+
kind: "human" | "agent" | "admin" | "protocol";
|
|
692
|
+
description?: string | undefined;
|
|
693
|
+
}, {
|
|
694
|
+
pluginId: string;
|
|
695
|
+
label: string;
|
|
696
|
+
id: string;
|
|
697
|
+
href: string;
|
|
698
|
+
kind: "human" | "agent" | "admin" | "protocol";
|
|
699
|
+
status?: "available" | "coming-soon" | "disabled" | undefined;
|
|
700
|
+
description?: string | undefined;
|
|
701
|
+
priority?: number | undefined;
|
|
702
|
+
visibility?: "anchor" | "trusted" | "public" | undefined;
|
|
552
703
|
}>, "many">;
|
|
553
704
|
}, "strip", z.ZodTypeAny, {
|
|
554
705
|
model: string;
|
|
555
706
|
version: string;
|
|
556
707
|
uptime: number;
|
|
557
708
|
entities: number;
|
|
709
|
+
entityCounts: {
|
|
710
|
+
entityType: string;
|
|
711
|
+
count: number;
|
|
712
|
+
}[];
|
|
558
713
|
embeddings: number;
|
|
559
714
|
ai: {
|
|
560
715
|
model: string;
|
|
@@ -576,12 +731,28 @@ declare const AppInfoSchema: z.ZodObject<{
|
|
|
576
731
|
label: string;
|
|
577
732
|
url: string;
|
|
578
733
|
priority: number;
|
|
734
|
+
visibility: "anchor" | "trusted" | "public";
|
|
735
|
+
}[];
|
|
736
|
+
interactions: {
|
|
737
|
+
status: "available" | "coming-soon" | "disabled";
|
|
738
|
+
pluginId: string;
|
|
739
|
+
label: string;
|
|
740
|
+
priority: number;
|
|
741
|
+
visibility: "anchor" | "trusted" | "public";
|
|
742
|
+
id: string;
|
|
743
|
+
href: string;
|
|
744
|
+
kind: "human" | "agent" | "admin" | "protocol";
|
|
745
|
+
description?: string | undefined;
|
|
579
746
|
}[];
|
|
580
747
|
}, {
|
|
581
748
|
model: string;
|
|
582
749
|
version: string;
|
|
583
750
|
uptime: number;
|
|
584
751
|
entities: number;
|
|
752
|
+
entityCounts: {
|
|
753
|
+
entityType: string;
|
|
754
|
+
count: number;
|
|
755
|
+
}[];
|
|
585
756
|
embeddings: number;
|
|
586
757
|
ai: {
|
|
587
758
|
model: string;
|
|
@@ -602,7 +773,19 @@ declare const AppInfoSchema: z.ZodObject<{
|
|
|
602
773
|
pluginId: string;
|
|
603
774
|
label: string;
|
|
604
775
|
url: string;
|
|
605
|
-
priority
|
|
776
|
+
priority?: number | undefined;
|
|
777
|
+
visibility?: "anchor" | "trusted" | "public" | undefined;
|
|
778
|
+
}[];
|
|
779
|
+
interactions: {
|
|
780
|
+
pluginId: string;
|
|
781
|
+
label: string;
|
|
782
|
+
id: string;
|
|
783
|
+
href: string;
|
|
784
|
+
kind: "human" | "agent" | "admin" | "protocol";
|
|
785
|
+
status?: "available" | "coming-soon" | "disabled" | undefined;
|
|
786
|
+
description?: string | undefined;
|
|
787
|
+
priority?: number | undefined;
|
|
788
|
+
visibility?: "anchor" | "trusted" | "public" | undefined;
|
|
606
789
|
}[];
|
|
607
790
|
}>;
|
|
608
791
|
type AppInfo = z.infer<typeof AppInfoSchema>;
|
|
@@ -621,24 +804,24 @@ declare const ConversationSchema: z.ZodObject<{
|
|
|
621
804
|
}, "strip", z.ZodTypeAny, {
|
|
622
805
|
interfaceType: string;
|
|
623
806
|
channelId: string;
|
|
807
|
+
metadata: Record<string, unknown>;
|
|
624
808
|
id: string;
|
|
625
809
|
sessionId: string;
|
|
626
810
|
startedAt: string;
|
|
627
811
|
lastActiveAt: string;
|
|
628
812
|
createdAt: string;
|
|
629
813
|
updatedAt: string;
|
|
630
|
-
metadata: Record<string, unknown>;
|
|
631
814
|
channelName?: string | undefined;
|
|
632
815
|
}, {
|
|
633
816
|
interfaceType: string;
|
|
634
817
|
channelId: string;
|
|
818
|
+
metadata: Record<string, unknown>;
|
|
635
819
|
id: string;
|
|
636
820
|
sessionId: string;
|
|
637
821
|
startedAt: string;
|
|
638
822
|
lastActiveAt: string;
|
|
639
823
|
createdAt: string;
|
|
640
824
|
updatedAt: string;
|
|
641
|
-
metadata: Record<string, unknown>;
|
|
642
825
|
channelName?: string | undefined;
|
|
643
826
|
}>;
|
|
644
827
|
type Conversation = z.infer<typeof ConversationSchema>;
|
|
@@ -652,17 +835,17 @@ declare const MessageSchema: z.ZodObject<{
|
|
|
652
835
|
timestamp: z.ZodString;
|
|
653
836
|
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
654
837
|
}, "strip", z.ZodTypeAny, {
|
|
655
|
-
|
|
838
|
+
role: "user" | "assistant" | "system";
|
|
656
839
|
metadata: Record<string, unknown>;
|
|
840
|
+
id: string;
|
|
657
841
|
conversationId: string;
|
|
658
|
-
role: "user" | "assistant" | "system";
|
|
659
842
|
content: string;
|
|
660
843
|
timestamp: string;
|
|
661
844
|
}, {
|
|
662
|
-
|
|
845
|
+
role: "user" | "assistant" | "system";
|
|
663
846
|
metadata: Record<string, unknown>;
|
|
847
|
+
id: string;
|
|
664
848
|
conversationId: string;
|
|
665
|
-
role: "user" | "assistant" | "system";
|
|
666
849
|
content: string;
|
|
667
850
|
timestamp: string;
|
|
668
851
|
}>;
|
|
@@ -674,14 +857,14 @@ declare const BrainCharacterSchema: z.ZodObject<{
|
|
|
674
857
|
purpose: z.ZodString;
|
|
675
858
|
values: z.ZodArray<z.ZodString, "many">;
|
|
676
859
|
}, "strip", z.ZodTypeAny, {
|
|
860
|
+
role: string;
|
|
677
861
|
values: string[];
|
|
678
862
|
name: string;
|
|
679
|
-
role: string;
|
|
680
863
|
purpose: string;
|
|
681
864
|
}, {
|
|
865
|
+
role: string;
|
|
682
866
|
values: string[];
|
|
683
867
|
name: string;
|
|
684
|
-
role: string;
|
|
685
868
|
purpose: string;
|
|
686
869
|
}>;
|
|
687
870
|
type BrainCharacter = z.infer<typeof BrainCharacterSchema>;
|
|
@@ -781,16 +964,16 @@ declare const BaseMessageSchema: z.ZodObject<{
|
|
|
781
964
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
782
965
|
}, "strip", z.ZodTypeAny, {
|
|
783
966
|
type: string;
|
|
967
|
+
source: string;
|
|
784
968
|
id: string;
|
|
785
969
|
timestamp: string;
|
|
786
|
-
source: string;
|
|
787
970
|
metadata?: Record<string, unknown> | undefined;
|
|
788
971
|
target?: string | undefined;
|
|
789
972
|
}, {
|
|
790
973
|
type: string;
|
|
974
|
+
source: string;
|
|
791
975
|
id: string;
|
|
792
976
|
timestamp: string;
|
|
793
|
-
source: string;
|
|
794
977
|
metadata?: Record<string, unknown> | undefined;
|
|
795
978
|
target?: string | undefined;
|
|
796
979
|
}>;
|
|
@@ -814,7 +997,7 @@ interface MessageContext {
|
|
|
814
997
|
messageId?: string;
|
|
815
998
|
timestamp?: string;
|
|
816
999
|
interfaceType?: string;
|
|
817
|
-
userPermissionLevel?:
|
|
1000
|
+
userPermissionLevel?: UserPermissionLevel;
|
|
818
1001
|
threadId?: string;
|
|
819
1002
|
}
|
|
820
1003
|
|
|
@@ -856,7 +1039,7 @@ interface ToolResponse<T = unknown> {
|
|
|
856
1039
|
data?: T;
|
|
857
1040
|
error?: string;
|
|
858
1041
|
}
|
|
859
|
-
type ToolVisibility =
|
|
1042
|
+
type ToolVisibility = UserPermissionLevel;
|
|
860
1043
|
interface ToolConfirmation {
|
|
861
1044
|
required: boolean;
|
|
862
1045
|
message?: string;
|
|
@@ -953,34 +1136,9 @@ interface Channel<TPayload, TResponse = unknown> {
|
|
|
953
1136
|
readonly _response?: TResponse;
|
|
954
1137
|
}
|
|
955
1138
|
declare function defineChannel<TPayload, TResponse = unknown>(name: string, schema: z.ZodType<TPayload>): Channel<TPayload, TResponse>;
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
}
|
|
960
|
-
interface ListEntitiesRequest {
|
|
961
|
-
entityType: string;
|
|
962
|
-
options?: unknown;
|
|
963
|
-
}
|
|
964
|
-
interface CountEntitiesRequest {
|
|
965
|
-
entityType: string;
|
|
966
|
-
options?: unknown;
|
|
967
|
-
}
|
|
968
|
-
interface EntitySearchRequest {
|
|
969
|
-
query: string;
|
|
970
|
-
options?: unknown;
|
|
971
|
-
}
|
|
972
|
-
interface IEntityService {
|
|
973
|
-
getEntity<T = unknown>(request: GetEntityRequest): Promise<T | null>;
|
|
974
|
-
listEntities<T = unknown>(request: ListEntitiesRequest): Promise<T[]>;
|
|
975
|
-
search<T = unknown>(request: EntitySearchRequest): Promise<T[]>;
|
|
976
|
-
getEntityTypes(): string[];
|
|
977
|
-
hasEntityType(type: string): boolean;
|
|
978
|
-
countEntities(request: CountEntitiesRequest): Promise<number>;
|
|
979
|
-
getEntityCounts(): Promise<Array<{
|
|
980
|
-
entityType: string;
|
|
981
|
-
count: number;
|
|
982
|
-
}>>;
|
|
983
|
-
}
|
|
1139
|
+
type PublicEntityServiceMethods = "getEntity" | "listEntities" | "search" | "getEntityTypes" | "hasEntityType" | "countEntities" | "getEntityCounts" | "getEntityTypeConfig";
|
|
1140
|
+
type IEntityService = Pick<ICoreEntityService, PublicEntityServiceMethods>;
|
|
1141
|
+
|
|
984
1142
|
interface IIdentityNamespace {
|
|
985
1143
|
get: () => BrainCharacter;
|
|
986
1144
|
getProfile: () => AnchorProfile;
|
|
@@ -1008,7 +1166,7 @@ interface IMessagingNamespace {
|
|
|
1008
1166
|
type EvalHandler<TInput = unknown, TOutput = unknown> = (input: TInput) => Promise<TOutput>;
|
|
1009
1167
|
type InsightHandler = (entityService: IEntityService) => Promise<Record<string, unknown>>;
|
|
1010
1168
|
interface IEvalNamespace {
|
|
1011
|
-
registerHandler
|
|
1169
|
+
registerHandler(handlerId: string, handler: EvalHandler): void;
|
|
1012
1170
|
}
|
|
1013
1171
|
interface IInsightsNamespace {
|
|
1014
1172
|
register(type: string, handler: InsightHandler): void;
|
|
@@ -1028,16 +1186,6 @@ interface BasePluginContext {
|
|
|
1028
1186
|
readonly eval: IEvalNamespace;
|
|
1029
1187
|
readonly insights: IInsightsNamespace;
|
|
1030
1188
|
}
|
|
1031
|
-
interface IEntitiesNamespace {
|
|
1032
|
-
register<TEntity extends BaseEntity>(entityType: string, schema: z.ZodSchema<TEntity>, adapter: EntityAdapter<TEntity>, config?: EntityTypeConfig): void;
|
|
1033
|
-
getAdapter<TEntity extends BaseEntity>(entityType: string): EntityAdapter<TEntity> | undefined;
|
|
1034
|
-
update<TEntity extends BaseEntity>(entity: TEntity): Promise<{
|
|
1035
|
-
entityId: string;
|
|
1036
|
-
jobId: string;
|
|
1037
|
-
}>;
|
|
1038
|
-
registerDataSource(dataSource: DataSource): void;
|
|
1039
|
-
registerCreateInterceptor(entityType: string, interceptor: (input: CreateInput, executionContext: CreateExecutionContext) => Promise<CreateInterceptionResult>): void;
|
|
1040
|
-
}
|
|
1041
1189
|
interface IPromptsNamespace {
|
|
1042
1190
|
resolve(target: string, fallback: string): Promise<string>;
|
|
1043
1191
|
}
|
|
@@ -1045,7 +1193,11 @@ interface IServiceTemplatesNamespace {
|
|
|
1045
1193
|
register(templates: unknown): void;
|
|
1046
1194
|
}
|
|
1047
1195
|
interface IViewsNamespace {
|
|
1048
|
-
|
|
1196
|
+
get(name: string): unknown | undefined;
|
|
1197
|
+
list(): unknown[];
|
|
1198
|
+
hasRenderer(templateName: string): boolean;
|
|
1199
|
+
getRenderer(templateName: string): unknown | undefined;
|
|
1200
|
+
validate(templateName: string, content: unknown): boolean;
|
|
1049
1201
|
}
|
|
1050
1202
|
interface ServicePluginContext extends BasePluginContext {
|
|
1051
1203
|
readonly entities: IEntitiesNamespace;
|
|
@@ -1192,4 +1344,4 @@ declare abstract class ServicePlugin<TConfig = unknown> implements Plugin {
|
|
|
1192
1344
|
}
|
|
1193
1345
|
|
|
1194
1346
|
export { AgentResponseSchema, AnchorProfileSchema, AppInfoSchema, BaseMessageSchema, BrainCharacterSchema, ChatContextSchema, ConversationSchema, EntityPlugin, ExtensionMetadataSchema, InterfacePlugin, MessageInterfacePlugin, MessageResponseSchema, MessageSchema, PendingConfirmationSchema, ServicePlugin, ToolResultDataSchema, createResource, createTool, defineChannel, toolError, toolSuccess, urlCaptureConfigSchema };
|
|
1195
|
-
export type { AgentNamespace, AgentResponse, AnchorProfile, AppInfo, BaseJobTrackingInfo, BaseMessage, BasePluginContext, BrainCharacter, Channel, ChatContext, Conversation, EntityPluginContext, ExtensionMetadata, IConversationsNamespace, IEntitiesNamespace, IEvalNamespace, IIdentityNamespace, IInsightsNamespace, IMessagingNamespace, IPromptsNamespace, IServiceTemplatesNamespace, IViewsNamespace, InterfacePluginContext, JobProgressContext, JobProgressEvent, JobProgressStatus, Message, MessageContext, MessageJobTrackingInfo, MessageResponse, MessageRole, MessageSendOptions, MessageSender, MessageWithPayload, PendingConfirmation, Plugin, PluginConfig, PluginConfigInput, PluginFactory, Prompt, Resource, ResourceTemplate, ServicePluginContext, Tool, ToolConfirmation, ToolContext, ToolResponse, ToolResultData, ToolVisibility };
|
|
1347
|
+
export type { AgentNamespace, AgentResponse, AnchorProfile, AppInfo, BaseJobTrackingInfo, BaseMessage, BasePluginContext, BrainCharacter, Channel, ChatContext, Conversation, EntityPluginContext, ExtensionMetadata, IConversationsNamespace, IEntitiesNamespace, IEntityService, IEvalNamespace, IIdentityNamespace, IInsightsNamespace, IMessagingNamespace, IPromptsNamespace, IServiceTemplatesNamespace, IViewsNamespace, InterfacePluginContext, JobProgressContext, JobProgressEvent, JobProgressStatus, Message, MessageContext, MessageJobTrackingInfo, MessageResponse, MessageRole, MessageSendOptions, MessageSender, MessageWithPayload, PendingConfirmation, Plugin, PluginConfig, PluginConfigInput, PluginFactory, Prompt, Resource, ResourceTemplate, ServicePluginContext, Tool, ToolConfirmation, ToolContext, ToolResponse, ToolResultData, ToolVisibility };
|