@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
@@ -7,7 +7,20 @@
7
7
  * null or absent in a read at the level of steps.
8
8
  */
9
9
  /** How much a trace read carries: the steps as the owner may read them, or the debug facts beside them. */
10
- export type ConversationTraceLevel = "STEPS" | "DEBUG";
10
+ export type ConversationTraceLevel = "RESULT" | "STEPS" | "DEBUG";
11
+ /** The trace levels from the least to the most: RESULT (the answers only, no steps) < STEPS < DEBUG. */
12
+ export declare const CONVERSATION_TRACE_LEVELS: readonly ConversationTraceLevel[];
13
+ /**
14
+ * Which trace levels a reader may see in a conversation (the server's `AgentTraceViewPolicy`, decided by the app's
15
+ * `AgentTraceViewPolicyService`): every level up to `maxDetailLevel`, starting at `defaultDetailLevel`. The server holds
16
+ * the lock (a read above the maximum is lowered); a client only offers what is allowed. `isSwitchShown` is false when
17
+ * a single level is allowed: no Short / Normal / Verbose switch then.
18
+ */
19
+ export interface ConversationTraceViewPolicy {
20
+ maxDetailLevel: ConversationTraceLevel;
21
+ defaultDetailLevel: ConversationTraceLevel;
22
+ isSwitchShown: boolean;
23
+ }
11
24
  export type ConversationTraceStepKind = "THINKING" | "MODEL_CALL" | "TOOL_CALL" | "SKILL_LOAD" | "SUB_AGENT" | "WIDGET" | "COMPACTION" | "SIGNAL" | "DECISION" | "TASK_PLAN" | "ERROR";
12
25
  /** What a tool does to the data it works on, as the tool declared it. */
13
26
  export type ConversationTraceToolEffect = "READ" | "WORKSPACE" | "WRITE" | "DELETE";
@@ -176,6 +189,51 @@ export interface ConversationTraceTaskPlanItem {
176
189
  title: string;
177
190
  /** `open`, `done`, `blocked`, … as the server stores it. */
178
191
  status: string | null;
192
+ /**
193
+ * The state the plan shows (`open`, `done`, `blocked`, `not_applicable`): a container derives it from its subtasks, an
194
+ * item below a blocked or not applicable container takes that state. Null from a server that does not send it.
195
+ */
196
+ shownStatus?: string | null;
197
+ /** The one-line note of a terminal state: what was produced, why it is blocked, why it does not apply. */
198
+ statusNote?: string | null;
199
+ /** Only the owner can lift the block. */
200
+ requiresUserAction?: boolean;
201
+ /** The block is transient: the item may be tried again. */
202
+ retryable?: boolean;
203
+ /** The item came from the purpose's seeded plan (false: the agent added it). */
204
+ isSeeded?: boolean;
205
+ /** The seed found the item already satisfied and closed it at the start. */
206
+ isPreResolvedAtSeed?: boolean;
207
+ /** The platform closes the item from the record (a tool call, a widget, a delivered answer), never the agent's tick. */
208
+ closesItself?: boolean;
209
+ /** The platform wrote the item's current terminal state. */
210
+ wasClosedByPlatform?: boolean;
211
+ /** The machine done criterion of a seeded item. */
212
+ doneCriterion?: string | null;
213
+ /** The customer-facing progress step the item belongs to. */
214
+ customerProgressStepKey?: string | null;
215
+ /** Debug level: the agent's instruction, when the title is the customer-facing name. */
216
+ instruction?: string | null;
217
+ /** Debug level: the skills the item needs when it is the plan's next. */
218
+ skillNames?: string[];
219
+ /** Debug level: the seeded declarations that are set. */
220
+ declarations?: ConversationTraceTaskPlanItemDeclaration[];
221
+ /** Debug level: the message index of the evidence the item was closed on, and where the platform closed it. */
222
+ evidenceMessageIndex?: number | null;
223
+ platformResolvedAtMessageIndex?: number | null;
224
+ }
225
+ /** One seeded declaration of a task plan item (debug level). */
226
+ export interface ConversationTraceTaskPlanItemDeclaration {
227
+ name: string;
228
+ /** `text`, `nonEmptyArray`, `nameList`, `bool`, `connectedChannel`, `closedQuestionOptions`, `reasoningEffort`. */
229
+ kind: string;
230
+ value: string;
231
+ }
232
+ /** One line of the rejection block a refused plan call returned to the agent (debug level). */
233
+ export interface ConversationTraceTaskPlanRejection {
234
+ line: string;
235
+ /** The first item key the line names; null when it names none. */
236
+ itemKey: string | null;
179
237
  }
180
238
  /** The compaction of a `COMPACTION` step (the summary text at debug level only). */
