@mgamadeus/ddd-agents 0.11.13 → 0.13.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 (227) hide show
  1. package/README.md +138 -6
  2. package/boundary.json +5 -0
  3. package/dist/admin.js +13839 -0
  4. package/dist/admin.js.map +1 -0
  5. package/dist/chat.js +1627 -109
  6. package/dist/chat.js.map +1 -1
  7. package/dist/chunks/{AgentsConversationClientContext-C4T7g_Qk.js → AgentsConversationClientContext-B_UJSLXU.js} +2 -2
  8. package/dist/chunks/{AgentsConversationClientContext-C4T7g_Qk.js.map → AgentsConversationClientContext-B_UJSLXU.js.map} +1 -1
  9. package/dist/chunks/{ConversationMarkdown-D-aP3Ssl.js → ConversationMarkdown-DlvwT3Qk.js} +5 -4
  10. package/dist/chunks/{ConversationMarkdown-D-aP3Ssl.js.map → ConversationMarkdown-DlvwT3Qk.js.map} +1 -1
  11. package/dist/chunks/{ConversationMessageInputComposerWidgets-7HNAmZE1.js → ConversationMessageInputComposerWidgets-TchR1lPj.js} +6 -6
  12. package/dist/chunks/{ConversationMessageInputComposerWidgets-7HNAmZE1.js.map → ConversationMessageInputComposerWidgets-TchR1lPj.js.map} +1 -1
  13. package/dist/chunks/{VoiceBarsIcon-FhLAcgLG.js → VoiceBarsIcon-y3mgSqbn.js} +4 -4
  14. package/dist/chunks/{VoiceBarsIcon-FhLAcgLG.js.map → VoiceBarsIcon-y3mgSqbn.js.map} +1 -1
  15. package/dist/chunks/{WebSearchResultsConversationWidget-dEq19U7k.js → WebSearchResultsConversationWidget-l9Aek_lG.js} +3 -2
  16. package/dist/chunks/WebSearchResultsConversationWidget-l9Aek_lG.js.map +1 -0
  17. package/dist/chunks/agents-http-trace-mappers-LWNi-3a4.js +759 -0
  18. package/dist/chunks/agents-http-trace-mappers-LWNi-3a4.js.map +1 -0
  19. package/dist/chunks/{browser-request-interception-ydNOzeUL.js → browser-request-interception-D678IemW.js} +2 -2
  20. package/dist/chunks/{browser-request-interception-ydNOzeUL.js.map → browser-request-interception-D678IemW.js.map} +1 -1
  21. package/dist/chunks/{canvas-reducers-BInd3xNz.js → canvas-reducers-BYArW_Ji.js} +2 -2
  22. package/dist/chunks/{canvas-reducers-BInd3xNz.js.map → canvas-reducers-BYArW_Ji.js.map} +1 -1
  23. package/dist/chunks/{canvas-title-slot-context-BI1PLnPn.js → canvas-title-slot-context-BRGnFzYP.js} +3 -3
  24. package/dist/chunks/{canvas-title-slot-context-BI1PLnPn.js.map → canvas-title-slot-context-BRGnFzYP.js.map} +1 -1
  25. package/dist/chunks/{canvasBodies-CRVh8pCw.js → canvasBodies-BjXypuHf.js} +4 -4
  26. package/dist/chunks/{canvasBodies-CRVh8pCw.js.map → canvasBodies-BjXypuHf.js.map} +1 -1
  27. package/dist/chunks/{canvasStorage-Cr3omZeI.js → canvasStorage-DSspwRMg.js} +2 -2
  28. package/dist/chunks/{canvasStorage-Cr3omZeI.js.map → canvasStorage-DSspwRMg.js.map} +1 -1
  29. package/dist/chunks/content-from-unified-diff-CovnmG2Q.js +2927 -0
  30. package/dist/chunks/content-from-unified-diff-CovnmG2Q.js.map +1 -0
  31. package/dist/chunks/{contract-C18owGKs.js → contract-886XjdID.js} +2 -2
  32. package/dist/chunks/{contract-C18owGKs.js.map → contract-886XjdID.js.map} +1 -1
  33. package/dist/chunks/{conversation-CbWEHPbL.js → conversation-B7-evdj_.js} +4 -4
  34. package/dist/chunks/{conversation-CbWEHPbL.js.map → conversation-B7-evdj_.js.map} +1 -1
  35. package/dist/chunks/{icon-names-Di6c4zLo.js → icon-names-C5PeVvkJ.js} +32 -1
  36. package/dist/chunks/icon-names-C5PeVvkJ.js.map +1 -0
  37. package/dist/chunks/{link-navigation-DRHt6g7U.js → index-DZovGMpG.js} +65 -106
  38. package/dist/chunks/index-DZovGMpG.js.map +1 -0
  39. package/dist/chunks/link-navigation-a_sRfmsj.js +49 -0
  40. package/dist/chunks/link-navigation-a_sRfmsj.js.map +1 -0
  41. package/dist/chunks/{widget-name-resolver-Dq6Ejo7d.js → widget-name-resolver-DS3zH_5W.js} +5 -4
  42. package/dist/chunks/{widget-name-resolver-Dq6Ejo7d.js.map → widget-name-resolver-DS3zH_5W.js.map} +1 -1
  43. package/dist/chunks/{withPollingChangeSubscription-ClyOABgu.js → withPollingChangeSubscription-XvCpjGmd.js} +13 -2
  44. package/dist/chunks/{withPollingChangeSubscription-ClyOABgu.js.map → withPollingChangeSubscription-XvCpjGmd.js.map} +1 -1
  45. package/dist/client-testing.js +5 -5
  46. package/dist/client.js +50 -231
  47. package/dist/client.js.map +1 -1
  48. package/dist/contract.js +5 -5
  49. package/dist/files/i18n-keys.json +18277 -1298
  50. package/dist/files/widgets/DriveFilesConversationWidget/DriveFilesConversationWidget.md +3 -3
  51. package/dist/image-render.js +7 -7
  52. package/dist/index.js +62 -61
  53. package/dist/index.js.map +1 -1
  54. package/dist/kit.js +2 -2
  55. package/dist/preview.js +7 -7
  56. package/dist/provider.js +57 -56
  57. package/dist/provider.js.map +1 -1
  58. package/dist/renderer.js +15 -15
  59. package/dist/styles.css +2962 -15
  60. package/dist/types/admin/blocks/CodeBlock.d.ts +28 -0
  61. package/dist/types/admin/blocks/DetailModal.d.ts +34 -0
  62. package/dist/types/admin/blocks/Disclosure.d.ts +25 -0
  63. package/dist/types/admin/blocks/JsonTree.d.ts +18 -0
  64. package/dist/types/admin/blocks/LineDiffView.d.ts +18 -0
  65. package/dist/types/admin/blocks/ProportionBar.d.ts +43 -0
  66. package/dist/types/admin/blocks/TokenFigure.d.ts +14 -0
  67. package/dist/types/admin/blocks/json-tree.d.ts +40 -0
  68. package/dist/types/admin/blocks/line-diff.d.ts +46 -0
  69. package/dist/types/admin/blocks/proportion-bar.d.ts +34 -0
  70. package/dist/types/admin/blocks/series-fill-classes.d.ts +13 -0
  71. package/dist/types/admin/blocks/token-figure.d.ts +8 -0
  72. package/dist/types/admin/connections/AgentConnectionCard.d.ts +21 -0
  73. package/dist/types/admin/connections/AgentConnectionDriveRootSpaces.d.ts +25 -0
  74. package/dist/types/admin/connections/AgentConnectionDriveScopeDialog.d.ts +20 -0
  75. package/dist/types/admin/connections/AgentConnectionDriveSearchFilters.d.ts +34 -0
  76. package/dist/types/admin/connections/AgentConnectionDrivesDrawer.d.ts +39 -0
  77. package/dist/types/admin/connections/AgentConnectionLevelsDrawer.d.ts +27 -0
  78. package/dist/types/admin/connections/AgentConnectionSharingDialog.d.ts +12 -0
  79. package/dist/types/admin/connections/AgentConnectionsPanel.d.ts +105 -0
  80. package/dist/types/admin/connections/AgentConnectionsScreen.d.ts +18 -0
  81. package/dist/types/admin/connections/ConnectDialogs.d.ts +22 -0
  82. package/dist/types/admin/connections/agent-connection-drive-scope.d.ts +112 -0
  83. package/dist/types/admin/connections/agent-connection-drives.d.ts +107 -0
  84. package/dist/types/admin/connections/agent-connection-format.d.ts +82 -0
  85. package/dist/types/admin/connections/agent-connection-oauth.d.ts +138 -0
  86. package/dist/types/admin/connections/agent-connections-api.d.ts +420 -0
  87. package/dist/types/admin/connections/agent-connections-context.d.ts +60 -0
  88. package/dist/types/admin/connections/agent-connections-types.d.ts +447 -0
  89. package/dist/types/admin/connections/connection-logos.d.ts +53 -0
  90. package/dist/types/admin/connections/connection-parts.d.ts +84 -0
  91. package/dist/types/admin/connections/use-agent-connect.d.ts +25 -0
  92. package/dist/types/admin/context/CompactionThresholdBanner.d.ts +13 -0
  93. package/dist/types/admin/context/ContextCompositionPanel.d.ts +27 -0
  94. package/dist/types/admin/context/ContextSegmentList.d.ts +20 -0
  95. package/dist/types/admin/context/SentPayloadPanel.d.ts +37 -0
  96. package/dist/types/admin/context/agent-inspect-context-api.d.ts +53 -0
  97. package/dist/types/admin/context/agent-inspect-context-types.d.ts +98 -0
  98. package/dist/types/admin/context/context-composition-grouping.d.ts +78 -0
  99. package/dist/types/admin/context/context-segment-families.d.ts +18 -0
  100. package/dist/types/admin/context/context-segment-label-texts.d.ts +19 -0
  101. package/dist/types/admin/context/context-segment-labels.d.ts +18 -0
  102. package/dist/types/admin/control-panel/AgentControlPanelScreen.d.ts +71 -0
  103. package/dist/types/admin/control-panel/BudgetsTab.d.ts +13 -0
  104. package/dist/types/admin/control-panel/SettingsTab.d.ts +22 -0
  105. package/dist/types/admin/control-panel/SpacesTab.d.ts +24 -0
  106. package/dist/types/admin/control-panel/StatisticsTab.d.ts +26 -0
  107. package/dist/types/admin/control-panel/TimeSeriesChartCard.d.ts +37 -0
  108. package/dist/types/admin/control-panel/ToolResponseSamplesDrawer.d.ts +22 -0
  109. package/dist/types/admin/control-panel/agent-control-panel-api.d.ts +104 -0
  110. package/dist/types/admin/control-panel/agent-control-panel-types.d.ts +241 -0
  111. package/dist/types/admin/control-panel/budget-meters.d.ts +35 -0
  112. package/dist/types/admin/control-panel/control-panel-statistics.d.ts +49 -0
  113. package/dist/types/admin/control-panel/runtime-settings-form.d.ts +44 -0
  114. package/dist/types/admin/control-panel/time-series-chart.d.ts +54 -0
  115. package/dist/types/admin/conversations/AgentConversationDetailScreen.d.ts +128 -0
  116. package/dist/types/admin/conversations/AgentConversationsScreen.d.ts +60 -0
  117. package/dist/types/admin/conversations/ContextPanel.d.ts +9 -0
  118. package/dist/types/admin/conversations/ConversationActions.d.ts +32 -0
  119. package/dist/types/admin/conversations/ConversationTurns.d.ts +56 -0
  120. package/dist/types/admin/conversations/DebugSwitchBar.d.ts +23 -0
  121. package/dist/types/admin/conversations/DelegationPanel.d.ts +6 -0
  122. package/dist/types/admin/conversations/ModelContextDialog.d.ts +31 -0
  123. package/dist/types/admin/conversations/RequestCompositionRows.d.ts +14 -0
  124. package/dist/types/admin/conversations/RequestsPanel.d.ts +21 -0
  125. package/dist/types/admin/conversations/SandboxPanel.d.ts +42 -0
  126. package/dist/types/admin/conversations/StepDetailDialog.d.ts +19 -0
  127. package/dist/types/admin/conversations/agent-inspect-api.d.ts +259 -0
  128. package/dist/types/admin/conversations/agent-inspect-mappers.d.ts +23 -0
  129. package/dist/types/admin/conversations/agent-inspect-types.d.ts +517 -0
  130. package/dist/types/admin/conversations/conversation-list-export.d.ts +64 -0
  131. package/dist/types/admin/conversations/conversation-list-filters.d.ts +59 -0
  132. package/dist/types/admin/conversations/debug-switches.d.ts +27 -0
  133. package/dist/types/admin/conversations/delegation-swimlanes.d.ts +78 -0
  134. package/dist/types/admin/conversations/header-facts.d.ts +23 -0
  135. package/dist/types/admin/conversations/inspect-format.d.ts +44 -0
  136. package/dist/types/admin/conversations/inspect-parts.d.ts +42 -0
  137. package/dist/types/admin/conversations/inspect-scope.d.ts +92 -0
  138. package/dist/types/admin/conversations/model-call-rows.d.ts +78 -0
  139. package/dist/types/admin/conversations/step-descriptions.d.ts +43 -0
  140. package/dist/types/admin/conversations/touched-files-tree.d.ts +47 -0
  141. package/dist/types/admin/conversations/turn-paging.d.ts +56 -0
  142. package/dist/types/admin/conversations/turn-segments.d.ts +36 -0
  143. package/dist/types/admin/conversations/turn-timeline.d.ts +22 -0
  144. package/dist/types/admin/conversations/use-query-loader.d.ts +8 -0
  145. package/dist/types/admin/period/AdminPeriodControl.d.ts +15 -0
  146. package/dist/types/admin/period/admin-period.d.ts +51 -0
  147. package/dist/types/admin/quality/AgentQualityEvalRunScreen.d.ts +30 -0
  148. package/dist/types/admin/quality/AgentQualityScreen.d.ts +38 -0
  149. package/dist/types/admin/quality/SaveAsEvalCaseDialog.d.ts +27 -0
  150. package/dist/types/admin/quality/agent-quality-api.d.ts +86 -0
  151. package/dist/types/admin/quality/agent-quality-format.d.ts +52 -0
  152. package/dist/types/admin/quality/agent-quality-types.d.ts +161 -0
  153. package/dist/types/admin/schedules/AgentSchedulesPanel.d.ts +43 -0
  154. package/dist/types/admin/schedules/agent-schedules-api.d.ts +116 -0
  155. package/dist/types/admin/schedules/agent-schedules-format.d.ts +25 -0
  156. package/dist/types/admin/schedules/agent-schedules-types.d.ts +113 -0
  157. package/dist/types/admin/shared/AdminHrefLink.d.ts +13 -0
  158. package/dist/types/admin/skills/AgentSkillCatalogScreen.d.ts +51 -0
  159. package/dist/types/admin/skills/SharedBlocksPanel.d.ts +14 -0
  160. package/dist/types/admin/skills/SkillLoadSourcesPanel.d.ts +20 -0
  161. package/dist/types/admin/skills/SkillPurposesPanel.d.ts +16 -0
  162. package/dist/types/admin/skills/SkillTreeRowView.d.ts +31 -0
  163. package/dist/types/admin/skills/ToolSchemaDrawer.d.ts +21 -0
  164. package/dist/types/admin/skills/agent-skill-catalog-api.d.ts +101 -0
  165. package/dist/types/admin/skills/agent-skill-catalog-types.d.ts +259 -0
  166. package/dist/types/admin/skills/skill-catalog-colors.d.ts +10 -0
  167. package/dist/types/admin/skills/skill-catalog-tree.d.ts +159 -0
  168. package/dist/types/admin/skills/skill-purpose-texts.d.ts +11 -0
  169. package/dist/types/admin/wire/admin-wire.d.ts +21 -0
  170. package/dist/types/chat/controller/AgentChatController.d.ts +22 -0
  171. package/dist/types/chat/controller/turn-initiators.d.ts +21 -0
  172. package/dist/types/chat/trace/BackgroundTasksList.d.ts +35 -0
  173. package/dist/types/chat/trace/ChangeSetCard.d.ts +34 -0
  174. package/dist/types/chat/trace/ChangedFilesPane.d.ts +33 -0
  175. package/dist/types/chat/trace/ChangedRecordsList.d.ts +34 -0
  176. package/dist/types/chat/trace/ConsentRequestCard.d.ts +23 -0
  177. package/dist/types/chat/trace/ContextRing.d.ts +19 -0
  178. package/dist/types/chat/trace/ConversationChildTrace.d.ts +18 -0
  179. package/dist/types/chat/trace/ConversationTurnTrace.d.ts +48 -0
  180. package/dist/types/chat/trace/EntityChip.d.ts +23 -0
  181. package/dist/types/chat/trace/FileChangesSummary.d.ts +14 -0
  182. package/dist/types/chat/trace/FileEditBlock.d.ts +42 -0
  183. package/dist/types/chat/trace/LoadedSkillsDisclosure.d.ts +16 -0
  184. package/dist/types/chat/trace/QueuedMessageChip.d.ts +17 -0
  185. package/dist/types/chat/trace/RunStatusLine.d.ts +27 -0
  186. package/dist/types/chat/trace/StepKindDetails.d.ts +59 -0
  187. package/dist/types/chat/trace/SubAgentStepGroup.d.ts +53 -0
  188. package/dist/types/chat/trace/TaskPlanPane.d.ts +31 -0
  189. package/dist/types/chat/trace/TaskPlanRow.d.ts +28 -0
  190. package/dist/types/chat/trace/TerminalBlock.d.ts +16 -0
  191. package/dist/types/chat/trace/ThinkingBlock.d.ts +19 -0
  192. package/dist/types/chat/trace/ToolStepDetail.d.ts +49 -0
  193. package/dist/types/chat/trace/ToolStepGroup.d.ts +58 -0
  194. package/dist/types/chat/trace/ToolStepRow.d.ts +52 -0
  195. package/dist/types/chat/trace/TraceViewModeSwitch.d.ts +14 -0
  196. package/dist/types/chat/trace/TurnMetaLine.d.ts +27 -0
  197. package/dist/types/chat/trace/content-from-unified-diff.d.ts +25 -0
  198. package/dist/types/chat/trace/conversation-trace-loader.d.ts +133 -0
  199. package/dist/types/chat/trace/index.d.ts +34 -0
  200. package/dist/types/chat/trace/parse-unified-diff.d.ts +51 -0
  201. package/dist/types/chat/trace/task-plan-counts.d.ts +41 -0
  202. package/dist/types/chat/trace/trace-collect.d.ts +91 -0
  203. package/dist/types/chat/trace/trace-counts.d.ts +21 -0
  204. package/dist/types/chat/trace/trace-format.d.ts +73 -0
  205. package/dist/types/chat/trace/trace-labels.d.ts +60 -0
  206. package/dist/types/chat/trace/trace-parts.d.ts +63 -0
  207. package/dist/types/chat/trace/trace-step-focus.d.ts +12 -0
  208. package/dist/types/chat/trace/trace-types.d.ts +370 -0
  209. package/dist/types/chat/trace/use-conversation-trace.d.ts +47 -0
  210. package/dist/types/client/AgentsConversationClient.d.ts +20 -0
  211. package/dist/types/client/http/agents-http-trace-mappers.d.ts +31 -0
  212. package/dist/types/client/http/agents-http-trace-wire.d.ts +433 -0
  213. package/dist/types/contract/conversation-trace.d.ts +594 -0
  214. package/dist/types/entries/admin.d.ts +86 -0
  215. package/dist/types/entries/chat.d.ts +3 -1
  216. package/dist/types/entries/client.d.ts +2 -0
  217. package/dist/types/entries/contract.d.ts +1 -0
  218. package/dist/types/provider/components/icon-names.d.ts +4 -2
  219. package/dist/types/provider/components/types.d.ts +3 -1
  220. package/dist/types/widgets/DriveFilesConversationWidget/shared/drive-files.d.ts +1 -1
  221. package/dist/voice.js +3 -3
  222. package/dist/widgets.js +6 -6
  223. package/package.json +7 -3
  224. package/public-api.json +1047 -3
  225. package/dist/chunks/WebSearchResultsConversationWidget-dEq19U7k.js.map +0 -1
  226. package/dist/chunks/icon-names-Di6c4zLo.js.map +0 -1
  227. package/dist/chunks/link-navigation-DRHt6g7U.js.map +0 -1
