@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,51 @@
1
+ /** The presets of a period control: the last n days up to today, or a range of two typed days. */
2
+ export type AdminPeriodPresetId = "7d" | "14d" | "30d" | "90d" | "custom";
3
+ /** One preset with the days it covers (today included); the custom preset covers the two typed days. */
4
+ export interface AdminPeriodPreset {
5
+ id: AdminPeriodPresetId;
6
+ days: number | null;
7
+ }
8
+ export declare const ADMIN_PERIOD_PRESETS: readonly AdminPeriodPreset[];
9
+ /** The longest range the admin reads accept (`AgentControlPanelRange::MAX_DAYS`). */
10
+ export declare const ADMIN_PERIOD_MAX_DAYS = 366;
11
+ /** What a screen keeps of its period (its URL keys `period`, `from`, `to`): each `""` when unset. */
12
+ export interface AdminPeriodState {
13
+ preset: string;
14
+ from: string;
15
+ to: string;
16
+ }
17
+ /** A period as the requests take it: two inclusive calendar days and how many days they cover. */
18
+ export interface AdminPeriod {
19
+ preset: AdminPeriodPresetId;
20
+ /** The first day, `YYYY-MM-DD`. */
21
+ from: string;
22
+ /** The last day, `YYYY-MM-DD`. */
23
+ to: string;
24
+ dayCount: number;
25
+ }
26
+ /** Whether `value` is a calendar day that exists (`2026-02-30` does not). */
27
+ export declare const isAdminPeriodDay: (value: string | null | undefined) => value is string;
28
+ /** The days from `from` to `to`, both counted; 0 when `to` is before `from` or a day is invalid. */
29
+ export declare const countAdminPeriodDays: (from: string, to: string) => number;
30
+ /**
31
+ * The period of a screen's state on `today`: a preset of days ends today; the custom preset takes the two typed days
32
+ * when both exist, are in order and cover at most `ADMIN_PERIOD_MAX_DAYS` days, else the default preset applies. An
33
+ * unknown or empty preset is the default preset.
34
+ */
35
+ export declare const resolveAdminPeriod: (state: Partial<AdminPeriodState>, defaultPreset?: Exclude<AdminPeriodPresetId, "custom">, today?: string) => AdminPeriod;
36
+ /** The period of the same length that ends the day before `period` starts. */
37
+ export declare const precedingAdminPeriod: (period: Pick<AdminPeriod, "from" | "dayCount">) => {
38
+ from: string;
39
+ to: string;
40
+ };
41
+ /** The bucket of a time series: one point per day, or per ISO week keyed by its Monday. */
42
+ export type AdminPeriodGranularity = "DAY" | "WEEK";
43
+ /** The Monday of the ISO week `day` lies in. */
44
+ export declare const mondayOfAdminPeriodDay: (day: string) => string;
45
+ /**
46
+ * Every bucket key of a period in order: each day, or the Monday of each ISO week the period touches (the first
47
+ * Monday may lie before `from`). Empty for an invalid period.
48
+ */
49
+ export declare const adminPeriodBucketKeys: (from: string, to: string, granularity: AdminPeriodGranularity) => string[];
50
+ /** The bucket key of a point's day under a granularity: the day itself, or its week's Monday. */
51
+ export declare const adminPeriodBucketKeyOf: (day: string, granularity: AdminPeriodGranularity) => string;
@@ -0,0 +1,30 @@
1
+ import { type UrlStateAdapter } from "@mgamadeus/ddd-admin-ui/logic";
2
+ import { type PageLinkComponent } from "@mgamadeus/ddd-admin-ui/primitives";
3
+ import type { ReactNode } from "react";
4
+ import type { AgentQualityApi } from "./agent-quality-api";
5
+ /** The URL keys of the screen: the verdict filter and the page of the cases (1-based). */
6
+ export declare const AGENT_QUALITY_EVAL_RUN_URL_KEYS: readonly ["verdict", "page"];
7
+ export interface AgentQualityEvalRunScreenProps {
8
+ /** `createAgentQualityApi(…)` of the host. */
9
+ api: Pick<AgentQualityApi, "useQualityEvalRunQuery">;
10
+ /** The id of the recorded run (the host's route parameter). */
11
+ evalRunId: number;
12
+ /** Where the verdict filter and the page live: the host's URL adapter. Without one they live in component state. */
13
+ urlStateAdapter?: UrlStateAdapter;
14
+ /** Before the title: the host's link back to the quality screen. */
15
+ backLink?: ReactNode;
16
+ headerActions?: ReactNode;
17
+ linkComponent?: PageLinkComponent;
18
+ /** The link of the conversation a case drove; `null` = no link. */
19
+ buildConversationHref?: (conversationId: number) => string | null;
20
+ /** Cases per page (default 50, at most 500). */
21
+ pageSize?: number;
22
+ /** The host's display name of a model by its catalog name ("GPT-6 Luna"); null = the catalog name. */
23
+ describeModelName?: (modelName: string) => string | null;
24
+ }
25
+ /**
26
+ * One recorded evaluation run: what ran and how its cases ended, and its cases with a verdict filter and pages. A
27
+ * case names its fixture and model, its verdict, what went wrong (one finding per line), how long it took, its model
28
+ * and tool calls, what it cost and the conversation it drove.
29
+ */
30
+ export declare const AgentQualityEvalRunScreen: ({ api, evalRunId, urlStateAdapter, backLink, headerActions, linkComponent, buildConversationHref, pageSize, describeModelName }: AgentQualityEvalRunScreenProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,38 @@
1
+ import { type UrlStateAdapter } from "@mgamadeus/ddd-admin-ui/logic";
2
+ import { type PageLinkComponent } from "@mgamadeus/ddd-admin-ui/primitives";
3
+ import { type ReactNode } from "react";
4
+ import type { AgentQualityApi } from "./agent-quality-api";
5
+ import type { AgentQualityEvalRunSummary } from "./agent-quality-types";
6
+ /** The URL keys of the screen: the period (`period`, `from`, `to`) and how many of the newest evaluation runs are skipped. */
7
+ export declare const AGENT_QUALITY_URL_KEYS: readonly ["period", "from", "to", "runsOffset"];
8
+ export interface AgentQualityScreenProps {
9
+ /** `createAgentQualityApi(…)` of the host. */
10
+ api: AgentQualityApi;
11
+ /** Where the period and the page of the runs live: the host's URL adapter. Without one they live in component state. */
12
+ urlStateAdapter?: UrlStateAdapter;
13
+ /** The page title; default "Quality". Already translated. */
14
+ title?: ReactNode;
15
+ description?: ReactNode;
16
+ headerActions?: ReactNode;
17
+ linkComponent?: PageLinkComponent;
18
+ /** The link of a conversation in the host's agent screens; `null` = no link. */
19
+ buildConversationHref?: (conversationId: number) => string | null;
20
+ /** The host's route of one evaluation run (`AgentQualityEvalRunScreen`); `null` / absent = the runs are not links. */
21
+ buildEvalRunHref?: (evalRunId: number) => string | null;
22
+ /** Evaluation runs per page (default 8, at most 200). */
23
+ evalRunsPageSize?: number;
24
+ /** The host's display name of a model by its catalog name ("GPT-6 Luna"); null = the catalog name. */
25
+ describeModelName?: (modelName: string) => string | null;
26
+ }
27
+ /** The counts of a run as three marks with their numbers: passed, failed, broken. */
28
+ export declare const EvalRunCounts: ({ run, className }: {
29
+ run: AgentQualityEvalRunSummary;
30
+ className?: string;
31
+ }) => import("react/jsx-runtime").JSX.Element;
32
+ /**
33
+ * Where the agent fails and whether it still passes its evaluation: the figures of a period beside the period before
34
+ * (conversations with a failure, tool timeouts, aborted or expired turns, purposes finished, the newest evaluation
35
+ * run, ratings), the failures grouped by kind and by tool or model with their newest conversation, and the recorded
36
+ * evaluation runs.
37
+ */
38
+ export declare const AgentQualityScreen: ({ api, urlStateAdapter, title, description, headerActions, linkComponent, buildConversationHref, buildEvalRunHref, evalRunsPageSize, describeModelName }: AgentQualityScreenProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,27 @@
1
+ import type { CodeHighlighterLoader } from "@mgamadeus/ddd-admin-ui/files";
2
+ import type { AgentQualityApi } from "./agent-quality-api";
3
+ export interface SaveAsEvalCaseDialogProps {
4
+ /** `createAgentQualityApi(…)` of the host (the dialog uses its `useDraftEvalCaseMutation`). */
5
+ api: Pick<AgentQualityApi, "useDraftEvalCaseMutation">;
6
+ /** The conversation the case is made from. */
7
+ conversationId: number;
8
+ /**
9
+ * A message of the turn (the owner's message or any row after it). The route needs this or `messageIndex`: without
10
+ * both it refuses the draft and the dialog shows its message.
11
+ */
12
+ messageId?: number;
13
+ /** Without `messageId`: the position of a message of the turn in the conversation. */
14
+ messageIndex?: number;
15
+ open: boolean;
16
+ onOpenChange: (open: boolean) => void;
17
+ /** Colours the JSON with the host's highlighter; without it the JSON stays plain. */
18
+ loadCodeHighlighter?: CodeHighlighterLoader;
19
+ }
20
+ /**
21
+ * Drafts an evaluation case from one stored turn and shows it for a person to keep: the prompt, the skills the agent
22
+ * loaded and the tools it called in the turn, and the case as JSON (alone, or as a fixture file with this one case)
23
+ * with copy and "Download". The draft is asked for when the dialog opens; nothing is written on the server, and what
24
+ * the agent did is not necessarily what it should have done, so the JSON is reviewed before it goes into a fixture
25
+ * folder.
26
+ */
27
+ export declare const SaveAsEvalCaseDialog: ({ api, conversationId, messageId, messageIndex, open, onOpenChange, loadCodeHighlighter }: SaveAsEvalCaseDialogProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,86 @@
1
+ import { type ApiMutationHook, type ApiQueryHook, type InjectableBaseApi, type InjectedRequest, type StaticQueryFailure } from "@mgamadeus/ddd-admin-ui/logic/pure";
2
+ import type { AgentQualityEvalCaseDraftArg, AgentQualityEvalCaseDraftResponse, AgentQualityEvalRunArg, AgentQualityEvalRunResponse, AgentQualityEvalRunsArg, AgentQualityEvalRunsResponse, AgentQualityFailuresResponse, AgentQualityRangeArg, AgentQualitySummaryResponse } from "./agent-quality-types";
3
+ /** The cache tag type of the quality reads (ids `SUMMARY`, `FAILURES`, `EVAL_RUNS`, `EVAL_RUN`). */
4
+ export declare const AGENT_QUALITY_TAG = "AdminUiAgentQuality";
5
+ /** The hooks `createAgentQualityApi` returns; the quality screens and `SaveAsEvalCaseDialog` take them as `api`. */
6
+ export interface AgentQualityApi {
7
+ /** `GET /summary?from&to`: the figures of the period and of the period before, the newest evaluation run. */
8
+ useQualitySummaryQuery: ApiQueryHook<AgentQualityRangeArg, AgentQualitySummaryResponse>;
9
+ /** `GET /failures?from&to`: the failures of the period, grouped by kind and tool or model. */
10
+ useQualityFailuresQuery: ApiQueryHook<AgentQualityRangeArg, AgentQualityFailuresResponse>;
11
+ /** `GET /evalRuns?limit&offset`: the recorded evaluation runs, the newest first. */
12
+ useQualityEvalRunsQuery: ApiQueryHook<AgentQualityEvalRunsArg, AgentQualityEvalRunsResponse>;
13
+ /** `GET /evalRuns/{evalRunId}?verdicts&top&skip`: one run with a page of its cases. */
14
+ useQualityEvalRunQuery: ApiQueryHook<AgentQualityEvalRunArg, AgentQualityEvalRunResponse>;
15
+ /** `POST /evalCases`: drafts an evaluation case from a stored turn. Answers a document; nothing is written. */
16
+ useDraftEvalCaseMutation: ApiMutationHook<AgentQualityEvalCaseDraftArg, AgentQualityEvalCaseDraftResponse>;
17
+ }
18
+ export interface CreateAgentQualityApiOptions {
19
+ /** The host's RTK Query api (`createApi` with the React hooks module). */
20
+ baseApi: InjectableBaseApi;
21
+ /** Where the host mounts `AdminAgentQualityTrait`, without a trailing slash (`/api/admin/ai/agentQuality`). */
22
+ apiPrefix: string;
23
+ }
24
+ /** The request of every operation, on `apiPrefix`. Pure: no RTK runtime. */
25
+ export declare const buildAgentQualityRequests: (apiPrefix: string) => {
26
+ summary: (arg?: AgentQualityRangeArg) => InjectedRequest;
27
+ failures: (arg?: AgentQualityRangeArg) => InjectedRequest;
28
+ evalRuns: (arg?: AgentQualityEvalRunsArg) => InjectedRequest;
29
+ evalRun: ({ evalRunId, verdicts, top, skip }: AgentQualityEvalRunArg) => InjectedRequest;
30
+ draftEvalCase: ({ conversationId, messageId, messageIndex }: AgentQualityEvalCaseDraftArg) => InjectedRequest;
31
+ };
32
+ /** The operations as injected. The draft is a mutation without tags: it writes nothing. */
33
+ export declare const agentQualityEndpointDefinitions: (apiPrefix: string) => {
34
+ readonly adminUiAgentQualitySummary: {
35
+ readonly kind: "query";
36
+ readonly request: (arg?: AgentQualityRangeArg) => InjectedRequest;
37
+ readonly providesTags: readonly [{
38
+ readonly type: "AdminUiAgentQuality";
39
+ readonly id: "SUMMARY";
40
+ }];
41
+ };
42
+ readonly adminUiAgentQualityFailures: {
43
+ readonly kind: "query";
44
+ readonly request: (arg?: AgentQualityRangeArg) => InjectedRequest;
45
+ readonly providesTags: readonly [{
46
+ readonly type: "AdminUiAgentQuality";
47
+ readonly id: "FAILURES";
48
+ }];
49
+ };
50
+ readonly adminUiAgentQualityEvalRuns: {
51
+ readonly kind: "query";
52
+ readonly request: (arg?: AgentQualityEvalRunsArg) => InjectedRequest;
53
+ readonly providesTags: readonly [{
54
+ readonly type: "AdminUiAgentQuality";
55
+ readonly id: "EVAL_RUNS";
56
+ }];
57
+ };
58
+ readonly adminUiAgentQualityEvalRun: {
59
+ readonly kind: "query";
60
+ readonly request: ({ evalRunId, verdicts, top, skip }: AgentQualityEvalRunArg) => InjectedRequest;
61
+ readonly providesTags: readonly [{
62
+ readonly type: "AdminUiAgentQuality";
63
+ readonly id: "EVAL_RUN";
64
+ }];
65
+ };
66
+ readonly adminUiAgentQualityDraftEvalCase: {
67
+ readonly kind: "mutation";
68
+ readonly request: ({ conversationId, messageId, messageIndex }: AgentQualityEvalCaseDraftArg) => InjectedRequest;
69
+ };
70
+ };
71
+ /**
72
+ * Injects the quality operations into the host's RTK Query api and returns their hooks. Call it once at module scope:
73
+ * `export const agentQualityApi = createAgentQualityApi({ baseApi, apiPrefix: "/api/admin/ai/agentQuality" });`
74
+ */
75
+ export declare const createAgentQualityApi: ({ baseApi, apiPrefix }: CreateAgentQualityApiOptions) => AgentQualityApi;
76
+ /** Fixed answers of a `createStaticAgentQualityApi`; a query without one stays loading. */
77
+ export interface StaticAgentQualityData {
78
+ summary?: (arg: AgentQualityRangeArg) => AgentQualitySummaryResponse | StaticQueryFailure | undefined;
79
+ failures?: (arg: AgentQualityRangeArg) => AgentQualityFailuresResponse | StaticQueryFailure | undefined;
80
+ evalRuns?: (arg: AgentQualityEvalRunsArg) => AgentQualityEvalRunsResponse | StaticQueryFailure | undefined;
81
+ evalRun?: (arg: AgentQualityEvalRunArg) => AgentQualityEvalRunResponse | StaticQueryFailure | undefined;
82
+ /** The answer of a draft; default an empty draft. A thrown error is the failed request. */
83
+ draftEvalCase?: (arg: AgentQualityEvalCaseDraftArg) => AgentQualityEvalCaseDraftResponse | Promise<AgentQualityEvalCaseDraftResponse>;
84
+ }
85
+ /** An `AgentQualityApi` answering fixed payloads, without a store or a request (previews, tests, reviews). */
86
+ export declare const createStaticAgentQualityApi: (data: StaticAgentQualityData) => AgentQualityApi;
@@ -0,0 +1,52 @@
1
+ import { type LucideIcon } from "lucide-react";
2
+ import { type AdminWireSet } from "../wire/admin-wire";
3
+ import { type AgentQualityEvalRunSummary, type AgentQualityEvalVerdict, type AgentQualityFailureGroup, type AgentQualityFailureKind, type AgentQualityPeriodFigures } from "./agent-quality-types";
4
+ /** How a failure kind shows: its name, what it means, its icon. */
5
+ export interface AgentQualityFailureKindDefinition {
6
+ label: string;
7
+ description: string;
8
+ icon: LucideIcon;
9
+ }
10
+ export declare const AGENT_QUALITY_FAILURE_KIND_DEFINITIONS: Readonly<Record<AgentQualityFailureKind, AgentQualityFailureKindDefinition>>;
11
+ /** Whether a kind is one the package names. */
12
+ export declare const isKnownAgentQualityFailureKind: (kind: string) => kind is AgentQualityFailureKind;
13
+ /** The failures of one kind, as the table lists them under one heading. */
14
+ export interface AgentQualityFailureKindSection {
15
+ kind: string;
16
+ /** The occurrences of the kind over all of its lines. */
17
+ count: number;
18
+ groups: AgentQualityFailureGroup[];
19
+ }
20
+ /**
21
+ * The failure lines by kind: the kind with the most occurrences first (equal counts in the order of
22
+ * `AGENT_QUALITY_FAILURE_KINDS`, unknown kinds last by name); inside a kind the lines keep the order they came in
23
+ * (the most frequent first).
24
+ */
25
+ export declare const groupAgentQualityFailuresByKind: (failures: AdminWireSet<AgentQualityFailureGroup> | null | undefined) => AgentQualityFailureKindSection[];
26
+ /** What a failure line happened with: its tool, else its model, with the error code beside it; null when it names none. */
27
+ export declare const agentQualityFailureSubjectOf: (group: Pick<AgentQualityFailureGroup, "toolName" | "modelName" | "errorCode">) => {
28
+ name: string | null;
29
+ errorCode: string | null;
30
+ };
31
+ /** The turns of a period that ended without an answer: aborted (failed, given up, cancelled) and expired; null when neither was read. */
32
+ export declare const abortedAndExpiredTurnCountOf: (figures: AgentQualityPeriodFigures | null | undefined) => number | null;
33
+ /** `current - previous`; null when one of them is missing. */
34
+ export declare const qualityFigureChangeOf: (current: number | null | undefined, previous: number | null | undefined) => number | null;
35
+ /** The verdict of an evaluation case. */
36
+ export declare const AGENT_QUALITY_EVAL_VERDICT: Readonly<Record<AgentQualityEvalVerdict, import("@mgamadeus/ddd-admin-ui/logic").StatusDefinition>>;
37
+ /** The verdict filter of a run's cases: which verdicts each choice asks for (none = every case). */
38
+ export declare const AGENT_QUALITY_EVAL_VERDICT_FILTERS: {
39
+ readonly all: readonly [];
40
+ readonly failed: readonly ["FAIL", "ERROR"];
41
+ readonly passed: readonly ["PASS"];
42
+ readonly notJudged: readonly ["NOT_APPLICABLE", "EXPECTED_FAIL"];
43
+ };
44
+ export type AgentQualityEvalVerdictFilter = keyof typeof AGENT_QUALITY_EVAL_VERDICT_FILTERS;
45
+ /** The models a run names in its options (`models`, `model`, `aiModelName`), in order and without repeats; empty when it names none. */
46
+ export declare const evalRunModelNamesOf: (run: Pick<AgentQualityEvalRunSummary, "runOptionsJson"> | null | undefined) => string[];
47
+ /** Seconds as a short duration (`48 s`, `3 min 20 s`, `1 h 4 min`). */
48
+ export declare const formatQualityDuration: (seconds: number | null | undefined) => string;
49
+ /** The name of the file a drafted case is saved as (`eval-case-<case id>.json`), safe for a file system. */
50
+ export declare const evalCaseFileNameOf: (caseId: string | null | undefined, kind: "case" | "fixture") => string;
51
+ /** The icon of a kind the package does not name. */
52
+ export declare const UNKNOWN_FAILURE_KIND_ICON: LucideIcon;
@@ -0,0 +1,161 @@
1
+ import type { AdminWireSet } from "../wire/admin-wire";
2
+ /** The kinds a quality view groups failures by (`AgentQualityFailureKind::KINDS`), in the order equal counts are listed. */
3
+ export declare const AGENT_QUALITY_FAILURE_KINDS: readonly ["TOOL_TIMEOUT", "INVALID_ARGUMENTS", "REFUSED_BY_GATE", "MODEL_ERROR", "RUN_STUCK", "TURN_GAVE_UP", "TURN_FAILED", "TURN_EXPIRED", "RUN_ERROR", "REPEATED_CALL", "TOOL_ERROR"];
4
+ export type AgentQualityFailureKind = (typeof AGENT_QUALITY_FAILURE_KINDS)[number];
5
+ /** The counted figures of one period (`AgentQualityPeriodFigures`); a figure that could not be read is null. */
6
+ export interface AgentQualityPeriodFigures {
7
+ fromDay?: string;
8
+ toDay?: string;
9
+ conversationsWithFailureCount?: number | null;
10
+ toolTimeoutCount?: number | null;
11
+ turnCount?: number | null;
12
+ answeredTurnCount?: number | null;
13
+ /** Turns that ended without an answer and not by expiry: failed, given up or cancelled. */
14
+ abortedTurnCount?: number | null;
15
+ failedTurnCount?: number | null;
16
+ gaveUpTurnCount?: number | null;
17
+ cancelledTurnCount?: number | null;
18
+ expiredTurnCount?: number | null;
19
+ }
20
+ /** One recorded evaluation run (`AgentQualityEvalRunSummary`). */
21
+ export interface AgentQualityEvalRunSummary {
22
+ evalRunId?: number | null;
23
+ suiteLabel?: string | null;
24
+ command?: string | null;
25
+ host?: string | null;
26
+ startedAt?: string | null;
27
+ finishedAt?: string | null;
28
+ durationSeconds?: number | null;
29
+ casesTotal?: number;
30
+ /** Cases that could pass or fail. */
31
+ casesJudged?: number;
32
+ casesPassed?: number;
33
+ casesFailed?: number;
34
+ casesErrored?: number;
35
+ casesNotApplicable?: number;
36
+ casesFailedAsExpected?: number;
37
+ /** The share of the judged cases that passed, 0 to 1; null without a judged case. */
38
+ passRate?: number | null;
39
+ isGreen?: boolean;
40
+ /** The run's options as a small JSON object (models, flavors, suites). */
41
+ runOptionsJson?: string | null;
42
+ logDirectoryName?: string | null;
43
+ }
44
+ /** The quality figures of a period (`AgentQualitySummary`). */
45
+ export interface AgentQualitySummary {
46
+ figures?: AgentQualityPeriodFigures | null;
47
+ previousFigures?: AgentQualityPeriodFigures | null;
48
+ /** Conversations marked as running although their last heartbeat is older than the limit, now. */
49
+ stuckRunCount?: number | null;
50
+ stuckAfterSeconds?: number;
51
+ purposeRunCount?: number | null;
52
+ finishedPurposeRunCount?: number | null;
53
+ purposeFinishRate?: number | null;
54
+ latestEvalRun?: AgentQualityEvalRunSummary | null;
55
+ /** False: no rating of an answer is stored, so there is no count of negative ratings. */
56
+ isSatisfactionCaptured?: boolean;
57
+ thumbsDownCount?: number | null;
58
+ unavailableParts?: string[] | null;
59
+ }
60
+ export interface AgentQualityRangeArg {
61
+ from?: string;
62
+ to?: string;
63
+ }
64
+ /** `GET {prefix}/summary`. */
65
+ export interface AgentQualitySummaryResponse {
66
+ summary?: AgentQualitySummary | null;
67
+ }
68
+ /** One line of the failures of a period (`AgentQualityFailureGroup`). */
69
+ export interface AgentQualityFailureGroup {
70
+ kind: AgentQualityFailureKind | string;
71
+ toolName?: string | null;
72
+ modelName?: string | null;
73
+ errorCode?: string | null;
74
+ count?: number;
75
+ latestConversationId?: number | null;
76
+ latestConversationTitle?: string | null;
77
+ latestAt?: string | null;
78
+ }
79
+ /** `GET {prefix}/failures`. */
80
+ export interface AgentQualityFailuresResponse {
81
+ rangeFrom?: string;
82
+ rangeTo?: string;
83
+ /** The groups (`AgentQualityFailureGroups`, an object set; read through `wireElementsOf`). */
84
+ failures?: AdminWireSet<AgentQualityFailureGroup> | null;
85
+ /** True: a read reached its row limit, the counts are a lower bound. */
86
+ isTruncated?: boolean;
87
+ /** The parts that could not be read (`toolCalls`, `errorRows`, `turnEnds`, `stuckRuns`). */
88
+ unavailableParts?: string[] | null;
89
+ }
90
+ export interface AgentQualityEvalRunsArg {
91
+ limit?: number;
92
+ offset?: number;
93
+ }
94
+ /** `GET {prefix}/evalRuns`. */
95
+ export interface AgentQualityEvalRunsResponse {
96
+ /** The runs (`AgentQualityEvalRunSummaries`, an object set; read through `wireElementsOf`). */
97
+ evalRuns?: AdminWireSet<AgentQualityEvalRunSummary> | null;
98
+ }
99
+ export type AgentQualityEvalVerdict = "PASS" | "FAIL" | "ERROR" | "NOT_APPLICABLE" | "EXPECTED_FAIL";
100
+ /** One case of a recorded run (`AgentEvalSuiteCase`). */
101
+ export interface AgentQualityEvalCase {
102
+ id?: number;
103
+ agentEvalSuiteRunId?: number | null;
104
+ caseId?: string | null;
105
+ suiteName?: string | null;
106
+ fixtureName?: string | null;
107
+ modelName?: string | null;
108
+ /** `call` (deterministic, single-shot) or `judge` (simulated owner and judge). */
109
+ flavor?: string | null;
110
+ aiConversationId?: number | null;
111
+ verdict?: AgentQualityEvalVerdict | string | null;
112
+ /** What went wrong, one finding per line. */
113
+ findings?: string | null;
114
+ wallSeconds?: number | null;
115
+ agentSeconds?: number | null;
116
+ ownerTurns?: number | null;
117
+ modelCalls?: number | null;
118
+ toolCalls?: number | null;
119
+ costUsd?: number | null;
120
+ }
121
+ export interface AgentQualityEvalRunArg {
122
+ evalRunId: number;
123
+ /** Only cases with one of these verdicts; empty or absent = every case. */
124
+ verdicts?: readonly string[];
125
+ top?: number;
126
+ skip?: number;
127
+ }
128
+ /** `GET {prefix}/evalRuns/{evalRunId}`. */
129
+ export interface AgentQualityEvalRunResponse {
130
+ evalRun?: AgentQualityEvalRunSummary | null;
131
+ cases?: AdminWireSet<AgentQualityEvalCase> | null;
132
+ /** How many cases of the run match the verdict filter, over every page. */
133
+ caseCount?: number;
134
+ }
135
+ /** `POST {prefix}/evalCases`: the turn a case is drafted from. */
136
+ export interface AgentQualityEvalCaseDraftArg {
137
+ conversationId: number;
138
+ /** The id of a message of the turn. */
139
+ messageId?: number;
140
+ /** Without `messageId`: the position of a message of the turn in the conversation. */
141
+ messageIndex?: number;
142
+ }
143
+ /** The draft of an evaluation case (`AgentQualityEvalCaseDraft`). Nothing is written by the route. */
144
+ export interface AgentQualityEvalCaseDraft {
145
+ caseId?: string;
146
+ conversationId?: number | null;
147
+ initiatorMessageIndex?: number | null;
148
+ prompt?: string;
149
+ agentSpaceId?: number | null;
150
+ purposeName?: string | null;
151
+ skillNames?: string[] | null;
152
+ toolNames?: string[] | null;
153
+ /** The case alone as JSON. */
154
+ caseJson?: string;
155
+ /** A fixture file with this one case as JSON. */
156
+ fixtureJson?: string;
157
+ }
158
+ /** The answer of `POST {prefix}/evalCases`. */
159
+ export interface AgentQualityEvalCaseDraftResponse {
160
+ evalCase?: AgentQualityEvalCaseDraft | null;
161
+ }
@@ -0,0 +1,43 @@
1
+ import { type PageLinkComponent } from "@mgamadeus/ddd-admin-ui/primitives";
2
+ import { type ReactNode } from "react";
3
+ import type { AgentSchedulesApi } from "./agent-schedules-api";
4
+ import type { AgentSchedulePlace, AgentSchedulesScope } from "./agent-schedules-types";
5
+ export interface AgentSchedulesPanelProps {
6
+ /** `createAgentSchedulesApi(…)` of the host. */
7
+ api: AgentSchedulesApi;
8
+ /** Only the schedules of places of this kind (a kind the application names), and with `recordId` of this record. */
9
+ placeKind?: string;
10
+ recordId?: number;
11
+ /**
12
+ * Whose schedules: `own` (the signed-in account's, the default) or `all` (every account's, with an owner column).
13
+ * The server refuses `all` for an account that may not see every account's schedules.
14
+ */
15
+ scope?: AgentSchedulesScope;
16
+ /** The link of a schedule's owner in the host (scope `all`); `null` = no link. */
17
+ buildAccountHref?: (accountId: number) => string | null;
18
+ /** False: the actions that change a schedule are off. Default true. */
19
+ writesAllowed?: boolean;
20
+ linkComponent?: PageLinkComponent;
21
+ /** The link of a run's conversation in the host's agent screens; `null` = no link. */
22
+ buildConversationHref?: (conversationId: number) => string | null;
23
+ /** The host's name of a place (its kind and record); default the place's own name, else its kind. Already translated. */
24
+ describePlace?: (place: AgentSchedulePlace) => ReactNode;
25
+ /**
26
+ * The host's words for the cron expression of a recurring schedule ("Every day at 07:00"); null or absent = the
27
+ * expression itself. Already translated. The expression stays readable as the tooltip.
28
+ */
29
+ describeCronSchedule?: (expression: string) => string | null;
30
+ /** The schedule whose runs are open, when the host keeps it (the URL); with it pass `onSelectSchedule`. */
31
+ selectedScheduleId?: number | null;
32
+ onSelectSchedule?: (scheduleId: number | null) => void;
33
+ /** The card's heading; default "Schedules". Already translated. */
34
+ title?: ReactNode;
35
+ className?: string;
36
+ }
37
+ /**
38
+ * The agent's schedules as a table: where a schedule lives, its label and task, its timing (cron expression or
39
+ * one-time moment, with its time zone), its state, the last and the next run and how the newest run ended. A row's
40
+ * menu opens the runs, edits the schedule, pauses or resumes it, runs it now or deletes it; each entry shows only when
41
+ * the schedule allows it now, and a delete or a run asks first.
42
+ */
43
+ export declare const AgentSchedulesPanel: ({ api, placeKind, recordId, scope, buildAccountHref, writesAllowed, linkComponent, buildConversationHref, describePlace, describeCronSchedule, selectedScheduleId, onSelectSchedule, title, className, }: AgentSchedulesPanelProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,116 @@
1
+ import { type ApiMutationHook, type ApiQueryHook, type InjectableBaseApi, type InjectedRequest, type StaticQueryFailure } from "@mgamadeus/ddd-admin-ui/logic/pure";
2
+ import type { AgentScheduleActionResponse, AgentScheduleIdArg, AgentScheduleRunsArg, AgentScheduleRunsResponse, AgentSchedulesArg, AgentSchedulesResponse, AgentScheduleUpdateArg } from "./agent-schedules-types";
3
+ /** The cache tag type of the schedule operations (ids `LIST`, `RUNS`). */
4
+ export declare const AGENT_SCHEDULES_TAG = "AdminUiAgentSchedules";
5
+ /** The hooks `createAgentSchedulesApi` returns; `AgentSchedulesPanel` takes them as `api`. */
6
+ export interface AgentSchedulesApi {
7
+ /** `GET /list?placeKind&recordId&scope`: the schedules with their place, newest run and allowed actions; `scope=all` lists every account's. */
8
+ useAgentSchedulesQuery: ApiQueryHook<AgentSchedulesArg, AgentSchedulesResponse>;
9
+ /** `GET /{scheduleId}/runs?limit&beforeConversationId`: the runs of one schedule, newest first. */
10
+ useAgentScheduleRunsQuery: ApiQueryHook<AgentScheduleRunsArg, AgentScheduleRunsResponse>;
11
+ /** `POST /{scheduleId}/pause`. */
12
+ usePauseAgentScheduleMutation: ApiMutationHook<AgentScheduleIdArg, AgentScheduleActionResponse>;
13
+ /** `POST /{scheduleId}/resume`. */
14
+ useResumeAgentScheduleMutation: ApiMutationHook<AgentScheduleIdArg, AgentScheduleActionResponse>;
15
+ /** `POST /{scheduleId}/runNow`: starts a run now; answers its conversation. */
16
+ useRunAgentScheduleNowMutation: ApiMutationHook<AgentScheduleIdArg, AgentScheduleActionResponse>;
17
+ /** `POST /{scheduleId}/update`: title, task, cron expression or one-time moment. */
18
+ useUpdateAgentScheduleMutation: ApiMutationHook<AgentScheduleUpdateArg, AgentScheduleActionResponse>;
19
+ /** `DELETE /{scheduleId}`: removes, archives or keeps the schedule as history (`actionTaken`). */
20
+ useDeleteAgentScheduleMutation: ApiMutationHook<AgentScheduleIdArg, AgentScheduleActionResponse>;
21
+ }
22
+ export interface CreateAgentSchedulesApiOptions {
23
+ /** The host's RTK Query api (`createApi` with the React hooks module). */
24
+ baseApi: InjectableBaseApi;
25
+ /** Where the host mounts `AdminAgentSchedulesTrait`, without a trailing slash (`/api/admin/ai/agentSchedules`). */
26
+ apiPrefix: string;
27
+ }
28
+ /** The request of every operation, on `apiPrefix`. Pure: no RTK runtime. */
29
+ export declare const buildAgentSchedulesRequests: (apiPrefix: string) => {
30
+ list: (arg?: AgentSchedulesArg) => InjectedRequest;
31
+ runs: ({ scheduleId, limit, beforeConversationId }: AgentScheduleRunsArg) => InjectedRequest;
32
+ pause: ({ scheduleId }: AgentScheduleIdArg) => InjectedRequest;
33
+ resume: ({ scheduleId }: AgentScheduleIdArg) => InjectedRequest;
34
+ runNow: ({ scheduleId }: AgentScheduleIdArg) => InjectedRequest;
35
+ update: ({ scheduleId, ...changes }: AgentScheduleUpdateArg) => InjectedRequest;
36
+ remove: ({ scheduleId }: AgentScheduleIdArg) => InjectedRequest;
37
+ };
38
+ /** The operations as injected. */
39
+ export declare const agentSchedulesEndpointDefinitions: (apiPrefix: string) => {
40
+ readonly adminUiAgentSchedules: {
41
+ readonly kind: "query";
42
+ readonly request: (arg?: AgentSchedulesArg) => InjectedRequest;
43
+ readonly providesTags: readonly [{
44
+ readonly type: "AdminUiAgentSchedules";
45
+ readonly id: "LIST";
46
+ }];
47
+ };
48
+ readonly adminUiAgentScheduleRuns: {
49
+ readonly kind: "query";
50
+ readonly request: ({ scheduleId, limit, beforeConversationId }: AgentScheduleRunsArg) => InjectedRequest;
51
+ readonly providesTags: readonly [{
52
+ readonly type: "AdminUiAgentSchedules";
53
+ readonly id: "RUNS";
54
+ }];
55
+ };
56
+ readonly adminUiAgentSchedulePause: {
57
+ readonly kind: "mutation";
58
+ readonly request: ({ scheduleId }: AgentScheduleIdArg) => InjectedRequest;
59
+ readonly invalidatesTags: readonly [{
60
+ readonly type: "AdminUiAgentSchedules";
61
+ readonly id: "LIST";
62
+ }];
63
+ };
64
+ readonly adminUiAgentScheduleResume: {
65
+ readonly kind: "mutation";
66
+ readonly request: ({ scheduleId }: AgentScheduleIdArg) => InjectedRequest;
67
+ readonly invalidatesTags: readonly [{
68
+ readonly type: "AdminUiAgentSchedules";
69
+ readonly id: "LIST";
70
+ }];
71
+ };
72
+ readonly adminUiAgentScheduleRunNow: {
73
+ readonly kind: "mutation";
74
+ readonly request: ({ scheduleId }: AgentScheduleIdArg) => InjectedRequest;
75
+ readonly invalidatesTags: readonly [{
76
+ readonly type: "AdminUiAgentSchedules";
77
+ readonly id: "LIST";
78
+ }, {
79
+ readonly type: "AdminUiAgentSchedules";
80
+ readonly id: "RUNS";
81
+ }];
82
+ };
83
+ readonly adminUiAgentScheduleUpdate: {
84
+ readonly kind: "mutation";
85
+ readonly request: ({ scheduleId, ...changes }: AgentScheduleUpdateArg) => InjectedRequest;
86
+ readonly invalidatesTags: readonly [{
87
+ readonly type: "AdminUiAgentSchedules";
88
+ readonly id: "LIST";
89
+ }];
90
+ };
91
+ readonly adminUiAgentScheduleDelete: {
92
+ readonly kind: "mutation";
93
+ readonly request: ({ scheduleId }: AgentScheduleIdArg) => InjectedRequest;
94
+ readonly invalidatesTags: readonly [{
95
+ readonly type: "AdminUiAgentSchedules";
96
+ readonly id: "LIST";
97
+ }];
98
+ };
99
+ };
100
+ /**
101
+ * Injects the schedule operations into the host's RTK Query api and returns their hooks. Call it once at module scope:
102
+ * `export const agentSchedulesApi = createAgentSchedulesApi({ baseApi, apiPrefix: "/api/admin/ai/agentSchedules" });`
103
+ */
104
+ export declare const createAgentSchedulesApi: ({ baseApi, apiPrefix }: CreateAgentSchedulesApiOptions) => AgentSchedulesApi;
105
+ /** Fixed answers of a `createStaticAgentSchedulesApi`; a query without one stays loading, an action without one answers empty. */
106
+ export interface StaticAgentSchedulesData {
107
+ list?: (arg: AgentSchedulesArg) => AgentSchedulesResponse | StaticQueryFailure | undefined;
108
+ runs?: (arg: AgentScheduleRunsArg) => AgentScheduleRunsResponse | StaticQueryFailure | undefined;
109
+ pause?: (arg: AgentScheduleIdArg) => AgentScheduleActionResponse | Promise<AgentScheduleActionResponse>;
110
+ resume?: (arg: AgentScheduleIdArg) => AgentScheduleActionResponse | Promise<AgentScheduleActionResponse>;
111
+ runNow?: (arg: AgentScheduleIdArg) => AgentScheduleActionResponse | Promise<AgentScheduleActionResponse>;
112
+ update?: (arg: AgentScheduleUpdateArg) => AgentScheduleActionResponse | Promise<AgentScheduleActionResponse>;
113
+ remove?: (arg: AgentScheduleIdArg) => AgentScheduleActionResponse | Promise<AgentScheduleActionResponse>;
114
+ }
115
+ /** An `AgentSchedulesApi` answering fixed payloads, without a store or a request (previews, tests, reviews). */
116
+ export declare const createStaticAgentSchedulesApi: (data: StaticAgentSchedulesData) => AgentSchedulesApi;
@@ -0,0 +1,25 @@
1
+ import type { AgentScheduleListItem, AgentScheduleStatus, AgentScheduleUpdateArg } from "./agent-schedules-types";
2
+ /** Where a schedule stands (`AIConversationScheduleStatus`). */
3
+ export declare const AGENT_SCHEDULE_STATUS: Readonly<Record<AgentScheduleStatus, import("@mgamadeus/ddd-admin-ui/logic").StatusDefinition>>;
4
+ /** The run state of a run's conversation (`AIConversationRunState`). */
5
+ export declare const AGENT_RUN_STATE: Readonly<Record<string, import("@mgamadeus/ddd-admin-ui/logic").StatusDefinition>>;
6
+ /** What the edit dialog holds, as its fields hold it. */
7
+ export interface AgentScheduleEditValues {
8
+ title: string;
9
+ task: string;
10
+ /** The cron expression of a recurring schedule. */
11
+ cronSchedule: string;
12
+ /** The moment of a one-time task as a `datetime-local` field holds it (`YYYY-MM-DDTHH:MM`), in the schedule's time zone. */
13
+ runAtLocalTime: string;
14
+ }
15
+ /** A UTC moment of the backend (`Y-m-d H:i:s`) as the wall time of `timeZone`, in the form of a `datetime-local` field; `""` when unreadable. */
16
+ export declare const scheduleLocalDateTimeOf: (utcDateTime: string | null | undefined, timeZone: string) => string;
17
+ /** The fields of the edit dialog for a schedule as listed. */
18
+ export declare const agentScheduleEditValuesOf: (item: AgentScheduleListItem) => AgentScheduleEditValues;
19
+ /**
20
+ * The update of a schedule: only the fields that differ from what the dialog started with (the route changes only what
21
+ * is sent). The one-time moment goes as `YYYY-MM-DD HH:MM`; null when nothing changed.
22
+ */
23
+ export declare const buildAgentScheduleUpdate: (scheduleId: number, initial: AgentScheduleEditValues, edited: AgentScheduleEditValues, isOneTime: boolean) => AgentScheduleUpdateArg | null;
24
+ /** The longest title the update route takes. */
25
+ export declare const AGENT_SCHEDULE_TITLE_MAX_LENGTH = 60;