langchain_agentx_stream_ui 0.1.0

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.
@@ -0,0 +1,650 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+ import { q as Source, L as LangchainAgentEvent, N as NodeRegistry, v as TierOverrides, I as InteractionBus, M as MarkdownRenderer, T as Task, t as TaskPhase, l as SessionStatus, p as SessionTree, R as ReducerError, E as EventTier } from './multi-session-CviqerRl.js';
4
+ 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, r as SourceEventContext, 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-CviqerRl.js';
5
+ import { T as ToolDisplayRegistry, P as PermissionUiMode, b as DisplayMode, c as ProjectionContext, R as RenderableEntry, C as CanonicalNodeRef } from './sessionViewOptions-DLSFRQwZ.js';
6
+ 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';
7
+ import { a as ToolBodyMode } from './types-aXj5TYSP.js';
8
+ export { T as ToolBodyComponent, b as ToolDisplayProps } from './types-aXj5TYSP.js';
9
+ export { DEFAULT_ESTIMATE_SIZE, DEFAULT_VIRTUALIZE_THRESHOLD, SessionTimeline, SessionTimelineProps, VirtualTimeline, VirtualTimelineProps } from './virtual.js';
10
+ 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';
11
+ import { S as SessionNode, a as SessionNodeKind } from './nodes-DqhaBW7M.js';
12
+ 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';
13
+ 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';
14
+ import 'zustand/vanilla';
15
+
16
+ interface AgentSessionProps {
17
+ source: Source;
18
+ /** 挂载时先 replay 预灌树(含 EventBuffer ingest 快照),再接 source 续流 */
19
+ initialEvents?: LangchainAgentEvent[];
20
+ registry?: NodeRegistry;
21
+ tierOverrides?: TierOverrides;
22
+ onError?: (error: Error) => void;
23
+ autoReconnect?: boolean;
24
+ debug?: boolean;
25
+ /** 为 true 且主舞台节点数超过阈值时使用 VirtualTimeline(V2-E) */
26
+ virtualized?: boolean;
27
+ virtualizeThreshold?: number;
28
+ /** 权限回写薄层;PermissionCard 触发 onPermissionResolve(V2-D) */
29
+ interactionBus?: InteractionBus;
30
+ /** 按工具名注册 Body 组件(V3-T0) */
31
+ toolDisplayRegistry?: ToolDisplayRegistry;
32
+ /** 工具正文默认 preview / full(V3-T0) */
33
+ defaultBodyMode?: ToolBodyMode;
34
+ /** @deprecated Phase 4 起由 projection GroupedToolUseAccumulator 自动分组;保留 prop 兼容 */
35
+ groupParallelTools?: boolean;
36
+ /** 权限 UI:standalone | inline | both(V3-T4.6);后台 bypass 时通常无 pending */
37
+ permissionUiMode?: PermissionUiMode;
38
+ /** 富 Markdown 渲染(simple demo 可注入 react-markdown + mermaid) */
39
+ markdownRenderer?: MarkdownRenderer;
40
+ /** 对齐 CLI display mode(normal / brief_only / transcript) */
41
+ displayMode?: DisplayMode;
42
+ /** 对齐 CC verbose;为 true 时跳过分组并展开 explore detail */
43
+ verbose?: boolean;
44
+ exploreFullscreenBash?: boolean;
45
+ memoryDir?: string | null;
46
+ workspaceRoot?: string | null;
47
+ children?: ReactNode;
48
+ }
49
+ declare function AgentSession({ source, initialEvents, registry, tierOverrides: _tierOverrides, onError, autoReconnect: _autoReconnect, debug, virtualized, virtualizeThreshold, interactionBus, toolDisplayRegistry, defaultBodyMode, groupParallelTools, permissionUiMode, markdownRenderer, displayMode, verbose, exploreFullscreenBash, memoryDir, workspaceRoot, children, }: AgentSessionProps): react_jsx_runtime.JSX.Element;
50
+
51
+ interface TimelineItemProps {
52
+ nodeId: string;
53
+ registry: NodeRegistry;
54
+ }
55
+ declare function TimelineItem({ nodeId, registry }: TimelineItemProps): react_jsx_runtime.JSX.Element | null;
56
+
57
+ declare function Timeline(): react_jsx_runtime.JSX.Element;
58
+
59
+ interface SpinnerElapsedInput {
60
+ /** 当前 wall-clock(ms) */
61
+ nowMs: number;
62
+ /** Turn 加载开始时间(ms) */
63
+ loadingStartTimeMs: number;
64
+ /** 已累计 pause 时长(ms);SDK 无 pause 事件时为 0 */
65
+ totalPausedMs?: number;
66
+ /** pause 开始时间;非 null 表示当前处于 pause 冻结 */
67
+ pauseStartTimeMs?: number | null;
68
+ }
69
+
70
+ interface SpinnerProps {
71
+ /** Session 启动时间(毫秒时间戳) */
72
+ startedAt: number | null;
73
+ /** 当前内容字符数(用于估算 Token) */
74
+ contentCharCount?: number;
75
+ /** 当前模式(用于跟踪 thinking 状态) */
76
+ mode?: 'idle' | 'requesting' | 'tool-use' | 'thinking';
77
+ /** 对齐 CC verbose:30s 前仍显示 timer/token 后缀 */
78
+ verbose?: boolean;
79
+ /** pause 扣除(SDK 无事件时省略) */
80
+ timing?: Pick<SpinnerElapsedInput, 'totalPausedMs' | 'pauseStartTimeMs'>;
81
+ }
82
+ declare function Spinner({ startedAt, contentCharCount, mode, verbose, timing, }: SpinnerProps): react_jsx_runtime.JSX.Element | null;
83
+
84
+ interface TaskListProps {
85
+ tasks: Task[];
86
+ /** 省略时按视口高度动态计算(对齐 CC 终端行数档位) */
87
+ maxDisplay?: number;
88
+ /** false = Spinner 内嵌模式,不显示统计行(对齐 CC TaskListV2) */
89
+ isStandalone?: boolean;
90
+ }
91
+ declare function TaskList({ tasks, maxDisplay: maxDisplayProp, isStandalone, }: TaskListProps): react_jsx_runtime.JSX.Element | null;
92
+
93
+ /** 纯函数:footer pill 文案(供单测) */
94
+ declare function formatTaskFooterLabel(tasks: Task[]): string;
95
+ /** 纯函数:是否展示 footer(供单测) */
96
+ declare function shouldShowTaskListFooter(taskPhase: TaskPhase, tasks: Task[], hasEverShownTaskList: boolean, sessionStatus: SessionStatus): boolean;
97
+ declare function TaskListFooter(): react_jsx_runtime.JSX.Element | null;
98
+
99
+ /**
100
+ * 职责:默认 registry 工厂别名,供 AgentSession 内部使用。
101
+ * 链路位置:AgentSession 未传 registry 时的 fallback。
102
+ * 当前裁剪范围:委托 NodeRegistry.default()。
103
+ */
104
+
105
+ declare function createDefaultRegistry(): NodeRegistry;
106
+
107
+ interface TextBubbleProps {
108
+ nodeId: string;
109
+ }
110
+ declare function TextBubble({ nodeId }: TextBubbleProps): react_jsx_runtime.JSX.Element | null;
111
+
112
+ interface ReasoningBubbleProps {
113
+ nodeId: string;
114
+ }
115
+ declare function ReasoningBubble({ nodeId }: ReasoningBubbleProps): react_jsx_runtime.JSX.Element | null;
116
+
117
+ /**
118
+ * SystemSummaryNode.tsx — system_summary 摘要行
119
+ *
120
+ * 对齐 CC / CLI hook · compact 单行系统摘要。
121
+ */
122
+ interface SystemSummaryNodeProps {
123
+ summaryText: string;
124
+ }
125
+ declare function SystemSummaryNode({ summaryText }: SystemSummaryNodeProps): react_jsx_runtime.JSX.Element;
126
+
127
+ interface ToolCallCardProps {
128
+ nodeId: string;
129
+ layout?: 'default' | 'grouped';
130
+ }
131
+ declare function ToolCallCard({ nodeId, layout }: ToolCallCardProps): react_jsx_runtime.JSX.Element | null;
132
+
133
+ /**
134
+ * constants.ts — Renderable Projection 常量 SSOT
135
+ *
136
+ * 职责:
137
+ * 分组工具名等与 CLI D13、grouped_tool_use.py 对齐的 frozen 集合。
138
+ *
139
+ * 链路位置:
140
+ * Phase 1+ classifier / GroupedToolUseAccumulator 消费;Phase 0 定标与单测。
141
+ *
142
+ * 当前裁剪范围:
143
+ * 不含 explore CollapseKind 枚举(Phase 2 classify.ts)。
144
+ */
145
+ /** 对齐 CLI GROUPABLE_TOOL_NAMES · CC applyGrouping 仅 Agent */
146
+ declare const GROUPABLE_TOOL_NAMES: ReadonlySet<string>;
147
+ declare function isGroupableToolName(toolName: string): boolean;
148
+
149
+ /**
150
+ * 合并 call 与 result 侧 candidate;call 优先。
151
+ * message_id 缺失 → null → GroupedToolUseAccumulator 不分组(对齐 CLI 保守策略)。
152
+ */
153
+ declare function resolveResponseId(toolPayload: Record<string, unknown> | undefined | null, resultMeta: unknown): string | null;
154
+
155
+ interface ReduceOptions {
156
+ tierOverrides?: TierOverrides;
157
+ /** true 时 debug tier 也写入 debugEvents(AgentSession debug prop) */
158
+ collectDebug?: boolean;
159
+ }
160
+ declare function streamChunk(data: {
161
+ delta?: string;
162
+ text?: string;
163
+ content?: string;
164
+ }): string;
165
+ /** Pure reducer: tree + event → new tree. */
166
+ declare function reduceTree(tree: SessionTree, event: LangchainAgentEvent, eventIndex: number, options?: ReduceOptions): SessionTree;
167
+ /** Reduce a sequence of events from empty tree. */
168
+ declare function reduceEvents(events: LangchainAgentEvent[], options?: ReduceOptions): SessionTree;
169
+ /** Collect main-stage node ids for Timeline rendering. */
170
+ declare function getMainStageIds(tree: SessionTree): string[];
171
+ declare function getChildIds(tree: SessionTree, parentId: string): string[];
172
+
173
+ /**
174
+ * memoryPaths.ts — memory 工具路径识别 SSOT(对齐 CLI memory_paths.py)
175
+ *
176
+ * 职责:
177
+ * 判断 write/read/grep/glob/bash 是否针对 auto-managed memory 目录。
178
+ *
179
+ * 链路位置:
180
+ * ToolProjectionClassifier.memorySubkind() → ExploreCollapseAccumulator。
181
+ *
182
+ * 当前裁剪范围:
183
+ * 基于 memoryDir + workspaceRoot 路径前缀;不含 SDK is_agent_memory_path。
184
+ */
185
+ declare const MemoryKind: {
186
+ readonly Write: "Write";
187
+ readonly Read: "Read";
188
+ readonly Search: "Search";
189
+ };
190
+ type MemoryToolKind = (typeof MemoryKind)[keyof typeof MemoryKind];
191
+
192
+ /**
193
+ * classify.ts — 工具投影分类(CollapseKind)
194
+ *
195
+ * 职责:
196
+ * 将 tool_use 归类为 Read / Search / List / Bash / Memory / None。
197
+ *
198
+ * 链路位置:
199
+ * RenderableTimelineProjector → ToolProjectionClassifier(Phase 2+ accumulator 消费)。
200
+ *
201
+ * 当前裁剪范围:
202
+ * bash 重分类与 memory 路径识别;对齐 CLI classify.py。
203
+ */
204
+
205
+ declare enum CollapseKind {
206
+ None = "None",
207
+ Read = "Read",
208
+ Search = "Search",
209
+ List = "List",
210
+ Bash = "Bash",
211
+ Memory = "Memory",
212
+ Mcp = "Mcp"
213
+ }
214
+ declare class ToolProjectionClassifier {
215
+ private readonly context;
216
+ constructor(context: ProjectionContext);
217
+ getContext(): ProjectionContext;
218
+ isSilentTool(toolName: string | null | undefined): boolean;
219
+ classifyTool(toolName: string | null | undefined, toolInput?: Record<string, unknown> | null, display?: Record<string, unknown> | null): CollapseKind;
220
+ isExploreCollapsible(toolName: string | null | undefined, toolInput?: Record<string, unknown> | null, display?: Record<string, unknown> | null): boolean;
221
+ memorySubkind(toolName: string | null | undefined, toolInput?: Record<string, unknown> | null, display?: Record<string, unknown> | null): MemoryToolKind | null;
222
+ }
223
+
224
+ declare function commandAsHint(command: string): string;
225
+ /** G06:bash 内 git 写操作(commit/push 等),不计入 explore bash 桶 */
226
+ declare function isGitOperationCommand(command: string): boolean;
227
+ /** G06:MCP 工具名识别 */
228
+ declare function isMcpToolName(toolName: string | null | undefined): boolean;
229
+
230
+ /**
231
+ * exploreSummary.ts — collapsed_explore 摘要文案(对齐 CC / CLI)
232
+ *
233
+ * 职责:
234
+ * 生成与 CC CollapsedReadSearchContent / getSearchReadSummaryText 一致的 plain 摘要。
235
+ *
236
+ * 链路位置:
237
+ * ExploreCollapseAccumulator → payload.summaryText。
238
+ *
239
+ * 当前裁剪范围:
240
+ * 仅 plain text;Rich/bold 渲染在 CollapsedExploreNode(Phase 3)。
241
+ */
242
+ interface ExploreSummaryCounts {
243
+ searchCount: number;
244
+ readCount: number;
245
+ listCount: number;
246
+ bashCount: number;
247
+ memorySearchCount: number;
248
+ memoryReadCount: number;
249
+ memoryWriteCount: number;
250
+ relevantRecallCount: number;
251
+ gitOpBashCount: number;
252
+ mcpCallCount: number;
253
+ }
254
+ declare function formatExploreSummaryText(counts: ExploreSummaryCounts, options?: {
255
+ active: boolean;
256
+ prefix?: string;
257
+ joiner?: string;
258
+ /** Thought 前缀已占用句首时,explore 动词用小写续写 */
259
+ continuingSentence?: boolean;
260
+ }): string | null;
261
+
262
+ /**
263
+ * exploreCollapse.ts — ExploreCollapseAccumulator
264
+ *
265
+ * 职责:
266
+ * 将连续探索类 tool_use 节点折叠为 collapsed_explore RenderableEntry。
267
+ *
268
+ * 链路位置:
269
+ * RenderableTimelineProjector.projectImpl → collapse()。
270
+ *
271
+ * 当前裁剪范围:
272
+ * 前端 canonical 为单节点 tool_call(input+result 合并);对齐 CLI 计数与 payload 字段。
273
+ */
274
+
275
+ declare class ExploreCollapseAccumulator {
276
+ private readonly classifier;
277
+ /** 当前活跃轮次 ID */
278
+ private currentRoundId;
279
+ /** 当前活跃 reasoning 节点 ID */
280
+ private currentReasoningNodeId;
281
+ constructor(classifier: ToolProjectionClassifier);
282
+ collapse(entries: RenderableEntry[]): RenderableEntry[];
283
+ private newGroup;
284
+ private breaksGroup;
285
+ private waitingPermission;
286
+ private toolKind;
287
+ private absorbToolEntry;
288
+ private groupCounts;
289
+ private resolveShellProgressSuffix;
290
+ private buildPayload;
291
+ private serializeToolUses;
292
+ private readPath;
293
+ private recordSearchArg;
294
+ private recordDisplayHint;
295
+ private resolveDisplayHint;
296
+ }
297
+
298
+ /**
299
+ * groupedToolUse.ts — GroupedToolUseAccumulator
300
+ *
301
+ * 职责:
302
+ * 同一 response(message_id)内 2+ 个同类 Agent/Task 合成 grouped_tool_use。
303
+ *
304
+ * 链路位置:
305
+ * RenderableTimelineProjector.projectImpl → group()(在 explore collapse 之前)。
306
+ *
307
+ * 当前裁剪范围:
308
+ * 对齐 CLI grouped_tool_use.py;前端单节点 tool_call(无独立 tool_result 行)。
309
+ */
310
+
311
+ declare class GroupedToolUseAccumulator {
312
+ group(entries: RenderableEntry[]): RenderableEntry[];
313
+ private buildGrouped;
314
+ }
315
+
316
+ /**
317
+ * systemSummary.ts — SystemSummaryAccumulator
318
+ *
319
+ * 职责:连续 hook / compact 系统事件 → system_summary RenderableEntry。
320
+ *
321
+ * 链路位置:
322
+ * RenderableTimelineProjector.projectImpl → collapseSystemSummary()。
323
+ */
324
+
325
+ declare class SystemSummaryAccumulator {
326
+ collapse(entries: RenderableEntry[]): RenderableEntry[];
327
+ }
328
+
329
+ /**
330
+
331
+ * treeAdapter.ts — SessionTree → CanonicalNodeRef[]
332
+
333
+ *
334
+
335
+ * 职责:
336
+
337
+ * 从 reducer 保真 SessionTree 抽取主舞台 canonical 列表(不改 reducer)。
338
+
339
+ *
340
+
341
+ * 链路位置:
342
+
343
+ * projectTimeline(tree) → buildCanonicalFromTree → RenderableTimelineProjector。
344
+
345
+ *
346
+
347
+ * 当前裁剪范围:
348
+
349
+ * systemEvents(hook/compact)按 timestamp 与主舞台交错;不含 debug tier 其它事件。
350
+
351
+ */
352
+
353
+ /** relevant_memories 单测 / 未来 recall 事件适配 */
354
+ declare function buildRelevantMemoriesCanonical(options: {
355
+ nodeId?: string;
356
+ count: number;
357
+ }): CanonicalNodeRef;
358
+ declare function buildCanonicalFromTree(tree: SessionTree): CanonicalNodeRef[];
359
+ declare function buildSystemEventCanonical(options: {
360
+ eventIndex: number;
361
+ eventType: string;
362
+ data?: Record<string, unknown>;
363
+ timestamp?: number;
364
+ }): CanonicalNodeRef;
365
+
366
+ /**
367
+ * systemSummaryText.ts — system_summary 摘要文案
368
+ *
369
+ * 对齐 CC collapseHookSummaries / CLI system_summary.py 感官。
370
+ */
371
+ declare function formatHookFinishedSummary(data: Record<string, unknown>): string;
372
+
373
+ /**
374
+ * shellProgress.ts — G05 collapsed_explore shell 进度后缀
375
+ *
376
+ * 对齐 CC CollapsedReadSearchContent:bash 运行 ≥2s 时在摘要后追加 elapsed/lines。
377
+ */
378
+ declare const SHELL_PROGRESS_MIN_ELAPSED_SECONDS = 2;
379
+ declare function formatShellProgressSuffix(elapsedSeconds: number | undefined, totalLines: number | undefined): string | null;
380
+ declare function resolveShellProgressFromPayload(payload: Record<string, unknown>): string | null;
381
+
382
+ /**
383
+ * projector.ts — RenderableTimelineProjector
384
+ *
385
+ * 职责:
386
+ * 接收 canonical 列表,产出 RenderableEntry[]。
387
+ * Phase 4:group → explore collapse pass 顺序对齐 CLI。
388
+ *
389
+ * 链路位置:
390
+ * projectTimeline(tree, context) → 本类 → Timeline(Phase 3 接入)。
391
+ *
392
+ * 当前裁剪范围:
393
+ * pass 顺序 group → explore → systemSummary;异常时 atomic 回退。
394
+ */
395
+
396
+ declare class RenderableTimelineProjector {
397
+ private readonly context;
398
+ private readonly classifier;
399
+ constructor(context: ProjectionContext);
400
+ getContext(): ProjectionContext;
401
+ getClassifier(): ToolProjectionClassifier;
402
+ project(canonical: CanonicalNodeRef[]): RenderableEntry[];
403
+ private projectImpl;
404
+ private shouldOmitFromRenderable;
405
+ private toRenderableEntry;
406
+ private atomicPassThrough;
407
+ }
408
+
409
+ /**
410
+ * projectTimeline.ts — 薄封装入口
411
+ *
412
+ * 职责:
413
+ * SessionTree + ProjectionContext → RenderableEntry[]。
414
+ *
415
+ * 链路位置:
416
+ * useProjectedTimeline(Phase 3)/ 公开 API 消费。
417
+ *
418
+ * 当前裁剪范围:
419
+ * 仅委托 RenderableTimelineProjector;不 mount DOM。
420
+ */
421
+
422
+ declare function projectTimeline(tree: SessionTree, context: ProjectionContext): RenderableEntry[];
423
+ declare function projectCanonical(canonical: CanonicalNodeRef[], context: ProjectionContext): RenderableEntry[];
424
+
425
+ /**
426
+ * mountCandidates.ts — renderable → Timeline mount 候选
427
+ *
428
+ * 职责:
429
+ * 根据 RenderableEntry[] 计算 entryKey、过滤被 collapsed / grouped 吸收的原子行。
430
+ *
431
+ * 链路位置:
432
+ * useProjectedTimeline / TimelineEntries 消费。
433
+ *
434
+ * 当前裁剪范围:
435
+ * 对齐 CLI renderable_mount.py;B02 禁止 explore 双重 mount。
436
+ */
437
+
438
+ declare function entryKey(entry: RenderableEntry): string;
439
+ declare function iterMountCandidates(entries: RenderableEntry[], options: {
440
+ classifier: ToolProjectionClassifier | null;
441
+ exploreDetail: boolean;
442
+ hideStandalonePermissions?: boolean;
443
+ showReasoningInTimeline?: boolean;
444
+ compactNarrative?: boolean;
445
+ }): Array<[string, RenderableEntry]>;
446
+
447
+ /**
448
+ * groupParallelTools.ts — 主舞台 Timeline 条目分组(过渡实现)
449
+ *
450
+ * @deprecated Phase 4 由 core/projection GroupedToolUseAccumulator + mountCandidates 替代。
451
+ * 对齐参考:CC GroupedToolUseContent · buildMessageLookups 并行同工具分组语义
452
+ */
453
+
454
+ type TimelineEntry = {
455
+ kind: 'node';
456
+ nodeId: string;
457
+ } | {
458
+ kind: 'tool_group';
459
+ toolName: string;
460
+ nodeIds: string[];
461
+ };
462
+ interface BuildTimelineEntriesOptions {
463
+ /** @deprecated 使用 projection grouped_tool_use;保留至 Phase 4 迁移完成 */
464
+ groupParallelTools?: boolean;
465
+ hideStandalonePermissions?: boolean;
466
+ }
467
+ /** @deprecated 见 core/projection;Phase 4 删除 */
468
+ declare function buildTimelineEntries(rootIds: string[], byId: Record<string, SessionNode | undefined>, options?: BuildTimelineEntriesOptions): TimelineEntry[];
469
+
470
+ declare function formatAgentTitle(input: unknown, display: unknown): string;
471
+
472
+ /**
473
+ * toolNames.ts — CC PascalCase 工具名 SSOT(对齐 SDK registry_names.py)
474
+ *
475
+ * 职责:Stream UI widget / projection / reducer 消费的工具名字面量唯一来源。
476
+ * 链路位置:registry.ts、classify.ts、memoryPaths.ts、reducer.ts。
477
+ * 当前裁剪范围:无 legacy alias、无 *Tool 后缀变体、无 REMOVED 双轨表。
478
+ */
479
+ declare const Read = "Read";
480
+ declare const Write = "Write";
481
+ declare const Edit = "Edit";
482
+ declare const Glob = "Glob";
483
+ declare const Grep = "Grep";
484
+ declare const Bash = "Bash";
485
+ declare const Skill = "Skill";
486
+ declare const Agent = "Agent";
487
+ declare const AskUserQuestion = "AskUserQuestion";
488
+ declare const WebSearch = "WebSearch";
489
+ declare const WebFetch = "WebFetch";
490
+
491
+ interface SubAgentBlockProps {
492
+ nodeId: string;
493
+ }
494
+ declare function SubAgentBlock({ nodeId }: SubAgentBlockProps): react_jsx_runtime.JSX.Element | null;
495
+
496
+ interface StepCardProps {
497
+ nodeId: string;
498
+ }
499
+ declare function StepCard({ nodeId }: StepCardProps): react_jsx_runtime.JSX.Element | null;
500
+
501
+ interface ErrorCardProps {
502
+ nodeId: string;
503
+ }
504
+ declare function ErrorCard({ nodeId }: ErrorCardProps): react_jsx_runtime.JSX.Element | null;
505
+
506
+ interface UnknownCardProps {
507
+ nodeId: string;
508
+ }
509
+ declare function UnknownCard({ nodeId }: UnknownCardProps): react_jsx_runtime.JSX.Element | null;
510
+
511
+ interface PermissionCardProps {
512
+ nodeId: string;
513
+ }
514
+ declare function PermissionCard({ nodeId }: PermissionCardProps): react_jsx_runtime.JSX.Element | null;
515
+
516
+ interface CollapsedExploreNodeProps {
517
+ entry: RenderableEntry;
518
+ registry: NodeRegistry;
519
+ }
520
+ declare function CollapsedExploreNode({ entry, registry }: CollapsedExploreNodeProps): react_jsx_runtime.JSX.Element;
521
+
522
+ declare const MIN_HINT_DISPLAY_MS = 700;
523
+ /**
524
+ * 每个 distinct value 至少展示 minMs,避免 hint 闪烁过快。
525
+ */
526
+ declare function useMinDisplayTime<T>(value: T, minMs?: number): T;
527
+
528
+ declare function useInteractionBus(): InteractionBus;
529
+
530
+ /**
531
+ * 职责:浏览器 EventSource 封装,解码 meta/agentx 命名帧并校验协议版本。
532
+ * 链路位置:业务页面 createAgentxSseSource({ url }) → AgentSession source prop。
533
+ * 当前裁剪范围:protocol_version "1";SSE id 行续传;网络错误依赖 EventSource 原生重连(Last-Event-ID)。
534
+ */
535
+
536
+ declare const EXPECTED_PROTOCOL_VERSION = "1";
537
+ interface AgentxSseSourceOptions {
538
+ url: string;
539
+ onError?: (error: Error) => void;
540
+ autoReconnect?: boolean;
541
+ reconnectDelayMs?: number;
542
+ /** 每收到 agentx 帧 SSE id 时回调(含续传重叠 id) */
543
+ onLastEventId?: (id: string) => void;
544
+ /** 测试注入:替换全局 EventSource */
545
+ EventSourceImpl?: typeof EventSource;
546
+ }
547
+ interface AgentxMetaFrame {
548
+ protocol_version: string;
549
+ session_id?: string | null;
550
+ started_at?: number;
551
+ }
552
+ /** 手动重连时追加 resume 查询参数(EventSource 无法设 Last-Event-ID 请求头)。 */
553
+ declare function buildResumeStreamUrl(baseUrl: string, lastEventId: string | null | undefined, queryParam?: string): string;
554
+ declare function createAgentxSseSource(options: AgentxSseSourceOptions): Source;
555
+ /** 测试/Story 用:内存事件源 */
556
+ declare function createMockSource(events: LangchainAgentEvent[]): Source;
557
+
558
+ /**
559
+ * 职责:离线回放纯函数,将 events[] 归并为 SessionTree。
560
+ * 链路位置:测试、历史页、createReplaySource、AgentSession initialEvents 共用。
561
+ * 当前裁剪范围:纯函数;禁止网络与 Date.now();复用 classify + reducer。
562
+ */
563
+
564
+ interface ReplayOptions {
565
+ tierOverrides?: TierOverrides;
566
+ collectDebug?: boolean;
567
+ }
568
+ /** 从空树回放完整事件序列。 */
569
+ declare function replayEvents(events: LangchainAgentEvent[], options?: ReplayOptions): SessionTree;
570
+ /** 从已有树继续回放;startEventIndex 默认 0,续流时传 initialEvents.length。 */
571
+ declare function replayTree(initialTree: SessionTree, events: LangchainAgentEvent[], options?: ReplayOptions & {
572
+ startEventIndex?: number;
573
+ }): SessionTree;
574
+
575
+ declare function useReplayTree(events: LangchainAgentEvent[], options?: ReplayOptions): SessionTree;
576
+
577
+ /**
578
+ * useProjectedTimeline.ts — SessionTree → mount 候选 RenderableEntry[]
579
+ *
580
+ * 职责:
581
+ * memo 订阅 tree + SessionViewOptions,运行 projectTimeline + iterMountCandidates。
582
+ *
583
+ * 链路位置:
584
+ * TimelineEntries / VirtualTimeline 消费。
585
+ *
586
+ * 当前裁剪范围:
587
+ * grouped_tool_use / system_summary 由 Phase 4+ 渲染分支处理。
588
+ */
589
+
590
+ interface ProjectedTimelineItem {
591
+ key: string;
592
+ entry: RenderableEntry;
593
+ }
594
+ declare function useProjectedTimeline(): ProjectedTimelineItem[];
595
+
596
+ declare function useTimeline(): string[];
597
+ declare function useNode(id: string): SessionNode | undefined;
598
+ declare function useNodeTyped<K extends SessionNodeKind>(id: string, kind: K): Extract<SessionNode, {
599
+ kind: K;
600
+ }> | undefined;
601
+ declare function useChildren(parentId: string): string[];
602
+ declare function useSessionStatus(): SessionStatus;
603
+ declare function useInternalErrors(): ReducerError[];
604
+ declare function useSessionMeta(): {
605
+ sessionId: string | null;
606
+ startedAt: number | null;
607
+ lastEventId: string | null;
608
+ };
609
+
610
+ /**
611
+ * 职责:内存事件源,按序投递 events 实现 Source 接口。
612
+ * 链路位置:历史回放、测试、AgentSession 只读时间线。
613
+ * 当前裁剪范围:可选 delayMs 模拟流式;不含 SSE 续传。
614
+ */
615
+
616
+ interface ReplaySourceOptions extends ReplayOptions {
617
+ /** 事件间隔毫秒;默认 0 立即投递 */
618
+ delayMs?: number;
619
+ }
620
+ declare function createReplaySource(events: LangchainAgentEvent[], opts?: ReplaySourceOptions): Source;
621
+
622
+ /**
623
+ * 职责:事件分级类型(V2-A classify 层公共契约)。
624
+ * 链路位置:classify.ts → reducer;AgentSession tierOverrides 传入。
625
+ * 当前裁剪范围:四级 tier;不含多会话/Replay 选项。
626
+ */
627
+
628
+ interface ClassifiedEvent {
629
+ event: LangchainAgentEvent;
630
+ tier: EventTier;
631
+ /** 折叠/debug 事件写入的父节点 id(tool:*) */
632
+ parentNodeId?: string;
633
+ }
634
+ /** classify 只读上下文(由 reducer 从 SessionTree 派生) */
635
+ interface ClassifyContext {
636
+ openSubAgentStack: string[];
637
+ /** 当前流式 tool 节点(tool-input-delta 无 tool_call_id 时回退) */
638
+ streamingToolNodeId?: string;
639
+ }
640
+
641
+ /**
642
+ * 职责:LangchainAgentEvent → tier + parentNodeId(纯函数,不改树)。
643
+ * 链路位置:store.applyEvent → classifyEvent → reduceTree。
644
+ * 当前裁剪范围:DEFAULT_EVENT_TIERS + tierOverrides;subagent 折叠事件挂 Agent ToolCallNode。
645
+ */
646
+
647
+ declare function resolveEventTier(eventType: string, overrides?: TierOverrides): EventTier;
648
+ declare function classifyEvent(event: LangchainAgentEvent, ctx: ClassifyContext, overrides?: TierOverrides, eventIndex?: number): ClassifiedEvent;
649
+
650
+ export { Agent, AgentSession, type AgentSessionProps, type AgentxMetaFrame, type AgentxSseSourceOptions, AskUserQuestion, Bash, CanonicalNodeRef, type ClassifiedEvent, type ClassifyContext, CollapseKind, CollapsedExploreNode, type CollapsedExploreNodeProps, DisplayMode, EXPECTED_PROTOCOL_VERSION, Edit, ErrorCard, EventTier, ExploreCollapseAccumulator, GROUPABLE_TOOL_NAMES, Glob, Grep, GroupedToolUseAccumulator, InteractionBus, LangchainAgentEvent, MIN_HINT_DISPLAY_MS, MarkdownRenderer, NodeRegistry, PermissionCard, PermissionUiMode, type ProjectedTimelineItem, ProjectionContext, DisplayMode as ProjectionDisplayMode, Read, ReasoningBubble, type ReduceOptions, ReducerError, RenderableEntry, RenderableTimelineProjector, type ReplayOptions, type ReplaySourceOptions, SHELL_PROGRESS_MIN_ELAPSED_SECONDS, SessionNode, SessionNodeKind, SessionStatus, SessionTree, Skill, Source, Spinner, type SpinnerProps, StepCard, SubAgentBlock, SystemSummaryAccumulator, SystemSummaryNode, Task, TaskList, TaskListFooter, TextBubble, TierOverrides, Timeline, TimelineItem, ToolBodyMode, ToolCallCard, ToolDisplayRegistry, ToolProjectionClassifier, UnknownCard, WebFetch, WebSearch, Write, buildCanonicalFromTree, buildRelevantMemoriesCanonical, buildResumeStreamUrl, buildSystemEventCanonical, buildTimelineEntries, classifyEvent, commandAsHint, createAgentxSseSource, createDefaultRegistry, createMockSource, createReplaySource, entryKey, formatAgentTitle, formatExploreSummaryText, formatHookFinishedSummary, formatShellProgressSuffix, formatTaskFooterLabel, getChildIds, getMainStageIds, isGitOperationCommand, isGroupableToolName, isMcpToolName, iterMountCandidates, projectCanonical, projectTimeline, reduceEvents, reduceTree, replayEvents, replayTree, resolveEventTier, resolveResponseId, resolveShellProgressFromPayload, shouldShowTaskListFooter, streamChunk, useChildren, useInteractionBus, useInternalErrors, useMinDisplayTime, useNode, useNodeTyped, useProjectedTimeline, useReplayTree, useSessionMeta, useSessionStatus, useTimeline };