@memberjunction/ng-conversations 5.37.0 → 5.38.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 (56) hide show
  1. package/README.md +2 -2
  2. package/dist/lib/components/conversation/conversation-agent-picker.component.d.ts +47 -0
  3. package/dist/lib/components/conversation/conversation-agent-picker.component.d.ts.map +1 -0
  4. package/dist/lib/components/conversation/conversation-agent-picker.component.js +253 -0
  5. package/dist/lib/components/conversation/conversation-agent-picker.component.js.map +1 -0
  6. package/dist/lib/components/conversation/conversation-chat-area.component.d.ts +148 -11
  7. package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
  8. package/dist/lib/components/conversation/conversation-chat-area.component.js +498 -261
  9. package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
  10. package/dist/lib/components/conversation/conversation-empty-state.component.d.ts +2 -1
  11. package/dist/lib/components/conversation/conversation-empty-state.component.d.ts.map +1 -1
  12. package/dist/lib/components/conversation/conversation-empty-state.component.js +6 -3
  13. package/dist/lib/components/conversation/conversation-empty-state.component.js.map +1 -1
  14. package/dist/lib/components/conversation/conversation-mode-picker.component.d.ts +57 -0
  15. package/dist/lib/components/conversation/conversation-mode-picker.component.d.ts.map +1 -0
  16. package/dist/lib/components/conversation/conversation-mode-picker.component.js +252 -0
  17. package/dist/lib/components/conversation/conversation-mode-picker.component.js.map +1 -0
  18. package/dist/lib/components/message/message-input.component.d.ts +51 -3
  19. package/dist/lib/components/message/message-input.component.d.ts.map +1 -1
  20. package/dist/lib/components/message/message-input.component.js +107 -18
  21. package/dist/lib/components/message/message-input.component.js.map +1 -1
  22. package/dist/lib/components/message/message-item.component.d.ts +0 -13
  23. package/dist/lib/components/message/message-item.component.d.ts.map +1 -1
  24. package/dist/lib/components/message/message-item.component.js +124 -150
  25. package/dist/lib/components/message/message-item.component.js.map +1 -1
  26. package/dist/lib/components/overlay/chat-overlay.component.d.ts +15 -0
  27. package/dist/lib/components/overlay/chat-overlay.component.d.ts.map +1 -1
  28. package/dist/lib/components/overlay/chat-overlay.component.js +123 -46
  29. package/dist/lib/components/overlay/chat-overlay.component.js.map +1 -1
  30. package/dist/lib/components/workspace/conversation-workspace.component.d.ts +11 -0
  31. package/dist/lib/components/workspace/conversation-workspace.component.d.ts.map +1 -1
  32. package/dist/lib/components/workspace/conversation-workspace.component.js +13 -3
  33. package/dist/lib/components/workspace/conversation-workspace.component.js.map +1 -1
  34. package/dist/lib/conversations.module.d.ts +59 -58
  35. package/dist/lib/conversations.module.d.ts.map +1 -1
  36. package/dist/lib/conversations.module.js +8 -4
  37. package/dist/lib/conversations.module.js.map +1 -1
  38. package/dist/lib/models/conversation-state.model.d.ts +0 -27
  39. package/dist/lib/models/conversation-state.model.d.ts.map +1 -1
  40. package/dist/lib/models/conversation-state.model.js.map +1 -1
  41. package/dist/lib/services/conversation-agent.service.d.ts +1 -9
  42. package/dist/lib/services/conversation-agent.service.d.ts.map +1 -1
  43. package/dist/lib/services/conversation-agent.service.js +22 -121
  44. package/dist/lib/services/conversation-agent.service.js.map +1 -1
  45. package/dist/lib/services/conversation-attachment.service.d.ts.map +1 -1
  46. package/dist/lib/services/conversation-attachment.service.js +5 -26
  47. package/dist/lib/services/conversation-attachment.service.js.map +1 -1
  48. package/dist/lib/services/conversation-bridge.service.d.ts +13 -0
  49. package/dist/lib/services/conversation-bridge.service.d.ts.map +1 -1
  50. package/dist/lib/services/conversation-bridge.service.js +15 -0
  51. package/dist/lib/services/conversation-bridge.service.js.map +1 -1
  52. package/package.json +23 -22
  53. package/dist/lib/components/message/suggested-responses.component.d.ts +0 -55
  54. package/dist/lib/components/message/suggested-responses.component.d.ts.map +0 -1
  55. package/dist/lib/components/message/suggested-responses.component.js +0 -207
  56. package/dist/lib/components/message/suggested-responses.component.js.map +0 -1
@@ -37,6 +37,7 @@ export declare class MessageInputComponent extends BaseAngularComponent implemen
37
37
  placeholder: string;
38
38
  parentMessageId?: string;
39
39
  enableAttachments: boolean;
40
+ enableMentions: boolean;
40
41
  maxAttachments: number;
41
42
  maxAttachmentSizeBytes: number;
42
43
  acceptedFileTypes: string;
@@ -45,6 +46,52 @@ export declare class MessageInputComponent extends BaseAngularComponent implemen
45
46
  agentRunsByDetailId?: Map<string, MJAIAgentRunEntityExtended>;
46
47
  emptyStateMode: boolean;
