@lincyaw/aegis-ui 0.11.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/dist/agent/ask/AskPanel.cjs +1 -1
  2. package/dist/agent/ask/AskPanel.cjs.map +1 -1
  3. package/dist/agent/ask/AskPanel.js +25 -25
  4. package/dist/agent/ask/AskPanel.js.map +1 -1
  5. package/dist/components/ui/Button.cjs.map +1 -1
  6. package/dist/components/ui/Button.d.ts +4 -2
  7. package/dist/components/ui/Button.js.map +1 -1
  8. package/dist/components/ui/CheckGrid.cjs +1 -1
  9. package/dist/components/ui/CheckGrid.cjs.map +1 -1
  10. package/dist/components/ui/CheckGrid.js +18 -17
  11. package/dist/components/ui/CheckGrid.js.map +1 -1
  12. package/dist/components/ui/CodeEditor.cjs +1 -1
  13. package/dist/components/ui/CodeEditor.cjs.map +1 -1
  14. package/dist/components/ui/CodeEditor.js +95 -87
  15. package/dist/components/ui/CodeEditor.js.map +1 -1
  16. package/dist/components/ui/CommandInvocationCard.cjs +1 -1
  17. package/dist/components/ui/CommandInvocationCard.cjs.map +1 -1
  18. package/dist/components/ui/CommandInvocationCard.js +10 -10
  19. package/dist/components/ui/CommandInvocationCard.js.map +1 -1
  20. package/dist/components/ui/DangerZone.cjs +1 -1
  21. package/dist/components/ui/DangerZone.cjs.map +1 -1
  22. package/dist/components/ui/DangerZone.js +12 -12
  23. package/dist/components/ui/DangerZone.js.map +1 -1
  24. package/dist/components/ui/DataList.cjs +1 -1
  25. package/dist/components/ui/DataList.cjs.map +1 -1
  26. package/dist/components/ui/DataList.js +4 -3
  27. package/dist/components/ui/DataList.js.map +1 -1
  28. package/dist/components/ui/DataTable.cjs +1 -1
  29. package/dist/components/ui/DataTable.cjs.map +1 -1
  30. package/dist/components/ui/DataTable.d.ts +2 -1
  31. package/dist/components/ui/DataTable.js +125 -108
  32. package/dist/components/ui/DataTable.js.map +1 -1
  33. package/dist/components/ui/DiffViewer.cjs +1 -1
  34. package/dist/components/ui/DiffViewer.cjs.map +1 -1
  35. package/dist/components/ui/DiffViewer.js +29 -25
  36. package/dist/components/ui/DiffViewer.js.map +1 -1
  37. package/dist/components/ui/DropdownMenu.cjs.map +1 -1
  38. package/dist/components/ui/DropdownMenu.d.ts +1 -0
  39. package/dist/components/ui/DropdownMenu.js.map +1 -1
  40. package/dist/components/ui/FileDropzone.cjs +1 -1
  41. package/dist/components/ui/FileDropzone.cjs.map +1 -1
  42. package/dist/components/ui/FileDropzone.js +12 -12
  43. package/dist/components/ui/FileDropzone.js.map +1 -1
  44. package/dist/components/ui/FilePreview.cjs +1 -1
  45. package/dist/components/ui/FilePreview.cjs.map +1 -1
  46. package/dist/components/ui/FilePreview.js +16 -13
  47. package/dist/components/ui/FilePreview.js.map +1 -1
  48. package/dist/components/ui/ParetoChart.cjs +1 -1
  49. package/dist/components/ui/ParetoChart.cjs.map +1 -1
  50. package/dist/components/ui/ParetoChart.js +247 -212
  51. package/dist/components/ui/ParetoChart.js.map +1 -1
  52. package/dist/components/ui/QueryAutocomplete.cjs +1 -1
  53. package/dist/components/ui/QueryAutocomplete.cjs.map +1 -1
  54. package/dist/components/ui/QueryAutocomplete.d.ts +4 -1
  55. package/dist/components/ui/QueryAutocomplete.js +136 -123
  56. package/dist/components/ui/QueryAutocomplete.js.map +1 -1
  57. package/dist/components/ui/RankBar.cjs +1 -1
  58. package/dist/components/ui/RankBar.cjs.map +1 -1
  59. package/dist/components/ui/RankBar.js +9 -9
  60. package/dist/components/ui/RankBar.js.map +1 -1
  61. package/dist/components/ui/ReplayStepStrip.cjs +1 -1
  62. package/dist/components/ui/ReplayStepStrip.cjs.map +1 -1
  63. package/dist/components/ui/ReplayStepStrip.d.ts +6 -3
  64. package/dist/components/ui/ReplayStepStrip.js +71 -61
  65. package/dist/components/ui/ReplayStepStrip.js.map +1 -1
  66. package/dist/components/ui/ServiceMap.cjs +1 -1
  67. package/dist/components/ui/ServiceMap.cjs.map +1 -1
  68. package/dist/components/ui/ServiceMap.d.ts +9 -1
  69. package/dist/components/ui/ServiceMap.js +335 -268
  70. package/dist/components/ui/ServiceMap.js.map +1 -1
  71. package/dist/components/ui/SparkLine.cjs +1 -1
  72. package/dist/components/ui/SparkLine.cjs.map +1 -1
  73. package/dist/components/ui/SparkLine.d.ts +5 -2
  74. package/dist/components/ui/SparkLine.js +33 -29
  75. package/dist/components/ui/SparkLine.js.map +1 -1
  76. package/dist/components/ui/TableOfContents.cjs +1 -1
  77. package/dist/components/ui/TableOfContents.cjs.map +1 -1
  78. package/dist/components/ui/TableOfContents.js +16 -19
  79. package/dist/components/ui/TableOfContents.js.map +1 -1
  80. package/dist/components/ui/Tabs.cjs +2 -2
  81. package/dist/components/ui/Tabs.cjs.map +1 -1
  82. package/dist/components/ui/Tabs.js +107 -87
  83. package/dist/components/ui/Tabs.js.map +1 -1
  84. package/dist/components/ui/TimeRangePicker.cjs +1 -1
  85. package/dist/components/ui/TimeRangePicker.cjs.map +1 -1
  86. package/dist/components/ui/TimeRangePicker.d.ts +12 -1
  87. package/dist/components/ui/TimeRangePicker.js +69 -63
  88. package/dist/components/ui/TimeRangePicker.js.map +1 -1
  89. package/dist/components/ui/Timeline.cjs.map +1 -1
  90. package/dist/components/ui/Timeline.d.ts +4 -4
  91. package/dist/components/ui/Timeline.js.map +1 -1
  92. package/dist/components/ui/TimelineChart.cjs +2 -2
  93. package/dist/components/ui/TimelineChart.cjs.map +1 -1
  94. package/dist/components/ui/TimelineChart.d.ts +1 -0
  95. package/dist/components/ui/TimelineChart.js +131 -137
  96. package/dist/components/ui/TimelineChart.js.map +1 -1
  97. package/dist/components/ui/TraceTree.cjs +1 -1
  98. package/dist/components/ui/TraceTree.cjs.map +1 -1
  99. package/dist/components/ui/TraceTree.d.ts +4 -0
  100. package/dist/components/ui/TraceTree.js +88 -87
  101. package/dist/components/ui/TraceTree.js.map +1 -1
  102. package/dist/components/ui/TrajectoryStep.cjs +2 -1
  103. package/dist/components/ui/TrajectoryStep.cjs.map +1 -1
  104. package/dist/components/ui/TrajectoryStep.js +64 -43
  105. package/dist/components/ui/TrajectoryStep.js.map +1 -1
  106. package/dist/components/ui/useColumnWidths.cjs +1 -1
  107. package/dist/components/ui/useColumnWidths.cjs.map +1 -1
  108. package/dist/components/ui/useColumnWidths.d.ts +6 -1
  109. package/dist/components/ui/useColumnWidths.js +139 -123
  110. package/dist/components/ui/useColumnWidths.js.map +1 -1
  111. package/dist/layouts/shell/AegisShell.cjs +1 -1
  112. package/dist/layouts/shell/AegisShell.cjs.map +1 -1
  113. package/dist/layouts/shell/AegisShell.js +33 -34
  114. package/dist/layouts/shell/AegisShell.js.map +1 -1
  115. package/dist/lib/breakAtSeparators.cjs +2 -0
  116. package/dist/lib/breakAtSeparators.cjs.map +1 -0
  117. package/dist/lib/breakAtSeparators.d.ts +6 -0
  118. package/dist/lib/breakAtSeparators.js +10 -0
  119. package/dist/lib/breakAtSeparators.js.map +1 -0
  120. package/dist/locale/strings.cjs +1 -1
  121. package/dist/locale/strings.cjs.map +1 -1
  122. package/dist/locale/strings.d.ts +6 -0
  123. package/dist/locale/strings.js +27 -19
  124. package/dist/locale/strings.js.map +1 -1
  125. package/dist/style.css +1 -1
  126. package/dist/theme/antdTheme.cjs +1 -1
  127. package/dist/theme/antdTheme.cjs.map +1 -1
  128. package/dist/theme/antdTheme.js +50 -29
  129. package/dist/theme/antdTheme.js.map +1 -1
  130. package/dist/transports/agentm/AgentmChannelProvider.cjs +1 -1
  131. package/dist/transports/agentm/AgentmChannelProvider.cjs.map +1 -1
  132. package/dist/transports/agentm/AgentmChannelProvider.js +66 -61
  133. package/dist/transports/agentm/AgentmChannelProvider.js.map +1 -1
  134. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("antd"),l=e=>({...n.theme.darkAlgorithm(e),colorPrimary:e.colorPrimary,colorInfo:e.colorInfo,colorLink:e.colorLink,colorSuccess:e.colorSuccess,colorWarning:e.colorWarning,colorError:e.colorError}),i="'Hanken Grotesk Variable', 'Hanken Grotesk', 'PingFang SC', 'Noto Sans SC Variable', 'Noto Sans SC', 'Microsoft YaHei', sans-serif",c="'Google Sans Code', 'PingFang SC', monospace",o={xs:4,sm:6,md:10,lg:20,pill:999},r="cubic-bezier(0.22, 1, 0.36, 1)",g="cubic-bezier(0.4, 0, 1, 1)",b={bgPage:"#f7f8fa",bgPanel:"#ffffff",bgMuted:"#f1f3f5",bgInverted:"#1f2328",bgBrandSoft:"#eef1fe",bgBackdrop:"rgba(31, 35, 40, 0.28)",textMain:"#1f2328",textMuted:"#5f6368",textFaint:"#9aa0a6",textOnInverted:"#ffffff",borderHairline:"rgba(31, 35, 40, 0.08)",borderEmphasis:"rgba(31, 35, 40, 0.16)",accentBrand:"#3c56f4",accentInfo:"#3c56f4",accentSuccess:"#167a62",accentWarning:"#e11d48",inkWarn:"#d97706",shadowRest:"0 1px 2px rgba(31, 35, 40, 0.04), 0 6px 20px -6px rgba(31, 35, 40, 0.08)",shadowOverlay:"0 8px 24px -6px rgba(31, 35, 40, 0.12), 0 28px 64px -16px rgba(31, 35, 40, 0.2)"},s={bgPage:"#0b0d12",bgPanel:"#15181e",bgMuted:"#1e222a",bgInverted:"#eef0f3",bgBrandSoft:"#1a2140",bgBackdrop:"rgba(0, 0, 0, 0.55)",textMain:"#eef0f3",textMuted:"#9aa0a6",textFaint:"#6b7280",textOnInverted:"#0b0d12",borderHairline:"rgba(255, 255, 255, 0.08)",borderEmphasis:"rgba(255, 255, 255, 0.18)",accentBrand:"#8ea0ff",accentInfo:"#8ea0ff",accentSuccess:"#4ade80",accentWarning:"#fb7185",inkWarn:"#fbbf24",shadowRest:"0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px -6px rgba(0, 0, 0, 0.4)",shadowOverlay:"0 8px 24px -6px rgba(0, 0, 0, 0.45), 0 28px 64px -16px rgba(0, 0, 0, 0.6)"};function a(e,d){const t={hoverBorderColor:e.borderEmphasis,activeBorderColor:e.accentBrand};return{cssVar:!0,hashed:!1,algorithm:d==="dark"?l:n.theme.defaultAlgorithm,token:{colorPrimary:e.bgInverted,colorInfo:e.accentInfo,colorLink:e.accentInfo,colorSuccess:e.accentSuccess,colorWarning:e.inkWarn,colorError:e.accentWarning,colorBgLayout:e.bgPage,colorBgContainer:e.bgPanel,colorBgElevated:e.bgPanel,colorBgSpotlight:e.bgInverted,colorBgMask:e.bgBackdrop,colorText:e.textMain,colorTextSecondary:e.textMuted,colorTextTertiary:e.textMuted,colorTextQuaternary:e.textFaint,colorTextPlaceholder:e.textMuted,colorTextLightSolid:e.textOnInverted,colorBorder:e.borderHairline,colorBorderSecondary:e.borderHairline,colorSplit:e.borderHairline,controlOutline:e.bgBrandSoft,controlOutlineWidth:3,lineWidthFocus:2,borderRadius:o.md,borderRadiusLG:o.lg,borderRadiusSM:o.sm,borderRadiusXS:o.xs,fontFamily:i,fontFamilyCode:c,fontSize:13,fontSizeLG:14,fontSizeSM:12,lineHeight:22/13,controlHeight:32,controlHeightSM:24,boxShadow:e.shadowOverlay,boxShadowSecondary:e.shadowOverlay,boxShadowTertiary:e.shadowRest,motionDurationMid:"0.2s",motionDurationFast:"0.15s",motionDurationSlow:"0.25s",motionEaseOut:r,motionEaseOutCirc:r,motionEaseOutQuint:r,motionEaseOutBack:r,motionEaseInOut:r,motionEaseInOutCirc:r,motionEaseInBack:r,motionEaseInQuint:g},components:{Tree:{nodeHoverBg:e.bgMuted,controlItemBgHover:e.bgMuted,nodeSelectedBg:e.bgInverted,nodeSelectedColor:e.textOnInverted,directoryNodeSelectedBg:e.bgInverted,directoryNodeSelectedColor:e.textOnInverted},Button:{borderRadius:o.pill,borderRadiusLG:o.pill,borderRadiusSM:o.pill,controlHeight:32,paddingInline:16,fontWeight:500,primaryColor:e.textOnInverted,defaultBg:e.bgPanel,defaultColor:e.textMain,defaultBorderColor:e.borderHairline,defaultHoverBg:e.bgPanel,defaultHoverColor:e.textMain,defaultHoverBorderColor:e.borderEmphasis,defaultActiveBg:e.bgPanel,defaultActiveColor:e.textMain,defaultActiveBorderColor:e.borderEmphasis,primaryShadow:"none",defaultShadow:e.shadowRest,dangerShadow:"none",textHoverBg:e.bgMuted},Card:{borderRadiusLG:o.lg,headerBg:"transparent",headerFontSize:16,headerHeight:52,paddingLG:20,colorBgContainer:e.bgPanel},Table:{headerBg:e.bgMuted,headerSplitColor:"transparent",headerColor:e.textMuted,borderColor:e.borderHairline,cellPaddingBlock:8,colorBgContainer:e.bgPanel},Input:t,InputNumber:t,Select:t,DatePicker:t,Checkbox:{borderRadiusSM:o.xs,colorBorder:e.borderEmphasis,colorWhite:e.textOnInverted},Tag:{borderRadiusSM:o.pill},Modal:{borderRadiusLG:o.lg,contentBg:e.bgPanel,headerBg:e.bgPanel,footerBg:e.bgPanel},Drawer:{colorBgElevated:e.bgPanel},Menu:{itemBg:"transparent",itemSelectedBg:e.bgInverted,itemSelectedColor:e.textOnInverted,itemHoverBg:e.bgMuted,itemBorderRadius:o.md},Tabs:{inkBarColor:e.textMain,itemSelectedColor:e.textMain,itemHoverColor:e.textMain},Switch:{colorPrimary:e.bgInverted,colorPrimaryHover:e.bgInverted},Tooltip:{colorBgSpotlight:e.bgInverted,colorTextLightSolid:e.textOnInverted},Progress:{defaultColor:e.textMain,remainingColor:e.bgMuted},Dropdown:{colorBgElevated:e.bgPanel},Popover:{colorBgElevated:e.bgPanel},Notification:{colorBgElevated:e.bgPanel},Message:{colorBgElevated:e.bgPanel}}}}const u={light:a(b,"light"),dark:a(s,"dark")};function f(e){return u[e]}exports.getAegisTheme=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("antd"),d=e=>({...n.theme.darkAlgorithm(e),colorPrimary:e.colorPrimary,colorInfo:e.colorInfo,colorLink:e.colorLink,colorSuccess:e.colorSuccess,colorWarning:e.colorWarning,colorError:e.colorError}),i="'Hanken Grotesk Variable', 'Hanken Grotesk', 'PingFang SC', 'Noto Sans SC Variable', 'Noto Sans SC', 'Microsoft YaHei', sans-serif",c="'Google Sans Code', 'PingFang SC', monospace",r={xs:4,sm:6,md:10,lg:20,pill:999},o="cubic-bezier(0.22, 1, 0.36, 1)",g="cubic-bezier(0.4, 0, 1, 1)",b={bgPage:"#f7f8fa",bgPanel:"#ffffff",bgMuted:"#f1f3f5",bgInverted:"#1f2328",bgBrandSoft:"#eef1fe",bgBackdrop:"rgba(31, 35, 40, 0.28)",textMain:"#1f2328",textMuted:"#5f6368",textFaint:"#9aa0a6",textOnInverted:"#ffffff",borderHairline:"rgba(31, 35, 40, 0.08)",borderEmphasis:"rgba(31, 35, 40, 0.16)",accentBrand:"#3c56f4",accentInfo:"#3c56f4",accentSuccess:"#167a62",accentWarning:"#e11d48",inkWarn:"#d97706",textWarn:"#b45309",bgWarnSoft:"#fffbeb",shadowRest:"0 1px 2px rgba(31, 35, 40, 0.04), 0 6px 20px -6px rgba(31, 35, 40, 0.08)",shadowOverlay:"0 8px 24px -6px rgba(31, 35, 40, 0.12), 0 28px 64px -16px rgba(31, 35, 40, 0.2)"},s={bgPage:"#0b0d12",bgPanel:"#15181e",bgMuted:"#1e222a",bgInverted:"#eef0f3",bgBrandSoft:"#1a2140",bgBackdrop:"rgba(0, 0, 0, 0.55)",textMain:"#eef0f3",textMuted:"#9aa0a6",textFaint:"#6b7280",textOnInverted:"#0b0d12",borderHairline:"rgba(255, 255, 255, 0.08)",borderEmphasis:"rgba(255, 255, 255, 0.18)",accentBrand:"#8ea0ff",accentInfo:"#8ea0ff",accentSuccess:"#4ade80",accentWarning:"#fb7185",inkWarn:"#fbbf24",textWarn:"#fbbf24",bgWarnSoft:"#2a200a",shadowRest:"0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px -6px rgba(0, 0, 0, 0.4)",shadowOverlay:"0 8px 24px -6px rgba(0, 0, 0, 0.45), 0 28px 64px -16px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.18)"};function a(e,l){const t={hoverBorderColor:e.borderEmphasis,activeBorderColor:e.accentBrand};return{cssVar:!0,hashed:!1,algorithm:l==="dark"?d:n.theme.defaultAlgorithm,token:{colorPrimary:e.bgInverted,colorInfo:e.accentInfo,colorLink:e.accentInfo,colorSuccess:e.accentSuccess,colorWarning:e.inkWarn,colorError:e.accentWarning,colorBgLayout:e.bgPage,colorBgContainer:e.bgPanel,colorBgElevated:e.bgPanel,colorBgSpotlight:e.bgInverted,colorBgMask:e.bgBackdrop,colorText:e.textMain,colorTextSecondary:e.textMuted,colorTextTertiary:e.textMuted,colorTextQuaternary:e.textFaint,colorTextPlaceholder:e.textMuted,colorTextLightSolid:e.textOnInverted,colorBorder:e.borderHairline,colorBorderSecondary:e.borderHairline,colorSplit:e.borderHairline,controlOutline:e.bgBrandSoft,controlOutlineWidth:3,lineWidthFocus:2,borderRadius:r.md,borderRadiusLG:r.lg,borderRadiusSM:r.sm,borderRadiusXS:r.xs,fontFamily:i,fontFamilyCode:c,fontSize:13,fontSizeLG:14,fontSizeSM:12,lineHeight:22/13,controlHeight:32,controlHeightSM:24,boxShadow:e.shadowOverlay,boxShadowSecondary:e.shadowOverlay,boxShadowTertiary:e.shadowRest,motionDurationMid:"0.2s",motionDurationFast:"0.15s",motionDurationSlow:"0.25s",motionEaseOut:o,motionEaseOutCirc:o,motionEaseOutQuint:o,motionEaseOutBack:o,motionEaseInOut:o,motionEaseInOutCirc:o,motionEaseInBack:o,motionEaseInQuint:g},components:{Tree:{nodeHoverBg:e.bgMuted,controlItemBgHover:e.bgMuted,nodeSelectedBg:e.bgInverted,nodeSelectedColor:e.textOnInverted,directoryNodeSelectedBg:e.bgInverted,directoryNodeSelectedColor:e.textOnInverted,borderRadiusSM:r.xs,colorBorder:e.borderEmphasis,colorWhite:e.textOnInverted},Button:{borderRadius:r.pill,borderRadiusLG:r.pill,borderRadiusSM:r.pill,controlHeight:32,paddingInline:16,fontWeight:500,primaryColor:e.textOnInverted,defaultBg:e.bgPanel,defaultColor:e.textMain,defaultBorderColor:e.borderHairline,defaultHoverBg:e.bgPanel,defaultHoverColor:e.textMain,defaultHoverBorderColor:e.borderEmphasis,defaultActiveBg:e.bgPanel,defaultActiveColor:e.textMain,defaultActiveBorderColor:e.borderEmphasis,primaryShadow:"none",defaultShadow:e.shadowRest,dangerShadow:"none",textHoverBg:e.bgMuted,colorError:e.textWarn,colorErrorHover:e.textWarn,colorErrorActive:e.textWarn,colorErrorBorderHover:e.inkWarn,colorErrorBg:e.bgWarnSoft,colorErrorBgFilledHover:e.bgWarnSoft,colorErrorBgActive:e.bgWarnSoft,dangerColor:e.textOnInverted},Card:{borderRadiusLG:r.lg,headerBg:"transparent",headerFontSize:16,headerHeight:52,paddingLG:20,colorBgContainer:e.bgPanel},Table:{headerBg:e.bgMuted,headerSplitColor:"transparent",headerColor:e.textMuted,borderColor:e.borderHairline,cellPaddingBlock:8,colorBgContainer:e.bgPanel},Input:t,InputNumber:t,Select:t,DatePicker:t,Checkbox:{borderRadiusSM:r.xs,colorBorder:e.borderEmphasis,colorWhite:e.textOnInverted},Tag:{borderRadiusSM:r.pill},Modal:{borderRadiusLG:r.lg,contentBg:e.bgPanel,headerBg:e.bgPanel,footerBg:e.bgPanel},Drawer:{colorBgElevated:e.bgPanel},Menu:{itemBg:"transparent",itemSelectedBg:e.bgInverted,itemSelectedColor:e.textOnInverted,itemHoverBg:e.bgMuted,itemBorderRadius:r.md},Tabs:{inkBarColor:e.textMain,itemSelectedColor:e.textMain,itemHoverColor:e.textMain},Switch:{colorPrimary:e.bgInverted,colorPrimaryHover:e.bgInverted},Tooltip:{colorBgSpotlight:e.bgInverted,colorTextLightSolid:e.textOnInverted},Progress:{defaultColor:e.textMain,remainingColor:e.bgMuted},Dropdown:{colorBgElevated:e.bgPanel},Popover:{colorBgElevated:e.bgPanel},Notification:{colorBgElevated:e.bgPanel},Message:{colorBgElevated:e.bgPanel}}}}const f={light:a(b,"light"),dark:a(s,"dark")};function u(e){return f[e]}exports.getAegisTheme=u;
