@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.
Files changed (98) hide show
  1. package/README.md +10 -0
  2. package/dist/DuplicateReasoningAgentProvider.d.ts +35 -0
  3. package/dist/DuplicateReasoningAgentProvider.d.ts.map +1 -0
  4. package/dist/DuplicateReasoningAgentProvider.js +95 -0
  5. package/dist/DuplicateReasoningAgentProvider.js.map +1 -0
  6. package/dist/MJAIAgentRequestEntityServer.d.ts +7 -0
  7. package/dist/MJAIAgentRequestEntityServer.d.ts.map +1 -1
  8. package/dist/MJAIAgentRequestEntityServer.js +28 -1
  9. package/dist/MJAIAgentRequestEntityServer.js.map +1 -1
  10. package/dist/SkillImportExportService.d.ts +63 -0
  11. package/dist/SkillImportExportService.d.ts.map +1 -0
  12. package/dist/SkillImportExportService.js +148 -0
  13. package/dist/SkillImportExportService.js.map +1 -0
  14. package/dist/SkillMarkdownConverter.d.ts +82 -0
  15. package/dist/SkillMarkdownConverter.d.ts.map +1 -0
  16. package/dist/SkillMarkdownConverter.js +145 -0
  17. package/dist/SkillMarkdownConverter.js.map +1 -0
  18. package/dist/agent-types/flow-agent-type.d.ts.map +1 -1
  19. package/dist/agent-types/flow-agent-type.js +10 -2
  20. package/dist/agent-types/flow-agent-type.js.map +1 -1
  21. package/dist/agent-types/loop-agent-response-type.d.ts +17 -2
  22. package/dist/agent-types/loop-agent-response-type.d.ts.map +1 -1
  23. package/dist/agent-types/loop-agent-response-type.js.map +1 -1
  24. package/dist/agent-types/loop-agent-type.d.ts.map +1 -1
  25. package/dist/agent-types/loop-agent-type.js +33 -1
  26. package/dist/agent-types/loop-agent-type.js.map +1 -1
  27. package/dist/base-agent.d.ts +373 -12
  28. package/dist/base-agent.d.ts.map +1 -1
  29. package/dist/base-agent.js +1019 -78
  30. package/dist/base-agent.js.map +1 -1
  31. package/dist/index.d.ts +12 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +12 -0
  34. package/dist/index.js.map +1 -1
  35. package/dist/memory-manager-agent.d.ts +39 -0
  36. package/dist/memory-manager-agent.d.ts.map +1 -1
  37. package/dist/memory-manager-agent.js +118 -5
  38. package/dist/memory-manager-agent.js.map +1 -1
  39. package/dist/operations/AISkillMarkdownOperations.d.ts +11 -0
  40. package/dist/operations/AISkillMarkdownOperations.d.ts.map +1 -0
  41. package/dist/operations/AISkillMarkdownOperations.js +57 -0
  42. package/dist/operations/AISkillMarkdownOperations.js.map +1 -0
  43. package/dist/prompt-component-resolver.d.ts +73 -0
  44. package/dist/prompt-component-resolver.d.ts.map +1 -0
  45. package/dist/prompt-component-resolver.js +166 -0
  46. package/dist/prompt-component-resolver.js.map +1 -0
  47. package/dist/realtime/agent-media-library.d.ts +65 -0
  48. package/dist/realtime/agent-media-library.d.ts.map +1 -0
  49. package/dist/realtime/agent-media-library.js +160 -0
  50. package/dist/realtime/agent-media-library.js.map +1 -0
  51. package/dist/realtime/bridge-room-transcript-sink.d.ts +5 -0
  52. package/dist/realtime/bridge-room-transcript-sink.d.ts.map +1 -1
  53. package/dist/realtime/bridge-room-transcript-sink.js +25 -1
  54. package/dist/realtime/bridge-room-transcript-sink.js.map +1 -1
  55. package/dist/realtime/client-context-channel-server.d.ts +59 -0
  56. package/dist/realtime/client-context-channel-server.d.ts.map +1 -0
  57. package/dist/realtime/client-context-channel-server.js +78 -0
  58. package/dist/realtime/client-context-channel-server.js.map +1 -0
  59. package/dist/realtime/media-channel-server.d.ts +73 -0
  60. package/dist/realtime/media-channel-server.d.ts.map +1 -0
  61. package/dist/realtime/media-channel-server.js +145 -0
  62. package/dist/realtime/media-channel-server.js.map +1 -0
  63. package/dist/realtime/realtime-channel-server-data-context.d.ts +42 -0
  64. package/dist/realtime/realtime-channel-server-data-context.d.ts.map +1 -0
  65. package/dist/realtime/realtime-channel-server-data-context.js +29 -0
  66. package/dist/realtime/realtime-channel-server-data-context.js.map +1 -0
  67. package/dist/realtime/realtime-channel-server-host.d.ts.map +1 -1
  68. package/dist/realtime/realtime-channel-server-host.js +8 -2
  69. package/dist/realtime/realtime-channel-server-host.js.map +1 -1
  70. package/dist/realtime/realtime-client-session-service.d.ts +85 -5
  71. package/dist/realtime/realtime-client-session-service.d.ts.map +1 -1
  72. package/dist/realtime/realtime-client-session-service.js +234 -25
  73. package/dist/realtime/realtime-client-session-service.js.map +1 -1
  74. package/dist/realtime/realtime-coagent-config.d.ts +161 -3
  75. package/dist/realtime/realtime-coagent-config.d.ts.map +1 -1
  76. package/dist/realtime/realtime-coagent-config.js +241 -6
  77. package/dist/realtime/realtime-coagent-config.js.map +1 -1
  78. package/dist/realtime/realtime-recording-capture.d.ts +125 -0
  79. package/dist/realtime/realtime-recording-capture.d.ts.map +1 -0
  80. package/dist/realtime/realtime-recording-capture.js +317 -0
  81. package/dist/realtime/realtime-recording-capture.js.map +1 -0
  82. package/dist/realtime/realtime-recording-store.d.ts +105 -0
  83. package/dist/realtime/realtime-recording-store.d.ts.map +1 -0
  84. package/dist/realtime/realtime-recording-store.js +216 -0
  85. package/dist/realtime/realtime-recording-store.js.map +1 -0
  86. package/dist/realtime/realtime-session-runner.d.ts +33 -2
  87. package/dist/realtime/realtime-session-runner.d.ts.map +1 -1
  88. package/dist/realtime/realtime-session-runner.js +45 -2
  89. package/dist/realtime/realtime-session-runner.js.map +1 -1
  90. package/dist/realtime/realtime-tool-broker.d.ts +41 -3
  91. package/dist/realtime/realtime-tool-broker.d.ts.map +1 -1
  92. package/dist/realtime/realtime-tool-broker.js +67 -3
  93. package/dist/realtime/realtime-tool-broker.js.map +1 -1
  94. package/dist/realtime/realtime-turn-moderator.d.ts +103 -0
  95. package/dist/realtime/realtime-turn-moderator.d.ts.map +1 -0
  96. package/dist/realtime/realtime-turn-moderator.js +266 -0
  97. package/dist/realtime/realtime-turn-moderator.js.map +1 -0
  98. package/package.json +18 -17
