langchain_agentx_stream_ui 0.1.0 → 0.1.2
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-G2KYJCMM.js → chunk-3B4WC67E.js} +209 -83
- package/dist/chunk-3B4WC67E.js.map +1 -0
- package/dist/chunk-A4W6B7C3.js +1429 -0
- package/dist/chunk-A4W6B7C3.js.map +1 -0
- package/dist/default.css +822 -0
- package/dist/index.d.ts +427 -7
- package/dist/index.js +3072 -229
- package/dist/index.js.map +1 -1
- package/dist/{multi-session-CviqerRl.d.ts → multi-session-DAHwfTNb.d.ts} +52 -30
- package/dist/multi-session.d.ts +1 -1
- package/dist/multi-session.js +2 -2
- package/dist/virtual.d.ts +4 -11
- package/dist/virtual.js +1 -1
- package/package.json +14 -2
- package/dist/chunk-G2KYJCMM.js.map +0 -1
- package/dist/chunk-W6QQHTJ4.js +0 -785
- package/dist/chunk-W6QQHTJ4.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
2
3
|
import { ReactNode } from 'react';
|
|
3
|
-
import { q as Source, L as LangchainAgentEvent, N as NodeRegistry, v as TierOverrides, I as InteractionBus, M as MarkdownRenderer,
|
|
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,
|
|
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';
|
|
5
6
|
import { T as ToolDisplayRegistry, P as PermissionUiMode, b as DisplayMode, c as ProjectionContext, R as RenderableEntry, C as CanonicalNodeRef } from './sessionViewOptions-DLSFRQwZ.js';
|
|
6
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';
|
|
7
8
|
import { a as ToolBodyMode } from './types-aXj5TYSP.js';
|
|
8
9
|
export { T as ToolBodyComponent, b as ToolDisplayProps } from './types-aXj5TYSP.js';
|
|
10
|
+
import { StoreApi } from 'zustand/vanilla';
|
|
9
11
|
export { DEFAULT_ESTIMATE_SIZE, DEFAULT_VIRTUALIZE_THRESHOLD, SessionTimeline, SessionTimelineProps, VirtualTimeline, VirtualTimelineProps } from './virtual.js';
|
|
10
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';
|
|
11
13
|
import { S as SessionNode, a as SessionNodeKind } from './nodes-DqhaBW7M.js';
|
|
12
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';
|
|
13
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';
|
|
14
|
-
import 'zustand/vanilla';
|
|
15
16
|
|
|
16
17
|
interface AgentSessionProps {
|
|
17
18
|
source: Source;
|
|
@@ -48,13 +49,313 @@ interface AgentSessionProps {
|
|
|
48
49
|
}
|
|
49
50
|
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
|
|
|
52
|
+
interface AgentLoopViewProps {
|
|
53
|
+
/** 传入时使用隔离 store(workflow scoped);省略则使用上层 SessionStoreContext */
|
|
54
|
+
tree?: SessionTree;
|
|
55
|
+
showTaskListFooter?: boolean;
|
|
56
|
+
virtualized?: boolean;
|
|
57
|
+
virtualizeThreshold?: number;
|
|
58
|
+
groupParallelTools?: boolean;
|
|
59
|
+
}
|
|
60
|
+
declare function AgentLoopView({ tree, showTaskListFooter, virtualized, virtualizeThreshold, groupParallelTools, }: AgentLoopViewProps): react_jsx_runtime.JSX.Element;
|
|
61
|
+
|
|
62
|
+
/** 宿主按需 replay 某 loopSessionId 的事件(P2 懒加载) */
|
|
63
|
+
type WorkflowLoopReplayHandler = (loopSessionId: string) => void | Promise<void>;
|
|
64
|
+
declare function WorkflowLoopReplayProvider({ onRequestLoopReplay, children, }: {
|
|
65
|
+
onRequestLoopReplay?: WorkflowLoopReplayHandler;
|
|
66
|
+
children: ReactNode;
|
|
67
|
+
}): react_jsx_runtime.JSX.Element;
|
|
68
|
+
|
|
69
|
+
/** Workflow 大规模编排 UI 缩放选项(P1–P4) */
|
|
70
|
+
interface WorkflowScaleOptions {
|
|
71
|
+
/**
|
|
72
|
+
* P1:已弃用 — stage 壳列表不再使用虚拟滚动。
|
|
73
|
+
* 保留字段以保证向后兼容,工作流主链路不再读取此值。
|
|
74
|
+
* @deprecated D25 Phase 1 移除 stage shell virtualization 后不再生效。
|
|
75
|
+
*/
|
|
76
|
+
stageVirtualizeThreshold: number;
|
|
77
|
+
/** P3:默认展示的 completed done stage 上限(running/failed/pending 始终展示) */
|
|
78
|
+
completedStagePageSize: number;
|
|
79
|
+
/** P2:completed 且未 pin 的 loop 树移出内存,保留摘要 */
|
|
80
|
+
evictCompletedLoops: boolean;
|
|
81
|
+
/** P4:running 容器仅 active 自动展开 AgentLoopView */
|
|
82
|
+
onlyExpandActiveRunning: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* P1:已弃用 — parallel item shell 不再使用虚拟滚动(最大并行跨度仅 4)。
|
|
85
|
+
* 保留字段以保证向后兼容,工作流主链路不再读取此值。
|
|
86
|
+
* @deprecated D25 Phase 1 移除 parallel item virtualization 后不再生效。
|
|
87
|
+
*/
|
|
88
|
+
parallelItemVirtualizeThreshold: number;
|
|
89
|
+
/** P2:completed hydrated loop 热缓存上限(默认 4,与最大并行跨度对齐) */
|
|
90
|
+
maxHydratedCompletedLoops: number;
|
|
91
|
+
}
|
|
92
|
+
declare const DEFAULT_WORKFLOW_SCALE_OPTIONS: WorkflowScaleOptions;
|
|
93
|
+
|
|
94
|
+
interface WorkflowSessionProps {
|
|
95
|
+
source: Source;
|
|
96
|
+
initialEvents?: LangchainAgentEvent[];
|
|
97
|
+
registry?: NodeRegistry;
|
|
98
|
+
tierOverrides?: TierOverrides;
|
|
99
|
+
onError?: (error: Error) => void;
|
|
100
|
+
interactionBus?: InteractionBus;
|
|
101
|
+
toolDisplayRegistry?: ToolDisplayRegistry;
|
|
102
|
+
defaultBodyMode?: ToolBodyMode;
|
|
103
|
+
permissionUiMode?: PermissionUiMode;
|
|
104
|
+
markdownRenderer?: MarkdownRenderer;
|
|
105
|
+
displayMode?: DisplayMode;
|
|
106
|
+
verbose?: boolean;
|
|
107
|
+
exploreFullscreenBash?: boolean;
|
|
108
|
+
memoryDir?: string | null;
|
|
109
|
+
workspaceRoot?: string | null;
|
|
110
|
+
virtualized?: boolean;
|
|
111
|
+
virtualizeThreshold?: number;
|
|
112
|
+
groupParallelTools?: boolean;
|
|
113
|
+
/** P1–P4:大规模 workflow 缩放选项 */
|
|
114
|
+
workflowScale?: Partial<WorkflowScaleOptions>;
|
|
115
|
+
/** P2:展开已淘汰 loop 时由宿主 replay 事件 */
|
|
116
|
+
onRequestLoopReplay?: WorkflowLoopReplayHandler;
|
|
117
|
+
children?: ReactNode;
|
|
118
|
+
}
|
|
119
|
+
declare function WorkflowSession({ source, initialEvents, registry, tierOverrides, onError, interactionBus, toolDisplayRegistry, defaultBodyMode, permissionUiMode, markdownRenderer, displayMode, verbose, exploreFullscreenBash, memoryDir, workspaceRoot, virtualized, virtualizeThreshold, groupParallelTools, workflowScale, onRequestLoopReplay, children, }: WorkflowSessionProps): react_jsx_runtime.JSX.Element;
|
|
120
|
+
|
|
121
|
+
declare const WorkflowScaleContext: react.Context<WorkflowScaleOptions>;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* workflowDisplay.ts — SDK WorkflowDisplayPayload 契约(TS)
|
|
125
|
+
*
|
|
126
|
+
* 职责:
|
|
127
|
+
* 对齐 langchain_agentx WorkflowDisplayPayload;结构事件 data.display 类型。
|
|
128
|
+
*
|
|
129
|
+
* 链路位置:
|
|
130
|
+
* workflowContainerProjector → WorkflowChrome(P2+)。
|
|
131
|
+
*
|
|
132
|
+
* 当前裁剪范围:
|
|
133
|
+
* 只读消费;不计算 display(由 SDK enricher 注入)。
|
|
134
|
+
*/
|
|
135
|
+
type WorkflowDisplayScope = 'workflow' | 'stage' | 'item' | 'branch' | 'aggregate' | 'subworkflow';
|
|
136
|
+
type WorkflowDisplayStatus = 'pending' | 'running' | 'completed' | 'failed' | 'skipped' | 'cancelled' | 'blocked' | 'retrying';
|
|
137
|
+
/** 对齐 SDK display_resolver.WorkflowDisplayPayload */
|
|
138
|
+
interface WorkflowDisplayPayload {
|
|
139
|
+
version?: number;
|
|
140
|
+
scope?: WorkflowDisplayScope;
|
|
141
|
+
title?: string;
|
|
142
|
+
description?: string;
|
|
143
|
+
workflow_title?: string;
|
|
144
|
+
workflow_description?: string;
|
|
145
|
+
parent_title?: string;
|
|
146
|
+
breadcrumb?: string[];
|
|
147
|
+
progress_current?: number;
|
|
148
|
+
progress_total?: number;
|
|
149
|
+
progress_label?: string;
|
|
150
|
+
progress_indeterminate?: boolean;
|
|
151
|
+
status?: WorkflowDisplayStatus;
|
|
152
|
+
status_reason?: string;
|
|
153
|
+
icon?: string;
|
|
154
|
+
item_index?: number;
|
|
155
|
+
item_total?: number;
|
|
156
|
+
metrics_completed?: number;
|
|
157
|
+
metrics_running?: number;
|
|
158
|
+
metrics_failed?: number;
|
|
159
|
+
metrics_total?: number;
|
|
160
|
+
decision_label?: string;
|
|
161
|
+
pattern?: string;
|
|
162
|
+
debug_key?: string;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* workflowContainer.ts — Workflow 容器树投影类型
|
|
167
|
+
*
|
|
168
|
+
* 职责:
|
|
169
|
+
* 容器节点、正文块、快照;对齐 SDK workflow_container_projector。
|
|
170
|
+
*
|
|
171
|
+
* 链路位置:
|
|
172
|
+
* workflowContainerProjector → workflowReducer(P1+)→ WorkflowChrome(P2+)。
|
|
173
|
+
*
|
|
174
|
+
* 当前裁剪范围:
|
|
175
|
+
* 不含 React 视图 props;仅投影层 state。
|
|
176
|
+
*/
|
|
177
|
+
|
|
178
|
+
type WorkflowContainerScope = 'workflow' | 'stage' | 'item' | 'branch' | 'aggregate' | 'subworkflow';
|
|
179
|
+
type WorkflowContainerStatus = 'pending' | 'running' | 'completed' | 'failed' | 'skipped' | 'cancelled' | 'blocked' | 'retrying';
|
|
180
|
+
type ContentBlockKind = 'reasoning' | 'text' | 'tool';
|
|
181
|
+
interface WorkflowContentBlock {
|
|
182
|
+
kind: ContentBlockKind;
|
|
183
|
+
preview: string;
|
|
184
|
+
tool_name: string | null;
|
|
185
|
+
}
|
|
186
|
+
interface WorkflowContainerNode {
|
|
187
|
+
container_id: string;
|
|
188
|
+
scope: WorkflowContainerScope;
|
|
189
|
+
workflow_path: string;
|
|
190
|
+
workflow_depth: number;
|
|
191
|
+
scope_key: string;
|
|
192
|
+
title: string;
|
|
193
|
+
subtitle: string;
|
|
194
|
+
status: WorkflowContainerStatus;
|
|
195
|
+
pattern: string;
|
|
196
|
+
parent_container_id: string | null;
|
|
197
|
+
display: WorkflowDisplayPayload | null;
|
|
198
|
+
content_blocks: WorkflowContentBlock[];
|
|
199
|
+
is_open: boolean;
|
|
200
|
+
}
|
|
201
|
+
/** reducer 运行时节点:投影字段 + loop 绑定(P1) */
|
|
202
|
+
interface WorkflowContainerRuntimeNode extends WorkflowContainerNode {
|
|
203
|
+
loopSessionId: string | null;
|
|
204
|
+
}
|
|
205
|
+
/** WorkflowSession 容器树 state(P1+) */
|
|
206
|
+
interface WorkflowContainerTreeState {
|
|
207
|
+
rootContainerIds: string[];
|
|
208
|
+
activeContainerIds: string[];
|
|
209
|
+
containersById: Record<string, WorkflowContainerRuntimeNode>;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
interface WorkflowStageListPartition {
|
|
213
|
+
visible: WorkflowContainerRuntimeNode[];
|
|
214
|
+
hiddenCount: number;
|
|
215
|
+
total: number;
|
|
216
|
+
/** 当前已展示的 done stage 数量 */
|
|
217
|
+
visibleDoneCount: number;
|
|
218
|
+
/** done stage 总数 */
|
|
219
|
+
totalDoneCount: number;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* P3:running / failed / pending / blocked 全显;
|
|
223
|
+
* done 按 maxVisibleDoneCount 分页展示(默认最近 completedStagePageSize 条)。
|
|
224
|
+
* maxVisibleDoneCount 由 WorkflowStageListPanel 的 "Show N more" 逐页递增。
|
|
225
|
+
*/
|
|
226
|
+
declare function partitionWorkflowStages(stages: WorkflowContainerRuntimeNode[], maxVisibleDoneCount: number): WorkflowStageListPartition;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* workflowSession.ts — Workflow 会话顶层状态
|
|
230
|
+
*
|
|
231
|
+
* 职责:
|
|
232
|
+
* 定义 /workflow 页专用 WorkflowSessionState(与 /chat SessionTree 隔离)。
|
|
233
|
+
*
|
|
234
|
+
* 链路位置:
|
|
235
|
+
* workflowReducer → workflowSessionStore → WorkflowSession / WorkflowChrome。
|
|
236
|
+
*
|
|
237
|
+
* 当前裁剪范围:
|
|
238
|
+
* 不含合并 TaskListFooter(P3);parallel 结构仅基础字段。
|
|
239
|
+
*/
|
|
240
|
+
|
|
241
|
+
/** P2:stage 完成摘要缓存(loop 树淘汰后仍显示 teaser) */
|
|
242
|
+
interface CachedStageDoneSummary {
|
|
243
|
+
label: string;
|
|
244
|
+
teaser: string;
|
|
245
|
+
extraLines: number;
|
|
246
|
+
}
|
|
247
|
+
type WorkflowRunStatus = 'running' | 'done' | 'error';
|
|
248
|
+
interface WorkflowStageProgress {
|
|
249
|
+
stageKey: string;
|
|
250
|
+
stageIndex: number;
|
|
251
|
+
stageTotal?: number;
|
|
252
|
+
status: 'pending' | 'running' | 'done' | 'failed';
|
|
253
|
+
error?: string;
|
|
254
|
+
}
|
|
255
|
+
interface ParallelItemProgress {
|
|
256
|
+
itemKey: string;
|
|
257
|
+
itemIndex: number;
|
|
258
|
+
itemTotal?: number;
|
|
259
|
+
status: 'pending' | 'running' | 'done' | 'failed';
|
|
260
|
+
loopSessionId: string | null;
|
|
261
|
+
error?: string;
|
|
262
|
+
}
|
|
263
|
+
interface WorkflowProgressState {
|
|
264
|
+
workflowId: string | null;
|
|
265
|
+
workflowPath: string | null;
|
|
266
|
+
status: WorkflowRunStatus;
|
|
267
|
+
stages: WorkflowStageProgress[];
|
|
268
|
+
parallelItems: Record<string, ParallelItemProgress>;
|
|
269
|
+
}
|
|
270
|
+
type WorkflowScopeKind = 'stage' | 'parallel-item' | 'subworkflow';
|
|
271
|
+
interface WorkflowScopeFrame {
|
|
272
|
+
kind: WorkflowScopeKind;
|
|
273
|
+
key: string;
|
|
274
|
+
loopSessionId: string | null;
|
|
275
|
+
}
|
|
276
|
+
interface WorkflowSessionState {
|
|
277
|
+
status: SessionStatus;
|
|
278
|
+
meta: {
|
|
279
|
+
workflowRunId: string | null;
|
|
280
|
+
startedAt: number | null;
|
|
281
|
+
lastEventId: string | null;
|
|
282
|
+
};
|
|
283
|
+
/** SDK 容器树投影 + loopSessionId 绑定(P1 主模型) */
|
|
284
|
+
containerTree: WorkflowContainerTreeState;
|
|
285
|
+
/** 过渡期 dual-write;P2+ UI 逐步改读 containerTree */
|
|
286
|
+
workflowProgress: WorkflowProgressState;
|
|
287
|
+
loopTreesBySessionId: Record<string, SessionTree>;
|
|
288
|
+
/** P2:container_id → done 摘要(loop 淘汰后) */
|
|
289
|
+
stageDoneSummariesByContainerId: Record<string, CachedStageDoneSummary>;
|
|
290
|
+
/** P2:completed hydrated loop LRU 热缓存(最近使用在数组尾部) */
|
|
291
|
+
hotCompletedLoopSessionIds: string[];
|
|
292
|
+
activeLoopSessionId: string | null;
|
|
293
|
+
/** @deprecated P1 起由 containerTree.activeContainerIds 替代 */
|
|
294
|
+
openScopeStack: WorkflowScopeFrame[];
|
|
295
|
+
internalErrors: ReducerError[];
|
|
296
|
+
}
|
|
297
|
+
declare function createEmptyWorkflowSessionState(): WorkflowSessionState;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* workflowSessionStore.ts — Workflow 页 zustand store
|
|
301
|
+
*
|
|
302
|
+
* 职责:
|
|
303
|
+
* Source 事件写入 WorkflowSessionState;与 SessionStore 平行隔离。
|
|
304
|
+
*
|
|
305
|
+
* 链路位置:
|
|
306
|
+
* WorkflowSession Provider → applyEvent。
|
|
307
|
+
*
|
|
308
|
+
* 当前裁剪范围:
|
|
309
|
+
* 无多会话 Tab;dedupe 与 SessionStore 同构。
|
|
310
|
+
*/
|
|
311
|
+
|
|
312
|
+
interface WorkflowSessionStoreOptions {
|
|
313
|
+
tierOverrides?: TierOverrides;
|
|
314
|
+
initialEventCount?: number;
|
|
315
|
+
initialSeenEventIds?: Iterable<string>;
|
|
316
|
+
/** P2:completed loop 树内存淘汰(默认 true) */
|
|
317
|
+
evictCompletedLoops?: boolean;
|
|
318
|
+
/** P2:completed hydrated loop 热缓存上限(默认 4) */
|
|
319
|
+
maxHydratedCompletedLoops?: number;
|
|
320
|
+
}
|
|
321
|
+
interface WorkflowSessionStoreState {
|
|
322
|
+
state: WorkflowSessionState;
|
|
323
|
+
eventCount: number;
|
|
324
|
+
applyEvent: (event: LangchainAgentEvent, ctx?: SourceEventContext) => void;
|
|
325
|
+
applyEvents: (events: LangchainAgentEvent[]) => void;
|
|
326
|
+
reset: () => void;
|
|
327
|
+
markAsError: (error?: Error) => void;
|
|
328
|
+
/** P2:展开 done stage 时 pin,避免淘汰 */
|
|
329
|
+
pinLoopSession: (loopSessionId: string) => void;
|
|
330
|
+
/** P2:宿主 replay 后灌入 loop 树 */
|
|
331
|
+
hydrateLoopSession: (loopSessionId: string, events: LangchainAgentEvent[]) => void;
|
|
332
|
+
}
|
|
333
|
+
type WorkflowSessionStore = StoreApi<WorkflowSessionStoreState>;
|
|
334
|
+
declare function createWorkflowSessionStore(initialState?: WorkflowSessionState, storeOptions?: WorkflowSessionStoreOptions): WorkflowSessionStore;
|
|
335
|
+
|
|
336
|
+
declare function useWorkflowSessionStoreApi(): WorkflowSessionStore;
|
|
337
|
+
declare function useWorkflowSessionStatus(): SessionStatus;
|
|
338
|
+
|
|
339
|
+
interface WorkflowChromeProps {
|
|
340
|
+
containerTree: WorkflowContainerTreeState;
|
|
341
|
+
loopTreesBySessionId?: Record<string, SessionTree>;
|
|
342
|
+
virtualized?: boolean;
|
|
343
|
+
virtualizeThreshold?: number;
|
|
344
|
+
groupParallelTools?: boolean;
|
|
345
|
+
}
|
|
346
|
+
declare function WorkflowChrome({ containerTree, loopTreesBySessionId, virtualized, virtualizeThreshold, groupParallelTools, }: WorkflowChromeProps): react_jsx_runtime.JSX.Element;
|
|
347
|
+
|
|
348
|
+
declare function WorkflowTaskListFooter(): react_jsx_runtime.JSX.Element | null;
|
|
349
|
+
|
|
51
350
|
interface TimelineItemProps {
|
|
52
351
|
nodeId: string;
|
|
53
352
|
registry: NodeRegistry;
|
|
54
353
|
}
|
|
55
354
|
declare function TimelineItem({ nodeId, registry }: TimelineItemProps): react_jsx_runtime.JSX.Element | null;
|
|
56
355
|
|
|
57
|
-
declare function Timeline(
|
|
356
|
+
declare function Timeline({ showTaskListFooter }: {
|
|
357
|
+
showTaskListFooter?: boolean;
|
|
358
|
+
}): react_jsx_runtime.JSX.Element;
|
|
58
359
|
|
|
59
360
|
interface SpinnerElapsedInput {
|
|
60
361
|
/** 当前 wall-clock(ms) */
|
|
@@ -164,6 +465,8 @@ declare function streamChunk(data: {
|
|
|
164
465
|
}): string;
|
|
165
466
|
/** Pure reducer: tree + event → new tree. */
|
|
166
467
|
declare function reduceTree(tree: SessionTree, event: LangchainAgentEvent, eventIndex: number, options?: ReduceOptions): SessionTree;
|
|
468
|
+
/** Agent loop 归约(/chat 根树与 workflow per-loop 子树共用)。 */
|
|
469
|
+
declare const reduceAgentLoopEvent: typeof reduceTree;
|
|
167
470
|
/** Reduce a sequence of events from empty tree. */
|
|
168
471
|
declare function reduceEvents(events: LangchainAgentEvent[], options?: ReduceOptions): SessionTree;
|
|
169
472
|
/** Collect main-stage node ids for Timeline rendering. */
|
|
@@ -469,6 +772,53 @@ declare function buildTimelineEntries(rootIds: string[], byId: Record<string, Se
|
|
|
469
772
|
|
|
470
773
|
declare function formatAgentTitle(input: unknown, display: unknown): string;
|
|
471
774
|
|
|
775
|
+
interface RichMarkdownProps {
|
|
776
|
+
content: string;
|
|
777
|
+
className?: string;
|
|
778
|
+
}
|
|
779
|
+
/** Web 向富 Markdown(TextNode S1);含 Mermaid、GFM、代码高亮。 */
|
|
780
|
+
declare function RichMarkdown({ content, className }: RichMarkdownProps): react_jsx_runtime.JSX.Element | null;
|
|
781
|
+
|
|
782
|
+
interface MermaidDiagramProps {
|
|
783
|
+
chart: string;
|
|
784
|
+
className?: string;
|
|
785
|
+
/** 画布内 svg-pan-zoom */
|
|
786
|
+
zoomingEnabled?: boolean;
|
|
787
|
+
/** 工具栏全屏与点击放大 */
|
|
788
|
+
fullscreenEnabled?: boolean;
|
|
789
|
+
}
|
|
790
|
+
declare function MermaidDiagram({ chart, className, zoomingEnabled, fullscreenEnabled, }: MermaidDiagramProps): react_jsx_runtime.JSX.Element;
|
|
791
|
+
|
|
792
|
+
type MermaidThemeName = 'neutral' | 'default' | 'dark' | 'forest' | 'base';
|
|
793
|
+
interface MermaidInitOptions {
|
|
794
|
+
theme?: MermaidThemeName;
|
|
795
|
+
maxTextSize?: number;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
/** 覆盖默认 mermaid 初始化(需在首次 render 前调用) */
|
|
799
|
+
declare function configureMermaid(options: MermaidInitOptions): void;
|
|
800
|
+
|
|
801
|
+
interface PlantUMLBlockProps {
|
|
802
|
+
content: string;
|
|
803
|
+
className?: string;
|
|
804
|
+
}
|
|
805
|
+
/** PlantUML 源码块(高亮 + 拷贝;供 sourceOnly / 降级展示) */
|
|
806
|
+
declare function PlantUMLBlock({ content, className }: PlantUMLBlockProps): react_jsx_runtime.JSX.Element;
|
|
807
|
+
|
|
808
|
+
interface PlantUMLDiagramProps {
|
|
809
|
+
content: string;
|
|
810
|
+
className?: string;
|
|
811
|
+
/** Kroki 或兼容渲染服务根 URL */
|
|
812
|
+
serverUrl?: string;
|
|
813
|
+
fullscreenEnabled?: boolean;
|
|
814
|
+
/** 仅源码高亮,不请求渲染 */
|
|
815
|
+
sourceOnly?: boolean;
|
|
816
|
+
}
|
|
817
|
+
declare function PlantUMLDiagram({ content, className, serverUrl, fullscreenEnabled, sourceOnly, }: PlantUMLDiagramProps): react_jsx_runtime.JSX.Element;
|
|
818
|
+
|
|
819
|
+
/** 配置 PlantUML 渲染服务(默认 Kroki:https://kroki.io) */
|
|
820
|
+
declare function configurePlantumlServer(url: string): void;
|
|
821
|
+
|
|
472
822
|
/**
|
|
473
823
|
* toolNames.ts — CC PascalCase 工具名 SSOT(对齐 SDK registry_names.py)
|
|
474
824
|
*
|
|
@@ -527,27 +877,63 @@ declare function useMinDisplayTime<T>(value: T, minMs?: number): T;
|
|
|
527
877
|
|
|
528
878
|
declare function useInteractionBus(): InteractionBus;
|
|
529
879
|
|
|
880
|
+
/**
|
|
881
|
+
* applicationKind.ts — SSE meta application_kind 契约
|
|
882
|
+
*
|
|
883
|
+
* 职责:
|
|
884
|
+
* 定义双轨 SSE 出口 kind 枚举与 mismatch 错误类型。
|
|
885
|
+
*
|
|
886
|
+
* 链路位置:
|
|
887
|
+
* createAgentxSseSource meta 握手校验。
|
|
888
|
+
*
|
|
889
|
+
* 当前裁剪范围:
|
|
890
|
+
* 仅 agent_session / workflow;无自动推断。
|
|
891
|
+
*/
|
|
892
|
+
type ApplicationKind = 'agent_session' | 'workflow';
|
|
893
|
+
declare class ApplicationKindMismatchError extends Error {
|
|
894
|
+
readonly name = "ApplicationKindMismatchError";
|
|
895
|
+
readonly expected: ApplicationKind;
|
|
896
|
+
readonly actual: string | undefined;
|
|
897
|
+
constructor(expected: ApplicationKind, actual: string | undefined);
|
|
898
|
+
}
|
|
899
|
+
declare class MissingApplicationKindError extends Error {
|
|
900
|
+
readonly name = "MissingApplicationKindError";
|
|
901
|
+
constructor();
|
|
902
|
+
}
|
|
903
|
+
|
|
530
904
|
/**
|
|
531
905
|
* 职责:浏览器 EventSource 封装,解码 meta/agentx 命名帧并校验协议版本。
|
|
532
906
|
* 链路位置:业务页面 createAgentxSseSource({ url }) → AgentSession source prop。
|
|
533
|
-
*
|
|
907
|
+
*
|
|
908
|
+
* 错误分层(对齐 claude-code SSETransport / Messages 管线):
|
|
909
|
+
* - 传输 terminal:握手前/未 finish 断连 → reject(SseTransportTerminalError),不进 Timeline
|
|
910
|
+
* - 传输 benign:finish/error 帧后的 EventSource.onerror → resolve
|
|
911
|
+
* - 业务层:agentx event_type=error → reducer → ErrorNode(唯一用户可见错误文案)
|
|
534
912
|
*/
|
|
535
913
|
|
|
536
914
|
declare const EXPECTED_PROTOCOL_VERSION = "1";
|
|
915
|
+
/** 传输层 terminal 失败(须排查/fix);与 agentx error 帧(业务错误)分离。 */
|
|
916
|
+
type SseTransportFailureKind = 'handshake_failed' | 'premature_close';
|
|
917
|
+
declare class SseTransportTerminalError extends Error {
|
|
918
|
+
readonly kind: SseTransportFailureKind;
|
|
919
|
+
constructor(kind: SseTransportFailureKind, message: string);
|
|
920
|
+
}
|
|
537
921
|
interface AgentxSseSourceOptions {
|
|
538
922
|
url: string;
|
|
539
|
-
onError?: (error: Error) => void;
|
|
540
923
|
autoReconnect?: boolean;
|
|
541
924
|
reconnectDelayMs?: number;
|
|
542
925
|
/** 每收到 agentx 帧 SSE id 时回调(含续传重叠 id) */
|
|
543
926
|
onLastEventId?: (id: string) => void;
|
|
544
927
|
/** 测试注入:替换全局 EventSource */
|
|
545
928
|
EventSourceImpl?: typeof EventSource;
|
|
929
|
+
/** /chat 与 /workflow 必填:校验 meta.application_kind */
|
|
930
|
+
expectedApplicationKind?: ApplicationKind;
|
|
546
931
|
}
|
|
547
932
|
interface AgentxMetaFrame {
|
|
548
933
|
protocol_version: string;
|
|
549
934
|
session_id?: string | null;
|
|
550
935
|
started_at?: number;
|
|
936
|
+
application_kind?: ApplicationKind;
|
|
551
937
|
}
|
|
552
938
|
/** 手动重连时追加 resume 查询参数(EventSource 无法设 Last-Event-ID 请求头)。 */
|
|
553
939
|
declare function buildResumeStreamUrl(baseUrl: string, lastEventId: string | null | undefined, queryParam?: string): string;
|
|
@@ -619,6 +1005,40 @@ interface ReplaySourceOptions extends ReplayOptions {
|
|
|
619
1005
|
}
|
|
620
1006
|
declare function createReplaySource(events: LangchainAgentEvent[], opts?: ReplaySourceOptions): Source;
|
|
621
1007
|
|
|
1008
|
+
/**
|
|
1009
|
+
* workflowReducer.ts — WorkflowSession 容器树 + agent loop 双轨归约
|
|
1010
|
+
*
|
|
1011
|
+
* 职责:
|
|
1012
|
+
* 结构事件经 WorkflowContainerTreeProjector 更新 containerTree;
|
|
1013
|
+
* agent 事件 bind loopSessionId 并写入 loopTreesBySessionId。
|
|
1014
|
+
*
|
|
1015
|
+
* 链路位置:
|
|
1016
|
+
* workflowSessionStore.applyEvent → reduceWorkflowSession。
|
|
1017
|
+
*
|
|
1018
|
+
* 当前裁剪范围:
|
|
1019
|
+
* workflowProgress 为过渡期 dual-write;P2+ UI 改读 containerTree。
|
|
1020
|
+
*/
|
|
1021
|
+
|
|
1022
|
+
/** Pure reducer:Workflow 会话状态 + 单条事件。 */
|
|
1023
|
+
declare function reduceWorkflowSession(state: WorkflowSessionState, event: LangchainAgentEvent, eventIndex: number, options?: ReduceOptions): WorkflowSessionState;
|
|
1024
|
+
/** 从空状态回放 workflow 事件序列。 */
|
|
1025
|
+
declare function reduceWorkflowEvents(events: LangchainAgentEvent[], options?: ReduceOptions): WorkflowSessionState;
|
|
1026
|
+
|
|
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
|
+
*/
|
|
1039
|
+
declare const WORKFLOW_STRUCTURE_EVENT_TYPES: ReadonlySet<string>;
|
|
1040
|
+
declare function isWorkflowStructureEventType(eventType: string): boolean;
|
|
1041
|
+
|
|
622
1042
|
/**
|
|
623
1043
|
* 职责:事件分级类型(V2-A classify 层公共契约)。
|
|
624
1044
|
* 链路位置:classify.ts → reducer;AgentSession tierOverrides 传入。
|
|
@@ -647,4 +1067,4 @@ interface ClassifyContext {
|
|
|
647
1067
|
declare function resolveEventTier(eventType: string, overrides?: TierOverrides): EventTier;
|
|
648
1068
|
declare function classifyEvent(event: LangchainAgentEvent, ctx: ClassifyContext, overrides?: TierOverrides, eventIndex?: number): ClassifiedEvent;
|
|
649
1069
|
|
|
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 };
|
|
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 };
|