2
2
  //# sourceMappingURL=antdTheme.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"antdTheme.cjs","sources":["../../src/theme/antdTheme.ts"],"sourcesContent":["/**\n * Ant Design 5 ConfigProvider theme mapped onto the aegis tokens in\n * `styles/theme.css`.\n *\n * Two palettes are exposed (`light` / `dark`) so that consumers can mirror\n * the `data-theme` attribute set by `ThemeProvider`. Values are duplicated\n * here (not `var(...)`) because AntD theme tokens are computed in JS — they\n * cannot resolve CSS custom properties.\n *\n * Usage:\n * const { resolved } = useTheme();\n * <ConfigProvider theme={getAegisTheme(resolved)}>…</ConfigProvider>\n */\nimport {\n type MappingAlgorithm,\n type ThemeConfig,\n theme as antdTokens,\n} from 'antd';\n\nimport type { ThemeMode } from './themeContext';\n\n// antd's dark algorithm re-derives the seed colours toward the background\n// (and seed tokens cannot be overridden afterwards); pin them back to the\n// token values so antd controls match the primitives.\nconst darkWithTokenSeeds: MappingAlgorithm = (seed) => ({\n ...antdTokens.darkAlgorithm(seed),\n colorPrimary: seed.colorPrimary,\n colorInfo: seed.colorInfo,\n colorLink: seed.colorLink,\n colorSuccess: seed.colorSuccess,\n colorWarning: seed.colorWarning,\n colorError: seed.colorError,\n});\n\nconst FONT_UI =\n \"'Hanken Grotesk Variable', 'Hanken Grotesk', 'PingFang SC', \" +\n \"'Noto Sans SC Variable', 'Noto Sans SC', 'Microsoft YaHei', sans-serif\";\n\nconst FONT_MONO = \"'Google Sans Code', 'PingFang SC', monospace\";\n\nconst RADIUS = {\n xs: 4,\n sm: 6,\n md: 10,\n lg: 20,\n pill: 999,\n};\n\n/* theme.css's decelerating and exit curves. antd's back and in-out easings\n * would overshoot or ease both ways. antd also uses its in-out-circ and\n * in-back easings for entrances and state changes (radio, progress,\n * message, checkbox), so only in-quint, which it uses for leaving alone,\n * takes the exit curve. */\nconst EASE_SETTLE = 'cubic-bezier(0.22, 1, 0.36, 1)';\nconst EASE_EXIT = 'cubic-bezier(0.4, 0, 1, 1)';\n\ninterface Palette {\n bgPage: string;\n bgPanel: string;\n bgMuted: string;\n bgInverted: string;\n bgBrandSoft: string;\n bgBackdrop: string;\n textMain: string;\n textMuted: string;\n textFaint: string;\n textOnInverted: string;\n borderHairline: string;\n borderEmphasis: string;\n accentBrand: string;\n accentInfo: string;\n accentSuccess: string;\n accentWarning: string;\n inkWarn: string;\n shadowRest: string;\n shadowOverlay: string;\n}\n\nconst LIGHT: Palette = {\n bgPage: '#f7f8fa',\n bgPanel: '#ffffff',\n bgMuted: '#f1f3f5',\n bgInverted: '#1f2328',\n bgBrandSoft: '#eef1fe',\n bgBackdrop: 'rgba(31, 35, 40, 0.28)',\n textMain: '#1f2328',\n textMuted: '#5f6368',\n textFaint: '#9aa0a6',\n textOnInverted: '#ffffff',\n borderHairline: 'rgba(31, 35, 40, 0.08)',\n borderEmphasis: 'rgba(31, 35, 40, 0.16)',\n accentBrand: '#3c56f4',\n accentInfo: '#3c56f4',\n accentSuccess: '#167a62',\n accentWarning: '#e11d48',\n inkWarn: '#d97706',\n shadowRest:\n '0 1px 2px rgba(31, 35, 40, 0.04), 0 6px 20px -6px rgba(31, 35, 40, 0.08)',\n shadowOverlay:\n '0 8px 24px -6px rgba(31, 35, 40, 0.12), ' +\n '0 28px 64px -16px rgba(31, 35, 40, 0.2)',\n};\n\nconst DARK: Palette = {\n bgPage: '#0b0d12',\n bgPanel: '#15181e',\n bgMuted: '#1e222a',\n bgInverted: '#eef0f3',\n bgBrandSoft: '#1a2140',\n bgBackdrop: 'rgba(0, 0, 0, 0.55)',\n textMain: '#eef0f3',\n textMuted: '#9aa0a6',\n textFaint: '#6b7280',\n textOnInverted: '#0b0d12',\n borderHairline: 'rgba(255, 255, 255, 0.08)',\n borderEmphasis: 'rgba(255, 255, 255, 0.18)',\n accentBrand: '#8ea0ff',\n accentInfo: '#8ea0ff',\n accentSuccess: '#4ade80',\n accentWarning: '#fb7185',\n inkWarn: '#fbbf24',\n shadowRest:\n '0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px -6px rgba(0, 0, 0, 0.4)',\n shadowOverlay:\n '0 8px 24px -6px rgba(0, 0, 0, 0.45), 0 28px 64px -16px rgba(0, 0, 0, 0.6)',\n};\n\nfunction buildTheme(p: Palette, scheme: ThemeMode): ThemeConfig {\n // Text fields, selects and pickers: hairline at rest, emphasis on hover,\n // a brand border plus the brand-soft halo (controlOutline) on focus.\n const field = {\n hoverBorderColor: p.borderEmphasis,\n activeBorderColor: p.accentBrand,\n };\n return {\n cssVar: true,\n hashed: false,\n algorithm:\n scheme === 'dark' ? darkWithTokenSeeds : antdTokens.defaultAlgorithm,\n token: {\n // Activation is surface inversion, so antd's \"primary\" is the ink.\n colorPrimary: p.bgInverted,\n colorInfo: p.accentInfo,\n colorLink: p.accentInfo,\n colorSuccess: p.accentSuccess,\n colorWarning: p.inkWarn,\n colorError: p.accentWarning,\n\n colorBgLayout: p.bgPage,\n colorBgContainer: p.bgPanel,\n colorBgElevated: p.bgPanel,\n colorBgSpotlight: p.bgInverted,\n colorBgMask: p.bgBackdrop,\n\n colorText: p.textMain,\n colorTextSecondary: p.textMuted,\n colorTextTertiary: p.textMuted,\n colorTextQuaternary: p.textFaint,\n colorTextPlaceholder: p.textMuted,\n colorTextLightSolid: p.textOnInverted,\n\n colorBorder: p.borderHairline,\n colorBorderSecondary: p.borderHairline,\n colorSplit: p.borderHairline,\n\n controlOutline: p.bgBrandSoft,\n controlOutlineWidth: 3,\n lineWidthFocus: 2,\n\n borderRadius: RADIUS.md,\n borderRadiusLG: RADIUS.lg,\n borderRadiusSM: RADIUS.sm,\n borderRadiusXS: RADIUS.xs,\n\n fontFamily: FONT_UI,\n fontFamilyCode: FONT_MONO,\n fontSize: 13,\n fontSizeLG: 14,\n fontSizeSM: 12,\n\n lineHeight: 22 / 13,\n\n controlHeight: 32,\n controlHeightSM: 24,\n\n boxShadow: p.shadowOverlay,\n boxShadowSecondary: p.shadowOverlay,\n boxShadowTertiary: p.shadowRest,\n\n motionDurationMid: '0.2s',\n motionDurationFast: '0.15s',\n motionDurationSlow: '0.25s',\n motionEaseOut: EASE_SETTLE,\n motionEaseOutCirc: EASE_SETTLE,\n motionEaseOutQuint: EASE_SETTLE,\n motionEaseOutBack: EASE_SETTLE,\n motionEaseInOut: EASE_SETTLE,\n motionEaseInOutCirc: EASE_SETTLE,\n motionEaseInBack: EASE_SETTLE,\n motionEaseInQuint: EASE_EXIT,\n },\n components: {\n Tree: {\n nodeHoverBg: p.bgMuted,\n // The keyboard-active node's fill; index.css adds the focus ring.\n controlItemBgHover: p.bgMuted,\n nodeSelectedBg: p.bgInverted,\n nodeSelectedColor: p.textOnInverted,\n directoryNodeSelectedBg: p.bgInverted,\n directoryNodeSelectedColor: p.textOnInverted,\n },\n Button: {\n borderRadius: RADIUS.pill,\n borderRadiusLG: RADIUS.pill,\n borderRadiusSM: RADIUS.pill,\n controlHeight: 32,\n paddingInline: 16,\n fontWeight: 500,\n primaryColor: p.textOnInverted,\n defaultBg: p.bgPanel,\n defaultColor: p.textMain,\n defaultBorderColor: p.borderHairline,\n defaultHoverBg: p.bgPanel,\n defaultHoverColor: p.textMain,\n defaultHoverBorderColor: p.borderEmphasis,\n defaultActiveBg: p.bgPanel,\n defaultActiveColor: p.textMain,\n defaultActiveBorderColor: p.borderEmphasis,\n primaryShadow: 'none',\n defaultShadow: p.shadowRest,\n dangerShadow: 'none',\n textHoverBg: p.bgMuted,\n },\n Card: {\n borderRadiusLG: RADIUS.lg,\n headerBg: 'transparent',\n headerFontSize: 16,\n headerHeight: 52,\n paddingLG: 20,\n colorBgContainer: p.bgPanel,\n },\n Table: {\n headerBg: p.bgMuted,\n headerSplitColor: 'transparent',\n headerColor: p.textMuted,\n borderColor: p.borderHairline,\n cellPaddingBlock: 8,\n colorBgContainer: p.bgPanel,\n },\n Input: field,\n InputNumber: field,\n Select: field,\n DatePicker: field,\n Checkbox: {\n borderRadiusSM: RADIUS.xs,\n colorBorder: p.borderEmphasis,\n // The tick is drawn in colorWhite; on the dark scheme's light ink it\n // must be the inverted text colour to stay visible.\n colorWhite: p.textOnInverted,\n },\n Tag: {\n borderRadiusSM: RADIUS.pill,\n },\n Modal: {\n borderRadiusLG: RADIUS.lg,\n contentBg: p.bgPanel,\n headerBg: p.bgPanel,\n footerBg: p.bgPanel,\n },\n Drawer: {\n colorBgElevated: p.bgPanel,\n },\n Menu: {\n itemBg: 'transparent',\n itemSelectedBg: p.bgInverted,\n itemSelectedColor: p.textOnInverted,\n itemHoverBg: p.bgMuted,\n itemBorderRadius: RADIUS.md,\n },\n Tabs: {\n inkBarColor: p.textMain,\n itemSelectedColor: p.textMain,\n itemHoverColor: p.textMain,\n },\n Switch: {\n colorPrimary: p.bgInverted,\n colorPrimaryHover: p.bgInverted,\n },\n Tooltip: {\n colorBgSpotlight: p.bgInverted,\n colorTextLightSolid: p.textOnInverted,\n },\n Progress: {\n defaultColor: p.textMain,\n remainingColor: p.bgMuted,\n },\n Dropdown: {\n colorBgElevated: p.bgPanel,\n },\n Popover: {\n colorBgElevated: p.bgPanel,\n },\n Notification: {\n colorBgElevated: p.bgPanel,\n },\n Message: {\n colorBgElevated: p.bgPanel,\n },\n },\n };\n}\n\n// Built once so callers that pass getAegisTheme(resolved) every render hand\n// antd a stable object.\nconst THEMES: Record<ThemeMode, ThemeConfig> = {\n light: buildTheme(LIGHT, 'light'),\n dark: buildTheme(DARK, 'dark'),\n};\n\n/**\n * Returns the antd ThemeConfig for the given scheme. Pair with `useTheme().resolved`.\n */\nexport function getAegisTheme(scheme: ThemeMode): ThemeConfig {\n return THEMES[scheme];\n}\n"],"names":["darkWithTokenSeeds","seed","antdTokens","FONT_UI","FONT_MONO","RADIUS","EASE_SETTLE","EASE_EXIT","LIGHT","DARK","buildTheme","p","scheme","field","THEMES","getAegisTheme"],"mappings":"wGAwBMA,EAAwCC,IAAU,CACtD,GAAGC,EAAAA,MAAW,cAAcD,CAAI,EAChC,aAAcA,EA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ACL,SAAUA,EAAE,QACZ,iBAAkB,cAClB,YAAaA,EAAE,UACf,YAAaA,EAAE,eACf,iBAAkB,EAClB,iBAAkBA,EAAE,OAAA,EAEtB,MAAOE,EACP,YAAaA,EACb,OAAQA,EACR,WAAYA,EACZ,SAAU,CACR,eAAgBR,EAAO,GACvB,YAAaM,EAAE,eAGf,WAAYA,EAAE,cAAA,EAEhB,IAAK,CACH,eAAgBN,EAAO,IAAA,EAEzB,MAAO,CACL,eAAgBA,EAAO,GACvB,UAAWM,EAAE,QACb,SAAUA,EAAE,QACZ,SAAUA,EAAE,OAAA,EAEd,OAAQ,CACN,gBAAiBA,EAAE,OAAA,EAErB,KAAM,CACJ,OAAQ,cACR,eAAgBA,EAAE,WAClB,kBAAmBA,EAAE,eACrB,YAAaA,EAAE,QACf,iBAAkBN,EAAO,EAAA,EAE3B,KAAM,CACJ,YAAaM,EAAE,SACf,kBAAmBA,EAAE,SACrB,eAAgBA,EAAE,QAAA,EAEpB,OAAQ,CACN,aAAcA,EAAE,WAChB,kBAAmBA,EAAE,UAAA,EAEvB,QAAS,CACP,iBAAkBA,EAAE,WACpB,oBAAqBA,EAAE,cAAA,EAEzB,SAAU,CACR,aAAcA,EAAE,SAChB,eAAgBA,EAAE,OAAA,EAEpB,SAAU,CACR,gBAAiBA,EAAE,OAAA,EAErB,QAAS,CACP,gBAAiBA,EAAE,OAAA,EAErB,aAAc,CACZ,gBAAiBA,EAAE,OAAA,EAErB,QAAS,CACP,gBAAiBA,EAAE,OAAA,CACrB,CACF,CAEJ,CAIA,MAAMG,EAAyC,CAC7C,MAAOJ,EAAWF,EAAO,OAAO,EAChC,KAAME,EAAWD,EAAM,MAAM,CAC/B,EAKO,SAASM,EAAcH,EAAgC,CAC5D,OAAOE,EAAOF,CAAM,CACtB"}
