@flanksource/clicky-ui 0.3.29 → 0.3.31

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 (346) hide show
  1. package/dist/ai.cjs +48 -3
  2. package/dist/ai.cjs.map +1 -1
  3. package/dist/ai.js +46 -1
  4. package/dist/ai.js.map +1 -1
  5. package/dist/comments/CommentCard.cjs +110 -262
  6. package/dist/comments/CommentCard.cjs.map +1 -1
  7. package/dist/comments/CommentCard.d.ts +3 -1
  8. package/dist/comments/CommentCard.d.ts.map +1 -1
  9. package/dist/comments/CommentCard.js +105 -257
  10. package/dist/comments/CommentCard.js.map +1 -1
  11. package/dist/comments/CommentCardParts.cjs +95 -0
  12. package/dist/comments/CommentCardParts.cjs.map +1 -0
  13. package/dist/comments/CommentCardParts.d.ts +17 -0
  14. package/dist/comments/CommentCardParts.d.ts.map +1 -0
  15. package/dist/comments/CommentCardParts.js +95 -0
  16. package/dist/comments/CommentCardParts.js.map +1 -0
  17. package/dist/comments/CommentSidePanel.cjs +14 -7
  18. package/dist/comments/CommentSidePanel.cjs.map +1 -1
  19. package/dist/comments/CommentSidePanel.d.ts +3 -1
  20. package/dist/comments/CommentSidePanel.d.ts.map +1 -1
  21. package/dist/comments/CommentSidePanel.js +14 -7
  22. package/dist/comments/CommentSidePanel.js.map +1 -1
  23. package/dist/comments/CommentThread.cjs +2 -0
  24. package/dist/comments/CommentThread.cjs.map +1 -1
  25. package/dist/comments/CommentThread.d.ts +2 -1
  26. package/dist/comments/CommentThread.d.ts.map +1 -1
  27. package/dist/comments/CommentThread.js +2 -0
  28. package/dist/comments/CommentThread.js.map +1 -1
  29. package/dist/comments/CommentThreadList.cjs +50 -34
  30. package/dist/comments/CommentThreadList.cjs.map +1 -1
  31. package/dist/comments/CommentThreadList.d.ts +3 -1
  32. package/dist/comments/CommentThreadList.d.ts.map +1 -1
  33. package/dist/comments/CommentThreadList.js +50 -34
  34. package/dist/comments/CommentThreadList.js.map +1 -1
  35. package/dist/components/ComboboxMenu.cjs +4 -1
  36. package/dist/components/ComboboxMenu.cjs.map +1 -1
  37. package/dist/components/ComboboxMenu.d.ts.map +1 -1
  38. package/dist/components/ComboboxMenu.js +5 -2
  39. package/dist/components/ComboboxMenu.js.map +1 -1
  40. package/dist/components/ComboboxTags.cjs +5 -1
  41. package/dist/components/ComboboxTags.cjs.map +1 -1
  42. package/dist/components/ComboboxTags.d.ts.map +1 -1
  43. package/dist/components/ComboboxTags.js +6 -2
  44. package/dist/components/ComboboxTags.js.map +1 -1
  45. package/dist/components/ConnectionLoggingPolicy.cjs +24 -35
  46. package/dist/components/ConnectionLoggingPolicy.cjs.map +1 -1
  47. package/dist/components/ConnectionLoggingPolicy.d.ts.map +1 -1
  48. package/dist/components/ConnectionLoggingPolicy.js +24 -35
  49. package/dist/components/ConnectionLoggingPolicy.js.map +1 -1
  50. package/dist/components/DateField.d.ts +1 -1
  51. package/dist/components/DatePicker.d.ts +1 -1
  52. package/dist/components/DateTimePicker.d.ts +1 -1
  53. package/dist/components/MultiSelect.cjs.map +1 -1
  54. package/dist/components/MultiSelect.d.ts +7 -0
  55. package/dist/components/MultiSelect.d.ts.map +1 -1
  56. package/dist/components/MultiSelect.js.map +1 -1
  57. package/dist/components/filter-bar-multi.cjs +10 -1
  58. package/dist/components/filter-bar-multi.cjs.map +1 -1
  59. package/dist/components/filter-bar-multi.d.ts.map +1 -1
  60. package/dist/components/filter-bar-multi.js +11 -2
  61. package/dist/components/filter-bar-multi.js.map +1 -1
  62. package/dist/components/mdx-editor-callout-model.d.ts +1 -1
  63. package/dist/data/MarkdownEditor.model.d.ts +1 -1
  64. package/dist/data/ai/ChatWindow.catalogs.cjs +11 -5
  65. package/dist/data/ai/ChatWindow.catalogs.cjs.map +1 -1
  66. package/dist/data/ai/ChatWindow.catalogs.d.ts +2 -1
  67. package/dist/data/ai/ChatWindow.catalogs.d.ts.map +1 -1
  68. package/dist/data/ai/ChatWindow.catalogs.js +11 -5
  69. package/dist/data/ai/ChatWindow.catalogs.js.map +1 -1
  70. package/dist/data/ai/ChatWindow.cjs +1 -0
  71. package/dist/data/ai/ChatWindow.cjs.map +1 -1
  72. package/dist/data/ai/ChatWindow.d.ts.map +1 -1
  73. package/dist/data/ai/ChatWindow.js +1 -0
  74. package/dist/data/ai/ChatWindow.js.map +1 -1
  75. package/dist/data/ai/PromptRunEditor/VariablesField.cjs +79 -0
  76. package/dist/data/ai/PromptRunEditor/VariablesField.cjs.map +1 -0
  77. package/dist/data/ai/PromptRunEditor/VariablesField.d.ts +8 -0
  78. package/dist/data/ai/PromptRunEditor/VariablesField.d.ts.map +1 -0
  79. package/dist/data/ai/PromptRunEditor/VariablesField.js +79 -0
  80. package/dist/data/ai/PromptRunEditor/VariablesField.js.map +1 -0
  81. package/dist/data/ai/PromptRunEditor/index.cjs +61 -69
  82. package/dist/data/ai/PromptRunEditor/index.cjs.map +1 -1
  83. package/dist/data/ai/PromptRunEditor/index.d.ts +11 -1
  84. package/dist/data/ai/PromptRunEditor/index.d.ts.map +1 -1
  85. package/dist/data/ai/PromptRunEditor/index.js +61 -69
  86. package/dist/data/ai/PromptRunEditor/index.js.map +1 -1
  87. package/dist/data/ai/PromptRunEditor/model.cjs.map +1 -1
  88. package/dist/data/ai/PromptRunEditor/model.d.ts +2 -0
  89. package/dist/data/ai/PromptRunEditor/model.d.ts.map +1 -1
  90. package/dist/data/ai/PromptRunEditor/model.js.map +1 -1
  91. package/dist/data/ai/SessionViewer.model.cjs +23 -8
  92. package/dist/data/ai/SessionViewer.model.cjs.map +1 -1
  93. package/dist/data/ai/SessionViewer.model.d.ts +8 -0
  94. package/dist/data/ai/SessionViewer.model.d.ts.map +1 -1
  95. package/dist/data/ai/SessionViewer.model.js +23 -8
  96. package/dist/data/ai/SessionViewer.model.js.map +1 -1
  97. package/dist/data/ai/SessionViewer.rows.cjs +9 -1
  98. package/dist/data/ai/SessionViewer.rows.cjs.map +1 -1
  99. package/dist/data/ai/SessionViewer.rows.js +9 -1
  100. package/dist/data/ai/SessionViewer.rows.js.map +1 -1
  101. package/dist/data/ai/SpecRuntimeEditor/ModelSection.cjs +4 -3
  102. package/dist/data/ai/SpecRuntimeEditor/ModelSection.cjs.map +1 -1
  103. package/dist/data/ai/SpecRuntimeEditor/ModelSection.d.ts.map +1 -1
  104. package/dist/data/ai/SpecRuntimeEditor/ModelSection.js +2 -1
  105. package/dist/data/ai/SpecRuntimeEditor/ModelSection.js.map +1 -1
  106. package/dist/data/ai/SpecRuntimeEditor/PermissionModeField.cjs +2 -2
  107. package/dist/data/ai/SpecRuntimeEditor/PermissionModeField.cjs.map +1 -1
  108. package/dist/data/ai/SpecRuntimeEditor/PermissionModeField.js +1 -1
  109. package/dist/data/ai/SpecRuntimeEditor/VerifySection.cjs +24 -2
  110. package/dist/data/ai/SpecRuntimeEditor/VerifySection.cjs.map +1 -1
  111. package/dist/data/ai/SpecRuntimeEditor/VerifySection.d.ts.map +1 -1
  112. package/dist/data/ai/SpecRuntimeEditor/VerifySection.js +25 -3
  113. package/dist/data/ai/SpecRuntimeEditor/VerifySection.js.map +1 -1
  114. package/dist/data/ai/SpecRuntimeEditor/index.cjs +4 -3
  115. package/dist/data/ai/SpecRuntimeEditor/index.cjs.map +1 -1
  116. package/dist/data/ai/SpecRuntimeEditor/index.d.ts.map +1 -1
  117. package/dist/data/ai/SpecRuntimeEditor/index.js +2 -1
  118. package/dist/data/ai/SpecRuntimeEditor/index.js.map +1 -1
  119. package/dist/data/ai/SpecRuntimeEditor/summaries.cjs.map +1 -1
  120. package/dist/data/ai/SpecRuntimeEditor/summaries.d.ts.map +1 -1
  121. package/dist/data/ai/SpecRuntimeEditor/summaries.js.map +1 -1
  122. package/dist/data/ai/SpecRuntimeEditor.model.cjs +4 -0
  123. package/dist/data/ai/SpecRuntimeEditor.model.cjs.map +1 -1
  124. package/dist/data/ai/SpecRuntimeEditor.model.d.ts +4 -0
  125. package/dist/data/ai/SpecRuntimeEditor.model.d.ts.map +1 -1
  126. package/dist/data/ai/SpecRuntimeEditor.model.js +4 -0
  127. package/dist/data/ai/SpecRuntimeEditor.model.js.map +1 -1
  128. package/dist/data/ai/index.d.ts +3 -2
  129. package/dist/data/ai/index.d.ts.map +1 -1
  130. package/dist/data/ai/runtime-profile.cjs.map +1 -1
  131. package/dist/data/ai/runtime-profile.d.ts +9 -7
  132. package/dist/data/ai/runtime-profile.d.ts.map +1 -1
  133. package/dist/data/ai/runtime-profile.js.map +1 -1
  134. package/dist/data/ai/runtime-profiles/OrderedPresetSelect.cjs +111 -0
  135. package/dist/data/ai/runtime-profiles/OrderedPresetSelect.cjs.map +1 -0
  136. package/dist/data/ai/runtime-profiles/OrderedPresetSelect.d.ts +7 -0
  137. package/dist/data/ai/runtime-profiles/OrderedPresetSelect.d.ts.map +1 -0
  138. package/dist/data/ai/runtime-profiles/OrderedPresetSelect.js +111 -0
  139. package/dist/data/ai/runtime-profiles/OrderedPresetSelect.js.map +1 -0
  140. package/dist/data/ai/runtime-profiles/PermissionStrategiesEditor.cjs +313 -0
  141. package/dist/data/ai/runtime-profiles/PermissionStrategiesEditor.cjs.map +1 -0
  142. package/dist/data/ai/runtime-profiles/PermissionStrategiesEditor.d.ts +8 -0
  143. package/dist/data/ai/runtime-profiles/PermissionStrategiesEditor.d.ts.map +1 -0
  144. package/dist/data/ai/runtime-profiles/PermissionStrategiesEditor.js +313 -0
  145. package/dist/data/ai/runtime-profiles/PermissionStrategiesEditor.js.map +1 -0
  146. package/dist/data/ai/runtime-profiles/PermissionStrategyConditionRow.cjs +98 -0
  147. package/dist/data/ai/runtime-profiles/PermissionStrategyConditionRow.cjs.map +1 -0
  148. package/dist/data/ai/runtime-profiles/PermissionStrategyConditionRow.d.ts +11 -0
  149. package/dist/data/ai/runtime-profiles/PermissionStrategyConditionRow.d.ts.map +1 -0
  150. package/dist/data/ai/runtime-profiles/PermissionStrategyConditionRow.js +98 -0
  151. package/dist/data/ai/runtime-profiles/PermissionStrategyConditionRow.js.map +1 -0
  152. package/dist/data/ai/runtime-profiles/PresetSpecEditor.cjs +35 -0
  153. package/dist/data/ai/runtime-profiles/PresetSpecEditor.cjs.map +1 -0
  154. package/dist/data/ai/runtime-profiles/PresetSpecEditor.d.ts +11 -0
  155. package/dist/data/ai/runtime-profiles/PresetSpecEditor.d.ts.map +1 -0
  156. package/dist/data/ai/runtime-profiles/PresetSpecEditor.js +35 -0
  157. package/dist/data/ai/runtime-profiles/PresetSpecEditor.js.map +1 -0
  158. package/dist/data/ai/runtime-profiles/PresetWorkspace.cjs +179 -0
  159. package/dist/data/ai/runtime-profiles/PresetWorkspace.cjs.map +1 -0
  160. package/dist/data/ai/runtime-profiles/PresetWorkspace.d.ts +22 -0
  161. package/dist/data/ai/runtime-profiles/PresetWorkspace.d.ts.map +1 -0
  162. package/dist/data/ai/runtime-profiles/PresetWorkspace.js +179 -0
  163. package/dist/data/ai/runtime-profiles/PresetWorkspace.js.map +1 -0
  164. package/dist/data/ai/runtime-profiles/ProfileSpecEditor.cjs +57 -0
  165. package/dist/data/ai/runtime-profiles/ProfileSpecEditor.cjs.map +1 -0
  166. package/dist/data/ai/runtime-profiles/ProfileSpecEditor.d.ts +18 -0
  167. package/dist/data/ai/runtime-profiles/ProfileSpecEditor.d.ts.map +1 -0
  168. package/dist/data/ai/runtime-profiles/ProfileSpecEditor.js +57 -0
  169. package/dist/data/ai/runtime-profiles/ProfileSpecEditor.js.map +1 -0
  170. package/dist/data/ai/runtime-profiles/ProfileWorkspace.cjs +135 -0
  171. package/dist/data/ai/runtime-profiles/ProfileWorkspace.cjs.map +1 -0
  172. package/dist/data/ai/runtime-profiles/ProfileWorkspace.d.ts +23 -0
  173. package/dist/data/ai/runtime-profiles/ProfileWorkspace.d.ts.map +1 -0
  174. package/dist/data/ai/runtime-profiles/ProfileWorkspace.js +135 -0
  175. package/dist/data/ai/runtime-profiles/ProfileWorkspace.js.map +1 -0
  176. package/dist/data/ai/runtime-profiles/ResolutionInspector.cjs +85 -0
  177. package/dist/data/ai/runtime-profiles/ResolutionInspector.cjs.map +1 -0
  178. package/dist/data/ai/runtime-profiles/ResolutionInspector.d.ts +7 -0
  179. package/dist/data/ai/runtime-profiles/ResolutionInspector.d.ts.map +1 -0
  180. package/dist/data/ai/runtime-profiles/ResolutionInspector.js +85 -0
  181. package/dist/data/ai/runtime-profiles/ResolutionInspector.js.map +1 -0
  182. package/dist/data/ai/runtime-profiles/ResolutionTrace.cjs +42 -0
  183. package/dist/data/ai/runtime-profiles/ResolutionTrace.cjs.map +1 -0
  184. package/dist/data/ai/runtime-profiles/ResolutionTrace.d.ts +6 -0
  185. package/dist/data/ai/runtime-profiles/ResolutionTrace.d.ts.map +1 -0
  186. package/dist/data/ai/runtime-profiles/ResolutionTrace.js +42 -0
  187. package/dist/data/ai/runtime-profiles/ResolutionTrace.js.map +1 -0
  188. package/dist/data/ai/runtime-profiles/RuntimeLibraryList.cjs +93 -0
  189. package/dist/data/ai/runtime-profiles/RuntimeLibraryList.cjs.map +1 -0
  190. package/dist/data/ai/runtime-profiles/RuntimeLibraryList.d.ts +18 -0
  191. package/dist/data/ai/runtime-profiles/RuntimeLibraryList.d.ts.map +1 -0
  192. package/dist/data/ai/runtime-profiles/RuntimeLibraryList.js +93 -0
  193. package/dist/data/ai/runtime-profiles/RuntimeLibraryList.js.map +1 -0
  194. package/dist/data/ai/runtime-profiles/RuntimePersistenceBar.cjs +44 -0
  195. package/dist/data/ai/runtime-profiles/RuntimePersistenceBar.cjs.map +1 -0
  196. package/dist/data/ai/runtime-profiles/RuntimePersistenceBar.d.ts +6 -0
  197. package/dist/data/ai/runtime-profiles/RuntimePersistenceBar.d.ts.map +1 -0
  198. package/dist/data/ai/runtime-profiles/RuntimePersistenceBar.js +44 -0
  199. package/dist/data/ai/runtime-profiles/RuntimePersistenceBar.js.map +1 -0
  200. package/dist/data/ai/runtime-profiles/RuntimeProfilePicker.cjs +198 -0
  201. package/dist/data/ai/runtime-profiles/RuntimeProfilePicker.cjs.map +1 -0
  202. package/dist/data/ai/runtime-profiles/RuntimeProfilePicker.d.ts +12 -0
  203. package/dist/data/ai/runtime-profiles/RuntimeProfilePicker.d.ts.map +1 -0
  204. package/dist/data/ai/runtime-profiles/RuntimeProfilePicker.js +198 -0
  205. package/dist/data/ai/runtime-profiles/RuntimeProfilePicker.js.map +1 -0
  206. package/dist/data/ai/runtime-profiles/RuntimeProfilePicker.model.cjs +97 -0
  207. package/dist/data/ai/runtime-profiles/RuntimeProfilePicker.model.cjs.map +1 -0
  208. package/dist/data/ai/runtime-profiles/RuntimeProfilePicker.model.d.ts +26 -0
  209. package/dist/data/ai/runtime-profiles/RuntimeProfilePicker.model.d.ts.map +1 -0
  210. package/dist/data/ai/runtime-profiles/RuntimeProfilePicker.model.js +97 -0
  211. package/dist/data/ai/runtime-profiles/RuntimeProfilePicker.model.js.map +1 -0
  212. package/dist/data/ai/runtime-profiles/RuntimeProfilesWorkspace.cjs +143 -0
  213. package/dist/data/ai/runtime-profiles/RuntimeProfilesWorkspace.cjs.map +1 -0
  214. package/dist/data/ai/runtime-profiles/RuntimeProfilesWorkspace.d.ts +25 -0
  215. package/dist/data/ai/runtime-profiles/RuntimeProfilesWorkspace.d.ts.map +1 -0
  216. package/dist/data/ai/runtime-profiles/RuntimeProfilesWorkspace.js +143 -0
  217. package/dist/data/ai/runtime-profiles/RuntimeProfilesWorkspace.js.map +1 -0
  218. package/dist/data/ai/runtime-profiles/RuntimeStatusNotice.cjs +41 -0
  219. package/dist/data/ai/runtime-profiles/RuntimeStatusNotice.cjs.map +1 -0
  220. package/dist/data/ai/runtime-profiles/RuntimeStatusNotice.d.ts +8 -0
  221. package/dist/data/ai/runtime-profiles/RuntimeStatusNotice.d.ts.map +1 -0
  222. package/dist/data/ai/runtime-profiles/RuntimeStatusNotice.js +41 -0
  223. package/dist/data/ai/runtime-profiles/RuntimeStatusNotice.js.map +1 -0
  224. package/dist/data/ai/runtime-profiles/index.d.ts +20 -0
  225. package/dist/data/ai/runtime-profiles/index.d.ts.map +1 -0
  226. package/dist/data/ai/runtime-profiles/types.d.ts +50 -0
  227. package/dist/data/ai/runtime-profiles/types.d.ts.map +1 -0
  228. package/dist/data/ai/runtime-profiles/use-permission-catalog.cjs +37 -0
  229. package/dist/data/ai/runtime-profiles/use-permission-catalog.cjs.map +1 -0
  230. package/dist/data/ai/runtime-profiles/use-permission-catalog.d.ts +5 -0
  231. package/dist/data/ai/runtime-profiles/use-permission-catalog.d.ts.map +1 -0
  232. package/dist/data/ai/runtime-profiles/use-permission-catalog.js +37 -0
  233. package/dist/data/ai/runtime-profiles/use-permission-catalog.js.map +1 -0
  234. package/dist/data/ai/runtime-profiles/use-resolution.cjs +43 -0
  235. package/dist/data/ai/runtime-profiles/use-resolution.cjs.map +1 -0
  236. package/dist/data/ai/runtime-profiles/use-resolution.d.ts +4 -0
  237. package/dist/data/ai/runtime-profiles/use-resolution.d.ts.map +1 -0
  238. package/dist/data/ai/runtime-profiles/use-resolution.js +43 -0
  239. package/dist/data/ai/runtime-profiles/use-resolution.js.map +1 -0
  240. package/dist/data/ai/runtime-profiles/use-runtime-families.cjs +38 -0
  241. package/dist/data/ai/runtime-profiles/use-runtime-families.cjs.map +1 -0
  242. package/dist/data/ai/runtime-profiles/use-runtime-families.d.ts +3 -0
  243. package/dist/data/ai/runtime-profiles/use-runtime-families.d.ts.map +1 -0
  244. package/dist/data/ai/runtime-profiles/use-runtime-families.js +38 -0
  245. package/dist/data/ai/runtime-profiles/use-runtime-families.js.map +1 -0
  246. package/dist/data/ai/runtime-profiles/use-runtime-profile-picker.cjs +107 -0
  247. package/dist/data/ai/runtime-profiles/use-runtime-profile-picker.cjs.map +1 -0
  248. package/dist/data/ai/runtime-profiles/use-runtime-profile-picker.d.ts +35 -0
  249. package/dist/data/ai/runtime-profiles/use-runtime-profile-picker.d.ts.map +1 -0
  250. package/dist/data/ai/runtime-profiles/use-runtime-profile-picker.js +107 -0
  251. package/dist/data/ai/runtime-profiles/use-runtime-profile-picker.js.map +1 -0
  252. package/dist/data/ai/use-session-scroll.cjs.map +1 -1
  253. package/dist/data/ai/use-session-scroll.d.ts +2 -2
  254. package/dist/data/ai/use-session-scroll.d.ts.map +1 -1
  255. package/dist/data/ai/use-session-scroll.js.map +1 -1
  256. package/dist/data/badge-variants.d.ts +1 -1
  257. package/dist/data/runtime/RuntimeBar.cjs +3 -2
  258. package/dist/data/runtime/RuntimeBar.cjs.map +1 -1
  259. package/dist/data/runtime/RuntimeBar.d.ts.map +1 -1
  260. package/dist/data/runtime/RuntimeBar.js +3 -2
  261. package/dist/data/runtime/RuntimeBar.js.map +1 -1
  262. package/dist/data/runtime/runtime-field-support.cjs +3 -3
  263. package/dist/data/runtime/runtime-field-support.cjs.map +1 -1
  264. package/dist/data/runtime/runtime-field-support.js +1 -1
  265. package/dist/data/runtime/runtime-mode.cjs +14 -47
  266. package/dist/data/runtime/runtime-mode.cjs.map +1 -1
  267. package/dist/data/runtime/runtime-mode.d.ts +5 -7
  268. package/dist/data/runtime/runtime-mode.d.ts.map +1 -1
  269. package/dist/data/runtime/runtime-mode.js +7 -39
  270. package/dist/data/runtime/runtime-mode.js.map +1 -1
  271. package/dist/data/test-runner/TestRunner.cjs +6 -4
  272. package/dist/data/test-runner/TestRunner.cjs.map +1 -1
  273. package/dist/data/test-runner/TestRunner.d.ts +10 -1
  274. package/dist/data/test-runner/TestRunner.d.ts.map +1 -1
  275. package/dist/data/test-runner/TestRunner.js +6 -4
  276. package/dist/data/test-runner/TestRunner.js.map +1 -1
  277. package/dist/data/verification/VerificationResults.cjs +99 -0
  278. package/dist/data/verification/VerificationResults.cjs.map +1 -0
  279. package/dist/data/verification/VerificationResults.d.ts +27 -0
  280. package/dist/data/verification/VerificationResults.d.ts.map +1 -0
  281. package/dist/data/verification/VerificationResults.js +99 -0
  282. package/dist/data/verification/VerificationResults.js.map +1 -0
  283. package/dist/data/verification/adapterViews.cjs +116 -0
  284. package/dist/data/verification/adapterViews.cjs.map +1 -0
  285. package/dist/data/verification/adapterViews.d.ts +13 -0
  286. package/dist/data/verification/adapterViews.d.ts.map +1 -0
  287. package/dist/data/verification/adapterViews.js +116 -0
  288. package/dist/data/verification/adapterViews.js.map +1 -0
  289. package/dist/data/verification/adapters.cjs +26 -0
  290. package/dist/data/verification/adapters.cjs.map +1 -0
  291. package/dist/data/verification/adapters.d.ts +6 -0
  292. package/dist/data/verification/adapters.d.ts.map +1 -0
  293. package/dist/data/verification/adapters.js +26 -0
  294. package/dist/data/verification/adapters.js.map +1 -0
  295. package/dist/data/verification/index.d.ts +5 -0
  296. package/dist/data/verification/index.d.ts.map +1 -0
  297. package/dist/data/verification/verify-report.cjs +58 -0
  298. package/dist/data/verification/verify-report.cjs.map +1 -0
  299. package/dist/data/verification/verify-report.d.ts +96 -0
  300. package/dist/data/verification/verify-report.d.ts.map +1 -0
  301. package/dist/data/verification/verify-report.js +58 -0
  302. package/dist/data/verification/verify-report.js.map +1 -0
  303. package/dist/data/verification/verifyReportTests.cjs +83 -0
  304. package/dist/data/verification/verifyReportTests.cjs.map +1 -0
  305. package/dist/data/verification/verifyReportTests.d.ts +13 -0
  306. package/dist/data/verification/verifyReportTests.d.ts.map +1 -0
  307. package/dist/data/verification/verifyReportTests.js +83 -0
  308. package/dist/data/verification/verifyReportTests.js.map +1 -0
  309. package/dist/data/version-info.cjs +3 -3
  310. package/dist/data/version-info.js +3 -3
  311. package/dist/data.cjs +10 -0
  312. package/dist/data.cjs.map +1 -1
  313. package/dist/data.d.ts +1 -0
  314. package/dist/data.d.ts.map +1 -1
  315. package/dist/data.js +10 -0
  316. package/dist/data.js.map +1 -1
  317. package/dist/index.cjs +62 -0
  318. package/dist/index.cjs.map +1 -1
  319. package/dist/index.js +62 -0
  320. package/dist/index.js.map +1 -1
  321. package/dist/lib/permission-strategies.cjs +155 -0
  322. package/dist/lib/permission-strategies.cjs.map +1 -0
  323. package/dist/lib/permission-strategies.d.ts +35 -0
  324. package/dist/lib/permission-strategies.d.ts.map +1 -0
  325. package/dist/lib/permission-strategies.js +155 -0
  326. package/dist/lib/permission-strategies.js.map +1 -0
  327. package/dist/lib/runtime-family.cjs +51 -0
  328. package/dist/lib/runtime-family.cjs.map +1 -0
  329. package/dist/lib/runtime-family.d.ts +25 -0
  330. package/dist/lib/runtime-family.d.ts.map +1 -0
  331. package/dist/lib/runtime-family.js +51 -0
  332. package/dist/lib/runtime-family.js.map +1 -0
  333. package/dist/lib/runtime-profile-model.cjs +129 -0
  334. package/dist/lib/runtime-profile-model.cjs.map +1 -0
  335. package/dist/lib/runtime-profile-model.d.ts +30 -0
  336. package/dist/lib/runtime-profile-model.d.ts.map +1 -0
  337. package/dist/lib/runtime-profile-model.js +129 -0
  338. package/dist/lib/runtime-profile-model.js.map +1 -0
  339. package/dist/styles.css +1 -1
  340. package/dist/utils.cjs +52 -0
  341. package/dist/utils.cjs.map +1 -1
  342. package/dist/utils.d.ts +5 -0
  343. package/dist/utils.d.ts.map +1 -1
  344. package/dist/utils.js +53 -1
  345. package/dist/utils.js.map +1 -1
  346. package/package.json +1 -1
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const SPEC_RUNTIME_MODES = ["api", "agent", "cli", "cmux"];
4
+ const RUNTIME_MODES = new Set(SPEC_RUNTIME_MODES);
5
+ function isSpecRuntimeMode(value) {
6
+ return RUNTIME_MODES.has(value ?? "");
7
+ }
8
+ function runtimeModeFromModel(model) {
9
+ const [prefix] = (model ?? "").trim().toLowerCase().split(":");
10
+ return isSpecRuntimeMode(prefix) ? prefix : void 0;
11
+ }
12
+ function familyForModel(families, models, modelId) {
13
+ var _a;
14
+ if (!modelId) return void 0;
15
+ const selected = models.find(
16
+ (model) => {
17
+ var _a2, _b;
18
+ return model.id === modelId || ((_a2 = model.runtime) == null ? void 0 : _a2.model) === modelId || ((_b = model.runtime) == null ? void 0 : _b.id) === modelId;
19
+ }
20
+ );
21
+ const compact = ((_a = modelId.split(",")[0]) == null ? void 0 : _a.trim()) ?? "";
22
+ const [prefix, inlineModel] = compact.split(":");
23
+ const canonicalModel = RUNTIME_MODES.has((prefix == null ? void 0 : prefix.toLowerCase()) ?? "") && inlineModel ? inlineModel : compact;
24
+ const slash = canonicalModel.indexOf("/");
25
+ const provider = (selected == null ? void 0 : selected.provider) ?? (slash > 0 ? canonicalModel.slice(0, slash) : void 0);
26
+ if (!provider) return void 0;
27
+ return families.find(
28
+ (family) => family.provider === provider || family.catalogPrefix === provider || family.modes.some((mode) => mode.provider === provider)
29
+ );
30
+ }
31
+ function modeOptionFor(families, mode, preferredFamily) {
32
+ const target = (mode ?? "").toLowerCase();
33
+ if (!target) return void 0;
34
+ const ordered = preferredFamily ? [
35
+ ...families.filter((family) => family.id === preferredFamily),
36
+ ...families.filter((family) => family.id !== preferredFamily)
37
+ ] : families;
38
+ for (const family of ordered) {
39
+ const entry = family.modes.find(
40
+ (candidate) => candidate.id.toLowerCase() === target
41
+ );
42
+ if (entry) return entry;
43
+ }
44
+ return void 0;
45
+ }
46
+ exports.SPEC_RUNTIME_MODES = SPEC_RUNTIME_MODES;
47
+ exports.familyForModel = familyForModel;
48
+ exports.isSpecRuntimeMode = isSpecRuntimeMode;
49
+ exports.modeOptionFor = modeOptionFor;
50
+ exports.runtimeModeFromModel = runtimeModeFromModel;
51
+ //# sourceMappingURL=runtime-family.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-family.cjs","sources":["../../src/lib/runtime-family.ts"],"sourcesContent":["type RuntimeModelIdentity = {\n id: string;\n provider: string;\n runtime?: { id?: string; model?: string } | undefined;\n};\n\ntype RuntimeFamilyIdentity = {\n id: string;\n provider: string;\n catalogPrefix?: string | undefined;\n modes: Array<{ id: string; provider?: string | undefined }>;\n};\n\nexport const SPEC_RUNTIME_MODES = [\"api\", \"agent\", \"cli\", \"cmux\"] as const;\nexport type SpecRuntimeMode = (typeof SPEC_RUNTIME_MODES)[number];\nconst RUNTIME_MODES = new Set<string>(SPEC_RUNTIME_MODES);\n\nexport function isSpecRuntimeMode(\n value: string | undefined,\n): value is SpecRuntimeMode {\n return RUNTIME_MODES.has(value ?? \"\");\n}\n\nexport function runtimeModeFromModel(\n model: string | undefined,\n): SpecRuntimeMode | undefined {\n const [prefix] = (model ?? \"\").trim().toLowerCase().split(\":\");\n return isSpecRuntimeMode(prefix) ? prefix : undefined;\n}\n\nexport function familyForModel<T extends RuntimeFamilyIdentity>(\n families: T[],\n models: RuntimeModelIdentity[],\n modelId: string | undefined,\n): T | undefined {\n if (!modelId) return undefined;\n const selected = models.find(\n (model) =>\n model.id === modelId ||\n model.runtime?.model === modelId ||\n model.runtime?.id === modelId,\n );\n const compact = modelId.split(\",\")[0]?.trim() ?? \"\";\n const [prefix, inlineModel] = compact.split(\":\");\n const canonicalModel =\n RUNTIME_MODES.has(prefix?.toLowerCase() ?? \"\") && inlineModel\n ? inlineModel\n : compact;\n const slash = canonicalModel.indexOf(\"/\");\n const provider =\n selected?.provider ??\n (slash > 0 ? canonicalModel.slice(0, slash) : undefined);\n if (!provider) return undefined;\n return families.find(\n (family) =>\n family.provider === provider ||\n family.catalogPrefix === provider ||\n family.modes.some((mode) => mode.provider === provider),\n );\n}\n\nexport function modeOptionFor<T extends RuntimeFamilyIdentity>(\n families: T[],\n mode: string | undefined,\n preferredFamily?: string | undefined,\n): T[\"modes\"][number] | undefined {\n const target = (mode ?? \"\").toLowerCase();\n if (!target) return undefined;\n const ordered = preferredFamily\n ? [\n ...families.filter((family) => family.id === preferredFamily),\n ...families.filter((family) => family.id !== preferredFamily),\n ]\n : families;\n for (const family of ordered) {\n const entry = family.modes.find(\n (candidate) => candidate.id.toLowerCase() === target,\n );\n if (entry) return entry;\n }\n return undefined;\n}\n"],"names":["_a"],"mappings":";;AAaO,MAAM,qBAAqB,CAAC,OAAO,SAAS,OAAO,MAAM;AAEhE,MAAM,gBAAgB,IAAI,IAAY,kBAAkB;AAEjD,SAAS,kBACd,OAC0B;AAC1B,SAAO,cAAc,IAAI,SAAS,EA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kB;AAAA,IAAA;AAEhD,QAAI,MAAO,QAAO;AAAA,EACpB;AACA,SAAO;AACT;;;;;;"}
@@ -0,0 +1,25 @@
1
+ type RuntimeModelIdentity = {
2
+ id: string;
3
+ provider: string;
4
+ runtime?: {
5
+ id?: string;
6
+ model?: string;
7
+ } | undefined;
8
+ };
9
+ type RuntimeFamilyIdentity = {
10
+ id: string;
11
+ provider: string;
12
+ catalogPrefix?: string | undefined;
13
+ modes: Array<{
14
+ id: string;
15
+ provider?: string | undefined;
16
+ }>;
17
+ };
18
+ export declare const SPEC_RUNTIME_MODES: readonly ["api", "agent", "cli", "cmux"];
19
+ export type SpecRuntimeMode = (typeof SPEC_RUNTIME_MODES)[number];
20
+ export declare function isSpecRuntimeMode(value: string | undefined): value is SpecRuntimeMode;
21
+ export declare function runtimeModeFromModel(model: string | undefined): SpecRuntimeMode | undefined;
22
+ export declare function familyForModel<T extends RuntimeFamilyIdentity>(families: T[], models: RuntimeModelIdentity[], modelId: string | undefined): T | undefined;
23
+ export declare function modeOptionFor<T extends RuntimeFamilyIdentity>(families: T[], mode: string | undefined, preferredFamily?: string | undefined): T["modes"][number] | undefined;
24
+ export {};
25
+ //# sourceMappingURL=runtime-family.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-family.d.ts","sourceRoot":"","sources":["../../src/lib/runtime-family.ts"],"names":[],"mappings":"AAAA,KAAK,oBAAoB,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CACvD,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,KAAK,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC,CAAC;CAC7D,CAAC;AAEF,eAAO,MAAM,kBAAkB,0CAA2C,CAAC;AAC3E,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAGlE,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,KAAK,IAAI,eAAe,CAE1B;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,eAAe,GAAG,SAAS,CAG7B;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,qBAAqB,EAC5D,QAAQ,EAAE,CAAC,EAAE,EACb,MAAM,EAAE,oBAAoB,EAAE,EAC9B,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,CAAC,GAAG,SAAS,CAyBf;AAED,wBAAgB,aAAa,CAAC,CAAC,SAAS,qBAAqB,EAC3D,QAAQ,EAAE,CAAC,EAAE,EACb,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,GACnC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS,CAgBhC"}
@@ -0,0 +1,51 @@
1
+ const SPEC_RUNTIME_MODES = ["api", "agent", "cli", "cmux"];
2
+ const RUNTIME_MODES = new Set(SPEC_RUNTIME_MODES);
3
+ function isSpecRuntimeMode(value) {
4
+ return RUNTIME_MODES.has(value ?? "");
5
+ }
6
+ function runtimeModeFromModel(model) {
7
+ const [prefix] = (model ?? "").trim().toLowerCase().split(":");
8
+ return isSpecRuntimeMode(prefix) ? prefix : void 0;
9
+ }
10
+ function familyForModel(families, models, modelId) {
11
+ var _a;
12
+ if (!modelId) return void 0;
13
+ const selected = models.find(
14
+ (model) => {
15
+ var _a2, _b;
16
+ return model.id === modelId || ((_a2 = model.runtime) == null ? void 0 : _a2.model) === modelId || ((_b = model.runtime) == null ? void 0 : _b.id) === modelId;
17
+ }
18
+ );
19
+ const compact = ((_a = modelId.split(",")[0]) == null ? void 0 : _a.trim()) ?? "";
20
+ const [prefix, inlineModel] = compact.split(":");
21
+ const canonicalModel = RUNTIME_MODES.has((prefix == null ? void 0 : prefix.toLowerCase()) ?? "") && inlineModel ? inlineModel : compact;
22
+ const slash = canonicalModel.indexOf("/");
23
+ const provider = (selected == null ? void 0 : selected.provider) ?? (slash > 0 ? canonicalModel.slice(0, slash) : void 0);
24
+ if (!provider) return void 0;
25
+ return families.find(
26
+ (family) => family.provider === provider || family.catalogPrefix === provider || family.modes.some((mode) => mode.provider === provider)
27
+ );
28
+ }
29
+ function modeOptionFor(families, mode, preferredFamily) {
30
+ const target = (mode ?? "").toLowerCase();
31
+ if (!target) return void 0;
32
+ const ordered = preferredFamily ? [
33
+ ...families.filter((family) => family.id === preferredFamily),
34
+ ...families.filter((family) => family.id !== preferredFamily)
35
+ ] : families;
36
+ for (const family of ordered) {
37
+ const entry = family.modes.find(
38
+ (candidate) => candidate.id.toLowerCase() === target
39
+ );
40
+ if (entry) return entry;
41
+ }
42
+ return void 0;
43
+ }
44
+ export {
45
+ SPEC_RUNTIME_MODES,
46
+ familyForModel,
47
+ isSpecRuntimeMode,
48
+ modeOptionFor,
49
+ runtimeModeFromModel
50
+ };
51
+ //# sourceMappingURL=runtime-family.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-family.js","sources":["../../src/lib/runtime-family.ts"],"sourcesContent":["type RuntimeModelIdentity = {\n id: string;\n provider: string;\n runtime?: { id?: string; model?: string } | undefined;\n};\n\ntype RuntimeFamilyIdentity = {\n id: string;\n provider: string;\n catalogPrefix?: string | undefined;\n modes: Array<{ id: string; provider?: string | undefined }>;\n};\n\nexport const SPEC_RUNTIME_MODES = [\"api\", \"agent\", \"cli\", \"cmux\"] as const;\nexport type SpecRuntimeMode = (typeof SPEC_RUNTIME_MODES)[number];\nconst RUNTIME_MODES = new Set<string>(SPEC_RUNTIME_MODES);\n\nexport function isSpecRuntimeMode(\n value: string | undefined,\n): value is SpecRuntimeMode {\n return RUNTIME_MODES.has(value ?? \"\");\n}\n\nexport function runtimeModeFromModel(\n model: string | undefined,\n): SpecRuntimeMode | undefined {\n const [prefix] = (model ?? \"\").trim().toLowerCase().split(\":\");\n return isSpecRuntimeMode(prefix) ? prefix : undefined;\n}\n\nexport function familyForModel<T extends RuntimeFamilyIdentity>(\n families: T[],\n models: RuntimeModelIdentity[],\n modelId: string | undefined,\n): T | undefined {\n if (!modelId) return undefined;\n const selected = models.find(\n (model) =>\n model.id === modelId ||\n model.runtime?.model === modelId ||\n model.runtime?.id === modelId,\n );\n const compact = modelId.split(\",\")[0]?.trim() ?? \"\";\n const [prefix, inlineModel] = compact.split(\":\");\n const canonicalModel =\n RUNTIME_MODES.has(prefix?.toLowerCase() ?? \"\") && inlineModel\n ? inlineModel\n : compact;\n const slash = canonicalModel.indexOf(\"/\");\n const provider =\n selected?.provider ??\n (slash > 0 ? canonicalModel.slice(0, slash) : undefined);\n if (!provider) return undefined;\n return families.find(\n (family) =>\n family.provider === provider ||\n family.catalogPrefix === provider ||\n family.modes.some((mode) => mode.provider === provider),\n );\n}\n\nexport function modeOptionFor<T extends RuntimeFamilyIdentity>(\n families: T[],\n mode: string | undefined,\n preferredFamily?: string | undefined,\n): T[\"modes\"][number] | undefined {\n const target = (mode ?? \"\").toLowerCase();\n if (!target) return undefined;\n const ordered = preferredFamily\n ? [\n ...families.filter((family) => family.id === preferredFamily),\n ...families.filter((family) => family.id !== preferredFamily),\n ]\n : families;\n for (const family of ordered) {\n const entry = family.modes.find(\n (candidate) => candidate.id.toLowerCase() === target,\n );\n if (entry) return entry;\n }\n return undefined;\n}\n"],"names":["_a"],"mappings":"AAaO,MAAM,qBAAqB,CAAC,OAAO,SAAS,OAAO,MAAM;AAEhE,MAAM,gBAAgB,IAAI,IAAY,kBAAkB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AAW,UAAU,SAAS;AAC5B,UAAM,QAAQ,OAAO,MAAM;AAAA,MACzB,CAAC,cAAc,UAAU,GAAG,kBAAkB;AAAA,IAAA;AAEhD,QAAI,MAAO,QAAO;AAAA,EACpB;AACA,SAAO;AACT;"}
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const collections = require("./collections.cjs");
4
+ const runtimeFamily = require("./runtime-family.cjs");
5
+ function reorderProfilePresets(profile, from, to) {
6
+ if (!profile.presets[from] || !profile.presets[to]) {
7
+ throw new Error(`cannot reorder preset from ${from} to ${to}`);
8
+ }
9
+ return { ...profile, presets: collections.moveItem(profile.presets, from, to) };
10
+ }
11
+ function presetForRef(ref, presets) {
12
+ const name = ref.trim().toLowerCase();
13
+ return presets.find((preset) => preset.id === ref) ?? presets.find((preset) => preset.name.trim().toLowerCase() === name);
14
+ }
15
+ function presetsOf(profile, presets) {
16
+ const found = [];
17
+ const missing = [];
18
+ for (const ref of profile.presets) {
19
+ const preset = presetForRef(ref, presets);
20
+ if (preset) found.push(preset);
21
+ else missing.push(ref);
22
+ }
23
+ return { found, missing };
24
+ }
25
+ function authoredRuntimeSpec(profile, presets) {
26
+ var _a, _b, _c, _d;
27
+ if (!profile) return {};
28
+ const runtime = {};
29
+ for (const preset of presetsOf(profile, presets).found) {
30
+ if ((_a = preset.spec.model) == null ? void 0 : _a.trim()) runtime.model = preset.spec.model;
31
+ if ((_b = preset.spec.mode) == null ? void 0 : _b.trim()) runtime.mode = preset.spec.mode;
32
+ }
33
+ if ((_c = profile.spec.model) == null ? void 0 : _c.trim()) runtime.model = profile.spec.model;
34
+ if ((_d = profile.spec.mode) == null ? void 0 : _d.trim()) runtime.mode = profile.spec.mode;
35
+ return runtime;
36
+ }
37
+ function referencedBy(preset, profiles) {
38
+ const name = preset.name.trim().toLowerCase();
39
+ return profiles.filter(
40
+ (profile) => profile.presets.some(
41
+ (ref) => ref === preset.id || ref.trim().toLowerCase() === name
42
+ )
43
+ ).map((profile) => profile.name);
44
+ }
45
+ function duplicateName(name, existing) {
46
+ return nextNewName(`${name.trim()} copy`, existing);
47
+ }
48
+ function nextNewName(base, existing) {
49
+ const occupied = new Set(existing.map((item) => item.trim().toLowerCase()));
50
+ if (!occupied.has(base.toLowerCase())) return base;
51
+ let index = 2;
52
+ while (occupied.has(`${base} ${index}`.toLowerCase())) index += 1;
53
+ return `${base} ${index}`;
54
+ }
55
+ function uniqueName(name, id, records) {
56
+ const normalized = name.trim().toLowerCase();
57
+ if (!normalized) return false;
58
+ return !records.some(
59
+ (record) => record.id !== id && record.name.trim().toLowerCase() === normalized
60
+ );
61
+ }
62
+ function permissionTarget(spec, families) {
63
+ var _a;
64
+ const model = spec == null ? void 0 : spec.model;
65
+ const mode = runtimeFamily.runtimeModeFromModel(model) || ((_a = spec == null ? void 0 : spec.mode) == null ? void 0 : _a.trim());
66
+ const family = runtimeFamily.familyForModel(families, [], model);
67
+ if (!family || !mode || !runtimeFamily.modeOptionFor(families, mode, family.id)) {
68
+ return void 0;
69
+ }
70
+ return { provider: family.provider, mode };
71
+ }
72
+ function newProfileRecord(profiles, id) {
73
+ const name = nextNewName(
74
+ "New profile",
75
+ profiles.map((item) => item.name)
76
+ );
77
+ return { id, name, spec: {}, presets: [] };
78
+ }
79
+ function newPresetRecord(presets, id) {
80
+ const name = nextNewName(
81
+ "New preset",
82
+ presets.map((item) => item.name)
83
+ );
84
+ return { id, name, scope: "surface", spec: {} };
85
+ }
86
+ function duplicateRecord(records, sourceId, id) {
87
+ const source = records.find((record) => record.id === sourceId);
88
+ if (!source) throw new Error(`cannot duplicate missing record "${sourceId}"`);
89
+ return {
90
+ ...structuredClone(source),
91
+ id,
92
+ name: duplicateName(
93
+ source.name,
94
+ records.map((record) => record.name)
95
+ )
96
+ };
97
+ }
98
+ function selectionAfterDelete(records, deletedId, selectedId) {
99
+ var _a;
100
+ if (selectedId !== deletedId) return selectedId;
101
+ return (_a = records.find((record) => record.id !== deletedId)) == null ? void 0 : _a.id;
102
+ }
103
+ function mergeRuntimeSpec(base, overlay) {
104
+ return mergeRecords(base, overlay);
105
+ }
106
+ function mergeRecords(base, overlay) {
107
+ const merged = structuredClone(base);
108
+ for (const [key, value] of Object.entries(overlay)) {
109
+ if (value === void 0) continue;
110
+ const current = merged[key];
111
+ merged[key] = collections.isPlainObject(current) && collections.isPlainObject(value) ? mergeRecords(current, value) : structuredClone(value);
112
+ }
113
+ return merged;
114
+ }
115
+ exports.authoredRuntimeSpec = authoredRuntimeSpec;
116
+ exports.duplicateName = duplicateName;
117
+ exports.duplicateRecord = duplicateRecord;
118
+ exports.mergeRuntimeSpec = mergeRuntimeSpec;
119
+ exports.newPresetRecord = newPresetRecord;
120
+ exports.newProfileRecord = newProfileRecord;
121
+ exports.nextNewName = nextNewName;
122
+ exports.permissionTarget = permissionTarget;
123
+ exports.presetForRef = presetForRef;
124
+ exports.presetsOf = presetsOf;
125
+ exports.referencedBy = referencedBy;
126
+ exports.reorderProfilePresets = reorderProfilePresets;
127
+ exports.selectionAfterDelete = selectionAfterDelete;
128
+ exports.uniqueName = uniqueName;
129
+ //# sourceMappingURL=runtime-profile-model.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-profile-model.cjs","sources":["../../src/lib/runtime-profile-model.ts"],"sourcesContent":["import { isPlainObject, moveItem } from \"./collections\";\nimport {\n type SpecRuntimeFamily,\n} from \"../data/runtime/runtime-mode\";\nimport {\n familyForModel,\n modeOptionFor,\n runtimeModeFromModel,\n} from \"./runtime-family\";\nimport type { RuntimePreset, RuntimeProfile } from \"../data/ai/runtime-profile\";\nimport type { AISpecRuntimeSpec } from \"../data/ai/SpecRuntimeEditor.model\";\nimport type { RuntimePermissionTarget } from \"../data/ai/runtime-profiles/types\";\n\nexport function reorderProfilePresets(\n profile: RuntimeProfile,\n from: number,\n to: number,\n): RuntimeProfile {\n if (!profile.presets[from] || !profile.presets[to]) {\n throw new Error(`cannot reorder preset from ${from} to ${to}`);\n }\n return { ...profile, presets: moveItem(profile.presets, from, to) };\n}\n\nexport function presetForRef(\n ref: string,\n presets: RuntimePreset[],\n): RuntimePreset | undefined {\n const name = ref.trim().toLowerCase();\n return (\n presets.find((preset) => preset.id === ref) ??\n presets.find((preset) => preset.name.trim().toLowerCase() === name)\n );\n}\n\nexport function presetsOf(\n profile: Pick<RuntimeProfile, \"presets\">,\n presets: RuntimePreset[],\n): { found: RuntimePreset[]; missing: string[] } {\n const found: RuntimePreset[] = [];\n const missing: string[] = [];\n for (const ref of profile.presets) {\n const preset = presetForRef(ref, presets);\n if (preset) found.push(preset);\n else missing.push(ref);\n }\n return { found, missing };\n}\n\nexport function authoredRuntimeSpec(\n profile: RuntimeProfile | undefined,\n presets: RuntimePreset[],\n): Pick<AISpecRuntimeSpec, \"model\" | \"mode\"> {\n if (!profile) return {};\n const runtime: Pick<AISpecRuntimeSpec, \"model\" | \"mode\"> = {};\n for (const preset of presetsOf(profile, presets).found) {\n if (preset.spec.model?.trim()) runtime.model = preset.spec.model;\n if (preset.spec.mode?.trim()) runtime.mode = preset.spec.mode;\n }\n if (profile.spec.model?.trim()) runtime.model = profile.spec.model;\n if (profile.spec.mode?.trim()) runtime.mode = profile.spec.mode;\n return runtime;\n}\n\nexport function referencedBy(\n preset: Pick<RuntimePreset, \"id\" | \"name\">,\n profiles: RuntimeProfile[],\n): string[] {\n const name = preset.name.trim().toLowerCase();\n return profiles\n .filter((profile) =>\n profile.presets.some(\n (ref) => ref === preset.id || ref.trim().toLowerCase() === name,\n ),\n )\n .map((profile) => profile.name);\n}\n\nexport function duplicateName(name: string, existing: string[]): string {\n return nextNewName(`${name.trim()} copy`, existing);\n}\n\nexport function nextNewName(base: string, existing: string[]): string {\n const occupied = new Set(existing.map((item) => item.trim().toLowerCase()));\n if (!occupied.has(base.toLowerCase())) return base;\n let index = 2;\n while (occupied.has(`${base} ${index}`.toLowerCase())) index += 1;\n return `${base} ${index}`;\n}\n\nexport function uniqueName(\n name: string,\n id: string,\n records: Array<{ id: string; name: string }>,\n) {\n const normalized = name.trim().toLowerCase();\n if (!normalized) return false;\n return !records.some(\n (record) =>\n record.id !== id && record.name.trim().toLowerCase() === normalized,\n );\n}\n\nexport function permissionTarget(\n spec: AISpecRuntimeSpec | undefined,\n families: SpecRuntimeFamily[],\n): RuntimePermissionTarget | undefined {\n const model = spec?.model;\n const mode = runtimeModeFromModel(model) || spec?.mode?.trim();\n const family = familyForModel(families, [], model);\n if (!family || !mode || !modeOptionFor(families, mode, family.id)) {\n return undefined;\n }\n return { provider: family.provider, mode };\n}\n\nexport function newProfileRecord(\n profiles: RuntimeProfile[],\n id: string,\n): RuntimeProfile {\n const name = nextNewName(\n \"New profile\",\n profiles.map((item) => item.name),\n );\n return { id, name, spec: {}, presets: [] };\n}\n\nexport function newPresetRecord(\n presets: RuntimePreset[],\n id: string,\n): RuntimePreset {\n const name = nextNewName(\n \"New preset\",\n presets.map((item) => item.name),\n );\n return { id, name, scope: \"surface\", spec: {} };\n}\n\nexport function duplicateRecord<T extends { id: string; name: string }>(\n records: T[],\n sourceId: string,\n id: string,\n): T {\n const source = records.find((record) => record.id === sourceId);\n if (!source) throw new Error(`cannot duplicate missing record \"${sourceId}\"`);\n return {\n ...structuredClone(source),\n id,\n name: duplicateName(\n source.name,\n records.map((record) => record.name),\n ),\n };\n}\n\nexport function selectionAfterDelete(\n records: Array<{ id: string }>,\n deletedId: string,\n selectedId: string | undefined,\n): string | undefined {\n if (selectedId !== deletedId) return selectedId;\n return records.find((record) => record.id !== deletedId)?.id;\n}\n\nexport function mergeRuntimeSpec<T extends AISpecRuntimeSpec>(\n base: AISpecRuntimeSpec,\n overlay: T,\n): T {\n return mergeRecords(base, overlay) as T;\n}\n\nfunction mergeRecords(\n base: Record<string, unknown>,\n overlay: Record<string, unknown>,\n): Record<string, unknown> {\n const merged: Record<string, unknown> = structuredClone(base);\n for (const [key, value] of Object.entries(overlay)) {\n if (value === undefined) continue;\n const current = merged[key];\n merged[key] =\n isPlainObject(current) && isPlainObject(value)\n ? mergeRecords(current, value)\n : structuredClone(value);\n }\n return merged;\n}\n"],"names":["moveItem","runtimeModeFromModel","familyForModel","modeOptionFor","isPlainObject"],"mappings":";;;;AAaO,SAAS,sBACd,SACA,MACA,IACgB;AAChB,MAAI,CAAC,QAAQ,QAAQ,IAAI,KAAK,CAAC,QAAQ,QAAQ,EAAE,GAAG;AAClD,UAAM,IAAI,MAAM,8BAA8B,IAAI,OAAO,EAAE,EAAE;AAAA,EAC/D;AACA,SAAO,EAAE,GAAG,SAAS,SAASA,YAAAA,SAAS,QAAQ,SAAS,MAAM,EAAE,EAAA;AAClE;AAEO,SAAS,aACd,KACA,SAC2B;AAC3B,QAAM,OAAO,IAAI,KAAA,EAAO,YAAA;AACxB,SACE,QAAQ,KAAK,CAAC,WAAW,OAAO,OAAO,GAAG,KAC1C,QAAQ,KAAK,CAAC,WAAW,OAAO,KAAK,OAAO,YAAA,MAAkB,IAAI;AAEtE;AAEO,SAAS,UACd,SACA,SAC+C;AAC/C,QAAM,QAAyB,CAAA;AAC/B,QAAM,UAAoB,CAAA;AAC1B,aAAW,OAAO,QAAQ,SAAS;AACjC,UAAM,SAAS,aAAa,KAAK,OAAO;AACxC,QAAI,OAAQ,OAAM,KAAK,MAAM;AAAA,QACxB,SAAQ,KAAK,GAAG;AAAA,EACvB;AACA,SAAO,EAAE,OAAO,QAAA;AAClB;AAEO,SAAS,oBACd,SACA,SAC2C;;AAC3C,MAAI,CAAC,QAAS,QAAO,CAAA;AACrB,QAAM,UAAqD,CAAA;AAC3D,aAAW,UAAU,UAAU,SAAS,OAAO,EAAE,OAAO;AACtD,SAAI,YAAO,KAAK,UAAZ,mBAAmB,OAAQ,SAAQ,QAAQ,OAAO,KAAK;AAC3D,SAAI,YAAO,KAAK,SAAZ,mBAAkB,OAAQ,SAAQ,OAAO,OAAO,KAAK;AAAA,EAC3D;AACA,OAAI,aAAQ,KAAK,UAAb,mBAAoB,OAAQ,SAAQ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cAAc,KAAK,IACzC,aAAa,SAAS,KAAK,IAC3B,gBAAgB,KAAK;AAAA,EAC7B;AACA,SAAO;AACT;;;;;;;;;;;;;;;"}
@@ -0,0 +1,30 @@
1
+ import { SpecRuntimeFamily } from '../data/runtime/runtime-mode';
2
+ import { RuntimePreset, RuntimeProfile } from '../data/ai/runtime-profile';
3
+ import { AISpecRuntimeSpec } from '../data/ai/SpecRuntimeEditor.model';
4
+ import { RuntimePermissionTarget } from '../data/ai/runtime-profiles/types';
5
+ export declare function reorderProfilePresets(profile: RuntimeProfile, from: number, to: number): RuntimeProfile;
6
+ export declare function presetForRef(ref: string, presets: RuntimePreset[]): RuntimePreset | undefined;
7
+ export declare function presetsOf(profile: Pick<RuntimeProfile, "presets">, presets: RuntimePreset[]): {
8
+ found: RuntimePreset[];
9
+ missing: string[];
10
+ };
11
+ export declare function authoredRuntimeSpec(profile: RuntimeProfile | undefined, presets: RuntimePreset[]): Pick<AISpecRuntimeSpec, "model" | "mode">;
12
+ export declare function referencedBy(preset: Pick<RuntimePreset, "id" | "name">, profiles: RuntimeProfile[]): string[];
13
+ export declare function duplicateName(name: string, existing: string[]): string;
14
+ export declare function nextNewName(base: string, existing: string[]): string;
15
+ export declare function uniqueName(name: string, id: string, records: Array<{
16
+ id: string;
17
+ name: string;
18
+ }>): boolean;
19
+ export declare function permissionTarget(spec: AISpecRuntimeSpec | undefined, families: SpecRuntimeFamily[]): RuntimePermissionTarget | undefined;
20
+ export declare function newProfileRecord(profiles: RuntimeProfile[], id: string): RuntimeProfile;
21
+ export declare function newPresetRecord(presets: RuntimePreset[], id: string): RuntimePreset;
22
+ export declare function duplicateRecord<T extends {
23
+ id: string;
24
+ name: string;
25
+ }>(records: T[], sourceId: string, id: string): T;
26
+ export declare function selectionAfterDelete(records: Array<{
27
+ id: string;
28
+ }>, deletedId: string, selectedId: string | undefined): string | undefined;
29
+ export declare function mergeRuntimeSpec<T extends AISpecRuntimeSpec>(base: AISpecRuntimeSpec, overlay: T): T;
30
+ //# sourceMappingURL=runtime-profile-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-profile-model.d.ts","sourceRoot":"","sources":["../../src/lib/runtime-profile-model.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,iBAAiB,EACvB,MAAM,8BAA8B,CAAC;AAMtC,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAEjF,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,cAAc,CAKhB;AAED,wBAAgB,YAAY,CAC1B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,aAAa,EAAE,GACvB,aAAa,GAAG,SAAS,CAM3B;AAED,wBAAgB,SAAS,CACvB,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,EACxC,OAAO,EAAE,aAAa,EAAE,GACvB;IAAE,KAAK,EAAE,aAAa,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAS/C;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,cAAc,GAAG,SAAS,EACnC,OAAO,EAAE,aAAa,EAAE,GACvB,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,MAAM,CAAC,CAU3C;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,GAAG,MAAM,CAAC,EAC1C,QAAQ,EAAE,cAAc,EAAE,GACzB,MAAM,EAAE,CASV;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAEtE;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAMpE;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,WAQ7C;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,iBAAiB,GAAG,SAAS,EACnC,QAAQ,EAAE,iBAAiB,EAAE,GAC5B,uBAAuB,GAAG,SAAS,CAQrC;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,cAAc,EAAE,EAC1B,EAAE,EAAE,MAAM,GACT,cAAc,CAMhB;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,aAAa,EAAE,EACxB,EAAE,EAAE,MAAM,GACT,aAAa,CAMf;AAED,wBAAgB,eAAe,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACpE,OAAO,EAAE,CAAC,EAAE,EACZ,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,GACT,CAAC,CAWH;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,EAC9B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,MAAM,GAAG,SAAS,CAGpB;AAED,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,iBAAiB,EAC1D,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,CAAC,GACT,CAAC,CAEH"}
@@ -0,0 +1,129 @@
1
+ import { moveItem, isPlainObject } from "./collections.js";
2
+ import { runtimeModeFromModel, familyForModel, modeOptionFor } from "./runtime-family.js";
3
+ function reorderProfilePresets(profile, from, to) {
4
+ if (!profile.presets[from] || !profile.presets[to]) {
5
+ throw new Error(`cannot reorder preset from ${from} to ${to}`);
6
+ }
7
+ return { ...profile, presets: moveItem(profile.presets, from, to) };
8
+ }
9
+ function presetForRef(ref, presets) {
10
+ const name = ref.trim().toLowerCase();
11
+ return presets.find((preset) => preset.id === ref) ?? presets.find((preset) => preset.name.trim().toLowerCase() === name);
12
+ }
13
+ function presetsOf(profile, presets) {
14
+ const found = [];
15
+ const missing = [];
16
+ for (const ref of profile.presets) {
17
+ const preset = presetForRef(ref, presets);
18
+ if (preset) found.push(preset);
19
+ else missing.push(ref);
20
+ }
21
+ return { found, missing };
22
+ }
23
+ function authoredRuntimeSpec(profile, presets) {
24
+ var _a, _b, _c, _d;
25
+ if (!profile) return {};
26
+ const runtime = {};
27
+ for (const preset of presetsOf(profile, presets).found) {
28
+ if ((_a = preset.spec.model) == null ? void 0 : _a.trim()) runtime.model = preset.spec.model;
29
+ if ((_b = preset.spec.mode) == null ? void 0 : _b.trim()) runtime.mode = preset.spec.mode;
30
+ }
31
+ if ((_c = profile.spec.model) == null ? void 0 : _c.trim()) runtime.model = profile.spec.model;
32
+ if ((_d = profile.spec.mode) == null ? void 0 : _d.trim()) runtime.mode = profile.spec.mode;
33
+ return runtime;
34
+ }
35
+ function referencedBy(preset, profiles) {
36
+ const name = preset.name.trim().toLowerCase();
37
+ return profiles.filter(
38
+ (profile) => profile.presets.some(
39
+ (ref) => ref === preset.id || ref.trim().toLowerCase() === name
40
+ )
41
+ ).map((profile) => profile.name);
42
+ }
43
+ function duplicateName(name, existing) {
44
+ return nextNewName(`${name.trim()} copy`, existing);
45
+ }
46
+ function nextNewName(base, existing) {
47
+ const occupied = new Set(existing.map((item) => item.trim().toLowerCase()));
48
+ if (!occupied.has(base.toLowerCase())) return base;
49
+ let index = 2;
50
+ while (occupied.has(`${base} ${index}`.toLowerCase())) index += 1;
51
+ return `${base} ${index}`;
52
+ }
53
+ function uniqueName(name, id, records) {
54
+ const normalized = name.trim().toLowerCase();
55
+ if (!normalized) return false;
56
+ return !records.some(
57
+ (record) => record.id !== id && record.name.trim().toLowerCase() === normalized
58
+ );
59
+ }
60
+ function permissionTarget(spec, families) {
61
+ var _a;
62
+ const model = spec == null ? void 0 : spec.model;
63
+ const mode = runtimeModeFromModel(model) || ((_a = spec == null ? void 0 : spec.mode) == null ? void 0 : _a.trim());
64
+ const family = familyForModel(families, [], model);
65
+ if (!family || !mode || !modeOptionFor(families, mode, family.id)) {
66
+ return void 0;
67
+ }
68
+ return { provider: family.provider, mode };
69
+ }
70
+ function newProfileRecord(profiles, id) {
71
+ const name = nextNewName(
72
+ "New profile",
73
+ profiles.map((item) => item.name)
74
+ );
75
+ return { id, name, spec: {}, presets: [] };
76
+ }
77
+ function newPresetRecord(presets, id) {
78
+ const name = nextNewName(
79
+ "New preset",
80
+ presets.map((item) => item.name)
81
+ );
82
+ return { id, name, scope: "surface", spec: {} };
83
+ }
84
+ function duplicateRecord(records, sourceId, id) {
85
+ const source = records.find((record) => record.id === sourceId);
86
+ if (!source) throw new Error(`cannot duplicate missing record "${sourceId}"`);
87
+ return {
88
+ ...structuredClone(source),
89
+ id,
90
+ name: duplicateName(
91
+ source.name,
92
+ records.map((record) => record.name)
93
+ )
94
+ };
95
+ }
96
+ function selectionAfterDelete(records, deletedId, selectedId) {
97
+ var _a;
98
+ if (selectedId !== deletedId) return selectedId;
99
+ return (_a = records.find((record) => record.id !== deletedId)) == null ? void 0 : _a.id;
100
+ }
101
+ function mergeRuntimeSpec(base, overlay) {
102
+ return mergeRecords(base, overlay);
103
+ }
104
+ function mergeRecords(base, overlay) {
105
+ const merged = structuredClone(base);
106
+ for (const [key, value] of Object.entries(overlay)) {
107
+ if (value === void 0) continue;
108
+ const current = merged[key];
109
+ merged[key] = isPlainObject(current) && isPlainObject(value) ? mergeRecords(current, value) : structuredClone(value);
110
+ }
111
+ return merged;
112
+ }
113
+ export {
114
+ authoredRuntimeSpec,
115
+ duplicateName,
116
+ duplicateRecord,
117
+ mergeRuntimeSpec,
118
+ newPresetRecord,
119
+ newProfileRecord,
120
+ nextNewName,
121
+ permissionTarget,
122
+ presetForRef,
123
+ presetsOf,
124
+ referencedBy,
125
+ reorderProfilePresets,
126
+ selectionAfterDelete,
127
+ uniqueName
128
+ };
129
+ //# sourceMappingURL=runtime-profile-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-profile-model.js","sources":["../../src/lib/runtime-profile-model.ts"],"sourcesContent":["import { isPlainObject, moveItem } from \"./collections\";\nimport {\n type SpecRuntimeFamily,\n} from \"../data/runtime/runtime-mode\";\nimport {\n familyForModel,\n modeOptionFor,\n runtimeModeFromModel,\n} from \"./runtime-family\";\nimport type { RuntimePreset, RuntimeProfile } from \"../data/ai/runtime-profile\";\nimport type { AISpecRuntimeSpec } from \"../data/ai/SpecRuntimeEditor.model\";\nimport type { RuntimePermissionTarget } from \"../data/ai/runtime-profiles/types\";\n\nexport function reorderProfilePresets(\n profile: RuntimeProfile,\n from: number,\n to: number,\n): RuntimeProfile {\n if (!profile.presets[from] || !profile.presets[to]) {\n throw new Error(`cannot reorder preset from ${from} to ${to}`);\n }\n return { ...profile, presets: moveItem(profile.presets, from, to) };\n}\n\nexport function presetForRef(\n ref: string,\n presets: RuntimePreset[],\n): RuntimePreset | undefined {\n const name = ref.trim().toLowerCase();\n return (\n presets.find((preset) => preset.id === ref) ??\n presets.find((preset) => preset.name.trim().toLowerCase() === name)\n );\n}\n\nexport function presetsOf(\n profile: Pick<RuntimeProfile, \"presets\">,\n presets: RuntimePreset[],\n): { found: RuntimePreset[]; missing: string[] } {\n const found: RuntimePreset[] = [];\n const missing: string[] = [];\n for (const ref of profile.presets) {\n const preset = presetForRef(ref, presets);\n if (preset) found.push(preset);\n else missing.push(ref);\n }\n return { found, missing };\n}\n\nexport function authoredRuntimeSpec(\n profile: RuntimeProfile | undefined,\n presets: RuntimePreset[],\n): Pick<AISpecRuntimeSpec, \"model\" | \"mode\"> {\n if (!profile) return {};\n const runtime: Pick<AISpecRuntimeSpec, \"model\" | \"mode\"> = {};\n for (const preset of presetsOf(profile, presets).found) {\n if (preset.spec.model?.trim()) runtime.model = preset.spec.model;\n if (preset.spec.mode?.trim()) runtime.mode = preset.spec.mode;\n }\n if (profile.spec.model?.trim()) runtime.model = profile.spec.model;\n if (profile.spec.mode?.trim()) runtime.mode = profile.spec.mode;\n return runtime;\n}\n\nexport function referencedBy(\n preset: Pick<RuntimePreset, \"id\" | \"name\">,\n profiles: RuntimeProfile[],\n): string[] {\n const name = preset.name.trim().toLowerCase();\n return profiles\n .filter((profile) =>\n profile.presets.some(\n (ref) => ref === preset.id || ref.trim().toLowerCase() === name,\n ),\n )\n .map((profile) => profile.name);\n}\n\nexport function duplicateName(name: string, existing: string[]): string {\n return nextNewName(`${name.trim()} copy`, existing);\n}\n\nexport function nextNewName(base: string, existing: string[]): string {\n const occupied = new Set(existing.map((item) => item.trim().toLowerCase()));\n if (!occupied.has(base.toLowerCase())) return base;\n let index = 2;\n while (occupied.has(`${base} ${index}`.toLowerCase())) index += 1;\n return `${base} ${index}`;\n}\n\nexport function uniqueName(\n name: string,\n id: string,\n records: Array<{ id: string; name: string }>,\n) {\n const normalized = name.trim().toLowerCase();\n if (!normalized) return false;\n return !records.some(\n (record) =>\n record.id !== id && record.name.trim().toLowerCase() === normalized,\n );\n}\n\nexport function permissionTarget(\n spec: AISpecRuntimeSpec | undefined,\n families: SpecRuntimeFamily[],\n): RuntimePermissionTarget | undefined {\n const model = spec?.model;\n const mode = runtimeModeFromModel(model) || spec?.mode?.trim();\n const family = familyForModel(families, [], model);\n if (!family || !mode || !modeOptionFor(families, mode, family.id)) {\n return undefined;\n }\n return { provider: family.provider, mode };\n}\n\nexport function newProfileRecord(\n profiles: RuntimeProfile[],\n id: string,\n): RuntimeProfile {\n const name = nextNewName(\n \"New profile\",\n profiles.map((item) => item.name),\n );\n return { id, name, spec: {}, presets: [] };\n}\n\nexport function newPresetRecord(\n presets: RuntimePreset[],\n id: string,\n): RuntimePreset {\n const name = nextNewName(\n \"New preset\",\n presets.map((item) => item.name),\n );\n return { id, name, scope: \"surface\", spec: {} };\n}\n\nexport function duplicateRecord<T extends { id: string; name: string }>(\n records: T[],\n sourceId: string,\n id: string,\n): T {\n const source = records.find((record) => record.id === sourceId);\n if (!source) throw new Error(`cannot duplicate missing record \"${sourceId}\"`);\n return {\n ...structuredClone(source),\n id,\n name: duplicateName(\n source.name,\n records.map((record) => record.name),\n ),\n };\n}\n\nexport function selectionAfterDelete(\n records: Array<{ id: string }>,\n deletedId: string,\n selectedId: string | undefined,\n): string | undefined {\n if (selectedId !== deletedId) return selectedId;\n return records.find((record) => record.id !== deletedId)?.id;\n}\n\nexport function mergeRuntimeSpec<T extends AISpecRuntimeSpec>(\n base: AISpecRuntimeSpec,\n overlay: T,\n): T {\n return mergeRecords(base, overlay) as T;\n}\n\nfunction mergeRecords(\n base: Record<string, unknown>,\n overlay: Record<string, unknown>,\n): Record<string, unknown> {\n const merged: Record<string, unknown> = structuredClone(base);\n for (const [key, value] of Object.entries(overlay)) {\n if (value === undefined) continue;\n const current = merged[key];\n merged[key] =\n isPlainObject(current) && isPlainObject(value)\n ? mergeRecords(current, value)\n : structuredClone(value);\n }\n return merged;\n}\n"],"names":[],"mappings":";;AAaO,SAAS,sBACd,SACA,MACA,IACgB;AAChB,MAAI,CAAC,QAAQ,QAAQ,IAAI,KAAK,CAAC,QAAQ,QAAQ,EAAE,GAAG;AAClD,UAAM,IAAI,MAAM,8BAA8B,IAAI,OAAO,EAAE,EAAE;AAAA,EAC/D;AACA,SAAO,EAAE,GAAG,SAAS,SAAS,SAAS,QAAQ,SAAS,MAAM,EAAE,EAAA;AAClE;AAEO,SAAS,aACd,KACA,SAC2B;AAC3B,QAAM,OAAO,IAAI,KAAA,EAAO,YAAA;AACxB,SACE,QAAQ,KAAK,CAAC,WAAW,OAAO,OAAO,GAAG,KAC1C,QAAQ,KAAK,CAAC,WAAW,OAAO,KAAK,OAAO,YAAA,MAAkB,IAAI;AAEtE;AAEO,SAAS,UACd,SACA,S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