@mgamadeus/ddd-agents 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +76 -0
  2. package/dist/admin.js +2 -2
  3. package/dist/chat.js +1303 -409
  4. package/dist/chat.js.map +1 -1
  5. package/dist/chunks/{agents-http-trace-mappers-LWNi-3a4.js → agents-http-trace-mappers-juBx_kw5.js} +64 -22
  6. package/dist/chunks/agents-http-trace-mappers-juBx_kw5.js.map +1 -0
  7. package/dist/chunks/{canvas-title-slot-context-BRGnFzYP.js → canvas-label-context-B54MYVLF.js} +16 -4
  8. package/dist/chunks/canvas-label-context-B54MYVLF.js.map +1 -0
  9. package/dist/chunks/{content-from-unified-diff-CovnmG2Q.js → content-from-unified-diff-lgH6CejC.js} +77 -46
  10. package/dist/chunks/content-from-unified-diff-lgH6CejC.js.map +1 -0
  11. package/dist/chunks/{contract-886XjdID.js → contract-CIXLnSqL.js} +2 -1
  12. package/dist/chunks/{contract-886XjdID.js.map → contract-CIXLnSqL.js.map} +1 -1
  13. package/dist/chunks/conversation-B7-evdj_.js.map +1 -1
  14. package/dist/chunks/conversation-trace-fVeh6Lg6.js +6 -0
  15. package/dist/chunks/conversation-trace-fVeh6Lg6.js.map +1 -0
  16. package/dist/chunks/index-DZovGMpG.js.map +1 -1
  17. package/dist/client.js +13 -8
  18. package/dist/client.js.map +1 -1
  19. package/dist/contract.js +3 -1
  20. package/dist/contract.js.map +1 -1
  21. package/dist/files/i18n-keys.json +496 -12
  22. package/dist/files/styles/_surfaces.scss +5 -0
  23. package/dist/renderer.js +10 -8
  24. package/dist/styles.css +920 -39
  25. package/dist/types/chat/CanvasResizeHandle/CanvasResizeHandle.d.ts +2 -0
  26. package/dist/types/chat/CanvasResizeHandle/use-canvas-resize.d.ts +4 -2
  27. package/dist/types/chat/ConversationMessage/ConversationCallMarkerChip/ConversationCallMarkerChip.d.ts +6 -1
  28. package/dist/types/chat/ConversationMessageList/ConversationMessageList.d.ts +8 -1
  29. package/dist/types/chat/ConversationMessageList/message-times.d.ts +55 -0
  30. package/dist/types/chat/ConversationView.d.ts +3 -0
  31. package/dist/types/chat/ConversationViewBody/ConversationViewBody.d.ts +3 -0
  32. package/dist/types/chat/canvas-layout.d.ts +13 -0
  33. package/dist/types/chat/controller/AgentChatController.d.ts +7 -0
  34. package/dist/types/chat/trace/TaskPlanDrawer.d.ts +45 -0
  35. package/dist/types/chat/trace/TaskPlanPane.d.ts +21 -12
  36. package/dist/types/chat/trace/ToolStepGroup.d.ts +2 -0
  37. package/dist/types/chat/trace/TraceViewModeSwitch.d.ts +10 -2
  38. package/dist/types/chat/trace/index.d.ts +4 -1
  39. package/dist/types/chat/trace/task-plan-tree.d.ts +55 -0
  40. package/dist/types/chat/trace/trace-collect.d.ts +15 -0
  41. package/dist/types/chat/trace/trace-types.d.ts +20 -0
  42. package/dist/types/chat/trace/trace-view-policy.d.ts +17 -0
  43. package/dist/types/client/http/agents-http-trace-mappers.d.ts +8 -1
  44. package/dist/types/client/http/agents-http-trace-wire.d.ts +27 -0
  45. package/dist/types/client/http/agents-http-wire.d.ts +4 -0
  46. package/dist/types/contract/conversation-trace.d.ts +63 -1
  47. package/dist/types/contract/conversation.d.ts +11 -0
  48. package/dist/types/entries/chat.d.ts +1 -0
  49. package/dist/types/entries/renderer.d.ts +1 -0
  50. package/dist/types/provider/components/types.d.ts +5 -0
  51. package/dist/types/provider/environment.d.ts +26 -0
  52. package/dist/types/provider/index.d.ts +1 -1
  53. package/dist/types/renderer/canvas/canvas-label-context.d.ts +10 -0
  54. package/package.json +1 -1
  55. package/public-api.json +40 -0
  56. package/dist/chunks/agents-http-trace-mappers-LWNi-3a4.js.map +0 -1
  57. package/dist/chunks/canvas-title-slot-context-BRGnFzYP.js.map +0 -1
  58. package/dist/chunks/content-from-unified-diff-CovnmG2Q.js.map +0 -1
