@axiom-lattice/gateway 10.3.0 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/dist/{A2AAuthService-UKN53ZGP.mjs → A2AAuthService-UYWSDE5L.mjs} +2 -2
  2. package/dist/{a2a-YLKZE5JG.mjs → a2a-OCCSVNWB.mjs} +3 -3
  3. package/dist/{a2a-standard-ELY7MTJB.mjs → a2a-standard-2IJP4JG5.mjs} +2 -2
  4. package/dist/{chunk-BIMO2ILH.mjs → chunk-5EXTBV2Z.mjs} +6 -3
  5. package/dist/chunk-5EXTBV2Z.mjs.map +1 -0
  6. package/dist/{chunk-JGQURU44.mjs → chunk-6DTR3CPW.mjs} +2 -2
  7. package/dist/chunk-6DTR3CPW.mjs.map +1 -0
  8. package/dist/{chunk-BOPNXTMO.mjs → chunk-7XTRBDCF.mjs} +2 -2
  9. package/dist/{chunk-MFWTGNQR.mjs → chunk-HBDRSIPK.mjs} +1 -1
  10. package/dist/chunk-HBDRSIPK.mjs.map +1 -0
  11. package/dist/{chunk-YR32MWEJ.mjs → chunk-JQWIJDZN.mjs} +2 -2
  12. package/dist/{chunk-LCM4OQTI.mjs → chunk-NQS3U4KP.mjs} +23 -1
  13. package/dist/chunk-NQS3U4KP.mjs.map +1 -0
  14. package/dist/{chunk-NYYSBNDG.mjs → chunk-Q5ADRJ3T.mjs} +2 -2
  15. package/dist/{chunk-7CG57LEF.mjs → chunk-WKHTSTB6.mjs} +2 -2
  16. package/dist/chunk-WKHTSTB6.mjs.map +1 -0
  17. package/dist/embed/agent-chat-loader.js +1 -1
  18. package/dist/embed/embed-page-AgentDetailSideApp-CQEMTLCM.js +1 -0
  19. package/dist/embed/embed-page-AgentGovernanceWorkbench-MFE7A3HX.js +1 -0
  20. package/dist/embed/{embed-page-LangfuseDashboard-C5ZHCYOD.js → embed-page-LangfuseDashboard-FXNWREGX.js} +1 -1
  21. package/dist/embed/embed-page-MessageGraph-2KRSGTMR.js +6 -0
  22. package/dist/embed/embed-page-ReactChart-BFMFGXXT.js +1 -0
  23. package/dist/embed/{embed-page-SkillFlow-4WN6SBBR.js → embed-page-SkillFlow-F24RIIPR.js} +1 -1
  24. package/dist/embed/{embed-page-TasksSideApp-JWXHAGJ3.js → embed-page-TasksSideApp-EKOC6GR5.js} +1 -1
  25. package/dist/embed/{embed-page-ThreadMaintenancePanel-BIPYRPG7.js → embed-page-ThreadMaintenancePanel-25HFF6LC.js} +1 -1
  26. package/dist/embed/embed-page-TopologyRuntimeView-AZ56RJ3H.js +6 -0
  27. package/dist/embed/{embed-page-WorkflowAutomationView-5Z5LIL2H.js → embed-page-WorkflowAutomationView-TZR47MHE.js} +1 -1
  28. package/dist/embed/{embed-page-abnfDiagram-N423BO3Z-G35TGDL3.js → embed-page-abnfDiagram-N423BO3Z-4HBLZWO7.js} +1 -1
  29. package/dist/embed/{embed-page-architectureDiagram-T3A2C74G-3BPO7RRI.js → embed-page-architectureDiagram-T3A2C74G-ZMH2RUZR.js} +1 -1
  30. package/dist/embed/{embed-page-blockDiagram-VBNYF7ZC-4IOAZLE3.js → embed-page-blockDiagram-VBNYF7ZC-DOS6CKB7.js} +1 -1
  31. package/dist/embed/{embed-page-c4Diagram-5PPSVZJV-7FVWUUL4.js → embed-page-c4Diagram-5PPSVZJV-GCQQWQJ4.js} +1 -1
  32. package/dist/embed/{embed-page-chunk-OJORJR7X.js → embed-page-chunk-43ZJCYNA.js} +1 -1
  33. package/dist/embed/{embed-page-chunk-B4EAWKYT.js → embed-page-chunk-5VJZ7DJM.js} +1 -1
  34. package/dist/embed/{embed-page-chunk-Z4KLLEUH.js → embed-page-chunk-5ZRWN6T7.js} +1 -1
  35. package/dist/embed/{embed-page-chunk-D4ICPD5X.js → embed-page-chunk-7IPWMDQ3.js} +1 -1
  36. package/dist/embed/embed-page-chunk-CWVHIM56.js +69 -0
  37. package/dist/embed/embed-page-chunk-DLSQ2OWQ.js +1 -0
  38. package/dist/embed/{embed-page-chunk-3MT44IAN.js → embed-page-chunk-FPA5BD6K.js} +1 -1
  39. package/dist/embed/{embed-page-chunk-EP6TRRST.js → embed-page-chunk-FUNZXEPN.js} +1 -1
  40. package/dist/embed/{embed-page-chunk-KOCOGP7G.js → embed-page-chunk-GA5A7NLC.js} +1 -1
  41. package/dist/embed/{embed-page-chunk-EZBBN23V.js → embed-page-chunk-GWB56NNU.js} +1 -1
  42. package/dist/embed/{embed-page-chunk-DVOV6TZI.js → embed-page-chunk-I7EMCZI6.js} +1 -1
  43. package/dist/embed/{embed-page-chunk-X2ALKNHQ.js → embed-page-chunk-JAZH5PLN.js} +1 -1
  44. package/dist/embed/{embed-page-chunk-IK542MPZ.js → embed-page-chunk-ME637LUU.js} +1 -1
  45. package/dist/embed/{embed-page-chunk-I7ESIG2O.js → embed-page-chunk-MM3IA4HE.js} +1 -1
  46. package/dist/embed/{embed-page-chunk-YUWPQRVF.js → embed-page-chunk-NY2J2ZAX.js} +1 -1
  47. package/dist/embed/{embed-page-chunk-PNJ7DZ5V.js → embed-page-chunk-QQZUP2A4.js} +1 -1
  48. package/dist/embed/{embed-page-chunk-XWR7WUUN.js → embed-page-chunk-RPGUOUD3.js} +1 -1
  49. package/dist/embed/embed-page-chunk-S2G53SSD.js +217 -0
  50. package/dist/embed/{embed-page-chunk-NUKT6SH3.js → embed-page-chunk-S2XGVDY7.js} +1 -1
  51. package/dist/embed/{embed-page-chunk-JRORGMGI.js → embed-page-chunk-TJMEWCV7.js} +147 -147
  52. package/dist/embed/{embed-page-chunk-7E2Z7TAR.js → embed-page-chunk-U6PURUXV.js} +1 -1
  53. package/dist/embed/{embed-page-chunk-LKNA7XLR.js → embed-page-chunk-UAXOXJ4N.js} +1 -1
  54. package/dist/embed/{embed-page-chunk-CV2LFQZA.js → embed-page-chunk-UWC5QL3B.js} +1 -1
  55. package/dist/embed/{embed-page-chunk-CJYKMTD7.js → embed-page-chunk-V3HPWIF4.js} +1 -1
  56. package/dist/embed/{embed-page-chunk-JAHIW5IQ.js → embed-page-chunk-W4W6GR5T.js} +1 -1
  57. package/dist/embed/{embed-page-chunk-JAMKPUN7.js → embed-page-chunk-X2TOGOMH.js} +1 -1
  58. package/dist/embed/{embed-page-chunk-BL44I3VR.js → embed-page-chunk-XP37R2JT.js} +6 -6
  59. package/dist/embed/{embed-page-chunk-UVNC53TL.js → embed-page-chunk-YGBGMNRQ.js} +1 -1
  60. package/dist/embed/{embed-page-chunk-2EHKMAOV.js → embed-page-chunk-YI3NKQSA.js} +1 -1
  61. package/dist/embed/embed-page-classDiagram-JCYQIIEL-QS7YU54N.js +1 -0
  62. package/dist/embed/embed-page-classDiagram-v2-OCEON4UE-EMQVQCCM.js +1 -0
  63. package/dist/embed/{embed-page-cynefinDiagram-MW4NZA55-3QBH5TCJ.js → embed-page-cynefinDiagram-MW4NZA55-PAQOPJV2.js} +1 -1
  64. package/dist/embed/{embed-page-dagre-VZM6K2ZE-JB3F5OD3.js → embed-page-dagre-VZM6K2ZE-35URH6ZO.js} +1 -1
  65. package/dist/embed/{embed-page-diagram-7IWD3JNH-33KTKPAG.js → embed-page-diagram-7IWD3JNH-CYEWFX2M.js} +1 -1
  66. package/dist/embed/{embed-page-diagram-B4RE2ZJO-HURI4UTY.js → embed-page-diagram-B4RE2ZJO-YQLA7HKI.js} +1 -1
  67. package/dist/embed/{embed-page-diagram-LBJQPF4R-XDFU7A3K.js → embed-page-diagram-LBJQPF4R-R5X23WLT.js} +1 -1
  68. package/dist/embed/{embed-page-diagram-Q27KOJAE-WCF3Y7MH.js → embed-page-diagram-Q27KOJAE-CSOUXGQI.js} +1 -1
  69. package/dist/embed/{embed-page-diagram-UB23O5K3-A4XJCZZ2.js → embed-page-diagram-UB23O5K3-ZYKI7DKR.js} +1 -1
  70. package/dist/embed/{embed-page-ebnfDiagram-BXEA7PRR-XZ65TQZ5.js → embed-page-ebnfDiagram-BXEA7PRR-AXHHSO6J.js} +1 -1
  71. package/dist/embed/embed-page-echarts-AD736F33.js +1 -0
  72. package/dist/embed/{embed-page-en-PPUKY32O.js → embed-page-en-BRZZWMIP.js} +1 -1
  73. package/dist/embed/{embed-page-en-3DNM36A2.js → embed-page-en-RKPA6NPQ.js} +3 -1
  74. package/dist/embed/{embed-page-erDiagram-JOGREHBK-HAMRJORU.js → embed-page-erDiagram-JOGREHBK-TIWNY54V.js} +1 -1
  75. package/dist/embed/embed-page-flowDiagram-UKHOOZJN-YZBV5FD5.js +1 -0
  76. package/dist/embed/{embed-page-ganttDiagram-PKOTCBZU-K5INERM6.js → embed-page-ganttDiagram-PKOTCBZU-LQ65QV2D.js} +1 -1
  77. package/dist/embed/{embed-page-gitGraphDiagram-DS77QQ5N-GZ5MSQH3.js → embed-page-gitGraphDiagram-DS77QQ5N-JXOCEBS4.js} +1 -1
  78. package/dist/embed/{embed-page-infoDiagram-6WML65LV-U6G3NNSP.js → embed-page-infoDiagram-6WML65LV-JXXYLFOE.js} +1 -1
  79. package/dist/embed/{embed-page-ishikawaDiagram-WSZJBQD7-EYGGRQN3.js → embed-page-ishikawaDiagram-WSZJBQD7-AXPRA54P.js} +1 -1
  80. package/dist/embed/{embed-page-journeyDiagram-NVQOT4AX-XS4LDJC3.js → embed-page-journeyDiagram-NVQOT4AX-FLTEDSGP.js} +1 -1
  81. package/dist/embed/{embed-page-jspdf.es.min-XOYWIBVE.js → embed-page-jspdf.es.min-Y4RIBUHC.js} +17 -17
  82. package/dist/embed/{embed-page-kanban-definition-27J2QSJJ-FW7UGXYI.js → embed-page-kanban-definition-27J2QSJJ-GLES277J.js} +1 -1
  83. package/dist/embed/embed-page-katex-JBKN2BFH.js +257 -0
  84. package/dist/embed/{embed-page-mermaid-AQNL2ZVI.js → embed-page-mermaid-TRGRXQWI.js} +2 -2
  85. package/dist/embed/embed-page-mindmap-definition-FAOFIHXS-IK7SJKOY.js +96 -0
  86. package/dist/embed/{embed-page-pegDiagram-VL7TDLO6-KNUT3CIR.js → embed-page-pegDiagram-VL7TDLO6-WTW3QO5Z.js} +1 -1
  87. package/dist/embed/{embed-page-pieDiagram-7S7Q4E2Y-NA5D6ASE.js → embed-page-pieDiagram-7S7Q4E2Y-IO7RF3AF.js} +1 -1
  88. package/dist/embed/{embed-page-quadrantDiagram-CIZ2JOQS-ZP6CLE62.js → embed-page-quadrantDiagram-CIZ2JOQS-77SBD3YG.js} +1 -1
  89. package/dist/embed/{embed-page-railroadDiagram-AXF67PYL-2IW2UZXA.js → embed-page-railroadDiagram-AXF67PYL-OW3L5JI4.js} +1 -1
  90. package/dist/embed/{embed-page-requirementDiagram-LRYGKXZP-CXPDAY5Y.js → embed-page-requirementDiagram-LRYGKXZP-APMTCGOA.js} +1 -1
  91. package/dist/embed/{embed-page-sankeyDiagram-W5VNT64P-F2LGR2H3.js → embed-page-sankeyDiagram-W5VNT64P-FZX3QVUX.js} +1 -1
  92. package/dist/embed/{embed-page-sequenceDiagram-SI44F4Z6-GJMWRLXS.js → embed-page-sequenceDiagram-SI44F4Z6-HGLMDT4H.js} +1 -1
  93. package/dist/embed/{embed-page-stateDiagram-OKZ733FA-2C3LJEVN.js → embed-page-stateDiagram-OKZ733FA-DYGG6K57.js} +1 -1
  94. package/dist/embed/embed-page-stateDiagram-v2-UEYNNEHI-BZIFN7WW.js +1 -0
  95. package/dist/embed/{embed-page-swimlanes-SLNWSIFB-FVZEOHUB.js → embed-page-swimlanes-SLNWSIFB-OKHSRANK.js} +1 -1
  96. package/dist/embed/embed-page-swimlanesDiagram-ULZ7WXOC-CTOAIWO4.js +8 -0
  97. package/dist/embed/{embed-page-timeline-definition-Z64GVDOM-G7N7WGUT.js → embed-page-timeline-definition-Z64GVDOM-F6LUVHOK.js} +1 -1
  98. package/dist/embed/{embed-page-vennDiagram-T6HMQDX7-F7T3NLBE.js → embed-page-vennDiagram-T6HMQDX7-QA2TWRL4.js} +1 -1
  99. package/dist/embed/{embed-page-wardleyDiagram-T6FBY63Y-KQ66EZSM.js → embed-page-wardleyDiagram-T6FBY63Y-DL57P2VA.js} +1 -1
  100. package/dist/embed/{embed-page-xychartDiagram-ELKLHX3M-22WT4PGT.js → embed-page-xychartDiagram-ELKLHX3M-V2Q7NF4U.js} +1 -1
  101. package/dist/embed/{embed-page-zh-4SFTLL5M.js → embed-page-zh-D4S5EDEI.js} +1 -1
  102. package/dist/embed/{embed-page-zh-OA54TF5G.js → embed-page-zh-LQCDXDUF.js} +3 -1
  103. package/dist/embed/embed-page.js +3 -3
  104. package/dist/embed/mcp-app-page.js +19 -19
  105. package/dist/index.js +2130 -1445
  106. package/dist/index.js.map +1 -1
  107. package/dist/index.mjs +1195 -318
  108. package/dist/index.mjs.map +1 -1
  109. package/dist/{mcp-apps-MZECSNN2.mjs → mcp-apps-MKHHUJE4.mjs} +2 -2
  110. package/dist/{open-Y7PAA2VJ.mjs → open-TJLQARLV.mjs} +8 -8
  111. package/dist/open-TJLQARLV.mjs.map +1 -0
  112. package/dist/{open-catalog-NVGP6SQP.mjs → open-catalog-LLTMSZGH.mjs} +2 -2
  113. package/dist/{open-exposure-HGYT5VFC.mjs → open-exposure-2CSXJTM3.mjs} +3 -3
  114. package/dist/{open-files-WK4SQHE3.mjs → open-files-QIMOTHSN.mjs} +2 -2
  115. package/dist/{open-session-CLZT3HVG.mjs → open-session-F5H6PFSN.mjs} +3 -3
  116. package/dist/open-session-F5H6PFSN.mjs.map +1 -0
  117. package/dist/{openLattice-D5YTSZBY.mjs → openLattice-KFUREFWM.mjs} +2 -2
  118. package/dist/{registerExposedPlugins-2JGXSMAL.mjs → registerExposedPlugins-N6ENBBKN.mjs} +3 -3
  119. package/dist/{resources-YD5DOPGD.mjs → resources-53PXMFQI.mjs} +37 -12
  120. package/dist/resources-53PXMFQI.mjs.map +1 -0
  121. package/dist/{sandboxOpenCredentialProvider-RTYOYRCT.mjs → sandboxOpenCredentialProvider-3CUISBEL.mjs} +4 -4
  122. package/dist/sandboxOpenCredentialProvider-3CUISBEL.mjs.map +1 -0
  123. package/package.json +10 -11
  124. package/dist/chunk-7CG57LEF.mjs.map +0 -1
  125. package/dist/chunk-BIMO2ILH.mjs.map +0 -1
  126. package/dist/chunk-JGQURU44.mjs.map +0 -1
  127. package/dist/chunk-LCM4OQTI.mjs.map +0 -1
  128. package/dist/chunk-MFWTGNQR.mjs.map +0 -1
  129. package/dist/chunk-PWHUWFXL.mjs +0 -173
  130. package/dist/chunk-PWHUWFXL.mjs.map +0 -1
  131. package/dist/collection_service-RTRJEQFL.mjs +0 -8
  132. package/dist/embed/embed-page-AgentDetailSideApp-7KV3SLDR.js +0 -1
  133. package/dist/embed/embed-page-AgentGovernanceWorkbench-SVXBIDD2.js +0 -1
  134. package/dist/embed/embed-page-MessageGraph-YU76I7TO.js +0 -6
  135. package/dist/embed/embed-page-ReactChart-KN2C7M65.js +0 -1
  136. package/dist/embed/embed-page-TopologyRuntimeView-FPLRJ3NO.js +0 -6
  137. package/dist/embed/embed-page-chunk-NXYALHX3.js +0 -69
  138. package/dist/embed/embed-page-chunk-YJQVMCUN.js +0 -217
  139. package/dist/embed/embed-page-classDiagram-JCYQIIEL-F3ZGV5RH.js +0 -1
  140. package/dist/embed/embed-page-classDiagram-v2-OCEON4UE-WK33F7MR.js +0 -1
  141. package/dist/embed/embed-page-echarts-EYVCOS2L.js +0 -1
  142. package/dist/embed/embed-page-flowDiagram-UKHOOZJN-FCTARXK6.js +0 -1
  143. package/dist/embed/embed-page-katex-W5DMKJAE.js +0 -257
  144. package/dist/embed/embed-page-mindmap-definition-FAOFIHXS-LS6BVRC5.js +0 -96
  145. package/dist/embed/embed-page-stateDiagram-v2-UEYNNEHI-QI633DEL.js +0 -1
  146. package/dist/embed/embed-page-swimlanesDiagram-ULZ7WXOC-7W6HH2PU.js +0 -8
  147. package/dist/kbProvider-2D6DZ34N.mjs +0 -50
  148. package/dist/kbProvider-2D6DZ34N.mjs.map +0 -1
  149. package/dist/open-Y7PAA2VJ.mjs.map +0 -1
  150. package/dist/open-session-CLZT3HVG.mjs.map +0 -1
  151. package/dist/registerExposedPlugins-2JGXSMAL.mjs.map +0 -1
  152. package/dist/resources-YD5DOPGD.mjs.map +0 -1
  153. package/dist/sandboxOpenCredentialProvider-RTYOYRCT.mjs.map +0 -1
  154. /package/dist/{A2AAuthService-UKN53ZGP.mjs.map → A2AAuthService-UYWSDE5L.mjs.map} +0 -0
  155. /package/dist/{a2a-YLKZE5JG.mjs.map → a2a-OCCSVNWB.mjs.map} +0 -0
  156. /package/dist/{a2a-standard-ELY7MTJB.mjs.map → a2a-standard-2IJP4JG5.mjs.map} +0 -0
  157. /package/dist/{chunk-BOPNXTMO.mjs.map → chunk-7XTRBDCF.mjs.map} +0 -0
  158. /package/dist/{chunk-YR32MWEJ.mjs.map → chunk-JQWIJDZN.mjs.map} +0 -0
  159. /package/dist/{chunk-NYYSBNDG.mjs.map → chunk-Q5ADRJ3T.mjs.map} +0 -0
  160. /package/dist/{collection_service-RTRJEQFL.mjs.map → mcp-apps-MKHHUJE4.mjs.map} +0 -0
  161. /package/dist/{open-catalog-NVGP6SQP.mjs.map → open-catalog-LLTMSZGH.mjs.map} +0 -0
  162. /package/dist/{open-exposure-HGYT5VFC.mjs.map → open-exposure-2CSXJTM3.mjs.map} +0 -0
  163. /package/dist/{open-files-WK4SQHE3.mjs.map → open-files-QIMOTHSN.mjs.map} +0 -0
  164. /package/dist/{mcp-apps-MZECSNN2.mjs.map → openLattice-KFUREFWM.mjs.map} +0 -0
  165. /package/dist/{openLattice-D5YTSZBY.mjs.map → registerExposedPlugins-N6ENBBKN.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -1,14 +1,11 @@
1
1
  import {
2
2
  invalidateAgentReflectionCache
3
- } from "./chunk-YR32MWEJ.mjs";
3
+ } from "./chunk-JQWIJDZN.mjs";
4
4
  import {
5
5
  getContentTypeFromFilename,
6
6
  getFilenameFromPath,
7
7
  sendBufferWithRange
8
8
  } from "./chunk-EMYRCJOI.mjs";
9
- import {
10
- createRecoveryCallerDeps
11
- } from "./chunk-NOXGKYUV.mjs";
12
9
  import {
13
10
  Logger,
14
11
  getQrCode,
@@ -47,11 +44,8 @@ import {
47
44
  } from "./chunk-P4JEGK74.mjs";
48
45
  import {
49
46
  buildPreviewTokenScript
50
- } from "./chunk-7CG57LEF.mjs";
47
+ } from "./chunk-WKHTSTB6.mjs";
51
48
  import "./chunk-EXPERMZR.mjs";
52
- import {
53
- CollectionService
54
- } from "./chunk-PWHUWFXL.mjs";
55
49
  import {
56
50
  A2A_KEY_CHANGED_TOPIC,
57
51
  ProjectAccessService,
@@ -60,19 +54,19 @@ import {
60
54
  publishA2AKeyChanged,
61
55
  refreshStoreKeyMap,
62
56
  setA2AProjectAccess
63
- } from "./chunk-NYYSBNDG.mjs";
57
+ } from "./chunk-Q5ADRJ3T.mjs";
64
58
  import {
65
59
  A2AAuthService,
66
60
  parseEnvKeys
67
- } from "./chunk-LCM4OQTI.mjs";
61
+ } from "./chunk-NQS3U4KP.mjs";
68
62
  import {
69
63
  getMcpUiResourceResolver,
70
64
  listTenantPlugins,
71
65
  registerMcpAppRoutes,
72
66
  resolveTenantPluginByType
73
- } from "./chunk-BIMO2ILH.mjs";
67
+ } from "./chunk-5EXTBV2Z.mjs";
74
68
  import "./chunk-XUWD4VKY.mjs";