1
+ {"version":3,"file":"antdTheme.cjs","sources":["../../src/theme/antdTheme.ts"],"sourcesContent":["/**\n * Ant Design 5 ConfigProvider theme mapped onto the aegis tokens in\n * `styles/theme.css`.\n *\n * Two palettes are exposed (`light` / `dark`) so that consumers can mirror\n * the `data-theme` attribute set by `ThemeProvider`. Values are duplicated\n * here (not `var(...)`) because AntD theme tokens are computed in JS — they\n * cannot resolve CSS custom properties.\n *\n * Usage:\n * const { resolved } = useTheme();\n * <ConfigProvider theme={getAegisTheme(resolved)}>…</ConfigProvider>\n */\nimport {\n type MappingAlgorithm,\n type ThemeConfig,\n theme as antdTokens,\n} from 'antd';\n\nimport type { ThemeMode } from './themeContext';\n\n// antd's dark algorithm re-derives the seed colours toward the background\n// (and seed tokens cannot be overridden afterwards); pin them back to the\n// token values so antd controls match the primitives.\nconst darkWithTokenSeeds: MappingAlgorithm = (seed) => ({\n ...antdTokens.darkAlgorithm(seed),\n colorPrimary: seed.colorPrimary,\n colorInfo: seed.colorInfo,\n colorLink: seed.colorLink,\n colorSuccess: seed.colorSuccess,\n colorWarning: seed.colorWarning,\n colorError: seed.colorError,\n});\n\nconst FONT_UI =\n \"'Hanken Grotesk Variable', 'Hanken Grotesk', 'PingFang SC', \" +\n \"'Noto Sans SC Variable', 'Noto Sans SC', 'Microsoft YaHei', sans-serif\";\n\nconst FONT_MONO = \"'Google Sans Code', 'PingFang SC', monospace\";\n\nconst RADIUS = {\n xs: 4,\n sm: 6,\n md: 10,\n lg: 20,\n pill: 999,\n};\n\n/* theme.css's decelerating and exit curves. antd's back and in-out easings\n * would overshoot or ease both ways. antd also uses its in-out-circ and\n * in-back easings for entrances and state changes (radio, progress,\n * message, checkbox), so only in-quint, which it uses for leaving alone,\n * takes the exit curve. */\nconst EASE_SETTLE = 'cubic-bezier(0.22, 1, 0.36, 1)';\nconst EASE_EXIT = 'cubic-bezier(0.4, 0, 1, 1)';\n\ninterface Palette {\n bgPage: string;\n bgPanel: string;\n bgMuted: string;\n bgInverted: string;\n bgBrandSoft: string;\n bgBackdrop: string;\n textMain: string;\n textMuted: string;\n textFaint: string;\n textOnInverted: string;\n borderHairline: string;\n borderEmphasis: string;\n accentBrand: string;\n accentInfo: string;\n accentSuccess: string;\n accentWarning: string;\n inkWarn: string;\n textWarn: string;\n bgWarnSoft: string;\n shadowRest: string;\n shadowOverlay: string;\n}\n\nconst LIGHT: Palette = {\n bgPage: '#f7f8fa',\n bgPanel: '#ffffff',\n bgMuted: '#f1f3f5',\n bgInverted: '#1f2328',\n bgBrandSoft: '#eef1fe',\n bgBackdrop: 'rgba(31, 35, 40, 0.28)',\n textMain: '#1f2328',\n textMuted: '#5f6368',\n textFaint: '#9aa0a6',\n textOnInverted: '#ffffff',\n borderHairline: 'rgba(31, 35, 40, 0.08)',\n borderEmphasis: 'rgba(31, 35, 40, 0.16)',\n accentBrand: '#3c56f4',\n accentInfo: '#3c56f4',\n accentSuccess: '#167a62',\n accentWarning: '#e11d48',\n inkWarn: '#d97706',\n textWarn: '#b45309',\n bgWarnSoft: '#fffbeb',\n shadowRest:\n '0 1px 2px rgba(31, 35, 40, 0.04), 0 6px 20px -6px rgba(31, 35, 40, 0.08)',\n shadowOverlay:\n '0 8px 24px -6px rgba(31, 35, 40, 0.12), ' +\n '0 28px 64px -16px rgba(31, 35, 40, 0.2)',\n};\n\nconst DARK: Palette = {\n bgPage: '#0b0d12',\n bgPanel: '#15181e',\n bgMuted: '#1e222a',\n bgInverted: '#eef0f3',\n bgBrandSoft: '#1a2140',\n bgBackdrop: 'rgba(0, 0, 0, 0.55)',\n textMain: '#eef0f3',\n textMuted: '#9aa0a6',\n textFaint: '#6b7280',\n textOnInverted: '#0b0d12',\n borderHairline: 'rgba(255, 255, 255, 0.08)',\n borderEmphasis: 'rgba(255, 255, 255, 0.18)',\n accentBrand: '#8ea0ff',\n accentInfo: '#8ea0ff',\n accentSuccess: '#4ade80',\n accentWarning: '#fb7185',\n inkWarn: '#fbbf24',\n textWarn: '#fbbf24',\n bgWarnSoft: '#2a200a',\n shadowRest:\n '0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px -6px rgba(0, 0, 0, 0.4)',\n shadowOverlay:\n '0 8px 24px -6px rgba(0, 0, 0, 0.45), 0 28px 64px -16px rgba(0, 0, 0, 0.6), ' +\n '0 0 0 1px rgba(255, 255, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.18)',\n};\n\nfunction buildTheme(p: Palette, scheme: ThemeMode): ThemeConfig {\n // Text fields, selects and pickers: hairline at rest, emphasis on hover,\n // a brand border plus the brand-soft halo (controlOutline) on focus.\n const field = {\n hoverBorderColor: p.borderEmphasis,\n activeBorderColor: p.accentBrand,\n };\n return {\n cssVar: true,\n hashed: false,\n algorithm:\n scheme === 'dark' ? darkWithTokenSeeds : antdTokens.defaultAlgorithm,\n token: {\n // Activation is surface inversion, so antd's \"primary\" is the ink.\n colorPrimary: p.bgInverted,\n colorInfo: p.accentInfo,\n colorLink: p.accentInfo,\n colorSuccess: p.accentSuccess,\n colorWarning: p.inkWarn,\n colorError: p.accentWarning,\n\n colorBgLayout: p.bgPage,\n colorBgContainer: p.bgPanel,\n colorBgElevated: p.bgPanel,\n colorBgSpotlight: p.bgInverted,\n colorBgMask: p.bgBackdrop,\n\n colorText: p.textMain,\n colorTextSecondary: p.textMuted,\n colorTextTertiary: p.textMuted,\n colorTextQuaternary: p.textFaint,\n colorTextPlaceholder: p.textMuted,\n colorTextLightSolid: p.textOnInverted,\n\n colorBorder: p.borderHairline,\n colorBorderSecondary: p.borderHairline,\n colorSplit: p.borderHairline,\n\n controlOutline: p.bgBrandSoft,\n controlOutlineWidth: 3,\n lineWidthFocus: 2,\n\n borderRadius: RADIUS.md,\n borderRadiusLG: RADIUS.lg,\n borderRadiusSM: RADIUS.sm,\n borderRadiusXS: RADIUS.xs,\n\n fontFamily: FONT_UI,\n fontFamilyCode: FONT_MONO,\n fontSize: 13,\n fontSizeLG: 14,\n fontSizeSM: 12,\n\n lineHeight: 22 / 13,\n\n controlHeight: 32,\n controlHeightSM: 24,\n\n boxShadow: p.shadowOverlay,\n boxShadowSecondary: p.shadowOverlay,\n boxShadowTertiary: p.shadowRest,\n\n motionDurationMid: '0.2s',\n motionDurationFast: '0.15s',\n motionDurationSlow: '0.25s',\n motionEaseOut: EASE_SETTLE,\n motionEaseOutCirc: EASE_SETTLE,\n motionEaseOutQuint: EASE_SETTLE,\n motionEaseOutBack: EASE_SETTLE,\n motionEaseInOut: EASE_SETTLE,\n motionEaseInOutCirc: EASE_SETTLE,\n motionEaseInBack: EASE_SETTLE,\n motionEaseInQuint: EASE_EXIT,\n },\n components: {\n Tree: {\n nodeHoverBg: p.bgMuted,\n // The keyboard-active node's fill; index.css adds the focus ring.\n controlItemBgHover: p.bgMuted,\n nodeSelectedBg: p.bgInverted,\n nodeSelectedColor: p.textOnInverted,\n directoryNodeSelectedBg: p.bgInverted,\n directoryNodeSelectedColor: p.textOnInverted,\n // The Tree draws its own checkboxes, so it takes the Checkbox\n // block's tokens: on the dark scheme's ink the tick must be the\n // inverted text colour. colorBorder also draws showLine's lines.\n borderRadiusSM: RADIUS.xs,\n colorBorder: p.borderEmphasis,\n colorWhite: p.textOnInverted,\n },\n Button: {\n borderRadius: RADIUS.pill,\n borderRadiusLG: RADIUS.pill,\n borderRadiusSM: RADIUS.pill,\n controlHeight: 32,\n paddingInline: 16,\n fontWeight: 500,\n primaryColor: p.textOnInverted,\n defaultBg: p.bgPanel,\n defaultColor: p.textMain,\n defaultBorderColor: p.borderHairline,\n defaultHoverBg: p.bgPanel,\n defaultHoverColor: p.textMain,\n defaultHoverBorderColor: p.borderEmphasis,\n defaultActiveBg: p.bgPanel,\n defaultActiveColor: p.textMain,\n defaultActiveBorderColor: p.borderEmphasis,\n primaryShadow: 'none',\n defaultShadow: p.shadowRest,\n dangerShadow: 'none',\n textHoverBg: p.bgMuted,\n // A danger button is a destructive action, a caution and not a\n // failure: it takes the caution ink and wash. The global colorError\n // stays the anomaly red, for form validation and other failures.\n colorError: p.textWarn,\n colorErrorHover: p.textWarn,\n colorErrorActive: p.textWarn,\n colorErrorBorderHover: p.inkWarn,\n colorErrorBg: p.bgWarnSoft,\n colorErrorBgFilledHover: p.bgWarnSoft,\n colorErrorBgActive: p.bgWarnSoft,\n dangerColor: p.textOnInverted,\n },\n Card: {\n borderRadiusLG: RADIUS.lg,\n headerBg: 'transparent',\n headerFontSize: 16,\n headerHeight: 52,\n paddingLG: 20,\n colorBgContainer: p.bgPanel,\n },\n Table: {\n headerBg: p.bgMuted,\n headerSplitColor: 'transparent',\n headerColor: p.textMuted,\n borderColor: p.borderHairline,\n cellPaddingBlock: 8,\n colorBgContainer: p.bgPanel,\n },\n Input: field,\n InputNumber: field,\n Select: field,\n DatePicker: field,\n Checkbox: {\n borderRadiusSM: RADIUS.xs,\n colorBorder: p.borderEmphasis,\n // The tick is drawn in colorWhite; on the dark scheme's light ink it\n // must be the inverted text colour to stay visible.\n colorWhite: p.textOnInverted,\n },\n Tag: {\n borderRadiusSM: RADIUS.pill,\n },\n Modal: {\n borderRadiusLG: RADIUS.lg,\n contentBg: p.bgPanel,\n headerBg: p.bgPanel,\n footerBg: p.bgPanel,\n },\n Drawer: {\n colorBgElevated: p.bgPanel,\n },\n Menu: {\n itemBg: 'transparent',\n itemSelectedBg: p.bgInverted,\n itemSelectedColor: p.textOnInverted,\n itemHoverBg: p.bgMuted,\n itemBorderRadius: RADIUS.md,\n },\n Tabs: {\n inkBarColor: p.textMain,\n itemSelectedColor: p.textMain,\n itemHoverColor: p.textMain,\n },\n Switch: {\n colorPrimary: p.bgInverted,\n colorPrimaryHover: p.bgInverted,\n },\n Tooltip: {\n colorBgSpotlight: p.bgInverted,\n colorTextLightSolid: p.textOnInverted,\n },\n Progress: {\n defaultColor: p.textMain,\n remainingColor: p.bgMuted,\n },\n Dropdown: {\n colorBgElevated: p.bgPanel,\n },\n Popover: {\n colorBgElevated: p.bgPanel,\n },\n Notification: {\n colorBgElevated: p.bgPanel,\n },\n Message: {\n colorBgElevated: p.bgPanel,\n },\n },\n };\n}\n\n// Built once so callers that pass getAegisTheme(resolved) every render hand\n// antd a stable object.\nconst THEMES: Record<ThemeMode, ThemeConfig> = {\n light: buildTheme(LIGHT, 'light'),\n dark: buildTheme(DARK, 'dark'),\n};\n\n/**\n * Returns the antd ThemeConfig for the given scheme. Pair with `useTheme().resolved`.\n */\nexport function getAegisTheme(scheme: ThemeMode): ThemeConfig {\n return THEMES[scheme];\n}\n"],"names":["darkWithTokenSeeds","seed","antdTokens","FONT_UI","FONT_MONO","RADIUS","EASE_SETTLE","EASE_EXIT","LIGHT","DARK","buildTheme","p","scheme","field","THEMES","getAegisTheme"],"mappings":"wGAwBMA,EAAwCC,IAAU,CACtD,GAAGC,EAAAA,MAAW,cAAcD,CAAI,EAChC,aAAcA,EAAK,aACnB,UAAWA,EAAK,UAChB,UAAWA,EAAK,UAChB,aAAcA,EAAK,aACnB,aAAcA,EAAK,aACnB,WAAYA,EAAK,UACnB,GAEME,EACJ,qIAGIC,EAAY,+CAEZC,EAAS,CACb,GAAI,EACJ,GAAI,EACJ,GAAI,GACJ,GAAI,GACJ,KAAM,GACR,EAOMC,EAAc,iCACdC,EAAY,6BA0BZC,EAAiB,CACrB,OAAQ,UACR,QAAS,UACT,QAAS,UACT,WAAY,UACZ,YAAa,UACb,WAAY,yBACZ,SAAU,UACV,UAAW,UACX,UAAW,UACX,eAAgB,UAChB,eAAgB,yBAChB,eAAgB,yBAChB,YAAa,UACb,WAAY,UACZ,cAAe,UACf,cAAe,UACf,QAAS,UACT,SAAU,UACV,WAAY,UACZ,WACE,2EACF,cACE,iFAEJ,EAEMC,EAAgB,CACpB,OAAQ,UACR,QAAS,UACT,QAAS,UACT,WAAY,UACZ,YAAa,UACb,WAAY,sBACZ,SAAU,UACV,UAAW,UACX,UAAW,UACX,eAAgB,UAChB,eAAgB,4BAChB,eAAgB,4BAChB,YAAa,UACb,WAAY,UACZ,cAAe,UACf,cAAe,UACf,QAAS,UACT,SAAU,UACV,WAAY,UACZ,WACE,mEACF,cACE,yJAEJ,EAEA,SAASC,EAAWC,EAAYC,EAAgC,CAG9D,MAAMC,EAAQ,CACZ,iBAAkBF,EAAE,eACp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AgBA,EAAE,QAAA,EAEpB,OAAQ,CACN,aAAcA,EAAE,WAChB,kBAAmBA,EAAE,UAAA,EAEvB,QAAS,CACP,iBAAkBA,EAAE,WACpB,oBAAqBA,EAAE,cAAA,EAEzB,SAAU,CACR,aAAcA,EAAE,SAChB,eAAgBA,EAAE,OAAA,EAEpB,SAAU,CACR,gBAAiBA,EAAE,OAAA,EAErB,QAAS,CACP,gBAAiBA,EAAE,OAAA,EAErB,aAAc,CACZ,gBAAiBA,EAAE,OAAA,EAErB,QAAS,CACP,gBAAiBA,EAAE,OAAA,CACrB,CACF,CAEJ,CAIA,MAAMG,EAAyC,CAC7C,MAAOJ,EAAWF,EAAO,OAAO,EAChC,KAAME,EAAWD,EAAM,MAAM,CAC/B,EAKO,SAASM,EAAcH,EAAgC,CAC5D,OAAOE,EAAOF,CAAM,CACtB"}
@@ -1,5 +1,5 @@
1
1
  import { theme as n } from "antd";