47
48
  appContext: Record<string, unknown> | null;
49
+ /**
50
+ * Optional default agent ID for the conversation. When set, the FIRST
51
+ * message routes directly to this agent — skipping Sage's default
52
+ * delegation — provided the user did not @mention a different agent
53
+ * and there is no prior agent in the conversation history. After the
54
+ * first message, the existing "last non-Sage agent" continuity rule
55
+ * keeps subsequent messages on the same agent.
56
+ *
57
+ * Used by embedded chat surfaces (Form Builder cockpit, future
58
+ * domain-specific chats) that have an obvious specialist agent for the
59
+ * context and don't need Sage to route. Leave unset to preserve the
60
+ * standard Sage-fronted UX of the main Chat app.
61
+ */
62
+ defaultAgentId: string | null;
63
+ /**
64
+ * Per-conversation pinned default agent — sourced from the loaded
65
+ * `MJConversationEntity.DefaultAgentID`. When set, this agent is used in
66
+ * preference to the embedder-supplied {@link defaultAgentId} so a user
67
+ * who pins a conversation to e.g. Research Agent gets that routing even
68
+ * inside an embedded surface whose embedder defaults to a different
69
+ * specialist. Routing precedence:
70
+ * 1. @mention
71
+ * 2. continuity (last responder)
72
+ * 3. **conversationDefaultAgentId** (this input — user's per-conversation pin)
73
+ * 4. defaultAgentId (embedder-supplied)
74
+ * 5. Sage fallback
75
+ */
76
+ conversationDefaultAgentId: string | null;
77
+ /**
78
+ * The `MJ: AI Agent Configurations.ID` selected via the chat header's
79
+ * mode picker (Draft / Standard / High). Applied to **non-mention**
80
+ * routes — when the user types without `@mention`, this preset rides
81
+ * along on the next `invokeSubAgent` call so the server resolves the
82
+ * agent's Fast / Standard / High Power AI configuration accordingly.
83
+ *
84
+ * Mentioned-route turns still use the preset embedded in the mention
85
+ * (e.g. `@Form Builder /high`) because that's a per-message intent
86
+ * the user just expressed. Continuity-route turns (last responder
87
+ * agent) also honor this input as the fallback when the prior
88
+ * message itself doesn't carry an explicit configuration preset.
89
+ *
90
+ * Picker writes are forward-only: changing the mode does NOT re-route
91
+ * messages already in flight or already in history. Affects "what
92
+ * happens next."
93
+ */
94
+ agentConfigurationPresetId: string | null;
48
95
  private _initialMessage;
49
96
  private _initialAttachments;
50
97
  private _isComponentReady;
@@ -191,8 +238,9 @@ export declare class MessageInputComponent extends BaseAngularComponent implemen
191
238
  */
192
239
  private parseMentionsFromMessage;
193
240
  /**
194
- * Routes the message to the appropriate agent or Sage based on context
195
- * Priority: @mention > intent check > Sage
241
+ * Routes the message to the appropriate agent or Sage based on context.
242
+ * Priority: explicit @mention > prior-agent continuity > embedder-supplied
243
+ * default agent > Sage fallback.
196
244
  */
197
245
  private routeMessage;
198
246
  /**
@@ -332,6 +380,6 @@ export declare class MessageInputComponent extends BaseAngularComponent implemen
332
380
  */
333
381
  private cleanupCompletionTimestamp;
