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

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 (332) hide show
  1. package/README.md +51 -253
  2. package/dist/authentication-server.mjs +52 -84
  3. package/dist/chunk-3wzp2sax.js +4806 -0
  4. package/dist/chunk-5kjvzbwr.js +512 -0
  5. package/dist/chunk-egeb4821.js +156 -0
  6. package/dist/chunk-q5v72erd.js +241 -0
  7. package/dist/{chunk-yhzbn4vx.js → chunk-wvbz0nmd.js} +19485 -34180
  8. package/dist/{chunk-352j1ayk.js → chunk-y8fnwbx0.js} +51781 -36259
  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)/connected-apps/disconnect-form.tsx +57 -0
  14. package/dist/dashboard-source/apps/frontend/app/(protected)/connected-apps/page.tsx +97 -0
  15. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/client.tsx +1 -1
  16. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/page.tsx +2 -0
  17. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/process-state/page.tsx +2 -0
  18. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/default.tsx +3 -0
  19. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/page.tsx +3 -1
  20. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/process-state/page.tsx +2 -0
  21. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/client-layout.tsx +19 -0
  22. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/default.tsx +6 -0
  23. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/executions-client.tsx +1637 -0
  24. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/layout.tsx +5 -7
  25. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/page.tsx +4 -1589
  26. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-page-client.tsx +1 -1
  27. package/dist/dashboard-source/apps/frontend/app/(protected)/layout.tsx +41 -33
  28. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/client.tsx +11 -17
  29. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/page.tsx +2 -0
  30. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/default.tsx +3 -0
  31. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/list-page-client.tsx +169 -18
  32. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/page.tsx +21 -14
  33. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-create-form.tsx +36 -18
  34. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-edit-form.tsx +22 -28
  35. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-load-error.tsx +49 -0
  36. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-schema-form.tsx +28 -0
  37. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/default.tsx +6 -0
  38. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/metric-control-url-state.ts +7 -16
  39. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-deleted-callback.ts +4 -6
  40. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-item-detail.ts +45 -142
  41. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/client.tsx +10 -20
  42. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/page.tsx +2 -0
  43. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/layout.tsx +3 -0
  44. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-process-dialog.tsx +72 -0
  45. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh-provider.tsx +65 -0
  46. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh.ts +162 -16
  47. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.tsx +19 -0
  48. package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/page.tsx +4 -9
  49. package/dist/dashboard-source/apps/frontend/app/(protected)/page.tsx +4 -0
  50. package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/actions.ts +15 -18
  51. package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/page.tsx +12 -6
  52. package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/passkeys-client.tsx +7 -16
  53. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/client.tsx +26 -48
  54. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/page.tsx +4 -7
  55. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/default.tsx +3 -0
  56. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client-layout.tsx +28 -0
  57. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client.tsx +1 -3
  58. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/start-process-form.tsx +193 -117
  59. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/default.tsx +6 -0
  60. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/layout.tsx +7 -9
  61. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/page.tsx +3 -0
  62. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/processes-client.tsx +60 -204
  63. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/client.tsx +12 -51
  64. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/page.tsx +27 -4
  65. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/page.tsx +5 -4
  66. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-flow.tsx +0 -5
  67. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-form-preview-sheet.tsx +26 -19
  68. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/page.tsx +5 -2
  69. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-authorize.ts +85 -9
  70. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-types.ts +12 -1
  71. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/explorer.tsx +66 -4
  72. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/layout.tsx +3 -0
  73. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-handbook.ts +41 -13
  74. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/[invitationId]/page.tsx +2 -0
  75. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-client.tsx +442 -365
  76. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/new/page.tsx +8 -2
  77. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/page.tsx +7 -0
  78. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations-table.tsx +61 -43
  79. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/page.tsx +6 -67
  80. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/providers/page.tsx +7 -0
  81. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/roles/page.tsx +7 -0
  82. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-client.tsx +111 -189
  83. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-page.tsx +86 -0
  84. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/client.tsx +141 -256
  85. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/page.tsx +2 -0
  86. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/tokens/page.tsx +2 -0
  87. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/page.tsx +7 -0
  88. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users-table.tsx +6 -4
  89. package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/page.tsx +3 -0
  90. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/client.tsx +30 -9
  91. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/page.tsx +3 -1
  92. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/default.tsx +3 -0
  93. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/client.tsx +2 -4
  94. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/page.tsx +3 -1
  95. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/complete-todo-form.tsx +47 -54
  96. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/public-completion-correction-form.tsx +37 -54
  97. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/todo-form-actions.tsx +1 -1
  98. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/correct/[...stepPath]/page.tsx +3 -1
  99. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/default.tsx +6 -0
  100. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/layout.tsx +3 -0
  101. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/lib/mobile-todo-list.ts +4 -25
  102. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/page.tsx +4 -1315
  103. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/to-dos-client.tsx +1282 -0
  104. package/dist/dashboard-source/apps/frontend/app/api/auth/callback/route.ts +81 -65
  105. package/dist/dashboard-source/apps/frontend/app/api/auth/delegation/route.ts +8 -2
  106. package/dist/dashboard-source/apps/frontend/app/api/auth/login/route.ts +0 -1
  107. package/dist/dashboard-source/apps/frontend/app/api/auth/logout/route.ts +10 -5
  108. package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/start/route.ts +1 -3
  109. package/dist/dashboard-source/apps/frontend/app/api/auth/refresh/route.ts +0 -1
  110. package/dist/dashboard-source/apps/frontend/app/api/auth/revalidate-google/route.ts +68 -0
  111. package/dist/dashboard-source/apps/frontend/app/api/auth/switch-role/route.ts +1 -3
  112. package/dist/dashboard-source/apps/frontend/app/api/dev/import-events/route.ts +69 -1
  113. package/dist/dashboard-source/apps/frontend/app/api/embed/lookup/route.ts +25 -7
  114. package/dist/dashboard-source/apps/frontend/app/api/embed/submit/route.ts +1 -2
  115. package/dist/dashboard-source/apps/frontend/app/api/public/start/[address]/route.ts +49 -0
  116. package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/lookup/route.ts +4 -3
  117. package/dist/dashboard-source/apps/frontend/app/api/revalidate/route.ts +15 -4
  118. package/dist/dashboard-source/apps/frontend/app/app-shell.tsx +14 -6
  119. package/dist/dashboard-source/apps/frontend/app/cli-auth/route.ts +2 -1
  120. package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/embed-client.tsx +31 -18
  121. package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/page.tsx +5 -1
  122. package/dist/dashboard-source/apps/frontend/app/login/page.tsx +4 -4
  123. package/dist/dashboard-source/apps/frontend/app/login/passkey-button.tsx +11 -6
  124. package/dist/dashboard-source/apps/frontend/app/login/passkey-help/page.tsx +67 -0
  125. package/dist/dashboard-source/apps/frontend/app/mcp/[[...endpoint]]/route.ts +44 -0
  126. package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-client.tsx +44 -25
  127. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/form/page.tsx +10 -0
  128. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/layout.tsx +32 -0
  129. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-client.tsx +319 -0
  130. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-content.tsx +41 -0
  131. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page.tsx +10 -0
  132. package/dist/dashboard-source/apps/frontend/app/public.css +1 -1
  133. package/dist/dashboard-source/apps/frontend/app/register/passkey/register-passkey-client.tsx +17 -0
  134. package/dist/dashboard-source/apps/frontend/components/DashboardSection.tsx +9 -15
  135. package/dist/dashboard-source/apps/frontend/components/Header.tsx +14 -8
  136. package/dist/dashboard-source/apps/frontend/components/anonymous-page-link.tsx +57 -0
  137. package/dist/dashboard-source/apps/frontend/components/anonymous-start-form.tsx +24 -0
  138. package/dist/dashboard-source/apps/frontend/components/app-sidebar.tsx +21 -7
  139. package/dist/dashboard-source/apps/frontend/components/auth-provider.tsx +12 -7
  140. package/dist/dashboard-source/apps/frontend/components/browser-only.tsx +19 -0
  141. package/dist/dashboard-source/apps/frontend/components/config-provider.tsx +0 -1
  142. package/dist/dashboard-source/apps/frontend/components/delegation-expiry.tsx +24 -13
  143. package/dist/dashboard-source/apps/frontend/components/form-dialog-content.tsx +22 -2
  144. package/dist/dashboard-source/apps/frontend/components/journey-timeline.tsx +52 -45
  145. package/dist/dashboard-source/apps/frontend/components/notification-bell.tsx +0 -1
  146. package/dist/dashboard-source/apps/frontend/components/sidebar-lists.tsx +0 -1
  147. package/dist/dashboard-source/apps/frontend/components/token-refresh-scheduler.tsx +38 -11
  148. package/dist/dashboard-source/apps/frontend/components/ui/sidebar.tsx +0 -1
  149. package/dist/dashboard-source/apps/frontend/components/ui/tab-pill.tsx +26 -15
  150. package/dist/dashboard-source/apps/frontend/components/workflow/step-node.tsx +0 -1
  151. package/dist/dashboard-source/apps/frontend/components/workflow/workflow-edge.tsx +5 -0
  152. package/dist/dashboard-source/apps/frontend/hooks/use-form-metadata.ts +21 -10
  153. package/dist/dashboard-source/apps/frontend/hooks/use-process-draft.ts +173 -0
  154. package/dist/dashboard-source/apps/frontend/hooks/use-weekly-execution-stats.ts +1 -3
  155. package/dist/dashboard-source/apps/frontend/lib/anonymous-page-form-values.ts +6 -0
  156. package/dist/dashboard-source/apps/frontend/lib/anonymous-page-server.ts +65 -0
  157. package/dist/dashboard-source/apps/frontend/lib/appsync-events/adapter.ts +9 -3
  158. package/dist/dashboard-source/apps/frontend/lib/appsync-events/client.ts +7 -340
  159. package/dist/dashboard-source/apps/frontend/lib/auth/client-session.ts +2 -0
  160. package/dist/dashboard-source/apps/frontend/lib/auth/delegations.ts +9 -7
  161. package/dist/dashboard-source/apps/frontend/lib/auth/google-revalidation.ts +111 -0
  162. package/dist/dashboard-source/apps/frontend/lib/auth/logout.ts +1 -1
  163. package/dist/dashboard-source/apps/frontend/lib/auth/passkeys.ts +28 -30
  164. package/dist/dashboard-source/apps/frontend/lib/auth/providers.ts +10 -0
  165. package/dist/dashboard-source/apps/frontend/lib/auth/realtime-session-token.ts +1 -0
  166. package/dist/dashboard-source/apps/frontend/lib/auth/reauthentication-state.ts +4 -4
  167. package/dist/dashboard-source/apps/frontend/lib/auth/session-admission.ts +11 -7
  168. package/dist/dashboard-source/apps/frontend/lib/auth/session.ts +27 -10
  169. package/dist/dashboard-source/apps/frontend/lib/auth/ssr-session.ts +76 -9
  170. package/dist/dashboard-source/apps/frontend/lib/auth/verify-passkey.ts +25 -3
  171. package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-factory.tsx +115 -23
  172. package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution.ts +1 -8
  173. package/dist/dashboard-source/apps/frontend/lib/collections/execution.ts +6 -2
  174. package/dist/dashboard-source/apps/frontend/lib/collections/graphql-stream.ts +21 -1
  175. package/dist/dashboard-source/apps/frontend/lib/collections/process-collection-provider.tsx +3 -0
  176. package/dist/dashboard-source/apps/frontend/lib/collections/process.ts +8 -2
  177. package/dist/dashboard-source/apps/frontend/lib/collections/replication-factory.ts +16 -4
  178. package/dist/dashboard-source/apps/frontend/lib/collections/todo.ts +1 -1
  179. package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-query-invalidation.tsx +66 -9
  180. package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-refresh.ts +10 -6
  181. package/dist/dashboard-source/apps/frontend/lib/effect/navigation.ts +4 -0
  182. package/dist/dashboard-source/apps/frontend/lib/effect/page-runtime.ts +29 -0
  183. package/dist/dashboard-source/apps/frontend/lib/effect/params.ts +18 -12
  184. package/dist/dashboard-source/apps/frontend/lib/effect/run-effect.ts +1 -1
  185. package/dist/dashboard-source/apps/frontend/lib/effect/runtime.ts +19 -23
  186. package/dist/dashboard-source/apps/frontend/lib/effect/services/access-token.ts +9 -12
  187. package/dist/dashboard-source/apps/frontend/lib/effect/services/authorization.ts +12 -12
  188. package/dist/dashboard-source/apps/frontend/lib/effect/services/form-validation.ts +20 -18
  189. package/dist/dashboard-source/apps/frontend/lib/effect/services/graphql.ts +32 -16
  190. package/dist/dashboard-source/apps/frontend/lib/embed-form-server.ts +35 -0
  191. package/dist/dashboard-source/apps/frontend/lib/embed-manifest.ts +10 -103
  192. package/dist/dashboard-source/apps/frontend/lib/forms/invitation.ts +43 -0
  193. package/dist/dashboard-source/apps/frontend/lib/forms/provider-user.ts +64 -0
  194. package/dist/dashboard-source/apps/frontend/lib/frontend-form-loaders.ts +40 -0
  195. package/dist/dashboard-source/apps/frontend/lib/frontend-manifest.ts +1 -33
  196. package/dist/dashboard-source/apps/frontend/lib/generated/gql/gql.ts +123 -33
  197. package/dist/dashboard-source/apps/frontend/lib/generated/gql/graphql.ts +168 -30
  198. package/dist/dashboard-source/apps/frontend/lib/generated/gql/index.ts +1 -0
  199. package/dist/dashboard-source/apps/frontend/lib/graphql/anonymous-page.ts +27 -0
  200. package/dist/dashboard-source/apps/frontend/lib/graphql/dependent-lookup-query.ts +1 -0
  201. package/dist/dashboard-source/apps/frontend/lib/graphql/list-queries.ts +34 -29
  202. package/dist/dashboard-source/apps/frontend/lib/graphql/lookup-provider.tsx +82 -10
  203. package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-operations.ts +2 -5
  204. package/dist/dashboard-source/apps/frontend/lib/graphql/queries.ts +25 -4
  205. package/dist/dashboard-source/apps/frontend/lib/graphql/server-client.ts +11 -0
  206. package/dist/dashboard-source/apps/frontend/lib/graphql/settings-queries.ts +13 -104
  207. package/dist/dashboard-source/apps/frontend/lib/graphql/user-queries.ts +11 -4
  208. package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-operations.ts +1 -3
  209. package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-queries.ts +1 -0
  210. package/dist/dashboard-source/apps/frontend/lib/list-detail-selection.ts +54 -0
  211. package/dist/dashboard-source/apps/frontend/lib/mcp/executions.ts +110 -0
  212. package/dist/dashboard-source/apps/frontend/lib/mcp/list-writes.ts +395 -0
  213. package/dist/dashboard-source/apps/frontend/lib/mcp/lists.ts +263 -0
  214. package/dist/dashboard-source/apps/frontend/lib/mcp/oauth.ts +889 -0
  215. package/dist/dashboard-source/apps/frontend/lib/mcp/origin.ts +50 -0
  216. package/dist/dashboard-source/apps/frontend/lib/mcp/processes.ts +436 -0
  217. package/dist/dashboard-source/apps/frontend/lib/mcp/read-tool.ts +72 -0
  218. package/dist/dashboard-source/apps/frontend/lib/mcp/result.ts +4 -0
  219. package/dist/dashboard-source/apps/frontend/lib/mcp/server.ts +71 -0
  220. package/dist/dashboard-source/apps/frontend/lib/mcp/store.ts +107 -0
  221. package/dist/dashboard-source/apps/frontend/lib/mcp/todos.ts +260 -0
  222. package/dist/dashboard-source/apps/frontend/lib/notifications/notification-preference.ts +0 -1
  223. package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notification-observer.ts +0 -5
  224. package/dist/dashboard-source/apps/frontend/lib/org-chart-data.ts +0 -2
  225. package/dist/dashboard-source/apps/frontend/lib/org-identity.ts +6 -4
  226. package/dist/dashboard-source/apps/frontend/lib/organisation-form-loaders.ts +4 -0
  227. package/dist/dashboard-source/apps/frontend/lib/public-todo-form-runtime.ts +0 -1
  228. package/dist/dashboard-source/apps/frontend/lib/public-todo-model.ts +39 -139
  229. package/dist/dashboard-source/apps/frontend/lib/public-todo-server.ts +17 -16
  230. package/dist/dashboard-source/apps/frontend/lib/query-client.ts +0 -1
  231. package/dist/dashboard-source/apps/frontend/lib/todo-utils.ts +1 -77
  232. package/dist/dashboard-source/apps/frontend/lib/workflow/layout.ts +3 -7
  233. package/dist/dashboard-source/apps/frontend/next.config.ts +33 -13
  234. package/dist/dashboard-source/apps/frontend/package.json +47 -47
  235. package/dist/dashboard-source/apps/frontend/proxy.ts +72 -14
  236. package/dist/dashboard-source/modules/auth-local-cedar/src/index.ts +0 -3
  237. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/auth-local-cedar.ts +165 -233
  238. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/cedar-reload-notifier.ts +4 -3
  239. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/config-base.ts +111 -75
  240. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/policy-watcher.ts +14 -18
  241. package/dist/dashboard-source/modules/auth-policy/src/index.ts +1 -0
  242. package/dist/dashboard-source/modules/auth-policy/src/lib/auth-policy.ts +19 -37
  243. package/dist/dashboard-source/modules/auth-policy/src/lib/current-principal.ts +33 -29
  244. package/dist/dashboard-source/modules/auth-policy/src/lib/policy-revision.ts +23 -0
  245. package/dist/dashboard-source/modules/auth-policy/src/lib/types.ts +24 -49
  246. package/dist/dashboard-source/modules/auth-session/src/index.ts +4 -0
  247. package/dist/dashboard-source/modules/auth-session/src/lib/project-subscription.ts +13 -0
  248. package/dist/dashboard-source/modules/auth-session/src/lib/realtime-recipient.ts +10 -2
  249. package/dist/dashboard-source/modules/auth-session/src/lib/subjects.ts +82 -8
  250. package/dist/dashboard-source/modules/auth-session/src/lib/workload-access.ts +48 -0
  251. package/dist/dashboard-source/modules/auth-session/src/lib/workload-audit.ts +52 -0
  252. package/dist/dashboard-source/modules/aws-common/src/index.ts +0 -1
  253. package/dist/dashboard-source/modules/effect-json-logger/src/lib/effect-json-logger.ts +6 -9
  254. package/dist/dashboard-source/modules/form/src/hooks/use-local-storage.ts +5 -3
  255. package/dist/dashboard-source/modules/form/src/index.ts +1 -10
  256. package/dist/dashboard-source/modules/form/src/lib/effect-schema-form.tsx +1271 -0
  257. package/dist/dashboard-source/modules/form/src/lib/form-actions.ts +26 -0
  258. package/dist/dashboard-source/modules/form/src/lib/form-prefill.tsx +79 -0
  259. package/dist/dashboard-source/modules/form/src/lib/initial-focus.ts +31 -0
  260. package/dist/dashboard-source/modules/form/src/lib/lookup-context.tsx +18 -0
  261. package/dist/dashboard-source/modules/form/src/lib/plugin-registry.ts +4 -0
  262. package/dist/dashboard-source/modules/form/src/lib/plugin-scripts.ts +26 -0
  263. package/dist/dashboard-source/modules/form/src/lib/registered-plugin-field.tsx +57 -0
  264. package/dist/dashboard-source/modules/form/src/lib/schema-lookup.tsx +124 -0
  265. package/dist/dashboard-source/modules/form/src/lib/schema-typeahead.tsx +522 -0
  266. package/dist/dashboard-source/modules/form/src/lib/validation-logic.ts +172 -0
  267. package/dist/dashboard-source/modules/form-schema/src/index.ts +4 -1
  268. package/dist/dashboard-source/modules/form-schema/src/lib/annotation-helpers.ts +19 -14
  269. package/dist/dashboard-source/modules/form-schema/src/lib/email.ts +13 -11
  270. package/dist/dashboard-source/modules/form-schema/src/lib/field-count.ts +15 -13
  271. package/dist/dashboard-source/modules/form-schema/src/lib/form-annotations.ts +14 -0
  272. package/dist/dashboard-source/modules/form-schema/src/lib/form-presentation.ts +33 -0
  273. package/dist/dashboard-source/modules/form-schema/src/lib/form-schema.ts +186 -80
  274. package/dist/dashboard-source/modules/form-schema/src/lib/number-from-string.ts +26 -0
  275. package/dist/dashboard-source/modules/form-schema/src/lib/phone.ts +8 -7
  276. package/dist/dashboard-source/modules/form-schema/src/lib/public-completion-correction.ts +7 -0
  277. package/dist/dashboard-source/modules/form-schema/src/lib/search-lookup-items.ts +27 -0
  278. package/dist/dashboard-source/modules/form-submission-schema/src/index.ts +5 -0
  279. package/dist/dashboard-source/modules/form-submission-schema/src/lib/executable-rules.ts +379 -0
  280. package/dist/dashboard-source/modules/form-submission-schema/src/lib/form-submission-schema.ts +475 -0
  281. package/dist/dashboard-source/modules/form-submission-schema/src/lib/json-schema.ts +58 -0
  282. package/dist/dashboard-source/modules/form-submission-schema/src/lib/schema-defaults.ts +158 -0
  283. package/dist/dashboard-source/modules/form-submission-schema/src/lib/submission-utils.ts +75 -0
  284. package/dist/dashboard-source/modules/frontend-manifest/src/lib/browser-plugin-artifact.ts +46 -0
  285. package/dist/dashboard-source/modules/frontend-manifest/src/lib/frontend-manifest.ts +37 -30
  286. package/dist/dashboard-source/modules/frontend-plugin-host/src/lib/frontend-plugin-host.ts +9 -1
  287. package/dist/dashboard-source/modules/openauth/src/client.ts +25 -17
  288. package/dist/dashboard-source/modules/openauth/src/util.ts +16 -0
  289. package/dist/dashboard-source/modules/{aws-common/src/lib/project-balance-admission.ts → project-accounting/src/admission.ts} +4 -8
  290. package/dist/dashboard-source/modules/realtime-client/src/appsync-client.ts +377 -0
  291. package/dist/dashboard-source/modules/realtime-client/src/index.ts +5 -0
  292. package/dist/dashboard-source/modules/realtime-client/src/subscription-presence.ts +163 -0
  293. package/dist/dashboard-source/modules/request-time/src/lib/request-time.ts +6 -24
  294. package/dist/dashboard-source/modules/rxdb-collections/generated/execution-schema.json +28 -21
  295. package/dist/dashboard-source/modules/rxdb-collections/src/lib/rxdb-collections.ts +25 -18
  296. package/dist/dashboard-source/modules/rxdb-collections/src/lib/to-rxdb-schema.ts +60 -10
  297. package/dist/dashboard-source/modules/shadcn-components/src/index.ts +18 -2
  298. package/dist/dashboard-source/modules/shadcn-components/src/lib/date-calendar.tsx +93 -0
  299. package/dist/dashboard-source/modules/shadcn-components/src/lib/date-field.tsx +147 -48
  300. package/dist/dashboard-source/modules/shadcn-components/src/lib/date-time-display.tsx +273 -0
  301. package/dist/dashboard-source/modules/shadcn-components/src/lib/local-date-time-input.tsx +108 -0
  302. package/dist/dashboard-source/modules/shadcn-components/src/lib/lookup-field.tsx +237 -351
  303. package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/popover.tsx +2 -1
  304. package/dist/dashboard-source.json +47 -47
  305. package/dist/graphql-server.mjs +272 -200
  306. package/dist/job-worker-supervisor.mjs +262 -0
  307. package/dist/job-worker.mjs +234 -133
  308. package/dist/main.mjs +30 -6
  309. package/dist/prepare-dashboard.mjs +8 -8
  310. package/dist/resources/cedar/policies.cedar +80 -38
  311. package/dist/resources/cedar/schema.cedarschema +39 -21
  312. package/dist/resources/graphql-schema/rxdb.graphql +2 -0
  313. package/dist/resources/graphql-schema/system.graphql +191 -51
  314. package/package.json +63 -62
  315. package/dist/chunk-6ntmymmx.js +0 -85
  316. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.ts +0 -20
  317. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-form-actions.tsx +0 -105
  318. package/dist/dashboard-source/apps/frontend/hooks/use-draft-process-save.ts +0 -189
  319. package/dist/dashboard-source/apps/frontend/hooks/use-draft-state.ts +0 -79
  320. package/dist/dashboard-source/apps/frontend/hooks/use-processes-query.ts +0 -56
  321. package/dist/dashboard-source/modules/form/src/lib/ajv-standard-schema.ts +0 -152
  322. package/dist/dashboard-source/modules/form/src/lib/client-components-to-form.tsx +0 -1421
  323. package/dist/dashboard-source/modules/form/src/lib/friendly-validation-message.ts +0 -85
  324. package/dist/dashboard-source/modules/form/src/lib/walker.tsx +0 -1549
  325. package/dist/dashboard-source/modules/form-client-representation/src/lib/client-form-definition.ts +0 -440
  326. package/dist/dashboard-source/modules/form-client-representation/src/lib/plugin-registry.ts +0 -13
  327. package/dist/dashboard-source/modules/form-client-representation/src/lib/types.ts +0 -336
  328. package/dist/dashboard-source/modules/form-rule/src/index.ts +0 -21
  329. package/dist/dashboard-source/modules/form-rule/src/lib/evaluator.ts +0 -531
  330. package/dist/dashboard-source/modules/form-rule/src/lib/paths.ts +0 -102
  331. package/dist/dashboard-source/modules/form-rule/src/lib/types.ts +0 -121
  332. package/dist/dashboard-source/modules/form-schema/src/lib/property-signature.ts +0 -45
