@yieldfabric/terminal 1.0.0 → 1.1.1
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/LICENSE.md +293 -0
- package/NOTICE.md +28 -0
- package/README.md +78 -9
- package/dist/index.cjs +1391 -775
- package/dist/index.d.cts +244 -4
- package/dist/index.d.ts +244 -4
- package/dist/index.js +959 -350
- package/package.json +18 -8
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 YieldFabric Technologies Ltd, DIFC, UAE.
|
|
3
|
+
* All rights reserved. Proprietary and confidential.
|
|
4
|
+
* Source review requires written authorization; see package LICENSE.md and NOTICE.md.
|
|
5
|
+
* Runtime use requires a separate express license.
|
|
6
|
+
*/
|
|
1
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
8
|
import React from 'react';
|
|
3
9
|
import { NodeProps, EdgeProps, Node, Edge } from '@xyflow/react';
|
|
@@ -15,6 +21,16 @@ import { NodeProps, EdgeProps, Node, Edge } from '@xyflow/react';
|
|
|
15
21
|
type ReasoningMode = 'reason';
|
|
16
22
|
|
|
17
23
|
interface TerminalTheme {
|
|
24
|
+
/** Which side of the light/dark divide this theme is.
|
|
25
|
+
*
|
|
26
|
+
* Components that need to branch (a placeholder tint, a panel border, a
|
|
27
|
+
* toolbar fill) used to sniff it with `t.bgRaised === '#ffffff'`. That is an
|
|
28
|
+
* exact-string test against one literal, so it silently reported DARK for
|
|
29
|
+
* any light theme whose surfaces are CSS variables, or simply an off-white
|
|
30
|
+
* — which is what happens the moment a host themes its surfaces properly.
|
|
31
|
+
* Declare it instead. Optional, and the old sniff remains the fallback, so
|
|
32
|
+
* a theme that predates this keeps its current behaviour. */
|
|
33
|
+
mode?: 'light' | 'dark';
|
|
18
34
|
primary: string;
|
|
19
35
|
primaryMuted: string;
|
|
20
36
|
primaryHover: string;
|
|
@@ -345,16 +361,39 @@ interface PageSuggestion {
|
|
|
345
361
|
keywords: string[];
|
|
346
362
|
icon: string;
|
|
347
363
|
}
|
|
364
|
+
/**
|
|
365
|
+
* What the terminal calls itself when no host says otherwise.
|
|
366
|
+
*
|
|
367
|
+
* Exported so a host can tell whether it is looking at the default or at
|
|
368
|
+
* its own value, and so the fallback has one home rather than a literal
|
|
369
|
+
* repeated at every banner site — which is what it was, and why renaming
|
|
370
|
+
* it in one place left the Clear button still saying the old name.
|
|
371
|
+
*/
|
|
372
|
+
declare const DEFAULT_AGENT_LABEL = "YieldFabric Agent";
|
|
348
373
|
interface TerminalConfig {
|
|
349
374
|
endpoints: ApiEndpoint[];
|
|
350
375
|
helpTopics?: HelpTopic[];
|
|
351
376
|
pageSuggestions?: PageSuggestion[];
|
|
352
377
|
apiBaseUrl?: string;
|
|
353
378
|
agentsApiUrl?: string;
|
|
379
|
+
/** Resolve current credentials at action time, including refreshed tokens. */
|
|
380
|
+
getAuthHeaders?: () => Record<string, string>;
|
|
354
381
|
/** Unified GraphQL endpoint for entity/wallet/asset queries in action cards. */
|
|
355
382
|
graphqlUrl?: string;
|
|
356
383
|
welcomeMessage?: string;
|
|
357
384
|
showWelcomeMessage?: boolean;
|
|
385
|
+
/**
|
|
386
|
+
* The name in the terminal's banner line, shown on first mount, after
|
|
387
|
+
* Clear, and above the welcome message. Defaults to
|
|
388
|
+
* `DEFAULT_AGENT_LABEL`.
|
|
389
|
+
*
|
|
390
|
+
* Exists because this package is embedded in white-labelled platforms —
|
|
391
|
+
* qord and every customer platform generated from it — where the
|
|
392
|
+
* vendor's name in the host's own product reads as a leak. Setting it
|
|
393
|
+
* is the supported way to rename; there is no other, since the banner
|
|
394
|
+
* is rebuilt from scratch on Clear and would revert.
|
|
395
|
+
*/
|
|
396
|
+
agentLabel?: string;
|
|
358
397
|
/** Custom commands shown in the / command palette alongside built-ins. */
|
|
359
398
|
customCommands?: TerminalCommand[];
|
|
360
399
|
}
|
|
@@ -573,8 +612,52 @@ interface ReasoningProgressEvent {
|
|
|
573
612
|
reasoning_thread_id?: string;
|
|
574
613
|
thread_id?: string;
|
|
575
614
|
}
|
|
615
|
+
/** One tool call an agent made, as reported on a stream. Emitted twice per
|
|
616
|
+
* call with the same `seq` — once on dispatch, once on return — so a consumer
|
|
617
|
+
* keyed on `seq` updates the row in place rather than appending. */
|
|
618
|
+
interface AgentToolStep {
|
|
619
|
+
seq: number;
|
|
620
|
+
/** Which of the agent's decisions this call belongs to, 1-based.
|
|
621
|
+
*
|
|
622
|
+
* Every call the model emitted in one response shares a round, so counting
|
|
623
|
+
* rounds counts how many times the agent stopped to think, where counting
|
|
624
|
+
* calls counts how far each thought fanned out. Optional because a server
|
|
625
|
+
* that predates the field simply omits it. */
|
|
626
|
+
round?: number;
|
|
627
|
+
tool: string;
|
|
628
|
+
/** `"tool"`, and room for `"think"` / `"plan"` later. Optional because the
|
|
629
|
+
* SSE stream shape omits it — the renderer keys on `tool` and `status`. */
|
|
630
|
+
kind?: string;
|
|
631
|
+
/** 'running' on dispatch, then 'ok' | 'error'. */
|
|
632
|
+
status: string;
|
|
633
|
+
/** What the agent was looking for. Derived from its arguments, never from
|
|
634
|
+
* a tool's results — results can carry document text, and a progress feed
|
|
635
|
+
* is the wrong channel for it. */
|
|
636
|
+
detail: string;
|
|
637
|
+
/** How much came back — a count, never content. Empty while running. */
|
|
638
|
+
outcome: string;
|
|
639
|
+
ms: number;
|
|
640
|
+
}
|
|
641
|
+
interface AgentCompletion {
|
|
642
|
+
stop_reason: 'answered' | 'rounds_exhausted' | 'budget_exhausted' | 'empty' | 'failed' | 'interrupted' | 'cancelled' | 'awaiting_tool_results';
|
|
643
|
+
truncated?: boolean;
|
|
644
|
+
rounds_used?: number;
|
|
645
|
+
prompt_tokens?: number;
|
|
646
|
+
completion_tokens?: number;
|
|
647
|
+
reasoning_tokens?: number;
|
|
648
|
+
elided_groups?: number;
|
|
649
|
+
reused_calls?: number;
|
|
650
|
+
}
|
|
576
651
|
interface StreamChunk {
|
|
652
|
+
/** Host-owned turn identity/context, retained on the rendered response. */
|
|
653
|
+
entryMetadata?: Record<string, unknown>;
|
|
654
|
+
completion?: AgentCompletion;
|
|
655
|
+
error?: string;
|
|
577
656
|
chunk?: string;
|
|
657
|
+
/** A tool step from an agentic loop. Present only on backends that run one;
|
|
658
|
+
* a chunk carrying a step has an empty `chunk`, so a consumer that ignores
|
|
659
|
+
* this field appends nothing and behaves exactly as before. */
|
|
660
|
+
step?: AgentToolStep;
|
|
578
661
|
thread_id?: string;
|
|
579
662
|
/** KG id (kgf.knowledge_graphs.id) this chunk belongs to. */
|
|
580
663
|
kg_id?: string;
|
|
@@ -821,6 +904,20 @@ interface BaseTerminalProps {
|
|
|
821
904
|
onReasoningModeChange?: (mode: ReasoningMode | null) => void;
|
|
822
905
|
onResolveWorkingGroup?: () => Promise<WorkingGroupContext | null>;
|
|
823
906
|
workingGroupContext?: WorkingGroupContext | null;
|
|
907
|
+
/**
|
|
908
|
+
* Show the "Working Group Scope" banner above the transcript.
|
|
909
|
+
* Defaults to `true`. See `TerminalShellProps` — the short version is
|
|
910
|
+
* that `workingGroupContext` both scopes the file tools and prints
|
|
911
|
+
* this strip, and a host may want the first without the second.
|
|
912
|
+
*/
|
|
913
|
+
showWorkingGroupBanner?: boolean;
|
|
914
|
+
/**
|
|
915
|
+
* Take keyboard focus when the composer mounts. Defaults to `true`.
|
|
916
|
+
* Set `false` when the terminal is one panel among several: focus
|
|
917
|
+
* raises the on-screen keyboard and takes the caret from whatever the
|
|
918
|
+
* reader was doing. See `TerminalInputBarProps.autoFocus`.
|
|
919
|
+
*/
|
|
920
|
+
autoFocusInput?: boolean;
|
|
824
921
|
onRagFileUpload?: (files: File[], context?: WorkingGroupContext | null) => Promise<FileUploadResult>;
|
|
825
922
|
onListRagFiles?: (context?: WorkingGroupContext | null) => Promise<ListRagFilesResult>;
|
|
826
923
|
onDeleteRagFile?: (documentId: string, context?: WorkingGroupContext | null) => Promise<RagFileActionResult>;
|
|
@@ -838,6 +935,14 @@ interface BaseTerminalProps {
|
|
|
838
935
|
ok: boolean;
|
|
839
936
|
message: string;
|
|
840
937
|
}>;
|
|
938
|
+
/** Capture a line of narration as a work item on the host's work
|
|
939
|
+
* record — the `/log` slash command. A PERSON's own capture is a
|
|
940
|
+
* direct create (no proposal); the host decides the scope (the
|
|
941
|
+
* active workspace). Returns a short message the terminal echoes. */
|
|
942
|
+
onSubmitLog?: (prose: string) => Promise<{
|
|
943
|
+
ok: boolean;
|
|
944
|
+
message: string;
|
|
945
|
+
}>;
|
|
841
946
|
/** Resolve a partial `@<query>` typed inside a slash command (e.g.
|
|
842
947
|
* `/note @wi`) to substrate entities. The terminal renders the
|
|
843
948
|
* results as a picker popover; selecting one replaces the query
|
|
@@ -875,11 +980,28 @@ interface BaseTerminalProps {
|
|
|
875
980
|
renderEntryExtra?: (entry: TerminalEntry, index: number) => React.ReactNode;
|
|
876
981
|
/** Full override for entry rendering. Return `null` to use default rendering. */
|
|
877
982
|
renderEntry?: (entry: TerminalEntry, index: number, defaultRender: () => React.ReactNode) => React.ReactNode;
|
|
983
|
+
/**
|
|
984
|
+
* Show the built-in "Processing…" row while a turn is in flight.
|
|
985
|
+
* Defaults to `true`.
|
|
986
|
+
*
|
|
987
|
+
* Turn it OFF when the host renders its own account of the work — an
|
|
988
|
+
* agentic loop that names the step in flight, say. The built-in row
|
|
989
|
+
* says only that something is happening and for how long, which beside
|
|
990
|
+
* a named step is a second clock with nothing to add, and hosts cannot
|
|
991
|
+
* suppress it otherwise: it is gated on `progressState`, which stays
|
|
992
|
+
* null for any backend that does not emit `progress` chunks, so for
|
|
993
|
+
* those it is not a fallback but a permanent fixture.
|
|
994
|
+
*/
|
|
995
|
+
showBusyIndicator?: boolean;
|
|
878
996
|
/** Custom widgets that render per-entry based on a match condition. */
|
|
879
997
|
widgets?: TerminalWidget[];
|
|
880
998
|
/** Slot-based injection points for persistent content around the terminal. */
|
|
881
999
|
slots?: TerminalSlots;
|
|
882
1000
|
onSourcesActivate?: (sources: TerminalSource[], entry: TerminalEntry) => void;
|
|
1001
|
+
/** Activate one cited source. When supplied, each source label becomes an
|
|
1002
|
+
* independent control; `onSourcesActivate` remains available for consumers
|
|
1003
|
+
* that treat the complete citation set as one action. */
|
|
1004
|
+
onSourceActivate?: (source: TerminalSource, entry: TerminalEntry) => void;
|
|
883
1005
|
/** Poll for new messages (e.g. agent push messages). Called every pollIntervalMs. */
|
|
884
1006
|
onPollMessages?: (lastMessageId?: string) => Promise<TerminalEntry[]>;
|
|
885
1007
|
/** Polling interval in ms. Default 3000. */
|
|
@@ -901,6 +1023,20 @@ interface BaseTerminalProps {
|
|
|
901
1023
|
}
|
|
902
1024
|
/** StandardTerminal — developer console with API endpoints and commands. */
|
|
903
1025
|
interface StandardTerminalProps extends BaseTerminalProps {
|
|
1026
|
+
/** Submit a complete question to this terminal only. IDs are consumed once;
|
|
1027
|
+
* a request arriving during another answer waits until that answer settles.
|
|
1028
|
+
* Does not replace the reader's draft or focus the mobile keyboard. */
|
|
1029
|
+
submitRequest?: {
|
|
1030
|
+
id: string;
|
|
1031
|
+
value: string;
|
|
1032
|
+
} | null;
|
|
1033
|
+
onSubmitRequest?: (id: string) => void;
|
|
1034
|
+
/** What the empty input invites, when the host has a name for its
|
|
1035
|
+
* agent. Defaults to the generic prompt, so a host that does not set
|
|
1036
|
+
* one is unchanged. A KG scope still overrides it — "Ask about X" is
|
|
1037
|
+
* about where the answer will come from, which outranks whose
|
|
1038
|
+
* assistant is asking. */
|
|
1039
|
+
inputPlaceholder?: string;
|
|
904
1040
|
onCommandExecute?: (command: string, endpoint?: ApiEndpoint, params?: Record<string, string>) => Promise<TerminalCommandResult>;
|
|
905
1041
|
authToken?: string;
|
|
906
1042
|
onAuthTokenChange?: (token: string) => void;
|
|
@@ -916,11 +1052,18 @@ interface ChatTerminalProps extends BaseTerminalProps {
|
|
|
916
1052
|
displayName: string;
|
|
917
1053
|
}>;
|
|
918
1054
|
onTyping?: () => void;
|
|
1055
|
+
/** Bearer JWT — forwarded to `/pipelines/:run_id/events` as
|
|
1056
|
+
* `?access_token=` for upload-progress streaming (the fetch SSE
|
|
1057
|
+
* wrapper can't set `Authorization` and the agents service enforces
|
|
1058
|
+
* auth on that endpoint). Without it, `onRagFileUpload` ingestions
|
|
1059
|
+
* still run server-side but live progress 401s silently. Same
|
|
1060
|
+
* contract as `StandardTerminalProps.authToken`. */
|
|
1061
|
+
authToken?: string;
|
|
919
1062
|
}
|
|
920
1063
|
|
|
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;
|
|
1064
|
+
declare function StandardTerminal({ showBusyIndicator, theme: themeOverrides, config, onCommandExecute, onPageNavigation, authToken, onAuthTokenChange, className, style, showHeader, showWelcomeMessage, initialHistory, onHistoryChange, onStreamRequest, onResolveWorkingGroup, onRagFileUpload, onListRagFiles, onDeleteRagFile, onDownloadRagFile, workingGroupContext: workingGroupContextProp, showWorkingGroupBanner, autoFocusInput, inputPlaceholder, submitRequest, onSubmitRequest, onPipelineDraftEdit, onPipelineDraftReject, onSubmitNote, onSubmitLog, onMentionResolve, onMentionPicked, availableKGs, activeKGScope, onKGScopeChange, onViewKnowledgeGraph, onLiveKGUpdate, onKgIdChange, onRunIdChange, onThreadIdChange, onReasoningPhaseChange, reasoningRef, reasoningMode: reasoningModeProp, onReasoningModeChange: onReasoningModeChangeProp, sourceKGNodes, renderEntryExtra, renderEntry, widgets, slots, onSourcesActivate, onSourceActivate, onPollMessages, pollIntervalMs, historyRef, }: StandardTerminalProps): react_jsx_runtime.JSX.Element;
|
|
922
1065
|
|
|
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;
|
|
1066
|
+
declare function ChatTerminal({ showBusyIndicator, theme: themeOverrides, config, className, style, showHeader, showWelcomeMessage, initialHistory, onHistoryChange, onStreamRequest, onResolveWorkingGroup, onRagFileUpload, onListRagFiles, onDeleteRagFile, onDownloadRagFile, workingGroupContext: workingGroupContextProp, showWorkingGroupBanner, autoFocusInput, onPipelineDraftEdit, onPipelineDraftReject, onPageNavigation, availableKGs, activeKGScope, onKGScopeChange, onViewKnowledgeGraph, onLiveKGUpdate, onKgIdChange, onRunIdChange, onThreadIdChange, onReasoningPhaseChange, onActivityEventsChange, reasoningRef, reasoningMode: reasoningModeProp, onReasoningModeChange: onReasoningModeChangeProp, sourceKGNodes, renderEntryExtra, renderEntry, widgets, slots, onSourcesActivate, onSourceActivate, historyRef, currentUser, onSendMessage, onPollMessages, mentionTargets, pollIntervalMs, typingUsers, onTyping, onSubmitNote, onSubmitLog, onMentionResolve, onMentionPicked, authToken, }: ChatTerminalProps): react_jsx_runtime.JSX.Element;
|
|
924
1067
|
|
|
925
1068
|
/**
|
|
926
1069
|
* CoreTerminal — routing facade for backward compatibility.
|
|
@@ -1007,11 +1150,30 @@ interface AgentAvatarProps {
|
|
|
1007
1150
|
}
|
|
1008
1151
|
declare const AgentAvatar: React.FC<AgentAvatarProps>;
|
|
1009
1152
|
|
|
1153
|
+
interface AgentStepTraceProps {
|
|
1154
|
+
steps: AgentToolStep[];
|
|
1155
|
+
/** True while the reply is still streaming. */
|
|
1156
|
+
working: boolean;
|
|
1157
|
+
}
|
|
1158
|
+
declare function AgentStepTrace({ steps, working }: AgentStepTraceProps): react_jsx_runtime.JSX.Element;
|
|
1159
|
+
|
|
1160
|
+
/**
|
|
1161
|
+
* Ready-made `renderEntryExtra` for any terminal that wants the trace.
|
|
1162
|
+
*
|
|
1163
|
+
* Exported rather than re-written per surface: there are several chat surfaces
|
|
1164
|
+
* across several apps, and the first attempt wired only one of them. A shared
|
|
1165
|
+
* function makes adding the next one a single prop, and means the "is it still
|
|
1166
|
+
* working?" rule below has exactly one definition to be wrong in.
|
|
1167
|
+
*/
|
|
1168
|
+
declare function agentStepTraceExtra(entry: TerminalEntry): React.ReactNode;
|
|
1169
|
+
|
|
1010
1170
|
interface TerminalInputBarProps {
|
|
1011
1171
|
inputRef: React.RefObject<HTMLTextAreaElement>;
|
|
1012
1172
|
fileInputRef: React.RefObject<HTMLInputElement>;
|
|
1013
1173
|
currentCommand: string;
|
|
1014
1174
|
isExecuting: boolean;
|
|
1175
|
+
/** Prevent editing while a prerequisite is unavailable, without implying work is running. */
|
|
1176
|
+
disabled?: boolean;
|
|
1015
1177
|
placeholder?: string;
|
|
1016
1178
|
onInputChange: (value: string) => void;
|
|
1017
1179
|
onKeyDown: (e: React.KeyboardEvent) => void;
|
|
@@ -1043,8 +1205,22 @@ interface TerminalInputBarProps {
|
|
|
1043
1205
|
compactToolbar?: boolean;
|
|
1044
1206
|
/** Accessible label for the submit affordance. */
|
|
1045
1207
|
submitTitle?: string;
|
|
1208
|
+
/**
|
|
1209
|
+
* Take keyboard focus when the bar mounts. Defaults to `true`, which is
|
|
1210
|
+
* what a terminal that OWNS its page wants.
|
|
1211
|
+
*
|
|
1212
|
+
* Turn it off when the terminal is one panel among several. Focus is not
|
|
1213
|
+
* free: it opens the on-screen keyboard on a touch device, and a panel
|
|
1214
|
+
* that grabs the caret the moment it mounts takes it away from whatever
|
|
1215
|
+
* the reader was actually doing. An embedded consumer generally wants
|
|
1216
|
+
* the input ready but not seized — `false` here, and the reader taps it.
|
|
1217
|
+
*
|
|
1218
|
+
* The page-scroll that used to come with this is fixed for everyone
|
|
1219
|
+
* regardless of the setting; see the focus effect below.
|
|
1220
|
+
*/
|
|
1221
|
+
autoFocus?: boolean;
|
|
1046
1222
|
}
|
|
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;
|
|
1223
|
+
declare function TerminalInputBar({ inputRef, fileInputRef, currentCommand, isExecuting, disabled, placeholder, onInputChange, onKeyDown, onSubmit, onTyping, onUploadFiles, onListFilesCommand, availableKGs, activeKGScope, onKGScopeChange, reasoningMode, onReasoningModeChange, knownMentionNames, onCaretChange, showUploadButton, showFilesButton, commandPaletteItems, selectedPaletteItem, onSelectPaletteItem, inputBarExtra, modeSelector, compactToolbar, submitTitle, autoFocus, }: TerminalInputBarProps): react_jsx_runtime.JSX.Element;
|
|
1048
1224
|
|
|
1049
1225
|
interface SlashMentionCandidate {
|
|
1050
1226
|
entity_id: string;
|
|
@@ -1118,6 +1294,56 @@ declare function filterCommands(query: string, builtIn: TerminalCommand[], custo
|
|
|
1118
1294
|
*/
|
|
1119
1295
|
declare function processStreamLines(buffer: string, onJsonLine: (parsed: any) => void): string;
|
|
1120
1296
|
|
|
1297
|
+
/**
|
|
1298
|
+
* When a stream has gone quiet long enough to be dead.
|
|
1299
|
+
*
|
|
1300
|
+
* ## Why a reader cannot just wait
|
|
1301
|
+
*
|
|
1302
|
+
* A TCP connection can die LOUDLY — the browser reports a failed load and
|
|
1303
|
+
* `reader.read()` rejects — or SILENTLY: the peer goes away, no FIN or RST
|
|
1304
|
+
* is ever seen, and the read simply never settles. Nothing throws, so
|
|
1305
|
+
* nothing downstream recovers, and the reader watches a spinner while the
|
|
1306
|
+
* work is already finished on the server.
|
|
1307
|
+
*
|
|
1308
|
+
* That is observed behaviour, not theory: two identical severed
|
|
1309
|
+
* connections, one surfacing `ERR_INCOMPLETE_CHUNKED_ENCODING` and
|
|
1310
|
+
* recovering, the other hanging past a minute with the answer already
|
|
1311
|
+
* stored. Which one you get is up to the network, which is exactly why a
|
|
1312
|
+
* client cannot wait to be told.
|
|
1313
|
+
*
|
|
1314
|
+
* ## Why a timeout is safe here
|
|
1315
|
+
*
|
|
1316
|
+
* Every YieldFabric SSE endpoint keeps its stream alive — axum's
|
|
1317
|
+
* `KeepAlive::default()`, a `:\n\n` comment every fifteen seconds while
|
|
1318
|
+
* the stream is otherwise idle. So silence is a reliable death signal
|
|
1319
|
+
* rather than a guess about how long work should take: a slow answer
|
|
1320
|
+
* still ticks, only a dead connection goes quiet.
|
|
1321
|
+
*
|
|
1322
|
+
* NO IMPORTS, deliberately. This is consumed both by `handleSSEStream`
|
|
1323
|
+
* here and by hosts that read a stream themselves, and it is the piece
|
|
1324
|
+
* worth testing — a barrel import would drag React and an ESM markdown
|
|
1325
|
+
* renderer into a test that only needs arithmetic and a promise.
|
|
1326
|
+
*/
|
|
1327
|
+
/** How often a YieldFabric SSE endpoint sends a keep-alive comment. */
|
|
1328
|
+
declare const SSE_KEEPALIVE_MS = 15000;
|
|
1329
|
+
/**
|
|
1330
|
+
* Silence that means the connection is gone, whatever the OS thinks.
|
|
1331
|
+
*
|
|
1332
|
+
* Three missed keep-alives: long enough that a slow hop or a stalled
|
|
1333
|
+
* scheduler cannot trip it, short enough to be noticed while somebody is
|
|
1334
|
+
* still watching.
|
|
1335
|
+
*/
|
|
1336
|
+
declare const SSE_STALL_MS: number;
|
|
1337
|
+
/**
|
|
1338
|
+
* `work`, unless nothing has happened for `ms` — then a rejection.
|
|
1339
|
+
*
|
|
1340
|
+
* `sleep` is injected so the rule can be tested without waiting for a
|
|
1341
|
+
* real clock. The `done` flag matters: a stream delivers many chunks, and
|
|
1342
|
+
* a timer that fired after its read already landed would kill a healthy
|
|
1343
|
+
* connection.
|
|
1344
|
+
*/
|
|
1345
|
+
declare function withStallTimeout<T>(work: Promise<T>, ms?: number, sleep?: (ms: number) => Promise<void>): Promise<T>;
|
|
1346
|
+
|
|
1121
1347
|
/**
|
|
1122
1348
|
* Handles generic streaming JSON-line responses (non-SSE).
|
|
1123
1349
|
*/
|
|
@@ -1138,7 +1364,21 @@ declare const handleSSEStream: (url: string, body: any, onChunk: (chunk: any) =>
|
|
|
1138
1364
|
method?: string;
|
|
1139
1365
|
headers?: Record<string, string>;
|
|
1140
1366
|
signal?: AbortSignal;
|
|
1367
|
+
/** Host authentication/renewal transport. It must preserve the supplied
|
|
1368
|
+
* abort signal and must not retry a request after its stream has begun. */
|
|
1369
|
+
fetcher?: (url: string, init: RequestInit) => Promise<Response>;
|
|
1141
1370
|
onGone?: (reason: string) => void;
|
|
1371
|
+
/** Require an explicit answer terminal event. Defaults to true.
|
|
1372
|
+
* Set false only for non-answer protocols that intentionally end at EOF.
|
|
1373
|
+
*/
|
|
1374
|
+
requireFinal?: boolean;
|
|
1375
|
+
/**
|
|
1376
|
+
* Give up after this much silence. Defaults to `SSE_STALL_MS`, which
|
|
1377
|
+
* is safe for every YieldFabric endpoint because they all keep their
|
|
1378
|
+
* streams alive — see `streamStall`. Pass `0` to wait forever, which
|
|
1379
|
+
* is only right for a server that does NOT heartbeat.
|
|
1380
|
+
*/
|
|
1381
|
+
stallMs?: number;
|
|
1142
1382
|
}) => Promise<void>;
|
|
1143
1383
|
|
|
1144
1384
|
/**
|
|
@@ -2305,4 +2545,4 @@ declare const terminalClassNames: {
|
|
|
2305
2545
|
promptSymbol: string;
|
|
2306
2546
|
};
|
|
2307
2547
|
|
|
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 };
|
|
2548
|
+
export { ADVANCE_PHASE_SIGNAL, AGENT_PALETTE, type AIAction, type ActivityItem, AgentAvatar, type AgentAvatarProps, type AgentAvatarSize, type AgentCompletion, AgentPresenceBar, AgentStepTrace, type AgentToolStep, 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, DEFAULT_AGENT_LABEL, 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, SSE_KEEPALIVE_MS, SSE_STALL_MS, 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, agentStepTraceExtra, 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, withStallTimeout };
|