langchain_agentx_stream_ui 0.1.2 → 0.1.8

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/index.d.ts CHANGED
@@ -1,18 +1,18 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
- import { ReactNode } 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-DAHwfTNb.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-DAHwfTNb.js';
6
- import { T as ToolDisplayRegistry, P as PermissionUiMode, b as DisplayMode, c as ProjectionContext, R as RenderableEntry, C as CanonicalNodeRef } from './sessionViewOptions-DLSFRQwZ.js';
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-DLSFRQwZ.js';
8
- import { a as ToolBodyMode } from './types-aXj5TYSP.js';
9
- export { T as ToolBodyComponent, b as ToolDisplayProps } from './types-aXj5TYSP.js';
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';
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
+ 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
+ import { a as ToolBodyMode } from './types-BEXSHQG7.js';
9
+ export { T as ToolBodyComponent, b as ToolDisplayProps } from './types-BEXSHQG7.js';
10
10
  import { StoreApi } from 'zustand/vanilla';
11
11
  export { DEFAULT_ESTIMATE_SIZE, DEFAULT_VIRTUALIZE_THRESHOLD, SessionTimeline, SessionTimelineProps, VirtualTimeline, VirtualTimelineProps } from './virtual.js';
12
- export { A as AgentToolBody, a as AskUserQuestionToolBody, B as BashToolBody, D as DefaultToolBody, E as EditToolBody, G as GlobToolBody, b as GrepToolBody, R as ReadToolBody, S as SkillToolBody, W as WebFetchToolBody, c as WebSearchToolBody, d as WriteToolBody, f as formatToolTitle, r as resolveToolBody } from './AskUserQuestionToolBody-CyuNy_k5.js';
13
- import { S as SessionNode, a as SessionNodeKind } from './nodes-DqhaBW7M.js';
14
- export { E as ErrorNode, N as NodeDetail, P as PermissionNode, R as ReasoningNode, b as StepDetail, c as StepNode, d as SubAgentNode, T as TextNode, g as ToolCallNode, U as UnknownNode } from './nodes-DqhaBW7M.js';
15
- export { B as BodyBlock, a as BodyBlockList, D as DiffView, M as MAX_PREVIEW_LINES, b as MarkdownBlock, T as TruncatedContent, c as buildBashBodyBlocks, d as displayPath, f as formatDiffFromStrings, e as formatPatternTitle, g as formatSearchResultBody, h as formatTimeoutFooter, p as parseDiffText, t as truncateCommand } from './MarkdownBlock-3iEW0Ubm.js';
12
+ export { A as AgentToolBody, a as AskUserQuestionToolBody, B as BashToolBody, D as DefaultToolBody, E as EditToolBody, G as GlobToolBody, b as GrepToolBody, R as ReadToolBody, S as SkillToolBody, W as WebFetchToolBody, c as WebSearchToolBody, d as WriteToolBody, f as formatToolTitle, r as resolveToolBody } from './AskUserQuestionToolBody-BG1StdvE.js';
13
+ import { S as SessionNode, a as SessionNodeKind } from './nodes-BcyPw6Fr.js';
14
+ export { E as ErrorNode, N as NodeDetail, P as PermissionNode, R as ReasoningNode, b as StepDetail, c as StepNode, d as SubAgentNode, T as TextNode, h as ToolCallNode, U as UnknownNode } from './nodes-BcyPw6Fr.js';
15
+ export { B as BodyBlock, a as BodyBlockList, D as DiffView, M as MAX_PREVIEW_LINES, b as MarkdownBlock, T as TruncatedContent, c as buildBashBodyBlocks, d as displayPath, f as formatDiffFromStrings, e as formatPatternTitle, g as formatSearchResultBody, h as formatTimeoutFooter, p as parseDiffText, t as truncateCommand } from './MarkdownBlock-CcXZ5nTm.js';
16
16
 