2
- const l = (e) => ({
2
+ const d = (e) => ({
3
3
  ...n.darkAlgorithm(e),
4
4
  colorPrimary: e.colorPrimary,
5
5
  colorInfo: e.colorInfo,
@@ -7,13 +7,13 @@ const l = (e) => ({
7
7
  colorSuccess: e.colorSuccess,
8
8
  colorWarning: e.colorWarning,
9
9
  colorError: e.colorError
10
- }), i = "'Hanken Grotesk Variable', 'Hanken Grotesk', 'PingFang SC', 'Noto Sans SC Variable', 'Noto Sans SC', 'Microsoft YaHei', sans-serif", c = "'Google Sans Code', 'PingFang SC', monospace", o = {
10
+ }), i = "'Hanken Grotesk Variable', 'Hanken Grotesk', 'PingFang SC', 'Noto Sans SC Variable', 'Noto Sans SC', 'Microsoft YaHei', sans-serif", c = "'Google Sans Code', 'PingFang SC', monospace", r = {
11
11
  xs: 4,
12
12
  sm: 6,
13
13
  md: 10,
14
14
  lg: 20,
15
15
  pill: 999
16
- }, r = "cubic-bezier(0.22, 1, 0.36, 1)", g = "cubic-bezier(0.4, 0, 1, 1)", b = {
16
+ }, o = "cubic-bezier(0.22, 1, 0.36, 1)", g = "cubic-bezier(0.4, 0, 1, 1)", b = {
17
17
  bgPage: "#f7f8fa",
18
18
  bgPanel: "#ffffff",
19
19
  bgMuted: "#f1f3f5",
@@ -31,6 +31,8 @@ const l = (e) => ({
31
31
  accentSuccess: "#167a62",
32
32
  accentWarning: "#e11d48",
33
33
  inkWarn: "#d97706",
34
+ textWarn: "#b45309",
35
+ bgWarnSoft: "#fffbeb",
34
36
  shadowRest: "0 1px 2px rgba(31, 35, 40, 0.04), 0 6px 20px -6px rgba(31, 35, 40, 0.08)",
35
37
  shadowOverlay: "0 8px 24px -6px rgba(31, 35, 40, 0.12), 0 28px 64px -16px rgba(31, 35, 40, 0.2)"
36
38
  }, s = {
@@ -51,10 +53,12 @@ const l = (e) => ({
51
53
  accentSuccess: "#4ade80",
52
54
  accentWarning: "#fb7185",
53
55
  inkWarn: "#fbbf24",
56
+ textWarn: "#fbbf24",
57
+ bgWarnSoft: "#2a200a",
54
58
  shadowRest: "0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px -6px rgba(0, 0, 0, 0.4)",
55
- shadowOverlay: "0 8px 24px -6px rgba(0, 0, 0, 0.45), 0 28px 64px -16px rgba(0, 0, 0, 0.6)"
59
+ shadowOverlay: "0 8px 24px -6px rgba(0, 0, 0, 0.45), 0 28px 64px -16px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.18)"
56
60
  };
57
- function a(e, d) {
61
+ function a(e, l) {
58
62
  const t = {
59
63
  hoverBorderColor: e.borderEmphasis,
60
64
  activeBorderColor: e.accentBrand
@@ -62,7 +66,7 @@ function a(e, d) {
62
66
  return {
63
67
  cssVar: !0,
64
68
  hashed: !1,
65
- algorithm: d === "dark" ? l : n.defaultAlgorithm,
69
+ algorithm: l === "dark" ? d : n.defaultAlgorithm,
66
70
  token: {
67
71
  // Activation is surface inversion, so antd's "primary" is the ink.
68
72
  colorPrimary: e.bgInverted,
@@ -88,10 +92,10 @@ function a(e, d) {
88
92
  controlOutline: e.bgBrandSoft,
89
93
  controlOutlineWidth: 3,
90
94
  lineWidthFocus: 2,
91
- borderRadius: o.md,
92
- borderRadiusLG: o.lg,
93
- borderRadiusSM: o.sm,
94
- borderRadiusXS: o.xs,
95
+ borderRadius: r.md,
96
+ borderRadiusLG: r.lg,
97
+ borderRadiusSM: r.sm,
98
+ borderRadiusXS: r.xs,
95
99
  fontFamily: i,
96
100
  fontFamilyCode: c,
97
101
  fontSize: 13,
@@ -106,13 +110,13 @@ function a(e, d) {
106
110
  motionDurationMid: "0.2s",
107
111
  motionDurationFast: "0.15s",
108
112
  motionDurationSlow: "0.25s",
109
- motionEaseOut: r,
110
- motionEaseOutCirc: r,
111
- motionEaseOutQuint: r,
112
- motionEaseOutBack: r,
113
- motionEaseInOut: r,
114
- motionEaseInOutCirc: r,
115
- motionEaseInBack: r,
113
+ motionEaseOut: o,
114
+ motionEaseOutCirc: o,
115
+ motionEaseOutQuint: o,
116
+ motionEaseOutBack: o,
117
+ motionEaseInOut: o,
118
+ motionEaseInOutCirc: o,
119
+ motionEaseInBack: o,
116
120
  motionEaseInQuint: g
117
121
  },
118
122
  components: {
@@ -123,12 +127,18 @@ function a(e, d) {
123
127
  nodeSelectedBg: e.bgInverted,
124
128
  nodeSelectedColor: e.textOnInverted,
125
129
  directoryNodeSelectedBg: e.bgInverted,
126
- directoryNodeSelectedColor: e.textOnInverted
130
+ directoryNodeSelectedColor: e.textOnInverted,
131
+ // The Tree draws its own checkboxes, so it takes the Checkbox
132
+ // block's tokens: on the dark scheme's ink the tick must be the
133
+ // inverted text colour. colorBorder also draws showLine's lines.
134
+ borderRadiusSM: r.xs,
135
+ colorBorder: e.borderEmphasis,
136
+ colorWhite: e.textOnInverted
127
137
  },
128
138
  Button: {
129
- borderRadius: o.pill,
130
- borderRadiusLG: o.pill,
131
- borderRadiusSM: o.pill,
139
+ borderRadius: r.pill,
140
+ borderRadiusLG: r.pill,
141
+ borderRadiusSM: r.pill,
132
142
  controlHeight: 32,
133
143
  paddingInline: 16,
134
144
  fontWeight: 500,
@@ -145,10 +155,21 @@ function a(e, d) {
145
155
  primaryShadow: "none",
146
156
  defaultShadow: e.shadowRest,
147
157
  dangerShadow: "none",
148
- textHoverBg: e.bgMuted
158
+ textHoverBg: e.bgMuted,
159
+ // A danger button is a destructive action, a caution and not a
160
+ // failure: it takes the caution ink and wash. The global colorError
161
+ // stays the anomaly red, for form validation and other failures.
162
+ colorError: e.textWarn,
163
+ colorErrorHover: e.textWarn,
164
+ colorErrorActive: e.textWarn,
165
+ colorErrorBorderHover: e.inkWarn,
166
+ colorErrorBg: e.bgWarnSoft,
167
+ colorErrorBgFilledHover: e.bgWarnSoft,
168
+ colorErrorBgActive: e.bgWarnSoft,
169
+ dangerColor: e.textOnInverted
149
170
  },
150
171
  Card: {
151
- borderRadiusLG: o.lg,
172
+ borderRadiusLG: r.lg,
152
173
  headerBg: "transparent",
153
174
  headerFontSize: 16,
154
175
  headerHeight: 52,
@@ -168,17 +189,17 @@ function a(e, d) {
168
189
  Select: t,
169
190
  DatePicker: t,
170
191
  Checkbox: {
171
- borderRadiusSM: o.xs,
192
+ borderRadiusSM: r.xs,
172
193
  colorBorder: e.borderEmphasis,
173
194
  // The tick is drawn in colorWhite; on the dark scheme's light ink it
174
195
  // must be the inverted text colour to stay visible.
175
196
  colorWhite: e.textOnInverted
176
197
  },
177
198
  Tag: {
178
- borderRadiusSM: o.pill
199
+ borderRadiusSM: r.pill
179
200
  },
180
201
  Modal: {
181
- borderRadiusLG: o.lg,
202
+ borderRadiusLG: r.lg,
182
203
  contentBg: e.bgPanel,
183
204
  headerBg: e.bgPanel,
184
205
  footerBg: e.bgPanel
@@ -191,7 +212,7 @@ function a(e, d) {
191
212
  itemSelectedBg: e.bgInverted,
192
213
  itemSelectedColor: e.textOnInverted,
193
214
  itemHoverBg: e.bgMuted,
194
- itemBorderRadius: o.md
215
+ itemBorderRadius: r.md
195
216
  },
196
217
  Tabs: {
197
218
  inkBarColor: e.textMain,
@@ -229,10 +250,10 @@ const f = {
229
250
  light: a(b, "light"),
230
251
  dark: a(s, "dark")
231
252
  };
232
- function x(e) {
253
+ function u(e) {
233
254
  return f[e];
234
255
  }
235
256
  export {
236
- x as getAegisTheme
257
+ u as getAegisTheme
237
258
  };
238
259
  //# sourceMappingURL=antdTheme.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"antdTheme.js","sources":["../../src/theme/antdTheme.ts"],"sourcesContent":["/**\n * Ant Design 5 ConfigProvider theme mapped onto the aegis tokens in\n * `styles/theme.css`.\n *\n * Two palettes are exposed (`light` / `dark`) so that consumers can mirror\n * the `data-theme` attribute set by `ThemeProvider`. Values are duplicated\n * here (not `var(...)`) because AntD theme tokens are computed in JS — they\n * cannot resolve CSS custom properties.\n *\n * Usage:\n * const { resolved } = useTheme();\n * <ConfigProvider theme={getAegisTheme(resolved)}>…</ConfigProvider>\n */\nimport {\n type MappingAlgorithm,\n type ThemeConfig,\n theme as antdTokens,\n} from 'antd';\n\nimport type { ThemeMode } from './themeContext';\n\n// antd's dark algorithm re-derives the seed colours toward the background\n// (and seed tokens cannot be overridden afterwards); pin them back to the\n// token values so antd controls match the primitives.\nconst darkWithTokenSeeds: MappingAlgorithm = (seed) => ({\n ...antdTokens.darkAlgorithm(seed),\n colorPrimary: seed.colorPrimary,\n colorInfo: seed.colorInfo,\n colorLink: seed.colorLink,\n colorSuccess: seed.colorSuccess,\n colorWarning: seed.colorWarning,\n colorError: seed.colorError,\n});\n\nconst FONT_UI =\n \"'Hanken Grotesk Variable', 'Hanken Grotesk', 'PingFang SC', \" +\n \"'Noto Sans SC Variable', 'Noto Sans SC', 'Microsoft YaHei', sans-serif\";\n\nconst FONT_MONO = \"'Google Sans Code', 'PingFang SC', monospace\";\n\nconst RADIUS = {\n xs: 4,\n sm: 6,\n md: 10,\n lg: 20,\n pill: 999,\n};\n\n/* theme.css's decelerating and exit curves. antd's back and in-out easings\n * would overshoot or ease both ways. antd also uses its in-out-circ and\n * in-back easings for entrances and state changes (radio, progress,\n * message, checkbox), so only in-quint, which it uses for leaving alone,\n * takes the exit curve. */\nconst EASE_SETTLE = 'cubic-bezier(0.22, 1, 0.36, 1)';\nconst EASE_EXIT = 'cubic-bezier(0.4, 0, 1, 1)';\n\ninterface Palette {\n bgPage: string;\n bgPanel: string;\n bgMuted: string;\n bgInverted: string;\n bgBrandSoft: string;\n bgBackdrop: string;\n textMain: string;\n textMuted: string;\n textFaint: string;\n textOnInverted: string;\n borderHairline: string;\n borderEmphasis: string;\n accentBrand: string;\n accentInfo: string;\n accentSuccess: string;\n accentWarning: string;\n inkWarn: string;\n shadowRest: string;\n shadowOverlay: string;\n}\n\nconst LIGHT: Palette = {\n bgPage: '#f7f8fa',\n bgPanel: '#ffffff',\n bgMuted: '#f1f3f5',\n bgInverted: '#1f2328',\n bgBrandSoft: '#eef1fe',\n bgBackdrop: 'rgba(31, 35, 40, 0.28)',\n textMain: '#1f2328',\n textMuted: '#5f6368',\n textFaint: '#9aa0a6',\n textOnInverted: '#ffffff',\n borderHairline: 'rgba(31, 35, 40, 0.08)',\n borderEmphasis: 'rgba(31, 35, 40, 0.16)',\n accentBrand: '#3c56f4',\n accentInfo: '#3c56f4',\n accentSuccess: '#167a62',\n accentWarning: '#e11d48',\n inkWarn: '#d97706',\n shadowRest:\n '0 1px 2px rgba(31, 35, 40, 0.04), 0 6px 20px -6px rgba(31, 35, 40, 0.08)',\n shadowOverlay:\n '0 8px 24px -6px rgba(31, 35, 40, 0.12), ' +\n '0 28px 64px -16px rgba(31, 35, 40, 0.2)',\n};\n\nconst DARK: Palette = {\n bgPage: '#0b0d12',\n bgPanel: '#15181e',\n bgMuted: '#1e222a',\n bgInverted: '#eef0f3',\n bgBrandSoft: '#1a2140',\n bgBackdrop: 'rgba(0, 0, 0, 0.55)',\n textMain: '#eef0f3',\n textMuted: '#9aa0a6',\n textFaint: '#6b7280',\n textOnInverted: '#0b0d12',\n borderHairline: 'rgba(255, 255, 255, 0.08)',\n borderEmphasis: 'rgba(255, 255, 255, 0.18)',\n accentBrand: '#8ea0ff',\n accentInfo: '#8ea0ff',\n accentSuccess: '#4ade80',\n accentWarning: '#fb7185',\n inkWarn: '#fbbf24',\n shadowRest:\n '0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px -6px rgba(0, 0, 0, 0.4)',\n shadowOverlay:\n '0 8px 24px -6px rgba(0, 0, 0, 0.45), 0 28px 64px -16px rgba(0, 0, 0, 0.6)',\n};\n\nfunction buildTheme(p: Palette, scheme: ThemeMode): ThemeConfig {\n // Text fields, selects and pickers: hairline at rest, emphasis on hover,\n // a brand border plus the brand-soft halo (controlOutline) on focus.\n const field = {\n hoverBorderColor: p.borderEmphasis,\n activeBorderColor: p.accentBrand,\n };\n return {\n cssVar: true,\n hashed: false,\n algorithm:\n scheme === 'dark' ? darkWithTokenSeeds : antdTokens.defaultAlgorithm,\n token: {\n // Activation is surface inversion, so antd's \"primary\" is the ink.\n colorPrimary: p.bgInverted,\n colorInfo: p.accentInfo,\n colorLink: p.accentInfo,\n colorSuccess: p.accentSuccess,\n colorWarning: p.inkWarn,\n colorError: p.accentWarning,\n\n colorBgLayout: p.bgPage,\n colorBgContainer: p.bgPanel,\n colorBgElevated: p.bgPanel,\n colorBgSpotlight: p.bgInverted,\n colorBgMask: p.bgBackdrop,\n\n colorText: p.textMain,\n colorTextSecondary: p.textMuted,\n colorTextTertiary: p.textMuted,\n colorTextQuaternary: p.textFaint,\n colorTextPlaceholder: p.textMuted,\n colorTextLightSolid: p.textOnInverted,\n\n colorBorder: p.borderHairline,\n colorBorderSecondary: p.borderHairline,\n colorSplit: p.borderHairline,\n\n controlOutline: p.bgBrandSoft,\n controlOutlineWidth: 3,\n lineWidthFocus: 2,\n\n borderRadius: RADIUS.md,\n borderRadiusLG: RADIUS.lg,\n borderRadiusSM: RADIUS.sm,\n borderRadiusXS: RADIUS.xs,\n\n fontFamily: FONT_UI,\n fontFamilyCode: FONT_MONO,\n fontSize: 13,\n fontSizeLG: 14,\n fontSizeSM: 12,\n\n lineHeight: 22 / 13,\n\n controlHeight: 32,\n controlHeightSM: 24,\n\n boxShadow: p.shadowOverlay,\n boxShadowSecondary: p.shadowOverlay,\n boxShadowTertiary: p.shadowRest,\n\n motionDurationMid: '0.2s',\n motionDurationFast: '0.15s',\n motionDurationSlow: '0.25s',\n motionEaseOut: EASE_SETTLE,\n motionEaseOutCirc: EASE_SETTLE,\n motionEaseOutQuint: EASE_SETTLE,\n motionEaseOutBack: EASE_SETTLE,\n motionEaseInOut: EASE_SETTLE,\n motionEaseInOutCirc: EASE_SETTLE,\n motionEaseInBack: EASE_SETTLE,\n motionEaseInQuint: EASE_EXIT,\n },\n components: {\n Tree: {\n nodeHoverBg: p.bgMuted,\n // The keyboard-active node's fill; index.css adds the focus ring.\n controlItemBgHover: p.bgMuted,\n nodeSelectedBg: p.bgInverted,\n nodeSelectedColor: p.textOnInverted,\n directoryNodeSelectedBg: p.bgInverted,\n directoryNodeSelectedColor: p.textOnInverted,\n },\n Button: {\n borderRadius: RADIUS.pill,\n borderRadiusLG: RADIUS.pill,\n borderRadiusSM: RADIUS.pill,\n controlHeight: 32,\n paddingInline: 16,\n fontWeight: 500,\n primaryColor: p.textOnInverted,\n defaultBg: p.bgPanel,\n defaultColor: p.textMain,\n defaultBorderColor: p.borderHairline,\n defaultHoverBg: p.bgPanel,\n defaultHoverColor: p.textMain,\n defaultHoverBorderColor: p.borderEmphasis,\n defaultActiveBg: p.bgPanel,\n defaultActiveColor: p.textMain,\n defaultActiveBorderColor: p.borderEmphasis,\n primaryShadow: 'none',\n defaultShadow: p.shadowRest,\n dangerShadow: 'none',\n textHoverBg: p.bgMuted,\n },\n Card: {\n borderRadiusLG: RADIUS.lg,\n headerBg: 'transparent',\n headerFontSize: 16,\n headerHeight: 52,\n paddingLG: 20,\n colorBgContainer: p.bgPanel,\n },\n Table: {\n headerBg: p.bgMuted,\n headerSplitColor: 'transparent',\n headerColor: p.textMuted,\n borderColor: p.borderHairline,\n cellPaddingBlock: 8,\n colorBgContainer: p.bgPanel,\n },\n Input: field,\n InputNumber: field,\n Select: field,\n DatePicker: field,\n Checkbox: {\n borderRadiusSM: RADIUS.xs,\n colorBorder: p.borderEmphasis,\n // The tick is drawn in colorWhite; on the dark scheme's light ink it\n // must be the inverted text colour to stay visible.\n colorWhite: p.textOnInverted,\n },\n Tag: {\n borderRadiusSM: RADIUS.pill,\n },\n Modal: {\n borderRadiusLG: RADIUS.lg,\n contentBg: p.bgPanel,\n headerBg: p.bgPanel,\n footerBg: p.bgPanel,\n },\n Drawer: {\n colorBgElevated: p.bgPanel,\n },\n Menu: {\n itemBg: 'transparent',\n itemSelectedBg: p.bgInverted,\n itemSelectedColor: p.textOnInverted,\n itemHoverBg: p.bgMuted,\n itemBorderRadius: RADIUS.md,\n },\n Tabs: {\n inkBarColor: p.textMain,\n itemSelectedColor: p.textMain,\n itemHoverColor: p.textMain,\n },\n Switch: {\n colorPrimary: p.bgInverted,\n colorPrimaryHover: p.bgInverted,\n },\n Tooltip: {\n colorBgSpotlight: p.bgInverted,\n colorTextLightSolid: p.textOnInverted,\n },\n Progress: {\n defaultColor: p.textMain,\n remainingColor: p.bgMuted,\n },\n Dropdown: {\n colorBgElevated: p.bgPanel,\n },\n Popover: {\n colorBgElevated: p.bgPanel,\n },\n Notification: {\n colorBgElevated: p.bgPanel,\n },\n Message: {\n colorBgElevated: p.bgPanel,\n },\n },\n };\n}\n\n// Built once so callers that pass getAegisTheme(resolved) every render hand\n// antd a stable object.\nconst THEMES: Record<ThemeMode, ThemeConfig> = {\n light: buildTheme(LIGHT, 'light'),\n dark: buildTheme(DARK, 'dark'),\n};\n\n/**\n * Returns the antd ThemeConfig for the given scheme. Pair with `useTheme().resolved`.\n */\nexport function getAegisTheme(scheme: ThemeMode): ThemeConfig {\n return THEMES[scheme];\n}\n"],"names":["darkWithTokenSeeds","seed","antdTokens","FONT_UI","FONT_MONO","RADIUS","EASE_SETTLE","E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AO,OAAO;AAAA,EAChC,MAAME,EAAWD,GAAM,MAAM;AAC/B;AAKO,SAASM,EAAcH,GAAgC;AAC5D,SAAOE,EAAOF,CAAM;AACtB;"}
1
+ {"version":3,"file":"antdTheme.js","sources":["../../src/theme/antdTheme.ts"],"sourcesContent":["/**\n * Ant Design 5 ConfigProvider theme mapped onto the aegis tokens in\n * `styles/theme.css`.\n *\n * Two palettes are exposed (`light` / `dark`) so that consumers can mirror\n * the `data-theme` attribute set by `ThemeProvider`. Values are duplicated\n * here (not `var(...)`) because AntD theme tokens are computed in JS — they\n * cannot resolve CSS custom properties.\n *\n * Usage:\n * const { resolved } = useTheme();\n * <ConfigProvider theme={getAegisTheme(resolved)}>…</ConfigProvider>\n */\nimport {\n type MappingAlgorithm,\n type ThemeConfig,\n theme as antdTokens,\n} from 'antd';\n\nimport type { ThemeMode } from './themeContext';\n\n// antd's dark algorithm re-derives the seed colours toward the background\n// (and seed tokens cannot be overridden afterwards); pin them back to the\n// token values so antd controls match the primitives.\nconst darkWithTokenSeeds: MappingAlgorithm = (seed) => ({\n ...antdTokens.darkAlgorithm(seed),\n colorPrimary: seed.colorPrimary,\n colorInfo: seed.colorInfo,\n colorLink: seed.colorLink,\n colorSuccess: seed.colorSuccess,\n colorWarning: seed.colorWarning,\n colorError: seed.colorError,\n});\n\nconst FONT_UI =\n \"'Hanken Grotesk Variable', 'Hanken Grotesk', 'PingFang SC', \" +\n \"'Noto Sans SC Variable', 'Noto Sans SC', 'Microsoft YaHei', sans-serif\";\n\nconst FONT_MONO = \"'Google Sans Code', 'PingFang SC', monospace\";\n\nconst RADIUS = {\n xs: 4,\n sm: 6,\n md: 10,\n lg: 20,\n pill: 999,\n};\n\n/* theme.css's decelerating and exit curves. antd's back and in-out easings\n * would overshoot or ease both ways. antd also uses its in-out-circ and\n * in-back easings for entrances and state changes (radio, progress,\n * message, checkbox), so only in-quint, which it uses for leaving alone,\n * takes the exit curve. */\nconst EASE_SETTLE = 'cubic-bezier(0.22, 1, 0.36, 1)';\nconst EASE_EXIT = 'cubic-bezier(0.4, 0, 1, 1)';\n\ninterface Palette {\n bgPage: string;\n bgPanel: string;\n bgMuted: string;\n bgInverted: string;\n bgBrandSoft: string;\n bgBackdrop: string;\n textMain: string;\n textMuted: string;\n textFaint: string;\n textOnInverted: string;\n borderHairline: string;\n borderEmphasis: string;\n accentBrand: string;\n accentInfo: string;\n accentSuccess: string;\n accentWarning: string;\n inkWarn: string;\n textWarn: string;\n bgWarnSoft: string;\n shadowRest: string;\n shadowOverlay: string;\n}\n\nconst LIGHT: Palette = {\n bgPage: '#f7f8fa',\n bgPanel: '#ffffff',\n bgMuted: '#f1f3f5',\n bgInverted: '#1f2328',\n bgBrandSoft: '#eef1fe',\n bgBackdrop: 'rgba(31, 35, 40, 0.28)',\n textMain: '#1f2328',\n textMuted: '#5f6368',\n textFaint: '#9aa0a6',\n textOnInverted: '#ffffff',\n borderHairline: 'rgba(31, 35, 40, 0.08)',\n borderEmphasis: 'rgba(31, 35, 40, 0.16)',\n accentBrand: '#3c56f4',\n accentInfo: '#3c56f4',\n accentSuccess: '#167a62',\n accentWarning: '#e11d48',\n inkWarn: '#d97706',\n textWarn: '#b45309',\n bgWarnSoft: '#fffbeb',\n shadowRest:\n '0 1px 2px rgba(31, 35, 40, 0.04), 0 6px 20px -6px rgba(31, 35, 40, 0.08)',\n shadowOverlay:\n '0 8px 24px -6px rgba(31, 35, 40, 0.12), ' +\n '0 28px 64px -16px rgba(31, 35, 40, 0.2)',\n};\n\nconst DARK: Palette = {\n bgPage: '#0b0d12',\n bgPanel: '#15181e',\n bgMuted: '#1e222a',\n bgInverted: '#eef0f3',\n bgBrandSoft: '#1a2140',\n bgBackdrop: 'rgba(0, 0, 0, 0.55)',\n textMain: '#eef0f3',\n textMuted: '#9aa0a6',\n textFaint: '#6b7280',\n textOnInverted: '#0b0d12',\n borderHairline: 'rgba(255, 255, 255, 0.08)',\n borderEmphasis: 'rgba(255, 255, 255, 0.18)',\n accentBrand: '#8ea0ff',\n accentInfo: '#8ea0ff',\n accentSuccess: '#4ade80',\n accentWarning: '#fb7185',\n inkWarn: '#fbbf24',\n textWarn: '#fbbf24',\n bgWarnSoft: '#2a200a',\n shadowRest:\n '0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px -6px rgba(0, 0, 0, 0.4)',\n shadowOverlay:\n '0 8px 24px -6px rgba(0, 0, 0, 0.45), 0 28px 64px -16px rgba(0, 0, 0, 0.6), ' +\n '0 0 0 1px rgba(255, 255, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.18)',\n};\n\nfunction buildTheme(p: Palette, scheme: ThemeMode): ThemeConfig {\n // Text fields, selects and pickers: hairline at rest, emphasis on hover,\n // a brand border plus the brand-soft halo (controlOutline) on focus.\n const field = {\n hoverBorderColor: p.borderEmphasis,\n activeBorderColor: p.accentBrand,\n };\n return {\n cssVar: true,\n hashed: false,\n algorithm:\n scheme === 'dark' ? darkWithTokenSeeds : antdTokens.defaultAlgorithm,\n token: {\n // Activation is surface inversion, so antd's \"primary\" is the ink.\n colorPrimary: p.bgInverted,\n colorInfo: p.accentInfo,\n colorLink: p.accentInfo,\n colorSuccess: p.accentSuccess,\n colorWarning: p.inkWarn,\n colorError: p.accentWarning,\n\n colorBgLayout: p.bgPage,\n colorBgContainer: p.bgPanel,\n colorBgElevated: p.bgPanel,\n colorBgSpotlight: p.bgInverted,\n colorBgMask: p.bgBackdrop,\n\n colorText: p.textMain,\n colorTextSecondary: p.textMuted,\n colorTextTertiary: p.textMuted,\n colorTextQuaternary: p.textFaint,\n colorTextPlaceholder: p.textMuted,\n colorTextLightSolid: p.textOnInverted,\n\n colorBorder: p.borderHairline,\n colorBorderSecondary: p.borderHairline,\n colorSplit: p.borderHairline,\n\n controlOutline: p.bgBrandSoft,\n controlOutlineWidth: 3,\n lineWidthFocus: 2,\n\n borderRadius: RADIUS.md,\n borderRadiusLG: RADIUS.lg,\n borderRadiusSM: RADIUS.sm,\n borderRadiusXS: RADIUS.xs,\n\n fontFamily: FONT_UI,\n fontFamilyCode: FONT_MONO,\n fontSize: 13,\n fontSizeLG: 14,\n fontSizeSM: 12,\n\n lineHeight: 22 / 13,\n\n controlHeight: 32,\n controlHeightSM: 24,\n\n boxShadow: p.shadowOverlay,\n boxShadowSecondary: p.shadowOverlay,\n boxShadowTertiary: p.shadowRest,\n\n motionDurationMid: '0.2s',\n motionDurationFast: '0.15s',\n motionDurationSlow: '0.25s',\n motionEaseOut: EASE_SETTLE,\n motionEaseOutCirc: EASE_SETTLE,\n motionEaseOutQuint: EASE_SETTLE,\n motionEaseOutBack: EASE_SETTLE,\n motionEaseInOut: EASE_SETTLE,\n motionEaseInOutCirc: EASE_SETTLE,\n motionEaseInBack: EASE_SETTLE,\n motionEaseInQuint: EASE_EXIT,\n },\n components: {\n Tree: {\n nodeHoverBg: p.bgMuted,\n // The keyboard-active node's fill; index.css adds the focus ring.\n controlItemBgHover: p.bgMuted,\n nodeSelectedBg: p.bgInverted,\n nodeSelectedColor: p.textOnInverted,\n directoryNodeSelectedBg: p.bgInverted,\n directoryNodeSelectedColor: p.textOnInverted,\n // The Tree draws its own checkboxes, so it takes the Checkbox\n // block's tokens: on the dark scheme's ink the tick must be the\n // inverted text colour. colorBorder also draws showLine's lines.\n borderRadiusSM: RADIUS.xs,\n colorBorder: p.borderEmphasis,\n colorWhite: p.textOnInverted,\n },\n Button: {\n borderRadius: RADIUS.pill,\n borderRadiusLG: RADIUS.pill,\n borderRadiusSM: RADIUS.pill,\n controlHeight: 32,\n paddingInline: 16,\n fontWeight: 500,\n primaryColor: p.textOnInverted,\n defaultBg: p.bgPanel,\n defaultColor: p.textMain,\n defaultBorderColor: p.borderHairline,\n defaultHoverBg: p.bgPanel,\n defaultHoverColor: p.textMain,\n defaultHoverBorderColor: p.borderEmphasis,\n defaultActiveBg: p.bgPanel,\n defaultActiveColor: p.textMain,\n defaultActiveBorderColor: p.borderEmphasis,\n primaryShadow: 'none',\n defaultShadow: p.shadowRest,\n dangerShadow: 'none',\n textHoverBg: p.bgMuted,\n // A danger button is a destructive action, a caution and not a\n // failure: it takes the caution ink and wash. The global colorError\n // stays the anomaly red, for form validation and other failures.\n colorError: p.textWarn,\n colorErrorHover: p.textWarn,\n colorErrorActive: p.textWarn,\n colorErrorBorderHover: p.inkWarn,\n colorErrorBg: p.bgWarnSoft,\n colorErrorBgFilledHover: p.bgWarnSoft,\n colorErrorBgActive: p.bgWarnSoft,\n dangerColor: p.textOnInverted,\n },\n Card: {\n borderRadiusLG: RADIUS.lg,\n headerBg: 'transparent',\n headerFontSize: 16,\n headerHeight: 52,\n paddingLG: 20,\n colorBgContainer: p.bgPanel,\n },\n Table: {\n headerBg: p.bgMuted,\n headerSplitColor: 'transparent',\n headerColor: p.textMuted,\n borderColor: p.borderHairline,\n cellPaddingBlock: 8,\n colorBgContainer: p.bgPanel,\n },\n Input: field,\n InputNumber: field,\n Select: field,\n DatePicker: field,\n Checkbox: {\n borderRadiusSM: RADIUS.xs,\n colorBorder: p.borderEmphasis,\n // The tick is drawn in colorWhite; on the dark scheme's light ink it\n // must be the inverted text colour to stay visible.\n colorWhite: p.textOnInverted,\n },\n Tag: {\n borderRadiusSM: RADIUS.pill,\n },\n Modal: {\n borderRadiusLG: RADIUS.lg,\n contentBg: p.bgPanel,\n headerBg: p.bgPanel,\n footerBg: p.bgPanel,\n },\n Drawer: {\n colorBgElevated: p.bgPanel,\n },\n Menu: {\n itemBg: 'transparent',\n itemSelectedBg: p.bgInverted,\n itemSelectedColor: p.textOnInverted,\n itemHoverBg: p.bgMuted,\n itemBorderRadius: RADIUS.md,\n },\n Tabs: {\n inkBarColor: p.textMain,\n itemSelectedColor: p.textMain,\n itemHoverColor: p.textMain,\n },\n Switch: {\n colorPrimary: p.bgInverted,\n colorPrimaryHover: p.bgInverted,\n },\n Tooltip: {\n colorBgSpotlight: p.bgInverted,\n colorTextLightSolid: p.textOnInverted,\n },\n Progress: {\n defaultColor: p.textMain,\n remainingColor: p.bgMuted,\n },\n Dropdown: {\n colorBgElevated: p.bgPanel,\n },\n Popover: {\n colorBgElevated: p.bgPanel,\n },\n Notification: {\n colorBgElevated: p.bgPanel,\n },\n Message: {\n colorBgElevated: p.bgPanel,\n },\n },\n };\n}\n\n// Built once so callers that pass getAegisTheme(resolved) every render hand\n// antd a stable object.\nconst THEMES: Record<ThemeMode, ThemeConfig> = {\n light: buildTheme(LIGHT, 'light'),\n dark: buildTheme(DARK, 'dark'),\n};\n\n/**\n * Returns the antd ThemeConfig for the given scheme. Pair with `useTheme().resolved`.\n */\nexport function getAegisTheme(scheme: ThemeMode): ThemeConfig {\n return THEMES[scheme];\n}\n"],"names":["darkWithTokenSeeds","seed","antdTokens","FONT_UI","FONT_MONO","RADIUS","EASE_SETTLE","EASE_EXIT","LIGHT","DARK","buildTheme","p","scheme","field","THEMES","getAegisTheme"],"mappings":";AAwBA,MAAMA,IAAuC,CAACC,OAAU;AAAA,EACtD,GAAGC,EAAW,cAAcD,CAAI;AAAA,EAChC,cAAcA,EAAK;AAAA,EACnB,WAAWA,EAAK;AAAA,EAChB,WAAWA,EAAK;AAAA,EAChB,cAAcA,EAAK;AAAA,EACnB,cAAcA,EAAK;AAAA,EACnB,YAAYA,EAAK;AACnB,IAEME,IACJ,sIAGIC,IAAY,gDAEZC,IAAS;AAAA,EACb,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,MAAM;AACR,GAOMC,IAAc,kCACdC,IAAY,8BA0BZC,IAAiB;AAAA,EACrB,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,WAAW;AAAA,EACX,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,eAAe;AA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AQ;AAAA,QACN,iBAAiBA,EAAE;AAAA,MAAA;AAAA,MAErB,MAAM;AAAA,QACJ,QAAQ;AAAA,QACR,gBAAgBA,EAAE;AAAA,QAClB,mBAAmBA,EAAE;AAAA,QACrB,aAAaA,EAAE;AAAA,QACf,kBAAkBN,EAAO;AAAA,MAAA;AAAA,MAE3B,MAAM;AAAA,QACJ,aAAaM,EAAE;AAAA,QACf,mBAAmBA,EAAE;AAAA,QACrB,gBAAgBA,EAAE;AAAA,MAAA;AAAA,MAEpB,QAAQ;AAAA,QACN,cAAcA,EAAE;AAAA,QAChB,mBAAmBA,EAAE;AAAA,MAAA;AAAA,MAEvB,SAAS;AAAA,QACP,kBAAkBA,EAAE;AAAA,QACpB,qBAAqBA,EAAE;AAAA,MAAA;AAAA,MAEzB,UAAU;AAAA,QACR,cAAcA,EAAE;AAAA,QAChB,gBAAgBA,EAAE;AAAA,MAAA;AAAA,MAEpB,UAAU;AAAA,QACR,iBAAiBA,EAAE;AAAA,MAAA;AAAA,MAErB,SAAS;AAAA,QACP,iBAAiBA,EAAE;AAAA,MAAA;AAAA,MAErB,cAAc;AAAA,QACZ,iBAAiBA,EAAE;AAAA,MAAA;AAAA,MAErB,SAAS;AAAA,QACP,iBAAiBA,EAAE;AAAA,MAAA;AAAA,IACrB;AAAA,EACF;AAEJ;AAIA,MAAMG,IAAyC;AAAA,EAC7C,OAAOJ,EAAWF,GAAO,OAAO;AAAA,EAChC,MAAME,EAAWD,GAAM,MAAM;AAC/B;AAKO,SAASM,EAAcH,GAAgC;AAC5D,SAAOE,EAAOF,CAAM;AACtB;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react/jsx-runtime"),r=require("react"),z=require("../../agent/chat/AgentChatProvider.cjs"),d=require("../../lib/id.cjs"),J=require("../../lib/storage.cjs"),N=require("./agentmChannelClient.cjs"),Y="aegis.agentm.peerId";function B(t){const e=t.body,n=typeof e.stream_id=="string"?e.stream_id:null;if(e.kind==="tool_call"){const a=F(e.metadata);return a?{role:"tool",content:"",streamId:n,final:e.final===!0,toolCall:a}:null}return typeof e.content!="string"?null:{content:e.content,final:e.final===!0,streamId:n}}function F(t){if(typeof t!="object"||t===null)return null;const e=t,n=e.tool_call_id,a=e.tool_name,i=e.status;if(typeof n!="string"||typeof a!="string")return null;const S=e.is_error===!0?"error":i==="running"||i==="ok"||i==="error"?i:"running",o={toolCallId:n,name:a,args:e.args,status:S};return typeof e.result_text=="string"&&(o.resultText=e.result_text),typeof e.started_at=="number"&&(o.startedAt=e.started_at),typeof e.ended_at=="number"&&(o.endedAt=e.ended_at),o}function G({channel:t,children:e,initialMessages:n,onStatusChange:a,mapOutbound:i}){const[S,o]=r.useState(()=>n??[]),[b,f]=r.useState(!1),[q,E]=r.useState("idle"),[D,P]=r.useState(t.chatId);t.chatId!==D&&(P(t.chatId),o(n??[]),f(!1));const y=r.useRef(null),R=r.useRef(new Map),O=r.useRef(i);O.current=i;const w=r.useRef(a);w.current=a;const M=r.useRef(t);M.current=t;const v=r.useMemo(()=>JSON.stringify({url:t.url,peerId:t.peerId,peerKind:t.peerKind,token:t.token,channel:t.channel,chatId:t.chatId,autoReconnect:t.autoReconnect}),[t.url,t.peerId,t.peerKind,t.token,t.channel,t.chatId,t.autoReconnect]);r.useEffect(()=>{const C=M.current,g=C.peerId??J.getOrCreateStored(Y,()=>d.uniqueId("peer"),"session"),u=new N.AgentmChannelClient({...C,peerId:g});y.current=u;const c=u.onStatusChange(l=>{E(l),l!=="connected"&&f(!1),w.current?.(l)}),_=u.onOutbound(l=>{const s=(O.current??B)(l);if(!s)return;f(!1);const I=R.current;let m;s.streamId?(m=I.get(s.streamId)??d.uniqueId("msg"),s.final?I.delete(s.streamId):I.set(s.streamId,m)):m=d.uniqueId("msg");const $={id:m,role:s.role??"assistant",content:s.content,timestamp:new Date().toISOString(),...s.toolCall?{toolCall:s.toolCall}:{}};o(h=>H(h,$))}),K=u.onError(l=>{const p=l.body,s=typeof p.code=="string"?p.code:"error",I=typeof p.message=="string"?p.message:"gateway error";f(!1),o(m=>[...m,{id:d.uniqueId("msg"),role:"system",content:`[${s}] ${I}`,timestamp:new Date().toISOString()}])});u.connect().catch(()=>{});const j=R.current;return()=>{c(),_(),K(),u.close(),y.current===u&&(y.current=null),j.clear()}},[v]);const A=r.useCallback(C=>{const g=C.trim();if(!g)return;const u=y.current;if(o(c=>[...c,{id:d.uniqueId("msg"),role:"user",content:g,timestamp:new Date().toISOString()}]),!u||u.connectionStatus!=="connected"){o(c=>[...c,{id:d.uniqueId("msg"),role:"system",content:"AgentM gateway is not connected — message not delivered.",timestamp:new Date().toISOString()}]);return}try{f(!0),u.sendInbound(g)}catch(c){f(!1),o(_=>[..._,{id:d.uniqueId("msg"),role:"system",content:`send failed: ${c instanceof Error?c.message:String(c)}`,timestamp:new Date().toISOString()}])}},[]),k=r.useCallback(()=>{R.current.clear(),o([])},[]),x=r.useMemo(()=>({messages:S,sending:b,send:A,clear:k,status:q}),[S,b,A,k,q]);return T.jsx(z.AgentChatProvider,{value:x,children:e})}function H(t,e){return t.some(n=>n.id===e.id)?t.map(n=>n.id===e.id?{...n,content:e.content,...e.toolCall?{toolCall:e.toolCall}:{}}:n):[...t,e]}exports.AgentmChannelProvider=G;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("react/jsx-runtime"),n=require("react"),F=require("../../agent/chat/AgentChatProvider.cjs"),d=require("../../lib/id.cjs"),G=require("../../lib/storage.cjs"),J=require("./agentmChannelClient.cjs"),Y=require("../../locale/useStrings.cjs"),B="aegis.agentm.peerId";function H(t){const e=t.body,r=typeof e.stream_id=="string"?e.stream_id:null;if(e.kind==="tool_call"){const i=L(e.metadata);return i?{role:"tool",content:"",streamId:r,final:e.final===!0,toolCall:i}:null}return typeof e.content!="string"?null:{content:e.content,final:e.final===!0,streamId:r}}function L(t){if(typeof t!="object"||t===null)return null;const e=t,r=e.tool_call_id,i=e.tool_name,a=e.status;if(typeof r!="string"||typeof i!="string")return null;const S=e.is_error===!0?"error":a==="running"||a==="ok"||a==="error"?a:"running",o={toolCallId:r,name:i,args:e.args,status:S};return typeof e.result_text=="string"&&(o.resultText=e.result_text),typeof e.started_at=="number"&&(o.startedAt=e.started_at),typeof e.ended_at=="number"&&(o.endedAt=e.ended_at),o}function Q({channel:t,children:e,initialMessages:r,onStatusChange:i,mapOutbound:a}){const[S,o]=n.useState(()=>r??[]),[q,f]=n.useState(!1),[O,P]=n.useState("idle"),[x,K]=n.useState(t.chatId);t.chatId!==x&&(K(t.chatId),o(r??[]),f(!1));const y=n.useRef(null),_=n.useRef(new Map),w=n.useRef(a);w.current=a;const E=n.useRef(i);E.current=i;const M=n.useRef(t);M.current=t;const k=Y.useStrings(),C=n.useRef(k);C.current=k;const j=n.useMemo(()=>JSON.stringify({url:t.url,peerId:t.peerId,peerKind:t.peerKind,token:t.token,channel:t.channel,chatId:t.chatId,autoReconnect:t.autoReconnect}),[t.url,t.peerId,t.peerKind,t.token,t.channel,t.chatId,t.autoReconnect]);n.useEffect(()=>{const R=M.current,g=R.peerId??G.getOrCreateStored(B,()=>d.uniqueId("peer"),"session"),u=new J.AgentmChannelClient({...R,peerId:g});y.current=u;const c=u.onStatusChange(l=>{P(l),l!=="connected"&&f(!1),E.current?.(l)}),b=u.onOutbound(l=>{const s=(w.current??H)(l);if(!s)return;f(!1);const I=_.current;let m;s.streamId?(m=I.get(s.streamId)??d.uniqueId("msg"),s.final?I.delete(s.streamId):I.set(s.streamId,m)):m=d.uniqueId("msg");const $={id:m,role:s.role??"assistant",content:s.content,timestamp:new Date().toISOString(),...s.toolCall?{toolCall:s.toolCall}:{}};o(N=>U(N,$))}),h=u.onError(l=>{const p=l.body,s=typeof p.code=="string"?p.code:"error",I=typeof p.message=="string"?p.message:C.current.agentmGatewayError;f(!1),o(m=>[...m,{id:d.uniqueId("msg"),role:"system",content:`[${s}] ${I}`,timestamp:new Date().toISOString()}])});u.connect().catch(()=>{});const T=_.current;return()=>{c(),b(),h(),u.close(),y.current===u&&(y.current=null),T.clear()}},[j]);const A=n.useCallback(R=>{const g=R.trim();if(!g)return;const u=y.current;if(o(c=>[...c,{id:d.uniqueId("msg"),role:"user",content:g,timestamp:new Date().toISOString()}]),!u||u.connectionStatus!=="connected"){o(c=>[...c,{id:d.uniqueId("msg"),role:"system",content:C.current.agentmNotConnected,timestamp:new Date().toISOString()}]);return}try{f(!0),u.sendInbound(g)}catch(c){f(!1),o(b=>[...b,{id:d.uniqueId("msg"),role:"system",content:C.current.agentmSendFailed(c instanceof Error?c.message:String(c)),timestamp:new Date().toISOString()}])}},[]),D=n.useCallback(()=>{_.current.clear(),o([])},[]),v=n.useMemo(()=>({messages:S,sending:q,send:A,clear:D,status:O}),[S,q,A,D,O]);return z.jsx(F.AgentChatProvider,{value:v,children:e})}function U(t,e){return t.some(r=>r.id===e.id)?t.map(r=>r.id===e.id?{...r,content:e.content,...e.toolCall?{toolCall:e.toolCall}:{}}:r):[...t,e]}exports.AgentmChannelProvider=Q;
2
2
  //# sourceMappingURL=AgentmChannelProvider.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentmChannelProvider.cjs","sources":["../../../src/transports/agentm/AgentmChannelProvider.tsx"],"sourcesContent":["import {\n type ReactElement,\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { AgentChatProvider } from '../../agent/chat/AgentChatProvider';\nimport type {\n AgentChatValue,\n AgentMessage,\n AgentMessageRole,\n AgentToolCallRecord,\n} from '../../agent/chat/chat';\nimport { uniqueId } from '../../lib/id';\nimport { getOrCreateStored } from '../../lib/storage';\nimport {\n AgentmChannelClient,\n type AgentmChannelClientOptions,\n type ConnectionStatus,\n type Envelope,\n} from './agentmChannelClient';\n\ntype ChannelOptions = Omit<AgentmChannelClientOptions, 'peerId'> & {\n /** Stable peer id. Defaults to a sessionStorage-persisted random id. */\n peerId?: string;\n};\n\ninterface AgentmChannelProviderProps {\n channel: ChannelOptions;\n children: ReactNode;\n /**\n * Initial messages — for resuming a prior thread server-side. The\n * conversation restarts from them whenever `channel.chatId` changes. The\n * library still does not persist anything itself.\n */\n initialMessages?: AgentMessage[];\n /** Notified on every connection-state change. */\n onStatusChange?: (status: ConnectionStatus) => void;\n /**\n * Custom mapper from an `outbound` envelope to a renderable assistant\n * message. Default reads `body.content` as the text body.\n */\n mapOutbound?: (env: Envelope) => MappedOutbound | null;\n}\n\ninterface MappedOutbound {\n content: string;\n role?: AgentMessageRole;\n final?: boolean;\n streamId?: string | null;\n toolCall?: AgentToolCallRecord;\n}\n\nconst PEER_ID_KEY = 'aegis.agentm.peerId';\n\nfunction defaultMapOutbound(env: Envelope): MappedOutbound | null {\n const body = env.body as {\n content?: unknown;\n final?: unknown;\n stream_id?: unknown;\n kind?: unknown;\n metadata?: unknown;\n };\n const streamId = typeof body.stream_id === 'string' ? body.stream_id : null;\n if (body.kind === 'tool_call') {\n const toolCall = parseToolCall(body.metadata);\n if (!toolCall) {\n return null;\n }\n return {\n role: 'tool',\n content: '',\n streamId,\n final: body.final === true,\n toolCall,\n };\n }\n if (typeof body.content !== 'string') {\n return null;\n }\n return {\n content: body.content,\n final: body.final === true,\n streamId,\n };\n}\n\nfunction parseToolCall(metadata: unknown): AgentToolCallRecord | null {\n if (typeof metadata !== 'object' || metadata === null) {\n return null;\n }\n const m = metadata as Record<string, unknown>;\n const toolCallId = m.tool_call_id;\n const name = m.tool_name;\n const status = m.status;\n if (typeof toolCallId !== 'string' || typeof name !== 'string') {\n return null;\n }\n // The gateway can report a finished call as `ok` with is_error set.\n const normalizedStatus: AgentToolCallRecord['status'] =\n m.is_error === true\n ? 'error'\n : status === 'running' || status === 'ok' || status === 'error'\n ? status\n : 'running';\n const record: AgentToolCallRecord = {\n toolCallId,\n name,\n args: m.args,\n status: normalizedStatus,\n };\n if (typeof m.result_text === 'string') {\n record.resultText = m.result_text;\n }\n if (typeof m.started_at === 'number') {\n record.startedAt = m.started_at;\n }\n if (typeof m.ended_at === 'number') {\n record.endedAt = m.ended_at;\n }\n return record;\n}\n\n/**\n * Connects to an AgentM channels gateway (contrib/channels) as a\n * `chat_client` peer over WebSocket and exposes the conversation as\n * an `AgentChatValue` consumable by `<AgentPanel>` / `useAgentChat`.\n *\n * The client owns the round-trip: `send(content)` emits an `inbound`\n * envelope; `outbound` envelopes from the gateway become assistant\n * messages. Streamed responses (same `stream_id`) replace the same\n * message in place — contrib/channels sends cumulative content per\n * chunk, not deltas. Non-streamed outbounds become discrete messages.\n */\nexport function AgentmChannelProvider({\n channel,\n children,\n initialMessages,\n onStatusChange,\n mapOutbound,\n}: AgentmChannelProviderProps): ReactElement {\n const [messages, setMessages] = useState<AgentMessage[]>(\n () => initialMessages ?? [],\n );\n const [sending, setSending] = useState<boolean>(false);\n const [status, setStatus] = useState<ConnectionStatus>('idle');\n // Reset in render, not in an effect, so the new chat's first paint never\n // shows the previous chat's messages.\n const [chatId, setChatId] = useState(channel.chatId);\n if (channel.chatId !== chatId) {\n setChatId(channel.chatId);\n setMessages(initialMessages ?? []);\n setSending(false);\n }\n const clientRef = useRef<AgentmChannelClient | null>(null);\n // Maps stream_id → message id so we can append chunks to the same row.\n const streamMapRef = useRef<Map<string, string>>(new Map());\n\n const mapRef = useRef(mapOutbound);\n mapRef.current = mapOutbound;\n const onStatusRef = useRef(onStatusChange);\n onStatusRef.current = onStatusChange;\n const channelRef = useRef(channel);\n channelRef.current = channel;\n\n const channelKey = useMemo(\n () =>\n JSON.stringify({\n url: channel.url,\n peerId: channel.peerId,\n peerKind: channel.peerKind,\n token: channel.token,\n channel: channel.channel,\n chatId: channel.chatId,\n autoReconnect: channel.autoReconnect,\n }),\n [\n channel.url,\n channel.peerId,\n channel.peerKind,\n channel.token,\n channel.channel,\n channel.chatId,\n channel.autoReconnect,\n ],\n );\n\n useEffect(() => {\n const current = channelRef.current;\n const peerId =\n current.peerId ??\n getOrCreateStored(PEER_ID_KEY, () => uniqueId('peer'), 'session');\n const client = new AgentmChannelClient({ ...current, peerId });\n clientRef.current = client;\n\n const offStatus = client.onStatusChange((s) => {\n setStatus(s);\n // A reply cannot arrive on a dropped connection; free the composer.\n if (s !== 'connected') {\n setSending(false);\n }\n onStatusRef.current?.(s);\n });\n\n const offOutbound = client.onOutbound((env) => {\n const mapper = mapRef.current ?? defaultMapOutbound;\n const mapped = mapper(env);\n if (!mapped) {\n return;\n }\n setSending(false);\n // Stream bookkeeping stays out of the updater, which StrictMode runs\n // twice.\n const streams = streamMapRef.current;\n let id: string;\n if (mapped.streamId) {\n id = streams.get(mapped.streamId) ?? uniqueId('msg');\n if (mapped.final) {\n streams.delete(mapped.streamId);\n } else {\n streams.set(mapped.streamId, id);\n }\n } else {\n id = uniqueId('msg');\n }\n const message: AgentMessage = {\n id,\n role: mapped.role ?? 'assistant',\n content: mapped.content,\n timestamp: new Date().toISOString(),\n ...(mapped.toolCall ? { toolCall: mapped.toolCall } : {}),\n };\n setMessages((prev) => upsertMessage(prev, message));\n });\n\n const offError = client.onError((env) => {\n const body = env.body as { code?: unknown; message?: unknown };\n const code = typeof body.code === 'string' ? body.code : 'error';\n const detail =\n typeof body.message === 'string' ? body.message : 'gateway error';\n setSending(false);\n setMessages((prev) => [\n ...prev,\n {\n id: uniqueId('msg'),\n role: 'system',\n content: `[${code}] ${detail}`,\n timestamp: new Date().toISOString(),\n },\n ]);\n });\n\n client.connect().catch(() => {\n // surfaced via onError / status; nothing to do here.\n });\n\n const streamMap = streamMapRef.current;\n return () => {\n offStatus();\n offOutbound();\n offError();\n client.close();\n if (clientRef.current === client) {\n clientRef.current = null;\n }\n streamMap.clear();\n };\n // channelKey captures every input that affects the client identity;\n // the latest `channel` object is read via channelRef so a fresh\n // parent render with the same fields does not tear down the socket.\n }, [channelKey]);\n\n const send = useCallback((content: string): void => {\n const trimmed = content.trim();\n if (!trimmed) {\n return;\n }\n const client = clientRef.current;\n setMessages((prev) => [\n ...prev,\n {\n id: uniqueId('msg'),\n role: 'user',\n content: trimmed,\n timestamp: new Date().toISOString(),\n },\n ]);\n if (!client || client.connectionStatus !== 'connected') {\n setMessages((prev) => [\n ...prev,\n {\n id: uniqueId('msg'),\n role: 'system',\n content: 'AgentM gateway is not connected — message not delivered.',\n timestamp: new Date().toISOString(),\n },\n ]);\n return;\n }\n try {\n setSending(true);\n client.sendInbound(trimmed);\n } catch (err) {\n setSending(false);\n setMessages((prev) => [\n ...prev,\n {\n id: uniqueId('msg'),\n role: 'system',\n content: `send failed: ${err instanceof Error ? err.message : String(err)}`,\n timestamp: new Date().toISOString(),\n },\n ]);\n }\n }, []);\n\n const clear = useCallback((): void => {\n streamMapRef.current.clear();\n setMessages([]);\n }, []);\n\n const value = useMemo<AgentChatValue & { status: ConnectionStatus }>(\n () => ({\n messages,\n sending,\n send,\n clear,\n status,\n }),\n [messages, sending, send, clear, status],\n );\n\n return <AgentChatProvider value={value}>{children}</AgentChatProvider>;\n}\n\n// contrib/channels sends cumulative content per stream_id (each chunk is\n// the full text so far, not a delta), so a later chunk replaces the row.\nfunction upsertMessage(\n prev: AgentMessage[],\n message: AgentMessage,\n): AgentMessage[] {\n if (!prev.some((m) => m.id === message.id)) {\n return [...prev, message];\n }\n return prev.map((m) =>\n m.id === message.id\n ? {\n ...m,\n content: message.content,\n ...(message.toolCall ? { toolCall: message.toolCall } : {}),\n }\n : m,\n );\n}\n"],"names":["PEER_ID_KEY","defaultMapOutbound","env","body","streamId","toolCall","parseToolCall","metadata","m","toolCallId","name","status","normalizedStatus","record","AgentmChannelProvider","channel","children","initialMessages","onStatusChange","mapOutbound","messages","setMessages","useState","sending","setSending","setStatus","chatId","setChatId","clientRef","useRef","streamMapRef","mapRef","onStatusRef","channelRef","channelKey","useMemo","useEffect","current","peerId","getOrCreateStored","uniqueId","client","AgentmChannelClient","offStatus","s","offOutbound","mapped","streams","id","message","prev","upsertMessage","offError","code","detail","streamMap","send","useCallback","content","trimmed","err","clear","value","jsx","AgentChatProvider"],"mappings":"oSAyDMA,E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jB,GAAIA,EAAQ,SAAW,CAAE,SAAUA,EAAQ,QAAA,EAAa,CAAA,CAAC,EAE3DzC,CAAA,EATG,CAAC,GAAG0C,EAAMD,CAAO,CAW5B"}
1
+ {"version":3,"file":"AgentmChannelProvider.cjs","sources":["../../../src/transports/agentm/AgentmChannelProvider.tsx"],"sourcesContent":["import {\n type ReactElement,\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { AgentChatProvider } from '../../agent/chat/AgentChatProvider';\nimport type {\n AgentChatValue,\n AgentMessage,\n AgentMessageRole,\n AgentToolCallRecord,\n} from '../../agent/chat/chat';\nimport { uniqueId } from '../../lib/id';\nimport { getOrCreateStored } from '../../lib/storage';\nimport { useStrings } from '../../locale';\nimport {\n AgentmChannelClient,\n type AgentmChannelClientOptions,\n type ConnectionStatus,\n type Envelope,\n} from './agentmChannelClient';\n\ntype ChannelOptions = Omit<AgentmChannelClientOptions, 'peerId'> & {\n /** Stable peer id. Defaults to a sessionStorage-persisted random id. */\n peerId?: string;\n};\n\ninterface AgentmChannelProviderProps {\n channel: ChannelOptions;\n children: ReactNode;\n /**\n * Initial messages — for resuming a prior thread server-side. The\n * conversation restarts from them whenever `channel.chatId` changes. The\n * library still does not persist anything itself.\n */\n initialMessages?: AgentMessage[];\n /** Notified on every connection-state change. */\n onStatusChange?: (status: ConnectionStatus) => void;\n /**\n * Custom mapper from an `outbound` envelope to a renderable assistant\n * message. Default reads `body.content` as the text body.\n */\n mapOutbound?: (env: Envelope) => MappedOutbound | null;\n}\n\ninterface MappedOutbound {\n content: string;\n role?: AgentMessageRole;\n final?: boolean;\n streamId?: string | null;\n toolCall?: AgentToolCallRecord;\n}\n\nconst PEER_ID_KEY = 'aegis.agentm.peerId';\n\nfunction defaultMapOutbound(env: Envelope): MappedOutbound | null {\n const body = env.body as {\n content?: unknown;\n final?: unknown;\n stream_id?: unknown;\n kind?: unknown;\n metadata?: unknown;\n };\n const streamId = typeof body.stream_id === 'string' ? body.stream_id : null;\n if (body.kind === 'tool_call') {\n const toolCall = parseToolCall(body.metadata);\n if (!toolCall) {\n return null;\n }\n return {\n role: 'tool',\n content: '',\n streamId,\n final: body.final === true,\n toolCall,\n };\n }\n if (typeof body.content !== 'string') {\n return null;\n }\n return {\n content: body.content,\n final: body.final === true,\n streamId,\n };\n}\n\nfunction parseToolCall(metadata: unknown): AgentToolCallRecord | null {\n if (typeof metadata !== 'object' || metadata === null) {\n return null;\n }\n const m = metadata as Record<string, unknown>;\n const toolCallId = m.tool_call_id;\n const name = m.tool_name;\n const status = m.status;\n if (typeof toolCallId !== 'string' || typeof name !== 'string') {\n return null;\n }\n // The gateway can report a finished call as `ok` with is_error set.\n const normalizedStatus: AgentToolCallRecord['status'] =\n m.is_error === true\n ? 'error'\n : status === 'running' || status === 'ok' || status === 'error'\n ? status\n : 'running';\n const record: AgentToolCallRecord = {\n toolCallId,\n name,\n args: m.args,\n status: normalizedStatus,\n };\n if (typeof m.result_text === 'string') {\n record.resultText = m.result_text;\n }\n if (typeof m.started_at === 'number') {\n record.startedAt = m.started_at;\n }\n if (typeof m.ended_at === 'number') {\n record.endedAt = m.ended_at;\n }\n return record;\n}\n\n/**\n * Connects to an AgentM channels gateway (contrib/channels) as a\n * `chat_client` peer over WebSocket and exposes the conversation as\n * an `AgentChatValue` consumable by `<AgentPanel>` / `useAgentChat`.\n *\n * The client owns the round-trip: `send(content)` emits an `inbound`\n * envelope; `outbound` envelopes from the gateway become assistant\n * messages. Streamed responses (same `stream_id`) replace the same\n * message in place — contrib/channels sends cumulative content per\n * chunk, not deltas. Non-streamed outbounds become discrete messages.\n */\nexport function AgentmChannelProvider({\n channel,\n children,\n initialMessages,\n onStatusChange,\n mapOutbound,\n}: AgentmChannelProviderProps): ReactElement {\n const [messages, setMessages] = useState<AgentMessage[]>(\n () => initialMessages ?? [],\n );\n const [sending, setSending] = useState<boolean>(false);\n const [status, setStatus] = useState<ConnectionStatus>('idle');\n // Reset in render, not in an effect, so the new chat's first paint never\n // shows the previous chat's messages.\n const [chatId, setChatId] = useState(channel.chatId);\n if (channel.chatId !== chatId) {\n setChatId(channel.chatId);\n setMessages(initialMessages ?? []);\n setSending(false);\n }\n const clientRef = useRef<AgentmChannelClient | null>(null);\n // Maps stream_id → message id so we can append chunks to the same row.\n const streamMapRef = useRef<Map<string, string>>(new Map());\n\n const mapRef = useRef(mapOutbound);\n mapRef.current = mapOutbound;\n const onStatusRef = useRef(onStatusChange);\n onStatusRef.current = onStatusChange;\n const channelRef = useRef(channel);\n channelRef.current = channel;\n // Read through a ref, so a locale change neither reconnects nor gives\n // `send` a new identity.\n const strings = useStrings();\n const stringsRef = useRef(strings);\n stringsRef.current = strings;\n\n const channelKey = useMemo(\n () =>\n JSON.stringify({\n url: channel.url,\n peerId: channel.peerId,\n peerKind: channel.peerKind,\n token: channel.token,\n channel: channel.channel,\n chatId: channel.chatId,\n autoReconnect: channel.autoReconnect,\n }),\n [\n channel.url,\n channel.peerId,\n channel.peerKind,\n channel.token,\n channel.channel,\n channel.chatId,\n channel.autoReconnect,\n ],\n );\n\n useEffect(() => {\n const current = channelRef.current;\n const peerId =\n current.peerId ??\n getOrCreateStored(PEER_ID_KEY, () => uniqueId('peer'), 'session');\n const client = new AgentmChannelClient({ ...current, peerId });\n clientRef.current = client;\n\n const offStatus = client.onStatusChange((s) => {\n setStatus(s);\n // A reply cannot arrive on a dropped connection; free the composer.\n if (s !== 'connected') {\n setSending(false);\n }\n onStatusRef.current?.(s);\n });\n\n const offOutbound = client.onOutbound((env) => {\n const mapper = mapRef.current ?? defaultMapOutbound;\n const mapped = mapper(env);\n if (!mapped) {\n return;\n }\n setSending(false);\n // Stream bookkeeping stays out of the updater, which StrictMode runs\n // twice.\n const streams = streamMapRef.current;\n let id: string;\n if (mapped.streamId) {\n id = streams.get(mapped.streamId) ?? uniqueId('msg');\n if (mapped.final) {\n streams.delete(mapped.streamId);\n } else {\n streams.set(mapped.streamId, id);\n }\n } else {\n id = uniqueId('msg');\n }\n const message: AgentMessage = {\n id,\n role: mapped.role ?? 'assistant',\n content: mapped.content,\n timestamp: new Date().toISOString(),\n ...(mapped.toolCall ? { toolCall: mapped.toolCall } : {}),\n };\n setMessages((prev) => upsertMessage(prev, message));\n });\n\n const offError = client.onError((env) => {\n const body = env.body as { code?: unknown; message?: unknown };\n const code = typeof body.code === 'string' ? body.code : 'error';\n const detail =\n typeof body.message === 'string'\n ? body.message\n : stringsRef.current.agentmGatewayError;\n setSending(false);\n setMessages((prev) => [\n ...prev,\n {\n id: uniqueId('msg'),\n role: 'system',\n content: `[${code}] ${detail}`,\n timestamp: new Date().toISOString(),\n },\n ]);\n });\n\n client.connect().catch(() => {\n // surfaced via onError / status; nothing to do here.\n });\n\n const streamMap = streamMapRef.current;\n return () => {\n offStatus();\n offOutbound();\n offError();\n client.close();\n if (clientRef.current === client) {\n clientRef.current = null;\n }\n streamMap.clear();\n };\n // channelKey captures every input that affects the client identity;\n // the latest `channel` object is read via channelRef so a fresh\n // parent render with the same fields does not tear down the socket.\n }, [channelKey]);\n\n const send = useCallback((content: string): void => {\n const trimmed = content.trim();\n if (!trimmed) {\n return;\n }\n const client = clientRef.current;\n setMessages((prev) => [\n ...prev,\n {\n id: uniqueId('msg'),\n role: 'user',\n content: trimmed,\n timestamp: new Date().toISOString(),\n },\n ]);\n if (!client || client.connectionStatus !== 'connected') {\n setMessages((prev) => [\n ...prev,\n {\n id: uniqueId('msg'),\n role: 'system',\n content: stringsRef.current.agentmNotConnected,\n timestamp: new Date().toISOString(),\n },\n ]);\n return;\n }\n try {\n setSending(true);\n client.sendInbound(trimmed);\n } catch (err) {\n setSending(false);\n setMessages((prev) => [\n ...prev,\n {\n id: uniqueId('msg'),\n role: 'system',\n content: stringsRef.current.agentmSendFailed(\n err instanceof Error ? err.message : String(err),\n ),\n timestamp: new Date().toISOString(),\n },\n ]);\n }\n }, []);\n\n const clear = useCallback((): void => {\n streamMapRef.current.clear();\n setMessages([]);\n }, []);\n\n const value = useMemo<AgentChatValue & { status: ConnectionStatus }>(\n () => ({\n messages,\n sending,\n send,\n clear,\n status,\n }),\n [messages, sending, send, clear, status],\n );\n\n return <AgentChatProvider value={value}>{children}</AgentChatProvider>;\n}\n\n// contrib/channels sends cumulative content per stream_id (each chunk is\n// the full text so far, not a delta), so a later chunk replaces the row.\nfunction upsertMessage(\n prev: AgentMessage[],\n message: AgentMessage,\n): AgentMessage[] {\n if (!prev.some((m) => m.id === message.id)) {\n return [...prev, message];\n }\n return prev.map((m) =>\n m.id === message.id\n ? {\n ...m,\n content: message.content,\n ...(message.toolCall ? { toolCall: message.toolCall } : {}),\n }\n : m,\n );\n}\n"],"names":["PEER_ID_KEY","defaultMapOutbound","env","body","streamId","toolCall","parseToolCall","metadata","m","toolCallId","name","status","normalizedStatus","record","AgentmChannelProvider","channel","children","initialMessages","onStatusChange","mapOutbound","messages","setMessages","useState","sending","setSending","setStatus","chatId","setChatId","clientRef","useRef","streamMapRef","mapRef","onStatusRef","channelRef","strings","useStrings","stringsRef","channelKey","useMemo","useEffect","current","peerId","getOrCreateStored","uniqueId","client","AgentmChannelClient","offStatus","s","offOutbound","mapped","streams","id","message","prev","upsertMessage","offError","code","detail","streamMap","send","useCallback","content","trimmed","err","clear","value","jsx","AgentChatProvider"],"mappings":"6UA0DMA,EAAc,sBAEpB,SAASC,EAAmBC,EAAsC,CAChE,MAAMC,EAAOD,EAAI,KAOXE,EAAW,OAAOD,EAAK,WAAc,SAAWA,EAAK,UAAY,KACvE,GAAIA,EAAK,OAAS,YAAa,CAC7B,MAAME,EAAWC,EAAcH,EAAK,QAAQ,EAC5C,OAAKE,EAGE,CACL,KAAM,OACN,QAAS,GACT,SAAAD,EACA,MAAOD,EAAK,QAAU,GACtB,SAAAE,CAAA,EAPO,IASX,CACA,OAAI,OAAOF,EAAK,SAAY,SACnB,KAEF,CACL,QAASA,EAAK,QACd,MAAOA,EAAK,QAAU,GACtB,SAAAC,CAAA,CAEJ,CAEA,SAASE,EAAc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