package/dist/main.mjs CHANGED
@@ -70,7 +70,7 @@ var prepareDashboardStyles = (root) => {
70
70
  var SourceManifest = Schema.Struct({
71
71
  format: Schema.Literal(1),
72
72
  sha256: Schema.String,
73
- dependencies: Schema.Record({ key: Schema.String, value: Schema.String })
73
+ dependencies: Schema.Record(Schema.String, Schema.String)
74
74
  });
75
75
  var BuildManifest = Schema.Struct({
76
76
  format: Schema.Literal(1),
@@ -176,6 +176,7 @@ var assertDashboardBuild = async (env) => {
176
176
  var dashboardEnvironment = (env) => ({
177
177
  ...env,
178
178
  NODE_ENV: "production",
179
+ PF_RUNTIME_MODE: "local",
179
180
  PF_DASHBOARD_SOURCE_ROOT: resolve2(env["PF_RUNTIME_ROOT"] ?? process.cwd(), ".processfocus/dashboard"),
180
181
  PF_DASHBOARD_PROJECT_BUILD: "1"
181
182
  });
@@ -294,6 +295,7 @@ var startLocalRuntime = async (options) => {
294
295
  let graphqlUrl = `http://localhost:${graphqlPort}/graphql`;
295
296
  const dashboardUrl = `http://localhost:${dashboardPort}`;
296
297
  const cli = resolveCli();
298
+ const mcpStorageSecret = randomBytes(32).toString("hex");
297
299
  const env = {
298
300
  ...process.env,
299
301
  NODE_ENV: process.env["NODE_ENV"] ?? "development",
@@ -338,7 +340,7 @@ var startLocalRuntime = async (options) => {
338
340
  };
339
341
  const waitForPort = async (file, child) => {
340
342
  const schema = Schema2.Struct({
341
- port: Schema2.Number.pipe(Schema2.int(), Schema2.between(1, 65535))
343
+ port: Schema2.Number.pipe(Schema2.check(Schema2.isInt(), Schema2.isBetween({ minimum: 1, maximum: 65535 })))
342
344
  });
343
345
  for (let attempt = 0;attempt < 150; attempt += 1) {
344
346
  if (stopping || child.exitCode !== null)
@@ -373,7 +375,8 @@ var startLocalRuntime = async (options) => {
373
375
  ...options.graphqlPort === undefined ? [] : ["--port", String(graphqlPort)],
374
376
  "--org",
375
377
  orgPath
376
- ]
378
+ ],
379
+ childEnv: { ...env, PF_MCP_STORAGE_SECRET: mcpStorageSecret }
377
380
  });
378
381
  graphqlUrl = `http://localhost:${options.graphqlPort ?? await waitForPort(".graphql-port.json", graphql)}/graphql`;
379
382
  env["GRAPHQL_ENDPOINT"] = graphqlUrl;
@@ -402,10 +405,28 @@ var startLocalRuntime = async (options) => {
402
405
  console.log(`Dashboard built in ${app}`);
403
406
  return 0;
404
407
  }
405
- spawn({
406
- entry: fileURLToPath2(new URL("./job-worker.mjs", import.meta.url)),
408
+ const workerStateFile = env["PF_LOCAL_QUEUE_STATE_FILE"] || resolve3(runtimeRoot, ".queue-worker-state.json");
409
+ env["PF_LOCAL_QUEUE_STATE_FILE"] = workerStateFile;
410
+ rmSync2(workerStateFile, { force: true });
411
+ const worker = spawn({
412
+ entry: fileURLToPath2(new URL("./job-worker-supervisor.mjs", import.meta.url)),
407
413
  args: ["--org", orgPath]
408
414
  });
415
+ await (async () => {
416
+ for (let attempt = 0;attempt < 650; attempt += 1) {
417
+ if (stopping || worker.exitCode !== null)
418
+ throw new Error("Local queue supervisor exited before readiness");
419
+ if (existsSync3(workerStateFile)) {
420
+ const state = Schema2.decodeUnknownSync(Schema2.Struct({ health: Schema2.String }))(JSON.parse(readFileSync3(workerStateFile, "utf8")));
421
+ if (state.health === "ready")
422
+ return;
423
+ if (state.health === "failed")
424
+ throw new Error("Local queue supervision failed; see worker diagnostics");
425
+ }
426
+ await Bun.sleep(100);
427
+ }
428
+ throw new Error("Timed out waiting for local queue worker readiness");
429
+ })();
409
430
  spawn({
410
431
  entry: cli,
411
432
  args: ["import", "--watch", "--watch-skip-initial", orgPath]
@@ -426,7 +447,10 @@ var startLocalRuntime = async (options) => {
426
447
  "127.0.0.1"
427
448
  ],
428
449
  cwd: dashboardDirectory(runtimeRoot),
429
- childEnv: dashboardEnvironment(env),
450
+ childEnv: {
451
+ ...dashboardEnvironment(env),
452
+ PF_MCP_STORAGE_SECRET: mcpStorageSecret
453
+ },
430
454
  executable: "node"
431
455
  });
432
456
  await waitForHttp(`${dashboardUrl}/_pf/health`);
@@ -1,8 +1,8 @@
1
1
  // @bun
2
- import{createHash as D}from"crypto";import{copyFileSync as G,existsSync as P,mkdirSync as V,readFileSync as R,realpathSync as w,rmSync as q,statSync as L,writeFileSync as m}from"fs";import{dirname as F,relative as v,resolve as c,sep as f}from"path";var A="browser-plugins.json",O=["analytics","formComponents"],_=(n)=>O.some((t)=>n===t),y=(n,t)=>{if(typeof n!=="object"||n===null||Array.isArray(n))throw Error(`${t} must be an object`);return{...n}},g=(n,t)=>{if(typeof n!=="string"||n.trim().length===0)throw Error(`${t} must be a non-empty string`);return n.trim()},C=(n,t)=>{if(!_(n)){let r=O.map((e)=>JSON.stringify(e)).join(" or ");throw Error(`${t} must be ${r}`)}return n},b=(n,t,r="path")=>{let e=g(n,`browser plugin "${t}" ${r}`),i=e.split("/");if(e.startsWith("/")||e.includes("\\")||i.some((a)=>a===""||a==="."||a===".."))throw Error(`browser plugin "${t}" ${r} must stay within the artifact root: ${e}`);return e},k=(n,t)=>{let r=y(n,`browser plugin "${t}" preparation`);if(r.kind!=="stylesheet")throw Error(`browser plugin "${t}" preparation.kind must be "stylesheet"`);let e=g(r.sha256,`browser plugin "${t}" preparation.sha256`);if(!/^[0-9a-f]{64}$/.test(e))throw Error(`browser plugin "${t}" preparation.sha256 must be a 64-character hex string`);return{kind:"stylesheet",path:b(r.path,t,"preparation.path"),sha256:e}},B=(n,t)=>{let r=`browser plugin artifact manifest.plugins[${t}]`,e=y(n,r),i=g(e.identity,`${r}.identity`),a=e.hostInterfaceVersion;if(typeof a!=="number"||!Number.isInteger(a)||a<1)throw Error(`browser plugin "${i}" hostInterfaceVersion must be a positive integer`);let s=g(e.sha256,`browser plugin "${i}" sha256`);if(!/^[0-9a-f]{64}$/.test(s))throw Error(`browser plugin "${i}" sha256 must be a 64-character hex string`);return{identity:i,category:C(e.category,`browser plugin "${i}" category`),hostInterfaceVersion:a,path:b(e.path,i),sha256:s,...e.preparation!==void 0&&{preparation:k(e.preparation,i)}}},I=(n)=>{let t=y(n,"browser plugin artifact manifest");if(t.format!=="processfocus/browser-plugins")throw Error("browser plugin artifact manifest format must be processfocus/browser-plugins");if(t.version!==1)throw Error(`browser plugin artifact manifest version must be ${String(1)}`);if(!Array.isArray(t.plugins))throw Error("browser plugin artifact manifest.plugins must be an array");let r=t.plugins.map(B),e=new Set;for(let i of r){if(e.has(i.identity))throw Error(`browser plugin artifact manifest has duplicate identity "${i.identity}"`);e.add(i.identity)}return{format:"processfocus/browser-plugins",version:1,plugins:r}};var p=1;var h=(n,t)=>{if(typeof n!=="object"||n===null||Array.isArray(n))throw Error(`${t} must be an object`);return n},S=(n,t)=>{if(typeof n!=="string"||n.trim()==="")throw Error(`${t} must be a non-empty string`);return n},H=(n)=>{let r=h(JSON.parse(R(n,"utf8")),n).plugins;if(r===void 0)return[];let e=h(r,`${n}.plugins`);return["analytics","formComponents"].flatMap((i)=>{let a=e[i]??[];if(!Array.isArray(a))throw Error(`${n}.plugins.${i} must be an array`);return a.map((s,l)=>{let o=`${n}.plugins.${i}[${l}]`,d=h(s,o);return{category:i,module:S(d.module,`${o}.module`),type:S(d.type,`${o}.type`)}})})},N=(n)=>{for(let t of n.selections)if(!n.artifactIdentities.has(t.type))throw Error(`browser plugin "${t.type}" requires an organisation artifact entry in ${n.artifactManifestPath}`)},M=(n)=>{let t=c(n.artifactRoot,n.artifactPath);if(!t.startsWith(`${n.artifactRoot}${f}`))throw Error(`browser plugin "${n.identity}" ${n.artifactPathField} escapes the artifact root: ${n.artifactPath}`);if(!P(t)){let a=n.artifactPathField==="path"?"file":"preparation file";throw Error(`browser plugin "${n.identity}" ${a} is missing: ${n.artifactPath}`)}let r=w(t);if(!r.startsWith(`${n.realArtifactRoot}${f}`))throw Error(`browser plugin "${n.identity}" ${n.artifactPathField} escapes the artifact root through a symbolic link: ${n.artifactPath}`);if(!L(r).isFile())throw Error(`browser plugin "${n.identity}" ${n.artifactPathField} is not a file: ${n.artifactPath}`);let e=D("sha256").update(R(r)).digest("hex");if(e!==n.expectedSha256){let a=n.artifactPathField==="path"?"":"preparation ";throw Error(`browser plugin "${n.identity}" ${a}integrity mismatch for ${n.artifactPath}: expected ${n.expectedSha256}, got ${e}`)}V(n.outputDirectory,{recursive:!0});let i=c(n.outputDirectory,`${n.expectedSha256}${n.stagedExtension}`);return G(r,i),i},j=(n)=>{let t=F(n.manifestPath),r=c(t,A),e=c(F(n.outputModulePath),"browser-plugins");q(e,{recursive:!0,force:!0});let i=w(t);for(let o of[n.manifestPath,r])if(P(o)&&!w(o).startsWith(`${i}${f}`))throw Error(`plugin manifest escapes the selected organisation artifact root: ${o}`);if(!P(r))return N({selections:n.selections,artifactIdentities:new Set,artifactManifestPath:r}),[];let a;try{a=I(JSON.parse(R(r,"utf8")))}catch(o){throw Error(`browser plugin artifact manifest at ${r} is invalid: ${o instanceof Error?o.message:String(o)}`,{cause:o})}let s=new Map;for(let o of n.selections){if(s.has(o.type))throw Error(`frontend manifest has duplicate browser plugin identity "${o.type}"`);s.set(o.type,o)}N({selections:n.selections,artifactIdentities:new Set(a.plugins.map((o)=>o.identity)),artifactManifestPath:r});let l=c(t);return a.plugins.map((o)=>{let d=s.get(o.identity);if(!d)throw Error(`browser plugin "${o.identity}" has no matching frontend manifest selection`);if(d.category!==o.category)throw Error(`browser plugin "${o.identity}" declares category "${o.category}" but its frontend manifest selection is "${d.category}"`);if(o.hostInterfaceVersion!==p)throw Error(`browser plugin "${o.identity}" requires host interface version ${o.hostInterfaceVersion}, but the Dashboard provides ${p}`);let E=M({identity:o.identity,artifactPath:o.path,artifactPathField:"path",artifactRoot:l,expectedSha256:o.sha256,outputDirectory:e,realArtifactRoot:i,stagedExtension:".js"}),u=o.preparation;if(u===void 0)return{...o,stagedPath:E};let T=M({identity:o.identity,artifactPath:u.path,artifactPathField:"preparation.path",artifactRoot:l,expectedSha256:u.sha256,outputDirectory:e,realArtifactRoot:i,stagedExtension:".css"});return{...o,stagedPath:E,preparation:{...u,stagedPath:T}}})},x=(n,t)=>{let r=v(F(n),t).split(f).join("/");return r.startsWith(".")?r:`./${r}`},W=(n,t)=>{let r=n.map((s,l)=>{let o=JSON.stringify(x(t,s.stagedPath)),d=JSON.stringify(s.identity);return`const artifactLoader${l} = Object.assign(
2
+ import{createHash as G}from"crypto";import{copyFileSync as D,existsSync as w,mkdirSync as q,readFileSync as E,realpathSync as F,rmSync as v,statSync as L,writeFileSync as h}from"fs";import{dirname as R,relative as H,resolve as u,sep as f}from"path";var b="browser-plugins.json",O=["analytics","formComponents"],_=(n)=>O.some((e)=>n===e);var g=(n,e)=>{if(typeof n!=="object"||n===null||Array.isArray(n))throw Error(`${e} must be an object`);return{...n}},c=(n,e)=>{if(typeof n!=="string"||n.trim().length===0)throw Error(`${e} must be a non-empty string`);return n.trim()},C=(n,e)=>{if(!_(n)){let r=O.map((t)=>JSON.stringify(t)).join(" or ");throw Error(`${e} must be ${r}`)}return n},m=(n,e,r="path")=>{let t=c(n,`browser plugin "${e}" ${r}`),i=t.split("/");if(t.startsWith("/")||t.includes("\\")||i.some((a)=>a===""||a==="."||a===".."))throw Error(`browser plugin "${e}" ${r} must stay within the artifact root: ${t}`);return t},k=(n,e)=>{let r=g(n,`browser plugin "${e}" preparation`);if(r.kind!=="stylesheet")throw Error(`browser plugin "${e}" preparation.kind must be "stylesheet"`);let t=c(r.sha256,`browser plugin "${e}" preparation.sha256`);if(!/^[0-9a-f]{64}$/.test(t))throw Error(`browser plugin "${e}" preparation.sha256 must be a 64-character hex string`);return{kind:"stylesheet",path:m(r.path,e,"preparation.path"),sha256:t}},B=(n,e)=>{let r=`browser plugin artifact manifest.plugins[${e}]`,t=g(n,r),i=c(t.identity,`${r}.identity`),a=t.hostInterfaceVersion;if(typeof a!=="number"||!Number.isInteger(a)||a<1)throw Error(`browser plugin "${i}" hostInterfaceVersion must be a positive integer`);let s=c(t.sha256,`browser plugin "${i}" sha256`);if(!/^[0-9a-f]{64}$/.test(s))throw Error(`browser plugin "${i}" sha256 must be a 64-character hex string`);return{identity:i,category:C(t.category,`browser plugin "${i}" category`),hostInterfaceVersion:a,path:m(t.path,i),sha256:s,...t.preparation!==void 0&&{preparation:k(t.preparation,i)}}},V=(n,e)=>{let r=`browser artifact manifest.forms[${e}]`,t=g(n,r),i=c(t.stepPath,`${r}.stepPath`),a=c(t.sha256,`${r}.sha256`);if(!/^[0-9a-f]{64}$/.test(a))throw Error(`${r}.sha256 must be a SHA-256 digest`);if(t.hostInterfaceVersion!==1)throw Error(`${r} requires an unsupported form host interface version`);return{stepPath:i,exportName:c(t.exportName,`${r}.exportName`),hostInterfaceVersion:1,path:m(t.path,i),sha256:a}},N=(n)=>{let e=g(n,"browser plugin artifact manifest");if(e.format!=="processfocus/browser-plugins")throw Error("browser plugin artifact manifest format must be processfocus/browser-plugins");if(e.version!==1)throw Error(`browser plugin artifact manifest version must be ${String(1)}`);if(!Array.isArray(e.plugins))throw Error("browser plugin artifact manifest.plugins must be an array");let r=e.forms??[];if(!Array.isArray(r))throw Error("browser artifact manifest.forms must be an array");let t=r.map(V);if(new Set(t.map((s)=>s.stepPath)).size!==t.length)throw Error("browser artifact manifest has duplicate form step paths");let i=e.plugins.map(B),a=new Set;for(let s of i){if(a.has(s.identity))throw Error(`browser plugin artifact manifest has duplicate identity "${s.identity}"`);a.add(s.identity)}return{format:"processfocus/browser-plugins",version:1,plugins:i,...t.length>0?{forms:t}:{}}};var y=1;var P=(n,e)=>{if(typeof n!=="object"||n===null||Array.isArray(n))throw Error(`${e} must be an object`);return n},I=(n,e)=>{if(typeof n!=="string"||n.trim()==="")throw Error(`${e} must be a non-empty string`);return n},W=(n)=>{let r=P(JSON.parse(E(n,"utf8")),n).plugins;if(r===void 0)return[];let t=P(r,`${n}.plugins`);return["analytics","formComponents"].flatMap((i)=>{let a=t[i]??[];if(!Array.isArray(a))throw Error(`${n}.plugins.${i} must be an array`);return a.map((s,d)=>{let o=`${n}.plugins.${i}[${d}]`,l=P(s,o);return{category:i,module:I(l.module,`${o}.module`),type:I(l.type,`${o}.type`)}})})},S=(n)=>{for(let e of n.selections)if(!n.artifactIdentities.has(e.type))throw Error(`browser plugin "${e.type}" requires an organisation artifact entry in ${n.artifactManifestPath}`)},x=(n)=>{let e=u(n.artifactRoot,n.artifactPath);if(!e.startsWith(`${n.artifactRoot}${f}`))throw Error(`browser plugin "${n.identity}" ${n.artifactPathField} escapes the artifact root: ${n.artifactPath}`);if(!w(e)){let a=n.artifactPathField==="path"?"file":"preparation file";throw Error(`browser plugin "${n.identity}" ${a} is missing: ${n.artifactPath}`)}let r=F(e);if(!r.startsWith(`${n.realArtifactRoot}${f}`))throw Error(`browser plugin "${n.identity}" ${n.artifactPathField} escapes the artifact root through a symbolic link: ${n.artifactPath}`);if(!L(r).isFile())throw Error(`browser plugin "${n.identity}" ${n.artifactPathField} is not a file: ${n.artifactPath}`);let t=G("sha256").update(E(r)).digest("hex");if(t!==n.expectedSha256){let a=n.artifactPathField==="path"?"":"preparation ";throw Error(`browser plugin "${n.identity}" ${a}integrity mismatch for ${n.artifactPath}: expected ${n.expectedSha256}, got ${t}`)}q(n.outputDirectory,{recursive:!0});let i=u(n.outputDirectory,`${n.expectedSha256}${n.stagedExtension}`);return D(r,i),i},J=(n)=>{let e=R(n.manifestPath),r=u(e,b),t=u(R(n.outputModulePath),"browser-plugins");v(t,{recursive:!0,force:!0});let i=F(e);for(let o of[n.manifestPath,r])if(w(o)&&!F(o).startsWith(`${i}${f}`))throw Error(`plugin manifest escapes the selected organisation artifact root: ${o}`);if(!w(r))return S({selections:n.selections,artifactIdentities:new Set,artifactManifestPath:r}),[];let a;try{a=N(JSON.parse(E(r,"utf8")))}catch(o){throw Error(`browser plugin artifact manifest at ${r} is invalid: ${o instanceof Error?o.message:String(o)}`,{cause:o})}let s=new Map;for(let o of n.selections){if(s.has(o.type))throw Error(`frontend manifest has duplicate browser plugin identity "${o.type}"`);s.set(o.type,o)}S({selections:n.selections,artifactIdentities:new Set(a.plugins.map((o)=>o.identity)),artifactManifestPath:r});let d=u(e);return a.plugins.map((o)=>{let l=s.get(o.identity);if(!l)throw Error(`browser plugin "${o.identity}" has no matching frontend manifest selection`);if(l.category!==o.category)throw Error(`browser plugin "${o.identity}" declares category "${o.category}" but its frontend manifest selection is "${l.category}"`);if(o.hostInterfaceVersion!==y)throw Error(`browser plugin "${o.identity}" requires host interface version ${o.hostInterfaceVersion}, but the Dashboard provides ${y}`);let A=x({identity:o.identity,artifactPath:o.path,artifactPathField:"path",artifactRoot:d,expectedSha256:o.sha256,outputDirectory:t,realArtifactRoot:i,stagedExtension:".js"}),p=o.preparation;if(p===void 0)return{...o,stagedPath:A};let T=x({identity:o.identity,artifactPath:p.path,artifactPathField:"preparation.path",artifactRoot:d,expectedSha256:p.sha256,outputDirectory:t,realArtifactRoot:i,stagedExtension:".css"});return{...o,stagedPath:A,preparation:{...p,stagedPath:T}}})},M=(n,e)=>{let r=H(R(n),e).split(f).join("/");return r.startsWith(".")?r:`./${r}`},j=(n,e)=>{let r=n.map((s,d)=>{let o=JSON.stringify(M(e,s.stagedPath)),l=JSON.stringify(s.identity);return`const artifactLoader${d} = Object.assign(
3
3
  async (): Promise<boolean> => {
4
4
  const artifact = await import(${o})
5
- await host.activate(${d}, artifact.plugin)
5
+ await host.activate(${l}, artifact.plugin)
6
6
  return true
7
7
  }, {
8
8
  shouldActivate: async (config?: unknown) => {
@@ -10,8 +10,8 @@ import{createHash as D}from"crypto";import{copyFileSync as G,existsSync as P,mkd
10
10
  return artifact.shouldActivate(config, process.env["NODE_ENV"])
11
11
  },
12
12
  },
13
- )`}),e=n.map((s,l)=>` ${JSON.stringify(s.identity)}: artifactLoader${l},`).join(`
14
- `),i=r,a=e;return`// Generated by prepare-build-inputs. Do not edit.
13
+ )`}),t=n.map((s,d)=>` ${JSON.stringify(s.identity)}: artifactLoader${d},`).join(`
14
+ `),i=r,a=t;return`// Generated by prepare-build-inputs. Do not edit.
15
15
  import type { FrontendPluginLoaderMap } from "../frontend-plugin-loaders"
16
16
  import type { OrganisationFrontendPluginHost } from "../organisation-plugin-loaders"
17
17
 
@@ -28,8 +28,8 @@ ${i.map((s)=>` ${s.replaceAll(`
28
28
  ${a}
29
29
  }
30
30
  }
31
- `},J=(n,t)=>{let e=n.flatMap((i)=>i.preparation===void 0?[]:[`import ${JSON.stringify(x(t,i.preparation.stagedPath))}`]).join(`
31
+ `},U=(n,e)=>{let t=n.flatMap((i)=>i.preparation===void 0?[]:[`import ${JSON.stringify(M(e,i.preparation.stagedPath))}`]).join(`
32
32
  `);return`// Generated by prepare-build-inputs. Do not edit.
33
- ${e}${e?`
34
- `:""}`},U=(n)=>{let t=H(n.manifestPath),r=j({manifestPath:n.manifestPath,selections:t,outputModulePath:n.outputModulePath});m(n.outputModulePath,W(r,n.outputModulePath)),m(n.outputPreparationModulePath,J(r,n.outputPreparationModulePath)),m(n.outputReportPath,`${JSON.stringify({version:1,active:[...r.map((e)=>({source:"organisation-artifact",category:e.category,type:e.identity,path:e.path,sha256:e.sha256,hostInterfaceVersion:e.hostInterfaceVersion}))]},null,2)}
35
- `)};if(import.meta.main){let[n,t,r,e]=process.argv.slice(2);if(!n||!t||!r||!e)throw Error("usage: generate-organisation-plugin-composition <manifest> <output-module> <output-preparation-module> <output-report>");U({manifestPath:n,outputModulePath:t,outputPreparationModulePath:r,outputReportPath:e})}export{U as generateOrganisationFrontendPluginComposition};
33
+ ${t}${t?`
34
+ `:""}`},z=(n)=>{let e=W(n.manifestPath),r=J({manifestPath:n.manifestPath,selections:e,outputModulePath:n.outputModulePath});h(n.outputModulePath,j(r,n.outputModulePath)),h(n.outputPreparationModulePath,U(r,n.outputPreparationModulePath)),h(n.outputReportPath,`${JSON.stringify({version:1,active:[...r.map((t)=>({source:"organisation-artifact",category:t.category,type:t.identity,path:t.path,sha256:t.sha256,hostInterfaceVersion:t.hostInterfaceVersion}))]},null,2)}
35
+ `)};if(import.meta.main){let[n,e,r,t]=process.argv.slice(2);if(!n||!e||!r||!t)throw Error("usage: generate-organisation-plugin-composition <manifest> <output-module> <output-preparation-module> <output-report>");z({manifestPath:n,outputModulePath:e,outputPreparationModulePath:r,outputReportPath:t})}export{z as generateOrganisationFrontendPluginComposition,x as stageVerifiedBrowserPluginArtifact};
@@ -5,6 +5,7 @@
5
5
  // Ordinary work includes humans and their distinct Delegations.
6
6
  // Roles are explicit trusted facts, not inherited attributes.
7
7
  // Provider users can complete a step if they have the step's role.
8
+ // Direct assignment narrows this default grant to the assignee.
8
9
  permit (
9
10
  principal,
10
11
  action == PF::Action::"complete",
@@ -13,42 +14,29 @@ permit (
13
14
  when {
14
15
  (principal is PF::ProviderUser || principal is PF::Delegation) &&
15
16
  resource has role &&
17
+ principal has roles &&
16
18
  principal.roles.contains(resource.role)
17
- };
18
-
19
- // Provider users can complete active todos for role-authorized work.
20
- // Directly assigned todos are narrowed to the assigned provider user by default.
21
- permit (
22
- principal,
23
- action == PF::Action::"complete",
24
- resource is PF::Todo
25
- )
26
- when {
27
- (principal is PF::ProviderUser || principal is PF::Delegation) &&
28
- resource has role &&
29
- principal.roles.contains(resource.role) &&
30
- (
31
- !(resource has assignedTo) ||
32
- principal in resource.assignedTo
33
- )
19
+ }
20
+ unless {
21
+ context has assignedTo && !(principal in context.assignedTo)
34
22
  };
35
23
 
36
24
  // Provider users can correct Public Completion delivery failures through a
37
25
  // distinct action. Callers choose the responsible or execution-failure role
38
- // candidate when constructing the Todo resource.
26
+ // candidate when constructing the Step resource.
39
27
  permit (
40
28
  principal,
41
29
  action == PF::Action::"publicCompletionCorrection",
42
- resource is PF::Todo
30
+ resource is PF::Step
43
31
  )
44
32
  when {
45
33
  (principal is PF::ProviderUser || principal is PF::Delegation) &&
46
34
  resource has role &&
47
- principal.roles.contains(resource.role) &&
48
- (
49
- !(resource has assignedTo) ||
50
- principal in resource.assignedTo
51
- )
35
+ principal has roles &&
36
+ principal.roles.contains(resource.role)
37
+ }
38
+ unless {
39
+ context has assignedTo && !(principal in context.assignedTo)
52
40
  };
53
41
 
54
42
  // Service accounts with a requested role can complete unassigned role todos.
@@ -56,12 +44,13 @@ when {
56
44
  permit (
57
45
  principal is PF::ServiceAccount,
58
46
  action == PF::Action::"complete",
59
- resource is PF::Todo
47
+ resource is PF::Step
60
48
  )
61
49
  when {
50
+ context has todoId &&
62
51
  resource has role &&
63
52
  principal.roles.contains(resource.role) &&
64
- !(resource has assignedTo)
53
+ !(context has assignedTo)
65
54
  };
66
55
 
67
56
  // Provider users can modify submitted form fields if they have the field's role.
@@ -77,15 +66,15 @@ when {
77
66
  };
78
67
 
79
68
  // Public todo links can complete only the todo embedded in the encrypted token.
80
- // This is self-authorizing today, and intentionally keeps public-link scoping
81
- // in Cedar so future revocation/scoping rules can be policy-owned.
69
+ // The principal comes from the verified token; context identifies the actual work.
82
70
  permit (
83
71
  principal is PF::PublicLink,
84
72
  action == PF::Action::"complete",
85
- resource is PF::Todo
73
+ resource is PF::Step
86
74
  )
87
75
  when {
88
- principal.todo == resource
76
+ context has todoId &&
77
+ principal.todoId == context.todoId
89
78
  };
90
79
 
91
80
  // Provider users can login if they have at least one role.
@@ -145,9 +134,7 @@ when {
145
134
  principal.roles.contains(resource.role)
146
135
  };
147
136
 
148
- // Provider users with roles can access untagged GraphQL fields or fields tagged
149
- // for provider-user or embedded-form use. The embed tag is also used on shared
150
- // lookup fields that authenticated forms still call directly.
137
+ // Provider users with roles can access untagged or provider-user GraphQL fields.
151
138
  permit (
152
139
  principal,
153
140
  action in [PF::Action::"query", PF::Action::"mutation", PF::Action::"subscription"],
@@ -158,11 +145,23 @@ when {
158
145
  principal.roles.isEmpty() == false &&
159
146
  (
160
147
  !(resource has tag) ||
161
- resource.tag == "providerUser" ||
162
- resource.tag == "embed"
148
+ resource.tag == "providerUser"
163
149
  )
164
150
  };
165
151
 
152
+ // Frontend service account can invoke and read inert deployment probes.
153
+ permit (
154
+ principal == PF::ServiceAccount::"frontend",
155
+ action == PF::Action::"query",
156
+ resource == PF::GraphQLField::"Query.deploymentProbe"
157
+ );
158
+
159
+ permit (
160
+ principal == PF::ServiceAccount::"frontend",
161
+ action == PF::Action::"mutation",
162
+ resource == PF::GraphQLField::"Mutation.startDeploymentProbe"
163
+ );
164
+
166
165
  // Frontend service account can read bootstrap organization and Cedar policy data.
167
166
  permit (
168
167
  principal == PF::ServiceAccount::"frontend",
@@ -182,7 +181,48 @@ permit (
182
181
  resource is PF::GraphQLField
183
182
  )
184
183
  when {
185
- resource has tag && resource.tag == "embed"
184
+ resource has step && resource.step.embedded && resource.step.startsProcess
185
+ };
186
+
187
+ // Fixed public entrypoints still authorize the step, address or token in their resolver.
188
+ permit (
189
+ principal == PF::ServiceAccount::"frontend",
190
+ action == PF::Action::"query",
191
+ resource is PF::GraphQLField
192
+ )
193
+ when {
194
+ [
195
+ PF::GraphQLField::"Query.embeddedFormMetadata",
196
+ PF::GraphQLField::"Query.lookupSuggestions",
197
+ PF::GraphQLField::"Query.calendarSlots",
198
+ PF::GraphQLField::"Query.publicTodo",
199
+ PF::GraphQLField::"Query.publicTodoLookupSuggestions",
200
+ PF::GraphQLField::"Query.publicTodoCalendarSlots",
201
+ PF::GraphQLField::"Query.anonymousPage",
202
+ PF::GraphQLField::"Query.anonymousPageLookup"
203
+ ].contains(resource)
204
+ };
205
+
206
+ permit (
207
+ principal == PF::ServiceAccount::"frontend",
208
+ action == PF::Action::"mutation",
209
+ resource is PF::GraphQLField
210
+ )
211
+ when {
212
+ [
213
+ PF::GraphQLField::"Mutation.submitAnonymousPage",
214
+ PF::GraphQLField::"Mutation.completePublicTodo",
215
+ PF::GraphQLField::"Mutation.requestFreshPublicTodoLink"
216
+ ].contains(resource)
217
+ };
218
+
219
+ permit (
220
+ principal == PF::ServiceAccount::"frontend",
221
+ action == PF::Action::"viewEmbeddedForm",
222
+ resource is PF::Step
223
+ )
224
+ when {
225
+ resource.embedded && resource.startsProcess
186
226
  };
187
227
 
188
228
  permit (
@@ -205,7 +245,8 @@ when {
205
245
  };
206
246
 
207
247
  // Scheduler starts system-owned cron processes through the normal start-step
208
- // authorization path, so only role-less start steps are allowed by default.
248
+ // authorization path. Only role-less system starts with a cron schedule are
249
+ // allowed by default, even when a different start has no GraphQL field check.
209
250
  permit (
210
251
  principal == PF::ServiceAccount::"scheduler",
211
252
  action == PF::Action::"complete",
@@ -213,7 +254,8 @@ permit (
213
254
  )
214
255
  when {
215
256
  resource.startsProcess &&
216
- !(resource has role)
257
+ !(resource has role) &&
258
+ context has cronStart && context.cronStart
217
259
  };
218
260
 
219
261
  // Provider users can access a List if they have one of the list's allowed roles.
@@ -23,13 +23,7 @@ namespace PF {
23
23
  };
24
24
 
25
25
  entity PublicLink {
26
- todo: Todo,
27
- };
28
-
29
- entity Todo in [Step, Process] {
30
- step?: Step,
31
- role?: Role,
32
- assignedTo?: ProviderUser,
26
+ todoId: String,
33
27
  };
34
28
 
35
29
  entity Step in [Process] {
@@ -50,7 +44,7 @@ namespace PF {
50
44
  action skipScheduleWaits appliesTo {
51
45
  principal: [ProviderUser, ServiceAccount, Delegation],
52
46
  resource: Process,
53
- context: { requestTime: datetime, nodeEnv: String }
47
+ context: RequestContext
54
48
  };
55
49
 
56
50
  entity List in [OrgUnit] {
@@ -59,10 +53,13 @@ namespace PF {
59
53
 
60
54
  entity Execution in [Process, OrgUnit] {
61
55
  startedBy?: ProviderUser,
56
+ startedByServiceAccount?: ServiceAccount,
57
+ deploymentProjectGranted?: Bool,
62
58
  startedByRole?: Role,
63
59
  };
64
60
 
65
61
  entity File in [OrgUnit] {
62
+ serviceAccountOwner?: ServiceAccount,
66
63
  owner: ProviderUser,
67
64
  documentStore: String,
68
65
  };
@@ -71,26 +68,50 @@ namespace PF {
71
68
 
72
69
  entity GraphQLField {
73
70
  tag?: String,
71
+ step?: Step,
74
72
  };
75
73
 
76
74
  // Context available for all authorization requests
77
75
  type RequestContext = {
78
76
  requestTime: datetime,
77
+ // Lowercase English weekday of requestTime's configured local date.
78
+ weekday: String,
79
79
  nodeEnv: String,
80
+ runtimeMode: String,
81
+ stage: String,
82
+ environment: String,
83
+ };
84
+
85
+ // Instance facts resolved by the runtime, never supplied by the client.
86
+ type CompletionContext = {
87
+ requestTime: datetime,
88
+ weekday: String,
89
+ nodeEnv: String,
90
+ runtimeMode: String,
91
+ stage: String,
92
+ environment: String,
93
+ todoId?: String,
94
+ assignedTo?: ProviderUser,
95
+ cronStart?: Bool,
96
+ };
97
+
98
+ action viewEmbeddedForm appliesTo {
99
+ principal: [ProviderUser, Delegation, ServiceAccount],
100
+ resource: Step,
101
+ context: RequestContext,
80
102
  };
81
103
 
82
- // Complete action for steps
83
104
  action complete appliesTo {
84
105
  principal: [ProviderUser, Delegation, ServiceAccount, PublicLink],
85
- resource: [Step, Todo],
86
- context: RequestContext,
106
+ resource: Step,
107
+ context: CompletionContext,
87
108
  };
88
109
 
89
110
  // Provider-user action for correcting Public Completion delivery failures.
90
111
  action publicCompletionCorrection appliesTo {
91
112
  principal: [ProviderUser, Delegation],
92
- resource: Todo,
93
- context: RequestContext,
113
+ resource: Step,
114
+ context: CompletionContext,
94
115
  };
95
116
 
96
117
  // View action for executions and lists
@@ -114,7 +135,6 @@ namespace PF {
114
135
  context: RequestContext,
115
136
  };
116
137
 
117
- // Update action for lists
118
138
  action create appliesTo {
119
139
  principal: [ProviderUser, Delegation],
120
140
  resource: List,
@@ -139,12 +159,6 @@ namespace PF {
139
159
  context: RequestContext,
140
160
  };
141
161
 
142
- action requestProviderUserPermissions appliesTo {
143
- principal: [Delegation, ServiceAccount],
144
- resource: ProviderUser,
145
- context: RequestContext,
146
- };
147
-
148
162
  action actOnBehalfOf appliesTo {
149
163
  principal: [ProviderUser, Delegation, ServiceAccount],
150
164
  resource: ProviderUser,
@@ -156,7 +170,11 @@ namespace PF {
156
170
  resource: ProviderUser,
157
171
  context: {
158
172
  requestTime: datetime,
173
+ weekday: String,
159
174
  nodeEnv: String,
175
+ runtimeMode: String,
176
+ stage: String,
177
+ environment: String,
160
178
  ownerProviderUserId: String,
161
179
  humanSession: Bool,
162
180
  humanAuthentication?: {
@@ -220,7 +238,7 @@ namespace PF {
220
238
 
221
239
  // Delete action for files and lists
222
240
  action delete appliesTo {
223
- principal: [ProviderUser, Delegation],
241
+ principal: [ProviderUser, Delegation, ServiceAccount],
224
242
  resource: [File, List],
225
243
  context: RequestContext,
226
244
  };
@@ -116,6 +116,7 @@ input ExecutionStepsProviderUserInput {
116
116
  }
117
117
 
118
118
  type ExecutionSteps {
119
+ deadlineActivity: String
119
120
  id: ID!
120
121
  name: String!
121
122
  path: String!
@@ -132,6 +133,7 @@ type ExecutionSteps {
132
133
  }
133
134
 
134
135
  input ExecutionStepsInput {
136
+ deadlineActivity: String
135
137
  id: ID!
136
138
  name: String!
137
139
  path: String!