@hydraharness/harness-client-ui-conversation 0.1.1-rc.6
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 +21 -0
- package/README.md +79 -0
- package/lib/client.js +11683 -0
- package/lib/index.js +28 -0
- package/lib/invariant.js +25 -0
- package/lib/types/client/apply.d.ts +16 -0
- package/lib/types/client/chat/ActivityGroup.d.ts +22 -0
- package/lib/types/client/chat/AssistantMarkdown.d.ts +20 -0
- package/lib/types/client/chat/AssistantNodeView.d.ts +4 -0
- package/lib/types/client/chat/ChatNodeSeat.d.ts +11 -0
- package/lib/types/client/chat/ChatView.d.ts +7 -0
- package/lib/types/client/chat/CommandNodeView.d.ts +9 -0
- package/lib/types/client/chat/CompactionCommandCard.d.ts +8 -0
- package/lib/types/client/chat/CompactionItem.d.ts +19 -0
- package/lib/types/client/chat/ContextBody.d.ts +130 -0
- package/lib/types/client/chat/ContextInjectionRow.d.ts +26 -0
- package/lib/types/client/chat/GenericCommandCard.d.ts +9 -0
- package/lib/types/client/chat/MessageIconActions.d.ts +44 -0
- package/lib/types/client/chat/MessageItem.d.ts +46 -0
- package/lib/types/client/chat/PromptVersionMenu.d.ts +21 -0
- package/lib/types/client/chat/ReasoningRow.d.ts +14 -0
- package/lib/types/client/chat/StatsLine.d.ts +87 -0
- package/lib/types/client/chat/TurnTailNodeView.d.ts +9 -0
- package/lib/types/client/chat/message-chrome.d.ts +49 -0
- package/lib/types/client/chat/register-node-renderers.d.ts +11 -0
- package/lib/types/client/chat/tool-node-reader.d.ts +16 -0
- package/lib/types/client/chat/turn-assistant.d.ts +8 -0
- package/lib/types/client/chat/turn-metrics.d.ts +38 -0
- package/lib/types/client/chat/use-calendar-day.d.ts +6 -0
- package/lib/types/client/chat/use-throttled-visual-update.d.ts +8 -0
- package/lib/types/client/chat/useVersionNavigation.d.ts +12 -0
- package/lib/types/client/chat/web-citations.d.ts +11 -0
- package/lib/types/client/contract/chat-nodes.d.ts +68 -0
- package/lib/types/client/contract/composer-submission.d.ts +8 -0
- package/lib/types/client/contract/prompt-edit.d.ts +6 -0
- package/lib/types/client/contract/queue.d.ts +9 -0
- package/lib/types/client/contract/slots.d.ts +819 -0
- package/lib/types/client/contract/views.d.ts +39 -0
- package/lib/types/client/conversation-nodes/assistant.d.ts +35 -0
- package/lib/types/client/conversation-nodes/chat-snapshot-builder.d.ts +29 -0
- package/lib/types/client/conversation-nodes/command.d.ts +54 -0
- package/lib/types/client/conversation-nodes/common.d.ts +40 -0
- package/lib/types/client/conversation-nodes/compaction.d.ts +21 -0
- package/lib/types/client/conversation-nodes/fallback.d.ts +16 -0
- package/lib/types/client/conversation-nodes/inbox.d.ts +21 -0
- package/lib/types/client/conversation-nodes/message.d.ts +30 -0
- package/lib/types/client/conversation-nodes/register.d.ts +7 -0
- package/lib/types/client/conversation-nodes/retry.d.ts +23 -0
- package/lib/types/client/conversation-nodes/tool.d.ts +25 -0
- package/lib/types/client/conversation-nodes/turn-error.d.ts +30 -0
- package/lib/types/client/conversation-nodes/turn-max-tokens.d.ts +22 -0
- package/lib/types/client/conversation-nodes/turn-tail.d.ts +28 -0
- package/lib/types/client/image-labels.d.ts +22 -0
- package/lib/types/client/index.d.ts +30 -0
- package/lib/types/client/input/blocks.d.ts +57 -0
- package/lib/types/client/input/contract.d.ts +340 -0
- package/lib/types/client/input/decorations.d.ts +71 -0
- package/lib/types/client/input/facade.d.ts +261 -0
- package/lib/types/client/input/hub.d.ts +88 -0
- package/lib/types/client/input/machine.d.ts +135 -0
- package/lib/types/client/input/submission-policy.d.ts +46 -0
- package/lib/types/client/locales.d.ts +242 -0
- package/lib/types/client/queue/QueueDock.d.ts +29 -0
- package/lib/types/client/queue/store.d.ts +19 -0
- package/lib/types/client/reference/ReferenceIcon.d.ts +16 -0
- package/lib/types/client/service.d.ts +220 -0
- package/lib/types/client/settings/EnterBehaviorRow.d.ts +21 -0
- package/lib/types/client/settings/UsageSection.d.ts +21 -0
- package/lib/types/client/skeleton/ApprovalPanel.d.ts +13 -0
- package/lib/types/client/skeleton/ContextMeter.d.ts +14 -0
- package/lib/types/client/skeleton/ConversationRoot.d.ts +5 -0
- package/lib/types/client/skeleton/ConversationSession.d.ts +20 -0
- package/lib/types/client/skeleton/DetailsPanel.d.ts +5 -0
- package/lib/types/client/skeleton/EmptyHero.d.ts +58 -0
- package/lib/types/client/skeleton/InputBar.d.ts +11 -0
- package/lib/types/client/skeleton/PermissionSelect.d.ts +11 -0
- package/lib/types/client/skeleton/TodoPanel.d.ts +28 -0
- package/lib/types/client/skeleton/safari.d.ts +18 -0
- package/lib/types/client/stores.d.ts +22 -0
- package/lib/types/index.d.ts +9 -0
- package/lib/types/invariant.d.ts +16 -0
- package/lib/types/submission-settings.d.ts +20 -0
- package/package.json +121 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Context } from '@hydraharness/cordis';
|
|
2
|
+
import type { SessionId, UserMessageNode } from '@hydraharness/harness-client-runtime/client';
|
|
3
|
+
import type { PromptEditOptions } from '../contract/prompt-edit.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Register this package's business renderers behind the keyed Chat Node seat.
|
|
6
|
+
* @param ctx - owning UI Conversation context.
|
|
7
|
+
* @param editMessage - replaces a turn with a new prompt revision and response.
|
|
8
|
+
* @param retryRevision - retries the current failed attempt, keeping its user revision identity.
|
|
9
|
+
*/
|
|
10
|
+
export declare function registerChatNodeRenderers(ctx: Context, editMessage: (sessionId: SessionId, node: UserMessageNode, text: string, options: PromptEditOptions) => Promise<void>, retryRevision: (sessionId: SessionId, idempotencyKey: string) => Promise<void>): void;
|
|
11
|
+
//# sourceMappingURL=register-node-renderers.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ConversationSnapshot, ToolCallBlock } from '@hydraharness/harness-client-runtime/client';
|
|
2
|
+
/**
|
|
3
|
+
* Read one root Tool lifecycle through the internal Chat Node index.
|
|
4
|
+
* @param snapshot - current Conversation snapshot.
|
|
5
|
+
* @param rootCallId - root call identity and Tool Context identity.
|
|
6
|
+
* @returns root lifecycle when it is materialized in the current window.
|
|
7
|
+
*/
|
|
8
|
+
export declare function rootToolCall(snapshot: ConversationSnapshot, rootCallId: string): ToolCallBlock | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Find any root or nested Tool lifecycle through the internal Node store.
|
|
11
|
+
* @param snapshot - current Conversation snapshot.
|
|
12
|
+
* @param callId - root or nested call identity.
|
|
13
|
+
* @returns current Tool lifecycle when materialized in the loaded window.
|
|
14
|
+
*/
|
|
15
|
+
export declare function findToolCall(snapshot: ConversationSnapshot, callId: string): ToolCallBlock | undefined;
|
|
16
|
+
//# sourceMappingURL=tool-node-reader.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AssistantBlock } from '@hydraharness/harness-client-runtime/client';
|
|
2
|
+
/**
|
|
3
|
+
* Collect visible prose from one Assistant lifecycle.
|
|
4
|
+
* @param blocks - Assistant content blocks.
|
|
5
|
+
* @returns concatenated text blocks.
|
|
6
|
+
*/
|
|
7
|
+
export declare function assistantText(blocks: readonly AssistantBlock[]): string;
|
|
8
|
+
//# sourceMappingURL=turn-assistant.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AssistantMessageNode, ConversationNode } from '@hydraharness/harness-client-runtime/client';
|
|
2
|
+
/** Latency and decode-throughput readings for one turn's footer. */
|
|
3
|
+
export interface TurnMetrics {
|
|
4
|
+
/** First-step TTFT in ms; absent when that step carries no recorded timing. */
|
|
5
|
+
ttftMs?: number;
|
|
6
|
+
/** Decode throughput over steps carrying both timing and provider usage. */
|
|
7
|
+
tokensPerSecond?: number;
|
|
8
|
+
}
|
|
9
|
+
/** One assistant step's derivable latency facts; null marks an unrecorded part. */
|
|
10
|
+
export interface StepReading {
|
|
11
|
+
/** step/start → first token delta, in ms. */
|
|
12
|
+
ttftMs: number | null;
|
|
13
|
+
/** First token delta → final message, in ms. */
|
|
14
|
+
decodeMs: number | null;
|
|
15
|
+
/** Provider-reported completion tokens. */
|
|
16
|
+
outputTokens: number | null;
|
|
17
|
+
}
|
|
18
|
+
type AssistantNode = AssistantMessageNode;
|
|
19
|
+
/**
|
|
20
|
+
* Read one assistant node's TTFT, decode wall time, and output tokens.
|
|
21
|
+
* @param node - A settled assistant node.
|
|
22
|
+
* @returns Per-part readings with `null` for unrecorded values.
|
|
23
|
+
*/
|
|
24
|
+
export declare function assistantStepReading(node: AssistantNode): StepReading;
|
|
25
|
+
/**
|
|
26
|
+
* Fold assistant nodes into per-turn footer metrics.
|
|
27
|
+
*
|
|
28
|
+
* TTFT is the turn's lowest-step request-dispatch-to-first-token reading, so
|
|
29
|
+
* it is only meaningful when the turn's start is inside
|
|
30
|
+
* the loaded window (the caller gates on `turnTimings`, which shares that
|
|
31
|
+
* window). Throughput divides summed output tokens by summed decode wall time,
|
|
32
|
+
* counting only steps that carry both.
|
|
33
|
+
* @param nodes - Snapshot nodes of the loaded window.
|
|
34
|
+
* @returns Turn number → available metrics; turns with none are absent.
|
|
35
|
+
*/
|
|
36
|
+
export declare function deriveTurnMetrics(nodes: readonly ConversationNode[]): Map<number, TurnMetrics>;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=turn-metrics.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return a stable scheduler that coalesces visual updates over a frame interval.
|
|
3
|
+
* @param update - DOM alignment to run after the throttle interval.
|
|
4
|
+
* @param intervalFrames - frames to wait before applying the latest alignment.
|
|
5
|
+
* @returns a stable function that schedules the latest update.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useThrottledVisualUpdate(update: () => void, intervalFrames?: number): () => void;
|
|
8
|
+
//# sourceMappingURL=use-throttled-visual-update.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SessionId, SessionVersionId } from '@hydraharness/harness-session/types';
|
|
2
|
+
/**
|
|
3
|
+
* Serialize navigation from one version pager and preserve failures for its live region.
|
|
4
|
+
* @param open - Host-backed transcript selection.
|
|
5
|
+
* @returns Navigation callback, pending state, and the latest failure.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useVersionNavigation(open: (id: SessionId | SessionVersionId) => void | Promise<void>): {
|
|
8
|
+
pending: boolean;
|
|
9
|
+
error: string | null;
|
|
10
|
+
navigate(id: SessionId | SessionVersionId): Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useVersionNavigation.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Citation evidence is derived from successful, preceding fetch results in the loaded transcript. */
|
|
2
|
+
import type { ConversationNode } from '@hydraharness/harness-client-runtime/client';
|
|
3
|
+
import type { MarkdownCitations } from '@hydraharness/harness-client-ui-primitives';
|
|
4
|
+
/**
|
|
5
|
+
* Index source versions without a separate evidence database, including Code Mode subcalls.
|
|
6
|
+
* @param nodes - loaded session transcript; missing historical sources remain unresolved.
|
|
7
|
+
* @param beforeSeq - assistant message position, excluding sources retrieved later.
|
|
8
|
+
* @returns resolver accepting only exact nonempty quotes from successful recorded fetches.
|
|
9
|
+
*/
|
|
10
|
+
export declare function webCitations(nodes: readonly ConversationNode[], beforeSeq: number): MarkdownCitations;
|
|
11
|
+
//# sourceMappingURL=web-citations.d.ts.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { AssistantBlock, AssistantMessageNode, ChatConversationViewNode, CommandNode, CompactionSummaryNode, ModelRetryNode, RunningToolCall, ToolCallBlock } from '@hydraharness/harness-client-runtime/client';
|
|
2
|
+
/** Merge-extensible payload registry keyed by final Chat renderer kind. */
|
|
3
|
+
export interface ChatNodeDataMap {
|
|
4
|
+
}
|
|
5
|
+
/** Renderer kinds contributed by the currently installed Chat business modules. */
|
|
6
|
+
export type ChatNodeKind = Extract<keyof ChatNodeDataMap, string>;
|
|
7
|
+
/** Final Chat Node narrowed to one registered renderer kind and payload. */
|
|
8
|
+
export type ChatNode<Kind extends ChatNodeKind = ChatNodeKind> = {
|
|
9
|
+
[RegisteredKind in Kind]: ChatConversationViewNode & {
|
|
10
|
+
readonly kind: RegisteredKind;
|
|
11
|
+
readonly data: ChatNodeDataMap[RegisteredKind];
|
|
12
|
+
};
|
|
13
|
+
}[Kind];
|
|
14
|
+
/** Final Assistant row payload shared by streaming and settled states. */
|
|
15
|
+
export interface AssistantChatData {
|
|
16
|
+
readonly status: 'running' | 'settled' | 'interrupted';
|
|
17
|
+
readonly turn: number;
|
|
18
|
+
readonly step: number;
|
|
19
|
+
readonly blocks: readonly AssistantBlock[];
|
|
20
|
+
readonly time: number;
|
|
21
|
+
readonly usage?: unknown;
|
|
22
|
+
readonly finalNode?: AssistantMessageNode;
|
|
23
|
+
}
|
|
24
|
+
/** Settled or interrupted Assistant payload with its durable presentation node. */
|
|
25
|
+
export type FinalAssistantChatData = AssistantChatData & {
|
|
26
|
+
readonly finalNode: AssistantMessageNode;
|
|
27
|
+
};
|
|
28
|
+
/** Root Tool row payload; the root lifecycle owns all recursive subcalls. */
|
|
29
|
+
export interface ToolChatData {
|
|
30
|
+
readonly root: ToolCallBlock;
|
|
31
|
+
}
|
|
32
|
+
/** One manual command and its correlated compaction transaction. */
|
|
33
|
+
export interface ManualCompactionChatData {
|
|
34
|
+
readonly command: CommandNode;
|
|
35
|
+
readonly compaction: CompactionSummaryNode | null;
|
|
36
|
+
}
|
|
37
|
+
/** One durable retry chain rendered as a single row. */
|
|
38
|
+
export interface RetryChatData {
|
|
39
|
+
readonly attempts: readonly ModelRetryNode[];
|
|
40
|
+
readonly current: ModelRetryNode;
|
|
41
|
+
}
|
|
42
|
+
/** Turn-local footer row that owns actions and optional feature contributions. */
|
|
43
|
+
export interface TurnTailChatData {
|
|
44
|
+
readonly turn: number;
|
|
45
|
+
readonly seq: number;
|
|
46
|
+
readonly time: number;
|
|
47
|
+
/** Last finalized content-bearing Assistant in this Turn. */
|
|
48
|
+
readonly closing: FinalAssistantChatData | null;
|
|
49
|
+
/** Whether non-rendered later evidence makes the closing seq non-tail. */
|
|
50
|
+
readonly branchUnavailable: boolean;
|
|
51
|
+
readonly ttftMs?: number;
|
|
52
|
+
readonly tokensPerSecond?: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Test whether a Tool root has settled.
|
|
56
|
+
* @param block - Tool root lifecycle value.
|
|
57
|
+
* @returns whether the root carries its final result.
|
|
58
|
+
*/
|
|
59
|
+
export declare function isSettledTool(block: ToolCallBlock): block is Extract<ToolCallBlock, {
|
|
60
|
+
kind: 'tool-result';
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* Test whether a Tool root is still running.
|
|
64
|
+
* @param block - Tool root lifecycle value.
|
|
65
|
+
* @returns whether the root lacks a final result.
|
|
66
|
+
*/
|
|
67
|
+
export declare function isRunningTool(block: ToolCallBlock): block is RunningToolCall;
|
|
68
|
+
//# sourceMappingURL=chat-nodes.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Composer submission vocabulary shared by the input and settings domains. */
|
|
2
|
+
import type { BusyEnterBehavior } from '../../submission-settings.ts';
|
|
3
|
+
export type { BusyEnterBehavior } from '../../submission-settings.ts';
|
|
4
|
+
/** Delivery mode requested for one ordinary composer message. */
|
|
5
|
+
export type InputSubmitMode = BusyEnterBehavior;
|
|
6
|
+
/** Keyboard gesture whose delivery mode the submission policy resolves. */
|
|
7
|
+
export type ComposerSubmitGesture = 'enter' | 'accelerated';
|
|
8
|
+
//# sourceMappingURL=composer-submission.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Browser-owned text edit admission; attachments remain unchanged. */
|
|
2
|
+
/** Exact draft sent by the inline editor; the key survives retry while its contents stay unchanged. */
|
|
3
|
+
export interface PromptEditOptions {
|
|
4
|
+
idempotencyKey: string;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=prompt-edit.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Queue contracts derived from the runtime session face and snapshot. */
|
|
2
|
+
import type { ConversationSnapshot, SessionFace } from '@hydraharness/harness-client-runtime/client';
|
|
3
|
+
/** One address accepted by the runtime session's queue mutation verb. */
|
|
4
|
+
export type QueueItemId = Parameters<SessionFace['updateQueue']>[0];
|
|
5
|
+
/** One mutation accepted by the runtime session's queue mutation verb. */
|
|
6
|
+
export type QueueAction = Parameters<SessionFace['updateQueue']>[1];
|
|
7
|
+
/** One row projected by the runtime session's authoritative queue snapshot. */
|
|
8
|
+
export type QueueRow = ConversationSnapshot['queue'][number];
|
|
9
|
+
//# sourceMappingURL=queue.d.ts.map
|