@@ -0,0 +1,78 @@
1
+ import type { AgentInspectSubAgent, AgentInspectWaitingWindow } from "./agent-inspect-types";
2
+ /** The source of a waiting window that no delegation batch recorded: it is derived from the times of the sub-agents' runs. */
3
+ export declare const SWIMLANE_WINDOW_SOURCE_SUB_AGENT_RUNS = "SUB_AGENT_RUNS";
4
+ /** The smallest width of a bar, so a run of a few milliseconds stays visible and clickable. */
5
+ export declare const SWIMLANE_MINIMUM_BAR_PERCENT = 0.8;
6
+ export interface DelegationSwimlaneBar {
7
+ key: string;
8
+ runNumber: number | null;
9
+ /** The stored status of the run (`QUEUED`, `RUNNING`, `COMPLETED`, `FAILED`, `CANCELLED`, …). */
10
+ status: string | null;
11
+ /** Epoch milliseconds. */
12
+ startedAt: number;
13
+ /** Null while the run lasts (the bar then ends at `now`). */
14
+ endedAt: number | null;
15
+ durationMs: number;
16
+ leftPercent: number;
17
+ widthPercent: number;
18
+ }
19
+ export interface DelegationSwimlane {
20
+ key: string;
21
+ subAgent: AgentInspectSubAgent;
22
+ bars: DelegationSwimlaneBar[];
23
+ }
24
+ export interface DelegationSwimlaneWindow {
25
+ key: string;
26
+ startedAt: number;
27
+ /** Null while the parent still waits. */
28
+ endedAt: number | null;
29
+ durationMs: number;
30
+ leftPercent: number;
31
+ widthPercent: number;
32
+ /** What the window was derived from, as the server names it (`DELEGATION_BATCHES`, `SUB_AGENT_RUNS`, `BOTH`). */
33
+ source: string | null;
34
+ /** No delegation batch recorded the wait: the window comes from the times of the sub-agents' runs alone. */
35
+ isDerivedFromRuns: boolean;
36
+ }
37
+ export interface DelegationSwimlaneTick {
38
+ /** Milliseconds from the start of the axis. */
39
+ offsetMs: number;
40
+ leftPercent: number;
41
+ }
42
+ export interface DelegationSwimlanes {
43
+ /** The start of the axis (epoch milliseconds): the earliest run or waiting window. */
44
+ startedAt: number;
45
+ endedAt: number;
46
+ durationMs: number;
47
+ ticks: DelegationSwimlaneTick[];
48
+ waitingWindows: DelegationSwimlaneWindow[];
49
+ lanes: DelegationSwimlane[];
50
+ }
51
+ /** The marks of an axis of `durationMs`: at round distances, at most `maximumTicks` of them, the start included. */
52
+ export declare const buildSwimlaneTicks: (durationMs: number, maximumTicks?: number) => DelegationSwimlaneTick[];
53
+ export interface BuildDelegationSwimlanesInput {
54
+ subAgents: readonly AgentInspectSubAgent[];
55
+ waitingWindows?: readonly AgentInspectWaitingWindow[];
56
+ /** The moment a running run or an open window ends at (epoch milliseconds). */
57
+ now: number;
58
+ }
59
+ /**
60
+ * The swimlanes of a conversation's sub-agents; null when no run and no window has a readable start. A run without a
61
+ * start (still queued) starts where it was queued; a run without an end lasts until `now`.
62
+ */
63
+ export declare const buildDelegationSwimlanes: ({ subAgents, waitingWindows, now }: BuildDelegationSwimlanesInput) => DelegationSwimlanes | null;
64
+ /** The totals of a conversation's sub-agents. */
65
+ export interface DelegationTotals {
66
+ subAgentCount: number;
67
+ runCount: number;
68
+ runningCount: number;
69
+ failedCount: number;
70
+ costInUsd: number | null;
71
+ inputTokens: number | null;
72
+ outputTokens: number | null;
73
+ }
74
+ /**
75
+ * What the sub-agents cost together. A sub-agent counts with the total of its conversation where the server sends it
76
+ * (debug level), else with the sum of what its runs carry.
77
+ */
78
+ export declare const summarizeDelegation: (subAgents: readonly AgentInspectSubAgent[]) => DelegationTotals;
@@ -0,0 +1,23 @@
1
+ import type { AgentInspectConversationHeader, AgentInspectTurn } from "./agent-inspect-types";
2
+ /** The task plan of a conversation as the progress card shows it. */
3
+ export interface AgentInspectPlanProgress {
4
+ title: string | null;
5
+ itemCount: number;
6
+ /** Top-level items done or not applying; a blocked item is never counted done. */
7
+ doneCount: number;
8
+ blockedCount: number;
9
+ /** The first item that is neither done nor blocked, from the newest plan the loaded turns show; null when none is known. */
10
+ nextItemTitle: string | null;
11
+ }
12
+ /**
13
+ * The progress of the conversation's task plan: the counts of the header (done and blocked apart), the next step from
14
+ * the newest `TASK_PLAN` step of the loaded turns (its first item that is neither done nor blocked). The plan step's own counts stand in when the header
15
+ * names none. Null without a plan.
16
+ */
17
+ export declare const readAgentInspectPlanProgress: (header: AgentInspectConversationHeader, turns: readonly AgentInspectTurn[]) => AgentInspectPlanProgress | null;
18
+ /**
19
+ * A stored model name as the model catalog names it ("GPT-6 Luna"): the label an answer of the loaded turns carries
20
+ * for that model (the server writes the catalog's display name there), else the name in words
21
+ * (`describeTraceModelName`). Null without a name.
22
+ */
23
+ export declare const readAgentInspectModelLabel: (modelName: string | null | undefined, turns: readonly AgentInspectTurn[]) => string | null;
@@ -0,0 +1,44 @@
1
+ import { type AdminWireSet } from "../wire/admin-wire";
2
+ import type { AgentInspectLabel, AgentInspectMetric } from "./agent-inspect-types";
3
+ /** The translation context of the run states. */
4
+ export declare const AGENT_CONVERSATION_RUN_STATE_CONTEXT = "agent-run-state";
5
+ /** The run states of a conversation as status badges. */
6
+ export declare const AGENT_CONVERSATION_RUN_STATE: Readonly<Record<"AWAITING_DELEGATES" | "CANCELLED" | "COMPLETED" | "FAILED" | "IDLE" | "QUEUED" | "RUNNING", import("@mgamadeus/ddd-admin-ui/logic").StatusDefinition>>;
7
+ export type AgentRunStateValue = keyof typeof AGENT_CONVERSATION_RUN_STATE;
8
+ /** The run states in which a turn is live. */
9
+ export declare const AGENT_LIVE_RUN_STATES: readonly string[];
10
+ /** Whether a run state is one the badge map knows. */
11
+ export declare const isKnownAgentRunState: (runState: string | null | undefined) => runState is AgentRunStateValue;
12
+ /** A heartbeat older than this is no sign of life (the worker writes one every few seconds while a turn runs). */
13
+ export declare const AGENT_RUN_HEARTBEAT_FRESH_MS = 90000;
14
+ /** Whether a conversation shows the live mark: a live run state whose heartbeat is fresh, or no heartbeat to judge by. */
15
+ export declare const isAgentRunLive: (runState: string | null | undefined, runHeartbeatAt: string | null | undefined, now: number) => boolean;
16
+ /** The translation context of the origins. */
17
+ export declare const AGENT_ORIGIN_CONTEXT = "agent-conversation-origin";
18
+ /** The origins the package knows, in words; an application's own initiator type is shown as it is stored. */
19
+ export declare const AGENT_ORIGIN_LABELS: Readonly<Record<string, string>>;
20
+ /** The origin of a conversation: a sub-agent's, its initiator type, else the owner's chat. */
21
+ export declare const agentOriginOf: (conversation: {
22
+ isSubAgentConversation?: boolean | null;
23
+ initiatorType?: string | null;
24
+ delegatedFromMessageId?: number | null;
25
+ }) => string;
26
+ /** The labels of a response by id. */
27
+ export declare const agentInspectLabelsById: (labels: AdminWireSet<AgentInspectLabel> | null | undefined) => Map<number, AgentInspectLabel>;
28
+ /** The change of a metric against the period before; null when either figure is missing. */
29
+ export declare const agentInspectMetricChange: (metric: AgentInspectMetric | null | undefined) => number | null;
30
+ /** The change of a metric as a fraction of the figure before (`0.18` = +18 %); null without a figure before or a zero one. */
31
+ export declare const agentInspectMetricRelativeChange: (metric: AgentInspectMetric | null | undefined) => number | null;
32
+ /** The default cost format: US dollars with three decimals below one dollar. */
33
+ export declare const formatAgentInspectCost: (costInUsd: number, locale?: string) => string;
34
+ /** A count in short form (`812`, `1.2K`, `2.1M`). */
35
+ export declare const formatAgentInspectCount: (value: number, locale?: string) => string;
36
+ /**
37
+ * A past moment relative to `now`, as a list shows it: `justNow` under a minute, "4 min. ago" under an hour, "1 hr.
38
+ * ago" up to six hours on the same day, the clock time for an earlier hour of the same day, "yesterday", the weekday and
39
+ * the time within a week, else the date (with the year only when it is another year). `justNow` is the caller's
40
+ * translated text; every other word comes from `Intl` in the locale.
41
+ */
42
+ export declare const describeAgentInspectMomentRelative: (moment: number, now: number, locale: string | undefined, justNow: string) => string;
43
+ /** A duration in seconds in short form (`11 s`, `2:05 min`). */
44
+ export declare const formatAgentInspectSeconds: (seconds: number, locale?: string) => string;
@@ -0,0 +1,42 @@
1
+ import type { HTMLAttributes, ReactNode } from "react";
2
+ /** A small pulsing dot: a turn runs right now. `label` names it for screen readers and on hover. */
3
+ export declare const LiveDot: ({ label, className }: {
4
+ label: string;
5
+ className?: string;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ /** The attributes a host puts on the element around the chat's trace blocks (the scope of its theme mapping). */
8
+ export type AgentTraceFrameAttributes = Readonly<Record<`data-${string}`, string>>;
9
+ export interface AgentTraceFrameProps extends HTMLAttributes<HTMLDivElement> {
10
+ frameAttributes?: AgentTraceFrameAttributes;
11
+ children: ReactNode;
12
+ }
13
+ /**
14
+ * The element around trace blocks of the chat side that are drawn outside the chat window. The blocks read the
15
+ * package's `--agents-*` properties; a host that maps them to its theme below a selector of its own passes that
16
+ * selector's attributes as `frameAttributes`.
17
+ */
18
+ export declare const AgentTraceFrame: ({ frameAttributes, className, children, ...rest }: AgentTraceFrameProps) => import("react/jsx-runtime").JSX.Element;
19
+ /** A fact of a card: a small caption over its value and a muted line. */
20
+ export declare const InspectFactCard: ({ caption, value, detail, tone, children, className, }: {
21
+ caption: ReactNode;
22
+ value: ReactNode;
23
+ detail?: ReactNode;
24
+ tone?: "warning" | "danger";
25
+ children?: ReactNode;
26
+ className?: string;
27
+ }) => import("react/jsx-runtime").JSX.Element;
28
+ /** A thin meter: how much of a whole is used (0–100 and above; above 100 is full). */
29
+ export declare const InspectMeter: ({ percent, tone, label }: {
30
+ percent: number;
31
+ tone?: "warning" | "danger";
32
+ label: string;
33
+ }) => import("react/jsx-runtime").JSX.Element;
34
+ /** A quiet text button inside a row of actions. */
35
+ export declare const InspectActionButton: ({ icon, children, onClick, disabled, title, testId, }: {
36
+ icon?: ReactNode;
37
+ children: ReactNode;
38
+ onClick: () => void;
39
+ disabled?: boolean;
40
+ title?: string;
41
+ testId?: string;
42
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,92 @@
1
+ import type { CodeHighlighterLoader } from "@mgamadeus/ddd-admin-ui/files";
2
+ import type { PageLinkComponent } from "@mgamadeus/ddd-admin-ui/primitives";
3
+ import { type ReactNode } from "react";
4
+ import type { TraceDescribeMount, TraceFileChange, TraceHostBindings } from "../../chat/trace/trace-types";
5
+ import type { ConversationTraceLevel } from "../../contract/conversation-trace";
6
+ import type { AgentInspectApi } from "./agent-inspect-api";
7
+ import type { AgentInspectFileChange, AgentInspectStep } from "./agent-inspect-types";
8
+ import type { AgentTraceFrameAttributes } from "./inspect-parts";
9
+ /** What the admin may do to the open conversation; each function asks before it acts. */
10
+ export interface AgentInspectActions {
11
+ /** False: the controls show, disabled (the environment locks writes). */
12
+ writesAllowed: boolean;
13
+ /**
14
+ * Opens the dialog that writes a message as admin; `truncateFromIndex` branches from that position first and
15
+ * `initialMessage` fills the message (running a turn again with the message that started it).
16
+ */
17
+ openDrive: (options?: {
18
+ truncateFromIndex?: number;
19
+ truncateLabel?: string;
20
+ initialMessage?: string;
21
+ }) => void;
22
+ /** Truncates from a position (`indexInConversation`) after a confirmation. */
23
+ truncateFrom: (fromIndex: number, label: string) => void;
24
+ /** Runs a reading tool call again after a confirmation and shows its answer. */
25
+ replayToolCall: (step: AgentInspectStep) => void;
26
+ }
27
+ /** The file and the change of the sandbox and files tabs a link names (`?file=…&change=…`). */
28
+ export interface AgentInspectFileSelection {
29
+ /** The path of the picked file in its mount; null for none. */
30
+ filePath: string | null;
31
+ /** The picked change of that file; null for its newest. */
32
+ fileChangeId: number | null;
33
+ select: (filePath: string | null, fileChangeId?: number | null) => void;
34
+ }
35
+ /** What the detail hands the host's file preview beside the change. */
36
+ export interface AgentInspectFilePreviewOptions {
37
+ /**
38
+ * The file's content as the recorded change wrote it (rebuilt from the change's diff, drawn by type, with a note
39
+ * that says so), for the host to show in place of its own "cannot show this file" state: the stored file is gone,
40
+ * the reader may not open it, its malware check has not released it. Null when the change's diff does not hold the
41
+ * whole file (then the host shows its own state).
42
+ */
43
+ fallback: ReactNode | null;
44
+ }
45
+ /**
46
+ * The host's preview of a changed file as it is stored (the rendered document, the picture, the highlighted code);
47
+ * null for a change without a stored version (a temporary file, a deleted file): the detail then shows
48
+ * `options.fallback` itself when there is one, else the diff alone.
49
+ */
50
+ export type AgentInspectRenderFilePreview = (fileChange: AgentInspectFileChange, options?: AgentInspectFilePreviewOptions) => ReactNode;
51
+ /** What the parts of the conversation detail share. */
52
+ export interface AgentInspectScope {
53
+ api: AgentInspectApi;
54
+ conversationId: number;
55
+ /** The level the trace is read at: `DEBUG` while the debug switch is on. */
56
+ level: ConversationTraceLevel;
57
+ isDebug: boolean;
58
+ locale: string | undefined;
59
+ formatCost: (costInUsd: number) => string;
60
+ linkComponent: PageLinkComponent;
61
+ /** The host's bindings of the trace blocks: links, records, mounts, money, the whole diff of a change. */
62
+ host: TraceHostBindings;
63
+ describeMount?: TraceDescribeMount;
64
+ loadFullDiff: (fileChange: TraceFileChange) => Promise<string>;
65
+ renderMarkdown?: (source: string) => ReactNode;
66
+ frameAttributes?: AgentTraceFrameAttributes;
67
+ /** How the agent is named beside its answers. */
68
+ agentDisplayName: string;
69
+ buildConversationHref?: (conversationId: number) => string | null;
70
+ /** Null: the reader may not drive conversations. */
71
+ actions: AgentInspectActions | null;
72
+ /** The reader may read what a model call was sent (the composition and the payload); false hides those actions. */
73
+ canReadModelContext: boolean;
74
+ /** Opens what the model was sent at the call of a message. */
75
+ openModelContext: (messageId: number, view?: "composition" | "payload") => void;
76
+ /** Opens the detail of one step beside the conversation. */
77
+ openStepDetail: (stepId: string) => void;
78
+ /** Opens "Save as evaluation case" for the turn of a message; undefined when the host offers none. */
79
+ openEvalCase?: (messageId: number) => void;
80
+ fileSelection: AgentInspectFileSelection;
81
+ /** The host's preview of a changed file as it is stored; see `AgentInspectRenderFilePreview`. */
82
+ renderFilePreview?: AgentInspectRenderFilePreview;
83
+ /** The host's highlighter, for the source of a file rebuilt from a recorded change; without it the source stays plain. */
84
+ loadCodeHighlighter?: CodeHighlighterLoader;
85
+ /** The host's facts of the conversation's live workspace (state, usage, a link to its screen), above the sandbox tab. */
86
+ renderSandboxFacts?: () => ReactNode;
87
+ /** The host's display name of a model by its catalog name ("GPT-6 Luna"); null or absent: the name in words. */
88
+ describeModelName?: (modelName: string) => string | null;
89
+ }
90
+ export declare const AgentInspectScopeProvider: import("react").Provider<AgentInspectScope | null>;
91
+ /** The scope of the conversation detail the part is drawn in. */
92
+ export declare const useAgentInspectScope: () => AgentInspectScope;
@@ -0,0 +1,78 @@
1
+ import type { AgentInspectTrace, AgentInspectTurn } from "./agent-inspect-types";
2
+ import type { AgentInspectTurnWindow } from "./turn-paging";
3
+ /** Turns read per page of the requests table (the trace route answers at most 100). */
4
+ export declare const AGENT_INSPECT_REQUESTS_PAGE_SIZE = 50;
5
+ /** One model call of the conversation. */
6
+ export interface AgentInspectModelCallRow {
7
+ /** Unique among the rows: the step's id. */
8
+ key: string;
9
+ stepId: string;
10
+ turnNumber: number;
11
+ /** The number of the call within its turn, from 1: the server's, else its position among the turn's calls. */
12
+ callNumber: number;
13
+ /** The message of the call; null for a call without a stored message. */
14
+ messageId: number | null;
15
+ /** The message whose context composition and payload are this call's; null when neither can be read. */
16
+ contextMessageId: number | null;
17
+ /** The model in words ("GPT6 LUNA"), and its stored name. */
18
+ modelLabel: string | null;
19
+ modelName: string | null;
20
+ effort: string | null;
21
+ startedAt: string | null;
22
+ inputTokens: number | null;
23
+ outputTokens: number | null;
24
+ cachedInputTokens: number | null;
25
+ /** The share of the input tokens read from the cache, 0–100. */
26
+ cachePercent: number | null;
27
+ costInUsd: number | null;
28
+ /** How long the call took: the step's duration, else the provider's time. */
29
+ durationMs: number | null;
30
+ providerCallMs: number | null;
31
+ loopOverheadMs: number | null;
32
+ /** How the call ended (`toolCalls`, `answer`, `empty`), as the server derives it. */
33
+ stopReason: string | null;
34
+ /** The tools the model called in this call, in order. */
35
+ toolNames: string[];
36
+ retryCount: number;
37
+ /** The request of the call is stored as sent; false: it can only be rebuilt. */
38
+ hasStoredPayload: boolean;
39
+ /** The call belongs to a branch an admin truncated. */
40
+ isTruncated: boolean;
41
+ }
42
+ /**
43
+ * The model calls of the turns, oldest first: the `MODEL_CALL` steps, and a `THINKING` step that carries the facts of
44
+ * a call no `MODEL_CALL` step of its turn stands for. A read below the debug level has no such steps and no rows.
45
+ */
46
+ export declare const buildAgentInspectModelCallRows: (turns: readonly AgentInspectTurn[]) => AgentInspectModelCallRow[];
47
+ /** The sums of the listed model calls. A figure no call carries is null, never 0. */
48
+ export interface AgentInspectModelCallTotals {
49
+ callCount: number;
50
+ /** Turns that hold at least one of the calls. */
51
+ turnCount: number;
52
+ inputTokens: number | null;
53
+ outputTokens: number | null;
54
+ cachedInputTokens: number | null;
55
+ /** The cached share of the input tokens over the calls that carry both counts, 0–100. */
56
+ cachePercent: number | null;
57
+ costInUsd: number | null;
58
+ durationMs: number | null;
59
+ retryCount: number;
60
+ }
61
+ /** The totals of the rows. */
62
+ export declare const summarizeAgentInspectModelCalls: (rows: readonly AgentInspectModelCallRow[]) => AgentInspectModelCallTotals;
63
+ /** The paging facts of one page read of the trace. */
64
+ export type AgentInspectTracePage = Pick<AgentInspectTrace, "firstTurnNumber" | "lastTurnNumber" | "hasOlderTurns">;
65
+ /** Which turns the pages read so far cover, and whether older turns exist before them. */
66
+ export interface AgentInspectTraceCoverage {
67
+ firstTurnNumber: number | null;
68
+ lastTurnNumber: number | null;
69
+ /** Turns exist before `firstTurnNumber`, as the oldest page read says. */
70
+ hasOlderTurns: boolean;
71
+ }
72
+ /**
73
+ * What the page reads cover together. Whether older turns exist is the fact of the page that starts first; a page
74
+ * without turns (asked beyond what the conversation holds) covers nothing and ends the paging before it.
75
+ */
76
+ export declare const readAgentInspectTraceCoverage: (pages: readonly AgentInspectTracePage[]) => AgentInspectTraceCoverage;
77
+ /** The page before the covered turns; null when the first turn is covered. */
78
+ export declare const previousAgentInspectTracePage: (coverage: AgentInspectTraceCoverage, pageSize?: number) => AgentInspectTurnWindow | null;
@@ -0,0 +1,43 @@
1
+ import { type TraceLabelTranslate } from "../../chat/trace/trace-labels";
2
+ import type { AgentInspectDecision, AgentInspectStep } from "./agent-inspect-types";
3
+ export declare const AGENT_DECISION_STATUS_CONTEXT = "agent-decision-status";
4
+ /** How a side decision ended, in words (the keys are the server's statuses in lowercase). */
5
+ export declare const AGENT_DECISION_STATUS_LABELS: Readonly<Record<string, string>>;
6
+ export declare const AGENT_DECISION_ENGINE_CONTEXT = "agent-decision-engine";
7
+ /** What decided, in words; another engine shows the server's label, else its name. */
8
+ export declare const AGENT_DECISION_ENGINE_LABELS: Readonly<Record<string, string>>;
9
+ /** Translates a text key in a context (`useTranslate().t` bound to the context). */
10
+ export type TranslateInContext = (text: string, context: string) => string;
11
+ export type AgentDecisionStatusTone = "neutral" | "success" | "warning" | "info";
12
+ export interface AgentDecisionWords {
13
+ /** The site in words ("Skill preload"): the server's label, else the site's id in words. */
14
+ site: string | null;
15
+ /** What decided ("decision model", "Jev", "rule · precondition"); null when the step does not say. */
16
+ engine: string | null;
17
+ /** The end in words ("applied"). */
18
+ status: string | null;
19
+ /** The tone of the end: a fallback is a warning, an applied decision a success. */
20
+ statusTone: AgentDecisionStatusTone;
21
+ summary: string | null;
22
+ }
23
+ /** An id in camel case as words (`skillPreload` → `Skill preload`); anything else stays as it is. */
24
+ export declare const wordsOfIdentifier: (identifier: string) => string;
25
+ /**
26
+ * The words of a side decision: where it was taken (the stable words of a known site, `translateLabel`; else the
27
+ * server's label, else the id in words), what decided, how it ended and what came out.
28
+ */
29
+ export declare const describeAgentDecision: (decision: AgentInspectDecision, translate: TranslateInContext, translateLabel?: TraceLabelTranslate) => AgentDecisionWords;
30
+ /** One line for the row of a side decision: `Skill preload · decision model · applied: preloaded Agent.Sandbox.Shell`. */
31
+ export declare const agentDecisionLine: (words: AgentDecisionWords) => string | null;
32
+ /**
33
+ * A JSON text set out over lines for reading. A text that is no whole JSON (a cut excerpt, a plain text) comes back
34
+ * as it is: showing it unformatted is the right answer for it, so the parser's refusal is the signal, not a failure.
35
+ */
36
+ export declare const formatJsonForReading: (text: string) => string;
37
+ /**
38
+ * The step with the line of its row: a side decision by its words (site, what decided, end, result — more than the
39
+ * server's own short line), a signal without a line by its name in words (`describeTraceSignal`: its tag, else its
40
+ * source) and the start of its text. Every other step comes back as it is. `translateLabel` translates the stable
41
+ * words of the trace values (`chat/trace/trace-labels.ts`).
42
+ */
43
+ export declare const withInspectStepLine: (step: AgentInspectStep, translate: TranslateInContext, translateLabel?: TraceLabelTranslate) => AgentInspectStep;
@@ -0,0 +1,47 @@
1
+ import type { AgentInspectTouchedFile, AgentInspectTouchedMount } from "./agent-inspect-types";
2
+ export interface TouchedFilesDirectoryNode {
3
+ type: "directory";
4
+ /** The folder's name; a chain of folders with nothing else in them is one node (`src/reports`). */
5
+ name: string;
6
+ /** The folder's path in its mount. */
7
+ path: string;
8
+ children: TouchedFilesNode[];
9
+ }
10
+ export interface TouchedFilesFileNode {
11
+ type: "file";
12
+ name: string;
13
+ path: string;
14
+ file: AgentInspectTouchedFile;
15
+ }
16
+ export type TouchedFilesNode = TouchedFilesDirectoryNode | TouchedFilesFileNode;
17
+ export interface TouchedFilesMountGroup {
18
+ key: string;
19
+ mountKind: string | null;
20
+ mountName: string | null;
21
+ driveSpaceId: number | null;
22
+ fileCount: number;
23
+ linesAdded: number;
24
+ linesRemoved: number;
25
+ nodes: TouchedFilesNode[];
26
+ }
27
+ /** The key of a file in the whole tree: its mount and its path. */
28
+ export declare const touchedFileKeyOf: (mountKey: string, path: string) => string;
29
+ /** The key of a mount: its kind, its name and its drive space. */
30
+ export declare const touchedMountKeyOf: (mount: Pick<AgentInspectTouchedMount, "mountKind" | "mountName" | "driveSpaceId">) => string;
31
+ /** The files of one mount as a tree of folders. */
32
+ export declare const buildTouchedFilesNodes: (files: readonly AgentInspectTouchedFile[]) => TouchedFilesNode[];
33
+ /** The touched files by mount, as trees; a mount without files is left out. */
34
+ export declare const buildTouchedFilesTree: (mounts: readonly AgentInspectTouchedMount[]) => TouchedFilesMountGroup[];
35
+ export interface TouchedFilesRow {
36
+ key: string;
37
+ /** 0 for a node directly below its mount. */
38
+ depth: number;
39
+ node: TouchedFilesNode;
40
+ }
41
+ /** The nodes of a mount as rows in display order, each with its depth; the folders named in `closedPaths` stay shut. */
42
+ export declare const flattenTouchedFilesNodes: (nodes: readonly TouchedFilesNode[], closedPaths?: ReadonlySet<string>, depth?: number) => TouchedFilesRow[];
43
+ /** The file of a key (`touchedFileKeyOf`) with its mount; null when the tree holds none. */
44
+ export declare const findTouchedFile: (mounts: readonly AgentInspectTouchedMount[], fileKey: string | null) => {
45
+ mount: AgentInspectTouchedMount;
46
+ file: AgentInspectTouchedFile;
47
+ } | null;
@@ -0,0 +1,56 @@
1
+ import type { AgentInspectStep, AgentInspectTrace, AgentInspectTurn } from "./agent-inspect-types";
2
+ /** Turns loaded per window (the newest ones first, then each "load earlier turns"). */
3
+ export declare const AGENT_INSPECT_TURN_PAGE_SIZE = 10;
4
+ /** A window of turns of the trace read. */
5
+ export interface AgentInspectTurnWindow {
6
+ fromTurnNumber: number;
7
+ limit: number;
8
+ }
9
+ /**
10
+ * The turns of two reads as one list, oldest first: a turn of `incoming` replaces the loaded turn of the same number
11
+ * (a polled running turn carries more steps than the one loaded before), every other turn stays.
12
+ */
13
+ export declare const mergeAgentInspectTurns: (loaded: readonly AgentInspectTurn[], incoming: readonly AgentInspectTurn[]) => AgentInspectTurn[];
14
+ /** What a page read of older turns answered: its turns and the paging facts of that page. */
15
+ export type AgentInspectTurnPage = Pick<AgentInspectTrace, "turns" | "firstTurnNumber" | "hasOlderTurns">;
16
+ /**
17
+ * The trace a screen shows: the page of the newest turns with the pages of older turns before it and the follow-up
18
+ * read of a running conversation over it.
19
+ *
20
+ * - `hasOlderTurns` is the fact of the page that reaches furthest back (the server says whether turns exist before
21
+ * the first turn of a page); a follow-up read is no page and never changes it.
22
+ * - `hasNewerTurns` stays the newest page's (false: it ends at the newest turn, and the follow-up read reads through
23
+ * the newest turn).
24
+ * - The run facts (`isRunLive`, `runState`, `newestMessageIndex`) and the turn count are those of the follow-up read
25
+ * when there is one, since it is the newer look at the conversation.
26
+ */
27
+ export declare const mergeAgentInspectTraces: (newest: AgentInspectTrace, olderPages: readonly AgentInspectTurnPage[], followUp: AgentInspectTrace | null) => AgentInspectTrace;
28
+ /**
29
+ * The page before the first loaded turn: null when the trace says nothing is older (`hasOlderTurns`), else the
30
+ * `pageSize` turns that end right before `firstTurnNumber` (turn numbers are positions among all turns, from 1).
31
+ */
32
+ export declare const previousAgentInspectTurnWindow: (trace: Pick<AgentInspectTrace, "hasOlderTurns" | "firstTurnNumber">, pageSize?: number) => AgentInspectTurnWindow | null;
33
+ /**
34
+ * The position (`indexInConversation`) the follow-up read of a live conversation asks after: the newest row the page
35
+ * of the newest turns saw, moved back before the first row of every turn that runs — a running turn comes back whole
36
+ * with every poll, because a step changes its status without a new row. Null when the page saw no row.
37
+ */
38
+ export declare const followUpPositionOfAgentInspectTrace: (trace: Pick<AgentInspectTrace, "newestMessageIndex" | "turns">) => number | null;
39
+ /** The step a link names (`?step=<id>`) among the loaded turns; null when none of them holds it. */
40
+ export declare const findAgentInspectStep: (turns: readonly AgentInspectTurn[], stepId: string | null) => AgentInspectStep | null;
41
+ /** A model call of the conversation, as a picker names it. */
42
+ export interface AgentInspectModelCallReference {
43
+ messageId: number;
44
+ turnNumber: number;
45
+ /** The number of the call within its turn, from 1. */
46
+ callNumber: number;
47
+ /** The model of the call in words ("GPT6 LUNA"). */
48
+ modelName: string | null;
49
+ }
50
+ /**
51
+ * The model calls of the loaded turns, oldest first. At debug level they are the `MODEL_CALL` steps; at the level of
52
+ * steps (no such steps) the assistant's text messages stand for them, since each of them came out of a model call.
53
+ */
54
+ export declare const collectAgentInspectModelCalls: (turns: readonly AgentInspectTurn[]) => AgentInspectModelCallReference[];
55
+ /** The message whose model call is the newest of the loaded turns; null without one. */
56
+ export declare const newestAgentInspectModelCallMessageId: (turns: readonly AgentInspectTurn[]) => number | null;
@@ -0,0 +1,36 @@
1
+ import type { AgentInspectMessage, AgentInspectStep, AgentInspectTurn } from "./agent-inspect-types";
2
+ /** A stretch of a turn's steps; one that starts at a model call with an interim text carries that step. */
3
+ export interface AgentInspectTurnSegment {
4
+ key: string;
5
+ /** The step whose model call wrote a text before its tools ran; null for the stretch before the first such text. */
6
+ interimStep: AgentInspectStep | null;
7
+ /** The steps of the stretch in order, the interim step first. */
8
+ steps: AgentInspectStep[];
9
+ }
10
+ /**
11
+ * The steps of a turn as stretches: a new stretch starts at every step that carries an interim text
12
+ * (`assistantText`), so the text stands where it was written — after the steps before it and before the steps its
13
+ * model call issued. A turn without such a text is one stretch; a turn without steps is one empty stretch.
14
+ */
15
+ export declare const splitAgentInspectTurnAtInterimTexts: (steps: readonly AgentInspectStep[]) => AgentInspectTurnSegment[];
16
+ /** A widget block an answer's text carries, read from its fence. */
17
+ export interface AgentInspectWidgetFence {
18
+ type: string | null;
19
+ title: string | null;
20
+ /** The JSON of the block as the text holds it. */
21
+ json: string;
22
+ }
23
+ /**
24
+ * An answer's text without its widget blocks, and the blocks it held. The admin view shows a widget by its title (and
25
+ * its fields behind a fold at the debug level), never as the raw JSON the model wrote. A block whose JSON does not
26
+ * parse still leaves the text; its type and title are then unknown.
27
+ */
28
+ export declare const splitAgentInspectWidgetFences: (text: string) => {
29
+ text: string;
30
+ fences: AgentInspectWidgetFence[];
31
+ };
32
+ /**
33
+ * The texts of the assistant that stand below the steps of a turn: every answer, and an interim text only when none
34
+ * of the turn's steps carries it (the steps of a truncated branch were left out, an older read).
35
+ */
36
+ export declare const readAgentInspectTurnAnswers: (turn: Pick<AgentInspectTurn, "answerMessages" | "steps">) => AgentInspectMessage[];
@@ -0,0 +1,22 @@
1
+ import type { AgentInspectTurn } from "./agent-inspect-types";
2
+ export type TurnTimelineSegmentKind = "modelCall" | "toolCall" | "subAgent" | "failed";
3
+ export interface TurnTimelineSegment {
4
+ key: string;
5
+ /** The step behind the segment (the id its detail opens by). */
6
+ stepId: string;
7
+ kind: TurnTimelineSegmentKind;
8
+ /** The step's name: its model or its tool. */
9
+ label: string;
10
+ durationMs: number;
11
+ leftPercent: number;
12
+ widthPercent: number;
13
+ }
14
+ export interface TurnTimeline {
15
+ durationMs: number;
16
+ segments: TurnTimelineSegment[];
17
+ }
18
+ /**
19
+ * The timeline of a turn: one segment per step that has a start and a duration, placed between the turn's start and
20
+ * its end (the later of its recorded duration and the end of its last step). Null without a readable start.
21
+ */
22
+ export declare const buildTurnTimeline: (turn: AgentInspectTurn) => TurnTimeline | null;
@@ -0,0 +1,8 @@
1
+ import type { ApiQueryHook } from "@mgamadeus/ddd-admin-ui/logic/pure";
2
+ import { type ReactNode } from "react";
3
+ /**
4
+ * A query hook as a function that answers a promise, for a block that asks for data on a click (the whole diff of a
5
+ * file change): `load(arg)` mounts a runner that calls the hook and settles the promise with its answer. Reads stay
6
+ * queries (cached, never held back by a write lock). Render `runners` once, anywhere in the component.
7
+ */
8
+ export declare const useQueryLoader: <TArg, TData>(useQuery: ApiQueryHook<TArg, TData>, keyOf: (arg: TArg) => string) => readonly [(arg: TArg) => Promise<TData>, ReactNode];
@@ -0,0 +1,15 @@
1
+ import { type AdminPeriod, type AdminPeriodPresetId, type AdminPeriodState } from "./admin-period";
2
+ export interface AdminPeriodControlProps {
3
+ /** The resolved period (`resolveAdminPeriod` of the screen's state). */
4
+ period: AdminPeriod;
5
+ /** Called with the state to keep (the URL keys `period`, `from`, `to`); a preset of days clears the two days. */
6
+ onChange: (state: AdminPeriodState) => void;
7
+ /** The presets offered, in order; default all five. */
8
+ presets?: readonly AdminPeriodPresetId[];
9
+ className?: string;
10
+ }
11
+ /**
12
+ * The period of an admin screen: the last 7, 14, 30 or 90 days up to today, or two typed days. The custom preset
13
+ * shows two date fields that start with the days of the period shown; each bound limits the other.
14
+ */
15
+ export declare const AdminPeriodControl: ({ period, onChange, presets, className }: AdminPeriodControlProps) => import("react/jsx-runtime").JSX.Element;