@prettier-ai/dsh-client-ui-chat 0.1.2-alpha.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 +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +69 -0
- package/README.zh.md +69 -0
- package/lib/client.js +7588 -0
- package/lib/index.js +25 -0
- package/lib/invariant.js +16 -0
- package/lib/types/chat-settings.d.ts +20 -0
- package/lib/types/client/apply.d.ts +10 -0
- package/lib/types/client/chat/ApprovalCommand.d.ts +20 -0
- package/lib/types/client/chat/AssistantMarkdown.d.ts +22 -0
- package/lib/types/client/chat/AssistantNodeView.d.ts +4 -0
- package/lib/types/client/chat/ChatNodeSeat.d.ts +15 -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 +131 -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 +36 -0
- package/lib/types/client/chat/MessageItem.d.ts +42 -0
- package/lib/types/client/chat/ReasoningRow.d.ts +14 -0
- package/lib/types/client/chat/StatsLine.d.ts +64 -0
- package/lib/types/client/chat/SystemPromptRow.d.ts +19 -0
- package/lib/types/client/chat/TurnNavigator.d.ts +21 -0
- package/lib/types/client/chat/TurnProcessNodeView.d.ts +4 -0
- package/lib/types/client/chat/TurnTailNodeView.d.ts +7 -0
- package/lib/types/client/chat/TurnUsageDisclosure.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 +7 -0
- package/lib/types/client/chat/searchable-hidden.d.ts +9 -0
- package/lib/types/client/chat/token-format.d.ts +25 -0
- package/lib/types/client/chat/turn-assistant.d.ts +8 -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/contract/assistant-content.d.ts +9 -0
- package/lib/types/client/contract/chat-nodes.d.ts +110 -0
- package/lib/types/client/contract/slots.d.ts +195 -0
- package/lib/types/client/contract/snapshot.d.ts +65 -0
- package/lib/types/client/contract/store.d.ts +22 -0
- package/lib/types/client/contract/turn-metrics.d.ts +38 -0
- package/lib/types/client/contract/turn-process.d.ts +48 -0
- package/lib/types/client/conversation-nodes/assistant.d.ts +37 -0
- package/lib/types/client/conversation-nodes/chat-snapshot-builder.d.ts +42 -0
- package/lib/types/client/conversation-nodes/command.d.ts +54 -0
- package/lib/types/client/conversation-nodes/common.d.ts +41 -0
- package/lib/types/client/conversation-nodes/compaction.d.ts +22 -0
- package/lib/types/client/conversation-nodes/event-projection.d.ts +57 -0
- package/lib/types/client/conversation-nodes/fallback.d.ts +17 -0
- package/lib/types/client/conversation-nodes/inbox.d.ts +21 -0
- package/lib/types/client/conversation-nodes/message.d.ts +31 -0
- package/lib/types/client/conversation-nodes/partial.d.ts +34 -0
- package/lib/types/client/conversation-nodes/register.d.ts +7 -0
- package/lib/types/client/conversation-nodes/request-prompt.d.ts +30 -0
- package/lib/types/client/conversation-nodes/retry.d.ts +23 -0
- package/lib/types/client/conversation-nodes/tool.d.ts +23 -0
- package/lib/types/client/conversation-nodes/turn-error.d.ts +31 -0
- package/lib/types/client/conversation-nodes/turn-max-tokens.d.ts +23 -0
- package/lib/types/client/conversation-nodes/turn-navigation.d.ts +17 -0
- package/lib/types/client/conversation-nodes/turn-process.d.ts +32 -0
- package/lib/types/client/conversation-nodes/turn-tail.d.ts +28 -0
- package/lib/types/client/details/DetailsPanel.d.ts +4 -0
- package/lib/types/client/details/tool-node-reader.d.ts +9 -0
- package/lib/types/client/index.d.ts +36 -0
- package/lib/types/client/locale.d.ts +224 -0
- package/lib/types/client/markdown-labels.d.ts +10 -0
- package/lib/types/client/model/conversation-context.d.ts +22 -0
- package/lib/types/client/model/steering-history.d.ts +23 -0
- package/lib/types/client/model/tool-call-tree.d.ts +45 -0
- package/lib/types/client/settings/TranscriptViewRow.d.ts +22 -0
- package/lib/types/client/stores.d.ts +22 -0
- package/lib/types/client/transcript-view.d.ts +22 -0
- package/lib/types/index.d.ts +6 -0
- package/lib/types/invariant.d.ts +13 -0
- package/package.json +121 -0
package/lib/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { settingsNamespace } from "@prettier-ai/dsh-settings";
|
|
2
|
+
import z from "@prettier-ai/schemastery";
|
|
3
|
+
//#region lib/types/chat-settings.js
|
|
4
|
+
/** Chat transcript preferences stored in the Host user-settings document. */
|
|
5
|
+
/** Settings namespace owned by the Chat target. */
|
|
6
|
+
const CHAT_SETTINGS_NAMESPACE = "ui-chat";
|
|
7
|
+
/** Field carrying the completed-Turn transcript presentation mode. */
|
|
8
|
+
const TRANSCRIPT_VIEW_FIELD = "transcriptView";
|
|
9
|
+
/** Transcript presentation modes accepted at settings boundaries. */
|
|
10
|
+
const TRANSCRIPT_VIEW_MODES = ["normal", "compact"];
|
|
11
|
+
/** Default preserves the compact process disclosure introduced by Chat. */
|
|
12
|
+
const DEFAULT_TRANSCRIPT_VIEW_MODE = "compact";
|
|
13
|
+
/** Durable Chat schema; also the wire envelope the browser scope validates against. */
|
|
14
|
+
const ChatSettingsSchema = z.object({ [TRANSCRIPT_VIEW_FIELD]: z.union([...TRANSCRIPT_VIEW_MODES]).default(DEFAULT_TRANSCRIPT_VIEW_MODE) });
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region lib/types/index.js
|
|
17
|
+
/** Host registration for browser Chat preferences. */
|
|
18
|
+
/** Register the durable Chat settings section when a provider exists. */
|
|
19
|
+
function apply(ctx) {
|
|
20
|
+
ctx.inject(["settings"], (settingsCtx) => {
|
|
21
|
+
settingsCtx.settings.register(settingsNamespace(CHAT_SETTINGS_NAMESPACE), ChatSettingsSchema);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { CHAT_SETTINGS_NAMESPACE, DEFAULT_TRANSCRIPT_VIEW_MODE, TRANSCRIPT_VIEW_FIELD, TRANSCRIPT_VIEW_MODES, apply };
|
package/lib/invariant.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region lib/types/invariant.js
|
|
2
|
+
const PACKAGE_NAME = "@prettier-ai/dsh-client-ui-chat";
|
|
3
|
+
/** Cordis companion plugin name. */
|
|
4
|
+
const name = "client-ui-chat-invariant";
|
|
5
|
+
/** Service required before the companion reserves package ownership. */
|
|
6
|
+
const inject = ["invariants"];
|
|
7
|
+
/** No runtime invariant: Conversation and Slot registration enforce Chat target consistency. */
|
|
8
|
+
const install = () => {};
|
|
9
|
+
/**
|
|
10
|
+
* Register this package's invariant companion.
|
|
11
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
12
|
+
* @returns the installed registration's disposer.
|
|
13
|
+
*/
|
|
14
|
+
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
15
|
+
//#endregion
|
|
16
|
+
export { apply, inject, name };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Chat transcript preferences stored in the Host user-settings document. */
|
|
2
|
+
import z from '@prettier-ai/schemastery';
|
|
3
|
+
/** Settings namespace owned by the Chat target. */
|
|
4
|
+
export declare const CHAT_SETTINGS_NAMESPACE = "ui-chat";
|
|
5
|
+
/** Field carrying the completed-Turn transcript presentation mode. */
|
|
6
|
+
export declare const TRANSCRIPT_VIEW_FIELD = "transcriptView";
|
|
7
|
+
/** Transcript presentation modes accepted at settings boundaries. */
|
|
8
|
+
export declare const TRANSCRIPT_VIEW_MODES: readonly ["normal", "compact"];
|
|
9
|
+
/** Completed-Turn transcript presentation. */
|
|
10
|
+
export type TranscriptViewMode = typeof TRANSCRIPT_VIEW_MODES[number];
|
|
11
|
+
/** Default preserves the compact process disclosure introduced by Chat. */
|
|
12
|
+
export declare const DEFAULT_TRANSCRIPT_VIEW_MODE: TranscriptViewMode;
|
|
13
|
+
/** Durable Chat section shared by the Host schema and browser scope. */
|
|
14
|
+
export interface ChatSettings {
|
|
15
|
+
/** Presentation mode for completed Turn process content. */
|
|
16
|
+
transcriptView: TranscriptViewMode;
|
|
17
|
+
}
|
|
18
|
+
/** Durable Chat schema; also the wire envelope the browser scope validates against. */
|
|
19
|
+
export declare const ChatSettingsSchema: z<ChatSettings>;
|
|
20
|
+
//# sourceMappingURL=chat-settings.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Register the Chat Conversation target, renderers, stats, and details surface. */
|
|
2
|
+
import type { Context } from '@prettier-ai/cordis';
|
|
3
|
+
/** Services required by the Chat target and its presentation registrations. */
|
|
4
|
+
export declare const inject: string[];
|
|
5
|
+
/**
|
|
6
|
+
* Mount all Chat-owned contributions.
|
|
7
|
+
* @param ctx - Client root context.
|
|
8
|
+
*/
|
|
9
|
+
export declare function apply(ctx: Context): void;
|
|
10
|
+
//# sourceMappingURL=apply.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Chat-owned approval detail resolving a correlated Tool call's command. */
|
|
2
|
+
import type { PropsRuntime } from '@prettier-ai/dsh-client-ui-slots';
|
|
3
|
+
interface ApprovalToolCall {
|
|
4
|
+
readonly callId: string;
|
|
5
|
+
readonly argsRaw: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Extract a shell command from a correlated Tool call when its arguments carry one.
|
|
9
|
+
* @param call - Tool call arguments, when a correlated call exists.
|
|
10
|
+
* @returns command text, or undefined for absent, malformed, or unrelated arguments.
|
|
11
|
+
*/
|
|
12
|
+
export declare function commandOf(call: ApprovalToolCall | undefined): string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Render the command of the Chat Tool node correlated with an approval.
|
|
15
|
+
* @param props - Approval identity and Session-standard Chat selector hook.
|
|
16
|
+
* @returns command text when the correlated call carries one.
|
|
17
|
+
*/
|
|
18
|
+
export declare function ApprovalCommand({ callId, useChat }: PropsRuntime<'conversation.approval.detail'>): string | null;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=ApprovalCommand.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { MarkdownFileMentions } from '@prettier-ai/dsh-client-ui-primitives';
|
|
2
|
+
import type { ChatNodeOwnerProps, ChatViewSlotProps } from '../contract/slots.ts';
|
|
3
|
+
import type { AssistantBlock } from '../contract/snapshot.ts';
|
|
4
|
+
export interface AssistantMarkdownProps {
|
|
5
|
+
blocks: readonly AssistantBlock[];
|
|
6
|
+
streaming: boolean;
|
|
7
|
+
/** Frozen partial of an aborted turn: rendered with a stopped marker. */
|
|
8
|
+
interrupted?: boolean | undefined;
|
|
9
|
+
/** Render consecutive image blocks through the attachment slot. */
|
|
10
|
+
renderMessageImages: ChatNodeOwnerProps['renderMessageImages'];
|
|
11
|
+
/** Hide reasoning that belongs to the Turn-level process disclosure. */
|
|
12
|
+
reasoningHidden?: boolean | undefined;
|
|
13
|
+
/** Reveal the owning Turn-level process disclosure. */
|
|
14
|
+
revealProcess?: (() => void) | undefined;
|
|
15
|
+
/** Resolved prose file mentions for this Assistant's closing turn. */
|
|
16
|
+
mentions?: MarkdownFileMentions | undefined;
|
|
17
|
+
/** The owning view's locale seat, passed down as a plain prop. */
|
|
18
|
+
t: ChatViewSlotProps['t'];
|
|
19
|
+
}
|
|
20
|
+
/** Reasoning block as the Think variant summary row (figma 39:28304). */
|
|
21
|
+
export declare const AssistantMarkdown: import("react").MemoExoticComponent<({ blocks, streaming, interrupted, renderMessageImages, reasoningHidden, revealProcess, mentions, t, }: AssistantMarkdownProps) => import("react").JSX.Element | null>;
|
|
22
|
+
//# sourceMappingURL=AssistantMarkdown.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ChatNodeViewProps } from '../contract/slots.ts';
|
|
2
|
+
/** Streaming, settled, and interrupted Assistant states share one keyed renderer instance. */
|
|
3
|
+
export declare const AssistantNodeView: import("react").MemoExoticComponent<({ node, useTurnData, turnProcess, openFile, renderMessageImages, fileMentions, t, }: ChatNodeViewProps<"assistant-step">) => import("react").JSX.Element>;
|
|
4
|
+
//# sourceMappingURL=AssistantNodeView.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ChatNodeOwnerProps, ChatViewSlotProps } from '../contract/slots.ts';
|
|
2
|
+
interface ChatNodeSeatProps extends ChatNodeOwnerProps {
|
|
3
|
+
readonly nodeKey: string;
|
|
4
|
+
readonly historyIncomplete: boolean;
|
|
5
|
+
readonly compactTranscript: boolean;
|
|
6
|
+
readonly useChat: ChatViewSlotProps['useChat'];
|
|
7
|
+
readonly useStore: ChatViewSlotProps['useStore'];
|
|
8
|
+
readonly actions: ChatViewSlotProps['actions'];
|
|
9
|
+
readonly renderSlot: ChatViewSlotProps['renderSlot'];
|
|
10
|
+
readonly t: ChatViewSlotProps['t'];
|
|
11
|
+
}
|
|
12
|
+
/** Subscribe, apply Turn-process visibility, and dispatch one stable Context key. */
|
|
13
|
+
export declare const ChatNodeSeat: import("react").MemoExoticComponent<({ nodeKey, historyIncomplete, compactTranscript, selectedCallId, cwd, openFile, inspectCall, forkAt, renderMessageImages, fileMentions, useChat, useStore, actions, renderSlot, t, }: ChatNodeSeatProps) => import("react").JSX.Element | null>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=ChatNodeSeat.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ChatViewSlotProps } from '../contract/slots.ts';
|
|
2
|
+
/**
|
|
3
|
+
* The chat view slot entry: pure component over the composed props; each
|
|
4
|
+
* ordered business Node crosses the keyed renderer seat.
|
|
5
|
+
*/
|
|
6
|
+
export declare function ChatView({ useSession, useChat, useSessions, useStore, actions, renderSlot, sessionId, openFile, loadOlder, loadImage, openView, chatScroll, forkAt, fileMentions, useTranscriptView, t, }: ChatViewSlotProps): import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=ChatView.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PropsRenderSlots } from '@prettier-ai/dsh-client-ui-slots';
|
|
2
|
+
import type { ChatNodeViewProps } from '../contract/slots.ts';
|
|
3
|
+
type CommandNodeViewProps = ChatNodeViewProps<'command'> & PropsRenderSlots<'conversation.chat.commandview'>;
|
|
4
|
+
/** Ordinary command lifecycle renderer with command-name keyed specialization. */
|
|
5
|
+
export declare const CommandNodeView: import("react").MemoExoticComponent<({ node, renderSlot, t }: CommandNodeViewProps) => import("react").JSX.Element>;
|
|
6
|
+
/** One integrated `/compact` command and compaction transaction renderer. */
|
|
7
|
+
export declare const ManualCompactionNodeView: import("react").MemoExoticComponent<({ node, t, }: ChatNodeViewProps<"manual-compaction">) => import("react").JSX.Element>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=CommandNodeView.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ChatViewSlotProps, CommandRowOwnerProps } from '../contract/slots.ts';
|
|
2
|
+
interface CompactionCommandCardProps extends CommandRowOwnerProps {
|
|
3
|
+
t: ChatViewSlotProps['t'];
|
|
4
|
+
}
|
|
5
|
+
/** Render one manual compaction lifecycle without duplicating its checkpoint marker. */
|
|
6
|
+
export declare function CompactionCommandCard({ node, compaction, t }: CompactionCommandCardProps): import("react").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=CompactionCommandCard.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ChatViewSlotProps } from '../contract/slots.ts';
|
|
2
|
+
import type { CompactionSummaryNode } from '../contract/snapshot.ts';
|
|
3
|
+
interface CompactionItemProps {
|
|
4
|
+
node: CompactionSummaryNode;
|
|
5
|
+
/** Optional command title for a manual compaction folded into this marker. */
|
|
6
|
+
title?: string;
|
|
7
|
+
/** Command settlement text used when structured compaction counts are unavailable. */
|
|
8
|
+
fallbackSummary?: string | null;
|
|
9
|
+
/** The owning view's locale seat. */
|
|
10
|
+
t: ChatViewSlotProps['t'];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Renders the model-history compaction marker.
|
|
14
|
+
* @param props - the marker node off the snapshot cache.
|
|
15
|
+
* @returns the marker row, with the summary disclosure when one is available.
|
|
16
|
+
*/
|
|
17
|
+
export declare const CompactionItem: import("react").MemoExoticComponent<({ node, title, fallbackSummary, t, }: CompactionItemProps) => import("react").JSX.Element>;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=CompactionItem.d.ts.map
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ChatViewSlotProps } from '../contract/slots.ts';
|
|
3
|
+
import type { ContextMessageNode } from '../contract/snapshot.ts';
|
|
4
|
+
import type { KnownContextForm } from '@prettier-ai/dsh-client-ui-conversation/client';
|
|
5
|
+
type Translate = ChatViewSlotProps['t'];
|
|
6
|
+
/**
|
|
7
|
+
* Default presentation: the model-facing text as text, with its real line
|
|
8
|
+
* breaks, and the remaining source fields beneath it. This is what every form
|
|
9
|
+
* this UI version does not recognize renders as.
|
|
10
|
+
* @param props - Durable content, its source, and the locale seat.
|
|
11
|
+
* @returns The opaque context body.
|
|
12
|
+
*/
|
|
13
|
+
export declare function OpaqueBody({ content, source, t }: {
|
|
14
|
+
content: ContextMessageNode['content'];
|
|
15
|
+
source: unknown;
|
|
16
|
+
t: Translate;
|
|
17
|
+
}): ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* `instructions` form: the files this context reconciled, then their text.
|
|
20
|
+
*
|
|
21
|
+
* The text keeps its `<system-reminder>` framing verbatim — the framing is part
|
|
22
|
+
* of what the model read, so hiding it would misreport the request.
|
|
23
|
+
* @param props - Durable content, its source, and the locale seat.
|
|
24
|
+
* @returns The instructions context body, or the opaque body when the change
|
|
25
|
+
* list is unreadable.
|
|
26
|
+
*/
|
|
27
|
+
export declare function InstructionsBody({ content, source, t }: {
|
|
28
|
+
content: ContextMessageNode['content'];
|
|
29
|
+
source: unknown;
|
|
30
|
+
t: Translate;
|
|
31
|
+
}): ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* `catalog` form: the published entries as a list, read from the source rather
|
|
34
|
+
* than re-parsed out of the model-facing prose.
|
|
35
|
+
*
|
|
36
|
+
* A catalog whose source carries no usable entries falls through to the opaque
|
|
37
|
+
* body, so an older or hand-edited log still shows its text.
|
|
38
|
+
* @param props - Durable content, its source, and the locale seat.
|
|
39
|
+
* @returns The catalog context body, or the opaque body when the entry list is
|
|
40
|
+
* unreadable.
|
|
41
|
+
*/
|
|
42
|
+
export declare function CatalogBody({ content, source, t }: {
|
|
43
|
+
content: ContextMessageNode['content'];
|
|
44
|
+
source: unknown;
|
|
45
|
+
t: Translate;
|
|
46
|
+
}): ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* `snapshot` form: the named contributions this snapshot assembled, in order.
|
|
49
|
+
*
|
|
50
|
+
* The sections are the same bytes the model read, split at the boundaries the
|
|
51
|
+
* producer assembled them on, so a reader sees which subsystem contributed
|
|
52
|
+
* which state instead of one undifferentiated wall.
|
|
53
|
+
*
|
|
54
|
+
* One sentence of the model-facing text is NOT in any section: the producer's
|
|
55
|
+
* framing line declaring that this snapshot supersedes earlier ones. Unlike the
|
|
56
|
+
* `<system-reminder>` wrapper an instruction context carries — which wraps
|
|
57
|
+
* content and cannot be separated from it — that line states the form's own
|
|
58
|
+
* semantics, so the body states them as a caption instead of reprinting the
|
|
59
|
+
* joined prose beside the sections it was split from.
|
|
60
|
+
* @param props - Durable content, its source, and the locale seat.
|
|
61
|
+
* @returns The snapshot context body, or the opaque body when unreadable.
|
|
62
|
+
*/
|
|
63
|
+
export declare function SnapshotBody({ content, source, t }: {
|
|
64
|
+
content: ContextMessageNode['content'];
|
|
65
|
+
source: unknown;
|
|
66
|
+
t: Translate;
|
|
67
|
+
}): ReactNode;
|
|
68
|
+
/**
|
|
69
|
+
* `notice` form: what just happened, with the model-facing text beneath it.
|
|
70
|
+
*
|
|
71
|
+
* The one-line account also rides the collapsed row ({@link contextBody}), so a
|
|
72
|
+
* notice is usually readable without expanding at all.
|
|
73
|
+
* @param props - Durable content, its source, and the locale seat.
|
|
74
|
+
* @returns The notice context body.
|
|
75
|
+
*/
|
|
76
|
+
export declare function NoticeBody({ content, t }: {
|
|
77
|
+
content: ContextMessageNode['content'];
|
|
78
|
+
source: unknown;
|
|
79
|
+
t: Translate;
|
|
80
|
+
}): ReactNode;
|
|
81
|
+
/**
|
|
82
|
+
* `relay` form: which agent sent this, then what it said.
|
|
83
|
+
*
|
|
84
|
+
* The sender is an opaque session id; it is shown as a field rather than a
|
|
85
|
+
* label, because this client cannot resolve it to a title.
|
|
86
|
+
* @param props - Durable content, its source, and the locale seat.
|
|
87
|
+
* @returns The relay context body.
|
|
88
|
+
*/
|
|
89
|
+
export declare function RelayBody({ content, source, t }: {
|
|
90
|
+
content: ContextMessageNode['content'];
|
|
91
|
+
source: unknown;
|
|
92
|
+
t: Translate;
|
|
93
|
+
}): ReactNode;
|
|
94
|
+
/**
|
|
95
|
+
* `recall` form: which sessions this material came from and how much of each
|
|
96
|
+
* survived the read, then the material itself.
|
|
97
|
+
*
|
|
98
|
+
* Completeness is the fact a reader needs first: recalled context is bounded on
|
|
99
|
+
* the way in, so a card that hid the omitted count would overstate what the
|
|
100
|
+
* model received.
|
|
101
|
+
* @param props - Durable content, its source, and the locale seat.
|
|
102
|
+
* @returns The recall context body, or the opaque body when unreadable.
|
|
103
|
+
*/
|
|
104
|
+
export declare function RecallBody({ content, source, t }: {
|
|
105
|
+
content: ContextMessageNode['content'];
|
|
106
|
+
source: unknown;
|
|
107
|
+
t: Translate;
|
|
108
|
+
}): ReactNode;
|
|
109
|
+
/**
|
|
110
|
+
* Choose the body for one context node.
|
|
111
|
+
*
|
|
112
|
+
* Returns the form the body actually rendered as, which is not always the
|
|
113
|
+
* declared one: a declared form whose fields are unreadable falls back to
|
|
114
|
+
* opaque, and the caller labels the row with what it really shows.
|
|
115
|
+
* `summary` is the collapsed row's one-line account, which only a `notice`
|
|
116
|
+
* records: its whole point is being readable without expanding.
|
|
117
|
+
* @param form - the producer-declared form projected onto the node.
|
|
118
|
+
* @param props - durable content, its source, and the locale seat.
|
|
119
|
+
* @returns the rendered form (null for opaque), its collapsed summary, and its body.
|
|
120
|
+
*/
|
|
121
|
+
export declare function contextBody(form: ContextMessageNode['form'], props: {
|
|
122
|
+
content: ContextMessageNode['content'];
|
|
123
|
+
source: unknown;
|
|
124
|
+
t: Translate;
|
|
125
|
+
}): {
|
|
126
|
+
rendered: KnownContextForm | null;
|
|
127
|
+
summary: string | null;
|
|
128
|
+
body: ReactNode;
|
|
129
|
+
};
|
|
130
|
+
export {};
|
|
131
|
+
//# sourceMappingURL=ContextBody.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ChatViewSlotProps } from '../contract/slots.ts';
|
|
2
|
+
import type { ContextMessageNode } from '../contract/snapshot.ts';
|
|
3
|
+
/** Props for the logged non-user message presentation. */
|
|
4
|
+
export interface ContextInjectionRowProps {
|
|
5
|
+
content: ContextMessageNode['content'];
|
|
6
|
+
source: ContextMessageNode['source'];
|
|
7
|
+
/** Role and producer name projected from the durable source. */
|
|
8
|
+
provenance: ContextMessageNode['provenance'];
|
|
9
|
+
/** Producer-declared information form; null renders the opaque body. */
|
|
10
|
+
form: ContextMessageNode['form'];
|
|
11
|
+
/** The owning view's locale seat, passed down as a plain prop. */
|
|
12
|
+
t: ChatViewSlotProps['t'];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Render logged context with the Tool calls disclosure chrome from Figma.
|
|
16
|
+
*
|
|
17
|
+
* The header names the role the context plays and, beside it, the producer the
|
|
18
|
+
* durable source identifies, so a reader can tell an injected skill catalog
|
|
19
|
+
* from a workspace instruction file or a recalled session without expanding.
|
|
20
|
+
* The expanded body follows the producer-declared form; an absent or unknown
|
|
21
|
+
* form renders the opaque body.
|
|
22
|
+
* @param props - Durable content, its projected producer role/name and form, and the locale seat.
|
|
23
|
+
* @returns A collapsed context row with a bounded, form-specific body.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ContextInjectionRow({ content, source, provenance, form, t }: ContextInjectionRowProps): import("react").JSX.Element;
|
|
26
|
+
//# sourceMappingURL=ContextInjectionRow.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ChatViewSlotProps, CommandRowOwnerProps } from '../contract/slots.ts';
|
|
2
|
+
/** Card props: the owner payload plus the render site's locale seat (plain prop). */
|
|
3
|
+
export interface GenericCommandCardProps extends CommandRowOwnerProps {
|
|
4
|
+
t: ChatViewSlotProps['t'];
|
|
5
|
+
/** Command-specific running copy; absent uses the generic command label. */
|
|
6
|
+
runningSummary?: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare function GenericCommandCard({ node, t, runningSummary }: GenericCommandCardProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=GenericCommandCard.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { ChatViewSlotProps } from '../contract/slots.ts';
|
|
3
|
+
export interface MessageIconActionsProps {
|
|
4
|
+
/** Plain text the copy action writes. */
|
|
5
|
+
text: string;
|
|
6
|
+
/** Unix epoch ms for the clock label; omitted for transient messages. */
|
|
7
|
+
time?: number | undefined;
|
|
8
|
+
/** Turn wall time in ms, appended to the clock as `· Ran for 15s`; omitted when the turn's start is unknown. */
|
|
9
|
+
runMs?: number | undefined;
|
|
10
|
+
/** Turn first-step TTFT in ms, appended as `· TTFT 1.2s`; omitted when unrecorded. */
|
|
11
|
+
ttftMs?: number | undefined;
|
|
12
|
+
/** Turn decode throughput, appended as `· 34 tok/s`; omitted when unrecorded. */
|
|
13
|
+
tokensPerSecond?: number | undefined;
|
|
14
|
+
/** Clock before icons (user) or after (assistant). */
|
|
15
|
+
clock: 'start' | 'end';
|
|
16
|
+
/** Fork the session at this message; omission hides the branch action. */
|
|
17
|
+
onBranch?: (() => void) | undefined;
|
|
18
|
+
/** The message is not a completed transcript tail, so branch stays visible but unavailable. */
|
|
19
|
+
branchUnavailable?: boolean | undefined;
|
|
20
|
+
/** Parent layout class composed onto the actions row. */
|
|
21
|
+
className?: string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Slot-rendered actions owned by independent plugins, placed between the
|
|
24
|
+
* built-in copy and branch controls.
|
|
25
|
+
*/
|
|
26
|
+
extraActions?: ReactNode;
|
|
27
|
+
/** The owning view's locale seat, passed down as a plain prop. */
|
|
28
|
+
t: ChatViewSlotProps['t'];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Copy / branch (/ clock) IconActions row shared by user and assistant chrome.
|
|
32
|
+
* @param props - Copy text, event time, clock side, branch callback, className.
|
|
33
|
+
* @returns The actions row element.
|
|
34
|
+
*/
|
|
35
|
+
export declare function MessageIconActions({ text, time, runMs, ttftMs, tokensPerSecond, clock, onBranch, branchUnavailable, className, extraActions, t, }: MessageIconActionsProps): import("react").JSX.Element;
|
|
36
|
+
//# sourceMappingURL=MessageIconActions.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { PendingSubmission } from '@prettier-ai/dsh-api-session-controller/client';
|
|
3
|
+
import type { ChatNodeOwnerProps, ChatNodeViewProps, ChatViewSlotProps } from '../contract/slots.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Render one Host-authoritative pending steering item with the same visual
|
|
6
|
+
* language as its eventual durable transcript node.
|
|
7
|
+
* @param props - Pending message content and conversation translator.
|
|
8
|
+
* @returns the pending steering bubble.
|
|
9
|
+
*/
|
|
10
|
+
export declare function PendingSteeringBubble({ content, renderMessageImages, t }: {
|
|
11
|
+
content: readonly unknown[];
|
|
12
|
+
renderMessageImages: ChatNodeOwnerProps['renderMessageImages'];
|
|
13
|
+
t: ChatViewSlotProps['t'];
|
|
14
|
+
}): ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Render one local submission echo with the exact visual language of the
|
|
17
|
+
* durable user node that replaces it: draft text plus object-URL previews,
|
|
18
|
+
* visible from the submit click until the durable `user/message` (or its
|
|
19
|
+
* queue occurrence) renders.
|
|
20
|
+
* @param props - the session snapshot's pending submission and render seats.
|
|
21
|
+
* @returns the echoed user bubble.
|
|
22
|
+
*/
|
|
23
|
+
export declare function PendingSubmissionBubble({ submission, renderMessageImages, t }: {
|
|
24
|
+
submission: PendingSubmission;
|
|
25
|
+
renderMessageImages: ChatNodeOwnerProps['renderMessageImages'];
|
|
26
|
+
t: ChatViewSlotProps['t'];
|
|
27
|
+
}): ReactNode;
|
|
28
|
+
/** User and admitted-steering keyed Chat renderer. */
|
|
29
|
+
export declare const UserMessageNodeView: import("react").MemoExoticComponent<({ node, renderMessageImages, t, }: ChatNodeViewProps<"user" | "steering">) => import("react").JSX.Element>;
|
|
30
|
+
/** Injected-context keyed Chat renderer. */
|
|
31
|
+
export declare const ContextMessageNodeView: import("react").MemoExoticComponent<({ node, t }: ChatNodeViewProps<"context">) => import("react").JSX.Element>;
|
|
32
|
+
/** Automatic compaction keyed Chat renderer. */
|
|
33
|
+
export declare const CompactionNodeView: import("react").MemoExoticComponent<({ node, t }: ChatNodeViewProps<"compaction">) => import("react").JSX.Element>;
|
|
34
|
+
/** Correlated retry-chain keyed Chat renderer. */
|
|
35
|
+
export declare const RetryNodeView: import("react").MemoExoticComponent<({ node, t }: ChatNodeViewProps<"model-retry">) => import("react").JSX.Element>;
|
|
36
|
+
/** Terminal turn-error keyed Chat renderer. */
|
|
37
|
+
export declare const TurnErrorNodeView: import("react").MemoExoticComponent<({ node, t }: ChatNodeViewProps<"turn-error">) => import("react").JSX.Element>;
|
|
38
|
+
/** Max-tokens turn-end notice keyed Chat renderer. */
|
|
39
|
+
export declare const TurnMaxTokensNodeView: import("react").MemoExoticComponent<({ t }: ChatNodeViewProps<"turn-max-tokens">) => import("react").JSX.Element>;
|
|
40
|
+
/** Explicit unknown-surface keyed Chat renderer. */
|
|
41
|
+
export declare const UnknownNodeView: import("react").MemoExoticComponent<({ node, t }: ChatNodeViewProps<"unknown">) => import("react").JSX.Element>;
|
|
42
|
+
//# sourceMappingURL=MessageItem.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ChatViewSlotProps } from '../contract/slots.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Render one assistant reasoning block as the Think disclosure row.
|
|
4
|
+
* @param props.text - complete or streaming reasoning text.
|
|
5
|
+
* @param props.running - whether this block is the streaming tail.
|
|
6
|
+
* @param props.t - conversation locale seat for the running status.
|
|
7
|
+
* @returns the reasoning disclosure.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ReasoningRow({ text, running, t }: {
|
|
10
|
+
text: string;
|
|
11
|
+
running: boolean;
|
|
12
|
+
t: ChatViewSlotProps['t'];
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=ReasoningRow.d.ts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { UseProjection } from '@prettier-ai/dsh-api-session-controller/client';
|
|
2
|
+
import type { SnapshotSelectorHook } from '@prettier-ai/dsh-client-ui-slots';
|
|
3
|
+
import type { TokenUsageProjection } from '@prettier-ai/dsh-token-meter/client';
|
|
4
|
+
import type { ChatViewSlotProps } from '../contract/slots.ts';
|
|
5
|
+
import type { ChatSnapshot } from '../contract/snapshot.ts';
|
|
6
|
+
interface WindowStats {
|
|
7
|
+
turns: number;
|
|
8
|
+
steps: number;
|
|
9
|
+
/** Summed request wall time (step/start → assistant/message); 0 when no node carries timing. */
|
|
10
|
+
llmMs: number;
|
|
11
|
+
/** Summed tool wall time (tool/call → tool/result); 0 when no pair is in-window. */
|
|
12
|
+
toolMs: number;
|
|
13
|
+
/** Summed first-token latency over `ttftSteps`; 0 when no step records it. */
|
|
14
|
+
ttftMs: number;
|
|
15
|
+
/** Steps carrying a recorded TTFT. */
|
|
16
|
+
ttftSteps: number;
|
|
17
|
+
/** Summed decode wall time over steps that also report output tokens. */
|
|
18
|
+
decodeMs: number;
|
|
19
|
+
/** Summed output tokens over the same decode-timed steps. */
|
|
20
|
+
decodeTokens: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Fold assistant and tool-result nodes into window-scoped display totals —
|
|
24
|
+
* the FALLBACK for assemblies without the `sessionStats` projection.
|
|
25
|
+
*
|
|
26
|
+
* Every displayed figure rides that durable whole-log projection (and token
|
|
27
|
+
* accounting rides `tokenUsage`) because the window is paged and compaction
|
|
28
|
+
* rewrites it; this fold answers "what is on screen" only when no projection
|
|
29
|
+
* value is served. Its field names deliberately mirror the projection's so
|
|
30
|
+
* the two swap wholesale.
|
|
31
|
+
* @param nodes - snapshot nodes.
|
|
32
|
+
* @returns fallback counts and summed wall times.
|
|
33
|
+
*/
|
|
34
|
+
export declare function deriveStats(nodes: ChatSnapshot['legacy']['nodes']): WindowStats;
|
|
35
|
+
/**
|
|
36
|
+
* Compact duration: 45.2s under a minute, 2m42s from there on.
|
|
37
|
+
* @param ms - duration in milliseconds.
|
|
38
|
+
* @returns display string.
|
|
39
|
+
*/
|
|
40
|
+
export declare function formatDuration(ms: number, t: ChatViewSlotProps['t']): string;
|
|
41
|
+
/**
|
|
42
|
+
* Display-ready cache-hit share of prompt-side input over the whole durable log.
|
|
43
|
+
* @param usage - the session's token-usage projection value.
|
|
44
|
+
* @returns integer text when integer rounding stays below 100, otherwise the
|
|
45
|
+
* minimum decimal precision that still rounds below 100; a full hit returns
|
|
46
|
+
* 100, and no billed input returns null.
|
|
47
|
+
*/
|
|
48
|
+
export declare function cacheHitPercent(usage: TokenUsageProjection): string | null;
|
|
49
|
+
/**
|
|
50
|
+
* Sum the three disjoint prompt-side billing buckets.
|
|
51
|
+
* @param usage - the session's token-usage projection value.
|
|
52
|
+
* @returns billed input tokens.
|
|
53
|
+
*/
|
|
54
|
+
export declare function billedInputTokens(usage: TokenUsageProjection): number;
|
|
55
|
+
/** Props: the conversation-snapshot selector plus the projection read seat. */
|
|
56
|
+
export interface StatsLineProps {
|
|
57
|
+
useChat: SnapshotSelectorHook<ChatSnapshot>;
|
|
58
|
+
useProjection: UseProjection;
|
|
59
|
+
/** The owning dock's locale seat. */
|
|
60
|
+
t: ChatViewSlotProps['t'];
|
|
61
|
+
}
|
|
62
|
+
export declare const StatsLine: import("react").MemoExoticComponent<({ useChat, useProjection, t }: StatsLineProps) => import("react").JSX.Element | null>;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=StatsLine.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ChatNodeViewProps, ChatViewSlotProps } from '../contract/slots.ts';
|
|
2
|
+
/** Props for one complete system prompt disclosure. */
|
|
3
|
+
export interface SystemPromptRowProps {
|
|
4
|
+
/** Complete model-visible prompt text. */
|
|
5
|
+
text: string;
|
|
6
|
+
/** The owning view's locale seat. */
|
|
7
|
+
t: ChatViewSlotProps['t'];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Render one complete system prompt as a collapsed disclosure whose expanded
|
|
11
|
+
* body is the same opaque context chrome: 141px code-block scrollport and
|
|
12
|
+
* model-facing text with its real line breaks.
|
|
13
|
+
* @param props - Complete prompt text and the locale seat.
|
|
14
|
+
* @returns The system-prompt disclosure row.
|
|
15
|
+
*/
|
|
16
|
+
export declare function SystemPromptRow({ text, t }: SystemPromptRowProps): import("react").JSX.Element;
|
|
17
|
+
/** System-prompt keyed Chat renderer. */
|
|
18
|
+
export declare const SystemPromptNodeView: import("react").MemoExoticComponent<({ node, t, }: Pick<ChatNodeViewProps<"system-prompt">, "node" | "t">) => import("react").JSX.Element>;
|
|
19
|
+
//# sourceMappingURL=SystemPromptRow.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ChatViewSlotProps } from '../contract/slots.ts';
|
|
2
|
+
import type { TurnNavigationItem } from '../contract/snapshot.ts';
|
|
3
|
+
interface TurnNavigatorProps {
|
|
4
|
+
readonly items: readonly TurnNavigationItem[];
|
|
5
|
+
readonly activeTurn: number | null;
|
|
6
|
+
readonly onNavigate: (item: TurnNavigationItem) => void;
|
|
7
|
+
readonly t: ChatViewSlotProps['t'];
|
|
8
|
+
}
|
|
9
|
+
declare function TurnNavigatorRail({ items, activeTurn, onNavigate, t }: TurnNavigatorProps): import("react").JSX.Element | null;
|
|
10
|
+
/**
|
|
11
|
+
* Compact rail of the currently loaded Turns with hover and focus previews.
|
|
12
|
+
*
|
|
13
|
+
* Memoized because it renders two host elements per loaded Turn while the
|
|
14
|
+
* enclosing view re-renders on every streaming delta: without the guard a long
|
|
15
|
+
* session rebuilds hundreds of marks per commit for a rail that only changes
|
|
16
|
+
* when a Turn is added, removed, or becomes active. Its props must therefore
|
|
17
|
+
* stay referentially stable across those commits.
|
|
18
|
+
*/
|
|
19
|
+
export declare const TurnNavigator: import("react").MemoExoticComponent<typeof TurnNavigatorRail>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=TurnNavigator.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ChatNodeViewProps } from '../contract/slots.ts';
|
|
2
|
+
/** Turn-level process disclosure controller. */
|
|
3
|
+
export declare const TurnProcessNodeView: import("react").MemoExoticComponent<({ node, turnProcess, t, }: ChatNodeViewProps<"turn-process">) => import("react").JSX.Element | null>;
|
|
4
|
+
//# sourceMappingURL=TurnProcessNodeView.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PropsRenderSlots } from '@prettier-ai/dsh-client-ui-slots';
|
|
2
|
+
import type { ChatNodeViewProps } from '../contract/slots.ts';
|
|
3
|
+
type TurnTailNodeViewProps = ChatNodeViewProps<'turn-tail'> & PropsRenderSlots<'conversation.chat.turnTail' | 'conversation.chat.assistant-actions'>;
|
|
4
|
+
/** Turn-local actions and feature tail over the Location index, independent of Assistant placement. */
|
|
5
|
+
export declare const TurnTailNodeView: import("react").MemoExoticComponent<({ node, openFile, forkAt, renderSlot, renderSlotChain, t, useChat, }: TurnTailNodeViewProps) => import("react").JSX.Element | null>;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=TurnTailNodeView.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TurnTokenUsage } from '../contract/chat-nodes.ts';
|
|
2
|
+
import type { ChatViewSlotProps } from '../contract/slots.ts';
|
|
3
|
+
export interface TurnUsageDisclosureProps {
|
|
4
|
+
usage: TurnTokenUsage;
|
|
5
|
+
t: ChatViewSlotProps['t'];
|
|
6
|
+
}
|
|
7
|
+
/** Compact per-Turn usage summary with an opt-in bucket breakdown. */
|
|
8
|
+
export declare function TurnUsageDisclosure({ usage, t }: TurnUsageDisclosureProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=TurnUsageDisclosure.d.ts.map
|