@tangle-network/agent-app 0.10.1 → 0.11.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.
@@ -1,5 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
+ import { S as StepAgentActivity } from '../agent-activity-C8ZG0F0M.js';
4
+ import { FlowTrace } from '../trace/index.js';
3
5
  import { C as CatalogModel } from '../model-catalog-BEAEVDaa.js';
4
6
 
5
7
  /**
@@ -119,6 +121,82 @@ declare function nextRevealCount(shown: number, targetLength: number, dtMs: numb
119
121
  */
120
122
  declare function useSmoothText(target: string, enabled: boolean, opts?: SmoothRevealOptions): string;
121
123
 
124
+ type ActivityTone = 'live' | 'ok' | 'error' | 'neutral';
125
+ /** Map a delegation status (free-form string on the wire) to a render tone. */
126
+ declare function activityTone(status: string): ActivityTone;
127
+ /** "$0.4000" under a cent shows 4 decimals; null when unknown/zero. */
128
+ declare function formatActivityCost(costUsd?: number): string | null;
129
+ /** "8s" / "2m 05s" / "1h 12m"; null when unknown. */
130
+ declare function formatActivityDuration(durationMs?: number): string | null;
131
+ /** A delegation record on the cross-context surface; `missionRef` links a
132
+ * promoted delegation back to the mission/step that spawned it. */
133
+ interface AgentActivityRecord extends StepAgentActivity {
134
+ missionRef?: {
135
+ missionId: string;
136
+ stepId?: string;
137
+ label?: string;
138
+ };
139
+ }
140
+ interface AgentActivityPage {
141
+ items: AgentActivityRecord[];
142
+ /** Opaque continuation token; absent ⇒ no further pages. */
143
+ nextCursor?: string;
144
+ }
145
+ /**
146
+ * Fold a fetched page into the held rows: dedupe by `taskId` with the
147
+ * incoming row winning (a refresh re-fetches the head page, so newer
148
+ * snapshots of in-flight runs replace stale ones), newest `startedAt` first.
149
+ */
150
+ declare function mergeActivityPages(existing: AgentActivityRecord[], incoming: AgentActivityRecord[]): AgentActivityRecord[];
151
+ interface WaterfallRow {
152
+ name: string;
153
+ kind: 'pipeline' | 'model' | 'tool';
154
+ /** Bar geometry as percentages of the trace's total span. */
155
+ offsetPct: number;
156
+ widthPct: number;
157
+ durationLabel: string;
158
+ approx: boolean;
159
+ /** False only when the span's meta carries an explicit failure. */
160
+ ok: boolean;
161
+ }
162
+ /** Project a FlowTrace into proportional bar geometry for {@link FlowWaterfall}. */
163
+ declare function waterfallLayout(trace: FlowTrace): WaterfallRow[];
164
+ interface FlowWaterfallProps {
165
+ trace: FlowTrace;
166
+ }
167
+ /** Compact proportional waterfall over a FlowTrace — span name, bar, duration
168
+ * per row; total + cost in the footer. */
169
+ declare function FlowWaterfall({ trace }: FlowWaterfallProps): react.JSX.Element | null;
170
+ interface MissionActivityLaneProps {
171
+ /** The step's delegated-run snapshot (`MissionStepState.agentActivity`). */
172
+ activity: StepAgentActivity[];
173
+ /** Epoch ms origin for the expanded waterfall — usually the step start. */
174
+ startedAt?: number;
175
+ /** Wall clock for extending in-flight runs on the waterfall. */
176
+ nowMs?: number;
177
+ }
178
+ /**
179
+ * Collapsed sub-rows under a mission step — one row per delegated run —
180
+ * expanding to the step's waterfall. Renders nothing for an empty lane.
181
+ */
182
+ declare function MissionActivityLane({ activity, startedAt, nowMs }: MissionActivityLaneProps): react.JSX.Element | null;
183
+ interface AgentActivityPanelProps {
184
+ /** Data port — page through the product's delegation records. Called with
185
+ * no cursor on mount/refresh, with `nextCursor` for older pages. */
186
+ fetchActivity: (cursor?: string) => Promise<AgentActivityPage>;
187
+ /** Render the mission link for a promoted delegation (chip, anchor, router
188
+ * Link — the product's routing, not ours). */
189
+ renderMissionRef?: (ref: NonNullable<AgentActivityRecord['missionRef']>, record: AgentActivityRecord) => ReactNode;
190
+ title?: string;
191
+ emptyLabel?: string;
192
+ }
193
+ /**
194
+ * The standalone cross-context delegation surface: every agent run the
195
+ * product journaled, mission-spawned or not, with status, cost, drill-in, and
196
+ * a mission link slot for promoted delegations.
197
+ */
198
+ declare function AgentActivityPanel({ fetchActivity, renderMissionRef, title, emptyLabel }: AgentActivityPanelProps): react.JSX.Element;
199
+
122
200
  interface ChatMessageMetrics {
123
201
  modelUsed?: string;
124
202
  promptTokens?: number;
@@ -239,4 +317,4 @@ type ToolDetailRenderers = Record<string, (call: ChatToolCallInfo, message: Chat
239
317
  */
240
318
  declare function ChatMessages({ messages, models, renderMarkdown, renderExtras, userLabel, agentLabel, loading, approval, onToolCallClick, toolRenderers, }: ChatMessagesProps): react.JSX.Element;
241
319
 
242
- export { type ChatMessageMetrics, ChatMessages, type ChatMessagesProps, type ChatStreamCallbacks, type ChatStreamToolCall, type ChatStreamToolResult, type ChatToolCallInfo, type ChatUiMessage, type ConsumeChatStreamResult, EffortPicker, type EffortPickerProps, ModelPicker, type ModelPickerProps, type ProposalApprovalHandlers, ProviderLogo, type ProviderLogoProps, RunDrillIn, type RunDrillInProps, type SmoothRevealOptions, type StreamChatOptions, type ToolDetailRenderers, type ToolRunRecord, type ToolRunStep, consumeChatStream, dispatchChatStreamLine, formatModelCost, formatTokensPerSecond, nextRevealCount, pendingApprovalOf, streamChatTurn, useSmoothText };
320
+ export { type ActivityTone, type AgentActivityPage, AgentActivityPanel, type AgentActivityPanelProps, type AgentActivityRecord, type ChatMessageMetrics, ChatMessages, type ChatMessagesProps, type ChatStreamCallbacks, type ChatStreamToolCall, type ChatStreamToolResult, type ChatToolCallInfo, type ChatUiMessage, type ConsumeChatStreamResult, EffortPicker, type EffortPickerProps, FlowWaterfall, type FlowWaterfallProps, MissionActivityLane, type MissionActivityLaneProps, ModelPicker, type ModelPickerProps, type ProposalApprovalHandlers, ProviderLogo, type ProviderLogoProps, RunDrillIn, type RunDrillInProps, type SmoothRevealOptions, type StreamChatOptions, type ToolDetailRenderers, type ToolRunRecord, type ToolRunStep, type WaterfallRow, activityTone, consumeChatStream, dispatchChatStreamLine, formatActivityCost, formatActivityDuration, formatModelCost, formatTokensPerSecond, mergeActivityPages, nextRevealCount, pendingApprovalOf, streamChatTurn, useSmoothText, waterfallLayout };