181
239
  export interface ConversationTraceCompaction {
@@ -439,6 +497,8 @@ export interface ConversationTraceStep {
439
497
  skillLoad: ConversationTraceSkillLoad | null;
440
498
  /** The items of the task plan after a `TASK_PLAN` step; empty when the server sends none. */
441
499
  taskPlanItems: ConversationTraceTaskPlanItem[];
500
+ /** Debug level: the rejection lines of a refused plan call. Absent from a server that does not send them. */
501
+ taskPlanRejections?: ConversationTraceTaskPlanRejection[];
442
502
  /** The task plan after a `TASK_PLAN` step. */
443
503
  taskPlanTitle: string | null;
444
504
  /** Top-level items of the plan, and how many of them are open (neither done nor blocked). */
@@ -542,6 +602,8 @@ export interface ConversationTurnTraces {
542
602
  newestMessageIndex: number | null;
543
603
  /** A turn runs right now. */
544
604
  isRunLive: boolean;
605
+ /** Who may see which level in this conversation; null when the server sends none (an older server). */
606
+ traceViewPolicy: ConversationTraceViewPolicy | null;
545
607
  }
546
608
  /** Which turns a trace read returns. Without options: the newest turns, as many as the server's default window holds. */
547
609
  export interface ConversationTurnTracesOptions {
@@ -1,3 +1,4 @@
1
+ import type { ConversationTraceViewPolicy } from "./conversation-trace";
1
2
  /**
2
3
  * The conversation contract of the package: plain TypeScript types the conversation client port
3
4
  * (`client/AgentsConversationClient.ts`) returns and the chat reads. Every field is derived from what the chat files and
@@ -77,6 +78,11 @@ export interface AgentsConversation {
77
78
  * read does not carry it); without it the poller treats every poll of a running turn as a change.
78
79
  */
79
80
  lastMessageId?: number | null;
81
+ /**
82
+ * generic — which trace levels the reader may see in this conversation (`ConversationTraceViewPolicy`): the Short /
83
+ * Normal / Verbose switch offers only those. Absent when the read does not carry it (a binding or an older server).
84
+ */
85
+ traceViewPolicy?: ConversationTraceViewPolicy | null;
80
86
  /** app extension — the prompt extension of the host application's older AI-Extensions chat */
81
87
  promptExtensionId?: number | null;
82
88
  /** app extension — the category of that prompt extension (its colour and product name in the conversation list) */
@@ -158,6 +164,11 @@ export interface AgentsConversationMessage {
158
164
  message: string;
159
165
  /** generic */
160
166
  createdDate: string | null;
167
+ /**
168
+ * generic — when the message was written, in the server's date-time format (`ChangeHistory.createdTime`, UTC); the
169
+ * chat's day separators, time heads and exact times read it. Absent from a client that does not send it: no times.
170
+ */
171
+ createdAt?: string | null;
161
172
  /** generic */
162
173
  toolCall: ConversationToolCall | null;
163
174
  /** generic — the sub-agent conversations a `delegate` call started (older rows) */
@@ -30,6 +30,7 @@ export { CanvasRestoreOnMount, type CanvasRestoreOnMountProps } from "../rendere
30
30
  export { ConversationDeepLinkedWidget, type ConversationDeepLinkedWidgetProps, } from "../renderer/ConversationDeepLinkedWidget";
31
31
  export { CanvasPane } from "../chat/CanvasPane/CanvasPane";
32
32
  export { ConversationMessageList, findUnansweredWidgetMessageId, } from "../chat/ConversationMessageList/ConversationMessageList";
33
+ export { buildMessageTimeMarks, createMessageTimeFormat, formatCallLength, MESSAGE_TIME_PAUSE_MS, type MessageTimeFormat, type MessageTimeMarks, type MessageTimesMode, useMessageTimeFormat, } from "../chat/ConversationMessageList/message-times";
33
34
  export { ConversationMessageUser, type ConversationMessageUserProps, type ConversationMessageUserTheme, } from "../chat/ConversationMessage/ConversationMessageUser/ConversationMessageUser";
34
35
  export { ConversationMessageWidgets, type ConversationMessageWidgetsProps, } from "../chat/ConversationMessage/ConversationMessageWidgets/ConversationMessageWidgets";
35
36
  export { ConversationMessageSystem, type ConversationMessageSystemProps, } from "../chat/ConversationMessage/ConversationMessageSystem/ConversationMessageSystem";
@@ -12,6 +12,7 @@ export * from "../renderer/widget-hydration";
12
12
  export { unregisterWidgetHydrator } from "../renderer/widget-hydration/widget-hydration.registry";
13
13
  export * from "../renderer/canvas/canvas-behaviours";
14
14
  export { CanvasTitleSlotContext, useCanvasTitleSlot } from "../renderer/canvas/canvas-title-slot-context";
15
+ export { CanvasLabelContext, useCanvasLabel } from "../renderer/canvas/canvas-label-context";
15
16
  export type { ComposerLibraryFile } from "../renderer/composer-library-file";
16
17
  export type { ConversationComposerWidget } from "../renderer/conversation-composer-widget";
17
18
  export { buildComposerWidgetFenceBlock, buildMessageTextWithComposerWidgets, splitComposerWidgetFencesFromMessageText, type SplitComposerWidgetFencesResult, } from "../renderer/composer-widget-fence";
@@ -167,6 +167,11 @@ export interface AgentsSplitViewProps {
167
167
  mainPaneShowsReopen?: boolean;
168
168
  sidePaneShowsClose?: boolean;
169
169
  };
170
+ /**
171
+ * The short name the open side pane's body reports (`useCanvasLabel`: a file's name), for a replacement that frames
172
+ * the pane with a tab or a head. Absent while the body names nothing. The package default does not show it.
173
+ */
174
+ sideLabel?: string;
170
175
  }
171
176
  /** The change of a figure as an arrow and a signed amount, coloured by whether it is good. */
172
177
  export interface AgentsTrendDeltaProps {
@@ -91,6 +91,30 @@ export interface AgentsMapsLoaderState {
91
91
  * `--agents-*`, `__AGENTS_WIDGET_IMAGE_V1__`, `__AGENTS_WIDGET_PREVIEW_V1__`): the names its stored visualization scripts,
92
92
  * its skill texts or its headless capture already use. Every list is optional; the package's names always exist.
93
93
  */
94
+ /**
95
+ * How the agent chat lays out its canvas, for a host that frames the canvas itself (its own card, tabs, close control).
96
+ * Every member is optional and defaults to the package's own chrome, so a host without the setting sees no change.
97
+ */
98
+ export interface AgentsCanvasLayout {
99
+ /** The canvas pane's own "Close canvas" button. Default true; a host whose frame closes the canvas sets false. */
100
+ showsCloseButton?: boolean;
101
+ /** The round canvas toggle on the divider (where the chat enables it). Default true. */
102
+ showsDividerToggle?: boolean;
103
+ /** The "Re-open canvas" control over the chat of a narrow viewport. Default true. */
104
+ showsNarrowReopenControl?: boolean;
105
+ /**
106
+ * The narrowest the chat column gets beside an open canvas, in px: the default split and every pull of the edge stop
107
+ * there. Default `CHAT_COLUMN_MIN_WIDTH_PX`.
108
+ */
109
+ chatColumnMinWidthPx?: number;
110
+ /** The inset of the side-split canvas from its pane edge, in px, while the chat boxes the canvas. Default `CANVAS_BOXED_INSET_PX`. */
111
+ boxedInsetPx?: number;
112
+ /**
113
+ * The canvas pane's own surface: `card` (default) paints the rounded surface of a boxed canvas and pads the pane;
114
+ * `none` leaves both to the host's frame (its `SplitView` replacement draws the card).
115
+ */
116
+ paneSurface?: "card" | "none";
117
+ }
94
118
  export type AgentsSandboxLegacyAliases = {
95
119
  /** Further names of the sandbox global, e.g. the name stored scripts of the app read. */
96
120
  visualizationGlobalNames?: string[];
@@ -171,6 +195,8 @@ export interface AgentsEnvironment {
171
195
  */
172
196
  markdownImageHosts?: readonly string[];
173
197
  components?: Partial<AgentsComponents>;
198
+ /** How the chat lays out its canvas (see `AgentsCanvasLayout`). Default: the package's own chrome. */
199
+ canvasLayout?: AgentsCanvasLayout;
174
200
  texts?: AgentsTexts;
175
201
  /**
176
202
  * Prepares a plain text (a model's words, the owner's own message, a business name) for the app's `Text`, `Button`,
@@ -1,5 +1,5 @@
1
1
  export { AgentsProvider, type AgentsProviderProps, useAgentsActiveAgentSpaceKey, useAgentsBudgetLimit, useAgentsComponents, useAgentsEnvironment, useAgentsMapsLoader, useAgentsOwnerSettings, useAgentsStateDispatch, useAgentsStateSelector, useAgentsTexts, } from "./AgentsProvider";
2
- export { type AgentsAssistantBackgroundProps, type AgentsAssistantIconBadgeProps, type AgentsBudgetLimit, type AgentsEnvironment, type AgentsConnectionPermissionTarget, type AgentsGalleryImage, type AgentsMapsLoaderState, type AgentsOwnerSettings, type AgentsSandboxLegacyAliases, type AgentsStateAction, type AgentsStateStore, type AgentsTexts, appendAnotherAgentSpaceToOwnerText, buildUnnamedAgentSpaceLabel, buildWidgetOfAnotherAgentSpaceExplanation, DEFAULT_AGENTS_TEXTS, DEFAULT_WIDGET_IMAGE_CAPTURE_READ_PATH_PREFIX, DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME, escapePlainTextForText, getAgentDisplayName, getAgentsEnvironment, getFurtherCanvasBehaviours, getFurtherWidgetClickSignalSources, getGoogleMapWidgetNames, getSandboxLegacyAliases, getWidgetImageCaptureReadPathPrefix, getWidgetSelfHydrationKeyFieldName, openImageGallery, reportRunningTurn, reportWidgetCrash, setAgentsEnvironment, translateText, } from "./environment";
2
+ export { type AgentsAssistantBackgroundProps, type AgentsAssistantIconBadgeProps, type AgentsBudgetLimit, type AgentsEnvironment, type AgentsConnectionPermissionTarget, type AgentsGalleryImage, type AgentsMapsLoaderState, type AgentsOwnerSettings, type AgentsSandboxLegacyAliases, type AgentsStateAction, type AgentsCanvasLayout, type AgentsStateStore, type AgentsTexts, appendAnotherAgentSpaceToOwnerText, buildUnnamedAgentSpaceLabel, buildWidgetOfAnotherAgentSpaceExplanation, DEFAULT_AGENTS_TEXTS, DEFAULT_WIDGET_IMAGE_CAPTURE_READ_PATH_PREFIX, DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME, escapePlainTextForText, getAgentDisplayName, getAgentsEnvironment, getFurtherCanvasBehaviours, getFurtherWidgetClickSignalSources, getGoogleMapWidgetNames, getSandboxLegacyAliases, getWidgetImageCaptureReadPathPrefix, getWidgetSelfHydrationKeyFieldName, openImageGallery, reportRunningTurn, reportWidgetCrash, setAgentsEnvironment, translateText, } from "./environment";
3
3
  export { classNames } from "./class-names";
4
4
  export { useAgentsConversationClient, useOptionalAgentsConversationClient, } from "../client/AgentsConversationClientContext";
5
5
  export { AgentsLink, type AgentsLinkNavigation, type AgentsLinkProps, useAgentsLinkNavigation, } from "./link-navigation";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Where a canvas body reports its short name (a file's name, a list's title): the chat hands it to the `SplitView`
3
+ * as `sideLabel`, so a host that frames the canvas (a tab, a card head) can name it. Null outside a canvas pane.
4
+ */
5
+ export declare const CanvasLabelContext: import("react").Context<((label: string | null) => void) | null>;
6
+ /**
7
+ * Reports the open canvas's short name while the body is mounted; `null` or `undefined` (still loading) reports none.
8
+ * The name is taken back when the body unmounts. Outside a canvas pane it does nothing.
9
+ */
10
+ export declare const useCanvasLabel: (label: string | null | undefined) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mgamadeus/ddd-agents",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "The web frontend of the ddd-agents module: the agent chat, the widget renderer and the composed-view kit.",
5
5
  "keywords": [
6
6
  "ddd",
package/public-api.json CHANGED
@@ -96,6 +96,7 @@
96
96
  "AgentsButtonProps",
97
97
  "AgentsButtonSize",
98
98
  "AgentsButtonVariant",
99
+ "AgentsCanvasLayout",
99
100
  "AgentsCheckboxProps",
100
101
  "AgentsChoiceOption",
101
102
  "AgentsComponents",
@@ -180,6 +181,7 @@
180
181
  "CANVAS_FILLS_SCREEN_WIDTH_PERCENT",
181
182
  "CANVAS_MIN_WIDTH_PX",
182
183
  "CHAT_COLUMN_MIN_WIDTH_PX",
184
+ "CanvasLabelContext",
183
185
  "CanvasTitleSlotContext",
184
186
  "ConversationMarkdown",
185
187
  "ConversationWidgetActions",
@@ -271,6 +273,7 @@
271
273
  "useAnchorWidgetAgentSpaceKey",
272
274
  "useAnchorWidgetFenceAgentSpaceKey",
273
275
  "useAnchorWidgetPayload",
276
+ "useCanvasLabel",
274
277
  "useCanvasTitleSlot",
275
278
  "useConversationWidgetAgentSpaceFallback",
276
279
  "useConversationWidgetContext",
@@ -498,6 +501,7 @@
498
501
  "AGENTS_CLIENT_ERROR_CODE_REQUEST_ABORTED",
499
502
  "AgentsClientError",
500
503
  "CONVERSATION_RUN_STATES_THAT_END_THE_CONVERSATION",
504
+ "CONVERSATION_TRACE_LEVELS",
501
505
  "buildChangedMessagesRequest",
502
506
  "isAgentsClientError",
503
507
  "readConversationRunStatusOfRunState"
@@ -565,8 +569,11 @@
565
569
  "ConversationTraceSubAgentRun",
566
570
  "ConversationTraceSubAgentTaskKind",
567
571
  "ConversationTraceTaskPlanItem",
572
+ "ConversationTraceTaskPlanItemDeclaration",
573
+ "ConversationTraceTaskPlanRejection",
568
574
  "ConversationTraceTerminal",
569
575
  "ConversationTraceToolEffect",
576
+ "ConversationTraceViewPolicy",
570
577
  "ConversationTraceWidget",
571
578
  "ConversationTraceWindowMode",
572
579
  "ConversationTurnStop",
@@ -610,6 +617,8 @@
610
617
  "mapWireTraceMessage",
611
618
  "mapWireTraceStep",
612
619
  "mapWireTraceTaskPlanItems",
620
+ "mapWireTraceTaskPlanRejections",
621
+ "mapWireTraceViewPolicy",
613
622
  "mapWireTurnStop",
614
623
  "mapWireTurnTrace",
615
624
  "mapWireTurnTraces",
@@ -688,6 +697,8 @@
688
697
  "WireTraceSubAgent",
689
698
  "WireTraceSubAgentRun",
690
699
  "WireTraceTaskPlanItem",
700
+ "WireTraceTaskPlanItemDeclaration",
701
+ "WireTraceTaskPlanRejection",
691
702
  "WireTraceTerminal",
692
703
  "WireTraceWidget",
693
704
  "WireTurnStopResponse",
@@ -765,6 +776,7 @@
765
776
  "INITIAL_AGENTS_CHAT_STATE",
766
777
  "LoadedSkillsDisclosure",
767
778
  "MAX_MESSAGE_LENGTH",
779
+ "MESSAGE_TIME_PAUSE_MS",
768
780
  "PHONE_CALL_LIFECYCLE_SIGNAL_SOURCES",
769
781
  "QueuedMessageChip",
770
782
  "RunStatusLine",
@@ -782,9 +794,13 @@
782
794
  "TRACE_SIGNAL_TAG_LABELS",
783
795
  "TRACE_STEP_ANCHOR_ATTRIBUTE",
784
796
  "TRACE_TURN_ANCHOR_ATTRIBUTE",
797
+ "TRACE_VIEW_MODE_OF_LEVEL",
785
798
  "TRACE_WAKE_CONDITION_LABELS",
799
+ "TaskPlanDrawer",
800
+ "TaskPlanMark",
786
801
  "TaskPlanPane",
787
802
  "TaskPlanRow",
803
+ "TaskPlanSegments",
788
804
  "TaskPlanStepDetail",
789
805
  "TerminalBlock",
790
806
  "ThinkingBlock",
@@ -800,14 +816,19 @@
800
816
  "TraceViewModeSwitch",
801
817
  "TurnMetaLine",
802
818
  "WidgetDetail",
819
+ "buildMessageTimeMarks",
803
820
  "buildSideBySideDiffRows",
804
821
  "buildTaskPlanItems",
822
+ "buildTaskPlanTree",
823
+ "clampTraceViewMode",
805
824
  "collectTraceBackgroundTasks",
806
825
  "collectTraceChangedRecords",
807
826
  "collectTraceFileChangesByTurn",
808
827
  "collectTraceTaskPlan",
809
828
  "createAgentsChatStore",
829
+ "createMessageTimeFormat",
810
830
  "createTraceFormat",
831
+ "defaultTraceViewModeOfPolicy",
811
832
  "deriveAgentActivity",
812
833
  "describeChangedFieldName",
813
834
  "describeChangedRecord",
@@ -826,6 +847,7 @@
826
847
  "findTurnsInFlight",
827
848
  "findUnansweredWidgetMessageId",
828
849
  "focusTraceStep",
850
+ "formatCallLength",
829
851
  "formatElapsedClock",
830
852
  "formatShortSha256",
831
853
  "formatTraceClock",
@@ -838,6 +860,9 @@
838
860
  "prettyPrintTraceJson",
839
861
  "readContentFromUnifiedDiff",
840
862
  "readConversationErrorTypeOfRefusedSend",
863
+ "readDefaultExpandedKeys",
864
+ "readNeighbours",
865
+ "readShownStatus",
841
866
  "readTraceFileChangeIcon",
842
867
  "readTraceFileChangeLetter",
843
868
  "readTraceFileChangeWord",
@@ -849,10 +874,14 @@
849
874
  "readTraceStepIcon",
850
875
  "readTraceStepState",
851
876
  "readTraceSubAgentState",
877
+ "readVisibleNodes",
852
878
  "reduceAgentsChatState",
853
879
  "releaseConversationTraceLoaders",
854
880
  "resolveAgentChatActivityTiming",
881
+ "resolveAllowedTraceViewModes",
855
882
  "selectVisibleTraceSteps",
883
+ "traceLevelOfViewMode",
884
+ "traceViewModesOfPolicy",
856
885
  "useActivityTicker",
857
886
  "useAgentsChatSelector",
858
887
  "useAgentsChatState",
@@ -864,6 +893,7 @@
864
893
  "useConversationTraces",
865
894
  "useConversationTurnTrace",
866
895
  "useConversationsSearch",
896
+ "useMessageTimeFormat",
867
897
  "useOptionalAgentsChatStore",
868
898
  "useOptionalAgentsConversationClient",
869
899
  "useTraceFormat"
@@ -937,6 +967,9 @@
937
967
  "FileEditBlockProps",
938
968
  "FileEditDiffMode",
939
969
  "LoadedSkillsDisclosureProps",
970
+ "MessageTimeFormat",
971
+ "MessageTimeMarks",
972
+ "MessageTimesMode",
940
973
  "QueuedMessageChipProps",
941
974
  "ResolvedAgentChatActivityTiming",
942
975
  "RunStatusLineProps",
@@ -949,11 +982,16 @@
949
982
  "SubAgentStepGroupProps",
950
983
  "SubAgentStepRowProps",
951
984
  "SubAgentWaiting",
985
+ "TaskPlanDetailTarget",
986
+ "TaskPlanDrawerProps",
952
987
  "TaskPlanItem",
953
988
  "TaskPlanItemState",
989
+ "TaskPlanNodeState",
954
990
  "TaskPlanPaneProps",
955
991
  "TaskPlanRowProps",
956
992
  "TaskPlanStepDetailProps",
993
+ "TaskPlanTree",
994
+ "TaskPlanTreeNode",
957
995
  "TerminalBlockProps",
958
996
  "ThinkingBlockProps",
959
997
  "ToolStepDetailProps",
@@ -991,6 +1029,7 @@
991
1029
  "TraceSubAgent",
992
1030
  "TraceSubAgentRun",
993
1031
  "TraceTaskPlanItemSource",
1032
+ "TraceTaskPlanRejection",
994
1033
  "TraceTaskPlanSnapshot",
995
1034
  "TraceTaskPlanStepItem",
996
1035
  "TraceTerminal",
@@ -1157,6 +1196,7 @@
1157
1196
  "AgentsButtonProps",
1158
1197
  "AgentsButtonSize",
1159
1198
  "AgentsButtonVariant",
1199
+ "AgentsCanvasLayout",
1160
1200
  "AgentsCheckboxProps",
1161
1201
  "AgentsChoiceOption",
1162
1202
  "AgentsComponents",
@@ -1 +0,0 @@
1
- {"version":3,"file":"agents-http-trace-mappers-LWNi-3a4.js","sources":["../../src/client/http/agents-http-mappers.ts","../../src/client/http/agents-http-trace-mappers.ts"],"sourcesContent":["import {\n AGENTS_CLIENT_CONTEXT_LIMITS,\n AgentsClientError,\n type AgentsClientContext,\n type AgentsClientErrorKind,\n type AgentsConversation,\n type AgentsConversationMessage,\n type BoundConversationSubject,\n type ConversationActivity,\n type ConversationActivityElement,\n type ConversationMessageAuthorType,\n type ConversationMessageRole,\n type ConversationMessageSearchHit,\n type ConversationMessageStatus,\n type ConversationMessageType,\n type ConversationProgressStep,\n type ConversationRunState,\n type ConversationRunStateRead,\n type ConversationSearchGroup,\n type ConversationSubAgent,\n type SelectableModel,\n} from \"../../contract/conversation\";\nimport type {\n WireActivityLine,\n WireBoundConversationSubject,\n WireClientContext,\n WireClientContextRouteParameter,\n WireConversation,\n WireConversationActivityResponse,\n WireConversationMessage,\n WireConversationRunStateResponse,\n WireConversationSearchGroup,\n WireCustomerProgressStep,\n WireDelegationSubAgentRecord,\n WireErrorBody,\n WireSelectableModel,\n WireSemanticSearchHit,\n WireSet,\n} from \"./agents-http-wire\";\n\n// The vocabularies of the contract: a wire value outside one maps to null.\nconst RUN_STATES: readonly ConversationRunState[] = [\n \"IDLE\",\n \"QUEUED\",\n \"RUNNING\",\n \"AWAITING_DELEGATES\",\n \"FAILED\",\n \"COMPLETED\",\n \"CANCELLED\",\n];\nconst MESSAGE_ROLES: readonly ConversationMessageRole[] = [\"SYSTEM\", \"USER\", \"ASSISTANT\"];\nconst MESSAGE_TYPES: readonly ConversationMessageType[] = [\n \"TEXT\",\n \"TOOL_CALL\",\n \"CHECKPOINT\",\n \"ERROR\",\n \"SIGNAL\",\n \"TOOL_MESSAGE\",\n];\nconst MESSAGE_STATUSES: readonly ConversationMessageStatus[] = [\n \"PENDING\",\n \"RUNNING\",\n \"CANCEL_REQUESTED\",\n \"CANCELLED\",\n \"COMPLETED\",\n \"FAILED\",\n];\nconst AUTHOR_TYPES: readonly ConversationMessageAuthorType[] = [\"USER\", \"ASSISTANT\", \"AGENT\", \"TOOL\"];\nconst PROGRESS_STEP_STATUSES: readonly ConversationProgressStep[\"status\"][] = [\"done\", \"active\", \"upcoming\"];\nconst ACTIVITY_STATES: readonly NonNullable<ConversationActivityElement[\"state\"]>[] = [\n \"queued\",\n \"running\",\n \"finished\",\n \"failed\",\n \"skipped\",\n];\nconst ACTIVITY_KINDS: readonly NonNullable<ConversationActivityElement[\"kind\"]>[] = [\n \"tool\",\n \"delegation\",\n \"background\",\n \"long\",\n \"turnStart\",\n];\n\nconst readVocabularyValue = <Value extends string>(vocabulary: readonly Value[], value: unknown): Value | null =>\n typeof value === \"string\" && (vocabulary as readonly string[]).includes(value) ? (value as Value) : null;\n\nconst readNumberOrNull = (value: unknown): number | null =>\n typeof value === \"number\" && Number.isFinite(value) ? value : null;\n\nconst readStringOrNull = (value: unknown): string | null => (typeof value === \"string\" ? value : null);\n\n/** The elements of a serialized set (`{ elements: [...] }`), a plain array, or the values of a keyed object. */\nexport const readWireSetElements = <Element>(\n wireSet: WireSet<Element> | Record<string, Element> | null | undefined,\n): Element[] => {\n if (!wireSet) return [];\n if (Array.isArray(wireSet)) return wireSet;\n if (typeof wireSet === \"object\" && \"elements\" in wireSet) {\n const elements = (wireSet as { elements?: Element[] | null }).elements;\n return Array.isArray(elements) ? elements : [];\n }\n return Object.values(wireSet as Record<string, Element>);\n};\n\nconst mapWireProgressStep = (wireStep: WireCustomerProgressStep): ConversationProgressStep => ({\n key: wireStep.key ?? \"\",\n label: wireStep.customerLabel ?? \"\",\n status: readVocabularyValue(PROGRESS_STEP_STATUSES, wireStep.status) ?? \"upcoming\",\n});\n\n/** An `AIConversation` as the contract's conversation. */\nexport const mapWireConversation = (wireConversation: WireConversation): AgentsConversation => {\n const conversation: AgentsConversation = {\n id: wireConversation.id ?? 0,\n agentSpaceKey: readNumberOrNull(wireConversation.agentSpaceId),\n runState: readVocabularyValue(RUN_STATES, wireConversation.runState),\n agentTurnOwedAt: readStringOrNull(wireConversation.agentTurnOwedAt),\n title: readStringOrNull(wireConversation.summary?.title),\n titleManuallyEdited: wireConversation.summary?.manuallyEdited === true,\n summary: readStringOrNull(wireConversation.summary?.text),\n created: readStringOrNull(wireConversation.created ?? wireConversation.changeHistory?.createdTime),\n updated: readStringOrNull(wireConversation.updated ?? wireConversation.changeHistory?.modifiedTime),\n purposeName: readStringOrNull(wireConversation.purposeName),\n initiatorType: readStringOrNull(wireConversation.initiatorType),\n scheduleId: readNumberOrNull(wireConversation.scheduleId),\n entryPointKey: readStringOrNull(wireConversation.entryPointKey),\n progressSteps: readWireSetElements(wireConversation.customerProgressSteps).map(mapWireProgressStep),\n };\n if (wireConversation.lastMessageId !== undefined) conversation.lastMessageId = readNumberOrNull(wireConversation.lastMessageId);\n if (wireConversation.aiPromptExtensionId !== undefined) {\n conversation.promptExtensionId = readNumberOrNull(wireConversation.aiPromptExtensionId);\n }\n return conversation;\n};\n\nconst mapWireSubAgent = (wireSubAgent: WireDelegationSubAgentRecord | null | undefined): ConversationSubAgent | null =>\n wireSubAgent\n ? {\n currentRunNumber: readNumberOrNull(wireSubAgent.currentRunNumber),\n runs: readWireSetElements(wireSubAgent.runs).map((wireRun) => ({\n runNumber: readNumberOrNull(wireRun.runNumber),\n status: readStringOrNull(wireRun.status),\n })),\n }\n : null;\n\n/** An `AIConversationMessage` as the contract's message. */\nexport const mapWireConversationMessage = (wireMessage: WireConversationMessage): AgentsConversationMessage => {\n const message: AgentsConversationMessage = {\n id: wireMessage.id ?? 0,\n conversationId: readNumberOrNull(wireMessage.aiConversationId),\n indexInConversation: readNumberOrNull(wireMessage.indexInConversation),\n role: readVocabularyValue(MESSAGE_ROLES, wireMessage.role),\n messageType: readVocabularyValue(MESSAGE_TYPES, wireMessage.messageType),\n status: readVocabularyValue(MESSAGE_STATUSES, wireMessage.status),\n authorType: readVocabularyValue(AUTHOR_TYPES, wireMessage.authorType),\n signalSource: readStringOrNull(wireMessage.signalSource),\n message: wireMessage.message ?? \"\",\n createdDate: readStringOrNull(wireMessage.createdDate),\n toolCall: wireMessage.toolCall\n ? {\n toolCallId: readStringOrNull(wireMessage.toolCall.toolCallId),\n name: readStringOrNull(wireMessage.toolCall.name),\n arguments: wireMessage.toolCall.arguments ?? null,\n status: readStringOrNull(wireMessage.toolCall.status),\n }\n : null,\n delegatedConversations: readWireSetElements(wireMessage.delegatedConversations).map((delegated) => ({\n id: delegated.id ?? 0,\n runState: readVocabularyValue(RUN_STATES, delegated.runState),\n })),\n subAgent: mapWireSubAgent(wireMessage.delegationResults?.subAgent),\n };\n const hasForensics =\n wireMessage.inputTokens != null || wireMessage.outputTokens != null || wireMessage.requestSnapshot != null;\n if (hasForensics) {\n message.forensics = {\n inputTokens: readNumberOrNull(wireMessage.inputTokens),\n outputTokens: readNumberOrNull(wireMessage.outputTokens),\n costInUSD: readNumberOrNull(wireMessage.costInUSD),\n requestSnapshot: wireMessage.requestSnapshot ?? null,\n };\n }\n return message;\n};\n\n/** The run-state read (`AIConversationRunStateGetResponseDto`). */\nexport const mapWireConversationRunState = (wireRunState: WireConversationRunStateResponse): ConversationRunStateRead => ({\n id: wireRunState.id ?? 0,\n runState: readVocabularyValue(RUN_STATES, wireRunState.runState),\n agentTurnOwedAt: readStringOrNull(wireRunState.agentTurnOwedAt),\n lastMessageId: readNumberOrNull(wireRunState.lastMessageId),\n title: readStringOrNull(wireRunState.title),\n titleManuallyEdited: wireRunState.titleManuallyEdited === true,\n summary: readStringOrNull(wireRunState.summary),\n updated: readStringOrNull(wireRunState.updated),\n});\n\nconst mapWireActivityLine = (wireLine: WireActivityLine): ConversationActivityElement => ({\n toolCallMessageId: wireLine.toolCallMessageId ?? 0,\n batchId: readStringOrNull(wireLine.batchId),\n state: readVocabularyValue(ACTIVITY_STATES, wireLine.state),\n kind: readVocabularyValue(ACTIVITY_KINDS, wireLine.kind),\n childCount: readNumberOrNull(wireLine.childCount),\n helperIndex: readNumberOrNull(wireLine.helperIndex),\n line: readStringOrNull(wireLine.line),\n});\n\n/** The activity of a turn (`AIConversationActivityGetResponseDto`). */\nexport const mapWireConversationActivity = (wireActivity: WireConversationActivityResponse): ConversationActivity => ({\n turnMessageId: readNumberOrNull(wireActivity.turnMessageId),\n turnRunning: wireActivity.turnRunning === true,\n elements: readWireSetElements(wireActivity.elements).map(mapWireActivityLine),\n});\n\n/** A `SemanticSearchHit`. */\nexport const mapWireSearchHit = (wireHit: WireSemanticSearchHit): ConversationMessageSearchHit => ({\n messageId: readNumberOrNull(wireHit.messageId),\n conversationId: readNumberOrNull(wireHit.conversationId),\n indexInConversation: readNumberOrNull(wireHit.indexInConversation),\n role: readStringOrNull(wireHit.role),\n excerpt: wireHit.excerpt ?? \"\",\n relevance: readNumberOrNull(wireHit.relevance) ?? 0,\n created: readStringOrNull(wireHit.created),\n updated: readStringOrNull(wireHit.updated),\n title: readStringOrNull(wireHit.title),\n});\n\n/** An `AIConversationSearchGroup`. */\nexport const mapWireSearchGroup = (wireGroup: WireConversationSearchGroup): ConversationSearchGroup => ({\n conversationId: readNumberOrNull(wireGroup.conversationId),\n title: readStringOrNull(wireGroup.title),\n summary: readStringOrNull(wireGroup.summary),\n created: readStringOrNull(wireGroup.created),\n updated: readStringOrNull(wireGroup.updated),\n relevance: readNumberOrNull(wireGroup.relevance) ?? 0,\n hits: readWireSetElements(wireGroup.hits).map(mapWireSearchHit),\n});\n\n/** An `AgentCustomerSelectableModel`. */\nexport const mapWireSelectableModel = (wireModel: WireSelectableModel): SelectableModel => ({\n name: wireModel.name ?? \"\",\n displayName: wireModel.displayName ?? wireModel.name ?? \"\",\n description: wireModel.description ?? \"\",\n strengthLevel: readNumberOrNull(wireModel.strengthLevel),\n speedLevel: readNumberOrNull(wireModel.speedLevel),\n creditsMultiplier: readNumberOrNull(wireModel.creditsMultiplier),\n});\n\n/** The stable codes of the server's refusals the chat tells apart. */\nconst ERROR_KIND_BY_CODE: Readonly<Record<string, AgentsClientErrorKind>> = {\n AI_BUDGET_REACHED: \"budget\",\n RATE_LIMIT_EXCEEDED: \"rateLimit\",\n CONVERSATION_CLOSED: \"closed\",\n};\n\n/**\n * A refused request as the port's error: the stable code first (`errorCode` of the JSON body), then the status — 429\n * `rateLimit` (with `Retry-After`), 404 `notFound`, 403 and 401 `forbidden`, 5xx `network`, everything else `other`.\n */\nexport const mapHttpFailureToAgentsClientError = (\n httpStatus: number,\n wireErrorBody: WireErrorBody | null,\n retryAfterHeader: string | null,\n): AgentsClientError => {\n const code = wireErrorBody?.errorCode ?? wireErrorBody?.code ?? null;\n const message = wireErrorBody?.error ?? wireErrorBody?.message ?? undefined;\n const retryAfterOfHeader = retryAfterHeader !== null && /^\\d+$/.test(retryAfterHeader.trim()) ? Number(retryAfterHeader) : null;\n const retryAfterSeconds = readNumberOrNull(wireErrorBody?.retryAfterSeconds) ?? retryAfterOfHeader;\n const kindOfCode = code !== null ? ERROR_KIND_BY_CODE[code] : undefined;\n const kind: AgentsClientErrorKind =\n kindOfCode ??\n (httpStatus === 429\n ? \"rateLimit\"\n : httpStatus === 404\n ? \"notFound\"\n : httpStatus === 403 || httpStatus === 401\n ? \"forbidden\"\n : httpStatus >= 500\n ? \"network\"\n : \"other\");\n return new AgentsClientError(kind, { message: message ?? undefined, code, retryAfterSeconds, httpStatus });\n};\n\n// eslint-disable-next-line no-control-regex\nconst CONTROL_CHARACTERS = /[\\u0000-\\u001f\\u007f]/;\n\n/** A text field of the client context as it goes out: trimmed, or left out when empty, over its cap or not one line. */\nconst readClientContextText = (value: string | number | null | undefined, maxChars: number): string | undefined => {\n if (value === null || value === undefined) return undefined;\n const text = String(value).trim();\n if (text === \"\" || text.length > maxChars || CONTROL_CHARACTERS.test(text)) return undefined;\n return text;\n};\n\n/**\n * The client context as the body field `clientContext` carries it (`AgentClientContext`): the route parameters as a\n * list of `{name, value}`. A field over its cap ({@link AGENTS_CLIENT_CONTEXT_LIMITS}) or with a control character is\n * left out — never cut — so a send never fails on the context; the route parameters go together or not at all.\n * Undefined when nothing is left.\n */\nexport const mapClientContextToWire = (clientContext: AgentsClientContext | null | undefined): WireClientContext | undefined => {\n if (!clientContext) return undefined;\n const wireClientContext: WireClientContext = {};\n const routePath = readClientContextText(clientContext.routePath, AGENTS_CLIENT_CONTEXT_LIMITS.routePathChars);\n if (routePath !== undefined) wireClientContext.routePath = routePath;\n const routeParameters: WireClientContextRouteParameter[] = Object.entries(clientContext.routeParameters ?? {})\n .filter(([name, value]) => name.trim() !== \"\" && value !== null && value !== undefined)\n .map(([name, value]) => ({ name, value: String(value) }));\n const routeParametersText = routeParameters.map((routeParameter) => `${routeParameter.name}=${routeParameter.value}`).join(\"&\");\n if (\n routeParameters.length > 0 &&\n routeParameters.length <= AGENTS_CLIENT_CONTEXT_LIMITS.routeParameterCount &&\n routeParametersText.length <= AGENTS_CLIENT_CONTEXT_LIMITS.routeParametersChars &&\n !CONTROL_CHARACTERS.test(routeParametersText)\n ) {\n wireClientContext.routeParameters = routeParameters;\n }\n const recordKind = readClientContextText(clientContext.recordKind, AGENTS_CLIENT_CONTEXT_LIMITS.recordKindChars);\n if (recordKind !== undefined) wireClientContext.recordKind = recordKind;\n const recordId = readClientContextText(clientContext.recordId, AGENTS_CLIENT_CONTEXT_LIMITS.recordIdChars);\n if (recordId !== undefined) wireClientContext.recordId = recordId;\n const tab = readClientContextText(clientContext.tab, AGENTS_CLIENT_CONTEXT_LIMITS.tabChars);\n if (tab !== undefined) wireClientContext.tab = tab;\n return Object.keys(wireClientContext).length > 0 ? wireClientContext : undefined;\n};\n\n/** The record of an answer (`AIConversationBoundSubject`), or null when it names none. */\nexport const mapWireBoundConversationSubject = (wireSubject: WireBoundConversationSubject | null | undefined): BoundConversationSubject | null => {\n const entityId = Number(wireSubject?.subjectEntityId ?? 0);\n if (!wireSubject || !wireSubject.subjectEntityClass || !Number.isInteger(entityId) || entityId < 1) return null;\n return {\n conversationId: wireSubject.aiConversationId ?? null,\n entityClass: wireSubject.subjectEntityClass,\n entityId,\n name: wireSubject.name ?? null,\n link: wireSubject.link ?? null,\n purposeId: wireSubject.purposeName ?? null,\n };\n};\n","import type {\n ConversationContextComposition,\n ConversationContextSegment,\n ConversationFileChange,\n ConversationFileChangeDiff,\n ConversationFileChangeDiffState,\n ConversationFileChangeType,\n ConversationTraceCompaction,\n ConversationTraceDecision,\n ConversationTraceDecisionProbability,\n ConversationTraceEntityReference,\n ConversationTraceFieldChange,\n ConversationTraceLevel,\n ConversationTraceLoadedSkill,\n ConversationTraceLoadedSkillTool,\n ConversationTraceMessage,\n ConversationTraceModelCall,\n ConversationTraceRecordChange,\n ConversationTraceRecordChangeOperation,\n ConversationTraceRefusalReason,\n ConversationTraceSignal,\n ConversationTraceSkillLoad,\n ConversationTraceSkillLoadEntry,\n ConversationTraceStep,\n ConversationTraceStepKind,\n ConversationTraceStepStatus,\n ConversationTraceSubAgent,\n ConversationTraceSubAgentRun,\n ConversationTraceSubAgentTaskKind,\n ConversationTraceTaskPlanItem,\n ConversationTraceTerminal,\n ConversationTraceToolEffect,\n ConversationTraceWidget,\n ConversationTraceWindowMode,\n ConversationTurnStop,\n ConversationTurnTrace,\n ConversationTurnTraces,\n ConversationTurnTraceTotals,\n} from \"../../contract/conversation-trace\";\nimport { readWireSetElements } from \"./agents-http-mappers\";\nimport type {\n WireContextComposition,\n WireContextCompositionResponse,\n WireContextSegment,\n WireFileChangeDiffResponse,\n WireTurnStopResponse,\n WireTraceCompaction,\n WireTraceDecision,\n WireTraceFieldChange,\n WireTraceFileChange,\n WireTraceLoadedSkill,\n WireTraceMessage,\n WireTraceModelCall,\n WireTraceRecordChange,\n WireTraceRecordChanges,\n WireTraceSkillLoad,\n WireTraceSkillLoadEntry,\n WireTraceStep,\n WireTraceSubAgent,\n WireTraceSubAgentRun,\n WireTraceTaskPlanItem,\n WireTraceTerminal,\n WireTraceWidget,\n WireTurnTrace,\n WireTurnTraces,\n WireTurnTracesResponse,\n WireTurnTraceTotals,\n} from \"./agents-http-trace-wire\";\n\n// The mappers of the trace routes. They are tolerant on purpose: a field the server does not send reads as null (or\n// false, or an empty list), a value outside a vocabulary reads as null, a field the binding does not know is ignored.\n\nconst TRACE_LEVELS: readonly ConversationTraceLevel[] = [\"STEPS\", \"DEBUG\"];\nconst TRACE_WINDOW_MODES: readonly ConversationTraceWindowMode[] = [\"NEWEST\", \"FROM_TURN\", \"FOLLOW_UP\"];\nconst STEP_KINDS: readonly ConversationTraceStepKind[] = [\n \"THINKING\",\n \"MODEL_CALL\",\n \"TOOL_CALL\",\n \"SKILL_LOAD\",\n \"SUB_AGENT\",\n \"WIDGET\",\n \"COMPACTION\",\n \"SIGNAL\",\n \"DECISION\",\n \"TASK_PLAN\",\n \"ERROR\",\n];\nconst TOOL_EFFECTS: readonly ConversationTraceToolEffect[] = [\"READ\", \"WORKSPACE\", \"WRITE\", \"DELETE\"];\nconst STEP_STATUSES: readonly ConversationTraceStepStatus[] = [\n \"PENDING\",\n \"RUNNING\",\n \"COMPLETED\",\n \"FAILED\",\n \"CANCEL_REQUESTED\",\n \"CANCELLED\",\n \"ERROR\",\n \"REFUSED\",\n];\nconst REFUSAL_REASONS: readonly ConversationTraceRefusalReason[] = [\"turnAnswersOwner\", \"ownerWroteDuringTurn\", \"noSubAgentRunning\", \"other\"];\nconst SUB_AGENT_TASK_KINDS: readonly ConversationTraceSubAgentTaskKind[] = [\"agent\", \"toolRun\", \"awaitedRun\"];\nconst FILE_CHANGE_TYPES: readonly ConversationFileChangeType[] = [\"ADDED\", \"MODIFIED\", \"DELETED\", \"RENAMED\", \"DIRECTORY_CREATED\"];\nconst DIFF_STATES: readonly ConversationFileChangeDiffState[] = [\"NONE\", \"INLINE\", \"STORED\", \"BINARY\", \"TOO_LARGE\", \"UNAVAILABLE\"];\n\nconst readVocabularyValue = <Value extends string>(vocabulary: readonly Value[], value: unknown): Value | null =>\n typeof value === \"string\" && (vocabulary as readonly string[]).includes(value) ? (value as Value) : null;\n\nconst readNumberOrNull = (value: unknown): number | null =>\n typeof value === \"number\" && Number.isFinite(value) ? value : null;\n\nconst readStringOrNull = (value: unknown): string | null => (typeof value === \"string\" ? value : null);\n\nconst isPlainObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** The same check for a value whose wire shape is known: the shape stays, null and a non-object are ruled out. */\nconst isWireObject = <Wire extends object>(value: Wire | null | undefined): value is Wire => isPlainObject(value);\n\n/** A list of strings from a set, an array or a comma-separated text. */\nconst readStringList = (value: unknown): string[] => {\n if (typeof value === \"string\") return value.split(\",\").map((part) => part.trim()).filter((part) => part !== \"\");\n if (!isPlainObject(value) && !Array.isArray(value)) return [];\n return readWireSetElements(value as string[]).filter((element): element is string => typeof element === \"string\");\n};\n\nconst mapWireTraceModelCall = (wireModelCall: WireTraceModelCall | null | undefined): ConversationTraceModelCall | null =>\n isPlainObject(wireModelCall)\n ? {\n modelName: readStringOrNull(wireModelCall.modelName),\n effort: readStringOrNull(wireModelCall.reasoningEffort),\n inputTokens: readNumberOrNull(wireModelCall.inputTokens),\n outputTokens: readNumberOrNull(wireModelCall.outputTokens),\n cachedInputTokens: readNumberOrNull(wireModelCall.cachedInputTokens),\n cachePercent: readNumberOrNull(wireModelCall.cachePercent),\n costInUsd: readNumberOrNull(wireModelCall.costInUSD ?? wireModelCall.costInUsd),\n reasoningTokens: readNumberOrNull(wireModelCall.reasoningTokens),\n cacheWriteTokens: readNumberOrNull(wireModelCall.cacheWriteTokens),\n wireApi: readStringOrNull(wireModelCall.wireApi),\n forcedToolChoice: readStringOrNull(wireModelCall.forcedToolChoice ?? wireModelCall.forceToolChoice),\n providerCallMs: readNumberOrNull(wireModelCall.providerCallMs),\n loopOverheadMs: readNumberOrNull(wireModelCall.loopOverheadMs),\n hasStoredPayload: wireModelCall.hasStoredPayload === true,\n contextMessageId: readNumberOrNull(wireModelCall.contextMessageId),\n callNumberInTurn: readNumberOrNull(wireModelCall.callNumberInTurn),\n toolNames: readStringList(wireModelCall.toolNames),\n stopReason: readStringOrNull(wireModelCall.stopReason),\n toolDelivery: readStringOrNull(wireModelCall.toolDelivery),\n retryCount: readNumberOrNull(wireModelCall.retryCount),\n }\n : null;\n\n/** A JSON text from a field that carries text, or an object the server did not encode. */\nconst readJsonTextOrNull = (value: unknown): string | null => {\n if (typeof value === \"string\") return value === \"\" ? null : value;\n if (isPlainObject(value) || Array.isArray(value)) return JSON.stringify(value);\n return null;\n};\n\n/** The probabilities of a decision (name → probability), highest first. */\nconst readDecisionProbabilities = (value: unknown): ConversationTraceDecisionProbability[] =>\n isPlainObject(value)\n ? Object.entries(value)\n .filter((entry): entry is [string, number] => typeof entry[1] === \"number\" && Number.isFinite(entry[1]))\n .map(([name, probability]) => ({ name, probability }))\n .sort((left, right) => right.probability - left.probability)\n : [];\n\n/**\n * The decision of a `DECISION` step. The server's `decision` object is read as it is. A server that sends only the\n * stored event (`eventSite`, `eventPayloadExcerpt`) still names the decision: its site, and from the payload's start\n * who decided and whether the loop acted on it; the payload is what the loop resolved (`outcomeJson`).\n */\nconst mapWireTraceDecision = (wireStep: WireTraceStep): ConversationTraceDecision | null => {\n const wireDecision: WireTraceDecision | null = isWireObject(wireStep.decision) ? wireStep.decision : null;\n const eventSite = readStringOrNull(wireStep.eventSite);\n const eventPayload = readStringOrNull(wireStep.eventPayloadExcerpt);\n if (wireDecision === null && eventSite === null && eventPayload === null) return null;\n // The excerpt may be cut in the middle of its JSON: the two facts are read by their names, not by parsing it.\n const decidedBy = readStringOrNull(wireDecision?.decidedBy) ?? (eventPayload === null ? null : (/\"decidedBy\"\\s*:\\s*\"([^\"]*)\"/.exec(eventPayload)?.[1] ?? null));\n const appliedFlag = eventPayload === null ? null : (/\"applied\"\\s*:\\s*(true|false)/.exec(eventPayload)?.[1] ?? null);\n const isApplied = wireDecision?.isApplied === true || (wireDecision?.isApplied == null && appliedFlag === \"true\");\n const isFallback = decidedBy !== null && decidedBy.startsWith(\"fallback\");\n const derivedStatus = isFallback ? \"FALLBACK\" : decidedBy === \"shadow\" ? \"SHADOW\" : isApplied ? \"APPLIED\" : decidedBy !== null || appliedFlag !== null ? \"DECIDED\" : null;\n const derivedFallbackReason = isFallback ? (decidedBy ?? \"\").replace(/^fallback:?\\s*/, \"\") || null : null;\n return {\n site: readStringOrNull(wireDecision?.site) ?? eventSite,\n siteLabel: readStringOrNull(wireDecision?.siteLabel),\n subject: readStringOrNull(wireDecision?.subject) ?? readStringOrNull(wireStep.eventSubject),\n engine: readStringOrNull(wireDecision?.engine),\n engineLabel: readStringOrNull(wireDecision?.engineLabel) ?? (isFallback ? null : decidedBy),\n mode: readStringOrNull(wireDecision?.mode),\n status: readStringOrNull(wireDecision?.status) ?? derivedStatus,\n resultSummary: readStringOrNull(wireDecision?.resultSummary),\n modelName: readStringOrNull(wireDecision?.modelName),\n modelVersion: readStringOrNull(wireDecision?.modelVersion),\n durationMs: readNumberOrNull(wireDecision?.durationMs) ?? readNumberOrNull(wireStep.durationMs),\n sharedRequestDecisionCount: readNumberOrNull(wireDecision?.sharedRequestDecisionCount),\n confidence: readNumberOrNull(wireDecision?.confidence),\n probabilities: readDecisionProbabilities(wireDecision?.probabilities),\n fallbackReason: readStringOrNull(wireDecision?.fallbackReason) ?? derivedFallbackReason,\n skipReason: readStringOrNull(wireDecision?.skipReason),\n inputJson: readJsonTextOrNull(wireDecision?.inputJson),\n isInputCut: wireDecision?.isInputCut === true,\n questionsJson: readJsonTextOrNull(wireDecision?.questionsJson),\n isQuestionsCut: wireDecision?.isQuestionsCut === true,\n outputJson: readJsonTextOrNull(wireDecision?.outputJson),\n isOutputCut: wireDecision?.isOutputCut === true,\n outcomeJson: readJsonTextOrNull(wireDecision?.outcomeJson) ?? eventPayload,\n isOutcomeCut: wireDecision?.isOutcomeCut === true,\n };\n};\n\nconst mapWireTraceCompaction = (wireCompaction: WireTraceCompaction | null | undefined): ConversationTraceCompaction | null => {\n if (!isWireObject(wireCompaction)) return null;\n const tokensBefore = readNumberOrNull(wireCompaction.coveredTokens);\n const tokensAfter = readNumberOrNull(wireCompaction.summaryTokens);\n const compressionPercentOfTokens =\n tokensBefore !== null && tokensAfter !== null && tokensBefore > 0 ? Math.round(((tokensBefore - tokensAfter) / tokensBefore) * 100) : null;\n return {\n level: readNumberOrNull(wireCompaction.level),\n foldedMessageCount: readNumberOrNull(wireCompaction.coveredMessageCount),\n foldedFromMessageIndex: readNumberOrNull(wireCompaction.coveredFromMessageIndex),\n foldedToMessageIndex: readNumberOrNull(wireCompaction.coveredToMessageIndex),\n tokensBefore,\n tokensAfter,\n compressionPercent: readNumberOrNull(wireCompaction.compressionPercent) ?? compressionPercentOfTokens,\n modelName: readStringOrNull(wireCompaction.modelName),\n summaryText: readStringOrNull(wireCompaction.summaryText),\n isSummaryCut: wireCompaction.isSummaryCut === true,\n preservedFactsJson: readJsonTextOrNull(wireCompaction.preservedFactsJson),\n };\n};\n\n/** The signal of a `SIGNAL` step (the server writes its fields on the step itself). */\nconst mapWireTraceSignal = (wireStep: WireTraceStep): ConversationTraceSignal | null => {\n const source = readStringOrNull(wireStep.signalSource);\n const text = readStringOrNull(wireStep.signalText);\n const kind = readStringOrNull(wireStep.signalKind) ?? (text === null ? null : (/^\\[SIGNAL:([^\\]]+)\\]/.exec(text)?.[1] ?? null));\n const tag = readStringOrNull(wireStep.signalTag) ?? (text === null ? null : (/^\\s*\\[SIGNAL:([^\\]\\s]+)\\]/.exec(text)?.[1] ?? null));\n return source === null && text === null && kind === null ? null : { source, kind, tag, text, isTextCut: wireStep.isSignalTextCut === true };\n};\n\nconst mapWireTraceWidget = (wireWidget: WireTraceWidget | null | undefined): ConversationTraceWidget | null =>\n isWireObject(wireWidget)\n ? {\n type: readStringOrNull(wireWidget.type),\n emittedBy: readStringOrNull(wireWidget.emittedBy),\n isValid: wireWidget.isValid !== false,\n title: readStringOrNull(wireWidget.title),\n summary: readStringOrNull(wireWidget.summary),\n payloadJson: readJsonTextOrNull(wireWidget.payloadJson),\n isPayloadCut: wireWidget.isPayloadCut === true,\n messageId: readNumberOrNull(wireWidget.messageId),\n stepId: readStringOrNull(wireWidget.stepId),\n }\n : null;\n\nconst mapWireTraceLoadedSkillTools = (wireTools: WireTraceSkillLoadEntry[\"tools\"]): ConversationTraceLoadedSkillTool[] =>\n readWireSetElements(wireTools)\n .filter(isPlainObject)\n .map((wireTool) => ({\n name: readStringOrNull(wireTool.name) ?? \"\",\n residentTokens: readNumberOrNull(wireTool.residentTokens),\n usageCount: readNumberOrNull(wireTool.usageCount),\n }));\n\nconst mapWireTraceSkillLoad = (wireSkillLoad: WireTraceSkillLoad | null | undefined): ConversationTraceSkillLoad | null =>\n isWireObject(wireSkillLoad)\n ? {\n cause: readStringOrNull(wireSkillLoad.cause),\n loadedCount: readNumberOrNull(wireSkillLoad.loadedCount),\n notLoadedCount: readNumberOrNull(wireSkillLoad.notLoadedCount),\n requestedNames: readStringList(wireSkillLoad.requestedNames),\n skills: readWireSetElements(wireSkillLoad.skills)\n .filter(isPlainObject)\n .map(\n (wireEntry: WireTraceSkillLoadEntry): ConversationTraceSkillLoadEntry => ({\n name: readStringOrNull(wireEntry.name) ?? \"\",\n type: readStringOrNull(wireEntry.type),\n outcome: readStringOrNull(wireEntry.outcome),\n cause: readStringOrNull(wireEntry.cause),\n residentTokens: readNumberOrNull(wireEntry.residentTokens),\n residentTokensWithTools: readNumberOrNull(wireEntry.residentTokensWithTools),\n tools: mapWireTraceLoadedSkillTools(wireEntry.tools),\n }),\n ),\n notLoadedText: readStringOrNull(wireSkillLoad.notLoadedText),\n }\n : null;\n\nexport const mapWireTraceTaskPlanItems = (wireItems: WireTraceStep[\"taskPlanItems\"]): ConversationTraceTaskPlanItem[] =>\n readWireSetElements(wireItems)\n .filter(isPlainObject)\n .map((wireItem: WireTraceTaskPlanItem, position) => ({\n key: readStringOrNull(wireItem.key) ?? readStringOrNull(wireItem.numberPath) ?? String(position),\n numberPath: readStringOrNull(wireItem.numberPath),\n depth: readNumberOrNull(wireItem.depth) ?? 0,\n title: readStringOrNull(wireItem.title) ?? \"\",\n status: readStringOrNull(wireItem.status),\n }));\n\nconst mapWireTraceLoadedSkill = (wireSkill: WireTraceLoadedSkill): ConversationTraceLoadedSkill => ({\n name: readStringOrNull(wireSkill.name) ?? \"\",\n residentTokens: readNumberOrNull(wireSkill.residentTokens),\n isNew: wireSkill.isNew === true,\n isAlwaysLoaded: wireSkill.isAlwaysLoaded === true,\n cause: readStringOrNull(wireSkill.cause ?? wireSkill.source),\n tools: mapWireTraceLoadedSkillTools(wireSkill.tools),\n});\n\nconst mapWireTraceTerminal = (wireTerminal: WireTraceTerminal | null | undefined): ConversationTraceTerminal | null =>\n isPlainObject(wireTerminal)\n ? {\n command: readStringOrNull(wireTerminal.command),\n cwd: readStringOrNull(wireTerminal.cwd),\n exitCode: readNumberOrNull(wireTerminal.exitCode),\n durationMs: readNumberOrNull(wireTerminal.durationMs),\n output: readStringOrNull(wireTerminal.output),\n errorOutput: readStringOrNull(wireTerminal.errorOutput),\n isTruncated: wireTerminal.isTruncated === true,\n isBackground: wireTerminal.isBackground === true,\n timedOut: wireTerminal.timedOut === true,\n }\n : null;\n\n/** An `AgentTraceFileChange` as the contract's file change. */\nexport const mapWireTraceFileChange = (wireFileChange: WireTraceFileChange): ConversationFileChange => ({\n id: readNumberOrNull(wireFileChange.fileChangeId ?? wireFileChange.id),\n source: readStringOrNull(wireFileChange.source),\n mountKind: readStringOrNull(wireFileChange.mountKind),\n mountName: readStringOrNull(wireFileChange.mountName),\n driveSpaceId: readNumberOrNull(wireFileChange.driveSpaceId),\n path: readStringOrNull(wireFileChange.path) ?? \"\",\n previousPath: readStringOrNull(wireFileChange.previousPath),\n changeType: readVocabularyValue(FILE_CHANGE_TYPES, wireFileChange.changeType),\n sizeBefore: readNumberOrNull(wireFileChange.sizeBefore),\n sizeAfter: readNumberOrNull(wireFileChange.sizeAfter),\n sha256Before: readStringOrNull(wireFileChange.sha256Before),\n sha256After: readStringOrNull(wireFileChange.sha256After),\n contentType: readStringOrNull(wireFileChange.contentType),\n isBinary: wireFileChange.isBinary === true,\n linesAdded: readNumberOrNull(wireFileChange.linesAdded),\n linesRemoved: readNumberOrNull(wireFileChange.linesRemoved),\n diffState: readVocabularyValue(DIFF_STATES, wireFileChange.diffState),\n diffPreview: readStringOrNull(wireFileChange.diffPreview),\n driveNodeId: readNumberOrNull(wireFileChange.driveNodeId),\n driveFileVersionId: readNumberOrNull(wireFileChange.driveFileVersionId),\n externalRevisionId: readStringOrNull(wireFileChange.externalRevisionId),\n});\n\nconst mapWireTraceSubAgentRun = (wireRun: WireTraceSubAgentRun): ConversationTraceSubAgentRun => ({\n runNumber: readNumberOrNull(wireRun.runNumber),\n status: readStringOrNull(wireRun.status),\n startedAt: readStringOrNull(wireRun.startedAt),\n finishedAt: readStringOrNull(wireRun.finishedAt),\n verdict: readStringOrNull(wireRun.verdict),\n failureReason: readStringOrNull(wireRun.failureReason),\n costInUsd: readNumberOrNull(wireRun.costInUsd ?? wireRun.costInUSD),\n inputTokens: readNumberOrNull(wireRun.inputTokens),\n outputTokens: readNumberOrNull(wireRun.outputTokens),\n resultText: readStringOrNull(wireRun.resultText),\n isResultTextCut: wireRun.isResultTextCut === true,\n isToolResponse: wireRun.isToolResponse === true,\n isError: typeof wireRun.isError === \"boolean\" ? wireRun.isError : null,\n});\n\nconst mapWireTraceSubAgent = (wireSubAgent: WireTraceSubAgent | null | undefined): ConversationTraceSubAgent | null => {\n if (!isWireObject(wireSubAgent)) return null;\n const runs = readWireSetElements(wireSubAgent.runs).filter(isPlainObject).map(mapWireTraceSubAgentRun);\n return {\n number: readNumberOrNull(wireSubAgent.number),\n label: readStringOrNull(wireSubAgent.label) ?? \"\",\n taskText: readStringOrNull(wireSubAgent.taskText),\n skillNames: readStringList(wireSubAgent.skillNames),\n childConversationId: readNumberOrNull(wireSubAgent.childConversationId),\n status: readStringOrNull(wireSubAgent.status) ?? runs[runs.length - 1]?.status ?? null,\n runs,\n modelName: readStringOrNull(wireSubAgent.modelName ?? wireSubAgent.childModelNames),\n modelLabel: readStringOrNull(wireSubAgent.childModelLabels),\n costInUsd: readNumberOrNull(wireSubAgent.childCostInUSD ?? wireSubAgent.childCostInUsd),\n inputTokens: readNumberOrNull(wireSubAgent.childInputTokens),\n outputTokens: readNumberOrNull(wireSubAgent.childOutputTokens),\n cachedInputTokens: readNumberOrNull(wireSubAgent.childCachedInputTokens),\n messageCount: readNumberOrNull(wireSubAgent.childMessageCount),\n taskKind: readVocabularyValue(SUB_AGENT_TASK_KINDS, wireSubAgent.taskKind),\n toolName: readStringOrNull(wireSubAgent.toolName),\n operationName: readStringOrNull(wireSubAgent.operationName),\n backgroundJobKey: readStringOrNull(wireSubAgent.backgroundJobKey),\n verdictText: readStringOrNull(wireSubAgent.verdictText),\n resultText: readStringOrNull(wireSubAgent.resultText),\n isResultTextCut: wireSubAgent.isResultTextCut === true,\n };\n};\n\nconst mapWireTraceEntityReference = (wireReference: unknown): ConversationTraceEntityReference | null => {\n if (!isPlainObject(wireReference)) return null;\n const argumentName = readStringOrNull(wireReference.argumentName);\n const id = readNumberOrNull(wireReference.id);\n return argumentName !== null && argumentName !== \"\" && id !== null ? { argumentName, id } : null;\n};\n\nconst RECORD_CHANGE_OPERATIONS: readonly ConversationTraceRecordChangeOperation[] = [\"CREATED\", \"CHANGED\", \"DELETED\"];\n\nconst mapWireTraceFieldChange = (wireFieldChange: WireTraceFieldChange | null | undefined): ConversationTraceFieldChange | null => {\n if (!isWireObject(wireFieldChange)) return null;\n const fieldName = readStringOrNull(wireFieldChange.fieldName);\n if (fieldName === null || fieldName === \"\") return null;\n return {\n fieldName,\n before: readStringOrNull(wireFieldChange.before),\n after: readStringOrNull(wireFieldChange.after),\n isCut: wireFieldChange.isCut === true,\n };\n};\n\nconst mapWireTraceRecordChange = (wireRecordChange: WireTraceRecordChange | null | undefined): ConversationTraceRecordChange | null => {\n if (!isWireObject(wireRecordChange)) return null;\n const operation = readVocabularyValue(RECORD_CHANGE_OPERATIONS, wireRecordChange.operation);\n const tableName = readStringOrNull(wireRecordChange.tableName);\n if (operation === null || tableName === null || tableName === \"\") return null;\n return {\n operation,\n tableName,\n recordId: readNumberOrNull(wireRecordChange.recordId),\n fieldChanges: readWireSetElements(wireRecordChange.fieldChanges)\n .map(mapWireTraceFieldChange)\n .filter((fieldChange): fieldChange is ConversationTraceFieldChange => fieldChange !== null),\n omittedFieldCount: readNumberOrNull(wireRecordChange.omittedFieldCount) ?? 0,\n };\n};\n\n/** The readable thinking of a model call, with an ellipsis when the server cut it; null without one. */\nconst readThinkingSummary = (wireStep: WireTraceStep): string | null => {\n const thinkingSummary = readStringOrNull(wireStep.thinkingSummary);\n if (thinkingSummary === null || thinkingSummary.trim() === \"\") return null;\n return wireStep.isThinkingSummaryCut === true ? `${thinkingSummary}…` : thinkingSummary;\n};\n\n/** The record changes of a writing call (`ToolCallRecordChanges`); empty without them. */\nconst mapWireTraceRecordChanges = (\n wireRecordChanges: WireTraceRecordChanges | null | undefined,\n): { recordChanges: ConversationTraceRecordChange[]; omittedRecordChangeCount: number } => {\n if (!isWireObject(wireRecordChanges)) return { recordChanges: [], omittedRecordChangeCount: 0 };\n return {\n recordChanges: readWireSetElements(wireRecordChanges.elements)\n .map(mapWireTraceRecordChange)\n .filter((recordChange): recordChange is ConversationTraceRecordChange => recordChange !== null),\n omittedRecordChangeCount: readNumberOrNull(wireRecordChanges.omittedRecordCount) ?? 0,\n };\n};\n\n/**\n * An `AgentTraceStep` as the contract's step. A step of a kind the binding does not know is mapped to null and left\n * out of its turn. `position` is the step's place in its turn (part of its key when the server sends no step id).\n */\nexport const mapWireTraceStep = (wireStep: WireTraceStep, position: number): ConversationTraceStep | null => {\n if (!isWireObject(wireStep)) return null;\n const kind = readVocabularyValue(STEP_KINDS, wireStep.kind);\n if (kind === null) return null;\n const messageId = readNumberOrNull(wireStep.messageId);\n const loadedSkills =\n wireStep.loadedSkills == null ? null : readWireSetElements(wireStep.loadedSkills).filter(isPlainObject).map(mapWireTraceLoadedSkill);\n const stepId = typeof wireStep.stepId === \"number\" ? String(wireStep.stepId) : readStringOrNull(wireStep.stepId) || null;\n const widget = mapWireTraceWidget(wireStep.widget);\n return {\n key: stepId ?? `${messageId ?? \"event\"}:${kind}:${readStringOrNull(wireStep.toolCallId) ?? position}`,\n stepId,\n turnNumber: readNumberOrNull(wireStep.turnNumber),\n kind,\n messageId,\n toolName: readStringOrNull(wireStep.toolName),\n deliveredThroughCallTool: wireStep.deliveredThroughCallTool === true,\n effect: readVocabularyValue(TOOL_EFFECTS, wireStep.effect),\n status: readVocabularyValue(STEP_STATUSES, wireStep.status),\n storedStatus: readStringOrNull(wireStep.storedStatus),\n refusalReason:\n wireStep.refusalReason == null ? null : (readVocabularyValue(REFUSAL_REASONS, wireStep.refusalReason) ?? \"other\"),\n backgroundOperationName: readStringOrNull(wireStep.backgroundOperationName),\n backgroundJobKey: readStringOrNull(wireStep.backgroundJobKey),\n startedAt: readStringOrNull(wireStep.startedAt),\n durationMs: readNumberOrNull(wireStep.durationMs),\n line: readStringOrNull(wireStep.line),\n toolNameInWords: readStringOrNull(wireStep.toolNameInWords),\n toolSkillNames: readStringList(wireStep.toolSkillNames),\n modelLabel: readStringOrNull(wireStep.modelLabel),\n thinkingSummary: readThinkingSummary(wireStep),\n entityReferences: readWireSetElements(wireStep.entityReferences)\n .map(mapWireTraceEntityReference)\n .filter((reference): reference is ConversationTraceEntityReference => reference !== null),\n ...mapWireTraceRecordChanges(wireStep.recordChanges),\n isHeldForConsent: wireStep.wasHeldForOwnerConsent === true || wireStep.isHeldForConsent === true,\n isRefused:\n wireStep.wasRefusedByGate === true || wireStep.wasRefusedAsDuplicate === true || wireStep.wasRefusedAsFinal === true,\n errorText: readStringOrNull(wireStep.errorText),\n errorCode: readStringOrNull(wireStep.errorCode),\n wasRetried: wireStep.wasRetried === true,\n widgetType: widget?.type ?? null,\n widget,\n decision: kind === \"DECISION\" ? mapWireTraceDecision(wireStep) : null,\n compaction: mapWireTraceCompaction(wireStep.compaction),\n signal: kind === \"SIGNAL\" ? mapWireTraceSignal(wireStep) : null,\n skillLoad: mapWireTraceSkillLoad(wireStep.skillLoad),\n taskPlanItems: mapWireTraceTaskPlanItems(wireStep.taskPlanItems),\n taskPlanTitle: readStringOrNull(wireStep.taskPlanTitle),\n taskPlanItemCount: readNumberOrNull(wireStep.taskPlanItemCount),\n taskPlanOpenItemCount: readNumberOrNull(wireStep.taskPlanOpenItemCount),\n taskPlanDoneItemCount: readNumberOrNull(wireStep.taskPlanDoneItemCount),\n taskPlanBlockedItemCount: readNumberOrNull(wireStep.taskPlanBlockedItemCount),\n terminal: mapWireTraceTerminal(wireStep.terminal),\n fileChanges: readWireSetElements(wireStep.fileChanges).filter(isPlainObject).map(mapWireTraceFileChange),\n subAgent: mapWireTraceSubAgent(wireStep.subAgent),\n argumentsJson: readStringOrNull(wireStep.argumentsJson),\n isArgumentsCut: wireStep.isArgumentsCut === true,\n result: readStringOrNull(wireStep.result),\n resultChars: readNumberOrNull(wireStep.resultChars),\n isResultCut: wireStep.isResultCut === true,\n modelCall: mapWireTraceModelCall(wireStep.modelCall),\n loadedSkills,\n loadedSkillNames: readStringList(wireStep.loadedSkillNames),\n assistantText: readStringOrNull(wireStep.assistantText) || null,\n assistantTextChars: readNumberOrNull(wireStep.assistantTextChars),\n isAssistantTextCut: wireStep.isAssistantTextCut === true,\n };\n};\n\n/** An `AgentTraceMessage`: a message of a turn with its text; null for anything that is no object. */\nexport const mapWireTraceMessage = (wireMessage: WireTraceMessage | null | undefined): ConversationTraceMessage | null => {\n if (!isWireObject(wireMessage)) return null;\n const text = readStringOrNull(wireMessage.text) ?? \"\";\n return {\n messageId: readNumberOrNull(wireMessage.messageId),\n messageIndex: readNumberOrNull(wireMessage.messageIndex),\n authorKind: readStringOrNull(wireMessage.authorKind),\n text,\n textChars: readNumberOrNull(wireMessage.textChars) ?? text.length,\n isTextCut: wireMessage.isTextCut === true,\n createdAt: readStringOrNull(wireMessage.createdAt),\n signalSource: readStringOrNull(wireMessage.signalSource),\n isInterim: wireMessage.isInterim === true,\n modelLabel: readStringOrNull(wireMessage.modelLabel),\n modelName: readStringOrNull(wireMessage.modelName),\n widgetTypes: readStringList(wireMessage.widgetTypes),\n widgets: readWireSetElements(wireMessage.widgets)\n .map((wireWidget) => mapWireTraceWidget(wireWidget))\n .filter((widget): widget is ConversationTraceWidget => widget !== null),\n isQueuedDuringRun: wireMessage.isQueuedDuringRun === true,\n arrivedDuringTurnNumber: readNumberOrNull(wireMessage.arrivedDuringTurnNumber),\n handledInTurnNumber: readNumberOrNull(wireMessage.handledInTurnNumber),\n foldSignalMessageId: readNumberOrNull(wireMessage.foldSignalMessageId),\n };\n};\n\n/** The share of the input tokens read from the cache, when the server sends the two counts but not the share. */\nconst readCachePercent = (wireTotals: WireTurnTraceTotals): number | null => {\n const cachePercent = readNumberOrNull(wireTotals.cachePercent);\n if (cachePercent !== null) return cachePercent;\n const inputTokens = readNumberOrNull(wireTotals.inputTokens);\n const cachedInputTokens = readNumberOrNull(wireTotals.cachedInputTokens);\n if (inputTokens === null || cachedInputTokens === null || inputTokens <= 0) return null;\n return Math.round((cachedInputTokens / inputTokens) * 100);\n};\n\nconst mapWireTurnTraceTotals = (wireTurn: WireTurnTrace, steps: ConversationTraceStep[]): ConversationTurnTraceTotals => {\n // The server writes the totals on the turn itself; an object of their own wins when one arrives.\n const wireTotals: WireTurnTraceTotals = isPlainObject(wireTurn.totals) ? { ...wireTurn, ...wireTurn.totals } : wireTurn;\n return {\n durationMs: readNumberOrNull(wireTotals.durationMs),\n inputTokens: readNumberOrNull(wireTotals.inputTokens),\n outputTokens: readNumberOrNull(wireTotals.outputTokens),\n cachedInputTokens: readNumberOrNull(wireTotals.cachedInputTokens),\n cachePercent: readCachePercent(wireTotals),\n costInUsd: readNumberOrNull(wireTotals.costInUSD ?? wireTotals.costInUsd),\n stepCount: readNumberOrNull(wireTotals.stepCount) ?? steps.length,\n commandCount: readNumberOrNull(wireTotals.commandCount) ?? steps.filter((step) => step.terminal !== null).length,\n fileCount: readNumberOrNull(wireTotals.fileCount) ?? steps.reduce((count, step) => count + step.fileChanges.length, 0),\n linesAdded: readNumberOrNull(wireTotals.linesAdded) ?? 0,\n linesRemoved: readNumberOrNull(wireTotals.linesRemoved) ?? 0,\n modelName: readStringOrNull(wireTotals.modelName),\n effort: readStringOrNull(wireTotals.reasoningEffort ?? wireTotals.effort),\n outcome: readStringOrNull(wireTotals.outcome),\n };\n};\n\n/** An `AgentTurnTrace` as the contract's turn trace. */\nexport const mapWireTurnTrace = (wireTurn: WireTurnTrace): ConversationTurnTrace => {\n const steps = readWireSetElements(wireTurn.steps)\n .map((wireStep, position) => mapWireTraceStep(wireStep, position))\n .filter((step): step is ConversationTraceStep => step !== null);\n return {\n turnNumber: readNumberOrNull(wireTurn.turnNumber) ?? 0,\n turnMessageId: readNumberOrNull(wireTurn.initiatorMessageId ?? wireTurn.turnMessageId),\n turnMessageIndex: readNumberOrNull(wireTurn.initiatorMessageIndex),\n startedAt: readStringOrNull(wireTurn.startedAt),\n isRunning: wireTurn.isRunning === true,\n isStoppedByOwner: wireTurn.isStoppedByOwner === true,\n initiatorMessage: mapWireTraceMessage(wireTurn.initiatorMessage),\n answerMessages: readWireSetElements(wireTurn.answerMessages)\n .map(mapWireTraceMessage)\n .filter((message): message is ConversationTraceMessage => message !== null),\n queuedMessages: readWireSetElements(wireTurn.queuedMessages)\n .map(mapWireTraceMessage)\n .filter((message): message is ConversationTraceMessage => message !== null),\n isStartedForQueuedOwnerMessage: wireTurn.isStartedForQueuedOwnerMessage === true,\n startedBySignalMessageId: readNumberOrNull(wireTurn.startedBySignalMessageId),\n steps,\n totals: mapWireTurnTraceTotals(wireTurn, steps),\n };\n};\n\n/** The object of an answer that carries `fieldName`: the answer itself, or the first of its fields that does. */\nconst findObjectWithField = <Found>(response: unknown, fieldName: string): Found | null => {\n if (!isPlainObject(response)) return null;\n if (fieldName in response) return response as Found;\n for (const value of Object.values(response)) {\n if (isPlainObject(value) && fieldName in value) return value as Found;\n }\n return null;\n};\n\n/** The traces of an answer: the object that carries the turns (`elements` of the set, or `turns`) or its paging facts. */\nconst findWireTurnTraces = (response: unknown): WireTurnTraces =>\n findObjectWithField<WireTurnTraces>(response, \"totalTurnCount\") ?? findObjectWithField<WireTurnTraces>(response, \"turns\") ?? {};\n\n/**\n * The trace read (`AgentTurnTraces`) as the contract's turn traces: the traces may be the answer itself or sit in one\n * of its fields (a response DTO). The turns are the elements of the set. An answer without turns reads as an empty\n * trace.\n */\nexport const mapWireTurnTraces = (response: WireTurnTracesResponse | null | undefined): ConversationTurnTraces => {\n const wireTraces = findWireTurnTraces(response);\n const turns = readWireSetElements(Array.isArray(wireTraces.elements) ? wireTraces.elements : wireTraces.turns).filter(isPlainObject).map(mapWireTurnTrace);\n return {\n conversationId: readNumberOrNull(wireTraces.aiConversationId),\n level: readVocabularyValue(TRACE_LEVELS, wireTraces.detailLevel) ?? \"STEPS\",\n turns,\n windowMode: readVocabularyValue(TRACE_WINDOW_MODES, wireTraces.windowMode),\n totalTurnCount: readNumberOrNull(wireTraces.totalTurnCount),\n firstTurnNumber: readNumberOrNull(wireTraces.firstTurnNumber) ?? turns[0]?.turnNumber ?? null,\n lastTurnNumber: readNumberOrNull(wireTraces.lastTurnNumber) ?? turns[turns.length - 1]?.turnNumber ?? null,\n hasOlderTurns: wireTraces.hasOlderTurns === true,\n hasNewerTurns: wireTraces.hasNewerTurns === true,\n newestMessageIndex: readNumberOrNull(wireTraces.newestMessageIndex),\n isRunLive: wireTraces.isRunLive === true,\n };\n};\n\nconst mapWireContextSegment = (wireSegment: WireContextSegment, position: number): ConversationContextSegment => {\n const key = readStringOrNull(wireSegment.key) ?? readStringOrNull(wireSegment.name) ?? readStringOrNull(wireSegment.type) ?? \"segment\";\n return {\n // The segments of a kind repeat (one per wire message): the position makes the key unique.\n key: `${key}:${position}`,\n label: readStringOrNull(wireSegment.label) ?? key,\n tokens: readNumberOrNull(wireSegment.tokenCount ?? wireSegment.tokens) ?? 0,\n percent: readNumberOrNull(wireSegment.percent),\n };\n};\n\n/**\n * The context composition of one model call. The server's answer carries the composition in `composition` (the\n * segments of the system message, of the tool schemas and of the wire messages, in the order the model read them) and\n * the compaction threshold beside it: the context's size is the provider's count of the newest call, the size it may\n * reach is the threshold in effect. A flat answer (`segments`, `totalTokens`, `contextWindowTokens`) is read as well.\n */\nexport const mapWireContextComposition = (\n response: WireContextCompositionResponse | null | undefined,\n): ConversationContextComposition => {\n const wireResponse: WireContextComposition = isPlainObject(response) ? response : {};\n const wireComposition = isWireObject(wireResponse.composition)\n ? wireResponse.composition\n : isWireObject(wireResponse.contextComposition)\n ? wireResponse.contextComposition\n : null;\n const wireSegments =\n wireComposition !== null\n ? [\n ...readWireSetElements(wireComposition.systemSegments),\n ...readWireSetElements(wireComposition.toolSchemaSegments),\n ...readWireSetElements(wireComposition.messageSegments),\n ]\n : readWireSetElements((findObjectWithField<WireContextComposition>(response, \"segments\") ?? {}).segments);\n const mappedSegments = wireSegments.filter(isPlainObject).map(mapWireContextSegment);\n const segmentTokens = mappedSegments.length > 0 ? mappedSegments.reduce((sum, segment) => sum + segment.tokens, 0) : null;\n const wireThreshold = isWireObject(wireResponse.compactionThreshold) ? wireResponse.compactionThreshold : null;\n const totalTokens = readNumberOrNull(wireResponse.totalTokens) ?? readNumberOrNull(wireThreshold?.latestContextInputTokens) ?? segmentTokens;\n const thresholdTokens = readNumberOrNull(wireThreshold?.thresholdTokens);\n const contextWindowTokens = readNumberOrNull(wireResponse.contextWindowTokens) ?? (thresholdTokens !== null && thresholdTokens > 0 ? thresholdTokens : null);\n const fillPercentOfTokens =\n totalTokens !== null && contextWindowTokens !== null && contextWindowTokens > 0\n ? Math.round((totalTokens / contextWindowTokens) * 100)\n : null;\n // The share of each segment in the composition, when the server sends none.\n const segments = mappedSegments.map((segment) =>\n segment.percent === null && segmentTokens !== null && segmentTokens > 0\n ? { ...segment, percent: Math.round((segment.tokens / segmentTokens) * 1000) / 10 }\n : segment,\n );\n return {\n messageId: readNumberOrNull(wireResponse.messageId ?? wireResponse.aiConversationMessageId),\n totalTokens,\n contextWindowTokens,\n fillPercent: readNumberOrNull(wireResponse.fillPercent) ?? fillPercentOfTokens,\n segments,\n };\n};\n\n/** The whole diff of a file change. */\nexport const mapWireFileChangeDiff = (\n response: WireFileChangeDiffResponse | null | undefined,\n fileChangeId: number,\n): ConversationFileChangeDiff => {\n const wireDiff = findObjectWithField<WireFileChangeDiffResponse>(response, \"diff\") ??\n findObjectWithField<WireFileChangeDiffResponse>(response, \"diffText\") ?? {};\n const wireFileChange = isWireObject(wireDiff.fileChange) ? wireDiff.fileChange : null;\n return {\n fileChangeId: readNumberOrNull(wireDiff.fileChangeId) ?? readNumberOrNull(wireFileChange?.fileChangeId ?? wireFileChange?.id) ?? fileChangeId,\n diff: readStringOrNull(wireDiff.diff) ?? readStringOrNull(wireDiff.diffText) ?? \"\",\n isCut: wireDiff.isCut === true || wireDiff.isDiffCut === true,\n };\n};\n\n/** The answer of the stop route: whether a running turn was stopped, and the run state after it. */\nexport const mapWireTurnStop = (response: WireTurnStopResponse | null | undefined): ConversationTurnStop => {\n const wireStop: WireTurnStopResponse = isPlainObject(response) ? response : {};\n return { isStopped: wireStop.isStopped === true, runState: readStringOrNull(wireStop.runState) };\n};\n"],"names":["readVocabularyValue","readNumberOrNull","readStringOrNull"],"mappings":";;AAyCA,MAAM,aAA8C;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,MAAM,gBAAoD,CAAC,UAAU,QAAQ,WAAW;AACxF,MAAM,gBAAoD;AAAA,EACxD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,MAAM,mBAAyD;AAAA,EAC7D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,MAAM,eAAyD,CAAC,QAAQ,aAAa,SAAS,MAAM;AACpG,MAAM,yBAAwE,CAAC,QAAQ,UAAU,UAAU;AAC3G,MAAM,kBAAgF;AAAA,EACpF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACA,MAAM,iBAA8E;AAAA,EAClF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAMA,wBAAsB,CAAuB,YAA8B,UAC/E,OAAO,UAAU,YAAa,WAAiC,SAAS,KAAK,IAAK,QAAkB;AAEtG,MAAMC,qBAAmB,CAAC,UACxB,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,QAAQ;AAEhE,MAAMC,qBAAmB,CAAC,UAAmC,OAAO,UAAU,WAAW,QAAQ;AAG1F,MAAM,sBAAsB,CACjC,YACc;AACd,MAAI,CAAC,QAAS,QAAO,CAAA;AACrB,MAAI,MAAM,QAAQ,OAAO,EAAG,QAAO;AACnC,MAAI,OAAO,YAAY,YAAY,cAAc,SAAS;AACxD,UAAM,WAAY,QAA4C;AAC9D,WAAO,MAAM,QAAQ,QAAQ,IAAI,WAAW,CAAA;AAAA,EAC9C;AACA,SAAO,OAAO,OAAO,OA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AAU,UAAU,KAAK,CAAA;AAC3E,QAAM,iBAAiB,aAAa,SAAS,UAAU,IAAI,SAAS,aAAa;AACjF,SAAO;AAAA,IACL,cAAc,iBAAiB,SAAS,YAAY,KAAK,iBAAiB,gBAAgB,gBAAgB,gBAAgB,EAAE,KAAK;AAAA,IACjI,MAAM,iBAAiB,SAAS,IAAI,KAAK,iBAAiB,SAAS,QAAQ,KAAK;AAAA,IAChF,OAAO,SAAS,UAAU,QAAQ,SAAS,cAAc;AAAA,EAAA;AAE7D;AAGO,MAAM,kBAAkB,CAAC,aAA4E;AAC1G,QAAM,WAAiC,cAAc,QAAQ,IAAI,WAAW,CAAA;AAC5E,SAAO,EAAE,WAAW,SAAS,cAAc,MAAM,UAAU,iBAAiB,SAAS,QAAQ,EAAA;AAC/F;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"canvas-title-slot-context-BRGnFzYP.js","sources":["../../src/renderer/resolve-deep-linkable-widget.ts","../../src/renderer/widget-click-signal-sources.ts","../../src/renderer/canvas/canvas-title-slot-context.ts"],"sourcesContent":["import type { CanvasId } from \"./canvas/canvas-behaviours\";\nimport { ConversationWidgetEntry, conversationWidgetRegistry } from \"./conversationWidgetRegistry\";\n\n/**\n * Resolves the widget a `?agentWidget=<name>` deep-link (or a restored pinned canvas) may mount, by its CANONICAL\n * registry wire name.\n *\n * A URL is untrusted input, so this is an allow-list rather than a registry lookup: only an entry that declares\n * `deepLinkable: true` can be opened this way. Every other widget is emitted by the agent inside a message, where the\n * conversation itself is the authorisation — a link must not be able to mount an arbitrary widget (some carry\n * mount-time side effects) just because its name was typed into the address bar.\n *\n * Returns the entry (the caller renders its `component`, applying the feature gate the entry declares) or null when the\n * name is empty, unknown, or not deep-linkable.\n */\nexport const resolveDeepLinkableWidget = (widgetName?: string | null): ConversationWidgetEntry | null => {\n if (!widgetName) return null;\n return (\n conversationWidgetRegistry.widgets.find((entry) => entry.name === widgetName && entry.deepLinkable === true) ?? null\n );\n};\n\n/**\n * The reverse direction: which deep-linkable widget re-opens THIS canvas. The open canvas of the agent chat is\n * mirrored into `?agentWidget=` (AgentTrigger) so a reload brings the customer back to the surface they were working\n * on — an editor a cold chat opened has no conversation id yet, so the canvas model's own pointer storage\n * has nothing to restore from.\n *\n * Null for every canvas no deep-linkable widget declares: it is the agent's to open inside a message, and a URL must\n * not be able to mount it (the allow-list above).\n */\nexport const deepLinkableWidgetNameForCanvas = (canvasId: CanvasId | null | undefined): string | null => {\n if (!canvasId) return null;\n return (\n conversationWidgetRegistry.widgets.find(\n (entry) => entry.deepLinkable === true && entry.opensCanvases?.includes(canvasId),\n )?.name ?? null\n );\n};\n","import { getFurtherWidgetClickSignalSources } from \"../provider/environment\";\n\n/**\n * The `signalSource`s a widget CLICK posts into the conversation (`injectSignal`): the generic widget click and the\n * dedicated source the former owner-action consent widget sent (no component posts it any more; stored rows keep it),\n * plus the further sources an app's own widgets post (`AgentsEnvironment.furtherWidgetClickSignalSources`, e.g. a form\n * submit that starts its own owner turn). The message list reads them to tell an answered widget from an open one after\n * a reload — a widget the owner already clicked must never come back interactive (a consent widget re-armed is a second\n * confirmation for a destructive tool). Add a source here when a widget of the package starts posting a new one.\n */\nexport const FRONTEND_WIDGET_CLICK_SIGNAL_SOURCE = \"FRONTEND_WIDGET_CLICK\";\nexport const OWNER_ACTION_CONFIRM_SIGNAL_SOURCE = \"OWNER_ACTION_CONFIRM\";\n\n/** The package's own widget click sources (the backend's sources of the package that carry an owner statement). */\nexport const PACKAGE_WIDGET_CLICK_SIGNAL_SOURCES: readonly string[] = [\n FRONTEND_WIDGET_CLICK_SIGNAL_SOURCE,\n OWNER_ACTION_CONFIRM_SIGNAL_SOURCE,\n];\n\n/** Every widget click source: the package's own and the app's further ones. */\nexport const getWidgetClickSignalSources = (): readonly string[] => [\n ...PACKAGE_WIDGET_CLICK_SIGNAL_SOURCES,\n ...getFurtherWidgetClickSignalSources(),\n];\n\nexport const isWidgetClickSignalSource = (signalSource: string | undefined | null): boolean =>\n signalSource != null && getWidgetClickSignalSources().includes(signalSource);\n","import { createContext, useContext } from \"react\";\n\n/**\n * The place beside the canvas pane's close button, for a canvas whose behaviour declares `titleBesideCloseButton`:\n * its body portals its title there. Null outside a canvas pane and for every other canvas.\n */\nexport const CanvasTitleSlotContext = createContext<HTMLElement | null>(null);\n\nexport const useCanvasTitleSlot = (): HTMLElement | null => useContext(CanvasTitleSlotContext);\n"],"names":[],"mappings":";;;;AAeO,MAAM,4BAA4B,CAAC,eAA+D;AACvG,MAAI,CAAC,WAAY,QAAO;AACxB,SACE,2BAA2B,QAAQ,KAAK,CAAC,UAAU,MAAM,SAAS,cAAc,MAAM,iBAAiB,IAAI,KAAK;AAEpH;AAWO,MAAM,kCAAkC,CAAC,aAAyD;AACvG,MAAI,CAAC,SAAU,QAAO;AACtB,SACE,2BAA2B,QAAQ;AAAA,IACjC,CAAC,UAAU,MAAM,iBAAiB,QAAQ,MAAM,eAAe,SAAS,QAAQ;AAAA,EAAA,GAC/E,QAAQ;AAEf;AC5BO,MAAM,sCAAsC;AAC5C,MAAM,qCAAqC;AAG3C,MAAM,sCAAyD;AAAA,EACpE;AAAA,EACA;AACF;AAGO,MAAM,8BAA8B,MAAyB;AAAA,EAClE,GAAG;AAAA,EACH,GAAG,mCAAA;AACL;AAEO,MAAM,4BAA4B,CAAC,iBACxC,gBAAgB,QAAQ,4BAAA,EAA8B,SAAS,YAAY;ACpBtE,MAAM,yBAAyB,cAAkC,IAAI;AAErE,MAAM,qBAAqB,MAA0B,WAAW,sBAAsB;"}