@@ -31,9 +31,9 @@
31
31
  */
32
32
  import { UserInfo, IMetadataProvider } from '@memberjunction/core';
33
33
  import { BaseRealtimeModel, ChatMessage, ClientRealtimeSessionConfig, IRealtimeSession, JSONObject, RealtimeSessionParams, RealtimeToolCall, RealtimeToolDefinition } from '@memberjunction/ai';
34
- import { MJAIAgentEntityExtended, MJAIModelEntityExtended, MJAIAgentRunEntityExtended, AgentExecutionProgressCallback, ExecuteAgentResult } from '@memberjunction/ai-core-plus';
35
- import { RealtimeToolBroker, DelegateToTargetRequest, DelegatedResult, DelegatedRunArtifact, ToolExecutionResult } from './realtime-tool-broker.js';
36
- import { RealtimeCoAgentConfig } from './realtime-coagent-config.js';
34
+ import { MJAIAgentEntityExtended, MJAIModelEntityExtended, MJAIAgentRunEntityExtended, AgentExecutionProgressCallback, ExecuteAgentResult, AppContextSnapshot } from '@memberjunction/ai-core-plus';
35
+ import { RealtimeToolBroker, RealtimeColleague, DelegateToTargetRequest, DelegatedResult, DelegatedRunArtifact, ToolExecutionResult } from './realtime-tool-broker.js';
36
+ import { RealtimeAllowedAgent, RealtimeCoAgentConfig } from './realtime-coagent-config.js';
37
37
  /**
38
38
  * Input for {@link RealtimeClientSessionService.PrepareClientSession}.
39
39
  *
@@ -52,6 +52,20 @@ export interface PrepareClientSessionInput {
52
52
  AgentSessionID: string;
53
53
  /** Optional conversation id the session is attached to — stamped on the co-agent observability run. */
54
54
  ConversationID?: string;
55
+ /**
56
+ * Optional application id the realtime session runs in. Sources the **app cascade layer** of the
57
+ * effective config: `Application.AgentSettings.Realtime` (persona/disclosure/model overrides) +
58
+ * `RelevantAgents` (union-accumulated into the co-agent's allowed delegation set). Absent ⇒ no
59
+ * app layer (the cascade rests on type/co-agent/target/override only).
60
+ */
61
+ ApplicationID?: string;
62
+ /**
63
+ * Optional app-context snapshot — where the user is, what they see, and the live capability
64
+ * manifest — injected into the companion system prompt at mint (the session-start half of the
65
+ * client-context delivery; the {@link import('@memberjunction/ai-core-plus').AppContextSnapshot}
66
+ * shape). The streaming half rides the ClientContextChannel. Absent ⇒ no app-context section.
67
+ */
68
+ AppContext?: AppContextSnapshot;
55
69
  /** Prior conversation history to seed the model's context. Optional. */
56
70
  ConversationMessages?: ChatMessage[];
57
71
  /**
@@ -192,8 +206,15 @@ export interface ExecuteRelayedToolInput {
192
206
  AgentSessionID: string;
193
207
  /** The id of the (co-agent) run that owns this session, used as the delegated run's parent. Optional. */
194
208
  ParentRunID?: string;
195
- /** The top-level target agent id for `invoke-target-agent` delegation. */
209
+ /** The top-level (lead) target agent id for `invoke-target-agent` delegation. */
196
210
  TargetAgentID: string;
