langchain_agentx_stream_ui 0.3.4 → 0.3.7
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/{chunk-6ORA5RMV.js → chunk-24FLS4TF.js} +68 -6
- package/dist/chunk-24FLS4TF.js.map +1 -0
- package/dist/{chunk-GBY5DJ7L.js → chunk-4RIOBLGB.js} +1 -1
- package/dist/chunk-4RIOBLGB.js.map +1 -0
- package/dist/{chunk-ISQ7JWGD.js → chunk-7QYE5PN5.js} +5 -5
- package/dist/chunk-7QYE5PN5.js.map +1 -0
- package/dist/{chunk-6Z4ZF36Z.js → chunk-DP7V33X7.js} +1 -1
- package/dist/chunk-DP7V33X7.js.map +1 -0
- package/dist/{chunk-TCKOXX7O.js → chunk-MRGHYRSV.js} +4 -4
- package/dist/chunk-MRGHYRSV.js.map +1 -0
- package/dist/{chunk-FL2G7SV3.js → chunk-QL3DIGFI.js} +2 -2
- package/dist/chunk-QL3DIGFI.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +192 -100
- package/dist/index.js.map +1 -1
- package/dist/{multi-session-CerO558Y.d.ts → multi-session-CsPvSE9d.d.ts} +9 -3
- package/dist/multi-session.d.ts +1 -1
- package/dist/multi-session.js +6 -6
- package/dist/tools-presentation.js +2 -2
- package/dist/tools.js +4 -4
- package/dist/virtual.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-6ORA5RMV.js.map +0 -1
- package/dist/chunk-6Z4ZF36Z.js.map +0 -1
- package/dist/chunk-FL2G7SV3.js.map +0 -1
- package/dist/chunk-GBY5DJ7L.js.map +0 -1
- package/dist/chunk-ISQ7JWGD.js.map +0 -1
- package/dist/chunk-TCKOXX7O.js.map +0 -1
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
extractLastToolInfoFromProgress,
|
|
16
16
|
formatExploreSummaryText,
|
|
17
17
|
formatThoughtDurationPrefix
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-QL3DIGFI.js";
|
|
19
19
|
|
|
20
20
|
// src/types/tree.ts
|
|
21
21
|
function createEmptyTree() {
|
|
@@ -77,6 +77,8 @@ var DEFAULT_EVENT_TIERS = {
|
|
|
77
77
|
"subagent-model-step": "collapsed",
|
|
78
78
|
"hook-progress": "debug",
|
|
79
79
|
"hook-finished": "debug",
|
|
80
|
+
"api-retry": "debug",
|
|
81
|
+
"assistant-turn-superseded": "main",
|
|
80
82
|
"compact-start": "debug",
|
|
81
83
|
"compact-end": "debug",
|
|
82
84
|
"task-started": "debug",
|
|
@@ -483,23 +485,31 @@ function parseSnapshotTasks(rawTasks) {
|
|
|
483
485
|
}
|
|
484
486
|
|
|
485
487
|
// src/types/modelRetry.ts
|
|
486
|
-
function
|
|
487
|
-
if (data.name !== "model_retry") return null;
|
|
488
|
+
function parseModelRetryFields(data, timestampMs) {
|
|
488
489
|
const attempt = typeof data.attempt === "number" ? data.attempt : Number(data.attempt);
|
|
489
490
|
const maxRetries = typeof data.max_retries === "number" ? data.max_retries : Number(data.max_retries);
|
|
490
491
|
const retryDelayMs = typeof data.retry_delay_ms === "number" ? data.retry_delay_ms : Number(data.retry_delay_ms ?? 0);
|
|
491
492
|
if (!Number.isFinite(attempt) || !Number.isFinite(maxRetries)) return null;
|
|
493
|
+
const errorCategory = typeof data.error_category === "string" ? data.error_category : typeof data.error === "string" ? data.error : "api_error";
|
|
492
494
|
return {
|
|
493
495
|
attempt: Math.max(1, Math.floor(attempt)),
|
|
494
496
|
maxRetries: Math.max(1, Math.floor(maxRetries)),
|
|
495
497
|
retryDelayMs: Number.isFinite(retryDelayMs) ? Math.max(0, retryDelayMs) : 0,
|
|
496
|
-
errorCategory
|
|
498
|
+
errorCategory,
|
|
497
499
|
errorMessage: typeof data.error_message === "string" ? data.error_message : "",
|
|
498
500
|
errorStatus: typeof data.error_status === "number" ? data.error_status : data.error_status != null ? Number(data.error_status) : null,
|
|
499
501
|
phase: typeof data.phase === "string" ? data.phase : "scheduled",
|
|
500
502
|
updatedAt: timestampMs
|
|
501
503
|
};
|
|
502
504
|
}
|
|
505
|
+
function parseApiRetryEventData(data, timestampMs) {
|
|
506
|
+
if (data.subtype !== "api_retry") return null;
|
|
507
|
+
return parseModelRetryFields(data, timestampMs);
|
|
508
|
+
}
|
|
509
|
+
function parseModelRetryHookData(data, timestampMs) {
|
|
510
|
+
if (data.name !== "model_retry") return null;
|
|
511
|
+
return parseModelRetryFields(data, timestampMs);
|
|
512
|
+
}
|
|
503
513
|
function formatModelRetryCategoryLabel(category) {
|
|
504
514
|
switch (category) {
|
|
505
515
|
case "server_overload":
|
|
@@ -650,8 +660,14 @@ function streamChunk(data) {
|
|
|
650
660
|
function appendStreamChunk(current, data) {
|
|
651
661
|
return (current ?? "") + streamChunk(data);
|
|
652
662
|
}
|
|
663
|
+
function reactivateSessionIfIdle(tree) {
|
|
664
|
+
if (tree.status === "error") return;
|
|
665
|
+
if (tree.status !== "running" && tree.status !== "connecting") {
|
|
666
|
+
tree.status = "running";
|
|
667
|
+
}
|
|
668
|
+
}
|
|
653
669
|
function handleStart(tree, event) {
|
|
654
|
-
if (tree.status === "
|
|
670
|
+
if (tree.status === "error") {
|
|
655
671
|
return;
|
|
656
672
|
}
|
|
657
673
|
tree.status = "running";
|
|
@@ -781,6 +797,43 @@ function appendTaskDebugEvent(tree, event, eventIndex) {
|
|
|
781
797
|
data: event.data
|
|
782
798
|
});
|
|
783
799
|
}
|
|
800
|
+
function findLastMainStageTextNodeId(tree) {
|
|
801
|
+
const childIds = getActiveChildIds(tree);
|
|
802
|
+
for (let i = childIds.length - 1; i >= 0; i -= 1) {
|
|
803
|
+
const node = tree.byId[childIds[i]];
|
|
804
|
+
if (node?.kind === "text") {
|
|
805
|
+
return node.id;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
return void 0;
|
|
809
|
+
}
|
|
810
|
+
function removeMainStageTextNode(tree, nodeId) {
|
|
811
|
+
delete tree.byId[nodeId];
|
|
812
|
+
tree.rootChildren = tree.rootChildren.filter((id) => id !== nodeId);
|
|
813
|
+
}
|
|
814
|
+
function handleAssistantTurnSuperseded(tree) {
|
|
815
|
+
clearModelRetry(tree);
|
|
816
|
+
const hadDeferredPartial = Boolean(tree.deferredMainText);
|
|
817
|
+
tree.deferredMainText = "";
|
|
818
|
+
const streaming = findStreamingNode(tree, "text");
|
|
819
|
+
if (streaming) {
|
|
820
|
+
removeMainStageTextNode(tree, streaming.id);
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
if (!hadDeferredPartial) {
|
|
824
|
+
const lastTextId = findLastMainStageTextNodeId(tree);
|
|
825
|
+
if (lastTextId) {
|
|
826
|
+
removeMainStageTextNode(tree, lastTextId);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
function handleApiRetry(tree, event) {
|
|
831
|
+
const data = event.data;
|
|
832
|
+
const modelRetry = parseApiRetryEventData(data, eventTimeToMs(event.timestamp));
|
|
833
|
+
if (modelRetry) {
|
|
834
|
+
tree.modelRetry = modelRetry;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
784
837
|
function handleHookProgress(tree, event) {
|
|
785
838
|
const data = event.data;
|
|
786
839
|
const modelRetry = parseModelRetryHookData(data, eventTimeToMs(event.timestamp));
|
|
@@ -848,6 +901,7 @@ function flushDeferredMainTextToTree(tree, event, seq) {
|
|
|
848
901
|
appendMainStageChild(tree, id, event, seq);
|
|
849
902
|
}
|
|
850
903
|
function handleTextStart(tree, event, seq) {
|
|
904
|
+
reactivateSessionIfIdle(tree);
|
|
851
905
|
clearModelRetry(tree);
|
|
852
906
|
const id = `text:${seq}`;
|
|
853
907
|
const node = {
|
|
@@ -887,6 +941,7 @@ function handleTextEnd(tree, event) {
|
|
|
887
941
|
};
|
|
888
942
|
}
|
|
889
943
|
function handleReasoningStart(tree, event, seq) {
|
|
944
|
+
reactivateSessionIfIdle(tree);
|
|
890
945
|
const id = `reasoning:${seq}`;
|
|
891
946
|
const roundId = `round-${seq}`;
|
|
892
947
|
const node = {
|
|
@@ -1031,6 +1086,7 @@ function maybeSynthesizeLeakedToolProgress(tree, options, params) {
|
|
|
1031
1086
|
});
|
|
1032
1087
|
}
|
|
1033
1088
|
function handleToolCall(tree, event, seq, options) {
|
|
1089
|
+
reactivateSessionIfIdle(tree);
|
|
1034
1090
|
const id = toolNodeId(tree, event);
|
|
1035
1091
|
const data = event.data;
|
|
1036
1092
|
const existing = tree.byId[id];
|
|
@@ -1337,6 +1393,9 @@ function handleDebug(tree, event, eventIndex, parentNodeId, collectDebug) {
|
|
|
1337
1393
|
appendTaskDebugEvent(tree, event, eventIndex);
|
|
1338
1394
|
}
|
|
1339
1395
|
switch (event.event_type) {
|
|
1396
|
+
case "api-retry":
|
|
1397
|
+
handleApiRetry(tree, event);
|
|
1398
|
+
break;
|
|
1340
1399
|
case "hook-progress":
|
|
1341
1400
|
handleHookProgress(tree, event);
|
|
1342
1401
|
break;
|
|
@@ -1533,6 +1592,9 @@ function applyClassified(tree, classified, eventIndex, options) {
|
|
|
1533
1592
|
handleTextEnd(tree, event);
|
|
1534
1593
|
break;
|
|
1535
1594
|
}
|
|
1595
|
+
case "assistant-turn-superseded":
|
|
1596
|
+
handleAssistantTurnSuperseded(tree);
|
|
1597
|
+
break;
|
|
1536
1598
|
case "reasoning-start":
|
|
1537
1599
|
if (isDroppedByEmitterRoute(event.data)) break;
|
|
1538
1600
|
if (isSubagentScopedReasoningEvent(event.data)) break;
|
|
@@ -5498,4 +5560,4 @@ export {
|
|
|
5498
5560
|
VirtualTimeline,
|
|
5499
5561
|
SessionTimeline
|
|
5500
5562
|
};
|
|
5501
|
-
//# sourceMappingURL=chunk-
|
|
5563
|
+
//# sourceMappingURL=chunk-24FLS4TF.js.map
|