@rizom/brain 0.2.0-alpha.50 → 0.2.0-alpha.51

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.
@@ -232,18 +232,58 @@ interface EntityTypeConfig {
232
232
  * Core entity service interface for read-only operations
233
233
  * Used by core plugins that need entity access but shouldn't modify entities
234
234
  */
235
+ interface GetEntityRequest {
236
+ entityType: string;
237
+ id: string;
238
+ }
239
+ type GetEntityRawRequest = GetEntityRequest;
240
+ interface ListEntitiesRequest {
241
+ entityType: string;
242
+ options?: ListOptions | undefined;
243
+ }
244
+ interface CountEntitiesRequest {
245
+ entityType: string;
246
+ options?: Pick<ListOptions, "publishedOnly" | "filter"> | undefined;
247
+ }
248
+ interface CreateEntityRequest<T extends BaseEntity> {
249
+ entity: EntityInput<T>;
250
+ options?: CreateEntityOptions | undefined;
251
+ }
252
+ interface CreateEntityFromMarkdownRequest {
253
+ input: CreateEntityFromMarkdownInput;
254
+ options?: CreateEntityOptions | undefined;
255
+ }
256
+ interface UpdateEntityRequest<T extends BaseEntity> {
257
+ entity: T;
258
+ options?: EntityJobOptions | undefined;
259
+ }
260
+ interface DeleteEntityRequest {
261
+ entityType: string;
262
+ id: string;
263
+ }
264
+ interface UpsertEntityRequest<T extends BaseEntity> {
265
+ entity: T;
266
+ options?: EntityJobOptions | undefined;
267
+ }
268
+ interface EntitySearchRequest {
269
+ query: string;
270
+ options?: SearchOptions | undefined;
271
+ }
272
+ interface SearchWithDistancesRequest {
273
+ query: string;
274
+ }
235
275
  interface ICoreEntityService {
236
- getEntity<T extends BaseEntity>(entityType: string, id: string): Promise<T | null>;
276
+ getEntity<T extends BaseEntity>(request: GetEntityRequest): Promise<T | null>;
237
277
  /**
238
278
  * Get entity without content resolution (raw)
239
279
  * Used internally to avoid recursion when resolving image references
240
280
  */
241
- getEntityRaw<T extends BaseEntity>(entityType: string, id: string): Promise<T | null>;
242
- listEntities<T extends BaseEntity>(type: string, options?: ListOptions): Promise<T[]>;
243
- search<T extends BaseEntity = BaseEntity>(query: string, options?: SearchOptions): Promise<SearchResult<T>[]>;
281
+ getEntityRaw<T extends BaseEntity>(request: GetEntityRawRequest): Promise<T | null>;
282
+ listEntities<T extends BaseEntity>(request: ListEntitiesRequest): Promise<T[]>;
283
+ search<T extends BaseEntity = BaseEntity>(request: EntitySearchRequest): Promise<SearchResult<T>[]>;
244
284
  getEntityTypes(): string[];
245
285
  hasEntityType(type: string): boolean;
246
- countEntities(entityType: string, options?: Pick<ListOptions, "publishedOnly" | "filter">): Promise<number>;
286
+ countEntities(request: CountEntitiesRequest): Promise<number>;
247
287
  getEntityCounts(): Promise<Array<{
248
288
  entityType: string;
249
289
  count: number;
@@ -255,18 +295,18 @@ interface ICoreEntityService {
255
295
  * Entity service interface for managing brain entities
256
296
  */
257
297
  interface EntityService extends ICoreEntityService {
258
- createEntity<T extends BaseEntity>(entity: EntityInput<T>, options?: CreateEntityOptions): Promise<EntityMutationResult>;
259
- createEntityFromMarkdown(input: CreateEntityFromMarkdownInput, options?: CreateEntityOptions): Promise<EntityMutationResult>;
260
- updateEntity<T extends BaseEntity>(entity: T, options?: EntityJobOptions): Promise<EntityMutationResult>;
261
- deleteEntity(entityType: string, id: string): Promise<boolean>;
262
- upsertEntity<T extends BaseEntity>(entity: T, options?: EntityJobOptions): Promise<EntityMutationResult & {
298
+ createEntity<T extends BaseEntity>(request: CreateEntityRequest<T>): Promise<EntityMutationResult>;
299
+ createEntityFromMarkdown(request: CreateEntityFromMarkdownRequest): Promise<EntityMutationResult>;
300
+ updateEntity<T extends BaseEntity>(request: UpdateEntityRequest<T>): Promise<EntityMutationResult>;
301
+ deleteEntity(request: DeleteEntityRequest): Promise<boolean>;
302
+ upsertEntity<T extends BaseEntity>(request: UpsertEntityRequest<T>): Promise<EntityMutationResult & {
263
303
  created: boolean;
264
304
  }>;
265
305
  storeEmbedding(data: StoreEmbeddingData): Promise<void>;
266
306
  serializeEntity(entity: BaseEntity): string;
267
307
  deserializeEntity(markdown: string, entityType: string): Partial<BaseEntity>;
268
308
  countEmbeddings(): Promise<number>;
269
- searchWithDistances(query: string): Promise<Array<{
309
+ searchWithDistances(request: SearchWithDistancesRequest): Promise<Array<{
270
310
  entityId: string;
271
311
  entityType: string;
272
312
  distance: number;