@processfocus/runtime-local 0.1.0-next.2 → 0.1.0-next.3

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 (326) hide show
  1. package/README.md +48 -253
  2. package/dist/authentication-server.mjs +52 -84
  3. package/dist/{chunk-yhzbn4vx.js → chunk-04r0t2mb.js} +34324 -49067
  4. package/dist/chunk-727y6qkb.js +156 -0
  5. package/dist/chunk-bg5r4wpv.js +4755 -0
  6. package/dist/chunk-cbd36jq1.js +512 -0
  7. package/dist/chunk-d4ctj079.js +241 -0
  8. package/dist/{chunk-352j1ayk.js → chunk-r5s2v669.js} +51753 -36263
  9. package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/actions.ts +12 -12
  10. package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/delegations-client.tsx +31 -21
  11. package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/page.tsx +3 -0
  12. package/dist/dashboard-source/apps/frontend/app/(protected)/client-index.tsx +1 -12
  13. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/client.tsx +1 -1
  14. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/page.tsx +2 -0
  15. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/process-state/page.tsx +2 -0
  16. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/default.tsx +3 -0
  17. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/page.tsx +3 -1
  18. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/process-state/page.tsx +2 -0
  19. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/client-layout.tsx +19 -0
  20. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/default.tsx +6 -0
  21. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/executions-client.tsx +1637 -0
  22. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/layout.tsx +5 -7
  23. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/page.tsx +4 -1589
  24. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-page-client.tsx +1 -1
  25. package/dist/dashboard-source/apps/frontend/app/(protected)/layout.tsx +41 -33
  26. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/client.tsx +11 -17
  27. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/page.tsx +2 -0
  28. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/default.tsx +3 -0
  29. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/list-page-client.tsx +145 -19
  30. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/page.tsx +10 -2
  31. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-create-form.tsx +29 -13
  32. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-edit-form.tsx +22 -28
  33. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-load-error.tsx +49 -0
  34. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-schema-form.tsx +28 -0
  35. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/default.tsx +6 -0
  36. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/metric-control-url-state.ts +7 -16
  37. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-deleted-callback.ts +4 -6
  38. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-item-detail.ts +45 -142
  39. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/client.tsx +10 -20
  40. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/page.tsx +2 -0
  41. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/layout.tsx +3 -0
  42. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-process-dialog.tsx +72 -0
  43. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh-provider.tsx +65 -0
  44. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh.ts +162 -16
  45. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.tsx +19 -0
  46. package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/page.tsx +4 -9
  47. package/dist/dashboard-source/apps/frontend/app/(protected)/page.tsx +4 -0
  48. package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/actions.ts +15 -18
  49. package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/page.tsx +12 -6
  50. package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/passkeys-client.tsx +7 -16
  51. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/client.tsx +26 -48
  52. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/page.tsx +4 -7
  53. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/default.tsx +3 -0
  54. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client-layout.tsx +28 -0
  55. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client.tsx +1 -3
  56. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/start-process-form.tsx +193 -117
  57. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/default.tsx +6 -0
  58. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/layout.tsx +7 -9
  59. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/page.tsx +3 -0
  60. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/processes-client.tsx +60 -204
  61. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/client.tsx +12 -51
  62. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/page.tsx +27 -4
  63. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/page.tsx +5 -4
  64. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-flow.tsx +0 -5
  65. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-form-preview-sheet.tsx +26 -19
  66. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/page.tsx +5 -2
  67. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-authorize.ts +85 -9
  68. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-types.ts +12 -1
  69. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/explorer.tsx +66 -4
  70. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/layout.tsx +3 -0
  71. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-handbook.ts +41 -13
  72. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/[invitationId]/page.tsx +2 -0
  73. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-client.tsx +442 -365
  74. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/new/page.tsx +8 -2
  75. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/page.tsx +7 -0
  76. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations-table.tsx +61 -43
  77. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/page.tsx +6 -67
  78. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/providers/page.tsx +7 -0
  79. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/roles/page.tsx +7 -0
  80. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-client.tsx +111 -189
  81. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-page.tsx +86 -0
  82. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/client.tsx +141 -256
  83. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/page.tsx +2 -0
  84. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/tokens/page.tsx +2 -0
  85. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/page.tsx +7 -0
  86. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users-table.tsx +6 -4
  87. package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/page.tsx +3 -0
  88. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/client.tsx +30 -9
  89. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/page.tsx +3 -1
  90. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/default.tsx +3 -0
  91. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/client.tsx +2 -4
  92. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/page.tsx +3 -1
  93. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/complete-todo-form.tsx +47 -54
  94. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/public-completion-correction-form.tsx +37 -54
  95. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/todo-form-actions.tsx +1 -1
  96. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/correct/[...stepPath]/page.tsx +3 -1
  97. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/default.tsx +6 -0
  98. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/layout.tsx +3 -0
  99. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/lib/mobile-todo-list.ts +4 -25
  100. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/page.tsx +4 -1315
  101. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/to-dos-client.tsx +1282 -0
  102. package/dist/dashboard-source/apps/frontend/app/api/auth/callback/route.ts +81 -65
  103. package/dist/dashboard-source/apps/frontend/app/api/auth/delegation/route.ts +8 -2
  104. package/dist/dashboard-source/apps/frontend/app/api/auth/login/route.ts +0 -1
  105. package/dist/dashboard-source/apps/frontend/app/api/auth/logout/route.ts +10 -5
  106. package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/start/route.ts +1 -3
  107. package/dist/dashboard-source/apps/frontend/app/api/auth/refresh/route.ts +0 -1
  108. package/dist/dashboard-source/apps/frontend/app/api/auth/revalidate-google/route.ts +68 -0
  109. package/dist/dashboard-source/apps/frontend/app/api/auth/switch-role/route.ts +1 -3
  110. package/dist/dashboard-source/apps/frontend/app/api/embed/lookup/route.ts +25 -7
  111. package/dist/dashboard-source/apps/frontend/app/api/embed/submit/route.ts +1 -2
  112. package/dist/dashboard-source/apps/frontend/app/api/public/start/[address]/route.ts +49 -0
  113. package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/lookup/route.ts +4 -3
  114. package/dist/dashboard-source/apps/frontend/app/api/revalidate/route.ts +15 -4
  115. package/dist/dashboard-source/apps/frontend/app/app-shell.tsx +11 -4
  116. package/dist/dashboard-source/apps/frontend/app/cli-auth/route.ts +2 -1
  117. package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/embed-client.tsx +31 -18
  118. package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/page.tsx +5 -1
  119. package/dist/dashboard-source/apps/frontend/app/login/page.tsx +4 -4
  120. package/dist/dashboard-source/apps/frontend/app/login/passkey-button.tsx +11 -6
  121. package/dist/dashboard-source/apps/frontend/app/login/passkey-help/page.tsx +67 -0
  122. package/dist/dashboard-source/apps/frontend/app/mcp/[[...endpoint]]/route.ts +47 -0
  123. package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-client.tsx +44 -25
  124. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/form/page.tsx +10 -0
  125. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/layout.tsx +32 -0
  126. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-client.tsx +319 -0
  127. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-content.tsx +41 -0
  128. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page.tsx +10 -0
  129. package/dist/dashboard-source/apps/frontend/app/public.css +1 -1
  130. package/dist/dashboard-source/apps/frontend/app/register/passkey/register-passkey-client.tsx +17 -0
  131. package/dist/dashboard-source/apps/frontend/components/DashboardSection.tsx +9 -15
  132. package/dist/dashboard-source/apps/frontend/components/Header.tsx +4 -8
  133. package/dist/dashboard-source/apps/frontend/components/anonymous-page-link.tsx +57 -0
  134. package/dist/dashboard-source/apps/frontend/components/anonymous-start-form.tsx +24 -0
  135. package/dist/dashboard-source/apps/frontend/components/app-sidebar.tsx +21 -7
  136. package/dist/dashboard-source/apps/frontend/components/auth-provider.tsx +12 -7
  137. package/dist/dashboard-source/apps/frontend/components/browser-only.tsx +19 -0
  138. package/dist/dashboard-source/apps/frontend/components/config-provider.tsx +0 -1
  139. package/dist/dashboard-source/apps/frontend/components/delegation-expiry.tsx +24 -13
  140. package/dist/dashboard-source/apps/frontend/components/form-dialog-content.tsx +22 -2
  141. package/dist/dashboard-source/apps/frontend/components/journey-timeline.tsx +52 -45
  142. package/dist/dashboard-source/apps/frontend/components/notification-bell.tsx +0 -1
  143. package/dist/dashboard-source/apps/frontend/components/sidebar-lists.tsx +0 -1
  144. package/dist/dashboard-source/apps/frontend/components/token-refresh-scheduler.tsx +38 -11
  145. package/dist/dashboard-source/apps/frontend/components/ui/sidebar.tsx +0 -1
  146. package/dist/dashboard-source/apps/frontend/components/ui/tab-pill.tsx +26 -15
  147. package/dist/dashboard-source/apps/frontend/components/workflow/step-node.tsx +0 -1
  148. package/dist/dashboard-source/apps/frontend/components/workflow/workflow-edge.tsx +5 -0
  149. package/dist/dashboard-source/apps/frontend/hooks/use-form-metadata.ts +21 -10
  150. package/dist/dashboard-source/apps/frontend/hooks/use-process-draft.ts +173 -0
  151. package/dist/dashboard-source/apps/frontend/hooks/use-weekly-execution-stats.ts +1 -3
  152. package/dist/dashboard-source/apps/frontend/lib/anonymous-page-form-values.ts +6 -0
  153. package/dist/dashboard-source/apps/frontend/lib/anonymous-page-server.ts +65 -0
  154. package/dist/dashboard-source/apps/frontend/lib/appsync-events/adapter.ts +9 -3
  155. package/dist/dashboard-source/apps/frontend/lib/appsync-events/client.ts +7 -340
  156. package/dist/dashboard-source/apps/frontend/lib/auth/client-session.ts +2 -0
  157. package/dist/dashboard-source/apps/frontend/lib/auth/delegations.ts +9 -7
  158. package/dist/dashboard-source/apps/frontend/lib/auth/google-revalidation.ts +111 -0
  159. package/dist/dashboard-source/apps/frontend/lib/auth/logout.ts +1 -1
  160. package/dist/dashboard-source/apps/frontend/lib/auth/passkeys.ts +28 -30
  161. package/dist/dashboard-source/apps/frontend/lib/auth/providers.ts +10 -0
  162. package/dist/dashboard-source/apps/frontend/lib/auth/realtime-session-token.ts +1 -0
  163. package/dist/dashboard-source/apps/frontend/lib/auth/reauthentication-state.ts +4 -4
  164. package/dist/dashboard-source/apps/frontend/lib/auth/session-admission.ts +11 -7
  165. package/dist/dashboard-source/apps/frontend/lib/auth/session.ts +27 -10
  166. package/dist/dashboard-source/apps/frontend/lib/auth/ssr-session.ts +76 -9
  167. package/dist/dashboard-source/apps/frontend/lib/auth/verify-passkey.ts +25 -3
  168. package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-factory.tsx +112 -21
  169. package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution.ts +1 -8
  170. package/dist/dashboard-source/apps/frontend/lib/collections/execution.ts +6 -2
  171. package/dist/dashboard-source/apps/frontend/lib/collections/process-collection-provider.tsx +3 -0
  172. package/dist/dashboard-source/apps/frontend/lib/collections/process.ts +8 -2
  173. package/dist/dashboard-source/apps/frontend/lib/collections/replication-factory.ts +16 -4
  174. package/dist/dashboard-source/apps/frontend/lib/collections/todo.ts +1 -1
  175. package/dist/dashboard-source/apps/frontend/lib/effect/navigation.ts +4 -0
  176. package/dist/dashboard-source/apps/frontend/lib/effect/page-runtime.ts +29 -0
  177. package/dist/dashboard-source/apps/frontend/lib/effect/params.ts +18 -12
  178. package/dist/dashboard-source/apps/frontend/lib/effect/run-effect.ts +1 -1
  179. package/dist/dashboard-source/apps/frontend/lib/effect/runtime.ts +19 -23
  180. package/dist/dashboard-source/apps/frontend/lib/effect/services/access-token.ts +9 -12
  181. package/dist/dashboard-source/apps/frontend/lib/effect/services/authorization.ts +12 -12
  182. package/dist/dashboard-source/apps/frontend/lib/effect/services/form-validation.ts +20 -18
  183. package/dist/dashboard-source/apps/frontend/lib/effect/services/graphql.ts +32 -16
  184. package/dist/dashboard-source/apps/frontend/lib/embed-form-server.ts +35 -0
  185. package/dist/dashboard-source/apps/frontend/lib/embed-manifest.ts +10 -103
  186. package/dist/dashboard-source/apps/frontend/lib/forms/invitation.ts +43 -0
  187. package/dist/dashboard-source/apps/frontend/lib/forms/provider-user.ts +64 -0
  188. package/dist/dashboard-source/apps/frontend/lib/frontend-form-loaders.ts +40 -0
  189. package/dist/dashboard-source/apps/frontend/lib/frontend-manifest.ts +1 -33
  190. package/dist/dashboard-source/apps/frontend/lib/generated/gql/gql.ts +123 -33
  191. package/dist/dashboard-source/apps/frontend/lib/generated/gql/graphql.ts +169 -30
  192. package/dist/dashboard-source/apps/frontend/lib/generated/gql/index.ts +1 -0
  193. package/dist/dashboard-source/apps/frontend/lib/graphql/anonymous-page.ts +27 -0
  194. package/dist/dashboard-source/apps/frontend/lib/graphql/dependent-lookup-query.ts +1 -0
  195. package/dist/dashboard-source/apps/frontend/lib/graphql/list-queries.ts +34 -29
  196. package/dist/dashboard-source/apps/frontend/lib/graphql/lookup-provider.tsx +82 -10
  197. package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-operations.ts +2 -5
  198. package/dist/dashboard-source/apps/frontend/lib/graphql/queries.ts +25 -4
  199. package/dist/dashboard-source/apps/frontend/lib/graphql/server-client.ts +11 -0
  200. package/dist/dashboard-source/apps/frontend/lib/graphql/settings-queries.ts +13 -104
  201. package/dist/dashboard-source/apps/frontend/lib/graphql/user-queries.ts +11 -4
  202. package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-operations.ts +1 -3
  203. package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-queries.ts +1 -0
  204. package/dist/dashboard-source/apps/frontend/lib/list-detail-selection.ts +54 -0
  205. package/dist/dashboard-source/apps/frontend/lib/mcp/executions.ts +110 -0
  206. package/dist/dashboard-source/apps/frontend/lib/mcp/list-writes.ts +395 -0
  207. package/dist/dashboard-source/apps/frontend/lib/mcp/lists.ts +263 -0
  208. package/dist/dashboard-source/apps/frontend/lib/mcp/oauth.ts +900 -0
  209. package/dist/dashboard-source/apps/frontend/lib/mcp/origin.ts +42 -0
  210. package/dist/dashboard-source/apps/frontend/lib/mcp/processes.ts +436 -0
  211. package/dist/dashboard-source/apps/frontend/lib/mcp/read-tool.ts +72 -0
  212. package/dist/dashboard-source/apps/frontend/lib/mcp/result.ts +4 -0
  213. package/dist/dashboard-source/apps/frontend/lib/mcp/server.ts +71 -0
  214. package/dist/dashboard-source/apps/frontend/lib/mcp/store.ts +193 -0
  215. package/dist/dashboard-source/apps/frontend/lib/mcp/todos.ts +237 -0
  216. package/dist/dashboard-source/apps/frontend/lib/notifications/notification-preference.ts +0 -1
  217. package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notification-observer.ts +0 -5
  218. package/dist/dashboard-source/apps/frontend/lib/org-chart-data.ts +0 -2
  219. package/dist/dashboard-source/apps/frontend/lib/org-identity.ts +6 -4
  220. package/dist/dashboard-source/apps/frontend/lib/organisation-form-loaders.ts +4 -0
  221. package/dist/dashboard-source/apps/frontend/lib/public-todo-form-runtime.ts +0 -1
  222. package/dist/dashboard-source/apps/frontend/lib/public-todo-model.ts +39 -139
  223. package/dist/dashboard-source/apps/frontend/lib/public-todo-server.ts +17 -16
  224. package/dist/dashboard-source/apps/frontend/lib/query-client.ts +0 -1
  225. package/dist/dashboard-source/apps/frontend/lib/todo-utils.ts +1 -77
  226. package/dist/dashboard-source/apps/frontend/lib/workflow/layout.ts +3 -7
  227. package/dist/dashboard-source/apps/frontend/next.config.ts +33 -13
  228. package/dist/dashboard-source/apps/frontend/package.json +48 -47
  229. package/dist/dashboard-source/apps/frontend/proxy.ts +72 -14
  230. package/dist/dashboard-source/modules/auth-local-cedar/src/index.ts +0 -3
  231. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/auth-local-cedar.ts +165 -233
  232. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/cedar-reload-notifier.ts +4 -3
  233. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/config-base.ts +111 -75
  234. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/policy-watcher.ts +14 -18
  235. package/dist/dashboard-source/modules/auth-policy/src/index.ts +1 -0
  236. package/dist/dashboard-source/modules/auth-policy/src/lib/auth-policy.ts +19 -37
  237. package/dist/dashboard-source/modules/auth-policy/src/lib/current-principal.ts +33 -29
  238. package/dist/dashboard-source/modules/auth-policy/src/lib/policy-revision.ts +23 -0
  239. package/dist/dashboard-source/modules/auth-policy/src/lib/types.ts +24 -49
  240. package/dist/dashboard-source/modules/auth-session/src/index.ts +4 -0
  241. package/dist/dashboard-source/modules/auth-session/src/lib/project-subscription.ts +13 -0
  242. package/dist/dashboard-source/modules/auth-session/src/lib/realtime-recipient.ts +10 -2
  243. package/dist/dashboard-source/modules/auth-session/src/lib/subjects.ts +82 -8
  244. package/dist/dashboard-source/modules/auth-session/src/lib/workload-access.ts +48 -0
  245. package/dist/dashboard-source/modules/auth-session/src/lib/workload-audit.ts +52 -0
  246. package/dist/dashboard-source/modules/aws-common/src/index.ts +0 -1
  247. package/dist/dashboard-source/modules/effect-json-logger/src/lib/effect-json-logger.ts +6 -9
  248. package/dist/dashboard-source/modules/form/src/hooks/use-local-storage.ts +5 -3
  249. package/dist/dashboard-source/modules/form/src/index.ts +1 -10
  250. package/dist/dashboard-source/modules/form/src/lib/effect-schema-form.tsx +1271 -0
  251. package/dist/dashboard-source/modules/form/src/lib/form-actions.ts +26 -0
  252. package/dist/dashboard-source/modules/form/src/lib/form-prefill.tsx +79 -0
  253. package/dist/dashboard-source/modules/form/src/lib/initial-focus.ts +31 -0
  254. package/dist/dashboard-source/modules/form/src/lib/lookup-context.tsx +18 -0
  255. package/dist/dashboard-source/modules/form/src/lib/plugin-registry.ts +4 -0
  256. package/dist/dashboard-source/modules/form/src/lib/plugin-scripts.ts +26 -0
  257. package/dist/dashboard-source/modules/form/src/lib/registered-plugin-field.tsx +57 -0
  258. package/dist/dashboard-source/modules/form/src/lib/schema-lookup.tsx +124 -0
  259. package/dist/dashboard-source/modules/form/src/lib/schema-typeahead.tsx +522 -0
  260. package/dist/dashboard-source/modules/form/src/lib/validation-logic.ts +172 -0
  261. package/dist/dashboard-source/modules/form-schema/src/index.ts +4 -1
  262. package/dist/dashboard-source/modules/form-schema/src/lib/annotation-helpers.ts +19 -14
  263. package/dist/dashboard-source/modules/form-schema/src/lib/email.ts +13 -11
  264. package/dist/dashboard-source/modules/form-schema/src/lib/field-count.ts +15 -13
  265. package/dist/dashboard-source/modules/form-schema/src/lib/form-annotations.ts +14 -0
  266. package/dist/dashboard-source/modules/form-schema/src/lib/form-presentation.ts +33 -0
  267. package/dist/dashboard-source/modules/form-schema/src/lib/form-schema.ts +186 -80
  268. package/dist/dashboard-source/modules/form-schema/src/lib/number-from-string.ts +26 -0
  269. package/dist/dashboard-source/modules/form-schema/src/lib/phone.ts +8 -7
  270. package/dist/dashboard-source/modules/form-schema/src/lib/public-completion-correction.ts +7 -0
  271. package/dist/dashboard-source/modules/form-schema/src/lib/search-lookup-items.ts +27 -0
  272. package/dist/dashboard-source/modules/form-submission-schema/src/index.ts +5 -0
  273. package/dist/dashboard-source/modules/form-submission-schema/src/lib/executable-rules.ts +379 -0
  274. package/dist/dashboard-source/modules/form-submission-schema/src/lib/form-submission-schema.ts +475 -0
  275. package/dist/dashboard-source/modules/form-submission-schema/src/lib/json-schema.ts +58 -0
  276. package/dist/dashboard-source/modules/form-submission-schema/src/lib/schema-defaults.ts +158 -0
  277. package/dist/dashboard-source/modules/form-submission-schema/src/lib/submission-utils.ts +75 -0
  278. package/dist/dashboard-source/modules/frontend-manifest/src/lib/browser-plugin-artifact.ts +46 -0
  279. package/dist/dashboard-source/modules/frontend-manifest/src/lib/frontend-manifest.ts +37 -30
  280. package/dist/dashboard-source/modules/frontend-plugin-host/src/lib/frontend-plugin-host.ts +9 -1
  281. package/dist/dashboard-source/modules/openauth/src/client.ts +25 -17
  282. package/dist/dashboard-source/modules/openauth/src/util.ts +16 -0
  283. package/dist/dashboard-source/modules/{aws-common/src/lib/project-balance-admission.ts → project-accounting/src/admission.ts} +4 -8
  284. package/dist/dashboard-source/modules/realtime-client/src/appsync-client.ts +377 -0
  285. package/dist/dashboard-source/modules/realtime-client/src/index.ts +5 -0
  286. package/dist/dashboard-source/modules/realtime-client/src/subscription-presence.ts +163 -0
  287. package/dist/dashboard-source/modules/request-time/src/lib/request-time.ts +6 -24
  288. package/dist/dashboard-source/modules/rxdb-collections/generated/execution-schema.json +28 -21
  289. package/dist/dashboard-source/modules/rxdb-collections/src/lib/rxdb-collections.ts +25 -18
  290. package/dist/dashboard-source/modules/rxdb-collections/src/lib/to-rxdb-schema.ts +60 -10
  291. package/dist/dashboard-source/modules/shadcn-components/src/index.ts +18 -2
  292. package/dist/dashboard-source/modules/shadcn-components/src/lib/date-calendar.tsx +93 -0
  293. package/dist/dashboard-source/modules/shadcn-components/src/lib/date-field.tsx +147 -48
  294. package/dist/dashboard-source/modules/shadcn-components/src/lib/date-time-display.tsx +272 -0
  295. package/dist/dashboard-source/modules/shadcn-components/src/lib/local-date-time-input.tsx +108 -0
  296. package/dist/dashboard-source/modules/shadcn-components/src/lib/lookup-field.tsx +237 -351
  297. package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/popover.tsx +2 -1
  298. package/dist/dashboard-source.json +48 -47
  299. package/dist/graphql-server.mjs +245 -200
  300. package/dist/job-worker-supervisor.mjs +262 -0
  301. package/dist/job-worker.mjs +234 -133
  302. package/dist/main.mjs +23 -4
  303. package/dist/prepare-dashboard.mjs +8 -8
  304. package/dist/resources/cedar/policies.cedar +80 -38
  305. package/dist/resources/cedar/schema.cedarschema +39 -21
  306. package/dist/resources/graphql-schema/rxdb.graphql +2 -0
  307. package/dist/resources/graphql-schema/system.graphql +190 -51
  308. package/package.json +64 -62
  309. package/dist/chunk-6ntmymmx.js +0 -85
  310. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.ts +0 -20
  311. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-form-actions.tsx +0 -105
  312. package/dist/dashboard-source/apps/frontend/hooks/use-draft-process-save.ts +0 -189
  313. package/dist/dashboard-source/apps/frontend/hooks/use-draft-state.ts +0 -79
  314. package/dist/dashboard-source/apps/frontend/hooks/use-processes-query.ts +0 -56
  315. package/dist/dashboard-source/modules/form/src/lib/ajv-standard-schema.ts +0 -152
  316. package/dist/dashboard-source/modules/form/src/lib/client-components-to-form.tsx +0 -1421
  317. package/dist/dashboard-source/modules/form/src/lib/friendly-validation-message.ts +0 -85
  318. package/dist/dashboard-source/modules/form/src/lib/walker.tsx +0 -1549
  319. package/dist/dashboard-source/modules/form-client-representation/src/lib/client-form-definition.ts +0 -440
  320. package/dist/dashboard-source/modules/form-client-representation/src/lib/plugin-registry.ts +0 -13
  321. package/dist/dashboard-source/modules/form-client-representation/src/lib/types.ts +0 -336
  322. package/dist/dashboard-source/modules/form-rule/src/index.ts +0 -21
  323. package/dist/dashboard-source/modules/form-rule/src/lib/evaluator.ts +0 -531
  324. package/dist/dashboard-source/modules/form-rule/src/lib/paths.ts +0 -102
  325. package/dist/dashboard-source/modules/form-rule/src/lib/types.ts +0 -121
  326. package/dist/dashboard-source/modules/form-schema/src/lib/property-signature.ts +0 -45
