@memberjunction/ng-conversations 6.1.0-edge.0 → 6.1.0-edge.1

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.
@@ -552,9 +552,24 @@ export declare class MessageInputComponent extends BaseAngularComponent implemen
552
552
  * Only called when there's no @mention and no implicit agent context
553
553
  */
554
554
  private processMessageThroughAgent;
555
+ /** Detaches the progress callback for one message — used when submission never starts. */
556
+ private releaseProgressCallback;
555
557
  /**
556
- * Handle task graph execution based on Sage's payload
557
- * Creates tasks and orchestrates their execution
558
+ * Submits a task graph to the server and returns — the client no longer drives execution.
559
+ *
560
+ * This used to call the `ExecuteTaskGraph` mutation and await the ENTIRE workflow inside one
561
+ * long-lived GraphQL request. That had three unfixable problems: a page reload lost the awaited
562
+ * promise (leaving a workflow running with nobody watching), a server restart orphaned every
563
+ * in-flight task, and no other channel could reach the substrate at all.
564
+ *
565
+ * Now submission returns as soon as the graph is durable and the server-side dispatcher executes
566
+ * it. The client is purely an observer: progress arrives over the existing PubSub frames, and
567
+ * because the work lives in Task rows rather than in a promise, a reload can re-attach to a
568
+ * workflow already in flight.
569
+ *
570
+ * Single-task graphs are no longer special-cased here. The old client-side fork ran them through
571
+ * a different code path entirely; they now submit like any other graph, and the decision about
572
+ * whether a one-node graph is worth durable machinery moves server-side where it can be recorded.
558
573
  */
559
574
  private handleTaskGraphExecution;
560
575
  protected updateConversationDetail(convoDetail: MJConversationDetailEntity, message: string, status: 'In-Progress' | 'Complete' | 'Error', result?: ExecuteAgentResult): Promise<void>;
@@ -565,11 +580,6 @@ export declare class MessageInputComponent extends BaseAngularComponent implemen
565
580
  * Checks both user-visible and system artifacts to support agents like Agent Manager.
566
581
  */
567
582
  private loadPreviousPayloadForAgent;
