@tangle-network/agent-app 0.60.234 → 0.60.236

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.
Files changed (61) hide show
  1. package/dist/assistant/index.js +8 -9
  2. package/dist/assistant/index.js.map +1 -1
  3. package/dist/chat-react/index.js +4 -4
  4. package/dist/{chunk-BNFUJNPS.js → chunk-A77IBQ7S.js} +456 -431
  5. package/dist/chunk-A77IBQ7S.js.map +1 -0
  6. package/dist/chunk-BDEBQ4WO.js +38 -0
  7. package/dist/chunk-BDEBQ4WO.js.map +1 -0
  8. package/dist/{chunk-FJEGGUOQ.js → chunk-BGDQ7245.js} +4345 -3610
  9. package/dist/chunk-BGDQ7245.js.map +1 -0
  10. package/dist/{chunk-232KA6MR.js → chunk-CI53V6DD.js} +3 -3
  11. package/dist/{chunk-4JAXSEYW.js → chunk-DLVMKDFX.js} +3 -3
  12. package/dist/{chunk-JYVUFRRV.js → chunk-FUZETA6Z.js} +2 -2
  13. package/dist/{chunk-XIN7DOAB.js → chunk-R4X5474U.js} +35 -33
  14. package/dist/chunk-R4X5474U.js.map +1 -0
  15. package/dist/{chunk-3K45OQ5X.js → chunk-ZDPUC6CM.js} +43 -3
  16. package/dist/chunk-ZDPUC6CM.js.map +1 -0
  17. package/dist/{mention-editor-6FJ6HRSN.js → mention-editor-B23OMFT2.js} +2 -2
  18. package/dist/settings-react/index.js +1 -1
  19. package/dist/studio-react/index.js +2 -4
  20. package/dist/studio-react/index.js.map +1 -1
  21. package/dist/web-react/agent-profile-editor.js +4 -4
  22. package/dist/web-react/chat-composer-types.d.ts +301 -0
  23. package/dist/web-react/chat-composer.d.ts +2 -300
  24. package/dist/web-react/chat-empty-state.d.ts +27 -0
  25. package/dist/web-react/chat-message-body.d.ts +23 -0
  26. package/dist/web-react/chat-message-metrics.d.ts +6 -0
  27. package/dist/web-react/chat-message-types.d.ts +158 -0
  28. package/dist/web-react/chat-messages.d.ts +17 -0
  29. package/dist/web-react/chat-tool-call.d.ts +31 -0
  30. package/dist/web-react/composer-glyphs.d.ts +28 -0
  31. package/dist/web-react/index.d.ts +6 -245
  32. package/dist/web-react/index.js +13 -14
  33. package/dist/web-react/record-grid-editors.d.ts +31 -0
  34. package/dist/web-react/record-grid-review-actions.d.ts +13 -0
  35. package/dist/web-react/record-grid-source-marker.d.ts +27 -0
  36. package/dist/web-react/record-grid-types.d.ts +86 -0
  37. package/dist/web-react/record-grid.d.ts +2 -85
  38. package/dist/web-react/run-drill-in.d.ts +28 -0
  39. package/dist/web-react/session-history-panel.d.ts +84 -0
  40. package/dist/web-react/session-history.d.ts +4 -187
  41. package/dist/web-react/use-composer-commands.d.ts +25 -0
  42. package/dist/web-react/use-composer-file-intake.d.ts +20 -0
  43. package/dist/web-react/use-composer-send.d.ts +34 -0
  44. package/dist/web-react/use-infinite-scroll.d.ts +20 -0
  45. package/dist/web-react/use-session-actions.d.ts +47 -0
  46. package/dist/web-react/use-session-history.d.ts +44 -0
  47. package/dist/workspace-react/index.js +5 -7
  48. package/dist/workspace-react/index.js.map +1 -1
  49. package/package.json +1 -1
  50. package/dist/chunk-35APKGPB.js +0 -749
  51. package/dist/chunk-35APKGPB.js.map +0 -1
  52. package/dist/chunk-3K45OQ5X.js.map +0 -1
  53. package/dist/chunk-A2GG4D4A.js +0 -43
  54. package/dist/chunk-A2GG4D4A.js.map +0 -1
  55. package/dist/chunk-BNFUJNPS.js.map +0 -1
  56. package/dist/chunk-FJEGGUOQ.js.map +0 -1
  57. package/dist/chunk-XIN7DOAB.js.map +0 -1
  58. /package/dist/{chunk-232KA6MR.js.map → chunk-CI53V6DD.js.map} +0 -0
  59. /package/dist/{chunk-4JAXSEYW.js.map → chunk-DLVMKDFX.js.map} +0 -0
  60. /package/dist/{chunk-JYVUFRRV.js.map → chunk-FUZETA6Z.js.map} +0 -0
  61. /package/dist/{mention-editor-6FJ6HRSN.js.map → mention-editor-B23OMFT2.js.map} +0 -0