@@ -2,6 +2,8 @@ import { RefObject } from "react";
2
2
  export interface CanvasResizeHandleProps {
3
3
  rootRef: RefObject<HTMLElement | null>;
4
4
  inset: number;
5
+ /** The narrowest the chat column gets (`AgentsCanvasLayout.chatColumnMinWidthPx`); default `CHAT_COLUMN_MIN_WIDTH_PX`. */
6
+ chatColumnMinWidthPx?: number;
5
7
  width: number | null;
6
8
  onWidthChange: (width: number | null) => void;
7
9
  onClose: () => void;
@@ -2,16 +2,18 @@ import { KeyboardEvent, PointerEvent as ReactPointerEvent, RefObject } from "rea
2
2
  /** `idle` (hidden until the pointer comes near), `hover`, `drag`, `armed` (pulled past the narrowest and held: release closes). */
3
3
  export type CanvasResizeTab = "idle" | "hover" | "drag" | "armed";
4
4
  export declare const rubberBand: (distance: number) => number;
5
- export declare const canvasWidthLimits: (rootWidth: number, inset: number) => {
5
+ export declare const canvasWidthLimits: (rootWidth: number, inset: number, chatColumnMinWidthPx?: number) => {
6
6
  min: number;
7
7
  max: number;
8
8
  };
9
- export declare const clampCanvasWidth: (width: number, rootWidth: number, inset: number) => number;
9
+ export declare const clampCanvasWidth: (width: number, rootWidth: number, inset: number, chatColumnMinWidthPx?: number) => number;
10
10
  interface UseCanvasResizeOptions {
11
11
  /** The split's root: the canvas pane's right edge is its right edge, and `--agents-canvas-width-drag` is written onto it while dragging. */
12
12
  rootRef: RefObject<HTMLElement | null>;
13
13
  /** The canvas card's inset from its pane edge — the handle sits on the card's edge. */
14
14
  inset: number;
15
+ /** The narrowest the chat column gets beside the canvas; default `CHAT_COLUMN_MIN_WIDTH_PX`. */
16
+ chatColumnMinWidthPx?: number;
15
17
  /** The pane width the customer set (px), or `null` for the canvas's default split. */
16
18
  width: number | null;
17
19
  onWidthChange: (width: number | null) => void;
@@ -4,6 +4,11 @@ export interface ConversationCallMarkerChipProps {
4
4
  signalSource: string;
5
5
  /** The signal's model-visible text — carries the duration as `NNNs` and the end reason as `reason <value>`. */
6
6
  signalText: string;
7
+ /**
8
+ * When the signal was written (ms). Given, every marker but "ended" names its clock time ("Voice chat started · 21:05"):
9
+ * the marker is the time head of what follows. Omitted: no time, as before.
10
+ */
11
+ moment?: number | null;
7
12
  }
8
13
  /**
9
14
  * Centered marker for a call's lifecycle inside the chat timeline: started, ended (with its duration), declined, missed
@@ -11,4 +16,4 @@ export interface ConversationCallMarkerChipProps {
11
16
  * from the otherwise user-invisible PHONE_CALL_* SIGNAL messages — the label derives from the signal source + the small text contract of AgentVoiceCall::buildLifecycleSignalText (`In-app call …` vs
12
17
  * `Phone call …`, duration `NNNs`, reason `reason <value>`); an unparsable text degrades to the plain label.
13
18
  */
14
- export declare const ConversationCallMarkerChip: React.MemoExoticComponent<({ signalSource, signalText }: ConversationCallMarkerChipProps) => import("react/jsx-runtime").JSX.Element>;
19
+ export declare const ConversationCallMarkerChip: React.MemoExoticComponent<({ signalSource, signalText, moment }: ConversationCallMarkerChipProps) => import("react/jsx-runtime").JSX.Element>;
@@ -3,6 +3,7 @@ import React from "react";
3
3
  import { ConversationMessageUserTheme } from "../ConversationMessage/ConversationMessageUser/ConversationMessageUser";
4
4
  import { ConversationErrorType } from "../store/conversation-error-type";
5
5
  import type { ChatMessage } from "../chat-message";
6
+ import { type MessageTimesMode } from "./message-times";
6
7
  import { Ref, RefObject } from "react";
7
8
  interface ConversationMessageListProps {
8
9
  className?: string;
@@ -64,6 +65,12 @@ interface ConversationMessageListProps {
64
65
  renderAssistantAvatar?: (message: ChatMessage) => React.ReactNode;
65
66
  /** The backend refuses every widget signal of a closed conversation, so no widget renders its controls. */
66
67
  isConversationClosed?: boolean;
68
+ /**
69
+ * When what was written (`message-times.ts`): `turns` = day separators, a time head after a pause of 20 minutes,
70
+ * "finished HH:MM" under a long turn's answer, the exact time of each message on hover / focus / tap; `everyMessage`
71
+ * adds a quiet time under every message (a verbose view). Undefined / null: no times, as before.
72
+ */
73
+ messageTimes?: MessageTimesMode | null;
67
74
  }
68
75
  /**
69
76
  * The id of the newest widget-carrying assistant-role message the owner has not answered yet — null when the newest
@@ -76,5 +83,5 @@ export declare const findUnansweredWidgetMessageId: (messages: ChatMessage[]) =>
76
83
  * widget of the same name. Pure, order-based: the newest widget of a type is the live one.
77
84
  */
78
85
  export declare const findSupersededWidgetMessageIds: (messages: ChatMessage[]) => Set<string | number>;
79
- export declare const ConversationMessageList: ({ className, messages, currentCategory, aiPromptExtension, isDebugMode, aiThinking, thinkingIndicator, hideAssistantMeta, userMessageTheme, error, rateLimitRetryAfterSeconds, onRetryFailedRun, messagesBottomRef, messagesListRef, enableFreshMessageBlockReveal, taskInstructionMessageId, renderAfterMessage, renderAssistantAvatar, isConversationClosed, }: ConversationMessageListProps) => import("react/jsx-runtime").JSX.Element;
86
+ export declare const ConversationMessageList: ({ className, messages, currentCategory, aiPromptExtension, isDebugMode, aiThinking, thinkingIndicator, hideAssistantMeta, userMessageTheme, error, rateLimitRetryAfterSeconds, onRetryFailedRun, messagesBottomRef, messagesListRef, enableFreshMessageBlockReveal, taskInstructionMessageId, renderAfterMessage, renderAssistantAvatar, isConversationClosed, messageTimes, }: ConversationMessageListProps) => import("react/jsx-runtime").JSX.Element;
80
87
  export {};
@@ -0,0 +1,55 @@
1
+ import type { ChatMessage } from "../chat-message";
2
+ /**
3
+ * When what was written in the chat: the day separators, the time heads after a pause, the "finished HH:MM" under a
4
+ * long turn's answer and the exact time of each message.
5
+ *
6
+ * - `turns` (B): a separator before the first message of each day ("Today · 09:58"; without the time when a voice chat
7
+ * marker opens the day, it shows its own), a time head ("10:31") before a message that starts a turn more than
8
+ * {@link MESSAGE_TIME_PAUSE_MS} after the message before it. The agent's own steps and run time never cause one: the
9
+ * answer stays with its question, and a turn that took longer than the pause ends with "finished 10:24" under its
10
+ * answer. The exact time of each message on hover / keyboard focus, on touch by a tap.
11
+ * - `everyMessage` (C): `turns` plus a quiet time under every message.
12
+ */
13
+ export type MessageTimesMode = "turns" | "everyMessage";
14
+ /** The pause between two messages after which the next turn gets a time head, and the turn length that earns "finished". */
15
+ export declare const MESSAGE_TIME_PAUSE_MS: number;
16
+ /** What stands at one message of the list (by its index); every field is absent when nothing does. */
17
+ export interface MessageTimeMarks {
18
+ /** The message's moment (ms); null for a message without one (the owner's message before the server stored it). */
19
+ moment: number | null;
20
+ /** A day separator stands before the message; `withTime` names the time in it ("Today · 09:58"). */
21
+ daySeparator?: {
22
+ withTime: boolean;
23
+ };
24
+ /** A time head stands before the message (a turn after a pause). */
25
+ timeHead?: boolean;
26
+ /** "finished HH:MM" stands under the message: the last answer of a turn that ran longer than the pause. */
27
+ finishedAt?: number;
28
+ }
29
+ /** A voice chat (phone call) lifecycle marker: the list shows it as a centred chip that carries its own time. */
30
+ export declare const isCallMarkerMessage: (message: ChatMessage) => boolean;
31
+ /**
32
+ * The time marks of a message list (pure). `isShown` says which messages the list renders as a row; `dayKeyOf` maps a
33
+ * moment to its calendar day in the owner's time zone; `isTurnRunning` keeps the newest turn open (no "finished" before
34
+ * it ended).
35
+ */
36
+ export declare const buildMessageTimeMarks: (messages: readonly ChatMessage[], isShown: (message: ChatMessage) => boolean, dayKeyOf: (moment: number) => string, isTurnRunning: boolean) => MessageTimeMarks[];
37
+ /** The words and figures of the message times in the owner's locale and time zone. */
38
+ export interface MessageTimeFormat {
39
+ /** The clock time of a moment: `09:58`. */
40
+ time: (moment: number) => string;
41
+ /** The exact moment with the zone: `Mo., 30. Nov. 2026, 09:58:14 MEZ`. */
42
+ exact: (moment: number) => string;
43
+ /** The day of a moment for a separator: `Today`, `Yesterday`, `Mo., 24. Nov.`, `24. Nov. 2025` (another year). */
44
+ day: (moment: number) => string;
45
+ /** The calendar day of a moment in the owner's time zone, as a key (`2026-11-30`). */
46
+ dayKey: (moment: number) => string;
47
+ /** "finished 10:24". */
48
+ finished: (moment: number) => string;
49
+ }
50
+ /** Builds the formatters (undefined locale / zone: the runtime's). `now` is injected for tests. */
51
+ export declare const createMessageTimeFormat: (locale?: string | null, timeZone?: string | null, now?: () => number) => MessageTimeFormat;
52
+ /** The formatters of the owner's locale and time zone (`AgentsEnvironment.useOwnerSettings`), else the runtime's. */
53
+ export declare const useMessageTimeFormat: () => MessageTimeFormat;
54
+ /** `252` → `4:12 min`: the length of a voice chat, compact as the chat's marker shows it. */
55
+ export declare const formatCallLength: (durationSeconds: number) => string;
@@ -1,5 +1,6 @@
1
1
  import type { ChatAssistantCategory, ChatAssistantIdentity, ChatAssistantOpening } from "./chat-assistant-identity";
2
2
  import React from "react";
3
+ import type { MessageTimesMode } from "./ConversationMessageList/message-times";
3
4
  import { ConversationErrorType } from "./store/conversation-error-type";
4
5
  import type { ChatMessage } from "./chat-message";
5
6
  import { ConversationMessageUserTheme } from "./ConversationMessage/ConversationMessageUser/ConversationMessageUser";
@@ -221,6 +222,8 @@ export interface ConversationViewProps {
221
222
  renderAssistantAvatar?: (message: ChatMessage) => React.ReactNode;
222
223
  /** Forwarded through ConversationViewBody to ConversationMessageList: a closed conversation renders no widget controls. */
223
224
  isConversationClosed?: boolean;
225
+ /** Forwarded through ConversationViewBody to ConversationMessageList: when what was written (`MessageTimesMode`). */
226
+ messageTimes?: MessageTimesMode | null;
224
227
  onSuggestionClick: (text: string) => void;
225
228
  onSendMessage: SendMessageHandler;
226
229
  }
@@ -6,6 +6,7 @@ import type { ConversationComposerWidget } from "../../renderer/conversation-com
6
6
  import { SendMessageHandler } from "../conversation-send-message";
7
7
  import { ConversationErrorType } from "../store/conversation-error-type";
8
8
  import type { ChatMessage } from "../chat-message";
9
+ import type { MessageTimesMode } from "../ConversationMessageList/message-times";
9
10
  import { ConversationMessageUserTheme } from "../ConversationMessage/ConversationMessageUser/ConversationMessageUser";
10
11
  export interface ConversationViewProps {
11
12
  currentCategory?: ChatAssistantCategory;
@@ -222,6 +223,8 @@ export interface ConversationViewProps {
222
223
  renderAssistantAvatar?: (message: ChatMessage) => React.ReactNode;
223
224
  /** Forwarded to ConversationMessageList: a closed conversation renders no widget controls. */
224
225
  isConversationClosed?: boolean;
226
+ /** Forwarded to ConversationMessageList: when what was written (`MessageTimesMode`). */
227
+ messageTimes?: MessageTimesMode | null;
225
228
  onSuggestionClick: (text: string) => void;
226
229
  onSendMessage: SendMessageHandler;
227
230
  }
@@ -0,0 +1,13 @@
1
+ import type { AgentsCanvasLayout } from "../provider/environment";
2
+ /** `AgentsCanvasLayout` with every member set: the host's value, else the package's own chrome. */
3
+ export interface ResolvedCanvasLayout {
4
+ readonly showsCloseButton: boolean;
5
+ readonly showsDividerToggle: boolean;
6
+ readonly showsNarrowReopenControl: boolean;
7
+ readonly chatColumnMinWidthPx: number;
8
+ readonly boxedInsetPx: number;
9
+ readonly paneSurface: "card" | "none";
10
+ }
11
+ export declare const resolveCanvasLayout: (layout: AgentsCanvasLayout | undefined) => ResolvedCanvasLayout;
12
+ /** The canvas layout of this subtree's environment (`AgentsEnvironment.canvasLayout`). */
13
+ export declare const useCanvasLayout: () => ResolvedCanvasLayout;
@@ -4,6 +4,7 @@ import { type ConversationAttachmentReference } from "../../contract/conversatio
4
4
  import type { ChatMessage } from "../chat-message";
5
5
  import type { ConversationComposerWidget } from "../../renderer/conversation-composer-widget";
6
6
  import type { ComposerLibraryFile } from "../../renderer/composer-library-file";
7
+ import type { MessageTimesMode } from "../ConversationMessageList/message-times";
7
8
  import type { AgentsChatStore } from "../store/create-agents-chat-store";
8
9
  import { type AgentChatActivityTiming, type ResolvedAgentChatActivityTiming } from "./chat-activity-timing";
9
10
  import type { ChatScrollTarget } from "./chat-scroll-target";
@@ -169,6 +170,12 @@ export interface AgentChatControllerProps {
169
170
  * ends: the agent reads them after its current step. Default false.
170
171
  */
171
172
  showsQueuedMessages?: boolean;
173
+ /**
174
+ * When what was written in the thread (`MessageTimesMode`): `turns` = day separators, a time head after a pause,
175
+ * "finished HH:MM" under a long turn's answer, the exact time on hover / focus / tap; `everyMessage` adds a quiet time
176
+ * under every message (e.g. the host's verbose view). Default: none.
177
+ */
178
+ messageTimes?: MessageTimesMode | null;
172
179
  /** Rendered inside the chat's widget provider (the host's canvas syncs). */
173
180
  children?: ReactNode;
174
181
  /**
@@ -0,0 +1,45 @@
1
+ import type { TaskPlanTree, TaskPlanTreeNode } from "./task-plan-tree";
2
+ import type { TraceTaskPlanItemSource, TraceTaskPlanRejection } from "./trace-collect";
3
+ /** What the detail view shows: the plan, or one item by its key. */
4
+ export type TaskPlanDetailTarget = {
5
+ kind: "plan";
6
+ } | {
7
+ kind: "item";
8
+ key: string;
9
+ };
10
+ export interface TaskPlanDrawerProps {
11
+ target: TaskPlanDetailTarget;
12
+ tree: TaskPlanTree;
13
+ /** The plan's title: the request it was made for. */
14
+ title?: string | null;
15
+ /** Per item key, the plan update that last changed it and the one it first appeared in. */
16
+ itemSources?: Readonly<Record<string, TraceTaskPlanItemSource>>;
17
+ itemFirstSources?: Readonly<Record<string, TraceTaskPlanItemSource>>;
18
+ /** Debug level: what refused plan calls told the agent. */
19
+ rejections?: readonly TraceTaskPlanRejection[];
20
+ /** When the plan was last updated (a server date-time). */
21
+ updatedAt?: string | null;
22
+ onNavigate: (target: TaskPlanDetailTarget) => void;
23
+ onClose: () => void;
24
+ /** Leads to the plan update in the trace; without it the times are plain text. */
25
+ onShowSource?: (node: TaskPlanTreeNode, source: TraceTaskPlanItemSource) => void;
26
+ }
27
+ /** The state mark of an item: a ring, filled to the closed share for an open container. */
28
+ export declare const TaskPlanMark: ({ node }: {
29
+ node: TaskPlanTreeNode;
30
+ }) => import("react/jsx-runtime").JSX.Element;
31
+ /** The leaves of nodes as small segments, one per leaf, coloured by its state. */
32
+ export declare const TaskPlanSegments: ({ nodes, isSmall }: {
33
+ nodes: readonly TaskPlanTreeNode[];
34
+ isSmall?: boolean;
35
+ }) => import("react/jsx-runtime").JSX.Element;
36
+ /**
37
+ * The detail view of the work plan, for the plan or for one item. The plan: its goal (the request it was made for),
38
+ * its progress with the counts, its result once finished (every step with its note), when it was made and changed and
39
+ * where its items came from. An item: its state with the note (what was produced, why it is blocked, why it does not
40
+ * apply) and whether it waits for the owner, its subtasks with their part progress, when it is done (by its subtasks,
41
+ * by the record, by the agent's tick), its origin and times; at the debug level the agent's instruction, the seeded
42
+ * declarations and the rejected plan changes that name it. The head leads back to the plan, up to the parent and to the
43
+ * item before and after it in the plan.
44
+ */
45
+ export declare const TaskPlanDrawer: (props: TaskPlanDrawerProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,31 +1,40 @@
1
- import type { ReactNode } from "react";
2
- import type { TraceTaskPlanItemSource } from "./trace-collect";
1
+ import { type ReactNode } from "react";
2
+ import { type TaskPlanDetailTarget } from "./TaskPlanDrawer";
3
+ import type { TraceTaskPlanItemSource, TraceTaskPlanRejection } from "./trace-collect";
3
4
  import type { TraceTaskPlanStepItem } from "./trace-types";
4
5
  export interface TaskPlanPaneProps {
5
- /** The plan's own title ("Support.Ticket"); it follows the word "Plan". */
6
+ /** The plan's own title (the request it was made for); it heads the pane. */
6
7
  title?: string | null;
7
- /** The items in the plan's order; without them the pane shows the counts alone. */
8
+ /** The items in the plan's order, each with its `depth`; without them the pane shows the counts alone. */
8
9
  items: TraceTaskPlanStepItem[];
9
10
  /**
10
- * Top-level items of the plan, how many of them are done or do not apply, and how many are blocked (never counted
11
- * done). Default: counted from the top-level `items`.
11
+ * Top-level items of the plan, how many of them are done or do not apply, and how many are blocked: the counts of a
12
+ * plan whose items the reader does not have. With items the pane counts their leaves.
12
13
  */
13
14
  itemCount?: number | null;
14
15
  doneCount?: number | null;
15
16
  blockedCount?: number | null;
16
- /** A quiet line under the head (the turn that last updated the plan). */
17
+ /** A quiet line under the title (the turn that last updated the plan). */
17
18
  note?: ReactNode;
18
19
  /**
19
- * Per item key, the plan update that last changed the item (`TraceTaskPlanSnapshot.itemSources`). With
20
- * `onSelectItem` an item that has one is a button: it leads to that step in the trace (`focusTraceStep`).
20
+ * Per item key, the plan update that last changed the item (`TraceTaskPlanSnapshot.itemSources`) and the one it first
21
+ * appeared in: the times of the detail view. With `onSelectItem` the detail view leads to that step in the trace.
21
22
  */
22
23
  itemSources?: Readonly<Record<string, TraceTaskPlanItemSource>>;
24
+ itemFirstSources?: Readonly<Record<string, TraceTaskPlanItemSource>>;
23
25
  onSelectItem?: (item: TraceTaskPlanStepItem, source: TraceTaskPlanItemSource) => void;
26
+ /** Debug level: what refused plan calls told the agent (`TraceTaskPlanSnapshot.rejections`). */
27
+ rejections?: readonly TraceTaskPlanRejection[];
28
+ /** The detail view a host opens the pane on (a deep link); default none. */
29
+ defaultDetail?: TaskPlanDetailTarget | null;
24
30
  className?: string;
25
31
  }
26
32
  /**
27
- * The task plan of a conversation as it stands, for a pane beside the chat: "Plan · title", how many items are done
28
- * and blocked ("4 of 5 done · 1 blocked") with a meter of the done ones, and every item with its number, its text and its state (done, does not apply, blocked, up next —
29
- * the first open item — or not started). Nested items are indented by their depth.
33
+ * The task plan of a conversation as it stands, for a pane beside the chat. Its head names the plan and its progress
34
+ * over all steps ("6 of 9 done · step 2 of 3", a segment per step), then the plan as a tree: every container shows its
35
+ * part progress ("4/5") and folds; the path of the running step and of a blocked one is open, closed branches are
36
+ * folded. Every item shows its state (done, does not apply, blocked — "waits for you" when only the owner can lift it —,
37
+ * in progress or not started) and the note of a running or blocked step. A click on an item opens its detail view,
38
+ * "Plan details" the plan's ({@link TaskPlanDrawer}): beside the tree in a wide pane, in its place in a narrow one.
30
39
  */
31
40
  export declare const TaskPlanPane: (props: TaskPlanPaneProps) => import("react/jsx-runtime").JSX.Element;
@@ -50,6 +50,8 @@ export interface ToolStepGroupProps {
50
50
  isCompact?: boolean;
51
51
  className?: string;
52
52
  }
53
+ /** A turn shorter than this shows no length on its steps head (outside the verbose view): the steps are what counts. */
54
+ export declare const MIN_SHOWN_TURN_DURATION_MS = 30000;
53
55
  /**
54
56
  * The steps of one turn as a fold: a head "7 steps · 16.8 s" over one row per step. How much it shows follows the
55
57
  * view mode — nothing but the result (`summary`), the narrated steps folded closed (`normal`), or every step with
@@ -2,7 +2,15 @@ import type { TraceViewMode } from "./trace-types";
2
2
  export interface TraceViewModeSwitchProps {
3
3
  viewMode: TraceViewMode;
4
4
  onViewModeChange: (viewMode: TraceViewMode) => void;
5
- /** The reader may see the verbose view (tool names, arguments, results, costs); without it the option is not offered. */
5
+ /**
6
+ * The modes on offer, Short first (`traceViewModesOfPolicy` of the conversation's `traceViewPolicy`). With one mode
7
+ * or none the switch is not rendered. Absent: the former rule of `isVerboseAllowed`.
8
+ */
9
+ allowedViewModes?: readonly TraceViewMode[];
10
+ /**
11
+ * @deprecated Pass `allowedViewModes` (from the conversation's `traceViewPolicy`). Kept as the fallback while
12
+ * `allowedViewModes` is absent: the reader may see the verbose view, without it the option is not offered.
13
+ */
6
14
  isVerboseAllowed?: boolean;
7
15
  isCompact?: boolean;
8
16
  className?: string;
@@ -11,4 +19,4 @@ export interface TraceViewModeSwitchProps {
11
19
  * The switch of how much of a turn's trace the chat shows: Short (the result only), Normal (the steps, folded) and,
12
20
  * for a reader who may, Verbose (every step open to its details). Arrow keys move between the options.
13
21
  */
14
- export declare const TraceViewModeSwitch: (props: TraceViewModeSwitchProps) => import("react/jsx-runtime").JSX.Element;
22
+ export declare const TraceViewModeSwitch: (props: TraceViewModeSwitchProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -17,6 +17,8 @@ export { RunStatusLine, type RunStatusLineProps } from "./RunStatusLine";
17
17
  export { buildTaskPlanItems, CompactionDetail, DecisionDetail, describeTraceCompaction, describeTraceDecision, describeTraceDecisionStatus, SignalDetail, SkillLoadDetail, StepFactsLine, TaskPlanStepDetail, WidgetDetail, type CompactionDetailProps, type DecisionDetailProps, type SignalDetailProps, type SkillLoadDetailProps, type StepFactsLineProps, type TaskPlanStepDetailProps, type WidgetDetailProps, } from "./StepKindDetails";
18
18
  export { describeSubAgentCounts, SubAgentStepGroup, SubAgentStepRow, type SubAgentStepGroupProps, type SubAgentStepRowProps, type SubAgentWaiting, } from "./SubAgentStepGroup";
19
19
  export { TaskPlanPane, type TaskPlanPaneProps } from "./TaskPlanPane";
20
+ export { TaskPlanDrawer, TaskPlanMark, TaskPlanSegments, type TaskPlanDetailTarget, type TaskPlanDrawerProps } from "./TaskPlanDrawer";
21
+ export { buildTaskPlanTree, readDefaultExpandedKeys, readNeighbours, readShownStatus, readVisibleNodes, type TaskPlanNodeState, type TaskPlanTree, type TaskPlanTreeNode, } from "./task-plan-tree";
20
22
  export { focusTraceStep, TRACE_HIGHLIGHT_ATTRIBUTE, TRACE_STEP_ANCHOR_ATTRIBUTE, TRACE_TURN_ANCHOR_ATTRIBUTE } from "./trace-step-focus";
21
23
  export { TaskPlanRow, type TaskPlanItem, type TaskPlanItemState, type TaskPlanRowProps } from "./TaskPlanRow";
22
24
  export { TerminalBlock, type TerminalBlockProps } from "./TerminalBlock";
@@ -28,7 +30,8 @@ export { createTraceFormat, describeTraceModelName, readTraceRunResultText, desc
28
30
  export { describeTraceBackgroundJob, describeTraceContextSegment, describeTraceDecisionSite, describeTraceSignal, describeTraceWakeCondition, isTraceBackgroundJobLabel, TRACE_CONTEXT_SEGMENT_LABELS, TRACE_DECISION_SITE_LABELS, TRACE_SIGNAL_SOURCE_LABELS, TRACE_SIGNAL_TAG_LABELS, TRACE_WAKE_CONDITION_LABELS, type TraceLabelTranslate, } from "./trace-labels";
29
31
  export { readTraceStateLabel, TraceCopyButton, TraceMountChip, TracePath, TraceStateIcon, type TraceCopyButtonProps, type TraceMountChipProps, type TracePathProps, type TraceStateIconProps, } from "./trace-parts";
30
32
  export type { TraceCompaction, TraceDecision, TraceDescribeMount, TraceEntityDescription, TraceEntityReference, TraceFileChange, TraceFileChangeType, TraceFileDiffState, TraceHostBindings, TraceLinkComponent, TraceLoadedSkill, TraceLoadedSkillTool, TraceModelCall, TraceMountDescription, TraceSignal, TraceSkillLoad, TraceSkillLoadEntry, TraceStep, TraceStepKind, TraceStepState, TraceSubAgent, TraceSubAgentRun, TraceTaskPlanStepItem, TraceTerminal, TraceToolEffect, TraceTurnTotals, TraceViewMode, TraceWidget, } from "./trace-types";
31
- export { collectTraceBackgroundTasks, collectTraceChangedRecords, collectTraceFileChangesByTurn, collectTraceTaskPlan, type TraceChangedRecord, type TraceTaskPlanItemSource, type TraceTaskPlanSnapshot, type TraceTurnFileChanges, } from "./trace-collect";
33
+ export { collectTraceBackgroundTasks, collectTraceChangedRecords, collectTraceFileChangesByTurn, collectTraceTaskPlan, type TraceChangedRecord, type TraceTaskPlanItemSource, type TraceTaskPlanRejection, type TraceTaskPlanSnapshot, type TraceTurnFileChanges, } from "./trace-collect";
32
34
  export { useConversationTraceRevision, useConversationTraces, useConversationTurnTrace, type ConversationTurnTraceRead, type UseConversationTracesOptions, type UseConversationTurnTraceOptions, } from "./use-conversation-trace";
33
35
  export { TraceViewModeSwitch, type TraceViewModeSwitchProps } from "./TraceViewModeSwitch";
36
+ export { clampTraceViewMode, defaultTraceViewModeOfPolicy, resolveAllowedTraceViewModes, TRACE_VIEW_MODE_OF_LEVEL, traceLevelOfViewMode, traceViewModesOfPolicy, } from "./trace-view-policy";
34
37
  export { TurnMetaLine, type TurnMetaLineProps } from "./TurnMetaLine";
@@ -0,0 +1,55 @@
1
+ import type { TraceTaskPlanStepItem } from "./trace-types";
2
+ /**
3
+ * Where an item of the task plan stands, as the work plan draws it: done, does not apply (skipped), blocked, running
4
+ * (the first open leaf: the step the agent works on now) or open.
5
+ */
6
+ export type TaskPlanNodeState = "done" | "skipped" | "blocked" | "running" | "open";
7
+ /** One item of the plan in its tree: its children, its state and the part of its leaves that is closed. */
8
+ export interface TaskPlanTreeNode {
9
+ item: TraceTaskPlanStepItem;
10
+ key: string;
11
+ depth: number;
12
+ parent: TaskPlanTreeNode | null;
13
+ children: TaskPlanTreeNode[];
14
+ state: TaskPlanNodeState;
15
+ /** Leaves below the node (the node itself for a leaf) that are done or do not apply, and all of them. */
16
+ closedLeafCount: number;
17
+ leafCount: number;
18
+ }
19
+ /** The plan as a tree, with the counts the work plan shows. */
20
+ export interface TaskPlanTree {
21
+ roots: TaskPlanTreeNode[];
22
+ /** Every node in plan order (depth first). */
23
+ nodes: TaskPlanTreeNode[];
24
+ byKey: ReadonlyMap<string, TaskPlanTreeNode>;
25
+ /** The running leaf (the first open leaf), null when none is open. */
26
+ running: TaskPlanTreeNode | null;
27
+ /** All leaves, the closed ones (done or does not apply), the blocked and the skipped ones. */
28
+ leafCount: number;
29
+ closedLeafCount: number;
30
+ blockedLeafCount: number;
31
+ skippedLeafCount: number;
32
+ /** The position of the top-level item the plan works on (1-based; the count of top-level items when all are closed). */
33
+ currentTopLevelPosition: number;
34
+ }
35
+ /** The status the plan shows for an item: the server's derived status, else the item's own. */
36
+ export declare const readShownStatus: (item: Pick<TraceTaskPlanStepItem, "status" | "shownStatus">) => string;
37
+ /**
38
+ * Builds the tree of a plan's items (in plan order, each with its `depth`): a node's parent is the nearest item before
39
+ * it with a smaller depth. A container whose server sends no derived status derives its state from its children
40
+ * (blocked when a child is blocked and none open, done when all are closed). The first open leaf outside a closed
41
+ * container is the running step.
42
+ */
43
+ export declare const buildTaskPlanTree: (items: readonly TraceTaskPlanStepItem[]) => TaskPlanTree;
44
+ /**
45
+ * The containers the work plan opens at first: every container that is not closed (the path of the running and of a
46
+ * blocked step among them); a done or skipped branch stays folded.
47
+ */
48
+ export declare const readDefaultExpandedKeys: (tree: TaskPlanTree) => Set<string>;
49
+ /** The nodes a reader sees with the given containers open, in plan order. */
50
+ export declare const readVisibleNodes: (tree: TaskPlanTree, expandedKeys: ReadonlySet<string>) => TaskPlanTreeNode[];
51
+ /** The item before and after a node in plan order (any depth), for the arrows of the detail view. */
52
+ export declare const readNeighbours: (tree: TaskPlanTree, key: string) => {
53
+ previous: TaskPlanTreeNode | null;
54
+ next: TaskPlanTreeNode | null;
55
+ };
@@ -42,6 +42,10 @@ export interface TraceTaskPlanSnapshot {
42
42
  * whose change lies before the loaded turns has none.
43
43
  */
44
44
  itemSources: Readonly<Record<string, TraceTaskPlanItemSource>>;
45
+ /** Per item key: the plan update the item first appeared in (as it stands now: same key and title). */
46
+ itemFirstSources: Readonly<Record<string, TraceTaskPlanItemSource>>;
47
+ /** Debug level: what refused plan calls told the agent, oldest first (empty at the steps level). */
48
+ rejections: readonly TraceTaskPlanRejection[];
45
49
  }
46
50
  /** The plan update (a `TASK_PLAN` step) that last changed an item of the plan: where the trace shows it. */
47
51
  export interface TraceTaskPlanItemSource {
@@ -51,6 +55,17 @@ export interface TraceTaskPlanItemSource {
51
55
  stepKey: string;
52
56
  /** The id the server gives the step (the anchor of its row); null when it sends none. */
53
57
  stepId: string | null;
58
+ /** When the plan update ran (a server date-time); null when the trace names none. */
59
+ startedAt?: string | null;
60
+ }
61
+ /** One line a refused plan call returned to the agent, with the plan update it belongs to. */
62
+ export interface TraceTaskPlanRejection {
63
+ line: string;
64
+ /** The first item key the line names; null when it names none. */
65
+ itemKey: string | null;
66
+ /** The plan tool of the call (`update_task_plan`, `set_task_status`). */
67
+ toolName: string | null;
68
+ source: TraceTaskPlanItemSource;
54
69
  }
55
70
  /**
56
71
  * The conversation's task plan after its newest plan update (the last `TASK_PLAN` step of the turns that names a plan);
@@ -141,6 +141,26 @@ export interface TraceTaskPlanStepItem {
141
141
  depth?: number;
142
142
  title: string;
143
143
  status?: string | null;
144
+ /** What the server adds about an item (`ConversationTraceTaskPlanItem`): the shown state, the note, the origin, … */
145
+ shownStatus?: string | null;
146
+ statusNote?: string | null;
147
+ requiresUserAction?: boolean;
148
+ retryable?: boolean;
149
+ isSeeded?: boolean;
150
+ isPreResolvedAtSeed?: boolean;
151
+ closesItself?: boolean;
152
+ wasClosedByPlatform?: boolean;
153
+ doneCriterion?: string | null;
154
+ customerProgressStepKey?: string | null;
155
+ instruction?: string | null;
156
+ skillNames?: string[];
157
+ declarations?: {
158
+ name: string;
159
+ kind: string;
160
+ value: string;
161
+ }[];
162
+ evidenceMessageIndex?: number | null;
163
+ platformResolvedAtMessageIndex?: number | null;
144
164
  }
145
165
  export interface TraceLoadedSkillTool {
146
166
  name: string;
@@ -0,0 +1,17 @@
1
+ import { type ConversationTraceLevel, type ConversationTraceViewPolicy } from "../../contract/conversation-trace";
2
+ import type { TraceViewMode } from "./trace-types";
3
+ /** The view mode that shows a trace level: Short ↔ RESULT, Normal ↔ STEPS, Verbose ↔ DEBUG. */
4
+ export declare const TRACE_VIEW_MODE_OF_LEVEL: Readonly<Record<ConversationTraceLevel, TraceViewMode>>;
5
+ /** The trace level a view mode reads. */
6
+ export declare const traceLevelOfViewMode: (viewMode: TraceViewMode) => ConversationTraceLevel;
7
+ /** The view modes a policy allows, Short first: every mode up to its maximum level. */
8
+ export declare const traceViewModesOfPolicy: (policy: ConversationTraceViewPolicy) => TraceViewMode[];
9
+ /**
10
+ * The view modes on offer: the policy's when the conversation carries one, else the former rule (Short and Normal, and
11
+ * Verbose for a reader who may: `isVerboseAllowed`).
12
+ */
13
+ export declare const resolveAllowedTraceViewModes: (policy: ConversationTraceViewPolicy | null | undefined, isVerboseAllowed?: boolean) => TraceViewMode[];
14
+ /** The mode shown: the chosen one while it is allowed, else the most detailed allowed one below it (never above). */
15
+ export declare const clampTraceViewMode: (viewMode: TraceViewMode, allowedViewModes: readonly TraceViewMode[]) => TraceViewMode;
16
+ /** The mode a reader starts in when they chose none: the policy's default level. */
17
+ export declare const defaultTraceViewModeOfPolicy: (policy: ConversationTraceViewPolicy) => TraceViewMode;
@@ -1,6 +1,13 @@
1
- import type { ConversationContextComposition, ConversationFileChange, ConversationFileChangeDiff, ConversationTraceMessage, ConversationTraceStep, ConversationTraceTaskPlanItem, ConversationTurnStop, ConversationTurnTrace, ConversationTurnTraces } from "../../contract/conversation-trace";
1
+ import type { ConversationContextComposition, ConversationFileChange, ConversationFileChangeDiff, ConversationTraceViewPolicy, ConversationTraceMessage, ConversationTraceStep, ConversationTraceTaskPlanItem, ConversationTraceTaskPlanRejection, ConversationTurnStop, ConversationTurnTrace, ConversationTurnTraces } from "../../contract/conversation-trace";
2
2
  import type { WireContextCompositionResponse, WireFileChangeDiffResponse, WireTurnStopResponse, WireTraceFileChange, WireTraceMessage, WireTraceStep, WireTurnTrace, WireTurnTracesResponse } from "./agents-http-trace-wire";
3
+ /**
4
+ * The server's `AgentTraceViewPolicy` (`traceViewPolicy` of a conversation or trace read) as the contract's policy;
5
+ * null when absent or without a known maximum. The default never exceeds the maximum; a policy that allows one level
6
+ * shows no switch, whatever the wire says.
7
+ */
8
+ export declare const mapWireTraceViewPolicy: (wirePolicy: unknown) => ConversationTraceViewPolicy | null;
3
9
  export declare const mapWireTraceTaskPlanItems: (wireItems: WireTraceStep["taskPlanItems"]) => ConversationTraceTaskPlanItem[];
10
+ export declare const mapWireTraceTaskPlanRejections: (wireRejections: WireTraceStep["taskPlanRejections"]) => ConversationTraceTaskPlanRejection[];
4
11
  /** An `AgentTraceFileChange` as the contract's file change. */
5
12
  export declare const mapWireTraceFileChange: (wireFileChange: WireTraceFileChange) => ConversationFileChange;
6
13
  /**
@@ -124,6 +124,32 @@ export interface WireTraceTaskPlanItem {
124
124
  depth?: number | null;
125
125
  title?: string | null;
126
126
  status?: string | null;
127
+ shownStatus?: string | null;
128
+ statusNote?: string | null;
129
+ requiresUserAction?: boolean | null;
130
+ retryable?: boolean | null;
131
+ isSeeded?: boolean | null;
132
+ isPreResolvedAtSeed?: boolean | null;
133
+ closesItself?: boolean | null;
134
+ wasClosedByPlatform?: boolean | null;
135
+ doneCriterion?: string | null;
136
+ customerProgressStepKey?: string | null;
137
+ instruction?: string | null;
138
+ skillNames?: WireSet<string> | null;
139
+ declarations?: WireSet<WireTraceTaskPlanItemDeclaration> | null;
140
+ evidenceMessageIndex?: number | null;
141
+ platformResolvedAtMessageIndex?: number | null;
142
+ }
143
+ /** `AgentTraceTaskPlanItemDeclaration`. */
144
+ export interface WireTraceTaskPlanItemDeclaration {
145
+ name?: string | null;
146
+ kind?: string | null;
147
+ value?: string | null;
148
+ }
149
+ /** `AgentTraceTaskPlanRejection`. */
150
+ export interface WireTraceTaskPlanRejection {
151
+ line?: string | null;
152
+ itemKey?: string | null;
127
153
  }
128
154
  /** `AgentTraceLoadedSkillTool`. */
129
155
  export interface WireTraceLoadedSkillTool {
@@ -295,6 +321,7 @@ export interface WireTraceStep {
295
321
  compaction?: WireTraceCompaction | null;
296
322
  skillLoad?: WireTraceSkillLoad | null;
297
323
  taskPlanItems?: WireSet<WireTraceTaskPlanItem> | null;
324
+ taskPlanRejections?: WireSet<WireTraceTaskPlanRejection> | null;
298
325
  signalSource?: string | null;
299
326
  signalKind?: string | null;
300
327
  signalText?: string | null;
@@ -76,6 +76,8 @@ export interface WireConversationMessage {
76
76
  signalSource?: string | null;
77
77
  message?: string | null;
78
78
  createdDate?: string | null;
79
+ /** The message's `ChangeHistory`: its `createdTime` is when it was written. */
80
+ changeHistory?: WireChangeHistory | null;
79
81
  toolCall?: WireToolCall | null;
80
82
  delegatedConversations?: WireSet<{
81
83
  id?: number | null;
@@ -135,6 +137,8 @@ export interface WireSelectableModel {
135
137
  /** `AIConversationGetResponseDto` (get, postMessage, injectSignal, retry, title). */
136
138
  export interface WireConversationResponse {
137
139
  aiConversation?: WireConversation | null;
140
+ /** `AgentTraceViewPolicy`: which trace levels the reader may see (`AIConversationGetResponseDto`). */
141
+ traceViewPolicy?: unknown;
138
142
  }
139
143
  /** `AIConversationStartWithMessagePostResponseDto`. */
140
144
  export interface WireConversationStartResponse extends WireConversationResponse {