langchain_agentx_stream_ui 0.6.8 → 0.7.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/{AskUserQuestionToolBody-CutLY-dS.d.ts → AskUserQuestionToolBody-C6J742a2.d.ts} +2 -2
- package/dist/{MarkdownBlock-Hf-kcLh6.d.ts → MarkdownBlock-B_wNhCB4.d.ts} +1 -1
- package/dist/{chunk-GBY5DJ7L.js → chunk-4RIOBLGB.js} +1 -1
- package/dist/chunk-4RIOBLGB.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-VBUKRPEO.js → chunk-GGYJQYVR.js} +66 -35
- package/dist/chunk-GGYJQYVR.js.map +1 -0
- package/dist/{chunk-7XSQYG3X.js → chunk-GLUQUP3A.js} +215 -3
- package/dist/chunk-GLUQUP3A.js.map +1 -0
- package/dist/{chunk-B2NG5KGH.js → chunk-OV6UUIA3.js} +4 -4
- package/dist/chunk-OV6UUIA3.js.map +1 -0
- package/dist/{chunk-UBYOUDQE.js → chunk-RNBYZF6S.js} +81 -66
- package/dist/chunk-RNBYZF6S.js.map +1 -0
- package/dist/default.css +4 -0
- package/dist/index.d.ts +18 -14
- package/dist/index.js +83 -9
- package/dist/index.js.map +1 -1
- package/dist/{multi-session-t7dWsecW.d.ts → multi-session-Dzkwt9KF.d.ts} +8 -9
- package/dist/multi-session.d.ts +4 -4
- package/dist/multi-session.js +6 -6
- package/dist/{nodes-C2rGC3J7.d.ts → nodes-MpVB9C5d.d.ts} +2 -1
- package/dist/{sessionViewOptions-2Hv9BGeg.d.ts → sessionViewOptions-DeTrGjRM.d.ts} +1 -1
- package/dist/tools-presentation.d.ts +3 -3
- package/dist/tools-presentation.js +2 -2
- package/dist/tools.d.ts +5 -5
- package/dist/tools.js +4 -4
- package/dist/{types-kH4WQSM2.d.ts → types-SVtInovH.d.ts} +1 -1
- package/dist/virtual.d.ts +1 -1
- package/dist/virtual.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-6Z4ZF36Z.js.map +0 -1
- package/dist/chunk-7XSQYG3X.js.map +0 -1
- package/dist/chunk-B2NG5KGH.js.map +0 -1
- package/dist/chunk-GBY5DJ7L.js.map +0 -1
- package/dist/chunk-UBYOUDQE.js.map +0 -1
- package/dist/chunk-VBUKRPEO.js.map +0 -1
|
@@ -10,12 +10,18 @@ import {
|
|
|
10
10
|
SILENT_TASK_TOOL_NAMES,
|
|
11
11
|
SubagentTranscriptBlock,
|
|
12
12
|
Write,
|
|
13
|
+
classifyFinishErrorPresentation,
|
|
14
|
+
classifyToolCancelSoftKind,
|
|
13
15
|
coerceSubagentProgressEntries,
|
|
14
16
|
createDefaultToolRegistry,
|
|
15
17
|
extractLastToolInfoFromProgress,
|
|
18
|
+
extractToolCancelSignals,
|
|
16
19
|
formatExploreSummaryText,
|
|
17
|
-
formatThoughtDurationPrefix
|
|
18
|
-
|
|
20
|
+
formatThoughtDurationPrefix,
|
|
21
|
+
resolveHookStoppedMessage,
|
|
22
|
+
resolveInterruptDisplayText,
|
|
23
|
+
resolveToolCancelDisplayText
|
|
24
|
+
} from "./chunk-GLUQUP3A.js";
|
|
19
25
|
|
|
20
26
|
// src/types/tree.ts
|
|
21
27
|
function createEmptyTree() {
|
|
@@ -79,8 +85,8 @@ var DEFAULT_EVENT_TIERS = {
|
|
|
79
85
|
"hook-finished": "debug",
|
|
80
86
|
"api-retry": "debug",
|
|
81
87
|
"assistant-turn-superseded": "main",
|
|
82
|
-
|
|
83
|
-
"compact-
|
|
88
|
+
/** D-CMP-EVT-11:主可见(非仅 debug);淡提示 Conversation compacted */
|
|
89
|
+
"compact-boundary": "collapsed",
|
|
84
90
|
"task-started": "debug",
|
|
85
91
|
"task-progress": "debug",
|
|
86
92
|
"task-notification-enqueued": "debug",
|
|
@@ -295,7 +301,7 @@ function updateParallelAgentTextGate(tree) {
|
|
|
295
301
|
}
|
|
296
302
|
const allTerminal = ids.every((id) => {
|
|
297
303
|
const node = findAgentToolCallNodeByCallId(tree, id);
|
|
298
|
-
return node != null && (node.status === "done" || node.status === "failed");
|
|
304
|
+
return node != null && (node.status === "done" || node.status === "failed" || node.status === "cancelled");
|
|
299
305
|
});
|
|
300
306
|
if (allTerminal) {
|
|
301
307
|
return { ...tree, parallelAgentTextGateCallIds: null };
|
|
@@ -532,40 +538,6 @@ function formatModelRetryCategoryLabel(category) {
|
|
|
532
538
|
}
|
|
533
539
|
}
|
|
534
540
|
|
|
535
|
-
// src/core/finishCancel.ts
|
|
536
|
-
var DEFAULT_DISPLAY_INTERRUPT_TEXT = "[Request interrupted by user]";
|
|
537
|
-
var USER_CANCEL_TERMINAL_REASONS = /* @__PURE__ */ new Set([
|
|
538
|
-
"aborted_streaming",
|
|
539
|
-
"aborted_tools"
|
|
540
|
-
]);
|
|
541
|
-
function isUserCancelledFinish(data) {
|
|
542
|
-
if (data.error_kind === "hook_stopped") return false;
|
|
543
|
-
if (data.error_kind === "user_cancelled") return true;
|
|
544
|
-
const reason = typeof data.terminal_reason === "string" ? data.terminal_reason : "";
|
|
545
|
-
if (USER_CANCEL_TERMINAL_REASONS.has(reason)) return true;
|
|
546
|
-
return false;
|
|
547
|
-
}
|
|
548
|
-
function isHookStoppedFinish(data) {
|
|
549
|
-
return data.error_kind === "hook_stopped";
|
|
550
|
-
}
|
|
551
|
-
function classifyFinishErrorPresentation(data) {
|
|
552
|
-
if (isHookStoppedFinish(data)) return "hook_stopped";
|
|
553
|
-
if (isUserCancelledFinish(data)) return "interrupt";
|
|
554
|
-
return "error";
|
|
555
|
-
}
|
|
556
|
-
function resolveInterruptDisplayText(data) {
|
|
557
|
-
if (typeof data.display_interrupt_text === "string" && data.display_interrupt_text.trim()) {
|
|
558
|
-
return data.display_interrupt_text.trim();
|
|
559
|
-
}
|
|
560
|
-
return DEFAULT_DISPLAY_INTERRUPT_TEXT;
|
|
561
|
-
}
|
|
562
|
-
function resolveHookStoppedMessage(data) {
|
|
563
|
-
if (Array.isArray(data.errors) && data.errors.length > 0) {
|
|
564
|
-
return data.errors.map(String).join("\n");
|
|
565
|
-
}
|
|
566
|
-
return "Stopped by hook";
|
|
567
|
-
}
|
|
568
|
-
|
|
569
541
|
// src/core/taskNotification.ts
|
|
570
542
|
function trimStr(value) {
|
|
571
543
|
return typeof value === "string" ? value.trim() : "";
|
|
@@ -1090,6 +1062,7 @@ function flushDeferredMainTextToTree(tree, event, seq) {
|
|
|
1090
1062
|
const text = flushDeferredMainText(tree.deferredMainText);
|
|
1091
1063
|
tree.deferredMainText = "";
|
|
1092
1064
|
if (!text) return;
|
|
1065
|
+
clearModelRetry(tree);
|
|
1093
1066
|
const id = `text:defer-${seq}`;
|
|
1094
1067
|
const node = {
|
|
1095
1068
|
kind: "text",
|
|
@@ -1351,22 +1324,47 @@ function handleToolResult(tree, event, seq) {
|
|
|
1351
1324
|
}
|
|
1352
1325
|
function handleToolError(tree, event, seq) {
|
|
1353
1326
|
const id = toolNodeId(tree, event);
|
|
1354
|
-
const
|
|
1327
|
+
const raw = event.data ?? {};
|
|
1355
1328
|
const existing = tree.byId[id];
|
|
1356
|
-
const toolName = resolveToolName(event,
|
|
1357
|
-
const dataRecord =
|
|
1329
|
+
const toolName = resolveToolName(event, raw, existing);
|
|
1330
|
+
const dataRecord = raw;
|
|
1358
1331
|
const isSubagentLeak = resolveSubagentToolLeak(tree, dataRecord, toolName, existing);
|
|
1359
1332
|
const isHidden = isInternalTool(toolName) || existing?.hidden === true || isSubagentLeak;
|
|
1360
|
-
const
|
|
1333
|
+
const cancelSignals = extractToolCancelSignals(raw);
|
|
1334
|
+
const softKind = classifyToolCancelSoftKind(cancelSignals);
|
|
1335
|
+
const cancelled = softKind != null;
|
|
1336
|
+
const message = cancelSignals.message || typeof raw.message === "string" && raw.message || typeof raw.error === "string" && raw.error || "Unknown error";
|
|
1337
|
+
const errType = cancelSignals.error_type || cancelSignals.type || (typeof raw.type === "string" ? raw.type : void 0);
|
|
1338
|
+
const failedResult = cancelled ? {
|
|
1339
|
+
schema_version: "2",
|
|
1340
|
+
status: "error",
|
|
1341
|
+
summary: resolveToolCancelDisplayText(softKind),
|
|
1342
|
+
payload: cancelSignals.payload ?? message,
|
|
1343
|
+
blocks: [],
|
|
1344
|
+
artifacts: [],
|
|
1345
|
+
hints: null,
|
|
1346
|
+
meta: {
|
|
1347
|
+
error_kind: cancelSignals.error_kind ?? (softKind === "canceled" ? "user_cancelled" : "aborted"),
|
|
1348
|
+
terminal_state: "cancelled",
|
|
1349
|
+
cancel_ui_kind: softKind
|
|
1350
|
+
},
|
|
1351
|
+
// 保留 type=cancelled,供 AgentToolBody / finalize 识别;文案用 soft Interrupted
|
|
1352
|
+
error: {
|
|
1353
|
+
message: resolveToolCancelDisplayText(softKind),
|
|
1354
|
+
type: "cancelled"
|
|
1355
|
+
},
|
|
1356
|
+
truncated: false,
|
|
1357
|
+
overflow_file: null
|
|
1358
|
+
} : {
|
|
1361
1359
|
schema_version: "1",
|
|
1362
1360
|
status: "failed",
|
|
1363
|
-
summary:
|
|
1361
|
+
summary: message,
|
|
1364
1362
|
payload: null,
|
|
1365
1363
|
blocks: [],
|
|
1366
1364
|
artifacts: [],
|
|
1367
1365
|
hints: null,
|
|
1368
1366
|
meta: null,
|
|
1369
|
-
error: { message
|
|
1367
|
+
error: { message, type: errType },
|
|
1370
1368
|
truncated: false,
|
|
1371
1369
|
overflow_file: null
|
|
1372
1370
|
};
|
|
@@ -1375,7 +1373,7 @@ function handleToolError(tree, event, seq) {
|
|
|
1375
1373
|
id,
|
|
1376
1374
|
event,
|
|
1377
1375
|
{
|
|
1378
|
-
status: "failed",
|
|
1376
|
+
status: cancelled ? "cancelled" : "failed",
|
|
1379
1377
|
endedAt: eventTimeToMs(event.timestamp),
|
|
1380
1378
|
result: failedResult,
|
|
1381
1379
|
hidden: isHidden || void 0
|
|
@@ -1609,12 +1607,20 @@ function attachDebugToParent(tree, parentNodeId, event) {
|
|
|
1609
1607
|
}
|
|
1610
1608
|
var SYSTEM_SUMMARY_SOURCE_EVENTS = /* @__PURE__ */ new Set([
|
|
1611
1609
|
"hook-finished",
|
|
1612
|
-
"compact-
|
|
1613
|
-
"compact-end"
|
|
1610
|
+
"compact-boundary"
|
|
1614
1611
|
]);
|
|
1615
1612
|
function isSystemSummarySourceEvent(eventType) {
|
|
1616
1613
|
return SYSTEM_SUMMARY_SOURCE_EVENTS.has(eventType);
|
|
1617
1614
|
}
|
|
1615
|
+
function pushSystemSummarySource(tree, event, eventIndex) {
|
|
1616
|
+
if (!isSystemSummarySourceEvent(event.event_type)) return;
|
|
1617
|
+
tree.systemEvents.push({
|
|
1618
|
+
eventIndex,
|
|
1619
|
+
eventType: event.event_type,
|
|
1620
|
+
data: event.data,
|
|
1621
|
+
timestamp: eventTimeToMs(event.timestamp)
|
|
1622
|
+
});
|
|
1623
|
+
}
|
|
1618
1624
|
function handleDebug(tree, event, eventIndex, parentNodeId, collectDebug) {
|
|
1619
1625
|
if (TASK_DEBUG_EVENT_TYPES.has(event.event_type)) {
|
|
1620
1626
|
appendTaskDebugEvent(tree, event, eventIndex);
|
|
@@ -1630,14 +1636,7 @@ function handleDebug(tree, event, eventIndex, parentNodeId, collectDebug) {
|
|
|
1630
1636
|
handleHookFinished(tree, event);
|
|
1631
1637
|
break;
|
|
1632
1638
|
}
|
|
1633
|
-
|
|
1634
|
-
tree.systemEvents.push({
|
|
1635
|
-
eventIndex,
|
|
1636
|
-
eventType: event.event_type,
|
|
1637
|
-
data: event.data,
|
|
1638
|
-
timestamp: eventTimeToMs(event.timestamp)
|
|
1639
|
-
});
|
|
1640
|
-
}
|
|
1639
|
+
pushSystemSummarySource(tree, event, eventIndex);
|
|
1641
1640
|
if (collectDebug && !TASK_DEBUG_EVENT_TYPES.has(event.event_type)) {
|
|
1642
1641
|
tree.debugEvents.push({
|
|
1643
1642
|
eventIndex,
|
|
@@ -1779,6 +1778,17 @@ function applyClassified(tree, classified, eventIndex, options) {
|
|
|
1779
1778
|
case "task-notification":
|
|
1780
1779
|
handleTaskNotification(tree, event);
|
|
1781
1780
|
break;
|
|
1781
|
+
case "compact-boundary":
|
|
1782
|
+
pushSystemSummarySource(tree, event, eventIndex);
|
|
1783
|
+
if (options?.collectDebug === true) {
|
|
1784
|
+
tree.debugEvents.push({
|
|
1785
|
+
eventIndex,
|
|
1786
|
+
eventType: event.event_type,
|
|
1787
|
+
data: event.data
|
|
1788
|
+
});
|
|
1789
|
+
}
|
|
1790
|
+
attachDebugToParent(tree, parentNodeId, event);
|
|
1791
|
+
break;
|
|
1782
1792
|
case "start-step":
|
|
1783
1793
|
handleStepStart(tree, event, parentNodeId, seq);
|
|
1784
1794
|
break;
|
|
@@ -1859,13 +1869,18 @@ function applyClassified(tree, classified, eventIndex, options) {
|
|
|
1859
1869
|
case "error": {
|
|
1860
1870
|
const data = event.data;
|
|
1861
1871
|
const { message, type } = resolveErrorEventFields(data);
|
|
1872
|
+
const softKind = classifyToolCancelSoftKind(
|
|
1873
|
+
extractToolCancelSignals(data)
|
|
1874
|
+
);
|
|
1875
|
+
clearModelRetry(tree);
|
|
1862
1876
|
const id = `error:${seq}`;
|
|
1863
1877
|
const node = {
|
|
1864
1878
|
kind: "error",
|
|
1865
1879
|
id,
|
|
1866
|
-
message,
|
|
1867
|
-
errorType: type,
|
|
1868
|
-
startedAt: eventTimeToMs(event.timestamp)
|
|
1880
|
+
message: softKind ? resolveToolCancelDisplayText(softKind) : message,
|
|
1881
|
+
errorType: softKind ? "cancelled" : type,
|
|
1882
|
+
startedAt: eventTimeToMs(event.timestamp),
|
|
1883
|
+
...softKind ? { variant: "interrupt" } : {}
|
|
1869
1884
|
};
|
|
1870
1885
|
tree.byId[id] = node;
|
|
1871
1886
|
appendMainStageChild(tree, id, event, seq);
|
|
@@ -2694,6 +2709,8 @@ function formatSystemEventSummary(eventType, data) {
|
|
|
2694
2709
|
switch (eventType) {
|
|
2695
2710
|
case "hook-finished":
|
|
2696
2711
|
return formatHookFinishedSummary(payload);
|
|
2712
|
+
case "compact-boundary":
|
|
2713
|
+
return "Conversation compacted";
|
|
2697
2714
|
default:
|
|
2698
2715
|
return null;
|
|
2699
2716
|
}
|
|
@@ -2708,9 +2725,6 @@ function mergeSystemSummaryLines(lines) {
|
|
|
2708
2725
|
function summarizeSystemEvents(events) {
|
|
2709
2726
|
const lines = [];
|
|
2710
2727
|
for (const evt of events) {
|
|
2711
|
-
if (evt.eventType === "compact-start" || evt.eventType === "compact-end") {
|
|
2712
|
-
continue;
|
|
2713
|
-
}
|
|
2714
2728
|
if (evt.eventType === "hook-finished" && isRecord3(evt.data) && !isHookVisibleInTimeline(evt.data)) {
|
|
2715
2729
|
continue;
|
|
2716
2730
|
}
|
|
@@ -2817,6 +2831,7 @@ var ExploreCollapseAccumulator = class {
|
|
|
2817
2831
|
continue;
|
|
2818
2832
|
}
|
|
2819
2833
|
if (entry.kind === "node" && entry.payload.canonicalType === "compact") {
|
|
2834
|
+
result.push(entry);
|
|
2820
2835
|
continue;
|
|
2821
2836
|
}
|
|
2822
2837
|
if (entry.kind === "node" && entry.payload.canonicalType === "hook") {
|
|
@@ -3270,10 +3285,10 @@ function toolUseEntry(entry) {
|
|
|
3270
3285
|
}
|
|
3271
3286
|
function isResolved(payload) {
|
|
3272
3287
|
const status = payload.status;
|
|
3273
|
-
return status === "done" || status === "failed";
|
|
3288
|
+
return status === "done" || status === "failed" || status === "cancelled";
|
|
3274
3289
|
}
|
|
3275
3290
|
function isErrored(payload) {
|
|
3276
|
-
return payload.status === "failed" || payload.is_error === true || payload.error != null;
|
|
3291
|
+
return (payload.status === "failed" || payload.is_error === true || payload.error != null) && payload.status !== "cancelled";
|
|
3277
3292
|
}
|
|
3278
3293
|
var GroupedToolUseAccumulator = class {
|
|
3279
3294
|
group(entries) {
|
|
@@ -3907,7 +3922,7 @@ function mapNode(node, pendingPermissionTools) {
|
|
|
3907
3922
|
}
|
|
3908
3923
|
function systemEventCanonicalType(eventType) {
|
|
3909
3924
|
if (eventType === "hook-finished") return "hook";
|
|
3910
|
-
if (eventType === "compact-
|
|
3925
|
+
if (eventType === "compact-boundary") return "compact";
|
|
3911
3926
|
return null;
|
|
3912
3927
|
}
|
|
3913
3928
|
function mapSystemEvent(evt) {
|
|
@@ -5902,4 +5917,4 @@ export {
|
|
|
5902
5917
|
VirtualTimeline,
|
|
5903
5918
|
SessionTimeline
|
|
5904
5919
|
};
|
|
5905
|
-
//# sourceMappingURL=chunk-
|
|
5920
|
+
//# sourceMappingURL=chunk-RNBYZF6S.js.map
|