langchain_agentx_stream_ui 0.2.5 → 0.2.6

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/default.css CHANGED
@@ -2050,6 +2050,24 @@
2050
2050
  --lax-workflow-indent: calc(var(--lax-workflow-depth, 0) * var(--lax-workflow-indent-unit, 1rem));
2051
2051
  }
2052
2052
 
2053
+ .lax-workflow-closeout-warning {
2054
+ margin: 0 0 0.75rem;
2055
+ padding: 0.65rem 0.85rem;
2056
+ border-radius: var(--lax-radius, 8px);
2057
+ border: 1px solid color-mix(in srgb, var(--lax-color-warning, #b8860b) 45%, transparent);
2058
+ background: var(--lax-bg-warning, #fdf8ec);
2059
+ color: color-mix(in srgb, var(--lax-color-warning, #b8860b) 85%, #000);
2060
+ font-size: 0.875rem;
2061
+ line-height: 1.45;
2062
+ }
2063
+
2064
+ .lax-workflow-closeout-warning__scopes {
2065
+ margin: 0.45rem 0 0 1.1rem;
2066
+ padding: 0;
2067
+ font-family: Consolas, monospace;
2068
+ font-size: 0.8125rem;
2069
+ }
2070
+
2053
2071
  .lax-workflow-chrome {
2054
2072
  display: flex;
2055
2073
  flex-direction: column;
@@ -2267,6 +2285,11 @@
2267
2285
  color: var(--lax-color-done, var(--lax-accent-primary));
2268
2286
  }
2269
2287
 
2288
+ .lax-workflow-container-line__status-dot[data-status='warning'],
2289
+ .lax-workflow-stage-container__status-dot[data-status='warning'] {
2290
+ color: var(--lax-color-warning, #b8860b);
2291
+ }
2292
+
2270
2293
  .lax-workflow-stage-container__status-dot[data-status='pending'] {
2271
2294
  color: var(--lax-muted);
2272
2295
  opacity: 0.5;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
3
  import { ReactNode, PointerEventHandler } from 'react';
4
- import { q as Source, L as LangchainAgentEvent, N as NodeRegistry, v as TierOverrides, I as InteractionBus, M as MarkdownRenderer, p as SessionTree, l as SessionStatus, R as ReducerError, r as SourceEventContext, T as Task, t as TaskPhase, E as EventTier } from './multi-session-Dxyo3y7w.js';
5
- export { C as CommonFields, D as DEFAULT_EVENT_TIERS, a as EventType, b as InteractionBusHandlers, c as MarkdownRendererProps, d as MultiAgentSession, e as MultiAgentSessionProps, f as MultiSessionSourceConfig, g as MultiSessionStore, h as MultiSessionStoreOptions, i as MultiSessionStoreState, j as NodeWidget, k as NodeWidgetProps, P as PermissionResolvePayload, S as SessionSlice, m as SessionStore, n as SessionStoreOptions, o as SessionStoreState, s as SourceHandler, u as TaskStatus, w as createActiveSessionBridge, x as createEmptyTree, y as createInteractionBus, z as createMultiSessionStore, A as createSessionStore, B as getNoopInteractionBus, F as useActiveSession, G as useSessionIds } from './multi-session-Dxyo3y7w.js';
4
+ import { q as Source, L as LangchainAgentEvent, N as NodeRegistry, v as TierOverrides, I as InteractionBus, M as MarkdownRenderer, p as SessionTree, l as SessionStatus, R as ReducerError, r as SourceEventContext, T as Task, t as TaskPhase, E as EventTier } from './multi-session-xvSZstSN.js';
5
+ export { C as CommonFields, D as DEFAULT_EVENT_TIERS, a as EventType, b as InteractionBusHandlers, c as MarkdownRendererProps, d as MultiAgentSession, e as MultiAgentSessionProps, f as MultiSessionSourceConfig, g as MultiSessionStore, h as MultiSessionStoreOptions, i as MultiSessionStoreState, j as NodeWidget, k as NodeWidgetProps, P as PermissionResolvePayload, S as SessionSlice, m as SessionStore, n as SessionStoreOptions, o as SessionStoreState, s as SourceHandler, u as TaskStatus, w as createActiveSessionBridge, x as createEmptyTree, y as createInteractionBus, z as createMultiSessionStore, A as createSessionStore, B as getNoopInteractionBus, F as useActiveSession, G as useSessionIds } from './multi-session-xvSZstSN.js';
6
6
  import { T as ToolDisplayRegistry, P as PermissionUiMode, b as DisplayMode, c as ProjectionContext, R as RenderableEntry, C as CanonicalNodeRef } from './sessionViewOptions-WM00Fpcn.js';
7
7
  export { a as CollapsedExplorePayload, D as DEFAULT_SESSION_VIEW_OPTIONS, S as SessionViewOptions, d as ToolUseSnapshot, e as buildProjectionContext, f as buildProjectionViewContext, g as createDefaultToolRegistry, h as createProjectionContext, r as resolveEffectiveToolBodyMode, s as shouldApplyGrouping, i as shouldShowExploreDetail } from './sessionViewOptions-WM00Fpcn.js';
8
8
  import { a as ToolBodyMode } from './types-BEXSHQG7.js';
@@ -240,6 +240,8 @@ declare function partitionWorkflowStages(stages: WorkflowContainerRuntimeNode[],
240
240
  * 不含合并 TaskListFooter(P3);parallel 结构仅基础字段。
241
241
  */
242
242
 
243
+ /** SDK v1.9.0 根 workflow 终态语义 SSOT */
244
+ type WorkflowTerminalKind = 'healthy' | 'forced_closeout' | 'failed';
243
245
  /** P2:stage 完成摘要缓存(loop 树淘汰后仍显示 teaser) */
244
246
  interface CachedStageDoneSummary {
245
247
  label: string;
@@ -277,6 +279,10 @@ interface WorkflowScopeFrame {
277
279
  }
278
280
  interface WorkflowSessionState {
279
281
  status: SessionStatus;
282
+ /** SDK v1.9.0 根终态语义;stream 推断 done 时为 null */
283
+ terminalKind: WorkflowTerminalKind | null;
284
+ /** forced_closeout 时 SDK 写入的未关闭 child scope */
285
+ openChildIdentities: string[];
280
286
  meta: {
281
287
  workflowRunId: string | null;
282
288
  startedAt: number | null;
@@ -1202,4 +1208,4 @@ interface ClassifyContext {
1202
1208
  declare function resolveEventTier(eventType: string, overrides?: TierOverrides): EventTier;
1203
1209
  declare function classifyEvent(event: LangchainAgentEvent, ctx: ClassifyContext, overrides?: TierOverrides, eventIndex?: number): ClassifiedEvent;
1204
1210
 
1205
- export { Agent, AgentLoopView, type AgentLoopViewProps, AgentSession, type AgentSessionProps, type AgentxMetaFrame, type AgentxSseSourceOptions, type ApplicationKind, ApplicationKindMismatchError, AskUserQuestion, BOUNDED_DEFAULTS, Bash, CanonicalNodeRef, type ClassifiedEvent, type ClassifyContext, CollapseKind, CollapsedExploreNode, type CollapsedExploreNodeProps, DEFAULT_WORKFLOW_SCALE_OPTIONS, type DiagramFitLayout, DiagramZoomShell, type DiagramZoomShellProps, DiagramZoomView, type DiagramZoomViewProps, DisplayMode, EXPECTED_PROTOCOL_VERSION, Edit, ErrorCard, EventTier, ExploreCollapseAccumulator, GROUPABLE_TOOL_NAMES, Glob, Grep, GroupedToolUseAccumulator, type HydrateLoopSessionAsyncOptions, InteractionBus, LangchainAgentEvent, MIN_HINT_DISPLAY_MS, MarkdownRenderer, MermaidDiagram, type MermaidDiagramProps, type MermaidInitOptions, type MermaidThemeName, MissingApplicationKindError, NodeRegistry, PROFILE_PRESETS, PermissionCard, PermissionUiMode, PlantUMLBlock, type PlantUMLBlockProps, PlantUMLDiagram, type PlantUMLDiagramProps, type ProjectedTimelineItem, ProjectionContext, DisplayMode as ProjectionDisplayMode, Read, ReasoningBubble, ReconnectBudget, type ReduceOptions, ReducerError, RenderableEntry, RenderableTimelineProjector, type ReplayOptions, type ReplaySourceOptions, RichMarkdown, type RichMarkdownProps, SHELL_PROGRESS_MIN_ELAPSED_SECONDS, SessionNode, SessionNodeKind, SessionStatus, SessionTree, Skill, Source, SourceEventContext, Spinner, type SpinnerProps, type SseReconnectMode, type SseReconnectPolicy, type SseReplayMode, type SseTerminalPolicy, type SseTransportFailureKind, type SseTransportPolicy, type SseTransportPolicyOverride, type SseTransportProfile, SseTransportTerminalError, StepCard, SubAgentBlock, SystemSummaryAccumulator, SystemSummaryNode, Task, TaskList, TaskListFooter, TextBubble, TierOverrides, Timeline, TimelineItem, ToolBodyMode, ToolCallCard, ToolDisplayRegistry, ToolProjectionClassifier, UnknownCard, WORKFLOW_STRUCTURE_EVENT_PREFIXES, WORKFLOW_STRUCTURE_EVENT_TYPES, WebFetch, WebSearch, WorkflowChrome, type WorkflowChromeProps, type WorkflowLoopReplayHandler, WorkflowLoopReplayProvider, type WorkflowProgressState, WorkflowScaleContext, type WorkflowScaleOptions, type WorkflowScopeFrame, WorkflowSession, type WorkflowSessionProps, type WorkflowSessionState, type WorkflowSessionStore, type WorkflowSessionStoreOptions, type WorkflowSessionStoreState, type WorkflowStageProgress, WorkflowTaskListFooter, Write, buildCanonicalFromTree, buildRelevantMemoriesCanonical, buildResumeStreamUrl, buildSystemEventCanonical, buildTimelineEntries, classifyEvent, commandAsHint, computeViewportFitTransform, configureMermaid, configurePlantumlServer, createAgentxSseSource, createDefaultRegistry, createEmptyWorkflowSessionState, createMockSource, createReplaySource, createWorkflowSessionStore, deriveLoopSessionIdFromAgentEvent, entryKey, filterAgentLoopReplayEvents, fixDiagramSvg, formatAgentTitle, formatExploreSummaryText, formatHookFinishedSummary, formatShellProgressSuffix, formatTaskFooterLabel, getChildIds, getMainStageIds, isAgentLoopReplayEventType, isGitOperationCommand, isGroupableToolName, isMcpToolName, isSseStreamTerminalEvent, isWorkflowStructureEventType, iterMountCandidates, partitionWorkflowStages, projectCanonical, projectTimeline, reduceAgentLoopEvent, reduceEvents, reduceTree, reduceWorkflowEvents, reduceWorkflowSession, replayEvents, replayTree, resolveEventTier, resolveResponseId, resolveShellProgressFromPayload, resolveSseTransportPolicy, shouldShowTaskListFooter, streamChunk, useChildren, useInteractionBus, useInternalErrors, useMinDisplayTime, useNode, useNodeTyped, useProjectedTimeline, useReplayTree, useSessionMeta, useSessionStatus, useTimeline, useWorkflowSessionStatus, useWorkflowSessionStoreApi };
1211
+ export { Agent, AgentLoopView, type AgentLoopViewProps, AgentSession, type AgentSessionProps, type AgentxMetaFrame, type AgentxSseSourceOptions, type ApplicationKind, ApplicationKindMismatchError, AskUserQuestion, BOUNDED_DEFAULTS, Bash, CanonicalNodeRef, type ClassifiedEvent, type ClassifyContext, CollapseKind, CollapsedExploreNode, type CollapsedExploreNodeProps, DEFAULT_WORKFLOW_SCALE_OPTIONS, type DiagramFitLayout, DiagramZoomShell, type DiagramZoomShellProps, DiagramZoomView, type DiagramZoomViewProps, DisplayMode, EXPECTED_PROTOCOL_VERSION, Edit, ErrorCard, EventTier, ExploreCollapseAccumulator, GROUPABLE_TOOL_NAMES, Glob, Grep, GroupedToolUseAccumulator, type HydrateLoopSessionAsyncOptions, InteractionBus, LangchainAgentEvent, MIN_HINT_DISPLAY_MS, MarkdownRenderer, MermaidDiagram, type MermaidDiagramProps, type MermaidInitOptions, type MermaidThemeName, MissingApplicationKindError, NodeRegistry, PROFILE_PRESETS, PermissionCard, PermissionUiMode, PlantUMLBlock, type PlantUMLBlockProps, PlantUMLDiagram, type PlantUMLDiagramProps, type ProjectedTimelineItem, ProjectionContext, DisplayMode as ProjectionDisplayMode, Read, ReasoningBubble, ReconnectBudget, type ReduceOptions, ReducerError, RenderableEntry, RenderableTimelineProjector, type ReplayOptions, type ReplaySourceOptions, RichMarkdown, type RichMarkdownProps, SHELL_PROGRESS_MIN_ELAPSED_SECONDS, SessionNode, SessionNodeKind, SessionStatus, SessionTree, Skill, Source, SourceEventContext, Spinner, type SpinnerProps, type SseReconnectMode, type SseReconnectPolicy, type SseReplayMode, type SseTerminalPolicy, type SseTransportFailureKind, type SseTransportPolicy, type SseTransportPolicyOverride, type SseTransportProfile, SseTransportTerminalError, StepCard, SubAgentBlock, SystemSummaryAccumulator, SystemSummaryNode, Task, TaskList, TaskListFooter, TextBubble, TierOverrides, Timeline, TimelineItem, ToolBodyMode, ToolCallCard, ToolDisplayRegistry, ToolProjectionClassifier, UnknownCard, WORKFLOW_STRUCTURE_EVENT_PREFIXES, WORKFLOW_STRUCTURE_EVENT_TYPES, WebFetch, WebSearch, WorkflowChrome, type WorkflowChromeProps, type WorkflowLoopReplayHandler, WorkflowLoopReplayProvider, type WorkflowProgressState, WorkflowScaleContext, type WorkflowScaleOptions, type WorkflowScopeFrame, WorkflowSession, type WorkflowSessionProps, type WorkflowSessionState, type WorkflowSessionStore, type WorkflowSessionStoreOptions, type WorkflowSessionStoreState, type WorkflowStageProgress, WorkflowTaskListFooter, type WorkflowTerminalKind, Write, buildCanonicalFromTree, buildRelevantMemoriesCanonical, buildResumeStreamUrl, buildSystemEventCanonical, buildTimelineEntries, classifyEvent, commandAsHint, computeViewportFitTransform, configureMermaid, configurePlantumlServer, createAgentxSseSource, createDefaultRegistry, createEmptyWorkflowSessionState, createMockSource, createReplaySource, createWorkflowSessionStore, deriveLoopSessionIdFromAgentEvent, entryKey, filterAgentLoopReplayEvents, fixDiagramSvg, formatAgentTitle, formatExploreSummaryText, formatHookFinishedSummary, formatShellProgressSuffix, formatTaskFooterLabel, getChildIds, getMainStageIds, isAgentLoopReplayEventType, isGitOperationCommand, isGroupableToolName, isMcpToolName, isSseStreamTerminalEvent, isWorkflowStructureEventType, iterMountCandidates, partitionWorkflowStages, projectCanonical, projectTimeline, reduceAgentLoopEvent, reduceEvents, reduceTree, reduceWorkflowEvents, reduceWorkflowSession, replayEvents, replayTree, resolveEventTier, resolveResponseId, resolveShellProgressFromPayload, resolveSseTransportPolicy, shouldShowTaskListFooter, streamChunk, useChildren, useInteractionBus, useInternalErrors, useMinDisplayTime, useNode, useNodeTyped, useProjectedTimeline, useReplayTree, useSessionMeta, useSessionStatus, useTimeline, useWorkflowSessionStatus, useWorkflowSessionStoreApi };
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  fixDiagramSvg,
24
24
  markEventIdSeen,
25
25
  shouldSkipDuplicateEvent
26
- } from "./chunk-AVSPJ252.js";
26
+ } from "./chunk-CUKNUCGU.js";
27
27
  import {
28
28
  DefaultToolBody,
29
29
  InteractionBusContext,
@@ -111,7 +111,7 @@ import {
111
111
  useSessionStatus,
112
112
  useSessionViewOptions,
113
113
  useTimeline
114
- } from "./chunk-D4BG3I7P.js";
114
+ } from "./chunk-SUEMZC4U.js";
115
115
  import {
116
116
  Agent,
117
117
  AgentToolBody,
@@ -942,6 +942,8 @@ function createEmptyWorkflowProgress() {
942
942
  function createEmptyWorkflowSessionState() {
943
943
  return {
944
944
  status: "connecting",
945
+ terminalKind: null,
946
+ openChildIdentities: [],
945
947
  meta: { workflowRunId: null, startedAt: null, lastEventId: null },
946
948
  containerTree: createEmptyWorkflowContainerTreeState(),
947
949
  workflowProgress: createEmptyWorkflowProgress(),
@@ -2106,6 +2108,38 @@ function readWorkflowId(data) {
2106
2108
  return readWorkflowIdFromData(data);
2107
2109
  }
2108
2110
 
2111
+ // src/core/workflow/workflowTerminalKind.ts
2112
+ function resolveWorkflowTerminalKind(data, eventType) {
2113
+ const raw = data.terminal_kind;
2114
+ if (raw === "healthy" || raw === "forced_closeout" || raw === "failed") {
2115
+ return raw;
2116
+ }
2117
+ if (data.closeout_forced === true) {
2118
+ return "forced_closeout";
2119
+ }
2120
+ if (eventType === "workflow-failed") {
2121
+ return "failed";
2122
+ }
2123
+ return "healthy";
2124
+ }
2125
+ function sessionStatusFromTerminalKind(kind, isWorkflowFailedEvent) {
2126
+ if (isWorkflowFailedEvent || kind === "failed") {
2127
+ return "error";
2128
+ }
2129
+ if (kind === "forced_closeout") {
2130
+ return "done_with_warning";
2131
+ }
2132
+ return "done";
2133
+ }
2134
+ function readOpenChildIdentities(data) {
2135
+ const raw = data.open_child_identities;
2136
+ if (!Array.isArray(raw)) return [];
2137
+ return raw.filter((item) => typeof item === "string");
2138
+ }
2139
+ function isWorkflowSessionTerminal(status) {
2140
+ return status === "done" || status === "done_with_warning" || status === "error";
2141
+ }
2142
+
2109
2143
  // src/core/workflowReducer.ts
2110
2144
  function readString5(data, key) {
2111
2145
  const value = data[key];
@@ -2479,9 +2513,25 @@ function applyStructureEvent(state, event) {
2479
2513
  if (workflowProgress.status === "done") status = "done";
2480
2514
  else if (workflowProgress.status === "error") status = "error";
2481
2515
  else if (status === "connecting") status = "running";
2516
+ let terminalKind = state.terminalKind;
2517
+ let openChildIdentities = state.openChildIdentities;
2518
+ if (projectedEvent.event_type === "workflow-end" || projectedEvent.event_type === "workflow-failed") {
2519
+ const resolved = resolveWorkflowTerminalKind(
2520
+ structureData,
2521
+ projectedEvent.event_type
2522
+ );
2523
+ status = sessionStatusFromTerminalKind(
2524
+ resolved,
2525
+ projectedEvent.event_type === "workflow-failed"
2526
+ );
2527
+ terminalKind = resolved;
2528
+ openChildIdentities = resolved === "forced_closeout" ? readOpenChildIdentities(structureData) : [];
2529
+ }
2482
2530
  const base = {
2483
2531
  ...nextState,
2484
2532
  status,
2533
+ terminalKind,
2534
+ openChildIdentities,
2485
2535
  containerTree,
2486
2536
  workflowProgress
2487
2537
  };
@@ -2566,7 +2616,7 @@ function reduceWorkflowSession(state, event, eventIndex, options) {
2566
2616
  };
2567
2617
  }
2568
2618
  function finalizeWorkflowSessionOnStreamComplete(state) {
2569
- if (state.status === "done" || state.status === "error") {
2619
+ if (isWorkflowSessionTerminal(state.status)) {
2570
2620
  return { ...state, activeLoopSessionId: null };
2571
2621
  }
2572
2622
  const tree = state.containerTree;
@@ -3148,7 +3198,10 @@ function mapContainerStatusLabel(status) {
3148
3198
  return "pending";
3149
3199
  }
3150
3200
  }
3151
- function mapWorkflowRootStatusLabel(status) {
3201
+ function mapWorkflowRootStatusLabel(status, sessionStatus) {
3202
+ if (sessionStatus === "done_with_warning" && status === "completed") {
3203
+ return "done (warning)";
3204
+ }
3152
3205
  switch (status) {
3153
3206
  case "completed":
3154
3207
  return "done";
@@ -3861,9 +3914,12 @@ function WorkflowRootContainer({
3861
3914
  containersById
3862
3915
  }) {
3863
3916
  const { verbose } = useSessionViewOptions();
3917
+ const sessionStatus = useWorkflowSessionStatus();
3864
3918
  const visuallyActive = containersById ? isWorkflowRootVisuallyActive(node, containersById) : node.status === "running" || node.status === "retrying";
3865
- const uiStatus = mapContainerUiStatus(visuallyActive ? "running" : node.status);
3866
- const statusLabel = mapWorkflowRootStatusLabel(visuallyActive ? "running" : node.status);
3919
+ const nodeStatus = visuallyActive ? "running" : node.status;
3920
+ const forcedCloseout = sessionStatus === "done_with_warning" && nodeStatus === "completed";
3921
+ const uiStatus = forcedCloseout ? "warning" : mapContainerUiStatus(nodeStatus);
3922
+ const statusLabel = mapWorkflowRootStatusLabel(nodeStatus, sessionStatus);
3867
3923
  const meta = containersById ? buildEffectiveWorkflowRootMeta(node, containersById) : buildWorkflowRootMeta(node);
3868
3924
  return /* @__PURE__ */ jsxs7("div", { className: "lax-workflow-root", "data-testid": "lax-workflow-root", children: [
3869
3925
  /* @__PURE__ */ jsx12(
@@ -4573,6 +4629,10 @@ function WorkflowSession({
4573
4629
  storeRef.current,
4574
4630
  (s) => s.state.loopTreesBySessionId
4575
4631
  );
4632
+ const openChildIdentities = useStore4(
4633
+ storeRef.current,
4634
+ (s) => s.state.openChildIdentities
4635
+ );
4576
4636
  const sessionStatus = useStore4(
4577
4637
  storeRef.current,
4578
4638
  (s) => s.state.status
@@ -4611,6 +4671,22 @@ function WorkflowSession({
4611
4671
  className: "lax-agent-session lax-workflow-session",
4612
4672
  "data-testid": "lax-workflow-session",
4613
4673
  children: [
4674
+ sessionStatus === "done_with_warning" ? /* @__PURE__ */ jsxs12(
4675
+ "div",
4676
+ {
4677
+ className: "lax-workflow-closeout-warning",
4678
+ "data-testid": "lax-workflow-closeout-warning",
4679
+ role: "status",
4680
+ children: [
4681
+ /* @__PURE__ */ jsx17("strong", { children: "Workflow forced closeout" }),
4682
+ /* @__PURE__ */ jsxs12("span", { children: [
4683
+ " ",
4684
+ "\u2014 stream ended with unresolved child scopes; not a healthy completion."
4685
+ ] }),
4686
+ openChildIdentities.length > 0 ? /* @__PURE__ */ jsx17("ul", { className: "lax-workflow-closeout-warning__scopes", children: openChildIdentities.map((identity) => /* @__PURE__ */ jsx17("li", { children: identity }, identity)) }) : null
4687
+ ]
4688
+ }
4689
+ ) : null,
4614
4690
  sessionStatus === "error" || internalErrors.length > 0 ? /* @__PURE__ */ jsx17(
4615
4691
  "div",
4616
4692
  {