@dxos/plugin-routine 0.10.0 → 0.11.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 (320) hide show
  1. package/PLUGIN.mdl +18 -13
  2. package/dist/lib/RoutinePlugin.mjs +2 -0
  3. package/dist/lib/RoutinePlugin.node.mjs +894 -0
  4. package/dist/lib/RoutinePlugin.node.mjs.map +1 -0
  5. package/dist/lib/RoutinePlugin.workerd.mjs +20 -0
  6. package/dist/lib/RoutinePlugin.workerd.mjs.map +1 -0
  7. package/dist/lib/capabilities/node.mjs +12 -0
  8. package/dist/lib/capabilities/node.mjs.map +1 -0
  9. package/dist/lib/capabilities.mjs +14 -0
  10. package/dist/lib/capabilities.mjs.map +1 -0
  11. package/dist/lib/chunk-RoutineArticle.mjs +79 -0
  12. package/dist/lib/chunk-RoutineArticle.mjs.map +1 -0
  13. package/dist/lib/chunk-RoutineCompanion.mjs +192 -0
  14. package/dist/lib/chunk-RoutineCompanion.mjs.map +1 -0
  15. package/dist/lib/chunk-RoutinePlugin.mjs +38 -0
  16. package/dist/lib/chunk-RoutinePlugin.mjs.map +1 -0
  17. package/dist/lib/chunk-RoutineSettings.mjs +50 -0
  18. package/dist/lib/chunk-RoutineSettings.mjs.map +1 -0
  19. package/dist/lib/chunk-RoutineTraceCompanion.mjs +208 -0
  20. package/dist/lib/chunk-RoutineTraceCompanion.mjs.map +1 -0
  21. package/dist/lib/chunk-SkillArticle.mjs +28 -0
  22. package/dist/lib/chunk-SkillArticle.mjs.map +1 -0
  23. package/dist/lib/chunk-app-graph-builder.mjs +71 -0
  24. package/dist/lib/chunk-app-graph-builder.mjs.map +1 -0
  25. package/dist/lib/chunk-create-object.mjs +23 -0
  26. package/dist/lib/chunk-create-object.mjs.map +1 -0
  27. package/dist/lib/chunk-create-routine.mjs +34 -0
  28. package/dist/lib/chunk-create-routine.mjs.map +1 -0
  29. package/dist/lib/chunk-create-trigger-from-template.mjs +48 -0
  30. package/dist/lib/chunk-create-trigger-from-template.mjs.map +1 -0
  31. package/dist/lib/chunk-layer-specs.mjs +179 -0
  32. package/dist/lib/chunk-layer-specs.mjs.map +1 -0
  33. package/dist/lib/{neutral/chunk-HLO4LYXT.mjs → chunk-meta.mjs} +19 -27
  34. package/dist/lib/chunk-meta.mjs.map +1 -0
  35. package/dist/lib/chunk-operation-handler.mjs +11 -0
  36. package/dist/lib/chunk-operation-handler.mjs.map +1 -0
  37. package/dist/lib/chunk-paths.mjs +11 -0
  38. package/dist/lib/chunk-paths.mjs.map +1 -0
  39. package/dist/lib/chunk-react-surface.mjs +64 -0
  40. package/dist/lib/chunk-react-surface.mjs.map +1 -0
  41. package/dist/lib/chunk-registry-sync.mjs +104 -0
  42. package/dist/lib/chunk-registry-sync.mjs.map +1 -0
  43. package/dist/lib/chunk-run-routine.mjs +57 -0
  44. package/dist/lib/chunk-run-routine.mjs.map +1 -0
  45. package/dist/lib/chunk-templates.mjs +37 -0
  46. package/dist/lib/chunk-templates.mjs.map +1 -0
  47. package/dist/lib/chunk-trigger-runtime-controller.mjs +73 -0
  48. package/dist/lib/chunk-trigger-runtime-controller.mjs.map +1 -0
  49. package/dist/lib/chunk-types.mjs +149 -0
  50. package/dist/lib/chunk-types.mjs.map +1 -0
  51. package/dist/lib/chunk-util.mjs +142 -0
  52. package/dist/lib/chunk-util.mjs.map +1 -0
  53. package/dist/lib/components.mjs +1645 -0
  54. package/dist/lib/components.mjs.map +1 -0
  55. package/dist/lib/containers.mjs +11 -0
  56. package/dist/lib/containers.mjs.map +1 -0
  57. package/dist/lib/hooks.mjs +37 -0
  58. package/dist/lib/hooks.mjs.map +1 -0
  59. package/dist/lib/index.mjs +5 -0
  60. package/dist/lib/meta.mjs +2 -0
  61. package/dist/lib/operations.mjs +7 -0
  62. package/dist/lib/operations.mjs.map +1 -0
  63. package/dist/lib/plugin.mjs +9 -0
  64. package/dist/lib/plugin.mjs.map +1 -0
  65. package/dist/lib/testing.mjs +2 -0
  66. package/dist/lib/translations.mjs +110 -0
  67. package/dist/lib/translations.mjs.map +1 -0
  68. package/dist/lib/types.mjs +2 -0
  69. package/dist/types/src/RoutinePlugin.d.ts.map +1 -1
  70. package/dist/types/src/RoutinePlugin.node.d.ts.map +1 -1
  71. package/dist/types/src/RoutinePlugin.workerd.d.ts.map +1 -1
  72. package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
  73. package/dist/types/src/capabilities/create-object.d.ts +1 -1
  74. package/dist/types/src/capabilities/index.d.ts +0 -1
  75. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  76. package/dist/types/src/capabilities/layer-specs.d.ts +1 -1
  77. package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
  78. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  79. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  80. package/dist/types/src/capabilities/registry-sync.d.ts +1 -1
  81. package/dist/types/src/capabilities/templates.d.ts +1 -1
  82. package/dist/types/src/capabilities/trigger-runtime-controller.d.ts +1 -1
  83. package/dist/types/src/commands/trigger/create/{queue.d.ts → feed.d.ts} +2 -2
  84. package/dist/types/src/commands/trigger/create/feed.d.ts.map +1 -0
  85. package/dist/types/src/commands/trigger/update/{queue.d.ts → feed.d.ts} +2 -2
  86. package/dist/types/src/commands/trigger/update/feed.d.ts.map +1 -0
  87. package/dist/types/src/commands/trigger/util.d.ts +1 -1
  88. package/dist/types/src/commands/trigger/util.d.ts.map +1 -1
  89. package/dist/types/src/components/InstructionsEditor/InstructionsEditor.d.ts +7 -5
  90. package/dist/types/src/components/InstructionsEditor/InstructionsEditor.d.ts.map +1 -1
  91. package/dist/types/src/components/InstructionsEditor/InstructionsEditor.stories.d.ts +3 -3
  92. package/dist/types/src/components/InstructionsEditor/InstructionsEditor.stories.d.ts.map +1 -1
  93. package/dist/types/src/components/RoutineCard/RoutineCard.d.ts +9 -0
  94. package/dist/types/src/components/RoutineCard/RoutineCard.d.ts.map +1 -0
  95. package/dist/types/src/components/RoutineCard/RoutineCard.stories.d.ts +21 -0
  96. package/dist/types/src/components/RoutineCard/RoutineCard.stories.d.ts.map +1 -0
  97. package/dist/types/src/components/RoutineCard/index.d.ts +2 -0
  98. package/dist/types/src/components/RoutineCard/index.d.ts.map +1 -0
  99. package/dist/types/src/components/RoutineForm/RoutineForm.d.ts +7 -2
  100. package/dist/types/src/components/RoutineForm/RoutineForm.d.ts.map +1 -1
  101. package/dist/types/src/components/Schedule/Schedule.d.ts +2 -26
  102. package/dist/types/src/components/Schedule/Schedule.d.ts.map +1 -1
  103. package/dist/types/src/components/Schedule/days.d.ts +24 -0
  104. package/dist/types/src/components/Schedule/days.d.ts.map +1 -0
  105. package/dist/types/src/components/Schedule/describe-schedule.d.ts +3 -0
  106. package/dist/types/src/components/Schedule/describe-schedule.d.ts.map +1 -0
  107. package/dist/types/src/components/Schedule/index.d.ts +2 -0
  108. package/dist/types/src/components/Schedule/index.d.ts.map +1 -1
  109. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts +1 -1
  110. package/dist/types/src/components/TemplateEditor/TemplateEditor.d.ts.map +1 -1
  111. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +1 -2
  112. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
  113. package/dist/types/src/components/TriggerEditor/TriggerKindSelector.d.ts +5 -2
  114. package/dist/types/src/components/TriggerEditor/TriggerKindSelector.d.ts.map +1 -1
  115. package/dist/types/src/components/TriggerEditor/trigger-kind-icon.d.ts +5 -0
  116. package/dist/types/src/components/TriggerEditor/trigger-kind-icon.d.ts.map +1 -0
  117. package/dist/types/src/components/index.d.ts +1 -1
  118. package/dist/types/src/components/index.d.ts.map +1 -1
  119. package/dist/types/src/containers/RoutineArticle/RoutineArticle.d.ts +5 -10
  120. package/dist/types/src/containers/RoutineArticle/RoutineArticle.d.ts.map +1 -1
  121. package/dist/types/src/containers/RoutineArticle/RoutineArticle.stories.d.ts +6 -2
  122. package/dist/types/src/containers/RoutineArticle/RoutineArticle.stories.d.ts.map +1 -1
  123. package/dist/types/src/containers/RoutineCompanion/RoutineCompanion.d.ts +4 -12
  124. package/dist/types/src/containers/RoutineCompanion/RoutineCompanion.d.ts.map +1 -1
  125. package/dist/types/src/containers/RoutineCompanion/RoutineCompanion.stories.d.ts.map +1 -1
  126. package/dist/types/src/containers/RoutineSettings/RoutineSettings.d.ts +4 -8
  127. package/dist/types/src/containers/RoutineSettings/RoutineSettings.d.ts.map +1 -1
  128. package/dist/types/src/containers/RoutineTraceCompanion/RoutineTraceCompanion.d.ts +5 -3
  129. package/dist/types/src/containers/RoutineTraceCompanion/RoutineTraceCompanion.d.ts.map +1 -1
  130. package/dist/types/src/containers/RoutineTraceCompanion/RoutineTraceCompanion.stories.d.ts.map +1 -1
  131. package/dist/types/src/containers/RoutineTraceCompanion/useRoutineRuns.d.ts +1 -1
  132. package/dist/types/src/containers/RoutineTraceCompanion/useRoutineRuns.d.ts.map +1 -1
  133. package/dist/types/src/containers/SkillArticle/SkillArticle.d.ts +4 -1
  134. package/dist/types/src/containers/SkillArticle/SkillArticle.d.ts.map +1 -1
  135. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +1 -1
  136. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
  137. package/dist/types/src/index.d.ts +1 -0
  138. package/dist/types/src/index.d.ts.map +1 -1
  139. package/dist/types/src/operations/run-routine.d.ts.map +1 -1
  140. package/dist/types/src/operations/run-routine.test.d.ts +2 -0
  141. package/dist/types/src/operations/run-routine.test.d.ts.map +1 -0
  142. package/dist/types/src/paths.d.ts.map +1 -1
  143. package/dist/types/src/templates/index.d.ts +1 -1
  144. package/dist/types/src/templates/index.d.ts.map +1 -1
  145. package/dist/types/src/testing/test-functions.d.ts +30 -6
  146. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  147. package/dist/types/src/translations.d.ts.map +1 -1
  148. package/dist/types/src/types/RoutineCapabilities.d.ts +9 -3
  149. package/dist/types/src/types/RoutineCapabilities.d.ts.map +1 -1
  150. package/dist/types/src/types/RoutineOperation.d.ts +2 -3
  151. package/dist/types/src/types/RoutineOperation.d.ts.map +1 -1
  152. package/dist/types/src/types/index.d.ts +0 -1
  153. package/dist/types/src/types/index.d.ts.map +1 -1
  154. package/dist/types/src/util/index.d.ts +1 -0
  155. package/dist/types/src/util/index.d.ts.map +1 -1
  156. package/dist/types/src/util/routines-for-object.d.ts +6 -3
  157. package/dist/types/src/util/routines-for-object.d.ts.map +1 -1
  158. package/dist/types/src/util/wire.d.ts +21 -0
  159. package/dist/types/src/util/wire.d.ts.map +1 -0
  160. package/dist/types/src/util/wire.test.d.ts +2 -0
  161. package/dist/types/src/util/wire.test.d.ts.map +1 -0
  162. package/dist/types/tsconfig.tsbuildinfo +1 -1
  163. package/dx.config.ts +3 -2
  164. package/package.json +73 -71
  165. package/src/RoutinePlugin.node.ts +1 -2
  166. package/src/RoutinePlugin.tsx +2 -4
  167. package/src/RoutinePlugin.workerd.ts +1 -2
  168. package/src/capabilities/app-graph-builder.ts +9 -7
  169. package/src/capabilities/create-object.ts +2 -2
  170. package/src/capabilities/index.ts +0 -1
  171. package/src/capabilities/layer-specs.ts +78 -12
  172. package/src/capabilities/{react-surface.tsx → react-surface.ts} +18 -22
  173. package/src/capabilities/trigger-runtime-controller.test.ts +12 -18
  174. package/src/capabilities/trigger-runtime-controller.ts +22 -25
  175. package/src/commands/trigger/create/{queue.ts → feed.ts} +1 -1
  176. package/src/commands/trigger/create/index.ts +2 -2
  177. package/src/commands/trigger/update/{queue.ts → feed.ts} +1 -1
  178. package/src/commands/trigger/update/index.ts +2 -2
  179. package/src/commands/trigger/util.ts +1 -2
  180. package/src/components/InstructionsEditor/InstructionsEditor.stories.tsx +7 -6
  181. package/src/components/InstructionsEditor/InstructionsEditor.tsx +31 -19
  182. package/src/components/RoutineCard/RoutineCard.stories.tsx +95 -0
  183. package/src/components/RoutineCard/RoutineCard.tsx +60 -0
  184. package/src/components/{MasterDetail → RoutineCard}/index.ts +1 -1
  185. package/src/components/RoutineForm/RoutineForm.tsx +60 -52
  186. package/src/components/Schedule/Schedule.stories.tsx +1 -1
  187. package/src/components/Schedule/Schedule.tsx +4 -73
  188. package/src/components/Schedule/days.ts +18 -0
  189. package/src/components/Schedule/describe-schedule.ts +64 -0
  190. package/src/components/Schedule/index.ts +2 -0
  191. package/src/components/TemplateEditor/TemplateEditor.stories.tsx +1 -1
  192. package/src/components/TemplateEditor/TemplateForm.tsx +1 -1
  193. package/src/components/TriggerEditor/TriggerEditor.stories.tsx +3 -3
  194. package/src/components/TriggerEditor/TriggerEditor.tsx +79 -66
  195. package/src/components/TriggerEditor/TriggerKindSelector.tsx +4 -30
  196. package/src/components/TriggerEditor/trigger-kind-icon.ts +38 -0
  197. package/src/components/index.ts +1 -1
  198. package/src/containers/RoutineArticle/RoutineArticle.stories.tsx +78 -19
  199. package/src/containers/RoutineArticle/RoutineArticle.tsx +8 -4
  200. package/src/containers/RoutineCompanion/RoutineCompanion.stories.tsx +5 -4
  201. package/src/containers/RoutineCompanion/RoutineCompanion.tsx +11 -7
  202. package/src/containers/RoutineSettings/RoutineSettings.tsx +22 -33
  203. package/src/containers/RoutineTraceCompanion/RoutineTraceCompanion.stories.tsx +6 -5
  204. package/src/containers/RoutineTraceCompanion/RoutineTraceCompanion.tsx +3 -1
  205. package/src/containers/RoutineTraceCompanion/useRoutineRuns.ts +3 -5
  206. package/src/containers/SkillArticle/SkillArticle.tsx +2 -0
  207. package/src/hooks/useTriggerRuntimeControls.ts +2 -2
  208. package/src/index.ts +1 -0
  209. package/src/operations/create-routine.ts +1 -1
  210. package/src/operations/create-trigger-from-template.ts +2 -2
  211. package/src/operations/run-routine.test.ts +150 -0
  212. package/src/operations/run-routine.ts +18 -2
  213. package/src/paths.ts +5 -5
  214. package/src/templates/index.ts +5 -3
  215. package/src/translations.ts +5 -6
  216. package/src/types/RoutineCapabilities.ts +10 -4
  217. package/src/types/RoutineOperation.ts +7 -6
  218. package/src/types/index.ts +0 -1
  219. package/src/util/index.ts +1 -0
  220. package/src/util/routines-for-object.test.ts +37 -5
  221. package/src/util/routines-for-object.ts +33 -8
  222. package/src/util/wire.test.ts +77 -0
  223. package/src/util/wire.ts +76 -0
  224. package/dist/lib/neutral/RoutineArticle-UNTMV4CC.mjs +0 -95
  225. package/dist/lib/neutral/RoutineArticle-UNTMV4CC.mjs.map +0 -7
  226. package/dist/lib/neutral/RoutineCompanion-ZZ6WMY7I.mjs +0 -249
  227. package/dist/lib/neutral/RoutineCompanion-ZZ6WMY7I.mjs.map +0 -7
  228. package/dist/lib/neutral/RoutinePlugin.mjs +0 -10
  229. package/dist/lib/neutral/RoutinePlugin.mjs.map +0 -7
  230. package/dist/lib/neutral/RoutinePlugin.node.mjs +0 -1133
  231. package/dist/lib/neutral/RoutinePlugin.node.mjs.map +0 -7
  232. package/dist/lib/neutral/RoutinePlugin.workerd.mjs +0 -36
  233. package/dist/lib/neutral/RoutinePlugin.workerd.mjs.map +0 -7
  234. package/dist/lib/neutral/RoutineSettings-ZJOM4F3S.mjs +0 -48
  235. package/dist/lib/neutral/RoutineSettings-ZJOM4F3S.mjs.map +0 -7
  236. package/dist/lib/neutral/RoutineTraceCompanion-5U6R7LJE.mjs +0 -236
  237. package/dist/lib/neutral/RoutineTraceCompanion-5U6R7LJE.mjs.map +0 -7
  238. package/dist/lib/neutral/SkillArticle-WWDNKW2Z.mjs +0 -27
  239. package/dist/lib/neutral/SkillArticle-WWDNKW2Z.mjs.map +0 -7
  240. package/dist/lib/neutral/app-graph-builder-FALWLZTI.mjs +0 -90
  241. package/dist/lib/neutral/app-graph-builder-FALWLZTI.mjs.map +0 -7
  242. package/dist/lib/neutral/capabilities/index.mjs +0 -25
  243. package/dist/lib/neutral/capabilities/index.mjs.map +0 -7
  244. package/dist/lib/neutral/capabilities/node.mjs +0 -19
  245. package/dist/lib/neutral/capabilities/node.mjs.map +0 -7
  246. package/dist/lib/neutral/chunk-674LDIUJ.mjs +0 -9
  247. package/dist/lib/neutral/chunk-674LDIUJ.mjs.map +0 -7
  248. package/dist/lib/neutral/chunk-HLO4LYXT.mjs.map +0 -7
  249. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
  250. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
  251. package/dist/lib/neutral/chunk-P3TDQKOO.mjs +0 -8
  252. package/dist/lib/neutral/chunk-P3TDQKOO.mjs.map +0 -7
  253. package/dist/lib/neutral/chunk-R7J2MU2M.mjs +0 -263
  254. package/dist/lib/neutral/chunk-R7J2MU2M.mjs.map +0 -7
  255. package/dist/lib/neutral/chunk-WLNL77C7.mjs +0 -14
  256. package/dist/lib/neutral/chunk-WLNL77C7.mjs.map +0 -7
  257. package/dist/lib/neutral/chunk-YGWSAKLD.mjs +0 -65
  258. package/dist/lib/neutral/chunk-YGWSAKLD.mjs.map +0 -7
  259. package/dist/lib/neutral/components/index.mjs +0 -1921
  260. package/dist/lib/neutral/components/index.mjs.map +0 -7
  261. package/dist/lib/neutral/containers/index.mjs +0 -17
  262. package/dist/lib/neutral/containers/index.mjs.map +0 -7
  263. package/dist/lib/neutral/create-object-V23KVDMJ.mjs +0 -25
  264. package/dist/lib/neutral/create-object-V23KVDMJ.mjs.map +0 -7
  265. package/dist/lib/neutral/create-routine-6QBY6TWF.mjs +0 -38
  266. package/dist/lib/neutral/create-routine-6QBY6TWF.mjs.map +0 -7
  267. package/dist/lib/neutral/create-trigger-from-template-U3KNS77V.mjs +0 -70
  268. package/dist/lib/neutral/create-trigger-from-template-U3KNS77V.mjs.map +0 -7
  269. package/dist/lib/neutral/hooks/index.mjs +0 -47
  270. package/dist/lib/neutral/hooks/index.mjs.map +0 -7
  271. package/dist/lib/neutral/index.mjs +0 -27
  272. package/dist/lib/neutral/index.mjs.map +0 -7
  273. package/dist/lib/neutral/layer-specs-2TWJU5HI.mjs +0 -135
  274. package/dist/lib/neutral/layer-specs-2TWJU5HI.mjs.map +0 -7
  275. package/dist/lib/neutral/meta.json +0 -1
  276. package/dist/lib/neutral/meta.mjs +0 -8
  277. package/dist/lib/neutral/meta.mjs.map +0 -7
  278. package/dist/lib/neutral/navigation-resolver-KQIWUH6F.mjs +0 -18
  279. package/dist/lib/neutral/navigation-resolver-KQIWUH6F.mjs.map +0 -7
  280. package/dist/lib/neutral/operation-handler-QKLJSDCQ.mjs +0 -13
  281. package/dist/lib/neutral/operation-handler-QKLJSDCQ.mjs.map +0 -7
  282. package/dist/lib/neutral/operations/index.mjs +0 -8
  283. package/dist/lib/neutral/operations/index.mjs.map +0 -7
  284. package/dist/lib/neutral/plugin.mjs +0 -16
  285. package/dist/lib/neutral/plugin.mjs.map +0 -7
  286. package/dist/lib/neutral/react-surface-GMO7I7YE.mjs +0 -67
  287. package/dist/lib/neutral/react-surface-GMO7I7YE.mjs.map +0 -7
  288. package/dist/lib/neutral/registry-sync-DYPOC7ZG.mjs +0 -86
  289. package/dist/lib/neutral/registry-sync-DYPOC7ZG.mjs.map +0 -7
  290. package/dist/lib/neutral/run-routine-AEWO6SYD.mjs +0 -37
  291. package/dist/lib/neutral/run-routine-AEWO6SYD.mjs.map +0 -7
  292. package/dist/lib/neutral/templates-IIUCEBAX.mjs +0 -49
  293. package/dist/lib/neutral/templates-IIUCEBAX.mjs.map +0 -7
  294. package/dist/lib/neutral/testing.mjs +0 -8
  295. package/dist/lib/neutral/testing.mjs.map +0 -7
  296. package/dist/lib/neutral/translations.mjs +0 -115
  297. package/dist/lib/neutral/translations.mjs.map +0 -7
  298. package/dist/lib/neutral/trigger-runtime-controller-WIDDFGQT.mjs +0 -77
  299. package/dist/lib/neutral/trigger-runtime-controller-WIDDFGQT.mjs.map +0 -7
  300. package/dist/lib/neutral/types/index.mjs +0 -17
  301. package/dist/lib/neutral/types/index.mjs.map +0 -7
  302. package/dist/types/src/capabilities/navigation-resolver.d.ts +0 -5
  303. package/dist/types/src/capabilities/navigation-resolver.d.ts.map +0 -1
  304. package/dist/types/src/commands/trigger/create/queue.d.ts.map +0 -1
  305. package/dist/types/src/commands/trigger/update/queue.d.ts.map +0 -1
  306. package/dist/types/src/components/MasterDetail/MasterDetail.d.ts +0 -51
  307. package/dist/types/src/components/MasterDetail/MasterDetail.d.ts.map +0 -1
  308. package/dist/types/src/components/MasterDetail/MasterDetail.stories.d.ts +0 -16
  309. package/dist/types/src/components/MasterDetail/MasterDetail.stories.d.ts.map +0 -1
  310. package/dist/types/src/components/MasterDetail/index.d.ts +0 -2
  311. package/dist/types/src/components/MasterDetail/index.d.ts.map +0 -1
  312. package/dist/types/src/types/Routine.d.ts +0 -55
  313. package/dist/types/src/types/Routine.d.ts.map +0 -1
  314. package/dist/types/src/types/Routine.test.d.ts +0 -2
  315. package/dist/types/src/types/Routine.test.d.ts.map +0 -1
  316. package/src/capabilities/navigation-resolver.ts +0 -21
  317. package/src/components/MasterDetail/MasterDetail.stories.tsx +0 -100
  318. package/src/components/MasterDetail/MasterDetail.tsx +0 -175
  319. package/src/types/Routine.test.ts +0 -51
  320. package/src/types/Routine.ts +0 -144
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/components/RoutineForm/RoutineForm.tsx", "../../../../src/components/InstructionsEditor/InstructionsEditor.tsx", "../../../../src/components/TriggerEditor/TriggerEditor.tsx", "../../../../src/components/Schedule/cron.ts", "../../../../src/components/Schedule/types.ts", "../../../../src/components/Schedule/Schedule.tsx", "../../../../src/components/TriggerEditor/TriggerKindSelector.tsx", "../../../../src/components/CreateRoutinePanel/CreateRoutinePanel.tsx", "../../../../src/components/MasterDetail/MasterDetail.tsx", "../../../../src/components/TemplateEditor/TemplateEditor.tsx", "../../../../src/components/TemplateEditor/extensions/handlebars-extension.ts", "../../../../src/components/TemplateEditor/extensions/xml-extension.ts"],
4
- "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport React, { type PropsWithChildren, useCallback, useMemo } from 'react';\n\nimport { Instructions, Operation, Trigger } from '@dxos/compute';\nimport { type Database, DXN, Entity, Filter, Obj, Query, Ref, Scope, Type } from '@dxos/echo';\nimport { useObject, useQuery } from '@dxos/react-client/echo';\nimport { ToggleGroup, ToggleGroupItem, useTranslation } from '@dxos/react-ui';\nimport { Form, type FormFieldMap, RefField } from '@dxos/react-ui-form';\n\nimport { meta } from '#meta';\nimport { Routine } from '#types';\n\nimport { InstructionsEditor } from '../InstructionsEditor';\nimport { TriggerEditor } from '../TriggerEditor';\n\n//\n// Main (general) form — the outer form; actions and triggers are sub-forms within its content.\n//\n\n// Pick the editable general fields from the Routine schema rather than redeclaring them.\nconst GeneralForm = Type.getSchema(Routine.Routine).pipe(Schema.pick('name', 'description'));\ntype GeneralForm = Schema.Schema.Type<typeof GeneralForm>;\n\nexport type RoutineFormProps = {\n db: Database.Database;\n routine: Routine.Routine;\n /** Render the form for display only (e.g. an enabled routine, locked until disabled). */\n readonly?: boolean;\n /** Commit the edit session; when set, the form renders a Save/Cancel action row (the companion's create flow). */\n onSave?: () => void;\n /** Discard the edit session. */\n onCancel?: () => void;\n};\n\n/**\n * Composite routine form: the general fields (name + description) are the outer {@link Form},\n * with the Actions and Triggers sections rendered as sub-forms inside its content:\n * - Actions — Operation/Instructions variants chosen via a button group (single action; `spec` isn't an array).\n * - Triggers — the {@link TriggerEditor}.\n *\n * The sub-forms read and autosave the routine's owned instructions and primary trigger directly off the\n * `routine` graph (live editing); `readonly` displays them without edit affordances. The optional Save/Cancel\n * row is used only by the companion's create-from-template flow.\n */\nexport const RoutineForm = ({ db, routine, readonly = false, onSave, onCancel }: RoutineFormProps) => {\n const { t } = useTranslation(meta.profile.key);\n const [auto, updateAuto] = useObject(routine);\n const trigger = usePrimaryTrigger(routine);\n\n // Read once per routine identity; the uncontrolled form owns edits after mount.\n const defaultValues = useMemo<Partial<GeneralForm>>(\n () => ({ name: auto.name, description: auto.description }),\n [routine],\n );\n const handleValuesChanged = useCallback(\n (values: Partial<GeneralForm>) => {\n updateAuto((routine) => {\n routine.name = values.name;\n routine.description = values.description;\n });\n },\n [updateAuto],\n );\n\n return (\n <Form.Root\n schema={GeneralForm}\n readonly={readonly}\n defaultValues={defaultValues}\n onValuesChanged={handleValuesChanged}\n onSave={onSave}\n onCancel={onCancel}\n >\n <Form.Viewport scroll>\n <Form.Content>\n <Form.FieldSet />\n\n <Section title={t('actions.title')}>\n <ActionEditor db={db} routine={routine} readonly={readonly} />\n </Section>\n\n <Section title={t('triggers.title')}>\n <TriggerEditor db={db} routine={routine} trigger={trigger} readonly={readonly} />\n </Section>\n\n {/* Save/Cancel for the edit session (the sub-forms autosave to the in-memory clones as they change). */}\n {onSave && <Form.Actions />}\n </Form.Content>\n </Form.Viewport>\n </Form.Root>\n );\n};\n\n/** Lightweight labelled grouping for a sub-form (no `Settings` chrome). */\nconst Section = ({ title, children }: PropsWithChildren<{ title: string }>) => (\n <div role='none' className='flex flex-col mbs-4'>\n <Form.Label standalone label={title} />\n {children}\n </div>\n);\n\n//\n// Actions\n//\n\n/**\n * Single action: an Operation (the routine's `spec.runnable`) or an owned Instructions edited inline. The\n * action kind is derived from the routine's `spec` — an absent spec means \"operation, none chosen yet\" (a\n * scaffolded routine always carries an instructions spec, so the only way to clear it is switching to an\n * operation). `Routine.make` establishes the owned-instructions wiring when the routine is scaffolded.\n */\nconst ActionEditor = ({\n db,\n routine: routineProp,\n readonly,\n}: {\n db: Database.Database;\n routine: Routine.Routine;\n readonly?: boolean;\n}) => {\n const operations = useOperations(db);\n const [routine, updateRoutine] = useObject(routineProp);\n\n // Classification is read off `spec.kind` (no dereference); the owned instructions object is then resolved in\n // place to hand to the editor (an owned ref is always locally resolvable, and the parent `useObject` re-renders\n // this when `spec` changes). An absent spec means \"runnable, none chosen yet\" — a scaffolded routine always\n // carries an instructions spec, so the only way to clear it is switching to a runnable action.\n const kind = routine.spec?.kind ?? 'runnable';\n const operationRef = Routine.runnableRef(routine);\n const instructions = Routine.instructionsRef(routine)?.target;\n\n const handleOperationChange = useCallback(\n (operation?: Ref.Ref<Operation.PersistentOperation>) => {\n updateRoutine((routine) => {\n routine.spec = operation ? { kind: 'runnable', runnable: operation } : undefined;\n });\n // Keep the owned trigger's `function`/`input` in sync with the new action.\n Routine.wireTriggers(routineProp);\n },\n [updateRoutine, routineProp],\n );\n\n const handleKindChange = useCallback(\n (next: Routine.Kind) => {\n updateRoutine((routine) => {\n if (next === 'runnable') {\n // Switch to an operation action; the operation is chosen via the picker below. A previously-owned\n // instructions stays parented to the routine (cascade-deleted with it) but is no longer the action.\n routine.spec = undefined;\n } else if (routine.spec?.kind !== 'instructions') {\n // Seed an owned instructions action (the executing operation is the implicit RunInstructions).\n const instructions = Instructions.make({});\n Obj.setParent(instructions, routine);\n routine.spec = { kind: 'instructions', instructions: Ref.make(instructions) };\n }\n });\n // Re-wire the owned trigger to dispatch the new action (RunInstructions vs the operation).\n Routine.wireTriggers(routineProp);\n },\n [updateRoutine, routineProp],\n );\n\n return (\n <div role='none' className='flex flex-col'>\n {!readonly && <ActionKindToggle value={kind} onChange={handleKindChange} />}\n {kind === 'runnable' ? (\n <OperationEditor\n db={db}\n operations={operations}\n operation={operationRef}\n onChange={handleOperationChange}\n readonly={readonly}\n />\n ) : instructions ? (\n <InstructionsEditor db={db} instructions={instructions} readonly={readonly} />\n ) : null}\n </div>\n );\n};\n\nconst ActionKindToggle = ({ value, onChange }: { value: Routine.Kind; onChange: (kind: Routine.Kind) => void }) => {\n const { t } = useTranslation(meta.profile.key);\n return (\n // `type='single'` emits `''` when the selected item is clicked again (toggled off); ignore that and any\n // other non-kind value so it can't fall through and overwrite the current action.\n <ToggleGroup\n type='single'\n value={value}\n onValueChange={(next) => {\n if (next === 'instructions' || next === 'runnable') {\n onChange(next);\n }\n }}\n >\n <ToggleGroupItem value='instructions'>{t('action-kind.instructions.label')}</ToggleGroupItem>\n <ToggleGroupItem value='runnable'>{t('action-kind.operation.label')}</ToggleGroupItem>\n </ToggleGroup>\n );\n};\n\nconst OperationActionForm = Schema.Struct({\n operation: Ref.Ref(Operation.PersistentOperation).pipe(Schema.annotations({ title: 'Operation' }), Schema.optional),\n});\ntype OperationActionValues = Schema.Schema.Type<typeof OperationActionForm>;\n\n// Operation picker options: surface each operation's registry key (plugin/id) as the option's secondary\n// line and sort by name. The `id` derivation mirrors the RefField default so a selected operation ref\n// still matches its option.\nconst getOperationOptions = (results: Entity.Any[]): { id: string; label: string; description?: string }[] =>\n results\n // Hide internal operations: only operations annotated visible are user-bindable as trigger actions.\n .filter((operation) => !Obj.instanceOf(Operation.PersistentOperation, operation) || Operation.isVisible(operation))\n .map((operation) => {\n const id = Entity.getURI(operation, { prefer: 'named' });\n const name = Entity.getLabel(operation) ?? id;\n const key = Obj.instanceOf(Operation.PersistentOperation, operation) ? Operation.getKey(operation) : undefined;\n return { id, label: name, description: key };\n })\n .sort((left, right) => left.label.localeCompare(right.label));\n\n/** Sub-form: ref picker for an Operation. Draws options from the queried operation set (space + registry). */\nconst OperationEditor = ({\n db,\n operations,\n operation,\n onChange,\n readonly,\n}: {\n db: Database.Database;\n operations: ReturnType<typeof useOperations>;\n operation?: Ref.Ref<Operation.PersistentOperation>;\n onChange?: (operation?: Ref.Ref<Operation.PersistentOperation>) => void;\n readonly?: boolean;\n}) => {\n const fieldMap = useMemo<FormFieldMap>(\n () => ({\n operation: (props) => (\n <RefField {...props} db={db} useResults={() => operations} getOptions={getOperationOptions} />\n ),\n }),\n [db, operations],\n );\n const defaultValues = useMemo<Partial<OperationActionValues>>(() => ({ operation }), [operation]);\n const handleValuesChanged = useCallback(\n (values: Partial<OperationActionValues>) => onChange?.(values.operation),\n [onChange],\n );\n\n return (\n <Form.Root\n schema={OperationActionForm}\n db={db}\n readonly={readonly}\n defaultValues={defaultValues}\n fieldMap={fieldMap}\n onValuesChanged={handleValuesChanged}\n >\n <Form.FieldSet />\n </Form.Root>\n );\n};\n\n//\n// Hooks\n//\n\n/** Operations available to bind as an action (space-resident plus registry / plugin-provided). */\nconst useOperations = (db: Database.Database) =>\n useQuery(\n db,\n Query.select(Filter.type(DXN.make(Type.getTypename(Operation.PersistentOperation)))).from(\n Scope.space(),\n Scope.registry(),\n ),\n );\n\n/** Subscribe to the routine and derive its primary (first) trigger. */\nconst usePrimaryTrigger = (routine: Routine.Routine): Trigger.Trigger | undefined => {\n const [snapshot] = useObject(routine);\n return useMemo(() => {\n for (const ref of snapshot.triggers) {\n const target = ref.target;\n if (Obj.instanceOf(Trigger.Trigger, target)) {\n return target;\n }\n }\n return undefined;\n }, [snapshot.triggers]);\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Option from 'effect/Option';\nimport React, { useCallback, useMemo } from 'react';\n\nimport { Instructions, Skill } from '@dxos/compute';\nimport { type Database, Entity, Obj, Type } from '@dxos/echo';\nimport { HiddenAnnotation } from '@dxos/echo/Annotation';\nimport { Form } from '@dxos/react-ui-form';\n\nconst INSTRUCTIONS_SCHEMA = Type.getSchema(Instructions.Instructions);\n\n// Owned-routine action fields surfaced for editing — the prompt text, the agent's `skills`,\n// and the context `objects` bound to its session at run. All live on the Instructions schema,\n// so a single form edits them together.\nconst INSTRUCTIONS_FIELDS = new Set(['text', 'skills', 'objects']);\n\nexport type InstructionsEditorProps = {\n db?: Database.Database;\n instructions: Instructions.Instructions;\n readonly?: boolean;\n};\n\n/**\n * Sub-form: edits the owned Instructions in place — its `text` (Markdown), `skills`, and the\n * context `objects` bound to its session at run, all fields of the Instructions schema. A bare Form.Root +\n * FieldSet (no Viewport) keeps these fields left-aligned with the sibling general/action forms; the\n * rendered fields are written back so selections persist to the instructions.\n */\nexport const InstructionsEditor = ({ db: dbProp, instructions, readonly }: InstructionsEditorProps) => {\n // A draft routine is not yet attached to a database, so fall back to the explicit `db` for ref queries.\n const db = dbProp ?? Obj.getDatabase(instructions);\n\n // `objects` is optional; normalize to an array so the ref-array field renders its add affordance.\n const defaultValues = useMemo<Partial<Instructions.Instructions>>(\n () => ({ ...Obj.getSnapshot(instructions), objects: instructions.objects ? [...instructions.objects] : [] }),\n [instructions],\n );\n\n const handleValuesChanged = useCallback(\n (values: Partial<Instructions.Instructions>, { isValid }: { isValid: boolean }) => {\n // Skip while invalid (e.g. an empty ref slot just added by a skills/objects array field) so a\n // partial selection isn't persisted; the write lands once the slot is filled.\n if (!isValid) {\n return;\n }\n\n Obj.update(instructions, (instructions) => {\n if (values.text) {\n instructions.text = values.text;\n }\n instructions.skills = [...(values.skills ?? [])];\n instructions.objects = [...(values.objects ?? [])];\n });\n },\n [instructions],\n );\n\n return (\n <Form.Root\n key={instructions.id}\n schema={INSTRUCTIONS_SCHEMA}\n db={db}\n readonly={readonly}\n defaultValues={defaultValues}\n getOptions={getRefOptions}\n onValuesChanged={handleValuesChanged}\n >\n <Form.FieldSet filter={(props) => props.filter((prop) => INSTRUCTIONS_FIELDS.has(prop.name.toString()))} />\n </Form.Root>\n );\n};\n\n// System objects (e.g. SpaceProperties) carry `HiddenAnnotation` on their type; they are infrastructure,\n// not user content, so they are excluded from the context picker.\nconst isSystemObject = (object: Entity.Any): boolean => {\n if (!Obj.isObject(object)) {\n return false;\n }\n const typeEntity = Obj.getType(object);\n if (!typeEntity) {\n return false;\n }\n\n return HiddenAnnotation.get(Type.getSchema(typeEntity)).pipe(Option.getOrElse(() => false));\n};\n\n// Ref-picker options shared by the routine form's skill and object fields: surface a secondary line\n// per candidate — a Skill's registry key, otherwise the object's typename — and sort by label, so the\n// pickers present refs consistently. Falls back to the type placeholder (then URI) for unlabelled objects,\n// matching the default RefField; system objects are excluded.\nconst getRefOptions = (\n results: Entity.Any[],\n { getTypePlaceholder }: { getTypePlaceholder?: (typename: string) => string } = {},\n): { id: string; label: string; description?: string }[] =>\n results\n .filter((entity) => !isSystemObject(entity))\n .map((entity) => {\n const id = Entity.getURI(entity, { prefer: 'named' });\n const typename = Entity.getTypename(entity);\n const label = Entity.getLabel(entity) ?? (typename ? getTypePlaceholder?.(typename) : undefined) ?? id;\n const description = Obj.instanceOf(Skill.Skill, entity) ? Obj.getMeta(entity).key : typename;\n return { id, label, description };\n })\n .sort((left, right) => left.label.localeCompare(right.label));\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport React, { useCallback, useMemo, useState } from 'react';\n\nimport { Trigger } from '@dxos/compute';\nimport { type Database, DXN, Feed, Filter, Obj, Query, Ref, Scope, Type } from '@dxos/echo';\nimport { useQuery } from '@dxos/react-client/echo';\nimport { IconButton, Input, ThemedClassName, useTranslation } from '@dxos/react-ui';\nimport { Form, type FormFieldMap, type FormFieldRendererProps, SelectField } from '@dxos/react-ui-form';\nimport { ParentLabelAnnotation } from '@dxos/schema';\nimport { mx } from '@dxos/ui-theme';\n\nimport { meta } from '#meta';\nimport { Routine } from '#types';\n\nimport {\n FrequencyDefaults,\n Schedule,\n type ScheduleKind,\n type ScheduleValue,\n cronToSchedule,\n scheduleToCron,\n toCron,\n} from '../Schedule';\nimport { type TriggerKind, TriggerKindSelector } from './TriggerKindSelector';\n\n// A recurring trigger fires on a cron, so the one-time `once` kind is not offered here.\nconst RECURRING_KINDS = ['hourly', 'daily', 'weekly', 'monthly', 'custom'] as const satisfies readonly ScheduleKind[];\n\n// The `enabled` toggle is a field of the Trigger object (sibling of `spec`), not of any spec variant. It is\n// reused from the Trigger schema (rather than redeclared) and extended onto every form member so the editor\n// surfaces it once a kind is chosen; the value is written back to `trigger.enabled`, not the spec.\nconst EnabledForm = Type.getSchema(Trigger.Trigger).pipe(Schema.pick('enabled'));\n\n// Scoped trigger form, modeled as a top-level discriminated union (one member per pluggable variant) so the\n// Form renders the chosen kind's fields as one flat field set (no nested, bordered sub-fieldset). The kind\n// itself is chosen by `TriggerKindPicker` (a radio-card list) rather than a select. The feed field carries\n// ParentLabelAnnotation so the built-in RefField labels feed options by their parent object (e.g. the mailbox).\nconst TimerSpecForm = Schema.extend(\n Schema.Struct({\n kind: Schema.Literal('timer'),\n cron: Schema.String.pipe(Schema.annotations({ title: 'Schedule (cron)' }), Schema.optional),\n }),\n EnabledForm,\n);\n\nconst SubscriptionSpecForm = Schema.extend(\n Schema.Struct({\n kind: Schema.Literal('subscription'),\n // The object type to watch; converted to a `Filter.type` query. `typename` renders via a custom select of\n // the space/registry types (see `TypeSelectField`); `deep`/`delay` map to the subscription's options.\n typename: Schema.String.pipe(Schema.annotations({ title: 'Type' }), Schema.optional),\n deep: Schema.Boolean.pipe(Schema.annotations({ title: 'Nested' }), Schema.optional),\n delay: Schema.Number.pipe(Schema.annotations({ title: 'Delay (ms)' }), Schema.optional),\n }),\n EnabledForm,\n);\n\nconst WebhookSpecForm = Schema.extend(\n Schema.Struct({\n kind: Schema.Literal('webhook'),\n method: Schema.String.pipe(Schema.annotations({ title: 'Method' }), Schema.optional),\n port: Schema.Number.pipe(Schema.annotations({ title: 'Port' }), Schema.optional),\n }),\n EnabledForm,\n);\n\nconst FeedSpecForm = Schema.extend(\n Schema.Struct({\n kind: Schema.Literal('feed'),\n feed: Ref.Ref(Feed.Feed).pipe(\n ParentLabelAnnotation.set(true),\n Schema.annotations({ title: 'Feed' }),\n Schema.optional,\n ),\n }),\n EnabledForm,\n);\n\nconst EmailSpecForm = Schema.extend(\n Schema.Struct({\n kind: Schema.Literal('email'),\n }),\n EnabledForm,\n);\n\nconst TriggerForm = Schema.Union(TimerSpecForm, SubscriptionSpecForm, WebhookSpecForm, FeedSpecForm, EmailSpecForm);\ntype TriggerFormValues = Schema.Schema.Type<typeof TriggerForm>;\n\n// Flat view of the form values: `Partial<TriggerFormValues>` collapses a discriminated union to its common\n// key alone (`kind`), so reach the variant fields through this all-optional shape instead. `Partial<T>` is\n// assignable to it, so handlers/helpers can accept the Form's value verbatim and still read the variant fields.\ntype TriggerFormInput = {\n readonly kind?: TriggerKind;\n readonly enabled?: boolean;\n readonly cron?: string;\n readonly method?: string;\n readonly port?: number;\n readonly feed?: Ref.Ref<Feed.Feed>;\n readonly typename?: string;\n readonly deep?: boolean;\n readonly delay?: number;\n};\n\n/** Project a trigger spec onto the form's discriminated-union members. */\nconst triggerFormValues = (spec?: Trigger.Spec): TriggerFormInput => {\n switch (spec?.kind) {\n case 'subscription':\n // The watched typename is preserved in `query.raw` so the Type select can round-trip it.\n return {\n kind: 'subscription',\n typename: spec.query?.raw,\n deep: spec.options?.deep,\n delay: spec.options?.delay,\n };\n case 'feed':\n return {\n kind: 'feed',\n feed: spec.feed,\n };\n case 'webhook':\n return {\n kind: 'webhook',\n method: spec.method,\n port: spec.port,\n };\n case 'email':\n return {\n kind: 'email',\n };\n case 'timer':\n return {\n kind: 'timer',\n cron: spec.cron,\n };\n default:\n // No spec yet: leave the kind unset so the editor shows the variant picker (nothing selected).\n return {};\n }\n};\n\n// Fallback cron used when no schedule has been set yet.\nconst DEFAULT_TIMER_CRON = toCron(FrequencyDefaults.daily);\n\n/** Build the subscription query: filter by the chosen type, or match everything until one is picked. */\nconst subscriptionQuery = (typename?: string): Query.Any =>\n typename ? Query.select(Filter.type(DXN.make(typename))) : Query.select(Filter.everything());\n\n/** Build a trigger spec from the form's values. */\nconst triggerFormSpec = (values: TriggerFormInput): Trigger.Spec => {\n switch (values.kind) {\n case 'subscription': {\n const hasOptions = values.deep != null || values.delay != null;\n return {\n kind: 'subscription',\n // Carry the typename in `raw` so the editor can recover the Type selection on reopen.\n query: { raw: values.typename, ast: subscriptionQuery(values.typename).ast },\n options: hasOptions ? { deep: values.deep, delay: values.delay } : undefined,\n };\n }\n case 'feed':\n return {\n kind: 'feed',\n feed: values.feed,\n };\n case 'webhook':\n return Trigger.specWebhook({ method: values.method, port: values.port });\n case 'email':\n return Trigger.specEmail();\n case 'timer':\n default:\n return Trigger.specTimer(values.cron || DEFAULT_TIMER_CRON);\n }\n};\n\nexport type TriggerEditorProps = ThemedClassName<{\n db: Database.Database;\n routine: Routine.Routine;\n trigger?: Trigger.Trigger;\n /** Render the trigger for display only (no variant picker, clear, or field edits). */\n readonly?: boolean;\n}>;\n\nexport const TriggerEditor = ({ classNames, db, routine, trigger, readonly }: TriggerEditorProps) => {\n const { t } = useTranslation(meta.profile.key);\n const { defaultValues, fieldMap, kind, resetNonce, handleClose, handleValuesChanged } = useTriggerForm(\n routine,\n trigger,\n );\n\n // TODO(burdon): Not persistent; need to memo\n return (\n <Form.Root\n // Remount when the bound trigger changes (picks up its spec) or on reset (reverts to the picker).\n key={`${trigger?.id ?? 'new'}:${resetNonce}`}\n schema={TriggerForm}\n db={db}\n readonly={readonly}\n fieldMap={fieldMap}\n defaultValues={defaultValues}\n onValuesChanged={handleValuesChanged}\n >\n <Form.Content classNames={mx(kind && 'pb-2 bg-card-surface border border-separator rounded-xs', classNames)}>\n {/* TODO(burdon): Generalize indented section for discriminated unions. */}\n {(kind && (\n <>\n <div className='flex items-center'>\n <Input.Root>\n <Input.Label classNames='pl-2 grow truncate'>{t(`trigger-kind.${kind}.label`)}</Input.Label>\n </Input.Root>\n {!readonly && (\n <IconButton\n iconOnly\n variant='ghost'\n square\n icon='ph--x--regular'\n label={t('trigger-kind.clear.label')}\n onClick={handleClose}\n />\n )}\n </div>\n <Form.FieldSet classNames='px-2' />\n </>\n )) || <Form.FieldSet />}\n\n {/* Email triggers have no configuration; surface an explanatory note instead of an empty body. */}\n {kind === 'email' && <p className='px-2 text-sm text-description'>{t('trigger-kind.email-note.message')}</p>}\n </Form.Content>\n </Form.Root>\n );\n};\n\n/** Selects the ECHO object type to watch (subscription `typename`) from the space + registry schemas. */\nconst TypeSelectField = (props: FormFieldRendererProps) => {\n const types = useQuery(props.db, Query.select(Filter.type(Type.Type)).from(Scope.space(), Scope.registry()));\n const options = useMemo(\n () =>\n types\n .filter((type) => !Type.isTypeKind(type))\n .map((type) => Type.getTypename(type))\n .filter((typename): typename is string => !!typename)\n .map((typename) => ({ value: typename, label: typename })),\n [types],\n );\n return <SelectField {...props} options={options} />;\n};\n\nTypeSelectField.displayName = 'TriggerEditor.TypeSelectField';\n\n/** Edits the cron via the Schedule picker (recurring kinds only) with a live cronstrue description below it. */\nconst CronField = (props: FormFieldRendererProps) => {\n const cron = (props.getValue() as string | undefined) || DEFAULT_TIMER_CRON;\n // Read once per mount; the Schedule owns its state and emits cron changes via `handleChange`.\n const initial = useMemo(() => cronToSchedule(cron), []);\n\n const handleChange = useCallback(\n (value: ScheduleValue) => {\n const next = scheduleToCron(value);\n if (next) {\n props.onValueChange(props.type, next);\n }\n },\n [props.type, props.onValueChange],\n );\n\n // TODO(wittjosiah): Add read-only support.\n return (\n <Schedule.Root kinds={RECURRING_KINDS} defaultValue={initial} onValueChange={handleChange}>\n <Schedule.Header />\n <Schedule.Kind />\n <Schedule.Body />\n </Schedule.Root>\n );\n};\n\nCronField.displayName = 'TriggerEditor.CronField';\n\n/** Form state for the Trigger section: the chosen variant spec, plus create-on-first-edit handler. */\nconst useTriggerForm = (routine: Routine.Routine, trigger?: Trigger.Trigger) => {\n const methodOptions = useMemo(\n () => [\n { value: 'GET', label: 'GET' },\n { value: 'POST', label: 'POST' },\n ],\n [],\n );\n\n const fieldMap = useMemo<FormFieldMap>(\n () => ({\n // Show the variant picker only until a kind is chosen; once selected the row is replaced by that\n // variant's editor (the kind field renders nothing).\n kind: (props) =>\n props.getValue() ? null : <TriggerKindSelector onChange={(next) => props.onValueChange(props.type, next)} />,\n cron: (props) => <CronField {...props} />,\n method: (props) => <SelectField {...props} options={methodOptions} />,\n typename: (props) => <TypeSelectField {...props} />,\n }),\n [methodOptions],\n );\n\n // Bumping this remounts the uncontrolled Form so it re-reads `defaultValues` (used to revert to the picker).\n const [resetNonce, setResetNonce] = useState(0);\n // Read per trigger identity / reset; a trigger with no spec yet starts with no kind (shows the picker).\n // `enabled` is a Trigger-level field, seeded alongside the spec-derived variant values.\n const defaultValues = useMemo<Partial<TriggerFormValues>>(\n () => ({ ...triggerFormValues(trigger?.spec), enabled: trigger?.enabled }),\n [trigger, resetNonce],\n );\n\n // Mirror the active kind: gates the variant picker (shown only while unset) and the variant-specific notes.\n const [kind, setKind] = useState<TriggerKind | undefined>(() => triggerFormValues(trigger?.spec).kind);\n\n // Revert the kind selection: clear the trigger's spec and remount the Form so the picker reappears.\n const handleClose = useCallback(() => {\n setKind(undefined);\n setResetNonce((nonce) => nonce + 1);\n if (trigger) {\n Obj.update(trigger, (trigger) => {\n trigger.spec = undefined;\n });\n }\n }, [trigger]);\n\n const handleValuesChanged = useCallback(\n (values: Partial<TriggerFormValues>) => {\n // Ignore changes until a kind is picked, so the unselected picker never seeds a default trigger.\n if (!values.kind) {\n return;\n }\n\n const spec = triggerFormSpec(values);\n setKind(spec.kind);\n const enabled = values.enabled === true;\n // Edit the spec and `enabled` on the trigger; the trigger's `function` and `input` (including the\n // instructions binding and any operation-specific bindings like `{ magazine }`) are wired once by\n // `Routine.make`, so they are not re-derived here.\n if (trigger) {\n Obj.update(trigger, (trigger) => {\n // The subscription spec's QueryAST is deeply readonly while the live ECHO draft's `spec` is mutable;\n // the structures are identical at runtime, so a readonly->mutable boundary coercion is required here\n // (mirrors commands/trigger/update/subscription.ts).\n trigger.spec = spec as typeof trigger.spec;\n trigger.enabled = enabled;\n });\n } else {\n // Defensive: the draft normally carries an owned trigger already (see `Routine.make`). If absent,\n // create one in memory and attach it to the routine graph — nothing is persisted until save.\n const created = Trigger.make({ spec, enabled });\n Obj.setParent(created, routine);\n Obj.update(routine, (routine) => {\n routine.triggers.push(Ref.make(created));\n });\n // Wire the new trigger's `function`/`input` to dispatch the routine's action (RunInstructions binds the\n // owned instructions; an operation binds directly).\n Routine.wireTriggers(routine);\n }\n },\n [routine, trigger],\n );\n\n return { defaultValues, fieldMap, kind, resetNonce, handleClose, handleValuesChanged };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport cronstrue from 'cronstrue';\n\nimport type { ScheduleValue } from './Schedule';\nimport type { CronSpecType, DayOfWeek } from './types';\n\nconst DOW_MAP: Record<DayOfWeek, number> = {\n sun: 0,\n mon: 1,\n tue: 2,\n wed: 3,\n thu: 4,\n fri: 5,\n sat: 6,\n};\n\n/**\n * Derives a 5-field standard cron expression from a decomposed CronSpec value.\n * Fields: minute hour day-of-month month day-of-week\n */\nexport const toCron = (value: CronSpecType): string => {\n switch (value.frequency) {\n case 'minutely':\n return `*/${value.interval} * * * *`;\n\n case 'hourly':\n return `${value.minute} */${value.interval} * * *`;\n\n case 'daily':\n return `${value.minute} ${value.hour} * * *`;\n\n case 'weekly': {\n const dow = value.daysOfWeek.length > 0 ? value.daysOfWeek.map((d) => DOW_MAP[d]).join(',') : '*';\n return `${value.minute} ${value.hour} * * ${dow}`;\n }\n\n case 'monthly': {\n const dom = value.daysOfMonth.length > 0 ? value.daysOfMonth.join(',') : '*';\n return `${value.minute} ${value.hour} ${dom} * *`;\n }\n\n case 'custom':\n return value.cronExpression || '* * * * *';\n }\n};\n\nconst DOW_REVERSE: Partial<Record<string, DayOfWeek>> = {\n '0': 'sun',\n '1': 'mon',\n '2': 'tue',\n '3': 'wed',\n '4': 'thu',\n '5': 'fri',\n '6': 'sat',\n // Both 0 and 7 represent Sunday in standard cron.\n '7': 'sun',\n};\n\n/** Returns a non-negative integer if the token is a valid decimal integer, otherwise undefined. */\nconst parseUInt = (token: string): number | undefined => (/^\\d+$/.test(token) ? Number(token) : undefined);\n\n/** Returns the parsed integer if it falls within [min, max], otherwise undefined. */\nconst parseBoundedUInt = (token: string, min: number, max: number): number | undefined => {\n const value = parseUInt(token);\n return value !== undefined && value >= min && value <= max ? value : undefined;\n};\n\n/**\n * Parses a 5-field cron expression into a CronSpec value.\n * Recognises common patterns (minutely, hourly, daily, weekly, monthly) and falls back to `custom`.\n */\nexport const fromCron = (cron: string): CronSpecType => {\n const parts = cron.trim().split(/\\s+/);\n if (parts.length !== 5) {\n return { frequency: 'custom', cronExpression: cron };\n }\n\n const [minute, hour, dom, month, dow] = parts;\n\n // minutely: */N * * * *\n const minutelyMatch = minute.match(/^\\*\\/(\\d+)$/);\n if (minutelyMatch && hour === '*' && dom === '*' && month === '*' && dow === '*') {\n return { frequency: 'minutely', interval: parseInt(minutelyMatch[1]) };\n }\n\n // hourly: M */N * * *\n const hourlyMatch = hour.match(/^\\*\\/(\\d+)$/);\n const minuteNum = parseBoundedUInt(minute, 0, 59);\n if (hourlyMatch && dom === '*' && month === '*' && dow === '*' && minuteNum !== undefined) {\n return { frequency: 'hourly', interval: parseInt(hourlyMatch[1]), minute: minuteNum };\n }\n\n const hourNum = parseBoundedUInt(hour, 0, 23);\n if (minuteNum === undefined || hourNum === undefined) {\n return { frequency: 'custom', cronExpression: cron };\n }\n\n // weekly: M H * * DOW[,DOW...] (numeric DOW values only; all tokens must be valid)\n if (dom === '*' && month === '*' && dow !== '*') {\n const tokens = dow.split(',');\n const days = tokens.map((d) => DOW_REVERSE[d]).filter((d): d is DayOfWeek => d != null);\n if (days.length === tokens.length && days.length > 0) {\n return { frequency: 'weekly', daysOfWeek: days, hour: hourNum, minute: minuteNum };\n }\n return { frequency: 'custom', cronExpression: cron };\n }\n\n // monthly: M H DOM[,DOM...] * * (all tokens must be valid integers in 1-31)\n if (dom !== '*' && month === '*' && dow === '*') {\n const tokens = dom.split(',');\n const days = tokens.map((d) => parseBoundedUInt(d, 1, 31)).filter((d): d is number => d !== undefined);\n if (days.length === tokens.length && days.length > 0) {\n return { frequency: 'monthly', daysOfMonth: days, hour: hourNum, minute: minuteNum };\n }\n return { frequency: 'custom', cronExpression: cron };\n }\n\n // daily: M H * * *\n if (dom === '*' && month === '*' && dow === '*') {\n return { frequency: 'daily', hour: hourNum, minute: minuteNum };\n }\n\n return { frequency: 'custom', cronExpression: cron };\n};\n\n/**\n * Returns a human-readable description of a cron expression, e.g. \"At 09:00 on Monday\".\n * Falls back to the raw expression string on parse errors.\n */\nexport const describeCron = (cron: string): string => {\n try {\n return cronstrue.toString(cron, { throwExceptionOnParseError: true });\n } catch {\n return cron;\n }\n};\n\n//\n// Schedule <-> cron bridge.\n//\n\nconst pad = (value: number): string => String(value).padStart(2, '0');\n\nconst splitTime = (time: string): { hour: number; minute: number } => {\n const [hour, minute] = time.split(':').map(Number);\n return { hour: Number.isFinite(hour) ? hour : 0, minute: Number.isFinite(minute) ? minute : 0 };\n};\n\nconst joinTime = (hour: number, minute: number): string => `${pad(hour)}:${pad(minute)}`;\n\n/**\n * Convert a recurring {@link ScheduleValue} to a 5-field cron expression. The one-time `once` kind has no\n * cron representation and returns `undefined`.\n */\nexport const scheduleToCron = (value: ScheduleValue): string | undefined => {\n switch (value.kind) {\n case 'hourly':\n return toCron({ frequency: 'hourly', interval: 1, minute: value.minute });\n case 'daily': {\n const { hour, minute } = splitTime(value.time);\n return toCron({ frequency: 'daily', hour, minute });\n }\n case 'weekly': {\n const { hour, minute } = splitTime(value.time);\n return toCron({ frequency: 'weekly', daysOfWeek: value.days, hour, minute });\n }\n case 'monthly': {\n const { hour, minute } = splitTime(value.time);\n return toCron({ frequency: 'monthly', daysOfMonth: [value.day], hour, minute });\n }\n case 'custom':\n return toCron({ frequency: 'custom', cronExpression: value.cron });\n }\n};\n\n//\n// Minimum-interval constraint.\n//\n\nconst MINUTE_SECONDS = 60;\nconst HOUR_SECONDS = 60 * 60;\nconst DAY_SECONDS = 24 * HOUR_SECONDS;\n\n/** Upper bound for a Schedule minimum interval: a 5-field cron's coarsest single-field cadence is hourly. */\nexport const MAX_MIN_INTERVAL_SECONDS = HOUR_SECONDS;\n\n/** Parses a comma-separated list of bounded integers; returns undefined if any token is not a plain integer in range. */\nconst parseList = (field: string, min: number, max: number): number[] | undefined => {\n const tokens = field.split(',');\n const values = tokens\n .map((token) => parseBoundedUInt(token, min, max))\n .filter((value): value is number => value !== undefined);\n return values.length === tokens.length && values.length > 0 ? values : undefined;\n};\n\n/**\n * Smallest cyclic gap between values in a field whose domain wraps at `span` (60 for minutes, 24 for hours),\n * or Infinity for a single value. The wrap is required so e.g. minutes `0,59` register their 1-unit gap\n * (59 → 0 of the next cycle), not just the 59-unit one.\n */\nconst minGap = (values: number[], span: number): number => {\n const sorted = [...new Set(values)].sort((lhs, rhs) => lhs - rhs);\n if (sorted.length <= 1) {\n return Number.POSITIVE_INFINITY;\n }\n let gap = Number.POSITIVE_INFINITY;\n for (let index = 0; index < sorted.length; index++) {\n const next = index === sorted.length - 1 ? sorted[0] + span : sorted[index + 1];\n gap = Math.min(gap, next - sorted[index]);\n }\n return gap;\n};\n\n/** Step value of a `*\\/N`, `M/N`, or `A-B/N` field (the cadence between fires), or undefined if not a step form. */\nconst parseStep = (field: string, max: number): number | undefined => {\n const match = field.match(/^(?:\\*|\\d+(?:-\\d+)?)\\/(\\d+)$/);\n return match ? parseBoundedUInt(match[1], 1, max) : undefined;\n};\n\n/** Minimum seconds between fires implied by a cron's hour field (independent of minute granularity). */\nconst hourIntervalSeconds = (hour: string): number => {\n const step = parseStep(hour, 23);\n if (step !== undefined) {\n return step * HOUR_SECONDS;\n }\n if (hour === '*') {\n return HOUR_SECONDS;\n }\n const hours = parseList(hour, 0, 23);\n if (hours) {\n return hours.length > 1 ? minGap(hours, 24) * HOUR_SECONDS : DAY_SECONDS;\n }\n return Number.POSITIVE_INFINITY;\n};\n\n/**\n * Best-effort minimum seconds between consecutive fires of a 5-field cron expression. Recognises the patterns\n * a too-frequent schedule can take (`* …`, `*\\/N …`, explicit minute/hour lists); returns Infinity for\n * expressions it cannot analyse, so unrecognised crons are treated as satisfying any minimum.\n */\nexport const cronIntervalSeconds = (cron: string): number => {\n const parts = cron.trim().split(/\\s+/);\n if (parts.length !== 5) {\n return Number.POSITIVE_INFINITY;\n }\n\n const [minute, hour] = parts;\n const minuteStep = parseStep(minute, 59);\n if (minuteStep !== undefined) {\n return minuteStep * MINUTE_SECONDS;\n }\n if (minute === '*') {\n return MINUTE_SECONDS;\n }\n\n const minutes = parseList(minute, 0, 59);\n if (minutes) {\n const minuteGap = minutes.length > 1 ? minGap(minutes, 60) * MINUTE_SECONDS : Number.POSITIVE_INFINITY;\n return Math.min(minuteGap, hourIntervalSeconds(hour));\n }\n\n return Number.POSITIVE_INFINITY;\n};\n\n/**\n * Rewrites a cron's minute field so it fires no more often than `minIntervalSeconds`. Used to clamp a custom\n * expression; leaves non-5-field expressions untouched since their cadence cannot be reasoned about.\n */\nconst clampCronMinute = (cron: string, minIntervalSeconds: number): string => {\n const parts = cron.trim().split(/\\s+/);\n if (parts.length !== 5) {\n return cron;\n }\n const stepMinutes = Math.ceil(minIntervalSeconds / MINUTE_SECONDS);\n // A step that spans the whole minute range fires only at minute 0; express that as the hourly cadence.\n parts[0] = stepMinutes >= 60 ? '0' : `*/${stepMinutes}`;\n return parts.join(' ');\n};\n\n/** Minimum seconds between fires for a recurring {@link ScheduleValue}. */\nexport const scheduleIntervalSeconds = (value: ScheduleValue): number => {\n switch (value.kind) {\n case 'hourly':\n return HOUR_SECONDS;\n case 'daily':\n return DAY_SECONDS;\n // Consecutive selected weekdays sit one day apart at closest.\n case 'weekly':\n return DAY_SECONDS;\n // Approximate the shortest month to stay conservative.\n case 'monthly':\n return 28 * DAY_SECONDS;\n case 'custom':\n return cronIntervalSeconds(value.cron);\n }\n};\n\n/**\n * Coerces a schedule so it fires no more often than `minIntervalSeconds`. Only `custom` expressions can exceed\n * the limit (structured kinds are hourly or slower), so clamping rewrites the cron's minute field; all other\n * values pass through unchanged.\n */\nexport const clampSchedule = (value: ScheduleValue, minIntervalSeconds: number): ScheduleValue => {\n if (value.kind !== 'custom' || cronIntervalSeconds(value.cron) >= minIntervalSeconds) {\n return value;\n }\n return { kind: 'custom', cron: clampCronMinute(value.cron, minIntervalSeconds) };\n};\n\n/**\n * Convert a cron expression to a recurring {@link ScheduleValue}. Patterns that Schedule cannot model exactly\n * (sub-hourly intervals, multi-day months, etc.) fall back to the `custom` kind preserving the raw expression.\n */\nexport const cronToSchedule = (cron: string): ScheduleValue => {\n const spec = fromCron(cron);\n switch (spec.frequency) {\n case 'hourly':\n // Schedule's hourly runs at the top of every hour; a non-unit interval can't be modelled.\n return spec.interval === 1 ? { kind: 'hourly', minute: spec.minute } : { kind: 'custom', cron };\n case 'daily':\n return { kind: 'daily', time: joinTime(spec.hour, spec.minute) };\n case 'weekly':\n return { kind: 'weekly', time: joinTime(spec.hour, spec.minute), days: [...spec.daysOfWeek] };\n case 'monthly':\n // Schedule models a single day-of-month; multiple days remain custom.\n return spec.daysOfMonth.length === 1\n ? { kind: 'monthly', day: spec.daysOfMonth[0], time: joinTime(spec.hour, spec.minute) }\n : { kind: 'custom', cron };\n case 'minutely':\n case 'custom':\n default:\n return { kind: 'custom', cron };\n }\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nexport const MinutelySpec = Schema.Struct({\n frequency: Schema.Literal('minutely').annotations({ title: 'Frequency' }),\n interval: Schema.Number.pipe(Schema.int(), Schema.between(1, 59)).annotations({\n title: 'Every (minutes)',\n description: '1–59',\n }),\n});\n\nexport const HourlySpec = Schema.Struct({\n frequency: Schema.Literal('hourly').annotations({ title: 'Frequency' }),\n interval: Schema.Number.pipe(Schema.int(), Schema.between(1, 23)).annotations({\n title: 'Every (hours)',\n description: '1–23',\n }),\n minute: Schema.Number.pipe(Schema.int(), Schema.between(0, 59)).annotations({\n title: 'At minute',\n description: '0–59',\n }),\n});\n\nexport const DailySpec = Schema.Struct({\n frequency: Schema.Literal('daily').annotations({ title: 'Frequency' }),\n hour: Schema.Number.pipe(Schema.int(), Schema.between(0, 23)).annotations({\n title: 'Hour',\n description: '0–23',\n }),\n minute: Schema.Number.pipe(Schema.int(), Schema.between(0, 59)).annotations({\n title: 'Minute',\n description: '0–59',\n }),\n});\n\n// Named day-of-week literals for UX clarity; cron.ts maps them to numeric DOW values.\nexport const DayOfWeek = Schema.Literal('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat');\nexport type DayOfWeek = Schema.Schema.Type<typeof DayOfWeek>;\n\nexport const WeeklySpec = Schema.Struct({\n frequency: Schema.Literal('weekly').annotations({ title: 'Frequency' }),\n daysOfWeek: Schema.Array(DayOfWeek.annotations({ title: 'Day' })).annotations({ title: 'Days of week' }),\n hour: Schema.Number.pipe(Schema.int(), Schema.between(0, 23)).annotations({\n title: 'Hour',\n description: '0–23',\n }),\n minute: Schema.Number.pipe(Schema.int(), Schema.between(0, 59)).annotations({\n title: 'Minute',\n description: '0–59',\n }),\n});\n\nexport const MonthlySpec = Schema.Struct({\n frequency: Schema.Literal('monthly').annotations({ title: 'Frequency' }),\n daysOfMonth: Schema.Array(\n Schema.Number.pipe(Schema.int(), Schema.between(1, 31)).annotations({ title: 'Day' }),\n ).annotations({\n title: 'Days of month',\n }),\n hour: Schema.Number.pipe(Schema.int(), Schema.between(0, 23)).annotations({\n title: 'Hour',\n description: '0–23',\n }),\n minute: Schema.Number.pipe(Schema.int(), Schema.between(0, 59)).annotations({\n title: 'Minute',\n description: '0–59',\n }),\n});\n\nexport const CustomSpec = Schema.Struct({\n frequency: Schema.Literal('custom').annotations({ title: 'Frequency' }),\n cronExpression: Schema.String.annotations({\n title: 'Cron expression',\n description: 'e.g. 0 9 * * MON-FRI',\n }),\n});\n\nexport const CronSpec = Schema.Union(\n MinutelySpec,\n HourlySpec,\n DailySpec,\n WeeklySpec,\n MonthlySpec,\n CustomSpec,\n).annotations({ title: '' });\n\nexport type CronSpecType = Schema.Schema.Type<typeof CronSpec>;\nexport type Frequency = CronSpecType['frequency'];\n\nexport const FrequencyDefaults: { [K in Frequency]: Extract<CronSpecType, { frequency: K }> } = {\n minutely: {\n frequency: 'minutely',\n interval: 15,\n },\n hourly: {\n frequency: 'hourly',\n interval: 1,\n minute: 0,\n },\n daily: {\n frequency: 'daily',\n hour: 9,\n minute: 0,\n },\n weekly: {\n frequency: 'weekly',\n daysOfWeek: ['mon'],\n hour: 9,\n minute: 0,\n },\n monthly: {\n frequency: 'monthly',\n daysOfMonth: [1],\n hour: 9,\n minute: 0,\n },\n custom: {\n frequency: 'custom',\n cronExpression: '* * * * *',\n },\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport React, { type PropsWithChildren, createContext, forwardRef, useCallback, useContext, useState } from 'react';\n\nimport { invariant } from '@dxos/invariant';\nimport {\n Input,\n ThemedClassName,\n ToggleGroup,\n ToggleGroupItem,\n composable,\n composableProps,\n useTranslation,\n} from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\nimport { meta } from '#meta';\n\nimport {\n MAX_MIN_INTERVAL_SECONDS,\n clampSchedule,\n describeCron,\n fromCron,\n scheduleIntervalSeconds,\n scheduleToCron,\n} from './cron';\n\n//\n// Value model.\n//\n\nexport const ScheduleKinds = [\n // TODO(burdon): Once cannot be converted to a cron expression.\n // 'once',\n 'hourly',\n 'daily',\n 'weekly',\n 'monthly',\n 'custom',\n] as const;\nexport type ScheduleKind = (typeof ScheduleKinds)[number];\n\nconst isScheduleKind = (value: string): value is ScheduleKind => (ScheduleKinds as readonly string[]).includes(value);\n\nexport const Days = [\n { value: 'mon', label: 'Mon' },\n { value: 'tue', label: 'Tue' },\n { value: 'wed', label: 'Wed' },\n { value: 'thu', label: 'Thu' },\n { value: 'fri', label: 'Fri' },\n { value: 'sat', label: 'Sat' },\n { value: 'sun', label: 'Sun' },\n] as const;\nexport type Day = (typeof Days)[number]['value'];\n\n/** Discriminated schedule value. Times are `HH:mm` (24h); `once.date` is `YYYY-MM-DDTHH:mm`. */\nexport type ScheduleValue =\n // | { kind: 'once'; date?: string }\n | { kind: 'hourly'; minute: number }\n | { kind: 'daily'; time: string }\n | { kind: 'weekly'; time: string; days: Day[] }\n | { kind: 'monthly'; day: number; time: string }\n | { kind: 'custom'; cron: string };\n\nconst DEFAULT_TIME = '08:00';\n\n/** Default minimum interval: a schedule may fire at most once every 60s (the finest 5-field cron granularity). */\nconst DEFAULT_MIN_INTERVAL_SECONDS = 60;\n\n/** Clamp a requested minimum interval to the achievable range; a 5-field cron cannot fire more often than every minute or require slower than hourly. */\nconst normalizeMinInterval = (minInterval: number): number => {\n // Guard non-finite input (NaN/Infinity) so the clamp can't yield NaN and produce a `*/NaN` cron.\n const finite = Number.isFinite(minInterval) ? minInterval : DEFAULT_MIN_INTERVAL_SECONDS;\n return Math.min(MAX_MIN_INTERVAL_SECONDS, Math.max(DEFAULT_MIN_INTERVAL_SECONDS, Math.round(finite)));\n};\n\nconst KIND_LABEL_KEYS: Record<ScheduleKind, string> = {\n // once: 'schedule.kind.once.label',\n hourly: 'schedule.kind.hourly.label',\n daily: 'schedule.kind.daily.label',\n weekly: 'schedule.kind.weekly.label',\n monthly: 'schedule.kind.monthly.label',\n custom: 'schedule.kind.custom.label',\n};\n\nconst DEFAULTS: { [K in ScheduleKind]: Extract<ScheduleValue, { kind: K }> } = {\n // once: {\n // kind: 'once',\n // },\n hourly: {\n kind: 'hourly',\n minute: 0,\n },\n daily: {\n kind: 'daily',\n time: DEFAULT_TIME,\n },\n weekly: {\n kind: 'weekly',\n time: DEFAULT_TIME,\n days: ['mon'],\n },\n monthly: {\n kind: 'monthly',\n day: 1,\n time: DEFAULT_TIME,\n },\n custom: {\n kind: 'custom',\n cron: '0 9 * * 1',\n },\n};\n\nconst pad = (value: number): string => String(value).padStart(2, '0');\n\n/**\n * Switch to a different kind, preserving the current schedule's timing by routing it through its cron\n * representation. The cron is the canonical carrier: each target kind reuses whatever fields it supports\n * (time-of-day, weekdays, day-of-month), falling back to the kind's default for fields the cron doesn't hold.\n */\nconst switchKind = (current: ScheduleValue, kind: ScheduleKind): ScheduleValue => {\n const cron = scheduleToCron(current);\n const spec = cron ? fromCron(cron) : undefined;\n // Fall back to the shared default time (not midnight) when the source cron carries no time-of-day,\n // so switching from e.g. hourly to daily lands on a sensible hour rather than 00:00.\n const [defaultHour, defaultMinute] = DEFAULT_TIME.split(':').map(Number);\n const minute = spec && 'minute' in spec ? spec.minute : defaultMinute;\n const hour = spec && 'hour' in spec ? spec.hour : defaultHour;\n const time = `${pad(hour)}:${pad(minute)}`;\n switch (kind) {\n case 'hourly':\n return { kind: 'hourly', minute };\n case 'daily':\n return { kind: 'daily', time };\n case 'weekly':\n return { kind: 'weekly', time, days: spec?.frequency === 'weekly' ? [...spec.daysOfWeek] : DEFAULTS.weekly.days };\n case 'monthly':\n return { kind: 'monthly', time, day: spec?.frequency === 'monthly' ? spec.daysOfMonth[0] : DEFAULTS.monthly.day };\n case 'custom':\n return { kind: 'custom', cron: cron ?? DEFAULTS.custom.cron };\n }\n};\n\n//\n// Context\n//\n\ntype ScheduleContextValue = {\n value: ScheduleValue;\n onValueChange: (value: ScheduleValue) => void;\n kinds: readonly ScheduleKind[];\n /** Minimum seconds between fires; schedules that would fire more often are clamped. */\n minInterval: number;\n timezone?: string;\n};\n\nconst ScheduleContext = createContext<ScheduleContextValue | null>(null);\n\nconst useScheduleContext = (consumer: string): ScheduleContextValue => {\n const context = useContext(ScheduleContext);\n invariant(context, `${consumer} must be used within Schedule.Root`);\n return context;\n};\n\n//\n// Root\n//\n\nexport type ScheduleRootProps = ThemedClassName<\n PropsWithChildren<{\n value?: ScheduleValue;\n /** Timezone abbreviation shown in the summary, e.g. `EDT`. */\n timezone?: string;\n defaultValue?: ScheduleValue;\n onValueChange?: (value: ScheduleValue) => void;\n /** Restrict which frequency tabs are offered (defaults to all kinds). */\n kinds?: readonly ScheduleKind[];\n /**\n * Minimum seconds between fires (default 60). Schedules that would fire more often are clamped, and\n * frequency tabs that cannot satisfy it are hidden. Capped to the hourly cadence a 5-field cron can model.\n */\n minInterval?: number;\n }>\n>;\n\n/**\n * Schedule picker root: provides the shared {@link Column} grid (all rows align to the same gutters)\n * and the schedule state context. Controllable via `value`/`onValueChange`, or self-managing via\n * `defaultValue`. Compose with `Schedule.Header`, `Schedule.Kind`, `Schedule.Body`, `Schedule.Description`.\n */\nconst ScheduleRoot = composable<HTMLDivElement, ScheduleRootProps>(\n (\n {\n children,\n value: valueProp,\n defaultValue,\n onValueChange,\n kinds = ScheduleKinds,\n minInterval: minIntervalProp = DEFAULT_MIN_INTERVAL_SECONDS,\n timezone,\n ...props\n },\n forwardedRef,\n ) => {\n const minInterval = normalizeMinInterval(minIntervalProp);\n const [value, setValue] = useState<ScheduleValue>(() =>\n clampSchedule(valueProp ?? defaultValue ?? DEFAULTS.weekly, minInterval),\n );\n\n const handleValueChange = useCallback(\n (next: ScheduleValue) => {\n const clamped = clampSchedule(next, minInterval);\n setValue(clamped);\n onValueChange?.(clamped);\n },\n [onValueChange, minInterval],\n );\n\n // Only offer frequencies whose cadence can satisfy the minimum; `custom` always stays (it is clamped on edit).\n const allowedKinds = kinds.filter(\n (kind) => kind === 'custom' || scheduleIntervalSeconds(DEFAULTS[kind]) >= minInterval,\n );\n\n return (\n <ScheduleContext.Provider\n value={{\n value: clampSchedule(valueProp ?? value, minInterval),\n onValueChange: handleValueChange,\n kinds: allowedKinds,\n minInterval,\n timezone,\n }}\n >\n <div {...composableProps(props, { classNames: 'flex flex-col gap-y-3' })} ref={forwardedRef}>\n {children}\n </div>\n </ScheduleContext.Provider>\n );\n },\n);\n\nScheduleRoot.displayName = 'Schedule.Root';\n\n//\n// Header\n//\n\nexport type ScheduleHeaderProps = { classNames?: string };\n\n/**\n * Summary row laid out on the shared grid: the icon in the leading gutter (column 1), the schedule\n * description (or `children`) in the center column, and an optional close button in the trailing gutter\n * (column 3).\n */\nconst ScheduleHeader = forwardRef<HTMLDivElement, ScheduleHeaderProps>(({ classNames }, forwardedRef) => {\n const { t } = useTranslation(meta.profile.key);\n const { value, timezone } = useScheduleContext('Schedule.Header');\n return <p className={mx('grow truncate text-description', classNames)}>{describeSchedule(value, timezone)}</p>;\n});\n\nScheduleHeader.displayName = 'Schedule.Header';\n\n//\n// Kind\n//\n\nexport type ScheduleKindProps = ThemedClassName;\n\n/** Segmented frequency tabs (Once / Hourly / Daily / Weekly / Custom). */\nconst ScheduleKindRow = forwardRef<HTMLDivElement, ScheduleKindProps>(({ classNames }, forwardedRef) => {\n const { t } = useTranslation(meta.profile.key);\n const { value, onValueChange, kinds } = useScheduleContext('Schedule.Kind');\n const handleKindChange = useCallback(\n (kind: string) => {\n if (isScheduleKind(kind)) {\n onValueChange(switchKind(value, kind));\n }\n },\n [value, onValueChange],\n );\n\n return (\n <ToggleGroup\n classNames='overflow-x-auto scrollbar-none'\n type='single'\n value={value.kind}\n onValueChange={handleKindChange}\n >\n {kinds.map((kind) => (\n <ToggleGroupItem key={kind} value={kind}>\n {t(KIND_LABEL_KEYS[kind])}\n </ToggleGroupItem>\n ))}\n </ToggleGroup>\n );\n});\n\nScheduleKindRow.displayName = 'Schedule.Kind';\n\n//\n// Body\n//\n\nexport type ScheduleBodyProps = ThemedClassName;\n\n/** Per-kind editor for the active frequency. Rendered as a 3-column row so editors can use the gutters. */\nconst ScheduleBody = forwardRef<HTMLDivElement, ScheduleBodyProps>(({ classNames }, forwardedRef) => {\n const { value, onValueChange } = useScheduleContext('Schedule.Body');\n return <ScheduleEditor value={value} onChange={onValueChange} />;\n});\n\nScheduleBody.displayName = 'Schedule.Body';\n\n//\n// Namespace.\n//\n\nexport const Schedule = {\n Root: ScheduleRoot,\n Header: ScheduleHeader,\n Kind: ScheduleKindRow,\n Body: ScheduleBody,\n};\n\n//\n// Per-kind editors.\n//\n\nconst Field = ({ label, children, classNames }: ThemedClassName<PropsWithChildren<{ label: string }>>) => (\n <label className={mx('flex items-center gap-2 shrink-0', classNames)}>\n <span className='text-sm'>{label}</span>\n {children}\n </label>\n);\n\nconst ScheduleEditor = ({ value, onChange }: { value: ScheduleValue; onChange: (value: ScheduleValue) => void }) => {\n const { t } = useTranslation(meta.profile.key);\n switch (value.kind) {\n // case 'once':\n // `Input.Root` renders no DOM, so the trigger (column 1) and the field (center) become direct children\n // of `Schedule.Body`'s row while still sharing the input context that wires the picker to the field.\n // return (\n // <Input.Root>\n // <div>\n // <Field label={t('schedule.at.label')}>\n // <Input.DateTime\n // classNames='min-w-0 overflow-hidden'\n // hourCycle={12}\n // value={value.date ?? ''}\n // onValueChange={(date) => onChange({ kind: 'once', date: date || undefined })}\n // />\n // <Input.TriggerIcon />\n // </Field>\n // </div>\n // </Input.Root>\n // );\n\n case 'hourly':\n return (\n <Field label={t('schedule.minute.label')}>\n <Input.Root>\n <Input.TextInput\n type='number'\n min={0}\n max={59}\n step={1}\n classNames='w-15'\n value={String(value.minute)}\n onChange={(event) => {\n const minute = Math.min(59, Math.max(0, Math.round(Number(event.target.value) || 0)));\n onChange({ kind: 'hourly', minute });\n }}\n />\n </Input.Root>\n </Field>\n );\n\n case 'daily':\n return (\n <Field label={t('schedule.at.label')}>\n <Input.Root>\n <Input.Time hourCycle={12} value={value.time} onValueChange={(time) => onChange({ kind: 'daily', time })} />\n </Input.Root>\n </Field>\n );\n\n case 'weekly':\n return (\n <div className='@container dx-inline-size-container min-w-0 flex justify-between items-center gap-2 overflow-x-auto scrollbar-none'>\n <Field label={t('schedule.at.label')}>\n <Input.Root>\n <Input.Time hourCycle={12} value={value.time} onValueChange={(time) => onChange({ ...value, time })} />\n </Input.Root>\n </Field>\n <div className='flex shrink-0 items-center gap-2'>\n <span className='shrink-0 text-sm'>{t('schedule.on.label')}</span>\n <div className='grid w-max shrink-0 grid-cols-7 gap-x-2'>\n {Days.map(({ value: day, label }) => {\n const checked = value.days.includes(day);\n return (\n <div key={day} className='flex shrink-0 items-center gap-1'>\n <Input.Root>\n <Input.Checkbox\n checked={checked}\n onCheckedChange={(next) => {\n // Preserve the canonical `Days` order so the summary reads naturally.\n const nextDays = next\n ? Days.map((d) => d.value).filter((d) => d === day || value.days.includes(d))\n : value.days.filter((d) => d !== day);\n // A weekly schedule must keep at least one day; an empty set serializes to `*`\n // (every day), silently broadening execution. Ignore the uncheck in that case.\n onChange({ ...value, days: nextDays.length > 0 ? nextDays : value.days });\n }}\n />\n <Input.Label classNames='hidden @min-[32rem]:inline-block text-xs uppercase'>{label}</Input.Label>\n <Input.Label classNames='inline-block @min-[32rem]:hidden text-xs'>{label.charAt(0)}</Input.Label>\n </Input.Root>\n </div>\n );\n })}\n </div>\n </div>\n </div>\n );\n\n case 'monthly':\n return (\n <div className='flex items-center gap-3'>\n <Field label={t('schedule.day.label')}>\n <Input.Root>\n <Input.TextInput\n type='number'\n min={1}\n max={31}\n step={1}\n classNames='w-15'\n value={String(value.day)}\n onChange={(event) => {\n const day = Math.min(31, Math.max(1, Math.round(Number(event.target.value) || 1)));\n onChange({ ...value, day });\n }}\n />\n </Input.Root>\n </Field>\n <Field label={t('schedule.at.label')}>\n <Input.Root>\n <Input.Time hourCycle={12} value={value.time} onValueChange={(time) => onChange({ ...value, time })} />\n </Input.Root>\n </Field>\n </div>\n );\n\n case 'custom':\n return (\n <Field label={t('schedule.cron.label')}>\n <Input.Root>\n <Input.TextInput\n classNames='w-50 tabular-nums'\n placeholder='0 9 * * MON-FRI'\n value={value.cron}\n onChange={(event) => onChange({ kind: 'custom', cron: event.target.value })}\n />\n </Input.Root>\n </Field>\n );\n }\n};\n\n//\n// Summary.\n//\n\nconst DAY_NAMES: Record<Day, string> = {\n mon: 'Monday',\n tue: 'Tuesday',\n wed: 'Wednesday',\n thu: 'Thursday',\n fri: 'Friday',\n sat: 'Saturday',\n sun: 'Sunday',\n};\n\n/** Format a `HH:mm` (24h) time as a 12-hour clock string, e.g. `9:00 AM`. */\nconst formatTime = (time: string): string => {\n const [h, m] = time.split(':').map(Number);\n if (Number.isNaN(h) || Number.isNaN(m)) {\n return time;\n }\n\n const period = h < 12 ? 'AM' : 'PM';\n const hour = h % 12 === 0 ? 12 : h % 12;\n return `${hour}:${String(m).padStart(2, '0')} ${period}`;\n};\n\nconst withZone = (text: string, timezone?: string): string => (timezone ? `${text} ${timezone}` : text);\n\n/** Human-readable summary of the schedule, suitable for the header. */\n// TODO(wittjosiah): Just use cronstrue for all cases?\nexport const describeSchedule = (value: ScheduleValue, timezone?: string): string => {\n switch (value.kind) {\n // case 'once':\n // return value.date\n // ? `Runs once at ${formatTime(value.date.slice(11))} on ${value.date.slice(0, 10)}`\n // : 'Runs once';\n case 'hourly':\n return `Runs every hour at minute ${value.minute}`;\n case 'daily':\n return withZone(`Runs every day at ${formatTime(value.time)}`, timezone);\n case 'weekly': {\n const days =\n value.days.length === 0\n ? 'no days'\n : value.days.length === 1\n ? DAY_NAMES[value.days[0]]\n : Days.filter((d) => value.days.includes(d.value))\n .map((d) => d.label)\n .join(', ');\n return withZone(`Runs every ${days} at ${formatTime(value.time)}`, timezone);\n }\n case 'monthly':\n return withZone(`Runs monthly on day ${value.day} at ${formatTime(value.time)}`, timezone);\n case 'custom':\n return withZone(describeCron(value.cron), timezone);\n }\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { Icon, useTranslation } from '@dxos/react-ui';\nimport { Listbox } from '@dxos/react-ui-list';\n\nimport { meta } from '#meta';\n\n/** Trigger spec kinds surfaced as selectable variants. Matches the discriminants of `Trigger.Spec`. */\nexport type TriggerKind = 'timer' | 'feed' | 'subscription' | 'webhook' | 'email';\n\ntype TriggerKindOption = {\n kind: TriggerKind;\n icon: string;\n disabled?: boolean;\n};\n\n// Ordered as presented; labels and descriptions are resolved from translations keyed by `kind`.\nconst OPTIONS: readonly TriggerKindOption[] = [\n {\n kind: 'timer',\n icon: 'ph--clock-countdown--regular',\n },\n {\n kind: 'feed',\n icon: 'ph--cards-three--regular',\n },\n {\n kind: 'subscription',\n icon: 'ph--funnel--regular',\n },\n {\n kind: 'webhook',\n icon: 'ph--webhooks-logo--regular',\n disabled: true,\n },\n {\n kind: 'email',\n icon: 'ph--envelope--regular',\n disabled: true,\n },\n];\n\n/** Icon for a trigger kind, shared by the picker rows and the selected-variant editor header. */\nexport const getTriggerKindIcon = (kind: TriggerKind): string =>\n OPTIONS.find((option) => option.kind === kind)?.icon ?? 'ph--lightning--regular';\n\nexport type TriggerKindSelectorProps = {\n onChange: (kind: TriggerKind) => void;\n};\n\n/**\n * Single-select list of pluggable trigger variants (Schedule / Feed / Query / Webhook / Email): each row\n * shows an icon, title and description. Built on {@link Listbox} (role=listbox/option, arrow-key navigation);\n * selecting a row emits its kind. Selection is transient — the parent swaps in the variant editor on change.\n */\nexport const TriggerKindSelector = ({ onChange }: TriggerKindSelectorProps) => {\n const { t } = useTranslation(meta.profile.key);\n const handleValueChange = useCallback(\n (id: string) => {\n const option = OPTIONS.find((option) => option.kind === id);\n if (option) {\n onChange(option.kind);\n }\n },\n [onChange],\n );\n\n return (\n <Listbox.Root onValueChange={handleValueChange}>\n <Listbox.Content classNames='gap-1' aria-label={t('trigger-kind.placeholder')}>\n {OPTIONS.map(({ kind, icon, disabled }) => (\n <Listbox.Item key={kind} id={kind} disabled={disabled} classNames='bg-input-surface rounded-sm'>\n <Listbox.ItemContent\n icon={<Icon icon={icon} size={5} classNames='text-description' />}\n title={<span className='font-medium'>{t(`trigger-kind.${kind}.label`)}</span>}\n description={t(`trigger-kind.${kind}.description`)}\n />\n </Listbox.Item>\n ))}\n </Listbox.Content>\n </Listbox.Root>\n );\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport React, { useCallback, useMemo } from 'react';\n\nimport { useCapabilities } from '@dxos/app-framework/ui';\nimport { type SpaceCapabilities } from '@dxos/plugin-space';\nimport { useTranslation } from '@dxos/react-ui';\nimport { SearchList, useSearchListResults } from '@dxos/react-ui-search';\n\nimport { meta } from '#meta';\nimport { RoutineCapabilities } from '#types';\n\nexport type CreateRoutinePanelProps = SpaceCapabilities.CreateObjectCustomPanelProps & {\n /** Optional override (primarily for stories/tests). Defaults to RoutineCapabilities.Template. */\n templates?: RoutineCapabilities.Template[];\n};\n\n/**\n * Create panel for routines: a SearchList picker over contributed templates. Selecting one submits\n * `{ templateId }`; plugin-routine's CreateObjectEntry.createObject resolves the templateId and runs the\n * template's `scaffold`.\n */\nexport const CreateRoutinePanel = ({ onCreateObject, templates: templatesProp }: CreateRoutinePanelProps) => {\n const { t } = useTranslation(meta.profile.key);\n const capabilityTemplates = useCapabilities(RoutineCapabilities.Template);\n const templates = templatesProp ?? capabilityTemplates;\n // The global create dialog has no subject, so subject-required templates (e.g. CRM, which needs a\n // Mailbox) are excluded; they are offered from the relevant object's Automation companion instead.\n const sorted = useMemo(\n () =>\n [...templates]\n .filter((template) => template.appliesTo?.(undefined) ?? true)\n .sort((a, b) => a.label.localeCompare(b.label)),\n [templates],\n );\n const { results, handleSearch } = useSearchListResults({ items: sorted, extract: (template) => template.label });\n\n const handleSelect = useCallback(\n (templateId: string) => {\n void onCreateObject({ templateId });\n },\n [onCreateObject],\n );\n\n return (\n <SearchList.Root onSearch={handleSearch}>\n <SearchList.Input\n classNames='mb-form-gap'\n autoFocus\n data-testid='create-automation-panel.template-input'\n placeholder={t('create-panel.template.placeholder')}\n />\n <SearchList.Viewport>\n {results.map((template) => (\n <SearchList.Item\n key={template.id}\n value={template.id}\n label={template.label}\n icon={template.icon ?? 'ph--lightning--regular'}\n onSelect={() => handleSelect(template.id)}\n />\n ))}\n </SearchList.Viewport>\n </SearchList.Root>\n );\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { Atom, useAtomValue } from '@effect-atom/atom-react';\nimport React, { type ReactNode, useMemo } from 'react';\n\nimport { Column, Icon, IconBlock, IconButton, type ThemedClassName, Tooltip, useTranslation } from '@dxos/react-ui';\nimport { Empty, OrderedList } from '@dxos/react-ui-list';\nimport { type ActionGraphProps, Menu, useMenuBuilder } from '@dxos/react-ui-menu';\nimport { getStyles } from '@dxos/ui-theme';\n\nimport { meta } from '#meta';\n\n// Prototype master-detail layout, candidate to push down into @dxos/react-ui-list as a reusable\n// component. Presentation-only: a selectable list (master) on top of a single detail pane, with an\n// optional empty state. The parent owns the detail content (the selected item's form, a draft form,\n// etc.) and the selection state.\n\nexport type MasterDetailRecord = { id: string };\n\n/** A row's leading icon: same shape as {@link Obj.getIcon} — a Phosphor icon name and an optional hue. */\nexport type MasterDetailIcon = { icon: string; hue?: string };\n\n/** A row's trailing adornment: a status icon with a tooltip label (e.g. a 'detached' warning badge). */\nexport type MasterDetailAdornment = { icon: string; label: string };\n\nconst EMPTY_MENU: ActionGraphProps = { nodes: [], edges: [] };\n\nexport type MasterDetailProps<T extends MasterDetailRecord> = ThemedClassName<{\n items: readonly T[];\n /** Currently highlighted row; `undefined` clears the selection (e.g. while a draft is active). */\n selectedId?: string;\n onSelect?: (id: string | undefined) => void;\n /**\n * Build the row's label reactively. Run inside an atom so it can subscribe to the item's state via `get`\n * (e.g. the object's name) and update live when it changes.\n */\n getLabel: (get: Atom.Context, item: T) => string;\n /**\n * Build the row's leading icon reactively. Run inside an atom so it can subscribe to the item's state via\n * `get` (e.g. colour the icon by an `enabled` flag); returns the icon name and optional colour classes.\n */\n getIcon?: (get: Atom.Context, item: T) => MasterDetailIcon | undefined;\n /**\n * Build the row's trailing adornment reactively (e.g. a status badge). Run inside an atom so it can subscribe\n * to the item's state via `get`; returns a Phosphor icon name and a tooltip label, or `undefined` for none.\n */\n getAdornment?: (get: Atom.Context, item: T) => MasterDetailAdornment | undefined;\n /**\n * Build the per-row overflow (three-dots) menu. Run inside each row's `useMenuBuilder`, so it should\n * subscribe to that item's reactive state via `get` (e.g. an `enabled` flag) — the menu then updates live\n * without re-rendering the whole list.\n */\n getMenu?: (get: Atom.Context, item: T) => ActionGraphProps;\n /** Message shown when there are no items. */\n emptyLabel?: string;\n /** Detail pane content (selected item's form, draft form, …); rendered below the list. */\n detail?: ReactNode;\n}>;\n\n/** Selectable master list (with an optional per-row overflow menu) above a parent-supplied detail pane. */\nexport const MasterDetail = <T extends MasterDetailRecord>({\n classNames,\n items,\n selectedId,\n onSelect,\n getLabel,\n getIcon,\n getAdornment,\n getMenu,\n emptyLabel,\n detail,\n}: MasterDetailProps<T>) => {\n // The gutter is owned by a `Column.Root` (not an ad-hoc wrapper) so the list aligns to the surface's\n // column system: rows and their selection highlight sit in the centre track (`Column.Center`), matching\n // the inset of the detail's form. The detail bleeds the full width since its own `Form` owns its gutter.\n return (\n <Column.Root gutter='sm' classNames={classNames}>\n <Column.Center>\n {(items.length === 0 && <Empty label={emptyLabel} />) || (\n <OrderedList.Root<T> items={items}>\n {({ items }) => (\n <OrderedList.Content>\n {items.map((item) => (\n <MasterDetailRow\n key={item.id}\n item={item}\n selected={item.id === selectedId}\n getLabel={getLabel}\n getIcon={getIcon}\n getAdornment={getAdornment}\n getMenu={getMenu}\n onSelect={onSelect}\n />\n ))}\n </OrderedList.Content>\n )}\n </OrderedList.Root>\n )}\n </Column.Center>\n\n <div className='col-span-full pt-trim-md'>{detail}</div>\n </Column.Root>\n );\n};\n\ntype MasterDetailRowProps<T extends MasterDetailRecord> = {\n item: T;\n selected: boolean;\n getLabel: (get: Atom.Context, item: T) => string;\n getIcon?: (get: Atom.Context, item: T) => MasterDetailIcon | undefined;\n getAdornment?: (get: Atom.Context, item: T) => MasterDetailAdornment | undefined;\n getMenu?: (get: Atom.Context, item: T) => ActionGraphProps;\n onSelect?: (id: string | undefined) => void;\n};\n\nconst MasterDetailRow = <T extends MasterDetailRecord>({\n item,\n selected,\n getLabel,\n getIcon,\n getAdornment,\n getMenu,\n onSelect,\n}: MasterDetailRowProps<T>) => {\n const { t } = useTranslation(meta.profile.key);\n // Resolve the label, icon, adornment, and actions reactively per row — each subscribes (via `get`) only to\n // this item's state, so a change (rename, toggling enabled) updates just this row.\n const label = useAtomValue(useMemo(() => Atom.make((get) => getLabel(get, item)), [getLabel, item]));\n const icon = useAtomValue(useMemo(() => Atom.make((get) => getIcon?.(get, item)), [getIcon, item]));\n const adornment = useAtomValue(useMemo(() => Atom.make((get) => getAdornment?.(get, item)), [getAdornment, item]));\n const menu = useMenuBuilder((get) => getMenu?.(get, item) ?? EMPTY_MENU, [getMenu, item]);\n\n return (\n <OrderedList.Item\n id={item.id}\n item={item}\n canDrag={false}\n hover\n selected={selected}\n classNames='flex items-center cursor-pointer p-1'\n onClick={() => onSelect?.(selected ? undefined : item.id)}\n >\n {icon && (\n <IconBlock>\n <Icon icon={icon.icon} classNames={icon.hue ? getStyles(icon.hue).text : undefined} />\n </IconBlock>\n )}\n <span className='grow truncate'>{label}</span>\n {adornment && (\n <Tooltip.Provider>\n <Tooltip.Trigger asChild side='bottom' content={adornment.label}>\n <Icon icon={adornment.icon} />\n </Tooltip.Trigger>\n </Tooltip.Provider>\n )}\n {getMenu && (\n <Menu.Root {...menu}>\n <Menu.Trigger asChild>\n <IconButton\n iconOnly\n variant='ghost'\n icon='ph--dots-three-vertical--regular'\n label={t('routine-actions.label')}\n // Open the menu without toggling row selection.\n onClick={(event) => event.stopPropagation()}\n />\n </Menu.Trigger>\n <Menu.Content />\n </Menu.Root>\n )}\n </OrderedList.Item>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { defaultHighlightStyle, syntaxHighlighting } from '@codemirror/language';\nimport { composeRefs } from '@radix-ui/react-compose-refs';\nimport React from 'react';\n\nimport { type Ref } from '@dxos/echo';\nimport { Doc } from '@dxos/echo-doc';\nimport { useThemeContext, useTranslation } from '@dxos/react-ui';\nimport { composable, composableProps } from '@dxos/react-ui';\nimport { useTextEditor } from '@dxos/react-ui-editor';\nimport { type Text } from '@dxos/schema';\nimport {\n createBasicExtensions,\n createDataExtensions,\n createMarkdownExtensions,\n createThemeExtensions,\n decorateMarkdown,\n} from '@dxos/ui-editor';\nimport { isNonNullable } from '@dxos/util';\n\nimport { meta } from '#meta';\n\nimport { handlebars, xmlDecorator } from './extensions';\n\nexport type TemplateEditorProps = {\n id: string;\n /** Markdown + Handlebars source text. */\n source?: Ref.Ref<Text.Text>;\n lineNumbers?: boolean;\n};\n\nexport const TemplateEditor = composable<HTMLDivElement, TemplateEditorProps>(\n ({ classNames, id, source, lineNumbers = true, ...props }, forwardedRef) => {\n const { t } = useTranslation(meta.profile.key);\n const { themeMode } = useThemeContext();\n const { parentRef } = useTextEditor(() => {\n const target = source?.target;\n if (!target) {\n return {};\n }\n\n return {\n initialValue: target.content ?? '',\n extensions: [\n createDataExtensions({ id, text: Doc.createAccessor(target, ['content']) }),\n createBasicExtensions({\n bracketMatching: false,\n lineNumbers,\n lineWrapping: true,\n placeholder: t('template.placeholder'),\n }),\n createThemeExtensions({ themeMode }),\n createMarkdownExtensions(),\n decorateMarkdown(),\n handlebars(),\n // xml(),\n // NOTE: Since we're using markdown only HTML nodes are parsed.\n xmlDecorator(),\n syntaxHighlighting(defaultHighlightStyle),\n ].filter(isNonNullable),\n };\n }, [themeMode, source?.target, lineNumbers]);\n\n return (\n <div\n {...composableProps(props, {\n role: 'none',\n classNames: ['h-full overflow-hidden', classNames],\n })}\n ref={composeRefs(parentRef, forwardedRef)}\n />\n );\n },\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport {\n type CompletionContext,\n type CompletionResult,\n autocompletion,\n completionKeymap,\n} from '@codemirror/autocomplete';\nimport { type Extension, RangeSetBuilder } from '@codemirror/state';\nimport {\n Decoration,\n type DecorationSet,\n type EditorView,\n ViewPlugin,\n type ViewUpdate,\n WidgetType,\n keymap,\n} from '@codemirror/view';\n\nimport { Domino, mx } from '@dxos/ui';\n\nexport type HandlebarsOptions = {};\n\n/**\n * Simple Handlebars plugin for CodeMirror.\n * Supports:\n * - Comments: {{! comment }}\n * - Commands: {{#command}} {{/command}}\n * - Variables: {{var}}\n * - Commands with variables: {{#each items}} {{/each}}\n */\nexport const handlebars = (_: HandlebarsOptions = {}): Extension => {\n return [\n handlebarsHighlightPlugin,\n autocompletion({\n activateOnTyping: true,\n aboveCursor: true,\n closeOnBlur: true,\n override: [handlebarsCompletions],\n }),\n keymap.of(completionKeymap),\n ];\n};\n\nconst regex = {\n // {{! comment }}\n comment: /\\{\\{!\\s*[^}]*\\}\\}/g,\n\n // {{var}}\n brackets: /\\{\\{[^}]*\\}\\}/g,\n\n // {{#command}} {{/command}}\n command: /\\{\\{[#/]([^}]+)\\}\\}/g,\n\n // {{var}}\n var: /\\{\\{(?!\\s*!)(\\w[^}]*)\\}\\}/g,\n\n // @echo://space/id or @dxn:nsid\n dxn: /@?(?:echo:\\/{1,3}[\\w/]+|dxn:[\\w.-]+)/g,\n\n // example.com/path/xxx\n url: /[\\w.-]+\\.[\\w.-]+\\/[\\w/]+/g,\n};\n\nconst tagPadding = 'mx-0.5 px-1 rounded-xs';\n\n/**\n * ViewPlugin that decorates Handlebars syntax.\n */\nconst handlebarsHighlightPlugin = ViewPlugin.fromClass(\n class {\n decorations: DecorationSet;\n\n constructor(view: EditorView) {\n this.decorations = this.buildDecorations(view);\n }\n\n update(update: ViewUpdate) {\n if (update.docChanged || update.viewportChanged || update.selectionSet) {\n this.decorations = this.buildDecorations(update.view);\n }\n }\n\n // NOTE: Decorations may clash with other extensions (e.g., markdown).\n buildDecorations(view: EditorView) {\n const selection = view.state.selection.main;\n const decorations: Array<{\n from: number;\n to: number;\n decoration: Decoration;\n }> = [];\n\n for (const { from, to } of view.visibleRanges) {\n const text = view.state.doc.sliceString(from, to);\n\n // Match DXN.\n {\n let match;\n while ((match = regex.dxn.exec(text)) !== null) {\n const start = from + match.index;\n const end = start + match[0].length;\n // Only show widget if selection doesn't overlap with the match range.\n const overlaps = selection.to > start && selection.from <= end;\n if (!overlaps) {\n decorations.push({\n from: start,\n to: end,\n decoration: Decoration.widget({\n widget: new DXNWidget(match[0]),\n }),\n });\n }\n }\n }\n\n // Match URLs.\n {\n let match;\n while ((match = regex.url.exec(text)) !== null) {\n const start = from + match.index;\n const end = start + match[0].length;\n decorations.push({\n from: start,\n to: end,\n decoration: Decoration.mark({\n class: mx('dx-tag--blue', tagPadding),\n }),\n });\n }\n }\n\n // Match brackets: {{ and }}.\n {\n let match;\n while ((match = regex.brackets.exec(text)) !== null) {\n const start = from + match.index;\n const end = start + match[0].length;\n decorations.push({\n from: start,\n to: end,\n decoration: Decoration.mark({ class: 'text-subdued' }),\n });\n }\n }\n\n // Match commands: {{#command}} and {{/command}}.\n {\n let match;\n while ((match = regex.command.exec(text)) !== null) {\n const start = from + match.index + 2;\n let end = start + match[0].length - 4;\n const text = view.state.doc.sliceString(start, end);\n const parts = text.split(/\\s+/);\n if (parts.length > 1) {\n const idx = start + parts[0].length;\n decorations.push({\n from: idx,\n to: end,\n decoration: Decoration.mark({ class: 'text-green-text' }),\n });\n end = idx;\n }\n decorations.push({\n from: start,\n to: end,\n decoration: Decoration.mark({ class: 'text-blue-text' }),\n });\n }\n }\n\n // Match variables: {{var}}.\n {\n let match;\n while ((match = regex.var.exec(text)) !== null) {\n const start = from + match.index + 2;\n const end = start + match[0].length - 4;\n decorations.push({\n from: start,\n to: end,\n decoration: Decoration.mark({ class: 'text-green-text' }),\n });\n }\n }\n }\n\n // Sort decorations by position to satisfy RangeSetBuilder requirements.\n decorations.sort((a, b) => a.from - b.from || a.to - b.to);\n\n // Add sorted decorations to builder.\n const builder = new RangeSetBuilder<Decoration>();\n for (const { from, to, decoration } of decorations) {\n builder.add(from, to, decoration);\n }\n\n return builder.finish();\n }\n },\n {\n decorations: (v) => v.decorations,\n },\n);\n\nclass DXNWidget extends WidgetType {\n constructor(private readonly _identifier: string) {\n super();\n }\n\n override ignoreEvent() {\n return false;\n }\n\n override eq(other: this) {\n return this._identifier === other._identifier;\n }\n\n override toDOM() {\n const text = this._identifier\n .split(':')\n .map((part) => {\n const len = 16;\n const plen = 4;\n if (part.length > len) {\n return `[${part.slice(0, plen)}…${part.slice(-plen)}]`;\n }\n return part;\n })\n .join(':');\n return Domino.of('span').classNames(mx('font-mono dx-tag--blue', tagPadding)).text(text).root;\n }\n}\n\n// TODO(burdon): Pass in variables.\nconst variables = ['this'];\nconst commands = ['this', 'each', 'if', 'unless', 'with'];\n\n/**\n * Provides completions for Handlebars variables.\n */\nfunction handlebarsCompletions(context: CompletionContext): CompletionResult | null {\n const match = context.matchBefore(/\\{\\{[^}]*/);\n if (!match || match.from === match.to) {\n return null;\n }\n\n let type = 'variable';\n let text = match.text.slice(2);\n let from = match.from + 2;\n let matches = [];\n if (text.startsWith('#') || text.startsWith('/')) {\n const idx = text.lastIndexOf(' ');\n if (idx !== -1) {\n type = 'variable';\n matches = variables;\n text = text.slice(idx + 1);\n from += idx + 1;\n } else {\n type = 'command';\n text = text.slice(1);\n matches = commands;\n from += 1;\n }\n } else {\n type = 'variable';\n matches = variables;\n }\n\n const options = matches.filter((name) => name.startsWith(text)).map((name) => ({ type, label: name }));\n return {\n from,\n options,\n };\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { syntaxTree } from '@codemirror/language';\nimport { type Extension, RangeSetBuilder } from '@codemirror/state';\nimport { Decoration, type DecorationSet, type EditorView, ViewPlugin, type ViewUpdate } from '@codemirror/view';\n\nexport type XmlOptions = {};\n\n/**\n * XML decorator plugin for CodeMirror.\n * Decorates XML tags with monospace font using the XML language grammar.\n */\nexport const xmlDecorator = (_: XmlOptions = {}): Extension => {\n return [xmlDecoratorPlugin];\n};\n\n/**\n * ViewPlugin that decorates XML tags using syntax tree.\n */\nconst xmlDecoratorPlugin = ViewPlugin.fromClass(\n class {\n decorations: DecorationSet;\n\n constructor(view: EditorView) {\n this.decorations = this.buildDecorations(view);\n }\n\n update(update: ViewUpdate) {\n if (update.docChanged || update.viewportChanged) {\n this.decorations = this.buildDecorations(update.view);\n }\n }\n\n buildDecorations(view: EditorView) {\n const builder = new RangeSetBuilder<Decoration>();\n\n for (const { from, to } of view.visibleRanges) {\n syntaxTree(view.state).iterate({\n from,\n to,\n enter: (node) => {\n // Decorate XML elements (opening tags, closing tags, self-closing tags).\n if (\n node.name === 'HTMLTag' ||\n node.name === 'OpenTag' ||\n node.name === 'CloseTag' ||\n node.name === 'SelfClosingTag' ||\n node.name === 'Element'\n ) {\n builder.add(node.from, node.to, Decoration.mark({ class: 'font-mono text-subdued' }));\n }\n },\n });\n }\n\n return builder.finish();\n }\n },\n {\n decorations: (v) => v.decorations,\n },\n);\n"],
5
- "mappings": ";;;AAIA,YAAYA,aAAY;AACxB,OAAOC,UAAiCC,eAAAA,cAAaC,WAAAA,gBAAe;AAEpE,SAASC,gBAAAA,eAAcC,WAAWC,WAAAA,gBAAe;AACjD,SAAwBC,OAAAA,MAAKC,UAAAA,SAAQC,UAAAA,SAAQC,OAAAA,MAAKC,SAAAA,QAAOC,OAAAA,MAAKC,SAAAA,QAAOC,QAAAA,aAAY;AACjF,SAASC,WAAWC,YAAAA,iBAAgB;AACpC,SAASC,eAAAA,cAAaC,mBAAAA,kBAAiBC,kBAAAA,uBAAsB;AAC7D,SAASC,QAAAA,OAAyBC,gBAAgB;AAElD,SAASC,QAAA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b,QAAQa;AACvB,QAAI,CAACA,QAAQ;AACX,aAAO,CAAC;IACV;AAEA,WAAO;MACLC,cAAcD,OAAOE,WAAW;MAChCC,YAAY;QACVC,qBAAqB;UAAElB;UAAImB,MAAMC,IAAIC,eAAeP,QAAQ;YAAC;WAAU;QAAE,CAAA;QACzEQ,sBAAsB;UACpBC,iBAAiB;UACjBrB;UACAsB,cAAc;UACdC,aAAapB,EAAE,sBAAA;QACjB,CAAA;QACAqB,sBAAsB;UAAEhB;QAAU,CAAA;QAClCiB,yBAAAA;QACAC,iBAAAA;QACAC,WAAAA;;;QAGAC,aAAAA;QACAC,mBAAmBC,qBAAAA;QACnBC,OAAOC,aAAAA;IACX;EACF,GAAG;IAACxB;IAAWT,QAAQa;IAAQZ;GAAY;AAE3C,SACE,gBAAAiC,OAAA,cAACC,OAAAA;IACE,GAAGC,iBAAgBlC,OAAO;MACzBmC,MAAM;MACNvC,YAAY;QAAC;QAA0BA;;IACzC,CAAA;IACAwC,KAAKC,YAAY5B,WAAWR,YAAAA;;AAGlC,CAAA;",
6
- "names": ["Schema", "React", "useCallback", "useMemo", "Instructions", "Operation", "Trigger", "DXN", "Entity", "Filter", "Obj", "Query", "Ref", "Scope", "Type", "useObject", "useQuery", "ToggleGroup", "ToggleGroupItem", "useTranslation", "Form", "RefField", "meta", "Routine", "Option", "React", "useCallback", "useMemo", "Instructions", "Skill", "Entity", "Obj", "Type", "HiddenAnnotation", "Form", "INSTRUCTIONS_SCHEMA", "getSchema", "INSTRUCTIONS_FIELDS", "Set", "InstructionsEditor", "db", "dbProp", "instructions", "readonly", "getDatabase", "defaultValues", "getSnapshot", "objects", "handleValuesChanged", "values", "isValid", "update", "text", "skills", "Root", "key", "id", "schema", "getOptions", "getRefOptions", "onValuesChanged", "FieldSet", "filter", "props", "prop", "has", "name", "toString", "isSystemObject", "object", "isObject", "typeEntity", "getType", "get", "pipe", "getOrElse", "results", "getTypePlaceholder", "entity", "map", "getURI", "prefer", "typename", "getTypename", "label", "getLabel", "undefined", "description", "instanceOf", "getMeta", "sort", "left", "right", "localeCompare", "Schema", "React", "useCallback", "useMemo", "useState", "Trigger", "DXN", "Feed", "Filter", "Obj", "Query", "Ref", "Scope", "Type", "useQuery", "IconButton", "Input", "useTranslation", "Form", "SelectField", "ParentLabelAnnotation", "mx", "meta", "Routine", "cronstrue", "DOW_MAP", "sun", "mon", "tue", "wed", "thu", "fri", "sat", "toCron", "value", "frequency", "interval", "minute", "hour", "dow", "daysOfWeek", "length", "map", "d", "join", "dom", "daysOfMonth", "cronExpression", "DOW_REVERSE", "parseUInt", "token", "test", "Number", "undefined", "parseBoundedUInt", "min", "max", "fromCron", "cron", "parts", "trim", "split", "month", "minutelyMatch", "match", "parseInt", "hourlyMatch", "minuteNum", "hourNum", "tokens", "days", "filter", "describeCron", "toString", "throwExceptionOnParseError", "pad", "String", "padStart", "splitTime", "time", "isFinite", "joinTime", "scheduleToCron", "kind", "day", "MINUTE_SECONDS", "HOUR_SECONDS", "DAY_SECONDS", "MAX_MIN_INTERVAL_SECONDS", "parseList", "field", "values", "minGap", "span", "sorted", "Set", "sort", "lhs", "rhs", "POSITIVE_INFINITY", "gap", "index", "next", "Math", "parseStep", "hourIntervalSeconds", "step", "hours", "cronIntervalSeconds", "minuteStep", "minutes", "minuteGap", "clampCronMinute", "minIntervalSeconds", "stepMinutes", "ceil", "scheduleIntervalSeconds", "clampSchedule", "cronToSchedule", "spec", "Schema", "MinutelySpec", "Struct", "frequency", "Literal", "annotations", "title", "interval", "Number", "pipe", "int", "between", "description", "HourlySpec", "minute", "DailySpec", "hour", "DayOfWeek", "WeeklySpec", "daysOfWeek", "Array", "MonthlySpec", "daysOfMonth", "CustomSpec", "cronExpression", "String", "CronSpec", "Union", "FrequencyDefaults", "minutely", "hourly", "daily", "weekly", "monthly", "custom", "React", "createContext", "forwardRef", "useCallback", "useContext", "useState", "invariant", "Input", "ToggleGroup", "ToggleGroupItem", "composable", "composableProps", "useTranslation", "mx", "meta", "value", "DEFAULT_MIN_INTERVAL_SECONDS", "KIND_LABEL_KEYS", "hourly", "weekly", "monthly", "custom", "DEFAULTS", "minute", "daily", "time", "days", "DEFAULT_TIME", "cron", "spec", "fromCron", "hour", "defaultHour", "kind", "pad", "day", "ScheduleContext", "invariant", "consumer", "context", "setValue", "useState", "clampSchedule", "valueProp", "defaultValue", "minInterval", "handleValueChange", "next", "clamped", "onValueChange", "kinds", "allowedKinds", "timezone", "classNames", "ref", "forwardedRef", "children", "ScheduleRoot", "displayName", "useScheduleContext", "p", "className", "mx", "ScheduleHeader", "useTranslation", "handleKindChange", "useCallback", "isScheduleKind", "switchKind", "React", "map", "t", "ScheduleKindRow", "ScheduleEditor", "ScheduleBody", "Header", "Kind", "Body", "span", "Input", "type", "max", "step", "onChange", "event", "Math", "min", "hourCycle", "Field", "label", "Root", "Days", "checked", "key", "onCheckedChange", "nextDays", "Label", "tue", "wed", "thu", "fri", "sat", "sun", "period", "String", "padStart", "withZone", "text", "describeSchedule", "formatTime", "describeCron", "React", "useCallback", "Icon", "useTranslation", "Listbox", "meta", "OPTIONS", "kind", "icon", "disabled", "TriggerKindSelector", "onChange", "t", "useTranslation", "meta", "profile", "key", "handleValueChange", "useCallback", "id", "option", "OPTIONS", "find", "kind", "React", "Listbox", "Root", "onValueChange", "Content", "classNames", "aria-label", "map", "icon", "disabled", "Item", "ItemContent", "Icon", "size", "title", "span", "className", "description", "RECURRING_KINDS", "EnabledForm", "Type", "getSchema", "Trigger", "pipe", "pick", "TimerSpecForm", "extend", "Struct", "kind", "Literal", "cron", "String", "annotations", "title", "optional", "SubscriptionSpecForm", "typename", "deep", "Boolean", "delay", "Number", "WebhookSpecForm", "method", "port", "FeedSpecForm", "feed", "Ref", "Feed", "ParentLabelAnnotation", "set", "EmailSpecForm", "TriggerForm", "Union", "triggerFormValues", "spec", "query", "raw", "options", "DEFAULT_TIMER_CRON", "toCron", "FrequencyDefaults", "daily", "subscriptionQuery", "Query", "select", "Filter", "type", "DXN", "make", "everything", "triggerFormSpec", "values", "hasOptions", "ast", "undefined", "specWebhook", "specEmail", "specTimer", "TriggerEditor", "classNames", "db", "routine", "trigger", "readonly", "t", "useTranslation", "meta", "profile", "key", "defaultValues", "fieldMap", "resetNonce", "handleClose", "handleValuesChanged", "useTriggerForm", "React", "Form", "Root", "id", "schema", "onValuesChanged", "Content", "mx", "div", "className", "Input", "Label", "IconButton", "iconOnly", "variant", "square", "icon", "label", "onClick", "FieldSet", "p", "TypeSelectField", "props", "types", "useQuery", "from", "Scope", "space", "registry", "useMemo", "filter", "isTypeKind", "map", "getTypename", "value", "SelectField", "displayName", "CronField", "getValue", "initial", "cronToSchedule", "handleChange", "useCallback", "next", "scheduleToCron", "onValueChange", "Schedule", "kinds", "defaultValue", "Header", "Kind", "Body", "methodOptions", "TriggerKindSelector", "onChange", "setResetNonce", "useState", "enabled", "setKind", "nonce", "Obj", "update", "created", "setParent", "triggers", "push", "Routine", "wireTriggers", "GeneralForm", "Type", "getSchema", "Routine", "pipe", "pick", "RoutineForm", "db", "routine", "readonly", "onSave", "onCancel", "t", "useTranslation", "meta", "profile", "key", "auto", "updateAuto", "useObject", "trigger", "usePrimaryTrigger", "defaultValues", "useMemo", "name", "description", "handleValuesChanged", "useCallback", "values", "React", "Form", "Root", "schema", "onValuesChanged", "Viewport", "scroll", "Content", "FieldSet", "Section", "title", "ActionEditor", "TriggerEditor", "Actions", "children", "div", "role", "className", "Label", "standalone", "label", "routineProp", "operations", "useOperations", "updateRoutine", "kind", "spec", "operationRef", "runnableRef", "instructions", "instructionsRef", "target", "handleOperationChange", "operation", "runnable", "undefined", "wireTriggers", "handleKindChange", "next", "Instructions", "make", "Obj", "setParent", "Ref", "ActionKindToggle", "value", "onChange", "OperationEditor", "InstructionsEditor", "ToggleGroup", "type", "onValueChange", "ToggleGroupItem", "OperationActionForm", "Struct", "Operation", "PersistentOperation", "annotations", "optional", "getOperationOptions", "results", "filter", "instanceOf", "isVisible", "map", "id", "Entity", "getURI", "prefer", "getLabel", "getKey", "sort", "left", "right", "localeCompare", "fieldMap", "props", "RefField", "useResults", "getOptions", "useQuery", "Query", "select", "Filter", "DXN", "getTypename", "from", "Scope", "space", "registry", "snapshot", "ref", "triggers", "Trigger", "React", "useCallback", "useMemo", "useCapabilities", "useTranslation", "SearchList", "useSearchListResults", "meta", "RoutineCapabilities", "CreateRoutinePanel", "onCreateObject", "templates", "templatesProp", "t", "profile", "key", "capabilityTemplates", "Template", "sorted", "filter", "template", "appliesTo", "undefined", "sort", "a", "b", "label", "localeCompare", "results", "handleSearch", "items", "extract", "handleSelect", "templateId", "Root", "onSearch", "Input", "classNames", "autoFocus", "data-testid", "placeholder", "Viewport", "map", "Item", "id", "value", "icon", "onSelect", "Atom", "useAtomValue", "React", "useMemo", "Column", "Icon", "IconBlock", "IconButton", "Tooltip", "useTranslation", "Empty", "OrderedList", "Menu", "useMenuBuilder", "getStyles", "meta", "EMPTY_MENU", "nodes", "edges", "MasterDetail", "classNames", "items", "selectedId", "onSelect", "getLabel", "getIcon", "getAdornment", "getMenu", "emptyLabel", "detail", "Root", "gutter", "Center", "length", "label", "Content", "map", "item", "MasterDetailRow", "key", "id", "selected", "div", "className", "t", "profile", "make", "get", "icon", "adornment", "menu", "Item", "canDrag", "hover", "onClick", "undefined", "hue", "text", "span", "Provider", "Trigger", "asChild", "side", "content", "iconOnly", "variant", "event", "stopPropagation", "defaultHighlightStyle", "syntaxHighlighting", "composeRefs", "React", "Doc", "useThemeContext", "useTranslation", "composable", "composableProps", "useTextEditor", "createBasicExtensions", "createDataExtensions", "createMarkdownExtensions", "createThemeExtensions", "decorateMarkdown", "isNonNullable", "meta", "autocompletion", "completionKeymap", "RangeSetBuilder", "Decoration", "ViewPlugin", "WidgetType", "keymap", "Domino", "mx", "handlebars", "_", "handlebarsHighlightPlugin", "activateOnTyping", "aboveCursor", "closeOnBlur", "override", "handlebarsCompletions", "of", "regex", "comment", "brackets", "command", "var", "dxn", "url", "tagPadding", "fromClass", "decorations", "view", "buildDecorations", "update", "docChanged", "viewportChanged", "selectionSet", "selection", "state", "main", "from", "to", "visibleRanges", "text", "doc", "sliceString", "match", "exec", "start", "index", "end", "length", "overlaps", "push", "decoration", "widget", "DXNWidget", "mark", "class", "parts", "split", "idx", "sort", "a", "b", "builder", "add", "finish", "v", "_identifier", "ignoreEvent", "eq", "other", "toDOM", "map", "part", "len", "plen", "slice", "join", "classNames", "root", "variables", "commands", "context", "matchBefore", "type", "matches", "startsWith", "lastIndexOf", "options", "filter", "name", "label", "syntaxTree", "RangeSetBuilder", "Decoration", "ViewPlugin", "xmlDecorator", "_", "xmlDecoratorPlugin", "fromClass", "decorations", "view", "buildDecorations", "update", "docChanged", "viewportChanged", "builder", "from", "to", "visibleRanges", "state", "iterate", "enter", "node", "name", "add", "mark", "class", "finish", "v", "TemplateEditor", "composable", "classNames", "id", "source", "lineNumbers", "props", "forwardedRef", "t", "useTranslation", "meta", "profile", "key", "themeMode", "useThemeContext", "parentRef", "useTextEditor", "target", "initialValue", "content", "extensions", "createDataExtensions", "text", "Doc", "createAccessor", "createBasicExtensions", "bracketMatching", "lineWrapping", "placeholder", "createThemeExtensions", "createMarkdownExtensions", "decorateMarkdown", "handlebars", "xmlDecorator", "syntaxHighlighting", "defaultHighlightStyle", "filter", "isNonNullable", "React", "div", "composableProps", "role", "ref", "composeRefs"]
7
- }
@@ -1,17 +0,0 @@
1
- import "../chunk-J5LGTIGS.mjs";
2
-
3
- // src/containers/index.ts
4
- import { lazy } from "react";
5
- var RoutineArticle = lazy(() => import("../RoutineArticle-UNTMV4CC.mjs"));
6
- var RoutineTraceCompanion = lazy(() => import("../RoutineTraceCompanion-5U6R7LJE.mjs"));
7
- var RoutineSettings = lazy(() => import("../RoutineSettings-ZJOM4F3S.mjs"));
8
- var RoutineCompanion = lazy(() => import("../RoutineCompanion-ZZ6WMY7I.mjs"));
9
- var SkillArticle = lazy(() => import("../SkillArticle-WWDNKW2Z.mjs"));
10
- export {
11
- RoutineArticle,
12
- RoutineCompanion,
13
- RoutineSettings,
14
- RoutineTraceCompanion,
15
- SkillArticle
16
- };
17
- //# sourceMappingURL=index.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/containers/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type ComponentType, lazy } from 'react';\n\nexport const RoutineArticle: ComponentType<any> = lazy(() => import('./RoutineArticle'));\nexport const RoutineTraceCompanion: ComponentType<any> = lazy(() => import('./RoutineTraceCompanion'));\nexport const RoutineSettings: ComponentType<any> = lazy(() => import('./RoutineSettings'));\nexport const RoutineCompanion: ComponentType<any> = lazy(() => import('./RoutineCompanion'));\nexport const SkillArticle: ComponentType<any> = lazy(() => import('./SkillArticle'));\n"],
5
- "mappings": ";;;AAIA,SAA6BA,YAAY;AAElC,IAAMC,iBAAqCD,KAAK,MAAM,OAAO,gCAAA,CAAA;AAC7D,IAAME,wBAA4CF,KAAK,MAAM,OAAO,uCAAA,CAAA;AACpE,IAAMG,kBAAsCH,KAAK,MAAM,OAAO,iCAAA,CAAA;AAC9D,IAAMI,mBAAuCJ,KAAK,MAAM,OAAO,kCAAA,CAAA;AAC/D,IAAMK,eAAmCL,KAAK,MAAM,OAAO,8BAAA,CAAA;",
6
- "names": ["lazy", "RoutineArticle", "RoutineTraceCompanion", "RoutineSettings", "RoutineCompanion", "SkillArticle"]
7
- }
@@ -1,25 +0,0 @@
1
- import "./chunk-J5LGTIGS.mjs";
2
-
3
- // src/capabilities/create-object.ts
4
- import * as Effect from "effect/Effect";
5
- import { Capability } from "@dxos/app-framework";
6
- import { Operation } from "@dxos/compute";
7
- import { Type } from "@dxos/echo";
8
- import { SpaceCapabilities } from "@dxos/plugin-space";
9
- import { CreateRoutinePanel } from "#components";
10
- import { Routine, RoutineOperation } from "#types";
11
- var create_object_default = Capability.makeModule(Effect.fnUntraced(function* () {
12
- return Capability.contributes(SpaceCapabilities.CreateObjectEntry, {
13
- id: Type.getTypename(Routine.Routine),
14
- customPanel: CreateRoutinePanel,
15
- createObject: ({ name, templateId }, options) => Operation.invoke(RoutineOperation.CreateRoutine, {
16
- db: options.db,
17
- templateId,
18
- name
19
- })
20
- });
21
- }));
22
- export {
23
- create_object_default as default
24
- };
25
- //# sourceMappingURL=create-object-V23KVDMJ.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/create-object.ts"],
4
- "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { Operation } from '@dxos/compute';\nimport { Type } from '@dxos/echo';\nimport { SpaceCapabilities } from '@dxos/plugin-space';\n\nimport { CreateRoutinePanel } from '#components';\nimport { Routine, RoutineOperation } from '#types';\n\ntype CreateOptions = Parameters<SpaceCapabilities.CreateObjectEntry['createObject']>[1];\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n return Capability.contributes(SpaceCapabilities.CreateObjectEntry, {\n id: Type.getTypename(Routine.Routine),\n customPanel: CreateRoutinePanel,\n createObject: ({ name, templateId }: { name?: string; templateId: string }, options: CreateOptions) =>\n Operation.invoke(RoutineOperation.CreateRoutine, { db: options.db, templateId, name }),\n });\n }),\n);\n"],
5
- "mappings": ";;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,iBAAiB;AAC1B,SAASC,YAAY;AACrB,SAASC,yBAAyB;AAElC,SAASC,0BAA0B;AACnC,SAASC,SAASC,wBAAwB;AAI1C,IAAA,wBAAeN,WAAWO,WACjBC,kBAAW,aAAA;AAChB,SAAOR,WAAWS,YAAYN,kBAAkBO,mBAAmB;IACjEC,IAAIT,KAAKU,YAAYP,QAAQA,OAAO;IACpCQ,aAAaT;IACbU,cAAc,CAAC,EAAEC,MAAMC,WAAU,GAA2CC,YAC1EhB,UAAUiB,OAAOZ,iBAAiBa,eAAe;MAAEC,IAAIH,QAAQG;MAAIJ;MAAYD;IAAK,CAAA;EACxF,CAAA;AACF,CAAA,CAAA;",
6
- "names": ["Effect", "Capability", "Operation", "Type", "SpaceCapabilities", "CreateRoutinePanel", "Routine", "RoutineOperation", "makeModule", "fnUntraced", "contributes", "CreateObjectEntry", "id", "getTypename", "customPanel", "createObject", "name", "templateId", "options", "invoke", "CreateRoutine", "db"]
7
- }
@@ -1,38 +0,0 @@
1
- import {
2
- RoutineCapabilities_exports,
3
- RoutineOperation_exports
4
- } from "./chunk-R7J2MU2M.mjs";
5
- import "./chunk-674LDIUJ.mjs";
6
- import {
7
- getRoutinesPath
8
- } from "./chunk-WLNL77C7.mjs";
9
- import "./chunk-J5LGTIGS.mjs";
10
-
11
- // src/operations/create-routine.ts
12
- import * as Effect from "effect/Effect";
13
- import { Capability } from "@dxos/app-framework";
14
- import { Operation } from "@dxos/compute";
15
- import { Database } from "@dxos/echo";
16
- import { invariant } from "@dxos/invariant";
17
- import { SpaceOperation } from "@dxos/plugin-space";
18
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-routine/src/operations/create-routine.ts";
19
- var handler = RoutineOperation_exports.CreateRoutine.pipe(Operation.withHandler(Effect.fnUntraced(function* ({ db, templateId, name, subject }) {
20
- const templates = yield* Capability.getAll(RoutineCapabilities_exports.Template);
21
- const template = templates.find((entry) => entry.id === templateId);
22
- invariant(template, `Unknown routine template: ${templateId}`, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 15, S: this, A: ["template", "`Unknown routine template: ${templateId}`"] });
23
- const draft = yield* template.scaffold({
24
- name,
25
- subject
26
- }).pipe(Effect.provideService(Database.Service, Database.makeService(db)));
27
- const targetNodeId = getRoutinesPath(db.spaceId);
28
- return yield* Operation.invoke(SpaceOperation.AddObject, {
29
- object: draft,
30
- target: db,
31
- targetNodeId
32
- });
33
- })));
34
- var create_routine_default = handler;
35
- export {
36
- create_routine_default as default
37
- };
38
- //# sourceMappingURL=create-routine-6QBY6TWF.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/operations/create-routine.ts"],
4
- "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { Operation } from '@dxos/compute';\nimport { Database } from '@dxos/echo';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceOperation } from '@dxos/plugin-space';\n\nimport { getRoutinesPath } from '../paths';\nimport { RoutineCapabilities, RoutineOperation } from '../types';\n\nconst handler: Operation.WithHandler<typeof RoutineOperation.CreateRoutine> = RoutineOperation.CreateRoutine.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ db, templateId, name, subject }) {\n const templates = yield* Capability.getAll(RoutineCapabilities.Template);\n const template = templates.find((entry) => entry.id === templateId);\n invariant(template, `Unknown routine template: ${templateId}`);\n\n // The scaffold returns a fully-wired in-memory routine graph (runnable, owned instructions, and trigger\n // all parented and bound by `Routine.make`); AddObject's `Database.add` cascades the whole graph.\n const draft = yield* template\n .scaffold({ name, subject })\n .pipe(Effect.provideService(Database.Service, Database.makeService(db)));\n\n const targetNodeId = getRoutinesPath(db.spaceId);\n return yield* Operation.invoke(SpaceOperation.AddObject, {\n object: draft,\n target: db,\n targetNodeId,\n });\n }),\n ),\n);\n\nexport default handler;\n"],
5
- "mappings": ";;;;;;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,iBAAiB;AAC1B,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;AAC1B,SAASC,sBAAsB;AAK/B,IAAA,eAA8EC;IAIxE,UAAMC,yBAAqBC,cAAgBC,KAAMC,UAAOC,YAAAA,kBAAAA,WAAAA,EAAAA,IAAAA,YAAAA,MAAAA,QAAAA,GAAAA;AACxDC,QAAAA,YAAUL,OAAW,WAAA,OAAA,4BAAwC,QAAA;AAE7D,QAAA,WAAA,UAAA,KAAA,CAAA,UAAA,MAAA,OAAA,UAAA;AACA,YAAA,UAAA,6BAAA,UAAA,IAAA,EAAA,YAAA,YAAA,GAAA,cAAkG,GAAA,IAAA,GAAA,MAAA,GAAA,CAAA,YAAA,2CAAA,EAAA,CAAA;QAE9EM,QAAAA,OAAAA,SAAAA,SAAAA;IACjBC;IAEH;EACA,CAAA,EAAA,KAAcC,sBAAgB,SAACC,SAAeC,SAAW,YAAA,EAAA,CAAA,CAAA;QACvDC,eAAQC,gBAAAA,GAAAA,OAAAA;SACRC,OAAQC,UAAAA,OAAAA,eAAAA,WAAAA;IACRC,QAAAA;IACF,QAAA;IACF;EAIJ,CAAA;;;",
6
- "names": ["Effect", "Capability", "Operation", "Database", "invariant", "SpaceOperation", "RoutineOperation", "template", "find", "entry", "id", "templateId", "invariant", "subject", "pipe", "Operation", "SpaceOperation", "AddObject", "object", "draft", "target", "db", "targetNodeId"]
7
- }
@@ -1,70 +0,0 @@
1
- import {
2
- RoutineOperation_exports
3
- } from "./chunk-R7J2MU2M.mjs";
4
- import "./chunk-674LDIUJ.mjs";
5
- import {
6
- getRoutinesSettingsPath
7
- } from "./chunk-WLNL77C7.mjs";
8
- import "./chunk-J5LGTIGS.mjs";
9
-
10
- // src/operations/create-trigger-from-template.ts
11
- import * as Effect from "effect/Effect";
12
- import { LayoutOperation, Paths } from "@dxos/app-toolkit";
13
- import { Operation, Script, Trigger } from "@dxos/compute";
14
- import { Filter, Obj, Ref } from "@dxos/echo";
15
- import { SpaceOperation } from "@dxos/plugin-space";
16
- var handler = RoutineOperation_exports.CreateTriggerFromTemplate.pipe(Operation.withHandler(Effect.fnUntraced(function* ({ db, template, enabled = false, scriptName, input }) {
17
- const trigger = Trigger.make({
18
- enabled,
19
- input
20
- });
21
- if (scriptName) {
22
- const scripts = yield* Effect.promise(() => db.query(Filter.type(Script.Script, {
23
- name: scriptName
24
- })).run());
25
- const [script] = scripts;
26
- if (script) {
27
- const operations = yield* Effect.promise(() => db.query(Filter.type(Operation.PersistentOperation, {
28
- source: Ref.make(script)
29
- })).run());
30
- const [operation] = operations;
31
- if (operation) {
32
- Obj.update(trigger, (trigger2) => {
33
- trigger2.runnable = Ref.make(operation);
34
- });
35
- }
36
- }
37
- }
38
- switch (template.type) {
39
- case "timer": {
40
- Obj.update(trigger, (trigger2) => {
41
- trigger2.spec = Trigger.specTimer(template.cron);
42
- });
43
- break;
44
- }
45
- case "feed": {
46
- Obj.update(trigger, (trigger2) => {
47
- trigger2.spec = Trigger.specFeed(template.feed);
48
- });
49
- break;
50
- }
51
- default: {
52
- break;
53
- }
54
- }
55
- yield* Operation.invoke(SpaceOperation.AddObject, {
56
- object: trigger,
57
- target: db
58
- });
59
- yield* Operation.invoke(LayoutOperation.Open, {
60
- subject: [
61
- getRoutinesSettingsPath(db.spaceId)
62
- ],
63
- workspace: Paths.getSpacePath(db.spaceId)
64
- });
65
- })));
66
- var create_trigger_from_template_default = handler;
67
- export {
68
- create_trigger_from_template_default as default
69
- };
70
- //# sourceMappingURL=create-trigger-from-template-U3KNS77V.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/operations/create-trigger-from-template.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { LayoutOperation, Paths } from '@dxos/app-toolkit';\nimport { Operation, Script, Trigger } from '@dxos/compute';\nimport { type Feed, Filter, Obj, Ref } from '@dxos/echo';\nimport { SpaceOperation } from '@dxos/plugin-space';\n\nimport { getRoutinesSettingsPath } from '../paths';\nimport { RoutineOperation } from '../types';\n\nconst handler: Operation.WithHandler<typeof RoutineOperation.CreateTriggerFromTemplate> =\n RoutineOperation.CreateTriggerFromTemplate.pipe(\n Operation.withHandler(\n Effect.fnUntraced(function* ({ db, template, enabled = false, scriptName, input }) {\n const trigger = Trigger.make({ enabled, input });\n\n // TODO(wittjosiah): Factor out operation lookup by script name?\n if (scriptName) {\n const scripts = yield* Effect.promise(() => db.query(Filter.type(Script.Script, { name: scriptName })).run());\n const [script] = scripts;\n if (script) {\n const operations = yield* Effect.promise(() =>\n db.query(Filter.type(Operation.PersistentOperation, { source: Ref.make(script) })).run(),\n );\n const [operation] = operations;\n if (operation) {\n Obj.update(trigger, (trigger) => {\n trigger.runnable = Ref.make(operation);\n });\n }\n }\n }\n\n switch (template.type) {\n case 'timer': {\n Obj.update(trigger, (trigger) => {\n trigger.spec = Trigger.specTimer(template.cron);\n });\n break;\n }\n case 'feed': {\n Obj.update(trigger, (trigger) => {\n trigger.spec = Trigger.specFeed(template.feed as Feed.Feed);\n });\n break;\n }\n default: {\n break;\n }\n }\n\n yield* Operation.invoke(SpaceOperation.AddObject, {\n object: trigger,\n target: db,\n });\n yield* Operation.invoke(LayoutOperation.Open, {\n subject: [getRoutinesSettingsPath(db.spaceId)],\n workspace: Paths.getSpacePath(db.spaceId),\n });\n }),\n ),\n );\n\nexport default handler;\n"],
5
- "mappings": ";;;;;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,iBAAiBC,aAAa;AACvC,SAASC,WAAWC,QAAQC,eAAe;AAC3C,SAAoBC,QAAQC,KAAKC,WAAW;AAC5C,SAASC,sBAAsB;AAK/B,IAAMC,UACJC,yBAAiBC,0BAA0BC,KACzCC,UAAUC,YACDC,kBAAW,WAAW,EAAEC,IAAIC,UAAUC,UAAU,OAAOC,YAAYC,MAAK,GAAE;AAC/E,QAAMC,UAAUC,QAAQC,KAAK;IAAEL;IAASE;EAAM,CAAA;AAG9C,MAAID,YAAY;AACd,UAAMK,UAAU,OAAcC,eAAQ,MAAMT,GAAGU,MAAMC,OAAOC,KAAKC,OAAOA,QAAQ;MAAEC,MAAMX;IAAW,CAAA,CAAA,EAAIY,IAAG,CAAA;AAC1G,UAAM,CAACC,MAAAA,IAAUR;AACjB,QAAIQ,QAAQ;AACV,YAAMC,aAAa,OAAcR,eAAQ,MACvCT,GAAGU,MAAMC,OAAOC,KAAKf,UAAUqB,qBAAqB;QAAEC,QAAQC,IAAIb,KAAKS,MAAAA;MAAQ,CAAA,CAAA,EAAID,IAAG,CAAA;AAExF,YAAM,CAACM,SAAAA,IAAaJ;AACpB,UAAII,WAAW;AACbC,YAAIC,OAAOlB,SAAS,CAACA,aAAAA;AACnBA,UAAAA,SAAQmB,WAAWJ,IAAIb,KAAKc,SAAAA;QAC9B,CAAA;MACF;IACF;EACF;AAEA,UAAQpB,SAASW,MAAI;IACnB,KAAK,SAAS;AACZU,UAAIC,OAAOlB,SAAS,CAACA,aAAAA;AACnBA,QAAAA,SAAQoB,OAAOnB,QAAQoB,UAAUzB,SAAS0B,IAAI;MAChD,CAAA;AACA;IACF;IACA,KAAK,QAAQ;AACXL,UAAIC,OAAOlB,SAAS,CAACA,aAAAA;AACnBA,QAAAA,SAAQoB,OAAOnB,QAAQsB,SAAS3B,SAAS4B,IAAI;MAC/C,CAAA;AACA;IACF;IACA,SAAS;AACP;IACF;EACF;AAEA,SAAOhC,UAAUiC,OAAOC,eAAeC,WAAW;IAChDC,QAAQ5B;IACR6B,QAAQlC;EACV,CAAA;AACA,SAAOH,UAAUiC,OAAOK,gBAAgBC,MAAM;IAC5CC,SAAS;MAACC,wBAAwBtC,GAAGuC,OAAO;;IAC5CC,WAAWC,MAAMC,aAAa1C,GAAGuC,OAAO;EAC1C,CAAA;AACF,CAAA,CAAA,CAAA;AAIN,IAAA,uCAAe9C;",
6
- "names": ["Effect", "LayoutOperation", "Paths", "Operation", "Script", "Trigger", "Filter", "Obj", "Ref", "SpaceOperation", "handler", "RoutineOperation", "CreateTriggerFromTemplate", "pipe", "Operation", "withHandler", "fnUntraced", "db", "template", "enabled", "scriptName", "input", "trigger", "Trigger", "make", "scripts", "promise", "query", "Filter", "type", "Script", "name", "run", "script", "operations", "PersistentOperation", "source", "Ref", "operation", "Obj", "update", "runnable", "spec", "specTimer", "cron", "specFeed", "feed", "invoke", "SpaceOperation", "AddObject", "object", "target", "LayoutOperation", "Open", "subject", "getRoutinesSettingsPath", "spaceId", "workspace", "Paths", "getSpacePath"]
7
- }