@yieldfabric/terminal 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +293 -0
- package/NOTICE.md +28 -0
- package/README.md +78 -9
- package/dist/index.cjs +1354 -768
- package/dist/index.d.cts +231 -4
- package/dist/index.d.ts +231 -4
- package/dist/index.js +922 -343
- package/package.json +18 -8
package/dist/index.d.ts
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';
|
|
@@ -345,16 +351,39 @@ interface PageSuggestion {
|
|
|
345
351
|
keywords: string[];
|
|
346
352
|
icon: string;
|
|
347
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* What the terminal calls itself when no host says otherwise.
|
|
356
|
+
*
|
|
357
|
+
* Exported so a host can tell whether it is looking at the default or at
|
|
358
|
+
* its own value, and so the fallback has one home rather than a literal
|
|
359
|
+
* repeated at every banner site — which is what it was, and why renaming
|
|
360
|
+
* it in one place left the Clear button still saying the old name.
|
|
361
|
+
*/
|
|
362
|
+
declare const DEFAULT_AGENT_LABEL = "YieldFabric Agent";
|
|
348
363
|
interface TerminalConfig {
|
|
349
364
|
endpoints: ApiEndpoint[];
|
|
350
365
|
helpTopics?: HelpTopic[];
|
|
351
366
|
pageSuggestions?: PageSuggestion[];
|
|
352
367
|
apiBaseUrl?: string;
|
|
353
368
|
agentsApiUrl?: string;
|
|
369
|
+
/** Resolve current credentials at action time, including refreshed tokens. */
|
|
370
|
+
getAuthHeaders?: () => Record<string, string>;
|
|
354
371
|
/** Unified GraphQL endpoint for entity/wallet/asset queries in action cards. */
|
|
355
372
|
graphqlUrl?: string;
|
|
356
373
|
welcomeMessage?: string;
|
|
357
374
|
showWelcomeMessage?: boolean;
|
|
375
|
+
/**
|
|
376
|
+
* The name in the terminal's banner line, shown on first mount, after
|
|
377
|
+
* Clear, and above the welcome message. Defaults to
|
|
378
|
+
* `DEFAULT_AGENT_LABEL`.
|
|
379
|
+
*
|
|
380
|
+
* Exists because this package is embedded in white-labelled platforms —
|
|
381
|
+
* qord and every customer platform generated from it — where the
|
|
382
|
+
* vendor's name in the host's own product reads as a leak. Setting it
|
|
383
|
+
* is the supported way to rename; there is no other, since the banner
|
|
384
|
+
* is rebuilt from scratch on Clear and would revert.
|
|
385
|
+
*/
|
|
386
|
+
agentLabel?: string;
|
|
358
387
|
/** Custom commands shown in the / command palette alongside built-ins. */
|
|
359
388
|
customCommands?: TerminalCommand[];
|
|
360
389
|
}
|
|
@@ -573,8 +602,52 @@ interface ReasoningProgressEvent {
|
|
|
573
602
|
reasoning_thread_id?: string;
|
|
574
603
|
thread_id?: string;
|
|
575
604
|
}
|
|
605
|
+
/** One tool call an agent made, as reported on a stream. Emitted twice per
|
|
606
|
+
* call with the same `seq` — once on dispatch, once on return — so a consumer
|
|
607
|
+
* keyed on `seq` updates the row in place rather than appending. */
|
|
608
|
+
interface AgentToolStep {
|
|
609
|
+
seq: number;
|
|
610
|
+
/** Which of the agent's decisions this call belongs to, 1-based.
|
|
611
|
+
*
|
|
612
|
+
* Every call the model emitted in one response shares a round, so counting
|
|
613
|
+
* rounds counts how many times the agent stopped to think, where counting
|
|
614
|
+
* calls counts how far each thought fanned out. Optional because a server
|
|
615
|
+
* that predates the field simply omits it. */
|
|
616
|
+
round?: number;
|
|
617
|
+
tool: string;
|
|
618
|
+
/** `"tool"`, and room for `"think"` / `"plan"` later. Optional because the
|
|
619
|
+
* SSE stream shape omits it — the renderer keys on `tool` and `status`. */
|
|
620
|
+
kind?: string;
|
|
621
|
+
/** 'running' on dispatch, then 'ok' | 'error'. */
|
|
622
|
+
status: string;
|
|
623
|
+
/** What the agent was looking for. Derived from its arguments, never from
|
|
624
|
+
* a tool's results — results can carry document text, and a progress feed
|
|
625
|
+
* is the wrong channel for it. */
|
|
626
|
+
detail: string;
|
|
627
|
+
/** How much came back — a count, never content. Empty while running. */
|
|
628
|
+
outcome: string;
|
|
629
|
+
ms: number;
|
|
630
|
+
}
|
|
631
|
+
interface AgentCompletion {
|
|
632
|
+
stop_reason: 'answered' | 'rounds_exhausted' | 'budget_exhausted' | 'empty' | 'failed' | 'interrupted' | 'cancelled' | 'awaiting_tool_results';
|
|
633
|
+
truncated?: boolean;
|
|
634
|
+
rounds_used?: number;
|
|
635
|
+
prompt_tokens?: number;
|
|
636
|
+
completion_tokens?: number;
|
|
637
|
+
reasoning_tokens?: number;
|
|
638
|
+
elided_groups?: number;
|
|
639
|
+
reused_calls?: number;
|
|
640
|
+
}
|
|
576
641
|
interface StreamChunk {
|
|
642
|
+
/** Host-owned turn identity/context, retained on the rendered response. */
|
|
643
|
+
entryMetadata?: Record<string, unknown>;
|
|
644
|
+
completion?: AgentCompletion;
|
|
645
|
+
error?: string;
|
|
577
646
|
chunk?: string;
|
|
647
|
+
/** A tool step from an agentic loop. Present only on backends that run one;
|
|
648
|
+
* a chunk carrying a step has an empty `chunk`, so a consumer that ignores
|
|
649
|
+
* this field appends nothing and behaves exactly as before. */
|
|
650
|
+
step?: AgentToolStep;
|
|
578
651
|
thread_id?: string;
|
|
579
652
|
/** KG id (kgf.knowledge_graphs.id) this chunk belongs to. */
|
|
580
653
|
kg_id?: string;
|
|
@@ -821,6 +894,20 @@ interface BaseTerminalProps {
|
|
|
821
894
|
onReasoningModeChange?: (mode: ReasoningMode | null) => void;
|
|
822
895
|
onResolveWorkingGroup?: () => Promise<WorkingGroupContext | null>;
|
|
823
896
|
workingGroupContext?: WorkingGroupContext | null;
|
|
897
|
+
/**
|
|
898
|
+
* Show the "Working Group Scope" banner above the transcript.
|
|
899
|
+
* Defaults to `true`. See `TerminalShellProps` — the short version is
|
|
900
|
+
* that `workingGroupContext` both scopes the file tools and prints
|
|
901
|
+
* this strip, and a host may want the first without the second.
|
|
902
|
+
*/
|
|
903
|
+
showWorkingGroupBanner?: boolean;
|
|
904
|
+
/**
|
|
905
|
+
* Take keyboard focus when the composer mounts. Defaults to `true`.
|
|
906
|
+
* Set `false` when the terminal is one panel among several: focus
|
|
907
|
+
* raises the on-screen keyboard and takes the caret from whatever the
|
|
908
|
+
* reader was doing. See `TerminalInputBarProps.autoFocus`.
|
|
909
|
+
*/
|
|
910
|
+
autoFocusInput?: boolean;
|
|
824
911
|
onRagFileUpload?: (files: File[], context?: WorkingGroupContext | null) => Promise<FileUploadResult>;
|
|
825
912
|
onListRagFiles?: (context?: WorkingGroupContext | null) => Promise<ListRagFilesResult>;
|
|
826
913
|
onDeleteRagFile?: (documentId: string, context?: WorkingGroupContext | null) => Promise<RagFileActionResult>;
|
|
@@ -838,6 +925,14 @@ interface BaseTerminalProps {
|
|
|
838
925
|
ok: boolean;
|
|
839
926
|
message: string;
|
|
840
927
|
}>;
|
|
928
|
+
/** Capture a line of narration as a work item on the host's work
|
|
929
|
+
* record — the `/log` slash command. A PERSON's own capture is a
|
|
930
|
+
* direct create (no proposal); the host decides the scope (the
|
|
931
|
+
* active workspace). Returns a short message the terminal echoes. */
|
|
932
|
+
onSubmitLog?: (prose: string) => Promise<{
|
|
933
|
+
ok: boolean;
|
|
934
|
+
message: string;
|
|
935
|
+
}>;
|
|
841
936
|
/** Resolve a partial `@<query>` typed inside a slash command (e.g.
|
|
842
937
|
* `/note @wi`) to substrate entities. The terminal renders the
|
|
843
938
|
* results as a picker popover; selecting one replaces the query
|
|
@@ -875,11 +970,28 @@ interface BaseTerminalProps {
|
|
|
875
970
|
renderEntryExtra?: (entry: TerminalEntry, index: number) => React.ReactNode;
|
|
876
971
|
/** Full override for entry rendering. Return `null` to use default rendering. */
|
|
877
972
|
renderEntry?: (entry: TerminalEntry, index: number, defaultRender: () => React.ReactNode) => React.ReactNode;
|
|
973
|
+
/**
|
|
974
|
+
* Show the built-in "Processing…" row while a turn is in flight.
|
|
975
|
+
* Defaults to `true`.
|
|
976
|
+
*
|
|
977
|
+
* Turn it OFF when the host renders its own account of the work — an
|
|
978
|
+
* agentic loop that names the step in flight, say. The built-in row
|
|
979
|
+
* says only that something is happening and for how long, which beside
|
|
980
|
+
* a named step is a second clock with nothing to add, and hosts cannot
|
|
981
|
+
* suppress it otherwise: it is gated on `progressState`, which stays
|
|
982
|
+
* null for any backend that does not emit `progress` chunks, so for
|
|
983
|
+
* those it is not a fallback but a permanent fixture.
|
|
984
|
+
*/
|
|
985
|
+
showBusyIndicator?: boolean;
|
|
878
986
|
/** Custom widgets that render per-entry based on a match condition. */
|
|
879
987
|
widgets?: TerminalWidget[];
|
|
880
988
|
/** Slot-based injection points for persistent content around the terminal. */
|
|
881
989
|
slots?: TerminalSlots;
|
|
882
990
|
onSourcesActivate?: (sources: TerminalSource[], entry: TerminalEntry) => void;
|
|
991
|
+
/** Activate one cited source. When supplied, each source label becomes an
|
|
992
|
+
* independent control; `onSourcesActivate` remains available for consumers
|
|
993
|
+
* that treat the complete citation set as one action. */
|
|
994
|
+
onSourceActivate?: (source: TerminalSource, entry: TerminalEntry) => void;
|
|
883
995
|
/** Poll for new messages (e.g. agent push messages). Called every pollIntervalMs. */
|
|
884
996
|
onPollMessages?: (lastMessageId?: string) => Promise<TerminalEntry[]>;
|
|
885
997
|
/** Polling interval in ms. Default 3000. */
|
|
@@ -901,6 +1013,20 @@ interface BaseTerminalProps {
|
|
|
901
1013
|
}
|
|
902
1014
|
/** StandardTerminal — developer console with API endpoints and commands. */
|
|
903
1015
|
interface StandardTerminalProps extends BaseTerminalProps {
|
|
1016
|
+
/** Submit a complete question to this terminal only. IDs are consumed once;
|
|
1017
|
+
* a request arriving during another answer waits until that answer settles.
|
|
1018
|
+
* Does not replace the reader's draft or focus the mobile keyboard. */
|
|
1019
|
+
submitRequest?: {
|
|
1020
|
+
id: string;
|
|
1021
|
+
value: string;
|
|
1022
|
+
} | null;
|
|
1023
|
+
onSubmitRequest?: (id: string) => void;
|
|
1024
|
+
/** What the empty input invites, when the host has a name for its
|
|
1025
|
+
* agent. Defaults to the generic prompt, so a host that does not set
|
|
1026
|
+
* one is unchanged. A KG scope still overrides it — "Ask about X" is
|
|
1027
|
+
* about where the answer will come from, which outranks whose
|
|
1028
|
+
* assistant is asking. */
|
|
1029
|
+
inputPlaceholder?: string;
|
|
904
1030
|
onCommandExecute?: (command: string, endpoint?: ApiEndpoint, params?: Record<string, string>) => Promise<TerminalCommandResult>;
|
|
905
1031
|
authToken?: string;
|
|
906
1032
|
onAuthTokenChange?: (token: string) => void;
|
|
@@ -916,11 +1042,18 @@ interface ChatTerminalProps extends BaseTerminalProps {
|
|
|
916
1042
|
displayName: string;
|
|
917
1043
|
}>;
|
|
918
1044
|
onTyping?: () => void;
|
|
1045
|
+
/** Bearer JWT — forwarded to `/pipelines/:run_id/events` as
|
|
1046
|
+
* `?access_token=` for upload-progress streaming (the fetch SSE
|
|
1047
|
+
* wrapper can't set `Authorization` and the agents service enforces
|
|
1048
|
+
* auth on that endpoint). Without it, `onRagFileUpload` ingestions
|
|
1049
|
+
* still run server-side but live progress 401s silently. Same
|
|
1050
|
+
* contract as `StandardTerminalProps.authToken`. */
|
|
1051
|
+
authToken?: string;
|
|
919
1052
|
}
|
|
920
1053
|
|
|
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;
|
|
1054
|
+
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
1055
|
|
|
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;
|
|
1056
|
+
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
1057
|
|
|
925
1058
|
/**
|
|
926
1059
|
* CoreTerminal — routing facade for backward compatibility.
|
|
@@ -1007,11 +1140,30 @@ interface AgentAvatarProps {
|
|
|
1007
1140
|
}
|
|
1008
1141
|
declare const AgentAvatar: React.FC<AgentAvatarProps>;
|
|
1009
1142
|
|
|
1143
|
+
interface AgentStepTraceProps {
|
|
1144
|
+
steps: AgentToolStep[];
|
|
1145
|
+
/** True while the reply is still streaming. */
|
|
1146
|
+
working: boolean;
|
|
1147
|
+
}
|
|
1148
|
+
declare function AgentStepTrace({ steps, working }: AgentStepTraceProps): react_jsx_runtime.JSX.Element;
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* Ready-made `renderEntryExtra` for any terminal that wants the trace.
|
|
1152
|
+
*
|
|
1153
|
+
* Exported rather than re-written per surface: there are several chat surfaces
|
|
1154
|
+
* across several apps, and the first attempt wired only one of them. A shared
|
|
1155
|
+
* function makes adding the next one a single prop, and means the "is it still
|
|
1156
|
+
* working?" rule below has exactly one definition to be wrong in.
|
|
1157
|
+
*/
|
|
1158
|
+
declare function agentStepTraceExtra(entry: TerminalEntry): React.ReactNode;
|
|
1159
|
+
|
|
1010
1160
|
interface TerminalInputBarProps {
|
|
1011
1161
|
inputRef: React.RefObject<HTMLTextAreaElement>;
|
|
1012
1162
|
fileInputRef: React.RefObject<HTMLInputElement>;
|
|
1013
1163
|
currentCommand: string;
|
|
1014
1164
|
isExecuting: boolean;
|
|
1165
|
+
/** Prevent editing while a prerequisite is unavailable, without implying work is running. */
|
|
1166
|
+
disabled?: boolean;
|
|
1015
1167
|
placeholder?: string;
|
|
1016
1168
|
onInputChange: (value: string) => void;
|
|
1017
1169
|
onKeyDown: (e: React.KeyboardEvent) => void;
|
|
@@ -1043,8 +1195,22 @@ interface TerminalInputBarProps {
|
|
|
1043
1195
|
compactToolbar?: boolean;
|
|
1044
1196
|
/** Accessible label for the submit affordance. */
|
|
1045
1197
|
submitTitle?: string;
|
|
1198
|
+
/**
|
|
1199
|
+
* Take keyboard focus when the bar mounts. Defaults to `true`, which is
|
|
1200
|
+
* what a terminal that OWNS its page wants.
|
|
1201
|
+
*
|
|
1202
|
+
* Turn it off when the terminal is one panel among several. Focus is not
|
|
1203
|
+
* free: it opens the on-screen keyboard on a touch device, and a panel
|
|
1204
|
+
* that grabs the caret the moment it mounts takes it away from whatever
|
|
1205
|
+
* the reader was actually doing. An embedded consumer generally wants
|
|
1206
|
+
* the input ready but not seized — `false` here, and the reader taps it.
|
|
1207
|
+
*
|
|
1208
|
+
* The page-scroll that used to come with this is fixed for everyone
|
|
1209
|
+
* regardless of the setting; see the focus effect below.
|
|
1210
|
+
*/
|
|
1211
|
+
autoFocus?: boolean;
|
|
1046
1212
|
}
|
|
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;
|
|
1213
|
+
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
1214
|
|
|
1049
1215
|
interface SlashMentionCandidate {
|
|
1050
1216
|
entity_id: string;
|
|
@@ -1118,6 +1284,56 @@ declare function filterCommands(query: string, builtIn: TerminalCommand[], custo
|
|
|
1118
1284
|
*/
|
|
1119
1285
|
declare function processStreamLines(buffer: string, onJsonLine: (parsed: any) => void): string;
|
|
1120
1286
|
|
|
1287
|
+
/**
|
|
1288
|
+
* When a stream has gone quiet long enough to be dead.
|
|
1289
|
+
*
|
|
1290
|
+
* ## Why a reader cannot just wait
|
|
1291
|
+
*
|
|
1292
|
+
* A TCP connection can die LOUDLY — the browser reports a failed load and
|
|
1293
|
+
* `reader.read()` rejects — or SILENTLY: the peer goes away, no FIN or RST
|
|
1294
|
+
* is ever seen, and the read simply never settles. Nothing throws, so
|
|
1295
|
+
* nothing downstream recovers, and the reader watches a spinner while the
|
|
1296
|
+
* work is already finished on the server.
|
|
1297
|
+
*
|
|
1298
|
+
* That is observed behaviour, not theory: two identical severed
|
|
1299
|
+
* connections, one surfacing `ERR_INCOMPLETE_CHUNKED_ENCODING` and
|
|
1300
|
+
* recovering, the other hanging past a minute with the answer already
|
|
1301
|
+
* stored. Which one you get is up to the network, which is exactly why a
|
|
1302
|
+
* client cannot wait to be told.
|
|
1303
|
+
*
|
|
1304
|
+
* ## Why a timeout is safe here
|
|
1305
|
+
*
|
|
1306
|
+
* Every YieldFabric SSE endpoint keeps its stream alive — axum's
|
|
1307
|
+
* `KeepAlive::default()`, a `:\n\n` comment every fifteen seconds while
|
|
1308
|
+
* the stream is otherwise idle. So silence is a reliable death signal
|
|
1309
|
+
* rather than a guess about how long work should take: a slow answer
|
|
1310
|
+
* still ticks, only a dead connection goes quiet.
|
|
1311
|
+
*
|
|
1312
|
+
* NO IMPORTS, deliberately. This is consumed both by `handleSSEStream`
|
|
1313
|
+
* here and by hosts that read a stream themselves, and it is the piece
|
|
1314
|
+
* worth testing — a barrel import would drag React and an ESM markdown
|
|
1315
|
+
* renderer into a test that only needs arithmetic and a promise.
|
|
1316
|
+
*/
|
|
1317
|
+
/** How often a YieldFabric SSE endpoint sends a keep-alive comment. */
|
|
1318
|
+
declare const SSE_KEEPALIVE_MS = 15000;
|
|
1319
|
+
/**
|
|
1320
|
+
* Silence that means the connection is gone, whatever the OS thinks.
|
|
1321
|
+
*
|
|
1322
|
+
* Three missed keep-alives: long enough that a slow hop or a stalled
|
|
1323
|
+
* scheduler cannot trip it, short enough to be noticed while somebody is
|
|
1324
|
+
* still watching.
|
|
1325
|
+
*/
|
|
1326
|
+
declare const SSE_STALL_MS: number;
|
|
1327
|
+
/**
|
|
1328
|
+
* `work`, unless nothing has happened for `ms` — then a rejection.
|
|
1329
|
+
*
|
|
1330
|
+
* `sleep` is injected so the rule can be tested without waiting for a
|
|
1331
|
+
* real clock. The `done` flag matters: a stream delivers many chunks, and
|
|
1332
|
+
* a timer that fired after its read already landed would kill a healthy
|
|
1333
|
+
* connection.
|
|
1334
|
+
*/
|
|
1335
|
+
declare function withStallTimeout<T>(work: Promise<T>, ms?: number, sleep?: (ms: number) => Promise<void>): Promise<T>;
|
|
1336
|
+
|
|
1121
1337
|
/**
|
|
1122
1338
|
* Handles generic streaming JSON-line responses (non-SSE).
|
|
1123
1339
|
*/
|
|
@@ -1139,6 +1355,17 @@ declare const handleSSEStream: (url: string, body: any, onChunk: (chunk: any) =>
|
|
|
1139
1355
|
headers?: Record<string, string>;
|
|
1140
1356
|
signal?: AbortSignal;
|
|
1141
1357
|
onGone?: (reason: string) => void;
|
|
1358
|
+
/** Require an explicit answer terminal event. Defaults to true.
|
|
1359
|
+
* Set false only for non-answer protocols that intentionally end at EOF.
|
|
1360
|
+
*/
|
|
1361
|
+
requireFinal?: boolean;
|
|
1362
|
+
/**
|
|
1363
|
+
* Give up after this much silence. Defaults to `SSE_STALL_MS`, which
|
|
1364
|
+
* is safe for every YieldFabric endpoint because they all keep their
|
|
1365
|
+
* streams alive — see `streamStall`. Pass `0` to wait forever, which
|
|
1366
|
+
* is only right for a server that does NOT heartbeat.
|
|
1367
|
+
*/
|
|
1368
|
+
stallMs?: number;
|
|
1142
1369
|
}) => Promise<void>;
|
|
1143
1370
|
|
|
1144
1371
|
/**
|
|
@@ -2305,4 +2532,4 @@ declare const terminalClassNames: {
|
|
|
2305
2532
|
promptSymbol: string;
|
|
2306
2533
|
};
|
|
2307
2534
|
|
|
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 };
|
|
2535
|
+
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 };
|