@@ -0,0 +1,23 @@
1
+ /** Chronological text, tool, and notice segments within one turn. */
2
+ import { type ReactNode } from 'react';
3
+ import type { ChatToolCallInfo, ChatUiMessage, ChatMessageSegment, ProposalApprovalHandlers, ToolDetailRenderers } from './chat-message-types';
4
+ /** The blinking insertion caret shown at the end of streaming answer text.
5
+ * Shared by the segmented and legacy branches so their streaming cue can't
6
+ * visually diverge. */
7
+ export declare function StreamingCaret(): import("react").JSX.Element;
8
+ /** Renders a turn's ordered text/tool segments interleaved. The trailing text
9
+ * run carries the streaming caret; if the last segment is instead a tool, a
10
+ * trailing caret keeps the gap before the next run from looking frozen. Any
11
+ * `toolCalls` not represented in `segments` (a partially-migrated producer that
12
+ * set both) still render, so a tool row is never silently dropped. A settled
13
+ * run of many tool calls collapses into one disclosure — see below. */
14
+ export declare function SegmentedBody({ segments, msg, streaming, renderBody, approval, onToolCallClick, toolRenderers, messageClassName, }: {
15
+ segments: ChatMessageSegment[];
16
+ msg: ChatUiMessage;
17
+ streaming: boolean;
18
+ renderBody: (content: string) => ReactNode;
19
+ approval?: ProposalApprovalHandlers;
20
+ onToolCallClick?: (call: ChatToolCallInfo, message: ChatUiMessage) => void;
21
+ toolRenderers?: ToolDetailRenderers;
22
+ messageClassName: string;
23
+ }): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { CatalogModel } from '../runtime/model-catalog';
2
+ import type { ChatMessageMetrics } from './chat-message-types';
3
+ /** "$0.0042" from token counts × catalogue per-token pricing; null when unknown. */
4
+ export declare function formatModelCost(msg: ChatMessageMetrics, models: CatalogModel[]): string | null;
5
+ /** "38 tok/s" from completion tokens over first-token→end duration; null when unknown. */
6
+ export declare function formatTokensPerSecond(msg: ChatMessageMetrics): string | null;
@@ -0,0 +1,158 @@
1
+ /** Message-thread and tool-rendering contracts. */
2
+ import type { ReactNode } from 'react';
3
+ import type { ChatAuthor } from '@tangle-network/ui/types';
4
+ import type { CatalogModel } from '../runtime/model-catalog';
5
+ import type { TurnPhaseData } from '../chat-routes/turn-progress';
6
+ import type { DurableChatCardsProps } from './durable-chat-cards';
7
+ import type { ChatAttachmentPart } from './chat-attachments';
8
+ import type { WorkProductPersistedPart } from '../work-product/types';
9
+ import type { ChatEmptyStateProps } from './chat-empty-state';
10
+ /** Describe metrics related to a chat message including model, token counts, and duration */
11
+ export interface ChatMessageMetrics {
12
+ modelUsed?: string;
13
+ promptTokens?: number;
14
+ completionTokens?: number;
15
+ durationMs?: number;
16
+ }
17
+ /** Describe the structure and state of a tool call within a chat interaction */
18
+ export interface ChatToolCallInfo {
19
+ id: string;
20
+ name: string;
21
+ status: 'running' | 'done' | 'error';
22
+ /** The call arguments, captured from the tool_call event — shown in the
23
+ * expanded card so users see exactly what the agent invoked. */
24
+ args?: Record<string, unknown>;
25
+ /** The tool outcome (`{ok, result}` shape). When `result.status` is
26
+ * 'queued_for_approval' the card renders the approval state. */
27
+ result?: unknown;
28
+ }
29
+ /** One ordered piece of an assistant turn: a run of answer text, or a tool
30
+ * call, in the sequence the agent emitted them. A message carrying `segments`
31
+ * is rendered in order — interleaving text and tool rows — so the agent's
32
+ * pre- and post-tool reasoning reads chronologically instead of as one text
33
+ * blob with the tool rows collected after it. */
34
+ export type ChatMessageSegment = {
35
+ kind: 'text';
36
+ content: string;
37
+ } | {
38
+ kind: 'tool';
39
+ call: ChatToolCallInfo;
40
+ }
41
+ /** An out-of-band transcript notice — a failed turn's error, a warning —
42
+ * rendered in its status tone so it never reads as answer prose. Map a
43
+ * persisted `notice` part (`noticeKind: 'error' | 'warning'`) to this. */
44
+ | {
45
+ kind: 'notice';
46
+ tone: ChatNoticeTone;
47
+ content: string;
48
+ };
49
+ /** Status tone of a {@link ChatMessageSegment} notice. */
50
+ export type ChatNoticeTone = 'error' | 'warning';
51
+ /** Describe the structure and properties of a chat message with roles, content, and optional metadata */
52
+ export interface ChatUiMessage extends ChatMessageMetrics {
53
+ id: string;
54
+ role: 'user' | 'assistant' | 'system';
55
+ content: string;
56
+ /** The model's reasoning for this message, shown in a {@link ReasoningRow} above the answer. */
57
+ reasoning?: string;
58
+ /** When the model started reasoning (epoch ms): `ChatReasoningState.startedAt` from the stream or the saved parts. */
59
+ reasoningStartedAt?: number;
60
+ /** When the reasoning ended (epoch ms). Set, the row reads "Thought for N seconds"; unset while streaming, it is still thinking. */
61
+ reasoningEndedAt?: number;
62
+ toolCalls?: ChatToolCallInfo[];
63
+ /** Ordered text/tool sequence for true chronological interleaving. When
64
+ * present and non-empty it is rendered in place of `content` + `toolCalls`;
65
+ * both remain the fallback for producers that don't segment a turn. */
66
+ segments?: ChatMessageSegment[];
67
+ /** Persisted assistant parts. When `ChatMessages.durableCards` is supplied,
68
+ * shared plan/question cards render directly from these projections. */
69
+ parts?: Array<Record<string, unknown>>;
70
+ /** Who wrote the message, when more than one person shares the thread: a
71
+ * client, an attorney and the agent. A user message whose author is not
72
+ * `ChatMessages.viewerId` is someone else's: start-aligned on a card under
73
+ * their avatar, name and role. An assistant message's author replaces the
74
+ * agent label. Absent → today's rendering, byte-identical. */
75
+ author?: ChatAuthor;
76
+ }
77
+ /** Define properties for rendering chat messages with optional models, markdown, extras, and durable cards */
78
+ export interface ChatMessagesProps {
79
+ messages: ChatUiMessage[];
80
+ /** Shared reading scale for both user and assistant prose. Defaults to 16px
81
+ * at a 1.6 line height; `large` uses 17px at the same leading without
82
+ * enlarging labels, tool chrome, or metadata. */
83
+ messageSize?: 'default' | 'large';
84
+ /** Transcript chrome. `labeled` (default) keeps the always-on role label +
85
+ * model/tok-s/cost meta line and the primary-tinted user bubble. `quiet`
86
+ * drops the label row into a fixed-height meta lane at each row's bottom
87
+ * (copy + the demoted meta, revealed on hover/focus, always visible on
88
+ * touch) and renders user bubbles neutral with a symmetric radius.
89
+ * Everything else — tool rows, reasoning, streaming — is identical. */
90
+ chrome?: 'labeled' | 'quiet';
91
+ /** Catalogue models, for per-message cost from pricing. Pass [] to skip cost. */
92
+ models?: CatalogModel[];
93
+ /** Markdown renderer for assistant content; default renders pre-wrapped text. */
94
+ renderMarkdown?: (content: string) => ReactNode;
95
+ /** Extra per-message content (artifacts, custom panels) appended after the body. */
96
+ renderExtras?: (message: ChatUiMessage) => ReactNode;
97
+ /** Canonical durable plan/question card wiring. Apps inject only transport,
98
+ * access, and optional visual callbacks; card selection/dedupe stays shared. */
99
+ durableCards?: Omit<DurableChatCardsProps, 'parts' | 'renderMarkdown'>;
100
+ userLabel?: string;
101
+ agentLabel?: string;
102
+ /** Render the trailing "agent is thinking" row. */
103
+ loading?: boolean;
104
+ /** The pending turn's latest stage from its `session.run.phase` events. The
105
+ * trailing row shows it in place of "Thinking…" until the first output. */
106
+ turnPhase?: Pick<TurnPhaseData, 'message'> | null;
107
+ /** Approve/Reject handlers for proposals awaiting approval. When omitted the
108
+ * card still shows "awaiting approval" but without action buttons. */
109
+ approval?: ProposalApprovalHandlers;
110
+ /** Open a full-transcript view (e.g. {@link RunDrillIn}) from a tool row's
111
+ * actions slot. */
112
+ onToolCallClick?: (call: ChatToolCallInfo, message: ChatUiMessage) => void;
113
+ /** Per-tool custom detail renderers for the expanded tool row body. */
114
+ toolRenderers?: ToolDetailRenderers;
115
+ /** Stream-error affordance: when the turn failed (a thrown transport error or
116
+ * a loop-level `onErrorEvent`), pass the message here to render an error row.
117
+ * A failed turn otherwise just stops with no UI signal. */
118
+ error?: string | null;
119
+ /** Retry control shown on the error row; omit to render the error without a
120
+ * retry button (e.g. when the product retries automatically). */
121
+ onRetry?: () => void;
122
+ /** Zero-state renderer, shown when there are no messages and the turn is
123
+ * neither loading nor errored. When omitted, a branded first-run state is
124
+ * shown ({@link ChatEmptyState}); pass `() => null` to render nothing. */
125
+ renderEmpty?: () => ReactNode;
126
+ /** First-run state config used when `renderEmpty` is not supplied. Lets a
127
+ * product set the headline and the "doors" (e.g. start from a template, ask
128
+ * the agent) without replacing the whole zero-state. */
129
+ emptyState?: ChatEmptyStateProps;
130
+ /** Optional branded header slot rendered above the thread. Off by default to
131
+ * preserve the current layout; pass `{ title }` (or your own node via
132
+ * `header`) to show the Tangle mark + product title in the chat shell. */
133
+ header?: ReactNode;
134
+ /** Resolve a raw-bytes download URL for one attachment part. When set, any
135
+ * message carrying attachment parts (`file`/`image` parts with a `path`,
136
+ * see `attachmentPartsFromMessageParts`) renders them as a `MessageAttachments`
137
+ * row next to the bubble — thumbnails for images, download chips for files.
138
+ * Absent → today's rendering, byte-identical (no attachment row). */
139
+ resolveAttachmentUrl?: (part: ChatAttachmentPart) => string;
140
+ /** Render persisted `type:'work_product'` anchor parts as `WorkProductCard`
141
+ * rows under the message body — the chat card that keeps chat the driver
142
+ * surface for review. `onOpen` opens the product's queue/detail surface.
143
+ * Absent → today's rendering, byte-identical (no card row). */
144
+ workProductCards?: {
145
+ onOpen?: (part: WorkProductPersistedPart) => void;
146
+ };
147
+ /** The reader's participant id, compared with each user message's
148
+ * `author.id`. A user message without an author is always the reader's. */
149
+ viewerId?: string;
150
+ }
151
+ /** Handle approval and rejection actions for proposals with asynchronous support */
152
+ export interface ProposalApprovalHandlers {
153
+ onApprove: (proposalId: string, toolCallId: string) => void | Promise<void>;
154
+ onReject: (proposalId: string, toolCallId: string) => void | Promise<void>;
155
+ }
156
+ /** Per-tool custom detail renderers for the expanded card body — keyed by
157
+ * tool name. Return null to fall back to the generic detail view. */
158
+ export type ToolDetailRenderers = Record<string, (call: ChatToolCallInfo, message: ChatUiMessage) => ReactNode>;
@@ -0,0 +1,17 @@
1
+ import type { ChatMessagesProps } from './chat-message-types';
2
+ /** Whole seconds elapsed while `active`, ticking once a second; counts from
3
+ * when `active` first turns true and freezes when it clears. Kept for
4
+ * existing consumers: `ReasoningRow` times reasoning from the stream's own
5
+ * start instead. */
6
+ export declare function useThinkingSeconds(active: boolean): number;
7
+ /**
8
+ * The message thread: one centered column; user messages are right-aligned
9
+ * bubbles with a User label; agent messages carry an Agent meta line with
10
+ * model id, tokens/sec, and cost, plus a collapsible thinking section and
11
+ * tool rows. `chrome="quiet"` opts into the label-free variant: the
12
+ * label/meta row becomes a hover-revealed meta lane under each row.
13
+ * A thread shared by several people passes each message's `author` and the
14
+ * reader's `viewerId`: the reader's own messages stay right-aligned, everyone
15
+ * else's are named, and a named agent replaces the agent label.
16
+ */
17
+ export declare function ChatMessages({ messages, messageSize, chrome, models, renderMarkdown, renderExtras, durableCards, userLabel, agentLabel, loading, turnPhase, approval, onToolCallClick, toolRenderers, error, onRetry, renderEmpty, emptyState, header, resolveAttachmentUrl, workProductCards, viewerId, }: ChatMessagesProps): import("react").JSX.Element;
@@ -0,0 +1,31 @@
1
+ import type { ToolPart } from '@tangle-network/ui/types';
2
+ import type { ChatToolCallInfo, ChatUiMessage, ProposalApprovalHandlers, ToolDetailRenderers } from './chat-message-types';
3
+ /** Extract `{proposalId, status}` from a tool outcome when it is a proposal
4
+ * awaiting human approval; null otherwise. */
5
+ export declare function pendingApprovalOf(call: ChatToolCallInfo): {
6
+ proposalId: string;
7
+ } | null;
8
+ /** A call that failed — by status OR by an `ok:false` outcome envelope. Shared
9
+ * by the row adapter, the collapse guard, and the card itself so the three can
10
+ * never disagree about what "failed" means. */
11
+ export declare function toolCallFailed(call: ChatToolCallInfo): boolean;
12
+ /**
13
+ * Adapt a chat tool call to the canonical `@tangle-network/ui` `ToolPart`, so
14
+ * the row renders through ui's `InlineToolItem` — one run-row grammar shared
15
+ * with every other Tangle run view (the same adapter pattern ui's own
16
+ * `ToolCallStep` uses for its flat props). `sandbox_run_command` maps to ui's
17
+ * canonical `bash` name so the row takes the command category (terminal icon);
18
+ * every other tool keeps its real name. agent-app carries no per-call timings,
19
+ * so `state.time` stays unset and the row shows no duration.
20
+ */
21
+ export declare function chatToolCallPart(call: ChatToolCallInfo): ToolPart;
22
+ export declare function ToolCallCard({ call, message, approval, onOpenRun, renderers, staggerIndex, }: {
23
+ call: ChatToolCallInfo;
24
+ message: ChatUiMessage;
25
+ approval?: ProposalApprovalHandlers;
26
+ onOpenRun?: (call: ChatToolCallInfo, message: ChatUiMessage) => void;
27
+ renderers?: ToolDetailRenderers;
28
+ /** Position in the surrounding run, so a group of rows arrives as a
29
+ * sequence. Frozen at mount by `useArrivalStyle`. */
30
+ staggerIndex?: number;
31
+ }): import("react").JSX.Element;
@@ -0,0 +1,28 @@
1
+ /** Inline action glyphs for the message composer. */
2
+ export declare function SendGlyph({ className }: {
3
+ className?: string;
4
+ }): import("react").JSX.Element;
5
+ export declare function StopGlyph({ className }: {
6
+ className?: string;
7
+ }): import("react").JSX.Element;
8
+ export declare function ArrowUpGlyph({ className }: {
9
+ className?: string;
10
+ }): import("react").JSX.Element;
11
+ export declare function PaperclipGlyph({ className }: {
12
+ className?: string;
13
+ }): import("react").JSX.Element;
14
+ export declare function FolderGlyph({ className }: {
15
+ className?: string;
16
+ }): import("react").JSX.Element;
17
+ export declare function CloseGlyph({ className }: {
18
+ className?: string;
19
+ }): import("react").JSX.Element;
20
+ export declare function RetryGlyph({ className }: {
21
+ className?: string;
22
+ }): import("react").JSX.Element;
23
+ export declare function UploadGlyph({ className }: {
24
+ className?: string;
25
+ }): import("react").JSX.Element;
26
+ export declare function MicGlyph({ className }: {
27
+ className?: string;
28
+ }): import("react").JSX.Element;
@@ -22,12 +22,6 @@
22
22
  * share one row implementation instead of drifting. That makes
