@memberjunction/ng-conversations 5.2.0 → 5.3.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.
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts +31 -5
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.js +165 -99
- package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
- package/dist/lib/components/message/message-input.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-input.component.js +20 -24
- package/dist/lib/components/message/message-input.component.js.map +1 -1
- package/dist/lib/components/message/message-list.component.d.ts.map +1 -1
- package/dist/lib/components/message/message-list.component.js +6 -2
- package/dist/lib/components/message/message-list.component.js.map +1 -1
- package/dist/lib/models/lazy-artifact-info.d.ts +32 -31
- package/dist/lib/models/lazy-artifact-info.d.ts.map +1 -1
- package/dist/lib/models/lazy-artifact-info.js +99 -75
- package/dist/lib/models/lazy-artifact-info.js.map +1 -1
- package/dist/lib/services/conversation-streaming.service.d.ts +6 -1
- package/dist/lib/services/conversation-streaming.service.d.ts.map +1 -1
- package/dist/lib/services/conversation-streaming.service.js +14 -9
- package/dist/lib/services/conversation-streaming.service.js.map +1 -1
- package/package.json +17 -17
|
@@ -289,11 +289,18 @@ export declare class ConversationChatAreaComponent implements OnInit, OnDestroy,
|
|
|
289
289
|
*/
|
|
290
290
|
private addAgentRunToMap;
|
|
291
291
|
/**
|
|
292
|
-
* Reload artifacts for a specific message ID
|
|
293
|
-
*
|
|
294
|
-
*
|
|
292
|
+
* Reload artifacts for a conversation, triggered by a specific message ID.
|
|
293
|
+
* Processes ALL messages in the conversation (not just the trigger message)
|
|
294
|
+
* so that artifacts from delegated sub-agent messages are also picked up.
|
|
295
|
+
* Called after an artifact is created to update the UI immediately.
|
|
296
|
+
* Invalidates and refreshes the conversation cache.
|
|
295
297
|
*/
|
|
296
298
|
private reloadArtifactsForMessage;
|
|
299
|
+
/**
|
|
300
|
+
* Update artifact maps for a single conversation detail row.
|
|
301
|
+
* Clears existing entries for the row and rebuilds from parsed data.
|
|
302
|
+
*/
|
|
303
|
+
private updateArtifactsForRow;
|
|
297
304
|
openProjectSelector(): void;
|
|
298
305
|
toggleMembersModal(): void;
|
|
299
306
|
viewArtifacts(): void;
|
|
@@ -309,6 +316,20 @@ export declare class ConversationChatAreaComponent implements OnInit, OnDestroy,
|
|
|
309
316
|
* Used for initial artifact count (doesn't change with toggle)
|
|
310
317
|
*/
|
|
311
318
|
private calculateUniqueArtifactCount;
|
|
319
|
+
/**
|
|
320
|
+
* Collect all currently known artifact IDs across all messages.
|
|
321
|
+
* Used as a "before" snapshot to detect newly created artifacts after a reload.
|
|
322
|
+
*/
|
|
323
|
+
private collectAllArtifactIds;
|
|
324
|
+
/**
|
|
325
|
+
* Auto-open the artifact panel for the most recent NEW artifact.
|
|
326
|
+
* Compares current artifacts against a pre-reload snapshot to find
|
|
327
|
+
* only artifacts that were just discovered (avoiding re-opening for old artifacts).
|
|
328
|
+
* Searches artifactsByDetailId directly rather than iterating this.messages,
|
|
329
|
+
* because reloadMessagesForActiveConversation can temporarily remove messages
|
|
330
|
+
* from this.messages during concurrent operations.
|
|
331
|
+
*/
|
|
332
|
+
private autoOpenNewArtifact;
|
|
312
333
|
/**
|
|
313
334
|
* Get the effective artifacts map based on showSystemArtifacts toggle
|
|
314
335
|
* Combines user-visible and system artifacts when toggle is on
|
|
@@ -485,8 +506,13 @@ export declare class ConversationChatAreaComponent implements OnInit, OnDestroy,
|
|
|
485
506
|
scrollToBottomNow(retryCount?: number): void;
|
|
486
507
|
scrollToBottomAnimate(): void;
|
|
487
508
|
/**
|
|
488
|
-
* Detect in-progress agent runs/tasks and reconnect to their streaming updates
|
|
489
|
-
* Called after loading a conversation to resume progress tracking
|
|
509
|
+
* Detect in-progress agent runs/tasks and reconnect to their streaming updates.
|
|
510
|
+
* Called after loading a conversation to resume progress tracking.
|
|
511
|
+
*
|
|
512
|
+
* Also handles the "timing gap" scenario: if an agent completed between the page
|
|
513
|
+
* refresh and the WebSocket reconnection, the completion PubSub event is lost.
|
|
514
|
+
* We catch this by comparing message status against the agent run status from
|
|
515
|
+
* the database — if the run is already complete, we handle the completion immediately.
|
|
490
516
|
*/
|
|
491
517
|
private detectAndReconnectToInProgressRuns;
|
|
492
518
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-chat-area.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/conversation/conversation-chat-area.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAkD,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC/K,OAAO,EAAE,QAAQ,EAA+B,YAAY,EAAe,MAAM,sBAAsB,CAAC;AACxG,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"conversation-chat-area.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/conversation/conversation-chat-area.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAkD,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC/K,OAAO,EAAE,QAAQ,EAA+B,YAAY,EAAe,MAAM,sBAAsB,CAAC;AACxG,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,YAAY,EAA0B,MAAM,+BAA+B,CAAC;AAC7K,OAAO,EAA2B,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAEnG,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,kB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E,iBAAiB,GAAG,IAAI;IAKnD,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAUpC,qBAAqB,CAAC,OAAO,EAAE,0BAA0B,GAAG,IAAI;IAiChE,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;IAKvC,wBAAwB,CAAC,KAAK,EAAE;QAAC,cAAc,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,GAAG,IAAI;IAQ/E;;OAEG;IACH,wBAAwB,CAAC,KAAK,EAAE;QAAC,IAAI,EAAE,cAAc,GAAG,YAAY,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAC,GAAG,IAAI;IAKxF;;OAEG;YACW,uBAAuB;IAmBrC;;OAEG;IACG,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAajE;;OAEG;IACH,yBAAyB,IAAI,IAAI;IAMjC;;OAEG;IACG,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAYvC,WAAW,IAAI,IAAI;IAkBnB,iBAAiB,CAAC,UAAU,GAAE,MAAU,GAAG,IAAI;IAoB/C,qBAAqB,IAAI,IAAI;IAO7B;;;;;;;;OAQG;YACW,kCAAkC;IAiChD;;;OAGG;YACW,+BAA+B;IAmD7C;;;OAGG;IACH,OAAO,CAAC,eAAe;IAavB;;OAEG;IACG,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAuB3C;;OAEG;IACH,sBAAsB,IAAI,IAAI;yCAxqEnB,6BAA6B;2CAA7B,6BAA6B;CAgrEzC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Component, Input, Output, EventEmitter, ViewChild, ViewChildren } from '@angular/core';
|
|
2
2
|
import { RunView, RunQuery, Metadata, CompositeKey, LogStatusEx } from '@memberjunction/core';
|
|
3
|
+
import { ArtifactMetadataEngine } from '@memberjunction/core-entities';
|
|
3
4
|
import { AIEngineBase } from '@memberjunction/ai-engine-base';
|
|
4
5
|
import { LazyArtifactInfo } from '../../models/lazy-artifact-info';
|
|
5
6
|
import { parseConversationDetailComplete } from '../../models/conversation-complete-query.model';
|
|
@@ -622,6 +623,10 @@ export class ConversationChatAreaComponent {
|
|
|
622
623
|
console.warn('⚠️ Mention autocomplete not initialized by workspace, initializing now...');
|
|
623
624
|
await this.mentionAutocompleteService.initialize(this.currentUser);
|
|
624
625
|
}
|
|
626
|
+
// Ensure ArtifactMetadataEngine is loaded so LazyArtifactInfo can
|
|
627
|
+
// resolve versions from its always-fresh in-memory cache.
|
|
628
|
+
// Config(false) is a no-op if already loaded by another component.
|
|
629
|
+
await ArtifactMetadataEngine.Instance.Config(false, this.currentUser);
|
|
625
630
|
// Initialize attachment support based on agent modalities
|
|
626
631
|
await this.initializeAttachmentSupport();
|
|
627
632
|
// Load saved artifact pane width
|
|
@@ -647,11 +652,11 @@ export class ConversationChatAreaComponent {
|
|
|
647
652
|
await this.handleMessageCompletion(message, event.agentRunId);
|
|
648
653
|
}
|
|
649
654
|
});
|
|
650
|
-
// Subscribe to polling-based agent state
|
|
651
|
-
//
|
|
652
|
-
//
|
|
653
|
-
//
|
|
654
|
-
//
|
|
655
|
+
// Subscribe to polling-based agent state as a secondary fallback for completion detection.
|
|
656
|
+
// The sessionId is persisted in localStorage and reused on refresh, so WebSocket events
|
|
657
|
+
// normally arrive correctly. However, there's a brief timing gap between page load and
|
|
658
|
+
// WebSocket reconnection where events can be lost. The catch-up check in
|
|
659
|
+
// detectAndReconnectToInProgressRuns() is the primary fallback; polling is the last resort.
|
|
655
660
|
this.agentStateService.activeAgents$
|
|
656
661
|
.pipe(takeUntil(this.destroy$))
|
|
657
662
|
.subscribe(async (agents) => {
|
|
@@ -1233,8 +1238,22 @@ export class ConversationChatAreaComponent {
|
|
|
1233
1238
|
ResultType: 'entity_object'
|
|
1234
1239
|
}, this.currentUser);
|
|
1235
1240
|
if (result.Success && result.Results && result.Results.length > 0) {
|
|
1236
|
-
//
|
|
1237
|
-
|
|
1241
|
+
// Merge DB results with existing client-side messages rather than replacing entirely.
|
|
1242
|
+
// This prevents dropping messages added client-side (e.g., by handleSubAgentInvocation)
|
|
1243
|
+
// that haven't appeared in the DB query results yet due to timing.
|
|
1244
|
+
const merged = new Map();
|
|
1245
|
+
// Add all DB messages (fresh data)
|
|
1246
|
+
for (const msg of result.Results) {
|
|
1247
|
+
merged.set(msg.ID, msg);
|
|
1248
|
+
}
|
|
1249
|
+
// Preserve client-side messages not yet in DB
|
|
1250
|
+
for (const msg of this.messages) {
|
|
1251
|
+
if (!merged.has(msg.ID)) {
|
|
1252
|
+
merged.set(msg.ID, msg);
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
this.messages = Array.from(merged.values())
|
|
1256
|
+
.sort((a, b) => (a.__mj_CreatedAt?.getTime() || 0) - (b.__mj_CreatedAt?.getTime() || 0));
|
|
1238
1257
|
// Find newly discovered messages (delegated agents)
|
|
1239
1258
|
const newMessages = result.Results.filter(m => !existingMessageIds.has(m.ID));
|
|
1240
1259
|
// Load agent runs for new messages so completion detector can reload artifacts
|
|
@@ -1269,6 +1288,8 @@ export class ConversationChatAreaComponent {
|
|
|
1269
1288
|
async handleMessageCompletion(message, _agentRunId) {
|
|
1270
1289
|
try {
|
|
1271
1290
|
LogStatusEx({ message: `🎉 Handling completion for message ${message.ID}`, verboseOnly: true });
|
|
1291
|
+
// Snapshot artifact IDs before reload to detect newly created artifacts
|
|
1292
|
+
const artifactIdsBefore = this.collectAllArtifactIds();
|
|
1272
1293
|
// Reload message from database to get final content and status
|
|
1273
1294
|
await message.Load(message.ID);
|
|
1274
1295
|
// Reload agent run to get final status, timestamps, and cost
|
|
@@ -1292,15 +1313,11 @@ export class ConversationChatAreaComponent {
|
|
|
1292
1313
|
this.inProgressMessageIds = [...this.messages
|
|
1293
1314
|
.filter(m => m.Status === 'In-Progress')
|
|
1294
1315
|
.map(m => m.ID)];
|
|
1295
|
-
// Auto-open artifact panel if
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
this.selectedArtifactId = artifactList[artifactList.length - 1].artifactId;
|
|
1301
|
-
this.showArtifactPanel = true;
|
|
1302
|
-
await this.loadArtifactPermissions(this.selectedArtifactId);
|
|
1303
|
-
}
|
|
1316
|
+
// Auto-open artifact panel if NEW artifacts were discovered (not just the triggering message).
|
|
1317
|
+
// When Sage delegates to a sub-agent (e.g., Skip), the artifact is on the sub-agent's
|
|
1318
|
+
// message, not Sage's. Checking only the triggering message would miss delegated artifacts.
|
|
1319
|
+
if (!this.showArtifactPanel) {
|
|
1320
|
+
await this.autoOpenNewArtifact(artifactIdsBefore);
|
|
1304
1321
|
}
|
|
1305
1322
|
// Remove task from ActiveTasksService (clears spinner in conversation list)
|
|
1306
1323
|
const task = this.activeTasks.getByConversationDetailId(message.ID);
|
|
@@ -1332,18 +1349,13 @@ export class ConversationChatAreaComponent {
|
|
|
1332
1349
|
if (event.agentResult?.agentRun?.ID) {
|
|
1333
1350
|
await this.addAgentRunToMap(event.message.ID, event.agentResult.agentRun.ID, true); // forceRefresh = true
|
|
1334
1351
|
}
|
|
1352
|
+
// Snapshot artifact IDs before reload to detect newly created artifacts
|
|
1353
|
+
const artifactIdsBefore = this.collectAllArtifactIds();
|
|
1335
1354
|
// Reload artifact mapping for this message to pick up newly created artifacts
|
|
1336
1355
|
await this.reloadArtifactsForMessage(event.message.ID);
|
|
1337
|
-
// Auto-open artifact panel if
|
|
1338
|
-
if (
|
|
1339
|
-
|
|
1340
|
-
if (artifactList && artifactList.length > 0) {
|
|
1341
|
-
// Show the LAST (most recent) artifact - uses display data, no lazy load needed
|
|
1342
|
-
this.selectedArtifactId = artifactList[artifactList.length - 1].artifactId;
|
|
1343
|
-
this.showArtifactPanel = true;
|
|
1344
|
-
// Load permissions for the new artifact
|
|
1345
|
-
await this.loadArtifactPermissions(this.selectedArtifactId);
|
|
1346
|
-
}
|
|
1356
|
+
// Auto-open artifact panel if NEW artifacts were discovered
|
|
1357
|
+
if (!this.showArtifactPanel) {
|
|
1358
|
+
await this.autoOpenNewArtifact(artifactIdsBefore);
|
|
1347
1359
|
}
|
|
1348
1360
|
// Force change detection to update the UI
|
|
1349
1361
|
this.cdr.detectChanges();
|
|
@@ -1386,9 +1398,11 @@ export class ConversationChatAreaComponent {
|
|
|
1386
1398
|
}
|
|
1387
1399
|
}
|
|
1388
1400
|
/**
|
|
1389
|
-
* Reload artifacts for a specific message ID
|
|
1390
|
-
*
|
|
1391
|
-
*
|
|
1401
|
+
* Reload artifacts for a conversation, triggered by a specific message ID.
|
|
1402
|
+
* Processes ALL messages in the conversation (not just the trigger message)
|
|
1403
|
+
* so that artifacts from delegated sub-agent messages are also picked up.
|
|
1404
|
+
* Called after an artifact is created to update the UI immediately.
|
|
1405
|
+
* Invalidates and refreshes the conversation cache.
|
|
1392
1406
|
*/
|
|
1393
1407
|
async reloadArtifactsForMessage(conversationDetailId) {
|
|
1394
1408
|
LogStatusEx({ message: `🔄 Reloading artifacts for message ${conversationDetailId}`, verboseOnly: true });
|
|
@@ -1417,48 +1431,60 @@ export class ConversationChatAreaComponent {
|
|
|
1417
1431
|
// Update cache with fresh data
|
|
1418
1432
|
const conversationData = result.Results;
|
|
1419
1433
|
this.conversationDataCache.set(detail.ConversationID, conversationData);
|
|
1420
|
-
//
|
|
1434
|
+
// Process ALL messages in the conversation to pick up artifacts from
|
|
1435
|
+
// delegated sub-agent messages (e.g., when Sage delegates to Skip,
|
|
1436
|
+
// the artifact is on Skip's message, not Sage's)
|
|
1421
1437
|
for (const row of conversationData) {
|
|
1422
|
-
|
|
1423
|
-
const parsed = parseConversationDetailComplete(row);
|
|
1424
|
-
// Clear existing artifacts for this detail and rebuild
|
|
1425
|
-
this.artifactsByDetailId.delete(conversationDetailId);
|
|
1426
|
-
this.systemArtifactsByDetailId.delete(conversationDetailId);
|
|
1427
|
-
if (parsed.artifacts.length > 0) {
|
|
1428
|
-
const artifactList = [];
|
|
1429
|
-
const systemArtifactList = [];
|
|
1430
|
-
for (const artifactData of parsed.artifacts) {
|
|
1431
|
-
const lazyInfo = new LazyArtifactInfo(artifactData, this.currentUser);
|
|
1432
|
-
// Separate system-only artifacts from user-visible artifacts
|
|
1433
|
-
if (artifactData.Visibility === 'System Only') {
|
|
1434
|
-
systemArtifactList.push(lazyInfo);
|
|
1435
|
-
}
|
|
1436
|
-
else {
|
|
1437
|
-
artifactList.push(lazyInfo);
|
|
1438
|
-
}
|
|
1439
|
-
LogStatusEx({ message: `✅ Loaded artifact ${artifactData.ArtifactID} v${artifactData.VersionNumber} for message ${conversationDetailId}`, verboseOnly: true });
|
|
1440
|
-
}
|
|
1441
|
-
// Add to appropriate maps
|
|
1442
|
-
if (artifactList.length > 0) {
|
|
1443
|
-
this.artifactsByDetailId.set(conversationDetailId, artifactList);
|
|
1444
|
-
}
|
|
1445
|
-
if (systemArtifactList.length > 0) {
|
|
1446
|
-
this.systemArtifactsByDetailId.set(conversationDetailId, systemArtifactList);
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
// Create new Map reference to trigger Angular change detection
|
|
1450
|
-
this.artifactsByDetailId = new Map(this.artifactsByDetailId);
|
|
1451
|
-
// Update artifact count
|
|
1452
|
-
this.artifactCount = this.calculateUniqueArtifactCount();
|
|
1453
|
-
this.updateArtifactCountDisplay();
|
|
1454
|
-
break; // Found and updated the target message
|
|
1455
|
-
}
|
|
1438
|
+
this.updateArtifactsForRow(row);
|
|
1456
1439
|
}
|
|
1440
|
+
// Create new Map reference to trigger Angular change detection
|
|
1441
|
+
this.artifactsByDetailId = new Map(this.artifactsByDetailId);
|
|
1442
|
+
this._combinedArtifactsMap = null; // Clear cache so effectiveArtifactsMap rebuilds
|
|
1443
|
+
// Update artifact count
|
|
1444
|
+
this.artifactCount = this.calculateUniqueArtifactCount();
|
|
1445
|
+
this.updateArtifactCountDisplay();
|
|
1457
1446
|
}
|
|
1458
1447
|
catch (error) {
|
|
1459
1448
|
console.error('Failed to reload artifacts for message:', error);
|
|
1460
1449
|
}
|
|
1461
1450
|
}
|
|
1451
|
+
/**
|
|
1452
|
+
* Update artifact maps for a single conversation detail row.
|
|
1453
|
+
* Clears existing entries for the row and rebuilds from parsed data.
|
|
1454
|
+
*/
|
|
1455
|
+
updateArtifactsForRow(row) {
|
|
1456
|
+
const rowId = row.ID;
|
|
1457
|
+
if (!rowId) {
|
|
1458
|
+
return;
|
|
1459
|
+
}
|
|
1460
|
+
const parsed = parseConversationDetailComplete(row);
|
|
1461
|
+
// Clear existing artifacts for this detail and rebuild
|
|
1462
|
+
this.artifactsByDetailId.delete(rowId);
|
|
1463
|
+
this.systemArtifactsByDetailId.delete(rowId);
|
|
1464
|
+
if (parsed.artifacts.length === 0) {
|
|
1465
|
+
return;
|
|
1466
|
+
}
|
|
1467
|
+
const artifactList = [];
|
|
1468
|
+
const systemArtifactList = [];
|
|
1469
|
+
for (const artifactData of parsed.artifacts) {
|
|
1470
|
+
const lazyInfo = new LazyArtifactInfo(artifactData, this.currentUser);
|
|
1471
|
+
// Separate system-only artifacts from user-visible artifacts
|
|
1472
|
+
if (artifactData.Visibility === 'System Only') {
|
|
1473
|
+
systemArtifactList.push(lazyInfo);
|
|
1474
|
+
}
|
|
1475
|
+
else {
|
|
1476
|
+
artifactList.push(lazyInfo);
|
|
1477
|
+
}
|
|
1478
|
+
LogStatusEx({ message: `✅ Loaded artifact ${artifactData.ArtifactID} v${artifactData.VersionNumber} for message ${rowId}`, verboseOnly: true });
|
|
1479
|
+
}
|
|
1480
|
+
// Add to appropriate maps
|
|
1481
|
+
if (artifactList.length > 0) {
|
|
1482
|
+
this.artifactsByDetailId.set(rowId, artifactList);
|
|
1483
|
+
}
|
|
1484
|
+
if (systemArtifactList.length > 0) {
|
|
1485
|
+
this.systemArtifactsByDetailId.set(rowId, systemArtifactList);
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1462
1488
|
openProjectSelector() {
|
|
1463
1489
|
this.showProjectSelector = true;
|
|
1464
1490
|
}
|
|
@@ -1496,6 +1522,39 @@ export class ConversationChatAreaComponent {
|
|
|
1496
1522
|
}
|
|
1497
1523
|
return uniqueArtifactIds.size;
|
|
1498
1524
|
}
|
|
1525
|
+
/**
|
|
1526
|
+
* Collect all currently known artifact IDs across all messages.
|
|
1527
|
+
* Used as a "before" snapshot to detect newly created artifacts after a reload.
|
|
1528
|
+
*/
|
|
1529
|
+
collectAllArtifactIds() {
|
|
1530
|
+
const ids = new Set();
|
|
1531
|
+
for (const artifactList of this.artifactsByDetailId.values()) {
|
|
1532
|
+
for (const info of artifactList) {
|
|
1533
|
+
ids.add(info.artifactId);
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
return ids;
|
|
1537
|
+
}
|
|
1538
|
+
/**
|
|
1539
|
+
* Auto-open the artifact panel for the most recent NEW artifact.
|
|
1540
|
+
* Compares current artifacts against a pre-reload snapshot to find
|
|
1541
|
+
* only artifacts that were just discovered (avoiding re-opening for old artifacts).
|
|
1542
|
+
* Searches artifactsByDetailId directly rather than iterating this.messages,
|
|
1543
|
+
* because reloadMessagesForActiveConversation can temporarily remove messages
|
|
1544
|
+
* from this.messages during concurrent operations.
|
|
1545
|
+
*/
|
|
1546
|
+
async autoOpenNewArtifact(artifactIdsBefore) {
|
|
1547
|
+
for (const [detailId, artifactList] of this.artifactsByDetailId) {
|
|
1548
|
+
const newArtifact = artifactList.find(a => !artifactIdsBefore.has(a.artifactId));
|
|
1549
|
+
if (newArtifact) {
|
|
1550
|
+
this.selectedArtifactId = newArtifact.artifactId;
|
|
1551
|
+
this.showArtifactPanel = true;
|
|
1552
|
+
await this.loadArtifactPermissions(newArtifact.artifactId);
|
|
1553
|
+
LogStatusEx({ message: `🎨 Auto-opening new artifact ${newArtifact.artifactId} from detail ${detailId}`, verboseOnly: true });
|
|
1554
|
+
return;
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1499
1558
|
/**
|
|
1500
1559
|
* Get the effective artifacts map based on showSystemArtifacts toggle
|
|
1501
1560
|
* Combines user-visible and system artifacts when toggle is on
|
|
@@ -1765,29 +1824,30 @@ export class ConversationChatAreaComponent {
|
|
|
1765
1824
|
this.cdr.detectChanges();
|
|
1766
1825
|
}
|
|
1767
1826
|
async onArtifactCreated(data) {
|
|
1768
|
-
//
|
|
1827
|
+
// Snapshot artifact IDs before reload to detect newly created artifacts
|
|
1828
|
+
const artifactIdsBefore = this.collectAllArtifactIds();
|
|
1829
|
+
// Reload artifacts to get full entities (processes ALL messages in the conversation)
|
|
1769
1830
|
await this.reloadArtifactsForMessage(data.conversationDetailId);
|
|
1770
|
-
const artifactList = this.artifactsByDetailId.get(data.conversationDetailId);
|
|
1771
1831
|
// Auto-open artifact panel if no artifact currently shown
|
|
1772
1832
|
if (!this.showArtifactPanel) {
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
// Load permissions for the new artifact
|
|
1778
|
-
await this.loadArtifactPermissions(this.selectedArtifactId);
|
|
1779
|
-
}
|
|
1833
|
+
// Use robust auto-open that checks ALL messages for new artifacts.
|
|
1834
|
+
// When a sub-agent (e.g., Skip) creates an artifact on a different ConversationDetail
|
|
1835
|
+
// than the one specified in the event, checking only data.conversationDetailId would miss it.
|
|
1836
|
+
await this.autoOpenNewArtifact(artifactIdsBefore);
|
|
1780
1837
|
}
|
|
1781
|
-
else if (this.selectedArtifactId
|
|
1838
|
+
else if (this.selectedArtifactId) {
|
|
1782
1839
|
// Panel is already open - check if new artifact is a new version of currently displayed artifact
|
|
1783
|
-
const
|
|
1784
|
-
if (
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1840
|
+
const artifactList = this.artifactsByDetailId.get(data.conversationDetailId);
|
|
1841
|
+
if (artifactList && artifactList.length > 0) {
|
|
1842
|
+
const currentArtifact = artifactList.find(a => a.artifactId === this.selectedArtifactId);
|
|
1843
|
+
if (currentArtifact) {
|
|
1844
|
+
// New version of the same artifact - refresh to show latest version
|
|
1845
|
+
const latestVersion = artifactList[artifactList.length - 1];
|
|
1846
|
+
this.artifactViewerRefresh$.next({
|
|
1847
|
+
artifactId: latestVersion.artifactId,
|
|
1848
|
+
versionNumber: latestVersion.versionNumber
|
|
1849
|
+
});
|
|
1850
|
+
}
|
|
1791
1851
|
}
|
|
1792
1852
|
}
|
|
1793
1853
|
// Force change detection to update the UI immediately
|
|
@@ -2152,32 +2212,38 @@ export class ConversationChatAreaComponent {
|
|
|
2152
2212
|
}
|
|
2153
2213
|
}
|
|
2154
2214
|
/**
|
|
2155
|
-
* Detect in-progress agent runs/tasks and reconnect to their streaming updates
|
|
2156
|
-
* Called after loading a conversation to resume progress tracking
|
|
2215
|
+
* Detect in-progress agent runs/tasks and reconnect to their streaming updates.
|
|
2216
|
+
* Called after loading a conversation to resume progress tracking.
|
|
2217
|
+
*
|
|
2218
|
+
* Also handles the "timing gap" scenario: if an agent completed between the page
|
|
2219
|
+
* refresh and the WebSocket reconnection, the completion PubSub event is lost.
|
|
2220
|
+
* We catch this by comparing message status against the agent run status from
|
|
2221
|
+
* the database — if the run is already complete, we handle the completion immediately.
|
|
2157
2222
|
*/
|
|
2158
2223
|
async detectAndReconnectToInProgressRuns(conversationId) {
|
|
2159
|
-
// Check for in-progress messages
|
|
2160
2224
|
const inProgressMessages = this.messages.filter(m => m.Status === 'In-Progress' && m.Role === 'AI');
|
|
2161
2225
|
if (inProgressMessages.length === 0) {
|
|
2162
2226
|
return;
|
|
2163
2227
|
}
|
|
2164
|
-
LogStatusEx({ message: `🔄 Found ${inProgressMessages.length} in-progress messages,
|
|
2165
|
-
|
|
2228
|
+
LogStatusEx({ message: `🔄 Found ${inProgressMessages.length} in-progress messages, checking status...`, verboseOnly: true });
|
|
2229
|
+
const completedStatuses = ['Completed', 'Failed', 'Error', 'Cancelled'];
|
|
2166
2230
|
for (const message of inProgressMessages) {
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2231
|
+
const agentRun = this.agentRunsByDetailId.get(message.ID);
|
|
2232
|
+
if (!agentRun) {
|
|
2233
|
+
// No agent run yet — fire-and-forget may not have created it.
|
|
2234
|
+
// Polling will pick this up once the server creates the run.
|
|
2235
|
+
LogStatusEx({ message: `⏳ No agent run found for in-progress message ${message.ID}, waiting for server...`, verboseOnly: true });
|
|
2236
|
+
continue;
|
|
2237
|
+
}
|
|
2238
|
+
if (completedStatuses.includes(agentRun.Status)) {
|
|
2239
|
+
// Agent completed during the WebSocket reconnection gap — handle now
|
|
2240
|
+
LogStatusEx({ message: `🔄 Agent run ${agentRun.ID} already completed (${agentRun.Status}) for message ${message.ID}, handling catch-up...`, verboseOnly: true });
|
|
2241
|
+
await this.handleMessageCompletion(message, agentRun.ID);
|
|
2242
|
+
}
|
|
2243
|
+
else {
|
|
2244
|
+
LogStatusEx({ message: `🔌 Agent run ${agentRun.ID} still ${agentRun.Status} for message ${message.ID}, WebSocket will receive updates`, verboseOnly: true });
|
|
2176
2245
|
}
|
|
2177
2246
|
}
|
|
2178
|
-
// Agent state service is already polling via startPolling() in onConversationChanged()
|
|
2179
|
-
// WebSocket subscription is already active via message-input component's subscribeToPushStatus()
|
|
2180
|
-
// Both will automatically receive updates for these in-progress runs
|
|
2181
2247
|
}
|
|
2182
2248
|
/**
|
|
2183
2249
|
* Handle pending artifact navigation from collection
|