211
+ /**
212
+ * The session's effective allowed delegation targets (the union-accumulated set from the config
213
+ * cascade; Move 4). When the model names a colleague in the call arguments (`agent`), it must
214
+ * resolve to one of these (or the lead); an unknown name yields a structured "not available"
215
+ * result. Absent/empty ⇒ classic single-target behavior (every call routes to {@link TargetAgentID}).
216
+ */
217
+ AllowedAgents?: RealtimeAllowedAgent[];
197
218
  /** The tool call the browser relayed from the provider. */
198
219
  Call: RealtimeToolCall;
199
220
  /**
@@ -418,7 +439,21 @@ export declare class RealtimeClientSessionService {
418
439
  * per-voiced-agent layer (above the co-agent, below the runtime override). Omit when there is none.
419
440
  * @returns The normalized effective configuration (possibly empty, never `null`).
420
441
  */
421
- protected resolveEffectiveConfig(coAgent: MJAIAgentEntityExtended, overridesJson?: string, targetAgent?: MJAIAgentEntityExtended | null): RealtimeCoAgentConfig;
442
+ protected resolveEffectiveConfig(coAgent: MJAIAgentEntityExtended, overridesJson?: string, targetAgent?: MJAIAgentEntityExtended | null, appSettingsJson?: string | null): RealtimeCoAgentConfig;
443
+ /**
444
+ * Resolves the APP cascade layer JSON from `Application.AgentSettings`: the `Realtime` overrides
445
+ * (persona/disclosure/model) plus `RelevantAgents` mapped to the union-accumulated allowed-agent
446
+ * set, all translated into the canonical `{"realtime":{…}}` shape via {@link BuildAppRealtimeOverridesJson}.
447
+ *
448
+ * One tiny by-ID read (served from the provider's RunView cache on repeat). Tolerant — any failure,
449
+ * a missing app, or an app with no `AgentSettings` returns `null` (no app layer), never throws.
450
+ *
451
+ * @param applicationId The app the session runs in, or absent/blank for no app layer.
452
+ * @param contextUser The calling user (RunView scope).
453
+ * @param provider The request-scoped metadata provider (reserved; RunView uses the default).
454
+ * @returns The canonical app-layer JSON string, or `null`.
455
+ */
456
+ protected resolveAppRealtimeOverrides(applicationId: string | undefined, contextUser: UserInfo, provider: IMetadataProvider): Promise<string | null>;
422
457
  /**
423
458
  * Reads the co-agent's TYPE-level `DefaultConfiguration` from {@link AIEngine}'s cached agent
424
459
  * types. **Overridable seam**; tolerant — an absent type or unloaded cache returns `null`.
@@ -788,6 +823,27 @@ export declare class RealtimeClientSessionService {
788
823
  * @returns The concatenated system prompt (never empty — the framing is always present).
789
824
  */
790
825
  protected buildCompanionSystemPrompt(input: PrepareClientSessionInput, coAgent: MJAIAgentEntityExtended, contextUser: UserInfo, provider: IMetadataProvider, effectiveConfig?: RealtimeCoAgentConfig): Promise<string>;
826
+ /**
827
+ * Maps the effective config's union-accumulated `allowedAgents` into {@link RealtimeColleague}
828
+ * entries for the framing — resolving each target's display name + description from the agent cache
829
+ * and its effective per-target disclosure ({@link GetDisclosureForTarget}). The LEAD (the voiced
830
+ * target) is excluded so the co-agent never lists itself as a colleague. Empty when none configured.
831
+ *
832
+ * @param effectiveConfig The resolved effective configuration.
833
+ * @param excludeAgentId The lead/target agent id to exclude from the colleague list.
834
+ * @returns The colleague set (possibly empty).
835
+ */
836
+ protected buildColleaguesFromConfig(effectiveConfig: RealtimeCoAgentConfig | undefined, excludeAgentId?: string): RealtimeColleague[];
837
+ /**
838
+ * Builds the session-start app-context section from the {@link AppContextSnapshot}: where the user
839
+ * is, what they see, and the live capability manifest, rendered via the shared
840
+ * {@link FormatAppContextNote} (one wording for mint-time and streaming notes) under a clear heading.
841
+ * Returns `''` when no snapshot was supplied or nothing salient survives.
842
+ *
843
+ * @param appContext The app-context snapshot, or undefined.
844
+ * @returns The prompt section, or `''`.
845
+ */
846
+ protected buildAppContextSection(appContext?: AppContextSnapshot): string;
791
847
  /**
792
848
  * Builds the **meeting-mode** discipline clause — present only for a multi-agent meeting session
793
849
  * ({@link PrepareClientSessionInput.DisableAutoResponse}). It tells the agent to hear the whole
@@ -911,6 +967,30 @@ export declare class RealtimeClientSessionService {
911
967
  * @returns The delegated result for the model's tool_response.
912
968
  */
913
969
  protected delegateToTarget(input: ExecuteRelayedToolInput, request: DelegateToTargetRequest, contextUser: UserInfo, provider: IMetadataProvider): Promise<DelegatedResult>;