@@ -1,5 +1,8 @@
1
1
  import ClientPage from "./client.tsx"
2
2
 
3
+ // The authenticated shell can omit this page while checking the session.
4
+ export const instant = false
5
+
3
6
  export default function Page() {
4
7
  return <ClientPage />
5
8
  }
@@ -2,175 +2,20 @@
2
2
 
3
3
  import type { Collection } from "@tanstack/db"
4
4
  import { useLiveQuery } from "@tanstack/react-db"
5
- import { formatDistanceToNow } from "date-fns"
6
5
  import Link from "next/link"
7
6
  import { Suspense, use, useMemo, useState } from "react"
7
+ import { deepEqual } from "rxdb/plugins/utils"
8
8
  import {
9
9
  type MobileProcessCatalogItem,
10
10
  createMobileProcessCatalog,
11
11
  } from "./lib/mobile-process-catalog.ts"
12
12
  import { ProcessWorkflowLink } from "@/components/process-workflow-link"
13
- import type { DraftProcessExecutionDocType } from "@/lib/collections/draft-process-execution"
14
- import { useDraftProcessCollection } from "@/lib/collections/draft-process-execution-collection-provider"
15
13
  import {
16
14
  type ProcessDocType,
17
15
  useProcessCollection,
18
16
  } from "@/lib/collections/process-collection-provider"