334
382
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageInputComponent, never>;
335
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageInputComponent, "mj-message-input", never, { "conversationId": { "alias": "conversationId"; "required": false; }; "conversationName": { "alias": "conversationName"; "required": false; }; "currentUser": { "alias": "currentUser"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "parentMessageId": { "alias": "parentMessageId"; "required": false; }; "enableAttachments": { "alias": "enableAttachments"; "required": false; }; "maxAttachments": { "alias": "maxAttachments"; "required": false; }; "maxAttachmentSizeBytes": { "alias": "maxAttachmentSizeBytes"; "required": false; }; "acceptedFileTypes": { "alias": "acceptedFileTypes"; "required": false; }; "artifactsByDetailId": { "alias": "artifactsByDetailId"; "required": false; }; "systemArtifactsByDetailId": { "alias": "systemArtifactsByDetailId"; "required": false; }; "agentRunsByDetailId": { "alias": "agentRunsByDetailId"; "required": false; }; "emptyStateMode": { "alias": "emptyStateMode"; "required": false; }; "appContext": { "alias": "appContext"; "required": false; }; "initialMessage": { "alias": "initialMessage"; "required": false; }; "initialAttachments": { "alias": "initialAttachments"; "required": false; }; "conversationHistory": { "alias": "conversationHistory"; "required": false; }; "inProgressMessageIds": { "alias": "inProgressMessageIds"; "required": false; }; }, { "messageSent": "messageSent"; "agentResponse": "agentResponse"; "agentRunDetected": "agentRunDetected"; "agentRunUpdate": "agentRunUpdate"; "messageComplete": "messageComplete"; "artifactCreated": "artifactCreated"; "conversationRenamed": "conversationRenamed"; "intentCheckStarted": "intentCheckStarted"; "intentCheckCompleted": "intentCheckCompleted"; "emptyStateSubmit": "emptyStateSubmit"; "uploadStateChanged": "uploadStateChanged"; "artifactPickerRequested": "artifactPickerRequested"; }, never, never, false, never>;
383
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageInputComponent, "mj-message-input", never, { "conversationId": { "alias": "conversationId"; "required": false; }; "conversationName": { "alias": "conversationName"; "required": false; }; "currentUser": { "alias": "currentUser"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "parentMessageId": { "alias": "parentMessageId"; "required": false; }; "enableAttachments": { "alias": "enableAttachments"; "required": false; }; "enableMentions": { "alias": "enableMentions"; "required": false; }; "maxAttachments": { "alias": "maxAttachments"; "required": false; }; "maxAttachmentSizeBytes": { "alias": "maxAttachmentSizeBytes"; "required": false; }; "acceptedFileTypes": { "alias": "acceptedFileTypes"; "required": false; }; "artifactsByDetailId": { "alias": "artifactsByDetailId"; "required": false; }; "systemArtifactsByDetailId": { "alias": "systemArtifactsByDetailId"; "required": false; }; "agentRunsByDetailId": { "alias": "agentRunsByDetailId"; "required": false; }; "emptyStateMode": { "alias": "emptyStateMode"; "required": false; }; "appContext": { "alias": "appContext"; "required": false; }; "defaultAgentId": { "alias": "defaultAgentId"; "required": false; }; "conversationDefaultAgentId": { "alias": "conversationDefaultAgentId"; "required": false; }; "agentConfigurationPresetId": { "alias": "agentConfigurationPresetId"; "required": false; }; "initialMessage": { "alias": "initialMessage"; "required": false; }; "initialAttachments": { "alias": "initialAttachments"; "required": false; }; "conversationHistory": { "alias": "conversationHistory"; "required": false; }; "inProgressMessageIds": { "alias": "inProgressMessageIds"; "required": false; }; }, { "messageSent": "messageSent"; "agentResponse": "agentResponse"; "agentRunDetected": "agentRunDetected"; "agentRunUpdate": "agentRunUpdate"; "messageComplete": "messageComplete"; "artifactCreated": "artifactCreated"; "conversationRenamed": "conversationRenamed"; "intentCheckStarted": "intentCheckStarted"; "intentCheckCompleted": "intentCheckCompleted"; "emptyStateSubmit": "emptyStateSubmit"; "uploadStateChanged": "uploadStateChanged"; "artifactPickerRequested": "artifactPickerRequested"; }, never, never, false, never>;
336
384
  }
337
385
  //# sourceMappingURL=message-input.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"message-input.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/message/message-input.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAAa,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9I,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAY,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAmD,MAAM,+BAA+B,CAAC;AAC5H,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,4BAA4B,EAAkD,MAAM,+CAA+C,CAA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W,yBAAyB;IA+FvC;;;OAGG;YACW,wBAAwB;IA2JtC;;;OAGG;YACW,uBAAuB;IAwJrC;;;OAGG;YACW,mBAAmB;IAgIjC;;;;;OAKG;YACW,iBAAiB;IAmI/B;;;;;;;;;;;OAWG;YACW,wBAAwB;IAsGtC;;;;;OAKG;YACW,gBAAgB;IAmF9B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IA8C3B;;OAEG;IACH,OAAO,CAAC,0BAA0B;yCA/0EvB,qBAAqB;2CAArB,qBAAqB;CAq1EjC"}
1
+ {"version":3,"file":"message-input.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/message/message-input.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAAa,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9I,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAY,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAmD,MAAM,+BAA+B,CAAC;AAC5H,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,4BAA4B,EAAkD,MAAM,+CAA+C,CAAC;AAG7I,OAAO,EAAE,kBAAkB,EAA+G,MAAM,8BAA8B,CAAC;AAC/K,OAAO,EAAE,0BAA0B,EAAqB,MAAM,6CAA6C,CAAC;AAC5G,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCA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AE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IA8D5L;;;;;OAKG;YACW,2BAA2B;IAmDzC;;;OAGG;YACW,yBAAyB;IAiGvC;;;OAGG;YACW,wBAAwB;IA6JtC;;;OAGG;YACW,uBAAuB;IA0JrC;;;OAGG;YACW,mBAAmB;IAiIjC;;;;;OAKG;YACW,iBAAiB;IA6I/B;;;;;;;;;;;OAWG;YACW,wBAAwB;IA2GtC;;;;;OAKG;YACW,gBAAgB;IAmF9B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IA8C3B;;OAEG;IACH,OAAO,CAAC,0BAA0B;yCAh7EvB,qBAAqB;2CAArB,qBAAqB;CAs7EjC"}
@@ -50,6 +50,7 @@ export class MessageInputComponent extends BaseAngularComponent {
50
50
  placeholder = 'Type a message... (Ctrl+Enter to send)';
51
51
  parentMessageId; // Optional: for replying in threads
52
52
  enableAttachments = true; // Whether to show attachment button (based on agent modality support)
53
+ enableMentions = true; // Whether to enable @-mention autocomplete (agents/users). Hosts addressing a single fixed agent (e.g. Form Builder cockpit) typically set false.
53
54
  maxAttachments = 10; // Maximum number of attachments per message
54
55
  maxAttachmentSizeBytes = 20 * 1024 * 1024; // Maximum size per attachment (20MB default)
55
56
  acceptedFileTypes = 'image/*'; // Accepted MIME types pattern
@@ -58,6 +59,52 @@ export class MessageInputComponent extends BaseAngularComponent {
58
59
  agentRunsByDetailId; // Pre-loaded agent run data for performance
59
60
  emptyStateMode = false; // When true, emits emptyStateSubmit instead of creating messages directly
60
61
  appContext = null; // Application context for AI agent awareness
62
+ /**
63
+ * Optional default agent ID for the conversation. When set, the FIRST
64
+ * message routes directly to this agent — skipping Sage's default
65
+ * delegation — provided the user did not @mention a different agent
66
+ * and there is no prior agent in the conversation history. After the
67
+ * first message, the existing "last non-Sage agent" continuity rule
68
+ * keeps subsequent messages on the same agent.
69
+ *
70
+ * Used by embedded chat surfaces (Form Builder cockpit, future
71
+ * domain-specific chats) that have an obvious specialist agent for the
72
+ * context and don't need Sage to route. Leave unset to preserve the
73
+ * standard Sage-fronted UX of the main Chat app.
74
+ */
75
+ defaultAgentId = null;
76
+ /**
77
+ * Per-conversation pinned default agent — sourced from the loaded
78
+ * `MJConversationEntity.DefaultAgentID`. When set, this agent is used in
79
+ * preference to the embedder-supplied {@link defaultAgentId} so a user
80
+ * who pins a conversation to e.g. Research Agent gets that routing even
81
+ * inside an embedded surface whose embedder defaults to a different
82
+ * specialist. Routing precedence:
83
+ * 1. @mention
84
+ * 2. continuity (last responder)
85
+ * 3. **conversationDefaultAgentId** (this input — user's per-conversation pin)
86
+ * 4. defaultAgentId (embedder-supplied)
87
+ * 5. Sage fallback
88
+ */
89
+ conversationDefaultAgentId = null;
90
+ /**
91
+ * The `MJ: AI Agent Configurations.ID` selected via the chat header's
92
+ * mode picker (Draft / Standard / High). Applied to **non-mention**
93
+ * routes — when the user types without `@mention`, this preset rides
94
+ * along on the next `invokeSubAgent` call so the server resolves the
95
+ * agent's Fast / Standard / High Power AI configuration accordingly.
96
+ *
97
+ * Mentioned-route turns still use the preset embedded in the mention
98
+ * (e.g. `@Form Builder /high`) because that's a per-message intent
99
+ * the user just expressed. Continuity-route turns (last responder
100
+ * agent) also honor this input as the fallback when the prior
101
+ * message itself doesn't carry an explicit configuration preset.
102
+ *
103
+ * Picker writes are forward-only: changing the mode does NOT re-route
104
+ * messages already in flight or already in history. Affects "what
105
+ * happens next."
106
+ */
107
+ agentConfigurationPresetId = null;
61
108
  // Initial message to send automatically - using getter/setter for precise control
62
109
  _initialMessage = null;
63
110
  _initialAttachments = null;
@@ -565,8 +612,9 @@ export class MessageInputComponent extends BaseAngularComponent {
565
612
  return mentionResult;
566
613
  }
567
614
  /**
568
- * Routes the message to the appropriate agent or Sage based on context
569
- * Priority: @mention > intent check > Sage
615
+ * Routes the message to the appropriate agent or Sage based on context.
616
+ * Priority: explicit @mention > prior-agent continuity > embedder-supplied
617
+ * default agent > Sage fallback.
570
618
  */
571
619
  async routeMessage(messageDetail, mentionResult, isFirstMessage) {
572
620
  // Priority 1: Direct @mention
@@ -580,7 +628,25 @@ export class MessageInputComponent extends BaseAngularComponent {
580
628
  await this.handleAgentContinuity(messageDetail, lastAgentId, mentionResult, isFirstMessage);
581
629
  return;
582
630
  }
583
- // Priority 3: Check if Sage was explicitly @mentioned with a config preset
631
+ // Priority 3: User's per-conversation pinned default agent sourced
632
+ // from MJConversationEntity.DefaultAgentID. Wins over the embedder's
633
+ // default because it represents an explicit user choice on this
634
+ // conversation (e.g. "always route to Research Agent for this thread").
635
+ if (this.conversationDefaultAgentId) {
636
+ await this.handleAgentContinuity(messageDetail, this.conversationDefaultAgentId, mentionResult, isFirstMessage);
637
+ return;
638
+ }
639
+ // Priority 4: Embedder-supplied default agent. Set by chat surfaces
640
+ // that have a specialist agent for the context (e.g. Form Builder
641
+ // cockpit). Only kicks in when nothing more explicit is present —
642
+ // @mention always wins, conversation continuity always wins. The
643
+ // intent is to skip Sage's default delegation when the embedder
644
+ // already knows what agent owns this conversation.
645
+ if (this.defaultAgentId) {
646
+ await this.handleAgentContinuity(messageDetail, this.defaultAgentId, mentionResult, isFirstMessage);
647
+ return;
648
+ }
649
+ // Priority 5: Check if Sage was explicitly @mentioned with a config preset
584
650
  // If so, treat it like agent continuity so the config preset is preserved
585
651
  if (this.converationManagerAgent?.ID) {
586
652
  const sageConfigPreset = this.agentService.findConfigurationPresetFromHistory(this.converationManagerAgent.ID, this.conversationHistory);
@@ -594,7 +660,7 @@ export class MessageInputComponent extends BaseAngularComponent {
594
660
  return;
595
661
  }
596
662
  }
597
- // Priority 4: No context - use Sage with default config
663
+ // Priority 6: No context - use Sage with default config
598
664
  await this.handleNoAgentContext(messageDetail, mentionResult, isFirstMessage);
599
665
  }
600
666
  /**
@@ -1254,7 +1320,8 @@ export class MessageInputComponent extends BaseAngularComponent {
1254
1320
  : task.inputPayload;
1255
1321
  // Invoke agent with merged payload
1256
1322
  const agentResult = await this.agentService.invokeSubAgent(agentName, conversationId, userMessage, this.conversationHistory, task.description || task.name, agentResponseMessage.ID, mergedPayload, // Pass merged payload for continuity
1257
- this.createProgressCallback(agentResponseMessage, agentName), artifactInfo?.artifactId, artifactInfo?.versionId);
1323
+ this.createProgressCallback(agentResponseMessage, agentName), artifactInfo?.artifactId, artifactInfo?.versionId, undefined, // configurationPresetId not used in this path
1324
+ this.appContext);
1258
1325
  // Task will be removed automatically in markMessageComplete() when status changes to Complete/Error
1259
1326
  // DO NOT remove here - allows UI to show task during entire execution
1260
1327
  if (agentResult && agentResult.success) {
@@ -1333,8 +1400,8 @@ export class MessageInputComponent extends BaseAngularComponent {
1333
1400
  : undefined;
1334
1401
  // Invoke the sub-agent with progress callback
1335
1402
  const subResult = await this.agentService.invokeSubAgent(agentName, conversationId, userMessage, this.conversationHistory, reasoning, agentResponseMessage.ID, previousPayload, // Pass previous payload for continuity
1336
- this.createProgressCallback(agentResponseMessage, agentName), artifactInfo?.artifactId, artifactInfo?.versionId, configurationPresetId // Pass configuration from previous @mention for continuity
1337
- );
1403
+ this.createProgressCallback(agentResponseMessage, agentName), artifactInfo?.artifactId, artifactInfo?.versionId, configurationPresetId, // Pass configuration from previous @mention for continuity
1404
+ this.appContext);
1338
1405
  // Task will be removed automatically in markMessageComplete() when status changes to Complete/Error
1339
1406
  // DO NOT remove here - allows UI to show task during entire execution
1340
1407
  if (subResult && subResult.success) {
@@ -1366,8 +1433,8 @@ export class MessageInputComponent extends BaseAngularComponent {
1366
1433
  await this.updateConversationDetail(agentResponseMessage, "Retrying...", agentResponseMessage.Status);
1367
1434
  // Retry the sub-agent (reuse previously loaded payload and config from first attempt)
1368
1435
  const retryResult = await this.agentService.invokeSubAgent(agentName, conversationId, userMessage, this.conversationHistory, reasoning, agentResponseMessage.ID, previousPayload, // Pass same payload as first attempt
1369
- this.createProgressCallback(agentResponseMessage, `${agentName} (retry)`), artifactInfo?.artifactId, artifactInfo?.versionId, configurationPresetId // Pass same config as first attempt
1370
- );
1436
+ this.createProgressCallback(agentResponseMessage, `${agentName} (retry)`), artifactInfo?.artifactId, artifactInfo?.versionId, configurationPresetId, // Pass same config as first attempt
1437
+ this.appContext);
1371
1438
  if (retryResult && retryResult.success) {
1372
1439
  // Retry succeeded - update the same message
1373
1440
  if (retryResult.agentRun.AgentID) {
@@ -1475,7 +1542,8 @@ export class MessageInputComponent extends BaseAngularComponent {
1475
1542
  });
1476
1543
  try {
1477
1544
  // Invoke the agent with the previous payload
1478
- const continuityResult = await this.agentService.invokeSubAgent(agentName, conversationId, userMessage, this.conversationHistory, 'Continuing previous work based on user feedback', statusMessage.ID, previousPayload, this.createProgressCallback(statusMessage, agentName), previousArtifactInfo?.artifactId, previousArtifactInfo?.versionId);
1545
+ const continuityResult = await this.agentService.invokeSubAgent(agentName, conversationId, userMessage, this.conversationHistory, 'Continuing previous work based on user feedback', statusMessage.ID, previousPayload, this.createProgressCallback(statusMessage, agentName), previousArtifactInfo?.artifactId, previousArtifactInfo?.versionId, undefined, // configurationPresetId not used in this path
1546
+ this.appContext);
1479
1547
  // Remove from active tasks
1480
1548
  // Task removed in markMessageComplete() - this.activeTasks.remove(taskId);
1481
1549
  if (continuityResult && continuityResult.success) {
@@ -1566,8 +1634,8 @@ export class MessageInputComponent extends BaseAngularComponent {
1566
1634
  : { payload: null, artifactInfo: null };
1567
1635
  // Invoke the agent directly
1568
1636
  const result = await this.agentService.invokeSubAgent(agentName, conversationId, userMessage, this.conversationHistory, `User mentioned agent directly with @${agentName}`, agentResponseMessage.ID, previousPayload, // Pass previous payload for continuity
1569
- this.createProgressCallback(agentResponseMessage, agentName), artifactInfo?.artifactId, artifactInfo?.versionId, agentMention.configurationId // Pass configuration preset ID
1570
- );
1637
+ this.createProgressCallback(agentResponseMessage, agentName), artifactInfo?.artifactId, artifactInfo?.versionId, agentMention.configurationId, // Pass configuration preset ID
1638
+ this.appContext);
1571
1639
  // Remove from active tasks
1572
1640
  // Task removed in markMessageComplete() - this.activeTasks.remove(taskId);
1573
1641
  if (result && result.success) {
@@ -1697,6 +1765,15 @@ export class MessageInputComponent extends BaseAngularComponent {
1697
1765
  // Extract configuration preset from the User message that @mentioned this agent
1698
1766
  // Uses the shared helper method in the agent service
1699
1767
  previousConfigurationId = this.agentService.findConfigurationPresetFromHistory(agentId, this.conversationHistory);
1768
+ // Fall back to the chat header's mode-picker selection when nothing
1769
+ // in the message history pinned a preset. The picker reflects the
1770
+ // user's persistent per-agent mode preference (Draft / Standard /
1771
+ // High) and applies to all subsequent non-mention routes. A
1772
+ // history-derived preset still wins because it represents an
1773
+ // explicit per-message intent the user expressed earlier.
1774
+ if (!previousConfigurationId && this.agentConfigurationPresetId) {
1775
+ previousConfigurationId = this.agentConfigurationPresetId;
1776
+ }
1700
1777
  // Fall back to searching through all agent messages for an artifact
1701
1778
  // This ensures payload continuity even after clarifying exchanges without artifacts
1702
1779
  if (!previousPayload && agentMessages.length > 0) {
@@ -1778,10 +1855,14 @@ export class MessageInputComponent extends BaseAngularComponent {
1778
1855
  // Save the record to establish __mj_CreatedAt timestamp
1779
1856
  await agentResponseMessage.Save();
1780
1857
  this.messageSent.emit(agentResponseMessage);
1781
- // Invoke the agent directly (continuation) with previous payload if available
1858
+ // Invoke the agent directly (continuation) with previous payload if available.
1859
+ // `this.appContext` is forwarded so direct-routed sub-agents (e.g. Form
1860
+ // Builder via [defaultAgentId]) see the embedder's ActiveForm/Schema/
1861
+ // OverrideID block in their prompt — same flow Sage gets via
1862
+ // `processMessage`.
1782
1863
  const result = await this.agentService.invokeSubAgent(agentName, conversationId, userMessage, this.conversationHistory, 'Continuing previous conversation with user', agentResponseMessage.ID, previousPayload, // Pass previous OUTPUT artifact payload for continuity
1783
- this.createProgressCallback(agentResponseMessage, agentName), previousArtifactInfo?.artifactId, previousArtifactInfo?.versionId, configurationId // Pass configuration for continuity
1784
- );
1864
+ this.createProgressCallback(agentResponseMessage, agentName), previousArtifactInfo?.artifactId, previousArtifactInfo?.versionId, configurationId, // Pass configuration for continuity
1865
+ this.appContext);
1785
1866
  // Remove from active tasks
1786
1867
  // Task removed in markMessageComplete() - this.activeTasks.remove(taskId);
1787
1868
  if (result && result.success) {
@@ -1947,7 +2028,7 @@ export class MessageInputComponent extends BaseAngularComponent {
1947
2028
  } if (rf & 2) {
1948
2029
  let _t;
1949
2030
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.inputBox = _t.first);
1950
- } }, inputs: { conversationId: "conversationId", conversationName: "conversationName", currentUser: "currentUser", disabled: "disabled", placeholder: "placeholder", parentMessageId: "parentMessageId", enableAttachments: "enableAttachments", maxAttachments: "maxAttachments", maxAttachmentSizeBytes: "maxAttachmentSizeBytes", acceptedFileTypes: "acceptedFileTypes", artifactsByDetailId: "artifactsByDetailId", systemArtifactsByDetailId: "systemArtifactsByDetailId", agentRunsByDetailId: "agentRunsByDetailId", emptyStateMode: "emptyStateMode", appContext: "appContext", initialMessage: "initialMessage", initialAttachments: "initialAttachments", conversationHistory: "conversationHistory", inProgressMessageIds: "inProgressMessageIds" }, outputs: { messageSent: "messageSent", agentResponse: "agentResponse", agentRunDetected: "agentRunDetected", agentRunUpdate: "agentRunUpdate", messageComplete: "messageComplete", artifactCreated: "artifactCreated", conversationRenamed: "conversationRenamed", intentCheckStarted: "intentCheckStarted", intentCheckCompleted: "intentCheckCompleted", emptyStateSubmit: "emptyStateSubmit", uploadStateChanged: "uploadStateChanged", artifactPickerRequested: "artifactPickerRequested" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature, i0.ɵɵNgOnChangesFeature], decls: 4, vars: 12, consts: [["inputBox", ""], [1, "message-input-wrapper"], [1, "processing-indicator"], [3, "valueChange", "textSubmitted", "attachmentsChanged", "attachmentError", "artifactPickerRequested", "placeholder", "disabled", "showCharacterCount", "enableMentions", "enableAttachments", "maxAttachments", "maxAttachmentSizeBytes", "acceptedFileTypes", "currentUser", "rows", "value"], [1, "fas", "fa-circle-notch", "fa-spin"]], template: function MessageInputComponent_Template(rf, ctx) { if (rf & 1) {
2031
+ } }, inputs: { conversationId: "conversationId", conversationName: "conversationName", currentUser: "currentUser", disabled: "disabled", placeholder: "placeholder", parentMessageId: "parentMessageId", enableAttachments: "enableAttachments", enableMentions: "enableMentions", maxAttachments: "maxAttachments", maxAttachmentSizeBytes: "maxAttachmentSizeBytes", acceptedFileTypes: "acceptedFileTypes", artifactsByDetailId: "artifactsByDetailId", systemArtifactsByDetailId: "systemArtifactsByDetailId", agentRunsByDetailId: "agentRunsByDetailId", emptyStateMode: "emptyStateMode", appContext: "appContext", defaultAgentId: "defaultAgentId", conversationDefaultAgentId: "conversationDefaultAgentId", agentConfigurationPresetId: "agentConfigurationPresetId", initialMessage: "initialMessage", initialAttachments: "initialAttachments", conversationHistory: "conversationHistory", inProgressMessageIds: "inProgressMessageIds" }, outputs: { messageSent: "messageSent", agentResponse: "agentResponse", agentRunDetected: "agentRunDetected", agentRunUpdate: "agentRunUpdate", messageComplete: "messageComplete", artifactCreated: "artifactCreated", conversationRenamed: "conversationRenamed", intentCheckStarted: "intentCheckStarted", intentCheckCompleted: "intentCheckCompleted", emptyStateSubmit: "emptyStateSubmit", uploadStateChanged: "uploadStateChanged", artifactPickerRequested: "artifactPickerRequested" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature, i0.ɵɵNgOnChangesFeature], decls: 4, vars: 12, consts: [["inputBox", ""], [1, "message-input-wrapper"], [1, "processing-indicator"], [3, "valueChange", "textSubmitted", "attachmentsChanged", "attachmentError", "artifactPickerRequested", "placeholder", "disabled", "showCharacterCount", "enableMentions", "enableAttachments", "maxAttachments", "maxAttachmentSizeBytes", "acceptedFileTypes", "currentUser", "rows", "value"], [1, "fas", "fa-circle-notch", "fa-spin"]], template: function MessageInputComponent_Template(rf, ctx) { if (rf & 1) {
1951
2032
  const _r1 = i0.ɵɵgetCurrentView();
1952
2033
  i0.ɵɵelementStart(0, "div", 1);
1953
2034
  i0.ɵɵconditionalCreate(1, MessageInputComponent_Conditional_1_Template, 4, 1, "div", 2);
@@ -1959,13 +2040,13 @@ export class MessageInputComponent extends BaseAngularComponent {
1959
2040
  i0.ɵɵadvance();
1960
2041
  i0.ɵɵconditional(ctx.isProcessing ? 1 : -1);
1961
2042
  i0.ɵɵadvance();
1962
- i0.ɵɵproperty("placeholder", ctx.placeholder)("disabled", ctx.disabled || ctx.isProcessing)("showCharacterCount", false)("enableMentions", true)("enableAttachments", ctx.enableAttachments)("maxAttachments", ctx.maxAttachments)("maxAttachmentSizeBytes", ctx.maxAttachmentSizeBytes)("acceptedFileTypes", ctx.acceptedFileTypes)("currentUser", ctx.currentUser)("rows", 3);
2043
+ i0.ɵɵproperty("placeholder", ctx.placeholder)("disabled", ctx.disabled || ctx.isProcessing)("showCharacterCount", false)("enableMentions", ctx.enableMentions)("enableAttachments", ctx.enableAttachments)("maxAttachments", ctx.maxAttachments)("maxAttachmentSizeBytes", ctx.maxAttachmentSizeBytes)("acceptedFileTypes", ctx.acceptedFileTypes)("currentUser", ctx.currentUser)("rows", 3);
1963
2044
  i0.ɵɵtwoWayProperty("value", ctx.messageText);
1964
2045
  } }, dependencies: [i11.MessageInputBoxComponent], styles: [".message-input-wrapper[_ngcontent-%COMP%] {\n position: relative;\n width: 100%;\n}\n\n.processing-indicator[_ngcontent-%COMP%] {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.75rem 1.25rem;\n background: color-mix(in srgb, var(--mj-bg-surface-card) 95%, transparent);\n border-radius: 8px;\n box-shadow: var(--mj-shadow-sm);\n z-index: 10;\n pointer-events: none;\n}\n.processing-indicator[_ngcontent-%COMP%] i[_ngcontent-%COMP%] {\n color: var(--mj-brand-primary);\n}\n.processing-indicator[_ngcontent-%COMP%] span[_ngcontent-%COMP%] {\n font-size: 0.9rem;\n color: var(--mj-text-primary);\n}"] });
1965
2046
  }
1966
2047
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MessageInputComponent, [{
1967
2048
  type: Component,
1968
- args: [{ standalone: false, selector: 'mj-message-input', template: "<div class=\"message-input-wrapper\">\n <!-- Processing Indicator Overlay -->\n @if (isProcessing) {\n <div class=\"processing-indicator\">\n <i class=\"fas fa-circle-notch fa-spin\"></i>\n <span>{{ processingMessage }}</span>\n </div>\n }\n\n <!-- Message Input Box -->\n <mj-message-input-box\n #inputBox\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled || isProcessing\"\n [showCharacterCount]=\"false\"\n [enableMentions]=\"true\"\n [enableAttachments]=\"enableAttachments\"\n [maxAttachments]=\"maxAttachments\"\n [maxAttachmentSizeBytes]=\"maxAttachmentSizeBytes\"\n [acceptedFileTypes]=\"acceptedFileTypes\"\n [currentUser]=\"currentUser\"\n [rows]=\"3\"\n [(value)]=\"messageText\"\n (textSubmitted)=\"onTextSubmitted($event)\"\n (attachmentsChanged)=\"onAttachmentsChanged($event)\"\n (attachmentError)=\"onAttachmentError($event)\"\n (artifactPickerRequested)=\"onArtifactPickerRequested()\">\n </mj-message-input-box>\n</div>", styles: [".message-input-wrapper {\n position: relative;\n width: 100%;\n}\n\n.processing-indicator {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.75rem 1.25rem;\n background: color-mix(in srgb, var(--mj-bg-surface-card) 95%, transparent);\n border-radius: 8px;\n box-shadow: var(--mj-shadow-sm);\n z-index: 10;\n pointer-events: none;\n}\n.processing-indicator i {\n color: var(--mj-brand-primary);\n}\n.processing-indicator span {\n font-size: 0.9rem;\n color: var(--mj-text-primary);\n}\n"] }]
2049
+ args: [{ standalone: false, selector: 'mj-message-input', template: "<div class=\"message-input-wrapper\">\n <!-- Processing Indicator Overlay -->\n @if (isProcessing) {\n <div class=\"processing-indicator\">\n <i class=\"fas fa-circle-notch fa-spin\"></i>\n <span>{{ processingMessage }}</span>\n </div>\n }\n\n <!-- Message Input Box -->\n <mj-message-input-box\n #inputBox\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled || isProcessing\"\n [showCharacterCount]=\"false\"\n [enableMentions]=\"enableMentions\"\n [enableAttachments]=\"enableAttachments\"\n [maxAttachments]=\"maxAttachments\"\n [maxAttachmentSizeBytes]=\"maxAttachmentSizeBytes\"\n [acceptedFileTypes]=\"acceptedFileTypes\"\n [currentUser]=\"currentUser\"\n [rows]=\"3\"\n [(value)]=\"messageText\"\n (textSubmitted)=\"onTextSubmitted($event)\"\n (attachmentsChanged)=\"onAttachmentsChanged($event)\"\n (attachmentError)=\"onAttachmentError($event)\"\n (artifactPickerRequested)=\"onArtifactPickerRequested()\">\n </mj-message-input-box>\n</div>", styles: [".message-input-wrapper {\n position: relative;\n width: 100%;\n}\n\n.processing-indicator {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.75rem 1.25rem;\n background: color-mix(in srgb, var(--mj-bg-surface-card) 95%, transparent);\n border-radius: 8px;\n box-shadow: var(--mj-shadow-sm);\n z-index: 10;\n pointer-events: none;\n}\n.processing-indicator i {\n color: var(--mj-brand-primary);\n}\n.processing-indicator span {\n font-size: 0.9rem;\n color: var(--mj-text-primary);\n}\n"] }]
1969
2050
  }], () => [{ type: i1.DialogService }, { type: i2.ToastService }, { type: i3.ConversationAgentService }, { type: i4.DataCacheService }, { type: i5.ActiveTasksService }, { type: i6.ConversationStreamingService }, { type: i7.MentionParserService }, { type: i8.MentionAutocompleteService }, { type: i9.ConversationAttachmentService }, { type: i10.ConversationBridgeService }], { conversationId: [{
1970
2051
  type: Input
1971
2052
  }], conversationName: [{
@@ -1980,6 +2061,8 @@ export class MessageInputComponent extends BaseAngularComponent {
1980
2061
  type: Input
1981
2062
  }], enableAttachments: [{
1982
2063
  type: Input
2064
+ }], enableMentions: [{
2065
+ type: Input
1983
2066
  }], maxAttachments: [{
1984
2067
  type: Input
1985
2068
  }], maxAttachmentSizeBytes: [{
@@ -1996,6 +2079,12 @@ export class MessageInputComponent extends BaseAngularComponent {
1996
2079
  type: Input
1997
2080
  }], appContext: [{
1998
2081
  type: Input
2082
+ }], defaultAgentId: [{
2083
+ type: Input
2084
+ }], conversationDefaultAgentId: [{
2085
+ type: Input
2086
+ }], agentConfigurationPresetId: [{
2087
+ type: Input
1999
2088
  }], initialMessage: [{
2000
2089
  type: Input
2001
2090
  }], initialAttachments: [{