970
+ /**
971
+ * Resolves which agent a delegation should run, given an optional colleague name the model passed.
972
+ *
973
+ * - **No name** → the lead {@link ExecuteRelayedToolInput.TargetAgentID} (classic single-target).
974
+ * - **A name matching an allowed colleague** (by label, resolved agent Name, or id — case/whitespace
975
+ * insensitive) OR the lead's own name → that agent.
976
+ * - **A name matching nothing in the union/lead** → an error result naming the available colleagues,
977
+ * so the model self-corrects conversationally rather than silently delegating to the wrong agent.
978
+ *
979
+ * The allowed union is an affordance/UX filter; `CanRun` on the resolved agent (inside the agent run)
980
+ * remains the security boundary — both apply.
981
+ *
982
+ * @param requestedAgent The colleague name the model named, or undefined.
983
+ * @param input The relayed tool input (lead id + allowed union).
984
+ * @returns `{ Agent }` on success, or `{ Error }` describing why no agent resolved.
985
+ */
986
+ protected resolveDelegationTarget(requestedAgent: string | undefined, input: ExecuteRelayedToolInput): {
987
+ Agent?: MJAIAgentEntityExtended;
988
+ Error: string;
989
+ };
990
+ /** Comma-joined display names of the session's allowed colleagues (labels preferred), for error guidance. */
991
+ protected describeAvailableColleagues(input: ExecuteRelayedToolInput): string;
992
+ /** Parses the optional `agent` (colleague name) from an `invoke-target-agent` call's arguments JSON. */
993
+ private parseDelegateAgentName;
914
994
  /**
915
995
  * Creates artifact(s) from a completed delegated run's payload — the voice-path equivalent of
916
996
  * the chat path's artifact step in `AgentRunner.RunAgentInConversation`. Delegated voice runs
@@ -1 +1 @@
1
- {"version":3,"file":"realtime-client-session-service.d.ts","sourceRoot":"","sources":["../../src/realtime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GAAG,OAAO,CAAC,mBAAmB,CAAC;IAQ1F;;;;;;OAMG;IACH,OAAO,CAAC,wBAAwB;IAYhC;;;;;;;;OAQG;IACH,OAAO,CAAC,cAAc;IAetB;;;;OAIG;IACH,OAAO,CAAC,cAAc;CAOzB"}
1
+ {"version":3,"file":"realtime-client-session-service.d.ts","sourceRoot":"","sources":["../../src/realtime/realtime-client-session-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAgC,MAAM,sBAAsB,CAAC;AAGjG,OAAO,EACH,iBAAiB,EACjB,WAAW,EACX,2BAA2B,EAE3B,gBAAgB,EAChB,UAAU,EACV,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,8BAA8B,EAAE,kBAAkB,EAAE,kBAAkB,EAAwB,MAAM,8BAA8B,CAAC;AAK1N,OAAO,EACH,kBAAkB,EAIlB,iBAAiB,EACjB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACtB,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EAQH,oBAAoB,EACpB,qBAAqB,EAExB,MAAM,2BAA2B,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,WAAW,yBAAyB;IACtC,iGAAiG;IACjG,OAAO,CAAC,EAAE,uBAAuB,CAAC;IAClC,2HAA2H;IAC3H,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yFAAyF;IACzF,aAAa,EAAE,MAAM,CAAC;IACtB,gEAAgE;IAChE,cAAc,EAAE,MAAM,CAAC;IACvB,uGAAuG;IACvG,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,kBAAkB,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,mBAAmB,CAAC;IAQ1F;;;;;;OAMG;IACH,OAAO,CAAC,wBAAwB;IAYhC;;;;;;;;OAQG;IACH,OAAO,CAAC,cAAc;IAetB;;;;OAIG;IACH,OAAO,CAAC,cAAc;CAOzB"}
@@ -32,12 +32,13 @@
32
32
  import { LogError, LogStatus, RunView } from '@memberjunction/core';
33
33
  import { MJGlobal, UUIDsEqual } from '@memberjunction/global';
34
34
  import { BaseRealtimeModel, GetAIAPIKey } from '@memberjunction/ai';
35
+ import { FormatAppContextNote } from '@memberjunction/ai-core-plus';
35
36
  import { AIEngine } from '@memberjunction/aiengine';
36
37
  import { AgentMemoryContextBuilder } from '../agent-memory-context-builder.js';
37
38
  import { AgentRunner } from '../AgentRunner.js';
38
39
  import { RealtimeToolBroker, INVOKE_TARGET_AGENT_TOOL_NAME, BuildRealtimeAgentFraming } from './realtime-tool-broker.js';
39
40
  import { NARRATION_PROMPT_NAME, LEGACY_NARRATION_PROMPT_NAME, ResolveNarrationInstructionsTemplate } from './realtime-narration.js';
40
- import { BuildVoiceMannerSection, DeepMergeConfigs, GetNarrationPaceMs, GetProviderVoiceSettings, ResolveEffectiveRealtimeConfig } from './realtime-coagent-config.js';
41
+ import { BuildVoiceMannerSection, BuildAppRealtimeOverridesJson, DeepMergeConfigs, GetDisclosureForTarget, GetNarrationPaceMs, GetProviderVoiceSettings, ResolveEffectiveRealtimeConfig } from './realtime-coagent-config.js';
41
42
  /**
42
43
  * Server-agnostic service that prepares a client-direct realtime session and executes the tool
43
44
  * calls the browser relays back. Constructed per-request (a normal injectable service — NOT a
@@ -199,7 +200,13 @@ export class RealtimeClientSessionService {
199
200
  // Tool calls → the shared delegation entry point, then hand the serialized result back to the model.
200
201
  session.OnToolCall(async (call) => {
201
202
  try {
202
- const result = await this.ExecuteRelayedTool({ AgentSessionID: input.AgentSessionID, ParentRunID: obs?.CoAgentRunID, TargetAgentID: input.TargetAgentID, Call: call }, contextUser, provider);
203
+ const result = await this.ExecuteRelayedTool({
204
+ AgentSessionID: input.AgentSessionID,
205
+ ParentRunID: obs?.CoAgentRunID,
206
+ TargetAgentID: input.TargetAgentID,
207
+ AllowedAgents: prep.EffectiveConfig?.realtime?.allowedAgents,
208
+ Call: call,
209
+ }, contextUser, provider);
203
210
  await session.SendToolResult(call.CallID, result.ResultJson);
204
211
  }
205
212
  catch (error) {
@@ -256,10 +263,11 @@ export class RealtimeClientSessionService {
256
263
  return { Success: false, ErrorMessage: 'The Realtime Co-Agent could not be resolved from the supplied id or entity.' };
257
264
  }
258
265
  // Effective config via the surface-agnostic cascade: type DefaultConfiguration < co-agent
259
- // TypeConfiguration < TARGET agent TypeConfiguration < runtime overrides (authorization-gated
260
- // upstream). This is the identical precedence on every host.
266
+ // TypeConfiguration < TARGET agent TypeConfiguration < APP (Application.AgentSettings.Realtime) <
267
+ // runtime overrides (authorization-gated upstream). This is the identical precedence on every host.
261
268
  const targetAgent = this.resolveTargetAgent(input.TargetAgentID);
262
- const effectiveConfig = this.resolveEffectiveConfig(coAgent, input.ConfigOverridesJson, targetAgent);
269
+ const appSettingsJson = await this.resolveAppRealtimeOverrides(input.ApplicationID, contextUser, provider);
270
+ const effectiveConfig = this.resolveEffectiveConfig(coAgent, input.ConfigOverridesJson, targetAgent, appSettingsJson);
263
271
  const outcome = await this.resolveModelForSession(input, coAgent, effectiveConfig);
264
272
  if (!outcome.Resolution) {
265
273
  return { Success: false, ErrorMessage: outcome.ErrorMessage ?? this.noModelMessage() };
@@ -282,8 +290,60 @@ export class RealtimeClientSessionService {
282
290
  * per-voiced-agent layer (above the co-agent, below the runtime override). Omit when there is none.
283
291
  * @returns The normalized effective configuration (possibly empty, never `null`).
284
292
  */
