@yieldfabric/terminal 1.0.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.
- package/README.md +118 -0
- package/dist/index.cjs +14143 -0
- package/dist/index.d.cts +2308 -0
- package/dist/index.d.ts +2308 -0
- package/dist/index.js +14040 -0
- package/package.json +84 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2308 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { NodeProps, EdgeProps, Node, Edge } from '@xyflow/react';
|
|
4
|
+
|
|
5
|
+
/** Reply-path override surfaced in the chat input toolbar. Maps to the
|
|
6
|
+
* backend's `reasoning` field on `POST /chat`:
|
|
7
|
+
* - `null` — default; the intent classifier decides whether to
|
|
8
|
+
* invoke a deep reasoning pass.
|
|
9
|
+
* - `'reason'` — `reasoning: true`; force deep collaborative reasoning,
|
|
10
|
+
* bypassing the classifier.
|
|
11
|
+
*
|
|
12
|
+
* The vocabulary editor and similar fast-response contexts use
|
|
13
|
+
* `reasoning: false` directly in their request body — there is no toggle
|
|
14
|
+
* state for that since it's a per-context decision, not a user choice. */
|
|
15
|
+
type ReasoningMode = 'reason';
|
|
16
|
+
|
|
17
|
+
interface TerminalTheme {
|
|
18
|
+
primary: string;
|
|
19
|
+
primaryMuted: string;
|
|
20
|
+
primaryHover: string;
|
|
21
|
+
bgBase: string;
|
|
22
|
+
bgRaised: string;
|
|
23
|
+
bgRaisedAlt: string;
|
|
24
|
+
bgRaisedHover: string;
|
|
25
|
+
bgOverlay: string;
|
|
26
|
+
bgHeader: string;
|
|
27
|
+
bgInput: string;
|
|
28
|
+
border: string;
|
|
29
|
+
borderLight: string;
|
|
30
|
+
borderStrong: string;
|
|
31
|
+
text: string;
|
|
32
|
+
textSecondary: string;
|
|
33
|
+
textMuted: string;
|
|
34
|
+
textInverse: string;
|
|
35
|
+
success: string;
|
|
36
|
+
error: string;
|
|
37
|
+
warning: string;
|
|
38
|
+
info: string;
|
|
39
|
+
textSystem: string;
|
|
40
|
+
textCommand: string;
|
|
41
|
+
textResponse: string;
|
|
42
|
+
codeBg: string;
|
|
43
|
+
codeText: string;
|
|
44
|
+
headingText: string;
|
|
45
|
+
buttonBg: string;
|
|
46
|
+
buttonHover: string;
|
|
47
|
+
buttonUploadBg: string;
|
|
48
|
+
buttonFilesBg: string;
|
|
49
|
+
buttonShadow: string;
|
|
50
|
+
scopeBorder: string;
|
|
51
|
+
scopeBg: string;
|
|
52
|
+
collabBorder: string;
|
|
53
|
+
collabBg: string;
|
|
54
|
+
reasoningBorder: string;
|
|
55
|
+
reasoningBg: string;
|
|
56
|
+
reasoningAccent: string;
|
|
57
|
+
pipelineBg: string;
|
|
58
|
+
shadowModal: string;
|
|
59
|
+
shadowDropdown: string;
|
|
60
|
+
radius: string;
|
|
61
|
+
radiusSm: string;
|
|
62
|
+
radiusLg: string;
|
|
63
|
+
cursor: string;
|
|
64
|
+
}
|
|
65
|
+
declare const defaultTheme: TerminalTheme;
|
|
66
|
+
declare const TerminalThemeProvider: React.Provider<TerminalTheme>;
|
|
67
|
+
declare function useTheme(): TerminalTheme;
|
|
68
|
+
declare function mergeTheme(overrides?: Partial<TerminalTheme>): TerminalTheme;
|
|
69
|
+
/** @deprecated Use useTheme() or defaultTheme instead */
|
|
70
|
+
declare const purple: {
|
|
71
|
+
readonly border: string;
|
|
72
|
+
readonly borderLight: string;
|
|
73
|
+
readonly borderMedium: string;
|
|
74
|
+
readonly borderStrong: string;
|
|
75
|
+
readonly borderHeavy: "rgba(51, 51, 51, 0.8)";
|
|
76
|
+
readonly borderExtraLight: "rgba(40, 40, 40, 0.4)";
|
|
77
|
+
readonly borderHighlight: string;
|
|
78
|
+
readonly bg: string;
|
|
79
|
+
readonly bgLight: string;
|
|
80
|
+
readonly bgMedium: string;
|
|
81
|
+
readonly bgStrong: string;
|
|
82
|
+
readonly bgHeavy: "rgba(51, 51, 51, 0.6)";
|
|
83
|
+
readonly bgButton: string;
|
|
84
|
+
readonly bgDark: "#181818";
|
|
85
|
+
readonly bgDarker: "#181818";
|
|
86
|
+
readonly bgHover: string;
|
|
87
|
+
readonly text: string;
|
|
88
|
+
readonly textMuted: string;
|
|
89
|
+
};
|
|
90
|
+
/** @deprecated Use useTheme() or defaultTheme instead */
|
|
91
|
+
declare const greenAction: {
|
|
92
|
+
readonly border: "border-green-800/50";
|
|
93
|
+
readonly borderStyle: "1px solid rgba(22, 101, 52, 0.5)";
|
|
94
|
+
readonly bg: "rgba(20, 80, 40, 0.2)";
|
|
95
|
+
readonly bgHover: "rgba(20, 100, 50, 0.3)";
|
|
96
|
+
};
|
|
97
|
+
/** @deprecated Use useTheme() or defaultTheme instead */
|
|
98
|
+
declare const warmBg: {
|
|
99
|
+
readonly header: string;
|
|
100
|
+
readonly card: "rgba(50, 45, 40, 0.90)";
|
|
101
|
+
readonly cardAlt: string;
|
|
102
|
+
readonly cardHover: string;
|
|
103
|
+
readonly button: string;
|
|
104
|
+
readonly buttonHover: string;
|
|
105
|
+
readonly buttonUpload: string;
|
|
106
|
+
readonly buttonFiles: string;
|
|
107
|
+
};
|
|
108
|
+
/** @deprecated Use useTheme() or defaultTheme instead */
|
|
109
|
+
declare const orangeRebuttal: {
|
|
110
|
+
readonly border: string;
|
|
111
|
+
readonly borderLight: "rgba(251, 146, 60, 0.15)";
|
|
112
|
+
readonly bg: "rgba(251, 146, 60, 0.05)";
|
|
113
|
+
readonly bgCard: "rgba(251, 146, 60, 0.06)";
|
|
114
|
+
};
|
|
115
|
+
/** @deprecated Use useTheme() or defaultTheme instead */
|
|
116
|
+
declare const emeraldRevised: {
|
|
117
|
+
readonly border: "rgba(52, 211, 153, 0.25)";
|
|
118
|
+
readonly bg: "rgba(52, 211, 153, 0.05)";
|
|
119
|
+
};
|
|
120
|
+
/** @deprecated Use useTheme() or defaultTheme instead */
|
|
121
|
+
declare const blueScope: {
|
|
122
|
+
readonly border: string;
|
|
123
|
+
readonly bg: string;
|
|
124
|
+
};
|
|
125
|
+
/** @deprecated Use useTheme() or defaultTheme instead */
|
|
126
|
+
declare const emeraldCollab: {
|
|
127
|
+
readonly border: string;
|
|
128
|
+
readonly bg: string;
|
|
129
|
+
};
|
|
130
|
+
/** @deprecated Use useTheme() or defaultTheme instead */
|
|
131
|
+
declare const pipelineBg: string;
|
|
132
|
+
/** @deprecated Use defaultTheme.buttonShadow instead */
|
|
133
|
+
declare const buttonShadow: string;
|
|
134
|
+
/** @deprecated Use useTheme() or defaultTheme instead */
|
|
135
|
+
declare const hostApp: {
|
|
136
|
+
readonly bg: "#181818";
|
|
137
|
+
readonly bgCard: string;
|
|
138
|
+
readonly bgCardAlt: string;
|
|
139
|
+
readonly bgSurface: string;
|
|
140
|
+
readonly border: string;
|
|
141
|
+
readonly borderLight: string;
|
|
142
|
+
readonly primary: string;
|
|
143
|
+
readonly textPrimary: string;
|
|
144
|
+
readonly textSecondary: string;
|
|
145
|
+
readonly textMuted: string;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
interface AIAction {
|
|
149
|
+
action_type: string;
|
|
150
|
+
payload: any;
|
|
151
|
+
description?: string;
|
|
152
|
+
metadata?: {
|
|
153
|
+
amount?: number;
|
|
154
|
+
currency?: string;
|
|
155
|
+
formatted_amount?: string;
|
|
156
|
+
description?: string;
|
|
157
|
+
from?: string;
|
|
158
|
+
to?: string;
|
|
159
|
+
status?: string;
|
|
160
|
+
payment_id?: string;
|
|
161
|
+
[key: string]: any;
|
|
162
|
+
};
|
|
163
|
+
/** When true, the UI shows a confirm/cancel step before executing. */
|
|
164
|
+
requires_confirmation?: boolean;
|
|
165
|
+
confirmation_message?: string;
|
|
166
|
+
/** Multi-party approval chain for this action. */
|
|
167
|
+
approval?: {
|
|
168
|
+
required_approvers: Array<{
|
|
169
|
+
entity_id: string;
|
|
170
|
+
display_name?: string;
|
|
171
|
+
role?: string;
|
|
172
|
+
}>;
|
|
173
|
+
current_approvals: Array<{
|
|
174
|
+
entity_id: string;
|
|
175
|
+
display_name?: string;
|
|
176
|
+
approved_at?: string;
|
|
177
|
+
}>;
|
|
178
|
+
status: 'pending' | 'partially_approved' | 'approved' | 'rejected';
|
|
179
|
+
min_approvals?: number;
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/** Identity of a message sender (human, agent, or system). */
|
|
183
|
+
interface MessageSender {
|
|
184
|
+
entity_id: string;
|
|
185
|
+
display_name: string;
|
|
186
|
+
type?: 'human' | 'agent' | 'system';
|
|
187
|
+
role?: 'moderator' | 'participant' | 'observer';
|
|
188
|
+
avatar_color?: string;
|
|
189
|
+
/** Uploaded avatar image URL. Takes precedence when set. */
|
|
190
|
+
avatar_url?: string;
|
|
191
|
+
/** Pre-resolved glyph (emoji/icon char) from the host app's avatar
|
|
192
|
+
* catalog. Rendered inside a circle when `avatar_url` is absent. */
|
|
193
|
+
avatar_glyph?: string;
|
|
194
|
+
/** Tailwind/CSS class for the glyph's background circle. Used when
|
|
195
|
+
* `avatar_glyph` is set. */
|
|
196
|
+
avatar_bg_class?: string;
|
|
197
|
+
}
|
|
198
|
+
/** Parsed @-mention within a message. */
|
|
199
|
+
interface Mention {
|
|
200
|
+
entity_id: string;
|
|
201
|
+
display_name: string;
|
|
202
|
+
start_index: number;
|
|
203
|
+
end_index: number;
|
|
204
|
+
}
|
|
205
|
+
/** Command entry for the / command palette. */
|
|
206
|
+
interface TerminalCommand {
|
|
207
|
+
id: string;
|
|
208
|
+
label: string;
|
|
209
|
+
description: string;
|
|
210
|
+
category?: 'built-in' | 'custom';
|
|
211
|
+
}
|
|
212
|
+
/** Target for @-mention autocomplete (humans, agents, @all). */
|
|
213
|
+
interface MentionTarget {
|
|
214
|
+
entity_id: string;
|
|
215
|
+
display_name: string;
|
|
216
|
+
type?: 'human' | 'agent' | 'special';
|
|
217
|
+
role?: string;
|
|
218
|
+
status?: 'active' | 'idle' | 'offline';
|
|
219
|
+
}
|
|
220
|
+
/** Audience envelope for directed messages. */
|
|
221
|
+
interface MessageAudience {
|
|
222
|
+
type: 'all' | 'direct';
|
|
223
|
+
recipients: string[];
|
|
224
|
+
}
|
|
225
|
+
interface ReasoningSnapshot {
|
|
226
|
+
iteration?: number;
|
|
227
|
+
maxIterations?: number;
|
|
228
|
+
phase?: string;
|
|
229
|
+
agents?: {
|
|
230
|
+
id: string;
|
|
231
|
+
status: string;
|
|
232
|
+
display_name?: string;
|
|
233
|
+
role?: string;
|
|
234
|
+
focus?: string;
|
|
235
|
+
}[];
|
|
236
|
+
narrativeBlocks: string[];
|
|
237
|
+
agentThinking: Record<string, string>;
|
|
238
|
+
agentOutputs?: Record<string, {
|
|
239
|
+
role: string;
|
|
240
|
+
content: string;
|
|
241
|
+
confidence?: number;
|
|
242
|
+
}>;
|
|
243
|
+
agentRebuttals?: Record<string, {
|
|
244
|
+
role: string;
|
|
245
|
+
content: string;
|
|
246
|
+
agreements: string[];
|
|
247
|
+
disagreements: string[];
|
|
248
|
+
}>;
|
|
249
|
+
knowledgeGraph?: LegacyKGSnapshot;
|
|
250
|
+
genericKG?: GenericKGSnapshot;
|
|
251
|
+
elapsedMs?: number;
|
|
252
|
+
cancelled?: boolean;
|
|
253
|
+
/** Total turns recorded in this run (terminal informational). */
|
|
254
|
+
turn?: number;
|
|
255
|
+
/** Pipeline run id this snapshot was captured from. */
|
|
256
|
+
run_id?: string;
|
|
257
|
+
}
|
|
258
|
+
interface PipelineBuilderAction {
|
|
259
|
+
action: 'add_steps' | 'remove_step' | 'edit_step' | 'clear_all' | 'set_template_name' | 'set_pipeline_name';
|
|
260
|
+
steps?: PipelineDraftStep[];
|
|
261
|
+
index?: number;
|
|
262
|
+
label?: string;
|
|
263
|
+
config?: Record<string, any>;
|
|
264
|
+
name?: string;
|
|
265
|
+
}
|
|
266
|
+
interface PipelineDraft {
|
|
267
|
+
draft_id: string | null;
|
|
268
|
+
group_id: string;
|
|
269
|
+
name: string;
|
|
270
|
+
description?: string;
|
|
271
|
+
steps: PipelineDraftStep[];
|
|
272
|
+
explanation?: string;
|
|
273
|
+
status: 'draft' | 'preview' | 'submitted' | 'rejected';
|
|
274
|
+
}
|
|
275
|
+
interface PipelineDraftStep {
|
|
276
|
+
step_key: string;
|
|
277
|
+
name: string;
|
|
278
|
+
step_type: string;
|
|
279
|
+
step_config: Record<string, any>;
|
|
280
|
+
depends_on: string[];
|
|
281
|
+
assignee_type?: string;
|
|
282
|
+
assignee_id?: string;
|
|
283
|
+
input_bindings?: Record<string, any>;
|
|
284
|
+
}
|
|
285
|
+
interface TerminalSource {
|
|
286
|
+
id: string;
|
|
287
|
+
label: string;
|
|
288
|
+
type?: string;
|
|
289
|
+
typeColor?: string;
|
|
290
|
+
description?: string;
|
|
291
|
+
}
|
|
292
|
+
interface TerminalEntry {
|
|
293
|
+
id?: string;
|
|
294
|
+
type: 'system' | 'command' | 'info' | 'response' | 'error' | 'success';
|
|
295
|
+
content: string;
|
|
296
|
+
timestamp: Date;
|
|
297
|
+
suggestions?: PageSuggestion[];
|
|
298
|
+
suggested_actions?: AIAction[];
|
|
299
|
+
reasoning_snapshot?: ReasoningSnapshot;
|
|
300
|
+
pipeline_draft?: PipelineDraft;
|
|
301
|
+
/** Message sender for multi-party attribution. */
|
|
302
|
+
sender?: MessageSender;
|
|
303
|
+
/** Parsed @-mentions in this message. */
|
|
304
|
+
mentions?: Mention[];
|
|
305
|
+
/** KG id (kgf.knowledge_graphs.id) this message is bound to — when set,
|
|
306
|
+
* renders a "View Knowledge Graph" button. Replaces the legacy
|
|
307
|
+
* `reasoning_set_id`. */
|
|
308
|
+
kg_id?: string;
|
|
309
|
+
/** Pipeline run id (kgf.pipeline_runs.id) this message was generated from.
|
|
310
|
+
* Used to subscribe to `/pipelines/:run_id/events` for delta updates. */
|
|
311
|
+
run_id?: string;
|
|
312
|
+
/** Source citations attached to this response. */
|
|
313
|
+
sources?: TerminalSource[];
|
|
314
|
+
/** Arbitrary data for custom rendering via renderEntryExtra. */
|
|
315
|
+
metadata?: Record<string, any>;
|
|
316
|
+
}
|
|
317
|
+
interface ApiEndpoint {
|
|
318
|
+
id: string;
|
|
319
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
320
|
+
path: string;
|
|
321
|
+
description: string;
|
|
322
|
+
category: string;
|
|
323
|
+
params: ApiParameter[];
|
|
324
|
+
baseUrl: string;
|
|
325
|
+
isGraphQL?: boolean;
|
|
326
|
+
}
|
|
327
|
+
interface ApiParameter {
|
|
328
|
+
name: string;
|
|
329
|
+
type: string;
|
|
330
|
+
required: boolean;
|
|
331
|
+
description: string;
|
|
332
|
+
example: string;
|
|
333
|
+
}
|
|
334
|
+
interface TerminalCommandResult {
|
|
335
|
+
success: boolean;
|
|
336
|
+
message?: string;
|
|
337
|
+
error?: string;
|
|
338
|
+
data?: any;
|
|
339
|
+
}
|
|
340
|
+
interface PageSuggestion {
|
|
341
|
+
id: string;
|
|
342
|
+
title: string;
|
|
343
|
+
description: string;
|
|
344
|
+
path: string;
|
|
345
|
+
keywords: string[];
|
|
346
|
+
icon: string;
|
|
347
|
+
}
|
|
348
|
+
interface TerminalConfig {
|
|
349
|
+
endpoints: ApiEndpoint[];
|
|
350
|
+
helpTopics?: HelpTopic[];
|
|
351
|
+
pageSuggestions?: PageSuggestion[];
|
|
352
|
+
apiBaseUrl?: string;
|
|
353
|
+
agentsApiUrl?: string;
|
|
354
|
+
/** Unified GraphQL endpoint for entity/wallet/asset queries in action cards. */
|
|
355
|
+
graphqlUrl?: string;
|
|
356
|
+
welcomeMessage?: string;
|
|
357
|
+
showWelcomeMessage?: boolean;
|
|
358
|
+
/** Custom commands shown in the / command palette alongside built-ins. */
|
|
359
|
+
customCommands?: TerminalCommand[];
|
|
360
|
+
}
|
|
361
|
+
interface HelpTopic {
|
|
362
|
+
name: string;
|
|
363
|
+
content: string;
|
|
364
|
+
}
|
|
365
|
+
interface GapOption {
|
|
366
|
+
id: string;
|
|
367
|
+
label: string;
|
|
368
|
+
}
|
|
369
|
+
interface GapQuestion {
|
|
370
|
+
question: string;
|
|
371
|
+
options: GapOption[];
|
|
372
|
+
allow_multiple: boolean;
|
|
373
|
+
}
|
|
374
|
+
interface TeamSetupAgent {
|
|
375
|
+
id: string;
|
|
376
|
+
display_name: string;
|
|
377
|
+
role: string;
|
|
378
|
+
expertise: string[];
|
|
379
|
+
focus?: string;
|
|
380
|
+
}
|
|
381
|
+
/** Lightweight KG projection used by `ReasoningSnapshot` to capture a
|
|
382
|
+
* point-in-time view of the live graph. The richer `KGSnapshot` from
|
|
383
|
+
* `kg/snapshot.rs` lives in `src/knowledge/types.ts` and is fetched
|
|
384
|
+
* separately from `GET /kgs/:id`. */
|
|
385
|
+
interface LegacyKGSnapshotNode {
|
|
386
|
+
id: string;
|
|
387
|
+
node_type: string;
|
|
388
|
+
label: string;
|
|
389
|
+
description: string;
|
|
390
|
+
confidence?: number;
|
|
391
|
+
source?: string;
|
|
392
|
+
iteration?: number;
|
|
393
|
+
}
|
|
394
|
+
interface LegacyKGSnapshotEdge {
|
|
395
|
+
id: string;
|
|
396
|
+
edge_type: string;
|
|
397
|
+
from: string;
|
|
398
|
+
to: string;
|
|
399
|
+
strength?: number;
|
|
400
|
+
label: string;
|
|
401
|
+
}
|
|
402
|
+
interface LegacyKGSnapshot {
|
|
403
|
+
nodes: LegacyKGSnapshotNode[];
|
|
404
|
+
edges: LegacyKGSnapshotEdge[];
|
|
405
|
+
node_count: number;
|
|
406
|
+
edge_count: number;
|
|
407
|
+
iteration: number;
|
|
408
|
+
}
|
|
409
|
+
type ClaimStatus = 'proposed' | 'supported' | 'challenged' | 'accepted' | 'rejected';
|
|
410
|
+
interface Annotation {
|
|
411
|
+
id: string;
|
|
412
|
+
agent_id: string;
|
|
413
|
+
annotation_type: 'support' | 'question' | 'challenge' | 'claim' | 'disagreement';
|
|
414
|
+
content: string;
|
|
415
|
+
resolved: boolean;
|
|
416
|
+
resolution: string | null;
|
|
417
|
+
source?: string;
|
|
418
|
+
}
|
|
419
|
+
interface GenericSnapshotNode {
|
|
420
|
+
id: string;
|
|
421
|
+
node_type: string;
|
|
422
|
+
label: string;
|
|
423
|
+
description: string;
|
|
424
|
+
confidence: number;
|
|
425
|
+
/** @deprecated Use claim_status instead */
|
|
426
|
+
phase?: 'problem' | 'solution' | 'simple';
|
|
427
|
+
claim_status?: ClaimStatus;
|
|
428
|
+
settled: boolean;
|
|
429
|
+
annotation_count: number;
|
|
430
|
+
unresolved_count: number;
|
|
431
|
+
created_by: string | null;
|
|
432
|
+
annotations: Annotation[];
|
|
433
|
+
}
|
|
434
|
+
interface GenericSnapshotEdge {
|
|
435
|
+
id: string;
|
|
436
|
+
from: string;
|
|
437
|
+
to: string;
|
|
438
|
+
relationship: string;
|
|
439
|
+
description: string;
|
|
440
|
+
confidence: number;
|
|
441
|
+
settled: boolean;
|
|
442
|
+
claim_status?: ClaimStatus;
|
|
443
|
+
/** Agent that proposed this claim. */
|
|
444
|
+
created_by?: string;
|
|
445
|
+
triple: string;
|
|
446
|
+
annotations: Annotation[];
|
|
447
|
+
}
|
|
448
|
+
interface GenericKGSnapshot {
|
|
449
|
+
node_count: number;
|
|
450
|
+
edge_count: number;
|
|
451
|
+
settled_count: number;
|
|
452
|
+
unsettled_count: number;
|
|
453
|
+
nodes: GenericSnapshotNode[];
|
|
454
|
+
edges: GenericSnapshotEdge[];
|
|
455
|
+
}
|
|
456
|
+
/** Unified progress event consumed by the reasoning UI. The discriminator
|
|
457
|
+
* union covers both the legacy PascalCase variants and the snake_case
|
|
458
|
+
* `TransformProgress` variants from `/pipelines/:run_id/events`. */
|
|
459
|
+
interface ReasoningProgressEvent {
|
|
460
|
+
type: 'Connected' | 'IterationStart' | 'PhaseStart' | 'AgentStatus' | 'CoherenceAssessment' | 'StepUpdate' | 'SolutionCoherence' | 'Convergence' | 'Synthesizing' | 'NarrativeText' | 'WaitingForInput' | 'AgentThinking' | 'AgentComplete' | 'TeamSetup' | 'KnowledgeGraphUpdate' | 'GenericKGUpdate' | 'RebuttalStart' | 'AgentRebuttal' | 'RevisedProcessStart' | 'TurnStart' | 'TurnComplete' | 'ConvergenceUpdate' | 'PhaseAdvanced' | 'PhaseBacktracked' | 'VerificationRan' | 'ProxyMutationsApplied' | 'SystemResponse' | 'SchemaTypeAdded' | 'ClaimStatusChanged' | 'SchemaSeeded' | 'SchemaReconciled' | 'pipeline_started' | 'pipeline_step_started' | 'pipeline_step_complete' | 'pipeline_checkpoint' | 'pipeline_paused' | 'pipeline_complete' | 'pipeline_failed' | 'transform_started' | 'transform_complete' | 'turn_started' | 'turn_complete' | 'input_processed' | 'agent_invoked' | 'agent_inner_round_complete' | 'agent_done' | 'node_added' | 'edge_added' | 'annotated' | 'annotation_resolved' | 'dedup_collapsed' | 'edge_dropped' | 'vocabulary_evolved' | 'schema_verified' | 'claim_status_changed' | 'convergence_update' | 'persisted' | 'kg_updated' | 'read_tool_called' | 'read_tool_result' | 'side_effect_executed' | 'waiting_for_input' | 'human_input_received' | 'transform_extension';
|
|
461
|
+
iteration?: number;
|
|
462
|
+
max_iterations?: number;
|
|
463
|
+
phase?: string;
|
|
464
|
+
description?: string;
|
|
465
|
+
agents?: {
|
|
466
|
+
id: string;
|
|
467
|
+
status: string;
|
|
468
|
+
display_name?: string;
|
|
469
|
+
role?: string;
|
|
470
|
+
focus?: string;
|
|
471
|
+
}[];
|
|
472
|
+
coverage?: number;
|
|
473
|
+
harmony?: number;
|
|
474
|
+
grounding?: number;
|
|
475
|
+
overall?: number;
|
|
476
|
+
is_coherent?: boolean;
|
|
477
|
+
step?: string;
|
|
478
|
+
detail?: string;
|
|
479
|
+
requirements_met?: boolean;
|
|
480
|
+
score?: number;
|
|
481
|
+
target?: number;
|
|
482
|
+
text?: string;
|
|
483
|
+
prompt?: string;
|
|
484
|
+
context?: string;
|
|
485
|
+
agent_id?: string;
|
|
486
|
+
snippet?: string;
|
|
487
|
+
role?: string;
|
|
488
|
+
content?: string;
|
|
489
|
+
confidence?: number;
|
|
490
|
+
questions?: GapQuestion[];
|
|
491
|
+
team_agents?: TeamSetupAgent[];
|
|
492
|
+
snapshot?: LegacyKGSnapshot;
|
|
493
|
+
generic_snapshot?: GenericKGSnapshot;
|
|
494
|
+
agreements?: string[];
|
|
495
|
+
disagreements?: string[];
|
|
496
|
+
turn?: number;
|
|
497
|
+
max_turns?: number;
|
|
498
|
+
active_agents?: string[];
|
|
499
|
+
from?: string;
|
|
500
|
+
to?: string;
|
|
501
|
+
mode?: string;
|
|
502
|
+
ontological?: boolean;
|
|
503
|
+
epistemic?: boolean;
|
|
504
|
+
converged?: boolean;
|
|
505
|
+
errors?: number;
|
|
506
|
+
warnings?: number;
|
|
507
|
+
entity_id?: string;
|
|
508
|
+
node_count?: number;
|
|
509
|
+
edge_count?: number;
|
|
510
|
+
type_name?: string;
|
|
511
|
+
added_by?: string;
|
|
512
|
+
edge_id?: string;
|
|
513
|
+
old_status?: string;
|
|
514
|
+
new_status?: string;
|
|
515
|
+
node_type_count?: number;
|
|
516
|
+
edge_type_count?: number;
|
|
517
|
+
has_constraints?: boolean;
|
|
518
|
+
novel_types_merged?: number;
|
|
519
|
+
novel_types_kept?: number;
|
|
520
|
+
needs_repass?: boolean;
|
|
521
|
+
/** Pipeline run id (kgf.pipeline_runs.id). */
|
|
522
|
+
run_id?: string;
|
|
523
|
+
/** KG id (kgf.knowledge_graphs.id) — both for tagging and for `pipeline_complete`. */
|
|
524
|
+
kg_id?: string;
|
|
525
|
+
/** Pipeline kind: file_extraction | reasoning | extract_then_reason. */
|
|
526
|
+
kind?: string;
|
|
527
|
+
total_steps?: number;
|
|
528
|
+
step_index?: number;
|
|
529
|
+
step_kind?: string;
|
|
530
|
+
name?: string;
|
|
531
|
+
/** For `pipeline_checkpoint`. */
|
|
532
|
+
checkpoint_id?: string;
|
|
533
|
+
reason?: string;
|
|
534
|
+
payload?: any;
|
|
535
|
+
requires_user_action?: boolean;
|
|
536
|
+
total_inputs?: number;
|
|
537
|
+
total_nodes?: number;
|
|
538
|
+
total_edges?: number;
|
|
539
|
+
index?: number;
|
|
540
|
+
total?: number;
|
|
541
|
+
label?: string;
|
|
542
|
+
round?: number;
|
|
543
|
+
mutations?: number;
|
|
544
|
+
reads?: number;
|
|
545
|
+
key?: string;
|
|
546
|
+
node_type?: string;
|
|
547
|
+
edge_type?: string;
|
|
548
|
+
layer?: string;
|
|
549
|
+
target_key?: string;
|
|
550
|
+
annotation_type?: string;
|
|
551
|
+
annotation_id?: string;
|
|
552
|
+
proposed_key?: string;
|
|
553
|
+
matched_key?: string;
|
|
554
|
+
action?: string;
|
|
555
|
+
added_node_types?: number;
|
|
556
|
+
added_edge_types?: number;
|
|
557
|
+
novel_node_types?: any[];
|
|
558
|
+
novel_edge_types?: any[];
|
|
559
|
+
nodes?: number;
|
|
560
|
+
edges?: number;
|
|
561
|
+
chunk_links?: number;
|
|
562
|
+
tool?: string;
|
|
563
|
+
query?: string;
|
|
564
|
+
result_summary?: string;
|
|
565
|
+
pending_guidance?: number;
|
|
566
|
+
pending_proxy_mutations?: number;
|
|
567
|
+
/** For human_input_received: kind of input (proceed/done/cancel/guidance/agent_done/proxy_mutation/rewind). */
|
|
568
|
+
input_kind?: string;
|
|
569
|
+
input_label?: string;
|
|
570
|
+
/** @deprecated alias of `kg_id`, kept for transitional compatibility. */
|
|
571
|
+
reasoning_set_id?: string;
|
|
572
|
+
/** @deprecated alias of `thread_id`, kept for transitional compatibility. */
|
|
573
|
+
reasoning_thread_id?: string;
|
|
574
|
+
thread_id?: string;
|
|
575
|
+
}
|
|
576
|
+
interface StreamChunk {
|
|
577
|
+
chunk?: string;
|
|
578
|
+
thread_id?: string;
|
|
579
|
+
/** KG id (kgf.knowledge_graphs.id) this chunk belongs to. */
|
|
580
|
+
kg_id?: string;
|
|
581
|
+
/** Pipeline run id (kgf.pipeline_runs.id). */
|
|
582
|
+
run_id?: string;
|
|
583
|
+
/** @deprecated alias of `kg_id`, kept for transitional compatibility. */
|
|
584
|
+
reasoning_set_id?: string;
|
|
585
|
+
/** @deprecated alias of `thread_id`, kept for transitional compatibility. */
|
|
586
|
+
reasoning_thread_id?: string;
|
|
587
|
+
is_final?: boolean;
|
|
588
|
+
suggested_actions?: any[];
|
|
589
|
+
page_suggestions?: PageSuggestion[];
|
|
590
|
+
progress?: ReasoningProgressEvent;
|
|
591
|
+
processing_mode?: string;
|
|
592
|
+
collaboration?: {
|
|
593
|
+
session_id?: string;
|
|
594
|
+
input_mode?: 'open_floor' | 'moderated' | 'round_robin';
|
|
595
|
+
participants?: Array<{
|
|
596
|
+
entity_id: string;
|
|
597
|
+
display_name?: string;
|
|
598
|
+
role?: 'moderator' | 'participant' | 'observer';
|
|
599
|
+
status?: 'active' | 'idle' | 'offline';
|
|
600
|
+
}>;
|
|
601
|
+
};
|
|
602
|
+
knowledge?: {
|
|
603
|
+
nodes_count?: number;
|
|
604
|
+
edges_count?: number;
|
|
605
|
+
top_nodes?: Array<{
|
|
606
|
+
id: string;
|
|
607
|
+
type?: string;
|
|
608
|
+
description?: string;
|
|
609
|
+
}>;
|
|
610
|
+
/** Node ids that the response actually grounded on. Used by the chat
|
|
611
|
+
* panel to highlight cited nodes in the surrounding KG view. */
|
|
612
|
+
nodes_used?: string[];
|
|
613
|
+
};
|
|
614
|
+
/** Top-level shortcut for `knowledge.nodes_used`, supported by some backends. */
|
|
615
|
+
nodes_used?: string[];
|
|
616
|
+
pipeline_draft?: PipelineDraft;
|
|
617
|
+
pipeline_actions?: PipelineBuilderAction[];
|
|
618
|
+
/** Sender identity for attributed messages in multi-party sessions. */
|
|
619
|
+
sender?: MessageSender;
|
|
620
|
+
/** Source citations for RAG-grounded responses. */
|
|
621
|
+
sources?: TerminalSource[];
|
|
622
|
+
/** Real-time approval update for a previously suggested action. */
|
|
623
|
+
approval_update?: {
|
|
624
|
+
action_id: string;
|
|
625
|
+
entity_id: string;
|
|
626
|
+
display_name?: string;
|
|
627
|
+
decision: 'approved' | 'rejected';
|
|
628
|
+
timestamp: string;
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
interface StreamHandler {
|
|
632
|
+
onChunk: (chunk: StreamChunk) => void;
|
|
633
|
+
onComplete: () => void;
|
|
634
|
+
onError: (error: string) => void;
|
|
635
|
+
}
|
|
636
|
+
interface WorkingGroupContext {
|
|
637
|
+
workingGroupId: string;
|
|
638
|
+
pageKey: string;
|
|
639
|
+
pageTitle?: string;
|
|
640
|
+
}
|
|
641
|
+
interface KGScope {
|
|
642
|
+
/** KG id (kgf.knowledge_graphs.id). */
|
|
643
|
+
kgId: string;
|
|
644
|
+
label: string;
|
|
645
|
+
nodeCount?: number;
|
|
646
|
+
}
|
|
647
|
+
interface FileUploadResult {
|
|
648
|
+
success: boolean;
|
|
649
|
+
message?: string;
|
|
650
|
+
documentsIngested?: number;
|
|
651
|
+
failedFiles?: string[];
|
|
652
|
+
data?: any;
|
|
653
|
+
/** Pipeline runs spawned by `POST /pipelines/ingest-document`, one per
|
|
654
|
+
* uploaded file. The terminal subscribes to `/pipelines/:run_id/events`
|
|
655
|
+
* for each one to render upload + extraction progress. */
|
|
656
|
+
pipelineRuns?: Array<{
|
|
657
|
+
run_id: string;
|
|
658
|
+
kg_id: string;
|
|
659
|
+
/** Original file name, for display. */
|
|
660
|
+
title?: string;
|
|
661
|
+
}>;
|
|
662
|
+
}
|
|
663
|
+
interface ListedRagFile {
|
|
664
|
+
id: string;
|
|
665
|
+
title: string;
|
|
666
|
+
document_type?: string;
|
|
667
|
+
status?: string;
|
|
668
|
+
summary?: string;
|
|
669
|
+
url?: string;
|
|
670
|
+
}
|
|
671
|
+
interface ListRagFilesResult {
|
|
672
|
+
success: boolean;
|
|
673
|
+
message?: string;
|
|
674
|
+
files?: ListedRagFile[];
|
|
675
|
+
}
|
|
676
|
+
interface RagFileActionResult {
|
|
677
|
+
success: boolean;
|
|
678
|
+
message?: string;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
interface TerminalPlugin {
|
|
682
|
+
name: string;
|
|
683
|
+
handleCommand?: (command: string, endpoint?: ApiEndpoint, params?: Record<string, string>) => Promise<TerminalCommandResult | null>;
|
|
684
|
+
handleStream?: (command: string, handlers: StreamHandlers) => Promise<void>;
|
|
685
|
+
onInit?: () => void;
|
|
686
|
+
onDestroy?: () => void;
|
|
687
|
+
}
|
|
688
|
+
interface StreamHandlers {
|
|
689
|
+
onChunk: (chunk: StreamChunk) => void;
|
|
690
|
+
onComplete: () => void;
|
|
691
|
+
onError: (error: string) => void;
|
|
692
|
+
}
|
|
693
|
+
interface PluginContext {
|
|
694
|
+
config: any;
|
|
695
|
+
apiService?: any;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
/** Live reasoning progress state managed via reduceProgress. */
|
|
699
|
+
interface ProgressState {
|
|
700
|
+
iteration?: number;
|
|
701
|
+
maxIterations?: number;
|
|
702
|
+
phase?: string;
|
|
703
|
+
phaseDescription?: string;
|
|
704
|
+
agents?: {
|
|
705
|
+
id: string;
|
|
706
|
+
status: string;
|
|
707
|
+
display_name?: string;
|
|
708
|
+
role?: string;
|
|
709
|
+
focus?: string;
|
|
710
|
+
}[];
|
|
711
|
+
coherence?: {
|
|
712
|
+
coverage: number;
|
|
713
|
+
harmony: number;
|
|
714
|
+
grounding: number;
|
|
715
|
+
overall: number;
|
|
716
|
+
isCoherent: boolean;
|
|
717
|
+
};
|
|
718
|
+
currentStep?: string;
|
|
719
|
+
stepDetail?: string;
|
|
720
|
+
solutionCoherence?: {
|
|
721
|
+
overall: number;
|
|
722
|
+
requirementsMet: boolean;
|
|
723
|
+
};
|
|
724
|
+
convergence?: {
|
|
725
|
+
score: number;
|
|
726
|
+
target: number;
|
|
727
|
+
};
|
|
728
|
+
synthesizing: boolean;
|
|
729
|
+
narrativeBlocks: string[];
|
|
730
|
+
waitingForInput: boolean;
|
|
731
|
+
inputPrompt?: string;
|
|
732
|
+
inputContext?: string;
|
|
733
|
+
inputQuestions?: GapQuestion[];
|
|
734
|
+
threadId?: string;
|
|
735
|
+
agentThinking: Record<string, string>;
|
|
736
|
+
agentOutputs: Record<string, {
|
|
737
|
+
role: string;
|
|
738
|
+
content: string;
|
|
739
|
+
confidence?: number;
|
|
740
|
+
}>;
|
|
741
|
+
teamSetup?: TeamSetupAgent[];
|
|
742
|
+
knowledgeGraph?: LegacyKGSnapshot;
|
|
743
|
+
genericKG?: GenericKGSnapshot;
|
|
744
|
+
connectionLost?: boolean;
|
|
745
|
+
startedAtMs?: number;
|
|
746
|
+
lastUpdateAtMs?: number;
|
|
747
|
+
rebuttalPhase?: 'rebuttal' | 'revised' | null;
|
|
748
|
+
turn?: number;
|
|
749
|
+
maxTurns?: number;
|
|
750
|
+
activeAgents?: string[];
|
|
751
|
+
pipelinePhase?: string;
|
|
752
|
+
ontologicalConverged?: boolean;
|
|
753
|
+
epistemicConverged?: boolean;
|
|
754
|
+
converged?: boolean;
|
|
755
|
+
reasoningGoal?: string;
|
|
756
|
+
/** Ordered list of pipeline phases visited */
|
|
757
|
+
pipelinePhases?: string[];
|
|
758
|
+
agentRebuttals?: Record<string, {
|
|
759
|
+
role: string;
|
|
760
|
+
content: string;
|
|
761
|
+
agreements: string[];
|
|
762
|
+
disagreements: string[];
|
|
763
|
+
}>;
|
|
764
|
+
}
|
|
765
|
+
/** Capture a snapshot of current reasoning state for history. */
|
|
766
|
+
declare function captureReasoningSnapshot(state: ProgressState, cancelled?: boolean): ReasoningSnapshot;
|
|
767
|
+
/** Pure reducer: apply a ReasoningProgressEvent to ProgressState. */
|
|
768
|
+
declare function reduceProgress(state: ProgressState, event: ReasoningProgressEvent): ProgressState;
|
|
769
|
+
|
|
770
|
+
/** A registered custom widget that renders per-entry when its condition is met. */
|
|
771
|
+
interface TerminalWidget {
|
|
772
|
+
/** Unique key for React reconciliation. */
|
|
773
|
+
name: string;
|
|
774
|
+
/** Return true to render this widget for the given entry. */
|
|
775
|
+
match: (entry: TerminalEntry) => boolean;
|
|
776
|
+
/** The widget component. Receives the entry and its index. */
|
|
777
|
+
render: (props: {
|
|
778
|
+
entry: TerminalEntry;
|
|
779
|
+
index: number;
|
|
780
|
+
}) => React.ReactNode;
|
|
781
|
+
/** Where to render relative to built-in widgets. Default: 'after'. */
|
|
782
|
+
position?: 'before' | 'after' | 'replace';
|
|
783
|
+
}
|
|
784
|
+
/** Slot-based injection points for persistent content around the terminal. */
|
|
785
|
+
interface TerminalSlots {
|
|
786
|
+
/** Rendered inside the header bar, after the brain icon and before the settings button. */
|
|
787
|
+
headerExtra?: React.ReactNode;
|
|
788
|
+
/** Rendered at the top of the scrollable body, before any entries. */
|
|
789
|
+
beforeEntries?: React.ReactNode;
|
|
790
|
+
/** Rendered at the bottom of the scrollable body, after all entries. */
|
|
791
|
+
afterEntries?: React.ReactNode;
|
|
792
|
+
/** Rendered inside the input bar area, between the toolbar hints and the action buttons. */
|
|
793
|
+
inputBarExtra?: React.ReactNode;
|
|
794
|
+
/** When provided, **replaces** the default Auto/Reason mode selector in the
|
|
795
|
+
* input bar toolbar. Consumers can inject any button (e.g. Direct/Coach in
|
|
796
|
+
* the Agent Studio) while keeping the same toolbar position and styling. */
|
|
797
|
+
modeSelector?: React.ReactNode;
|
|
798
|
+
}
|
|
799
|
+
/** Props shared by both StandardTerminal and ChatTerminal. */
|
|
800
|
+
interface BaseTerminalProps {
|
|
801
|
+
/** Custom theme overrides — merged with defaultTheme. */
|
|
802
|
+
theme?: Partial<TerminalTheme>;
|
|
803
|
+
config: TerminalConfig;
|
|
804
|
+
className?: string;
|
|
805
|
+
style?: React.CSSProperties;
|
|
806
|
+
showHeader?: boolean;
|
|
807
|
+
showWelcomeMessage?: boolean;
|
|
808
|
+
initialHistory?: TerminalEntry[];
|
|
809
|
+
onHistoryChange?: (history: TerminalEntry[]) => void;
|
|
810
|
+
onStreamRequest?: (command: string, handlers: {
|
|
811
|
+
onChunk: (chunk: StreamChunk) => void;
|
|
812
|
+
onComplete: () => void;
|
|
813
|
+
onError: (error: string) => void;
|
|
814
|
+
}, options?: {
|
|
815
|
+
reasoningMode?: ReasoningMode | null;
|
|
816
|
+
}) => Promise<void>;
|
|
817
|
+
/** Current reply-path mode: 'auto' (intent classifier decides) or 'quick'
|
|
818
|
+
* (skip classification, fast direct LLM). Controlled — when omitted, the
|
|
819
|
+
* terminal manages its own internal state. */
|
|
820
|
+
reasoningMode?: ReasoningMode | null;
|
|
821
|
+
onReasoningModeChange?: (mode: ReasoningMode | null) => void;
|
|
822
|
+
onResolveWorkingGroup?: () => Promise<WorkingGroupContext | null>;
|
|
823
|
+
workingGroupContext?: WorkingGroupContext | null;
|
|
824
|
+
onRagFileUpload?: (files: File[], context?: WorkingGroupContext | null) => Promise<FileUploadResult>;
|
|
825
|
+
onListRagFiles?: (context?: WorkingGroupContext | null) => Promise<ListRagFilesResult>;
|
|
826
|
+
onDeleteRagFile?: (documentId: string, context?: WorkingGroupContext | null) => Promise<RagFileActionResult>;
|
|
827
|
+
onDownloadRagFile?: (documentId: string, title?: string, context?: WorkingGroupContext | null) => Promise<RagFileActionResult>;
|
|
828
|
+
onPipelineDraftEdit?: (draft: PipelineDraft) => Promise<void>;
|
|
829
|
+
onPipelineDraftReject?: (draft: PipelineDraft) => Promise<void>;
|
|
830
|
+
/** Persist a free-form prose note via the host's notebook service.
|
|
831
|
+
* Wired by both the `/note` slash command (workspace scope) and
|
|
832
|
+
* the `/personal` slash command (force personal scope from inside
|
|
833
|
+
* a team workspace). The `scope` arg lets the host route to the
|
|
834
|
+
* right notebook KG; absent → workspace (the legacy default).
|
|
835
|
+
* Returns a short message the terminal echoes as a success/error
|
|
836
|
+
* line. */
|
|
837
|
+
onSubmitNote?: (prose: string, scope?: 'workspace' | 'personal') => Promise<{
|
|
838
|
+
ok: boolean;
|
|
839
|
+
message: string;
|
|
840
|
+
}>;
|
|
841
|
+
/** Resolve a partial `@<query>` typed inside a slash command (e.g.
|
|
842
|
+
* `/note @wi`) to substrate entities. The terminal renders the
|
|
843
|
+
* results as a picker popover; selecting one replaces the query
|
|
844
|
+
* with `@<display_name> ` and notifies via `onMentionPicked`.
|
|
845
|
+
* `command` is the active slash-command name (e.g. `'note'` or
|
|
846
|
+
* `'personal'`) so hosts can scope candidates per-command. */
|
|
847
|
+
onMentionResolve?: (query: string, command?: string) => Promise<Array<{
|
|
848
|
+
entity_id: string;
|
|
849
|
+
display_name: string;
|
|
850
|
+
concept_type?: string;
|
|
851
|
+
}>>;
|
|
852
|
+
/** Notified when the user picks an entity from the slash-command
|
|
853
|
+
* mention picker. Hosts use this to remember the explicit pick so
|
|
854
|
+
* `onSubmitNote` can use the precise frame_id rather than relying
|
|
855
|
+
* on a label re-lookup at submit time. */
|
|
856
|
+
onMentionPicked?: (entity: {
|
|
857
|
+
entity_id: string;
|
|
858
|
+
display_name: string;
|
|
859
|
+
}) => void;
|
|
860
|
+
onPageNavigation?: (page: PageSuggestion) => void;
|
|
861
|
+
availableKGs?: KGScope[];
|
|
862
|
+
activeKGScope?: KGScope | null;
|
|
863
|
+
onKGScopeChange?: (scope: KGScope | null) => void;
|
|
864
|
+
onViewKnowledgeGraph?: (snapshot: GenericKGSnapshot | LegacyKGSnapshot) => void;
|
|
865
|
+
onLiveKGUpdate?: (snapshot: GenericKGSnapshot) => void;
|
|
866
|
+
/** Called when the active KG id changes. Replaces `onReasoningSetIdChange`. */
|
|
867
|
+
onKgIdChange?: (id: string | null) => void;
|
|
868
|
+
/** Called when the active pipeline run id changes (used by hosts that
|
|
869
|
+
* want to mirror the run id into URL state or open a debug pane). */
|
|
870
|
+
onRunIdChange?: (id: string | null) => void;
|
|
871
|
+
/** Called when the active conversational thread id changes. Replaces
|
|
872
|
+
* `onReasoningThreadIdChange`. */
|
|
873
|
+
onThreadIdChange?: (id: string | null) => void;
|
|
874
|
+
sourceKGNodes?: GenericSnapshotNode[];
|
|
875
|
+
renderEntryExtra?: (entry: TerminalEntry, index: number) => React.ReactNode;
|
|
876
|
+
/** Full override for entry rendering. Return `null` to use default rendering. */
|
|
877
|
+
renderEntry?: (entry: TerminalEntry, index: number, defaultRender: () => React.ReactNode) => React.ReactNode;
|
|
878
|
+
/** Custom widgets that render per-entry based on a match condition. */
|
|
879
|
+
widgets?: TerminalWidget[];
|
|
880
|
+
/** Slot-based injection points for persistent content around the terminal. */
|
|
881
|
+
slots?: TerminalSlots;
|
|
882
|
+
onSourcesActivate?: (sources: TerminalSource[], entry: TerminalEntry) => void;
|
|
883
|
+
/** Poll for new messages (e.g. agent push messages). Called every pollIntervalMs. */
|
|
884
|
+
onPollMessages?: (lastMessageId?: string) => Promise<TerminalEntry[]>;
|
|
885
|
+
/** Polling interval in ms. Default 3000. */
|
|
886
|
+
pollIntervalMs?: number;
|
|
887
|
+
historyRef?: React.MutableRefObject<{
|
|
888
|
+
setHistory: React.Dispatch<React.SetStateAction<TerminalEntry[]>>;
|
|
889
|
+
setIsExecuting?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
890
|
+
} | null>;
|
|
891
|
+
reasoningRef?: React.MutableRefObject<{
|
|
892
|
+
progressState: ProgressState | null;
|
|
893
|
+
submitInput: (message: string) => void;
|
|
894
|
+
cancelReasoning: () => void;
|
|
895
|
+
} | null>;
|
|
896
|
+
/** Called when the pipeline phase changes (e.g. "vocab_discovery" -> "extraction"). */
|
|
897
|
+
onReasoningPhaseChange?: (phase: string | null) => void;
|
|
898
|
+
/** Called with accumulated activity events for the KG ticker */
|
|
899
|
+
onActivityEventsChange?: (events: any[]) => void;
|
|
900
|
+
windowWidth?: number;
|
|
901
|
+
}
|
|
902
|
+
/** StandardTerminal — developer console with API endpoints and commands. */
|
|
903
|
+
interface StandardTerminalProps extends BaseTerminalProps {
|
|
904
|
+
onCommandExecute?: (command: string, endpoint?: ApiEndpoint, params?: Record<string, string>) => Promise<TerminalCommandResult>;
|
|
905
|
+
authToken?: string;
|
|
906
|
+
onAuthTokenChange?: (token: string) => void;
|
|
907
|
+
}
|
|
908
|
+
/** ChatTerminal — multi-party chat with mentions, presence, and polling. */
|
|
909
|
+
interface ChatTerminalProps extends BaseTerminalProps {
|
|
910
|
+
currentUser?: MessageSender;
|
|
911
|
+
onSendMessage?: (content: string, mentions?: Mention[], audience?: MessageAudience) => Promise<TerminalEntry>;
|
|
912
|
+
onLoadMessages?: () => Promise<TerminalEntry[]>;
|
|
913
|
+
mentionTargets?: MentionTarget[];
|
|
914
|
+
typingUsers?: Array<{
|
|
915
|
+
entityId: string;
|
|
916
|
+
displayName: string;
|
|
917
|
+
}>;
|
|
918
|
+
onTyping?: () => void;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
declare function StandardTerminal({ theme: themeOverrides, config, onCommandExecute, onPageNavigation, authToken, onAuthTokenChange, className, style, showHeader, showWelcomeMessage, initialHistory, onHistoryChange, onStreamRequest, onResolveWorkingGroup, onRagFileUpload, onListRagFiles, onDeleteRagFile, onDownloadRagFile, workingGroupContext: workingGroupContextProp, onPipelineDraftEdit, onPipelineDraftReject, onSubmitNote, onMentionResolve, onMentionPicked, availableKGs, activeKGScope, onKGScopeChange, onViewKnowledgeGraph, onLiveKGUpdate, onKgIdChange, onRunIdChange, onThreadIdChange, onReasoningPhaseChange, reasoningRef, reasoningMode: reasoningModeProp, onReasoningModeChange: onReasoningModeChangeProp, sourceKGNodes, renderEntryExtra, renderEntry, widgets, slots, onSourcesActivate, onPollMessages, pollIntervalMs, historyRef, }: StandardTerminalProps): react_jsx_runtime.JSX.Element;
|
|
922
|
+
|
|
923
|
+
declare function ChatTerminal({ theme: themeOverrides, config, className, style, showHeader, showWelcomeMessage, initialHistory, onHistoryChange, onStreamRequest, onResolveWorkingGroup, onRagFileUpload, onListRagFiles, onDeleteRagFile, onDownloadRagFile, workingGroupContext: workingGroupContextProp, onPipelineDraftEdit, onPipelineDraftReject, onPageNavigation, availableKGs, activeKGScope, onKGScopeChange, onViewKnowledgeGraph, onLiveKGUpdate, onKgIdChange, onRunIdChange, onThreadIdChange, onReasoningPhaseChange, onActivityEventsChange, reasoningRef, reasoningMode: reasoningModeProp, onReasoningModeChange: onReasoningModeChangeProp, sourceKGNodes, renderEntryExtra, renderEntry, widgets, slots, onSourcesActivate, historyRef, currentUser, onSendMessage, onPollMessages, mentionTargets, pollIntervalMs, typingUsers, onTyping, onSubmitNote, onMentionResolve, onMentionPicked, }: ChatTerminalProps): react_jsx_runtime.JSX.Element;
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* CoreTerminal — routing facade for backward compatibility.
|
|
927
|
+
* Routes to ChatTerminal when chat props are present, StandardTerminal otherwise.
|
|
928
|
+
* Prefer importing StandardTerminal or ChatTerminal directly.
|
|
929
|
+
*/
|
|
930
|
+
type CoreTerminalProps = StandardTerminalProps & ChatTerminalProps;
|
|
931
|
+
declare function CoreTerminal(props: CoreTerminalProps): react_jsx_runtime.JSX.Element;
|
|
932
|
+
|
|
933
|
+
interface ExpandableTerminalProps extends CoreTerminalProps {
|
|
934
|
+
guidanceMessage?: string;
|
|
935
|
+
onGuidanceRequest?: () => Promise<string>;
|
|
936
|
+
}
|
|
937
|
+
declare function ExpandableTerminal({ guidanceMessage, onGuidanceRequest, className, windowWidth, initialHistory, theme: themeOverrides, ...terminalProps }: ExpandableTerminalProps): react_jsx_runtime.JSX.Element;
|
|
938
|
+
|
|
939
|
+
interface InlineTerminalProps {
|
|
940
|
+
contextName?: string;
|
|
941
|
+
placeholder?: string;
|
|
942
|
+
onStreamRequest?: (command: string, handlers: {
|
|
943
|
+
onChunk: (chunk: StreamChunk) => void;
|
|
944
|
+
onComplete: () => void;
|
|
945
|
+
onError: (error: string) => void;
|
|
946
|
+
}) => Promise<void>;
|
|
947
|
+
isOnline?: boolean;
|
|
948
|
+
className?: string;
|
|
949
|
+
autoFocus?: boolean;
|
|
950
|
+
}
|
|
951
|
+
declare function InlineTerminal({ contextName, placeholder, onStreamRequest, isOnline, className, autoFocus, }: InlineTerminalProps): react_jsx_runtime.JSX.Element;
|
|
952
|
+
|
|
953
|
+
declare function ReasoningHistoryCard({ snapshot, defaultExpanded, }: {
|
|
954
|
+
snapshot: ReasoningSnapshot;
|
|
955
|
+
defaultExpanded?: boolean;
|
|
956
|
+
}): react_jsx_runtime.JSX.Element;
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* Deterministic agent visual identity — one component and one set of
|
|
960
|
+
* helpers, used everywhere an agent is rendered.
|
|
961
|
+
*
|
|
962
|
+
* Same agent id (or display name) always renders the same face and the
|
|
963
|
+
* same accent color — the seed is canonicalised inside this module so
|
|
964
|
+
* all three forms the caller may have (`agent:buddy` / `Buddy` / `buddy`)
|
|
965
|
+
* collapse to the same hash, which in turn picks the same palette entry
|
|
966
|
+
* for both the avatar background and the accent color used for labels,
|
|
967
|
+
* pill borders, and badges.
|
|
968
|
+
*
|
|
969
|
+
* Public API:
|
|
970
|
+
* - `<AgentAvatar name={seed} size={...} />` — the rendered character
|
|
971
|
+
* - `getAgentColor(name)` — stable accent color for this agent
|
|
972
|
+
* - `agentSeed(...candidates)` — pick the first non-empty seed candidate
|
|
973
|
+
* - `AGENT_PALETTE` — the six-entry palette (exported for consumers
|
|
974
|
+
* that need to reason about the colors directly)
|
|
975
|
+
*/
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* One palette for the whole system. Avatar halo and accent-text color
|
|
979
|
+
* pull from the same six colors via the same hash, so an agent's name
|
|
980
|
+
* label and their avatar background always coordinate.
|
|
981
|
+
*
|
|
982
|
+
* Stored without the `#` prefix because DiceBear expects hex-less
|
|
983
|
+
* strings; `getAgentColor` prepends `#` for CSS use.
|
|
984
|
+
*/
|
|
985
|
+
declare const AGENT_PALETTE: readonly ["a78bfa", "f472b6", "60a5fa", "34d399", "fbbf24", "fb7185"];
|
|
986
|
+
/**
|
|
987
|
+
* Stable accent color for an agent — used for colored name labels,
|
|
988
|
+
* mention-pill borders, and edge-label text next to an avatar.
|
|
989
|
+
*
|
|
990
|
+
* Always canonicalises the input, so `getAgentColor('Buddy')` and
|
|
991
|
+
* `getAgentColor('agent:buddy')` return the same color.
|
|
992
|
+
*/
|
|
993
|
+
declare function getAgentColor(name: string): string;
|
|
994
|
+
/**
|
|
995
|
+
* Pick the first non-empty seed candidate. Lets call sites write
|
|
996
|
+
* `agentSeed(agent.id, agent.display_name)` instead of repeating the
|
|
997
|
+
* `a || b` fallback pattern everywhere.
|
|
998
|
+
*/
|
|
999
|
+
declare function agentSeed(...candidates: Array<string | null | undefined>): string;
|
|
1000
|
+
type AgentAvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | number;
|
|
1001
|
+
interface AgentAvatarProps {
|
|
1002
|
+
/** Stable seed — prefer the agent's `id`, fall back to `display_name`. */
|
|
1003
|
+
name: string;
|
|
1004
|
+
/** Named preset or pixel number. */
|
|
1005
|
+
size?: AgentAvatarSize;
|
|
1006
|
+
className?: string;
|
|
1007
|
+
}
|
|
1008
|
+
declare const AgentAvatar: React.FC<AgentAvatarProps>;
|
|
1009
|
+
|
|
1010
|
+
interface TerminalInputBarProps {
|
|
1011
|
+
inputRef: React.RefObject<HTMLTextAreaElement>;
|
|
1012
|
+
fileInputRef: React.RefObject<HTMLInputElement>;
|
|
1013
|
+
currentCommand: string;
|
|
1014
|
+
isExecuting: boolean;
|
|
1015
|
+
placeholder?: string;
|
|
1016
|
+
onInputChange: (value: string) => void;
|
|
1017
|
+
onKeyDown: (e: React.KeyboardEvent) => void;
|
|
1018
|
+
onSubmit: () => void;
|
|
1019
|
+
onTyping?: () => void;
|
|
1020
|
+
onUploadFiles: (files: File[]) => void;
|
|
1021
|
+
onListFilesCommand: () => void;
|
|
1022
|
+
availableKGs?: KGScope[];
|
|
1023
|
+
activeKGScope?: KGScope | null;
|
|
1024
|
+
onKGScopeChange?: (scope: KGScope | null) => void;
|
|
1025
|
+
/** Reply-path mode toggle: 'auto' (intent classifier decides) or 'quick' (skip reasoning). */
|
|
1026
|
+
reasoningMode?: ReasoningMode | null;
|
|
1027
|
+
onReasoningModeChange?: (mode: ReasoningMode | null) => void;
|
|
1028
|
+
/** Known mention names for inline highlighting */
|
|
1029
|
+
knownMentionNames?: string[];
|
|
1030
|
+
/** Reports the caret position in the FULL command (not the
|
|
1031
|
+
* textarea-local position, which is relative to the tail when
|
|
1032
|
+
* pills consume the prefix). Slash-mention picker uses this. */
|
|
1033
|
+
onCaretChange?: (absoluteCaret: number) => void;
|
|
1034
|
+
showUploadButton?: boolean;
|
|
1035
|
+
showFilesButton?: boolean;
|
|
1036
|
+
commandPaletteItems: TerminalCommand[];
|
|
1037
|
+
selectedPaletteItem: number;
|
|
1038
|
+
onSelectPaletteItem: (id: string) => void;
|
|
1039
|
+
inputBarExtra?: React.ReactNode;
|
|
1040
|
+
/** When provided, replaces the default Auto/Reason selector in the toolbar. */
|
|
1041
|
+
modeSelector?: React.ReactNode;
|
|
1042
|
+
/** Keeps toolbar affordances icon-sized even in a wide container. */
|
|
1043
|
+
compactToolbar?: boolean;
|
|
1044
|
+
/** Accessible label for the submit affordance. */
|
|
1045
|
+
submitTitle?: string;
|
|
1046
|
+
}
|
|
1047
|
+
declare function TerminalInputBar({ inputRef, fileInputRef, currentCommand, isExecuting, placeholder, onInputChange, onKeyDown, onSubmit, onTyping, onUploadFiles, onListFilesCommand, availableKGs, activeKGScope, onKGScopeChange, reasoningMode, onReasoningModeChange, knownMentionNames, onCaretChange, showUploadButton, showFilesButton, commandPaletteItems, selectedPaletteItem, onSelectPaletteItem, inputBarExtra, modeSelector, compactToolbar, submitTitle, }: TerminalInputBarProps): react_jsx_runtime.JSX.Element;
|
|
1048
|
+
|
|
1049
|
+
interface SlashMentionCandidate {
|
|
1050
|
+
entity_id: string;
|
|
1051
|
+
display_name: string;
|
|
1052
|
+
concept_type?: string;
|
|
1053
|
+
}
|
|
1054
|
+
interface UseSlashMentionPickerArgs {
|
|
1055
|
+
currentCommand: string;
|
|
1056
|
+
caretIndex: number;
|
|
1057
|
+
/** Resolver for `@<query>` matches. Receives the typed prefix and,
|
|
1058
|
+
* when active inside a slash-command shape, the command name (e.g.
|
|
1059
|
+
* `'note'`, `'personal'`) so the host can scope candidates per
|
|
1060
|
+
* command (team-scoped vs personal-scoped). */
|
|
1061
|
+
onMentionResolve?: (query: string, command?: string) => Promise<SlashMentionCandidate[]>;
|
|
1062
|
+
/** Slash commands eligible for mention resolution. Default:
|
|
1063
|
+
* `['note', 'personal']`. Ignored when `requireSlashCommand` is
|
|
1064
|
+
* `false`. */
|
|
1065
|
+
enabledCommands?: string[];
|
|
1066
|
+
/** When `false`, the picker fires on any `@<query>` at the caret —
|
|
1067
|
+
* no slash-command prefix required. Used by surfaces that edit
|
|
1068
|
+
* prose directly (e.g. the notes editor) instead of typing a
|
|
1069
|
+
* slash command. Default: `true`. */
|
|
1070
|
+
requireSlashCommand?: boolean;
|
|
1071
|
+
}
|
|
1072
|
+
/**
|
|
1073
|
+
* Inline `@<query>` picker for slash-command input. Watches the
|
|
1074
|
+
* caret position; when the input starts with an enabled slash command
|
|
1075
|
+
* and the caret sits inside an unbroken `@…` token, it debounces a
|
|
1076
|
+
* call to `onMentionResolve(query)` and exposes the candidates.
|
|
1077
|
+
*
|
|
1078
|
+
* The terminal renders the dropdown and calls `complete(candidate)`
|
|
1079
|
+
* on Enter/Tab; this hook returns the new command string with the
|
|
1080
|
+
* `@<query>` token replaced by `@<display_name> ` plus the offset to
|
|
1081
|
+
* place the caret.
|
|
1082
|
+
*/
|
|
1083
|
+
declare function useSlashMentionPicker({ currentCommand, caretIndex, onMentionResolve, enabledCommands, requireSlashCommand, }: UseSlashMentionPickerArgs): {
|
|
1084
|
+
query: string;
|
|
1085
|
+
candidates: SlashMentionCandidate[];
|
|
1086
|
+
selectedIndex: number;
|
|
1087
|
+
navigateUp: () => void;
|
|
1088
|
+
navigateDown: () => void;
|
|
1089
|
+
cancel: () => void;
|
|
1090
|
+
complete: (candidate: SlashMentionCandidate) => {
|
|
1091
|
+
next: string;
|
|
1092
|
+
caret: number;
|
|
1093
|
+
} | null;
|
|
1094
|
+
isOpen: boolean;
|
|
1095
|
+
};
|
|
1096
|
+
|
|
1097
|
+
interface Props {
|
|
1098
|
+
candidates: SlashMentionCandidate[];
|
|
1099
|
+
selectedIndex: number;
|
|
1100
|
+
onPick: (c: SlashMentionCandidate) => void;
|
|
1101
|
+
}
|
|
1102
|
+
declare function SlashMentionPicker({ candidates, selectedIndex, onPick }: Props): react_jsx_runtime.JSX.Element;
|
|
1103
|
+
|
|
1104
|
+
interface ParsedCommand {
|
|
1105
|
+
endpoint: ApiEndpoint;
|
|
1106
|
+
args: Record<string, string>;
|
|
1107
|
+
}
|
|
1108
|
+
declare function parseTerminalCommand(cmd: string, endpoints: ApiEndpoint[]): ParsedCommand | null;
|
|
1109
|
+
declare function buildTerminalCommand(endpoint: ApiEndpoint, values: Record<string, string>): string;
|
|
1110
|
+
declare function isNaturalLanguage(cmd: string, endpoints: ApiEndpoint[]): boolean;
|
|
1111
|
+
|
|
1112
|
+
declare function getBuiltInCommands(): TerminalCommand[];
|
|
1113
|
+
declare function filterCommands(query: string, builtIn: TerminalCommand[], custom?: TerminalCommand[]): TerminalCommand[];
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* Shared stream-line buffering logic used by both sseHandler and streamingHandler.
|
|
1117
|
+
* Eliminates duplicated buffer-split-parse loops.
|
|
1118
|
+
*/
|
|
1119
|
+
declare function processStreamLines(buffer: string, onJsonLine: (parsed: any) => void): string;
|
|
1120
|
+
|
|
1121
|
+
/**
|
|
1122
|
+
* Handles generic streaming JSON-line responses (non-SSE).
|
|
1123
|
+
*/
|
|
1124
|
+
declare function handleStreamingResponse(url: string, requestBody: any, onChunk: (chunk: StreamChunk) => void, onComplete: () => void, onError: (error: string) => void): Promise<void>;
|
|
1125
|
+
|
|
1126
|
+
/**
|
|
1127
|
+
* Handles Server-Sent Events (SSE) streaming responses.
|
|
1128
|
+
*
|
|
1129
|
+
* Pass `options.signal` to make the stream cancellable. When the signal aborts,
|
|
1130
|
+
* the in-flight fetch + reader unwinds and the function returns silently —
|
|
1131
|
+
* deliberate aborts are NOT surfaced as errors via onError.
|
|
1132
|
+
*
|
|
1133
|
+
* Pass `options.onGone` to handle 410 Gone specifically — used by the
|
|
1134
|
+
* pipeline-events endpoint when a run is persisted but inactive in memory.
|
|
1135
|
+
* If omitted, 410 falls through to onError like any other non-OK status.
|
|
1136
|
+
*/
|
|
1137
|
+
declare const handleSSEStream: (url: string, body: any, onChunk: (chunk: any) => void, onComplete: () => void, onError: (error: string) => void, options?: {
|
|
1138
|
+
method?: string;
|
|
1139
|
+
headers?: Record<string, string>;
|
|
1140
|
+
signal?: AbortSignal;
|
|
1141
|
+
onGone?: (reason: string) => void;
|
|
1142
|
+
}) => Promise<void>;
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* Shared asset display formatting utilities.
|
|
1146
|
+
* Eliminates 5+ copy-pasted formatting blocks across action card variants.
|
|
1147
|
+
*/
|
|
1148
|
+
/** Format a token asset ID like "aud-token-asset" to "Aud Token" */
|
|
1149
|
+
declare function formatTokenAssetId(assetId: string): string;
|
|
1150
|
+
/** Resolve a human-readable asset name from metadata fields. */
|
|
1151
|
+
declare function formatAssetDisplay(metadata: Record<string, any>, fallbackCurrency?: string): string;
|
|
1152
|
+
/**
|
|
1153
|
+
* Resolve a display name from a payment leg object (initiator / counterparty).
|
|
1154
|
+
* Handles asset_name > asset_id > denomination fallback chain.
|
|
1155
|
+
*/
|
|
1156
|
+
declare function resolvePaymentAssetDisplay(payment: Record<string, any>): string;
|
|
1157
|
+
/**
|
|
1158
|
+
* Format a potentially-scaled payment amount to a human-readable string.
|
|
1159
|
+
* Handles BigInt-scaled token amounts (e.g. 18-decimal ERC-20 tokens).
|
|
1160
|
+
*/
|
|
1161
|
+
declare function formatPaymentAmount(amount: string): string;
|
|
1162
|
+
|
|
1163
|
+
/**
|
|
1164
|
+
* Render a markdown-like text block into styled React elements.
|
|
1165
|
+
* Eliminates duplicate line-parsing logic in ReasoningProgressIndicator
|
|
1166
|
+
* and ReasoningHistoryCard.
|
|
1167
|
+
*/
|
|
1168
|
+
declare function renderMarkdownBlock(block: string, options?: {
|
|
1169
|
+
headingClass?: string;
|
|
1170
|
+
subheadingClass?: string;
|
|
1171
|
+
textClass?: string;
|
|
1172
|
+
listClass?: string;
|
|
1173
|
+
boldClass?: string;
|
|
1174
|
+
}): React.ReactNode[];
|
|
1175
|
+
|
|
1176
|
+
/**
|
|
1177
|
+
* Shared avatar utilities for consistent rendering across
|
|
1178
|
+
* AttributedMessage, MentionDropdown, PresenceBar, and ApprovalTracker.
|
|
1179
|
+
*/
|
|
1180
|
+
/** Deterministic color from an entity ID string. */
|
|
1181
|
+
declare function avatarColor(entityId: string): string;
|
|
1182
|
+
/** Extract up to 2 initials from a display name. */
|
|
1183
|
+
declare function initials(name: string): string;
|
|
1184
|
+
|
|
1185
|
+
/**
|
|
1186
|
+
* Extract source citations by matching KG node labels against response text.
|
|
1187
|
+
* Tries full label, core label (before parens), parenthetical text, and
|
|
1188
|
+
* reversed "X (Y)" → "Y (X)" patterns to handle varied AI phrasing.
|
|
1189
|
+
*/
|
|
1190
|
+
declare function extractKGSources(text: string, kgNodes: GenericSnapshotNode[]): TerminalSource[];
|
|
1191
|
+
|
|
1192
|
+
/** Window event channel name for pipeline progress events.
|
|
1193
|
+
* Used by every panel/canvas/indicator that needs to react to backend
|
|
1194
|
+
* TransformProgress events (TeamSetup, PhaseAdvanced, SchemaSeeded, etc.). */
|
|
1195
|
+
declare const PROGRESS_EVENT_NAME = "yf-progress-event";
|
|
1196
|
+
/** Sentinel KG id meaning "the live, ad-hoc session" — i.e. the upstream
|
|
1197
|
+
* pipeline run hasn't reported a target KG id yet, but the panel still
|
|
1198
|
+
* wants to scope progress events to the active live session. */
|
|
1199
|
+
declare const LIVE_KG_ID = "__live__";
|
|
1200
|
+
/** True iff `id` identifies a *fixed, persisted* KG — i.e. not empty, and
|
|
1201
|
+
* not the live-session sentinel. Used to decide whether a panel has a
|
|
1202
|
+
* stable identity it can rely on (skip adoption, open SSE keepalive)
|
|
1203
|
+
* vs. a placeholder that should still adopt ids surfaced from chunks. */
|
|
1204
|
+
declare function isFixedKgId(id: string | null | undefined): id is string;
|
|
1205
|
+
/** "Approve current phase and advance to the next." Used by the team and
|
|
1206
|
+
* schema review steps when the user clicks the primary continue button. */
|
|
1207
|
+
declare const ADVANCE_PHASE_SIGNAL = "looks good";
|
|
1208
|
+
/** "Synthesis is complete." The synthesis-review step uses this instead of
|
|
1209
|
+
* ADVANCE_PHASE_SIGNAL because the executor's prompt distinguishes them. */
|
|
1210
|
+
declare const SYNTHESIS_DONE_SIGNAL = "done";
|
|
1211
|
+
/** Shape of the detail payload on a yf-progress-event window event.
|
|
1212
|
+
* This is intentionally permissive — different backend events carry
|
|
1213
|
+
* different fields and we only care about a small set here. */
|
|
1214
|
+
interface ProgressEventDetail {
|
|
1215
|
+
type?: string;
|
|
1216
|
+
/** KG id (kgf.knowledge_graphs.id) the event applies to. */
|
|
1217
|
+
kg_id?: string;
|
|
1218
|
+
/** Pipeline run id (kgf.pipeline_runs.id) the event was emitted from. */
|
|
1219
|
+
run_id?: string;
|
|
1220
|
+
/** @deprecated alias of `kg_id`, kept so old payloads still flow through scoped listeners. */
|
|
1221
|
+
reasoning_set_id?: string;
|
|
1222
|
+
[key: string]: any;
|
|
1223
|
+
}
|
|
1224
|
+
/** Permissive shape for any object that might carry a KG id. */
|
|
1225
|
+
type KgIdSource = {
|
|
1226
|
+
kg_id?: string | null;
|
|
1227
|
+
reasoning_set_id?: string | null;
|
|
1228
|
+
} | null | undefined;
|
|
1229
|
+
/** Walk a precedence list of `{kg_id, reasoning_set_id}`-bearing objects
|
|
1230
|
+
* and return the first non-empty id found. The single source of truth
|
|
1231
|
+
* for resolving the legacy `reasoning_set_id` fallback — when that
|
|
1232
|
+
* field finally goes away on the wire, this function is the only place
|
|
1233
|
+
* to delete the branch. */
|
|
1234
|
+
declare function extractKgId(...sources: KgIdSource[]): string | undefined;
|
|
1235
|
+
interface DispatchOptions {
|
|
1236
|
+
/** The KG id to fall back to if the chunk/progress payload doesn't
|
|
1237
|
+
* already carry one. Typically the panel/hook's own kg id. */
|
|
1238
|
+
fallbackKgId?: string | null;
|
|
1239
|
+
/** Optional outer chunk that may carry kg_id at the top level (some
|
|
1240
|
+
* backends do, some only put it inside `progress`). */
|
|
1241
|
+
chunk?: KgIdSource;
|
|
1242
|
+
}
|
|
1243
|
+
/** Dispatch a progress event on the global window channel, ensuring the
|
|
1244
|
+
* payload is tagged with a `kg_id`. Tagging is what allows scoped
|
|
1245
|
+
* listeners to ignore foreign sessions. */
|
|
1246
|
+
declare function dispatchProgressEvent(progress: ProgressEventDetail | null | undefined, options?: DispatchOptions): void;
|
|
1247
|
+
interface ScopedReasoningContextValue {
|
|
1248
|
+
/** O(1) predicate: does this scope currently "own" the given KG id?
|
|
1249
|
+
* Backed by a ref so synchronous adoption updates take effect with
|
|
1250
|
+
* no React render in between. */
|
|
1251
|
+
hasOwnedKgId: (id: string) => boolean;
|
|
1252
|
+
}
|
|
1253
|
+
/** Wrap a subtree to claim ownership of one or more KGs.
|
|
1254
|
+
* Pass a *stable* predicate (memoized via useCallback with empty deps) so
|
|
1255
|
+
* the context value identity doesn't churn on every render. */
|
|
1256
|
+
declare function ScopedReasoningProvider({ hasOwnedKgId, children, }: {
|
|
1257
|
+
hasOwnedKgId: (id: string) => boolean;
|
|
1258
|
+
children: React.ReactNode;
|
|
1259
|
+
}): React.FunctionComponentElement<React.ProviderProps<ScopedReasoningContextValue>>;
|
|
1260
|
+
/** Subscribe to progress events scoped to a particular KG.
|
|
1261
|
+
*
|
|
1262
|
+
* Filter rule (single source of truth):
|
|
1263
|
+
* 1. Untagged events → always pass through (backward compat with hosts
|
|
1264
|
+
* that haven't been updated to propagate kg_id yet).
|
|
1265
|
+
* 2. Tagged events → must match `ownKgId` OR pass the predicate from
|
|
1266
|
+
* a surrounding `<ScopedReasoningProvider>` (if any).
|
|
1267
|
+
*
|
|
1268
|
+
* The provider predicate is what enables the chat-panel-spawns-an-ad-hoc-
|
|
1269
|
+
* session case: the panel mutates its owned-set ref synchronously before
|
|
1270
|
+
* firing the dispatch, so the child listener sees the new id immediately.
|
|
1271
|
+
*/
|
|
1272
|
+
declare function useScopedProgressEvent(ownKgId: string | null | undefined, handler: (event: ProgressEventDetail) => void, enabled?: boolean): void;
|
|
1273
|
+
|
|
1274
|
+
/** Open an SSE stream against `/pipelines/:run_id/events` and forward each
|
|
1275
|
+
* parsed `TransformProgress` event to `onProgress`.
|
|
1276
|
+
*
|
|
1277
|
+
* Pass an `AbortSignal` to make the connection cancellable.
|
|
1278
|
+
*
|
|
1279
|
+
* 410 Gone is surfaced through `onGone` (the run is persisted but inactive
|
|
1280
|
+
* in memory; the caller is expected to surface a Resume button). Network
|
|
1281
|
+
* failures bubble through `onError`.
|
|
1282
|
+
*
|
|
1283
|
+
* As of agents-service v0.3.0 the endpoint requires authentication. The
|
|
1284
|
+
* `authToken` option is appended as `?access_token=<jwt>` so the request
|
|
1285
|
+
* works from browser `EventSource`-style fetch streams (which cannot set
|
|
1286
|
+
* an `Authorization` header). When omitted, the call goes out unauthenticated
|
|
1287
|
+
* and will 401 in production. */
|
|
1288
|
+
declare function openPipelineEventStream(baseUrl: string, runId: string, handlers: {
|
|
1289
|
+
onProgress: (event: ReasoningProgressEvent) => void;
|
|
1290
|
+
onComplete?: () => void;
|
|
1291
|
+
onError?: (error: string) => void;
|
|
1292
|
+
onGone?: (reason: string) => void;
|
|
1293
|
+
}, options?: {
|
|
1294
|
+
signal?: AbortSignal;
|
|
1295
|
+
authToken?: string;
|
|
1296
|
+
}): Promise<void>;
|
|
1297
|
+
|
|
1298
|
+
type GraphLayer = 'document' | 'inferred' | 'agentic' | 'transactional' | 'user';
|
|
1299
|
+
/** Annotation as it appears inside a KGSnapshot node/edge. */
|
|
1300
|
+
interface KGAnnotation {
|
|
1301
|
+
id: string;
|
|
1302
|
+
agent_id: string;
|
|
1303
|
+
annotation_type: 'support' | 'question' | 'challenge';
|
|
1304
|
+
content: string;
|
|
1305
|
+
resolved: boolean;
|
|
1306
|
+
/** One of: "agent", "human_proxy:<id>", "schema_verifier",
|
|
1307
|
+
* "file_ingestion:<doc>", "structural_inference". */
|
|
1308
|
+
source?: string;
|
|
1309
|
+
}
|
|
1310
|
+
/** Node in a `KGSnapshot`. Mirrors `KGNodeSnapshot` from `src/kg/snapshot.rs`. */
|
|
1311
|
+
interface KGSnapshotNode {
|
|
1312
|
+
/** Stable string key (e.g. "trustee_1"). */
|
|
1313
|
+
key: string;
|
|
1314
|
+
node_type: string;
|
|
1315
|
+
label: string;
|
|
1316
|
+
description: string;
|
|
1317
|
+
confidence: number;
|
|
1318
|
+
graph_layer: GraphLayer;
|
|
1319
|
+
claim_status: ClaimStatus;
|
|
1320
|
+
settled: boolean;
|
|
1321
|
+
annotation_count: number;
|
|
1322
|
+
unresolved_count: number;
|
|
1323
|
+
created_by: string | null;
|
|
1324
|
+
annotations: KGAnnotation[];
|
|
1325
|
+
has_chunk_links: boolean;
|
|
1326
|
+
/** Surface variants the entity was seen under across chunks
|
|
1327
|
+
* (accumulated by cross-chunk dedup). Empty when no merges occurred. */
|
|
1328
|
+
aliases?: string[];
|
|
1329
|
+
}
|
|
1330
|
+
/** Edge in a `KGSnapshot`. */
|
|
1331
|
+
interface KGSnapshotEdge {
|
|
1332
|
+
/** Stable string key (e.g. "manages::trustee_1::fund_1"). */
|
|
1333
|
+
key: string;
|
|
1334
|
+
edge_type: string;
|
|
1335
|
+
from_key: string;
|
|
1336
|
+
to_key: string;
|
|
1337
|
+
description: string;
|
|
1338
|
+
strength: number;
|
|
1339
|
+
graph_layer: GraphLayer;
|
|
1340
|
+
claim_status: ClaimStatus;
|
|
1341
|
+
settled: boolean;
|
|
1342
|
+
/** Agent that proposed this edge claim. */
|
|
1343
|
+
created_by: string;
|
|
1344
|
+
/** Pre-rendered "subject [predicate] object" string. */
|
|
1345
|
+
triple: string;
|
|
1346
|
+
annotations: KGAnnotation[];
|
|
1347
|
+
has_chunk_links: boolean;
|
|
1348
|
+
}
|
|
1349
|
+
/** Full snapshot returned by `GET /kgs/:id`. */
|
|
1350
|
+
interface KGSnapshot {
|
|
1351
|
+
/** UUID of the KG (NOT `id`). */
|
|
1352
|
+
kg_id: string | null;
|
|
1353
|
+
name: string;
|
|
1354
|
+
iteration: number;
|
|
1355
|
+
node_count: number;
|
|
1356
|
+
edge_count: number;
|
|
1357
|
+
settled_count: number;
|
|
1358
|
+
unsettled_count: number;
|
|
1359
|
+
layer_counts: Record<GraphLayer, number>;
|
|
1360
|
+
nodes: KGSnapshotNode[];
|
|
1361
|
+
edges: KGSnapshotEdge[];
|
|
1362
|
+
}
|
|
1363
|
+
/** Single entry in the lineage chain returned by `GET /kgs/:id/lineage`. */
|
|
1364
|
+
interface LineageEntry {
|
|
1365
|
+
id: string;
|
|
1366
|
+
name: string;
|
|
1367
|
+
working_group_id: string | null;
|
|
1368
|
+
parent_kg_id: string | null;
|
|
1369
|
+
node_count: number;
|
|
1370
|
+
edge_count: number;
|
|
1371
|
+
}
|
|
1372
|
+
/** Internal render-shape node consumed by the React Flow layer and
|
|
1373
|
+
* drawers. Built from a `KGSnapshotNode` via `snapshotToSubgraph`, which
|
|
1374
|
+
* flattens vocabulary type, claim status, and annotations under
|
|
1375
|
+
* `properties.*` so downstream renderers keep reading the same paths. */
|
|
1376
|
+
interface SubgraphNode {
|
|
1377
|
+
id: string;
|
|
1378
|
+
/** KG id this node belongs to. */
|
|
1379
|
+
kg_id: string;
|
|
1380
|
+
node_key: string;
|
|
1381
|
+
node_type: string;
|
|
1382
|
+
label: string;
|
|
1383
|
+
description: string;
|
|
1384
|
+
properties: Record<string, any>;
|
|
1385
|
+
confidence: number | null;
|
|
1386
|
+
source_agent_key: string | null;
|
|
1387
|
+
iteration: number;
|
|
1388
|
+
status: string;
|
|
1389
|
+
created_at: string;
|
|
1390
|
+
/** Surface variants this entity has been merged from across chunks. */
|
|
1391
|
+
aliases?: string[];
|
|
1392
|
+
/** Graph layer the node belongs to (document / inferred / agentic / user). */
|
|
1393
|
+
graph_layer?: GraphLayer;
|
|
1394
|
+
/** Semantic search score (populated by search results). */
|
|
1395
|
+
score?: number;
|
|
1396
|
+
/** Neighbor node keys (populated by traversal). */
|
|
1397
|
+
neighbors?: string[];
|
|
1398
|
+
}
|
|
1399
|
+
/** Internal render-shape edge. Mirror of SubgraphNode for edges. */
|
|
1400
|
+
interface SubgraphEdge {
|
|
1401
|
+
id: string;
|
|
1402
|
+
kg_id: string;
|
|
1403
|
+
edge_key: string;
|
|
1404
|
+
edge_type: string;
|
|
1405
|
+
from_node_key: string;
|
|
1406
|
+
to_node_key: string;
|
|
1407
|
+
properties: Record<string, any>;
|
|
1408
|
+
strength: number | null;
|
|
1409
|
+
iteration: number;
|
|
1410
|
+
status: string;
|
|
1411
|
+
created_at: string;
|
|
1412
|
+
/** Agent that proposed this claim. */
|
|
1413
|
+
created_by?: string;
|
|
1414
|
+
}
|
|
1415
|
+
/** KG search result. */
|
|
1416
|
+
interface KGSearchResult {
|
|
1417
|
+
hits: SubgraphNode[];
|
|
1418
|
+
traversal: SubgraphNode[];
|
|
1419
|
+
}
|
|
1420
|
+
/** Chunk reference from a KG node to source text.
|
|
1421
|
+
*
|
|
1422
|
+
* Also serves as the data shape for the "notes" view — each chunk is a
|
|
1423
|
+
* human-readable, editable markdown fragment that grounds one or more KG
|
|
1424
|
+
* entities. `chunk_text` carries the full editable content; `excerpt` is a
|
|
1425
|
+
* short preview used in the sidebar list.
|
|
1426
|
+
*
|
|
1427
|
+
* The backend `GET /kgs/:id/chunks` endpoint populates all fields.
|
|
1428
|
+
* `onLoadNodeChunks` (per-node lookups from the legacy retriever path) may
|
|
1429
|
+
* still return partial data with `chunk_text` unset, so that field remains
|
|
1430
|
+
* optional at the type level — callers using it for editing must null-check. */
|
|
1431
|
+
interface KGChunkLink$1 {
|
|
1432
|
+
id: string;
|
|
1433
|
+
node_key?: string;
|
|
1434
|
+
edge_key?: string;
|
|
1435
|
+
chunk_id: string;
|
|
1436
|
+
excerpt: string;
|
|
1437
|
+
link_type: string;
|
|
1438
|
+
/** Full markdown content. Populated by `GET /kgs/:id/chunks`; optional on
|
|
1439
|
+
* legacy paths that don't fetch it. */
|
|
1440
|
+
chunk_text?: string;
|
|
1441
|
+
/** Document id. Required for edit operations; populated by the KG chunks
|
|
1442
|
+
* endpoint. */
|
|
1443
|
+
document_id?: string;
|
|
1444
|
+
chunk_index?: number;
|
|
1445
|
+
/** Last edit timestamp (ISO 8601). Populated by `GET /kgs/:id/chunks`. */
|
|
1446
|
+
updated_at?: string;
|
|
1447
|
+
/** Parent document title for the editor UI header. Populated by
|
|
1448
|
+
* `GET /kgs/:id/chunks`. */
|
|
1449
|
+
doc_title?: string;
|
|
1450
|
+
}
|
|
1451
|
+
/** Response from `POST /chunks/:id` (Phase 4b — note editing). */
|
|
1452
|
+
interface SaveNoteResult {
|
|
1453
|
+
chunk_id: string;
|
|
1454
|
+
affected_kgs: string[];
|
|
1455
|
+
orphaned_nodes: number;
|
|
1456
|
+
}
|
|
1457
|
+
/** Result of creating a manual note via `POST /kgs/:kg_id/chunks` (202).
|
|
1458
|
+
* The backend persists the chunk immediately and spawns extraction in the
|
|
1459
|
+
* background. The frontend streams progress via `/pipelines/:run_id/events`
|
|
1460
|
+
* and refetches chunks when the pipeline completes. */
|
|
1461
|
+
interface CreateNoteResult {
|
|
1462
|
+
chunk_id: string;
|
|
1463
|
+
document_id: string;
|
|
1464
|
+
/** Pipeline run id for the extraction pipeline. */
|
|
1465
|
+
run_id: string;
|
|
1466
|
+
}
|
|
1467
|
+
/** Convert a KGSnapshot to the internal render-shape that the React Flow
|
|
1468
|
+
* layer + drawers consume. Keeps the existing rendering code untouched. */
|
|
1469
|
+
declare function snapshotToSubgraph(snap: KGSnapshot): {
|
|
1470
|
+
nodes: SubgraphNode[];
|
|
1471
|
+
edges: SubgraphEdge[];
|
|
1472
|
+
};
|
|
1473
|
+
/** Callbacks the host app provides for data fetching. */
|
|
1474
|
+
interface KnowledgeGraphDataCallbacks {
|
|
1475
|
+
/** Fetch a KG by id. Backed by `GET /kgs/:id` (optionally with `?layers=...`).
|
|
1476
|
+
* Returns the full snapshot. The view maps it to its internal shape. */
|
|
1477
|
+
onLoadKg: (groupId: string, kgId: string) => Promise<KGSnapshot>;
|
|
1478
|
+
/** Fetch a KG composed with all its ancestors. Backed by `GET /kgs/:id/composed`.
|
|
1479
|
+
* Optional — when not wired, the composed view is unavailable. */
|
|
1480
|
+
onLoadComposedKg?: (groupId: string, kgId: string) => Promise<KGSnapshot | null>;
|
|
1481
|
+
/** Walk the parent chain. Backed by `GET /kgs/:id/lineage`. */
|
|
1482
|
+
onLoadLineage?: (groupId: string, kgId: string) => Promise<LineageEntry[]>;
|
|
1483
|
+
/** Search KG nodes semantically (via the chat retriever or a host-defined
|
|
1484
|
+
* endpoint). The new framework has no dedicated KG-search route, so this
|
|
1485
|
+
* is fully delegated to the host. */
|
|
1486
|
+
onSearchNodes?: (groupId: string, kgId: string, query: string, limit: number, traversalDepth: number) => Promise<KGSearchResult>;
|
|
1487
|
+
/** Fetch source text chunks for a node. Optional — chunk text comes back
|
|
1488
|
+
* inline via the chat retriever in the new framework, so this typically
|
|
1489
|
+
* isn't wired anymore. */
|
|
1490
|
+
onLoadNodeChunks?: (groupId: string, kgId: string, nodeKey: string) => Promise<KGChunkLink$1[]>;
|
|
1491
|
+
/** Fetch ALL chunk links for a KG. Used by the chunk-graph view. */
|
|
1492
|
+
onLoadAllChunks?: (groupId: string, kgId: string) => Promise<KGChunkLink$1[]>;
|
|
1493
|
+
/** Edit a chunk's content (note editing). Backend re-embeds + re-extracts
|
|
1494
|
+
* for every KG that cited the chunk. Returns the affected KG ids + an
|
|
1495
|
+
* orphan-node hint. Optional — when not wired, chunk nodes are read-only. */
|
|
1496
|
+
onSaveNote?: (groupId: string, kgId: string, chunkId: string, content: string) => Promise<SaveNoteResult>;
|
|
1497
|
+
/** Create a new note (chunk) in the KG. The backend persists the chunk,
|
|
1498
|
+
* extracts entities with vocabulary discovery enabled (auto-merge by name),
|
|
1499
|
+
* and returns the new chunk id plus any newly-discovered vocab types.
|
|
1500
|
+
* Optional — when not wired, the "New Note" card is hidden. */
|
|
1501
|
+
onCreateNote?: (groupId: string, kgId: string, content: string) => Promise<CreateNoteResult>;
|
|
1502
|
+
/** Post a message to a thread (for the chat panel). */
|
|
1503
|
+
onPostMessage?: (groupId: string, threadId: string, content: string, references?: any) => Promise<any>;
|
|
1504
|
+
/** Load messages from a thread. */
|
|
1505
|
+
onLoadMessages?: (groupId: string, threadId: string) => Promise<any[]>;
|
|
1506
|
+
/** Stream a chat request (for non-reasoning KG chat). Accepts an optional AbortSignal for cancellation. */
|
|
1507
|
+
onStreamRequest?: (body: any, onChunk: (chunk: any) => void, onComplete: () => void, onError: (error: string) => void, signal?: AbortSignal) => Promise<void>;
|
|
1508
|
+
/** Get the active reasoning pipeline for a working group. Returns the
|
|
1509
|
+
* pipeline run id, the KG id it targets, and (optionally) the
|
|
1510
|
+
* conversation thread id used for human input. */
|
|
1511
|
+
onGetReasoningSession?: (groupId: string, kgId?: string) => Promise<{
|
|
1512
|
+
run_id?: string;
|
|
1513
|
+
kg_id?: string;
|
|
1514
|
+
thread_id?: string;
|
|
1515
|
+
current_phase?: string;
|
|
1516
|
+
} | null>;
|
|
1517
|
+
/** Get the agents currently active on a pipeline run. Used to populate
|
|
1518
|
+
* the TeamStage on reload. */
|
|
1519
|
+
onLoadReasoningAgents?: (groupId: string, runId: string) => Promise<Array<{
|
|
1520
|
+
agent_id?: string | null;
|
|
1521
|
+
id?: string | null;
|
|
1522
|
+
display_name?: string | null;
|
|
1523
|
+
role?: string | null;
|
|
1524
|
+
role_in_session?: string | null;
|
|
1525
|
+
}>>;
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
interface KnowledgeGraphViewProps {
|
|
1529
|
+
groupId: string;
|
|
1530
|
+
/** KG id (kgf.knowledge_graphs.id) to render. */
|
|
1531
|
+
kgId: string;
|
|
1532
|
+
documentId?: string;
|
|
1533
|
+
onClose?: () => void;
|
|
1534
|
+
className?: string;
|
|
1535
|
+
/** Pipeline run id (kgf.pipeline_runs.id) — when set, the chat panel
|
|
1536
|
+
* subscribes to its events stream so HIL controls work. */
|
|
1537
|
+
runId?: string;
|
|
1538
|
+
/** When set, shows a processing banner and auto-refreshes the graph every 5s */
|
|
1539
|
+
processingDetail?: string | null;
|
|
1540
|
+
/** Generic KG with annotations — for collaborative reasoning mode */
|
|
1541
|
+
genericKG?: GenericKGSnapshot;
|
|
1542
|
+
/** Conversational thread id — when provided, chat panel uses the
|
|
1543
|
+
* reasoning thread for messages. */
|
|
1544
|
+
threadId?: string;
|
|
1545
|
+
/** Current user for chat attribution */
|
|
1546
|
+
currentUser?: MessageSender;
|
|
1547
|
+
/** Current pipeline phase (e.g. "vocab_discovery", "extraction") */
|
|
1548
|
+
reasoningPhase?: string | null;
|
|
1549
|
+
/** Pre-loaded reasoning agents — used to populate TeamStage on reload */
|
|
1550
|
+
reasoningAgents?: Array<{
|
|
1551
|
+
id: string;
|
|
1552
|
+
display_name: string;
|
|
1553
|
+
role: string;
|
|
1554
|
+
}>;
|
|
1555
|
+
/** Ref to expose chat toggle to parent */
|
|
1556
|
+
chatToggleRef?: React.MutableRefObject<(() => void) | null>;
|
|
1557
|
+
/** Live telemetry events for the activity ticker */
|
|
1558
|
+
activityEvents?: any[];
|
|
1559
|
+
/** Data callbacks — host app provides data fetching */
|
|
1560
|
+
data: KnowledgeGraphDataCallbacks;
|
|
1561
|
+
/** Terminal config for the built-in chat panel. Required unless renderChat is provided. */
|
|
1562
|
+
config?: TerminalConfig;
|
|
1563
|
+
/** Override the built-in chat panel. If not provided, renders GraphChatPanel using config + data callbacks.
|
|
1564
|
+
*
|
|
1565
|
+
* `onHighlightNodes` is the hook the chat panel calls when the AI
|
|
1566
|
+
* response mentions KG nodes — the custom chat panel should forward
|
|
1567
|
+
* it to its `GraphChatPanel` (or equivalent) so cited nodes get the
|
|
1568
|
+
* same dim/highlight treatment the built-in chat gives them. */
|
|
1569
|
+
renderChat?: (props: {
|
|
1570
|
+
groupId: string;
|
|
1571
|
+
kgId: string;
|
|
1572
|
+
runId?: string;
|
|
1573
|
+
threadId?: string;
|
|
1574
|
+
reasoningPhase?: string | null;
|
|
1575
|
+
currentUser?: any;
|
|
1576
|
+
rawNodes: SubgraphNode[];
|
|
1577
|
+
onHighlightNodes: (nodeIds: string[]) => void;
|
|
1578
|
+
}) => React.ReactNode;
|
|
1579
|
+
/** Optional: ontology/vocabulary panel renderer. Rendered in the right panel when ontology button is clicked. */
|
|
1580
|
+
renderOntologyPanel?: (props: {
|
|
1581
|
+
groupId: string;
|
|
1582
|
+
documentId?: string;
|
|
1583
|
+
rawNodes: SubgraphNode[];
|
|
1584
|
+
rawEdges: SubgraphEdge[];
|
|
1585
|
+
onClose: () => void;
|
|
1586
|
+
}) => React.ReactNode;
|
|
1587
|
+
/**
|
|
1588
|
+
* "Open dossier →" callback (Phase 4 click-through). When provided,
|
|
1589
|
+
* the NodeDetailDrawer renders a button that routes the host app
|
|
1590
|
+
* to the entity's detail page in the active lens. The host
|
|
1591
|
+
* receives the node's frame_id + concept_type and constructs the
|
|
1592
|
+
* URL (typically `/crm/:kind/:id?lens=:current_lens`). When
|
|
1593
|
+
* omitted, the drawer stays read-only — preserving the legacy
|
|
1594
|
+
* behavior for hosts that haven't migrated.
|
|
1595
|
+
*/
|
|
1596
|
+
onOpenDossier?: (params: {
|
|
1597
|
+
frameId: string;
|
|
1598
|
+
conceptType: string;
|
|
1599
|
+
}) => void;
|
|
1600
|
+
}
|
|
1601
|
+
declare function KnowledgeGraphView({ groupId, kgId, documentId, onClose, className, runId, processingDetail, genericKG: genericKGProp, threadId, currentUser, reasoningPhase, reasoningAgents, chatToggleRef, activityEvents, data, config, renderChat, renderOntologyPanel, onOpenDossier, }: KnowledgeGraphViewProps): react_jsx_runtime.JSX.Element;
|
|
1602
|
+
|
|
1603
|
+
interface GraphChatPanelProps {
|
|
1604
|
+
groupId: string;
|
|
1605
|
+
/** KG id (kgf.knowledge_graphs.id) this panel is bound to. */
|
|
1606
|
+
kgId: string;
|
|
1607
|
+
/** Pipeline run id, when there's an active reasoning pipeline targeting this KG. */
|
|
1608
|
+
runId?: string;
|
|
1609
|
+
/** Optional thread id used for the conversational pause loop. */
|
|
1610
|
+
threadId?: string;
|
|
1611
|
+
rawNodes: SubgraphNode[];
|
|
1612
|
+
onHighlightNodes?: (nodeIds: string[]) => void;
|
|
1613
|
+
currentUser?: MessageSender;
|
|
1614
|
+
/** Terminal config — host app provides */
|
|
1615
|
+
config: TerminalConfig;
|
|
1616
|
+
/** Load messages from a thread */
|
|
1617
|
+
onLoadMessages?: (groupId: string, threadId: string) => Promise<any[]>;
|
|
1618
|
+
/** Post a message to a thread */
|
|
1619
|
+
onPostMessage?: (groupId: string, threadId: string, content: string, references?: any) => Promise<any>;
|
|
1620
|
+
/** Stream a chat request. Accepts an optional AbortSignal for cancellation. */
|
|
1621
|
+
onStreamChat?: (body: any, onChunk: (chunk: StreamChunk) => void, onComplete: () => void, onError: (error: string) => void, signal?: AbortSignal) => Promise<void>;
|
|
1622
|
+
/** True when viewing a previously completed KG (not live) */
|
|
1623
|
+
isLoadedSession?: boolean;
|
|
1624
|
+
/** True when a live reasoning session is active — disables standalone streaming even before thread ID arrives */
|
|
1625
|
+
isLiveReasoning?: boolean;
|
|
1626
|
+
/** Current pipeline phase — used to seed PipelineProgressBar on mount when no live events have fired yet */
|
|
1627
|
+
reasoningPhase?: string | null;
|
|
1628
|
+
/** Bearer JWT — forwarded to the pipeline SSE keepalive as `?access_token=`
|
|
1629
|
+
* since browser fetch SSE can't set `Authorization`. The agents service
|
|
1630
|
+
* requires auth on /pipelines/:run_id/events (v0.3.0+). */
|
|
1631
|
+
authToken?: string;
|
|
1632
|
+
}
|
|
1633
|
+
declare function GraphChatPanel({ groupId, kgId, runId, threadId, rawNodes, onHighlightNodes, currentUser, config, onLoadMessages, onPostMessage, onStreamChat, isLoadedSession, isLiveReasoning, reasoningPhase, authToken, }: GraphChatPanelProps): react_jsx_runtime.JSX.Element;
|
|
1634
|
+
|
|
1635
|
+
interface ReasoningViewProps {
|
|
1636
|
+
/** Terminal/chat configuration */
|
|
1637
|
+
config: TerminalConfig;
|
|
1638
|
+
/** Working group ID */
|
|
1639
|
+
groupId: string;
|
|
1640
|
+
/** KG id (kgf.knowledge_graphs.id) — replaces the legacy `reasoningSetId`. */
|
|
1641
|
+
kgId: string;
|
|
1642
|
+
/** Pipeline run id (kgf.pipeline_runs.id) — when the KG is the target
|
|
1643
|
+
* of an in-flight reasoning pipeline, this powers HIL controls. */
|
|
1644
|
+
runId?: string;
|
|
1645
|
+
/** Conversational thread id — enables reasoning-aware chat (polling thread messages) */
|
|
1646
|
+
threadId?: string;
|
|
1647
|
+
/** Current user for chat attribution */
|
|
1648
|
+
currentUser?: MessageSender;
|
|
1649
|
+
/** Called when user closes the view */
|
|
1650
|
+
onClose?: () => void;
|
|
1651
|
+
/** Live KG snapshot — for active reasoning sessions (real-time updates via SSE) */
|
|
1652
|
+
genericKG?: GenericKGSnapshot;
|
|
1653
|
+
/** Current pipeline phase label */
|
|
1654
|
+
reasoningPhase?: string | null;
|
|
1655
|
+
/** Data callbacks for the KG visualization */
|
|
1656
|
+
data: KnowledgeGraphDataCallbacks;
|
|
1657
|
+
/** Optional: title shown in header */
|
|
1658
|
+
title?: string;
|
|
1659
|
+
/** Optional: description/subtitle */
|
|
1660
|
+
description?: string;
|
|
1661
|
+
/** Optional: node/edge counts for header */
|
|
1662
|
+
nodeCount?: number;
|
|
1663
|
+
edgeCount?: number;
|
|
1664
|
+
/** Optional: status badge */
|
|
1665
|
+
status?: string;
|
|
1666
|
+
/** Problem statement / reasoning goal — shown prominently in header */
|
|
1667
|
+
problem?: string;
|
|
1668
|
+
/** Called when the user wants to chain a new reasoning pipeline whose
|
|
1669
|
+
* parent KG is this one. The host typically posts to
|
|
1670
|
+
* `POST /kgs/:kgId/reason-over` and the resulting child KG inherits
|
|
1671
|
+
* this KG's vocabulary. The `parentKgId` argument is the current KG id. */
|
|
1672
|
+
onChainSession?: (parentKgId: string, problem: string) => void;
|
|
1673
|
+
/** Live telemetry events for the activity ticker on the KG canvas */
|
|
1674
|
+
activityEvents?: any[];
|
|
1675
|
+
/** Load messages from a thread */
|
|
1676
|
+
onLoadMessages?: (groupId: string, threadId: string) => Promise<any[]>;
|
|
1677
|
+
/** Post a message to a thread */
|
|
1678
|
+
onPostMessage?: (groupId: string, threadId: string, content: string, references?: any) => Promise<any>;
|
|
1679
|
+
/** Stream a chat request. Accepts an optional AbortSignal for cancellation. */
|
|
1680
|
+
onStreamChat?: (body: any, onChunk: (chunk: StreamChunk) => void, onComplete: () => void, onError: (error: string) => void, signal?: AbortSignal) => Promise<void>;
|
|
1681
|
+
className?: string;
|
|
1682
|
+
}
|
|
1683
|
+
/**
|
|
1684
|
+
* ReasoningView — the full reasoning experience.
|
|
1685
|
+
* Renders a KG graph on the left and a reasoning chat on the right.
|
|
1686
|
+
* This is the primary way users interact with reasoning sets.
|
|
1687
|
+
*/
|
|
1688
|
+
declare function ReasoningView({ config, groupId, kgId, runId, threadId, currentUser, onClose, genericKG, reasoningPhase, data, title, description, nodeCount, edgeCount, status, onLoadMessages, onPostMessage, onStreamChat, problem, onChainSession, activityEvents, className, }: ReasoningViewProps): react_jsx_runtime.JSX.Element;
|
|
1689
|
+
|
|
1690
|
+
interface GraphNodeData extends Record<string, unknown> {
|
|
1691
|
+
label: string;
|
|
1692
|
+
description: string;
|
|
1693
|
+
nodeType: string;
|
|
1694
|
+
confidence?: number;
|
|
1695
|
+
source?: string;
|
|
1696
|
+
iteration?: number;
|
|
1697
|
+
status?: string;
|
|
1698
|
+
properties?: Record<string, any>;
|
|
1699
|
+
/** Surface variants this entity has been merged from across chunks
|
|
1700
|
+
* (cross-chunk dedup). Empty when no merges. */
|
|
1701
|
+
aliases?: string[];
|
|
1702
|
+
/** Graph layer (document / inferred / agentic / user). Surfaces
|
|
1703
|
+
* provenance as a badge in the detail drawer. */
|
|
1704
|
+
graphLayer?: string;
|
|
1705
|
+
hasRagChunks?: boolean;
|
|
1706
|
+
isHighlighted?: boolean;
|
|
1707
|
+
isDimmed?: boolean;
|
|
1708
|
+
isTraversal?: boolean;
|
|
1709
|
+
searchScore?: number | null;
|
|
1710
|
+
settled?: boolean;
|
|
1711
|
+
annotationCount?: number;
|
|
1712
|
+
unresolvedCount?: number;
|
|
1713
|
+
phase?: 'problem' | 'solution' | 'simple';
|
|
1714
|
+
claimStatus?: string;
|
|
1715
|
+
/** Transient flag — true for nodes that were just added by a re-extraction.
|
|
1716
|
+
* Triggers an orange "freshly added" glow that the parent KGV clears after
|
|
1717
|
+
* a few seconds via setNodes. */
|
|
1718
|
+
recentlyAdded?: boolean;
|
|
1719
|
+
}
|
|
1720
|
+
declare function GraphNodeComponent({ data, selected }: NodeProps & {
|
|
1721
|
+
data: GraphNodeData;
|
|
1722
|
+
}): react_jsx_runtime.JSX.Element;
|
|
1723
|
+
declare const GraphNode: React.MemoExoticComponent<typeof GraphNodeComponent>;
|
|
1724
|
+
|
|
1725
|
+
interface GraphEdgeData extends Record<string, unknown> {
|
|
1726
|
+
edgeType: string;
|
|
1727
|
+
strength?: number;
|
|
1728
|
+
label?: string;
|
|
1729
|
+
/** Source node label — used to render the full claim triple */
|
|
1730
|
+
sourceLabel?: string;
|
|
1731
|
+
/** Target node label — used to render the full claim triple */
|
|
1732
|
+
targetLabel?: string;
|
|
1733
|
+
/** Agent that proposed this claim */
|
|
1734
|
+
createdBy?: string;
|
|
1735
|
+
properties?: Record<string, any>;
|
|
1736
|
+
isHighlighted?: boolean;
|
|
1737
|
+
isDimmed?: boolean;
|
|
1738
|
+
claimStatus?: string;
|
|
1739
|
+
}
|
|
1740
|
+
declare function GraphEdgeComponent({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, data, selected, }: EdgeProps & {
|
|
1741
|
+
data: GraphEdgeData;
|
|
1742
|
+
}): react_jsx_runtime.JSX.Element;
|
|
1743
|
+
declare const GraphEdge: React.MemoExoticComponent<typeof GraphEdgeComponent>;
|
|
1744
|
+
/** SVG defs for arrow markers — render inside ReactFlow */
|
|
1745
|
+
declare function EdgeMarkerDefs(): react_jsx_runtime.JSX.Element;
|
|
1746
|
+
|
|
1747
|
+
interface SettlementBarProps {
|
|
1748
|
+
settledCount: number;
|
|
1749
|
+
totalCount: number;
|
|
1750
|
+
}
|
|
1751
|
+
declare function SettlementBar({ settledCount, totalCount }: SettlementBarProps): react_jsx_runtime.JSX.Element;
|
|
1752
|
+
|
|
1753
|
+
/** Chunk reference from a KG node to source text. */
|
|
1754
|
+
interface KGChunkLink {
|
|
1755
|
+
id: string;
|
|
1756
|
+
node_key?: string;
|
|
1757
|
+
edge_key?: string;
|
|
1758
|
+
chunk_id: string;
|
|
1759
|
+
excerpt: string;
|
|
1760
|
+
link_type: string;
|
|
1761
|
+
chunk_text?: string;
|
|
1762
|
+
}
|
|
1763
|
+
/** Diff summary returned from a save when re-extraction ran. Mirrors the
|
|
1764
|
+
* shape returned by the backend `reextract_chunk` endpoint. */
|
|
1765
|
+
interface SaveDiffSummary {
|
|
1766
|
+
added_node_keys?: string[];
|
|
1767
|
+
removed_node_keys?: string[];
|
|
1768
|
+
added_edge_keys?: string[];
|
|
1769
|
+
removed_edge_keys?: string[];
|
|
1770
|
+
orphaned_node_keys?: string[];
|
|
1771
|
+
}
|
|
1772
|
+
/** Result returned by `onSaveDescription` so the drawer can show a diff
|
|
1773
|
+
* summary in the success pill. All fields optional — a void return is also
|
|
1774
|
+
* accepted (treated as a no-info save). */
|
|
1775
|
+
interface SaveDescriptionResult {
|
|
1776
|
+
diff?: SaveDiffSummary;
|
|
1777
|
+
}
|
|
1778
|
+
interface NodeDetailDrawerProps {
|
|
1779
|
+
node: GraphNodeData & {
|
|
1780
|
+
id: string;
|
|
1781
|
+
};
|
|
1782
|
+
connectedNodes: Array<{
|
|
1783
|
+
id: string;
|
|
1784
|
+
label: string;
|
|
1785
|
+
nodeType: string;
|
|
1786
|
+
edgeType: string;
|
|
1787
|
+
direction: 'in' | 'out';
|
|
1788
|
+
}>;
|
|
1789
|
+
chunks?: KGChunkLink[];
|
|
1790
|
+
annotations?: Annotation[];
|
|
1791
|
+
onClose: () => void;
|
|
1792
|
+
onNavigate: (nodeId: string) => void;
|
|
1793
|
+
/**
|
|
1794
|
+
* Optional save handler. When provided, the description gets a pencil
|
|
1795
|
+
* affordance and the editor commits via this callback. Async — should
|
|
1796
|
+
* resolve only after the new content is durably persisted (or reject on
|
|
1797
|
+
* error so we surface the failure to the user). The optional return value
|
|
1798
|
+
* lets callers ship a diff summary that the drawer surfaces in its success
|
|
1799
|
+
* pill. When omitted, the description is read-only.
|
|
1800
|
+
*/
|
|
1801
|
+
onSaveDescription?: (newContent: string) => Promise<SaveDescriptionResult | void>;
|
|
1802
|
+
/**
|
|
1803
|
+
* Hint about what the save callback does. `fast` = content + embedding
|
|
1804
|
+
* only (~500ms). `reextract` = full pipeline including KG re-extraction
|
|
1805
|
+
* (~5-15s). Used to set expectations in the loading message.
|
|
1806
|
+
*/
|
|
1807
|
+
saveMode?: 'fast' | 'reextract';
|
|
1808
|
+
/** Ordered list of node IDs for review navigation. When provided,
|
|
1809
|
+
* prev/next buttons appear in the header. */
|
|
1810
|
+
reviewNodeIds?: string[];
|
|
1811
|
+
/** Called when the user clicks prev/next in the review nav. */
|
|
1812
|
+
onReviewNavigate?: (nodeId: string) => void;
|
|
1813
|
+
/**
|
|
1814
|
+
* "Open dossier →" callback (Phase 4 click-through). When provided,
|
|
1815
|
+
* the drawer renders a button at the top that routes the host app
|
|
1816
|
+
* to the entity's detail page in the current lens. Receives the
|
|
1817
|
+
* node's frame_id + concept_type so the host can build the URL.
|
|
1818
|
+
* Optional: when omitted, no dossier link is shown — drawer
|
|
1819
|
+
* remains read-only as before.
|
|
1820
|
+
*/
|
|
1821
|
+
onOpenDossier?: (params: {
|
|
1822
|
+
frameId: string;
|
|
1823
|
+
conceptType: string;
|
|
1824
|
+
}) => void;
|
|
1825
|
+
}
|
|
1826
|
+
declare function NodeDetailDrawer({ node, connectedNodes, chunks, annotations, onClose, onNavigate, onSaveDescription, saveMode, reviewNodeIds, onReviewNavigate, onOpenDossier }: NodeDetailDrawerProps): react_jsx_runtime.JSX.Element;
|
|
1827
|
+
|
|
1828
|
+
interface EdgeDetailDrawerProps {
|
|
1829
|
+
edge: {
|
|
1830
|
+
id: string;
|
|
1831
|
+
edgeType: string;
|
|
1832
|
+
strength?: number;
|
|
1833
|
+
label?: string;
|
|
1834
|
+
triple?: string;
|
|
1835
|
+
settled?: boolean;
|
|
1836
|
+
properties?: Record<string, any>;
|
|
1837
|
+
createdBy?: string;
|
|
1838
|
+
sourceNode: {
|
|
1839
|
+
id: string;
|
|
1840
|
+
label: string;
|
|
1841
|
+
nodeType: string;
|
|
1842
|
+
};
|
|
1843
|
+
targetNode: {
|
|
1844
|
+
id: string;
|
|
1845
|
+
label: string;
|
|
1846
|
+
nodeType: string;
|
|
1847
|
+
};
|
|
1848
|
+
};
|
|
1849
|
+
annotations?: Annotation[];
|
|
1850
|
+
onClose: () => void;
|
|
1851
|
+
onNavigate: (nodeId: string) => void;
|
|
1852
|
+
}
|
|
1853
|
+
declare function EdgeDetailDrawer({ edge, annotations, onClose, onNavigate }: EdgeDetailDrawerProps): react_jsx_runtime.JSX.Element;
|
|
1854
|
+
|
|
1855
|
+
interface ClaimNodeData extends Record<string, unknown> {
|
|
1856
|
+
/** Full triple: "Subject predicate Object" */
|
|
1857
|
+
triple: string;
|
|
1858
|
+
subjectLabel: string;
|
|
1859
|
+
predicate: string;
|
|
1860
|
+
objectLabel: string;
|
|
1861
|
+
claimStatus?: string;
|
|
1862
|
+
settled?: boolean;
|
|
1863
|
+
createdBy?: string;
|
|
1864
|
+
annotationCount?: number;
|
|
1865
|
+
unresolvedCount?: number;
|
|
1866
|
+
confidence?: number;
|
|
1867
|
+
isHighlighted?: boolean;
|
|
1868
|
+
isDimmed?: boolean;
|
|
1869
|
+
}
|
|
1870
|
+
declare function ClaimNodeComponent({ data, selected }: NodeProps & {
|
|
1871
|
+
data: ClaimNodeData;
|
|
1872
|
+
}): react_jsx_runtime.JSX.Element;
|
|
1873
|
+
declare const ClaimNode: React.MemoExoticComponent<typeof ClaimNodeComponent>;
|
|
1874
|
+
|
|
1875
|
+
/**
|
|
1876
|
+
* Claims projection — transforms the entity graph into a claims graph
|
|
1877
|
+
* where edges become nodes and shared entities become connectors.
|
|
1878
|
+
*
|
|
1879
|
+
* Entity view: [Company] --issues--> [Equity]
|
|
1880
|
+
* Claims view: [Company issues Equity] --Company-- [Company files Registration]
|
|
1881
|
+
*/
|
|
1882
|
+
|
|
1883
|
+
declare function buildClaimsGraph(nodes: SubgraphNode[], edges: SubgraphEdge[]): {
|
|
1884
|
+
rfNodes: Node[];
|
|
1885
|
+
rfEdges: Edge[];
|
|
1886
|
+
};
|
|
1887
|
+
|
|
1888
|
+
interface AnnotationThreadProps {
|
|
1889
|
+
annotations: Annotation[];
|
|
1890
|
+
settled: boolean;
|
|
1891
|
+
}
|
|
1892
|
+
declare function AnnotationThread({ annotations, settled }: AnnotationThreadProps): react_jsx_runtime.JSX.Element;
|
|
1893
|
+
|
|
1894
|
+
/** Entity mention descriptor for inline highlighting. */
|
|
1895
|
+
interface EntityMention {
|
|
1896
|
+
id: string;
|
|
1897
|
+
label: string;
|
|
1898
|
+
nodeType: string;
|
|
1899
|
+
}
|
|
1900
|
+
interface MarkdownContentProps {
|
|
1901
|
+
/** Markdown source. Falsy values render nothing. */
|
|
1902
|
+
children: string | null | undefined;
|
|
1903
|
+
/** Extra classes appended to the wrapper. */
|
|
1904
|
+
className?: string;
|
|
1905
|
+
/** Entities to highlight as inline mentions within the text. */
|
|
1906
|
+
entities?: EntityMention[];
|
|
1907
|
+
/** Called when the user clicks a highlighted entity mention. */
|
|
1908
|
+
onEntityClick?: (entityId: string) => void;
|
|
1909
|
+
}
|
|
1910
|
+
/**
|
|
1911
|
+
* Renders markdown text with refined dark-themed typography for the knowledge
|
|
1912
|
+
* graph drawers. Self-contained — does not require @tailwindcss/typography.
|
|
1913
|
+
*
|
|
1914
|
+
* When `entities` are provided, occurrences of entity labels in the text are
|
|
1915
|
+
* highlighted as colored inline pills.
|
|
1916
|
+
*/
|
|
1917
|
+
declare const MarkdownContent: React.NamedExoticComponent<MarkdownContentProps>;
|
|
1918
|
+
|
|
1919
|
+
interface MarkdownEditorProps {
|
|
1920
|
+
/** Initial markdown source. Read once on mount; further parent updates are ignored. */
|
|
1921
|
+
value: string;
|
|
1922
|
+
/** Called on every keystroke with the latest markdown. */
|
|
1923
|
+
onChange: (next: string) => void;
|
|
1924
|
+
/** Called when the user commits the edit (⌘↵ or Save). */
|
|
1925
|
+
onSave: () => void;
|
|
1926
|
+
/** Called when the user discards (Esc or Cancel). */
|
|
1927
|
+
onCancel: () => void;
|
|
1928
|
+
/** Optional placeholder shown when the editor is empty. */
|
|
1929
|
+
placeholder?: string;
|
|
1930
|
+
/** Whether to autofocus the editor on mount. Defaults to true. */
|
|
1931
|
+
autoFocus?: boolean;
|
|
1932
|
+
/**
|
|
1933
|
+
* When true, disables the Save / Cancel buttons and the ⌘↵ / Esc keyboard
|
|
1934
|
+
* shortcuts. The contenteditable itself stays interactive so the user can
|
|
1935
|
+
* keep editing while a save is in flight, but no second save can fire.
|
|
1936
|
+
* Used to prevent double-submits during long-running re-extraction.
|
|
1937
|
+
*/
|
|
1938
|
+
disabled?: boolean;
|
|
1939
|
+
}
|
|
1940
|
+
/**
|
|
1941
|
+
* A WYSIWYG markdown editor for the knowledge graph drawers, built on
|
|
1942
|
+
* MDXEditor (Lexical under the hood). You see formatted text as you type —
|
|
1943
|
+
* `## Heading` instantly becomes a heading, `**bold**` collapses into bold,
|
|
1944
|
+
* `- ` becomes a bullet, etc.
|
|
1945
|
+
*
|
|
1946
|
+
* Themed to match the drawer with our orange brand accent. Save/Cancel are
|
|
1947
|
+
* exposed as a footer with ⌘↵ / Esc keyboard shortcuts.
|
|
1948
|
+
*/
|
|
1949
|
+
declare const MarkdownEditor: React.NamedExoticComponent<MarkdownEditorProps>;
|
|
1950
|
+
|
|
1951
|
+
interface ActivityItem {
|
|
1952
|
+
id: string;
|
|
1953
|
+
icon: string;
|
|
1954
|
+
text: string;
|
|
1955
|
+
color: string;
|
|
1956
|
+
timestamp: number;
|
|
1957
|
+
}
|
|
1958
|
+
interface LiveActivityTickerProps {
|
|
1959
|
+
items: ActivityItem[];
|
|
1960
|
+
maxVisible?: number;
|
|
1961
|
+
}
|
|
1962
|
+
/**
|
|
1963
|
+
* A persistent live activity feed on the KG canvas.
|
|
1964
|
+
* Shows the most recent items. New items slide in, old ones slide out.
|
|
1965
|
+
* Always shows at least the latest item — never empties while reasoning is active.
|
|
1966
|
+
*/
|
|
1967
|
+
declare function LiveActivityTicker({ items, maxVisible }: LiveActivityTickerProps): react_jsx_runtime.JSX.Element;
|
|
1968
|
+
/** Convert a ReasoningProgressEvent into an ActivityItem (or null to skip) */
|
|
1969
|
+
declare function eventToActivity(event: any): ActivityItem | null;
|
|
1970
|
+
|
|
1971
|
+
interface AgentStatus {
|
|
1972
|
+
id: string;
|
|
1973
|
+
displayName: string;
|
|
1974
|
+
role?: string;
|
|
1975
|
+
status: 'idle' | 'thinking' | 'done' | 'active';
|
|
1976
|
+
}
|
|
1977
|
+
interface AgentPresenceBarProps {
|
|
1978
|
+
/** If true, listens for yf-progress-event window events to track agents */
|
|
1979
|
+
listenForEvents?: boolean;
|
|
1980
|
+
/** Alternatively, pass agents directly */
|
|
1981
|
+
agents?: AgentStatus[];
|
|
1982
|
+
/** KG this bar belongs to — events from other KGs are ignored */
|
|
1983
|
+
kgId?: string;
|
|
1984
|
+
}
|
|
1985
|
+
/**
|
|
1986
|
+
* Compact presence bar showing which agents are in the reasoning session.
|
|
1987
|
+
* Tracks agent status from SSE progress events via window events.
|
|
1988
|
+
*/
|
|
1989
|
+
declare function AgentPresenceBar({ listenForEvents, agents: agentsProp, kgId }: AgentPresenceBarProps): react_jsx_runtime.JSX.Element;
|
|
1990
|
+
|
|
1991
|
+
type Stage = 'idle' | 'team_formation' | 'schema_seeding' | 'doc_preparing' | 'doc_extracting' | 'doc_linking' | 'doc_storing' | 'graph';
|
|
1992
|
+
interface StageAgent {
|
|
1993
|
+
id: string;
|
|
1994
|
+
display_name: string;
|
|
1995
|
+
role: string;
|
|
1996
|
+
expertise?: string[];
|
|
1997
|
+
focus?: string;
|
|
1998
|
+
personality?: string;
|
|
1999
|
+
}
|
|
2000
|
+
interface StageState {
|
|
2001
|
+
stage: Stage;
|
|
2002
|
+
team: StageAgent[];
|
|
2003
|
+
/** Ids of agents the user added locally that the backend has not (yet)
|
|
2004
|
+
* acknowledged. Tracked separately from the agent objects so the agent
|
|
2005
|
+
* shape stays clean and downstream consumers don't have to know about
|
|
2006
|
+
* this internal flag. */
|
|
2007
|
+
localOnlyAgentIds: Set<string>;
|
|
2008
|
+
/** Ids of agents from the most recent backend TeamSetup. Used to detect
|
|
2009
|
+
* wholesale-replace events ("give me a different team"): if the next
|
|
2010
|
+
* TeamSetup arrives with zero overlap with this set, we drop the local
|
|
2011
|
+
* additions instead of carrying them forward as ghosts. */
|
|
2012
|
+
lastBackendTeamIds: Set<string>;
|
|
2013
|
+
schemaNodeTypes: string[];
|
|
2014
|
+
schemaEdgeTypes: string[];
|
|
2015
|
+
schemaRelationships: Array<{
|
|
2016
|
+
name: string;
|
|
2017
|
+
domain: string[];
|
|
2018
|
+
range: string[];
|
|
2019
|
+
}>;
|
|
2020
|
+
schemaNodeTypeCount: number;
|
|
2021
|
+
schemaEdgeTypeCount: number;
|
|
2022
|
+
docTitle: string;
|
|
2023
|
+
docActivity: ActivityItem[];
|
|
2024
|
+
}
|
|
2025
|
+
interface StageCanvasProps {
|
|
2026
|
+
nodeCount: number;
|
|
2027
|
+
onForceGraph: () => void;
|
|
2028
|
+
/** Initialize to a specific phase on mount (e.g. from session status endpoint) */
|
|
2029
|
+
initialPhase?: string;
|
|
2030
|
+
/** Pre-populate team agents on mount (e.g. from reasoning set agents) */
|
|
2031
|
+
initialTeam?: StageState['team'];
|
|
2032
|
+
/** KG this canvas belongs to — required to filter out global events
|
|
2033
|
+
* from other KGs that share the same window event channel. */
|
|
2034
|
+
kgId?: string;
|
|
2035
|
+
}
|
|
2036
|
+
declare function StageCanvas({ nodeCount, onForceGraph, initialPhase, initialTeam, kgId }: StageCanvasProps): react_jsx_runtime.JSX.Element;
|
|
2037
|
+
|
|
2038
|
+
interface ReasoningOverlayProps {
|
|
2039
|
+
/** Terminal config for the chat panel */
|
|
2040
|
+
config: TerminalConfig;
|
|
2041
|
+
/** Current user for chat attribution */
|
|
2042
|
+
currentUser?: MessageSender;
|
|
2043
|
+
/** Data callbacks for the KG visualization */
|
|
2044
|
+
data: KnowledgeGraphDataCallbacks;
|
|
2045
|
+
/** Look up the working group + thread for a KG. Replaces the legacy
|
|
2046
|
+
* `onLookupReasoningSet`. The host typically resolves this by walking
|
|
2047
|
+
* the KG's lineage (`GET /kgs/:id/lineage` returns `working_group_id`
|
|
2048
|
+
* on each `LineageEntry`) and asking the agents service for the
|
|
2049
|
+
* active reasoning session via `onGetReasoningSession`. */
|
|
2050
|
+
onLookupKg?: (kgId: string) => Promise<{
|
|
2051
|
+
working_group_id: string;
|
|
2052
|
+
thread_id?: string;
|
|
2053
|
+
run_id?: string;
|
|
2054
|
+
} | null>;
|
|
2055
|
+
/** Bearer JWT — forwarded to the chat panel's pipeline-events SSE keepalive
|
|
2056
|
+
* as `?access_token=` because browser fetch SSE can't set `Authorization`
|
|
2057
|
+
* and the agents service enforces auth (v0.3.0+). */
|
|
2058
|
+
authToken?: string;
|
|
2059
|
+
}
|
|
2060
|
+
/**
|
|
2061
|
+
* Global fullscreen overlay for viewing knowledge graphs.
|
|
2062
|
+
* Listens for `view-kg` window events and opens on top of any page.
|
|
2063
|
+
* Self-contained — fetches its own data via the host-provided callbacks,
|
|
2064
|
+
* no navigation needed.
|
|
2065
|
+
*/
|
|
2066
|
+
declare function ReasoningOverlay({ config, currentUser, data, onLookupKg, authToken }: ReasoningOverlayProps): react_jsx_runtime.JSX.Element;
|
|
2067
|
+
|
|
2068
|
+
interface PipelineProgressBarProps {
|
|
2069
|
+
/** Listen for yf-progress-event window events */
|
|
2070
|
+
listenForEvents?: boolean;
|
|
2071
|
+
/** Or pass the current phase directly */
|
|
2072
|
+
currentPhase?: string;
|
|
2073
|
+
/** Phases that have been completed */
|
|
2074
|
+
completedPhases?: string[];
|
|
2075
|
+
/** KG this bar belongs to — events from other KGs are ignored */
|
|
2076
|
+
kgId?: string;
|
|
2077
|
+
}
|
|
2078
|
+
/**
|
|
2079
|
+
* Horizontal step indicator showing pipeline progress.
|
|
2080
|
+
* Team → Schema → Building → Review → Synthesis → Done
|
|
2081
|
+
*/
|
|
2082
|
+
declare function PipelineProgressBar({ listenForEvents, currentPhase: currentPhaseProp, completedPhases: completedProp, kgId }: PipelineProgressBarProps): react_jsx_runtime.JSX.Element;
|
|
2083
|
+
|
|
2084
|
+
type CheckpointType = 'schema' | 'review' | 'synthesis' | 'team' | 'generic';
|
|
2085
|
+
interface CheckpointCardProps {
|
|
2086
|
+
/** Which checkpoint this is */
|
|
2087
|
+
type: CheckpointType;
|
|
2088
|
+
/** Main content / summary */
|
|
2089
|
+
content: string;
|
|
2090
|
+
/** KG stats */
|
|
2091
|
+
nodeCount?: number;
|
|
2092
|
+
edgeCount?: number;
|
|
2093
|
+
/** Convergence state */
|
|
2094
|
+
convergence?: {
|
|
2095
|
+
ontological: boolean;
|
|
2096
|
+
epistemic: boolean;
|
|
2097
|
+
converged: boolean;
|
|
2098
|
+
};
|
|
2099
|
+
/** Schema stats (for schema checkpoint) */
|
|
2100
|
+
schemaStats?: {
|
|
2101
|
+
nodeTypes: number;
|
|
2102
|
+
edgeTypes: number;
|
|
2103
|
+
hasConstraints: boolean;
|
|
2104
|
+
};
|
|
2105
|
+
/** Called when user picks an action */
|
|
2106
|
+
onAction: (action: 'proceed' | 'question' | 'change', message?: string) => void;
|
|
2107
|
+
/** Whether user has already responded */
|
|
2108
|
+
responded?: boolean;
|
|
2109
|
+
}
|
|
2110
|
+
declare function CheckpointCard({ type, content, nodeCount, edgeCount, convergence, schemaStats, onAction, responded, }: CheckpointCardProps): react_jsx_runtime.JSX.Element;
|
|
2111
|
+
|
|
2112
|
+
interface ConstructionProgressProps {
|
|
2113
|
+
/** KG this indicator belongs to — events from other KGs are ignored */
|
|
2114
|
+
kgId?: string;
|
|
2115
|
+
}
|
|
2116
|
+
/**
|
|
2117
|
+
* Compact per-transform progress indicator.
|
|
2118
|
+
*
|
|
2119
|
+
* Activates for any transform that iterates turns: reasoning's construction
|
|
2120
|
+
* phase AND file extraction / structural completion's per-input loops. The
|
|
2121
|
+
* reasoning-specific fields (schema errors, ontological / epistemic
|
|
2122
|
+
* convergence) hide themselves when their source events never fire, so
|
|
2123
|
+
* extraction runs show only the relevant columns (turn counter + node/edge
|
|
2124
|
+
* count) without confusing "○ ontology ○ claims" dots.
|
|
2125
|
+
*
|
|
2126
|
+
* Listens for yf-progress-event window events.
|
|
2127
|
+
*/
|
|
2128
|
+
declare function ConstructionProgress({ kgId }?: ConstructionProgressProps): react_jsx_runtime.JSX.Element;
|
|
2129
|
+
|
|
2130
|
+
/** Structured detail from the file→KG processing pipeline */
|
|
2131
|
+
type ProcessingDetail = {
|
|
2132
|
+
type: 'chunking';
|
|
2133
|
+
message: string;
|
|
2134
|
+
} | {
|
|
2135
|
+
type: 'embedding_chunks';
|
|
2136
|
+
chunk_count: number;
|
|
2137
|
+
} | {
|
|
2138
|
+
type: 'storing_document';
|
|
2139
|
+
} | {
|
|
2140
|
+
type: 'vocabulary_started';
|
|
2141
|
+
} | {
|
|
2142
|
+
type: 'extraction_started';
|
|
2143
|
+
total_chunks: number;
|
|
2144
|
+
} | {
|
|
2145
|
+
type: 'chunk_processed';
|
|
2146
|
+
chunk: number;
|
|
2147
|
+
total: number;
|
|
2148
|
+
new_entities: number;
|
|
2149
|
+
new_edges: number;
|
|
2150
|
+
total_entities: number;
|
|
2151
|
+
total_edges: number;
|
|
2152
|
+
} | {
|
|
2153
|
+
type: 'vocabulary_evolved';
|
|
2154
|
+
chunk: number;
|
|
2155
|
+
new_types: number;
|
|
2156
|
+
total_node_types: number;
|
|
2157
|
+
total_edge_types: number;
|
|
2158
|
+
} | {
|
|
2159
|
+
type: 'semantic_dedup';
|
|
2160
|
+
chunk: number;
|
|
2161
|
+
proposed_key: string;
|
|
2162
|
+
matched_key: string;
|
|
2163
|
+
} | {
|
|
2164
|
+
type: 'edge_dropped';
|
|
2165
|
+
chunk: number;
|
|
2166
|
+
from: string;
|
|
2167
|
+
to: string;
|
|
2168
|
+
reason: string;
|
|
2169
|
+
} | {
|
|
2170
|
+
type: 'extraction_complete';
|
|
2171
|
+
entities: number;
|
|
2172
|
+
edges: number;
|
|
2173
|
+
} | {
|
|
2174
|
+
type: 'structural_started';
|
|
2175
|
+
candidates: number;
|
|
2176
|
+
} | {
|
|
2177
|
+
type: 'structural_validated';
|
|
2178
|
+
from_label: string;
|
|
2179
|
+
to_label: string;
|
|
2180
|
+
rel_type: string;
|
|
2181
|
+
} | {
|
|
2182
|
+
type: 'structural_complete';
|
|
2183
|
+
inferred: number;
|
|
2184
|
+
rejected: number;
|
|
2185
|
+
yield_pct: number;
|
|
2186
|
+
} | {
|
|
2187
|
+
type: 'storage_started';
|
|
2188
|
+
} | {
|
|
2189
|
+
type: 'storage_progress';
|
|
2190
|
+
stored: number;
|
|
2191
|
+
total: number;
|
|
2192
|
+
} | {
|
|
2193
|
+
type: 'storage_complete';
|
|
2194
|
+
nodes: number;
|
|
2195
|
+
edges: number;
|
|
2196
|
+
chunk_links?: number;
|
|
2197
|
+
} | {
|
|
2198
|
+
type: 'embedding_started';
|
|
2199
|
+
entity_count: number;
|
|
2200
|
+
} | {
|
|
2201
|
+
type: 'embedding_complete';
|
|
2202
|
+
} | {
|
|
2203
|
+
type: 'error';
|
|
2204
|
+
message: string;
|
|
2205
|
+
};
|
|
2206
|
+
interface DocumentProcessingEvent {
|
|
2207
|
+
type: 'DocumentProcessing';
|
|
2208
|
+
document_id: string;
|
|
2209
|
+
step: 'processing' | 'vocabulary' | 'extracting' | 'linking' | 'storing' | 'embedding' | 'complete' | 'error';
|
|
2210
|
+
progress: number | null;
|
|
2211
|
+
detail: ProcessingDetail | string | null;
|
|
2212
|
+
/** KG id (kgf.knowledge_graphs.id) the upload pipeline targets. Replaces
|
|
2213
|
+
* the legacy `reasoning_set_id` field that the backend used to send. */
|
|
2214
|
+
kg_id: string | null;
|
|
2215
|
+
}
|
|
2216
|
+
/** Convert a DocumentProcessing detail into an ActivityItem for the ticker */
|
|
2217
|
+
declare function documentEventToActivity(detail: ProcessingDetail | string | null): ActivityItem | null;
|
|
2218
|
+
/** Pipeline phase labels for the progress indicator */
|
|
2219
|
+
declare const DOCUMENT_PIPELINE_STEPS: {
|
|
2220
|
+
key: string;
|
|
2221
|
+
label: string;
|
|
2222
|
+
}[];
|
|
2223
|
+
|
|
2224
|
+
/**
|
|
2225
|
+
* Compact progress indicator for file→KG document processing.
|
|
2226
|
+
* Listens for yf-doc-processing window events.
|
|
2227
|
+
*/
|
|
2228
|
+
declare function DocumentProcessingProgress(): react_jsx_runtime.JSX.Element;
|
|
2229
|
+
|
|
2230
|
+
/**
|
|
2231
|
+
* Hierarchical layout using dagre — clean, readable, no overlaps.
|
|
2232
|
+
* Uses LR (left-to-right) for wide screens, compact spacing.
|
|
2233
|
+
*/
|
|
2234
|
+
declare function layoutGraph(nodes: Node[], edges: Edge[]): Node[];
|
|
2235
|
+
|
|
2236
|
+
/** Node type → visual properties mapping for the knowledge graph */
|
|
2237
|
+
declare const NODE_TYPE_COLORS: Record<string, {
|
|
2238
|
+
bg: string;
|
|
2239
|
+
border: string;
|
|
2240
|
+
badge: string;
|
|
2241
|
+
text: string;
|
|
2242
|
+
}>;
|
|
2243
|
+
declare function getNodeColors(nodeType: string): {
|
|
2244
|
+
bg: string;
|
|
2245
|
+
border: string;
|
|
2246
|
+
badge: string;
|
|
2247
|
+
text: string;
|
|
2248
|
+
};
|
|
2249
|
+
/** Claim status → border/badge color overrides */
|
|
2250
|
+
declare const CLAIM_STATUS_COLORS: Record<string, {
|
|
2251
|
+
border: string;
|
|
2252
|
+
badge: string;
|
|
2253
|
+
opacity: number;
|
|
2254
|
+
}>;
|
|
2255
|
+
declare function getClaimStatusColors(status?: string): {
|
|
2256
|
+
border: string;
|
|
2257
|
+
badge: string;
|
|
2258
|
+
opacity: number;
|
|
2259
|
+
};
|
|
2260
|
+
declare const NODE_TYPE_LABELS: Record<string, string>;
|
|
2261
|
+
declare function getNodeTypeLabel(nodeType: string): string;
|
|
2262
|
+
declare function getVocabTypeColors(vocabType: string): {
|
|
2263
|
+
bg: string;
|
|
2264
|
+
border: string;
|
|
2265
|
+
badge: string;
|
|
2266
|
+
text: string;
|
|
2267
|
+
};
|
|
2268
|
+
declare function getVocabTypeLabel(vocabType: string): string;
|
|
2269
|
+
/** Edge type → visual properties */
|
|
2270
|
+
declare const EDGE_TYPE_COLORS: Record<string, string>;
|
|
2271
|
+
declare function getEdgeColor(edgeType: string): string;
|
|
2272
|
+
declare function getEdgeTypeLabel(edgeType: string): string;
|
|
2273
|
+
|
|
2274
|
+
declare const terminalColors: {
|
|
2275
|
+
promptDot: string;
|
|
2276
|
+
promptDollar: string;
|
|
2277
|
+
promptText: string;
|
|
2278
|
+
promptSymbol: string;
|
|
2279
|
+
bgPrimary: string;
|
|
2280
|
+
bgHeader: string;
|
|
2281
|
+
bgInput: string;
|
|
2282
|
+
borderPrimary: string;
|
|
2283
|
+
borderSecondary: string;
|
|
2284
|
+
textPrimary: string;
|
|
2285
|
+
textSecondary: string;
|
|
2286
|
+
textMuted: string;
|
|
2287
|
+
textPlaceholder: string;
|
|
2288
|
+
textSystem: string;
|
|
2289
|
+
textCommand: string;
|
|
2290
|
+
textError: string;
|
|
2291
|
+
textSuccess: string;
|
|
2292
|
+
buttonBg: string;
|
|
2293
|
+
buttonText: string;
|
|
2294
|
+
buttonHover: string;
|
|
2295
|
+
cursor: string;
|
|
2296
|
+
suggestionBg: string;
|
|
2297
|
+
suggestionCard: string;
|
|
2298
|
+
suggestionCardHover: string;
|
|
2299
|
+
suggestionHighlight: string;
|
|
2300
|
+
};
|
|
2301
|
+
declare const terminalClassNames: {
|
|
2302
|
+
promptDollar: string;
|
|
2303
|
+
promptDot: string;
|
|
2304
|
+
promptText: string;
|
|
2305
|
+
promptSymbol: string;
|
|
2306
|
+
};
|
|
2307
|
+
|
|
2308
|
+
export { ADVANCE_PHASE_SIGNAL, AGENT_PALETTE, type AIAction, type ActivityItem, AgentAvatar, type AgentAvatarProps, type AgentAvatarSize, AgentPresenceBar, type Annotation, AnnotationThread, type ApiEndpoint, type ApiParameter, type BaseTerminalProps, CLAIM_STATUS_COLORS, ChatTerminal, type ChatTerminalProps, CheckpointCard, type CheckpointType, ClaimNode, type ClaimNodeData, type ClaimStatus, ConstructionProgress, CoreTerminal, type CoreTerminalProps, type CreateNoteResult, DOCUMENT_PIPELINE_STEPS, type DocumentProcessingEvent, DocumentProcessingProgress, EDGE_TYPE_COLORS, EdgeDetailDrawer, EdgeMarkerDefs, CoreTerminal as EmbeddedTerminal, type CoreTerminalProps as EmbeddedTerminalProps, ExpandableTerminal, type ExpandableTerminalProps, type FileUploadResult, type GapOption, type GapQuestion, type GenericKGSnapshot, type GenericSnapshotEdge, type GenericSnapshotNode, GraphChatPanel, type GraphChatPanelProps, GraphEdge, type GraphEdgeData, type GraphLayer, GraphNode, type GraphNodeData, type HelpTopic, InlineTerminal, type InlineTerminalProps, type KGAnnotation, type KGChunkLink$1 as KGChunkLink, type KGScope, type KGSearchResult, type KGSnapshot, type KGSnapshotEdge, type KGSnapshotNode, type KnowledgeGraphDataCallbacks, KnowledgeGraphView, LIVE_KG_ID, type LegacyKGSnapshot, type LegacyKGSnapshotEdge, type LegacyKGSnapshotNode, type LineageEntry, type ListRagFilesResult, type ListedRagFile, LiveActivityTicker, MarkdownContent, MarkdownEditor, type Mention, type MentionTarget, type MessageAudience, type MessageSender, NODE_TYPE_COLORS, NODE_TYPE_LABELS, NodeDetailDrawer, PROGRESS_EVENT_NAME, type PageSuggestion, type ParsedCommand, type PipelineBuilderAction, type PipelineDraft, type PipelineDraftStep, PipelineProgressBar, type PluginContext, type ProcessingDetail, type ProgressEventDetail, type ProgressState, type RagFileActionResult, ReasoningHistoryCard, ReasoningOverlay, type ReasoningOverlayProps, type ReasoningProgressEvent, type ReasoningSnapshot, ReasoningView, type ReasoningViewProps, SYNTHESIS_DONE_SIGNAL, type SaveNoteResult, ScopedReasoningProvider, SettlementBar, type SlashMentionCandidate, SlashMentionPicker, StageCanvas, StandardTerminal, type StandardTerminalProps, type StreamChunk, type StreamHandler, type StreamHandlers, type SubgraphEdge, type SubgraphNode, type TeamSetupAgent, type TerminalCommand, type TerminalCommandResult, type TerminalConfig, type TerminalEntry, TerminalInputBar, type TerminalInputBarProps, type TerminalPlugin, type TerminalSlots, type TerminalSource, type TerminalTheme, TerminalThemeProvider, type TerminalWidget, type WorkingGroupContext, agentSeed, avatarColor, blueScope, buildClaimsGraph, buildTerminalCommand, buttonShadow, captureReasoningSnapshot, defaultTheme, dispatchProgressEvent, documentEventToActivity, emeraldCollab, emeraldRevised, eventToActivity, extractKGSources, extractKgId, filterCommands, formatAssetDisplay, formatPaymentAmount, formatTokenAssetId, getAgentColor, getBuiltInCommands, getClaimStatusColors, getEdgeColor, getEdgeTypeLabel, getNodeColors, getNodeTypeLabel, getVocabTypeColors, getVocabTypeLabel, greenAction, handleSSEStream, handleStreamingResponse, hostApp, initials, isFixedKgId, isNaturalLanguage, layoutGraph, mergeTheme, openPipelineEventStream, orangeRebuttal, parseTerminalCommand, pipelineBg, processStreamLines, purple, reduceProgress, renderMarkdownBlock, resolvePaymentAssetDisplay, snapshotToSubgraph, terminalClassNames, terminalColors, useScopedProgressEvent, useSlashMentionPicker, useTheme, warmBg };
|