@rizom/brain 0.2.0-alpha.145 → 0.2.0-alpha.147

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/plugins.d.ts CHANGED
@@ -124,6 +124,23 @@ declare const AgentResponseSchema: z.ZodType<AgentResponse, AgentResponse>;
124
124
  type MessageRole = "user" | "assistant";
125
125
  declare const messageRoleSchema: z.ZodType<MessageRole, MessageRole>;
126
126
 
127
+ /**
128
+ * Query response schemas used throughout the system
129
+ */
130
+ interface DefaultQuerySource {
131
+ id: string;
132
+ type: string;
133
+ excerpt?: string | undefined;
134
+ relevance?: number | undefined;
135
+ }
136
+ interface DefaultQueryResponse {
137
+ message: string;
138
+ summary?: string | undefined;
139
+ topics?: string[] | undefined;
140
+ sources?: DefaultQuerySource[] | undefined;
141
+ metadata?: Record<string, unknown> | undefined;
142
+ }
143
+
127
144
  /**
128
145
  * Options for entity mutation operations (create, update, upsert)
129
146
  */
@@ -580,6 +597,8 @@ interface IEntitiesNamespace {
580
597
  registerCreateInterceptor(entityType: string, interceptor: CreateInterceptor): void;
581
598
  /** Register a raw-upload durable save handler for this plugin's entity type */
582
599
  registerUploadSaveHandler(registration: UploadSaveHandlerRegistration): void;
600
+ /** Look up the registered upload-save handler claiming a media type */
601
+ getUploadSaveHandler(mediaType: string): UploadSaveHandlerRegistration | undefined;
583
602
  }
584
603
  interface EmbeddingBackfillResult {
585
604
  queued: number;
@@ -755,6 +774,16 @@ declare const entityCountSchema: z.ZodObject<{
755
774
  entityType: z.ZodString;
756
775
  count: z.ZodNumber;
757
776
  }>;
777
+ /**
778
+ * Content generation configuration - unified config object
779
+ */
780
+ interface ContentGenerationConfig {
781
+ prompt: string;
782
+ templateName: string;
783
+ conversationHistory?: string;
784
+ data?: Record<string, unknown>;
785
+ interfacePermissionGrant?: UserPermissionLevel;
786
+ }
758
787
 
759
788
  declare const DaemonHealthSchema: z.ZodObject<{
760
789
  status: z.ZodEnum<{
@@ -906,6 +935,33 @@ interface MessageContext {
906
935
  threadId?: string;
907
936
  }
908
937
 
938
+ type AIGenerationSchema<T> = ZodType<T>;
939
+ type AspectRatio = "1:1" | "16:9" | "9:16" | "4:3" | "3:4";
940
+ interface ImageGenerationOptions {
941
+ aspectRatio?: AspectRatio;
942
+ }
943
+ interface ImageGenerationResult {
944
+ base64: string;
945
+ dataUrl: string;
946
+ }
947
+ /**
948
+ * AI namespace for entity plugins — includes generation capabilities
949
+ */
950
+ interface IEntityAINamespace {
951
+ /** Query the AI with optional context */
952
+ query: (prompt: string, context?: Record<string, unknown>) => Promise<DefaultQueryResponse>;
953
+ /** Generate content using AI with template */
954
+ generate: <T = unknown>(config: ContentGenerationConfig) => Promise<T>;
955
+ /** Generate a structured object using AI with a schema parser */
956
+ generateObject: <T>(prompt: string, schema: AIGenerationSchema<T>) => Promise<{
957
+ object: T;
958
+ }>;
959
+ /** Generate an image using AI (requires AI_API_KEY) */
960
+ generateImage: (prompt: string, options?: ImageGenerationOptions) => Promise<ImageGenerationResult>;
961
+ /** Check if image generation is available */
962
+ canGenerateImages: () => boolean;
963
+ }
964
+
909
965
  type PluginConfig = Record<string, unknown>;
910
966
  type PluginConfigInput<T extends {
911
967
  _input: unknown;
@@ -1198,6 +1254,7 @@ interface ServicePluginContext extends BasePluginContext {
1198
1254
  readonly templates: IServiceTemplatesNamespace;
1199
1255
  readonly views: IViewsNamespace;
1200
1256
  readonly prompts: IPromptsNamespace;
1257
+ readonly ai: IEntityAINamespace;
1201
1258
  registerInstructions(instructions: string): void;
1202
1259
  }
1203
1260
  interface EntityPluginContext extends BasePluginContext {