568
- /**
569
- * Handle single task execution from task graph using direct agent execution
570
- * Uses the existing agent execution pattern with PubSub support
571
- */
572
- private handleSingleTaskExecution;
573
583
  /**
574
584
  * Handle sub-agent invocation based on Sage's payload
575
585
  * Reuses the existing conversationManagerMessage to avoid creating multiple records
@@ -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,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAY,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAmE,MAAM,+BAA+B,CAAC;AAC5I,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAsB,MAAM,8BAA8B,CAAC;AACvH,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,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,4BAA4B,EAAkD,MAAM,+CAA+C,CAAC;AAI7I,OAAO,EAAE,kBAAkB,EAA+G,MAAM,8BAA8B,CAAC;AAC/K,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AAG/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAA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AqJtC;;;OAGG;YACW,uBAAuB;IAsJrC;;;OAGG;YACW,mBAAmB;IA6HjC;;;;;OAKG;YACW,iBAAiB;IA6I/B;;;;;;;;;;;OAWG;YACW,wBAAwB;IAuGtC;;;;;OAKG;YACW,gBAAgB;IA4B9B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IA+C3B;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;IAW1B;;OAEG;IACH,OAAO,CAAC,0BAA0B;yCAn8FvB,qBAAqB;2CAArB,qBAAqB;CAy8FjC"}
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,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAY,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAwH,MAAM,+BAA+B,CAAC;AACjM,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAsB,MAAM,8BAA8B,CAAC;AACvH,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,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,4BAA4B,EAAkD,MAAM,+CAA+C,CAAC;AAI7I,OAAO,EAAE,kBAAkB,EA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AA0F;IAC1F,OAAO,CAAC,uBAAuB;IAQ/B;;;;;;;;;;;;;;;;OAgBG;YACW,wBAAwB;cAmEtB,wBAAwB,CAAC,WAAW,EAAE,0BAA0B,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,UAAU,GAAG,OAAO,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IA8D5L;;;;;OAKG;YACW,2BAA2B;IAmDzC;;;OAGG;YACW,wBAAwB;IAqJtC;;;OAGG;YACW,uBAAuB;IAsJrC;;;OAGG;YACW,mBAAmB;IA6HjC;;;;;OAKG;YACW,iBAAiB;IA6I/B;;;;;;;;;;;OAWG;YACW,wBAAwB;IAuGtC;;;;;OAKG;YACW,gBAAgB;IA4B9B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IA+C3B;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;IAW1B;;OAEG;IACH,OAAO,CAAC,0BAA0B;yCAxxFvB,qBAAqB;2CAArB,qBAAqB;CA8xFjC"}
@@ -1,8 +1,7 @@
1
1
  import { Component, Input, Output, EventEmitter, ViewChild } from '@angular/core';
2
2
  import { BaseAngularComponent } from '@memberjunction/ng-base-types';
3
- import { MJEnvironmentEntityExtended, ConversationEngine, UserInfoEngine } from '@memberjunction/core-entities';
3
+ import { MJEnvironmentEntityExtended, ConversationEngine, UserInfoEngine, TaskGraphSubmitOperation } from '@memberjunction/core-entities';
4
4
  import { BeforeAgentTurnEventArgs, AfterAgentTurnEventArgs } from '../../events/chat-events';
5
- import { GraphQLDataProvider } from '@memberjunction/graphql-dataprovider';
6
5
  import { GenerateAndApplyConversationName } from '../../services/conversation-naming';
7
6
  import { AIEngineBase } from '@memberjunction/ai-engine-base';
8
7
  import { ConversationUtility } from '@memberjunction/ai-core-plus';
@@ -1568,134 +1567,82 @@ export class MessageInputComponent extends BaseAngularComponent {
1568
1567
  }
1569
1568
  }
1570
1569
  }
1570
+ /** Detaches the progress callback for one message — used when submission never starts. */
1571
+ releaseProgressCallback(messageId) {
1572
+ const callback = this.registeredCallbacks.get(messageId);
1573
+ if (callback) {
1574
+ this.streamingService.unregisterMessageCallback(messageId, callback);
1575
+ this.registeredCallbacks.delete(messageId);
1576
+ }
1577
+ }
1571
1578
  /**
1572
- * Handle task graph execution based on Sage's payload
1573
- * Creates tasks and orchestrates their execution
1579
+ * Submits a task graph to the server and returns — the client no longer drives execution.
1580
+ *
1581
+ * This used to call the `ExecuteTaskGraph` mutation and await the ENTIRE workflow inside one
1582
+ * long-lived GraphQL request. That had three unfixable problems: a page reload lost the awaited
1583
+ * promise (leaving a workflow running with nobody watching), a server restart orphaned every
1584
+ * in-flight task, and no other channel could reach the substrate at all.
1585
+ *
1586
+ * Now submission returns as soon as the graph is durable and the server-side dispatcher executes
1587
+ * it. The client is purely an observer: progress arrives over the existing PubSub frames, and
1588
+ * because the work lives in Task rows rather than in a promise, a reload can re-attach to a
1589
+ * workflow already in flight.
1590
+ *
1591
+ * Single-task graphs are no longer special-cased here. The old client-side fork ran them through
1592
+ * a different code path entirely; they now submit like any other graph, and the decision about
1593
+ * whether a one-node graph is worth durable machinery moves server-side where it can be recorded.
1574
1594
  */