23
23
  * `@tangle-network/ui` a peer of this subpath.
24
24
  */
25
- import { type ReactNode } from 'react';
26
- import type { ChatAuthor, ToolPart } from '@tangle-network/ui/types';
27
- import { type DurableChatCardsProps } from './durable-chat-cards';
28
- import { type ChatAttachmentPart } from './chat-attachments';
29
- import type { WorkProductPersistedPart } from '../work-product/types';
30
- import type { TurnPhaseData } from '../chat-routes/turn-progress';
31
25
  export * from './chat-stream';
32
26
  export { TurnProgress, type TurnProgressProps } from './turn-progress';
33
27
  export { ReasoningRow, type ReasoningRowProps } from './reasoning-row';
@@ -76,246 +70,13 @@ export { ReviewFeedbackForm, type ReviewFeedbackFormProps, type ReviewFeedbackFo
76
70
  export * from './use-dictation';
77
71
  export { usePopover, usePending, PopoverSurface, POPOVER_SURFACE_ATTR, ModelPicker, formatModelPrice, EffortPicker, EffortMeter, effortMeterFill, effortLevelLabel, effortLevelsFromIds, reconcileEffortLevels, DEFAULT_EFFORT_LEVELS, EFFORT_METER_SEGMENTS, OVERLAY_SHADOW, fieldPickerTriggerClass, type ModelPickerProps, type EffortPickerProps, type EffortLevel, type PickerVariant, type PopoverSurfaceProps, } from './controls';
78
72
  export { AgentSessionControls, HarnessPicker, type AgentSessionControlsProps, type HarnessPickerProps, } from './agent-session-controls';
79
- import type { CatalogModel } from '../runtime/model-catalog';
80
73
  export type { CatalogModel } from '../runtime/model-catalog';
81
- /** Describe metrics related to a chat message including model, token counts, and duration */
82
- export interface ChatMessageMetrics {
83
- modelUsed?: string;
84
- promptTokens?: number;
85
- completionTokens?: number;
86
- durationMs?: number;
87
- }
88
- /** "$0.0042" from token counts × catalogue per-token pricing; null when unknown. */
89
- export declare function formatModelCost(msg: ChatMessageMetrics, models: CatalogModel[]): string | null;
90
- /** "38 tok/s" from completion tokens over first-token→end duration; null when unknown. */
91
- export declare function formatTokensPerSecond(msg: ChatMessageMetrics): string | null;
92
- /** One step of a retained tool run (e.g. a sandbox command + its output). */
93
- export interface ToolRunStep {
94
- at: string;
95
- label: string;
96
- detail?: string;
97
- status?: 'ok' | 'error';
98
- }
99
- /** A retained tool run keyed by the parent message's toolCallId. The product
100
- * persists these server-side (fail-closed: only ids its own loop created)
101
- * and serves them to the drill-in panel. */
102
- export interface ToolRunRecord {
103
- toolCallId: string;
104
- toolName: string;
105
- title: string;
106
- status: 'running' | 'complete' | 'error';
107
- steps: ToolRunStep[];
108
- }
109
- /** Define properties required to run a drill and handle its closure event */
110
- export interface RunDrillInProps {
111
- run: ToolRunRecord;
112
- onClose: () => void;
113
- }
114
- /**
115
- * Readonly side panel showing a retained tool run's transcript — the
116
- * "drill into what the sandbox actually did" view. Follow-ups happen in the
117
- * main chat, never here.
118
- */
119
- export declare function RunDrillIn({ run, onClose }: RunDrillInProps): import("react").JSX.Element;
120
- /** Describe the structure and state of a tool call within a chat interaction */
121
- export interface ChatToolCallInfo {
122
- id: string;
123
- name: string;
124
- status: 'running' | 'done' | 'error';
125
- /** The call arguments, captured from the tool_call event — shown in the
126
- * expanded card so users see exactly what the agent invoked. */
127
- args?: Record<string, unknown>;
128
- /** The tool outcome (`{ok, result}` shape). When `result.status` is
129
- * 'queued_for_approval' the card renders the approval state. */
130
- result?: unknown;
131
- }
132
- /** Extract `{proposalId, status}` from a tool outcome when it is a proposal
133
- * awaiting human approval; null otherwise. */
134
- export declare function pendingApprovalOf(call: ChatToolCallInfo): {
135
- proposalId: string;
136
- } | null;
137
- /** One ordered piece of an assistant turn: a run of answer text, or a tool
138
- * call, in the sequence the agent emitted them. A message carrying `segments`
139
- * is rendered in order — interleaving text and tool rows — so the agent's
140
- * pre- and post-tool reasoning reads chronologically instead of as one text
141
- * blob with the tool rows collected after it. */
142
- export type ChatMessageSegment = {
143
- kind: 'text';
144
- content: string;
145
- } | {
146
- kind: 'tool';
147
- call: ChatToolCallInfo;
148
- }
149
- /** An out-of-band transcript notice — a failed turn's error, a warning —
150
- * rendered in its status tone so it never reads as answer prose. Map a
151
- * persisted `notice` part (`noticeKind: 'error' | 'warning'`) to this. */
152
- | {
153
- kind: 'notice';
154
- tone: ChatNoticeTone;
155
- content: string;
156
- };
157
- /** Status tone of a {@link ChatMessageSegment} notice. */
158
- export type ChatNoticeTone = 'error' | 'warning';
159
- /** Describe the structure and properties of a chat message with roles, content, and optional metadata */
160
- export interface ChatUiMessage extends ChatMessageMetrics {
161
- id: string;
162
- role: 'user' | 'assistant' | 'system';
163
- content: string;
164
- /** The model's reasoning for this message, shown in a {@link ReasoningRow} above the answer. */
165
- reasoning?: string;
166
- /** When the model started reasoning (epoch ms): `ChatReasoningState.startedAt` from the stream or the saved parts. */
167
- reasoningStartedAt?: number;
168
- /** When the reasoning ended (epoch ms). Set, the row reads "Thought for N seconds"; unset while streaming, it is still thinking. */
169
- reasoningEndedAt?: number;
170
- toolCalls?: ChatToolCallInfo[];
171
- /** Ordered text/tool sequence for true chronological interleaving. When
172
- * present and non-empty it is rendered in place of `content` + `toolCalls`;
173
- * both remain the fallback for producers that don't segment a turn. */
174
- segments?: ChatMessageSegment[];
175
- /** Persisted assistant parts. When `ChatMessages.durableCards` is supplied,
176
- * shared plan/question cards render directly from these projections. */
177
- parts?: Array<Record<string, unknown>>;
178
- /** Who wrote the message, when more than one person shares the thread: a
179
- * client, an attorney and the agent. A user message whose author is not
180
- * `ChatMessages.viewerId` is someone else's: start-aligned on a card under
181
- * their avatar, name and role. An assistant message's author replaces the
182
- * agent label. Absent → today's rendering, byte-identical. */
183
- author?: ChatAuthor;
184
- }
185
- /** Define properties for rendering chat messages with optional models, markdown, extras, and durable cards */
186
- export interface ChatMessagesProps {
187
- messages: ChatUiMessage[];
188
- /** Shared reading scale for both user and assistant prose. Defaults to 16px
189
- * at a 1.6 line height; `large` uses 17px at the same leading without
190
- * enlarging labels, tool chrome, or metadata. */
191
- messageSize?: 'default' | 'large';
192
- /** Transcript chrome. `labeled` (default) keeps the always-on role label +
193
- * model/tok-s/cost meta line and the primary-tinted user bubble. `quiet`
194
- * drops the label row into a fixed-height meta lane at each row's bottom
195
- * (copy + the demoted meta, revealed on hover/focus, always visible on
196
- * touch) and renders user bubbles neutral with a symmetric radius.
197
- * Everything else — tool rows, reasoning, streaming — is identical. */
198
- chrome?: 'labeled' | 'quiet';
199
- /** Catalogue models, for per-message cost from pricing. Pass [] to skip cost. */
200
- models?: CatalogModel[];
201
- /** Markdown renderer for assistant content; default renders pre-wrapped text. */
202
- renderMarkdown?: (content: string) => ReactNode;
203
- /** Extra per-message content (artifacts, custom panels) appended after the body. */
204
- renderExtras?: (message: ChatUiMessage) => ReactNode;
205
- /** Canonical durable plan/question card wiring. Apps inject only transport,
206
- * access, and optional visual callbacks; card selection/dedupe stays shared. */
207
- durableCards?: Omit<DurableChatCardsProps, 'parts' | 'renderMarkdown'>;
208
- userLabel?: string;
209
- agentLabel?: string;
210
- /** Render the trailing "agent is thinking" row. */
211
- loading?: boolean;
212
- /** The pending turn's latest stage from its `session.run.phase` events. The
213
- * trailing row shows it in place of "Thinking…" until the first output. */
214
- turnPhase?: Pick<TurnPhaseData, 'message'> | null;
215
- /** Approve/Reject handlers for proposals awaiting approval. When omitted the
216
- * card still shows "awaiting approval" but without action buttons. */
217
- approval?: ProposalApprovalHandlers;
218
- /** Open a full-transcript view (e.g. {@link RunDrillIn}) from a tool row's
219
- * actions slot. */
220
- onToolCallClick?: (call: ChatToolCallInfo, message: ChatUiMessage) => void;
221
- /** Per-tool custom detail renderers for the expanded tool row body. */
222
- toolRenderers?: ToolDetailRenderers;
223
- /** Stream-error affordance: when the turn failed (a thrown transport error or
224
- * a loop-level `onErrorEvent`), pass the message here to render an error row.
225
- * A failed turn otherwise just stops with no UI signal. */
226
- error?: string | null;
227
- /** Retry control shown on the error row; omit to render the error without a
228
- * retry button (e.g. when the product retries automatically). */
229
- onRetry?: () => void;
230
- /** Zero-state renderer, shown when there are no messages and the turn is
231
- * neither loading nor errored. When omitted, a branded first-run state is
232
- * shown ({@link ChatEmptyState}); pass `() => null` to render nothing. */
233
- renderEmpty?: () => ReactNode;
234
- /** First-run state config used when `renderEmpty` is not supplied. Lets a
235
- * product set the headline and the "doors" (e.g. start from a template, ask
236
- * the agent) without replacing the whole zero-state. */
237
- emptyState?: ChatEmptyStateProps;
238
- /** Optional branded header slot rendered above the thread. Off by default to
239
- * preserve the current layout; pass `{ title }` (or your own node via
240
- * `header`) to show the Tangle mark + product title in the chat shell. */
241
- header?: ReactNode;
242
- /** Resolve a raw-bytes download URL for one attachment part. When set, any
243
- * message carrying attachment parts (`file`/`image` parts with a `path`,
244
- * see `attachmentPartsFromMessageParts`) renders them as a `MessageAttachments`
245
- * row next to the bubble — thumbnails for images, download chips for files.
246
- * Absent → today's rendering, byte-identical (no attachment row). */
247
- resolveAttachmentUrl?: (part: ChatAttachmentPart) => string;
248
- /** Render persisted `type:'work_product'` anchor parts as `WorkProductCard`
249
- * rows under the message body — the chat card that keeps chat the driver
250
- * surface for review. `onOpen` opens the product's queue/detail surface.
251
- * Absent → today's rendering, byte-identical (no card row). */
252
- workProductCards?: {
253
- onOpen?: (part: WorkProductPersistedPart) => void;
254
- };
255
- /** The reader's participant id, compared with each user message's
256
- * `author.id`. A user message without an author is always the reader's. */
257
- viewerId?: string;
258
- }
259
- /** One starting "door" in the chat first-run state — a concrete, labeled action
260
- * (start from a template, do it by hand, ask the agent), not a placeholder. */
261
- export interface ChatEmptyDoor {
262
- label: string;
263
- description?: string;
264
- onSelect: () => void;
265
- /** Optional glyph rendered left of the label. */
266
- icon?: ReactNode;
267
- }
268
- /** Define properties for rendering the chat empty state with customizable text and starting doors */
269
- export interface ChatEmptyStateProps {
270
- /** Product name shown next to the Tangle mark. Default "Agent". */
271
- productName?: string;
272
- /** Headline. Default frames delegation, not messaging. */
273
- headline?: string;
274
- /** Subline under the headline. */
275
- subline?: string;
276
- /** Up to three concrete starting doors. Omit for a mark-and-prompt-only state. */
277
- doors?: ChatEmptyDoor[];
278
- }
279
- /**
280
- * Branded chat first-run state: the Tangle mark, a delegation-framed prompt, and
281
- * up to three concrete doors. Replaces the blank thread that read as "empty or
282
- * broken". Concrete + actionable — never a "coming soon" placeholder.
283
- */
284
- export declare function ChatEmptyState({ productName, headline, subline, doors, }: ChatEmptyStateProps): import("react").JSX.Element;
285
- /** Handle approval and rejection actions for proposals with asynchronous support */
286
- export interface ProposalApprovalHandlers {
287
- onApprove: (proposalId: string, toolCallId: string) => void | Promise<void>;
288
- onReject: (proposalId: string, toolCallId: string) => void | Promise<void>;
289
- }
290
- /** Per-tool custom detail renderers for the expanded card body — keyed by
291
- * tool name. Return null to fall back to the generic detail view. */
292
- export type ToolDetailRenderers = Record<string, (call: ChatToolCallInfo, message: ChatUiMessage) => ReactNode>;
293
- /**
294
- * Adapt a chat tool call to the canonical `@tangle-network/ui` `ToolPart`, so
295
- * the row renders through ui's `InlineToolItem` — one run-row grammar shared
296
- * with every other Tangle run view (the same adapter pattern ui's own
297
- * `ToolCallStep` uses for its flat props). `sandbox_run_command` maps to ui's
298
- * canonical `bash` name so the row takes the command category (terminal icon);
299
- * every other tool keeps its real name. agent-app carries no per-call timings,
300
- * so `state.time` stays unset and the row shows no duration.
301
- */
302
- export declare function chatToolCallPart(call: ChatToolCallInfo): ToolPart;
303
- /** Whole seconds elapsed while `active`, ticking once a second; counts from
304
- * when `active` first turns true and freezes when it clears. Kept for
305
- * existing consumers: `ReasoningRow` times reasoning from the stream's own
306
- * start instead. */
307
- export declare function useThinkingSeconds(active: boolean): number;
308
- /**
309
- * The message thread: one centered column; user messages are right-aligned
310
- * bubbles with a User label; agent messages carry an Agent meta line with
311
- * model id, tokens/sec, and cost, plus a collapsible thinking section and
312
- * tool rows. `chrome="quiet"` opts into the label-free variant: the
313
- * label/meta row becomes a hover-revealed meta lane under each row.
314
- * A thread shared by several people passes each message's `author` and the
315
- * reader's `viewerId`: the reader's own messages stay right-aligned, everyone
316
- * else's are named, and a named agent replaces the agent label.
317
- */
318
- export declare function ChatMessages({ messages, messageSize, chrome, models, renderMarkdown, renderExtras, durableCards, userLabel, agentLabel, loading, turnPhase, approval, onToolCallClick, toolRenderers, error, onRetry, renderEmpty, emptyState, header, resolveAttachmentUrl, workProductCards, viewerId, }: ChatMessagesProps): import("react").JSX.Element;
74
+ export * from './chat-message-types';
75
+ export * from './chat-message-metrics';
76
+ export * from './run-drill-in';
77
+ export * from './chat-empty-state';
78
+ export { pendingApprovalOf, chatToolCallPart } from './chat-tool-call';
79
+ export { ChatMessages, useThinkingSeconds } from './chat-messages';
319
80
  export * from './api-access-panel';
320
81
  export * from './agent-setup-block';
321
82
  export * from './agent-settings-popover';
@@ -42,6 +42,7 @@ import {
42
42
  ReviewInbox,
43
43
  RunDrillIn,
44
44
  SeatPaywall,
45
+ SessionHistoryPanel,
45
46
  Sparkline,
46
47
  TurnProgress,
47
48
  __resetAttachmentFileCacheForTests,
@@ -69,6 +70,7 @@ import {
69
70
  formatInsightDelta,
70
71
  formatModelCost,
71
72
  formatRecordGridValue,
73
+ formatSessionTimestamp,
72
74
  formatSparklineValue,
73
75
  formatTokensPerSecond,
74
76
  getChatFundingRecovery,
@@ -128,6 +130,8 @@ import {
128
130
  useChatScroll,
129
131
  useDurablePlanFlow,
130
132
  useFileMentions,
133
+ useSessionActions,
134
+ useSessionHistory,
131
135
  useSmoothText,
132
136
  useThinkingSeconds,
133
137
  validateRecordGridCell,
@@ -141,17 +145,13 @@ import {
141
145
  withoutRecordGridCreated,
142
146
  withoutRecordGridRemoved,
143
147
  withoutRecordGridUpdate
144
- } from "../chunk-FJEGGUOQ.js";
148
+ } from "../chunk-BGDQ7245.js";
145
149
  import {
146
150
  MENTION_PILL_CLASS
147
151
  } from "../chunk-3HUFJ5LO.js";
148
152
  import {
149
- SessionHistoryPanel,
150
- formatSessionTimestamp,
151
- useInfiniteScroll,
152
- useSessionActions,
153
- useSessionHistory
154
- } from "../chunk-35APKGPB.js";
153
+ useInfiniteScroll
154
+ } from "../chunk-BDEBQ4WO.js";
155
155
  import "../chunk-FBVLEGEG.js";
156
156
  import {
157
157
  EvidenceLineageTable,
@@ -181,13 +181,12 @@ import {
181
181
  preloadWhenIdle,
182
182
  useComposerAttachments,
183
183
  useDictation
184
- } from "../chunk-BNFUJNPS.js";
184
+ } from "../chunk-A77IBQ7S.js";
185
185
  import "../chunk-L7MB2LLM.js";
186
186
  import {
187
187
  WorkspaceInitial,
188
188
  WorkspaceSwitcher
189
- } from "../chunk-3K45OQ5X.js";
190
- import "../chunk-A2GG4D4A.js";
189
+ } from "../chunk-ZDPUC6CM.js";
191
190
  import {
192
191
  WorkspacePrewarmContext,
193
192
  requestWorkspacePrewarm,
@@ -203,7 +202,7 @@ import {
203
202
  AGENT_PROFILE_EDITOR_SECTIONS,
204
203
  AgentProfileEditor,
205
204
  AgentProfileRegistryError
206
- } from "../chunk-4JAXSEYW.js";
205
+ } from "../chunk-DLVMKDFX.js";
207
206
  import {
208
207
  AgentSessionControls,
209
208
  AgentSettingsPopover,
@@ -213,8 +212,8 @@ import {
213
212
  filterAcceptedFiles,
214
213
  isAcceptedFileType,
215
214
  renamePastedImages
216
- } from "../chunk-232KA6MR.js";
217
- import "../chunk-JYVUFRRV.js";
215
+ } from "../chunk-CI53V6DD.js";
216
+ import "../chunk-FUZETA6Z.js";
218
217
  import {
219
218
  DEFAULT_EFFORT_LEVELS,
220
219
  EFFORT_METER_SEGMENTS,
@@ -232,7 +231,7 @@ import {
232
231
  reconcileEffortLevels,
233
232
  usePending,
234
233
  usePopover
235
- } from "../chunk-XIN7DOAB.js";
234
+ } from "../chunk-R4X5474U.js";
236
235
  import {
237
236
  ReviewFeedbackForm
238
237
  } from "../chunk-ATQQCG4I.js";
@@ -0,0 +1,31 @@
1
+ import { type RecordGridColumn, type RecordGridValue } from './record-grid-model';
2
+ interface CellEditorProps {
3
+ column: RecordGridColumn;
4
+ rowLabel: string;
5
+ text: string;
6
+ invalid: boolean;
7
+ describedBy?: string;
8
+ onText: (text: string) => void;
9
+ onCommit: (text: string) => void;
10
+ onCancel: () => void;
11
+ }
12
+ /** The in-cell control for one edit. Enter commits, Escape cancels, blur
13
+ * commits — the editor never disappears without deciding. */
14
+ export declare function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCommit, onCancel }: CellEditorProps): import("react").JSX.Element;
15
+ interface AddRecordFormProps {
16
+ columns: readonly RecordGridColumn[];
17
+ draft: Record<string, RecordGridValue>;
18
+ setDraft: (next: Record<string, RecordGridValue>) => void;
19
+ errors: Readonly<Record<string, string>>;
20
+ formError: string | null;
21
+ busy: boolean;
22
+ label: string;
23
+ fieldPrefix: string;
24
+ onSubmit: () => void;
25
+ onCancel: () => void;
26
+ }
27
+ /** The inline add form. Every control is labelled, every rejection names its
28
+ * field, and a column whose `dependsOn` is unsatisfied is not rendered — the
29
+ * nested sub-form case. */
30
+ export declare function AddRecordForm({ columns, draft, setDraft, errors, formError, busy, label, fieldPrefix, onSubmit, onCancel, }: AddRecordFormProps): import("react").JSX.Element;
31
+ export {};