@hotmeshio/long-tail 0.23.1 → 0.24.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 (562) hide show
  1. package/build/adapters/express.d.ts +9 -1
  2. package/build/adapters/express.js +32 -41
  3. package/build/api/auth-sso.d.ts +1 -1
  4. package/build/api/bot-accounts.d.ts +2 -0
  5. package/build/api/bot-accounts.js +4 -0
  6. package/build/api/capabilities.d.ts +7 -2
  7. package/build/api/capabilities.js +13 -2
  8. package/build/api/escalations/analytics.js +5 -0
  9. package/build/api/escalations/bulk.d.ts +2 -0
  10. package/build/api/escalations/bulk.js +9 -4
  11. package/build/api/escalations/helpers.d.ts +5 -0
  12. package/build/api/escalations/helpers.js +7 -0
  13. package/build/api/escalations/index.d.ts +1 -0
  14. package/build/api/escalations/index.js +4 -1
  15. package/build/api/escalations/list.d.ts +5 -0
  16. package/build/api/escalations/list.js +19 -5
  17. package/build/api/escalations/metadata.js +3 -0
  18. package/build/api/escalations/related.d.ts +18 -0
  19. package/build/api/escalations/related.js +205 -0
  20. package/build/api/escalations/single.d.ts +3 -2
  21. package/build/api/escalations/single.js +8 -3
  22. package/build/api/mcp/tools.d.ts +12 -0
  23. package/build/api/mcp/tools.js +113 -9
  24. package/build/api/roles.js +4 -0
  25. package/build/api/scan-codes/choice.js +31 -7
  26. package/build/api/scan-codes/present.js +5 -1
  27. package/build/api/settings.d.ts +1 -1
  28. package/build/api/settings.js +12 -1
  29. package/build/api/tasks.d.ts +3 -3
  30. package/build/api/tasks.js +30 -7
  31. package/build/api/workflows/input-lookups.js +1 -1
  32. package/build/api/workflows/invocable.js +2 -2
  33. package/build/api/workflows/invocation.js +1 -1
  34. package/build/api/yaml-workflows/deploy.d.ts +10 -2
  35. package/build/api/yaml-workflows/deploy.js +42 -2
  36. package/build/lib/db/schemas/038_oauth_server.sql +46 -0
  37. package/build/lib/events/browser-view.d.ts +15 -0
  38. package/build/lib/events/browser-view.js +101 -0
  39. package/build/lib/events/nats-ws-filter.d.ts +29 -0
  40. package/build/lib/events/nats-ws-filter.js +94 -0
  41. package/build/lib/events/nats-ws-proxy.d.ts +2 -0
  42. package/build/lib/events/nats-ws-proxy.js +39 -5
  43. package/build/lib/events/nats-ws-server-filter.d.ts +16 -0
  44. package/build/lib/events/nats-ws-server-filter.js +56 -0
  45. package/build/lib/events/nats-ws-ticket.d.ts +10 -0
  46. package/build/lib/events/nats-ws-ticket.js +42 -0
  47. package/build/lib/events/socketio.d.ts +10 -1
  48. package/build/lib/events/socketio.js +10 -3
  49. package/build/lib/http/index.d.ts +27 -0
  50. package/build/lib/http/index.js +55 -0
  51. package/build/modules/auth.d.ts +15 -24
  52. package/build/modules/auth.js +43 -126
  53. package/build/modules/capabilities.d.ts +62 -0
  54. package/build/modules/capabilities.js +188 -0
  55. package/build/modules/config.d.ts +14 -0
  56. package/build/modules/config.js +20 -0
  57. package/build/modules/defaults.d.ts +10 -0
  58. package/build/modules/defaults.js +12 -1
  59. package/build/modules/display.d.ts +15 -0
  60. package/build/modules/display.js +27 -0
  61. package/build/modules/mcp-auth.d.ts +11 -0
  62. package/build/modules/mcp-auth.js +56 -0
  63. package/build/modules/oauth-server.d.ts +18 -0
  64. package/build/modules/oauth-server.js +40 -0
  65. package/build/routes/agents.js +46 -14
  66. package/build/routes/announcements.js +2 -2
  67. package/build/routes/auth-sso.js +2 -2
  68. package/build/routes/auth.js +2 -2
  69. package/build/routes/bot-accounts.js +26 -3
  70. package/build/routes/capabilities.js +4 -4
  71. package/build/routes/controlplane.js +2 -2
  72. package/build/routes/dba.js +2 -2
  73. package/build/routes/delegation.js +2 -2
  74. package/build/routes/diagnostics.js +2 -2
  75. package/build/routes/docs.js +2 -2
  76. package/build/routes/domain.js +2 -2
  77. package/build/routes/escalations/accumulate.d.ts +1 -1
  78. package/build/routes/escalations/acting.d.ts +1 -1
  79. package/build/routes/escalations/analytics.d.ts +1 -1
  80. package/build/routes/escalations/bulk.d.ts +1 -1
  81. package/build/routes/escalations/facets.d.ts +1 -1
  82. package/build/routes/escalations/index.js +5 -2
  83. package/build/routes/escalations/list.d.ts +1 -1
  84. package/build/routes/escalations/list.js +2 -0
  85. package/build/routes/escalations/metadata.d.ts +1 -1
  86. package/build/routes/escalations/related.d.ts +7 -0
  87. package/build/routes/escalations/related.js +60 -0
  88. package/build/routes/escalations/resolve.d.ts +1 -1
  89. package/build/routes/escalations/single.d.ts +1 -1
  90. package/build/routes/escalations/single.js +1 -1
  91. package/build/routes/exports.js +14 -13
  92. package/build/routes/file-browser.js +9 -8
  93. package/build/routes/files.js +2 -2
  94. package/build/routes/index.js +4 -2
  95. package/build/routes/insight.js +5 -4
  96. package/build/routes/knowledge.js +2 -2
  97. package/build/routes/maintenance.js +2 -2
  98. package/build/routes/mcp-endpoint.d.ts +3 -1
  99. package/build/routes/mcp-endpoint.js +18 -8
  100. package/build/routes/mcp.js +35 -15
  101. package/build/routes/me.js +2 -2
  102. package/build/routes/namespaces.js +4 -3
  103. package/build/routes/nats-credentials.js +27 -3
  104. package/build/routes/oauth-server/authorize.d.ts +2 -0
  105. package/build/routes/oauth-server/authorize.js +108 -0
  106. package/build/routes/oauth-server/grants.d.ts +2 -0
  107. package/build/routes/oauth-server/grants.js +35 -0
  108. package/build/routes/oauth-server/index.d.ts +8 -0
  109. package/build/routes/oauth-server/index.js +52 -0
  110. package/build/routes/oauth-server/registration.d.ts +2 -0
  111. package/build/routes/oauth-server/registration.js +38 -0
  112. package/build/routes/oauth-server/token.d.ts +2 -0
  113. package/build/routes/oauth-server/token.js +100 -0
  114. package/build/routes/oauth-well-known.d.ts +8 -0
  115. package/build/routes/oauth-well-known.js +31 -0
  116. package/build/routes/oauth.js +2 -2
  117. package/build/routes/overview.js +2 -2
  118. package/build/routes/personas.js +2 -2
  119. package/build/routes/pipelines.js +6 -5
  120. package/build/routes/roles.js +2 -2
  121. package/build/routes/scan-codes.js +2 -2
  122. package/build/routes/settings.js +2 -2
  123. package/build/routes/tasks.js +5 -5
  124. package/build/routes/topics.js +21 -9
  125. package/build/routes/users.js +25 -22
  126. package/build/routes/workflow-sets.js +13 -12
  127. package/build/routes/workflows/config.js +15 -2
  128. package/build/routes/workflows/discovery.js +2 -2
  129. package/build/routes/workflows/index.js +2 -2
  130. package/build/routes/workflows/invocation.js +11 -10
  131. package/build/routes/yaml-workflows/cron.js +19 -6
  132. package/build/routes/yaml-workflows/crud.js +13 -12
  133. package/build/routes/yaml-workflows/deployment.js +11 -10
  134. package/build/routes/yaml-workflows/index.js +2 -2
  135. package/build/routes/yaml-workflows/versions.js +2 -2
  136. package/build/scripts/consolidation-sim.d.ts +25 -0
  137. package/build/scripts/consolidation-sim.js +141 -0
  138. package/build/sdk/index.d.ts +12 -0
  139. package/build/sdk/index.js +2 -0
  140. package/build/services/agent/authority.d.ts +14 -0
  141. package/build/services/agent/authority.js +53 -0
  142. package/build/services/auth/bot-api-key.d.ts +2 -0
  143. package/build/services/auth/bot-api-key.js +10 -0
  144. package/build/services/auth/oauth-server/access-token.d.ts +36 -0
  145. package/build/services/auth/oauth-server/access-token.js +80 -0
  146. package/build/services/auth/oauth-server/authorization.d.ts +47 -0
  147. package/build/services/auth/oauth-server/authorization.js +54 -0
  148. package/build/services/auth/oauth-server/constants.d.ts +11 -0
  149. package/build/services/auth/oauth-server/constants.js +16 -0
  150. package/build/services/auth/oauth-server/index.d.ts +3 -0
  151. package/build/services/auth/oauth-server/index.js +26 -0
  152. package/build/services/auth/oauth-server/metadata.d.ts +21 -0
  153. package/build/services/auth/oauth-server/metadata.js +53 -0
  154. package/build/services/auth/oauth-server/registration.d.ts +42 -0
  155. package/build/services/auth/oauth-server/registration.js +134 -0
  156. package/build/services/auth/oauth-server/sql.d.ts +34 -0
  157. package/build/services/auth/oauth-server/sql.js +123 -0
  158. package/build/services/auth/oauth-server/store.d.ts +74 -0
  159. package/build/services/auth/oauth-server/store.js +151 -0
  160. package/build/services/auth/sql.d.ts +1 -0
  161. package/build/services/auth/sql.js +3 -1
  162. package/build/services/escalation/grouped-list.d.ts +19 -0
  163. package/build/services/escalation/grouped-list.js +54 -0
  164. package/build/services/escalation/index.d.ts +4 -0
  165. package/build/services/escalation/index.js +9 -1
  166. package/build/services/escalation/queries.d.ts +17 -13
  167. package/build/services/escalation/queries.js +38 -42
  168. package/build/services/escalation/read-scope-sql.d.ts +13 -0
  169. package/build/services/escalation/read-scope-sql.js +19 -0
  170. package/build/services/escalation/related.d.ts +58 -0
  171. package/build/services/escalation/related.js +196 -0
  172. package/build/services/export/index.d.ts +10 -0
  173. package/build/services/export/index.js +27 -0
  174. package/build/services/invocation-access.d.ts +25 -4
  175. package/build/services/invocation-access.js +39 -7
  176. package/build/services/mcp/client/connection-dispatch.d.ts +6 -1
  177. package/build/services/mcp/client/connection-dispatch.js +3 -2
  178. package/build/services/mcp/client/connection-lifecycle.d.ts +10 -2
  179. package/build/services/mcp/client/connection-lifecycle.js +45 -7
  180. package/build/services/mcp/client/connection-test.js +2 -6
  181. package/build/services/mcp/client/connection.d.ts +1 -1
  182. package/build/services/mcp/client/connection.js +3 -1
  183. package/build/services/mcp/client/index.d.ts +2 -2
  184. package/build/services/mcp/client/index.js +4 -1
  185. package/build/services/mcp/client/network-transport.d.ts +12 -0
  186. package/build/services/mcp/client/network-transport.js +20 -0
  187. package/build/services/mcp/client/tools.d.ts +13 -0
  188. package/build/services/mcp/client/tools.js +18 -0
  189. package/build/services/mcp/db-server/index.js +2 -1
  190. package/build/services/mcp/external-server.d.ts +9 -4
  191. package/build/services/mcp/external-server.js +34 -11
  192. package/build/services/mcp/playwright-server/index.js +2 -1
  193. package/build/services/mcp/registered-tools.d.ts +3 -0
  194. package/build/services/mcp/registered-tools.js +7 -0
  195. package/build/services/mcp/server-lifecycle.js +2 -1
  196. package/build/services/role/index.js +6 -0
  197. package/build/services/role/seed.js +4 -0
  198. package/build/services/scan-code/validate-facts.d.ts +1 -1
  199. package/build/services/scan-code/validate-facts.js +12 -1
  200. package/build/services/workflow-invocation.d.ts +16 -3
  201. package/build/services/workflow-invocation.js +42 -10
  202. package/build/services/yaml-workflow/deployer.d.ts +10 -2
  203. package/build/services/yaml-workflow/deployer.js +17 -5
  204. package/build/services/yaml-workflow/invoke.js +27 -26
  205. package/build/shared/form-validation/x-lt-scan.d.ts +8 -0
  206. package/build/shared/form-validation/x-lt-scan.js +20 -1
  207. package/build/shared/list-schema/index.d.ts +3 -0
  208. package/build/shared/list-schema/index.js +27 -0
  209. package/build/shared/list-schema/template.d.ts +14 -0
  210. package/build/shared/list-schema/template.js +85 -0
  211. package/build/shared/list-schema/types.d.ts +154 -0
  212. package/build/shared/list-schema/types.js +55 -0
  213. package/build/shared/list-schema/validate.d.ts +12 -0
  214. package/build/shared/list-schema/validate.js +204 -0
  215. package/build/shared/roles/segment.d.ts +22 -0
  216. package/build/shared/roles/segment.js +42 -0
  217. package/build/start/adapters.js +2 -0
  218. package/build/start/config.js +7 -0
  219. package/build/start/index.js +4 -22
  220. package/build/start/server.d.ts +6 -4
  221. package/build/start/server.js +11 -35
  222. package/build/start/socket-auth.js +2 -1
  223. package/build/start/workers.js +1 -1
  224. package/build/system/mcp-servers/admin/agent-subscriptions.js +24 -1
  225. package/build/system/mcp-servers/admin/agents.js +25 -2
  226. package/build/system/mcp-servers/admin/announcements.js +3 -2
  227. package/build/system/mcp-servers/admin/bot-accounts.js +37 -5
  228. package/build/system/mcp-servers/admin/escalations.d.ts +3 -5
  229. package/build/system/mcp-servers/admin/escalations.js +74 -70
  230. package/build/system/mcp-servers/admin/exports.js +7 -1
  231. package/build/system/mcp-servers/admin/index.js +24 -25
  232. package/build/system/mcp-servers/admin/overview.d.ts +2 -2
  233. package/build/system/mcp-servers/admin/run-read.d.ts +2 -0
  234. package/build/system/mcp-servers/admin/run-read.js +5 -0
  235. package/build/system/mcp-servers/admin/scan-codes.d.ts +2 -2
  236. package/build/system/mcp-servers/admin/scan-codes.js +5 -11
  237. package/build/system/mcp-servers/admin/schemas.d.ts +20 -20
  238. package/build/system/mcp-servers/admin/tasks.js +7 -2
  239. package/build/system/mcp-servers/admin/users.js +39 -4
  240. package/build/system/mcp-servers/admin/workflow-config.js +12 -1
  241. package/build/system/mcp-servers/admin/workflows.js +27 -5
  242. package/build/system/mcp-servers/admin/yaml-workflows.js +7 -1
  243. package/build/system/mcp-servers/caller-auth.d.ts +18 -0
  244. package/build/system/mcp-servers/caller-auth.js +29 -0
  245. package/build/system/mcp-servers/claude-code.js +2 -1
  246. package/build/system/mcp-servers/db-query/index.js +2 -1
  247. package/build/system/mcp-servers/file-storage.js +2 -1
  248. package/build/system/mcp-servers/http-fetch.js +2 -1
  249. package/build/system/mcp-servers/human-queue.js +7 -3
  250. package/build/system/mcp-servers/oauth.js +31 -4
  251. package/build/system/mcp-servers/schema-exchange.js +2 -1
  252. package/build/system/mcp-servers/vision.d.ts +1 -0
  253. package/build/system/mcp-servers/vision.js +17 -7
  254. package/build/system/seed/tool-manifests-admin.d.ts +2 -17985
  255. package/build/system/seed/tool-manifests-admin.js +121 -121
  256. package/build/system/seed/tool-manifests-data.d.ts +8 -374
  257. package/build/system/seed/tool-manifests-data.js +22 -4
  258. package/build/system/seed/tool-manifests-escalation.d.ts +2 -352
  259. package/build/system/seed/tool-manifests-escalation.js +11 -1
  260. package/build/system/seed/tool-manifests-events.d.ts +2 -116
  261. package/build/system/seed/tool-manifests-events.js +6 -2
  262. package/build/system/seed/tool-manifests-knowledge.d.ts +2 -221
  263. package/build/system/seed/tool-manifests-knowledge.js +41 -1
  264. package/build/system/seed/tool-manifests-workflows.d.ts +2 -71
  265. package/build/system/seed/tool-manifests-workflows.js +3 -1
  266. package/build/system/workflows/shared/principal-tools.d.ts +20 -0
  267. package/build/system/workflows/shared/principal-tools.js +64 -0
  268. package/build/system/workflows/shared/tool-executor.js +21 -11
  269. package/build/system/workflows/shared/tool-loader.js +8 -1
  270. package/build/tsconfig.tsbuildinfo +1 -1
  271. package/build/types/auth.d.ts +1 -1
  272. package/build/types/capability.d.ts +14 -0
  273. package/build/types/capability.js +2 -0
  274. package/build/types/events.d.ts +1 -1
  275. package/build/types/index.d.ts +5 -3
  276. package/build/types/index.js +2 -1
  277. package/build/types/mcp.d.ts +3 -1
  278. package/build/types/oauth-server.d.ts +52 -0
  279. package/build/types/oauth-server.js +2 -0
  280. package/build/types/scan-code/constants.d.ts +7 -0
  281. package/build/types/scan-code/constants.js +7 -1
  282. package/build/types/scan-code/response.d.ts +3 -2
  283. package/build/types/scan-code/rule.d.ts +6 -1
  284. package/build/types/startup.d.ts +23 -7
  285. package/build/vitest.config.js +2 -1
  286. package/build/vitest.fast.config.d.ts +2 -0
  287. package/build/vitest.fast.config.js +20 -0
  288. package/build/vitest.llm.config.d.ts +2 -0
  289. package/build/vitest.llm.config.js +16 -0
  290. package/dashboard/dist/assets/{AdminDashboard-DKrqLGjn.js → AdminDashboard-B3mkMIOT.js} +2 -2
  291. package/dashboard/dist/assets/{AdminDashboard-DKrqLGjn.js.map → AdminDashboard-B3mkMIOT.js.map} +1 -1
  292. package/dashboard/dist/assets/{AgentConfigPage-BoQhRW6U.js → AgentConfigPage-CQj2B678.js} +2 -2
  293. package/dashboard/dist/assets/{AgentConfigPage-BoQhRW6U.js.map → AgentConfigPage-CQj2B678.js.map} +1 -1
  294. package/dashboard/dist/assets/{AgentDetailPage-DZhzuZmO.js → AgentDetailPage-CzrD8JJI.js} +3 -3
  295. package/dashboard/dist/assets/{AgentDetailPage-DZhzuZmO.js.map → AgentDetailPage-CzrD8JJI.js.map} +1 -1
  296. package/dashboard/dist/assets/{AgentsPage-5MynmbWX.js → AgentsPage-jg2OFwyW.js} +2 -2
  297. package/dashboard/dist/assets/{AgentsPage-5MynmbWX.js.map → AgentsPage-jg2OFwyW.js.map} +1 -1
  298. package/dashboard/dist/assets/AvailableEscalationsPage-IS28XBRe.js +2 -0
  299. package/dashboard/dist/assets/AvailableEscalationsPage-IS28XBRe.js.map +1 -0
  300. package/dashboard/dist/assets/{BotPicker-C3LR6Sqy.js → BotPicker-DvEJFpwS.js} +2 -2
  301. package/dashboard/dist/assets/{BotPicker-C3LR6Sqy.js.map → BotPicker-DvEJFpwS.js.map} +1 -1
  302. package/dashboard/dist/assets/{BulkAssignModal-COjoOIIH.js → BulkAssignModal-BoQCi-YC.js} +2 -2
  303. package/dashboard/dist/assets/{BulkAssignModal-COjoOIIH.js.map → BulkAssignModal-BoQCi-YC.js.map} +1 -1
  304. package/dashboard/dist/assets/CapabilitiesPage-kwlrcb_t.js +2 -0
  305. package/dashboard/dist/assets/{CapabilitiesPage-DKxLvOfB.js.map → CapabilitiesPage-kwlrcb_t.js.map} +1 -1
  306. package/dashboard/dist/assets/{CollapsibleSection-Cz5sRx-r.js → CollapsibleSection-UMIV4KIj.js} +2 -2
  307. package/dashboard/dist/assets/{CollapsibleSection-Cz5sRx-r.js.map → CollapsibleSection-UMIV4KIj.js.map} +1 -1
  308. package/dashboard/dist/assets/ConfirmDeleteModal-C5puwMg7.js +2 -0
  309. package/dashboard/dist/assets/ConfirmDeleteModal-C5puwMg7.js.map +1 -0
  310. package/dashboard/dist/assets/ConnectedAppsPage-drZa65kP.js +2 -0
  311. package/dashboard/dist/assets/ConnectedAppsPage-drZa65kP.js.map +1 -0
  312. package/dashboard/dist/assets/CountdownTimer-LG03dVgR.js +2 -0
  313. package/dashboard/dist/assets/CountdownTimer-LG03dVgR.js.map +1 -0
  314. package/dashboard/dist/assets/{CredentialsPage-DhiHiPsG.js → CredentialsPage-CaFQ6vLb.js} +2 -2
  315. package/dashboard/dist/assets/{CredentialsPage-DhiHiPsG.js.map → CredentialsPage-CaFQ6vLb.js.map} +1 -1
  316. package/dashboard/dist/assets/{CronLabel-C9SkawB-.js → CronLabel-Co5j7tzW.js} +2 -2
  317. package/dashboard/dist/assets/{CronLabel-C9SkawB-.js.map → CronLabel-Co5j7tzW.js.map} +1 -1
  318. package/dashboard/dist/assets/DataTable-FjFhx0SE.js +2 -0
  319. package/dashboard/dist/assets/DataTable-FjFhx0SE.js.map +1 -0
  320. package/dashboard/dist/assets/{ElapsedCell-BeK1SUDK.js → ElapsedCell-WJyE9G0T.js} +2 -2
  321. package/dashboard/dist/assets/{ElapsedCell-BeK1SUDK.js.map → ElapsedCell-WJyE9G0T.js.map} +1 -1
  322. package/dashboard/dist/assets/{EntityTimelinePanel-BThdefKj.js → EntityTimelinePanel-CDFFfX9d.js} +2 -2
  323. package/dashboard/dist/assets/{EntityTimelinePanel-BThdefKj.js.map → EntityTimelinePanel-CDFFfX9d.js.map} +1 -1
  324. package/dashboard/dist/assets/{EscalationListSchemaPage-DlDIYb-p.js → EscalationListSchemaPage-CMrUlaKI.js} +3 -3
  325. package/dashboard/dist/assets/{EscalationListSchemaPage-DlDIYb-p.js.map → EscalationListSchemaPage-CMrUlaKI.js.map} +1 -1
  326. package/dashboard/dist/assets/{EscalationSchemaPage-CQt-Embr.js → EscalationSchemaPage-Dx2Lyfrz.js} +3 -3
  327. package/dashboard/dist/assets/{EscalationSchemaPage-CQt-Embr.js.map → EscalationSchemaPage-Dx2Lyfrz.js.map} +1 -1
  328. package/dashboard/dist/assets/EscalationTimeline-d3nvshOk.js +2 -0
  329. package/dashboard/dist/assets/EscalationTimeline-d3nvshOk.js.map +1 -0
  330. package/dashboard/dist/assets/{EscalationTitleSelect-Dewrv8wX.js → EscalationTitleSelect-DWQieOM9.js} +2 -2
  331. package/dashboard/dist/assets/{EscalationTitleSelect-Dewrv8wX.js.map → EscalationTitleSelect-DWQieOM9.js.map} +1 -1
  332. package/dashboard/dist/assets/{EscalationsOverview-BzH-Y-5x.js → EscalationsOverview-BX8Cpi0X.js} +2 -2
  333. package/dashboard/dist/assets/{EscalationsOverview-BzH-Y-5x.js.map → EscalationsOverview-BX8Cpi0X.js.map} +1 -1
  334. package/dashboard/dist/assets/{EventTable-C97m6IZv.js → EventTable-D1-ITVXS.js} +2 -2
  335. package/dashboard/dist/assets/{EventTable-C97m6IZv.js.map → EventTable-D1-ITVXS.js.map} +1 -1
  336. package/dashboard/dist/assets/{FilterBar-D-6xVHIw.js → FilterBar-ABC9ctin.js} +2 -2
  337. package/dashboard/dist/assets/{FilterBar-D-6xVHIw.js.map → FilterBar-ABC9ctin.js.map} +1 -1
  338. package/dashboard/dist/assets/FormattedValue-k27T4bG7.js +2 -0
  339. package/dashboard/dist/assets/FormattedValue-k27T4bG7.js.map +1 -0
  340. package/dashboard/dist/assets/{GraphInvokePage-Bwi8EF9Y.js → GraphInvokePage-DKUErxWc.js} +2 -2
  341. package/dashboard/dist/assets/{GraphInvokePage-Bwi8EF9Y.js.map → GraphInvokePage-DKUErxWc.js.map} +1 -1
  342. package/dashboard/dist/assets/{HomePage-Z_Q03C0z.js → HomePage-C6u9dIpR.js} +2 -2
  343. package/dashboard/dist/assets/{HomePage-Z_Q03C0z.js.map → HomePage-C6u9dIpR.js.map} +1 -1
  344. package/dashboard/dist/assets/{ListToolbar-_jWTw5no.js → ListToolbar-gA5rFzkz.js} +2 -2
  345. package/dashboard/dist/assets/{ListToolbar-_jWTw5no.js.map → ListToolbar-gA5rFzkz.js.map} +1 -1
  346. package/dashboard/dist/assets/{McpOverview-CjqTuP0N.js → McpOverview-BOPo3J_i.js} +2 -2
  347. package/dashboard/dist/assets/{McpOverview-CjqTuP0N.js.map → McpOverview-BOPo3J_i.js.map} +1 -1
  348. package/dashboard/dist/assets/{McpQueryDetailPage-leCsje1U.js → McpQueryDetailPage-BRVVi0Zh.js} +2 -2
  349. package/dashboard/dist/assets/{McpQueryDetailPage-leCsje1U.js.map → McpQueryDetailPage-BRVVi0Zh.js.map} +1 -1
  350. package/dashboard/dist/assets/{McpQueryPage-C-PyXYX4.js → McpQueryPage-Dmbb6SAc.js} +2 -2
  351. package/dashboard/dist/assets/{McpQueryPage-C-PyXYX4.js.map → McpQueryPage-Dmbb6SAc.js.map} +1 -1
  352. package/dashboard/dist/assets/{McpRunDetailPage-JDrr3uUQ.js → McpRunDetailPage-bMXNO-6V.js} +2 -2
  353. package/dashboard/dist/assets/{McpRunDetailPage-JDrr3uUQ.js.map → McpRunDetailPage-bMXNO-6V.js.map} +1 -1
  354. package/dashboard/dist/assets/{McpRunsPage-DERXQLgZ.js → McpRunsPage-Bi9AMWja.js} +2 -2
  355. package/dashboard/dist/assets/{McpRunsPage-DERXQLgZ.js.map → McpRunsPage-Bi9AMWja.js.map} +1 -1
  356. package/dashboard/dist/assets/{OperationsPage-B2DA7n9m.js → OperationsPage-CvR74ZUJ.js} +3 -3
  357. package/dashboard/dist/assets/OperationsPage-CvR74ZUJ.js.map +1 -0
  358. package/dashboard/dist/assets/OperatorDashboard-DctmZw10.js +2 -0
  359. package/dashboard/dist/assets/OperatorDashboard-DctmZw10.js.map +1 -0
  360. package/dashboard/dist/assets/{PersonaDetailPage-ChXwJ6u5.js → PersonaDetailPage-Ubqm2rQH.js} +2 -2
  361. package/dashboard/dist/assets/{PersonaDetailPage-ChXwJ6u5.js.map → PersonaDetailPage-Ubqm2rQH.js.map} +1 -1
  362. package/dashboard/dist/assets/{PersonasPage-BFFxncSE.js → PersonasPage-BpFL2rpo.js} +2 -2
  363. package/dashboard/dist/assets/{PersonasPage-BFFxncSE.js.map → PersonasPage-BpFL2rpo.js.map} +1 -1
  364. package/dashboard/dist/assets/PortalPage-Dfc_Q02R.js +2 -0
  365. package/dashboard/dist/assets/PortalPage-Dfc_Q02R.js.map +1 -0
  366. package/dashboard/dist/assets/ProcessDetailPage-liJspvQh.js +2 -0
  367. package/dashboard/dist/assets/{ProcessDetailPage-D7EYwW-j.js.map → ProcessDetailPage-liJspvQh.js.map} +1 -1
  368. package/dashboard/dist/assets/{ProcessesListPage-CakYRtnE.js → ProcessesListPage-C3OM5ZUy.js} +2 -2
  369. package/dashboard/dist/assets/{ProcessesListPage-CakYRtnE.js.map → ProcessesListPage-C3OM5ZUy.js.map} +1 -1
  370. package/dashboard/dist/assets/ResolverForm-B1_x8Blv.js +8 -0
  371. package/dashboard/dist/assets/ResolverForm-B1_x8Blv.js.map +1 -0
  372. package/dashboard/dist/assets/{RoleDetailPage-CKbGwezP.js → RoleDetailPage-CrlYCh-R.js} +2 -2
  373. package/dashboard/dist/assets/{RoleDetailPage-CKbGwezP.js.map → RoleDetailPage-CrlYCh-R.js.map} +1 -1
  374. package/dashboard/dist/assets/{RolesPage-Czu7Zku4.js → RolesPage-BaazL_pt.js} +2 -2
  375. package/dashboard/dist/assets/{RolesPage-Czu7Zku4.js.map → RolesPage-BaazL_pt.js.map} +1 -1
  376. package/dashboard/dist/assets/{RunAsSelector-6BLScYTX.js → RunAsSelector-DxuV0fa1.js} +2 -2
  377. package/dashboard/dist/assets/{RunAsSelector-6BLScYTX.js.map → RunAsSelector-DxuV0fa1.js.map} +1 -1
  378. package/dashboard/dist/assets/{ScanCodesPage-Cv9q8Bvt.js → ScanCodesPage-C0mvmYTq.js} +2 -2
  379. package/dashboard/dist/assets/{ScanCodesPage-Cv9q8Bvt.js.map → ScanCodesPage-C0mvmYTq.js.map} +1 -1
  380. package/dashboard/dist/assets/{ScanSchemeDetailPage-BxazXYIc.js → ScanSchemeDetailPage-CiJgt5dZ.js} +2 -2
  381. package/dashboard/dist/assets/{ScanSchemeDetailPage-BxazXYIc.js.map → ScanSchemeDetailPage-CiJgt5dZ.js.map} +1 -1
  382. package/dashboard/dist/assets/ScanStationPage-DzGaXc40.js +2 -0
  383. package/dashboard/dist/assets/ScanStationPage-DzGaXc40.js.map +1 -0
  384. package/dashboard/dist/assets/{StickyPagination-DsdtYoXR.js → StickyPagination-CqbjVY6T.js} +2 -2
  385. package/dashboard/dist/assets/{StickyPagination-DsdtYoXR.js.map → StickyPagination-CqbjVY6T.js.map} +1 -1
  386. package/dashboard/dist/assets/{StreamMessageDetail-CT3FQoT3.js → StreamMessageDetail-wX3i0aqs.js} +2 -2
  387. package/dashboard/dist/assets/{StreamMessageDetail-CT3FQoT3.js.map → StreamMessageDetail-wX3i0aqs.js.map} +1 -1
  388. package/dashboard/dist/assets/{SwimlaneTimeline-C8TjkJ10.js → SwimlaneTimeline-C50PsFoV.js} +2 -2
  389. package/dashboard/dist/assets/{SwimlaneTimeline-C8TjkJ10.js.map → SwimlaneTimeline-C50PsFoV.js.map} +1 -1
  390. package/dashboard/dist/assets/{TaskDetailPage-DGUzdBFN.js → TaskDetailPage-bbNSv4Ae.js} +2 -2
  391. package/dashboard/dist/assets/{TaskDetailPage-DGUzdBFN.js.map → TaskDetailPage-bbNSv4Ae.js.map} +1 -1
  392. package/dashboard/dist/assets/{TasksListPage-BVIP6-EZ.js → TasksListPage-CDWnm_d9.js} +2 -2
  393. package/dashboard/dist/assets/{TasksListPage-BVIP6-EZ.js.map → TasksListPage-CDWnm_d9.js.map} +1 -1
  394. package/dashboard/dist/assets/{TimeAgo-C-rd9F9g.js → TimeAgo-BLjqlfoX.js} +2 -2
  395. package/dashboard/dist/assets/{TimeAgo-C-rd9F9g.js.map → TimeAgo-BLjqlfoX.js.map} +1 -1
  396. package/dashboard/dist/assets/{TimestampCell-DPbchDOI.js → TimestampCell-CnW0ENb5.js} +2 -2
  397. package/dashboard/dist/assets/{TimestampCell-DPbchDOI.js.map → TimestampCell-CnW0ENb5.js.map} +1 -1
  398. package/dashboard/dist/assets/{ToolTestPanel-DAUC8DHK.js → ToolTestPanel-DkMgCB-k.js} +2 -2
  399. package/dashboard/dist/assets/{ToolTestPanel-DAUC8DHK.js.map → ToolTestPanel-DkMgCB-k.js.map} +1 -1
  400. package/dashboard/dist/assets/{TopicDetailPage-70mMKBzG.js → TopicDetailPage-g3pljKKX.js} +2 -2
  401. package/dashboard/dist/assets/{TopicDetailPage-70mMKBzG.js.map → TopicDetailPage-g3pljKKX.js.map} +1 -1
  402. package/dashboard/dist/assets/{TopicsPage-CE3hBthn.js → TopicsPage-CVcCYdy-.js} +2 -2
  403. package/dashboard/dist/assets/{TopicsPage-CE3hBthn.js.map → TopicsPage-CVcCYdy-.js.map} +1 -1
  404. package/dashboard/dist/assets/{UserName-BDBDA-LR.js → UserName-D6zGIK2i.js} +2 -2
  405. package/dashboard/dist/assets/{UserName-BDBDA-LR.js.map → UserName-D6zGIK2i.js.map} +1 -1
  406. package/dashboard/dist/assets/{WorkflowExecutionPage-BbkLZ1co.js → WorkflowExecutionPage-B8g81FCJ.js} +2 -2
  407. package/dashboard/dist/assets/{WorkflowExecutionPage-BbkLZ1co.js.map → WorkflowExecutionPage-B8g81FCJ.js.map} +1 -1
  408. package/dashboard/dist/assets/{WorkflowsDashboard-Bp1L7Ggz.js → WorkflowsDashboard-nxT3bv6W.js} +2 -2
  409. package/dashboard/dist/assets/{WorkflowsDashboard-Bp1L7Ggz.js.map → WorkflowsDashboard-nxT3bv6W.js.map} +1 -1
  410. package/dashboard/dist/assets/{WorkflowsOverview-IeTKHAi4.js → WorkflowsOverview-grI-KAI2.js} +2 -2
  411. package/dashboard/dist/assets/{WorkflowsOverview-IeTKHAi4.js.map → WorkflowsOverview-grI-KAI2.js.map} +1 -1
  412. package/dashboard/dist/assets/{YamlWorkflowDetailPage-DtKCXnKt.js → YamlWorkflowDetailPage-BoZ-hfBE.js} +2 -2
  413. package/dashboard/dist/assets/{YamlWorkflowDetailPage-DtKCXnKt.js.map → YamlWorkflowDetailPage-BoZ-hfBE.js.map} +1 -1
  414. package/dashboard/dist/assets/{YamlWorkflowsPage-CEcZBV_3.js → YamlWorkflowsPage-Bf04rwRv.js} +2 -2
  415. package/dashboard/dist/assets/{YamlWorkflowsPage-CEcZBV_3.js.map → YamlWorkflowsPage-Bf04rwRv.js.map} +1 -1
  416. package/dashboard/dist/assets/{agents-BT-sEk81.js → agents-Dphpdi8l.js} +2 -2
  417. package/dashboard/dist/assets/{agents-BT-sEk81.js.map → agents-Dphpdi8l.js.map} +1 -1
  418. package/dashboard/dist/assets/{bots-DRoAdLek.js → bots-DIFE298x.js} +2 -2
  419. package/dashboard/dist/assets/{bots-DRoAdLek.js.map → bots-DIFE298x.js.map} +1 -1
  420. package/dashboard/dist/assets/{capabilities-Bc-nJk6y.js → capabilities-D7Y7LClY.js} +2 -2
  421. package/dashboard/dist/assets/{capabilities-Bc-nJk6y.js.map → capabilities-D7Y7LClY.js.map} +1 -1
  422. package/dashboard/dist/assets/{controlplane-aXceSIRf.js → controlplane-D1TGcYsS.js} +2 -2
  423. package/dashboard/dist/assets/{controlplane-aXceSIRf.js.map → controlplane-D1TGcYsS.js.map} +1 -1
  424. package/dashboard/dist/assets/escalation-columns-cwZE6xyo.js +2 -0
  425. package/dashboard/dist/assets/escalation-columns-cwZE6xyo.js.map +1 -0
  426. package/dashboard/dist/assets/{index-CuBGGwXf.js → index-BzYcUPdD.js} +2 -2
  427. package/dashboard/dist/assets/{index-CuBGGwXf.js.map → index-BzYcUPdD.js.map} +1 -1
  428. package/dashboard/dist/assets/index-CeCtqujG.js +67 -0
  429. package/dashboard/dist/assets/index-CeCtqujG.js.map +1 -0
  430. package/dashboard/dist/assets/{index-h2gX31B2.js → index-ChV7pBjM.js} +2 -2
  431. package/dashboard/dist/assets/{index-h2gX31B2.js.map → index-ChV7pBjM.js.map} +1 -1
  432. package/dashboard/dist/assets/index-CniRa65p.js +3 -0
  433. package/dashboard/dist/assets/index-CniRa65p.js.map +1 -0
  434. package/dashboard/dist/assets/index-CxdjT1Yk.js +2 -0
  435. package/dashboard/dist/assets/{index-BCFEQEMC.js.map → index-CxdjT1Yk.js.map} +1 -1
  436. package/dashboard/dist/assets/{index-CZyO9hRb.js → index-DAvi5_2T.js} +2 -2
  437. package/dashboard/dist/assets/{index-CZyO9hRb.js.map → index-DAvi5_2T.js.map} +1 -1
  438. package/dashboard/dist/assets/{index-Djsoi8DI.js → index-DN-kX7hL.js} +2 -2
  439. package/dashboard/dist/assets/{index-Djsoi8DI.js.map → index-DN-kX7hL.js.map} +1 -1
  440. package/dashboard/dist/assets/index-Dl_8hbYI.js +2 -0
  441. package/dashboard/dist/assets/index-Dl_8hbYI.js.map +1 -0
  442. package/dashboard/dist/assets/{index-DBxpyIw5.js → index-DpKOr311.js} +2 -2
  443. package/dashboard/dist/assets/{index-DBxpyIw5.js.map → index-DpKOr311.js.map} +1 -1
  444. package/dashboard/dist/assets/{index-Ba-s5Yb5.js → index-Dy1wWu2e.js} +2 -2
  445. package/dashboard/dist/assets/{index-Ba-s5Yb5.js.map → index-Dy1wWu2e.js.map} +1 -1
  446. package/dashboard/dist/assets/{index-DH03y-UT.js → index-HLu98Sqh.js} +2 -2
  447. package/dashboard/dist/assets/{index-DH03y-UT.js.map → index-HLu98Sqh.js.map} +1 -1
  448. package/dashboard/dist/assets/{index-C3VTJcrp.js → index-ag2pCAPu.js} +2 -2
  449. package/dashboard/dist/assets/{index-C3VTJcrp.js.map → index-ag2pCAPu.js.map} +1 -1
  450. package/dashboard/dist/assets/index-gkxPN7Vx.js +13 -0
  451. package/dashboard/dist/assets/{index-BEPKAjna.js.map → index-gkxPN7Vx.js.map} +1 -1
  452. package/dashboard/dist/assets/index-m9A3UYst.css +1 -0
  453. package/dashboard/dist/assets/{knowledge-BhW8V-Hq.js → knowledge-DnMs-SOJ.js} +2 -2
  454. package/dashboard/dist/assets/{knowledge-BhW8V-Hq.js.map → knowledge-DnMs-SOJ.js.map} +1 -1
  455. package/dashboard/dist/assets/{mcp-BYfSMQzh.js → mcp-CwW-K3r4.js} +2 -2
  456. package/dashboard/dist/assets/{mcp-BYfSMQzh.js.map → mcp-CwW-K3r4.js.map} +1 -1
  457. package/dashboard/dist/assets/{mcp-query-DUJoOk_q.js → mcp-query-BZt5e8_Q.js} +2 -2
  458. package/dashboard/dist/assets/{mcp-query-DUJoOk_q.js.map → mcp-query-BZt5e8_Q.js.map} +1 -1
  459. package/dashboard/dist/assets/{personas-jT1O_SB4.js → personas-UA-Xn60f.js} +2 -2
  460. package/dashboard/dist/assets/{personas-jT1O_SB4.js.map → personas-UA-Xn60f.js.map} +1 -1
  461. package/dashboard/dist/assets/{pipelines-Bp-wIaz2.js → pipelines-Cu3PARum.js} +2 -2
  462. package/dashboard/dist/assets/{pipelines-Bp-wIaz2.js.map → pipelines-Cu3PARum.js.map} +1 -1
  463. package/dashboard/dist/assets/{tasks-CCrvnXbz.js → tasks-BO6h8GJE.js} +2 -2
  464. package/dashboard/dist/assets/{tasks-CCrvnXbz.js.map → tasks-BO6h8GJE.js.map} +1 -1
  465. package/dashboard/dist/assets/{topics-Blft0I1L.js → topics-CWjCR-17.js} +2 -2
  466. package/dashboard/dist/assets/{topics-Blft0I1L.js.map → topics-CWjCR-17.js.map} +1 -1
  467. package/dashboard/dist/assets/{useDebouncedValue-BYqbcism.js → useDebouncedValue-6t0jx1RB.js} +2 -2
  468. package/dashboard/dist/assets/{useDebouncedValue-BYqbcism.js.map → useDebouncedValue-6t0jx1RB.js.map} +1 -1
  469. package/dashboard/dist/assets/{useNamespace-BfxJAUgG.js → useNamespace-CqpoQx6D.js} +2 -2
  470. package/dashboard/dist/assets/{useNamespace-BfxJAUgG.js.map → useNamespace-CqpoQx6D.js.map} +1 -1
  471. package/dashboard/dist/assets/{useYamlActivityEvents-BukJuWpb.js → useYamlActivityEvents-hmCQQwzB.js} +2 -2
  472. package/dashboard/dist/assets/{useYamlActivityEvents-BukJuWpb.js.map → useYamlActivityEvents-hmCQQwzB.js.map} +1 -1
  473. package/dashboard/dist/assets/validate-BIRn4a6d.js +2 -0
  474. package/dashboard/dist/assets/validate-BIRn4a6d.js.map +1 -0
  475. package/dashboard/dist/assets/{yaml-workflows-DeRWqMGk.js → yaml-workflows-ziUdZhKY.js} +2 -2
  476. package/dashboard/dist/assets/{yaml-workflows-DeRWqMGk.js.map → yaml-workflows-ziUdZhKY.js.map} +1 -1
  477. package/dashboard/dist/index.html +2 -2
  478. package/docs/agents.md +3 -1
  479. package/docs/api/http/agents.md +15 -1
  480. package/docs/api/http/escalations.md +49 -3
  481. package/docs/api/http/exports.md +3 -1
  482. package/docs/api/http/file-browser.md +3 -1
  483. package/docs/api/http/mcp-endpoint.md +5 -2
  484. package/docs/api/http/mcp-servers.md +34 -4
  485. package/docs/api/http/namespaces.md +2 -0
  486. package/docs/api/http/pipelines.md +2 -0
  487. package/docs/api/http/roles.md +11 -8
  488. package/docs/api/http/service-accounts.md +8 -2
  489. package/docs/api/http/settings.md +29 -2
  490. package/docs/api/http/tasks.md +3 -1
  491. package/docs/api/http/topics.md +7 -1
  492. package/docs/api/http/users.md +8 -2
  493. package/docs/api/http/workflows.md +25 -10
  494. package/docs/api/http/yaml-workflows.md +21 -0
  495. package/docs/api/mcp/admin.md +409 -49
  496. package/docs/api/mcp/file-storage.md +4 -0
  497. package/docs/api/mcp/http-fetch.md +6 -2
  498. package/docs/api/mcp/human-queue.md +53 -0
  499. package/docs/api/mcp/index.md +13 -10
  500. package/docs/api/mcp/knowledge.md +34 -0
  501. package/docs/api/mcp/oauth.md +1 -1
  502. package/docs/api/mcp/ortho.md +113 -0
  503. package/docs/api/mcp/vision.md +1 -1
  504. package/docs/api/sdk/bot-accounts.md +1 -0
  505. package/docs/api/sdk/escalations.md +18 -2
  506. package/docs/api/sdk/mcp.md +2 -2
  507. package/docs/api/sdk/settings.md +1 -1
  508. package/docs/api/sdk/tasks.md +2 -2
  509. package/docs/api/sdk/workflows.md +2 -2
  510. package/docs/api/sdk/yaml-workflows.md +1 -1
  511. package/docs/architecture.md +3 -1
  512. package/docs/auth.md +3 -2
  513. package/docs/cloud.md +7 -2
  514. package/docs/code-owned-configuration.md +12 -0
  515. package/docs/dashboard.md +16 -7
  516. package/docs/data.md +1 -1
  517. package/docs/escalation-strategies.md +9 -20
  518. package/docs/events.md +6 -0
  519. package/docs/hitl/portal.md +2 -0
  520. package/docs/hitl/x-lt-list-schema.md +88 -1
  521. package/docs/hitl/x-lt-scan.md +4 -1
  522. package/docs/iam.md +7 -5
  523. package/docs/mcp.md +159 -210
  524. package/docs/oauth-and-delegation.md +32 -21
  525. package/docs/scan-codes.md +7 -1
  526. package/docs/topics.md +2 -0
  527. package/docs/workflows.md +14 -112
  528. package/package.json +6 -3
  529. package/dashboard/dist/assets/AvailableEscalationsPage-CWMyy3IL.js +0 -2
  530. package/dashboard/dist/assets/AvailableEscalationsPage-CWMyy3IL.js.map +0 -1
  531. package/dashboard/dist/assets/CapabilitiesPage-DKxLvOfB.js +0 -2
  532. package/dashboard/dist/assets/ConfirmDeleteModal-Beq1vQtY.js +0 -2
  533. package/dashboard/dist/assets/ConfirmDeleteModal-Beq1vQtY.js.map +0 -1
  534. package/dashboard/dist/assets/CountdownTimer-BUBl_4mP.js +0 -2
  535. package/dashboard/dist/assets/CountdownTimer-BUBl_4mP.js.map +0 -1
  536. package/dashboard/dist/assets/DataTable-spX1dFyb.js +0 -2
  537. package/dashboard/dist/assets/DataTable-spX1dFyb.js.map +0 -1
  538. package/dashboard/dist/assets/EscalationListView-DTIVuym4.js +0 -2
  539. package/dashboard/dist/assets/EscalationListView-DTIVuym4.js.map +0 -1
  540. package/dashboard/dist/assets/EscalationTimeline-DNKNp6pL.js +0 -2
  541. package/dashboard/dist/assets/EscalationTimeline-DNKNp6pL.js.map +0 -1
  542. package/dashboard/dist/assets/OperationsPage-B2DA7n9m.js.map +0 -1
  543. package/dashboard/dist/assets/OperatorDashboard-C8RtPv8P.js +0 -2
  544. package/dashboard/dist/assets/OperatorDashboard-C8RtPv8P.js.map +0 -1
  545. package/dashboard/dist/assets/PortalPage-Xk1zVneM.js +0 -2
  546. package/dashboard/dist/assets/PortalPage-Xk1zVneM.js.map +0 -1
  547. package/dashboard/dist/assets/ProcessDetailPage-D7EYwW-j.js +0 -2
  548. package/dashboard/dist/assets/ResolverForm-BwVOJUpJ.js +0 -8
  549. package/dashboard/dist/assets/ResolverForm-BwVOJUpJ.js.map +0 -1
  550. package/dashboard/dist/assets/ScanStationPage-Cg8LCFR7.js +0 -2
  551. package/dashboard/dist/assets/ScanStationPage-Cg8LCFR7.js.map +0 -1
  552. package/dashboard/dist/assets/escalation-columns-Bf09Q89t.js +0 -2
  553. package/dashboard/dist/assets/escalation-columns-Bf09Q89t.js.map +0 -1
  554. package/dashboard/dist/assets/index-BCFEQEMC.js +0 -2
  555. package/dashboard/dist/assets/index-BEPKAjna.js +0 -13
  556. package/dashboard/dist/assets/index-BUYokcrl.js +0 -67
  557. package/dashboard/dist/assets/index-BUYokcrl.js.map +0 -1
  558. package/dashboard/dist/assets/index-CcgmR-7-.js +0 -2
  559. package/dashboard/dist/assets/index-CcgmR-7-.js.map +0 -1
  560. package/dashboard/dist/assets/index-D1mKf_qz.js +0 -3
  561. package/dashboard/dist/assets/index-D1mKf_qz.js.map +0 -1
  562. package/dashboard/dist/assets/index-DcppjzP5.css +0 -1
