@rizom/brain 0.2.0-alpha.234 → 0.2.0-alpha.236
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 +1276 -1273
- package/dist/chunks/blog-post-adapter-vt71whj1.js +5 -0
- package/dist/chunks/{index-23zvavvg.js → index-51pqwxdb.js} +3 -3
- package/dist/chunks/{index-23zvavvg.js.map → index-51pqwxdb.js.map} +1 -1
- package/dist/chunks/{index-k1dcptsq.js → index-72d2a6vf.js} +3 -3
- package/dist/chunks/{index-k1dcptsq.js.map → index-72d2a6vf.js.map} +1 -1
- package/dist/chunks/{index-5ecgasa8.js → index-8ej1r6tb.js} +3 -3
- package/dist/chunks/{index-5ecgasa8.js.map → index-8ej1r6tb.js.map} +1 -1
- package/dist/chunks/{index-twtkr2fy.js → index-8hmmeype.js} +4 -4
- package/dist/chunks/{index-twtkr2fy.js.map → index-8hmmeype.js.map} +1 -1
- package/dist/chunks/{index-nqjbkf5n.js → index-a3n899ev.js} +3 -3
- package/dist/chunks/{index-nqjbkf5n.js.map → index-a3n899ev.js.map} +1 -1
- package/dist/chunks/{index-6tjqzkys.js → index-aatpaped.js} +4 -4
- package/dist/chunks/{index-6tjqzkys.js.map → index-aatpaped.js.map} +1 -1
- package/dist/chunks/index-atsf9t9d.js +6 -0
- package/dist/chunks/{index-q0dkt6nc.js.map → index-atsf9t9d.js.map} +5 -4
- package/dist/chunks/{index-zx3c2cws.js → index-b6k44k1d.js} +3 -3
- package/dist/chunks/{index-zx3c2cws.js.map → index-b6k44k1d.js.map} +3 -3
- package/dist/chunks/{index-vtwspye3.js → index-fxc39qy2.js} +3 -3
- package/dist/chunks/{index-vtwspye3.js.map → index-fxc39qy2.js.map} +1 -1
- package/dist/chunks/{index-srk70x0g.js → index-kga4gmhq.js} +3 -3
- package/dist/chunks/{index-srk70x0g.js.map → index-kga4gmhq.js.map} +1 -1
- package/dist/chunks/{index-57d1xga4.js → index-q5r12b3s.js} +4 -4
- package/dist/chunks/{index-57d1xga4.js.map → index-q5r12b3s.js.map} +1 -1
- package/dist/chunks/index-zc6br876.js +10 -0
- package/dist/chunks/{index-9djq51zg.js.map → index-zc6br876.js.map} +8 -8
- package/dist/chunks/{rss-datasource-gj506d71.js → rss-datasource-9j87n822.js} +3 -3
- package/dist/chunks/{rss-datasource-gj506d71.js.map → rss-datasource-9j87n822.js.map} +1 -1
- package/dist/deploy.js +1 -1
- package/dist/entities.js +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/interfaces.js +2 -2
- package/dist/interfaces.js.map +1 -1
- package/dist/migrations/auth-service/0009_wild_namor.sql +44 -0
- package/dist/migrations/auth-service/0010_mixed_red_skull.sql +23 -0
- package/dist/migrations/auth-service/meta/0009_snapshot.json +1824 -0
- package/dist/migrations/auth-service/meta/0010_snapshot.json +1820 -0
- package/dist/migrations/auth-service/meta/_journal.json +14 -0
- package/dist/plugins.d.ts +48 -3
- package/dist/plugins.js +3 -3
- package/dist/plugins.js.map +4 -4
- package/dist/services.js +1 -1
- package/dist/site.js +224 -224
- package/dist/site.js.map +7 -5
- package/dist/templates.js +2 -2
- package/dist/templates.js.map +1 -1
- package/dist/themes.js +1 -1
- package/dist/ui/admin-app.js +102 -102
- package/dist/ui/admin-app.js.map +10 -10
- package/package.json +1 -1
- package/dist/chunks/blog-post-adapter-bgre78xn.js +0 -5
- package/dist/chunks/index-9djq51zg.js +0 -10
- package/dist/chunks/index-q0dkt6nc.js +0 -6
- /package/dist/chunks/{blog-post-adapter-bgre78xn.js.map → blog-post-adapter-vt71whj1.js.map} +0 -0
|
@@ -64,6 +64,20 @@
|
|
|
64
64
|
"when": 1784739018803,
|
|
65
65
|
"tag": "0008_slow_the_watchers",
|
|
66
66
|
"breakpoints": true
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"idx": 9,
|
|
70
|
+
"version": "6",
|
|
71
|
+
"when": 1785064040129,
|
|
72
|
+
"tag": "0009_wild_namor",
|
|
73
|
+
"breakpoints": true
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"idx": 10,
|
|
77
|
+
"version": "6",
|
|
78
|
+
"when": 1785139111015,
|
|
79
|
+
"tag": "0010_mixed_red_skull",
|
|
80
|
+
"breakpoints": true
|
|
67
81
|
}
|
|
68
82
|
]
|
|
69
83
|
}
|
package/dist/plugins.d.ts
CHANGED
|
@@ -821,6 +821,37 @@ interface AgentNamespace {
|
|
|
821
821
|
invalidate(): void;
|
|
822
822
|
}
|
|
823
823
|
//#endregion
|
|
824
|
+
//#region ../../shell/plugins/src/channel-registry.d.ts
|
|
825
|
+
interface ChannelSubjectPattern {
|
|
826
|
+
source: string;
|
|
827
|
+
flags?: string | undefined;
|
|
828
|
+
}
|
|
829
|
+
interface ChannelDescriptor {
|
|
830
|
+
type: string;
|
|
831
|
+
displayName: string;
|
|
832
|
+
subjectLabel: string;
|
|
833
|
+
subjectPattern?: ChannelSubjectPattern | undefined;
|
|
834
|
+
manualDelivery?: boolean | undefined;
|
|
835
|
+
}
|
|
836
|
+
interface ChannelDeliveryInput {
|
|
837
|
+
recipient: string;
|
|
838
|
+
subject: string;
|
|
839
|
+
text: string;
|
|
840
|
+
idempotencyKey: string;
|
|
841
|
+
}
|
|
842
|
+
type ChannelDeliveryResult = {
|
|
843
|
+
status: "sent";
|
|
844
|
+
providerDeliveryId?: string | undefined;
|
|
845
|
+
} | {
|
|
846
|
+
status: "failed";
|
|
847
|
+
failureCode: string;
|
|
848
|
+
};
|
|
849
|
+
interface ChannelDeliveryProvider {
|
|
850
|
+
channelType: string;
|
|
851
|
+
isAvailable(): Promise<boolean>;
|
|
852
|
+
send(input: ChannelDeliveryInput): Promise<ChannelDeliveryResult>;
|
|
853
|
+
}
|
|
854
|
+
//#endregion
|
|
824
855
|
//#region ../../shell/plugins/src/types/web-routes.d.ts
|
|
825
856
|
declare const WebRouteMethods: readonly ["GET", "POST", "PUT", "DELETE", "OPTIONS"];
|
|
826
857
|
type WebRouteMethod = (typeof WebRouteMethods)[number];
|
|
@@ -1326,6 +1357,15 @@ interface RuntimeUploadStore {
|
|
|
1326
1357
|
interface IRuntimeUploadsNamespace {
|
|
1327
1358
|
scoped(options: RuntimeUploadScopeOptions): RuntimeUploadStore;
|
|
1328
1359
|
}
|
|
1360
|
+
interface IChannelsNamespace {
|
|
1361
|
+
listDescriptors(): ChannelDescriptor[];
|
|
1362
|
+
getDescriptor(channelType: string): ChannelDescriptor | undefined;
|
|
1363
|
+
getDeliveryProvider(channelType: string): ChannelDeliveryProvider | undefined;
|
|
1364
|
+
}
|
|
1365
|
+
interface IMessageInterfaceChannelsNamespace extends IChannelsNamespace {
|
|
1366
|
+
registerDescriptor(descriptor: ChannelDescriptor): void;
|
|
1367
|
+
registerDeliveryProvider(provider: ChannelDeliveryProvider): void;
|
|
1368
|
+
}
|
|
1329
1369
|
interface BasePluginContext {
|
|
1330
1370
|
readonly pluginId: string;
|
|
1331
1371
|
readonly logger: Logger;
|
|
@@ -1347,6 +1387,7 @@ interface BasePluginContext {
|
|
|
1347
1387
|
readonly entityService: IEntityService;
|
|
1348
1388
|
readonly semantic: ISemanticNamespace;
|
|
1349
1389
|
readonly identity: IIdentityNamespace;
|
|
1390
|
+
readonly channels: IChannelsNamespace;
|
|
1350
1391
|
readonly messaging: IMessagingNamespace;
|
|
1351
1392
|
readonly conversations: IConversationsNamespace;
|
|
1352
1393
|
readonly eval: IEvalNamespace;
|
|
@@ -1388,6 +1429,9 @@ interface EntityPluginContext extends BasePluginContext {
|
|
|
1388
1429
|
interface InterfacePluginContext extends BasePluginContext {
|
|
1389
1430
|
readonly agent: AgentNamespace;
|
|
1390
1431
|
}
|
|
1432
|
+
interface MessageInterfacePluginContext extends InterfacePluginContext {
|
|
1433
|
+
readonly channels: IMessageInterfaceChannelsNamespace;
|
|
1434
|
+
}
|
|
1391
1435
|
//#endregion
|
|
1392
1436
|
//#region ../../shell/plugins/src/config.d.ts
|
|
1393
1437
|
/**
|
|
@@ -1474,8 +1518,9 @@ declare abstract class MessageInterfacePlugin<TConfig, TConfigInput, TTrackingIn
|
|
|
1474
1518
|
version: string;
|
|
1475
1519
|
description?: string;
|
|
1476
1520
|
}, config: TConfigInput, configSchema: PluginConfigSchema<TConfig>);
|
|
1477
|
-
|
|
1478
|
-
protected
|
|
1521
|
+
/** Inbound/conversational interfaces override this; outbound-only interfaces need not. */
|
|
1522
|
+
protected sendMessageToChannel(_request: SendMessageToChannelRequest): void;
|
|
1523
|
+
protected override onRegister(_context: MessageInterfacePluginContext): Promise<void>;
|
|
1479
1524
|
protected override onReady(_context: InterfacePluginContext): Promise<void>;
|
|
1480
1525
|
protected override onShutdown(): Promise<void>;
|
|
1481
1526
|
protected override getTools(): Promise<Tool[]>;
|
|
@@ -1520,4 +1565,4 @@ declare abstract class ServicePlugin<TConfig, TConfigInput> implements Plugin {
|
|
|
1520
1565
|
shutdown(): Promise<void>;
|
|
1521
1566
|
}
|
|
1522
1567
|
//#endregion
|
|
1523
|
-
export { type AgentNamespace, type AgentResponse, AgentResponseSchema, type AnchorProfile, AnchorProfileSchema, type AppInfo, AppInfoSchema, type BaseJobTrackingInfo, type BaseMessage, BaseMessageSchema, type BasePluginContext, type BrainCharacter, BrainCharacterSchema, type Channel, type ChatContext, ChatContextSchema, type Conversation, ConversationSchema, EntityPlugin, type EntityPluginContext, type ExtensionMetadata, ExtensionMetadataSchema, type IConversationsNamespace, type IEntitiesNamespace, type IEntityService, type IEvalNamespace, type IIdentityNamespace, type IInsightsNamespace, type IMessagingNamespace, type IPromptsNamespace, type IRuntimeUploadsNamespace, type IServiceTemplatesNamespace, type IViewsNamespace, InterfacePlugin, type InterfacePluginContext, type JobProgressContext, type JobProgressEvent, type JobProgressStatus, type Message, type MessageContext, MessageInterfacePlugin, type MessageJobTrackingInfo, type MessageResponse, MessageResponseSchema, type MessageRole, MessageSchema, type MessageSendOptions, type MessageSender, type MessageWithPayload, type PendingConfirmation, PendingConfirmationSchema, type Plugin, type PluginConfig, type PluginConfigInput, type PluginFactory, type Prompt, type ResolvedRuntimeUpload, type Resource, type ResourceTemplate, type RuntimeUploadRecord, type RuntimeUploadResponseBody, type RuntimeUploadScopeOptions, type RuntimeUploadStore, type SaveRuntimeUploadInput, ServicePlugin, type ServicePluginContext, type Tool, type ToolConfirmation, type ToolContext, type ToolResponse, type ToolResultData, ToolResultDataSchema, type ToolVisibility, createResource, createTool, defineChannel, toolError, toolSuccess, urlCaptureConfigSchema };
|
|
1568
|
+
export { type AgentNamespace, type AgentResponse, AgentResponseSchema, type AnchorProfile, AnchorProfileSchema, type AppInfo, AppInfoSchema, type BaseJobTrackingInfo, type BaseMessage, BaseMessageSchema, type BasePluginContext, type BrainCharacter, BrainCharacterSchema, type Channel, type ChannelDeliveryInput, type ChannelDeliveryProvider, type ChannelDeliveryResult, type ChannelDescriptor, type ChannelSubjectPattern, type ChatContext, ChatContextSchema, type Conversation, ConversationSchema, EntityPlugin, type EntityPluginContext, type ExtensionMetadata, ExtensionMetadataSchema, type IChannelsNamespace, type IConversationsNamespace, type IEntitiesNamespace, type IEntityService, type IEvalNamespace, type IIdentityNamespace, type IInsightsNamespace, type IMessageInterfaceChannelsNamespace, type IMessagingNamespace, type IPromptsNamespace, type IRuntimeUploadsNamespace, type IServiceTemplatesNamespace, type IViewsNamespace, InterfacePlugin, type InterfacePluginContext, type JobProgressContext, type JobProgressEvent, type JobProgressStatus, type Message, type MessageContext, MessageInterfacePlugin, type MessageInterfacePluginContext, type MessageJobTrackingInfo, type MessageResponse, MessageResponseSchema, type MessageRole, MessageSchema, type MessageSendOptions, type MessageSender, type MessageWithPayload, type PendingConfirmation, PendingConfirmationSchema, type Plugin, type PluginConfig, type PluginConfigInput, type PluginFactory, type Prompt, type ResolvedRuntimeUpload, type Resource, type ResourceTemplate, type RuntimeUploadRecord, type RuntimeUploadResponseBody, type RuntimeUploadScopeOptions, type RuntimeUploadStore, type SaveRuntimeUploadInput, ServicePlugin, type ServicePluginContext, type Tool, type ToolConfirmation, type ToolContext, type ToolResponse, type ToolResultData, ToolResultDataSchema, type ToolVisibility, createResource, createTool, defineChannel, toolError, toolSuccess, urlCaptureConfigSchema };
|
package/dist/plugins.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{n as N,o as
|
|
2
|
+
import{n as N,o as D,p as A,q as U,s as g,t as l,u as y,v as P,w as B,x as O}from"./chunks/index-zc6br876.js";import"./chunks/index-72d2a6vf.js";import{pa as w,qa as M,ra as W}from"./chunks/index-8hmmeype.js";import"./chunks/index-aatpaped.js";import"./chunks/index-8ej1r6tb.js";import{Ea as E,Ha as b,Ia as k}from"./chunks/index-b6k44k1d.js";import{_a as o}from"./chunks/index-q5r12b3s.js";import"./chunks/index-fxc39qy2.js";function T(e){return e}function C(e){return e}function R(e){return e===void 0?{success:!0}:{success:!0,data:e}}function S(e){return{success:!1,error:e}}var x=o.object({captureUrls:o.boolean().default(!1),blockedUrlDomains:o.array(o.string()).default(["meet.google.com","zoom.us","teams.microsoft.com","whereby.com","gather.town","calendly.com","cal.com","discord.com","discord.gg","cdn.discordapp.com","media.discordapp.net","giphy.com","tenor.com","wetransfer.com","file.io"])});function I(e,t){return{name:e,schema:t}}class p extends g{hooks;constructor(e,t,i,r,n){super(e,t,i,r);this.hooks=n}get entityType(){return this.hooks.getEntityType()}get schema(){return this.hooks.getSchema()}get adapter(){return this.hooks.getAdapter()}onRegister(e){return this.hooks.onRegister(e)}onReady(e){return this.hooks.onReady(e)}onShutdown(){return this.hooks.onShutdown()}getEntityTypeConfig(){return this.hooks.getEntityTypeConfig()}getDataSources(){return this.hooks.getDataSources()}getInstructions(){return this.hooks.getInstructions()}interceptCreate(e,t,i){return this.hooks.interceptCreate(e,t,i)}}class c{type="entity";id;version;packageName;description;delegate;constructor(e,t,i,r){if(this.id=e,this.version=t.version,this.packageName=t.name,t.description!==void 0)this.description=t.description;this.delegate=new p(e,t,i,r,{getEntityType:()=>this.entityType,getSchema:()=>this.schema,getAdapter:()=>this.adapter,onRegister:(n)=>this.onRegister(n),onReady:(n)=>this.onReady(n),onShutdown:()=>this.onShutdown(),getEntityTypeConfig:()=>this.getEntityTypeConfig(),getDataSources:()=>this.getDataSources(),getInstructions:()=>this.getInstructions(),interceptCreate:(n,a,v)=>this.interceptCreate(n,a,v)})}register(e,t){return this.delegate.register(e,t)}async onRegister(e){}async onReady(e){}async onShutdown(){}async getInstructions(){return}getEntityTypeConfig(){return}getDataSources(){return[]}async interceptCreate(e,t,i){return{kind:"continue",input:e}}ready(){return this.delegate.ready()}shutdown(){return this.delegate.shutdown?.()??Promise.resolve()}}class m extends l{hooks;constructor(e,t,i,r,n){super(e,t,i,r);this.hooks=n}onRegister(e){return this.hooks.onRegister(e)}onReady(e){return this.hooks.onReady(e)}onShutdown(){return this.hooks.onShutdown()}getTools(){return this.hooks.getTools()}getResources(){return this.hooks.getResources()}getInstructions(){return this.hooks.getInstructions()}getWebRoutes(){return this.hooks.getWebRoutes()}requiresDaemonStartup(){return this.hooks.requiresDaemonStartup()}}class s{type="interface";id;version;packageName;description;delegate;constructor(e,t,i,r){if(this.id=e,this.version=t.version,this.packageName=t.name,t.description!==void 0)this.description=t.description;this.delegate=new m(e,t,i,r,{onRegister:(n)=>this.onRegister(n),onReady:(n)=>this.onReady(n),onShutdown:()=>this.onShutdown(),getTools:()=>this.getTools(),getResources:()=>this.getResources(),getInstructions:()=>this.getInstructions(),getWebRoutes:()=>this.getWebRoutes(),requiresDaemonStartup:()=>this.requiresDaemonStartup()})}register(e,t){return this.delegate.register(e,t)}async onRegister(e){}async onReady(e){}async onShutdown(){}async getTools(){return[]}async getResources(){return[]}async getInstructions(){return}getWebRoutes(){return[]}requiresDaemonStartup(){return!1}ready(){return this.delegate.ready()}shutdown(){return this.delegate.shutdown?.()??Promise.resolve()}}class f extends y{hooks;constructor(e,t,i,r,n){super(e,t,i,r);this.hooks=n}async onRegister(e){await super.onRegister(e),await this.hooks.onRegister(e)}onReady(e){return this.hooks.onReady(e)}onShutdown(){return this.hooks.onShutdown()}getTools(){return this.hooks.getTools()}getResources(){return this.hooks.getResources()}getInstructions(){return this.hooks.getInstructions()}getWebRoutes(){return this.hooks.getWebRoutes()}requiresDaemonStartup(){return this.hooks.requiresDaemonStartup()}sendMessageToChannel(e){this.hooks.sendMessageToChannel(e)}sendMessageWithId(e){return this.hooks.sendMessageWithId(e)}editMessage(e){return this.hooks.editMessage(e)}supportsMessageEditing(){return this.hooks.supportsMessageEditing()}onProgressUpdate(e){return this.hooks.onProgressUpdate(e)}trackAgentResponseForJobPublic(e,t,i){this.trackAgentResponseForJob(e,t,i)}captureUrlViaAgentPublic(e,t,i,r,n){return this.captureUrlViaAgent(e,t,i,r,n)}getCurrentChannelIdPublic(){return this.getCurrentChannelId()}}class d extends s{messageDelegate;constructor(e,t,i,r){super(e,t,i,r);this.messageDelegate=new f(e,t,i,r,{onRegister:(n)=>this.onRegister(n),onReady:(n)=>this.onReady(n),onShutdown:()=>this.onShutdown(),getTools:()=>this.getTools(),getResources:()=>this.getResources(),getInstructions:()=>this.getInstructions(),getWebRoutes:()=>this.getWebRoutes(),requiresDaemonStartup:()=>this.requiresDaemonStartup(),sendMessageToChannel:(n)=>this.sendMessageToChannel(n),sendMessageWithId:(n)=>this.sendMessageWithId(n),editMessage:(n)=>this.editMessage(n),supportsMessageEditing:()=>this.supportsMessageEditing(),onProgressUpdate:(n)=>this.onProgressUpdate(n)})}register(e,t){return this.messageDelegate.register(e,t)}sendMessageToChannel(e){return}async onRegister(e){}async onReady(e){}async onShutdown(){}async getTools(){return[]}async getResources(){return[]}async getInstructions(){return}sendMessageWithId(e){return Promise.resolve(void 0)}editMessage(e){return Promise.resolve(!1)}supportsMessageEditing(){return!1}async onProgressUpdate(e){}isUploadableTextFile(e,t){let i=[".md",".txt",".markdown"];if(t&&["text/plain","text/markdown","text/x-markdown"].some((n)=>t.startsWith(n)))return!0;return i.some((n)=>e.toLowerCase().endsWith(n))}isFileSizeAllowed(e){return e<=1e5}formatFileUploadMessage(e,t){return`User uploaded a file "${e}":
|
|
3
3
|
|
|
4
|
-
${t}`}extractCaptureableUrls(e,t){let i=e.match(/https?:\/\/[^\s<>"{}|\\^`[\]]+?(?=[,;:\s]|$)/gi)??[];return[...new Set(i)].filter((r)=>{try{let{hostname:n}=new URL(r);return!t.some((a)=>n===a||n.endsWith(`.${a}`))}catch{return!1}})}captureUrlViaAgent(e,t,i,r,n){return this.messageDelegate.captureUrlViaAgentPublic(e,t,i,r,n)}trackAgentResponseForJob(e,t,i){this.messageDelegate.trackAgentResponseForJobPublic(e,t,i)}registerProgressCallback(e){this.messageDelegate.registerProgressCallback(e)}unregisterProgressCallback(){this.messageDelegate.unregisterProgressCallback()}getProgressEvents(){return this.messageDelegate.getProgressEvents()}getActiveProgressEvents(){return this.messageDelegate.getActiveProgressEvents()}startProcessingInput(e=null){this.messageDelegate.startProcessingInput(e)}endProcessingInput(){this.messageDelegate.endProcessingInput()}getCurrentChannelId(){return this.messageDelegate.getCurrentChannelIdPublic()}ready(){return this.messageDelegate.ready()}shutdown(){return this.messageDelegate.shutdown?.()??Promise.resolve()}}class h extends P{hooks;constructor(e,t,i,r,n){super(e,t,i,r);this.hooks=n}onRegister(e){return this.hooks.onRegister(e)}onReady(e){return this.hooks.onReady(e)}onShutdown(){return this.hooks.onShutdown()}getTools(){return this.hooks.getTools()}getResources(){return this.hooks.getResources()}getInstructions(){return this.hooks.getInstructions()}}class
|
|
4
|
+
${t}`}extractCaptureableUrls(e,t){let i=e.match(/https?:\/\/[^\s<>"{}|\\^`[\]]+?(?=[,;:\s]|$)/gi)??[];return[...new Set(i)].filter((r)=>{try{let{hostname:n}=new URL(r);return!t.some((a)=>n===a||n.endsWith(`.${a}`))}catch{return!1}})}captureUrlViaAgent(e,t,i,r,n){return this.messageDelegate.captureUrlViaAgentPublic(e,t,i,r,n)}trackAgentResponseForJob(e,t,i){this.messageDelegate.trackAgentResponseForJobPublic(e,t,i)}registerProgressCallback(e){this.messageDelegate.registerProgressCallback(e)}unregisterProgressCallback(){this.messageDelegate.unregisterProgressCallback()}getProgressEvents(){return this.messageDelegate.getProgressEvents()}getActiveProgressEvents(){return this.messageDelegate.getActiveProgressEvents()}startProcessingInput(e=null){this.messageDelegate.startProcessingInput(e)}endProcessingInput(){this.messageDelegate.endProcessingInput()}getCurrentChannelId(){return this.messageDelegate.getCurrentChannelIdPublic()}ready(){return this.messageDelegate.ready()}shutdown(){return this.messageDelegate.shutdown?.()??Promise.resolve()}}class h extends P{hooks;constructor(e,t,i,r,n){super(e,t,i,r);this.hooks=n}onRegister(e){return this.hooks.onRegister(e)}onReady(e){return this.hooks.onReady(e)}onShutdown(){return this.hooks.onShutdown()}getTools(){return this.hooks.getTools()}getResources(){return this.hooks.getResources()}getInstructions(){return this.hooks.getInstructions()}}class u{type="service";id;version;packageName;description;delegate;constructor(e,t,i,r){if(this.id=e,this.version=t.version,this.packageName=t.name,t.description!==void 0)this.description=t.description;this.delegate=new h(e,t,i,r,{onRegister:(n)=>this.onRegister(n),onReady:(n)=>this.onReady(n),onShutdown:()=>this.onShutdown(),getTools:()=>this.getTools(),getResources:()=>this.getResources(),getInstructions:()=>this.getInstructions()})}register(e,t){return this.delegate.register(e,t)}async onRegister(e){}async onReady(e){}async onShutdown(){}async getTools(){return[]}async getResources(){return[]}async getInstructions(){return}ready(){return this.delegate.ready()}shutdown(){return this.delegate.shutdown?.()??Promise.resolve()}}export{x as urlCaptureConfigSchema,R as toolSuccess,S as toolError,I as defineChannel,T as createTool,C as createResource,b as ToolResultDataSchema,u as ServicePlugin,E as PendingConfirmationSchema,D as MessageSchema,M as MessageResponseSchema,d as MessageInterfacePlugin,s as InterfacePlugin,w as ExtensionMetadataSchema,c as EntityPlugin,N as ConversationSchema,B as ChatContextSchema,A as BrainCharacterSchema,W as BaseMessageSchema,O as AppInfoSchema,U as AnchorProfileSchema,k as AgentResponseSchema};
|
|
5
5
|
|
|
6
|
-
//# debugId=
|
|
6
|
+
//# debugId=693485257544B91764756E2164756E21
|
|
7
7
|
//# sourceMappingURL=plugins.js.map
|
package/dist/plugins.js.map
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../shell/plugins/src/public/types.ts", "../../../shell/plugins/src/public/entity-plugin.ts", "../../../shell/plugins/src/public/interface-plugin.ts", "../../../shell/plugins/src/public/message-interface-plugin.ts", "../../../shell/plugins/src/public/service-plugin.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import type { ActorRef } from \"@brains/contracts\";\nimport type {\n ContentVisibility,\n CountEntitiesRequest,\n EntitySearchRequest,\n SearchWithDistancesRequest,\n GetEntityRequest,\n ICoreEntityService,\n IEntitiesNamespace,\n ProjectSemanticSpaceRequest,\n SemanticEntityReference,\n SemanticSpaceDistanceRange,\n SemanticSpaceNeighbor,\n SemanticSpaceOrigin,\n SemanticSpacePoint,\n SemanticSpaceProjection,\n ListEntitiesRequest,\n ListOptions,\n SearchOptions,\n SearchResult,\n} from \"@brains/entity-service\";\nimport type {\n EntityAction,\n OutputFormat,\n UserPermissionLevel,\n} from \"@brains/templates\";\nimport { z } from \"@brains/utils/zod\";\nimport type { AgentNamespace } from \"../contracts/agent\";\nimport type { AppInfo } from \"../contracts/app-info\";\nimport type { Conversation, Message } from \"../contracts/conversations\";\nimport type { AnchorProfile, BrainCharacter } from \"../contracts/identity\";\nimport type {\n MessageResponse,\n MessageSender,\n MessageWithPayload,\n} from \"../contracts/messaging\";\nimport type { IEntityAINamespace } from \"../entity/context\";\n\nexport type PluginConfig = Record<string, unknown>;\nexport type PluginConfigInput<T extends { _input: unknown }> = T[\"_input\"];\n\nexport interface SafeParserSchema<T> {\n safeParse(\n input: unknown,\n ):\n { success: true; data: T } | { success: false; error: { message: string } };\n}\n\nexport interface JudgeInput<T> {\n instruction: string;\n material: string;\n schema: z.ZodType<T, unknown>;\n}\n\nexport interface Plugin {\n readonly id: string;\n readonly version: string;\n readonly type: \"core\" | \"entity\" | \"service\" | \"interface\";\n readonly packageName: string;\n readonly description?: string;\n readonly dependencies?: string[];\n finalizeRegistration?(): Promise<void>;\n ready?(): Promise<void>;\n shutdown?(): Promise<void>;\n requiresDaemonStartup?(): boolean;\n}\n\nexport type PluginFactory = (config: PluginConfig) => Plugin | Plugin[];\n\nexport interface Logger {\n debug(message: string, data?: unknown): void;\n info(message: string, data?: unknown): void;\n warn(message: string, data?: unknown): void;\n error(message: string, data?: unknown): void;\n child(context: string): Logger;\n}\n\nexport interface ToolContext {\n progressToken?: string | number;\n sendProgress?: (notification: {\n progress?: number;\n total?: number;\n message?: string;\n }) => Promise<void>;\n interfaceType: string;\n actor: ActorRef;\n displayName?: string;\n conversationId?: string;\n channelId?: string;\n channelName?: string;\n runId?: string;\n toolCallId?: string;\n userPermissionLevel?: UserPermissionLevel;\n isAnchor?: boolean;\n}\n\nexport interface ToolResponse<T = unknown> {\n success: boolean;\n data?: T;\n error?: string;\n}\n\nexport type ToolVisibility = UserPermissionLevel;\n\nexport interface ToolConfirmation {\n required: boolean;\n message?: string;\n}\n\nexport type ToolSideEffects = \"none\" | \"writes\" | \"external\";\n\nexport interface Tool<TArgs = unknown, TResult = unknown> {\n name: string;\n description: string;\n inputSchema: Record<string, unknown>;\n handler: (args: TArgs, context: ToolContext) => Promise<TResult> | TResult;\n visibility?: ToolVisibility;\n confirmation?: ToolConfirmation;\n sideEffects?: ToolSideEffects;\n}\n\nexport interface Resource<TResult = unknown> {\n uri: string;\n name: string;\n description?: string;\n mimeType?: string;\n handler: () => Promise<TResult> | TResult;\n}\n\nexport interface ResourceTemplate<K extends string = string> {\n uriTemplate: K;\n name: string;\n description?: string;\n mimeType?: string;\n}\n\nexport interface Prompt {\n name: string;\n description?: string;\n arguments?: Array<{ name: string; description?: string; required?: boolean }>;\n}\n\nexport function createTool<TArgs = unknown, TResult = unknown>(\n tool: Tool<TArgs, TResult>,\n): Tool<TArgs, TResult> {\n return tool;\n}\n\nexport function createResource<TResult = unknown>(\n resource: Resource<TResult>,\n): Resource<TResult> {\n return resource;\n}\n\nexport function toolSuccess<T = unknown>(data?: T): ToolResponse<T> {\n return data === undefined ? { success: true } : { success: true, data };\n}\n\nexport function toolError(error: string): ToolResponse<never> {\n return { success: false, error };\n}\n\nexport interface BaseJobTrackingInfo {\n rootJobId: string;\n}\n\nexport interface MessageJobTrackingInfo extends BaseJobTrackingInfo {\n messageId?: string;\n channelId?: string;\n}\n\nexport type JobProgressStatus =\n \"pending\" | \"processing\" | \"completed\" | \"failed\";\n\nexport interface JobProgressContext {\n rootJobId: string;\n operationType:\n | \"file_operations\"\n | \"content_operations\"\n | \"data_processing\"\n | \"batch_processing\";\n pluginId?: string | undefined;\n progressToken?: string | number | undefined;\n operationTarget?: string | undefined;\n interfaceType?: string | undefined;\n conversationId?: string | undefined;\n channelId?: string | undefined;\n}\n\nexport interface JobProgressEvent {\n id: string;\n type: \"job\" | \"batch\";\n status: JobProgressStatus;\n message?: string | undefined;\n progress?:\n | {\n current: number;\n total: number;\n percentage: number;\n }\n | undefined;\n aggregationKey?: string | undefined;\n batchDetails?:\n | {\n totalOperations: number;\n completedOperations: number;\n failedOperations: number;\n currentOperation?: string | undefined;\n errors?: string[] | undefined;\n }\n | undefined;\n jobDetails?:\n | {\n jobType: string;\n priority: number;\n retryCount: number;\n }\n | undefined;\n metadata: JobProgressContext;\n}\n\nexport const urlCaptureConfigSchema: z.ZodObject<{\n captureUrls: z.ZodDefault<z.ZodBoolean>;\n blockedUrlDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;\n}> = z.object({\n captureUrls: z.boolean().default(false),\n blockedUrlDomains: z\n .array(z.string())\n .default([\n \"meet.google.com\",\n \"zoom.us\",\n \"teams.microsoft.com\",\n \"whereby.com\",\n \"gather.town\",\n \"calendly.com\",\n \"cal.com\",\n \"discord.com\",\n \"discord.gg\",\n \"cdn.discordapp.com\",\n \"media.discordapp.net\",\n \"giphy.com\",\n \"tenor.com\",\n \"wetransfer.com\",\n \"file.io\",\n ]),\n});\n\nexport interface Channel<TPayload, TResponse = unknown> {\n readonly name: string;\n readonly schema: SafeParserSchema<TPayload>;\n readonly _response?: TResponse;\n}\n\nexport function defineChannel<TPayload, TResponse = unknown>(\n name: string,\n schema: SafeParserSchema<TPayload>,\n): Channel<TPayload, TResponse> {\n return { name, schema };\n}\n\ntype PublicEntityServiceMethods =\n | \"getEntity\"\n | \"listEntities\"\n | \"search\"\n | \"searchWithDistances\"\n | \"getEntityTypes\"\n | \"hasEntityType\"\n | \"countEntities\"\n | \"getEntityCounts\"\n | \"getEntityTypeConfig\";\n\nexport type IEntityService = Pick<\n ICoreEntityService,\n PublicEntityServiceMethods\n>;\n\nexport type {\n CountEntitiesRequest,\n EntitySearchRequest,\n SearchWithDistancesRequest,\n GetEntityRequest,\n IEntitiesNamespace,\n ProjectSemanticSpaceRequest,\n SemanticEntityReference,\n SemanticSpaceDistanceRange,\n SemanticSpaceNeighbor,\n SemanticSpaceOrigin,\n SemanticSpacePoint,\n SemanticSpaceProjection,\n ListEntitiesRequest,\n ListOptions,\n SearchOptions,\n SearchResult,\n};\n\nexport interface IIdentityNamespace {\n get: () => BrainCharacter;\n getProfile: () => AnchorProfile;\n getAppInfo: () => Promise<AppInfo>;\n}\n\nexport interface IConversationsNamespace {\n get(conversationId: string): Promise<Conversation | null>;\n search(query: string): Promise<Conversation[]>;\n list(options?: {\n limit?: number;\n updatedAfter?: string;\n interfaceType?: string;\n sessionId?: string;\n channelId?: string;\n personId?: string;\n }): Promise<Conversation[]>;\n getMessages(\n conversationId: string,\n options?: { limit?: number; range?: { start: number; end: number } },\n ): Promise<Message[]>;\n}\n\nexport interface IMessagingNamespace {\n send: MessageSender;\n subscribe<T = unknown, R = unknown>(\n channel: string | Channel<T, R>,\n handler: (message: MessageWithPayload<T>) => Promise<MessageResponse<R>>,\n ): () => void;\n}\n\nexport type EvalHandler<TInput = unknown, TOutput = unknown> = (\n input: TInput,\n) => Promise<TOutput>;\n\nexport type InsightHandler = (\n entityService: IEntityService,\n visibilityScope: ContentVisibility,\n) => Promise<Record<string, unknown>>;\n\nexport interface IEvalNamespace {\n registerHandler(handlerId: string, handler: EvalHandler): void;\n}\n\nexport interface IInsightsNamespace {\n register(type: string, handler: InsightHandler): void;\n}\n\nexport interface ISemanticNamespace {\n project(\n request: ProjectSemanticSpaceRequest,\n ): Promise<SemanticSpaceProjection>;\n}\n\nexport interface IPermissionsNamespace {\n assertEntityActionAllowed(\n entityType: string,\n action: EntityAction,\n context: { userPermissionLevel?: UserPermissionLevel | undefined },\n ): void;\n}\n\nexport interface RuntimeUploadRecord {\n id: string;\n ref: { kind: string; id: string };\n filename: string;\n mediaType: string;\n sizeBytes: number;\n createdAt: string;\n metadata?: Record<string, unknown> | undefined;\n}\n\nexport interface RuntimeUploadResponseBody extends RuntimeUploadRecord {\n url: string;\n downloadUrl: string;\n}\n\nexport interface ResolvedRuntimeUpload {\n record: RuntimeUploadRecord;\n content: Buffer;\n}\n\nexport interface SaveRuntimeUploadInput {\n filename: string;\n mediaType: string;\n content: Buffer;\n metadata?: Record<string, unknown> | undefined;\n}\n\nexport interface RuntimeUploadScopeOptions {\n namespace: string;\n refKind: string;\n routePath: string;\n retentionMs?: number | undefined;\n maxCount?: number | undefined;\n}\n\nexport interface RuntimeUploadStore {\n save(input: SaveRuntimeUploadInput): Promise<RuntimeUploadRecord>;\n read(uploadId: string): Promise<ResolvedRuntimeUpload>;\n readRecord(uploadId: string): Promise<RuntimeUploadRecord>;\n toResponseBody(record: RuntimeUploadRecord): RuntimeUploadResponseBody;\n prune(): Promise<void>;\n getUploadDir(uploadId: string): string;\n}\n\nexport interface IRuntimeUploadsNamespace {\n scoped(options: RuntimeUploadScopeOptions): RuntimeUploadStore;\n}\n\nexport interface BasePluginContext {\n readonly pluginId: string;\n readonly logger: Logger;\n readonly dataDir: string;\n readonly domain: string | undefined;\n readonly siteUrl: string | undefined;\n readonly localSiteUrl: string | undefined;\n readonly previewUrl: string | undefined;\n readonly preferLocalUrls: boolean;\n readonly appInfo: () => Promise<AppInfo>;\n readonly judge: <T>(input: JudgeInput<T>) => Promise<{\n verdict: T;\n usage: {\n promptTokens: number;\n completionTokens: number;\n totalTokens: number;\n };\n }>;\n readonly entityService: IEntityService;\n readonly semantic: ISemanticNamespace;\n readonly identity: IIdentityNamespace;\n readonly messaging: IMessagingNamespace;\n readonly conversations: IConversationsNamespace;\n readonly eval: IEvalNamespace;\n readonly insights: IInsightsNamespace;\n readonly permissions: IPermissionsNamespace;\n readonly uploads: IRuntimeUploadsNamespace;\n}\n\nexport interface IPromptsNamespace {\n resolve(target: string, fallback: string): Promise<string>;\n}\n\nexport interface IServiceTemplatesNamespace {\n register(templates: unknown): void;\n}\n\nexport interface IViewsNamespace {\n get(name: string): unknown | undefined;\n list(): unknown[];\n hasRenderer(templateName: string, format?: OutputFormat): boolean;\n getRenderer(templateName: string, format?: OutputFormat): unknown | undefined;\n validate(templateName: string, content: unknown): boolean;\n}\n\nexport interface FrontmatterSchemaParser {\n parse(data: unknown): unknown;\n}\n\nexport interface EntityPluginEntitiesNamespace extends Omit<\n IEntitiesNamespace,\n \"getEffectiveFrontmatterSchema\"\n> {\n getEffectiveFrontmatterSchema(\n type: string,\n ): FrontmatterSchemaParser | undefined;\n}\n\nexport interface ServicePluginContext extends BasePluginContext {\n readonly entities: IEntitiesNamespace;\n readonly templates: IServiceTemplatesNamespace;\n readonly views: IViewsNamespace;\n readonly prompts: IPromptsNamespace;\n readonly ai: IEntityAINamespace;\n registerInstructions(instructions: string): void;\n}\n\nexport interface EntityPluginContext extends BasePluginContext {\n readonly entities: EntityPluginEntitiesNamespace;\n readonly prompts: IPromptsNamespace;\n}\n\nexport interface InterfacePluginContext extends BasePluginContext {\n readonly agent: AgentNamespace;\n}\n",
|
|
5
|
+
"import type { ActorRef } from \"@brains/contracts\";\nimport type {\n ContentVisibility,\n CountEntitiesRequest,\n EntitySearchRequest,\n SearchWithDistancesRequest,\n GetEntityRequest,\n ICoreEntityService,\n IEntitiesNamespace,\n ProjectSemanticSpaceRequest,\n SemanticEntityReference,\n SemanticSpaceDistanceRange,\n SemanticSpaceNeighbor,\n SemanticSpaceOrigin,\n SemanticSpacePoint,\n SemanticSpaceProjection,\n ListEntitiesRequest,\n ListOptions,\n SearchOptions,\n SearchResult,\n} from \"@brains/entity-service\";\nimport type {\n EntityAction,\n OutputFormat,\n UserPermissionLevel,\n} from \"@brains/templates\";\nimport { z } from \"@brains/utils/zod\";\nimport type { AgentNamespace } from \"../contracts/agent\";\nimport type { AppInfo } from \"../contracts/app-info\";\nimport type { Conversation, Message } from \"../contracts/conversations\";\nimport type { AnchorProfile, BrainCharacter } from \"../contracts/identity\";\nimport type {\n MessageResponse,\n MessageSender,\n MessageWithPayload,\n} from \"../contracts/messaging\";\nimport type { IEntityAINamespace } from \"../entity/context\";\nimport type {\n ChannelDeliveryProvider,\n ChannelDescriptor,\n} from \"../channel-registry\";\nexport type {\n ChannelDeliveryInput,\n ChannelDeliveryProvider,\n ChannelDeliveryResult,\n ChannelDescriptor,\n ChannelSubjectPattern,\n} from \"../channel-registry\";\n\nexport type PluginConfig = Record<string, unknown>;\nexport type PluginConfigInput<T extends { _input: unknown }> = T[\"_input\"];\n\nexport interface SafeParserSchema<T> {\n safeParse(\n input: unknown,\n ):\n { success: true; data: T } | { success: false; error: { message: string } };\n}\n\nexport interface JudgeInput<T> {\n instruction: string;\n material: string;\n schema: z.ZodType<T, unknown>;\n}\n\nexport interface Plugin {\n readonly id: string;\n readonly version: string;\n readonly type: \"core\" | \"entity\" | \"service\" | \"interface\";\n readonly packageName: string;\n readonly description?: string;\n readonly dependencies?: string[];\n finalizeRegistration?(): Promise<void>;\n ready?(): Promise<void>;\n shutdown?(): Promise<void>;\n requiresDaemonStartup?(): boolean;\n}\n\nexport type PluginFactory = (config: PluginConfig) => Plugin | Plugin[];\n\nexport interface Logger {\n debug(message: string, data?: unknown): void;\n info(message: string, data?: unknown): void;\n warn(message: string, data?: unknown): void;\n error(message: string, data?: unknown): void;\n child(context: string): Logger;\n}\n\nexport interface ToolContext {\n progressToken?: string | number;\n sendProgress?: (notification: {\n progress?: number;\n total?: number;\n message?: string;\n }) => Promise<void>;\n interfaceType: string;\n actor: ActorRef;\n displayName?: string;\n conversationId?: string;\n channelId?: string;\n channelName?: string;\n runId?: string;\n toolCallId?: string;\n userPermissionLevel?: UserPermissionLevel;\n isAnchor?: boolean;\n}\n\nexport interface ToolResponse<T = unknown> {\n success: boolean;\n data?: T;\n error?: string;\n}\n\nexport type ToolVisibility = UserPermissionLevel;\n\nexport interface ToolConfirmation {\n required: boolean;\n message?: string;\n}\n\nexport type ToolSideEffects = \"none\" | \"writes\" | \"external\";\n\nexport interface Tool<TArgs = unknown, TResult = unknown> {\n name: string;\n description: string;\n inputSchema: Record<string, unknown>;\n handler: (args: TArgs, context: ToolContext) => Promise<TResult> | TResult;\n visibility?: ToolVisibility;\n confirmation?: ToolConfirmation;\n sideEffects?: ToolSideEffects;\n}\n\nexport interface Resource<TResult = unknown> {\n uri: string;\n name: string;\n description?: string;\n mimeType?: string;\n handler: () => Promise<TResult> | TResult;\n}\n\nexport interface ResourceTemplate<K extends string = string> {\n uriTemplate: K;\n name: string;\n description?: string;\n mimeType?: string;\n}\n\nexport interface Prompt {\n name: string;\n description?: string;\n arguments?: Array<{ name: string; description?: string; required?: boolean }>;\n}\n\nexport function createTool<TArgs = unknown, TResult = unknown>(\n tool: Tool<TArgs, TResult>,\n): Tool<TArgs, TResult> {\n return tool;\n}\n\nexport function createResource<TResult = unknown>(\n resource: Resource<TResult>,\n): Resource<TResult> {\n return resource;\n}\n\nexport function toolSuccess<T = unknown>(data?: T): ToolResponse<T> {\n return data === undefined ? { success: true } : { success: true, data };\n}\n\nexport function toolError(error: string): ToolResponse<never> {\n return { success: false, error };\n}\n\nexport interface BaseJobTrackingInfo {\n rootJobId: string;\n}\n\nexport interface MessageJobTrackingInfo extends BaseJobTrackingInfo {\n messageId?: string;\n channelId?: string;\n}\n\nexport type JobProgressStatus =\n \"pending\" | \"processing\" | \"completed\" | \"failed\";\n\nexport interface JobProgressContext {\n rootJobId: string;\n operationType:\n | \"file_operations\"\n | \"content_operations\"\n | \"data_processing\"\n | \"batch_processing\";\n pluginId?: string | undefined;\n progressToken?: string | number | undefined;\n operationTarget?: string | undefined;\n interfaceType?: string | undefined;\n conversationId?: string | undefined;\n channelId?: string | undefined;\n}\n\nexport interface JobProgressEvent {\n id: string;\n type: \"job\" | \"batch\";\n status: JobProgressStatus;\n message?: string | undefined;\n progress?:\n | {\n current: number;\n total: number;\n percentage: number;\n }\n | undefined;\n aggregationKey?: string | undefined;\n batchDetails?:\n | {\n totalOperations: number;\n completedOperations: number;\n failedOperations: number;\n currentOperation?: string | undefined;\n errors?: string[] | undefined;\n }\n | undefined;\n jobDetails?:\n | {\n jobType: string;\n priority: number;\n retryCount: number;\n }\n | undefined;\n metadata: JobProgressContext;\n}\n\nexport const urlCaptureConfigSchema: z.ZodObject<{\n captureUrls: z.ZodDefault<z.ZodBoolean>;\n blockedUrlDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;\n}> = z.object({\n captureUrls: z.boolean().default(false),\n blockedUrlDomains: z\n .array(z.string())\n .default([\n \"meet.google.com\",\n \"zoom.us\",\n \"teams.microsoft.com\",\n \"whereby.com\",\n \"gather.town\",\n \"calendly.com\",\n \"cal.com\",\n \"discord.com\",\n \"discord.gg\",\n \"cdn.discordapp.com\",\n \"media.discordapp.net\",\n \"giphy.com\",\n \"tenor.com\",\n \"wetransfer.com\",\n \"file.io\",\n ]),\n});\n\nexport interface Channel<TPayload, TResponse = unknown> {\n readonly name: string;\n readonly schema: SafeParserSchema<TPayload>;\n readonly _response?: TResponse;\n}\n\nexport function defineChannel<TPayload, TResponse = unknown>(\n name: string,\n schema: SafeParserSchema<TPayload>,\n): Channel<TPayload, TResponse> {\n return { name, schema };\n}\n\ntype PublicEntityServiceMethods =\n | \"getEntity\"\n | \"listEntities\"\n | \"search\"\n | \"searchWithDistances\"\n | \"getEntityTypes\"\n | \"hasEntityType\"\n | \"countEntities\"\n | \"getEntityCounts\"\n | \"getEntityTypeConfig\";\n\nexport type IEntityService = Pick<\n ICoreEntityService,\n PublicEntityServiceMethods\n>;\n\nexport type {\n CountEntitiesRequest,\n EntitySearchRequest,\n SearchWithDistancesRequest,\n GetEntityRequest,\n IEntitiesNamespace,\n ProjectSemanticSpaceRequest,\n SemanticEntityReference,\n SemanticSpaceDistanceRange,\n SemanticSpaceNeighbor,\n SemanticSpaceOrigin,\n SemanticSpacePoint,\n SemanticSpaceProjection,\n ListEntitiesRequest,\n ListOptions,\n SearchOptions,\n SearchResult,\n};\n\nexport interface IIdentityNamespace {\n get: () => BrainCharacter;\n getProfile: () => AnchorProfile;\n getAppInfo: () => Promise<AppInfo>;\n}\n\nexport interface IConversationsNamespace {\n get(conversationId: string): Promise<Conversation | null>;\n search(query: string): Promise<Conversation[]>;\n list(options?: {\n limit?: number;\n updatedAfter?: string;\n interfaceType?: string;\n sessionId?: string;\n channelId?: string;\n personId?: string;\n }): Promise<Conversation[]>;\n getMessages(\n conversationId: string,\n options?: { limit?: number; range?: { start: number; end: number } },\n ): Promise<Message[]>;\n}\n\nexport interface IMessagingNamespace {\n send: MessageSender;\n subscribe<T = unknown, R = unknown>(\n channel: string | Channel<T, R>,\n handler: (message: MessageWithPayload<T>) => Promise<MessageResponse<R>>,\n ): () => void;\n}\n\nexport type EvalHandler<TInput = unknown, TOutput = unknown> = (\n input: TInput,\n) => Promise<TOutput>;\n\nexport type InsightHandler = (\n entityService: IEntityService,\n visibilityScope: ContentVisibility,\n) => Promise<Record<string, unknown>>;\n\nexport interface IEvalNamespace {\n registerHandler(handlerId: string, handler: EvalHandler): void;\n}\n\nexport interface IInsightsNamespace {\n register(type: string, handler: InsightHandler): void;\n}\n\nexport interface ISemanticNamespace {\n project(\n request: ProjectSemanticSpaceRequest,\n ): Promise<SemanticSpaceProjection>;\n}\n\nexport interface IPermissionsNamespace {\n assertEntityActionAllowed(\n entityType: string,\n action: EntityAction,\n context: { userPermissionLevel?: UserPermissionLevel | undefined },\n ): void;\n}\n\nexport interface RuntimeUploadRecord {\n id: string;\n ref: { kind: string; id: string };\n filename: string;\n mediaType: string;\n sizeBytes: number;\n createdAt: string;\n metadata?: Record<string, unknown> | undefined;\n}\n\nexport interface RuntimeUploadResponseBody extends RuntimeUploadRecord {\n url: string;\n downloadUrl: string;\n}\n\nexport interface ResolvedRuntimeUpload {\n record: RuntimeUploadRecord;\n content: Buffer;\n}\n\nexport interface SaveRuntimeUploadInput {\n filename: string;\n mediaType: string;\n content: Buffer;\n metadata?: Record<string, unknown> | undefined;\n}\n\nexport interface RuntimeUploadScopeOptions {\n namespace: string;\n refKind: string;\n routePath: string;\n retentionMs?: number | undefined;\n maxCount?: number | undefined;\n}\n\nexport interface RuntimeUploadStore {\n save(input: SaveRuntimeUploadInput): Promise<RuntimeUploadRecord>;\n read(uploadId: string): Promise<ResolvedRuntimeUpload>;\n readRecord(uploadId: string): Promise<RuntimeUploadRecord>;\n toResponseBody(record: RuntimeUploadRecord): RuntimeUploadResponseBody;\n prune(): Promise<void>;\n getUploadDir(uploadId: string): string;\n}\n\nexport interface IRuntimeUploadsNamespace {\n scoped(options: RuntimeUploadScopeOptions): RuntimeUploadStore;\n}\n\nexport interface IChannelsNamespace {\n listDescriptors(): ChannelDescriptor[];\n getDescriptor(channelType: string): ChannelDescriptor | undefined;\n getDeliveryProvider(channelType: string): ChannelDeliveryProvider | undefined;\n}\n\nexport interface IMessageInterfaceChannelsNamespace extends IChannelsNamespace {\n registerDescriptor(descriptor: ChannelDescriptor): void;\n registerDeliveryProvider(provider: ChannelDeliveryProvider): void;\n}\n\nexport interface BasePluginContext {\n readonly pluginId: string;\n readonly logger: Logger;\n readonly dataDir: string;\n readonly domain: string | undefined;\n readonly siteUrl: string | undefined;\n readonly localSiteUrl: string | undefined;\n readonly previewUrl: string | undefined;\n readonly preferLocalUrls: boolean;\n readonly appInfo: () => Promise<AppInfo>;\n readonly judge: <T>(input: JudgeInput<T>) => Promise<{\n verdict: T;\n usage: {\n promptTokens: number;\n completionTokens: number;\n totalTokens: number;\n };\n }>;\n readonly entityService: IEntityService;\n readonly semantic: ISemanticNamespace;\n readonly identity: IIdentityNamespace;\n readonly channels: IChannelsNamespace;\n readonly messaging: IMessagingNamespace;\n readonly conversations: IConversationsNamespace;\n readonly eval: IEvalNamespace;\n readonly insights: IInsightsNamespace;\n readonly permissions: IPermissionsNamespace;\n readonly uploads: IRuntimeUploadsNamespace;\n}\n\nexport interface IPromptsNamespace {\n resolve(target: string, fallback: string): Promise<string>;\n}\n\nexport interface IServiceTemplatesNamespace {\n register(templates: unknown): void;\n}\n\nexport interface IViewsNamespace {\n get(name: string): unknown | undefined;\n list(): unknown[];\n hasRenderer(templateName: string, format?: OutputFormat): boolean;\n getRenderer(templateName: string, format?: OutputFormat): unknown | undefined;\n validate(templateName: string, content: unknown): boolean;\n}\n\nexport interface FrontmatterSchemaParser {\n parse(data: unknown): unknown;\n}\n\nexport interface EntityPluginEntitiesNamespace extends Omit<\n IEntitiesNamespace,\n \"getEffectiveFrontmatterSchema\"\n> {\n getEffectiveFrontmatterSchema(\n type: string,\n ): FrontmatterSchemaParser | undefined;\n}\n\nexport interface ServicePluginContext extends BasePluginContext {\n readonly entities: IEntitiesNamespace;\n readonly templates: IServiceTemplatesNamespace;\n readonly views: IViewsNamespace;\n readonly prompts: IPromptsNamespace;\n readonly ai: IEntityAINamespace;\n registerInstructions(instructions: string): void;\n}\n\nexport interface EntityPluginContext extends BasePluginContext {\n readonly entities: EntityPluginEntitiesNamespace;\n readonly prompts: IPromptsNamespace;\n}\n\nexport interface InterfacePluginContext extends BasePluginContext {\n readonly agent: AgentNamespace;\n}\n\nexport interface MessageInterfacePluginContext extends InterfacePluginContext {\n readonly channels: IMessageInterfaceChannelsNamespace;\n}\n",
|
|
6
6
|
"import { EntityPlugin as RuntimeEntityPlugin } from \"../entity/entity-plugin\";\nimport type { EntityPluginContext as RuntimeEntityPluginContext } from \"../entity/context\";\nimport type { PluginConfigSchema } from \"../config\";\nimport type {\n IShell,\n PluginCapabilities,\n PluginRegistrationContext,\n} from \"../interfaces\";\nimport type {\n BaseEntity,\n CreateExecutionContext,\n CreateInput,\n CreateInterceptionResult,\n DataSource,\n EntityAdapter,\n EntityTypeConfig,\n} from \"@brains/entity-service\";\nimport type { EntityPluginContext, Plugin } from \"./types\";\n\ntype EntitySchema<TEntity extends BaseEntity> =\n EntityAdapter<TEntity>[\"schema\"];\n\ninterface EntityPluginHooks<TEntity extends BaseEntity> {\n getEntityType(): string;\n getSchema(): EntitySchema<TEntity>;\n getAdapter(): EntityAdapter<TEntity>;\n onRegister(context: EntityPluginContext): Promise<void>;\n onReady(context: EntityPluginContext): Promise<void>;\n onShutdown(): Promise<void>;\n getEntityTypeConfig(): EntityTypeConfig | undefined;\n getDataSources(): DataSource[];\n getInstructions(): Promise<string | undefined>;\n interceptCreate(\n input: CreateInput,\n executionContext: CreateExecutionContext,\n context: EntityPluginContext,\n ): Promise<CreateInterceptionResult>;\n}\n\nclass EntityPluginDelegate<\n TEntity extends BaseEntity,\n TConfig,\n TConfigInput,\n> extends RuntimeEntityPlugin<TEntity, TConfig, TConfigInput> {\n private readonly hooks: EntityPluginHooks<TEntity>;\n constructor(\n id: string,\n packageJson: { name: string; version: string; description?: string },\n config: TConfigInput,\n configSchema: PluginConfigSchema<TConfig>,\n hooks: EntityPluginHooks<TEntity>,\n ) {\n super(id, packageJson, config, configSchema);\n this.hooks = hooks;\n }\n\n override get entityType(): string {\n return this.hooks.getEntityType();\n }\n\n override get schema(): EntitySchema<TEntity> {\n return this.hooks.getSchema();\n }\n\n override get adapter(): EntityAdapter<TEntity> {\n return this.hooks.getAdapter();\n }\n\n protected override onRegister(\n context: RuntimeEntityPluginContext,\n ): Promise<void> {\n return this.hooks.onRegister(context);\n }\n\n protected override onReady(\n context: RuntimeEntityPluginContext,\n ): Promise<void> {\n return this.hooks.onReady(context);\n }\n\n protected override onShutdown(): Promise<void> {\n return this.hooks.onShutdown();\n }\n\n protected override getEntityTypeConfig(): EntityTypeConfig | undefined {\n return this.hooks.getEntityTypeConfig();\n }\n\n protected override getDataSources(): DataSource[] {\n return this.hooks.getDataSources();\n }\n\n protected override getInstructions(): Promise<string | undefined> {\n return this.hooks.getInstructions();\n }\n\n protected override interceptCreate(\n input: CreateInput,\n executionContext: CreateExecutionContext,\n context: RuntimeEntityPluginContext,\n ): Promise<CreateInterceptionResult> {\n return this.hooks.interceptCreate(input, executionContext, context);\n }\n}\n\nexport abstract class EntityPlugin<\n TEntity extends BaseEntity,\n TConfig,\n TConfigInput,\n> implements Plugin {\n public readonly type = \"entity\" as const;\n public readonly id: string;\n public readonly version: string;\n public readonly packageName: string;\n public readonly description?: string;\n public abstract readonly entityType: string;\n public abstract readonly schema: EntitySchema<TEntity>;\n public abstract readonly adapter: EntityAdapter<TEntity>;\n private readonly delegate: EntityPluginDelegate<\n TEntity,\n TConfig,\n TConfigInput\n >;\n\n protected constructor(\n id: string,\n packageJson: { name: string; version: string; description?: string },\n config: TConfigInput,\n configSchema: PluginConfigSchema<TConfig>,\n ) {\n this.id = id;\n this.version = packageJson.version;\n this.packageName = packageJson.name;\n if (packageJson.description !== undefined) {\n this.description = packageJson.description;\n }\n this.delegate = new EntityPluginDelegate(\n id,\n packageJson,\n config,\n configSchema,\n {\n getEntityType: (): string => this.entityType,\n getSchema: (): EntitySchema<TEntity> => this.schema,\n getAdapter: (): EntityAdapter<TEntity> => this.adapter,\n onRegister: (context): Promise<void> => this.onRegister(context),\n onReady: (context): Promise<void> => this.onReady(context),\n onShutdown: (): Promise<void> => this.onShutdown(),\n getEntityTypeConfig: (): EntityTypeConfig | undefined =>\n this.getEntityTypeConfig(),\n getDataSources: (): DataSource[] => this.getDataSources(),\n getInstructions: (): Promise<string | undefined> =>\n this.getInstructions(),\n interceptCreate: (\n input,\n executionContext,\n context,\n ): Promise<CreateInterceptionResult> =>\n this.interceptCreate(input, executionContext, context),\n },\n );\n }\n\n /** @internal */\n register(\n shell: IShell,\n context?: PluginRegistrationContext,\n ): Promise<PluginCapabilities> {\n return this.delegate.register(shell, context);\n }\n\n protected async onRegister(_context: EntityPluginContext): Promise<void> {}\n protected async onReady(_context: EntityPluginContext): Promise<void> {}\n protected async onShutdown(): Promise<void> {}\n protected async getInstructions(): Promise<string | undefined> {\n return undefined;\n }\n protected getEntityTypeConfig(): EntityTypeConfig | undefined {\n return undefined;\n }\n protected getDataSources(): DataSource[] {\n return [];\n }\n protected async interceptCreate(\n input: CreateInput,\n _executionContext: CreateExecutionContext,\n _context: EntityPluginContext,\n ): Promise<CreateInterceptionResult> {\n return { kind: \"continue\", input };\n }\n\n ready(): Promise<void> {\n return this.delegate.ready();\n }\n\n shutdown(): Promise<void> {\n return this.delegate.shutdown?.() ?? Promise.resolve();\n }\n}\n",
|
|
7
7
|
"import { InterfacePlugin as RuntimeInterfacePlugin } from \"../interface/interface-plugin\";\nimport type { InterfacePluginContext as RuntimeInterfacePluginContext } from \"../interface/context\";\nimport type { PluginConfigSchema } from \"../config\";\nimport type {\n IShell,\n PluginCapabilities,\n PluginRegistrationContext,\n} from \"../interfaces\";\nimport type { WebRouteDefinition } from \"../types/web-routes\";\nimport type {\n BaseJobTrackingInfo,\n InterfacePluginContext,\n Plugin,\n Resource,\n Tool,\n} from \"./types\";\n\ninterface InterfacePluginHooks {\n onRegister(context: InterfacePluginContext): Promise<void>;\n onReady(context: InterfacePluginContext): Promise<void>;\n onShutdown(): Promise<void>;\n getTools(): Promise<Tool[]>;\n getResources(): Promise<Resource[]>;\n getInstructions(): Promise<string | undefined>;\n getWebRoutes(): WebRouteDefinition[];\n requiresDaemonStartup(): boolean;\n}\n\nclass InterfacePluginDelegate<\n TConfig,\n TConfigInput,\n TTrackingInfo extends BaseJobTrackingInfo,\n> extends RuntimeInterfacePlugin<TConfig, TConfigInput, TTrackingInfo> {\n private readonly hooks: InterfacePluginHooks;\n constructor(\n id: string,\n packageJson: { name: string; version: string; description?: string },\n config: TConfigInput,\n configSchema: PluginConfigSchema<TConfig>,\n hooks: InterfacePluginHooks,\n ) {\n super(id, packageJson, config, configSchema);\n this.hooks = hooks;\n }\n\n protected override onRegister(\n context: RuntimeInterfacePluginContext,\n ): Promise<void> {\n return this.hooks.onRegister(context);\n }\n\n protected override onReady(\n context: RuntimeInterfacePluginContext,\n ): Promise<void> {\n return this.hooks.onReady(context);\n }\n\n protected override onShutdown(): Promise<void> {\n return this.hooks.onShutdown();\n }\n\n protected override getTools(): Promise<never[]> {\n return this.hooks.getTools() as Promise<never[]>;\n }\n\n protected override getResources(): Promise<never[]> {\n return this.hooks.getResources() as Promise<never[]>;\n }\n\n protected override getInstructions(): Promise<string | undefined> {\n return this.hooks.getInstructions();\n }\n\n override getWebRoutes(): WebRouteDefinition[] {\n return this.hooks.getWebRoutes();\n }\n\n override requiresDaemonStartup(): boolean {\n return this.hooks.requiresDaemonStartup();\n }\n}\n\nexport abstract class InterfacePlugin<\n TConfig,\n TConfigInput,\n TTrackingInfo extends BaseJobTrackingInfo = BaseJobTrackingInfo,\n> implements Plugin {\n public readonly type = \"interface\" as const;\n public readonly id: string;\n public readonly version: string;\n public readonly packageName: string;\n public readonly description?: string;\n private readonly delegate: InterfacePluginDelegate<\n TConfig,\n TConfigInput,\n TTrackingInfo\n >;\n\n protected constructor(\n id: string,\n packageJson: { name: string; version: string; description?: string },\n config: TConfigInput,\n configSchema: PluginConfigSchema<TConfig>,\n ) {\n this.id = id;\n this.version = packageJson.version;\n this.packageName = packageJson.name;\n if (packageJson.description !== undefined) {\n this.description = packageJson.description;\n }\n this.delegate = new InterfacePluginDelegate(\n id,\n packageJson,\n config,\n configSchema,\n {\n onRegister: (context): Promise<void> => this.onRegister(context),\n onReady: (context): Promise<void> => this.onReady(context),\n onShutdown: (): Promise<void> => this.onShutdown(),\n getTools: (): Promise<Tool[]> => this.getTools(),\n getResources: (): Promise<Resource[]> => this.getResources(),\n getInstructions: (): Promise<string | undefined> =>\n this.getInstructions(),\n getWebRoutes: (): WebRouteDefinition[] => this.getWebRoutes(),\n requiresDaemonStartup: (): boolean => this.requiresDaemonStartup(),\n },\n );\n }\n\n /** @internal */\n register(\n shell: IShell,\n context?: PluginRegistrationContext,\n ): Promise<PluginCapabilities> {\n return this.delegate.register(shell, context);\n }\n\n protected async onRegister(_context: InterfacePluginContext): Promise<void> {}\n protected async onReady(_context: InterfacePluginContext): Promise<void> {}\n protected async onShutdown(): Promise<void> {}\n protected async getTools(): Promise<Tool[]> {\n return [];\n }\n protected async getResources(): Promise<Resource[]> {\n return [];\n }\n protected async getInstructions(): Promise<string | undefined> {\n return undefined;\n }\n\n getWebRoutes(): WebRouteDefinition[] {\n return [];\n }\n\n requiresDaemonStartup(): boolean {\n return false;\n }\n\n ready(): Promise<void> {\n return this.delegate.ready();\n }\n\n shutdown(): Promise<void> {\n return this.delegate.shutdown?.() ?? Promise.resolve();\n }\n}\n",
|
|
8
|
-
"import { MessageInterfacePlugin as RuntimeMessageInterfacePlugin } from \"../message-interface/message-interface-plugin\";\nimport type { InterfacePluginContext as RuntimeInterfacePluginContext } from \"../interface/context\";\nimport type {\n EditMessageRequest,\n SendMessageToChannelRequest,\n SendMessageWithIdRequest,\n} from \"../message-interface/message-interface-plugin\";\nimport type {\n IShell,\n PluginCapabilities,\n PluginRegistrationContext,\n} from \"../interfaces\";\nimport type { WebRouteDefinition } from \"../types/web-routes\";\nimport type { PermissionLookupContext } from \"@brains/templates\";\nimport type { PluginConfigSchema } from \"../config\";\nimport { InterfacePlugin } from \"./interface-plugin\";\nimport type {\n InterfacePluginContext,\n JobProgressEvent,\n MessageJobTrackingInfo,\n Resource,\n Tool,\n} from \"./types\";\n\ninterface MessageInterfacePluginHooks {\n onRegister(context: InterfacePluginContext): Promise<void>;\n onReady(context: InterfacePluginContext): Promise<void>;\n onShutdown(): Promise<void>;\n getTools(): Promise<Tool[]>;\n getResources(): Promise<Resource[]>;\n getInstructions(): Promise<string | undefined>;\n getWebRoutes(): WebRouteDefinition[];\n requiresDaemonStartup(): boolean;\n sendMessageToChannel(request: SendMessageToChannelRequest): void;\n sendMessageWithId(\n request: SendMessageWithIdRequest,\n ): Promise<string | undefined>;\n editMessage(request: EditMessageRequest): Promise<boolean>;\n supportsMessageEditing(): boolean;\n onProgressUpdate(event: JobProgressEvent): Promise<void>;\n}\n\nclass MessageInterfacePluginDelegate<\n TConfig,\n TConfigInput,\n TTrackingInfo extends MessageJobTrackingInfo,\n> extends RuntimeMessageInterfacePlugin<TConfig, TConfigInput, TTrackingInfo> {\n private readonly hooks: MessageInterfacePluginHooks;\n constructor(\n id: string,\n packageJson: { name: string; version: string; description?: string },\n config: TConfigInput,\n configSchema: PluginConfigSchema<TConfig>,\n hooks: MessageInterfacePluginHooks,\n ) {\n super(id, packageJson, config, configSchema);\n this.hooks = hooks;\n }\n\n protected override async onRegister(\n context: RuntimeInterfacePluginContext,\n ): Promise<void> {\n await super.onRegister(context);\n await this.hooks.onRegister(context);\n }\n\n protected override onReady(\n context: RuntimeInterfacePluginContext,\n ): Promise<void> {\n return this.hooks.onReady(context);\n }\n\n protected override onShutdown(): Promise<void> {\n return this.hooks.onShutdown();\n }\n\n protected override getTools(): Promise<never[]> {\n return this.hooks.getTools() as Promise<never[]>;\n }\n\n protected override getResources(): Promise<never[]> {\n return this.hooks.getResources() as Promise<never[]>;\n }\n\n protected override getInstructions(): Promise<string | undefined> {\n return this.hooks.getInstructions();\n }\n\n override getWebRoutes(): WebRouteDefinition[] {\n return this.hooks.getWebRoutes();\n }\n\n override requiresDaemonStartup(): boolean {\n return this.hooks.requiresDaemonStartup();\n }\n\n protected override sendMessageToChannel(\n request: SendMessageToChannelRequest,\n ): void {\n this.hooks.sendMessageToChannel(request);\n }\n\n protected override sendMessageWithId(\n request: SendMessageWithIdRequest,\n ): Promise<string | undefined> {\n return this.hooks.sendMessageWithId(request);\n }\n\n protected override editMessage(\n request: EditMessageRequest,\n ): Promise<boolean> {\n return this.hooks.editMessage(request);\n }\n\n protected override supportsMessageEditing(): boolean {\n return this.hooks.supportsMessageEditing();\n }\n\n protected override onProgressUpdate(event: JobProgressEvent): Promise<void> {\n return this.hooks.onProgressUpdate(event);\n }\n\n trackAgentResponseForJobPublic(\n jobId: string,\n messageId: string,\n channelId: string,\n ): void {\n this.trackAgentResponseForJob(jobId, messageId, channelId);\n }\n\n captureUrlViaAgentPublic(\n url: string,\n channelId: string,\n authorId: string,\n interfaceType: string,\n permissionContext?: PermissionLookupContext,\n ): Promise<void> {\n return this.captureUrlViaAgent(\n url,\n channelId,\n authorId,\n interfaceType,\n permissionContext,\n );\n }\n\n getCurrentChannelIdPublic(): string | null {\n return this.getCurrentChannelId();\n }\n}\n\nexport abstract class MessageInterfacePlugin<\n TConfig,\n TConfigInput,\n TTrackingInfo extends MessageJobTrackingInfo = MessageJobTrackingInfo,\n> extends InterfacePlugin<TConfig, TConfigInput, TTrackingInfo> {\n private readonly messageDelegate: MessageInterfacePluginDelegate<\n TConfig,\n TConfigInput,\n TTrackingInfo\n >;\n\n protected constructor(\n id: string,\n packageJson: { name: string; version: string; description?: string },\n config: TConfigInput,\n configSchema: PluginConfigSchema<TConfig>,\n ) {\n super(id, packageJson, config, configSchema);\n this.messageDelegate = new MessageInterfacePluginDelegate(\n id,\n packageJson,\n config,\n configSchema,\n {\n onRegister: (context): Promise<void> => this.onRegister(context),\n onReady: (context): Promise<void> => this.onReady(context),\n onShutdown: (): Promise<void> => this.onShutdown(),\n getTools: (): Promise<Tool[]> => this.getTools(),\n getResources: (): Promise<Resource[]> => this.getResources(),\n getInstructions: (): Promise<string | undefined> =>\n this.getInstructions(),\n getWebRoutes: (): WebRouteDefinition[] => this.getWebRoutes(),\n requiresDaemonStartup: (): boolean => this.requiresDaemonStartup(),\n sendMessageToChannel: (request): void =>\n this.sendMessageToChannel(request),\n sendMessageWithId: (request): Promise<string | undefined> =>\n this.sendMessageWithId(request),\n editMessage: (request): Promise<boolean> => this.editMessage(request),\n supportsMessageEditing: (): boolean => this.supportsMessageEditing(),\n onProgressUpdate: (event): Promise<void> =>\n this.onProgressUpdate(event),\n },\n );\n }\n\n /** @internal */\n override register(\n shell: IShell,\n context?: PluginRegistrationContext,\n ): Promise<PluginCapabilities> {\n return this.messageDelegate.register(shell, context);\n }\n\n protected abstract sendMessageToChannel(\n request: SendMessageToChannelRequest,\n ): void;\n\n protected override async onRegister(\n _context: InterfacePluginContext,\n ): Promise<void> {}\n protected override async onReady(\n _context: InterfacePluginContext,\n ): Promise<void> {}\n protected override async onShutdown(): Promise<void> {}\n protected override async getTools(): Promise<Tool[]> {\n return [];\n }\n protected override async getResources(): Promise<Resource[]> {\n return [];\n }\n protected override async getInstructions(): Promise<string | undefined> {\n return undefined;\n }\n protected sendMessageWithId(\n _request: SendMessageWithIdRequest,\n ): Promise<string | undefined> {\n return Promise.resolve(undefined);\n }\n protected editMessage(_request: EditMessageRequest): Promise<boolean> {\n return Promise.resolve(false);\n }\n protected supportsMessageEditing(): boolean {\n return false;\n }\n protected async onProgressUpdate(_event: JobProgressEvent): Promise<void> {}\n\n /** @internal */\n protected isUploadableTextFile(filename: string, mimetype?: string): boolean {\n const textFileExtensions = [\".md\", \".txt\", \".markdown\"];\n const textMimeTypes = [\"text/plain\", \"text/markdown\", \"text/x-markdown\"];\n if (mimetype && textMimeTypes.some((type) => mimetype.startsWith(type))) {\n return true;\n }\n return textFileExtensions.some((extension) =>\n filename.toLowerCase().endsWith(extension),\n );\n }\n\n /** @internal */\n protected isFileSizeAllowed(size: number): boolean {\n return size <= 100_000;\n }\n\n /** @internal */\n protected formatFileUploadMessage(filename: string, content: string): string {\n return `User uploaded a file \"${filename}\":\\n\\n${content}`;\n }\n\n /** @internal */\n protected extractCaptureableUrls(\n content: string,\n blockedDomains: string[],\n ): string[] {\n const matches =\n content.match(/https?:\\/\\/[^\\s<>\"{}|\\\\^`[\\]]+?(?=[,;:\\s]|$)/gi) ?? [];\n return [...new Set(matches)].filter((url) => {\n try {\n const { hostname } = new URL(url);\n return !blockedDomains.some(\n (domain) => hostname === domain || hostname.endsWith(`.${domain}`),\n );\n } catch {\n return false;\n }\n });\n }\n\n /** @internal */\n protected captureUrlViaAgent(\n url: string,\n channelId: string,\n authorId: string,\n interfaceType: string,\n permissionContext?: PermissionLookupContext,\n ): Promise<void> {\n return this.messageDelegate.captureUrlViaAgentPublic(\n url,\n channelId,\n authorId,\n interfaceType,\n permissionContext,\n );\n }\n\n protected trackAgentResponseForJob(\n jobId: string,\n messageId: string,\n channelId: string,\n ): void {\n this.messageDelegate.trackAgentResponseForJobPublic(\n jobId,\n messageId,\n channelId,\n );\n }\n\n public registerProgressCallback(\n callback: (events: JobProgressEvent[]) => void,\n ): void {\n this.messageDelegate.registerProgressCallback(\n callback as (events: JobProgressEvent[]) => void,\n );\n }\n\n public unregisterProgressCallback(): void {\n this.messageDelegate.unregisterProgressCallback();\n }\n\n public getProgressEvents(): JobProgressEvent[] {\n return this.messageDelegate.getProgressEvents() as JobProgressEvent[];\n }\n\n public getActiveProgressEvents(): JobProgressEvent[] {\n return this.messageDelegate.getActiveProgressEvents() as JobProgressEvent[];\n }\n\n public startProcessingInput(channelId: string | null = null): void {\n this.messageDelegate.startProcessingInput(channelId);\n }\n\n public endProcessingInput(): void {\n this.messageDelegate.endProcessingInput();\n }\n\n protected getCurrentChannelId(): string | null {\n return this.messageDelegate.getCurrentChannelIdPublic();\n }\n\n override ready(): Promise<void> {\n return this.messageDelegate.ready();\n }\n\n override shutdown(): Promise<void> {\n return this.messageDelegate.shutdown?.() ?? Promise.resolve();\n }\n}\n",
|
|
8
|
+
"import { MessageInterfacePlugin as RuntimeMessageInterfacePlugin } from \"../message-interface/message-interface-plugin\";\nimport type {\n InterfacePluginContext as RuntimeInterfacePluginContext,\n MessageInterfacePluginContext as RuntimeMessageInterfacePluginContext,\n} from \"../interface/context\";\nimport type {\n EditMessageRequest,\n SendMessageToChannelRequest,\n SendMessageWithIdRequest,\n} from \"../message-interface/message-interface-plugin\";\nimport type {\n IShell,\n PluginCapabilities,\n PluginRegistrationContext,\n} from \"../interfaces\";\nimport type { WebRouteDefinition } from \"../types/web-routes\";\nimport type { PermissionLookupContext } from \"@brains/templates\";\nimport type { PluginConfigSchema } from \"../config\";\nimport { InterfacePlugin } from \"./interface-plugin\";\nimport type {\n InterfacePluginContext,\n JobProgressEvent,\n MessageInterfacePluginContext,\n MessageJobTrackingInfo,\n Resource,\n Tool,\n} from \"./types\";\n\ninterface MessageInterfacePluginHooks {\n onRegister(context: MessageInterfacePluginContext): Promise<void>;\n onReady(context: InterfacePluginContext): Promise<void>;\n onShutdown(): Promise<void>;\n getTools(): Promise<Tool[]>;\n getResources(): Promise<Resource[]>;\n getInstructions(): Promise<string | undefined>;\n getWebRoutes(): WebRouteDefinition[];\n requiresDaemonStartup(): boolean;\n sendMessageToChannel(request: SendMessageToChannelRequest): void;\n sendMessageWithId(\n request: SendMessageWithIdRequest,\n ): Promise<string | undefined>;\n editMessage(request: EditMessageRequest): Promise<boolean>;\n supportsMessageEditing(): boolean;\n onProgressUpdate(event: JobProgressEvent): Promise<void>;\n}\n\nclass MessageInterfacePluginDelegate<\n TConfig,\n TConfigInput,\n TTrackingInfo extends MessageJobTrackingInfo,\n> extends RuntimeMessageInterfacePlugin<TConfig, TConfigInput, TTrackingInfo> {\n private readonly hooks: MessageInterfacePluginHooks;\n constructor(\n id: string,\n packageJson: { name: string; version: string; description?: string },\n config: TConfigInput,\n configSchema: PluginConfigSchema<TConfig>,\n hooks: MessageInterfacePluginHooks,\n ) {\n super(id, packageJson, config, configSchema);\n this.hooks = hooks;\n }\n\n protected override async onRegister(\n context: RuntimeMessageInterfacePluginContext,\n ): Promise<void> {\n await super.onRegister(context);\n await this.hooks.onRegister(context);\n }\n\n protected override onReady(\n context: RuntimeInterfacePluginContext,\n ): Promise<void> {\n return this.hooks.onReady(context);\n }\n\n protected override onShutdown(): Promise<void> {\n return this.hooks.onShutdown();\n }\n\n protected override getTools(): Promise<never[]> {\n return this.hooks.getTools() as Promise<never[]>;\n }\n\n protected override getResources(): Promise<never[]> {\n return this.hooks.getResources() as Promise<never[]>;\n }\n\n protected override getInstructions(): Promise<string | undefined> {\n return this.hooks.getInstructions();\n }\n\n override getWebRoutes(): WebRouteDefinition[] {\n return this.hooks.getWebRoutes();\n }\n\n override requiresDaemonStartup(): boolean {\n return this.hooks.requiresDaemonStartup();\n }\n\n protected override sendMessageToChannel(\n request: SendMessageToChannelRequest,\n ): void {\n this.hooks.sendMessageToChannel(request);\n }\n\n protected override sendMessageWithId(\n request: SendMessageWithIdRequest,\n ): Promise<string | undefined> {\n return this.hooks.sendMessageWithId(request);\n }\n\n protected override editMessage(\n request: EditMessageRequest,\n ): Promise<boolean> {\n return this.hooks.editMessage(request);\n }\n\n protected override supportsMessageEditing(): boolean {\n return this.hooks.supportsMessageEditing();\n }\n\n protected override onProgressUpdate(event: JobProgressEvent): Promise<void> {\n return this.hooks.onProgressUpdate(event);\n }\n\n trackAgentResponseForJobPublic(\n jobId: string,\n messageId: string,\n channelId: string,\n ): void {\n this.trackAgentResponseForJob(jobId, messageId, channelId);\n }\n\n captureUrlViaAgentPublic(\n url: string,\n channelId: string,\n authorId: string,\n interfaceType: string,\n permissionContext?: PermissionLookupContext,\n ): Promise<void> {\n return this.captureUrlViaAgent(\n url,\n channelId,\n authorId,\n interfaceType,\n permissionContext,\n );\n }\n\n getCurrentChannelIdPublic(): string | null {\n return this.getCurrentChannelId();\n }\n}\n\nexport abstract class MessageInterfacePlugin<\n TConfig,\n TConfigInput,\n TTrackingInfo extends MessageJobTrackingInfo = MessageJobTrackingInfo,\n> extends InterfacePlugin<TConfig, TConfigInput, TTrackingInfo> {\n private readonly messageDelegate: MessageInterfacePluginDelegate<\n TConfig,\n TConfigInput,\n TTrackingInfo\n >;\n\n protected constructor(\n id: string,\n packageJson: { name: string; version: string; description?: string },\n config: TConfigInput,\n configSchema: PluginConfigSchema<TConfig>,\n ) {\n super(id, packageJson, config, configSchema);\n this.messageDelegate = new MessageInterfacePluginDelegate(\n id,\n packageJson,\n config,\n configSchema,\n {\n onRegister: (context): Promise<void> => this.onRegister(context),\n onReady: (context): Promise<void> => this.onReady(context),\n onShutdown: (): Promise<void> => this.onShutdown(),\n getTools: (): Promise<Tool[]> => this.getTools(),\n getResources: (): Promise<Resource[]> => this.getResources(),\n getInstructions: (): Promise<string | undefined> =>\n this.getInstructions(),\n getWebRoutes: (): WebRouteDefinition[] => this.getWebRoutes(),\n requiresDaemonStartup: (): boolean => this.requiresDaemonStartup(),\n sendMessageToChannel: (request): void =>\n this.sendMessageToChannel(request),\n sendMessageWithId: (request): Promise<string | undefined> =>\n this.sendMessageWithId(request),\n editMessage: (request): Promise<boolean> => this.editMessage(request),\n supportsMessageEditing: (): boolean => this.supportsMessageEditing(),\n onProgressUpdate: (event): Promise<void> =>\n this.onProgressUpdate(event),\n },\n );\n }\n\n /** @internal */\n override register(\n shell: IShell,\n context?: PluginRegistrationContext,\n ): Promise<PluginCapabilities> {\n return this.messageDelegate.register(shell, context);\n }\n\n /** Inbound/conversational interfaces override this; outbound-only interfaces need not. */\n protected sendMessageToChannel(_request: SendMessageToChannelRequest): void {\n return;\n }\n\n protected override async onRegister(\n _context: MessageInterfacePluginContext,\n ): Promise<void> {}\n protected override async onReady(\n _context: InterfacePluginContext,\n ): Promise<void> {}\n protected override async onShutdown(): Promise<void> {}\n protected override async getTools(): Promise<Tool[]> {\n return [];\n }\n protected override async getResources(): Promise<Resource[]> {\n return [];\n }\n protected override async getInstructions(): Promise<string | undefined> {\n return undefined;\n }\n protected sendMessageWithId(\n _request: SendMessageWithIdRequest,\n ): Promise<string | undefined> {\n return Promise.resolve(undefined);\n }\n protected editMessage(_request: EditMessageRequest): Promise<boolean> {\n return Promise.resolve(false);\n }\n protected supportsMessageEditing(): boolean {\n return false;\n }\n protected async onProgressUpdate(_event: JobProgressEvent): Promise<void> {}\n\n /** @internal */\n protected isUploadableTextFile(filename: string, mimetype?: string): boolean {\n const textFileExtensions = [\".md\", \".txt\", \".markdown\"];\n const textMimeTypes = [\"text/plain\", \"text/markdown\", \"text/x-markdown\"];\n if (mimetype && textMimeTypes.some((type) => mimetype.startsWith(type))) {\n return true;\n }\n return textFileExtensions.some((extension) =>\n filename.toLowerCase().endsWith(extension),\n );\n }\n\n /** @internal */\n protected isFileSizeAllowed(size: number): boolean {\n return size <= 100_000;\n }\n\n /** @internal */\n protected formatFileUploadMessage(filename: string, content: string): string {\n return `User uploaded a file \"${filename}\":\\n\\n${content}`;\n }\n\n /** @internal */\n protected extractCaptureableUrls(\n content: string,\n blockedDomains: string[],\n ): string[] {\n const matches =\n content.match(/https?:\\/\\/[^\\s<>\"{}|\\\\^`[\\]]+?(?=[,;:\\s]|$)/gi) ?? [];\n return [...new Set(matches)].filter((url) => {\n try {\n const { hostname } = new URL(url);\n return !blockedDomains.some(\n (domain) => hostname === domain || hostname.endsWith(`.${domain}`),\n );\n } catch {\n return false;\n }\n });\n }\n\n /** @internal */\n protected captureUrlViaAgent(\n url: string,\n channelId: string,\n authorId: string,\n interfaceType: string,\n permissionContext?: PermissionLookupContext,\n ): Promise<void> {\n return this.messageDelegate.captureUrlViaAgentPublic(\n url,\n channelId,\n authorId,\n interfaceType,\n permissionContext,\n );\n }\n\n protected trackAgentResponseForJob(\n jobId: string,\n messageId: string,\n channelId: string,\n ): void {\n this.messageDelegate.trackAgentResponseForJobPublic(\n jobId,\n messageId,\n channelId,\n );\n }\n\n public registerProgressCallback(\n callback: (events: JobProgressEvent[]) => void,\n ): void {\n this.messageDelegate.registerProgressCallback(\n callback as (events: JobProgressEvent[]) => void,\n );\n }\n\n public unregisterProgressCallback(): void {\n this.messageDelegate.unregisterProgressCallback();\n }\n\n public getProgressEvents(): JobProgressEvent[] {\n return this.messageDelegate.getProgressEvents() as JobProgressEvent[];\n }\n\n public getActiveProgressEvents(): JobProgressEvent[] {\n return this.messageDelegate.getActiveProgressEvents() as JobProgressEvent[];\n }\n\n public startProcessingInput(channelId: string | null = null): void {\n this.messageDelegate.startProcessingInput(channelId);\n }\n\n public endProcessingInput(): void {\n this.messageDelegate.endProcessingInput();\n }\n\n protected getCurrentChannelId(): string | null {\n return this.messageDelegate.getCurrentChannelIdPublic();\n }\n\n override ready(): Promise<void> {\n return this.messageDelegate.ready();\n }\n\n override shutdown(): Promise<void> {\n return this.messageDelegate.shutdown?.() ?? Promise.resolve();\n }\n}\n",
|
|
9
9
|
"import { ServicePlugin as RuntimeServicePlugin } from \"../service/service-plugin\";\nimport type { ServicePluginContext as RuntimeServicePluginContext } from \"../service/context\";\nimport type { PluginConfigSchema } from \"../config\";\nimport type {\n IShell,\n PluginCapabilities,\n PluginRegistrationContext,\n} from \"../interfaces\";\nimport type { Plugin, Resource, ServicePluginContext, Tool } from \"./types\";\n\ninterface ServicePluginHooks {\n onRegister(context: ServicePluginContext): Promise<void>;\n onReady(context: ServicePluginContext): Promise<void>;\n onShutdown(): Promise<void>;\n getTools(): Promise<Tool[]>;\n getResources(): Promise<Resource[]>;\n getInstructions(): Promise<string | undefined>;\n}\n\nclass ServicePluginDelegate<TConfig, TConfigInput> extends RuntimeServicePlugin<\n TConfig,\n TConfigInput\n> {\n private readonly hooks: ServicePluginHooks;\n constructor(\n id: string,\n packageJson: { name: string; version: string; description?: string },\n config: TConfigInput,\n configSchema: PluginConfigSchema<TConfig>,\n hooks: ServicePluginHooks,\n ) {\n super(id, packageJson, config, configSchema);\n this.hooks = hooks;\n }\n\n protected override onRegister(\n context: RuntimeServicePluginContext,\n ): Promise<void> {\n return this.hooks.onRegister(context);\n }\n\n protected override onReady(\n context: RuntimeServicePluginContext,\n ): Promise<void> {\n return this.hooks.onReady(context);\n }\n\n protected override onShutdown(): Promise<void> {\n return this.hooks.onShutdown();\n }\n\n protected override getTools(): Promise<never[]> {\n return this.hooks.getTools() as Promise<never[]>;\n }\n\n protected override getResources(): Promise<never[]> {\n return this.hooks.getResources() as Promise<never[]>;\n }\n\n protected override getInstructions(): Promise<string | undefined> {\n return this.hooks.getInstructions();\n }\n}\n\nexport abstract class ServicePlugin<TConfig, TConfigInput> implements Plugin {\n public readonly type = \"service\" as const;\n public readonly id: string;\n public readonly version: string;\n public readonly packageName: string;\n public readonly description?: string;\n private readonly delegate: ServicePluginDelegate<TConfig, TConfigInput>;\n\n protected constructor(\n id: string,\n packageJson: { name: string; version: string; description?: string },\n config: TConfigInput,\n configSchema: PluginConfigSchema<TConfig>,\n ) {\n this.id = id;\n this.version = packageJson.version;\n this.packageName = packageJson.name;\n if (packageJson.description !== undefined) {\n this.description = packageJson.description;\n }\n this.delegate = new ServicePluginDelegate(\n id,\n packageJson,\n config,\n configSchema,\n {\n onRegister: (context): Promise<void> => this.onRegister(context),\n onReady: (context): Promise<void> => this.onReady(context),\n onShutdown: (): Promise<void> => this.onShutdown(),\n getTools: (): Promise<Tool[]> => this.getTools(),\n getResources: (): Promise<Resource[]> => this.getResources(),\n getInstructions: (): Promise<string | undefined> =>\n this.getInstructions(),\n },\n );\n }\n\n /** @internal */\n register(\n shell: IShell,\n context?: PluginRegistrationContext,\n ): Promise<PluginCapabilities> {\n return this.delegate.register(shell, context);\n }\n\n protected async onRegister(_context: ServicePluginContext): Promise<void> {}\n protected async onReady(_context: ServicePluginContext): Promise<void> {}\n protected async onShutdown(): Promise<void> {}\n protected async getTools(): Promise<Tool[]> {\n return [];\n }\n protected async getResources(): Promise<Resource[]> {\n return [];\n }\n protected async getInstructions(): Promise<string | undefined> {\n return undefined;\n }\n\n ready(): Promise<void> {\n return this.delegate.ready();\n }\n\n shutdown(): Promise<void> {\n return this.delegate.shutdown?.() ?? Promise.resolve();\n }\n}\n"
|
|
10
10
|
],
|
|
11
|
-
"mappings": ";
|
|
12
|
-
"debugId": "
|
|
11
|
+
"mappings": ";maAyJO,UAAS,EAA8C,EAC5D,GACsB,EACtB,QAAO,GAGF,SAAS,CAAiC,CAC/C,EACmB,CACnB,OAAO,EAGF,SAAS,CAAwB,CAAC,EAA2B,CAClE,OAAO,IAAS,OAAY,CAAE,QAAS,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wB,CAClD,MAAO,CAAC,OAEM,gBAAe,EAAgC,CAC7D,OAGF,KAAK,EAAkB,CACrB,OAAO,KAAK,SAAS,MAAM,EAG7B,QAAQ,EAAkB,CACxB,OAAO,KAAK,SAAS,WAAW,GAAK,QAAQ,QAAQ,EAEzD",
|
|
12
|
+
"debugId": "693485257544B91764756E2164756E21",
|
|
13
13
|
"names": []
|
|
14
14
|
}
|
package/dist/services.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{A as j,y as f,z as h}from"./chunks/index-
|
|
2
|
+
import{A as j,y as f,z as h}from"./chunks/index-kga4gmhq.js";import"./chunks/index-72d2a6vf.js";import"./chunks/index-aatpaped.js";import"./chunks/index-b6k44k1d.js";import"./chunks/index-q5r12b3s.js";import"./chunks/index-fxc39qy2.js";export{f as baseQuerySchema,h as baseInputSchema,j as BaseEntityDataSource};
|
|
3
3
|
|
|
4
4
|
//# debugId=4712FBF11B1C2F8C64756E2164756E21
|
|
5
5
|
//# sourceMappingURL=services.js.map
|