19
17
  import { cn } from "@/lib/utils"
20
18
 
21
- function formatLastSaved(lastSaved: string): string {
22
- try {
23
- const date = new Date(lastSaved)
24
- if (Number.isNaN(date.getTime())) {
25
- return "Recently saved"
26
- }
27
- return formatDistanceToNow(date, { addSuffix: true })
28
- } catch {
29
- return "Recently saved"
30
- }
31
- }
32
-
33
- interface DraftCardData {
34
- id: string
35
- processId: string
36
- name: string
37
- startStepPath: string
38
- fieldsCompleted: number
39
- totalFields: number
40
- lastSaved: string
41
- }
42
-
43
- function DraftProcessExecutionCard({
44
- draft,
45
- onDiscard,
46
- }: {
47
- draft: DraftCardData
48
- onDiscard: (id: string) => void
49
- }) {
50
- // Construct the continue URL with draftId query param
51
- const continueUrl = `/processes/start/${draft.startStepPath}?draftId=${encodeURIComponent(draft.id)}`
52
-
53
- return (
54
- <div className="rounded-xl border border-slate-200 bg-slate-50/40 p-3 text-sm text-slate-600 dark:border-slate-700 dark:bg-slate-800/60 dark:text-slate-300">
55
- <div className="flex items-center justify-between">
56
- <div>
57
- <p className="font-semibold text-slate-900 dark:text-slate-100">
58
- {draft.name}
59
- </p>
60
- <p className="text-xs text-slate-500 dark:text-slate-400">
61
- {draft.fieldsCompleted} of {draft.totalFields} fields complete
62
- </p>
63
- </div>
64
- <span className="text-xs text-slate-500 dark:text-slate-400">
65
- {formatLastSaved(draft.lastSaved)}
66
- </span>
67
- </div>
68
- <div className="mt-3 flex items-center justify-between">
69
- <div className="h-2 w-48 rounded-full bg-slate-200 dark:bg-slate-700">
70
- <div
71
- className="h-2 rounded-full bg-blue-500"
72
- style={{
73
- width: `${(draft.fieldsCompleted / draft.totalFields) * 100}%`,
74
- }}
75
- />
76
- </div>
77
- <div className="flex gap-2">
78
- <Link
79
- href={continueUrl}
80
- prefetch={false}
81
- className="cursor-pointer rounded-full border border-slate-200 px-3 py-1 text-xs font-semibold text-slate-600 transition-colors hover:border-slate-300 hover:bg-slate-50 hover:text-slate-800 dark:border-slate-700 dark:text-slate-300 dark:hover:border-slate-600 dark:hover:bg-slate-800"
82
- >
83
- Continue
84
- </Link>
85
- <button
86
- type="button"
87
- onClick={() => onDiscard(draft.id)}
88
- className="cursor-pointer text-xs font-semibold text-rose-500 transition-colors hover:text-rose-600 dark:hover:text-rose-400"
89
- >
90
- Discard
91
- </button>
92
- </div>
93
- </div>
94
- </div>
95
- )
96
- }
97
-
98
- function DraftsSkeleton() {
99
- return (
100
- <div className="flex items-center justify-center py-6">
101
- <output
102
- className="inline-block h-6 w-6 animate-spin rounded-full border-4 border-solid border-blue-600 border-r-transparent motion-reduce:animate-[spin_1.5s_linear_infinite]"
103
- aria-label="Loading drafts"
104
- />
105
- </div>
106
- )
107
- }
108
-
109
- function DraftsListInner({
110
- collectionPromise,
111
- }: {
112
- collectionPromise: Promise<Collection<DraftProcessExecutionDocType, string>>
113
- }) {
114
- const draftProcessExecutionCollection = use(collectionPromise)
115
-
116
- const draftsQuery = useLiveQuery((q) =>
117
- q.from({ draft: draftProcessExecutionCollection }).select(({ draft }) => ({
118
- id: draft.id,
119
- processId: draft.processId,
120
- name: draft.name,
121
- startStepPath: draft.startStepPath,
122
- fieldsCompleted: draft.fieldsCompleted,
123
- totalFields: draft.totalFields,
124
- lastSaved: draft.lastSaved,
125
- })),
126
- )
127
-
128
- const handleDiscard = async (draftId: string) => {
129
- try {
130
- draftProcessExecutionCollection.delete(draftId)
131
- } catch (error) {
132
- console.error("Failed to discard draft:", error)
133
- alert(
134
- `Failed to discard draft: ${error instanceof Error ? error.message : String(error)}`,
135
- )
136
- }
137
- }
138
-
139
- if (!draftsQuery.isReady) {
140
- return <DraftsSkeleton />
141
- }
142
-
143
- if (draftsQuery.data.length === 0) {
144
- return (
145
- <p className="text-sm text-slate-500 dark:text-slate-400">
146
- No drafts yet. Start a process and your progress will autosave here.
147
- </p>
148
- )
149
- }
150
-
151
- return (
152
- <>
153
- {draftsQuery.data.map((draft) => (
154
- <DraftProcessExecutionCard
155
- key={draft.id}
156
- draft={draft}
157
- onDiscard={handleDiscard}
158
- />
159
- ))}
160
- </>
161
- )
162
- }
163
-
164
- function DraftsList() {
165
- const { collectionPromise } = useDraftProcessCollection()
166
-
167
- return (
168
- <Suspense fallback={<DraftsSkeleton />}>
169
- <DraftsListInner collectionPromise={collectionPromise} />
170
- </Suspense>
171
- )
172
- }
173
-
174
19
  function ProcessesSkeleton() {
175
20
  return (
176
21
  <div className="flex-1 overflow-y-auto">
@@ -203,28 +48,23 @@ function ProcessesPageInner({
203
48
  const [query, setQuery] = useState("")
204
49
  const [filterFavorites, setFilterFavorites] = useState(false)
205
50
 
206
- // Suspend until collection is ready
207
51
  const processesCollection = use(collectionPromise)
208
52
 
209
- // Query processes from RxDB collection
210
- const processesQuery = useLiveQuery((q) =>
211
- q.from({ process: processesCollection }).select(({ process }) => ({
212
- id: process.id,
213
- updatedAt: process.updatedAt,
214
- name: process.name,
215
- path: process.path,
216
- activeInstances: process.activeInstances,
217
- category: process.category,
218
- duration: process.duration,
219
- formFieldCount: process.formFieldCount,
220
- purpose: process.purpose,
221
- isFavorite: process.isFavorite,
222
- orgUnit: process.orgUnit,
223
- startStepPath: process.startStepPath,
224
- })),
225
- )
53
+ const { initialSync, retryInitialSync } = useProcessCollection()
226
54
 
227
- const isLoadingProcesses = !processesQuery.isReady
55
+ const processesQuery = useLiveQuery({
56
+ query: (q) => q.from({ process: processesCollection }),
57
+ })
58
+
59
+ // The provider confirms persistence and adapter commits. A live query can
60
+ // still be applying those commits; compare its full local snapshot before
61
+ // authorizing empty/filter-empty wording. Keep its existing rows visible.
62
+ const isLoadingProcesses =
63
+ !processesQuery.isReady ||
64
+ processesQuery.data.length !== processesCollection.size ||
65
+ !processesQuery.data.every((process) =>
66
+ deepEqual(process, processesCollection.get(process.id)),
67
+ )
228
68
 
229
69
  const filtered = useMemo(() => {
230
70
  const processes = processesQuery.data ?? []
@@ -259,14 +99,45 @@ function ProcessesPageInner({
259
99
  [filtered],
260
100
  )
261
101
 
262
- // Show loading state while initial data is being fetched from RxDB
263
- if (isLoadingProcesses) {
102
+ const hasRows = (processesQuery.data?.length ?? 0) > 0
103
+ const emptyTitle =
104
+ query.trim() || filterFavorites
105
+ ? "No matching processes"
106
+ : "No processes found"
107
+ const emptyDescription =
108
+ query.trim() || filterFavorites
109
+ ? "Try a different search or turn off Favorites."
110
+ : "There are no processes for your organisational unit or role."
111
+ const syncError =
112
+ initialSync.status === "error" ? (
113
+ <div role="alert" className="rounded-2xl border border-amber-300 p-4">
114
+ <p>
115
+ Processes could not finish loading. Check your connection and retry.
116
+ </p>
117
+ <button
118
+ type="button"
119
+ onClick={retryInitialSync}
120
+ className="mt-2 font-semibold text-blue-600"
121
+ >
122
+ Retry loading processes
123
+ </button>
124
+ </div>
125
+ ) : null
126
+
127
+ if (!hasRows && syncError) return syncError
128
+ if (!hasRows && (isLoadingProcesses || initialSync.status !== "complete")) {
264
129
  return <ProcessesSkeleton />
265
130
  }
266
131
 
267
132
  return (
268
133
  <div className="flex-1 overflow-y-auto">
269
134
  <section className="space-y-6">
135
+ {syncError}
136
+ {initialSync.status === "loading" && (
137
+ <p role="status" className="text-sm text-slate-500">
138
+ Loading processes…
139
+ </p>
140
+ )}
270
141
  <div className="hidden rounded-2xl border border-slate-200 bg-white p-6 shadow-sm dark:border-slate-800 dark:bg-slate-900/60 md:block">
271
142
  <div className="flex flex-col gap-4 md:flex-row md:items-center md:justify-between">
272
143
  <h2 className="text-2xl font-semibold text-slate-900 dark:text-slate-50">
@@ -298,22 +169,20 @@ function ProcessesPageInner({
298
169
  </div>
299
170
  <p className="mt-3 max-w-3xl text-sm text-slate-500 dark:text-slate-400">
300
171
  Processes are grouped by department. Start immediately if no intake
301
- form is required, or launch the kickoff wizard with autosave and
302
- schema driven validation.
172
+ form is required, or open the form to enter or pick up your details.
303
173
  </p>
304
174
  </div>
305
175
  <div className="space-y-4 md:hidden">
306
176
  {mobileCatalog.map((process) => (
307
177
  <MobileProcessRow key={process.id} process={process} />
308
178
  ))}
309
- {mobileCatalog.length === 0 && (
310
- <EmptyState
311
- title="No processes found"
312
- description="There are no processes for your organisational unit or role."
313
- />
314
- )}
179
+ {mobileCatalog.length === 0 &&
180
+ initialSync.status === "complete" &&
181
+ !isLoadingProcesses && (
182
+ <EmptyState title={emptyTitle} description={emptyDescription} />
183
+ )}
315
184
  </div>
316
- <div className="hidden gap-6 lg:grid-cols-[2fr_1fr] md:grid">
185
+ <div className="hidden gap-6 md:grid lg:grid-cols-[2fr_1fr]">
317
186
  <div className="space-y-5">
318
187
  {categoryEntries.map(([category, categoryProcesses]) => (
319
188
  <div key={category} className="space-y-3">
@@ -335,26 +204,13 @@ function ProcessesPageInner({
335
204
  </div>
336
205
  </div>
337
206
  ))}
338
- {categoryEntries.length === 0 && (
339
- <EmptyState
340
- title="No processes found"
341
- description="There are no processes for your organisational unit or role."
342
- />
343
- )}
207
+ {categoryEntries.length === 0 &&
208
+ initialSync.status === "complete" &&
209
+ !isLoadingProcesses && (
210
+ <EmptyState title={emptyTitle} description={emptyDescription} />
211
+ )}
344
212
  </div>
345
213
  <div className="space-y-5">
346
- <div className="rounded-2xl border border-slate-200 bg-white p-4 shadow-sm dark:border-slate-800 dark:bg-slate-900/70">
347
- <h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100">
348
- Draft process starts
349
- </h3>
350
- <p className="text-sm text-slate-500 dark:text-slate-400">
351
- Resume where you left off. Drafts autosave every 30 seconds and
352
- can be shared for collaboration.
353
- </p>
354
- <div className="mt-4 space-y-3">
355
- <DraftsList />
356
- </div>
357
- </div>
358
214
  <div className="rounded-2xl border border-slate-200 bg-white p-4 shadow-sm dark:border-slate-800 dark:bg-slate-900/70">
359
215
  <h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100">
360
216
  Help & resources
@@ -2,24 +2,20 @@
2
2
 
3
3
  import { useRouter } from "next/navigation"
4
4
  import { Suspense } from "react"
5
- import type { JsonSchemaRoot } from "../../../../../../../modules/form/src/index.ts"
6
5
  import {
7
6
  FormSkeleton,
8
7
  StartProcessForm,
9
8
  } from "../../components/start-process-form.tsx"
10
- import { useDraftState } from "@/hooks/use-draft-state"
9
+ import { useReturnToList } from "@/app/(protected)/lists/lib/list-refresh-provider"
11
10
  import { useFormMetadata } from "@/hooks/use-form-metadata"
12
11
 
13
12
  interface StartProcessClientProps {
14
13
  startStepPath: string
15
- draftId: string | undefined
16
14
  }
17
15
 
18
- function StartProcessClientInner({
19
- startStepPath,
20
- draftId,
21
- }: StartProcessClientProps) {
16
+ function StartProcessClientInner({ startStepPath }: StartProcessClientProps) {
22
17
  const router = useRouter()
18
+ const returnToList = useReturnToList()
23
19
 
24
20
  // Fetch form metadata via GraphQL
25
21
  const {
@@ -30,21 +26,13 @@ function StartProcessClientInner({
30
26
 
31
27
  const defaultValues =
32
28
  (formMetadata?.defaultValues as Record<string, unknown> | null) ?? null
33
- const jsonSchema = (formMetadata?.jsonSchema as JsonSchemaRoot | null) ?? null
34
29
 
35
- // Load draft state from RxDB and merge with default values
36
- const {
37
- mergedDefaultValues,
38
- isLoading: isDraftLoading,
39
- isError: isDraftError,
40
- } = useDraftState(draftId, defaultValues)
41
-
42
- const handleClose = () => {
30
+ const handleClose = (result: "cancelled" | "submitted" = "cancelled") => {
31
+ if (returnToList(result)) return
43
32
  router.push("/processes")
44
33
  }
45
34
 
46
- // Show loading state while metadata or draft is loading
47
- if (isMetadataLoading || isDraftLoading) {
35
+ if (isMetadataLoading) {
48
36
  return (
49
37
  <div className="flex-1">
50
38
  <div className="mx-auto max-w-2xl">
@@ -78,35 +66,7 @@ function StartProcessClientInner({
78
66
  </p>
79
67
  <button
80
68
  type="button"
81
- onClick={handleClose}
82
- className="rounded-full bg-rose-600 px-4 py-2 text-sm font-semibold text-white shadow hover:bg-rose-500"
83
- >
84
- Go Back
85
- </button>
86
- </div>
87
- </div>
88
- </div>
89
- )
90
- }
91
-
92
- // Show error state if draft loading failed
93
- if (isDraftError) {
94
- return (
95
- <div className="flex-1">
96
- <div className="mx-auto max-w-2xl">
97
- <div className="rounded-2xl border border-rose-200 bg-rose-50 p-8 shadow-sm dark:border-rose-800 dark:bg-rose-900/20">
98
- <div className="mb-6">
99
- <h1 className="text-3xl font-semibold text-rose-900 dark:text-rose-100">
100
- Error Loading Draft
101
- </h1>
102
- </div>
103
- <p className="mb-4 text-sm text-rose-600 dark:text-rose-400">
104
- Failed to load the saved draft. Please try again or start a new
105
- process.
106
- </p>
107
- <button
108
- type="button"
109
- onClick={handleClose}
69
+ onClick={() => handleClose()}
110
70
  className="rounded-full bg-rose-600 px-4 py-2 text-sm font-semibold text-white shadow hover:bg-rose-500"
111
71
  >
112
72
  Go Back
@@ -127,15 +87,16 @@ function StartProcessClientInner({
127
87
  </h1>
128
88
  </div>
129
89
  <StartProcessForm
90
+ processId={formMetadata.processId ?? ""}
91
+ canSkipScheduleWaits={formMetadata.canSkipScheduleWaits ?? false}
130
92
  startStepPath={startStepPath}
131
93
  mutationName={formMetadata.mutationName}
132
94
  inputTypeName={formMetadata.inputTypeName}
133
- defaultValues={mergedDefaultValues}
134
- formDefinition={formMetadata.formDefinition}
135
- jsonSchema={jsonSchema}
95
+ defaultValues={defaultValues}
96
+ requestData={formMetadata.requestData}
97
+ pluginConfiguration={formMetadata.pluginConfiguration ?? {}}
136
98
  processName={formMetadata.processName}
137
99
  totalFields={formMetadata.totalFields}
138
- draftId={draftId}
139
100
  onClose={handleClose}
140
101
  />
141
102
  </div>
@@ -1,8 +1,12 @@
1
- import { NotFound } from "@mcrovero/effect-nextjs/Navigation"
2
1
  import { Effect } from "effect"
3
2
  import StartProcessClient from "./client.tsx"
3
+ import ListPage from "@/app/(protected)/lists/[...listPath]/page"
4
+ import { parseListReturnDestination } from "@/app/(protected)/lists/lib/list-refresh"
5
+ import { NotFound } from "@/lib/effect/navigation"
4
6
  import { BasePage } from "@/lib/effect/runtime"
5
7
 
8
+ export const instant = false
9
+
6
10
  /**
7
11
  * Start process page - thin server wrapper that passes URL params to client.
8
12
  * Form metadata is fetched client-side via GraphQL.
@@ -12,10 +16,10 @@ const StartProcessPage = Effect.fn("StartProcessPage")(function* ({
12
16
  searchParams,
13
17
  }: {
14
18
  params: Promise<{ startStepPath: string[] }>
15
- searchParams: Promise<{ draftId?: string }>
19
+ searchParams: Promise<{ returnTo?: string | string[] }>
16
20
  }) {
17
21
  const { startStepPath: pathSegments } = yield* Effect.promise(() => params)
18
- const { draftId } = yield* Effect.promise(() => searchParams)
22
+ const { returnTo } = yield* Effect.promise(() => searchParams)
19
23
 
20
24
  // Guard against asset-like requests accidentally hitting this catch-all route
21
25
  // (e.g. `/processes/start/hr/installHook.js.map`).
@@ -33,7 +37,26 @@ const StartProcessPage = Effect.fn("StartProcessPage")(function* ({
33
37
  // Full path for lookup: "/engineering/bug-report-fix/Report bug"
34
38
  const startStepPath = `/${pathSegments.map(decodeURIComponent).join("/")}`
35
39
 
36
- return <StartProcessClient startStepPath={startStepPath} draftId={draftId} />
40
+ // Relative List destinations are validated by the same parser as close/submit.
41
+ // A hard navigation has no intercepted background: render the real List here.
42
+ // Match the client's URLSearchParams.get() behavior for repeated parameters.
43
+ const destination = parseListReturnDestination(
44
+ (Array.isArray(returnTo) ? returnTo[0] : returnTo) ?? null,
45
+ "http://localhost",
46
+ )
47
+ if (destination) {
48
+ const listUrl = new URL(destination.href, "http://localhost")
49
+ return (
50
+ <ListPage
51
+ params={Promise.resolve({
52
+ listPath: destination.listPath.slice(1).split("/"),
53
+ })}
54
+ searchParams={Promise.resolve(Object.fromEntries(listUrl.searchParams))}
55
+ />
56
+ )
57
+ }
58
+
59
+ return <StartProcessClient startStepPath={startStepPath} />
37
60
  })
38
61
 
39
62
  export default BasePage.build(StartProcessPage)
@@ -1,14 +1,17 @@
1
1
  import "@xyflow/react/dist/style.css"
2
- import { NotFound } from "@mcrovero/effect-nextjs/Navigation"
3
2
  import { Effect } from "effect"
4
3
  import Link from "next/link"
5
4
  import { ProcessDocumentation } from "./process-documentation.tsx"
6
5
  import { WorkflowFlow } from "./workflow-flow.tsx"
6
+ import { NotFound } from "@/lib/effect/navigation"
7
7
  import { BasePage } from "@/lib/effect/runtime"
8
8
  import { fetchProcessWorkflowEffect } from "@/lib/graphql/workflow-operations"
9
9
  import { getPhaseColors } from "@/lib/workflow/constants"
10
10
  import { createInitialLayout } from "@/lib/workflow/layout"
11
11
 
12
+ // The authenticated shell can omit this page while checking the session.
13
+ export const instant = false
14
+
12
15
  const WorkflowPage = Effect.fn("WorkflowPage")(function* ({
13
16
  params,
14
17
  }: {
@@ -27,9 +30,8 @@ const WorkflowPage = Effect.fn("WorkflowPage")(function* ({
27
30
 
28
31
  // Fetch workflow data with error handling - return error state on failure
29
32
  const data = yield* fetchProcessWorkflowEffect(processPath).pipe(
30
- Effect.catchAll((error) => {
33
+ Effect.catch((error) => {
31
34
  console.error("Failed to fetch workflow data:", error.message)
32
- // Return empty/error state for graceful degradation
33
35
  return Effect.succeed({
34
36
  processWorkflow: null,
35
37
  error: error.message,
@@ -37,7 +39,6 @@ const WorkflowPage = Effect.fn("WorkflowPage")(function* ({
37
39
  }),
38
40
  )
39
41
 
40
- // Handle error state
41
42
  if (!data.processWorkflow) {
42
43
  return (
43
44
  <div className="space-y-6">
@@ -154,15 +154,12 @@ function WorkflowFlowInner({
154
154
 
155
155
  const onNodesChange = useCallback((changes: NodeChange[]) => {
156
156
  setLayout((currentLayout) => {
157
- // Apply React Flow's changes first
158
157
  const updatedNodes = applyNodeChanges(changes, currentLayout.nodes)
159
158
 
160
- // If layout already applied, just return the updated nodes
161
159
  if (currentLayout.measuredHeight !== null) {
162
160
  return { ...currentLayout, nodes: updatedNodes }
163
161
  }
164
162
 
165
- // Check if we have dimension changes
166
163
  const hasDimensionChanges = changes.some(
167
164
  (change) => change.type === "dimensions",
168
165
  )
@@ -170,7 +167,6 @@ function WorkflowFlowInner({
170
167
  return { ...currentLayout, nodes: updatedNodes }
171
168
  }
172
169
 
173
- // Check if all step nodes now have measurements
174
170
  const stepNodes = updatedNodes.filter((n) => n.type === "workflowStep")
175
171
  const allMeasured =
176
172
  stepNodes.length > 0 &&
@@ -276,7 +272,6 @@ function WorkflowFlowWithAutoRefresh({
276
272
  initialWorkflowData,
277
273
  )
278
274
 
279
- // Recompute layout when workflow data changes
280
275
  const { nodes: currentNodes, edges: currentEdges } = useMemo(
281
276
  () => createInitialLayout(workflowData),
282
277
  [workflowData],
@@ -1,12 +1,8 @@
1
1
  "use client"
2
2
 
3
- import { useCallback, useEffect } from "react"
4
- import {
5
- type FieldError,
6
- type FormActionsContext,
7
- type JsonSchemaRoot,
8
- dynamicForm,
9
- } from "../../../../../../../modules/form/src/index.ts"
3
+ import { Suspense, use, useCallback, useEffect } from "react"
4
+ import type { FieldError, FormActionsContext } from "../../../../../../../modules/form/src/index.ts"
5
+ import { EffectSchemaForm } from "../../../../../../../modules/form/src/lib/effect-schema-form.tsx"
10
6
  import {
11
7
  Sheet,
12
8
  SheetContent,
@@ -15,6 +11,7 @@ import {
15
11
  SheetTitle,
16
12
  } from "@/components/ui/sheet"
17
13
  import { useFormMetadata } from "@/hooks/use-form-metadata"
14
+ import { loadBrowserFormDefinition } from "@/lib/frontend-form-loaders"
18
15
  import type { WorkflowStepData } from "@/lib/workflow/types"
19
16
 
20
17
  interface WorkflowFormPreviewSheetProps {
@@ -60,7 +57,6 @@ export function WorkflowFormPreviewSheet({
60
57
 
61
58
  const defaultValues =
62
59
  (formMetadata?.defaultValues as Record<string, unknown> | null) ?? null
63
- const jsonSchema = (formMetadata?.jsonSchema as JsonSchemaRoot | null) ?? null
64
60
 
65
61
  return (
66
62
  <Sheet open={open} onOpenChange={onOpenChange}>
@@ -80,19 +76,30 @@ export function WorkflowFormPreviewSheet({
80
76
  Unable to load this form.
81
77
  </div>
82
78
  ) : null}
83
- {!isLoading && formMetadata
84
- ? dynamicForm({
85
- draftId,
86
- formDefinition: formMetadata.formDefinition,
87
- defaultValues,
88
- handleSubmit,
89
- jsonSchema,
90
- renderActions,
91
- stepPath: step.path,
92
- })
93
- : null}
79
+ {!isLoading && formMetadata ? (
80
+ <Suspense fallback={<FormPreviewSkeleton />}>
81
+ <ExecutablePreview
82
+ stepPath={step.path}
83
+ draftId={draftId}
84
+ defaultValues={defaultValues ?? {}}
85
+ requestData={formMetadata.requestData}
86
+ onSubmit={handleSubmit}
87
+ >
88
+ {renderActions}
89
+ </ExecutablePreview>
90
+ </Suspense>
91
+ ) : null}
94
92
  </div>
95
93
  </SheetContent>
96
94
  </Sheet>
97
95
  )
98
96
  }
97
+
98
+ function ExecutablePreview(
99
+ props: Omit<React.ComponentProps<typeof EffectSchemaForm>, "schema"> & {
100
+ stepPath: string
101
+ },
102
+ ) {
103
+ const schema = use(loadBrowserFormDefinition(props.stepPath))
104
+ return <EffectSchemaForm {...props} schema={schema} />
105
+ }
@@ -1,4 +1,3 @@
1
- import { NotFound } from "@mcrovero/effect-nextjs/Navigation"
2
1
  import { Effect } from "effect"
3
2
  import { Suspense } from "react"
4
3
  import type { ProviderUserSession } from "../../../../../../../modules/auth-session/src/index.ts"
@@ -10,9 +9,13 @@ import { loadAuthorizationCedar } from "../load-cedar.ts"
10
9
  import { loadHandbookData } from "../load-handbook.ts"
11
10
  import { getSessionWithToken } from "@/lib/auth/session"
12
11
  import { parseAuthorizationTab } from "@/lib/authorization-tabs"
12
+ import { NotFound } from "@/lib/effect/navigation"
13
13
  import { BasePageWithAuthorization } from "@/lib/effect/runtime"
14
14
  import { checkFeaturePermissions } from "@/lib/effect/services"
15
15
 
16
+ // The authenticated shell can omit this page while checking the session.
17
+ export const instant = false
18
+
16
19
  type AuthorizationPageProps = {
17
20
  params: Promise<{ tab?: readonly string[] }>
18
21
  }
@@ -29,7 +32,7 @@ const denied = (
29
32
  const AuthorizationPageContent = Effect.fn("AuthorizationPageContent")(
30
33
  function* ({ params }: AuthorizationPageProps) {
31
34
  const sessionResult = yield* getSessionWithToken.pipe(
32
- Effect.catchAll(() => Effect.succeed(null)),
35
+ Effect.catch(() => Effect.succeed(null)),
33
36
  )
34
37
  if (!sessionResult || !("email" in sessionResult)) {
35
38
  return denied