17
17
  interface AgentSessionProps {
18
18
  source: Source;
@@ -775,24 +775,25 @@ declare function formatAgentTitle(input: unknown, display: unknown): string;
775
775
  interface RichMarkdownProps {
776
776
  content: string;
777
777
  className?: string;
778
+ /** 流式未稳定后缀:diagram fence 暂以源码展示 */
779
+ deferDiagrams?: boolean;
778
780
  }
779
781
  /** Web 向富 Markdown(TextNode S1);含 Mermaid、GFM、代码高亮。 */
780
- declare function RichMarkdown({ content, className }: RichMarkdownProps): react_jsx_runtime.JSX.Element | null;
782
+ declare function RichMarkdown({ content, className, deferDiagrams, }: RichMarkdownProps): react_jsx_runtime.JSX.Element | null;
781
783
 
782
784
  interface MermaidDiagramProps {
783
785
  chart: string;
784
786
  className?: string;
785
- /** 画布内 svg-pan-zoom */
786
- zoomingEnabled?: boolean;
787
- /** 工具栏全屏与点击放大 */
788
787
  fullscreenEnabled?: boolean;
789
788
  }
790
- declare function MermaidDiagram({ chart, className, zoomingEnabled, fullscreenEnabled, }: MermaidDiagramProps): react_jsx_runtime.JSX.Element;
789
+ declare function MermaidDiagram({ chart, className, fullscreenEnabled, }: MermaidDiagramProps): react_jsx_runtime.JSX.Element;
791
790
 
792
791
  type MermaidThemeName = 'neutral' | 'default' | 'dark' | 'forest' | 'base';
793
792
  interface MermaidInitOptions {
794
793
  theme?: MermaidThemeName;
795
794
  maxTextSize?: number;
795
+ /** 仅 `theme: 'base'` 时生效;默认使用 MERMAID_LIGHT_THEME_VARIABLES */
796
+ themeVariables?: Record<string, string | number | boolean>;
796
797
  }
797
798
 
798
799
  /** 覆盖默认 mermaid 初始化(需在首次 render 前调用) */
@@ -808,10 +809,8 @@ declare function PlantUMLBlock({ content, className }: PlantUMLBlockProps): reac
808
809
  interface PlantUMLDiagramProps {
809
810
  content: string;
810
811
  className?: string;
811
- /** Kroki 或兼容渲染服务根 URL */
812
812
  serverUrl?: string;
813
813
  fullscreenEnabled?: boolean;
814
- /** 仅源码高亮,不请求渲染 */
815
814
  sourceOnly?: boolean;
816
815
  }
817
816
  declare function PlantUMLDiagram({ content, className, serverUrl, fullscreenEnabled, sourceOnly, }: PlantUMLDiagramProps): react_jsx_runtime.JSX.Element;
@@ -819,6 +818,53 @@ declare function PlantUMLDiagram({ content, className, serverUrl, fullscreenEnab
819
818
  /** 配置 PlantUML 渲染服务(默认 Kroki:https://kroki.io) */
820
819
  declare function configurePlantumlServer(url: string): void;
821
820
 
821
+ interface DiagramZoomViewProps {
822
+ fixedSvg: string;
823
+ contentHash: string;
824
+ title: string;
825
+ fullscreenEnabled?: boolean;
826
+ className?: string;
827
+ }
828
+ declare function DiagramZoomView({ fixedSvg, contentHash, title, fullscreenEnabled, className, }: DiagramZoomViewProps): react_jsx_runtime.JSX.Element;
829
+
830
+ /** natural:内嵌自然高度;fill:全屏/固定视口 fit */
831
+ type DiagramFitLayout = 'natural' | 'fill';
832
+ interface ViewportFitTransform {
833
+ x: number;
834
+ y: number;
835
+ scale: number;
836
+ }
837
+ interface ViewportFitOptions {
838
+ layout?: DiagramFitLayout;
839
+ padding?: number;
840
+ /** fill 模式:小图放大上限;natural 固定为 1 */
841
+ maxScale?: number;
842
+ }
843
+ /**
844
+ * natural:CSS max-width:100% 适配框宽,rzpp 恒等变换
845
+ * fill:等比缩放进容器并居中
846
+ */
847
+ declare function computeViewportFitTransform(container: HTMLElement, svg: SVGSVGElement, options?: ViewportFitOptions): ViewportFitTransform;
848
+
849
+ interface DiagramZoomShellProps {
850
+ fixedSvg: string;
851
+ contentHash: string;
852
+ className?: string;
853
+ layout?: DiagramFitLayout;
854
+ viewportPointerHandlers?: {
855
+ onPointerDown?: PointerEventHandler<HTMLDivElement>;
856
+ onPointerMove?: PointerEventHandler<HTMLDivElement>;
857
+ onPointerUp?: PointerEventHandler<HTMLDivElement>;
858
+ onPointerCancel?: PointerEventHandler<HTMLDivElement>;
859
+ };
860
+ toolbarExtra?: ReactNode;
861
+ }
862
+ /** react-zoom-pan-pinch@3.6.1 — 内嵌 natural / 全屏 fill */
863
+ declare function DiagramZoomShell({ fixedSvg, contentHash, className, layout, viewportPointerHandlers, toolbarExtra, }: DiagramZoomShellProps): react_jsx_runtime.JSX.Element;
864
+
865
+ /** Mermaid / PlantUML:禁用 SVG 命中,并规范化百分比宽高(避免 fit 把 100% 当成 100px) */
866
+ declare function fixDiagramSvg(svg: string): string;
867
+
822
868
  /**
823
869
  * toolNames.ts — CC PascalCase 工具名 SSOT(对齐 SDK registry_names.py)
824
870
  *
@@ -1024,20 +1070,21 @@ declare function reduceWorkflowSession(state: WorkflowSessionState, event: Langc
1024
1070
  /** 从空状态回放 workflow 事件序列。 */
1025
1071
  declare function reduceWorkflowEvents(events: LangchainAgentEvent[], options?: ReduceOptions): WorkflowSessionState;
1026
1072
 
1027
- /**
1028
- * workflowStructureEvents.ts — Workflow 结构事件类型守卫
1029
- *
1030
- * 职责:
1031
- * 区分 workflow 编排结构 event_type 与 agent loop 事件。
1032
- *
1033
- * 链路位置:
1034
- * workflowReducer 路由 · Source application_kind 守卫(并行契约)。
1035
- *
1036
- * 当前裁剪范围:
1037
- * 与 backend WORKFLOW_STRUCTURE_EVENT_TYPES 对齐;不进 tier-1 白名单。
1038
- */
1073
+ /** 与 backend/langchain_agentx_stream_ui_backend/task_sync/multi_sse_bridge.py 对齐 */
1074
+ declare const WORKFLOW_STRUCTURE_EVENT_PREFIXES: readonly string[];
1075
+ /** 显式 SSOT(文档/契约测试);新增结构类型应同时满足前缀规则或补入此集合 */
1039
1076
  declare const WORKFLOW_STRUCTURE_EVENT_TYPES: ReadonlySet<string>;
1040
1077
  declare function isWorkflowStructureEventType(eventType: string): boolean;
1078
+ /** agent loop hydrate/replay 允许进入 reduceTree 的事件(正文 + state/debug tier) */
1079
+ declare function isAgentLoopReplayEventType(eventType: string): boolean;
1080
+ /**
1081
+ * hydrateLoopSession / 宿主 replay:
1082
+ * 1. 白名单:只保留 reduceTree 已知 event_type
1083
+ * 2. 结构前缀/集合:双重排除 workflow 编排帧(含 session_id 误绑的 dual emission)
1084
+ */
1085
+ declare function filterAgentLoopReplayEvents<T extends {
1086
+ event_type: string;
1087
+ }>(events: T[]): T[];
1041
1088
 
1042
1089
  /**
1043
1090
  * 职责:事件分级类型(V2-A classify 层公共契约)。
@@ -1067,4 +1114,4 @@ interface ClassifyContext {
1067
1114
  declare function resolveEventTier(eventType: string, overrides?: TierOverrides): EventTier;
1068
1115
  declare function classifyEvent(event: LangchainAgentEvent, ctx: ClassifyContext, overrides?: TierOverrides, eventIndex?: number): ClassifiedEvent;
1069
1116
 
1070
- export { Agent, AgentLoopView, type AgentLoopViewProps, AgentSession, type AgentSessionProps, type AgentxMetaFrame, type AgentxSseSourceOptions, type ApplicationKind, ApplicationKindMismatchError, AskUserQuestion, Bash, CanonicalNodeRef, type ClassifiedEvent, type ClassifyContext, CollapseKind, CollapsedExploreNode, type CollapsedExploreNodeProps, DEFAULT_WORKFLOW_SCALE_OPTIONS, DisplayMode, EXPECTED_PROTOCOL_VERSION, Edit, ErrorCard, EventTier, ExploreCollapseAccumulator, GROUPABLE_TOOL_NAMES, Glob, Grep, GroupedToolUseAccumulator, InteractionBus, LangchainAgentEvent, MIN_HINT_DISPLAY_MS, MarkdownRenderer, MermaidDiagram, type MermaidDiagramProps, type MermaidInitOptions, type MermaidThemeName, MissingApplicationKindError, NodeRegistry, PermissionCard, PermissionUiMode, PlantUMLBlock, type PlantUMLBlockProps, PlantUMLDiagram, type PlantUMLDiagramProps, type ProjectedTimelineItem, ProjectionContext, DisplayMode as ProjectionDisplayMode, Read, ReasoningBubble, 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 SseTransportFailureKind, SseTransportTerminalError, StepCard, SubAgentBlock, SystemSummaryAccumulator, SystemSummaryNode, Task, TaskList, TaskListFooter, TextBubble, TierOverrides, Timeline, TimelineItem, ToolBodyMode, ToolCallCard, ToolDisplayRegistry, ToolProjectionClassifier, UnknownCard, 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, configureMermaid, configurePlantumlServer, createAgentxSseSource, createDefaultRegistry, createEmptyWorkflowSessionState, createMockSource, createReplaySource, createWorkflowSessionStore, entryKey, formatAgentTitle, formatExploreSummaryText, formatHookFinishedSummary, formatShellProgressSuffix, formatTaskFooterLabel, getChildIds, getMainStageIds, isGitOperationCommand, isGroupableToolName, isMcpToolName, isWorkflowStructureEventType, iterMountCandidates, partitionWorkflowStages, projectCanonical, projectTimeline, reduceAgentLoopEvent, reduceEvents, reduceTree, reduceWorkflowEvents, reduceWorkflowSession, replayEvents, replayTree, resolveEventTier, resolveResponseId, resolveShellProgressFromPayload, shouldShowTaskListFooter, streamChunk, useChildren, useInteractionBus, useInternalErrors, useMinDisplayTime, useNode, useNodeTyped, useProjectedTimeline, useReplayTree, useSessionMeta, useSessionStatus, useTimeline, useWorkflowSessionStatus, useWorkflowSessionStoreApi };
1117
+ export { Agent, AgentLoopView, type AgentLoopViewProps, AgentSession, type AgentSessionProps, type AgentxMetaFrame, type AgentxSseSourceOptions, type ApplicationKind, ApplicationKindMismatchError, AskUserQuestion, 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, InteractionBus, LangchainAgentEvent, MIN_HINT_DISPLAY_MS, MarkdownRenderer, MermaidDiagram, type MermaidDiagramProps, type MermaidInitOptions, type MermaidThemeName, MissingApplicationKindError, NodeRegistry, PermissionCard, PermissionUiMode, PlantUMLBlock, type PlantUMLBlockProps, PlantUMLDiagram, type PlantUMLDiagramProps, type ProjectedTimelineItem, ProjectionContext, DisplayMode as ProjectionDisplayMode, Read, ReasoningBubble, 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 SseTransportFailureKind, 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, entryKey, filterAgentLoopReplayEvents, fixDiagramSvg, formatAgentTitle, formatExploreSummaryText, formatHookFinishedSummary, formatShellProgressSuffix, formatTaskFooterLabel, getChildIds, getMainStageIds, isAgentLoopReplayEventType, isGitOperationCommand, isGroupableToolName, isMcpToolName, isWorkflowStructureEventType, iterMountCandidates, partitionWorkflowStages, projectCanonical, projectTimeline, reduceAgentLoopEvent, reduceEvents, reduceTree, reduceWorkflowEvents, reduceWorkflowSession, replayEvents, replayTree, resolveEventTier, resolveResponseId, resolveShellProgressFromPayload, shouldShowTaskListFooter, streamChunk, useChildren, useInteractionBus, useInternalErrors, useMinDisplayTime, useNode, useNodeTyped, useProjectedTimeline, useReplayTree, useSessionMeta, useSessionStatus, useTimeline, useWorkflowSessionStatus, useWorkflowSessionStoreApi };
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import {
2
+ DiagramZoomShell,
3
+ DiagramZoomView,
2
4
  ErrorCard,
3
5
  MermaidDiagram,
4
6
  MultiAgentSession,
@@ -12,14 +14,16 @@ import {
12
14
  TextBubble,
13
15
  ToolCallCard,
14
16
  UnknownCard,
17
+ computeViewportFitTransform,
15
18
  configureMermaid,
16
19
  configurePlantumlServer,
17
20
  createActiveSessionBridge,
18
21
  createDefaultRegistry,
19
22
  createMultiSessionStore,
23
+ fixDiagramSvg,
20
24
  markEventIdSeen,
21
25
  shouldSkipDuplicateEvent
22
- } from "./chunk-A4W6B7C3.js";
26
+ } from "./chunk-WPW3TQQF.js";
23
27
  import {
24
28
  DefaultToolBody,
25
29
  InteractionBusContext,
@@ -28,7 +32,7 @@ import {
28
32
  getNoopInteractionBus,
29
33
  resolveToolBody,
30
34
  useInteractionBus
31
- } from "./chunk-WM6Y6APP.js";
35
+ } from "./chunk-6DYISADG.js";
32
36
  import "./chunk-DP7V33X7.js";
33
37
  import {
34
38
  CollapseKind,
@@ -107,7 +111,7 @@ import {
107
111
  useSessionStatus,
108
112
  useSessionViewOptions,
109
113
  useTimeline
110
- } from "./chunk-3B4WC67E.js";
114
+ } from "./chunk-LBJFJF22.js";
111
115
  import {
112
116
  Agent,
113
117
  AgentToolBody,
@@ -134,7 +138,7 @@ import {
134
138
  WriteToolBody,
135
139
  createDefaultToolRegistry,
136
140
  formatAgentTitle
137
- } from "./chunk-MHK53ZHC.js";
141
+ } from "./chunk-7CLAU74Y.js";
138
142
  import {
139
143
  BodyBlockList,
140
144
  DiffView,
@@ -1249,6 +1253,13 @@ function loopTaskScopeForStructureOpen(eventType) {
1249
1253
  }
1250
1254
 
1251
1255
  // src/core/workflowStructureEvents.ts
1256
+ var WORKFLOW_STRUCTURE_EVENT_PREFIXES = [
1257
+ "workflow-",
1258
+ "stage-",
1259
+ "parallel-",
1260
+ "route-",
1261
+ "subworkflow-"
1262
+ ];
1252
1263
  var WORKFLOW_STRUCTURE_EVENT_TYPES = /* @__PURE__ */ new Set([
1253
1264
  "workflow-start",
1254
1265
  "workflow-end",
@@ -1268,8 +1279,20 @@ var WORKFLOW_STRUCTURE_EVENT_TYPES = /* @__PURE__ */ new Set([
1268
1279
  "route-branch-done",
1269
1280
  "route-branch-failed"
1270
1281
  ]);
1282
+ var AGENT_LOOP_REPLAY_EVENT_TYPES = new Set(
1283
+ Object.keys(DEFAULT_EVENT_TIERS)
1284
+ );
1271
1285
  function isWorkflowStructureEventType(eventType) {
1272
- return WORKFLOW_STRUCTURE_EVENT_TYPES.has(eventType);
1286
+ if (WORKFLOW_STRUCTURE_EVENT_TYPES.has(eventType)) return true;
1287
+ return WORKFLOW_STRUCTURE_EVENT_PREFIXES.some((prefix) => eventType.startsWith(prefix));
1288
+ }
1289
+ function isAgentLoopReplayEventType(eventType) {
1290
+ return AGENT_LOOP_REPLAY_EVENT_TYPES.has(eventType);
1291
+ }
1292
+ function filterAgentLoopReplayEvents(events) {
1293
+ return events.filter(
1294
+ (event) => isAgentLoopReplayEventType(event.event_type) && !isWorkflowStructureEventType(event.event_type)
1295
+ );
1273
1296
  }
1274
1297
 
1275
1298
  // src/core/workflowReducer.ts
@@ -1421,16 +1444,17 @@ function findContainerByLoopSession(tree, loopSessionId) {
1421
1444
  return null;
1422
1445
  }
1423
1446
  var WORKFLOW_DEFAULT_LOOP_SESSION_ID = "workflow-loop-default";
1424
- function resolveAgentLoopSessionId(event) {
1447
+ function resolveAgentLoopSessionId(event, activeLoopSessionId) {
1425
1448
  if (event.session_id) return event.session_id;
1426
1449
  if (isWorkflowStructureEventType(event.event_type)) return null;
1427
1450
  if (event.event_type === "task-list-snapshot") return null;
1428
1451
  const derived = deriveLoopSessionIdFromAgentEvent(event);
1429
1452
  if (derived) return derived;
1453
+ if (activeLoopSessionId) return activeLoopSessionId;
1430
1454
  return WORKFLOW_DEFAULT_LOOP_SESSION_ID;
1431
1455
  }
1432
- function bindLoopSessionToContainerTree(tree, event) {
1433
- const sessionId = resolveAgentLoopSessionId(event);
1456
+ function bindLoopSessionToContainerTree(tree, event, activeLoopSessionId) {
1457
+ const sessionId = resolveAgentLoopSessionId(event, activeLoopSessionId);
1434
1458
  if (!sessionId) return tree;
1435
1459
  if (findContainerByLoopSession(tree, sessionId)) return tree;
1436
1460
  const data = event.data ?? {};
@@ -1536,8 +1560,12 @@ function reduceWorkflowSession(state, event, eventIndex, options) {
1536
1560
  if (isWorkflowStructureEventType(event.event_type)) {
1537
1561
  return applyStructureEvent(state, event);
1538
1562
  }
1539
- const loopSessionId = resolveAgentLoopSessionId(event) ?? WORKFLOW_DEFAULT_LOOP_SESSION_ID;
1540
- let containerTree = bindLoopSessionToContainerTree(state.containerTree, event);
1563
+ const loopSessionId = resolveAgentLoopSessionId(event, state.activeLoopSessionId) ?? WORKFLOW_DEFAULT_LOOP_SESSION_ID;
1564
+ let containerTree = bindLoopSessionToContainerTree(
1565
+ state.containerTree,
1566
+ event,
1567
+ state.activeLoopSessionId
1568
+ );
1541
1569
  containerTree = applyStructureToContainerTree(containerTree, event);
1542
1570
  let next = ensureLoopTree({ ...state, containerTree }, loopSessionId);
1543
1571
  const loopTree = next.loopTreesBySessionId[loopSessionId];
@@ -1812,7 +1840,7 @@ function createWorkflowSessionStore(initialState = createEmptyWorkflowSessionSta
1812
1840
  const { state, eventCount } = get();
1813
1841
  let tree = state.loopTreesBySessionId[loopSessionId] ?? createEmptyTree();
1814
1842
  let idx = eventCount;
1815
- for (const event of events) {
1843
+ for (const event of filterAgentLoopReplayEvents(events)) {
1816
1844
  tree = reduceTree(tree, event, idx, reduceOpts);
1817
1845
  idx += 1;
1818
1846
  }
@@ -3440,6 +3468,8 @@ export {
3440
3468
  DEFAULT_VIRTUALIZE_THRESHOLD,
3441
3469
  DEFAULT_WORKFLOW_SCALE_OPTIONS,
3442
3470
  DefaultToolBody,
3471
+ DiagramZoomShell,
3472
+ DiagramZoomView,
3443
3473
  DiffView,
3444
3474
  EXPECTED_PROTOCOL_VERSION,
3445
3475
  Edit,
@@ -3489,6 +3519,7 @@ export {
3489
3519
  TruncatedContent,
3490
3520
  UnknownCard,
3491
3521
  VirtualTimeline,
3522
+ WORKFLOW_STRUCTURE_EVENT_PREFIXES,
3492
3523
  WORKFLOW_STRUCTURE_EVENT_TYPES,
3493
3524
  WebFetch,
3494
3525
  WebFetchToolBody,
@@ -3511,6 +3542,7 @@ export {
3511
3542
  buildTimelineEntries,
3512
3543
  classifyEvent,
3513
3544
  commandAsHint,
3545
+ computeViewportFitTransform,
3514
3546
  configureMermaid,
3515
3547
  configurePlantumlServer,
3516
3548
  createActiveSessionBridge,
@@ -3528,6 +3560,8 @@ export {
3528
3560
  createWorkflowSessionStore,
3529
3561
  displayPath,
3530
3562
  entryKey,
3563
+ filterAgentLoopReplayEvents,
3564
+ fixDiagramSvg,
3531
3565
  formatAgentTitle,
3532
3566
  formatDiffFromStrings,
3533
3567
  formatExploreSummaryText,
@@ -3541,6 +3575,7 @@ export {
3541
3575
  getChildIds,
3542
3576
  getMainStageIds,
3543
3577
  getNoopInteractionBus,
3578
+ isAgentLoopReplayEventType,
3544
3579
  isGitOperationCommand,
3545
3580
  isGroupableToolName,
3546
3581
  isMcpToolName,