@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.
@@ -202,18 +202,58 @@ interface SearchOptions {
202
202
  * Core entity service interface for read-only operations
203
203
  * Used by core plugins that need entity access but shouldn't modify entities
204
204
  */
205
+ interface GetEntityRequest {
206
+ entityType: string;
207
+ id: string;
208
+ }
209
+ type GetEntityRawRequest = GetEntityRequest;
210
+ interface ListEntitiesRequest {
211
+ entityType: string;
212
+ options?: ListOptions | undefined;
213
+ }
214
+ interface CountEntitiesRequest {
215
+ entityType: string;
216
+ options?: Pick<ListOptions, "publishedOnly" | "filter"> | undefined;
217
+ }
218
+ interface CreateEntityRequest<T extends BaseEntity> {
219
+ entity: EntityInput<T>;
220
+ options?: CreateEntityOptions | undefined;
221
+ }
222
+ interface CreateEntityFromMarkdownRequest {
223
+ input: CreateEntityFromMarkdownInput;
224
+ options?: CreateEntityOptions | undefined;
225
+ }
226
+ interface UpdateEntityRequest<T extends BaseEntity> {
227
+ entity: T;
228
+ options?: EntityJobOptions | undefined;
229
+ }
230
+ interface DeleteEntityRequest {
231
+ entityType: string;
232
+ id: string;
233
+ }
234
+ interface UpsertEntityRequest<T extends BaseEntity> {
235
+ entity: T;
236
+ options?: EntityJobOptions | undefined;
237
+ }
238
+ interface EntitySearchRequest {
239
+ query: string;
240
+ options?: SearchOptions | undefined;
241
+ }
242
+ interface SearchWithDistancesRequest {
243
+ query: string;
244
+ }
205
245
  interface ICoreEntityService {
206
- getEntity<T extends BaseEntity>(entityType: string, id: string): Promise<T | null>;
246
+ getEntity<T extends BaseEntity>(request: GetEntityRequest): Promise<T | null>;
207
247
  /**
208
248
  * Get entity without content resolution (raw)
209
249
  * Used internally to avoid recursion when resolving image references
210
250
  */
211
- getEntityRaw<T extends BaseEntity>(entityType: string, id: string): Promise<T | null>;
212
- listEntities<T extends BaseEntity>(type: string, options?: ListOptions): Promise<T[]>;
213
- search<T extends BaseEntity = BaseEntity>(query: string, options?: SearchOptions): Promise<SearchResult<T>[]>;
251
+ getEntityRaw<T extends BaseEntity>(request: GetEntityRawRequest): Promise<T | null>;
252
+ listEntities<T extends BaseEntity>(request: ListEntitiesRequest): Promise<T[]>;
253
+ search<T extends BaseEntity = BaseEntity>(request: EntitySearchRequest): Promise<SearchResult<T>[]>;
214
254
  getEntityTypes(): string[];
215
255
  hasEntityType(type: string): boolean;
216
- countEntities(entityType: string, options?: Pick<ListOptions, "publishedOnly" | "filter">): Promise<number>;
256
+ countEntities(request: CountEntitiesRequest): Promise<number>;
217
257
  getEntityCounts(): Promise<Array<{
218
258
  entityType: string;
219
259
  count: number;
@@ -225,18 +265,18 @@ interface ICoreEntityService {
225
265
  * Entity service interface for managing brain entities
226
266
  */
227
267
  interface EntityService extends ICoreEntityService {
228
- createEntity<T extends BaseEntity>(entity: EntityInput<T>, options?: CreateEntityOptions): Promise<EntityMutationResult>;
229
- createEntityFromMarkdown(input: CreateEntityFromMarkdownInput, options?: CreateEntityOptions): Promise<EntityMutationResult>;
230
- updateEntity<T extends BaseEntity>(entity: T, options?: EntityJobOptions): Promise<EntityMutationResult>;
231
- deleteEntity(entityType: string, id: string): Promise<boolean>;
232
- upsertEntity<T extends BaseEntity>(entity: T, options?: EntityJobOptions): Promise<EntityMutationResult & {
268
+ createEntity<T extends BaseEntity>(request: CreateEntityRequest<T>): Promise<EntityMutationResult>;
269
+ createEntityFromMarkdown(request: CreateEntityFromMarkdownRequest): Promise<EntityMutationResult>;
270
+ updateEntity<T extends BaseEntity>(request: UpdateEntityRequest<T>): Promise<EntityMutationResult>;
271
+ deleteEntity(request: DeleteEntityRequest): Promise<boolean>;
272
+ upsertEntity<T extends BaseEntity>(request: UpsertEntityRequest<T>): Promise<EntityMutationResult & {
233
273
  created: boolean;
234
274
  }>;
235
275
  storeEmbedding(data: StoreEmbeddingData): Promise<void>;
236
276
  serializeEntity(entity: BaseEntity): string;
237
277
  deserializeEntity(markdown: string, entityType: string): Partial<BaseEntity>;
238
278
  countEmbeddings(): Promise<number>;
239
- searchWithDistances(query: string): Promise<Array<{
279
+ searchWithDistances(request: SearchWithDistancesRequest): Promise<Array<{
240
280
  entityId: string;
241
281
  entityType: string;
242
282
  distance: number;