1575
1595
  async handleTaskGraphExecution(userMessage, managerResult, conversationId, conversationManagerMessage) {
1576
- const taskGraph = managerResult.payload.taskGraph;
1596
+ // `payload` is untyped by construction (an agent's payload shape is agent-specific), so pin the
1597
+ // graph to the operation's own input contract at the boundary rather than letting it stay loose.
1598
+ const taskGraph = managerResult.payload?.taskGraph;
1599
+ if (!taskGraph)
1600
+ return;
1577
1601
  const workflowName = taskGraph.workflowName || 'Workflow';
1578
1602
  const reasoning = taskGraph.reasoning || 'Executing multi-step workflow';
1579
- const taskCount = taskGraph.tasks?.length || 0;
1580
- // Deduplicate tasks by tempId (LLM sometimes returns duplicates)
1581
- const seenTempIds = new Set();
1582
- const uniqueTasks = taskGraph.tasks.filter((task) => {
1583
- if (seenTempIds.has(task.tempId)) {
1584
- console.warn(`⚠️ Duplicate tempId detected on client, filtering: ${task.tempId} (${task.name})`);
1585
- return false;
1586
- }
1587
- seenTempIds.add(task.tempId);
1588
- return true;
1589
- });
1590
- const uniqueTaskCount = uniqueTasks.length;
1591
- const isSingleTask = uniqueTaskCount === 1;
1592
- // If single task, use direct agent execution (existing pattern with great PubSub support)
1593
- if (isSingleTask) {
1594
- const task = uniqueTasks[0];
1595
- const agentName = task.agentName;
1596
- // Update CM message
1597
- const delegationMessage = `👉 Delegating to **${agentName}**`;
1598
- await this.updateConversationDetail(conversationManagerMessage, delegationMessage, 'Complete');
1599
- // Execute single agent directly using existing pattern
1600
- await this.handleSingleTaskExecution(userMessage, task, agentName, conversationId, conversationManagerMessage);
1601
- return;
1602
- }
1603
- // Multi-step workflow - use server-side task orchestration
1604
- console.log(`📋 Multi-step workflow detected (${uniqueTaskCount} tasks), using task orchestration`);
1605
- // Update CM message with task summary (use unique tasks only)
1606
- const taskSummary = uniqueTasks.map((t) => `• ${t.name}`).join('\n');
1607
- await this.updateConversationDetail(conversationManagerMessage, `📋 Setting up multi-step workflow...\n\n**${workflowName}**\n${taskSummary}`, 'Complete');
1608
- // Step 2: Create new ConversationDetail for task execution updates
1603
+ const taskCount = Array.isArray(taskGraph.tasks) ? taskGraph.tasks.length : 0;
1604
+ // A message the user can watch. Progress frames from the dispatcher land against this ID.
1609
1605
  const taskExecutionMessage = await this.dataCache.createConversationDetail(this.currentUser);
1610
1606
  taskExecutionMessage.ConversationID = conversationId;
1611
1607
  taskExecutionMessage.Role = 'AI';
1612
- taskExecutionMessage.Message = '⏳ Starting workflow execution...';
1613
- taskExecutionMessage.ParentID = conversationManagerMessage.ID; // Thread under delegation message
1608
+ taskExecutionMessage.Message = `⏳ **${workflowName}**\n\n${reasoning}\n\nSubmitting ${taskCount} task(s)…`;
1609
+ taskExecutionMessage.ParentID = conversationManagerMessage.ID;
1614
1610
  taskExecutionMessage.Status = 'In-Progress';
1615
1611
  taskExecutionMessage.HiddenToUser = false;
1616
- // No AgentID for now - this represents the task orchestration system
1617
1612
  await taskExecutionMessage.Save();
1618
1613
  this.messageSent.emit(taskExecutionMessage);
1619
- // Register for streaming updates via global streaming service
1620
1614
  const callback = this.createMessageProgressCallback(taskExecutionMessage.ID);
1621
1615
  this.registeredCallbacks.set(taskExecutionMessage.ID, callback);
1622
1616
  this.streamingService.registerMessageCallback(taskExecutionMessage.ID, callback);
1623
1617
  try {
1624
- // Get default environment ID (MJ standard environment used across all installations)
1625
- const environmentId = MJEnvironmentEntityExtended.DefaultEnvironmentID;
1626
- // Get session ID for PubSub subscriptions
1627
- const sessionId = GraphQLDataProvider.Instance.sessionId || '';
1628
- // Step 3: Call ExecuteTaskGraph mutation (links to taskExecutionMessage)
1629
- const mutation = `
1630
- mutation ExecuteTaskGraph($taskGraphJson: String!, $conversationDetailId: String!, $environmentId: String!, $sessionId: String!, $createNotifications: Boolean) {
1631
- ExecuteTaskGraph(
1632
- taskGraphJson: $taskGraphJson
1633
- conversationDetailId: $conversationDetailId
1634
- environmentId: $environmentId
1635
- sessionId: $sessionId
1636
- createNotifications: $createNotifications
1637
- ) {
1638
- success
1639
- errorMessage
1640
- results {
1641
- taskId
1642
- success
1643
- output
1644
- error
1645
- }
1646
- }
1647
- }
1648
- `;
1649
- const variables = {
1650
- taskGraphJson: JSON.stringify(taskGraph),
1651
- conversationDetailId: taskExecutionMessage.ID, // Link tasks to execution message, not CM message
1652
- environmentId: environmentId,
1653
- sessionId: sessionId,
1654
- createNotifications: true
1655
- };
1656
- const result = await GraphQLDataProvider.Instance.ExecuteGQL(mutation, variables);
1657
- // Step 4: Update task execution message with results
1658
- // ExecuteGQL returns data directly (not wrapped in {data, errors})
1659
- if (result?.ExecuteTaskGraph?.success) {
1660
- await this.updateConversationDetail(taskExecutionMessage, `✅ **${workflowName}** completed successfully`, 'Complete');
1618
+ // `TaskGraph.Submit` is a Remote Operation, not a bespoke mutation: the same call site is
1619
+ // reachable from MCP, an Action wrapper, and this UI. `Execute` marshals over the generic
1620
+ // `ExecuteRemoteOperation` transport, so there is no hand-written GraphQL document here.
1621
+ const result = await new TaskGraphSubmitOperation().Execute({
1622
+ spec: taskGraph,
1623
+ environmentID: MJEnvironmentEntityExtended.DefaultEnvironmentID,
1624
+ conversationDetailID: taskExecutionMessage.ID,
1625
+ });
1626
+ if (result.Success && result.Output?.success) {
1627
+ // Deliberately NOT "completed" — submission means the work is durable and running, and
1628
+ // claiming completion here is exactly the lie the old await-everything path told when it
1629
+ // returned early. The dispatcher's progress frames update this message as tasks finish.
1630
+ await this.updateConversationDetail(taskExecutionMessage, `▶️ **${workflowName}** started — ${taskCount} task(s) running.`, 'In-Progress');
1661
1631
  }
1662
1632
  else {
1663
- const errorMsg = result?.ExecuteTaskGraph?.errorMessage || 'Unknown error';
1664
- console.error('Task graph execution failed:', errorMsg);
1633
+ const errorMsg = result.Output?.errorMessage || result.ErrorMessage || 'Unknown error';
1634
+ console.error('Task graph submission rejected:', errorMsg);
1665
1635
  taskExecutionMessage.Error = errorMsg;
1666
- await this.updateConversationDetail(taskExecutionMessage, `❌ **${workflowName}** failed: ${errorMsg}`, 'Error');
1667
- }
1668
- // Trigger artifact reload for this message
1669
- // Artifacts were created on server during task execution and linked to this message
1670
- // This event triggers the parent component to reload artifacts from the database
1671
- this.emitArtifactReload(taskExecutionMessage);
1672
- // Unregister streaming callback (task complete)
1673
- const callback = this.registeredCallbacks.get(taskExecutionMessage.ID);
1674
- if (callback) {
1675
- this.streamingService.unregisterMessageCallback(taskExecutionMessage.ID, callback);
1676
- this.registeredCallbacks.delete(taskExecutionMessage.ID);
1677
- }
1678
- // Mark agent response message as complete (removes task from active tasks)
1679
- await this.updateConversationDetail(conversationManagerMessage, conversationManagerMessage.Message, 'Complete');
1680
- // Mark user message as complete
1681
- await this.updateConversationDetail(userMessage, userMessage.Message, 'Complete');
1636
+ await this.updateConversationDetail(taskExecutionMessage, `❌ **${workflowName}** rejected: ${errorMsg}`, 'Error');
1637
+ this.releaseProgressCallback(taskExecutionMessage.ID);
1638
+ }
1682
1639
  }
1683
1640
  catch (error) {
1684
- console.error('❌ Error executing task graph:', error);
1685
- taskExecutionMessage.Error = String(error);
1686
- await this.updateConversationDetail(taskExecutionMessage, `❌ **${workflowName}** - Error: ${String(error)}`, 'Error');
1687
- // Trigger artifact reload even on error - partial artifacts may have been created
1688
- this.emitArtifactReload(taskExecutionMessage);
1689
- // Unregister streaming callback (task failed)
1690
- const callback = this.registeredCallbacks.get(taskExecutionMessage.ID);
1691
- if (callback) {
1692
- this.streamingService.unregisterMessageCallback(taskExecutionMessage.ID, callback);
1693
- this.registeredCallbacks.delete(taskExecutionMessage.ID);
1694
- }
1695
- // Mark agent response message as complete (removes task from active tasks)
1696
- conversationManagerMessage.Error = String(error);
1697
- await this.updateConversationDetail(conversationManagerMessage, conversationManagerMessage.Message, 'Error');
1698
- await this.updateConversationDetail(userMessage, userMessage.Message, 'Complete');
1641
+ const msg = error instanceof Error ? error.message : String(error);
1642
+ console.error('Task graph submission failed:', error);
1643
+ taskExecutionMessage.Error = msg;
1644
+ await this.updateConversationDetail(taskExecutionMessage, `❌ **${workflowName}** failed to submit: ${msg}`, 'Error');
1645
+ this.releaseProgressCallback(taskExecutionMessage.ID);
1699
1646
  }
1700
1647
  }