75
- import "./chunk-MFWTGNQR.mjs";
69
+ import "./chunk-HBDRSIPK.mjs";
76
70
  import {
77
71
  createOrphanRecoveryRuntime,
78
72
  createTaskRunLiveness,
@@ -84,6 +78,9 @@ import {
84
78
  resolveTopCaller,
85
79
  runOrphanRecovery
86
80
  } from "./chunk-NZXKECNN.mjs";
81
+ import {
82
+ createRecoveryCallerDeps
83
+ } from "./chunk-NOXGKYUV.mjs";
87
84
  import "./chunk-NFEGQTCC.mjs";
88
85
 
89
86
  // src/index.ts
@@ -2368,6 +2365,7 @@ function rejectProtectedTenantScope(request, reply) {
2368
2365
  }
2369
2366
  async function rejectProtectedTenantScopeUnlessPlatformRoute(request, reply) {
2370
2367
  if (await allowsPlatformScopeRoute(request)) return false;
2368
+ if (await allowsPlatformOpsMcpAppRequest(request)) return false;
2371
2369
  return rejectProtectedTenantScope(request, reply);
2372
2370
  }
2373
2371
  async function platformTenantPlaneGuard(request, reply) {
@@ -2389,6 +2387,41 @@ function isPlatformScopeRoutePath(path5) {
2389
2387
  async function allowsPlatformScopeRoute(request) {
2390
2388
  const path5 = (typeof request.url === "string" ? request.url : "").split("?", 1)[0];
2391
2389
  if (!path5 || !isPlatformScopeRoutePath(path5)) return false;
2390
+ return hasLivePlatformRole(request);
2391
+ }
2392
+ var PLATFORM_OPS_MCP_APP_PATHS = /* @__PURE__ */ new Set([
2393
+ "/api/mcp-apps/resource",
2394
+ "/api/mcp-apps/rpc"
2395
+ ]);
2396
+ var PLATFORM_OPS_PLUGIN_TYPE = "platform-ops";
2397
+ function readMcpAppRef(body) {
2398
+ let parsed = body;
2399
+ if (typeof parsed === "string") {
2400
+ try {
2401
+ parsed = JSON.parse(parsed);
2402
+ } catch {
2403
+ return void 0;
2404
+ }
2405
+ }
2406
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
2407
+ return void 0;
2408
+ }
2409
+ const ref = parsed.ref;
2410
+ if (ref === null || typeof ref !== "object" || Array.isArray(ref)) {
2411
+ return void 0;
2412
+ }
2413
+ return ref;
2414
+ }
2415
+ async function allowsPlatformOpsMcpAppRequest(request) {
2416
+ const path5 = (typeof request.url === "string" ? request.url : "").split("?", 1)[0];
2417
+ if (!PLATFORM_OPS_MCP_APP_PATHS.has(path5)) return false;
2418
+ const ref = readMcpAppRef(request.body);
2419
+ if (!ref || ref.kind !== "plugin" || ref.pluginType !== PLATFORM_OPS_PLUGIN_TYPE) {
2420
+ return false;
2421
+ }
2422
+ return hasLivePlatformRole(request);
2423
+ }
2424
+ async function hasLivePlatformRole(request) {
2392
2425
  const user = request.user;
2393
2426
  if (typeof user?.id !== "string" || user.tenantId !== PLATFORM_TENANT_ID) {
2394
2427
  return false;
@@ -2412,6 +2445,7 @@ async function platformTenantGlobalGuard(request, reply) {
2412
2445
  return;
2413
2446
  }
2414
2447
  if (await allowsPlatformScopeRoute(request)) return;
2448
+ if (await allowsPlatformOpsMcpAppRequest(request)) return;
2415
2449
  rejectProtectedTenantScope(request, reply);
2416
2450
  }
2417
2451
 
@@ -9220,6 +9254,277 @@ async function filterSkillsByLicense(request, reply) {
9220
9254
  }
9221
9255
  }
9222
9256
 
9257
+ // src/services/collection_service.ts
9258
+ import { v4 as uuidv4 } from "uuid";
9259
+ import { Document } from "@langchain/core/documents";
9260
+ import {
9261
+ collectionLatticeManager,
9262
+ embeddingsLatticeManager,
9263
+ getOrCreateCollectionVectorStore,
9264
+ getCollectionEntryCount,
9265
+ listCollectionEntries,
9266
+ removeCollectionVectorStore,
9267
+ deleteCollectionEntryIds
9268
+ } from "@axiom-lattice/core";
9269
+
9270
+ // src/services/collection_entry_batch.ts
9271
+ import { COLLECTION_ENTRY_BATCH_MAX } from "@axiom-lattice/protocols";
9272
+ function isRecord8(value) {
9273
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9274
+ }
9275
+ function validateCollectionEntryBatch(entries) {
9276
+ if (!Array.isArray(entries) || entries.length < 1 || entries.length > COLLECTION_ENTRY_BATCH_MAX) {
9277
+ return `entries must contain between 1 and ${COLLECTION_ENTRY_BATCH_MAX} items`;
9278
+ }
9279
+ if (entries.some(
9280
+ (entry) => !isRecord8(entry) || typeof entry.content !== "string" || entry.content.trim() === ""
9281
+ )) {
9282
+ return "each entry requires non-empty content";
9283
+ }
9284
+ if (entries.some((entry) => entry.metadata !== void 0 && !isRecord8(entry.metadata))) {
9285
+ return "entry metadata must be an object";
9286
+ }
9287
+ return null;
9288
+ }
9289
+ function validateCollectionEntryDeleteBatch(entryIds) {
9290
+ if (!Array.isArray(entryIds) || entryIds.length < 1 || entryIds.length > COLLECTION_ENTRY_BATCH_MAX) {
9291
+ return `entryIds must contain between 1 and ${COLLECTION_ENTRY_BATCH_MAX} items`;
9292
+ }
9293
+ if (entryIds.some(
9294
+ (entryId) => typeof entryId !== "string" || entryId.trim() === ""
9295
+ )) {
9296
+ return "each entry id must be a non-empty string";
9297
+ }
9298
+ return null;
9299
+ }
9300
+
9301
+ // src/services/collection_service.ts
9302
+ function getTenantId14(request) {
9303
+ return request.user?.tenantId || request.headers["x-tenant-id"] || "default";
9304
+ }
9305
+ var CollectionService = class {
9306
+ // ─── Collection CRUD ──────────────────────────────────────────
9307
+ async getAllCollections(request) {
9308
+ const tenantId = getTenantId14(request);
9309
+ const collections = await collectionLatticeManager.getAllCollections(tenantId);
9310
+ for (const c2 of collections) {
9311
+ try {
9312
+ c2._entryCount = await getCollectionEntryCount(c2.name, c2.embeddingKey, c2.tenantId);
9313
+ } catch {
9314
+ c2._entryCount = 0;
9315
+ }
9316
+ }
9317
+ return collections;
9318
+ }
9319
+ async getCollectionByName(request, name) {
9320
+ const tenantId = getTenantId14(request);
9321
+ return collectionLatticeManager.getCollection(tenantId, name);
9322
+ }
9323
+ async createCollection(request, data) {
9324
+ const tenantId = getTenantId14(request);
9325
+ const collection = await collectionLatticeManager.registerCollection(tenantId, data);
9326
+ try {
9327
+ await getOrCreateCollectionVectorStore(data.name, data.embeddingKey, tenantId);
9328
+ } catch (err) {
9329
+ console.warn(`[CollectionService] Failed to init vector store for ${data.name}:`, err);
9330
+ }
9331
+ return collection;
9332
+ }
9333
+ async updateCollection(request, name, updates) {
9334
+ const tenantId = getTenantId14(request);
9335
+ return collectionLatticeManager.updateCollection(tenantId, name, updates);
9336
+ }
9337
+ async deleteCollection(request, name) {
9338
+ const tenantId = getTenantId14(request);
9339
+ const removed = await collectionLatticeManager.removeCollection(tenantId, name);
9340
+ if (!removed) return false;
9341
+ await removeCollectionVectorStore(name, tenantId);
9342
+ return true;
9343
+ }
9344
+ // ─── Entry CRUD ───────────────────────────────────────────────
9345
+ async getEntries(request, collectionName) {
9346
+ const collection = await this.getCollectionByName(request, collectionName);
9347
+ if (!collection) throw new Error(`Collection "${collectionName}" not found`);
9348
+ const docs = await listCollectionEntries(collectionName, collection.embeddingKey, collection.tenantId);
9349
+ return docs.map((doc) => ({
9350
+ id: doc.metadata._id || "",
9351
+ content: doc.pageContent,
9352
+ metadata: Object.fromEntries(
9353
+ Object.entries(doc.metadata).filter(([k]) => !k.startsWith("_"))
9354
+ )
9355
+ }));
9356
+ }
9357
+ async createEntry(request, collectionName, data) {
9358
+ const collection = await this.getCollectionByName(request, collectionName);
9359
+ if (!collection) throw new Error(`Collection "${collectionName}" not found`);
9360
+ const vectorStore = await getOrCreateCollectionVectorStore(
9361
+ collectionName,
9362
+ collection.embeddingKey,
9363
+ collection.tenantId
9364
+ );
9365
+ const entryId = uuidv4();
9366
+ const now = (/* @__PURE__ */ new Date()).toISOString();
9367
+ const doc = new Document({
9368
+ pageContent: data.content,
9369
+ metadata: {
9370
+ ...data.metadata || {},
9371
+ _id: entryId,
9372
+ _created_at: now,
9373
+ _updated_at: now
9374
+ }
9375
+ });
9376
+ await vectorStore.addDocuments([doc]);
9377
+ return {
9378
+ id: entryId,
9379
+ content: data.content,
9380
+ metadata: Object.fromEntries(
9381
+ Object.entries(data.metadata || {}).filter(([key]) => !key.startsWith("_"))
9382
+ )
9383
+ };
9384
+ }
9385
+ async createEntries(request, collectionName, data) {
9386
+ const validationError = validateCollectionEntryBatch(data.entries);
9387
+ if (validationError) throw new Error(validationError);
9388
+ const collection = await this.getCollectionByName(request, collectionName);
9389
+ if (!collection) throw new Error(`Collection "${collectionName}" not found`);
9390
+ const vectorStore = await getOrCreateCollectionVectorStore(
9391
+ collectionName,
9392
+ collection.embeddingKey,
9393
+ collection.tenantId
9394
+ );
9395
+ const documents = data.entries.map((entry) => {
9396
+ const entryId = uuidv4();
9397
+ return {
9398
+ entry,
9399
+ entryId,
9400
+ document: new Document({
9401
+ pageContent: entry.content,
9402
+ metadata: {
9403
+ ...entry.metadata || {},
9404
+ _id: entryId,
9405
+ _created_at: (/* @__PURE__ */ new Date()).toISOString()
9406
+ }
9407
+ })
9408
+ };
9409
+ });
9410
+ await vectorStore.addDocuments(documents.map((item) => item.document));
9411
+ return documents.map(({ entry, entryId }) => ({
9412
+ id: entryId,
9413
+ content: entry.content,
9414
+ metadata: Object.fromEntries(
9415
+ Object.entries(entry.metadata || {}).filter(([key]) => !key.startsWith("_"))
9416
+ )
9417
+ }));
9418
+ }
9419
+ async getEntry(request, collectionName, entryId) {
9420
+ const collection = await this.getCollectionByName(request, collectionName);
9421
+ if (!collection) throw new Error(`Collection "${collectionName}" not found`);
9422
+ const docs = await listCollectionEntries(collectionName, collection.embeddingKey, collection.tenantId);
9423
+ const doc = docs.find((d) => d.metadata._id === entryId);
9424
+ if (!doc) return null;
9425
+ return {
9426
+ id: entryId,
9427
+ content: doc.pageContent,
9428
+ metadata: Object.fromEntries(
9429
+ Object.entries(doc.metadata).filter(([k]) => !k.startsWith("_"))
9430
+ )
9431
+ };
9432
+ }
9433
+ async updateEntry(request, collectionName, entryId, data) {
9434
+ const existing = await this.getEntry(request, collectionName, entryId);
9435
+ if (!existing) return null;
9436
+ const collection = await this.getCollectionByName(request, collectionName);
9437
+ if (!collection) throw new Error(`Collection "${collectionName}" not found`);
9438
+ const vectorStore = await getOrCreateCollectionVectorStore(
9439
+ collectionName,
9440
+ collection.embeddingKey,
9441
+ collection.tenantId
9442
+ );
9443
+ await vectorStore.delete({ filter: { _id: entryId } });
9444
+ const now = (/* @__PURE__ */ new Date()).toISOString();
9445
+ const callerMetadata = Object.fromEntries(
9446
+ Object.entries(data.metadata || {}).filter(([key]) => !key.startsWith("_"))
9447
+ );
9448
+ const mergedMetadata = { ...existing.metadata, ...callerMetadata };
9449
+ const doc = new Document({
9450
+ pageContent: data.content ?? existing.content,
9451
+ metadata: { ...mergedMetadata, _id: entryId, _created_at: now, _updated_at: now }
9452
+ });
9453
+ try {
9454
+ await vectorStore.addDocuments([doc]);
9455
+ } catch (error) {
9456
+ try {
9457
+ await vectorStore.addDocuments([
9458
+ new Document({
9459
+ pageContent: existing.content,
9460
+ metadata: { ...existing.metadata, _id: entryId, _updated_at: now }
9461
+ })
9462
+ ]);
9463
+ } catch {
9464
+ }
9465
+ throw error;
9466
+ }
9467
+ return { id: entryId, content: data.content ?? existing.content, metadata: mergedMetadata };
9468
+ }
9469
+ async deleteEntry(request, collectionName, entryId) {
9470
+ const collection = await this.getCollectionByName(request, collectionName);
9471
+ if (!collection) throw new Error(`Collection "${collectionName}" not found`);
9472
+ const vectorStore = await getOrCreateCollectionVectorStore(
9473
+ collectionName,
9474
+ collection.embeddingKey,
9475
+ collection.tenantId
9476
+ );
9477
+ try {
9478
+ await vectorStore.delete({ filter: { _id: entryId } });
9479
+ return true;
9480
+ } catch {
9481
+ return false;
9482
+ }
9483
+ }
9484
+ async deleteEntries(request, collectionName, data) {
9485
+ const validationError = validateCollectionEntryDeleteBatch(data.entryIds);
9486
+ if (validationError) throw new Error(validationError);
9487
+ const collection = await this.getCollectionByName(request, collectionName);
9488
+ if (!collection) throw new Error(`Collection "${collectionName}" not found`);
9489
+ const vectorStore = await getOrCreateCollectionVectorStore(
9490
+ collectionName,
9491
+ collection.embeddingKey,
9492
+ collection.tenantId
9493
+ );
9494
+ await deleteCollectionEntryIds(vectorStore, data.entryIds);
9495
+ return data.entryIds.length;
9496
+ }
9497
+ async searchEntries(request, collectionName, params) {
9498
+ const collection = await this.getCollectionByName(request, collectionName);
9499
+ if (!collection) throw new Error(`Collection "${collectionName}" not found`);
9500
+ const vectorStore = await getOrCreateCollectionVectorStore(
9501
+ collectionName,
9502
+ collection.embeddingKey,
9503
+ collection.tenantId
9504
+ );
9505
+ let embeddings;
9506
+ try {
9507
+ embeddings = embeddingsLatticeManager.getEmbeddingsClient(collection.embeddingKey);
9508
+ } catch {
9509
+ embeddings = embeddingsLatticeManager.getEmbeddingsClient("default");
9510
+ }
9511
+ const queryVector = await embeddings.embedQuery(params.query);
9512
+ const results = await vectorStore.similaritySearchVectorWithScore(
9513
+ queryVector,
9514
+ params.top_k || 5,
9515
+ params.filter
9516
+ );
9517
+ return results.map(([doc, score]) => ({
9518
+ id: doc.metadata._id || uuidv4(),
9519
+ content: doc.pageContent,
9520
+ metadata: Object.fromEntries(
9521
+ Object.entries(doc.metadata).filter(([k]) => !k.startsWith("_"))
9522
+ ),
9523
+ score
9524
+ }));
9525
+ }
9526
+ };
9527
+
9223
9528
  // src/controllers/collections.ts
9224
9529
  var collectionService = new CollectionService();
9225
9530
  function serializeCollection(collection) {
@@ -9341,10 +9646,10 @@ async function deleteCollection(request, reply) {
9341
9646
  }
9342
9647
 
9343
9648
  // src/controllers/embeddings.ts
9344
- import { embeddingsLatticeManager } from "@axiom-lattice/core";
9649
+ import { embeddingsLatticeManager as embeddingsLatticeManager2 } from "@axiom-lattice/core";
9345
9650
  async function listEmbeddings(_request, _reply) {
9346
9651
  try {
9347
- const info = embeddingsLatticeManager.getAllEmbeddingsInfo();
9652
+ const info = embeddingsLatticeManager2.getAllEmbeddingsInfo();
9348
9653
  return {
9349
9654
  success: true,
9350
9655
  message: "Successfully retrieved embedding models",
@@ -9401,6 +9706,37 @@ async function createEntry(request, reply) {
9401
9706
  });
9402
9707
  }
9403
9708
  }
9709
+ async function createEntries(request, reply) {
9710
+ try {
9711
+ const { name } = request.params;
9712
+ const entries = request.body?.entries;
9713
+ const validationError = validateCollectionEntryBatch(entries);
9714
+ if (validationError) {
9715
+ return reply.status(400).send({
9716
+ success: false,
9717
+ message: validationError
9718
+ });
9719
+ }
9720
+ const created = await collectionService2.createEntries(
9721
+ request,
9722
+ name,
9723
+ { entries }
9724
+ );
9725
+ return reply.status(201).send({
9726
+ success: true,
9727
+ message: "Successfully created entries",
9728
+ data: { records: created, total: created.length }
9729
+ });
9730
+ } catch (error) {
9731
+ if (error.message?.includes("not found")) {
9732
+ return reply.status(404).send({ success: false, message: error.message });
9733
+ }
9734
+ return reply.status(500).send({
9735
+ success: false,
9736
+ message: `Failed to create entries: ${error.message}`
9737
+ });
9738
+ }
9739
+ }
9404
9740
  async function getEntry(request, reply) {
9405
9741
  try {
9406
9742
  const { name, id: id3 } = request.params;
@@ -9458,6 +9794,37 @@ async function deleteEntry(request, reply) {
9458
9794
  });
9459
9795
  }
9460
9796
  }
9797
+ async function deleteEntries(request, reply) {
9798
+ try {
9799
+ const { name } = request.params;
9800
+ const entryIds = request.body?.entryIds;
9801
+ const validationError = validateCollectionEntryDeleteBatch(entryIds);
9802
+ if (validationError) {
9803
+ return reply.status(400).send({
9804
+ success: false,
9805
+ message: validationError
9806
+ });
9807
+ }
9808
+ const deleted = await collectionService2.deleteEntries(
9809
+ request,
9810
+ name,
9811
+ { entryIds }
9812
+ );
9813
+ return {
9814
+ success: true,
9815
+ message: "Successfully deleted entries",
9816
+ data: { processed: deleted }
9817
+ };
9818
+ } catch (error) {
9819
+ if (error.message?.includes("not found")) {
9820
+ return reply.status(404).send({ success: false, message: error.message });
9821
+ }
9822
+ return reply.status(500).send({
9823
+ success: false,
9824
+ message: `Failed to delete entries: ${error.message}`
9825
+ });
9826
+ }
9827
+ }
9461
9828
  async function searchEntries(request, reply) {
9462
9829
  try {
9463
9830
  const { name } = request.params;
@@ -9582,11 +9949,11 @@ import {
9582
9949
  getStoreLattice as getStoreLattice16,
9583
9950
  metricsServerManager
9584
9951
  } from "@axiom-lattice/core";
9585
- function getTenantId14(request) {
9952
+ function getTenantId15(request) {
9586
9953
  return request.headers["x-tenant-id"] || "default";
9587
9954
  }
9588
9955
  async function executeDataQuery(request, reply) {
9589
- const tenantId = getTenantId14(request);
9956
+ const tenantId = getTenantId15(request);
9590
9957
  const body = request.body;
9591
9958
  try {
9592
9959
  if (!body.serverKey && !body.datasourceId) {
@@ -9806,7 +10173,7 @@ function buildClarifySkipCommand(interruptId) {
9806
10173
  }
9807
10174
 
9808
10175
  // src/controllers/workflow-tracking.ts
9809
- function getTenantId15(request) {
10176
+ function getTenantId16(request) {
9810
10177
  const userTenantId = request.user?.tenantId;
9811
10178
  if (userTenantId) return userTenantId;
9812
10179
  return request.headers["x-tenant-id"] || "default";
@@ -9820,7 +10187,7 @@ function getTrackingStore() {
9820
10187
  }
9821
10188
  }
9822
10189
  async function getAllWorkflowRuns(request, reply) {
9823
- const tenantId = getTenantId15(request);
10190
+ const tenantId = getTenantId16(request);
9824
10191
  const { assistantId, status } = request.query;
9825
10192
  try {
9826
10193
  const store2 = getTrackingStore();
@@ -9874,7 +10241,7 @@ async function getAllWorkflowRuns(request, reply) {
9874
10241
  var INBOX_DEFAULT_PAGE_SIZE = 20;
9875
10242
  var INBOX_MAX_PAGE_SIZE = 100;
9876
10243
  async function getInboxItems(request, reply) {
9877
- const tenantId = getTenantId15(request);
10244
+ const tenantId = getTenantId16(request);
9878
10245
  try {
9879
10246
  const store2 = getTrackingStore();
9880
10247
  if (!store2) {
@@ -9982,7 +10349,7 @@ async function getInboxItems(request, reply) {
9982
10349
  }
9983
10350
  async function getWorkflowRuns(request, reply) {
9984
10351
  const { threadId } = request.params;
9985
- const tenantId = getTenantId15(request);
10352
+ const tenantId = getTenantId16(request);
9986
10353
  try {
9987
10354
  const store2 = getTrackingStore();
9988
10355
  if (!store2) {
@@ -10018,7 +10385,7 @@ async function getWorkflowRun(request, reply) {
10018
10385
  }
10019
10386
  async function deleteWorkflowRun(request, reply) {
10020
10387
  const { runId } = request.params;
10021
- const tenantId = getTenantId15(request);
10388
+ const tenantId = getTenantId16(request);
10022
10389
  try {
10023
10390
  const store2 = getTrackingStore();
10024
10391
  if (!store2) {
@@ -10101,7 +10468,7 @@ async function getRunTasks(request, reply) {
10101
10468
  }
10102
10469
  async function replyInboxTask(request, reply) {
10103
10470
  const { runId, answers } = request.body;
10104
- const tenantId = getTenantId15(request);
10471
+ const tenantId = getTenantId16(request);
10105
10472
  try {
10106
10473
  const store2 = getTrackingStore();
10107
10474
  if (!store2) {
@@ -10265,7 +10632,7 @@ async function requestWorkflowCancel(request, tenantId, run2) {
10265
10632
  async function abortWorkflowRun(request, reply) {
10266
10633
  try {
10267
10634
  const { runId } = request.params;
10268
- const tenantId = getTenantId15(request);
10635
+ const tenantId = getTenantId16(request);
10269
10636
  const store2 = getTrackingStore();
10270
10637
  if (!store2) {
10271
10638
  return reply.status(404).send({
@@ -10318,7 +10685,7 @@ import { randomUUID as randomUUID12 } from "crypto";
10318
10685
  function getWorkspaceId2(request) {
10319
10686
  return request.headers["x-workspace-id"] || "default";
10320
10687
  }
10321
- function getTenantId16(request) {
10688
+ function getTenantId17(request) {
10322
10689
  const userTenantId = request.user?.tenantId;
10323
10690
  if (userTenantId) return userTenantId;
10324
10691
  return request.headers["x-tenant-id"] || "default";
@@ -10351,7 +10718,7 @@ async function updateLinkMeta(userId, tenantId, meta) {
10351
10718
  await getLinkStore().updateLink(userId, tenantId, { metadata: meta });
10352
10719
  }
10353
10720
  async function createPersonalAssistant(request, reply) {
10354
- const tenantId = getTenantId16(request);
10721
+ const tenantId = getTenantId17(request);
10355
10722
  const userId = getUserId6(request);
10356
10723
  const { name, personality } = request.body;
10357
10724
  if (!name || !personality) {
@@ -10426,7 +10793,7 @@ async function createPersonalAssistant(request, reply) {
10426
10793
  });
10427
10794
  }
10428
10795
  async function getPersonalAssistant(request, reply) {
10429
- const tenantId = getTenantId16(request);
10796
+ const tenantId = getTenantId17(request);
10430
10797
  const userId = getUserId6(request);
10431
10798
  const store2 = getAssistantStore2();
10432
10799
  const assistant = await store2.getByOwner(tenantId, userId);
@@ -10443,7 +10810,7 @@ async function getPersonalAssistant(request, reply) {
10443
10810
  };
10444
10811
  }
10445
10812
  async function deletePersonalAssistant(request, reply) {
10446
- const tenantId = getTenantId16(request);
10813
+ const tenantId = getTenantId17(request);
10447
10814
  const userId = getUserId6(request);
10448
10815
  const store2 = getAssistantStore2();
10449
10816
  const assistant = await store2.getByOwner(tenantId, userId);
@@ -11930,7 +12297,7 @@ import * as os2 from "os";
11930
12297
  import { getStoreLattice as getStoreLattice19 } from "@axiom-lattice/core";
11931
12298
  import { SandboxFilesystem, FilesystemBackend } from "@axiom-lattice/core";
11932
12299
  import { getSandBoxManager as getSandBoxManager3, resolveSandboxAgentsPathAlias as resolveSandboxAgentsPathAlias2 } from "@axiom-lattice/core";
11933
- import { v4 as uuidv4 } from "uuid";
12300
+ import { v4 as uuidv42 } from "uuid";
11934
12301
 
11935
12302
  // src/services/collaboration/RoomCoordinatorProvisioner.ts
11936
12303
  import { roomCoordinatorConfig } from "@axiom-lattice/core";
@@ -12253,7 +12620,7 @@ var ProjectCollaborationInitializationError = class extends Error {
12253
12620
  }
12254
12621
  };
12255
12622
  function createProjectCollaborationInitializer(deps) {
12256
- const idFactory = deps.idFactory ?? uuidv4;
12623
+ const idFactory = deps.idFactory ?? uuidv42;
12257
12624
  return {
12258
12625
  authorizeCreator: async ({ tenantId, userId }) => await deps.userTenantLinkStore.getLink(userId, tenantId) !== null,
12259
12626
  initialize: async ({ tenantId, userId, project }) => {
@@ -12400,7 +12767,7 @@ var WorkspaceController = class {
12400
12767
  async createWorkspace(request, reply) {
12401
12768
  const tenantId = this.getTenantId(request);
12402
12769
  const data = request.body;
12403
- const id3 = uuidv4();
12770
+ const id3 = uuidv42();
12404
12771
  const workspace = await this.workspaceStore.createWorkspace(
12405
12772
  tenantId,
12406
12773
  id3,
@@ -12477,7 +12844,7 @@ var WorkspaceController = class {
12477
12844
  if (existing.length > 0) {
12478
12845
  return;
12479
12846
  }
12480
- await this.projectStore.createProject(tenantId, workspaceId, uuidv4(), {
12847
+ await this.projectStore.createProject(tenantId, workspaceId, uuidv42(), {
12481
12848
  name: "Training",
12482
12849
  description: "Shared workspace for agent training",
12483
12850
  kind: "training"
@@ -12520,7 +12887,7 @@ var WorkspaceController = class {
12520
12887
  });
12521
12888
  }
12522
12889
  }
12523
- const id3 = uuidv4();
12890
+ const id3 = uuidv42();
12524
12891
  const project = await this.projectStore.createProject(
12525
12892
  tenantId,
12526
12893
  workspaceId,
@@ -13377,7 +13744,7 @@ import {
13377
13744
  sqlDatabaseManager
13378
13745
  } from "@axiom-lattice/core";
13379
13746
  import { randomUUID as randomUUID15 } from "crypto";
13380
- function getTenantId17(request) {
13747
+ function getTenantId18(request) {
13381
13748
  const userTenantId = request.user?.tenantId;
13382
13749
  if (userTenantId) {
13383
13750
  return userTenantId;
@@ -13385,7 +13752,7 @@ function getTenantId17(request) {
13385
13752
  return request.headers["x-tenant-id"] || "default";
13386
13753
  }
13387
13754
  async function getDatabaseConfigList(request, reply) {
13388
- const tenantId = getTenantId17(request);
13755
+ const tenantId = getTenantId18(request);
13389
13756
  try {
13390
13757
  const storeLattice = getStoreLattice20("default", "database");
13391
13758
  const store2 = storeLattice.store;
@@ -13415,7 +13782,7 @@ async function getDatabaseConfigList(request, reply) {
13415
13782
  }
13416
13783
  }
13417
13784
  async function getDatabaseConfig(request, reply) {
13418
- const tenantId = getTenantId17(request);
13785
+ const tenantId = getTenantId18(request);
13419
13786
  const { key } = request.params;
13420
13787
  try {
13421
13788
  const storeLattice = getStoreLattice20("default", "database");
@@ -13441,7 +13808,7 @@ async function getDatabaseConfig(request, reply) {
13441
13808
  }
13442
13809
  }
13443
13810
  async function createDatabaseConfig(request, reply) {
13444
- const tenantId = getTenantId17(request);
13811
+ const tenantId = getTenantId18(request);
13445
13812
  const body = request.body;
13446
13813
  try {
13447
13814
  const storeLattice = getStoreLattice20("default", "database");
@@ -13476,7 +13843,7 @@ async function createDatabaseConfig(request, reply) {
13476
13843
  }
13477
13844
  }
13478
13845
  async function updateDatabaseConfig(request, reply) {
13479
- const tenantId = getTenantId17(request);
13846
+ const tenantId = getTenantId18(request);
13480
13847
  const { key } = request.params;
13481
13848
  const updates = request.body;
13482
13849
  try {
@@ -13518,7 +13885,7 @@ async function updateDatabaseConfig(request, reply) {
13518
13885
  }
13519
13886
  }
13520
13887
  async function deleteDatabaseConfig(request, reply) {
13521
- const tenantId = getTenantId17(request);
13888
+ const tenantId = getTenantId18(request);
13522
13889
  const { keyOrId } = request.params;
13523
13890
  try {
13524
13891
  const storeLattice = getStoreLattice20("default", "database");
@@ -13567,7 +13934,7 @@ async function deleteDatabaseConfig(request, reply) {
13567
13934
  }
13568
13935
  }
13569
13936
  async function testDatabaseConnection(request, reply) {
13570
- const tenantId = getTenantId17(request);
13937
+ const tenantId = getTenantId18(request);
13571
13938
  const { key } = request.params;
13572
13939
  try {
13573
13940
  const storeLattice = getStoreLattice20("default", "database");
@@ -13660,7 +14027,7 @@ import {
13660
14027
  SemanticMetricsClient as SemanticMetricsClient2
13661
14028
  } from "@axiom-lattice/core";
13662
14029
  import { randomUUID as randomUUID16 } from "crypto";
13663
- function getTenantId18(request) {
14030
+ function getTenantId19(request) {
13664
14031
  const userTenantId = request.user?.tenantId;
13665
14032
  if (userTenantId) {
13666
14033
  return userTenantId;
@@ -13668,7 +14035,7 @@ function getTenantId18(request) {
13668
14035
  return request.headers["x-tenant-id"] || "default";
13669
14036
  }
13670
14037
  async function getMetricsServerConfigList(request, reply) {
13671
- const tenantId = getTenantId18(request);
14038
+ const tenantId = getTenantId19(request);
13672
14039
  try {
13673
14040
  const storeLattice = getStoreLattice21("default", "metrics");
13674
14041
  const store2 = storeLattice.store;
@@ -13694,7 +14061,7 @@ async function getMetricsServerConfigList(request, reply) {
13694
14061
  }
13695
14062
  }
13696
14063
  async function getMetricsServerConfig(request, reply) {
13697
- const tenantId = getTenantId18(request);
14064
+ const tenantId = getTenantId19(request);
13698
14065
  const { key } = request.params;
13699
14066
  try {
13700
14067
  const storeLattice = getStoreLattice21("default", "metrics");
@@ -13720,7 +14087,7 @@ async function getMetricsServerConfig(request, reply) {
13720
14087
  }
13721
14088
  }
13722
14089
  async function createMetricsServerConfig(request, reply) {
13723
- const tenantId = getTenantId18(request);
14090
+ const tenantId = getTenantId19(request);
13724
14091
  const body = request.body;
13725
14092
  try {
13726
14093
  const storeLattice = getStoreLattice21("default", "metrics");
@@ -13771,7 +14138,7 @@ async function createMetricsServerConfig(request, reply) {
13771
14138
  }
13772
14139
  }
13773
14140
  async function updateMetricsServerConfig(request, reply) {
13774
- const tenantId = getTenantId18(request);
14141
+ const tenantId = getTenantId19(request);
13775
14142
  const { key } = request.params;
13776
14143
  const updates = request.body;
13777
14144
  try {
@@ -13822,7 +14189,7 @@ async function updateMetricsServerConfig(request, reply) {
13822
14189
  }
13823
14190
  }
13824
14191
  async function deleteMetricsServerConfig(request, reply) {
13825
- const tenantId = getTenantId18(request);
14192
+ const tenantId = getTenantId19(request);
13826
14193
  const { keyOrId } = request.params;
13827
14194
  try {
13828
14195
  const storeLattice = getStoreLattice21("default", "metrics");
@@ -13869,7 +14236,7 @@ async function deleteMetricsServerConfig(request, reply) {
13869
14236
  }
13870
14237
  }
13871
14238
  async function testMetricsServerConnection(request, reply) {
13872
- const tenantId = getTenantId18(request);
14239
+ const tenantId = getTenantId19(request);
13873
14240
  const { key } = request.params;
13874
14241
  try {
13875
14242
  const storeLattice = getStoreLattice21("default", "metrics");
@@ -13920,7 +14287,7 @@ async function testMetricsServerConnection(request, reply) {
13920
14287
  }
13921
14288
  }
13922
14289
  async function listAvailableMetrics(request, reply) {
13923
- const tenantId = getTenantId18(request);
14290
+ const tenantId = getTenantId19(request);
13924
14291
  const { key } = request.params;
13925
14292
  try {
13926
14293
  const storeLattice = getStoreLattice21("default", "metrics");
@@ -13958,7 +14325,7 @@ async function listAvailableMetrics(request, reply) {
13958
14325
  }
13959
14326
  }
13960
14327
  async function queryMetricsData(request, reply) {
13961
- const tenantId = getTenantId18(request);
14328
+ const tenantId = getTenantId19(request);
13962
14329
  const { key } = request.params;
13963
14330
  const { metricName, startTime, endTime, step, labels: labels2 } = request.body;
13964
14331
  try {
@@ -14006,7 +14373,7 @@ async function queryMetricsData(request, reply) {
14006
14373
  }
14007
14374
  }
14008
14375
  async function getDataSources(request, reply) {
14009
- const tenantId = getTenantId18(request);
14376
+ const tenantId = getTenantId19(request);
14010
14377
  const { key } = request.params;
14011
14378
  try {
14012
14379
  const storeLattice = getStoreLattice21("default", "metrics");
@@ -14047,7 +14414,7 @@ async function getDataSources(request, reply) {
14047
14414
  }
14048
14415
  }
14049
14416
  async function getDatasourceMetrics(request, reply) {
14050
- const tenantId = getTenantId18(request);
14417
+ const tenantId = getTenantId19(request);
14051
14418
  const { key, datasourceId } = request.params;
14052
14419
  try {
14053
14420
  const storeLattice = getStoreLattice21("default", "metrics");
@@ -14084,7 +14451,7 @@ async function getDatasourceMetrics(request, reply) {
14084
14451
  }
14085
14452
  }
14086
14453
  async function querySemanticMetrics(request, reply) {
14087
- const tenantId = getTenantId18(request);
14454
+ const tenantId = getTenantId19(request);
14088
14455
  const { key } = request.params;
14089
14456
  const body = request.body;
14090
14457
  try {
@@ -14397,7 +14764,7 @@ function connectionRoutes(fastify2) {
14397
14764
 
14398
14765
  // src/controllers/eval.ts
14399
14766
  import { getStoreLattice as getStoreLattice23, hasModelLatticeForTenant as hasModelLatticeForTenant2, modelLatticeManager as modelLatticeManager2 } from "@axiom-lattice/core";
14400
- import { v4 as uuidv43 } from "uuid";
14767
+ import { v4 as uuidv44 } from "uuid";
14401
14768
 
14402
14769
  // src/services/eval-runner.ts
14403
14770
  import { EventEmitter } from "events";
@@ -14410,7 +14777,7 @@ import {
14410
14777
  tenantHasOwnModelSupply
14411
14778
  } from "@axiom-lattice/core";
14412
14779
  import { PLATFORM_MODEL_TENANT_ID } from "@axiom-lattice/protocols";
14413
- import { v4 as uuidv42 } from "uuid";
14780
+ import { v4 as uuidv43 } from "uuid";
14414
14781
  var TERMINAL_PERSIST_ATTEMPTS = 2;
14415
14782
  var EVAL_EXECUTION_LEASE = "eval:execution";
14416
14783
  var EVAL_LEASE_TTL_MS = 6e4;
@@ -14471,7 +14838,7 @@ var EvalRunner = class {
14471
14838
  /** One eval at a time across replicas; the executing worker holds this lease. */
14472
14839
  async acquireExecutionLease() {
14473
14840
  const store2 = this.getLeaseStore();
14474
- const holder = `${getReplicaId6()}#${uuidv42()}`;
14841
+ const holder = `${getReplicaId6()}#${uuidv43()}`;
14475
14842
  if (!await store2.tryAcquire(EVAL_EXECUTION_LEASE, holder, EVAL_LEASE_TTL_MS)) {
14476
14843
  throw new Error("An evaluation run is already in progress");
14477
14844
  }
@@ -14576,7 +14943,7 @@ var EvalRunner = class {
14576
14943
  console.warn(`[eval-runner] Project "${project.name}" has no judge modelKey and no default model \u2014 falling back to "${resolvedJudgeModelKey}"`);
14577
14944
  }
14578
14945
  }
14579
- const runId = uuidv42();
14946
+ const runId = uuidv43();
14580
14947
  const concurrency = Math.max(1, Math.floor(project.concurrency) || 3);
14581
14948
  const isHoldout = suites.length > 0 && suites.every((s) => s.name.endsWith("-validation"));
14582
14949
  const workspaceId = runConfig?.workspaceId || "";
@@ -14633,7 +15000,7 @@ var EvalRunner = class {
14633
15000
  if (terminalUnavailable()) return;
14634
15001
  const passed = result.result?.pass ?? false;
14635
15002
  const score = result.result?.final_score ?? 0;
14636
- await store2.createRunResult(tenantId, runId, uuidv42(), {
15003
+ await store2.createRunResult(tenantId, runId, uuidv43(), {
14637
15004
  suiteName,
14638
15005
  caseId: result.caseId,
14639
15006
  pass: passed,
@@ -14802,7 +15169,7 @@ var EvalRunner = class {
14802
15169
  var evalRunner = new EvalRunner();
14803
15170
 
14804
15171
  // src/controllers/eval.ts
14805
- function getTenantId19(request) {
15172
+ function getTenantId20(request) {
14806
15173
  const userTenantId = request.user?.tenantId;
14807
15174
  if (userTenantId) {
14808
15175
  return userTenantId;
@@ -14826,9 +15193,9 @@ async function getOwnedCase(store2, tenantId, projectId, suiteId, caseId) {
14826
15193
  }
14827
15194
  async function createProject(request, reply) {
14828
15195
  try {
14829
- const tenantId = getTenantId19(request);
15196
+ const tenantId = getTenantId20(request);
14830
15197
  const store2 = getEvalStore();
14831
- const id3 = uuidv43();
15198
+ const id3 = uuidv44();
14832
15199
  const data = request.body;
14833
15200
  const existing = await store2.getProjectsByTenant(tenantId);
14834
15201
  if (existing.some((p) => p.name === data.name)) {
@@ -14882,7 +15249,7 @@ async function createProject(request, reply) {
14882
15249
  }
14883
15250
  async function listProjects(request, reply) {
14884
15251
  try {
14885
- const tenantId = getTenantId19(request);
15252
+ const tenantId = getTenantId20(request);
14886
15253
  const store2 = getEvalStore();
14887
15254
  let projects = await store2.getProjectsByTenant(tenantId);
14888
15255
  if (projects.length === 0) {
@@ -14892,7 +15259,7 @@ async function listProjects(request, reply) {
14892
15259
  const judgeModel = first ? { modelKey: first.key } : {};
14893
15260
  const host = request.hostname || "localhost";
14894
15261
  const baseUrl = `http://${host}:${process.env.PORT || 4001}`;
14895
- await store2.createProject(tenantId, uuidv43(), {
15262
+ await store2.createProject(tenantId, uuidv44(), {
14896
15263
  name: "Default",
14897
15264
  description: "Built-in project for testing eval against this server",
14898
15265
  judgeModelConfig: judgeModel,
@@ -14915,7 +15282,7 @@ async function listProjects(request, reply) {
14915
15282
  }
14916
15283
  async function getProject(request, reply) {
14917
15284
  try {
14918
- const tenantId = getTenantId19(request);
15285
+ const tenantId = getTenantId20(request);
14919
15286
  const store2 = getEvalStore();
14920
15287
  const { pid } = request.params;
14921
15288
  const project = await store2.getProjectById(tenantId, pid);
@@ -14935,7 +15302,7 @@ async function getProject(request, reply) {
14935
15302
  }
14936
15303
  async function updateProject(request, reply) {
14937
15304
  try {
14938
- const tenantId = getTenantId19(request);
15305
+ const tenantId = getTenantId20(request);
14939
15306
  const store2 = getEvalStore();
14940
15307
  const { pid } = request.params;
14941
15308
  const existing = await store2.getProjectById(tenantId, pid);
@@ -14978,7 +15345,7 @@ async function updateProject(request, reply) {
14978
15345
  async function deleteProject(request, reply) {
14979
15346
  let releaseDeletion;
14980
15347
  try {
14981
- const tenantId = getTenantId19(request);
15348
+ const tenantId = getTenantId20(request);
14982
15349
  const store2 = getEvalStore();
14983
15350
  const { pid } = request.params;
14984
15351
  const existing = await store2.getProjectById(tenantId, pid);
@@ -15016,14 +15383,14 @@ async function deleteProject(request, reply) {
15016
15383
  }
15017
15384
  async function createSuite(request, reply) {
15018
15385
  try {
15019
- const tenantId = getTenantId19(request);
15386
+ const tenantId = getTenantId20(request);
15020
15387
  const store2 = getEvalStore();
15021
15388
  const { pid } = request.params;
15022
15389
  const project = await store2.getProjectById(tenantId, pid);
15023
15390
  if (!project) {
15024
15391
  return reply.status(404).send({ success: false, message: "Project not found" });
15025
15392
  }
15026
- const id3 = uuidv43();
15393
+ const id3 = uuidv44();
15027
15394
  const data = request.body;
15028
15395
  const suite = await store2.createSuite(tenantId, pid, id3, { name: data.name });
15029
15396
  return reply.status(201).send({
@@ -15038,7 +15405,7 @@ async function createSuite(request, reply) {
15038
15405
  }
15039
15406
  async function updateSuite(request, reply) {
15040
15407
  try {
15041
- const tenantId = getTenantId19(request);
15408
+ const tenantId = getTenantId20(request);
15042
15409
  const store2 = getEvalStore();
15043
15410
  const { pid, sid } = request.params;
15044
15411
  const existing = await getOwnedSuite(store2, tenantId, pid, sid);
@@ -15058,7 +15425,7 @@ async function updateSuite(request, reply) {
15058
15425
  }
15059
15426
  async function deleteSuite(request, reply) {
15060
15427
  try {
15061
- const tenantId = getTenantId19(request);
15428
+ const tenantId = getTenantId20(request);
15062
15429
  const store2 = getEvalStore();
15063
15430
  const { pid, sid } = request.params;
15064
15431
  const existing = await getOwnedSuite(store2, tenantId, pid, sid);
@@ -15077,14 +15444,14 @@ async function deleteSuite(request, reply) {
15077
15444
  }
15078
15445
  async function createCase(request, reply) {
15079
15446
  try {
15080
- const tenantId = getTenantId19(request);
15447
+ const tenantId = getTenantId20(request);
15081
15448
  const store2 = getEvalStore();
15082
15449
  const { pid, sid } = request.params;
15083
15450
  const suite = await getOwnedSuite(store2, tenantId, pid, sid);
15084
15451
  if (!suite) {
15085
15452
  return reply.status(404).send({ success: false, message: "Suite not found" });
15086
15453
  }
15087
- const id3 = uuidv43();
15454
+ const id3 = uuidv44();
15088
15455
  const data = request.body;
15089
15456
  const created = await store2.createCase(tenantId, sid, id3, {
15090
15457
  inputMessage: data.inputMessage,
@@ -15107,7 +15474,7 @@ async function createCase(request, reply) {
15107
15474
  }
15108
15475
  async function listCasesForSuite(request, reply) {
15109
15476
  try {
15110
- const tenantId = getTenantId19(request);
15477
+ const tenantId = getTenantId20(request);
15111
15478
  const store2 = getEvalStore();
15112
15479
  const { pid, sid } = request.params;
15113
15480
  const suite = await getOwnedSuite(store2, tenantId, pid, sid);
@@ -15127,7 +15494,7 @@ async function listCasesForSuite(request, reply) {
15127
15494
  }
15128
15495
  async function updateCase(request, reply) {
15129
15496
  try {
15130
- const tenantId = getTenantId19(request);
15497
+ const tenantId = getTenantId20(request);
15131
15498
  const store2 = getEvalStore();
15132
15499
  const { pid, sid, cid } = request.params;
15133
15500
  const existing = await getOwnedCase(store2, tenantId, pid, sid, cid);
@@ -15147,7 +15514,7 @@ async function updateCase(request, reply) {
15147
15514
  }
15148
15515
  async function deleteCase(request, reply) {
15149
15516
  try {
15150
- const tenantId = getTenantId19(request);
15517
+ const tenantId = getTenantId20(request);
15151
15518
  const store2 = getEvalStore();
15152
15519
  const { pid, sid, cid } = request.params;
15153
15520
  const existing = await getOwnedCase(store2, tenantId, pid, sid, cid);
@@ -15179,7 +15546,7 @@ function registerEvalRoutes(app2) {
15179
15546
  app2.delete("/api/eval/projects/:pid/suites/:sid/cases/:cid", deleteCase);
15180
15547
  app2.post("/api/eval/projects/:pid/runs", async (request, reply) => {
15181
15548
  try {
15182
- const tenantId = getTenantId19(request);
15549
+ const tenantId = getTenantId20(request);
15183
15550
  const { pid } = request.params;
15184
15551
  const body = request.body ?? {};
15185
15552
  const bodyWs = request.headers["x-workspace-id"] || "";
@@ -15198,7 +15565,7 @@ function registerEvalRoutes(app2) {
15198
15565
  });
15199
15566
  app2.get("/api/eval/runs", async (request, reply) => {
15200
15567
  try {
15201
- const tenantId = getTenantId19(request);
15568
+ const tenantId = getTenantId20(request);
15202
15569
  const query = request.query;
15203
15570
  const runs = await getEvalStore().getRunsByTenant(tenantId, { projectId: query.project_id, status: query.status });
15204
15571
  reply.send({ success: true, message: "Ok", data: { records: runs, total: runs.length } });
@@ -15208,7 +15575,7 @@ function registerEvalRoutes(app2) {
15208
15575
  });
15209
15576
  app2.get("/api/eval/runs/:rid", async (request, reply) => {
15210
15577
  try {
15211
- const tenantId = getTenantId19(request);
15578
+ const tenantId = getTenantId20(request);
15212
15579
  const { rid } = request.params;
15213
15580
  const run2 = await getEvalStore().getRunById(tenantId, rid);
15214
15581
  if (!run2) return reply.status(404).send({ success: false, message: "Run not found" });
@@ -15219,7 +15586,7 @@ function registerEvalRoutes(app2) {
15219
15586
  }
15220
15587
  });
15221
15588
  app2.get("/api/eval/runs/:rid/stream", async (request, reply) => {
15222
- const tenantId = getTenantId19(request);
15589
+ const tenantId = getTenantId20(request);
15223
15590
  const { rid } = request.params;
15224
15591
  const store2 = getEvalStore();
15225
15592
  const initial = await store2.getRunById(tenantId, rid);
@@ -15302,7 +15669,7 @@ data: ${JSON.stringify(data)}
15302
15669
  });
15303
15670
  app2.post("/api/eval/runs/:rid/abort", async (request, reply) => {
15304
15671
  try {
15305
- const tenantId = getTenantId19(request);
15672
+ const tenantId = getTenantId20(request);
15306
15673
  const { rid } = request.params;
15307
15674
  const run2 = await getEvalStore().getRunById(tenantId, rid);
15308
15675
  if (!run2) return reply.status(404).send({ success: false, message: "Run not found" });
@@ -15315,7 +15682,7 @@ data: ${JSON.stringify(data)}
15315
15682
  });
15316
15683
  app2.delete("/api/eval/runs/:rid", async (request, reply) => {
15317
15684
  try {
15318
- const tenantId = getTenantId19(request);
15685
+ const tenantId = getTenantId20(request);
15319
15686
  const { rid } = request.params;
15320
15687
  const store2 = getEvalStore();
15321
15688
  const run2 = await store2.getRunById(tenantId, rid);
@@ -15332,7 +15699,7 @@ data: ${JSON.stringify(data)}
15332
15699
  });
15333
15700
  app2.get("/api/eval/reports/projects/:pid", async (request, reply) => {
15334
15701
  try {
15335
- const tenantId = getTenantId19(request);
15702
+ const tenantId = getTenantId20(request);
15336
15703
  const { pid } = request.params;
15337
15704
  const report = await getEvalStore().getProjectReport(tenantId, pid);
15338
15705
  if (!report) return reply.status(404).send({ success: false, message: "Project not found" });
@@ -15345,11 +15712,11 @@ data: ${JSON.stringify(data)}
15345
15712
 
15346
15713
  // src/controllers/users.ts
15347
15714
  import { getStoreLattice as getStoreLattice25 } from "@axiom-lattice/core";
15348
- import { v4 as uuidv45 } from "uuid";
15715
+ import { v4 as uuidv46 } from "uuid";
15349
15716
 
15350
15717
  // src/controllers/auth.ts
15351
15718
  import { getStoreLattice as getStoreLattice24 } from "@axiom-lattice/core";
15352
- import { v4 as uuidv44 } from "uuid";
15719
+ import { v4 as uuidv45 } from "uuid";
15353
15720
  import { createHmac, randomBytes, timingSafeEqual } from "crypto";
15354
15721
  import {
15355
15722
  PLATFORM_TENANT_ID as PLATFORM_TENANT_ID2,
@@ -15472,7 +15839,7 @@ var AuthController = class {
15472
15839
  error: "User with this email already exists"
15473
15840
  });
15474
15841
  }
15475
- const userId = uuidv44();
15842
+ const userId = uuidv45();
15476
15843
  const userStatus = this.config.autoApproveUsers ? "active" : "pending";
15477
15844
  const userData = {
15478
15845
  email,
@@ -16263,7 +16630,7 @@ var UsersController = class {
16263
16630
  async createUser(request, reply) {
16264
16631
  if (!await this.requireAdmin(request, reply)) return;
16265
16632
  const data = request.body;
16266
- const id3 = uuidv45();
16633
+ const id3 = uuidv46();
16267
16634
  if (this.isReservedPlatformEmail(data.email)) {
16268
16635
  return reply.status(403).send({
16269
16636
  success: false,
@@ -16449,7 +16816,7 @@ import {
16449
16816
  PLATFORM_TENANT_PROTECTED_ERROR as PLATFORM_TENANT_PROTECTED_ERROR3,
16450
16817
  isPlatformTenantId as isPlatformTenantId3
16451
16818
  } from "@axiom-lattice/protocols";
16452
- import { v4 as uuidv46 } from "uuid";
16819
+ import { v4 as uuidv47 } from "uuid";
16453
16820
 
16454
16821
  // src/services/auth/AdminRouteGuard.ts
16455
16822
  function allowedForRole(role, access) {
@@ -16563,7 +16930,7 @@ var TenantsController = class {
16563
16930
  }
16564
16931
  async createTenant(request, reply) {
16565
16932
  const data = request.body;
16566
- const id3 = uuidv46();
16933
+ const id3 = uuidv47();
16567
16934
  const tenant2 = await this.tenantStore.createTenant(id3, data);
16568
16935
  return reply.status(201).send({ success: true, data: tenant2 });
16569
16936
  }
@@ -16661,7 +17028,7 @@ function registerTenantRoutes(app2, options) {
16661
17028
  }
16662
17029
 
16663
17030
  // src/controllers/platform-admin.ts
16664
- import { v4 as uuidv47 } from "uuid";
17031
+ import { v4 as uuidv48 } from "uuid";
16665
17032
  import { getStoreLattice as getStoreLattice27 } from "@axiom-lattice/core";
16666
17033
  import {
16667
17034
  PLATFORM_TENANT_PROTECTED_ERROR as PLATFORM_TENANT_PROTECTED_ERROR4,
@@ -16937,11 +17304,11 @@ var PlatformAdminError = class extends Error {
16937
17304
  function inputError(code, message, statusCode = 400) {
16938
17305
  return new PlatformAdminError(code, message, statusCode);
16939
17306
  }
16940
- function isRecord8(value) {
17307
+ function isRecord9(value) {
16941
17308
  return typeof value === "object" && value !== null && !Array.isArray(value);
16942
17309
  }
16943
17310
  function bodyRecord(body) {
16944
- if (!isRecord8(body)) {
17311
+ if (!isRecord9(body)) {
16945
17312
  throw inputError("INVALID_INPUT", "Request body must be an object");
16946
17313
  }
16947
17314
  return body;
@@ -17064,7 +17431,7 @@ var PlatformAdminController = class {
17064
17431
  );
17065
17432
  }
17066
17433
  const metadata = typeof password === "string" ? { passwordHash: await hashLegacyPassword(password) } : {};
17067
- const user = await this.options.userStore.createUser(uuidv47(), {
17434
+ const user = await this.options.userStore.createUser(uuidv48(), {
17068
17435
  email,
17069
17436
  name,
17070
17437
  status,
@@ -17572,7 +17939,7 @@ var PlatformAdminController = class {
17572
17939
  }
17573
17940
  }
17574
17941
  pathParam(request, name) {
17575
- const params = isRecord8(request.params) ? request.params : {};
17942
+ const params = isRecord9(request.params) ? request.params : {};
17576
17943
  const value = optionalString(params[name]);
17577
17944
  if (!value) {
17578
17945
  throw inputError(
@@ -18009,9 +18376,11 @@ import {
18009
18376
  // src/services/settings/PlatformSettingsService.ts
18010
18377
  import {
18011
18378
  DEFAULT_PLATFORM_BRANDING,
18379
+ MAX_CUSTOM_CSS_LENGTH,
18012
18380
  PLATFORM_SETTINGS_DEFAULTS,
18013
18381
  PlatformSettingsVersionConflictError,
18014
- normalizeBrandingHost
18382
+ normalizeBrandingHost,
18383
+ validateCustomCss
18015
18384
  } from "@axiom-lattice/protocols";
18016
18385
  var PLATFORM_SETTINGS_CHANGED_TOPIC = "platform.settings.changed";
18017
18386
  var PlatformSettingsValidationError = class extends Error {
@@ -18043,7 +18412,8 @@ var BRANDING_KEYS = [
18043
18412
  "primaryColor",
18044
18413
  "backgroundColor",
18045
18414
  "loginTitle",
18046
- "loginSubtitle"
18415
+ "loginSubtitle",
18416
+ "customCss"
18047
18417
  ];
18048
18418
  var BRANDING_DOMAIN_KEYS = [
18049
18419
  "host",
@@ -18100,6 +18470,15 @@ function isHttpUrl(value) {
18100
18470
  return false;
18101
18471
  }
18102
18472
  }
18473
+ function isRootRelativeUrl(value) {
18474
+ if (typeof value !== "string" || value.length === 0 || value.length > MAX_BRANDING_URL_LENGTH) {
18475
+ return false;
18476
+ }
18477
+ return /^\/(?!\/)(?!\\)[^\s\\]*$/.test(value);
18478
+ }
18479
+ function isBrandAssetUrl(value) {
18480
+ return isHttpUrl(value) || isRootRelativeUrl(value);
18481
+ }
18103
18482
  function isHexColor(value) {
18104
18483
  return typeof value === "string" && HEX_COLOR_PATTERN.test(value);
18105
18484
  }
@@ -18130,7 +18509,7 @@ function sanitizeBranding(value) {
18130
18509
  }
18131
18510
  }
18132
18511
  for (const key of BRANDING_URL_KEYS) {
18133
- if (isHttpUrl(value[key])) branding[key] = value[key];
18512
+ if (isBrandAssetUrl(value[key])) branding[key] = value[key];
18134
18513
  }
18135
18514
  for (const key of BRANDING_COLOR_KEYS) {
18136
18515
  if (isHexColor(value[key])) branding[key] = value[key];
@@ -18141,6 +18520,9 @@ function sanitizeBranding(value) {
18141
18520
  branding[key] = text;
18142
18521
  }
18143
18522
  }
18523
+ if (typeof value.customCss === "string" && value.customCss.trim().length > 0 && validateCustomCss(value.customCss).ok) {
18524
+ branding.customCss = value.customCss;
18525
+ }
18144
18526
  return Object.keys(branding).length > 0 ? branding : void 0;
18145
18527
  }
18146
18528
  function sanitizeBrandingDomain(value) {
@@ -18412,10 +18794,19 @@ function validateBrandingFields(value, prefix, issues) {
18412
18794
  }
18413
18795
  }
18414
18796
  for (const key of BRANDING_URL_KEYS) {
18415
- if (value[key] !== void 0 && !isHttpUrl(value[key])) {
18797
+ if (value[key] !== void 0 && !isBrandAssetUrl(value[key])) {
18416
18798
  issues.push({
18417
18799
  path: `${prefix}.${key}`,
18418
- message: "must be an http(s) URL of at most 2048 characters"
18800
+ message: "must be an http(s) or root-relative URL of at most 2048 characters"
18801
+ });
18802
+ }
18803
+ }
18804
+ if (value.customCss !== void 0) {
18805
+ const result = validateCustomCss(value.customCss);
18806
+ if (!result.ok) {
18807
+ issues.push({
18808
+ path: `${prefix}.customCss`,
18809
+ message: result.reason === "length" ? `must be a string of at most ${MAX_CUSTOM_CSS_LENGTH} characters` : result.reason === "import" ? "must not contain @import" : "must not contain </style"
18419
18810
  });
18420
18811
  }
18421
18812
  }
@@ -18990,14 +19381,14 @@ var RESETTABLE_PATHS = /* @__PURE__ */ new Set([
18990
19381
  "rateLimits.maxActiveRunTasksPerTenant"
18991
19382
  ]);
18992
19383
  var RESET_PATH_PATTERN = /^[a-zA-Z][a-zA-Z0-9]*\.[a-zA-Z][a-zA-Z0-9]*$/;
18993
- function isRecord9(value) {
19384
+ function isRecord10(value) {
18994
19385
  return typeof value === "object" && value !== null && !Array.isArray(value);
18995
19386
  }
18996
19387
  function invalid(issues) {
18997
19388
  throw new PlatformSettingsValidationError(issues);
18998
19389
  }
18999
19390
  function parseUpdateBody(body) {
19000
- if (!isRecord9(body)) {
19391
+ if (!isRecord10(body)) {
19001
19392
  invalid([{ path: "", message: "must be an object" }]);
19002
19393
  }
19003
19394
  const expectedVersion = body.expectedVersion;
@@ -19006,7 +19397,7 @@ function parseUpdateBody(body) {
19006
19397
  { path: "expectedVersion", message: "must be a non-negative integer" }
19007
19398
  ]);
19008
19399
  }
19009
- if (body.patch !== void 0 && !isRecord9(body.patch)) {
19400
+ if (body.patch !== void 0 && !isRecord10(body.patch)) {
19010
19401
  invalid([{ path: "patch", message: "must be an object" }]);
19011
19402
  }
19012
19403
  if (body.reset !== void 0 && !Array.isArray(body.reset)) {
@@ -19036,13 +19427,13 @@ function parseResetPaths(reset) {
19036
19427
  return paths;
19037
19428
  }
19038
19429
  function buildDocumentPatch(patch, resetPaths) {
19039
- const document = isRecord9(patch) ? { ...patch } : {};
19430
+ const document = isRecord10(patch) ? { ...patch } : {};
19040
19431
  for (const path5 of resetPaths) {
19041
19432
  const dot = path5.indexOf(".");
19042
19433
  const section = path5.slice(0, dot);
19043
19434
  const leaf = path5.slice(dot + 1);
19044
19435
  const current3 = document[section];
19045
- if (current3 !== void 0 && !isRecord9(current3)) {
19436
+ if (current3 !== void 0 && !isRecord10(current3)) {
19046
19437
  continue;
19047
19438
  }
19048
19439
  document[section] = { ...current3 ?? {}, [leaf]: void 0 };
@@ -19052,7 +19443,7 @@ function buildDocumentPatch(patch, resetPaths) {
19052
19443
  function collectChangedKeys(patch, resetPaths) {
19053
19444
  const keys2 = new Set(resetPaths);
19054
19445
  for (const [section, value] of Object.entries(patch)) {
19055
- if (!isRecord9(value)) continue;
19446
+ if (!isRecord10(value)) continue;
19056
19447
  for (const [leaf, leafValue2] of Object.entries(value)) {
19057
19448
  if (leafValue2 !== void 0) keys2.add(`${section}.${leaf}`);
19058
19449
  }
@@ -19242,7 +19633,7 @@ function registerPlatformSettingsRoutes(app2, options) {
19242
19633
  }
19243
19634
 
19244
19635
  // src/controllers/branding.ts
19245
- function isRecord10(value) {
19636
+ function isRecord11(value) {
19246
19637
  return typeof value === "object" && value !== null && !Array.isArray(value);
19247
19638
  }
19248
19639
  function firstHeaderValue(value) {
@@ -19255,7 +19646,7 @@ function resolveBrandingRequestHost(request) {
19255
19646
  return firstHeaderValue(request.headers["x-axiom-host"]) ?? firstHeaderValue(request.headers["x-forwarded-host"]) ?? firstHeaderValue(request.headers.host) ?? request.hostname ?? "";
19256
19647
  }
19257
19648
  function parseUpdateBody2(body) {
19258
- if (!isRecord10(body)) {
19649
+ if (!isRecord11(body)) {
19259
19650
  throw new PlatformSettingsValidationError([
19260
19651
  { path: "", message: "must be an object" }
19261
19652
  ]);
@@ -19266,7 +19657,7 @@ function parseUpdateBody2(body) {
19266
19657
  { path: "expectedVersion", message: "must be a non-negative integer" }
19267
19658
  ]);
19268
19659
  }
19269
- if (!isRecord10(body.branding)) {
19660
+ if (!isRecord11(body.branding)) {
19270
19661
  throw new PlatformSettingsValidationError([
19271
19662
  { path: "branding", message: "must be an object" }
19272
19663
  ]);
@@ -20326,11 +20717,11 @@ var OidcProviderInputError = class extends Error {
20326
20717
  function inputError2(code, message, statusCode = 400) {
20327
20718
  return new OidcProviderInputError(code, message, statusCode);
20328
20719
  }
20329
- function isRecord11(value) {
20720
+ function isRecord12(value) {
20330
20721
  return typeof value === "object" && value !== null && !Array.isArray(value);
20331
20722
  }
20332
20723
  function bodyRecord2(body) {
20333
- if (!isRecord11(body)) {
20724
+ if (!isRecord12(body)) {
20334
20725
  throw inputError2("INVALID_INPUT", "Request body must be an object");
20335
20726
  }
20336
20727
  return body;
@@ -20390,6 +20781,13 @@ function normalizeIssuer(raw, allowInsecure, allowedPrivateHosts = []) {
20390
20781
  function normalizeClientId(value) {
20391
20782
  return requiredString2(value, "INVALID_CLIENT_ID", "Client id");
20392
20783
  }
20784
+ function normalizeClientSecret(value) {
20785
+ if (value === void 0 || value === null) return "";
20786
+ if (typeof value !== "string") {
20787
+ throw inputError2("INVALID_CLIENT_SECRET", "Client secret must be a string");
20788
+ }
20789
+ return value.trim();
20790
+ }
20393
20791
  function normalizeScopes(value, fallback) {
20394
20792
  if (value === void 0 || value === null) {
20395
20793
  if (fallback) return fallback;
@@ -20823,11 +21221,7 @@ var OidcProviderAdminController = class {
20823
21221
  allowedPrivateHosts ?? this.allowedPrivateHosts
20824
21222
  );
20825
21223
  const clientId = normalizeClientId(body.clientId);
20826
- const clientSecret = requiredString2(
20827
- body.clientSecret,
20828
- "CLIENT_SECRET_REQUIRED",
20829
- "Client secret"
20830
- );
21224
+ const clientSecret = normalizeClientSecret(body.clientSecret);
20831
21225
  const scopes = normalizeScopes(body.scopes, DEFAULT_SCOPES);
20832
21226
  const enabled = optionalBoolean(
20833
21227
  body.enabled,
@@ -20981,11 +21375,7 @@ var OidcProviderAdminController = class {
20981
21375
  allowedPrivateHosts
20982
21376
  ),
20983
21377
  clientId: normalizeClientId(body.clientId),
20984
- clientSecret: requiredString2(
20985
- body.clientSecret,
20986
- "CLIENT_SECRET_REQUIRED",
20987
- "Client secret"
20988
- ),
21378
+ clientSecret: normalizeClientSecret(body.clientSecret),
20989
21379
  allowInsecure: this.options.allowInsecure,
20990
21380
  ...allowedPrivateHosts.length ? { allowedPrivateHosts } : {}
20991
21381
  };
@@ -23364,7 +23754,7 @@ async function notifyInstallationChanged(tenantId, installationId) {
23364
23754
  console.error("Failed to notify channel installation change:", error);
23365
23755
  }
23366
23756
  }
23367
- function getTenantId20(request) {
23757
+ function getTenantId21(request) {
23368
23758
  const userTenantId = request.user?.tenantId;
23369
23759
  if (typeof userTenantId === "string" && userTenantId) {
23370
23760
  return userTenantId;
@@ -23500,7 +23890,7 @@ async function getInstallationStore() {
23500
23890
  });
23501
23891
  }
23502
23892
  async function getChannelInstallationList(request) {
23503
- const tenantId = getTenantId20(request);
23893
+ const tenantId = getTenantId21(request);
23504
23894
  const { channel } = request.query;
23505
23895
  try {
23506
23896
  const store2 = await getInstallationStore();
@@ -23526,7 +23916,7 @@ async function getChannelInstallationList(request) {
23526
23916
  }
23527
23917
  }
23528
23918
  async function getChannelInstallation(request, reply) {
23529
- const tenantId = getTenantId20(request);
23919
+ const tenantId = getTenantId21(request);
23530
23920
  const { installationId } = request.params;
23531
23921
  try {
23532
23922
  const store2 = await getInstallationStore();
@@ -23553,7 +23943,7 @@ async function getChannelInstallation(request, reply) {
23553
23943
  }
23554
23944
  }
23555
23945
  async function createChannelInstallation(request, reply) {
23556
- const tenantId = getTenantId20(request);
23946
+ const tenantId = getTenantId21(request);
23557
23947
  try {
23558
23948
  const body = snapshotPublicCreateRequest(request.body);
23559
23949
  if (!body) {
@@ -23614,7 +24004,7 @@ async function createChannelInstallation(request, reply) {
23614
24004
  }
23615
24005
  }
23616
24006
  async function updateChannelInstallation(request, reply) {
23617
- const tenantId = getTenantId20(request);
24007
+ const tenantId = getTenantId21(request);
23618
24008
  const { installationId } = request.params;
23619
24009
  try {
23620
24010
  const store2 = await getInstallationStore();
@@ -23751,7 +24141,7 @@ async function updateChannelInstallation(request, reply) {
23751
24141
  }
23752
24142
  }
23753
24143
  async function deleteChannelInstallation(request, reply) {
23754
- const tenantId = getTenantId20(request);
24144
+ const tenantId = getTenantId21(request);
23755
24145
  const { installationId } = request.params;
23756
24146
  try {
23757
24147
  const store2 = await getInstallationStore();
@@ -23824,7 +24214,7 @@ import {
23824
24214
  descriptorDataValue as descriptorDataValue2
23825
24215
  } from "@axiom-lattice/protocols";
23826
24216
  import { getBindingRegistry, getStoreLattice as getStoreLattice29 } from "@axiom-lattice/core";
23827
- function getTenantId21(request) {
24217
+ function getTenantId22(request) {
23828
24218
  const userTenantId = request.user?.tenantId;
23829
24219
  if (typeof userTenantId === "string" && userTenantId) return userTenantId;
23830
24220
  return request.headers["x-tenant-id"] || "default";
@@ -23897,7 +24287,7 @@ function invalidCreateRequest(reply) {
23897
24287
  }
23898
24288
  async function getBindingList(request, _reply) {
23899
24289
  void _reply;
23900
- const tenantId = getTenantId21(request);
24290
+ const tenantId = getTenantId22(request);
23901
24291
  const { channel, agentId, channelInstallationId, limit, offset } = request.query;
23902
24292
  try {
23903
24293
  const registry = getBindingRegistry();
@@ -23917,7 +24307,7 @@ async function getBindingList(request, _reply) {
23917
24307
  }
23918
24308
  }
23919
24309
  async function getBinding(request, reply) {
23920
- const tenantId = getTenantId21(request);
24310
+ const tenantId = getTenantId22(request);
23921
24311
  try {
23922
24312
  const registry = getBindingRegistry();
23923
24313
  const binding = await registry.findById(tenantId, request.params.id);
@@ -23932,7 +24322,7 @@ async function getBinding(request, reply) {
23932
24322
  }
23933
24323
  }
23934
24324
  async function createBinding(request, reply) {
23935
- const tenantId = getTenantId21(request);
24325
+ const tenantId = getTenantId22(request);
23936
24326
  try {
23937
24327
  const input = snapshotPublicCreate(request.body);
23938
24328
  if (!input) return invalidCreateRequest(reply);
@@ -23957,7 +24347,7 @@ async function createBinding(request, reply) {
23957
24347
  }
23958
24348
  async function updateBinding(request, reply) {
23959
24349
  try {
23960
- const tenantId = getTenantId21(request);
24350
+ const tenantId = getTenantId22(request);
23961
24351
  const registry = getBindingRegistry();
23962
24352
  const existing = await registry.findById(tenantId, request.params.id);
23963
24353
  if (!existing || isInternalBinding(existing)) {
@@ -23984,7 +24374,7 @@ async function updateBinding(request, reply) {
23984
24374
  }
23985
24375
  async function deleteBinding(request, reply) {
23986
24376
  try {
23987
- const tenantId = getTenantId21(request);
24377
+ const tenantId = getTenantId22(request);
23988
24378
  const registry = getBindingRegistry();
23989
24379
  const existing = await registry.findById(tenantId, request.params.id);
23990
24380
  if (!existing || isInternalBinding(existing)) {
@@ -24001,7 +24391,7 @@ async function deleteBinding(request, reply) {
24001
24391
  }
24002
24392
  async function resolveBinding(request, _reply) {
24003
24393
  void _reply;
24004
- const tenantId = getTenantId21(request);
24394
+ const tenantId = getTenantId22(request);
24005
24395
  const { channel, senderId, channelInstallationId } = request.query;
24006
24396
  if (channel === "room") {
24007
24397
  return { success: false, message: "No binding found", data: null };
@@ -24031,7 +24421,7 @@ function registerChannelBindingRoutes(app2) {
24031
24421
 
24032
24422
  // src/controllers/menu-items.ts
24033
24423
  import { getMenuRegistry } from "@axiom-lattice/core";
24034
- function getTenantId22(request) {
24424
+ function getTenantId23(request) {
24035
24425
  const userTenantId = request.user?.tenantId;
24036
24426
  if (userTenantId) return userTenantId;
24037
24427
  return request.headers["x-tenant-id"] || "default";
@@ -24046,7 +24436,7 @@ function sanitizeUpdatePatch(body) {
24046
24436
  return patch;
24047
24437
  }
24048
24438
  async function getMenuItemList(request, _reply) {
24049
- const tenantId = getTenantId22(request);
24439
+ const tenantId = getTenantId23(request);
24050
24440
  try {
24051
24441
  const registry = getMenuRegistry();
24052
24442
  const items = await registry.list({ tenantId, menuTarget: request.query.menuTarget });
@@ -24058,7 +24448,7 @@ async function getMenuItemList(request, _reply) {
24058
24448
  }
24059
24449
  }
24060
24450
  async function getMenuItem(request, reply) {
24061
- const tenantId = getTenantId22(request);
24451
+ const tenantId = getTenantId23(request);
24062
24452
  try {
24063
24453
  const registry = getMenuRegistry();
24064
24454
  const item = await registry.getById(request.params.id);
@@ -24075,7 +24465,7 @@ async function getMenuItem(request, reply) {
24075
24465
  }
24076
24466
  }
24077
24467
  async function createMenuItem(request, reply) {
24078
- const tenantId = getTenantId22(request);
24468
+ const tenantId = getTenantId23(request);
24079
24469
  try {
24080
24470
  const registry = getMenuRegistry();
24081
24471
  const item = await registry.create({ ...request.body, tenantId });
@@ -24090,7 +24480,7 @@ async function createMenuItem(request, reply) {
24090
24480
  }
24091
24481
  async function updateMenuItem(request, reply) {
24092
24482
  try {
24093
- const tenantId = getTenantId22(request);
24483
+ const tenantId = getTenantId23(request);
24094
24484
  const registry = getMenuRegistry();
24095
24485
  const existing = await registry.getById(request.params.id);
24096
24486
  if (!existing || existing.tenantId !== tenantId) {
@@ -24111,7 +24501,7 @@ async function updateMenuItem(request, reply) {
24111
24501
  }
24112
24502
  async function deleteMenuItem(request, reply) {
24113
24503
  try {
24114
- const tenantId = getTenantId22(request);
24504
+ const tenantId = getTenantId23(request);
24115
24505
  const registry = getMenuRegistry();
24116
24506
  const existing = await registry.getById(request.params.id);
24117
24507
  if (!existing || existing.tenantId !== tenantId) {
@@ -24410,7 +24800,7 @@ import { getStoreLattice as getStoreLattice30 } from "@axiom-lattice/core";
24410
24800
  import {
24411
24801
  AgentType as AgentType2
24412
24802
  } from "@axiom-lattice/protocols";
24413
- function getTenantId23(request) {
24803
+ function getTenantId24(request) {
24414
24804
  const userTenantId = request.user?.tenantId;
24415
24805
  if (userTenantId) return userTenantId;
24416
24806
  return request.headers["x-tenant-id"] || "default";
@@ -24447,7 +24837,7 @@ async function requireManagedAssistant(request, reply) {
24447
24837
  reply.status(400).send({ success: false, error: "assistantId is required" });
24448
24838
  return null;
24449
24839
  }
24450
- const registered = await getLocalA2AAssistant(getTenantId23(request), assistantId);
24840
+ const registered = await getLocalA2AAssistant(getTenantId24(request), assistantId);
24451
24841
  if (!registered) {
24452
24842
  reply.status(404).send({
24453
24843
  success: false,
@@ -24458,7 +24848,7 @@ async function requireManagedAssistant(request, reply) {
24458
24848
  return { assistantId, localRuntime: registered.localRuntime };
24459
24849
  }
24460
24850
  async function getLocalA2AStatus(request, reply) {
24461
- const tenantId = getTenantId23(request);
24851
+ const tenantId = getTenantId24(request);
24462
24852
  const managed = await getLocalA2AAssistants(tenantId);
24463
24853
  const states = await Promise.all(
24464
24854
  managed.map(
@@ -24679,7 +25069,7 @@ function registerTaskRoutes(app2, controller) {
24679
25069
  import {
24680
25070
  agentInstanceManager as agentInstanceManager9,
24681
25071
  agentLatticeManager as agentLatticeManager7,
24682
- embeddingsLatticeManager as embeddingsLatticeManager2,
25072
+ embeddingsLatticeManager as embeddingsLatticeManager3,
24683
25073
  sttModelLatticeManager as sttModelLatticeManager2,
24684
25074
  vectorStoreLatticeManager,
24685
25075
  createProjectTaskReassignmentAuthorizer,
@@ -24791,7 +25181,7 @@ function snapshotTaskItem(value) {
24791
25181
  try {
24792
25182
  const metadata = row.metadata === void 0 ? void 0 : snapshotJsonValue(row.metadata);
24793
25183
  const context2 = row.context === void 0 ? void 0 : snapshotJsonValue(row.context);
24794
- if (metadata !== void 0 && !isRecord12(metadata) || context2 !== void 0 && !isRecord12(context2)) return void 0;
25184
+ if (metadata !== void 0 && !isRecord13(metadata) || context2 !== void 0 && !isRecord13(context2)) return void 0;
24795
25185
  const dependencies = row.dependencies === void 0 ? void 0 : snapshotJsonValue(row.dependencies);
24796
25186
  if (dependencies !== void 0 && (!Array.isArray(dependencies) || dependencies.some((id3) => typeof id3 !== "string"))) return void 0;
24797
25187
  const files = row.files === void 0 ? void 0 : snapshotJsonValue(row.files);
@@ -24891,7 +25281,7 @@ function snapshotThread(value) {
24891
25281
  if (!row || !createdAt || !updatedAt || row.expiresAt !== void 0 && !expiresAt || typeof row.id !== "string" || !row.id || typeof row.tenantId !== "string" || !row.tenantId || typeof row.assistantId !== "string" || !row.assistantId) return void 0;
24892
25282
  try {
24893
25283
  const metadata = row.metadata === void 0 ? void 0 : snapshotJsonValue(row.metadata);
24894
- if (metadata !== void 0 && !isRecord12(metadata)) return void 0;
25284
+ if (metadata !== void 0 && !isRecord13(metadata)) return void 0;
24895
25285
  return {
24896
25286
  id: row.id,
24897
25287
  tenantId: row.tenantId,
@@ -24905,7 +25295,7 @@ function snapshotThread(value) {
24905
25295
  return void 0;
24906
25296
  }
24907
25297
  }
24908
- function isRecord12(value) {
25298
+ function isRecord13(value) {
24909
25299
  return typeof value === "object" && value !== null && !Array.isArray(value);
24910
25300
  }
24911
25301
  function isTaskFileRef(value) {
@@ -26343,7 +26733,7 @@ var protectedLifecycleKeys = /* @__PURE__ */ new Set([
26343
26733
  "status",
26344
26734
  "interruptedAt"
26345
26735
  ]);
26346
- function getTenantId24(request) {
26736
+ function getTenantId25(request) {
26347
26737
  const user = request.user;
26348
26738
  const value = user?.tenantId ?? request.headers["x-tenant-id"] ?? "default";
26349
26739
  if (typeof value !== "string" || !value) throw new HttpTaskError(400, "INVALID_TASK_INPUT");
@@ -26585,7 +26975,7 @@ async function validateReferences(store2, task, parentId, dependencies) {
26585
26975
  function createTaskController(deps) {
26586
26976
  const mutationMutex = deps.projectMutationMutex ?? projectMutationMutex;
26587
26977
  const authorize2 = async (request, projectId, capability2) => deps.access.requireProjectAccess({
26588
- tenantId: getTenantId24(request),
26978
+ tenantId: getTenantId25(request),
26589
26979
  userId: getUserId7(request),
26590
26980
  projectId,
26591
26981
  capability: capability2
@@ -26603,7 +26993,7 @@ function createTaskController(deps) {
26603
26993
  });
26604
26994
  };
26605
26995
  const list = withErrors(async (request) => {
26606
- const tenantId = getTenantId24(request);
26996
+ const tenantId = getTenantId25(request);
26607
26997
  const userId = getUserId7(request);
26608
26998
  const query = exactObject(request.query, ["projectId", "status", "priority", "limit", "offset", "ownerType", "ownerId", "parentId", "metadata"]);
26609
26999
  const projectId = typeof query.projectId === "string" ? query.projectId : void 0;
@@ -26675,14 +27065,14 @@ function createTaskController(deps) {
26675
27065
  });
26676
27066
  const get = withErrors(async (request, reply) => {
26677
27067
  await preauthorizeExplicitProject(request, authorize2);
26678
- const current3 = await deps.tasks.getById(getTenantId24(request), request.params.id);
27068
+ const current3 = await deps.tasks.getById(getTenantId25(request), request.params.id);
26679
27069
  if (!current3) return sendNotFound(reply);
26680
27070
  await authorizeRead(request, current3, authorize2);
26681
27071
  return { success: true, data: current3 };
26682
27072
  });
26683
27073
  const create = withErrors(async (request, reply) => {
26684
27074
  const body = snapshotCreate(request.body);
26685
- const tenantId = getTenantId24(request);
27075
+ const tenantId = getTenantId25(request);
26686
27076
  const userId = getUserId7(request);
26687
27077
  const governed = governedCreate(body);
26688
27078
  if (governed) return reply.code(409).send({ success: false, code: governed });
@@ -26738,7 +27128,7 @@ function createTaskController(deps) {
26738
27128
  const body = snapshotUpdate(request.body);
26739
27129
  if ("status" in body) throw new HttpTaskError(400, "STATUS_USES_COMMAND");
26740
27130
  await preauthorizeExplicitProject(request, authorize2);
26741
- const current3 = await deps.tasks.getById(getTenantId24(request), request.params.id);
27131
+ const current3 = await deps.tasks.getById(getTenantId25(request), request.params.id);
26742
27132
  if (!current3) return sendNotFound(reply);
26743
27133
  await authorizeMutation(request, current3, authorize2);
26744
27134
  return lockedTask(request, current3, async (locked) => {
@@ -26754,7 +27144,7 @@ function createTaskController(deps) {
26754
27144
  });
26755
27145
  const remove = withErrors(async (request, reply) => {
26756
27146
  await preauthorizeExplicitProject(request, authorize2);
26757
- const current3 = await deps.tasks.getById(getTenantId24(request), request.params.id);
27147
+ const current3 = await deps.tasks.getById(getTenantId25(request), request.params.id);
26758
27148
  if (!current3) return sendNotFound(reply);
26759
27149
  await authorizeMutation(request, current3, authorize2);
26760
27150
  return lockedTask(request, current3, async (locked) => {
@@ -26773,7 +27163,7 @@ function createTaskController(deps) {
26773
27163
  const complete = withErrors(async (request, reply) => {
26774
27164
  const body = snapshotComplete(request.body);
26775
27165
  await preauthorizeExplicitProject(request, authorize2);
26776
- const current3 = await deps.tasks.getById(getTenantId24(request), request.params.id);
27166
+ const current3 = await deps.tasks.getById(getTenantId25(request), request.params.id);
26777
27167
  if (!current3) return sendNotFound(reply);
26778
27168
  await authorizeMutation(request, current3, authorize2);
26779
27169
  return lockedTask(request, current3, async (locked) => {
@@ -26791,7 +27181,7 @@ function createTaskController(deps) {
26791
27181
  const command = withErrors(async (request, reply) => {
26792
27182
  const body = snapshotCommand(request.body);
26793
27183
  await preauthorizeExplicitProject(request, authorize2);
26794
- const current3 = await deps.tasks.getById(getTenantId24(request), request.params.id);
27184
+ const current3 = await deps.tasks.getById(getTenantId25(request), request.params.id);
26795
27185
  if (!current3) return sendNotFound(reply);
26796
27186
  const capability2 = commandCapability(body.type);
26797
27187
  await authorizeCommand(request, current3, authorize2, capability2);
@@ -26806,7 +27196,7 @@ function createTaskController(deps) {
26806
27196
  });
26807
27197
  const workItems = withErrors(async (request, reply) => {
26808
27198
  await preauthorizeExplicitProject(request, authorize2);
26809
- const current3 = await deps.tasks.getById(getTenantId24(request), request.params.id);
27199
+ const current3 = await deps.tasks.getById(getTenantId25(request), request.params.id);
26810
27200
  if (!current3) return sendNotFound(reply);
26811
27201
  await authorizeRead(request, current3, authorize2);
26812
27202
  const query = exactObject(request.query, ["action", "limit", "offset"]);
@@ -27140,8 +27530,9 @@ function normalizeError(reply, error) {
27140
27530
  error: { code: error.code, message: error.message, retryable: false }
27141
27531
  });
27142
27532
  }
27143
- if (error.statusCode && error.statusCode >= 400 && error.statusCode < 500) {
27144
- return invalidRequest2(reply, error.statusCode);
27533
+ const statusCode = typeof error === "object" && error !== null && "statusCode" in error ? error.statusCode : void 0;
27534
+ if (typeof statusCode === "number" && statusCode >= 400 && statusCode < 500) {
27535
+ return invalidRequest2(reply, statusCode);
27145
27536
  }
27146
27537
  return reply.code(500).send({
27147
27538
  success: false,
@@ -27163,7 +27554,7 @@ import { z as z5, ZodError as ZodError2 } from "zod";
27163
27554
  import { createHash as createHash6, randomUUID as randomUUID27 } from "crypto";
27164
27555
  import { MessageChunkTypes as MessageChunkTypes4, parseAgentWebAppGenUIBlock, buildAffinityMissChunk as buildAffinityMissChunk2 } from "@axiom-lattice/protocols";
27165
27556
  import { getReplicaId as getReplicaId7, getThreadRunOwner as getThreadRunOwner2, normalizeAgentInterrupts as normalizeAgentInterrupts2 } from "@axiom-lattice/core";
27166
- function isRecord13(value) {
27557
+ function isRecord14(value) {
27167
27558
  return typeof value === "object" && value !== null && !Array.isArray(value);
27168
27559
  }
27169
27560
  var AgentWebAppRuntimeError = class extends Error {
@@ -27309,7 +27700,7 @@ var AgentWebAppRuntimeService = class {
27309
27700
  projectId: runtime.project.id
27310
27701
  });
27311
27702
  return messages.flatMap((message) => {
27312
- if (!isRecord13(message) || typeof message.id !== "string" || message.role !== "human" && message.role !== "ai") return [];
27703
+ if (!isRecord14(message) || typeof message.id !== "string" || message.role !== "human" && message.role !== "ai") return [];
27313
27704
  const content = typeof message.content === "string" ? message.content : runtime.webApp.features.genUI && Array.isArray(message.content) ? message.content.map(parseAgentWebAppGenUIBlock).filter((block) => block !== void 0) : void 0;
27314
27705
  return [{ id: message.id, role: message.role, ...content && (typeof content === "string" || content.length > 0) ? { content } : {} }];
27315
27706
  });
@@ -28110,7 +28501,7 @@ function registerAgentWebAppRuntimeRoutes(app2, deps) {
28110
28501
  }
28111
28502
  const mirrorThreadParams = z5.object({ webAppId: idSchema, assistantId: idSchema, threadId: idSchema }).strict();
28112
28503
  const mirrorRunParams = mirrorThreadParams.extend({ runId: idSchema }).strict();
28113
- const isRecord19 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
28504
+ const isRecord20 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
28114
28505
  const scopedConsoleRequest = (request, scope) => {
28115
28506
  const proxy = Object.create(request);
28116
28507
  const runId = request.params.runId;
@@ -28129,22 +28520,22 @@ function registerAgentWebAppRuntimeRoutes(app2, deps) {
28129
28520
  return proxy;
28130
28521
  };
28131
28522
  const withRuntimeModel = (body, scope) => {
28132
- if (scope.modelKey === void 0 || !isRecord19(body) || !isRecord19(body.args)) return body;
28523
+ if (scope.modelKey === void 0 || !isRecord20(body) || !isRecord20(body.args)) return body;
28133
28524
  const args = body.args;
28134
- if (!isRecord19(args.config)) {
28525
+ if (!isRecord20(args.config)) {
28135
28526
  return { ...body, args: { ...args, config: { modelConfig: { modelKey: scope.modelKey } } } };
28136
28527
  }
28137
28528
  const config = args.config;
28138
- const modelConfig = isRecord19(config.modelConfig) ? config.modelConfig : {};
28529
+ const modelConfig = isRecord20(config.modelConfig) ? config.modelConfig : {};
28139
28530
  return {
28140
28531
  ...body,
28141
28532
  args: { ...args, config: { ...config, modelConfig: { ...modelConfig, modelKey: scope.modelKey } } }
28142
28533
  };
28143
28534
  };
28144
28535
  const withRunModel = (body, scope) => {
28145
- if (scope.modelKey === void 0 || !isRecord19(body)) return body;
28146
- const config = isRecord19(body.config) ? body.config : {};
28147
- const modelConfig = isRecord19(config.modelConfig) ? config.modelConfig : {};
28536
+ if (scope.modelKey === void 0 || !isRecord20(body)) return body;
28537
+ const config = isRecord20(body.config) ? body.config : {};
28538
+ const modelConfig = isRecord20(config.modelConfig) ? config.modelConfig : {};
28148
28539
  return { ...body, config: { ...config, modelConfig: { ...modelConfig, modelKey: scope.modelKey } } };
28149
28540
  };
28150
28541
  const selectionFor = (request) => projectQueryLenientSchema.parse(request.query);
@@ -28235,7 +28626,7 @@ function registerAgentWebAppRuntimeRoutes(app2, deps) {
28235
28626
  const selection = withPreview(selectionFor(request), identity.preview);
28236
28627
  const scope = await deps.service.authorizeThread(webAppId, identity.userId, threadId, selection);
28237
28628
  if (scope.assistantId !== assistantId) throw new AgentWebAppRuntimeError("THREAD_NOT_FOUND", 404, "Thread not found");
28238
- const command = isRecord19(request.body) && typeof request.body.command === "string" ? request.body.command : void 0;
28629
+ const command = isRecord20(request.body) && typeof request.body.command === "string" ? request.body.command : void 0;
28239
28630
  if (command === "input.respond" && !scope.hitl) {
28240
28631
  throw new AgentWebAppRuntimeError("FEATURE_DISABLED", 403, "HITL is disabled");
28241
28632
  }
@@ -28283,7 +28674,7 @@ function registerAgentWebAppRuntimeRoutes(app2, deps) {
28283
28674
  const params = mirrorThreadParams.parse(request.params);
28284
28675
  const { proxy, scope } = await authorizeRunMirror(request, params);
28285
28676
  const body = request.body;
28286
- if (isRecord19(body) && body.command !== void 0 && body.command !== null && scope.hitl === false) {
28677
+ if (isRecord20(body) && body.command !== void 0 && body.command !== null && scope.hitl === false) {
28287
28678
  throw new AgentWebAppRuntimeError(
28288
28679
  "FEATURE_DISABLED",
28289
28680
  403,
@@ -28548,9 +28939,10 @@ function resolveBundledEmbedDir() {
28548
28939
  }
28549
28940
  return null;
28550
28941
  }
28942
+ var EMBED_ASSET_BASE = "../../../embed";
28551
28943
  function renderChatShell(chunkCssFiles) {
28552
28944
  const chunkCssLinks = chunkCssFiles.map(
28553
- (name) => ` <link rel="stylesheet" href="/embed/${name}" />`
28945
+ (name) => ` <link rel="stylesheet" href="${EMBED_ASSET_BASE}/${name}" />`
28554
28946
  );
28555
28947
  return [
28556
28948
  "<!doctype html>",
@@ -28559,7 +28951,7 @@ function renderChatShell(chunkCssFiles) {
28559
28951
  ' <meta charset="utf-8" />',
28560
28952
  ' <meta name="viewport" content="width=device-width, initial-scale=1" />',
28561
28953
  " <title>Agent chat</title>",
28562
- ' <link rel="stylesheet" href="/embed/embed-page.css" />',
28954
+ ` <link rel="stylesheet" href="${EMBED_ASSET_BASE}/embed-page.css" />`,
28563
28955
  ...chunkCssLinks,
28564
28956
  " </head>",
28565
28957
  " <body>",
@@ -28567,7 +28959,7 @@ function renderChatShell(chunkCssFiles) {
28567
28959
  " <noscript>This chat requires JavaScript.</noscript>",
28568
28960
  ' <p class="axiom-embed-loading">Loading chat\u2026</p>',
28569
28961
  " </div>",
28570
- ' <script type="module" src="/embed/embed-page.js"></script>',
28962
+ ` <script type="module" src="${EMBED_ASSET_BASE}/embed-page.js"></script>`,
28571
28963
  " </body>",
28572
28964
  "</html>"
28573
28965
  ].join("\n");
@@ -35159,7 +35551,7 @@ function snapshotProjectableWorkItem(value) {
35159
35551
  if (!row || !createdAt || typeof row.id !== "string" || !row.id || typeof row.taskId !== "string" || !row.taskId || typeof row.tenantId !== "string" || !row.tenantId || typeof row.workspaceId !== "string" || !row.workspaceId || typeof row.projectId !== "string" || !row.projectId || typeof row.actor !== "string" || !row.actor || typeof row.eventKey !== "string" || !row.eventKey || !PROJECT_TASK_LIFECYCLE_ACTIONS.includes(row.action) || row.threadId !== void 0 && typeof row.threadId !== "string" || row.summary !== void 0 && typeof row.summary !== "string" || row.attempt !== void 0 && (typeof row.attempt !== "number" || !Number.isFinite(row.attempt))) return void 0;
35160
35552
  try {
35161
35553
  const detail = row.detail === void 0 ? void 0 : snapshotJsonValue(row.detail);
35162
- if (detail !== void 0 && !isRecord14(detail)) return void 0;
35554
+ if (detail !== void 0 && !isRecord15(detail)) return void 0;
35163
35555
  return {
35164
35556
  id: row.id,
35165
35557
  taskId: row.taskId,
@@ -35282,7 +35674,7 @@ function snapshotLifecycleCursor(value) {
35282
35674
  const createdAt = cloneExactDate(row?.createdAt);
35283
35675
  return row && typeof row.id === "string" && row.id.length > 0 && createdAt ? { id: row.id, createdAt } : void 0;
35284
35676
  }
35285
- function isRecord14(value) {
35677
+ function isRecord15(value) {
35286
35678
  return typeof value === "object" && value !== null && !Array.isArray(value);
35287
35679
  }
35288
35680
 
@@ -37325,7 +37717,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
37325
37717
  forgetTenantDefaultMiss: (tenantId) => modelLatticeManager3.forgetTenantDefaultMiss(tenantId),
37326
37718
  evictProviderCache: (tenantId, providerId2) => {
37327
37719
  modelLatticeManager3.evictProviderCache(tenantId, providerId2);
37328
- embeddingsLatticeManager2.evictProviderCache(tenantId, providerId2);
37720
+ embeddingsLatticeManager3.evictProviderCache(tenantId, providerId2);
37329
37721
  sttModelLatticeManager2.evictProviderCache(tenantId, providerId2);
37330
37722
  vectorStoreLatticeManager.clearTenantVectorStores(tenantId);
37331
37723
  }
@@ -37662,6 +38054,8 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
37662
38054
  app2.get("/api/embeddings", listEmbeddings);
37663
38055
  app2.get("/api/collections/:name/entries", listEntries);
37664
38056
  app2.post("/api/collections/:name/entries", createEntry);
38057
+ app2.post("/api/collections/:name/entries/batch", createEntries);
38058
+ app2.delete("/api/collections/:name/entries/batch", deleteEntries);
37665
38059
  app2.get("/api/collections/:name/entries/:id", getEntry);
37666
38060
  app2.put("/api/collections/:name/entries/:id", updateEntry);
37667
38061
  app2.delete("/api/collections/:name/entries/:id", deleteEntry);
@@ -40062,7 +40456,7 @@ var MAX_TRACKED_STREAMS = 1e3;
40062
40456
  var sentCardsByTaskId = /* @__PURE__ */ new Map();
40063
40457
  var handledCardEventKeys = /* @__PURE__ */ new Map();
40064
40458
  var ACKNOWLEDGED_TTL_MS = 10 * 6e4;
40065
- function isRecord15(value) {
40459
+ function isRecord16(value) {
40066
40460
  return value !== null && typeof value === "object" && !Array.isArray(value);
40067
40461
  }
40068
40462
  function replyKeyOf(installationId, reqId) {
@@ -40225,7 +40619,7 @@ function acknowledgedCard(taskId, eventKey) {
40225
40619
  const desc = eventKey ? `\u5DF2\u6536\u5230\uFF1A${eventKey}` : "\u5DF2\u63D0\u4EA4\uFF0C\u6B63\u5728\u5904\u7406\u2026";
40226
40620
  const original = sentCardForTask(taskId);
40227
40621
  if (original) {
40228
- const mainTitle = isRecord15(original.main_title) ? original.main_title : {};
40622
+ const mainTitle = isRecord16(original.main_title) ? original.main_title : {};
40229
40623
  return { ...original, main_title: { ...mainTitle, desc } };
40230
40624
  }
40231
40625
  return {
@@ -40235,7 +40629,7 @@ function acknowledgedCard(taskId, eventKey) {
40235
40629
  };
40236
40630
  }
40237
40631
  function cardEventFields(event) {
40238
- const nested = isRecord15(event?.template_card_event) ? event.template_card_event : event;
40632
+ const nested = isRecord16(event?.template_card_event) ? event.template_card_event : event;
40239
40633
  const source = nested ?? {};
40240
40634
  return {
40241
40635
  cardEvent: source,
@@ -42559,7 +42953,7 @@ function errorMessage6(error) {
42559
42953
 
42560
42954
  // src/services/channel-reply/loadFinalReplyText.ts
42561
42955
  import { agentInstanceManager as agentInstanceManager11 } from "@axiom-lattice/core";
42562
- function isRecord16(value) {
42956
+ function isRecord17(value) {
42563
42957
  return typeof value === "object" && value !== null && !Array.isArray(value);
42564
42958
  }
42565
42959
  function contentToText(content) {
@@ -42571,27 +42965,27 @@ function contentToText(content) {
42571
42965
  parts.push(block);
42572
42966
  continue;
42573
42967
  }
42574
- if (isRecord16(block) && typeof block.text === "string") {
42968
+ if (isRecord17(block) && typeof block.text === "string") {
42575
42969
  parts.push(block.text);
42576
42970
  }
42577
42971
  }
42578
42972
  return parts.join("");
42579
42973
  }
42580
42974
  function messageContent(message) {
42581
- if (!isRecord16(message)) return void 0;
42975
+ if (!isRecord17(message)) return void 0;
42582
42976
  if ("content" in message) return message.content;
42583
42977
  const kwargs = message.kwargs;
42584
- return isRecord16(kwargs) ? kwargs.content : void 0;
42978
+ return isRecord17(kwargs) ? kwargs.content : void 0;
42585
42979
  }
42586
42980
  function isAiMessage(message) {
42587
- if (!isRecord16(message)) return false;
42981
+ if (!isRecord17(message)) return false;
42588
42982
  if (message.role === "ai" || message.type === "ai") return true;
42589
42983
  return typeof message.getType === "function" && message.getType() === "ai";
42590
42984
  }
42591
42985
  function extractLastAiMessageText(state) {
42592
- if (!isRecord16(state)) return "";
42986
+ if (!isRecord17(state)) return "";
42593
42987
  const values = state.values;
42594
- if (!isRecord16(values) || !Array.isArray(values.messages)) return "";
42988
+ if (!isRecord17(values) || !Array.isArray(values.messages)) return "";
42595
42989
  for (let index = values.messages.length - 1; index >= 0; index -= 1) {
42596
42990
  const message = values.messages[index];
42597
42991
  if (!isAiMessage(message)) continue;
@@ -42628,7 +43022,7 @@ async function prepareProjectTaskRuntime(runtime, log2) {
42628
43022
  // src/services/platform-ops/PlatformOpsPlugin.ts
42629
43023
  import { AgentType as AgentType3, PLATFORM_OPS_AGENT_ID as PLATFORM_OPS_AGENT_ID3 } from "@axiom-lattice/protocols";
42630
43024
 
42631
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/chat_models/universal.js
43025
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/chat_models/universal.js
42632
43026
  import { BaseChatModel } from "@langchain/core/language_models/chat_models";
42633
43027
  import { RunnableBinding, ensureConfig } from "@langchain/core/runnables";
42634
43028
  import { AsyncGeneratorWithSetup, IterableReadableStream } from "@langchain/core/utils/stream";
@@ -42724,7 +43118,7 @@ var MODEL_PROVIDER_CONFIG = {
42724
43118
  };
42725
43119
  var SUPPORTED_PROVIDERS = Object.keys(MODEL_PROVIDER_CONFIG);
42726
43120
 
42727
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/tools/headless.js
43121
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/tools/headless.js
42728
43122
  import { tool } from "@langchain/core/tools";
42729
43123
  function createHeadlessTool(fields) {
42730
43124
  const { name, description, schema: schema2 } = fields;
@@ -42755,30 +43149,30 @@ var tool$1 = ((funcOrFields, fields) => {
42755
43149
  return tool(funcOrFields, fields);
42756
43150
  });
42757
43151
 
42758
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/errors.js
43152
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/errors.js
42759
43153
  import { isGraphBubbleUp } from "@langchain/langgraph";
42760
43154
 
42761
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/responses.js
43155
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/responses.js
42762
43156
  import { isInteropZodObject, isInteropZodSchema } from "@langchain/core/utils/types";
42763
43157
  import { Validator, toJsonSchema } from "@langchain/core/utils/json_schema";
42764
43158
  import { isSerializableSchema } from "@langchain/core/utils/standard_schema";
42765
43159
 
42766
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/utils.js
43160
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/utils.js
42767
43161
  import { AIMessage, ToolMessage } from "@langchain/core/messages";
42768
43162
  import { isLangChainTool } from "@langchain/core/tools";
42769
43163
  import { convertToOpenAITool } from "@langchain/core/utils/function_calling";
42770
43164
 
42771
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/transformers/tool-call.js
43165
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/transformers/tool-call.js
42772
43166
  import { ToolMessage as ToolMessage2 } from "@langchain/core/messages";
42773
43167
  import { StreamChannel } from "@langchain/langgraph";
42774
43168
 
42775
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/transformers/subagent.js
43169
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/transformers/subagent.js
42776
43170
  import { StreamChannel as StreamChannel2, createMessagesTransformer } from "@langchain/langgraph";
42777
43171
 
42778
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/types.js
43172
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/types.js
42779
43173
  var MIDDLEWARE_BRAND = Symbol.for("AgentMiddleware");
42780
43174
 
42781
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware.js
43175
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware.js
42782
43176
  function createMiddleware(config) {
42783
43177
  return {
42784
43178
  [MIDDLEWARE_BRAND]: true,
@@ -42796,25 +43190,25 @@ function createMiddleware(config) {
42796
43190
  };
42797
43191
  }
42798
43192
 
42799
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/tests/utils.js
43193
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/tests/utils.js
42800
43194
  import { AIMessage as AIMessage2, HumanMessage } from "@langchain/core/messages";
42801
43195
  import { BaseChatModel as BaseChatModel2 } from "@langchain/core/language_models/chat_models";
42802
43196
  import { RunnableLambda } from "@langchain/core/runnables";
42803
43197
  import "@langchain/core/tools";
42804
43198
 
42805
- // ../../node_modules/.pnpm/@langchain+langgraph-checkpoint@1.2.1_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@o_3c2d31ea38adcb814a776743edbe30f6/node_modules/@langchain/langgraph-checkpoint/dist/id.js
43199
+ // ../../node_modules/.pnpm/@langchain+langgraph-checkpoint@1.2.1_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@o_21f4cb933fdb001300ead1c867120b5d/node_modules/@langchain/langgraph-checkpoint/dist/id.js
42806
43200
  import { v5, v6 } from "@langchain/core/utils/uuid";
42807
43201
 
42808
- // ../../node_modules/.pnpm/@langchain+langgraph-checkpoint@1.2.1_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@o_3c2d31ea38adcb814a776743edbe30f6/node_modules/@langchain/langgraph-checkpoint/dist/serde/types.js
43202
+ // ../../node_modules/.pnpm/@langchain+langgraph-checkpoint@1.2.1_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@o_21f4cb933fdb001300ead1c867120b5d/node_modules/@langchain/langgraph-checkpoint/dist/serde/types.js
42809
43203
  var ERROR = "__error__";
42810
43204
  var SCHEDULED = "__scheduled__";
42811
43205
  var INTERRUPT = "__interrupt__";
42812
43206
  var RESUME = "__resume__";
42813
43207
 
42814
- // ../../node_modules/.pnpm/@langchain+langgraph-checkpoint@1.2.1_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@o_3c2d31ea38adcb814a776743edbe30f6/node_modules/@langchain/langgraph-checkpoint/dist/serde/jsonplus.js
43208
+ // ../../node_modules/.pnpm/@langchain+langgraph-checkpoint@1.2.1_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@o_21f4cb933fdb001300ead1c867120b5d/node_modules/@langchain/langgraph-checkpoint/dist/serde/jsonplus.js
42815
43209
  import { load } from "@langchain/core/load";
42816
43210
 
42817
- // ../../node_modules/.pnpm/@langchain+langgraph-checkpoint@1.2.1_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@o_3c2d31ea38adcb814a776743edbe30f6/node_modules/@langchain/langgraph-checkpoint/dist/base.js
43211
+ // ../../node_modules/.pnpm/@langchain+langgraph-checkpoint@1.2.1_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@o_21f4cb933fdb001300ead1c867120b5d/node_modules/@langchain/langgraph-checkpoint/dist/base.js
42818
43212
  var WRITES_IDX_MAP = {
42819
43213
  [ERROR]: -1,
42820
43214
  [SCHEDULED]: -2,
@@ -42822,52 +43216,52 @@ var WRITES_IDX_MAP = {
42822
43216
  [RESUME]: -4
42823
43217
  };
42824
43218
 
42825
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/tests/utils.js
43219
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/tests/utils.js
42826
43220
  import "zod/v3";
42827
43221
 
42828
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/annotation.js
43222
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/annotation.js
42829
43223
  import { MessagesValue, ReducedValue, StateSchema, UntrackedValue } from "@langchain/langgraph";
42830
43224
  import { schemaMetaRegistry } from "@langchain/langgraph/zod";
42831
43225
  import { getInteropZodObjectShape, isInteropZodObject as isInteropZodObject2, isZodSchemaV4 } from "@langchain/core/utils/types";
42832
43226
 
42833
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/utils.js
43227
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/utils.js
42834
43228
  import { AIMessage as AIMessage3, AIMessageChunk, SystemMessage, ToolMessage as ToolMessage3 } from "@langchain/core/messages";
42835
43229
  import { Runnable, RunnableBinding as RunnableBinding2, RunnableSequence } from "@langchain/core/runnables";
42836
43230
  import { StateSchema as StateSchema2, isCommand } from "@langchain/langgraph";
42837
43231
  import { interopParse, isInteropZodSchema as isInteropZodSchema2 } from "@langchain/core/utils/types";
42838
43232
 
42839
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/nodes/utils.js
43233
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/nodes/utils.js
42840
43234
  import { END, ReducedValue as ReducedValue2, StateSchema as StateSchema3 } from "@langchain/langgraph";
42841
43235
  import { getInteropZodObjectShape as getInteropZodObjectShape2, interopSafeParseAsync, interopZodObjectMakeFieldsOptional, interopZodObjectPartial, isInteropZodObject as isInteropZodObject3, isZodSchemaV4 as isZodSchemaV42 } from "@langchain/core/utils/types";
42842
43236
  import { z as z15 } from "zod/v4";
42843
43237
 
42844
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/RunnableCallable.js
43238
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/RunnableCallable.js
42845
43239
  import { Runnable as Runnable2, mergeConfigs } from "@langchain/core/runnables";
42846
43240
  import { AsyncLocalStorageProviderSingleton } from "@langchain/core/singletons";
42847
43241
 
42848
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/withAgentName.js
43242
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/withAgentName.js
42849
43243
  import { RunnableLambda as RunnableLambda2, RunnableSequence as RunnableSequence2 } from "@langchain/core/runnables";
42850
43244
 
42851
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/nodes/AgentNode.js
43245
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/nodes/AgentNode.js
42852
43246
  import { AIMessage as AIMessage4, SystemMessage as SystemMessage2, ToolMessage as ToolMessage4 } from "@langchain/core/messages";
42853
43247
  import { raceWithSignal } from "@langchain/core/runnables";
42854
43248
  import { Command, isCommand as isCommand2 } from "@langchain/langgraph";
42855
43249
  import { getSchemaDescription, interopParse as interopParse2 } from "@langchain/core/utils/types";
42856
43250
 
42857
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/nodes/ToolNode.js
43251
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/nodes/ToolNode.js
42858
43252
  import { AIMessage as AIMessage5, BaseMessage, ToolMessage as ToolMessage5 } from "@langchain/core/messages";
42859
43253
  import { ToolInputParsingException } from "@langchain/core/tools";
42860
43254
  import { Command as Command2, Send, isCommand as isCommand3, isGraphDrained, isGraphInterrupt } from "@langchain/langgraph";
42861
43255
 
42862
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/nodes/middleware.js
43256
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/nodes/middleware.js
42863
43257
  import { getInteropZodObjectShape as getInteropZodObjectShape3, interopParse as interopParse3, isInteropZodObject as isInteropZodObject4 } from "@langchain/core/utils/types";
42864
43258
 
42865
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/ReactAgent.js
43259
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/ReactAgent.js
42866
43260
  import { AIMessage as AIMessage6, ToolMessage as ToolMessage6 } from "@langchain/core/messages";
42867
43261
  import { mergeConfigs as mergeConfigs2 } from "@langchain/core/runnables";
42868
43262
  import { END as END2, START, Send as Send2, StateGraph, isCommand as isCommand4 } from "@langchain/langgraph";
42869
43263
 
42870
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/hitl.js
43264
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/hitl.js
42871
43265
  import { AIMessage as AIMessage7, ToolMessage as ToolMessage7 } from "@langchain/core/messages";
42872
43266
  import { Command as Command3, interrupt, isCommand as isCommand5 } from "@langchain/langgraph";
42873
43267
  import { interopParse as interopParse4, interopZodTransformInputSchema, isZodSchemaV4 as isZodSchemaV43 } from "@langchain/core/utils/types";
@@ -42996,7 +43390,7 @@ var contextSchema = z$1.object({
42996
43390
  descriptionPrefix: z$1.string().default("Tool execution requires approval")
42997
43391
  });
42998
43392
 
42999
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/constants.js
43393
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/constants.js
43000
43394
  import { z as z17 } from "zod/v3";
43001
43395
  import { getRetryable } from "@langchain/core/errors";
43002
43396
  var RetrySchema = z17.object({
@@ -43033,7 +43427,7 @@ var RetrySchema = z17.object({
43033
43427
  jitter: z17.boolean().default(true)
43034
43428
  });
43035
43429
 
43036
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/summarization.js
43430
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/summarization.js
43037
43431
  import { AIMessage as AIMessage8, HumanMessage as HumanMessage2, RemoveMessage, SystemMessage as SystemMessage3, ToolMessage as ToolMessage8, getBufferString, trimMessages } from "@langchain/core/messages";
43038
43432
  import { mergeConfigs as mergeConfigs3, pickRunnableConfigKeys } from "@langchain/core/runnables";
43039
43433
  import { REMOVE_ALL_MESSAGES } from "@langchain/langgraph";
@@ -43160,10 +43554,10 @@ var contextSchema2 = z$12.object({
43160
43554
  messagesToKeep: z$12.number().optional()
43161
43555
  });
43162
43556
 
43163
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/dynamicSystemPrompt.js
43557
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/dynamicSystemPrompt.js
43164
43558
  import { SystemMessage as SystemMessage4 } from "@langchain/core/messages";
43165
43559
 
43166
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/llmToolSelector.js
43560
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/llmToolSelector.js
43167
43561
  import { HumanMessage as HumanMessage3 } from "@langchain/core/messages";
43168
43562
  import { mergeConfigs as mergeConfigs4, pickRunnableConfigKeys as pickRunnableConfigKeys2 } from "@langchain/core/runnables";
43169
43563
  import { z as z19 } from "zod/v3";
@@ -43189,7 +43583,7 @@ var LLMToolSelectorOptionsSchema = z19.object({
43189
43583
  alwaysInclude: z19.array(z19.string()).optional()
43190
43584
  });
43191
43585
 
43192
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/pii.js
43586
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/pii.js
43193
43587
  import { AIMessage as AIMessage9, HumanMessage as HumanMessage4, ToolMessage as ToolMessage9 } from "@langchain/core/messages";
43194
43588
  import { z as z20 } from "zod/v3";
43195
43589
  import { sha256 } from "@langchain/core/utils/hash";
@@ -43208,7 +43602,7 @@ var contextSchema3 = z20.object({
43208
43602
  applyToToolResults: z20.boolean().optional()
43209
43603
  });
43210
43604
 
43211
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/piiRedaction.js
43605
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/piiRedaction.js
43212
43606
  import { AIMessage as AIMessage10, HumanMessage as HumanMessage5, RemoveMessage as RemoveMessage2, SystemMessage as SystemMessage5, ToolMessage as ToolMessage10 } from "@langchain/core/messages";
43213
43607
  import { z as z21 } from "zod/v3";
43214
43608
  var contextSchema4 = z21.object({
@@ -43219,10 +43613,10 @@ var contextSchema4 = z21.object({
43219
43613
  rules: z21.record(z21.string(), z21.instanceof(RegExp).describe("Regular expression pattern to match PII")).optional()
43220
43614
  });
43221
43615
 
43222
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/contextEditing.js
43616
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/contextEditing.js
43223
43617
  import { AIMessage as AIMessage11, SystemMessage as SystemMessage6, ToolMessage as ToolMessage11 } from "@langchain/core/messages";
43224
43618
 
43225
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/toolCallLimit.js
43619
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/toolCallLimit.js
43226
43620
  import { AIMessage as AIMessage12, ToolMessage as ToolMessage12 } from "@langchain/core/messages";
43227
43621
  import { z as z22 } from "zod/v4";
43228
43622
  import { z as z$13 } from "zod/v3";
@@ -43265,7 +43659,7 @@ var stateSchema = z$13.object({
43265
43659
  runToolCallCount: z$13.record(z$13.string(), z$13.number()).default({})
43266
43660
  });
43267
43661
 
43268
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/todoListMiddleware.js
43662
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/todoListMiddleware.js
43269
43663
  import { AIMessage as AIMessage13, ToolMessage as ToolMessage13 } from "@langchain/core/messages";
43270
43664
  import { tool as tool2 } from "@langchain/core/tools";
43271
43665
  import { Command as Command4 } from "@langchain/langgraph";
@@ -43281,7 +43675,7 @@ var TodoSchema = z23.object({
43281
43675
  });
43282
43676
  var stateSchema2 = z23.object({ todos: z23.array(TodoSchema).default([]) });
43283
43677
 
43284
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/modelCallLimit.js
43678
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/modelCallLimit.js
43285
43679
  import { AIMessage as AIMessage14 } from "@langchain/core/messages";
43286
43680
  import { z as z24 } from "zod/v3";
43287
43681
  var contextSchema5 = z24.object({
@@ -43306,10 +43700,10 @@ var stateSchema3 = z24.object({
43306
43700
  runModelCallCount: z24.number().default(0)
43307
43701
  });
43308
43702
 
43309
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/error.js
43703
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/error.js
43310
43704
  import { z as z25 } from "zod/v4";
43311
43705
 
43312
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/modelRetry.js
43706
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/modelRetry.js
43313
43707
  import { AIMessage as AIMessage15 } from "@langchain/core/messages";
43314
43708
  import { z as z26 } from "zod/v3";
43315
43709
  var ModelRetryMiddlewareOptionsSchema = z26.object({
@@ -43328,7 +43722,7 @@ var ModelRetryMiddlewareOptionsSchema = z26.object({
43328
43722
  ]).default("continue")
43329
43723
  }).merge(RetrySchema);
43330
43724
 
43331
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/toolRetry.js
43725
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/toolRetry.js
43332
43726
  import { ToolMessage as ToolMessage14 } from "@langchain/core/messages";
43333
43727
  import { isGraphBubbleUp as isGraphBubbleUp2 } from "@langchain/langgraph";
43334
43728
  import { z as z27 } from "zod/v3";
@@ -43364,21 +43758,21 @@ var ToolRetryMiddlewareOptionsSchema = z27.object({
43364
43758
  ]).default("continue")
43365
43759
  }).merge(RetrySchema);
43366
43760
 
43367
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/toolError.js
43761
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/toolError.js
43368
43762
  import { ToolMessage as ToolMessage15 } from "@langchain/core/messages";
43369
43763
  import { isGraphBubbleUp as isGraphBubbleUp3 } from "@langchain/langgraph";
43370
43764
 
43371
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/toolEmulator.js
43765
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/toolEmulator.js
43372
43766
  import { HumanMessage as HumanMessage6, ToolMessage as ToolMessage16 } from "@langchain/core/messages";
43373
43767
  import { mergeConfigs as mergeConfigs5, pickRunnableConfigKeys as pickRunnableConfigKeys3 } from "@langchain/core/runnables";
43374
43768
 
43375
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/providerToolSearch.js
43769
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/providerToolSearch.js
43376
43770
  import { isLangChainTool as isLangChainTool2 } from "@langchain/core/utils/function_calling";
43377
43771
 
43378
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/provider/openai/moderation.js
43772
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/provider/openai/moderation.js
43379
43773
  import { AIMessage as AIMessage16, HumanMessage as HumanMessage7, ToolMessage as ToolMessage17 } from "@langchain/core/messages";
43380
43774
 
43381
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/provider/anthropic/promptCaching.js
43775
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/provider/anthropic/promptCaching.js
43382
43776
  import { z as z28 } from "zod/v3";
43383
43777
  var contextSchema6 = z28.object({
43384
43778
  /**
@@ -43410,7 +43804,7 @@ var contextSchema6 = z28.object({
43410
43804
  ]).optional()
43411
43805
  });
43412
43806
 
43413
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/provider/aws/promptCaching.js
43807
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/provider/aws/promptCaching.js
43414
43808
  import { z as z29 } from "zod/v3";
43415
43809
  var contextSchema7 = z29.object({
43416
43810
  /**
@@ -43442,10 +43836,10 @@ var contextSchema7 = z29.object({
43442
43836
  ]).optional()
43443
43837
  });
43444
43838
 
43445
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/provider/openai/autoMode.js
43839
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/provider/openai/autoMode.js
43446
43840
  import { ToolMessage as ToolMessage18 } from "@langchain/core/messages";
43447
43841
 
43448
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/agents/middleware/provider/openai/modelRouter.js
43842
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/agents/middleware/provider/openai/modelRouter.js
43449
43843
  import { HumanMessage as HumanMessage8 } from "@langchain/core/messages";
43450
43844
  import { z as z30 } from "zod/v4";
43451
43845
  var routeSchema = z30.object({
@@ -43457,24 +43851,27 @@ var routeSchema = z30.object({
43457
43851
  }))
43458
43852
  });
43459
43853
 
43460
- // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_e9e367f3add88b95581927e1733bf88f/node_modules/langchain/dist/index.js
43854
+ // ../../node_modules/.pnpm/langchain@1.6.0_@langchain+core@1.3.2_@opentelemetry+api@1.9.1_@opentelemetry+exporter-_6b2dc0e1062c573b01467361cb243c19/node_modules/langchain/dist/index.js
43461
43855
  import { AIMessage as AIMessage17, AIMessageChunk as AIMessageChunk2, BaseMessage as BaseMessage2, BaseMessageChunk, HumanMessage as HumanMessage9, HumanMessageChunk, SystemMessage as SystemMessage7, SystemMessageChunk, ToolMessage as ToolMessage19, ToolMessageChunk, filterMessages, trimMessages as trimMessages2 } from "@langchain/core/messages";
43462
43856
  import { DynamicStructuredTool, DynamicTool, StructuredTool, Tool } from "@langchain/core/tools";
43463
43857
  import { context } from "@langchain/core/utils/context";
43464
43858
  import { InMemoryStore as InMemoryStore2 } from "@langchain/core/stores";
43465
- import { Document } from "@langchain/core/documents";
43859
+ import { Document as Document2 } from "@langchain/core/documents";
43466
43860
  import { fakeModel, langchainMatchers } from "@langchain/core/testing";
43467
43861
 
43468
43862
  // src/services/platform-ops/PlatformOpsTools.ts
43469
43863
  import { randomUUID as randomUUID41 } from "crypto";
43470
43864
  import { isIP as isIP2 } from "net";
43471
43865
  import { GraphInterrupt, interrupt as interrupt2 } from "@langchain/langgraph";
43472
- import { genUIMarkdown } from "@axiom-lattice/core";
43866
+ import { appendUiFence, genUIMarkdown } from "@axiom-lattice/core";
43473
43867
  import { z as z31 } from "zod";
43474
43868
  import {
43869
+ MAX_CUSTOM_CSS_LENGTH as MAX_CUSTOM_CSS_LENGTH2,
43475
43870
  PLATFORM_TENANT_PROTECTED_ERROR as PLATFORM_TENANT_PROTECTED_ERROR7,
43476
43871
  isPlatformTenantId as isPlatformTenantId8,
43477
- normalizeAllowedPrivateHosts as normalizeAllowedPrivateHosts2
43872
+ normalizeAllowedPrivateHosts as normalizeAllowedPrivateHosts2,
43873
+ normalizeBrandingHost as normalizeBrandingHost2,
43874
+ validateCustomCss as validateCustomCss2
43478
43875
  } from "@axiom-lattice/protocols";
43479
43876
  import {
43480
43877
  assertSafeEndpointSyntax as assertSafeEndpointSyntax3,
@@ -43483,11 +43880,92 @@ import {
43483
43880
  probeOidcProvider as probeOidcProvider2
43484
43881
  } from "@axiom-lattice/auth-oidc";
43485
43882
  import { getStoreLattice as getStoreLattice43 } from "@axiom-lattice/core";
43883
+
43884
+ // src/services/platform-ops/loginPreviewApp.ts
43885
+ var LOGIN_PREVIEW_UI_RESOURCE = "ui://platform-ops/login-preview";
43886
+ var LOGIN_PREVIEW_APP_HTML = `<!doctype html>
43887
+ <html lang="en">
43888
+ <head>
43889
+ <meta charset="utf-8" />
43890
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
43891
+ <style>
43892
+ html, body { margin: 0; height: 100%; font-family: Inter, system-ui, sans-serif; }
43893
+ iframe { width: 100%; height: 480px; border: 0; display: block; border-radius: 12px; }
43894
+ .bar { display:flex; justify-content:space-between; align-items:center; padding:8px 12px; font-size:12px; color:#667085; }
43895
+ a { color:#5b50c6; }
43896
+ </style>
43897
+ </head>
43898
+ <body>
43899
+ <div class="bar"><span>Login preview</span><a id="open" target="_blank" rel="noreferrer">Open in new tab</a></div>
43900
+ <iframe id="preview"></iframe>
43901
+ <script>
43902
+ (function () {
43903
+ var payload = null;
43904
+ var frame = document.getElementById("preview");
43905
+ var open = document.getElementById("open");
43906
+
43907
+ function apply(data) {
43908
+ if (!data || !data.previewUrl) return;
43909
+ payload = data;
43910
+ open.href = data.previewUrl;
43911
+ frame.src = data.previewUrl;
43912
+ }
43913
+
43914
+ function sendPayload() {
43915
+ if (!payload || !frame.contentWindow) return;
43916
+ frame.contentWindow.postMessage({
43917
+ type: "axiom:branding-preview",
43918
+ contract: 1,
43919
+ nonce: payload.nonce,
43920
+ surface: payload.surface,
43921
+ branding: payload.branding,
43922
+ customCss: payload.customCss
43923
+ }, payload.origin);
43924
+ }
43925
+
43926
+ frame.addEventListener("load", sendPayload);
43927
+
43928
+ window.addEventListener("message", function (event) {
43929
+ var data = event.data;
43930
+ if (!data || typeof data !== "object") return;
43931
+ if (data.type === "axiom:branding-preview-ready" && data.contract === 1) {
43932
+ if (event.source === frame.contentWindow) sendPayload();
43933
+ return;
43934
+ }
43935
+ if (data.method === "ui/notifications/tool-result") {
43936
+ var params = data.params || {};
43937
+ var structured = params.structuredContent;
43938
+ if (!structured && Array.isArray(params.content)) {
43939
+ for (var i = 0; i < params.content.length; i += 1) {
43940
+ var block = params.content[i];
43941
+ if (block && block.type === "text" && typeof block.text === "string") {
43942
+ try {
43943
+ var parsed = JSON.parse(block.text);
43944
+ if (parsed && parsed.data) structured = parsed.data;
43945
+ } catch (ignored) {}
43946
+ }
43947
+ }
43948
+ }
43949
+ apply(structured || {});
43950
+ }
43951
+ });
43952
+
43953
+ window.parent.postMessage({ jsonrpc: "2.0", id: 1, method: "ui/initialize", params: { protocolVersion: "2025-01-01" } }, "*");
43954
+ window.parent.postMessage({ jsonrpc: "2.0", method: "ui/notifications/initialized" }, "*");
43955
+ })();
43956
+ </script>
43957
+ </body>
43958
+ </html>`;
43959
+
43960
+ // src/services/platform-ops/PlatformOpsTools.ts
43486
43961
  var PLATFORM_ROLE_REQUIRED = "PLATFORM_ROLE_REQUIRED";
43487
43962
  var PLATFORM_OPS_RATE_LIMITED = "PLATFORM_OPS_RATE_LIMITED";
43488
43963
  var PLATFORM_OPS_DEPENDENCY_UNAVAILABLE = "PLATFORM_OPS_DEPENDENCY_UNAVAILABLE";
43489
43964
  var PLATFORM_ENVIRONMENT_UNAVAILABLE = "PLATFORM_ENVIRONMENT_UNAVAILABLE";
43490
43965
  var PLATFORM_BRANDING_UNAVAILABLE = "PLATFORM_BRANDING_UNAVAILABLE";
43966
+ var BRANDING_DOMAIN_NOT_FOUND = "BRANDING_DOMAIN_NOT_FOUND";
43967
+ var AUTH_PREVIEW_UNAVAILABLE = "AUTH_PREVIEW_UNAVAILABLE";
43968
+ var PLATFORM_OPS_UI_PLUGIN_TYPE = "platform-ops";
43491
43969
  var PlatformOpsToolError = class extends Error {
43492
43970
  constructor(code, message) {
43493
43971
  super(message ?? code);
@@ -44942,7 +45420,7 @@ var createOidcProviderSchema = z31.object({
44942
45420
  displayName: z31.string().trim().min(1),
44943
45421
  issuer: z31.string().trim().min(1),
44944
45422
  clientId: z31.string().trim().min(1),
44945
- clientSecret: z31.string().min(1),
45423
+ clientSecret: z31.string().optional(),
44946
45424
  scopes: z31.string().optional(),
44947
45425
  enabled: z31.boolean().optional(),
44948
45426
  jitProvisioning: z31.boolean().optional(),
@@ -44967,7 +45445,7 @@ var testOidcProviderSchema = z31.object({
44967
45445
  providerId: z31.string().trim().min(1).optional(),
44968
45446
  issuer: z31.string().trim().min(1).optional(),
44969
45447
  clientId: z31.string().trim().min(1).optional(),
44970
- clientSecret: z31.string().min(1).optional(),
45448
+ clientSecret: z31.string().optional(),
44971
45449
  allowedPrivateHosts: z31.array(z31.string()).optional()
44972
45450
  }).strict();
44973
45451
  var ssoClaimTargetSchema = z31.object({ claimId: z31.string().trim().min(1) }).strict();
@@ -44993,9 +45471,76 @@ var resetSettingSchema = z31.object({
44993
45471
  path: z31.string().trim().min(1),
44994
45472
  expectedVersion: z31.number().int().nonnegative().optional()
44995
45473
  }).strict();
44996
- var updateBrandingSchema = z31.object({
45474
+ var brandingFieldsSchema = z31.object({
45475
+ brandName: z31.string().min(1).max(80).nullable().optional(),
45476
+ logoUrl: z31.string().nullable().optional(),
45477
+ faviconUrl: z31.string().nullable().optional(),
45478
+ primaryColor: z31.string().nullable().optional(),
45479
+ backgroundColor: z31.string().nullable().optional(),
45480
+ loginTitle: z31.string().max(200).nullable().optional(),
45481
+ loginSubtitle: z31.string().max(200).nullable().optional(),
45482
+ customCss: z31.string().max(MAX_CUSTOM_CSS_LENGTH2).nullable().optional()
45483
+ }).strict();
45484
+ var BRANDING_PATCH_KEYS = [
45485
+ "brandName",
45486
+ "logoUrl",
45487
+ "faviconUrl",
45488
+ "primaryColor",
45489
+ "backgroundColor",
45490
+ "loginTitle",
45491
+ "loginSubtitle",
45492
+ "customCss"
45493
+ ];
45494
+ function brandingPatchMessage(error) {
45495
+ const unknown = error.issues.filter((issue2) => issue2.code === "unrecognized_keys").flatMap(
45496
+ (issue2) => issue2.code === "unrecognized_keys" ? issue2.keys : []
45497
+ );
45498
+ if (unknown.length > 0) {
45499
+ return `Unknown branding field(s): ${unknown.join(", ")}. Use ${BRANDING_PATCH_KEYS.join(", ")}; map productName -> brandName, tagline -> loginSubtitle, accentColor -> primaryColor.`;
45500
+ }
45501
+ return error.issues.map((issue2) => `${issue2.path.join(".")}: ${issue2.message}`).join("; ");
45502
+ }
45503
+ function parseBrandingPatch(value) {
45504
+ const parsed = brandingFieldsSchema.safeParse(value);
45505
+ if (!parsed.success) {
45506
+ throw new PlatformOpsToolError(
45507
+ PLATFORM_OPS_INVALID_INPUT,
45508
+ brandingPatchMessage(parsed.error)
45509
+ );
45510
+ }
45511
+ return parsed.data;
45512
+ }
45513
+ function applyBrandingFields(target, patch) {
45514
+ const next = { ...target ?? {} };
45515
+ for (const key of BRANDING_PATCH_KEYS) {
45516
+ const value = patch[key];
45517
+ if (value === void 0) continue;
45518
+ if (value === null) delete next[key];
45519
+ else next[key] = value;
45520
+ }
45521
+ return Object.keys(next).length > 0 ? next : void 0;
45522
+ }
45523
+ var updateBrandingDefaultSchema = z31.object({
45524
+ expectedVersion: z31.number().int().nonnegative().optional(),
45525
+ patch: z31.record(z31.string(), z31.unknown())
45526
+ }).strict();
45527
+ var updateBrandingDomainSchema = z31.object({
45528
+ expectedVersion: z31.number().int().nonnegative().optional(),
45529
+ host: z31.string().trim().min(1),
45530
+ status: z31.enum(["active", "pending"]).nullable().optional(),
45531
+ publicGatewayUrl: z31.string().nullable().optional(),
45532
+ publicConsoleUrl: z31.string().nullable().optional(),
45533
+ branding: z31.record(z31.string(), z31.unknown()).optional()
45534
+ }).strict();
45535
+ var removeBrandingDomainSchema = z31.object({
44997
45536
  expectedVersion: z31.number().int().nonnegative().optional(),
44998
- branding: z31.record(z31.string(), z31.unknown())
45537
+ host: z31.string().trim().min(1)
45538
+ }).strict();
45539
+ var setBrandingCustomCssSchema = z31.object({
45540
+ expectedVersion: z31.number().int().nonnegative().optional(),
45541
+ scope: z31.enum(["default", "domain"]),
45542
+ host: z31.string().trim().min(1).optional(),
45543
+ customCss: z31.string().nullable()
44999
45544
  }).strict();
45000
45545
  var transferPlatformOwnerSchema = z31.object({
45001
45546
  fromUserId: z31.string().trim().min(1),
@@ -45016,6 +45561,55 @@ var resetPlatformSettingsPlaybookSchema = z31.object({
45016
45561
  paths: z31.array(z31.string().trim().min(1)).optional(),
45017
45562
  expectedVersion: z31.number().int().nonnegative().optional()
45018
45563
  }).strict();
45564
+ function readBrandingSettings(settings) {
45565
+ const snapshot = settings.getBrandingSettings?.();
45566
+ if (!snapshot) {
45567
+ throw new PlatformOpsToolError(PLATFORM_BRANDING_UNAVAILABLE);
45568
+ }
45569
+ return structuredClone(snapshot.branding);
45570
+ }
45571
+ function serializeBrandingSnapshot(snapshot) {
45572
+ return {
45573
+ version: snapshot.version,
45574
+ branding: snapshot.branding,
45575
+ ...snapshot.updatedBy === void 0 ? {} : { updatedBy: snapshot.updatedBy },
45576
+ ...snapshot.updatedAt === void 0 ? {} : { updatedAt: timestamp(snapshot.updatedAt) }
45577
+ };
45578
+ }
45579
+ async function commitBranding(settings, branding, expectedVersion, caller, summary) {
45580
+ const update = settings.updateWithResult;
45581
+ if (!update) {
45582
+ throw new PlatformOpsToolError(
45583
+ PLATFORM_SETTINGS_WRITE_UNAVAILABLE,
45584
+ "The platform settings writer is unavailable"
45585
+ );
45586
+ }
45587
+ const before = settings.getBrandingSettings?.();
45588
+ const version = expectedVersion ?? settings.getSnapshot().version;
45589
+ const result = await update.bind(settings)(
45590
+ { branding },
45591
+ version,
45592
+ caller.userId
45593
+ );
45594
+ const after = settings.getBrandingSettings?.();
45595
+ return {
45596
+ data: after ? serializeBrandingSnapshot(after) : { version: result.snapshot.version, branding },
45597
+ ...before === void 0 ? {} : {
45598
+ before: {
45599
+ version: before.version,
45600
+ branding: before.branding
45601
+ }
45602
+ },
45603
+ summary: {
45604
+ ...summary,
45605
+ version: result.snapshot.version
45606
+ },
45607
+ after: {
45608
+ version: result.snapshot.version,
45609
+ changed: result.changed
45610
+ }
45611
+ };
45612
+ }
45019
45613
  function createPlatformOpsTools(deps = {}) {
45020
45614
  const overviewTool = readTool(
45021
45615
  "ops_get_overview",
@@ -45260,6 +45854,57 @@ function createPlatformOpsTools(deps = {}) {
45260
45854
  };
45261
45855
  }
45262
45856
  );
45857
+ const previewLoginSchema = z31.object({
45858
+ surface: z31.enum(["login", "register"]).optional(),
45859
+ host: z31.string().trim().min(1).optional(),
45860
+ branding: z31.record(z31.string(), z31.unknown()).optional(),
45861
+ customCss: z31.string().optional()
45862
+ }).strict();
45863
+ const previewLoginTool = tool$1(
45864
+ async (input, exeConfig) => {
45865
+ try {
45866
+ await authorize(exeConfig, deps);
45867
+ const consoleUrl = process.env.PUBLIC_CONSOLE_URL?.replace(/\/$/, "");
45868
+ if (!consoleUrl) return failure3(AUTH_PREVIEW_UNAVAILABLE);
45869
+ const settings = required(resolveSettings(deps));
45870
+ const snapshot = settings.getBrandingSettings?.();
45871
+ const resolved = input.host && settings.getBrandingForHost ? settings.getBrandingForHost(input.host) : void 0;
45872
+ const base = resolved?.branding ?? snapshot?.branding.default ?? {};
45873
+ const { customCss: baseCss, ...baseFields } = base;
45874
+ const draft = input.branding ?? {};
45875
+ const { customCss: draftCss, ...draftFields } = draft;
45876
+ const branding = { ...baseFields, ...draftFields };
45877
+ const css = input.customCss !== void 0 ? input.customCss : typeof draftCss === "string" ? draftCss : baseCss ?? "";
45878
+ if (!validateCustomCss2(css).ok) {
45879
+ throw new PlatformOpsToolError(PLATFORM_OPS_INVALID_INPUT);
45880
+ }
45881
+ const nonce = randomUUID41();
45882
+ const payload = {
45883
+ previewUrl: `${consoleUrl}/auth-preview?nonce=${encodeURIComponent(nonce)}`,
45884
+ origin: new URL(consoleUrl).origin,
45885
+ nonce,
45886
+ surface: input.surface ?? "login",
45887
+ branding,
45888
+ customCss: css
45889
+ };
45890
+ return appendUiFence(JSON.stringify({ success: true, data: payload }), {
45891
+ kind: "plugin",
45892
+ pluginType: PLATFORM_OPS_UI_PLUGIN_TYPE,
45893
+ resource: LOGIN_PREVIEW_UI_RESOURCE,
45894
+ displayMode: "inline",
45895
+ toolName: "ops_preview_login"
45896
+ });
45897
+ } catch (error) {
45898
+ if (error instanceof PlatformOpsToolError) return failure3(error.code);
45899
+ return failure3(PLATFORM_OPS_DEPENDENCY_UNAVAILABLE);
45900
+ }
45901
+ },
45902
+ {
45903
+ name: "ops_preview_login",
45904
+ description: "Render a login-page preview. Omitted branding/customCss inherit the current saved branding (default, or the host override when host is supplied); pass draft fields only for unsaved overrides. Read-only; drafts are not persisted.",
45905
+ schema: previewLoginSchema
45906
+ }
45907
+ );
45263
45908
  const createUserTool = writeTool(
45264
45909
  "ops_create_user",
45265
45910
  "Create a platform user. Owner/admin only; auditors cannot write. Never returns passwords or metadata.",
@@ -45895,13 +46540,7 @@ function createPlatformOpsTools(deps = {}) {
45895
46540
  const probeHosts = allowedPrivateHosts ?? options.allowedPrivateHosts ?? [];
45896
46541
  const issuer = normalizeOidcIssuer(input.issuer, options, probeHosts);
45897
46542
  const clientId = input.clientId.trim();
45898
- const clientSecret = input.clientSecret.trim();
45899
- if (!clientSecret) {
45900
- throw new PlatformOpsToolError(
45901
- PLATFORM_OPS_INVALID_INPUT,
45902
- "Client secret is required"
45903
- );
45904
- }
46543
+ const clientSecret = input.clientSecret?.trim() ?? "";
45905
46544
  const displayName2 = normalizeOidcDisplayName(input.displayName);
45906
46545
  const scopes = normalizeOidcScopes(input.scopes);
45907
46546
  const enabled = input.enabled ?? false;
@@ -46082,16 +46721,16 @@ function createPlatformOpsTools(deps = {}) {
46082
46721
  clientSecret = overrideSecret !== void 0 && overrideSecret !== "" ? overrideSecret : stored.clientSecret;
46083
46722
  } else {
46084
46723
  source = "unsaved";
46085
- if (input.issuer === void 0 || input.clientId === void 0 || input.clientSecret === void 0) {
46724
+ if (input.issuer === void 0 || input.clientId === void 0) {
46086
46725
  throw new PlatformOpsToolError(
46087
46726
  PLATFORM_OPS_INVALID_INPUT,
46088
- "providerId or issuer, clientId, and clientSecret are required"
46727
+ "providerId or issuer and clientId are required"
46089
46728
  );
46090
46729
  }
46091
46730
  hosts = normalizeOidcOptionalHosts(input.allowedPrivateHosts) ?? options.allowedPrivateHosts ?? [];
46092
46731
  issuer = normalizeOidcIssuer(input.issuer, options, hosts);
46093
46732
  clientId = input.clientId;
46094
- clientSecret = input.clientSecret;
46733
+ clientSecret = input.clientSecret?.trim() ?? "";
46095
46734
  }
46096
46735
  const result = await runOidcProbe(deps, {
46097
46736
  issuer,
@@ -46264,59 +46903,177 @@ function createPlatformOpsTools(deps = {}) {
46264
46903
  };
46265
46904
  }
46266
46905
  );
46267
- const updateBrandingTool = writeTool(
46268
- "ops_update_branding",
46269
- "Update platform branding with optimistic concurrency. Logo URLs and colors are validated by the settings service.",
46270
- updateBrandingSchema,
46906
+ const updateBrandingDefaultTool = writeTool(
46907
+ "ops_update_branding_default",
46908
+ "Partially update the platform default brand. Omit a field to keep it; null clears it. Valid fields: brandName, logoUrl, faviconUrl, primaryColor, backgroundColor, loginTitle, loginSubtitle, customCss. Use brandName/loginTitle/loginSubtitle/primaryColor; do not invent productName/tagline/accentColor.",
46909
+ updateBrandingDefaultSchema,
46271
46910
  deps,
46272
46911
  async (input, caller) => {
46273
46912
  const settings = required(
46274
46913
  resolveSettings(deps),
46275
46914
  PLATFORM_SETTINGS_WRITE_UNAVAILABLE
46276
46915
  );
46277
- const update = settings.updateWithResult;
46278
- if (!update) {
46279
- throw new PlatformOpsToolError(
46280
- PLATFORM_SETTINGS_WRITE_UNAVAILABLE,
46281
- "The platform settings writer is unavailable"
46282
- );
46283
- }
46284
- const before = settings.getBrandingSettings?.();
46285
- const expectedVersion = input.expectedVersion ?? settings.getSnapshot().version;
46286
- const result = await update.bind(settings)(
46287
- { branding: input.branding },
46288
- expectedVersion,
46289
- caller.userId
46916
+ const current3 = readBrandingSettings(settings);
46917
+ const patch = parseBrandingPatch(input.patch);
46918
+ const nextDefault = applyBrandingFields(current3.default, patch);
46919
+ const branding = { ...current3 };
46920
+ if (nextDefault === void 0) delete branding.default;
46921
+ else branding.default = nextDefault;
46922
+ return commitBranding(
46923
+ settings,
46924
+ branding,
46925
+ input.expectedVersion,
46926
+ caller,
46927
+ {
46928
+ tool: "ops_update_branding_default",
46929
+ fields: Object.keys(patch)
46930
+ }
46290
46931
  );
46291
- const after = settings.getBrandingSettings?.();
46292
- return {
46293
- data: after ? {
46294
- version: after.version,
46295
- branding: after.branding,
46296
- ...after.updatedBy === void 0 ? {} : { updatedBy: after.updatedBy },
46297
- ...after.updatedAt === void 0 ? {} : { updatedAt: timestamp(after.updatedAt) }
46298
- } : {
46299
- version: result.snapshot.version,
46300
- branding: input.branding
46301
- },
46302
- ...before === void 0 ? {} : {
46303
- before: {
46304
- version: before.version,
46305
- branding: before.branding
46306
- }
46307
- },
46308
- summary: {
46309
- tool: "ops_update_branding",
46310
- version: result.snapshot.version,
46311
- changed: result.changed
46312
- },
46313
- after: {
46314
- version: result.snapshot.version,
46315
- changed: result.changed
46932
+ }
46933
+ );
46934
+ const updateBrandingDomainTool = writeTool(
46935
+ "ops_update_branding_domain",
46936
+ "Create or partially update a per-host branding override. Omit a field to keep it; null clears it. The branding object accepts brandName, logoUrl, faviconUrl, primaryColor, backgroundColor, loginTitle, loginSubtitle, customCss.",
46937
+ updateBrandingDomainSchema,
46938
+ deps,
46939
+ async (input, caller) => {
46940
+ const settings = required(
46941
+ resolveSettings(deps),
46942
+ PLATFORM_SETTINGS_WRITE_UNAVAILABLE
46943
+ );
46944
+ const current3 = readBrandingSettings(settings);
46945
+ const patch = parseBrandingPatch(input.branding ?? {});
46946
+ const normalized = normalizeBrandingHost2(input.host);
46947
+ const domains = [...current3.domains ?? []];
46948
+ const index = domains.findIndex(
46949
+ (domain) => normalizeBrandingHost2(domain.host) === normalized
46950
+ );
46951
+ const existing = index >= 0 ? domains[index] : { host: input.host, status: "active" };
46952
+ const next = { ...existing };
46953
+ if (input.status !== void 0) {
46954
+ if (input.status === null) delete next.status;
46955
+ else next.status = input.status;
46956
+ }
46957
+ if (input.publicGatewayUrl !== void 0) {
46958
+ if (input.publicGatewayUrl === null) delete next.publicGatewayUrl;
46959
+ else next.publicGatewayUrl = input.publicGatewayUrl;
46960
+ }
46961
+ if (input.publicConsoleUrl !== void 0) {
46962
+ if (input.publicConsoleUrl === null) delete next.publicConsoleUrl;
46963
+ else next.publicConsoleUrl = input.publicConsoleUrl;
46964
+ }
46965
+ const nextBranding = applyBrandingFields(next.branding, patch);
46966
+ if (nextBranding === void 0) delete next.branding;
46967
+ else next.branding = nextBranding;
46968
+ if (index >= 0) domains[index] = next;
46969
+ else domains.push(next);
46970
+ const branding = { ...current3, domains };
46971
+ return commitBranding(
46972
+ settings,
46973
+ branding,
46974
+ input.expectedVersion,
46975
+ caller,
46976
+ {
46977
+ tool: "ops_update_branding_domain",
46978
+ host: next.host,
46979
+ fields: Object.keys(patch)
46316
46980
  }
46981
+ );
46982
+ }
46983
+ );
46984
+ const removeBrandingDomainTool = writeTool(
46985
+ "ops_remove_branding_domain",
46986
+ "Remove a per-host branding override by exact host. Idempotent: reports removed=false when no override exists.",
46987
+ removeBrandingDomainSchema,
46988
+ deps,
46989
+ async (input, caller) => {
46990
+ const settings = required(
46991
+ resolveSettings(deps),
46992
+ PLATFORM_SETTINGS_WRITE_UNAVAILABLE
46993
+ );
46994
+ const current3 = readBrandingSettings(settings);
46995
+ const normalized = normalizeBrandingHost2(input.host);
46996
+ const existing = current3.domains ?? [];
46997
+ const domains = existing.filter(
46998
+ (domain) => normalizeBrandingHost2(domain.host) !== normalized
46999
+ );
47000
+ const removed = domains.length !== existing.length;
47001
+ const branding = { ...current3 };
47002
+ if (domains.length > 0) branding.domains = domains;
47003
+ else delete branding.domains;
47004
+ const outcome = await commitBranding(
47005
+ settings,
47006
+ branding,
47007
+ input.expectedVersion,
47008
+ caller,
47009
+ {
47010
+ tool: "ops_remove_branding_domain",
47011
+ host: input.host,
47012
+ removed
47013
+ }
47014
+ );
47015
+ return {
47016
+ ...outcome,
47017
+ data: { ...outcome.data, removed }
46317
47018
  };
46318
47019
  }
46319
47020
  );
47021
+ const setBrandingCustomCssTool = writeTool(
47022
+ "ops_set_branding_custom_css",
47023
+ "Set or clear custom CSS for the default brand or one domain. Pass customCss: null to clear. CSS only; no @import and no </style; at most 65,536 characters.",
47024
+ setBrandingCustomCssSchema,
47025
+ deps,
47026
+ async (input, caller) => {
47027
+ const settings = required(
47028
+ resolveSettings(deps),
47029
+ PLATFORM_SETTINGS_WRITE_UNAVAILABLE
47030
+ );
47031
+ const current3 = readBrandingSettings(settings);
47032
+ const patch = { customCss: input.customCss };
47033
+ let branding = { ...current3 };
47034
+ if (input.scope === "default") {
47035
+ const nextDefault = applyBrandingFields(current3.default, patch);
47036
+ if (nextDefault === void 0) delete branding.default;
47037
+ else branding.default = nextDefault;
47038
+ } else {
47039
+ if (!input.host) {
47040
+ throw new PlatformOpsToolError(
47041
+ PLATFORM_OPS_INVALID_INPUT,
47042
+ "host is required when scope is domain"
47043
+ );
47044
+ }
47045
+ const normalized = normalizeBrandingHost2(input.host);
47046
+ const domains = [...current3.domains ?? []];
47047
+ const index = domains.findIndex(
47048
+ (domain2) => normalizeBrandingHost2(domain2.host) === normalized
47049
+ );
47050
+ if (index < 0) {
47051
+ throw new PlatformOpsToolError(
47052
+ BRANDING_DOMAIN_NOT_FOUND,
47053
+ `No domain branding override exists for ${input.host}`
47054
+ );
47055
+ }
47056
+ const domain = { ...domains[index] };
47057
+ const nextBranding = applyBrandingFields(domain.branding, patch);
47058
+ if (nextBranding === void 0) delete domain.branding;
47059
+ else domain.branding = nextBranding;
47060
+ domains[index] = domain;
47061
+ branding = { ...branding, domains };
47062
+ }
47063
+ return commitBranding(
47064
+ settings,
47065
+ branding,
47066
+ input.expectedVersion,
47067
+ caller,
47068
+ {
47069
+ tool: "ops_set_branding_custom_css",
47070
+ scope: input.scope,
47071
+ ...input.host === void 0 ? {} : { host: input.host },
47072
+ cleared: input.customCss === null
47073
+ }
47074
+ );
47075
+ }
47076
+ );
46320
47077
  const transferPlatformOwnerTool = playbookTool(
46321
47078
  "ops_playbook_transfer_platform_owner",
46322
47079
  "Preflight a one-time-confirmed transfer of the platform owner role from one owner to another active user. Requires a platform owner.",
@@ -46595,6 +47352,7 @@ function createPlatformOpsTools(deps = {}) {
46595
47352
  auditTool,
46596
47353
  settingsTool,
46597
47354
  brandingTool,
47355
+ previewLoginTool,
46598
47356
  createUserTool,
46599
47357
  updateUserTool,
46600
47358
  deleteUserTool,
@@ -46619,7 +47377,10 @@ function createPlatformOpsTools(deps = {}) {
46619
47377
  rejectSsoClaimTool,
46620
47378
  patchPlatformSettingsTool,
46621
47379
  resetPlatformSettingTool,
46622
- updateBrandingTool,
47380
+ updateBrandingDefaultTool,
47381
+ updateBrandingDomainTool,
47382
+ removeBrandingDomainTool,
47383
+ setBrandingCustomCssTool,
46623
47384
  transferPlatformOwnerTool,
46624
47385
  offboardPlatformMemberTool,
46625
47386
  deleteTenantPlaybookTool,
@@ -46658,13 +47419,34 @@ var PLATFORM_OPS_AGENT_PROMPT = [
46658
47419
  "first call: they return confirmationRequired with a confirmationId and an",
46659
47420
  "impact preview. Only the initiating user can confirm or cancel through the",
46660
47421
  "Admin Center, and a confirmation is single-use and expires after ten minutes.",
46661
- "Summarize successful writes concisely and include the audit id when present."
47422
+ "Summarize successful writes concisely and include the audit id when present.",
47423
+ "Branding writes are granular: ops_update_branding_default, ops_update_branding_domain, ops_remove_branding_domain, and ops_set_branding_custom_css. Omit fields to keep them; null clears them. Use brandName/logoUrl/faviconUrl/primaryColor/backgroundColor/loginTitle/loginSubtitle/customCss; never invent productName/tagline/accentColor. customCss only accepts CSS, rejects @import, and is capped at 64 KiB.",
47424
+ "For login theme design, load the platform-ops-branding-design skill, use the widget middleware (load_guidelines then show_widget) to iterate on an interactive mockup, then use ops_preview_login for the real page and save only after explicit approval.",
47425
+ "After reading or changing branding customCss, call ops_preview_login so the inline MCP UI card renders the result. It inherits the saved branding when fields are omitted; pass host to preview a domain override. If it reports AUTH_PREVIEW_UNAVAILABLE, tell the user PUBLIC_CONSOLE_URL is not configured."
46662
47426
  ].join("\n");
46663
47427
 
46664
47428
  // src/services/platform-ops/PlatformOpsSkill.ts
47429
+ import {
47430
+ AUTH_CSS_CONTRACT_PARTS,
47431
+ AUTH_CSS_CONTRACT_VARIABLES
47432
+ } from "@axiom-lattice/protocols";
46665
47433
  var PLATFORM_OPS_SKILL_KEY = "platform-ops-usage";
47434
+ var PLATFORM_OPS_AUTH_CSS_CONTRACT = `# Auth login CSS contract v1
47435
+ Surfaces (data-axiom-surface): login, register, invite, oidc-email, tenant-select, platform-admin-login
47436
+ Root: #axiom-auth-root[data-axiom-auth-contract="1"][data-axiom-surface="..."]
47437
+ Parts (attribute values of [data-axiom-part="..."]): ${AUTH_CSS_CONTRACT_PARTS.join("|")}
47438
+ Variables: ${AUTH_CSS_CONTRACT_VARIABLES.join(", ")}
47439
+ Rules: CSS only; no @import; no </style; at most 65,536 characters.
47440
+
47441
+ Propagation:
47442
+ - Stored as branding.default.customCss or branding.domains[].branding.customCss; a domain value replaces (does not concatenate) the default, and an empty/missing domain value inherits the default.
47443
+ - Public GET /api/branding resolves by host (x-axiom-host -> x-forwarded-host -> host).
47444
+ - Applied only while an auth surface is mounted: login, register, invite (unauthenticated), OIDC email completion, standalone tenant selection, platform-admin login. It does not style the authenticated workspace or the authenticated invite-claim view.
47445
+ - Invite links still use PUBLIC_CONSOLE_URL, so their landing page uses that host's branding.
47446
+ - url(...) resolves against the page origin; use absolute URLs for cross-host assets (subject to the deployment CSP).
47447
+ - The Admin preview shows the selected surface as an approximation (stub auth providers, en-US copy); the Ops MCP preview supports login/register.`;
46666
47448
  var PLATFORM_OPS_SKILL = {
46667
- version: "1.0.0",
47449
+ version: "1.6.0",
46668
47450
  content: `---
46669
47451
  name: platform-ops-usage
46670
47452
  description: Use the Platform Ops tools safely from the Admin Center Ops Agent.
@@ -46683,15 +47465,89 @@ description: Use the Platform Ops tools safely from the Admin Center Ops Agent.
46683
47465
  - Tool failures return \`{ success: false, error: { code, message } }\`.
46684
47466
  - Invite-link creation returns a one-time URL/token. Present it once with a copy warning; never repeat it later.
46685
47467
  - Never echo API keys, passwords, client secrets, or other credentials.
47468
+ - For login theme design, use the \`platform-ops-branding-design\` skill and the widget middleware: load mockup guidelines, show an interactive mockup, iterate, then confirm with \`ops_preview_login\` before saving.
47469
+ - Branding writes are granular: \`ops_update_branding_default\` (partial default patch), \`ops_update_branding_domain\` (create/update one host override), \`ops_remove_branding_domain\`, and \`ops_set_branding_custom_css\` (default or domain). Omit a field to keep it; pass null to clear it. Use \`brandName\`, \`logoUrl\`, \`faviconUrl\`, \`primaryColor\`, \`backgroundColor\`, \`loginTitle\`, \`loginSubtitle\`, and \`customCss\`; never invent \`productName\`, \`tagline\`, or \`accentColor\`.
47470
+ - \`ops_preview_login\` inherits the current saved branding when \`branding\`/\`customCss\` are omitted; pass only draft fields for unsaved overrides, and pass \`host\` to preview that domain override.
47471
+ - Branding \`customCss\` themes the login, register, invite, OIDC email-completion, tenant-select, and platform-admin-login surfaces. Use \`auth-login-css-contract.md\` for stable selectors/variables (the \`data-axiom-part\` values are attribute values); CSS only, no @import, no </style, at most 65,536 characters. Visual results cannot be verified by the agent; use \`ops_preview_login\` to render the inline MCP UI preview and ask the user to confirm the final result in the Admin Center Branding preview or the real \`/login\` page.
47472
+ `,
47473
+ resources: {
47474
+ "auth-login-css-contract.md": {
47475
+ content: PLATFORM_OPS_AUTH_CSS_CONTRACT,
47476
+ mimeType: "text/markdown"
47477
+ }
47478
+ }
47479
+ };
47480
+
47481
+ // src/services/platform-ops/PlatformOpsBrandingDesignSkill.ts
47482
+ var PLATFORM_OPS_BRANDING_DESIGN_SKILL_KEY = "platform-ops-branding-design";
47483
+ var PLATFORM_OPS_BRANDING_DESIGN_SKILL = {
47484
+ version: "1.0.0",
47485
+ content: `---
47486
+ name: platform-ops-branding-design
47487
+ description: Design login-page branding with an interactive widget mockup, then confirm on the real page before saving.
47488
+ ---
47489
+
47490
+ # Login branding design
47491
+
47492
+ Use this when the user wants to design or redesign the login page theme.
47493
+
47494
+ ## Workflow
47495
+
47496
+ 1. Read the current settings with \`ops_get_branding\`.
47497
+ 2. Use the **widget** middleware for the discussion mockup:
47498
+ - Call \`load_guidelines({ modules: ["mockup"] })\` first.
47499
+ - Then call \`show_widget\` with \`i_have_seen_guidelines: true\`, a title, and an interactive HTML mockup.
47500
+ 3. Iterate in the chat. When the design changes, show a new widget instead of describing it.
47501
+ 4. When the user settles on a design, call \`ops_preview_login\` with the draft \`branding\` and \`customCss\` so they see the **real** login page.
47502
+ 5. Save only after explicit approval:
47503
+ - default brand: \`ops_update_branding_default\` + \`ops_set_branding_custom_css\`
47504
+ - per-host override: \`ops_update_branding_domain\` (+ \`ops_set_branding_custom_css\` with \`scope: "domain"\`)
47505
+ 6. Never persist from the widget.
47506
+
47507
+ ## Widget mockup rules
47508
+
47509
+ - \`show_widget\` code is body-only: no DOCTYPE, \`<html>\`, \`<head>\`, or \`<body>\`.
47510
+ - Use inline CSS and inline JS only. No network calls.
47511
+ - Use the real auth contract so the design maps 1:1 to the login page:
47512
+ - root: \`#axiom-auth-root[data-axiom-auth-contract="1"][data-axiom-surface="login"]\`
47513
+ - parts: \`[data-axiom-part="page|card|header|logo|title|subtitle|form|field|input|submit|footer|link"]\`
47514
+ - variables: \`--axiom-auth-primary\`, \`--axiom-auth-primary-hover\`, \`--axiom-auth-primary-active\`, \`--axiom-auth-bg\`, \`--axiom-auth-surface\`, \`--axiom-auth-text\`, \`--axiom-auth-text-secondary\`, \`--axiom-auth-border\`, \`--axiom-auth-radius\`, \`--axiom-auth-page-padding\`, \`--axiom-auth-card-width\`, \`--axiom-auth-card-padding\`, \`--axiom-auth-card-shadow\`, \`--axiom-auth-card-shadow-hover\`, \`--axiom-auth-logo-size\`, \`--axiom-auth-input-height\`
47515
+ - Provide structured controls and a small preset row (Default / Dark / Minimal / Brand):
47516
+ - colors: primary, background, surface, text, text-secondary, border
47517
+ - shape: radius, card width, card padding, input height
47518
+ - brand: logo URL, brand name, login title, login subtitle
47519
+ - The mockup should look like a real sign-in card (logo, title, subtitle, email/password inputs, primary button, footer link). Controls update the mockup live.
47520
+ - If the user asks for raw CSS beyond the tokens, include it in the draft \`customCss\` sent to \`ops_preview_login\`; the real page is the source of truth.
47521
+
47522
+ ## Field names
47523
+
47524
+ Use only: \`brandName\`, \`logoUrl\`, \`faviconUrl\`, \`primaryColor\`, \`backgroundColor\`, \`loginTitle\`, \`loginSubtitle\`, \`customCss\`.
47525
+
47526
+ Map user language: product name -> \`brandName\`, tagline -> \`loginSubtitle\`, accent color -> \`primaryColor\`. Never send \`productName\`, \`tagline\`, or \`accentColor\` to the tools.
47527
+
47528
+ ## Boundaries
47529
+
47530
+ - The widget is an approximation for discussion; the real \`/auth-preview\` page is the confirmation step.
47531
+ - Do not claim the design is applied until the save tool succeeds.
47532
+ - Do not hide or overwrite existing branding fields the user did not ask to change; use partial updates.
46686
47533
  `
46687
47534
  };
46688
47535
 
46689
47536
  // src/services/platform-ops/PlatformOpsPlugin.ts
46690
- var PLATFORM_OPS_PLUGIN_TYPE = "platform-ops";
47537
+ var PLATFORM_OPS_PLUGIN_TYPE2 = "platform-ops";
47538
+ function resolveConsoleOrigin(env = process.env) {
47539
+ const raw = env.PUBLIC_CONSOLE_URL;
47540
+ if (!raw) return void 0;
47541
+ try {
47542
+ return new URL(raw).origin;
47543
+ } catch {
47544
+ return void 0;
47545
+ }
47546
+ }
46691
47547
  var PLATFORM_OPS_AGENT_MIDDLEWARE = [
46692
47548
  {
46693
47549
  id: "platform-ops-tools",
46694
- type: PLATFORM_OPS_PLUGIN_TYPE,
47550
+ type: PLATFORM_OPS_PLUGIN_TYPE2,
46695
47551
  name: "Platform Ops",
46696
47552
  description: "Role-inherited platform read and write tools for the Ops Agent",
46697
47553
  enabled: true,
@@ -46709,9 +47565,17 @@ var PLATFORM_OPS_AGENT_MIDDLEWARE = [
46709
47565
  id: "skill",
46710
47566
  type: "skill",
46711
47567
  name: "Skill",
46712
- description: "Load the Platform Ops usage guidance",
47568
+ description: "Load the Platform Ops usage and branding-design guidance",
46713
47569
  enabled: true,
46714
47570
  config: { readAll: true }
47571
+ },
47572
+ {
47573
+ id: "widget",
47574
+ type: "widget",
47575
+ name: "Widget",
47576
+ description: "Render interactive HTML mockups for design discussion",
47577
+ enabled: true,
47578
+ config: {}
46715
47579
  }
46716
47580
  ];
46717
47581
  function buildPlatformOpsAgentConfig(env = process.env) {
@@ -46727,17 +47591,33 @@ function buildPlatformOpsAgentConfig(env = process.env) {
46727
47591
  };
46728
47592
  }
46729
47593
  function createPlatformOpsPlugin(deps = {}, env = process.env) {
47594
+ const consoleOrigin = resolveConsoleOrigin(env);
46730
47595
  return {
46731
47596
  meta: {
46732
- type: PLATFORM_OPS_PLUGIN_TYPE,
47597
+ type: PLATFORM_OPS_PLUGIN_TYPE2,
46733
47598
  name: "Platform Ops",
46734
47599
  description: "Role-inherited platform operations agent, tools, and usage skill for Admin Center",
46735
47600
  source: "builtin:gateway",
46736
- category: "platform"
47601
+ category: "platform",
47602
+ tools: [
47603
+ {
47604
+ name: "ops_preview_login",
47605
+ description: "Render a login-page preview with unsaved branding/customCss overrides.",
47606
+ ui: {
47607
+ resource: LOGIN_PREVIEW_UI_RESOURCE,
47608
+ csp: consoleOrigin ? { frameDomains: [consoleOrigin], resourceDomains: [consoleOrigin] } : {},
47609
+ trustedSameOrigin: true
47610
+ }
47611
+ }
47612
+ ],
47613
+ uiResources: {
47614
+ [LOGIN_PREVIEW_UI_RESOURCE]: { html: LOGIN_PREVIEW_APP_HTML }
47615
+ }
46737
47616
  },
46738
47617
  middleware: () => createPlatformOpsMiddleware(deps),
46739
47618
  skills: {
46740
- [PLATFORM_OPS_SKILL_KEY]: PLATFORM_OPS_SKILL
47619
+ [PLATFORM_OPS_SKILL_KEY]: PLATFORM_OPS_SKILL,
47620
+ [PLATFORM_OPS_BRANDING_DESIGN_SKILL_KEY]: PLATFORM_OPS_BRANDING_DESIGN_SKILL
46741
47621
  },
46742
47622
  agents: {
46743
47623
  [PLATFORM_OPS_AGENT_ID3]: buildPlatformOpsAgentConfig(env)
@@ -46790,7 +47670,7 @@ var PluginDeploymentError = class extends Error {
46790
47670
  this.code = code;
46791
47671
  }
46792
47672
  };
46793
- function isRecord17(value) {
47673
+ function isRecord18(value) {
46794
47674
  return typeof value === "object" && value !== null && !Array.isArray(value);
46795
47675
  }
46796
47676
  function buildBootstrapEntrypoint(pluginType) {
@@ -47344,7 +48224,7 @@ var PluginDeploymentService = class {
47344
48224
  return { ok: false, error: `health responded with HTTP ${response.status}` };
47345
48225
  }
47346
48226
  const body = await response.json().catch(() => void 0);
47347
- if (isRecord17(body) && body.ok === true) {
48227
+ if (isRecord18(body) && body.ok === true) {
47348
48228
  return { ok: true };
47349
48229
  }
47350
48230
  return { ok: false, error: "health returned an invalid envelope" };
@@ -49904,7 +50784,7 @@ function installAgentLifecycleSync(params) {
49904
50784
  void publishAgentLifecycle(params.outbox, params.owner, event);
49905
50785
  });
49906
50786
  }
49907
- function isRecord18(value) {
50787
+ function isRecord19(value) {
49908
50788
  return typeof value === "object" && value !== null && !Array.isArray(value);
49909
50789
  }
49910
50790
  function nonEmptyString(value) {
@@ -49914,7 +50794,7 @@ function isMirroredEvent(value) {
49914
50794
  return typeof value === "string" && MIRRORED_EVENT_SET.has(value);
49915
50795
  }
49916
50796
  function handleAgentLifecycle(payload, deps = {}) {
49917
- if (!isRecord18(payload)) return false;
50797
+ if (!isRecord19(payload)) return false;
49918
50798
  const tenantId = payload.tenantId;
49919
50799
  const assistantId = payload.assistantId;
49920
50800
  const threadId = payload.threadId;
@@ -51169,9 +52049,9 @@ var start = async (config) => {
51169
52049
  });
51170
52050
  }
51171
52051
  try {
51172
- const { A2AAuthService: A2AAuthService2, parseEnvKeys: parseEnvKeys2 } = await import("./A2AAuthService-UKN53ZGP.mjs");
51173
- const { registerA2AStandardRoutes } = await import("./a2a-standard-ELY7MTJB.mjs");
51174
- const a2a = await import("./a2a-YLKZE5JG.mjs");
52052
+ const { A2AAuthService: A2AAuthService2, parseEnvKeys: parseEnvKeys2 } = await import("./A2AAuthService-UYWSDE5L.mjs");
52053
+ const { registerA2AStandardRoutes } = await import("./a2a-standard-2IJP4JG5.mjs");
52054
+ const a2a = await import("./a2a-OCCSVNWB.mjs");
51175
52055
  const a2aKeyStore = getStoreLattice46("default", "a2aApiKey").store;
51176
52056
  const assistantStore = getStoreLattice46("default", "assistant").store;
51177
52057
  const projectStore = getStoreLattice46("default", "project").store;
@@ -51200,19 +52080,16 @@ var start = async (config) => {
51200
52080
  });
51201
52081
  }
51202
52082
  try {
51203
- const { registerOpenRoutes } = await import("./open-Y7PAA2VJ.mjs");
51204
- const { registerOpenSessionRoutes } = await import("./open-session-CLZT3HVG.mjs");
51205
- const { registerOpenCatalogRoutes } = await import("./open-catalog-NVGP6SQP.mjs");
51206
- const { registerOpenFilesRoutes } = await import("./open-files-WK4SQHE3.mjs");
52083
+ const { registerOpenRoutes } = await import("./open-TJLQARLV.mjs");
52084
+ const { registerOpenSessionRoutes } = await import("./open-session-F5H6PFSN.mjs");
52085
+ const { registerOpenCatalogRoutes } = await import("./open-catalog-LLTMSZGH.mjs");
52086
+ const { registerOpenFilesRoutes } = await import("./open-files-QIMOTHSN.mjs");
51207
52087
  const { registerOpenAuditRoutes } = await import("./open-audit-UJ3NXCGW.mjs");
51208
- const { registerOpenExposureRoutes } = await import("./open-exposure-HGYT5VFC.mjs");
51209
- const { openLattice } = await import("./openLattice-D5YTSZBY.mjs");
51210
- const { createKbProvider } = await import("./kbProvider-2D6DZ34N.mjs");
52088
+ const { registerOpenExposureRoutes } = await import("./open-exposure-2CSXJTM3.mjs");
52089
+ const { openLattice } = await import("./openLattice-KFUREFWM.mjs");
51211
52090
  const { createOpenSandboxProvider } = await import("./sandboxProvider-LA6B5SKU.mjs");
51212
52091
  const { createAgentProvider } = await import("./agentProvider-X4FVQPKW.mjs");
51213
- const { registerExposedPluginTools } = await import("./registerExposedPlugins-2JGXSMAL.mjs");
51214
- const { CollectionService: CollectionService2 } = await import("./collection_service-RTRJEQFL.mjs");
51215
- openLattice.register(createKbProvider(new CollectionService2()));
52092
+ const { registerExposedPluginTools } = await import("./registerExposedPlugins-N6ENBBKN.mjs");
51216
52093
  openLattice.register(createOpenSandboxProvider());
51217
52094
  const threadStore = getStoreLattice46("default", "thread").store;
51218
52095
  const assistantStore = getStoreLattice46("default", "assistant").store;
@@ -51232,14 +52109,14 @@ var start = async (config) => {
51232
52109
  registerOpenFilesRoutes(app);
51233
52110
  registerOpenAuditRoutes(app);
51234
52111
  registerOpenExposureRoutes(app);
51235
- logger8.info("Open API routes registered (kb + sandbox providers, session exchange)");
52112
+ logger8.info("Open API routes registered (sandbox + agent providers, plugin tools, session exchange)");
51236
52113
  } catch (err) {
51237
52114
  logger8.warn("Open API routes unavailable", {
51238
52115
  error: err instanceof Error ? err.message : String(err)
51239
52116
  });
51240
52117
  }
51241
52118
  try {
51242
- const { registerGatewaySandboxOpenCredentialProvider } = await import("./sandboxOpenCredentialProvider-RTYOYRCT.mjs");
52119
+ const { registerGatewaySandboxOpenCredentialProvider } = await import("./sandboxOpenCredentialProvider-3CUISBEL.mjs");
51243
52120
  registerGatewaySandboxOpenCredentialProvider((error) => {
51244
52121
  logger8.warn("sandbox open-credential provider failed", { error });
51245
52122
  });
@@ -51298,7 +52175,7 @@ var start = async (config) => {
51298
52175
  }
51299
52176
  }
51300
52177
  try {
51301
- const { ResourceController } = await import("./resources-YD5DOPGD.mjs");
52178
+ const { ResourceController } = await import("./resources-53PXMFQI.mjs");
51302
52179
  const sharedResourceStore = getStoreLattice46("default", "sharedResource").store;
51303
52180
  const cache = new TokenCache();
51304
52181
  const resourceController = new ResourceController({
@@ -51309,7 +52186,7 @@ var start = async (config) => {
51309
52186
  });
51310
52187
  registerResourceRoutes(app, resourceController);
51311
52188
  const { registerMcpAppShareRoutes } = await import("./mcp-app-shares-M45HR4ZV.mjs");
51312
- const { makeMcpAppHandlers, resolveMcpAppDeps } = await import("./mcp-apps-MZECSNN2.mjs");
52189
+ const { makeMcpAppHandlers, resolveMcpAppDeps } = await import("./mcp-apps-MKHHUJE4.mjs");
51313
52190
  registerMcpAppShareRoutes(app, {
51314
52191
  store: sharedResourceStore,
51315
52192
  handlers: makeMcpAppHandlers(resolveMcpAppDeps()),