@@ -0,0 +1,2 @@
1
+ import{a as u,j as e}from"./vendor-query-DvWWuNIB.js";import{$ as C,az as I,aA as M,ah as A,aB as R,aC as T}from"./index-CeCtqujG.js";import{P as B}from"./PageHeader-CMd3f4bz.js";import"./FilterBar-ABC9ctin.js";import{W as F}from"./WorkflowPill-Dg7BDTyM.js";import{W as S,u as q,l as Q,e as $,L as z}from"./ResolverForm-B1_x8Blv.js";import{c as k}from"./validate-BIRn4a6d.js";import{N as O}from"./NamespacePill-DwM5pNA4.js";import{K as U,aw as H,ax as _,f as L,j as D,ay as K,az as V,an as Y}from"./vendor-icons-CeVtUKyP.js";import{B as G}from"./BotPicker-DvEJFpwS.js";import{f as J}from"./vendor-react-_9U4mKFr.js";import"./StatusBadge-DHVwxre2.js";import"./constants-CeBBTzf5.js";import"./bots-DIFE298x.js";function X(t){const[a,n]=u.useState(()=>{try{return window.matchMedia(t).matches}catch{return!1}});return u.useEffect(()=>{let i;try{i=window.matchMedia(t)}catch{return}n(i.matches);const r=l=>n(l.matches);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[t]),a}const Z="No Queue";function W(t){return[...new Set(t.map(a=>a.task_queue).filter(Boolean))].sort()}function E(t,a,n){const i=a.toLowerCase().trim(),r=o=>{var x;return!i||o.workflow_type.toLowerCase().includes(i)||((x=o.description)==null?void 0:x.toLowerCase().includes(i))},m=(n?[n]:W(t)).map(o=>({queue:o,workflows:t.filter(x=>x.task_queue===o&&r(x))})).filter(o=>o.workflows.length>0);if(!n){const o=t.filter(x=>!x.task_queue&&r(x));o.length>0&&m.push({queue:"",workflows:o})}return m}function ee(t){var a,n;return((n=(a=E(t,"",null)[0])==null?void 0:a.workflows[0])==null?void 0:n.workflow_type)??null}function te({configs:t,selectedType:a,onSelect:n,tierMap:i,activeTypes:r,search:l,activeQueue:m,compact:o=!1}){const x=u.useMemo(()=>E(t,l,m),[t,l,m]);return x.length===0?e.jsx("p",{className:"text-sm text-text-tertiary py-8 text-center",children:"No workflows match your filter."}):e.jsx("div",{className:o?"space-y-6":"space-y-10",children:x.map(({queue:f,workflows:p})=>e.jsxs("div",{children:[e.jsxs("div",{className:`flex items-center gap-2 py-2 mb-1 border-b border-surface-border ${o?"":"sticky top-[60px] z-10 bg-surface mb-2"}`,children:[f?e.jsx(U,{className:"w-3 h-3 text-accent shrink-0",strokeWidth:1.5}):e.jsx(H,{className:"w-3 h-3 text-text-quaternary shrink-0",strokeWidth:1.5}),e.jsx("h2",{className:"section-h2 truncate",title:f||void 0,children:f?k(f):Z}),e.jsx("span",{className:"text-xs text-text-quaternary",children:p.length})]}),e.jsx("div",{className:o?"":"divide-y divide-surface-border/30",children:p.map(c=>e.jsx(se,{config:c,isSelected:a===c.workflow_type,tier:i.get(c.workflow_type)??"durable",cronActive:(r==null?void 0:r.has(c.workflow_type))??!1,onSelect:n,compact:o},c.workflow_type))})]},f||"__none__"))})}function se({config:t,isSelected:a,tier:n,cronActive:i,onSelect:r,compact:l}){const m=n==="certified"?"certified":n==="registered"?"registered":"durable";return l?e.jsxs("button",{onClick:()=>r(t),"aria-current":a?"true":void 0,title:t.workflow_type,className:`group w-full text-left flex items-center gap-2.5 pl-3 pr-2 py-2 border-l-2 transition-colors ${a?"border-accent bg-accent/10 text-accent":"border-transparent text-text-primary hover:bg-surface-hover"}`,children:[e.jsx(S,{icon:t.icon,tier:n,className:`w-5 h-5 shrink-0 ${a?"text-accent":"text-accent/65"}`}),e.jsx("span",{className:"text-sm truncate",children:k(t.workflow_type)}),i&&e.jsx("span",{title:"Cron schedule active",className:"ml-auto shrink-0",children:e.jsx(_,{className:"w-3 h-3 text-status-success/70"})})]}):e.jsxs("button",{onClick:()=>r(t),className:"group relative w-full text-left py-2 px-3 -mx-3 rounded-md hover:bg-surface-hover/30 transition-colors duration-150",children:[a&&e.jsx("span",{className:"absolute left-0 top-1 bottom-1 w-0.5 bg-accent rounded-full"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(F,{type:t.workflow_type,size:"md",variant:m}),t.description&&e.jsx("p",{className:"flex-1 min-w-0 truncate text-2xs text-text-tertiary group-hover:text-text-secondary transition-colors",children:t.description}),e.jsxs("span",{className:"ml-auto flex items-center gap-2 shrink-0",children:[t.execute_as&&e.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 text-2xs bg-accent/10 text-accent rounded",children:[e.jsx(L,{className:"w-2.5 h-2.5"}),t.execute_as]}),i&&e.jsx("span",{title:"Cron schedule active",children:e.jsx(_,{className:"w-3 h-3 text-status-success/70 shrink-0"})}),e.jsx(O,{namespace:"durable"}),e.jsx("span",{title:"Configure & invoke",children:e.jsx(D,{className:`w-3 h-3 transition-opacity ${a?"text-accent opacity-100":"text-accent opacity-0 group-hover:opacity-100"}`,strokeWidth:1.5})})]})]})]})}function ae({config:t,overrideBot:a,onOverrideChange:n,showOverride:i}){const{user:r}=C(),l=a||t.execute_as;return e.jsxs("div",{className:"bg-surface-sunken rounded-lg px-4 py-3 space-y-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-2xs text-text-tertiary uppercase tracking-wider font-medium",children:"Running as"}),l&&!a&&e.jsx("span",{className:"text-2xs text-text-tertiary",children:"configured default"}),a&&e.jsx("span",{className:"text-2xs text-accent",children:"admin override"})]}),e.jsx("div",{className:"field flex items-center gap-1.5",children:l?e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"w-3.5 h-3.5 text-accent/70 shrink-0"}),e.jsx("span",{className:"text-xs text-text-primary font-mono",children:l})]}):e.jsxs(e.Fragment,{children:[e.jsx(K,{className:"w-3.5 h-3.5 text-text-tertiary shrink-0"}),e.jsx("span",{className:"text-xs text-text-primary",children:(r==null?void 0:r.displayName)||(r==null?void 0:r.username)||"you"})]})})]}),i&&n&&e.jsxs("div",{children:[e.jsx("label",{className:"text-2xs text-text-tertiary uppercase tracking-wider font-medium mb-1 block",children:"Override identity"}),e.jsx(G,{selected:a??"",onChange:n,placeholder:t.execute_as?`Default: ${t.execute_as}`:"Invoking user (default)"})]})]})}function re({selected:t}){const{isSuperAdmin:a,hasRoleType:n}=C(),i=a||n("admin"),[r,l]=u.useState(""),[m,o]=u.useState(t.certified);u.useEffect(()=>{l(""),o(t.certified)},[t.workflow_type,t.certified]);const x=u.useMemo(()=>{var N;const d=(N=t.envelope_schema)==null?void 0:N.metadata;return d&&typeof d=="object"?d:{}},[t.envelope_schema]),f=Array.isArray(t.input_lookups)&&t.input_lookups.length>0,{data:p}=I(t.workflow_type,f),c=u.useMemo(()=>p?M(p.lookups):void 0,[p]),w=(p==null?void 0:p.lookups.filter(d=>d.missing))??[],j=q(t,{certified:m,overrideBot:r}),y=e.jsxs(e.Fragment,{children:[t.description&&e.jsx(A,{content:t.description,className:"text-xs text-text-secondary leading-relaxed"}),e.jsx(ae,{config:t,overrideBot:r,onOverrideChange:l,showOverride:i}),t.certified&&e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:m,onChange:d=>o(d.target.checked),className:"rounded border-surface-border text-accent focus:ring-accent/30"}),e.jsx(V,{className:"w-3.5 h-3.5 text-text-tertiary"}),e.jsx("span",{className:"text-xs text-text-secondary",children:"Enable task tracking and escalation routing"})]})]});return e.jsxs("div",{className:"max-w-form","data-testid":"invoke-form",children:[e.jsxs("header",{className:"sticky top-0 z-10 bg-surface -mt-8 pt-8 flex items-baseline gap-3 min-w-0 pb-3 mb-5 border-b border-surface-border/60",children:[e.jsx(S,{icon:t.icon,tier:t.tier,className:"w-7 h-7 self-center shrink-0 text-accent"}),e.jsx("h2",{className:"heading-2 truncate",title:t.workflow_type,children:k(t.workflow_type)}),e.jsx("span",{className:"text-2xs font-mono text-text-quaternary shrink-0",children:t.workflow_type}),e.jsx("span",{className:"text-2xs uppercase tracking-widest text-text-tertiary shrink-0",children:t.tier}),t.task_queue&&e.jsx("span",{className:"text-2xs font-mono text-text-quaternary truncate",children:t.task_queue})]}),w.length>0&&e.jsxs("p",{className:"flex items-center gap-1.5 text-2xs text-status-warning mb-4","data-testid":"lookup-missing",children:[e.jsx(Y,{className:"w-3 h-3 shrink-0",strokeWidth:1.5}),w.map(Q).join(", ")," ",w.length===1?"is":"are"," not available; the fields that read ",w.length===1?"it":"them"," fall back to plain inputs."]}),t.input_schema?e.jsx($,{selected:t,schema:t.input_schema,metadata:x,lookup:c,submission:j,lead:y}):e.jsx(z,{selected:t,metadata:x,submission:j,lead:y})]})}const b="type",ne=!1;function oe(){const[t,a]=J(),{data:n,isLoading:i}=R(),{data:r}=T(),l=X("(max-width: 1279px)"),m=t.get(b)??"",[o,x]=u.useState(""),[f,p]=u.useState(null),c=n??[],w=u.useMemo(()=>{const s=new Map;for(const h of c)s.set(h.workflow_type,h.tier);return s},[c]),j=c.find(s=>s.workflow_type===m),y=new Set((r??[]).filter(s=>s.active).map(s=>s.workflow_type)),d=u.useCallback((s,h={})=>{a(P=>{const g=new URLSearchParams(P);return s?g.set(b,s):g.delete(b),g},{replace:h.replace??!1})},[a]);if(u.useEffect(()=>{if(t.get(b)||c.length===0)return;const s=ee(c);s&&d(s,{replace:!0})},[c,t,d]),i)return e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-8 bg-surface-sunken rounded w-48"}),e.jsx("div",{className:"h-40 bg-surface-sunken rounded"})]});const N=W(c),v=j?e.jsx(re,{selected:j}):e.jsx("p",{className:"text-xs text-text-tertiary",children:"Choose a tool to begin."});return e.jsxs("div",{children:[e.jsx(B,{title:"Invoke Tool",docsHash:"#docs:dashboard.md:invoke-tool"}),c.length===0?e.jsxs("div",{className:"py-16 text-center",children:[e.jsx("p",{className:"text-sm text-text-primary mb-1",children:"No tools to invoke"}),e.jsx("p",{className:"text-xs text-text-tertiary",children:"Mark workflows as invocable in the registry, or start the server with examples enabled."})]}):l?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"block mb-6 max-w-2xl",children:[e.jsx("span",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Tool"}),e.jsxs("select",{value:m,onChange:s=>d(s.target.value||null),className:"select text-xs font-mono w-full",children:[e.jsx("option",{value:"",children:"Choose a tool…"}),N.map(s=>e.jsx("optgroup",{label:k(s),children:c.filter(h=>(h.task_queue||"")===s).map(h=>e.jsx("option",{value:h.workflow_type,children:k(h.workflow_type)},h.workflow_type))},s)),c.filter(s=>!s.task_queue).map(s=>e.jsx("option",{value:s.workflow_type,children:k(s.workflow_type)},s.workflow_type))]})]}),e.jsx("div",{className:"pt-8",children:v})]}):e.jsxs("div",{className:"flex gap-10 items-start",children:[e.jsxs("aside",{className:"w-1/4 min-w-[15rem] shrink-0 sticky top-0 self-start -mt-8 pt-8 max-h-[calc(100vh-5rem)] overflow-y-auto pr-1 space-y-4","data-testid":"invoke-list",children:[ne,e.jsx(te,{configs:c,selectedType:m,onSelect:s=>d(s.workflow_type),tierMap:w,activeTypes:y,search:o,activeQueue:f,compact:!0})]}),e.jsx("section",{className:"flex-1 min-w-0",children:v})]})]})}function Ne(){return e.jsx(oe,{})}export{Ne as DurableInvokePage,oe as StartWorkflowPage};
2
+ //# sourceMappingURL=index-CxdjT1Yk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-BCFEQEMC.js","sources":["../../src/hooks/useMediaQuery.ts","../../src/pages/workflows/start/WorkflowSelector.tsx","../../src/pages/workflows/start/IdentitySummary.tsx","../../src/pages/workflows/start/StartNowPanel.tsx","../../src/pages/workflows/start/StartWorkflowPage.tsx","../../src/pages/workflows/start/DurableInvokePage.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/**\n * Tracks a viewport media query. Unlike container measurement, the viewport\n * is stable while shell panels open and close, so layout decisions made on\n * it never feed back into themselves. Returns false in environments without\n * matchMedia (jsdom), which callers treat as \"wide\".\n */\nexport function useMediaQuery(query: string): boolean {\n const [matches, setMatches] = useState<boolean>(() => {\n try {\n return window.matchMedia(query).matches;\n } catch {\n return false;\n }\n });\n\n useEffect(() => {\n let mql: MediaQueryList;\n try {\n mql = window.matchMedia(query);\n } catch {\n return;\n }\n setMatches(mql.matches);\n const onChange = (e: MediaQueryListEvent) => setMatches(e.matches);\n mql.addEventListener('change', onChange);\n return () => mql.removeEventListener('change', onChange);\n }, [query]);\n\n return matches;\n}\n","import { useMemo } from 'react';\nimport { Bot, Clock, Play, Server, Wrench } from 'lucide-react';\nimport { WorkflowPill } from '../../../components/common/display/WorkflowPill';\nimport { WorkflowIcon } from '../../../components/common/display/WorkflowIcon';\nimport { identifierToTitle } from '../../../lib/identifier-label';\nimport { NamespacePill } from '../../../components/common/display/NamespacePill';\nimport type { LTWorkflowConfig, WorkflowTier } from '../../../api/types';\n\nconst NO_QUEUE_LABEL = 'No Queue';\n\n/** The queue set a filter offers — shared with the grouping below. */\nexport function workflowQueues(configs: LTWorkflowConfig[]): string[] {\n return [...new Set(configs.map((c) => c.task_queue).filter(Boolean))].sort() as string[];\n}\n\n/** One section per task queue; unqueued workflows trail under their own heading when no queue filter is active. */\nexport function groupWorkflows(\n configs: LTWorkflowConfig[],\n search: string,\n activeQueue: string | null,\n): { queue: string; workflows: LTWorkflowConfig[] }[] {\n const q = search.toLowerCase().trim();\n const matches = (c: LTWorkflowConfig) =>\n !q || c.workflow_type.toLowerCase().includes(q) || c.description?.toLowerCase().includes(q);\n\n const targetQueues = activeQueue ? [activeQueue] : workflowQueues(configs);\n const sections = targetQueues\n .map((queue) => ({ queue, workflows: configs.filter((c) => c.task_queue === queue && matches(c)) }))\n .filter((g) => g.workflows.length > 0);\n\n if (!activeQueue) {\n const noQueue = configs.filter((c) => !c.task_queue && matches(c));\n if (noQueue.length > 0) sections.push({ queue: '', workflows: noQueue });\n }\n return sections;\n}\n\n/** The first row of the unfiltered list — what the page preselects. */\nexport function firstWorkflowType(configs: LTWorkflowConfig[]): string | null {\n return groupWorkflows(configs, '', null)[0]?.workflows[0]?.workflow_type ?? null;\n}\n\nexport function WorkflowSelector({\n configs,\n selectedType,\n onSelect,\n tierMap,\n activeTypes,\n search,\n activeQueue,\n compact = false,\n}: {\n configs: LTWorkflowConfig[];\n selectedType: string;\n onSelect: (config: LTWorkflowConfig) => void;\n tierMap: Map<string, WorkflowTier>;\n activeTypes?: Set<string>;\n search: string;\n activeQueue: string | null;\n /** The narrow list column beside the form: name and tier only, headings in flow. */\n compact?: boolean;\n}) {\n const grouped = useMemo(() => groupWorkflows(configs, search, activeQueue), [configs, search, activeQueue]);\n\n if (grouped.length === 0) {\n return <p className=\"text-sm text-text-tertiary py-8 text-center\">No workflows match your filter.</p>;\n }\n\n return (\n <div className={compact ? 'space-y-6' : 'space-y-10'}>\n {grouped.map(({ queue, workflows }) => (\n <div key={queue || '__none__'}>\n <div className={`flex items-center gap-2 py-2 mb-1 border-b border-surface-border ${compact ? '' : 'sticky top-[60px] z-10 bg-surface mb-2'}`}>\n {queue ? (\n <Server className=\"w-3 h-3 text-accent shrink-0\" strokeWidth={1.5} />\n ) : (\n <Wrench className=\"w-3 h-3 text-text-quaternary shrink-0\" strokeWidth={1.5} />\n )}\n <h2 className=\"section-h2 truncate\" title={queue || undefined}>{queue ? identifierToTitle(queue) : NO_QUEUE_LABEL}</h2>\n <span className=\"text-xs text-text-quaternary\">{workflows.length}</span>\n </div>\n <div className={compact ? '' : 'divide-y divide-surface-border/30'}>\n {workflows.map((config) => (\n <WorkflowRow\n key={config.workflow_type}\n config={config}\n isSelected={selectedType === config.workflow_type}\n tier={tierMap.get(config.workflow_type) ?? 'durable'}\n cronActive={activeTypes?.has(config.workflow_type) ?? false}\n onSelect={onSelect}\n compact={compact}\n />\n ))}\n </div>\n </div>\n ))}\n </div>\n );\n}\n\nfunction WorkflowRow({\n config,\n isSelected,\n tier,\n cronActive,\n onSelect,\n compact,\n}: {\n config: LTWorkflowConfig;\n isSelected: boolean;\n tier: WorkflowTier;\n cronActive: boolean;\n onSelect: (config: LTWorkflowConfig) => void;\n compact: boolean;\n}) {\n const variant = tier === 'certified' ? 'certified' : tier === 'registered' ? 'registered' : 'durable';\n\n if (compact) {\n return (\n <button\n onClick={() => onSelect(config)}\n aria-current={isSelected ? 'true' : undefined}\n title={config.workflow_type}\n className={`group w-full text-left flex items-center gap-2.5 pl-3 pr-2 py-2 border-l-2 transition-colors ${\n isSelected ? 'border-accent bg-accent/10 text-accent' : 'border-transparent text-text-primary hover:bg-surface-hover'\n }`}\n >\n <WorkflowIcon icon={config.icon} tier={tier} className={`w-5 h-5 shrink-0 ${isSelected ? 'text-accent' : 'text-accent/65'}`} />\n <span className=\"text-sm truncate\">{identifierToTitle(config.workflow_type)}</span>\n {cronActive && (\n <span title=\"Cron schedule active\" className=\"ml-auto shrink-0\">\n <Clock className=\"w-3 h-3 text-status-success/70\" />\n </span>\n )}\n </button>\n );\n }\n\n return (\n <button\n onClick={() => onSelect(config)}\n className=\"group relative w-full text-left py-2 px-3 -mx-3 rounded-md hover:bg-surface-hover/30 transition-colors duration-150\"\n >\n {isSelected && (\n <span className=\"absolute left-0 top-1 bottom-1 w-0.5 bg-accent rounded-full\" />\n )}\n <div className=\"flex items-center gap-3\">\n <WorkflowPill type={config.workflow_type} size=\"md\" variant={variant} />\n {config.description && (\n <p className=\"flex-1 min-w-0 truncate text-2xs text-text-tertiary group-hover:text-text-secondary transition-colors\">\n {config.description}\n </p>\n )}\n <span className=\"ml-auto flex items-center gap-2 shrink-0\">\n {config.execute_as && (\n <span className=\"inline-flex items-center gap-0.5 px-1.5 py-0.5 text-2xs bg-accent/10 text-accent rounded\">\n <Bot className=\"w-2.5 h-2.5\" />\n {config.execute_as}\n </span>\n )}\n {cronActive && (\n <span title=\"Cron schedule active\">\n <Clock className=\"w-3 h-3 text-status-success/70 shrink-0\" />\n </span>\n )}\n <NamespacePill namespace=\"durable\" />\n <span title=\"Configure & invoke\">\n <Play\n className={`w-3 h-3 transition-opacity ${\n isSelected ? 'text-accent opacity-100' : 'text-accent opacity-0 group-hover:opacity-100'\n }`}\n strokeWidth={1.5}\n />\n </span>\n </span>\n </div>\n </button>\n );\n}\n","import { Bot, UserCircle } from 'lucide-react';\nimport { BotPicker } from '../../../components/common/form/BotPicker';\nimport { useAuth } from '../../../hooks/useAuth';\nimport type { LTWorkflowConfig } from '../../../api/types';\n\nexport function IdentitySummary({\n config,\n overrideBot,\n onOverrideChange,\n showOverride,\n}: {\n config: LTWorkflowConfig;\n overrideBot?: string;\n onOverrideChange?: (botExternalId: string) => void;\n showOverride?: boolean;\n}) {\n const { user } = useAuth();\n const effectiveBot = overrideBot || config.execute_as;\n\n return (\n <div className=\"bg-surface-sunken rounded-lg px-4 py-3 space-y-3\">\n <div>\n <div className=\"flex items-center justify-between mb-1\">\n <span className=\"text-2xs text-text-tertiary uppercase tracking-wider font-medium\">Running as</span>\n {effectiveBot && !overrideBot && (\n <span className=\"text-2xs text-text-tertiary\">configured default</span>\n )}\n {overrideBot && (\n <span className=\"text-2xs text-accent\">admin override</span>\n )}\n </div>\n {/* Read-only identity, styled as a field so it reads consistently with\n the Override control below and pops off the sunken band. */}\n <div className=\"field flex items-center gap-1.5\">\n {effectiveBot ? (\n <>\n <Bot className=\"w-3.5 h-3.5 text-accent/70 shrink-0\" />\n <span className=\"text-xs text-text-primary font-mono\">{effectiveBot}</span>\n </>\n ) : (\n <>\n <UserCircle className=\"w-3.5 h-3.5 text-text-tertiary shrink-0\" />\n <span className=\"text-xs text-text-primary\">\n {user?.displayName || user?.username || 'you'}\n </span>\n </>\n )}\n </div>\n </div>\n {showOverride && onOverrideChange && (\n <div>\n <label className=\"text-2xs text-text-tertiary uppercase tracking-wider font-medium mb-1 block\">Override identity</label>\n <BotPicker\n selected={overrideBot ?? ''}\n onChange={onOverrideChange}\n placeholder={config.execute_as ? `Default: ${config.execute_as}` : 'Invoking user (default)'}\n />\n </div>\n )}\n </div>\n );\n}\n","import { useEffect, useMemo, useState } from 'react';\nimport { lookupLabel } from '../../../lib/lookup-label';\nimport { AlertTriangle, ShieldCheck } from 'lucide-react';\nimport { useAuth } from '../../../hooks/useAuth';\nimport { foldWorkflowLookups, useWorkflowLookups } from '../../../api/workflows';\nimport type { InvocableWorkflow } from '../../../api/types';\nimport { WorkflowIcon } from '../../../components/common/display/WorkflowIcon';\nimport { MarkdownRenderer } from '../../../components/common/display/MarkdownRenderer';\nimport { identifierToTitle } from '../../../lib/identifier-label';\nimport { IdentitySummary } from './IdentitySummary';\nimport { LegacyInvokeForm } from './LegacyInvokeForm';\nimport { RichInvokeForm } from './RichInvokeForm';\nimport { useInvokeSubmit } from './use-invoke-submit';\n\n/**\n * The form column. The workflow's name is the column's heading and stays\n * put; Start stays put at the bottom; description, identity, options, and\n* the fields scroll between them. A declared input_schema renders the\n * x-lt-* form, with pinned input_lookups resolved into its lookup domain;\n * otherwise the envelope template form.\n */\nexport function StartNowPanel({ selected }: { selected: InvocableWorkflow }) {\n const { isSuperAdmin, hasRoleType } = useAuth();\n const isAdmin = isSuperAdmin || hasRoleType('admin');\n const [overrideBot, setOverrideBot] = useState('');\n // Per-run interceptor opt-out, offered when the registration is certified.\n const [certified, setCertified] = useState(selected.certified);\n\n useEffect(() => {\n setOverrideBot('');\n setCertified(selected.certified);\n }, [selected.workflow_type, selected.certified]);\n\n const metadata = useMemo(() => {\n const md = selected.envelope_schema?.metadata;\n return md && typeof md === 'object' ? (md as Record<string, unknown>) : {};\n }, [selected.envelope_schema]);\n\n const hasLookups = Array.isArray(selected.input_lookups) && selected.input_lookups.length > 0;\n const { data: lookupData } = useWorkflowLookups(selected.workflow_type, hasLookups);\n const lookup = useMemo(() => (lookupData ? foldWorkflowLookups(lookupData.lookups) : undefined), [lookupData]);\n const missingLookups = lookupData?.lookups.filter((l) => l.missing) ?? [];\n\n const submission = useInvokeSubmit(selected, { certified, overrideBot });\n\n const lead = (\n <>\n {selected.description && (\n <MarkdownRenderer content={selected.description} className=\"text-xs text-text-secondary leading-relaxed\" />\n )}\n <IdentitySummary\n config={selected}\n overrideBot={overrideBot}\n onOverrideChange={setOverrideBot}\n showOverride={isAdmin}\n />\n {selected.certified && (\n <label className=\"flex items-center gap-2 cursor-pointer\">\n <input\n type=\"checkbox\"\n checked={certified}\n onChange={(e) => setCertified(e.target.checked)}\n className=\"rounded border-surface-border text-accent focus:ring-accent/30\"\n />\n <ShieldCheck className=\"w-3.5 h-3.5 text-text-tertiary\" />\n <span className=\"text-xs text-text-secondary\">Enable task tracking and escalation routing</span>\n </label>\n )}\n </>\n );\n\n return (\n <div className=\"max-w-form\" data-testid=\"invoke-form\">\n {/* Sticks to the top of the shell scroll; the pulled-up padding covers the page gutter above it. */}\n <header className=\"sticky top-0 z-10 bg-surface -mt-8 pt-8 flex items-baseline gap-3 min-w-0 pb-3 mb-5 border-b border-surface-border/60\">\n <WorkflowIcon icon={selected.icon} tier={selected.tier} className=\"w-7 h-7 self-center shrink-0 text-accent\" />\n <h2 className=\"heading-2 truncate\" title={selected.workflow_type}>\n {identifierToTitle(selected.workflow_type)}\n </h2>\n <span className=\"text-2xs font-mono text-text-quaternary shrink-0\">{selected.workflow_type}</span>\n <span className=\"text-2xs uppercase tracking-widest text-text-tertiary shrink-0\">{selected.tier}</span>\n {selected.task_queue && (\n <span className=\"text-2xs font-mono text-text-quaternary truncate\">{selected.task_queue}</span>\n )}\n </header>\n\n {missingLookups.length > 0 && (\n <p className=\"flex items-center gap-1.5 text-2xs text-status-warning mb-4\" data-testid=\"lookup-missing\">\n <AlertTriangle className=\"w-3 h-3 shrink-0\" strokeWidth={1.5} />\n {missingLookups.map(lookupLabel).join(', ')} {missingLookups.length === 1 ? 'is' : 'are'} not available; the fields that read {missingLookups.length === 1 ? 'it' : 'them'} fall back to plain inputs.\n </p>\n )}\n\n {selected.input_schema ? (\n <RichInvokeForm selected={selected} schema={selected.input_schema} metadata={metadata} lookup={lookup} submission={submission} lead={lead} />\n ) : (\n <LegacyInvokeForm selected={selected} metadata={metadata} submission={submission} lead={lead} />\n )}\n </div>\n );\n}\n","import { useCallback, useEffect, useMemo, useState } from 'react';\nimport { useSearchParams } from 'react-router-dom';\nimport { useInvocableWorkflows, useCronStatus } from '../../../api/workflows';\nimport { PageHeader } from '../../../components/common/layout/PageHeader';\nimport { FilterSelect, FilterInput } from '../../../components/common/data/FilterBar';\nimport { useMediaQuery } from '../../../hooks/useMediaQuery';\nimport type { InvocableWorkflow, WorkflowTier } from '../../../api/types';\nimport { WorkflowSelector, workflowQueues, firstWorkflowType } from './WorkflowSelector';\nimport { identifierToTitle } from '../../../lib/identifier-label';\nimport { StartNowPanel } from './StartNowPanel';\n\nconst TYPE_PARAM = 'type';\n// A few dozen workflows read fine grouped by queue; the filters wait for scale to demand them.\nconst LIST_FILTERS_VISIBLE = false;\n\n/**\n * Invoke — the list of workflows the caller may run beside the form for the\n * one chosen. The list is grouped by queue and takes a quarter of the row;\n * the form takes the rest. Selection lives in `?type=`, and the first row\n * is preselected so the page opens on a form, never on an empty column.\n */\nexport function StartWorkflowPage() {\n const [searchParams, setSearchParams] = useSearchParams();\n const { data: invocable, isLoading } = useInvocableWorkflows();\n const { data: cronEntries } = useCronStatus();\n // Below xl the list and the form cannot share the row: the list folds\n // into a select and the form takes the full width.\n const compact = useMediaQuery('(max-width: 1279px)');\n\n const selectedType = searchParams.get(TYPE_PARAM) ?? '';\n const [search, setSearch] = useState('');\n const [activeQueue, setActiveQueue] = useState<string | null>(null);\n\n const workflows: InvocableWorkflow[] = invocable ?? [];\n const tierMap = useMemo(() => {\n const map = new Map<string, WorkflowTier>();\n for (const w of workflows) map.set(w.workflow_type, w.tier);\n return map;\n }, [workflows]);\n const selected = workflows.find((c) => c.workflow_type === selectedType);\n const activeTypes = new Set((cronEntries ?? []).filter((e) => e.active).map((e) => e.workflow_type));\n\n // A user's choice is a history entry; the opening preselect only rewrites the landing URL.\n const setType = useCallback(\n (value: string | null, opts: { replace?: boolean } = {}) => {\n setSearchParams(\n (prev) => {\n const next = new URLSearchParams(prev);\n if (value) next.set(TYPE_PARAM, value);\n else next.delete(TYPE_PARAM);\n return next;\n },\n { replace: opts.replace ?? false },\n );\n },\n [setSearchParams],\n );\n\n useEffect(() => {\n if (searchParams.get(TYPE_PARAM) || workflows.length === 0) return;\n const first = firstWorkflowType(workflows);\n if (first) setType(first, { replace: true });\n }, [workflows, searchParams, setType]);\n\n if (isLoading) {\n return (\n <div className=\"animate-pulse space-y-4\">\n <div className=\"h-8 bg-surface-sunken rounded w-48\" />\n <div className=\"h-40 bg-surface-sunken rounded\" />\n </div>\n );\n }\n\n const queues = workflowQueues(workflows);\n const form = selected\n ? <StartNowPanel selected={selected} />\n : <p className=\"text-xs text-text-tertiary\">Choose a tool to begin.</p>;\n\n return (\n <div>\n <PageHeader title=\"Invoke Tool\" docsHash=\"#docs:dashboard.md:invoke-tool\" />\n\n {workflows.length === 0 ? (\n <div className=\"py-16 text-center\">\n <p className=\"text-sm text-text-primary mb-1\">No tools to invoke</p>\n <p className=\"text-xs text-text-tertiary\">Mark workflows as invocable in the registry, or start the server with examples enabled.</p>\n </div>\n ) : compact ? (\n <>\n <label className=\"block mb-6 max-w-2xl\">\n <span className=\"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1\">Tool</span>\n <select\n value={selectedType}\n onChange={(e) => setType(e.target.value || null)}\n className=\"select text-xs font-mono w-full\"\n >\n <option value=\"\">Choose a tool…</option>\n {queues.map((q) => (\n <optgroup key={q} label={identifierToTitle(q)}>\n {workflows\n .filter((c) => (c.task_queue || '') === q)\n .map((c) => (\n <option key={c.workflow_type} value={c.workflow_type}>{identifierToTitle(c.workflow_type)}</option>\n ))}\n </optgroup>\n ))}\n {workflows\n .filter((c) => !c.task_queue)\n .map((c) => (\n <option key={c.workflow_type} value={c.workflow_type}>{identifierToTitle(c.workflow_type)}</option>\n ))}\n </select>\n </label>\n {/* The form heading pulls itself up over the page gutter when stuck; give it that room here so it never covers the picker. */}\n <div className=\"pt-8\">{form}</div>\n </>\n ) : (\n <div className=\"flex gap-10 items-start\">\n {/* The page scrolls as a whole; the list column and the form's title and Start stick while the title of the page rides away. */}\n <aside className=\"w-1/4 min-w-[15rem] shrink-0 sticky top-0 self-start -mt-8 pt-8 max-h-[calc(100vh-5rem)] overflow-y-auto pr-1 space-y-4\" data-testid=\"invoke-list\">\n {LIST_FILTERS_VISIBLE && <div className=\"flex flex-col gap-3\">\n {queues.length > 1 && (\n <FilterSelect\n label=\"Queue\"\n value={activeQueue ?? ''}\n onChange={(v) => setActiveQueue(v || null)}\n options={queues.map((q) => ({ value: q, label: q }))}\n />\n )}\n <FilterInput\n label=\"Search\"\n value={search}\n onChange={setSearch}\n placeholder={`${workflows.length} workflows…`}\n />\n </div>}\n <WorkflowSelector\n configs={workflows}\n selectedType={selectedType}\n onSelect={(c) => setType(c.workflow_type)}\n tierMap={tierMap}\n activeTypes={activeTypes}\n search={search}\n activeQueue={activeQueue}\n compact\n />\n </aside>\n <section className=\"flex-1 min-w-0\">{form}</section>\n </div>\n )}\n </div>\n );\n}\n","import { StartWorkflowPage } from './StartWorkflowPage';\n\nexport function DurableInvokePage() {\n return <StartWorkflowPage />;\n}\n"],"names":["useMediaQuery","query","matches","setMatches","useState","useEffect","mql","onChange","e","NO_QUEUE_LABEL","workflowQueues","configs","c","groupWorkflows","search","activeQueue","q","_a","sections","queue","g","noQueue","firstWorkflowType","_b","WorkflowSelector","selectedType","onSelect","tierMap","activeTypes","compact","grouped","useMemo","jsx","workflows","jsxs","Server","Wrench","identifierToTitle","config","WorkflowRow","isSelected","tier","cronActive","variant","WorkflowIcon","Clock","WorkflowPill","Bot","NamespacePill","Play","IdentitySummary","overrideBot","onOverrideChange","showOverride","user","useAuth","effectiveBot","Fragment","UserCircle","BotPicker","StartNowPanel","selected","isSuperAdmin","hasRoleType","isAdmin","setOverrideBot","certified","setCertified","metadata","md","hasLookups","lookupData","useWorkflowLookups","lookup","foldWorkflowLookups","missingLookups","l","submission","useInvokeSubmit","lead","MarkdownRenderer","ShieldCheck","AlertTriangle","lookupLabel","RichInvokeForm","LegacyInvokeForm","TYPE_PARAM","LIST_FILTERS_VISIBLE","StartWorkflowPage","searchParams","setSearchParams","useSearchParams","invocable","isLoading","useInvocableWorkflows","cronEntries","useCronStatus","setSearch","setActiveQueue","map","w","setType","useCallback","value","opts","prev","next","first","queues","form","PageHeader","DurableInvokePage"],"mappings":"83BAQO,SAASA,EAAcC,EAAwB,CACpD,KAAM,CAACC,EAASC,CAAU,EAAIC,EAAAA,SAAkB,IAAM,CACpD,GAAI,CACF,OAAO,OAAO,WAAWH,CAAK,EAAE,OAClC,MAAQ,CACN,MAAO,EACT,CACF,CAAC,EAEDI,OAAAA,EAAAA,UAAU,IAAM,CACd,IAAIC,EACJ,GAAI,CACFA,EAAM,OAAO,WAAWL,CAAK,CAC/B,MAAQ,CACN,MACF,CACAE,EAAWG,EAAI,OAAO,EACtB,MAAMC,EAAYC,GAA2BL,EAAWK,EAAE,OAAO,EACjE,OAAAF,EAAI,iBAAiB,SAAUC,CAAQ,EAChC,IAAMD,EAAI,oBAAoB,SAAUC,CAAQ,CACzD,EAAG,CAACN,CAAK,CAAC,EAEHC,CACT,CCvBA,MAAMO,EAAiB,WAGhB,SAASC,EAAeC,EAAuC,CACpE,MAAO,CAAC,GAAG,IAAI,IAAIA,EAAQ,IAAKC,GAAMA,EAAE,UAAU,EAAE,OAAO,OAAO,CAAC,CAAC,EAAE,KAAA,CACxE,CAGO,SAASC,EACdF,EACAG,EACAC,EACoD,CACpD,MAAMC,EAAIF,EAAO,YAAA,EAAc,KAAA,EACzBZ,EAAWU,GAAA,OACf,OAACI,GAAKJ,EAAE,cAAc,YAAA,EAAc,SAASI,CAAC,KAAKC,EAAAL,EAAE,cAAF,YAAAK,EAAe,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A,CACL,EACF,EAEAoB,EAAAA,IAAC,MAAA,CAAI,UAAU,OAAQ,SAAA6E,CAAA,CAAK,CAAA,CAAA,CAC9B,EAEA3E,EAAAA,KAAC,MAAA,CAAI,UAAU,0BAEb,SAAA,CAAAA,EAAAA,KAAC,QAAA,CAAM,UAAU,0HAA0H,cAAY,cACpJ,SAAA,CAAAqD,GAgBDvD,EAAAA,IAACR,GAAA,CACC,QAASS,EACT,aAAAR,EACA,SAAWb,GAAMyF,EAAQzF,EAAE,aAAa,EACxC,QAAAe,EACA,YAAAC,EACA,OAAAd,EACA,YAAAC,EACA,QAAO,EAAA,CAAA,CACT,EACF,EACAiB,EAAAA,IAAC,UAAA,CAAQ,UAAU,iBAAkB,SAAA6E,CAAA,CAAK,CAAA,CAAA,CAC5C,CAAA,EAEJ,CAEJ,CCtJO,SAASE,IAAoB,CAClC,aAAQvB,GAAA,EAAkB,CAC5B"}
1
+ {"version":3,"file":"index-CxdjT1Yk.js","sources":["../../src/hooks/useMediaQuery.ts","../../src/pages/workflows/start/WorkflowSelector.tsx","../../src/pages/workflows/start/IdentitySummary.tsx","../../src/pages/workflows/start/StartNowPanel.tsx","../../src/pages/workflows/start/StartWorkflowPage.tsx","../../src/pages/workflows/start/DurableInvokePage.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/**\n * Tracks a viewport media query. Unlike container measurement, the viewport\n * is stable while shell panels open and close, so layout decisions made on\n * it never feed back into themselves. Returns false in environments without\n * matchMedia (jsdom), which callers treat as \"wide\".\n */\nexport function useMediaQuery(query: string): boolean {\n const [matches, setMatches] = useState<boolean>(() => {\n try {\n return window.matchMedia(query).matches;\n } catch {\n return false;\n }\n });\n\n useEffect(() => {\n let mql: MediaQueryList;\n try {\n mql = window.matchMedia(query);\n } catch {\n return;\n }\n setMatches(mql.matches);\n const onChange = (e: MediaQueryListEvent) => setMatches(e.matches);\n mql.addEventListener('change', onChange);\n return () => mql.removeEventListener('change', onChange);\n }, [query]);\n\n return matches;\n}\n","import { useMemo } from 'react';\nimport { Bot, Clock, Play, Server, Wrench } from 'lucide-react';\nimport { WorkflowPill } from '../../../components/common/display/WorkflowPill';\nimport { WorkflowIcon } from '../../../components/common/display/WorkflowIcon';\nimport { identifierToTitle } from '../../../lib/identifier-label';\nimport { NamespacePill } from '../../../components/common/display/NamespacePill';\nimport type { LTWorkflowConfig, WorkflowTier } from '../../../api/types';\n\nconst NO_QUEUE_LABEL = 'No Queue';\n\n/** The queue set a filter offers — shared with the grouping below. */\nexport function workflowQueues(configs: LTWorkflowConfig[]): string[] {\n return [...new Set(configs.map((c) => c.task_queue).filter(Boolean))].sort() as string[];\n}\n\n/** One section per task queue; unqueued workflows trail under their own heading when no queue filter is active. */\nexport function groupWorkflows(\n configs: LTWorkflowConfig[],\n search: string,\n activeQueue: string | null,\n): { queue: string; workflows: LTWorkflowConfig[] }[] {\n const q = search.toLowerCase().trim();\n const matches = (c: LTWorkflowConfig) =>\n !q || c.workflow_type.toLowerCase().includes(q) || c.description?.toLowerCase().includes(q);\n\n const targetQueues = activeQueue ? [activeQueue] : workflowQueues(configs);\n const sections = targetQueues\n .map((queue) => ({ queue, workflows: configs.filter((c) => c.task_queue === queue && matches(c)) }))\n .filter((g) => g.workflows.length > 0);\n\n if (!activeQueue) {\n const noQueue = configs.filter((c) => !c.task_queue && matches(c));\n if (noQueue.length > 0) sections.push({ queue: '', workflows: noQueue });\n }\n return sections;\n}\n\n/** The first row of the unfiltered list — what the page preselects. */\nexport function firstWorkflowType(configs: LTWorkflowConfig[]): string | null {\n return groupWorkflows(configs, '', null)[0]?.workflows[0]?.workflow_type ?? null;\n}\n\nexport function WorkflowSelector({\n configs,\n selectedType,\n onSelect,\n tierMap,\n activeTypes,\n search,\n activeQueue,\n compact = false,\n}: {\n configs: LTWorkflowConfig[];\n selectedType: string;\n onSelect: (config: LTWorkflowConfig) => void;\n tierMap: Map<string, WorkflowTier>;\n activeTypes?: Set<string>;\n search: string;\n activeQueue: string | null;\n /** The narrow list column beside the form: name and tier only, headings in flow. */\n compact?: boolean;\n}) {\n const grouped = useMemo(() => groupWorkflows(configs, search, activeQueue), [configs, search, activeQueue]);\n\n if (grouped.length === 0) {\n return <p className=\"text-sm text-text-tertiary py-8 text-center\">No workflows match your filter.</p>;\n }\n\n return (\n <div className={compact ? 'space-y-6' : 'space-y-10'}>\n {grouped.map(({ queue, workflows }) => (\n <div key={queue || '__none__'}>\n <div className={`flex items-center gap-2 py-2 mb-1 border-b border-surface-border ${compact ? '' : 'sticky top-[60px] z-10 bg-surface mb-2'}`}>\n {queue ? (\n <Server className=\"w-3 h-3 text-accent shrink-0\" strokeWidth={1.5} />\n ) : (\n <Wrench className=\"w-3 h-3 text-text-quaternary shrink-0\" strokeWidth={1.5} />\n )}\n <h2 className=\"section-h2 truncate\" title={queue || undefined}>{queue ? identifierToTitle(queue) : NO_QUEUE_LABEL}</h2>\n <span className=\"text-xs text-text-quaternary\">{workflows.length}</span>\n </div>\n <div className={compact ? '' : 'divide-y divide-surface-border/30'}>\n {workflows.map((config) => (\n <WorkflowRow\n key={config.workflow_type}\n config={config}\n isSelected={selectedType === config.workflow_type}\n tier={tierMap.get(config.workflow_type) ?? 'durable'}\n cronActive={activeTypes?.has(config.workflow_type) ?? false}\n onSelect={onSelect}\n compact={compact}\n />\n ))}\n </div>\n </div>\n ))}\n </div>\n );\n}\n\nfunction WorkflowRow({\n config,\n isSelected,\n tier,\n cronActive,\n onSelect,\n compact,\n}: {\n config: LTWorkflowConfig;\n isSelected: boolean;\n tier: WorkflowTier;\n cronActive: boolean;\n onSelect: (config: LTWorkflowConfig) => void;\n compact: boolean;\n}) {\n const variant = tier === 'certified' ? 'certified' : tier === 'registered' ? 'registered' : 'durable';\n\n if (compact) {\n return (\n <button\n onClick={() => onSelect(config)}\n aria-current={isSelected ? 'true' : undefined}\n title={config.workflow_type}\n className={`group w-full text-left flex items-center gap-2.5 pl-3 pr-2 py-2 border-l-2 transition-colors ${\n isSelected ? 'border-accent bg-accent/10 text-accent' : 'border-transparent text-text-primary hover:bg-surface-hover'\n }`}\n >\n <WorkflowIcon icon={config.icon} tier={tier} className={`w-5 h-5 shrink-0 ${isSelected ? 'text-accent' : 'text-accent/65'}`} />\n <span className=\"text-sm truncate\">{identifierToTitle(config.workflow_type)}</span>\n {cronActive && (\n <span title=\"Cron schedule active\" className=\"ml-auto shrink-0\">\n <Clock className=\"w-3 h-3 text-status-success/70\" />\n </span>\n )}\n </button>\n );\n }\n\n return (\n <button\n onClick={() => onSelect(config)}\n className=\"group relative w-full text-left py-2 px-3 -mx-3 rounded-md hover:bg-surface-hover/30 transition-colors duration-150\"\n >\n {isSelected && (\n <span className=\"absolute left-0 top-1 bottom-1 w-0.5 bg-accent rounded-full\" />\n )}\n <div className=\"flex items-center gap-3\">\n <WorkflowPill type={config.workflow_type} size=\"md\" variant={variant} />\n {config.description && (\n <p className=\"flex-1 min-w-0 truncate text-2xs text-text-tertiary group-hover:text-text-secondary transition-colors\">\n {config.description}\n </p>\n )}\n <span className=\"ml-auto flex items-center gap-2 shrink-0\">\n {config.execute_as && (\n <span className=\"inline-flex items-center gap-0.5 px-1.5 py-0.5 text-2xs bg-accent/10 text-accent rounded\">\n <Bot className=\"w-2.5 h-2.5\" />\n {config.execute_as}\n </span>\n )}\n {cronActive && (\n <span title=\"Cron schedule active\">\n <Clock className=\"w-3 h-3 text-status-success/70 shrink-0\" />\n </span>\n )}\n <NamespacePill namespace=\"durable\" />\n <span title=\"Configure & invoke\">\n <Play\n className={`w-3 h-3 transition-opacity ${\n isSelected ? 'text-accent opacity-100' : 'text-accent opacity-0 group-hover:opacity-100'\n }`}\n strokeWidth={1.5}\n />\n </span>\n </span>\n </div>\n </button>\n );\n}\n","import { Bot, UserCircle } from 'lucide-react';\nimport { BotPicker } from '../../../components/common/form/BotPicker';\nimport { useAuth } from '../../../hooks/useAuth';\nimport type { LTWorkflowConfig } from '../../../api/types';\n\nexport function IdentitySummary({\n config,\n overrideBot,\n onOverrideChange,\n showOverride,\n}: {\n config: LTWorkflowConfig;\n overrideBot?: string;\n onOverrideChange?: (botExternalId: string) => void;\n showOverride?: boolean;\n}) {\n const { user } = useAuth();\n const effectiveBot = overrideBot || config.execute_as;\n\n return (\n <div className=\"bg-surface-sunken rounded-lg px-4 py-3 space-y-3\">\n <div>\n <div className=\"flex items-center justify-between mb-1\">\n <span className=\"text-2xs text-text-tertiary uppercase tracking-wider font-medium\">Running as</span>\n {effectiveBot && !overrideBot && (\n <span className=\"text-2xs text-text-tertiary\">configured default</span>\n )}\n {overrideBot && (\n <span className=\"text-2xs text-accent\">admin override</span>\n )}\n </div>\n {/* Read-only identity, styled as a field so it reads consistently with\n the Override control below and pops off the sunken band. */}\n <div className=\"field flex items-center gap-1.5\">\n {effectiveBot ? (\n <>\n <Bot className=\"w-3.5 h-3.5 text-accent/70 shrink-0\" />\n <span className=\"text-xs text-text-primary font-mono\">{effectiveBot}</span>\n </>\n ) : (\n <>\n <UserCircle className=\"w-3.5 h-3.5 text-text-tertiary shrink-0\" />\n <span className=\"text-xs text-text-primary\">\n {user?.displayName || user?.username || 'you'}\n </span>\n </>\n )}\n </div>\n </div>\n {showOverride && onOverrideChange && (\n <div>\n <label className=\"text-2xs text-text-tertiary uppercase tracking-wider font-medium mb-1 block\">Override identity</label>\n <BotPicker\n selected={overrideBot ?? ''}\n onChange={onOverrideChange}\n placeholder={config.execute_as ? `Default: ${config.execute_as}` : 'Invoking user (default)'}\n />\n </div>\n )}\n </div>\n );\n}\n","import { useEffect, useMemo, useState } from 'react';\nimport { lookupLabel } from '../../../lib/lookup-label';\nimport { AlertTriangle, ShieldCheck } from 'lucide-react';\nimport { useAuth } from '../../../hooks/useAuth';\nimport { foldWorkflowLookups, useWorkflowLookups } from '../../../api/workflows';\nimport type { InvocableWorkflow } from '../../../api/types';\nimport { WorkflowIcon } from '../../../components/common/display/WorkflowIcon';\nimport { MarkdownRenderer } from '../../../components/common/display/MarkdownRenderer';\nimport { identifierToTitle } from '../../../lib/identifier-label';\nimport { IdentitySummary } from './IdentitySummary';\nimport { LegacyInvokeForm } from './LegacyInvokeForm';\nimport { RichInvokeForm } from './RichInvokeForm';\nimport { useInvokeSubmit } from './use-invoke-submit';\n\n/**\n * The form column. The workflow's name is the column's heading and stays\n * put; Start stays put at the bottom; description, identity, options, and\n* the fields scroll between them. A declared input_schema renders the\n * x-lt-* form, with pinned input_lookups resolved into its lookup domain;\n * otherwise the envelope template form.\n */\nexport function StartNowPanel({ selected }: { selected: InvocableWorkflow }) {\n const { isSuperAdmin, hasRoleType } = useAuth();\n const isAdmin = isSuperAdmin || hasRoleType('admin');\n const [overrideBot, setOverrideBot] = useState('');\n // Per-run interceptor opt-out, offered when the registration is certified.\n const [certified, setCertified] = useState(selected.certified);\n\n useEffect(() => {\n setOverrideBot('');\n setCertified(selected.certified);\n }, [selected.workflow_type, selected.certified]);\n\n const metadata = useMemo(() => {\n const md = selected.envelope_schema?.metadata;\n return md && typeof md === 'object' ? (md as Record<string, unknown>) : {};\n }, [selected.envelope_schema]);\n\n const hasLookups = Array.isArray(selected.input_lookups) && selected.input_lookups.length > 0;\n const { data: lookupData } = useWorkflowLookups(selected.workflow_type, hasLookups);\n const lookup = useMemo(() => (lookupData ? foldWorkflowLookups(lookupData.lookups) : undefined), [lookupData]);\n const missingLookups = lookupData?.lookups.filter((l) => l.missing) ?? [];\n\n const submission = useInvokeSubmit(selected, { certified, overrideBot });\n\n const lead = (\n <>\n {selected.description && (\n <MarkdownRenderer content={selected.description} className=\"text-xs text-text-secondary leading-relaxed\" />\n )}\n <IdentitySummary\n config={selected}\n overrideBot={overrideBot}\n onOverrideChange={setOverrideBot}\n showOverride={isAdmin}\n />\n {selected.certified && (\n <label className=\"flex items-center gap-2 cursor-pointer\">\n <input\n type=\"checkbox\"\n checked={certified}\n onChange={(e) => setCertified(e.target.checked)}\n className=\"rounded border-surface-border text-accent focus:ring-accent/30\"\n />\n <ShieldCheck className=\"w-3.5 h-3.5 text-text-tertiary\" />\n <span className=\"text-xs text-text-secondary\">Enable task tracking and escalation routing</span>\n </label>\n )}\n </>\n );\n\n return (\n <div className=\"max-w-form\" data-testid=\"invoke-form\">\n {/* Sticks to the top of the shell scroll; the pulled-up padding covers the page gutter above it. */}\n <header className=\"sticky top-0 z-10 bg-surface -mt-8 pt-8 flex items-baseline gap-3 min-w-0 pb-3 mb-5 border-b border-surface-border/60\">\n <WorkflowIcon icon={selected.icon} tier={selected.tier} className=\"w-7 h-7 self-center shrink-0 text-accent\" />\n <h2 className=\"heading-2 truncate\" title={selected.workflow_type}>\n {identifierToTitle(selected.workflow_type)}\n </h2>\n <span className=\"text-2xs font-mono text-text-quaternary shrink-0\">{selected.workflow_type}</span>\n <span className=\"text-2xs uppercase tracking-widest text-text-tertiary shrink-0\">{selected.tier}</span>\n {selected.task_queue && (\n <span className=\"text-2xs font-mono text-text-quaternary truncate\">{selected.task_queue}</span>\n )}\n </header>\n\n {missingLookups.length > 0 && (\n <p className=\"flex items-center gap-1.5 text-2xs text-status-warning mb-4\" data-testid=\"lookup-missing\">\n <AlertTriangle className=\"w-3 h-3 shrink-0\" strokeWidth={1.5} />\n {missingLookups.map(lookupLabel).join(', ')} {missingLookups.length === 1 ? 'is' : 'are'} not available; the fields that read {missingLookups.length === 1 ? 'it' : 'them'} fall back to plain inputs.\n </p>\n )}\n\n {selected.input_schema ? (\n <RichInvokeForm selected={selected} schema={selected.input_schema} metadata={metadata} lookup={lookup} submission={submission} lead={lead} />\n ) : (\n <LegacyInvokeForm selected={selected} metadata={metadata} submission={submission} lead={lead} />\n )}\n </div>\n );\n}\n","import { useCallback, useEffect, useMemo, useState } from 'react';\nimport { useSearchParams } from 'react-router-dom';\nimport { useInvocableWorkflows, useCronStatus } from '../../../api/workflows';\nimport { PageHeader } from '../../../components/common/layout/PageHeader';\nimport { FilterSelect, FilterInput } from '../../../components/common/data/FilterBar';\nimport { useMediaQuery } from '../../../hooks/useMediaQuery';\nimport type { InvocableWorkflow, WorkflowTier } from '../../../api/types';\nimport { WorkflowSelector, workflowQueues, firstWorkflowType } from './WorkflowSelector';\nimport { identifierToTitle } from '../../../lib/identifier-label';\nimport { StartNowPanel } from './StartNowPanel';\n\nconst TYPE_PARAM = 'type';\n// A few dozen workflows read fine grouped by queue; the filters wait for scale to demand them.\nconst LIST_FILTERS_VISIBLE = false;\n\n/**\n * Invoke — the list of workflows the caller may run beside the form for the\n * one chosen. The list is grouped by queue and takes a quarter of the row;\n * the form takes the rest. Selection lives in `?type=`, and the first row\n * is preselected so the page opens on a form, never on an empty column.\n */\nexport function StartWorkflowPage() {\n const [searchParams, setSearchParams] = useSearchParams();\n const { data: invocable, isLoading } = useInvocableWorkflows();\n const { data: cronEntries } = useCronStatus();\n // Below xl the list and the form cannot share the row: the list folds\n // into a select and the form takes the full width.\n const compact = useMediaQuery('(max-width: 1279px)');\n\n const selectedType = searchParams.get(TYPE_PARAM) ?? '';\n const [search, setSearch] = useState('');\n const [activeQueue, setActiveQueue] = useState<string | null>(null);\n\n const workflows: InvocableWorkflow[] = invocable ?? [];\n const tierMap = useMemo(() => {\n const map = new Map<string, WorkflowTier>();\n for (const w of workflows) map.set(w.workflow_type, w.tier);\n return map;\n }, [workflows]);\n const selected = workflows.find((c) => c.workflow_type === selectedType);\n const activeTypes = new Set((cronEntries ?? []).filter((e) => e.active).map((e) => e.workflow_type));\n\n // A user's choice is a history entry; the opening preselect only rewrites the landing URL.\n const setType = useCallback(\n (value: string | null, opts: { replace?: boolean } = {}) => {\n setSearchParams(\n (prev) => {\n const next = new URLSearchParams(prev);\n if (value) next.set(TYPE_PARAM, value);\n else next.delete(TYPE_PARAM);\n return next;\n },\n { replace: opts.replace ?? false },\n );\n },\n [setSearchParams],\n );\n\n useEffect(() => {\n if (searchParams.get(TYPE_PARAM) || workflows.length === 0) return;\n const first = firstWorkflowType(workflows);\n if (first) setType(first, { replace: true });\n }, [workflows, searchParams, setType]);\n\n if (isLoading) {\n return (\n <div className=\"animate-pulse space-y-4\">\n <div className=\"h-8 bg-surface-sunken rounded w-48\" />\n <div className=\"h-40 bg-surface-sunken rounded\" />\n </div>\n );\n }\n\n const queues = workflowQueues(workflows);\n const form = selected\n ? <StartNowPanel selected={selected} />\n : <p className=\"text-xs text-text-tertiary\">Choose a tool to begin.</p>;\n\n return (\n <div>\n <PageHeader title=\"Invoke Tool\" docsHash=\"#docs:dashboard.md:invoke-tool\" />\n\n {workflows.length === 0 ? (\n <div className=\"py-16 text-center\">\n <p className=\"text-sm text-text-primary mb-1\">No tools to invoke</p>\n <p className=\"text-xs text-text-tertiary\">Mark workflows as invocable in the registry, or start the server with examples enabled.</p>\n </div>\n ) : compact ? (\n <>\n <label className=\"block mb-6 max-w-2xl\">\n <span className=\"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1\">Tool</span>\n <select\n value={selectedType}\n onChange={(e) => setType(e.target.value || null)}\n className=\"select text-xs font-mono w-full\"\n >\n <option value=\"\">Choose a tool…</option>\n {queues.map((q) => (\n <optgroup key={q} label={identifierToTitle(q)}>\n {workflows\n .filter((c) => (c.task_queue || '') === q)\n .map((c) => (\n <option key={c.workflow_type} value={c.workflow_type}>{identifierToTitle(c.workflow_type)}</option>\n ))}\n </optgroup>\n ))}\n {workflows\n .filter((c) => !c.task_queue)\n .map((c) => (\n <option key={c.workflow_type} value={c.workflow_type}>{identifierToTitle(c.workflow_type)}</option>\n ))}\n </select>\n </label>\n {/* The form heading pulls itself up over the page gutter when stuck; give it that room here so it never covers the picker. */}\n <div className=\"pt-8\">{form}</div>\n </>\n ) : (\n <div className=\"flex gap-10 items-start\">\n {/* The page scrolls as a whole; the list column and the form's title and Start stick while the title of the page rides away. */}\n <aside className=\"w-1/4 min-w-[15rem] shrink-0 sticky top-0 self-start -mt-8 pt-8 max-h-[calc(100vh-5rem)] overflow-y-auto pr-1 space-y-4\" data-testid=\"invoke-list\">\n {LIST_FILTERS_VISIBLE && <div className=\"flex flex-col gap-3\">\n {queues.length > 1 && (\n <FilterSelect\n label=\"Queue\"\n value={activeQueue ?? ''}\n onChange={(v) => setActiveQueue(v || null)}\n options={queues.map((q) => ({ value: q, label: q }))}\n />\n )}\n <FilterInput\n label=\"Search\"\n value={search}\n onChange={setSearch}\n placeholder={`${workflows.length} workflows…`}\n />\n </div>}\n <WorkflowSelector\n configs={workflows}\n selectedType={selectedType}\n onSelect={(c) => setType(c.workflow_type)}\n tierMap={tierMap}\n activeTypes={activeTypes}\n search={search}\n activeQueue={activeQueue}\n compact\n />\n </aside>\n <section className=\"flex-1 min-w-0\">{form}</section>\n </div>\n )}\n </div>\n );\n}\n","import { StartWorkflowPage } from './StartWorkflowPage';\n\nexport function DurableInvokePage() {\n return <StartWorkflowPage />;\n}\n"],"names":["useMediaQuery","query","matches","setMatches","useState","useEffect","mql","onChange","e","NO_QUEUE_LABEL","workflowQueues","configs","c","groupWorkflows","search","activeQueue","q","_a","sections","queue","g","noQueue","firstWorkflowType","_b","WorkflowSelector","selectedType","onSelect","tierMap","activeTypes","compact","grouped","useMemo","jsx","workflows","jsxs","Server","Wrench","identifierToTitle","config","WorkflowRow","isSelected","tier","cronActive","variant","WorkflowIcon","Clock","WorkflowPill","Bot","NamespacePill","Play","IdentitySummary","overrideBot","onOverrideChange","showOverride","user","useAuth","effectiveBot","Fragment","UserCircle","BotPicker","StartNowPanel","selected","isSuperAdmin","hasRoleType","isAdmin","setOverrideBot","certified","setCertified","metadata","md","hasLookups","lookupData","useWorkflowLookups","lookup","foldWorkflowLookups","missingLookups","l","submission","useInvokeSubmit","lead","MarkdownRenderer","ShieldCheck","AlertTriangle","lookupLabel","RichInvokeForm","LegacyInvokeForm","TYPE_PARAM","LIST_FILTERS_VISIBLE","StartWorkflowPage","searchParams","setSearchParams","useSearchParams","invocable","isLoading","useInvocableWorkflows","cronEntries","useCronStatus","setSearch","setActiveQueue","map","w","setType","useCallback","value","opts","prev","next","first","queues","form","PageHeader","DurableInvokePage"],"mappings":"qsBAQO,SAASA,EAAcC,EAAwB,CACpD,KAAM,CAACC,EAASC,CAAU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AU,iBAAkB,SAAA6E,CAAA,CAAK,CAAA,CAAA,CAC5C,CAAA,EAEJ,CAEJ,CCtJO,SAASE,IAAoB,CAClC,aAAQvB,GAAA,EAAkB,CAC5B"}
@@ -1,2 +1,2 @@
1
- import{a as o,j as e}from"./vendor-query-DvWWuNIB.js";import{P as Ne}from"./PageHeader-CMd3f4bz.js";import{F as ve,a as we}from"./FilterBar-D-6xVHIw.js";import{L as ke}from"./ListToolbar-_jWTw5no.js";import{S as Se}from"./StickyPagination-DsdtYoXR.js";import{E as oe}from"./EmptyState-DgC_6njU.js";import{D as Ce}from"./DropZone-B1Tdfddc.js";import{T as H}from"./TimeAgo-C-rd9F9g.js";import{u as Pe,a as Ee,b as pe,c as De,d as Ae,e as Fe,f as Oe,g as ge,h as Ke}from"./knowledge-BhW8V-Hq.js";import{e as Je}from"./index-BUYokcrl.js";import{T as Te}from"./TagInput-CAgdLN_b.js";import{aB as Le,z as Ve,X as _e,g as ce,o as le,e as de,q as xe,bU as me}from"./vendor-icons-CeVtUKyP.js";import{f as fe,b as Re}from"./vendor-react-_9U4mKFr.js";function We(a){return a==null?"":typeof a=="string"?a:JSON.stringify(a,null,2)}function ue(a){const n=a.trim();if(!n)return{value:"",looksLikeJson:!1,parsedOk:!1};const l=n.startsWith("{")||n.startsWith("[");try{return{value:JSON.parse(n),looksLikeJson:l,parsedOk:!0}}catch{return{value:n,looksLikeJson:l,parsedOk:!1}}}function he(a){if(typeof a=="string"){const n=a.trim();return!(n.startsWith("{")&&n.endsWith("}")||n.startsWith("[")&&n.endsWith("]"))}return typeof a=="number"||typeof a=="boolean"||a===null}function q({value:a,onChange:n,onKeyDown:l,placeholder:r,mono:m}){const u=o.useRef(null);return o.useEffect(()=>{u.current&&(u.current.style.height="auto",u.current.style.height=`${u.current.scrollHeight}px`,u.current.focus())},[a]),e.jsx("textarea",{ref:u,value:a,onChange:N=>n(N.target.value),onKeyDown:l,placeholder:r,rows:1,className:`w-full bg-transparent text-xs text-text-primary resize-none outline-none p-0 ${m?"font-mono":""}`,style:{minHeight:"1.5em"}})}function $e({domain:a,entryKey:n,onDeleted:l}){var re,ne,ie;const{data:r,isLoading:m,refetch:u}=Pe(a,n),N=Ee(),h=pe(),A=De(),k=Ae(),[S,F]=o.useState(!1),[p,g]=o.useState(null),[C,f]=o.useState(""),[j,E]=o.useState(""),[P,i]=o.useState(""),[D,O]=o.useState(null),[R,T]=o.useState(null),[K,v]=o.useState(!1),[B,z]=fe(),G=((re=Fe(a,n,!!r&&r.found!==!1).data)==null?void 0:re.versions)??[],L=B.get("version"),V=L&&/^[0-9]+$/.test(L)?parseInt(L,10):null,J=V!=null&&r&&V!==r.current_version?V:null,s=J!=null,d=Oe(a,n,J),w=o.useCallback((t,x)=>{z(y=>{const b=new URLSearchParams(y);return t===x?b.delete("version"):b.set("version",String(t)),b},{replace:!0})},[z]),c=s?(ne=d.data)==null?void 0:ne.data:r==null?void 0:r.data,I=c?Object.entries(c):[],je=o.useMemo(()=>{const t=j.trim().toLowerCase();return t?I.filter(([x])=>x.toLowerCase().includes(t)):I},[I,j]),Y=o.useCallback((t,x)=>x==="field"?t:We(c==null?void 0:c[t]),[c]),Z=p?C!==Y(p.field,p.column):!1;function X(t,x){s||(g({field:t,column:x}),f(Y(t,x)),O(null))}function M(){g(null),f("")}function ee(){T("Invalid JSON — saved as text"),setTimeout(()=>T(null),4e3)}async function U(){if(!p||!c)return;const{field:t,column:x}=p;if(x==="value"){const{value:y,looksLikeJson:b,parsedOk:W}=ue(C);b&&!W&&ee(),await A.mutateAsync({domain:a,key:n,path:t,value:y})}else{const y=C.trim();if(!y||y===t){M();return}const b=c[t];await k.mutateAsync({domain:a,key:n,path:t}),await A.mutateAsync({domain:a,key:n,path:y,value:b})}g(null),f(""),u()}async function ye(t){await k.mutateAsync({domain:a,key:n,path:t}),O(null),g(null),u()}async function be(t){await h.mutateAsync({domain:a,key:n,data:c||{},tags:t,replace:!0}),u()}async function te(){const t=j.trim();if(!t)return;const{value:x,looksLikeJson:y,parsedOk:b}=ue(P);y&&!b&&ee();const W={...c,[t]:x||""};await h.mutateAsync({domain:a,key:n,data:W}),E(""),i(""),u()}function se(t){t.key==="Escape"?M():t.key==="Enter"&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),U())}function ae(t){t.key==="Escape"?(E(""),i("")):t.key==="Enter"&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),te())}return m?e.jsxs("div",{className:"animate-pulse space-y-3 mt-4",children:[e.jsx("div",{className:"h-4 bg-surface-sunken rounded w-1/3"}),e.jsx("div",{className:"h-48 bg-surface-sunken rounded"})]}):!r||r.found===!1?e.jsx("p",{className:"text-sm text-text-tertiary mt-4",children:"Entry not found."}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("div",{className:"flex items-center gap-4 min-h-[28px]",children:K?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Te,{tags:r.tags||[],onChange:t=>{be(t)},placeholder:"Add tag...",compact:!0}),e.jsx("button",{onClick:()=>v(!1),className:"text-2xs text-text-tertiary hover:text-text-secondary shrink-0",children:"Done"})]}):e.jsx("div",{className:"flex items-center gap-1 cursor-text group",onClick:()=>v(!0),title:"Click to edit tags",children:r.tags&&r.tags.length>0?r.tags.map(t=>e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-2xs font-medium bg-accent/10 text-accent",children:t},t)):e.jsx("span",{className:"text-2xs text-text-tertiary/40 italic group-hover:text-text-tertiary",children:"add tags..."})})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(Le,{className:"w-3 h-3 text-accent/75 shrink-0",strokeWidth:1.5}),e.jsx("select",{value:String(J??r.current_version),onChange:t=>w(parseInt(t.target.value,10),r.current_version),title:"Version history","aria-label":"Version history",className:"select text-2xs py-1",children:(G.length>0?G:[{version:r.current_version,is_current:!0}]).map(t=>e.jsxs("option",{value:String(t.version),children:["v",t.version,t.is_current?" · current":""]},t.version))})]}),e.jsx("span",{className:"text-2xs text-text-tertiary",children:e.jsx(H,{date:r.updated_at})}),S?e.jsxs("span",{className:"flex items-center gap-2 text-2xs",children:[e.jsx("span",{className:"text-status-error",children:"Delete entry?"}),e.jsx("button",{onClick:async()=>{try{await N.mutateAsync({domain:a,key:n}),l()}catch{}},className:"font-medium text-status-error hover:text-status-error/80",disabled:N.isPending,children:N.isPending?"Deleting...":"Yes"}),e.jsx("button",{onClick:()=>F(!1),className:"text-text-tertiary hover:text-text-secondary",children:"No"})]}):e.jsx("button",{onClick:()=>F(!0),className:"text-text-tertiary/50 hover:text-status-error transition-colors",title:"Delete entry",children:e.jsx(Ve,{className:"w-3.5 h-3.5"})})]})]}),s&&e.jsxs("div",{className:"flex items-center gap-2 mb-2 px-1 text-2xs",children:[e.jsxs("span",{className:"text-text-secondary",children:["Viewing ",e.jsxs("span",{className:"font-mono font-medium",children:["v",J]})," — an immutable edition",((ie=d.data)==null?void 0:ie.created_at)&&e.jsxs(e.Fragment,{children:[" from ",e.jsx(H,{date:d.data.created_at})]})]}),e.jsx("button",{onClick:()=>w(r.current_version,r.current_version),className:"font-medium text-accent hover:text-accent-hover",children:"Back to current"})]}),R&&e.jsxs("div",{className:"flex items-center justify-end gap-2 mb-2 px-1",children:[e.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full dot-ring bg-status-warning animate-pulse"}),e.jsx("span",{className:"text-xs text-status-warning",children:R})]}),e.jsxs("table",{className:"w-full border-collapse",children:[e.jsxs("thead",{className:"sticky top-0 z-10 bg-surface",children:[e.jsxs("tr",{className:"text-left text-2xs uppercase tracking-wider text-text-tertiary border-b border-surface-border",children:[e.jsx("th",{className:"px-3 py-2 font-medium w-[200px] border-r border-surface-border",children:"Field"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"Value"})]}),!s&&e.jsxs("tr",{className:"border-b border-surface-border bg-surface",children:[e.jsx("td",{className:"px-3 py-2 align-top border-r border-surface-border",children:e.jsx("input",{value:j,onChange:t=>E(t.target.value),onKeyDown:ae,placeholder:I.length?"add or filter...":"new field",className:"w-full bg-transparent text-xs text-text-primary placeholder:text-text-tertiary/40 placeholder:italic outline-none p-0"})}),e.jsxs("td",{className:"px-3 py-2 align-top",children:[e.jsx(q,{value:P,onChange:i,onKeyDown:ae,placeholder:"value"}),j.trim()&&e.jsxs("div",{className:"flex gap-2 mt-1.5",children:[e.jsx("button",{onClick:te,className:"text-2xs font-medium text-accent hover:text-accent-hover",disabled:h.isPending,children:h.isPending?"Saving...":"Save"}),e.jsx("button",{onClick:()=>{E(""),i("")},className:"text-2xs text-text-tertiary hover:text-text-secondary",children:"Cancel"})]})]})]})]}),e.jsx("tbody",{children:je.map(([t,x])=>{const y=(p==null?void 0:p.field)===t&&p.column==="field",b=(p==null?void 0:p.field)===t&&p.column==="value",W=y||b,_=D===t;return e.jsxs("tr",{className:`border-b border-surface-border ${_?"bg-status-error/10":W?"":"hover:bg-surface-hover/30"}`,children:[e.jsx("td",{className:`px-3 py-2 align-top border-r cursor-text ${_?"bg-transparent border-r-transparent":y?"border-r-surface-border bg-accent/5 border-l-2 border-l-accent":"border-r-surface-border"}`,onClick:()=>!y&&!_&&X(t,"field"),children:y?e.jsxs("div",{children:[e.jsx(q,{value:C,onChange:f,onKeyDown:se,placeholder:"field name"}),Z&&e.jsxs("div",{className:"flex gap-2 mt-1.5",children:[e.jsx("button",{onClick:U,className:"text-2xs font-medium text-accent hover:text-accent-hover",disabled:h.isPending,children:h.isPending?"Saving...":"Save"}),e.jsx("button",{onClick:M,className:"text-2xs text-text-tertiary hover:text-text-secondary",children:"Cancel"})]})]}):e.jsx("span",{className:"text-xs font-medium text-text-secondary break-all",children:t})}),e.jsx("td",{className:`px-3 py-2 align-top cursor-text ${_?"bg-transparent":b?"bg-accent/5 border-l-2 border-l-accent":""}`,onClick:()=>!b&&!_&&X(t,"value"),children:_?e.jsxs("span",{className:"flex items-center justify-end gap-2 text-2xs",children:[e.jsxs("span",{className:"text-status-error",children:["Remove ",e.jsx("span",{className:"font-medium",children:t}),"?"]}),e.jsx("button",{onClick:$=>{$.stopPropagation(),ye(t)},className:"font-medium text-status-error hover:text-status-error/80",disabled:h.isPending,children:h.isPending?"...":"Yes"}),e.jsx("button",{onClick:$=>{$.stopPropagation(),O(null)},className:"text-text-tertiary hover:text-text-secondary",children:"No"})]}):b?e.jsxs("div",{children:[e.jsx(q,{value:C,onChange:f,onKeyDown:se,placeholder:"value (string or JSON)",mono:!he(x)}),e.jsxs("div",{className:"flex gap-2 mt-1.5",children:[Z&&e.jsx("button",{onClick:U,className:"text-2xs font-medium text-accent hover:text-accent-hover",disabled:h.isPending,children:h.isPending?"Saving...":"Save"}),e.jsx("button",{onClick:M,className:"text-2xs text-text-tertiary hover:text-text-secondary",children:"Cancel"}),e.jsx("button",{onClick:$=>{$.stopPropagation(),O(t)},className:"text-2xs text-status-error/50 hover:text-status-error ml-auto",children:"Remove"})]})]}):he(x)?e.jsx("p",{className:"text-xs text-text-primary break-words whitespace-pre-wrap",children:String(x)}):e.jsx("pre",{className:"text-xs text-text-primary font-mono whitespace-pre-wrap break-words",children:typeof x=="string"?x:JSON.stringify(x,null,2)})})]},t)})})]})]})}function ze({open:a,onClose:n,onCreated:l,prefillData:r,prefillDomain:m}){const{data:u}=ge(),N=pe(),[h,A]=o.useState(m||""),[k,S]=o.useState(""),[F,p]=o.useState(r?JSON.stringify(r,null,2):"{}"),[g,C]=o.useState(""),[f,j]=o.useState(""),E=((u==null?void 0:u.domains)??[]).map(i=>i.domain);if(o.useEffect(()=>{a&&(p(r?JSON.stringify(r,null,2):"{}"),A(m||""),S(""),C(""),j(""))},[a,r,m]),!a)return null;const P=async()=>{if(j(""),!h.trim()){j("Domain is required");return}if(!k.trim()){j("Key is required");return}let i;try{if(i=JSON.parse(F),typeof i!="object"||Array.isArray(i))throw new Error}catch{j("Data must be a valid JSON object");return}try{await N.mutateAsync({domain:h.trim(),key:k.trim(),data:i,tags:g?g.split(",").map(D=>D.trim()).filter(Boolean):[]}),l==null||l(h.trim(),k.trim()),n()}catch(D){j(D.message)}};return Re.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:n}),e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-6 overflow-y-auto",children:e.jsxs("div",{className:"bg-surface-raised border border-surface-border rounded-lg shadow-lg w-full max-w-md max-h-[85vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-surface-border",children:[e.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"New Knowledge Entry"}),e.jsx("button",{onClick:n,className:"text-text-tertiary hover:text-text-primary",children:e.jsx(_e,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"px-5 py-4 space-y-4 overflow-y-auto flex-1 min-h-0",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Domain"}),e.jsx("input",{type:"text",list:"domain-list",value:h,onChange:i=>A(i.target.value),placeholder:"e.g., screenshots, config, emails",className:"input text-xs w-full"}),e.jsx("datalist",{id:"domain-list",children:E.map(i=>e.jsx("option",{value:i},i))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Key"}),e.jsx("input",{type:"text",value:k,onChange:i=>S(i.target.value),placeholder:"e.g., homepage, user-profile, report-2026",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Data (JSON)"}),e.jsx("textarea",{value:F,onChange:i=>p(i.target.value),rows:8,className:"input-json w-full max-h-[30vh]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Tags (comma-separated)"}),e.jsx("input",{type:"text",value:g,onChange:i=>C(i.target.value),placeholder:"e.g., important, review, 401k",className:"input text-xs w-full"})]}),f&&e.jsx("p",{className:"text-xs text-status-error",children:f})]}),e.jsxs("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-surface-border",children:[e.jsx("button",{onClick:n,className:"btn-ghost text-xs",children:"Cancel"}),e.jsx("button",{onClick:P,disabled:N.isPending,className:"btn-primary text-xs",children:N.isPending?"Creating...":"Create Entry"})]})]})})]}),document.body)}const Ie=50;function at(){var L,V,J;const[a,n]=fe(),l=a.get("domain")||"",r=a.get("key")||"",[m,u]=o.useState(""),[N,h]=o.useState(""),[A,k]=o.useState(1),[S,F]=o.useState(Ie),[p,g]=o.useState(!1),[C,f]=o.useState(),j=o.useCallback(s=>{console.debug("[Knowledge] drop received:",s.map(c=>({name:c.name,type:c.type,size:c.size})));const d=s.find(c=>c.name.endsWith(".json")||c.type==="application/json");if(!d){console.warn("[Knowledge] no JSON file found in dropped files");return}console.debug("[Knowledge] reading:",d.name);const w=new FileReader;w.onload=()=>{try{const c=JSON.parse(w.result);typeof c=="object"&&!Array.isArray(c)?(console.debug("[Knowledge] parsed object with keys:",Object.keys(c)),f(c),g(!0)):console.warn("[Knowledge] JSON is not a plain object, got:",Array.isArray(c)?"array":typeof c)}catch(c){console.warn("[Knowledge] JSON parse failed:",c)}},w.readAsText(d)},[]);o.useEffect(()=>{const s=setTimeout(()=>{h(m),k(1)},Je);return()=>clearTimeout(s)},[m]);const E=(A-1)*S,P=ge(),i=Ke(l,{search:N||void 0,limit:S,offset:E}),D=((L=P.data)==null?void 0:L.domains)??[],O=((V=i.data)==null?void 0:V.entries)??[],R=((J=i.data)==null?void 0:J.total)??0,T=o.useMemo(()=>{if(!m)return D;const s=m.toLowerCase();return D.filter(d=>d.domain.toLowerCase().includes(s))},[D,m]);function K(s,d){u(""),h(""),k(1);const w={};s&&(w.domain=s),d&&(w.key=d),n(w)}const v=r?"entry":l?"entries":"domains",B=v==="entries"?i.isLoading:v==="domains"?P.isLoading:!1,z=Math.ceil((v==="entries"?R:T.length)/S),Q=l?`/knowledge/entries?domain=${encodeURIComponent(l)}&limit=${S}&offset=${E}${N?`&search=${encodeURIComponent(N)}`:""}`:void 0;return e.jsxs(Ce,{onDrop:j,label:"Drop a JSON file to create an entry",accept:".json,application/json",children:[e.jsxs("div",{children:[e.jsx(Ne,{title:"Knowledge Base",docsHash:"#docs:dashboard.md:knowledge",actions:e.jsxs("button",{onClick:()=>{f(void 0),g(!0)},className:"btn-primary text-xs inline-flex items-center gap-1.5",children:[e.jsx(ce,{className:"w-3.5 h-3.5"}),"New Entry"]})}),e.jsxs("nav",{className:"flex items-center gap-1 text-sm mb-6 min-h-[28px]",children:[e.jsxs("button",{onClick:()=>K(""),className:`flex items-center gap-1.5 px-1.5 py-0.5 rounded transition-colors ${v==="domains"?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsx(le,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),e.jsx("span",{children:"All Domains"})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx(de,{className:"w-3.5 h-3.5 text-text-tertiary"}),e.jsxs("button",{onClick:()=>K(l),className:`flex items-center gap-1.5 px-1.5 py-0.5 rounded transition-colors ${v==="entries"?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsx(xe,{className:"w-3.5 h-3.5 text-accent/60",strokeWidth:1.5}),l]})]}),r&&e.jsxs(e.Fragment,{children:[e.jsx(de,{className:"w-3.5 h-3.5 text-text-tertiary"}),e.jsxs("span",{className:"flex items-center gap-1.5 px-1.5 py-0.5 text-text-primary font-medium",children:[e.jsx(me,{className:"w-3.5 h-3.5 text-accent/60",strokeWidth:1.5}),r]})]})]}),v==="entry"?e.jsx($e,{domain:l,entryKey:r,onDeleted:()=>K(l)}):e.jsxs(e.Fragment,{children:[e.jsx(ve,{actions:e.jsx(ke,{onRefresh:()=>v==="entries"?i.refetch():P.refetch(),isFetching:v==="entries"?i.isFetching:P.isFetching,apiPath:v==="entries"?Q:"/knowledge/domains"}),children:e.jsx(we,{label:"Search",value:m,onChange:u,placeholder:l?"Filter by key or tag...":"Filter by domain..."})}),B?e.jsx("div",{className:"animate-pulse space-y-2 mt-4",children:Array.from({length:6}).map((s,d)=>e.jsx("div",{className:"h-10 bg-surface-sunken rounded"},d))}):v==="domains"?T.length===0?e.jsx("div",{className:"cursor-pointer",onClick:()=>{f(void 0),g(!0)},children:e.jsx(oe,{icon:le,title:m?"No matching domains":"Knowledge Base Empty",description:m?void 0:"Create your first entry or drop a JSON file"})}):e.jsxs("table",{className:"w-full mt-2",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-2xs uppercase tracking-wider text-text-tertiary",children:[e.jsx("th",{className:"pb-2 pl-2 font-medium",children:"Domain"}),e.jsx("th",{className:"pb-2 font-medium w-24 text-right",children:"Entries"}),e.jsx("th",{className:"pb-2 pr-2 font-medium w-40 text-right",children:"Latest"})]})}),e.jsx("tbody",{children:T.map(s=>e.jsxs("tr",{onClick:()=>K(s.domain),className:"row-hover cursor-pointer group",children:[e.jsx("td",{className:"py-2 pl-2",children:e.jsxs("span",{className:"flex items-center gap-2.5",children:[e.jsx(xe,{className:"w-4 h-4 text-accent/75 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-sm text-text-primary group-hover:text-accent transition-colors",children:s.domain})]})}),e.jsx("td",{className:"py-2 text-right text-xs text-text-secondary tabular-nums",children:s.count}),e.jsx("td",{className:"py-2 pr-2 text-right text-xs text-text-secondary",children:e.jsx(H,{date:s.latest})})]},s.domain))})]}):O.length===0?e.jsx("div",{className:"cursor-pointer",onClick:()=>{f(void 0),g(!0)},children:e.jsx(oe,{icon:ce,title:m?"No matching entries":"No entries in this domain",description:m?void 0:"Add an entry or drop a JSON file"})}):e.jsxs(e.Fragment,{children:[e.jsxs("table",{className:"w-full mt-2",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-2xs uppercase tracking-wider text-text-tertiary",children:[e.jsx("th",{className:"pb-2 pl-2 font-medium w-[200px]",children:"Key"}),e.jsx("th",{className:"pb-2 font-medium",children:"Tags"}),e.jsx("th",{className:"pb-2 font-medium w-16 text-right",children:"Fields"}),e.jsx("th",{className:"pb-2 font-medium w-20 text-right",children:"Version"}),e.jsx("th",{className:"pb-2 pr-2 font-medium w-32 text-right",children:"Updated"})]})}),e.jsx("tbody",{children:O.map(s=>{var d;return e.jsxs("tr",{onClick:()=>K(l,s.key),className:"row-hover cursor-pointer group",children:[e.jsx("td",{className:"py-2 pl-2 w-[200px]",children:e.jsxs("span",{className:"flex items-center gap-2.5",children:[e.jsx(me,{className:"w-4 h-4 text-accent/75 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-sm text-text-primary group-hover:text-accent transition-colors truncate max-w-[160px]",title:s.key,children:s.key})]})}),e.jsx("td",{className:"py-2",children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[(d=s.tags)==null?void 0:d.slice(0,5).map(w=>e.jsx("span",{className:"inline-flex items-center px-1.5 py-0 rounded-full text-2xs font-medium bg-accent/10 text-accent",children:w},w)),s.tags&&s.tags.length>5&&e.jsxs("span",{className:"text-2xs text-text-tertiary",children:["+",s.tags.length-5]})]})}),e.jsx("td",{className:"py-2 text-right text-xs text-text-secondary tabular-nums",children:s.data?Object.keys(s.data).length:0}),e.jsxs("td",{className:"py-2 text-right text-xs text-text-secondary font-mono tabular-nums",children:["v",s.current_version]}),e.jsx("td",{className:"py-2 pr-2 text-right text-xs text-text-secondary",children:e.jsx(H,{date:s.updated_at})})]},s.key)})})]}),e.jsx(Se,{page:A,totalPages:z,onPageChange:k,total:R,pageSize:S,onPageSizeChange:F})]})]})]}),e.jsx(ze,{open:p,onClose:()=>{g(!1),f(void 0)},onCreated:(s,d)=>{n({domain:s,key:d}),P.refetch()},prefillData:C,prefillDomain:l||void 0})]})}export{at as KnowledgePage};
2
- //# sourceMappingURL=index-CZyO9hRb.js.map
1
+ import{a as o,j as e}from"./vendor-query-DvWWuNIB.js";import{P as Ne}from"./PageHeader-CMd3f4bz.js";import{F as ve,a as we}from"./FilterBar-ABC9ctin.js";import{L as ke}from"./ListToolbar-gA5rFzkz.js";import{S as Se}from"./StickyPagination-CqbjVY6T.js";import{E as oe}from"./EmptyState-DgC_6njU.js";import{D as Ce}from"./DropZone-B1Tdfddc.js";import{T as H}from"./TimeAgo-BLjqlfoX.js";import{u as Pe,a as Ee,b as pe,c as De,d as Ae,e as Fe,f as Oe,g as ge,h as Ke}from"./knowledge-DnMs-SOJ.js";import{e as Je}from"./index-CeCtqujG.js";import{T as Te}from"./TagInput-CAgdLN_b.js";import{aB as Le,z as Ve,X as _e,g as ce,o as le,e as de,q as xe,bU as me}from"./vendor-icons-CeVtUKyP.js";import{f as fe,b as Re}from"./vendor-react-_9U4mKFr.js";function We(a){return a==null?"":typeof a=="string"?a:JSON.stringify(a,null,2)}function ue(a){const n=a.trim();if(!n)return{value:"",looksLikeJson:!1,parsedOk:!1};const l=n.startsWith("{")||n.startsWith("[");try{return{value:JSON.parse(n),looksLikeJson:l,parsedOk:!0}}catch{return{value:n,looksLikeJson:l,parsedOk:!1}}}function he(a){if(typeof a=="string"){const n=a.trim();return!(n.startsWith("{")&&n.endsWith("}")||n.startsWith("[")&&n.endsWith("]"))}return typeof a=="number"||typeof a=="boolean"||a===null}function q({value:a,onChange:n,onKeyDown:l,placeholder:r,mono:m}){const u=o.useRef(null);return o.useEffect(()=>{u.current&&(u.current.style.height="auto",u.current.style.height=`${u.current.scrollHeight}px`,u.current.focus())},[a]),e.jsx("textarea",{ref:u,value:a,onChange:N=>n(N.target.value),onKeyDown:l,placeholder:r,rows:1,className:`w-full bg-transparent text-xs text-text-primary resize-none outline-none p-0 ${m?"font-mono":""}`,style:{minHeight:"1.5em"}})}function $e({domain:a,entryKey:n,onDeleted:l}){var re,ne,ie;const{data:r,isLoading:m,refetch:u}=Pe(a,n),N=Ee(),h=pe(),A=De(),k=Ae(),[S,F]=o.useState(!1),[p,g]=o.useState(null),[C,f]=o.useState(""),[j,E]=o.useState(""),[P,i]=o.useState(""),[D,O]=o.useState(null),[R,T]=o.useState(null),[K,v]=o.useState(!1),[B,z]=fe(),G=((re=Fe(a,n,!!r&&r.found!==!1).data)==null?void 0:re.versions)??[],L=B.get("version"),V=L&&/^[0-9]+$/.test(L)?parseInt(L,10):null,J=V!=null&&r&&V!==r.current_version?V:null,s=J!=null,d=Oe(a,n,J),w=o.useCallback((t,x)=>{z(y=>{const b=new URLSearchParams(y);return t===x?b.delete("version"):b.set("version",String(t)),b},{replace:!0})},[z]),c=s?(ne=d.data)==null?void 0:ne.data:r==null?void 0:r.data,I=c?Object.entries(c):[],je=o.useMemo(()=>{const t=j.trim().toLowerCase();return t?I.filter(([x])=>x.toLowerCase().includes(t)):I},[I,j]),Y=o.useCallback((t,x)=>x==="field"?t:We(c==null?void 0:c[t]),[c]),Z=p?C!==Y(p.field,p.column):!1;function X(t,x){s||(g({field:t,column:x}),f(Y(t,x)),O(null))}function M(){g(null),f("")}function ee(){T("Invalid JSON — saved as text"),setTimeout(()=>T(null),4e3)}async function U(){if(!p||!c)return;const{field:t,column:x}=p;if(x==="value"){const{value:y,looksLikeJson:b,parsedOk:W}=ue(C);b&&!W&&ee(),await A.mutateAsync({domain:a,key:n,path:t,value:y})}else{const y=C.trim();if(!y||y===t){M();return}const b=c[t];await k.mutateAsync({domain:a,key:n,path:t}),await A.mutateAsync({domain:a,key:n,path:y,value:b})}g(null),f(""),u()}async function ye(t){await k.mutateAsync({domain:a,key:n,path:t}),O(null),g(null),u()}async function be(t){await h.mutateAsync({domain:a,key:n,data:c||{},tags:t,replace:!0}),u()}async function te(){const t=j.trim();if(!t)return;const{value:x,looksLikeJson:y,parsedOk:b}=ue(P);y&&!b&&ee();const W={...c,[t]:x||""};await h.mutateAsync({domain:a,key:n,data:W}),E(""),i(""),u()}function se(t){t.key==="Escape"?M():t.key==="Enter"&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),U())}function ae(t){t.key==="Escape"?(E(""),i("")):t.key==="Enter"&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),te())}return m?e.jsxs("div",{className:"animate-pulse space-y-3 mt-4",children:[e.jsx("div",{className:"h-4 bg-surface-sunken rounded w-1/3"}),e.jsx("div",{className:"h-48 bg-surface-sunken rounded"})]}):!r||r.found===!1?e.jsx("p",{className:"text-sm text-text-tertiary mt-4",children:"Entry not found."}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("div",{className:"flex items-center gap-4 min-h-[28px]",children:K?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Te,{tags:r.tags||[],onChange:t=>{be(t)},placeholder:"Add tag...",compact:!0}),e.jsx("button",{onClick:()=>v(!1),className:"text-2xs text-text-tertiary hover:text-text-secondary shrink-0",children:"Done"})]}):e.jsx("div",{className:"flex items-center gap-1 cursor-text group",onClick:()=>v(!0),title:"Click to edit tags",children:r.tags&&r.tags.length>0?r.tags.map(t=>e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-2xs font-medium bg-accent/10 text-accent",children:t},t)):e.jsx("span",{className:"text-2xs text-text-tertiary/40 italic group-hover:text-text-tertiary",children:"add tags..."})})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(Le,{className:"w-3 h-3 text-accent/75 shrink-0",strokeWidth:1.5}),e.jsx("select",{value:String(J??r.current_version),onChange:t=>w(parseInt(t.target.value,10),r.current_version),title:"Version history","aria-label":"Version history",className:"select text-2xs py-1",children:(G.length>0?G:[{version:r.current_version,is_current:!0}]).map(t=>e.jsxs("option",{value:String(t.version),children:["v",t.version,t.is_current?" · current":""]},t.version))})]}),e.jsx("span",{className:"text-2xs text-text-tertiary",children:e.jsx(H,{date:r.updated_at})}),S?e.jsxs("span",{className:"flex items-center gap-2 text-2xs",children:[e.jsx("span",{className:"text-status-error",children:"Delete entry?"}),e.jsx("button",{onClick:async()=>{try{await N.mutateAsync({domain:a,key:n}),l()}catch{}},className:"font-medium text-status-error hover:text-status-error/80",disabled:N.isPending,children:N.isPending?"Deleting...":"Yes"}),e.jsx("button",{onClick:()=>F(!1),className:"text-text-tertiary hover:text-text-secondary",children:"No"})]}):e.jsx("button",{onClick:()=>F(!0),className:"text-text-tertiary/50 hover:text-status-error transition-colors",title:"Delete entry",children:e.jsx(Ve,{className:"w-3.5 h-3.5"})})]})]}),s&&e.jsxs("div",{className:"flex items-center gap-2 mb-2 px-1 text-2xs",children:[e.jsxs("span",{className:"text-text-secondary",children:["Viewing ",e.jsxs("span",{className:"font-mono font-medium",children:["v",J]})," — an immutable edition",((ie=d.data)==null?void 0:ie.created_at)&&e.jsxs(e.Fragment,{children:[" from ",e.jsx(H,{date:d.data.created_at})]})]}),e.jsx("button",{onClick:()=>w(r.current_version,r.current_version),className:"font-medium text-accent hover:text-accent-hover",children:"Back to current"})]}),R&&e.jsxs("div",{className:"flex items-center justify-end gap-2 mb-2 px-1",children:[e.jsx("span",{className:"inline-block w-2.5 h-2.5 rounded-full dot-ring bg-status-warning animate-pulse"}),e.jsx("span",{className:"text-xs text-status-warning",children:R})]}),e.jsxs("table",{className:"w-full border-collapse",children:[e.jsxs("thead",{className:"sticky top-0 z-10 bg-surface",children:[e.jsxs("tr",{className:"text-left text-2xs uppercase tracking-wider text-text-tertiary border-b border-surface-border",children:[e.jsx("th",{className:"px-3 py-2 font-medium w-[200px] border-r border-surface-border",children:"Field"}),e.jsx("th",{className:"px-3 py-2 font-medium",children:"Value"})]}),!s&&e.jsxs("tr",{className:"border-b border-surface-border bg-surface",children:[e.jsx("td",{className:"px-3 py-2 align-top border-r border-surface-border",children:e.jsx("input",{value:j,onChange:t=>E(t.target.value),onKeyDown:ae,placeholder:I.length?"add or filter...":"new field",className:"w-full bg-transparent text-xs text-text-primary placeholder:text-text-tertiary/40 placeholder:italic outline-none p-0"})}),e.jsxs("td",{className:"px-3 py-2 align-top",children:[e.jsx(q,{value:P,onChange:i,onKeyDown:ae,placeholder:"value"}),j.trim()&&e.jsxs("div",{className:"flex gap-2 mt-1.5",children:[e.jsx("button",{onClick:te,className:"text-2xs font-medium text-accent hover:text-accent-hover",disabled:h.isPending,children:h.isPending?"Saving...":"Save"}),e.jsx("button",{onClick:()=>{E(""),i("")},className:"text-2xs text-text-tertiary hover:text-text-secondary",children:"Cancel"})]})]})]})]}),e.jsx("tbody",{children:je.map(([t,x])=>{const y=(p==null?void 0:p.field)===t&&p.column==="field",b=(p==null?void 0:p.field)===t&&p.column==="value",W=y||b,_=D===t;return e.jsxs("tr",{className:`border-b border-surface-border ${_?"bg-status-error/10":W?"":"hover:bg-surface-hover/30"}`,children:[e.jsx("td",{className:`px-3 py-2 align-top border-r cursor-text ${_?"bg-transparent border-r-transparent":y?"border-r-surface-border bg-accent/5 border-l-2 border-l-accent":"border-r-surface-border"}`,onClick:()=>!y&&!_&&X(t,"field"),children:y?e.jsxs("div",{children:[e.jsx(q,{value:C,onChange:f,onKeyDown:se,placeholder:"field name"}),Z&&e.jsxs("div",{className:"flex gap-2 mt-1.5",children:[e.jsx("button",{onClick:U,className:"text-2xs font-medium text-accent hover:text-accent-hover",disabled:h.isPending,children:h.isPending?"Saving...":"Save"}),e.jsx("button",{onClick:M,className:"text-2xs text-text-tertiary hover:text-text-secondary",children:"Cancel"})]})]}):e.jsx("span",{className:"text-xs font-medium text-text-secondary break-all",children:t})}),e.jsx("td",{className:`px-3 py-2 align-top cursor-text ${_?"bg-transparent":b?"bg-accent/5 border-l-2 border-l-accent":""}`,onClick:()=>!b&&!_&&X(t,"value"),children:_?e.jsxs("span",{className:"flex items-center justify-end gap-2 text-2xs",children:[e.jsxs("span",{className:"text-status-error",children:["Remove ",e.jsx("span",{className:"font-medium",children:t}),"?"]}),e.jsx("button",{onClick:$=>{$.stopPropagation(),ye(t)},className:"font-medium text-status-error hover:text-status-error/80",disabled:h.isPending,children:h.isPending?"...":"Yes"}),e.jsx("button",{onClick:$=>{$.stopPropagation(),O(null)},className:"text-text-tertiary hover:text-text-secondary",children:"No"})]}):b?e.jsxs("div",{children:[e.jsx(q,{value:C,onChange:f,onKeyDown:se,placeholder:"value (string or JSON)",mono:!he(x)}),e.jsxs("div",{className:"flex gap-2 mt-1.5",children:[Z&&e.jsx("button",{onClick:U,className:"text-2xs font-medium text-accent hover:text-accent-hover",disabled:h.isPending,children:h.isPending?"Saving...":"Save"}),e.jsx("button",{onClick:M,className:"text-2xs text-text-tertiary hover:text-text-secondary",children:"Cancel"}),e.jsx("button",{onClick:$=>{$.stopPropagation(),O(t)},className:"text-2xs text-status-error/50 hover:text-status-error ml-auto",children:"Remove"})]})]}):he(x)?e.jsx("p",{className:"text-xs text-text-primary break-words whitespace-pre-wrap",children:String(x)}):e.jsx("pre",{className:"text-xs text-text-primary font-mono whitespace-pre-wrap break-words",children:typeof x=="string"?x:JSON.stringify(x,null,2)})})]},t)})})]})]})}function ze({open:a,onClose:n,onCreated:l,prefillData:r,prefillDomain:m}){const{data:u}=ge(),N=pe(),[h,A]=o.useState(m||""),[k,S]=o.useState(""),[F,p]=o.useState(r?JSON.stringify(r,null,2):"{}"),[g,C]=o.useState(""),[f,j]=o.useState(""),E=((u==null?void 0:u.domains)??[]).map(i=>i.domain);if(o.useEffect(()=>{a&&(p(r?JSON.stringify(r,null,2):"{}"),A(m||""),S(""),C(""),j(""))},[a,r,m]),!a)return null;const P=async()=>{if(j(""),!h.trim()){j("Domain is required");return}if(!k.trim()){j("Key is required");return}let i;try{if(i=JSON.parse(F),typeof i!="object"||Array.isArray(i))throw new Error}catch{j("Data must be a valid JSON object");return}try{await N.mutateAsync({domain:h.trim(),key:k.trim(),data:i,tags:g?g.split(",").map(D=>D.trim()).filter(Boolean):[]}),l==null||l(h.trim(),k.trim()),n()}catch(D){j(D.message)}};return Re.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-40 bg-black/30",onClick:n}),e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-6 overflow-y-auto",children:e.jsxs("div",{className:"bg-surface-raised border border-surface-border rounded-lg shadow-lg w-full max-w-md max-h-[85vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-surface-border",children:[e.jsx("h3",{className:"text-sm font-medium text-text-primary",children:"New Knowledge Entry"}),e.jsx("button",{onClick:n,className:"text-text-tertiary hover:text-text-primary",children:e.jsx(_e,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"px-5 py-4 space-y-4 overflow-y-auto flex-1 min-h-0",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Domain"}),e.jsx("input",{type:"text",list:"domain-list",value:h,onChange:i=>A(i.target.value),placeholder:"e.g., screenshots, config, emails",className:"input text-xs w-full"}),e.jsx("datalist",{id:"domain-list",children:E.map(i=>e.jsx("option",{value:i},i))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Key"}),e.jsx("input",{type:"text",value:k,onChange:i=>S(i.target.value),placeholder:"e.g., homepage, user-profile, report-2026",className:"input text-xs w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Data (JSON)"}),e.jsx("textarea",{value:F,onChange:i=>p(i.target.value),rows:8,className:"input-json w-full max-h-[30vh]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Tags (comma-separated)"}),e.jsx("input",{type:"text",value:g,onChange:i=>C(i.target.value),placeholder:"e.g., important, review, 401k",className:"input text-xs w-full"})]}),f&&e.jsx("p",{className:"text-xs text-status-error",children:f})]}),e.jsxs("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-surface-border",children:[e.jsx("button",{onClick:n,className:"btn-ghost text-xs",children:"Cancel"}),e.jsx("button",{onClick:P,disabled:N.isPending,className:"btn-primary text-xs",children:N.isPending?"Creating...":"Create Entry"})]})]})})]}),document.body)}const Ie=50;function at(){var L,V,J;const[a,n]=fe(),l=a.get("domain")||"",r=a.get("key")||"",[m,u]=o.useState(""),[N,h]=o.useState(""),[A,k]=o.useState(1),[S,F]=o.useState(Ie),[p,g]=o.useState(!1),[C,f]=o.useState(),j=o.useCallback(s=>{console.debug("[Knowledge] drop received:",s.map(c=>({name:c.name,type:c.type,size:c.size})));const d=s.find(c=>c.name.endsWith(".json")||c.type==="application/json");if(!d){console.warn("[Knowledge] no JSON file found in dropped files");return}console.debug("[Knowledge] reading:",d.name);const w=new FileReader;w.onload=()=>{try{const c=JSON.parse(w.result);typeof c=="object"&&!Array.isArray(c)?(console.debug("[Knowledge] parsed object with keys:",Object.keys(c)),f(c),g(!0)):console.warn("[Knowledge] JSON is not a plain object, got:",Array.isArray(c)?"array":typeof c)}catch(c){console.warn("[Knowledge] JSON parse failed:",c)}},w.readAsText(d)},[]);o.useEffect(()=>{const s=setTimeout(()=>{h(m),k(1)},Je);return()=>clearTimeout(s)},[m]);const E=(A-1)*S,P=ge(),i=Ke(l,{search:N||void 0,limit:S,offset:E}),D=((L=P.data)==null?void 0:L.domains)??[],O=((V=i.data)==null?void 0:V.entries)??[],R=((J=i.data)==null?void 0:J.total)??0,T=o.useMemo(()=>{if(!m)return D;const s=m.toLowerCase();return D.filter(d=>d.domain.toLowerCase().includes(s))},[D,m]);function K(s,d){u(""),h(""),k(1);const w={};s&&(w.domain=s),d&&(w.key=d),n(w)}const v=r?"entry":l?"entries":"domains",B=v==="entries"?i.isLoading:v==="domains"?P.isLoading:!1,z=Math.ceil((v==="entries"?R:T.length)/S),Q=l?`/knowledge/entries?domain=${encodeURIComponent(l)}&limit=${S}&offset=${E}${N?`&search=${encodeURIComponent(N)}`:""}`:void 0;return e.jsxs(Ce,{onDrop:j,label:"Drop a JSON file to create an entry",accept:".json,application/json",children:[e.jsxs("div",{children:[e.jsx(Ne,{title:"Knowledge Base",docsHash:"#docs:dashboard.md:knowledge",actions:e.jsxs("button",{onClick:()=>{f(void 0),g(!0)},className:"btn-primary text-xs inline-flex items-center gap-1.5",children:[e.jsx(ce,{className:"w-3.5 h-3.5"}),"New Entry"]})}),e.jsxs("nav",{className:"flex items-center gap-1 text-sm mb-6 min-h-[28px]",children:[e.jsxs("button",{onClick:()=>K(""),className:`flex items-center gap-1.5 px-1.5 py-0.5 rounded transition-colors ${v==="domains"?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsx(le,{className:"w-4 h-4 text-accent/75",strokeWidth:1.5}),e.jsx("span",{children:"All Domains"})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx(de,{className:"w-3.5 h-3.5 text-text-tertiary"}),e.jsxs("button",{onClick:()=>K(l),className:`flex items-center gap-1.5 px-1.5 py-0.5 rounded transition-colors ${v==="entries"?"text-text-primary font-medium":"text-text-secondary hover:text-text-primary hover:bg-surface-hover"}`,children:[e.jsx(xe,{className:"w-3.5 h-3.5 text-accent/60",strokeWidth:1.5}),l]})]}),r&&e.jsxs(e.Fragment,{children:[e.jsx(de,{className:"w-3.5 h-3.5 text-text-tertiary"}),e.jsxs("span",{className:"flex items-center gap-1.5 px-1.5 py-0.5 text-text-primary font-medium",children:[e.jsx(me,{className:"w-3.5 h-3.5 text-accent/60",strokeWidth:1.5}),r]})]})]}),v==="entry"?e.jsx($e,{domain:l,entryKey:r,onDeleted:()=>K(l)}):e.jsxs(e.Fragment,{children:[e.jsx(ve,{actions:e.jsx(ke,{onRefresh:()=>v==="entries"?i.refetch():P.refetch(),isFetching:v==="entries"?i.isFetching:P.isFetching,apiPath:v==="entries"?Q:"/knowledge/domains"}),children:e.jsx(we,{label:"Search",value:m,onChange:u,placeholder:l?"Filter by key or tag...":"Filter by domain..."})}),B?e.jsx("div",{className:"animate-pulse space-y-2 mt-4",children:Array.from({length:6}).map((s,d)=>e.jsx("div",{className:"h-10 bg-surface-sunken rounded"},d))}):v==="domains"?T.length===0?e.jsx("div",{className:"cursor-pointer",onClick:()=>{f(void 0),g(!0)},children:e.jsx(oe,{icon:le,title:m?"No matching domains":"Knowledge Base Empty",description:m?void 0:"Create your first entry or drop a JSON file"})}):e.jsxs("table",{className:"w-full mt-2",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-2xs uppercase tracking-wider text-text-tertiary",children:[e.jsx("th",{className:"pb-2 pl-2 font-medium",children:"Domain"}),e.jsx("th",{className:"pb-2 font-medium w-24 text-right",children:"Entries"}),e.jsx("th",{className:"pb-2 pr-2 font-medium w-40 text-right",children:"Latest"})]})}),e.jsx("tbody",{children:T.map(s=>e.jsxs("tr",{onClick:()=>K(s.domain),className:"row-hover cursor-pointer group",children:[e.jsx("td",{className:"py-2 pl-2",children:e.jsxs("span",{className:"flex items-center gap-2.5",children:[e.jsx(xe,{className:"w-4 h-4 text-accent/75 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-sm text-text-primary group-hover:text-accent transition-colors",children:s.domain})]})}),e.jsx("td",{className:"py-2 text-right text-xs text-text-secondary tabular-nums",children:s.count}),e.jsx("td",{className:"py-2 pr-2 text-right text-xs text-text-secondary",children:e.jsx(H,{date:s.latest})})]},s.domain))})]}):O.length===0?e.jsx("div",{className:"cursor-pointer",onClick:()=>{f(void 0),g(!0)},children:e.jsx(oe,{icon:ce,title:m?"No matching entries":"No entries in this domain",description:m?void 0:"Add an entry or drop a JSON file"})}):e.jsxs(e.Fragment,{children:[e.jsxs("table",{className:"w-full mt-2",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-2xs uppercase tracking-wider text-text-tertiary",children:[e.jsx("th",{className:"pb-2 pl-2 font-medium w-[200px]",children:"Key"}),e.jsx("th",{className:"pb-2 font-medium",children:"Tags"}),e.jsx("th",{className:"pb-2 font-medium w-16 text-right",children:"Fields"}),e.jsx("th",{className:"pb-2 font-medium w-20 text-right",children:"Version"}),e.jsx("th",{className:"pb-2 pr-2 font-medium w-32 text-right",children:"Updated"})]})}),e.jsx("tbody",{children:O.map(s=>{var d;return e.jsxs("tr",{onClick:()=>K(l,s.key),className:"row-hover cursor-pointer group",children:[e.jsx("td",{className:"py-2 pl-2 w-[200px]",children:e.jsxs("span",{className:"flex items-center gap-2.5",children:[e.jsx(me,{className:"w-4 h-4 text-accent/75 shrink-0",strokeWidth:1.5}),e.jsx("span",{className:"text-sm text-text-primary group-hover:text-accent transition-colors truncate max-w-[160px]",title:s.key,children:s.key})]})}),e.jsx("td",{className:"py-2",children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[(d=s.tags)==null?void 0:d.slice(0,5).map(w=>e.jsx("span",{className:"inline-flex items-center px-1.5 py-0 rounded-full text-2xs font-medium bg-accent/10 text-accent",children:w},w)),s.tags&&s.tags.length>5&&e.jsxs("span",{className:"text-2xs text-text-tertiary",children:["+",s.tags.length-5]})]})}),e.jsx("td",{className:"py-2 text-right text-xs text-text-secondary tabular-nums",children:s.data?Object.keys(s.data).length:0}),e.jsxs("td",{className:"py-2 text-right text-xs text-text-secondary font-mono tabular-nums",children:["v",s.current_version]}),e.jsx("td",{className:"py-2 pr-2 text-right text-xs text-text-secondary",children:e.jsx(H,{date:s.updated_at})})]},s.key)})})]}),e.jsx(Se,{page:A,totalPages:z,onPageChange:k,total:R,pageSize:S,onPageSizeChange:F})]})]})]}),e.jsx(ze,{open:p,onClose:()=>{g(!1),f(void 0)},onCreated:(s,d)=>{n({domain:s,key:d}),P.refetch()},prefillData:C,prefillDomain:l||void 0})]})}export{at as KnowledgePage};
2
+ //# sourceMappingURL=index-DAvi5_2T.js.map