285
- resolveEffectiveConfig(coAgent, overridesJson, targetAgent) {
286
- return ResolveEffectiveRealtimeConfig(this.getAgentTypeDefaultConfiguration(coAgent), coAgent.TypeConfiguration ?? null, overridesJson ?? null, targetAgent?.TypeConfiguration ?? null);
293
+ resolveEffectiveConfig(coAgent, overridesJson, targetAgent, appSettingsJson) {
294
+ return ResolveEffectiveRealtimeConfig(this.getAgentTypeDefaultConfiguration(coAgent), coAgent.TypeConfiguration ?? null, overridesJson ?? null, targetAgent?.TypeConfiguration ?? null, appSettingsJson ?? null);
295
+ }
296
+ /**
297
+ * Resolves the APP cascade layer JSON from `Application.AgentSettings`: the `Realtime` overrides
298
+ * (persona/disclosure/model) plus `RelevantAgents` mapped to the union-accumulated allowed-agent
299
+ * set, all translated into the canonical `{"realtime":{…}}` shape via {@link BuildAppRealtimeOverridesJson}.
300
+ *
301
+ * One tiny by-ID read (served from the provider's RunView cache on repeat). Tolerant — any failure,
302
+ * a missing app, or an app with no `AgentSettings` returns `null` (no app layer), never throws.
303
+ *
304
+ * @param applicationId The app the session runs in, or absent/blank for no app layer.
305
+ * @param contextUser The calling user (RunView scope).
306
+ * @param provider The request-scoped metadata provider (reserved; RunView uses the default).
307
+ * @returns The canonical app-layer JSON string, or `null`.
308
+ */
309
+ async resolveAppRealtimeOverrides(applicationId, contextUser,
310
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
311
+ provider) {
312
+ const appId = applicationId?.trim();
313
+ if (!appId) {
314
+ return null;
315
+ }
316
+ try {
317
+ const rv = new RunView();
318
+ const result = await rv.RunView({
319
+ EntityName: 'MJ: Applications',
320
+ ExtraFilter: `ID='${this.escapeSqlLiteral(appId)}'`,
321
+ MaxRows: 1,
322
+ ResultType: 'entity_object',
323
+ }, contextUser);
324
+ if (!result.Success || !result.Results || result.Results.length === 0) {
325
+ return null;
326
+ }
327
+ const settings = result.Results[0].AgentSettingsObject;
328
+ if (!settings) {
329
+ return null;
330
+ }
331
+ const relevantAgents = (settings.RelevantAgents ?? []).map(r => {
332
+ const entry = { agentId: r.AgentID };
333
+ if (r.Label) {
334
+ entry.label = r.Label;
335
+ }
336
+ if (r.Disclosure === 'silent' || r.Disclosure === 'mention' || r.Disclosure === 'hand-voice') {
337
+ entry.disclosure = r.Disclosure;
338
+ }
339
+ return entry;
340
+ });
341
+ return BuildAppRealtimeOverridesJson(settings.Realtime ?? null, relevantAgents);
342
+ }
343
+ catch (error) {
344
+ LogError(`RealtimeClientSessionService.resolveAppRealtimeOverrides failed for app '${appId}': ${error instanceof Error ? error.message : String(error)}`);
345
+ return null;
346
+ }
287
347
  }
288
348
  /**
289
349
  * Reads the co-agent's TYPE-level `DefaultConfiguration` from {@link AIEngine}'s cached agent
@@ -1133,19 +1193,76 @@ export class RealtimeClientSessionService {
1133
1193
  const targetName = target?.Name ?? 'the configured target agent';
1134
1194
  // Identity framing comes from the ONE shared producer (see BuildRealtimeAgentFraming) so the agent
1135
1195
  // is the same agent on every host. The interactive-surface clause is host-specific (native chat's
1136
- // browser/whiteboard); bridges pass none.
1137
- const framing = BuildRealtimeAgentFraming(targetName, this.buildInteractiveSurfaceFraming(input.ExtraTools));
1196
+ // browser/whiteboard); bridges pass none. Colleagues come from the effective allowed-agent union
1197
+ // (Move 4) so the lead knows who it can delegate to and how to narrate each handoff.
1198
+ const colleagues = this.buildColleaguesFromConfig(effectiveConfig, input.TargetAgentID);
1199
+ const framing = BuildRealtimeAgentFraming(targetName, this.buildInteractiveSurfaceFraming(input.ExtraTools), colleagues);
1138
1200
  const meetingFraming = this.buildMeetingFraming(input);
1139
1201
  const coAgentPrompt = this.getCoAgentSystemPromptText(coAgent);
1140
1202
  const voiceManner = BuildVoiceMannerSection(effectiveConfig);
1141
1203
  const targetIdentity = this.formatTargetIdentity(target);
1204
+ const appContextSection = this.buildAppContextSection(input.AppContext);
1142
1205
  const priorTranscript = this.formatPriorTranscript(input.PriorTranscript);
1143
1206
  const history = this.formatConversationHistory(input.ConversationMessages);
1144
1207
  const memoryContext = await this.assembleMemoryContext(input, coAgent, contextUser);
1145
- return [framing, meetingFraming, coAgentPrompt, voiceManner, targetIdentity, priorTranscript, history, memoryContext]
1208
+ return [framing, meetingFraming, coAgentPrompt, voiceManner, targetIdentity, appContextSection, priorTranscript, history, memoryContext]
1146
1209
  .filter(part => part && part.trim().length > 0)
1147
1210
  .join('\n\n');
1148
1211
  }
1212
+ /**
1213
+ * Maps the effective config's union-accumulated `allowedAgents` into {@link RealtimeColleague}
1214
+ * entries for the framing — resolving each target's display name + description from the agent cache
1215
+ * and its effective per-target disclosure ({@link GetDisclosureForTarget}). The LEAD (the voiced
1216
+ * target) is excluded so the co-agent never lists itself as a colleague. Empty when none configured.
1217
+ *
1218
+ * @param effectiveConfig The resolved effective configuration.
1219
+ * @param excludeAgentId The lead/target agent id to exclude from the colleague list.
1220
+ * @returns The colleague set (possibly empty).
1221
+ */
1222
+ buildColleaguesFromConfig(effectiveConfig, excludeAgentId) {
1223
+ const allowed = effectiveConfig?.realtime?.allowedAgents ?? [];
1224
+ if (allowed.length === 0) {
1225
+ return [];
1226
+ }
1227
+ const colleagues = [];
1228
+ for (const entry of allowed) {
1229
+ if (excludeAgentId && UUIDsEqual(entry.agentId, excludeAgentId)) {
1230
+ continue;
1231
+ }
1232
+ const agent = (AIEngine.Instance.Agents ?? []).find(a => UUIDsEqual(a.ID, entry.agentId));
1233
+ const colleague = {
1234
+ name: entry.label ?? agent?.Name ?? entry.agentId,
1235
+ disclosure: GetDisclosureForTarget(effectiveConfig, entry.agentId),
1236
+ };
1237
+ if (agent?.Description) {
1238
+ colleague.description = agent.Description;
1239
+ }
1240
+ colleagues.push(colleague);
1241
+ }
1242
+ return colleagues;
1243
+ }
1244
+ /**
1245
+ * Builds the session-start app-context section from the {@link AppContextSnapshot}: where the user
1246
+ * is, what they see, and the live capability manifest, rendered via the shared
1247
+ * {@link FormatAppContextNote} (one wording for mint-time and streaming notes) under a clear heading.
1248
+ * Returns `''` when no snapshot was supplied or nothing salient survives.
1249
+ *
1250
+ * @param appContext The app-context snapshot, or undefined.
1251
+ * @returns The prompt section, or `''`.
1252
+ */
1253
+ buildAppContextSection(appContext) {
1254
+ if (!appContext) {
1255
+ return '';
1256
+ }
1257
+ const note = FormatAppContextNote(appContext);
1258
+ if (!note) {
1259
+ return '';
1260
+ }
1261
+ return (`CURRENT APP CONTEXT — the user's live situation in the application. THIS IS YOUR SOURCE OF TRUTH for ` +
1262
+ `where the user is and what they see — use it directly to answer "where am I" and to act in context; do ` +
1263
+ `NOT ask the user to capture a snapshot just to learn their location. When it lists available actions, ` +
1264
+ `those are the actions you can run here via 'ContextTool':\n${note}`);
1265
+ }
1149
1266
  /**
1150
1267
  * Builds the **meeting-mode** discipline clause — present only for a multi-agent meeting session
1151
1268
  * ({@link PrepareClientSessionInput.DisableAutoResponse}). It tells the agent to hear the whole
@@ -1188,13 +1305,31 @@ export class RealtimeClientSessionService {
1188
1305
  if (!extraTools || extraTools.length === 0) {
1189
1306
  return '';
1190
1307
  }
1191
- return ` ONE EXCEPTION: besides '${INVOKE_TARGET_AGENT_TOOL_NAME}' you have been given ` +
1192
- `interactive-surface tools (for example 'browser_*' to drive a LIVE web browser the user can ` +
1193
- `watch, or 'Whiteboard_*' to draw on a shared board). Those surfaces are operated by YOU, ` +
1194
- `directly — when the user asks to use one (e.g. "open/show a browser", "go to a site", "add ` +
1195
- `to the whiteboard"), call the matching tool yourself immediately and narrate what you're ` +
1196
- `doing. NEVER route an interactive-surface request through '${INVOKE_TARGET_AGENT_TOOL_NAME}', ` +
1197
- `and never claim you lack a session — calling the tool is all that's needed.`;
1308
+ const hasContextTool = extraTools.some(t => t.Name === 'ContextTool');
1309
+ const otherSurfaces = extraTools.filter(t => t.Name !== 'ContextTool');
1310
+ let clause = '';
1311
+ if (otherSurfaces.length > 0) {
1312
+ clause += ` ONE EXCEPTION: besides '${INVOKE_TARGET_AGENT_TOOL_NAME}' you have been given ` +
1313
+ `interactive-surface tools (for example 'browser_*' to drive a LIVE web browser the user can ` +
1314
+ `watch, or 'Whiteboard_*' to draw on a shared board). Those surfaces are operated by YOU, ` +
1315
+ `directly — when the user asks to use one (e.g. "open/show a browser", "go to a site", "add ` +
1316
+ `to the whiteboard"), call the matching tool yourself immediately and narrate what you're ` +
1317
+ `doing. NEVER route an interactive-surface request through '${INVOKE_TARGET_AGENT_TOOL_NAME}', ` +
1318
+ `and never claim you lack a session — calling the tool is all that's needed.`;
1319
+ }
1320
+ if (hasContextTool) {
1321
+ clause += ` You ALSO have a 'ContextTool' that lets you ACT IN THE APPLICATION the user is currently ` +
1322
+ `in — navigate to apps and records, switch tabs/views, and run the actions available on the ` +
1323
+ `current screen. The set of actions available RIGHT NOW (their names + what they do) is given to you ` +
1324
+ `in your CURRENT APP CONTEXT and updated as the user moves around. To use one, call 'ContextTool' ` +
1325
+ `with { "action": "<action name>", "params": { ... } } — it runs in the user's browser IMMEDIATELY. ` +
1326
+ `Use 'ContextTool' YOURSELF for anything that navigates or acts in the app (e.g. "take me to ` +
1327
+ `Knowledge Hub" → ContextTool with action 'NavigateToApp'; "open this record"; "switch to the X tab"). ` +
1328
+ `Do NOT route in-app navigation/actions through '${INVOKE_TARGET_AGENT_TOOL_NAME}', and NEVER say you ` +
1329
+ `need an active session id or a screen snapshot to do them — calling 'ContextTool' is all that's ` +
1330
+ `needed. Reserve '${INVOKE_TARGET_AGENT_TOOL_NAME}' for actual analysis / data work, not navigation.`;
1331
+ }
1332
+ return clause;
1198
1333
  }
1199
1334
  /**
1200
1335
  * Frames the prior-leg transcript (when a session resumes via `lastSessionId`) as a clearly
@@ -1329,6 +1464,11 @@ export class RealtimeClientSessionService {
1329
1464
  request: {
1330
1465
  type: 'string',
1331
1466
  description: 'The natural-language request to hand to the target agent.'
1467
+ },
1468
+ agent: {
1469
+ type: 'string',
1470
+ description: 'Optional: the name of a specific colleague to hand this to (one of the colleagues ' +
1471
+ 'named in your instructions). Omit to use your own/the lead agent.'
1332
1472
  }
1333
1473
  },
1334
1474
  required: ['request']
@@ -1367,16 +1507,16 @@ export class RealtimeClientSessionService {
1367
1507
  * @returns The delegated result for the model's tool_response.
1368
1508
  */
1369
1509
  async delegateToTarget(input, request, contextUser, provider) {
1370
- const target = this.resolveTargetAgent(input.TargetAgentID);
1371
- if (!target) {
1372
- return {
1373
- CallID: request.CallID,
1374
- Success: false,
1375
- Output: 'No target agent is configured for this voice session, so the request could not be performed.'
1376
- };
1510
+ // Multi-target (Move 4): the model may name a specific colleague in the call arguments. Resolve
1511
+ // it against the session's allowed union; an unknown name yields a structured "not available"
1512
+ // result the model narrates. No name ⇒ route to the lead TargetAgentID (classic behavior).
1513
+ const requestedAgent = this.parseDelegateAgentName(request.Arguments);
1514
+ const resolution = this.resolveDelegationTarget(requestedAgent, input);
1515
+ if (!resolution.Agent) {
1516
+ return { CallID: request.CallID, Success: false, Output: resolution.Error };
1377
1517
  }
1378
1518
  try {
1379
- const result = await this.runDelegatedAgent(input, request, target, contextUser, provider);
1519
+ const result = await this.runDelegatedAgent(input, request, resolution.Agent, contextUser, provider);
1380
1520
  const artifacts = await this.createDelegatedRunArtifacts(result, contextUser, provider);
1381
1521
  return this.buildDelegatedResult(request.CallID, result, artifacts);
1382
1522
  }
@@ -1385,6 +1525,75 @@ export class RealtimeClientSessionService {
1385
1525
  return { CallID: request.CallID, Success: false, Output: `Delegation failed: ${message}` };
1386
1526
  }
1387
1527
  }
1528
+ /**
1529
+ * Resolves which agent a delegation should run, given an optional colleague name the model passed.
1530
+ *
1531
+ * - **No name** → the lead {@link ExecuteRelayedToolInput.TargetAgentID} (classic single-target).
1532
+ * - **A name matching an allowed colleague** (by label, resolved agent Name, or id — case/whitespace
1533
+ * insensitive) OR the lead's own name → that agent.
1534
+ * - **A name matching nothing in the union/lead** → an error result naming the available colleagues,
1535
+ * so the model self-corrects conversationally rather than silently delegating to the wrong agent.
1536
+ *
1537
+ * The allowed union is an affordance/UX filter; `CanRun` on the resolved agent (inside the agent run)
1538
+ * remains the security boundary — both apply.
1539
+ *
1540
+ * @param requestedAgent The colleague name the model named, or undefined.
1541
+ * @param input The relayed tool input (lead id + allowed union).
1542
+ * @returns `{ Agent }` on success, or `{ Error }` describing why no agent resolved.
1543
+ */
1544
+ resolveDelegationTarget(requestedAgent, input) {
1545
+ const lead = this.resolveTargetAgent(input.TargetAgentID);
1546
+ const name = requestedAgent?.trim().toLowerCase();
1547
+ if (!name) {
1548
+ return lead
1549
+ ? { Agent: lead, Error: '' }
1550
+ : { Error: 'No target agent is configured for this voice session, so the request could not be performed.' };
1551
+ }
1552
+ // Allow naming the lead itself.
1553
+ if (lead && (lead.Name ?? '').trim().toLowerCase() === name) {
1554
+ return { Agent: lead, Error: '' };
1555
+ }
1556
+ const allowed = input.AllowedAgents ?? [];
1557
+ const match = allowed.find(a => {
1558
+ if ((a.label ?? '').trim().toLowerCase() === name) {
1559
+ return true;
1560
+ }
1561
+ if (a.agentId.trim().toLowerCase() === name) {
1562
+ return true;
1563
+ }
1564
+ const resolvedName = this.resolveTargetAgent(a.agentId)?.Name ?? '';
1565
+ return resolvedName.trim().toLowerCase() === name;
1566
+ });
1567
+ if (match) {
1568
+ const agent = this.resolveTargetAgent(match.agentId);
1569
+ if (agent) {
1570
+ return { Agent: agent, Error: '' };
1571
+ }
1572
+ }
1573
+ return {
1574
+ Error: `"${requestedAgent}" isn't a colleague available in this session. ` +
1575
+ `Available: ${this.describeAvailableColleagues(input) || '(none — handle it yourself or via the lead agent)'}.`,
1576
+ };
1577
+ }
1578
+ /** Comma-joined display names of the session's allowed colleagues (labels preferred), for error guidance. */
1579
+ describeAvailableColleagues(input) {
1580
+ return (input.AllowedAgents ?? [])
1581
+ .map(a => a.label ?? this.resolveTargetAgent(a.agentId)?.Name ?? a.agentId)
1582
+ .join(', ');
1583
+ }
1584
+ /** Parses the optional `agent` (colleague name) from an `invoke-target-agent` call's arguments JSON. */
1585
+ parseDelegateAgentName(argumentsJson) {
1586
+ try {
1587
+ const parsed = JSON.parse(argumentsJson);
1588
+ if (typeof parsed.agent === 'string' && parsed.agent.trim().length > 0) {
1589
+ return parsed.agent.trim();
1590
+ }
1591
+ }
1592
+ catch {
1593
+ /* not JSON — no named agent */
1594
+ }
1595
+ return undefined;
1596
+ }
1388
1597
  /**
1389
1598
  * Creates artifact(s) from a completed delegated run's payload — the voice-path equivalent of
1390
1599
  * the chat path's artifact step in `AgentRunner.RunAgentInConversation`. Delegated voice runs