@memberjunction/ai-agents 5.42.0 → 5.44.0
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/README.md +10 -0
- package/dist/DuplicateReasoningAgentProvider.d.ts +35 -0
- package/dist/DuplicateReasoningAgentProvider.d.ts.map +1 -0
- package/dist/DuplicateReasoningAgentProvider.js +95 -0
- package/dist/DuplicateReasoningAgentProvider.js.map +1 -0
- package/dist/MJAIAgentRequestEntityServer.d.ts +7 -0
- package/dist/MJAIAgentRequestEntityServer.d.ts.map +1 -1
- package/dist/MJAIAgentRequestEntityServer.js +28 -1
- package/dist/MJAIAgentRequestEntityServer.js.map +1 -1
- package/dist/SkillImportExportService.d.ts +63 -0
- package/dist/SkillImportExportService.d.ts.map +1 -0
- package/dist/SkillImportExportService.js +148 -0
- package/dist/SkillImportExportService.js.map +1 -0
- package/dist/SkillMarkdownConverter.d.ts +82 -0
- package/dist/SkillMarkdownConverter.d.ts.map +1 -0
- package/dist/SkillMarkdownConverter.js +145 -0
- package/dist/SkillMarkdownConverter.js.map +1 -0
- package/dist/agent-types/flow-agent-type.d.ts.map +1 -1
- package/dist/agent-types/flow-agent-type.js +10 -2
- package/dist/agent-types/flow-agent-type.js.map +1 -1
- package/dist/agent-types/loop-agent-response-type.d.ts +17 -2
- package/dist/agent-types/loop-agent-response-type.d.ts.map +1 -1
- package/dist/agent-types/loop-agent-response-type.js.map +1 -1
- package/dist/agent-types/loop-agent-type.d.ts.map +1 -1
- package/dist/agent-types/loop-agent-type.js +33 -1
- package/dist/agent-types/loop-agent-type.js.map +1 -1
- package/dist/base-agent.d.ts +373 -12
- package/dist/base-agent.d.ts.map +1 -1
- package/dist/base-agent.js +1019 -78
- package/dist/base-agent.js.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/memory-manager-agent.d.ts +39 -0
- package/dist/memory-manager-agent.d.ts.map +1 -1
- package/dist/memory-manager-agent.js +118 -5
- package/dist/memory-manager-agent.js.map +1 -1
- package/dist/operations/AISkillMarkdownOperations.d.ts +11 -0
- package/dist/operations/AISkillMarkdownOperations.d.ts.map +1 -0
- package/dist/operations/AISkillMarkdownOperations.js +57 -0
- package/dist/operations/AISkillMarkdownOperations.js.map +1 -0
- package/dist/prompt-component-resolver.d.ts +73 -0
- package/dist/prompt-component-resolver.d.ts.map +1 -0
- package/dist/prompt-component-resolver.js +166 -0
- package/dist/prompt-component-resolver.js.map +1 -0
- package/dist/realtime/agent-media-library.d.ts +65 -0
- package/dist/realtime/agent-media-library.d.ts.map +1 -0
- package/dist/realtime/agent-media-library.js +160 -0
- package/dist/realtime/agent-media-library.js.map +1 -0
- package/dist/realtime/bridge-room-transcript-sink.d.ts +5 -0
- package/dist/realtime/bridge-room-transcript-sink.d.ts.map +1 -1
- package/dist/realtime/bridge-room-transcript-sink.js +25 -1
- package/dist/realtime/bridge-room-transcript-sink.js.map +1 -1
- package/dist/realtime/client-context-channel-server.d.ts +59 -0
- package/dist/realtime/client-context-channel-server.d.ts.map +1 -0
- package/dist/realtime/client-context-channel-server.js +78 -0
- package/dist/realtime/client-context-channel-server.js.map +1 -0
- package/dist/realtime/media-channel-server.d.ts +73 -0
- package/dist/realtime/media-channel-server.d.ts.map +1 -0
- package/dist/realtime/media-channel-server.js +145 -0
- package/dist/realtime/media-channel-server.js.map +1 -0
- package/dist/realtime/realtime-channel-server-data-context.d.ts +42 -0
- package/dist/realtime/realtime-channel-server-data-context.d.ts.map +1 -0
- package/dist/realtime/realtime-channel-server-data-context.js +29 -0
- package/dist/realtime/realtime-channel-server-data-context.js.map +1 -0
- package/dist/realtime/realtime-channel-server-host.d.ts.map +1 -1
- package/dist/realtime/realtime-channel-server-host.js +8 -2
- package/dist/realtime/realtime-channel-server-host.js.map +1 -1
- package/dist/realtime/realtime-client-session-service.d.ts +85 -5
- package/dist/realtime/realtime-client-session-service.d.ts.map +1 -1
- package/dist/realtime/realtime-client-session-service.js +234 -25
- package/dist/realtime/realtime-client-session-service.js.map +1 -1
- package/dist/realtime/realtime-coagent-config.d.ts +161 -3
- package/dist/realtime/realtime-coagent-config.d.ts.map +1 -1
- package/dist/realtime/realtime-coagent-config.js +241 -6
- package/dist/realtime/realtime-coagent-config.js.map +1 -1
- package/dist/realtime/realtime-recording-capture.d.ts +125 -0
- package/dist/realtime/realtime-recording-capture.d.ts.map +1 -0
- package/dist/realtime/realtime-recording-capture.js +317 -0
- package/dist/realtime/realtime-recording-capture.js.map +1 -0
- package/dist/realtime/realtime-recording-store.d.ts +105 -0
- package/dist/realtime/realtime-recording-store.d.ts.map +1 -0
- package/dist/realtime/realtime-recording-store.js +216 -0
- package/dist/realtime/realtime-recording-store.js.map +1 -0
- package/dist/realtime/realtime-session-runner.d.ts +33 -2
- package/dist/realtime/realtime-session-runner.d.ts.map +1 -1
- package/dist/realtime/realtime-session-runner.js +45 -2
- package/dist/realtime/realtime-session-runner.js.map +1 -1
- package/dist/realtime/realtime-tool-broker.d.ts +41 -3
- package/dist/realtime/realtime-tool-broker.d.ts.map +1 -1
- package/dist/realtime/realtime-tool-broker.js +67 -3
- package/dist/realtime/realtime-tool-broker.js.map +1 -1
- package/dist/realtime/realtime-turn-moderator.d.ts +103 -0
- package/dist/realtime/realtime-turn-moderator.d.ts.map +1 -0
- package/dist/realtime/realtime-turn-moderator.js +266 -0
- package/dist/realtime/realtime-turn-moderator.js.map +1 -0
- package/package.json +18 -17
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Server-side channel plugin for the **headless** Client Context channel — the live
|
|
3
|
+
* wire that streams the user's app context (where they are, what they see, the available client-tool
|
|
4
|
+
* and agent manifest) to the realtime co-agent, and through which the model's single stable
|
|
5
|
+
* `ContextTool` proxy drives in-app actions.
|
|
6
|
+
*
|
|
7
|
+
* Paired with the browser's `ClientContextChannel` client plugin through the seeded
|
|
8
|
+
* `MJ: AI Agent Channels` row (`Name: 'ClientContextChannel'`, `IsHeadless: 1`,
|
|
9
|
+
* `ServerPluginClass: 'ClientContextChannelServer'`, `ClientPluginClass: 'ClientContextChannel'`).
|
|
10
|
+
*
|
|
11
|
+
* **Why the server half is intentionally thin.** This channel is *headless* (it never mounts a tab)
|
|
12
|
+
* and *ephemeral* (it persists no state of record — it is a live wire, not a document like the
|
|
13
|
+
* whiteboard). In the client-direct topology the work lives in the browser: the client plugin
|
|
14
|
+
* publishes context deltas via the provider's `SendContextNote` and executes `ContextTool` calls
|
|
15
|
+
* locally through the unified client-tool resolver (`ResolveClientTools` in
|
|
16
|
+
* `@memberjunction/ai-core-plus`) with no server round-trip. The server half exists to (a) complete
|
|
17
|
+
* the channel registry pairing so the channel is discoverable/loadable like every other channel, and
|
|
18
|
+
* (b) be the home for any *future* server-side context tooling. It contributes no server tools today
|
|
19
|
+
* and saves no state — both base defaults, made explicit here.
|
|
20
|
+
*
|
|
21
|
+
* @module @memberjunction/ai-agents
|
|
22
|
+
* @author MemberJunction.com
|
|
23
|
+
*/
|
|
24
|
+
import { BaseRealtimeChannelServer, RealtimeToolDefinition } from '@memberjunction/ai';
|
|
25
|
+
/** The stable channel name, matching the seeded `MJ: AI Agent Channels` row. */
|
|
26
|
+
export declare const CLIENT_CONTEXT_CHANNEL_NAME = "ClientContextChannel";
|
|
27
|
+
/**
|
|
28
|
+
* Server half of the headless Client Context channel. One instance per realtime session (created by
|
|
29
|
+
* `RealtimeChannelServerHost` from the channel registry — never construct directly).
|
|
30
|
+
*
|
|
31
|
+
* Contributes **no server tools** ({@link GetServerToolDefinitions} returns `[]`) — the channel's
|
|
32
|
+
* `ContextTool` and client tools execute client-side — and persists **no state of record**
|
|
33
|
+
* ({@link OnChannelStateSave} returns `null`, the "keep nothing / live-only" posture), so a session
|
|
34
|
+
* resume never tries to rehydrate it.
|
|
35
|
+
*/
|
|
36
|
+
export declare class ClientContextChannelServer extends BaseRealtimeChannelServer {
|
|
37
|
+
/** Matches the seeded `MJ: AI Agent Channels` row's `Name`. */
|
|
38
|
+
get ChannelName(): string;
|
|
39
|
+
/**
|
|
40
|
+
* No server-executed tools: the channel's stable `ContextTool` proxy and all surface client tools
|
|
41
|
+
* execute in the browser via the unified client-tool resolver. Explicit `[]` documents the intent.
|
|
42
|
+
*/
|
|
43
|
+
GetServerToolDefinitions(): RealtimeToolDefinition[];
|
|
44
|
+
/**
|
|
45
|
+
* Live-only channel: it carries no state of record (it is a wire, not a document), so a landed
|
|
46
|
+
* state save is intentionally not persisted. Returning `null` keeps nothing — a session resume
|
|
47
|
+
* never rehydrates this channel.
|
|
48
|
+
*
|
|
49
|
+
* @returns `null` — never persist.
|
|
50
|
+
*/
|
|
51
|
+
OnChannelStateSave(): Promise<string | null>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Tree-shaking prevention for {@link ClientContextChannelServer}'s `@RegisterClass` registration.
|
|
55
|
+
* Called from a static code path in the server host so the registration always executes — mirroring
|
|
56
|
+
* every other `Load...()` in the realtime stack.
|
|
57
|
+
*/
|
|
58
|
+
export declare function LoadClientContextChannelServer(): void;
|
|
59
|
+
//# sourceMappingURL=client-context-channel-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-context-channel-server.d.ts","sourceRoot":"","sources":["../../src/realtime/client-context-channel-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGvF,gFAAgF;AAChF,eAAO,MAAM,2BAA2B,yBAAyB,CAAC;AAElE;;;;;;;;GAQG;AACH,qBACa,0BAA2B,SAAQ,yBAAyB;IACrE,+DAA+D;IAC/D,IAAW,WAAW,IAAI,MAAM,CAE/B;IAED;;;OAGG;IACa,wBAAwB,IAAI,sBAAsB,EAAE;IAIpE;;;;;;OAMG;IACmB,kBAAkB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAGrE;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,IAAI,IAAI,CAErD"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Server-side channel plugin for the **headless** Client Context channel — the live
|
|
3
|
+
* wire that streams the user's app context (where they are, what they see, the available client-tool
|
|
4
|
+
* and agent manifest) to the realtime co-agent, and through which the model's single stable
|
|
5
|
+
* `ContextTool` proxy drives in-app actions.
|
|
6
|
+
*
|
|
7
|
+
* Paired with the browser's `ClientContextChannel` client plugin through the seeded
|
|
8
|
+
* `MJ: AI Agent Channels` row (`Name: 'ClientContextChannel'`, `IsHeadless: 1`,
|
|
9
|
+
* `ServerPluginClass: 'ClientContextChannelServer'`, `ClientPluginClass: 'ClientContextChannel'`).
|
|
10
|
+
*
|
|
11
|
+
* **Why the server half is intentionally thin.** This channel is *headless* (it never mounts a tab)
|
|
12
|
+
* and *ephemeral* (it persists no state of record — it is a live wire, not a document like the
|
|
13
|
+
* whiteboard). In the client-direct topology the work lives in the browser: the client plugin
|
|
14
|
+
* publishes context deltas via the provider's `SendContextNote` and executes `ContextTool` calls
|
|
15
|
+
* locally through the unified client-tool resolver (`ResolveClientTools` in
|
|
16
|
+
* `@memberjunction/ai-core-plus`) with no server round-trip. The server half exists to (a) complete
|
|
17
|
+
* the channel registry pairing so the channel is discoverable/loadable like every other channel, and
|
|
18
|
+
* (b) be the home for any *future* server-side context tooling. It contributes no server tools today
|
|
19
|
+
* and saves no state — both base defaults, made explicit here.
|
|
20
|
+
*
|
|
21
|
+
* @module @memberjunction/ai-agents
|
|
22
|
+
* @author MemberJunction.com
|
|
23
|
+
*/
|
|
24
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
25
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
26
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
27
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
28
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
29
|
+
};
|
|
30
|
+
import { BaseRealtimeChannelServer } from '@memberjunction/ai';
|
|
31
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
32
|
+
/** The stable channel name, matching the seeded `MJ: AI Agent Channels` row. */
|
|
33
|
+
export const CLIENT_CONTEXT_CHANNEL_NAME = 'ClientContextChannel';
|
|
34
|
+
/**
|
|
35
|
+
* Server half of the headless Client Context channel. One instance per realtime session (created by
|
|
36
|
+
* `RealtimeChannelServerHost` from the channel registry — never construct directly).
|
|
37
|
+
*
|
|
38
|
+
* Contributes **no server tools** ({@link GetServerToolDefinitions} returns `[]`) — the channel's
|
|
39
|
+
* `ContextTool` and client tools execute client-side — and persists **no state of record**
|
|
40
|
+
* ({@link OnChannelStateSave} returns `null`, the "keep nothing / live-only" posture), so a session
|
|
41
|
+
* resume never tries to rehydrate it.
|
|
42
|
+
*/
|
|
43
|
+
let ClientContextChannelServer = class ClientContextChannelServer extends BaseRealtimeChannelServer {
|
|
44
|
+
/** Matches the seeded `MJ: AI Agent Channels` row's `Name`. */
|
|
45
|
+
get ChannelName() {
|
|
46
|
+
return CLIENT_CONTEXT_CHANNEL_NAME;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* No server-executed tools: the channel's stable `ContextTool` proxy and all surface client tools
|
|
50
|
+
* execute in the browser via the unified client-tool resolver. Explicit `[]` documents the intent.
|
|
51
|
+
*/
|
|
52
|
+
GetServerToolDefinitions() {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Live-only channel: it carries no state of record (it is a wire, not a document), so a landed
|
|
57
|
+
* state save is intentionally not persisted. Returning `null` keeps nothing — a session resume
|
|
58
|
+
* never rehydrates this channel.
|
|
59
|
+
*
|
|
60
|
+
* @returns `null` — never persist.
|
|
61
|
+
*/
|
|
62
|
+
async OnChannelStateSave() {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
ClientContextChannelServer = __decorate([
|
|
67
|
+
RegisterClass(BaseRealtimeChannelServer, 'ClientContextChannelServer')
|
|
68
|
+
], ClientContextChannelServer);
|
|
69
|
+
export { ClientContextChannelServer };
|
|
70
|
+
/**
|
|
71
|
+
* Tree-shaking prevention for {@link ClientContextChannelServer}'s `@RegisterClass` registration.
|
|
72
|
+
* Called from a static code path in the server host so the registration always executes — mirroring
|
|
73
|
+
* every other `Load...()` in the realtime stack.
|
|
74
|
+
*/
|
|
75
|
+
export function LoadClientContextChannelServer() {
|
|
76
|
+
// no-op — the import + call create a static reference bundlers cannot eliminate
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=client-context-channel-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-context-channel-server.js","sourceRoot":"","sources":["../../src/realtime/client-context-channel-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;;;AAEH,OAAO,EAAE,yBAAyB,EAA0B,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,gFAAgF;AAChF,MAAM,CAAC,MAAM,2BAA2B,GAAG,sBAAsB,CAAC;AAElE;;;;;;;;GAQG;AAEI,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,yBAAyB;IACrE,+DAA+D;IAC/D,IAAW,WAAW;QAClB,OAAO,2BAA2B,CAAC;IACvC,CAAC;IAED;;;OAGG;IACa,wBAAwB;QACpC,OAAO,EAAE,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACa,KAAK,CAAC,kBAAkB;QACpC,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AAxBY,0BAA0B;IADtC,aAAa,CAAC,yBAAyB,EAAE,4BAA4B,CAAC;GAC1D,0BAA0B,CAwBtC;;AAED;;;;GAIG;AACH,MAAM,UAAU,8BAA8B;IAC1C,gFAAgF;AACpF,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Server-side channel plugin for the live **Media** channel — the agent shows
|
|
3
|
+
* images / video / audio / PDFs / web embeds to the user during a realtime conversation. Paired
|
|
4
|
+
* with the browser's `RealtimeMediaChannel` client plugin through the seeded `MJ: AI Agent Channels`
|
|
5
|
+
* row (`Name: 'Media'`, `ServerPluginClass: 'MediaChannelServer'`,
|
|
6
|
+
* `ClientPluginClass: 'RealtimeMediaChannel'`).
|
|
7
|
+
*
|
|
8
|
+
* Like the Whiteboard, the Media channel executes entirely **client-side** (the client tools
|
|
9
|
+
* `Media_ShowMedia` / `Media_PlayMedia` / `Media_Highlight` / `Media_CloseMedia` / `Media_ClearAll`
|
|
10
|
+
* mutate a browser state engine that renders the media). The server half's job is to guard the
|
|
11
|
+
* **persisted state of record** — the `MJ: AI Agent Session Channels.Config` blob a resume
|
|
12
|
+
* rehydrates through the client's `RestoreState` — by validating that every landed save is a
|
|
13
|
+
* parseable media-state object and normalizing it to a canonical compact serialization.
|
|
14
|
+
*
|
|
15
|
+
* @module @memberjunction/ai-agents
|
|
16
|
+
* @author MemberJunction.com
|
|
17
|
+
*/
|
|
18
|
+
import { BaseRealtimeChannelServer } from '@memberjunction/ai';
|
|
19
|
+
import { IMetadataProvider, UserInfo } from '@memberjunction/core';
|
|
20
|
+
import { IRealtimeChannelServerDataAware } from './realtime-channel-server-data-context.js';
|
|
21
|
+
/**
|
|
22
|
+
* Server half of the Media interactive channel. One instance per realtime session (created by
|
|
23
|
+
* `RealtimeChannelServerHost` from the channel registry — never construct directly).
|
|
24
|
+
*
|
|
25
|
+
* On each landed state save ({@link OnChannelStateSave}):
|
|
26
|
+
* - payload parses to a JSON **object** → persist the canonical compact re-serialization;
|
|
27
|
+
* - payload is malformed JSON or a non-object → log loudly and keep the original unchanged
|
|
28
|
+
* (persistence is never blocked; the client's `RestoreState` is tolerant of bad payloads, so
|
|
29
|
+
* flag-don't-drop is the safe posture, matching `WhiteboardChannelServer`).
|
|
30
|
+
*/
|
|
31
|
+
export declare class MediaChannelServer extends BaseRealtimeChannelServer implements IRealtimeChannelServerDataAware {
|
|
32
|
+
/** The session's data context, handed over by the host before {@link OnSessionStarted}. */
|
|
33
|
+
private sessionContextUser;
|
|
34
|
+
private sessionProvider;
|
|
35
|
+
/** Matches the seeded `MJ: AI Agent Channels` row's `Name`. */
|
|
36
|
+
get ChannelName(): string;
|
|
37
|
+
/**
|
|
38
|
+
* Receives the session's MJ data context from the host (between `Initialize` and
|
|
39
|
+
* `OnSessionStarted`) — used by {@link OnSessionStarted} to resolve the agent's media kit.
|
|
40
|
+
*/
|
|
41
|
+
SetSessionDataContext(contextUser: UserInfo, provider: IMetadataProvider): void;
|
|
42
|
+
/**
|
|
43
|
+
* Resolves the agent's curated media kit (a bound `MJ: Collections` of artifacts) into a manifest
|
|
44
|
+
* and feeds it to the live model as a background context note, so the agent knows what it can show
|
|
45
|
+
* (and surfaces items via the existing `Media_ShowMedia` tool). Best-effort: any failure is logged
|
|
46
|
+
* and the session proceeds with no kit (the host also wraps this in try/catch).
|
|
47
|
+
*/
|
|
48
|
+
OnSessionStarted(): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Reads the per-session media-kit override (`mediaCollectionID`) from the session config blob the
|
|
51
|
+
* host handed over on {@link RealtimeChannelServerContext.AgentSessionConfig}. Returns `null` when
|
|
52
|
+
* there is no config, it does not parse, or it carries no override — the agent default kit applies.
|
|
53
|
+
*/
|
|
54
|
+
private readMediaCollectionOverride;
|
|
55
|
+
Dispose(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Validates + canonicalizes a landed media-state save (see the class doc for the contract).
|
|
58
|
+
*
|
|
59
|
+
* @param stateJson The serialized media state the client submitted (`{ Items, ActiveItemId }`).
|
|
60
|
+
* @returns The compact canonical JSON when the payload is a valid object and differs from the
|
|
61
|
+
* input; `null` (= keep the original) otherwise.
|
|
62
|
+
*/
|
|
63
|
+
OnChannelStateSave(stateJson: string): Promise<string | null>;
|
|
64
|
+
/** Flags a corrupt media payload — kept loud so it is caught before the next resume, not at it. */
|
|
65
|
+
private logInvalidState;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Tree-shaking prevention for {@link MediaChannelServer}'s `@RegisterClass` registration. Called
|
|
69
|
+
* from a static code path in the server host (alongside `LoadWhiteboardChannelServer`) so the
|
|
70
|
+
* registration always executes — mirroring every other `Load...()` in the realtime stack.
|
|
71
|
+
*/
|
|
72
|
+
export declare function LoadMediaChannelServer(): void;
|
|
73
|
+
//# sourceMappingURL=media-channel-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-channel-server.d.ts","sourceRoot":"","sources":["../../src/realtime/media-channel-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,iBAAiB,EAAY,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AAGzF;;;;;;;;;GASG;AACH,qBACa,kBAAmB,SAAQ,yBAA0B,YAAW,+BAA+B;IACxG,2FAA2F;IAC3F,OAAO,CAAC,kBAAkB,CAAyB;IACnD,OAAO,CAAC,eAAe,CAAkC;IAEzD,+DAA+D;IAC/D,IAAW,WAAW,IAAI,MAAM,CAE/B;IAED;;;OAGG;IACI,qBAAqB,CAAC,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAKtF;;;;;OAKG;IACmB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBvD;;;;OAIG;IACH,OAAO,CAAC,2BAA2B;IAiBnB,OAAO,IAAI,IAAI;IAM/B;;;;;;OAMG;IACmB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAgBnF,mGAAmG;IACnG,OAAO,CAAC,eAAe;CAO1B;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Server-side channel plugin for the live **Media** channel — the agent shows
|
|
3
|
+
* images / video / audio / PDFs / web embeds to the user during a realtime conversation. Paired
|
|
4
|
+
* with the browser's `RealtimeMediaChannel` client plugin through the seeded `MJ: AI Agent Channels`
|
|
5
|
+
* row (`Name: 'Media'`, `ServerPluginClass: 'MediaChannelServer'`,
|
|
6
|
+
* `ClientPluginClass: 'RealtimeMediaChannel'`).
|
|
7
|
+
*
|
|
8
|
+
* Like the Whiteboard, the Media channel executes entirely **client-side** (the client tools
|
|
9
|
+
* `Media_ShowMedia` / `Media_PlayMedia` / `Media_Highlight` / `Media_CloseMedia` / `Media_ClearAll`
|
|
10
|
+
* mutate a browser state engine that renders the media). The server half's job is to guard the
|
|
11
|
+
* **persisted state of record** — the `MJ: AI Agent Session Channels.Config` blob a resume
|
|
12
|
+
* rehydrates through the client's `RestoreState` — by validating that every landed save is a
|
|
13
|
+
* parseable media-state object and normalizing it to a canonical compact serialization.
|
|
14
|
+
*
|
|
15
|
+
* @module @memberjunction/ai-agents
|
|
16
|
+
* @author MemberJunction.com
|
|
17
|
+
*/
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
import { BaseRealtimeChannelServer } from '@memberjunction/ai';
|
|
25
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
26
|
+
import { LogError } from '@memberjunction/core';
|
|
27
|
+
import { buildAgentMediaContextNote } from './agent-media-library.js';
|
|
28
|
+
/**
|
|
29
|
+
* Server half of the Media interactive channel. One instance per realtime session (created by
|
|
30
|
+
* `RealtimeChannelServerHost` from the channel registry — never construct directly).
|
|
31
|
+
*
|
|
32
|
+
* On each landed state save ({@link OnChannelStateSave}):
|
|
33
|
+
* - payload parses to a JSON **object** → persist the canonical compact re-serialization;
|
|
34
|
+
* - payload is malformed JSON or a non-object → log loudly and keep the original unchanged
|
|
35
|
+
* (persistence is never blocked; the client's `RestoreState` is tolerant of bad payloads, so
|
|
36
|
+
* flag-don't-drop is the safe posture, matching `WhiteboardChannelServer`).
|
|
37
|
+
*/
|
|
38
|
+
let MediaChannelServer = class MediaChannelServer extends BaseRealtimeChannelServer {
|
|
39
|
+
constructor() {
|
|
40
|
+
super(...arguments);
|
|
41
|
+
/** The session's data context, handed over by the host before {@link OnSessionStarted}. */
|
|
42
|
+
this.sessionContextUser = null;
|
|
43
|
+
this.sessionProvider = null;
|
|
44
|
+
}
|
|
45
|
+
/** Matches the seeded `MJ: AI Agent Channels` row's `Name`. */
|
|
46
|
+
get ChannelName() {
|
|
47
|
+
return 'Media';
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Receives the session's MJ data context from the host (between `Initialize` and
|
|
51
|
+
* `OnSessionStarted`) — used by {@link OnSessionStarted} to resolve the agent's media kit.
|
|
52
|
+
*/
|
|
53
|
+
SetSessionDataContext(contextUser, provider) {
|
|
54
|
+
this.sessionContextUser = contextUser;
|
|
55
|
+
this.sessionProvider = provider;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Resolves the agent's curated media kit (a bound `MJ: Collections` of artifacts) into a manifest
|
|
59
|
+
* and feeds it to the live model as a background context note, so the agent knows what it can show
|
|
60
|
+
* (and surfaces items via the existing `Media_ShowMedia` tool). Best-effort: any failure is logged
|
|
61
|
+
* and the session proceeds with no kit (the host also wraps this in try/catch).
|
|
62
|
+
*/
|
|
63
|
+
async OnSessionStarted() {
|
|
64
|
+
const agentID = this.Context?.AgentID;
|
|
65
|
+
if (!agentID || !this.sessionContextUser || !this.sessionProvider) {
|
|
66
|
+
return; // no agent / data context — nothing to resolve (ad-hoc Media_ShowMedia still works)
|
|
67
|
+
}
|
|
68
|
+
// Per-session override (runtime kit) takes precedence over the agent default; the resolver
|
|
69
|
+
// already UUID-validated it, and the library re-validates before use (defense in depth).
|
|
70
|
+
const overrideCollectionID = this.readMediaCollectionOverride();
|
|
71
|
+
const note = await buildAgentMediaContextNote(this.sessionProvider, this.sessionContextUser, agentID, overrideCollectionID);
|
|
72
|
+
if (note) {
|
|
73
|
+
this.Context?.SendContextNote?.(note);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Reads the per-session media-kit override (`mediaCollectionID`) from the session config blob the
|
|
78
|
+
* host handed over on {@link RealtimeChannelServerContext.AgentSessionConfig}. Returns `null` when
|
|
79
|
+
* there is no config, it does not parse, or it carries no override — the agent default kit applies.
|
|
80
|
+
*/
|
|
81
|
+
readMediaCollectionOverride() {
|
|
82
|
+
const raw = this.Context?.AgentSessionConfig;
|
|
83
|
+
if (!raw) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
const parsed = JSON.parse(raw);
|
|
88
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
89
|
+
const value = parsed.mediaCollectionID;
|
|
90
|
+
return typeof value === 'string' && value.length > 0 ? value : null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
// Opaque/legacy config that isn't our JSON shape — no override, fall back to the agent default.
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
Dispose() {
|
|
99
|
+
this.sessionContextUser = null;
|
|
100
|
+
this.sessionProvider = null;
|
|
101
|
+
super.Dispose();
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Validates + canonicalizes a landed media-state save (see the class doc for the contract).
|
|
105
|
+
*
|
|
106
|
+
* @param stateJson The serialized media state the client submitted (`{ Items, ActiveItemId }`).
|
|
107
|
+
* @returns The compact canonical JSON when the payload is a valid object and differs from the
|
|
108
|
+
* input; `null` (= keep the original) otherwise.
|
|
109
|
+
*/
|
|
110
|
+
async OnChannelStateSave(stateJson) {
|
|
111
|
+
let parsed;
|
|
112
|
+
try {
|
|
113
|
+
parsed = JSON.parse(stateJson);
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
this.logInvalidState('is not valid JSON');
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
120
|
+
this.logInvalidState('is not a JSON object');
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
const canonical = JSON.stringify(parsed);
|
|
124
|
+
return canonical === stateJson ? null : canonical;
|
|
125
|
+
}
|
|
126
|
+
/** Flags a corrupt media payload — kept loud so it is caught before the next resume, not at it. */
|
|
127
|
+
logInvalidState(problem) {
|
|
128
|
+
const sessionID = this.Context?.AgentSessionID ?? 'unknown';
|
|
129
|
+
LogError(`[MediaChannelServer] Media state save for session ${sessionID} ${problem} — ` +
|
|
130
|
+
'persisting the payload unchanged; a future resume will start with a fresh media surface.');
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
MediaChannelServer = __decorate([
|
|
134
|
+
RegisterClass(BaseRealtimeChannelServer, 'MediaChannelServer')
|
|
135
|
+
], MediaChannelServer);
|
|
136
|
+
export { MediaChannelServer };
|
|
137
|
+
/**
|
|
138
|
+
* Tree-shaking prevention for {@link MediaChannelServer}'s `@RegisterClass` registration. Called
|
|
139
|
+
* from a static code path in the server host (alongside `LoadWhiteboardChannelServer`) so the
|
|
140
|
+
* registration always executes — mirroring every other `Load...()` in the realtime stack.
|
|
141
|
+
*/
|
|
142
|
+
export function LoadMediaChannelServer() {
|
|
143
|
+
// no-op — the import + call create a static reference bundlers cannot eliminate
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=media-channel-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-channel-server.js","sourceRoot":"","sources":["../../src/realtime/media-channel-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAqB,QAAQ,EAAY,MAAM,sBAAsB,CAAC;AAE7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE;;;;;;;;;GASG;AAEI,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,yBAAyB;IAA1D;;QACH,2FAA2F;QACnF,uBAAkB,GAAoB,IAAI,CAAC;QAC3C,oBAAe,GAA6B,IAAI,CAAC;IAoG7D,CAAC;IAlGG,+DAA+D;IAC/D,IAAW,WAAW;QAClB,OAAO,OAAO,CAAC;IACnB,CAAC;IAED;;;OAGG;IACI,qBAAqB,CAAC,WAAqB,EAAE,QAA2B;QAC3E,IAAI,CAAC,kBAAkB,GAAG,WAAW,CAAC;QACtC,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC;IACpC,CAAC;IAED;;;;;OAKG;IACa,KAAK,CAAC,gBAAgB;QAClC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC;QACtC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,kBA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,CAAC,kBAAkB,CAAC,SAAiB;QACtD,IAAI,MAAe,CAAC;QACpB,IAAI,CAAC;YACD,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACnC,CAAC;QAAC,MAAM,CAAC;YACL,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAC;YAC1C,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACzE,IAAI,CAAC,eAAe,CAAC,sBAAsB,CAAC,CAAC;YAC7C,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACzC,OAAO,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IACtD,CAAC;IAED,mGAAmG;IAC3F,eAAe,CAAC,OAAe;QACnC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,cAAc,IAAI,SAAS,CAAC;QAC5D,QAAQ,CACJ,qDAAqD,SAAS,IAAI,OAAO,KAAK;YAC1E,0FAA0F,CACjG,CAAC;IACN,CAAC;CACJ,CAAA;AAvGY,kBAAkB;IAD9B,aAAa,CAAC,yBAAyB,EAAE,oBAAoB,CAAC;GAClD,kBAAkB,CAuG9B;;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB;IAClC,gFAAgF;AACpF,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Optional capability a server-side realtime channel plugin can implement when it
|
|
3
|
+
* needs MJ data access (a `UserInfo` + `IMetadataProvider`) to do its session-start work.
|
|
4
|
+
*
|
|
5
|
+
* The base {@link import('@memberjunction/ai').BaseRealtimeChannelServer} contract is deliberately
|
|
6
|
+
* core-free (plain string ids only, "zero MJ dependencies past `@memberjunction/global`"), so it
|
|
7
|
+
* cannot carry `UserInfo` / `IMetadataProvider` on its lifecycle hooks. Most server channels only
|
|
8
|
+
* validate persisted state and never touch the DB. A channel that DOES need to query MJ at session
|
|
9
|
+
* start (e.g. the Media channel resolving an agent's media kit) implements this interface; the
|
|
10
|
+
* per-session host ({@link import('./realtime-channel-server-host.js').RealtimeChannelServerHost})
|
|
11
|
+
* detects it right after `Initialize(ctx)` and hands over the session's `contextUser` + `provider`
|
|
12
|
+
* BEFORE calling `OnSessionStarted()`.
|
|
13
|
+
*
|
|
14
|
+
* @module @memberjunction/ai-agents
|
|
15
|
+
* @author MemberJunction.com
|
|
16
|
+
*/
|
|
17
|
+
import { IMetadataProvider, UserInfo } from '@memberjunction/core';
|
|
18
|
+
/**
|
|
19
|
+
* Implemented by server-side channel plugins that need MJ data access for their session-start work.
|
|
20
|
+
* The host calls {@link SetSessionDataContext} once, after `Initialize(ctx)` and before
|
|
21
|
+
* `OnSessionStarted()`, with the SAME `contextUser` + `provider` the session authenticated on.
|
|
22
|
+
*/
|
|
23
|
+
export interface IRealtimeChannelServerDataAware {
|
|
24
|
+
/**
|
|
25
|
+
* Hands the channel the session's MJ data context. Called exactly once per session by the host
|
|
26
|
+
* between `Initialize(ctx)` and `OnSessionStarted()`. Implementations should just stash the
|
|
27
|
+
* values for use in their own `OnSessionStarted()`.
|
|
28
|
+
*
|
|
29
|
+
* @param contextUser The user the realtime session is running as (for `RunView` / entity loads).
|
|
30
|
+
* @param provider The metadata provider the session authenticated on (multi-provider safe).
|
|
31
|
+
*/
|
|
32
|
+
SetSessionDataContext(contextUser: UserInfo, provider: IMetadataProvider): void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Structural type-guard the host uses to decide whether a resolved server channel plugin wants the
|
|
36
|
+
* session data context. Keeps the host decoupled from any concrete channel class.
|
|
37
|
+
*
|
|
38
|
+
* @param plugin The resolved server channel plugin (typed as the core-free base by the host).
|
|
39
|
+
* @returns `true` when the plugin implements {@link IRealtimeChannelServerDataAware}.
|
|
40
|
+
*/
|
|
41
|
+
export declare function isRealtimeChannelServerDataAware(plugin: unknown): plugin is IRealtimeChannelServerDataAware;
|
|
42
|
+
//# sourceMappingURL=realtime-channel-server-data-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime-channel-server-data-context.d.ts","sourceRoot":"","sources":["../../src/realtime/realtime-channel-server-data-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEnE;;;;GAIG;AACH,MAAM,WAAW,+BAA+B;IAC5C;;;;;;;OAOG;IACH,qBAAqB,CAAC,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACnF;AAED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,+BAA+B,CAM3G"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Optional capability a server-side realtime channel plugin can implement when it
|
|
3
|
+
* needs MJ data access (a `UserInfo` + `IMetadataProvider`) to do its session-start work.
|
|
4
|
+
*
|
|
5
|
+
* The base {@link import('@memberjunction/ai').BaseRealtimeChannelServer} contract is deliberately
|
|
6
|
+
* core-free (plain string ids only, "zero MJ dependencies past `@memberjunction/global`"), so it
|
|
7
|
+
* cannot carry `UserInfo` / `IMetadataProvider` on its lifecycle hooks. Most server channels only
|
|
8
|
+
* validate persisted state and never touch the DB. A channel that DOES need to query MJ at session
|
|
9
|
+
* start (e.g. the Media channel resolving an agent's media kit) implements this interface; the
|
|
10
|
+
* per-session host ({@link import('./realtime-channel-server-host.js').RealtimeChannelServerHost})
|
|
11
|
+
* detects it right after `Initialize(ctx)` and hands over the session's `contextUser` + `provider`
|
|
12
|
+
* BEFORE calling `OnSessionStarted()`.
|
|
13
|
+
*
|
|
14
|
+
* @module @memberjunction/ai-agents
|
|
15
|
+
* @author MemberJunction.com
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Structural type-guard the host uses to decide whether a resolved server channel plugin wants the
|
|
19
|
+
* session data context. Keeps the host decoupled from any concrete channel class.
|
|
20
|
+
*
|
|
21
|
+
* @param plugin The resolved server channel plugin (typed as the core-free base by the host).
|
|
22
|
+
* @returns `true` when the plugin implements {@link IRealtimeChannelServerDataAware}.
|
|
23
|
+
*/
|
|
24
|
+
export function isRealtimeChannelServerDataAware(plugin) {
|
|
25
|
+
return (typeof plugin === 'object' &&
|
|
26
|
+
plugin !== null &&
|
|
27
|
+
typeof plugin.SetSessionDataContext === 'function');
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=realtime-channel-server-data-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime-channel-server-data-context.js","sourceRoot":"","sources":["../../src/realtime/realtime-channel-server-data-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAqBH;;;;;;GAMG;AACH,MAAM,UAAU,gCAAgC,CAAC,MAAe;IAC5D,OAAO,CACH,OAAO,MAAM,KAAK,QAAQ;QAC1B,MAAM,KAAK,IAAI;QACf,OAAQ,MAA0C,CAAC,qBAAqB,KAAK,UAAU,CAC1F,CAAC;AACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-channel-server-host.d.ts","sourceRoot":"","sources":["../../src/realtime/realtime-channel-server-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACH,yBAAyB,EACzB,4BAA4B,EAC5B,0BAA0B,EAC1B,sBAAsB,EACtB,uBAAuB,EAC1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAY,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAuB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"realtime-channel-server-host.d.ts","sourceRoot":"","sources":["../../src/realtime/realtime-channel-server-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACH,yBAAyB,EACzB,4BAA4B,EAC5B,0BAA0B,EAC1B,sBAAsB,EACtB,uBAAuB,EAC1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAY,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAuB,MAAM,sBAAsB,CAAC;AA8BxF;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,yBAA0B,SAAQ,aAAa,CAAC,yBAAyB,CAAC;IACnF,kFAAkF;IAClF,OAAO,CAAC,QAAQ,CAAyC;IAEzD;;;;OAIG;IACI,eAAe,SAA6B;IAEnD,SAAS;IAIT,8FAA8F;IAC9F,WAAkB,QAAQ,IAAI,yBAAyB,CAEtD;IAED,uFAAuF;IACvF,IAAW,kBAAkB,IAAI,MAAM,CAEtC;IAED;;;;OAIG;IACI,gBAAgB,CAAC,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,yBAAyB,GAAG,IAAI;IAWtG;;;;;;;;;;;OAWG;IACI,qBAAqB,CAAC,cAAc,EAAE,MAAM,GAAG,sBAAsB,EAAE;IAsB9E;;;;;;;;;;;;;;OAcG;IACU,wBAAwB,CACjC,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC,uBAAuB,CAAC;IAenC,yFAAyF;IAClF,cAAc,CAAC,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIxE;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAiBxB;;;;;;;;;OASG;IACU,gBAAgB,CACzB,GAAG,EAAE,4BAA4B,EACjC,WAAW,EAAE,QAAQ,EACrB,QAAQ,EAAE,iBAAiB,GAC5B,OAAO,CAAC,IAAI,CAAC;IAiBhB;;;;;;;;OAQG;IACU,kBAAkB,CAAC,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmBhH;;;;;;;OAOG;IACU,eAAe,CAAC,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,0BAA0B,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBnH,6FAA6F;IAC7F,OAAO,CAAC,gBAAgB;IAUxB,8FAA8F;IAC9F,OAAO,CAAC,cAAc;IAetB;;;;;;OAMG;YACW,uBAAuB;IAoBrC,uFAAuF;YACzE,yBAAyB;IAgCvC;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAyB5B,qEAAqE;IACrE,OAAO,CAAC,WAAW;IAQnB,kFAAkF;IAClF,OAAO,CAAC,UAAU;IAIlB,4CAA4C;IAC5C,OAAO,CAAC,UAAU;IAIlB,kEAAkE;IAClE,OAAO,CAAC,OAAO;CAGlB"}
|
|
@@ -29,6 +29,7 @@ import { BaseRealtimeChannelServer, } from '@memberjunction/ai';
|
|
|
29
29
|
import { BaseSingleton, MJGlobal } from '@memberjunction/global';
|
|
30
30
|
import { LogError, LogStatus } from '@memberjunction/core';
|
|
31
31
|
import { AIEngineBase } from '@memberjunction/ai-engine-base';
|
|
32
|
+
import { isRealtimeChannelServerDataAware } from './realtime-channel-server-data-context.js';
|
|
32
33
|
/** Entity name — kept in sync with the session machinery's `MJ:`-prefix convention. */
|
|
33
34
|
const CHANNEL_ENTITY = 'MJ: AI Agent Channels';
|
|
34
35
|
/**
|
|
@@ -193,7 +194,7 @@ export class RealtimeChannelServerHost extends BaseSingleton {
|
|
|
193
194
|
return;
|
|
194
195
|
}
|
|
195
196
|
const rows = await this.fetchChannelDefinitions(contextUser, provider);
|
|
196
|
-
const plugins = await this.instantiateSessionPlugins(rows, ctx);
|
|
197
|
+
const plugins = await this.instantiateSessionPlugins(rows, ctx, contextUser, provider);
|
|
197
198
|
if (plugins.size > 0) {
|
|
198
199
|
this.sessions.set(key, { plugins, disposeTimer: null });
|
|
199
200
|
}
|
|
@@ -305,7 +306,7 @@ export class RealtimeChannelServerHost extends BaseSingleton {
|
|
|
305
306
|
}
|
|
306
307
|
}
|
|
307
308
|
/** Resolves + start-brackets one fresh plugin instance per resolvable registry row. */
|
|
308
|
-
async instantiateSessionPlugins(rows, ctx) {
|
|
309
|
+
async instantiateSessionPlugins(rows, ctx, contextUser, provider) {
|
|
309
310
|
const plugins = new Map();
|
|
310
311
|
for (const row of rows) {
|
|
311
312
|
const plugin = this.resolveChannelPlugin(row);
|
|
@@ -314,6 +315,11 @@ export class RealtimeChannelServerHost extends BaseSingleton {
|
|
|
314
315
|
}
|
|
315
316
|
try {
|
|
316
317
|
plugin.Initialize(ctx);
|
|
318
|
+
// Hand the session's MJ data context to channels that need DB access at start
|
|
319
|
+
// (e.g. the Media channel resolving an agent's media kit), BEFORE OnSessionStarted.
|
|
320
|
+
if (isRealtimeChannelServerDataAware(plugin)) {
|
|
321
|
+
plugin.SetSessionDataContext(contextUser, provider);
|
|
322
|
+
}
|
|
317
323
|
await plugin.OnSessionStarted();
|
|
318
324
|
plugins.set(this.channelKey(row.Name), plugin);
|
|
319
325
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-channel-server-host.js","sourceRoot":"","sources":["../../src/realtime/realtime-channel-server-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACH,yBAAyB,GAK5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAA+B,QAAQ,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACx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