1701
1648
  async updateConversationDetail(convoDetail, message, status, result) {
@@ -1801,76 +1748,6 @@ export class MessageInputComponent extends BaseAngularComponent {
1801
1748
  console.log(`📦 No previous payload found for agent ${agentId} after searching ${agentMessages.length} messages`);
1802
1749
  return { payload: null, artifactInfo: null };
1803
1750
  }
1804
- /**
1805
- * Handle single task execution from task graph using direct agent execution
1806
- * Uses the existing agent execution pattern with PubSub support
1807
- */
1808
- async handleSingleTaskExecution(userMessage, task, // Task definition from taskGraph
1809
- agentName, conversationId, conversationManagerMessage) {
1810
- try {
1811
- // Look up the agent
1812
- const agent = AIEngineBase.Instance.Agents.find(a => a.Name === agentName);
1813
- if (!agent) {
1814
- throw new Error(`Agent not found: ${agentName}`);
1815
- }
1816
- // Create AI response message for the agent execution
1817
- const agentResponseMessage = await this.dataCache.createConversationDetail(this.currentUser);
1818
- agentResponseMessage.ConversationID = conversationId;
1819
- agentResponseMessage.Role = 'AI';
1820
- agentResponseMessage.Message = '⏳ Starting...';
1821
- agentResponseMessage.ParentID = conversationManagerMessage.ID; // Thread under delegation
1822
- agentResponseMessage.Status = 'In-Progress';
1823
- agentResponseMessage.HiddenToUser = false;
1824
- agentResponseMessage.AgentID = agent.ID;
1825
- await agentResponseMessage.Save();
1826
- this.messageSent.emit(agentResponseMessage);
1827
- // Add to active tasks
1828
- const newTaskId = this.activeTasks.add({
1829
- agentName: agentName,
1830
- status: 'Starting...',
1831
- relatedMessageId: userMessage.ID,
1832
- conversationDetailId: agentResponseMessage.ID,
1833
- conversationId,
1834
- conversationName: this.conversationName
1835
- });
1836
- // Load previous payload if agent has been invoked before
1837
- const { payload: previousPayload, artifactInfo } = await this.loadPreviousPayloadForAgent(agent.ID);
1838
- // Merge Sage's task payload with previous agent payload (Sage's takes precedence)
1839
- const mergedPayload = previousPayload
1840
- ? { ...previousPayload, ...task.inputPayload }
1841
- : task.inputPayload;
1842
- // Invoke agent with merged payload
1843
- const agentResult = await this.agentService.invokeSubAgent(agentName, conversationId, userMessage, this.conversationHistory, task.description || task.name, agentResponseMessage.ID, mergedPayload, // Pass merged payload for continuity
1844
- this.createProgressCallback(agentResponseMessage, agentName), artifactInfo?.artifactId, artifactInfo?.versionId, undefined, // configurationPresetId not used in this path
1845
- this.appContext, // Embedder-supplied app/form context
1846
- this.PlanModeEnabled, // per-request Plan Mode toggle
1847
- this._pendingRequestedSkillIDs);
1848
- // Task will be removed automatically in markMessageComplete() when status changes to Complete/Error
1849
- // DO NOT remove here - allows UI to show task during entire execution
1850
- if (agentResult && agentResult.success) {
1851
- // Update message with result
1852
- await this.updateConversationDetail(agentResponseMessage, agentResult.agentRun?.Message || `✅ **${agentName}** completed`, 'Complete', agentResult);
1853
- // Server created artifacts - emit event to trigger UI reload
1854
- if (agentResult.payload && Object.keys(agentResult.payload).length > 0) {
1855
- this.emitArtifactReload(agentResponseMessage);
1856
- console.log('🎨 Server created artifact from single task execution');
1857
- this.messageSent.emit(agentResponseMessage);
1858
- }
1859
- }
1860
- else {
1861
- // Handle failure
1862
- const errorMsg = agentResult?.agentRun?.ErrorMessage || 'Agent execution failed';
1863
- agentResponseMessage.Error = errorMsg;
1864
- await this.updateConversationDetail(agentResponseMessage, `❌ **${agentName}** failed: ${errorMsg}`, 'Error');
1865
- }
1866
- // Mark user message as complete
1867
- await this.updateConversationDetail(userMessage, userMessage.Message, 'Complete');
1868
- }
1869
- catch (error) {
1870
- console.error('❌ Error in single task execution:', error);
1871
- await this.updateConversationDetail(userMessage, userMessage.Message, 'Complete');
1872
- }
1873
- }
1874
1751
  /**
1875
1752
  * Handle sub-agent invocation based on Sage's payload
1876
1753
  * Reuses the existing conversationManagerMessage to avoid creating multiple records