@flowdular/sdk 0.2.4 → 0.3.1

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 (930) hide show
  1. package/.ai/agents/sandbox/business-manager.md +5 -1
  2. package/.ai/blueprints/author-spec/README.md +1 -1
  3. package/.ai/blueprints/author-spec/spec-requirements.yaml +44 -0
  4. package/.ai/blueprints/author-spec/steps.yaml +5 -5
  5. package/.ai/blueprints/author-spec/templates/module.yaml +99 -3
  6. package/.ai/blueprints/edit-module/gates.yaml +4 -0
  7. package/.ai/blueprints/edit-module/required-files.yaml +9 -0
  8. package/.ai/blueprints/new-module/gates.yaml +4 -0
  9. package/.ai/blueprints/new-module/spec-requirements.yaml +2 -2
  10. package/.ai/blueprints/release/gates.yaml +4 -0
  11. package/.ai/platform-capabilities.md +128 -0
  12. package/.ai/policies/capabilities.yaml +130 -3
  13. package/.ai/policies/path-ownership.yaml +5 -2
  14. package/.ai/policies/task-budgets.yaml +5 -3
  15. package/.ai/references/catalog/module.json +4 -4
  16. package/.ai/references/catalog/package.json +2 -2
  17. package/.ai/references/catalog/spec/module.yaml +5 -3
  18. package/.ai/references/catalog/src/platform.ts +2 -0
  19. package/.ai/references/catalog/src/services/catalog-service.ts +89 -1
  20. package/.ai/references/catalog/src/services/data-classes.ts +47 -0
  21. package/.ai/references/catalog/src/services/database-repository.ts +98 -1
  22. package/.ai/references/catalog/src/services/repository.ts +22 -1
  23. package/.ai/references/catalog/tests/data-classes.test.ts +157 -0
  24. package/.ai/references/catalog.provenance.json +12 -10
  25. package/.ai/skills/README.md +10 -0
  26. package/.ai/skills/agent-tool-design/SKILL.md +1 -2
  27. package/.ai/skills/auth-security-review/SKILL.md +1 -1
  28. package/.ai/skills/business-agent-design/SKILL.md +0 -1
  29. package/.ai/skills/cli-extension/SKILL.md +1 -1
  30. package/.ai/skills/deploy-operate/SKILL.md +119 -0
  31. package/.ai/skills/module-new/SKILL.md +29 -3
  32. package/.ai/skills/module-update/SKILL.md +9 -3
  33. package/.ai/skills/perf-audit/SKILL.md +0 -1
  34. package/.ai/skills/release-eject-pr/SKILL.md +0 -1
  35. package/.ai/skills/spec-interview/SKILL.md +120 -0
  36. package/.ai/skills/test-hardening/SKILL.md +1 -0
  37. package/.ai/skills/ux-design/SKILL.md +34 -3
  38. package/.ai/skills/variables/SKILL.md +0 -2
  39. package/.ai/skills/workflow-development/SKILL.md +0 -1
  40. package/AGENTS.md +4 -0
  41. package/docs/agent-contract.md +2 -2
  42. package/docs/design-system.md +185 -31
  43. package/modules/access/migrations/0001_access_core.down.sql +1 -0
  44. package/modules/access/migrations/0001_access_core.up.sql +28 -0
  45. package/modules/access/migrations/README.md +3 -0
  46. package/modules/access/module.json +33 -0
  47. package/modules/access/package.json +43 -0
  48. package/modules/access/spec/module.yaml +225 -0
  49. package/modules/access/src/acl/permissions.ts +6 -0
  50. package/modules/access/src/api/endpoints.ts +244 -0
  51. package/modules/access/src/client/ActivityView.tsrx +245 -0
  52. package/modules/access/src/client/AttestationsView.tsrx +176 -0
  53. package/modules/access/src/client/ReviewView.tsrx +586 -0
  54. package/modules/access/src/client/api.ts +132 -0
  55. package/modules/access/src/client/contribution.tsrx +41 -0
  56. package/modules/access/src/client/index.ts +41 -0
  57. package/modules/access/src/client/navigation.ts +57 -0
  58. package/modules/access/src/client/presentation.ts +69 -0
  59. package/modules/access/src/client/state.ts +72 -0
  60. package/modules/access/src/domain/types.ts +189 -0
  61. package/modules/access/src/index.ts +38 -0
  62. package/modules/access/src/platform.ts +60 -0
  63. package/modules/access/src/server/index.ts +42 -0
  64. package/modules/access/src/server/runtime.ts +105 -0
  65. package/modules/access/src/services/access-service.ts +298 -0
  66. package/modules/access/src/services/audit-window.ts +78 -0
  67. package/modules/access/src/services/auth-directory.ts +72 -0
  68. package/modules/access/src/services/changes.ts +91 -0
  69. package/modules/access/src/services/data-classes.ts +28 -0
  70. package/modules/access/src/services/database-repository.ts +185 -0
  71. package/modules/access/src/services/directory.ts +102 -0
  72. package/modules/access/src/services/index.ts +33 -0
  73. package/modules/access/src/services/list-exports.ts +150 -0
  74. package/modules/access/src/services/migration.ts +54 -0
  75. package/modules/access/src/services/repository.ts +30 -0
  76. package/modules/access/src/services/review.ts +178 -0
  77. package/modules/access/translations/en.json +155 -0
  78. package/modules/access/translations/pl.json +155 -0
  79. package/modules/agents/migrations/0022_credential_rotation_inventory.down.sql +2 -0
  80. package/modules/agents/migrations/0022_credential_rotation_inventory.up.sql +7 -0
  81. package/modules/agents/migrations/0023_agents_retention_indexes.down.sql +2 -0
  82. package/modules/agents/migrations/0023_agents_retention_indexes.up.sql +9 -0
  83. package/modules/agents/migrations/0024_agent_meter_refusals.down.sql +3 -0
  84. package/modules/agents/migrations/0024_agent_meter_refusals.up.sql +22 -0
  85. package/modules/agents/migrations/0025_agent_list_indexes.down.sql +3 -0
  86. package/modules/agents/migrations/0025_agent_list_indexes.up.sql +11 -0
  87. package/modules/agents/module.json +30 -4
  88. package/modules/agents/package.json +2 -1
  89. package/modules/agents/spec/module.yaml +63 -5
  90. package/modules/agents/src/api/endpoints.ts +291 -33
  91. package/modules/agents/src/cli/commands.json +11 -0
  92. package/modules/agents/src/cli/index.ts +45 -0
  93. package/modules/agents/src/client/AgentDashboardWidget.tsrx +19 -11
  94. package/modules/agents/src/client/AgentDefinitionList.tsrx +53 -10
  95. package/modules/agents/src/client/AgentPlaygroundView.tsrx +4 -4
  96. package/modules/agents/src/client/AgentProceduresView.tsrx +2 -2
  97. package/modules/agents/src/client/AgentRunsView.tsrx +143 -40
  98. package/modules/agents/src/client/AgentsView.tsrx +109 -33
  99. package/modules/agents/src/client/api.ts +99 -21
  100. package/modules/agents/src/client/state.ts +97 -0
  101. package/modules/agents/src/domain/types.ts +44 -4
  102. package/modules/agents/src/platform.ts +42 -0
  103. package/modules/agents/src/server/action-execution.ts +201 -106
  104. package/modules/agents/src/server/runtime.ts +32 -0
  105. package/modules/agents/src/services/agent-service.ts +158 -30
  106. package/modules/agents/src/services/credential-rotation.ts +185 -0
  107. package/modules/agents/src/services/credential-vault.ts +71 -46
  108. package/modules/agents/src/services/data-classes.ts +176 -0
  109. package/modules/agents/src/services/database-repository.ts +393 -101
  110. package/modules/agents/src/services/metering.ts +111 -0
  111. package/modules/agents/src/services/migration.ts +109 -0
  112. package/modules/agents/src/services/module-agent-preflight.ts +17 -9
  113. package/modules/agents/src/services/notifications.ts +98 -0
  114. package/modules/agents/src/services/provider-repository.ts +9 -18
  115. package/modules/agents/src/services/provider-service.ts +1 -9
  116. package/modules/agents/src/services/reports.ts +107 -0
  117. package/modules/agents/src/services/repository.ts +86 -6
  118. package/modules/agents/src/services/usage-service.ts +2 -0
  119. package/modules/agents/src/services/worker.ts +114 -4
  120. package/modules/agents/src/settings.ts +14 -3
  121. package/modules/agents/translations/en.json +14 -4
  122. package/modules/agents/translations/pl.json +14 -4
  123. package/modules/approvals/migrations/0001_approvals_core.down.sql +3 -0
  124. package/modules/approvals/migrations/0001_approvals_core.up.sql +78 -0
  125. package/modules/approvals/migrations/0002_approvals_expiry_routing_role.down.sql +2 -0
  126. package/modules/approvals/migrations/0002_approvals_expiry_routing_role.up.sql +19 -0
  127. package/modules/approvals/migrations/0003_approvals_retention_indexes.down.sql +6 -0
  128. package/modules/approvals/migrations/0003_approvals_retention_indexes.up.sql +14 -0
  129. package/modules/approvals/migrations/0004_approvals_inbox_keyset_indexes.down.sql +5 -0
  130. package/modules/approvals/migrations/0004_approvals_inbox_keyset_indexes.up.sql +12 -0
  131. package/modules/approvals/migrations/0005_approvals_grant_audit.down.sql +4 -0
  132. package/modules/approvals/migrations/0005_approvals_grant_audit.up.sql +20 -0
  133. package/modules/approvals/migrations/README.md +3 -0
  134. package/modules/approvals/module.json +34 -0
  135. package/modules/approvals/package.json +43 -0
  136. package/modules/approvals/spec/module.yaml +327 -0
  137. package/modules/approvals/src/acl/permissions.ts +7 -0
  138. package/modules/approvals/src/api/endpoints.ts +457 -0
  139. package/modules/approvals/src/client/ApprovalRequestDrawer.tsrx +138 -0
  140. package/modules/approvals/src/client/ApprovalsView.tsrx +562 -0
  141. package/modules/approvals/src/client/PendingCountWidget.tsrx +52 -0
  142. package/modules/approvals/src/client/api.ts +203 -0
  143. package/modules/approvals/src/client/approvals.css +51 -0
  144. package/modules/approvals/src/client/contribution.tsrx +44 -0
  145. package/modules/approvals/src/client/index.ts +26 -0
  146. package/modules/approvals/src/client/navigation.ts +39 -0
  147. package/modules/approvals/src/client/pending-count.ts +26 -0
  148. package/modules/approvals/src/client/presentation.ts +52 -0
  149. package/modules/approvals/src/client/state.ts +141 -0
  150. package/modules/approvals/src/domain/capability.ts +107 -0
  151. package/modules/approvals/src/domain/grant.ts +69 -0
  152. package/modules/approvals/src/domain/types.ts +168 -0
  153. package/modules/approvals/src/index.ts +61 -0
  154. package/modules/approvals/src/platform.ts +136 -0
  155. package/modules/approvals/src/server/index.ts +42 -0
  156. package/modules/approvals/src/server/runtime.ts +185 -0
  157. package/modules/approvals/src/services/approvals-service.ts +637 -0
  158. package/modules/approvals/src/services/callbacks.ts +75 -0
  159. package/modules/approvals/src/services/data-classes.ts +167 -0
  160. package/modules/approvals/src/services/database-repository.ts +783 -0
  161. package/modules/approvals/src/services/eligibility.ts +121 -0
  162. package/modules/approvals/src/services/expiry-runner.ts +81 -0
  163. package/modules/approvals/src/services/index.ts +31 -0
  164. package/modules/approvals/src/services/migration.ts +256 -0
  165. package/modules/approvals/src/services/notifications.ts +95 -0
  166. package/modules/approvals/src/services/repository.ts +169 -0
  167. package/modules/approvals/src/services/service-error.ts +70 -0
  168. package/modules/approvals/src/settings.ts +102 -0
  169. package/modules/approvals/translations/en.json +104 -0
  170. package/modules/approvals/translations/pl.json +104 -0
  171. package/modules/audit/migrations/0001_audit_core.down.sql +8 -0
  172. package/modules/audit/migrations/0001_audit_core.up.sql +107 -0
  173. package/modules/audit/migrations/0002_audit_sweep_routing_role.down.sql +2 -0
  174. package/modules/audit/migrations/0002_audit_sweep_routing_role.up.sql +21 -0
  175. package/modules/audit/migrations/0003_audit_export_request.down.sql +12 -0
  176. package/modules/audit/migrations/0003_audit_export_request.up.sql +40 -0
  177. package/modules/audit/migrations/0004_audit_hold_seal_erasure.down.sql +17 -0
  178. package/modules/audit/migrations/0004_audit_hold_seal_erasure.up.sql +192 -0
  179. package/modules/audit/migrations/0005_audit_event_format.down.sql +17 -0
  180. package/modules/audit/migrations/0005_audit_event_format.up.sql +60 -0
  181. package/modules/audit/migrations/0006_audit_own_class_walks.down.sql +3 -0
  182. package/modules/audit/migrations/0006_audit_own_class_walks.up.sql +14 -0
  183. package/modules/audit/migrations/README.md +3 -0
  184. package/modules/audit/module.json +32 -0
  185. package/modules/audit/package.json +49 -0
  186. package/modules/audit/spec/module.yaml +809 -0
  187. package/modules/audit/src/acl/permissions.ts +7 -0
  188. package/modules/audit/src/api/endpoints.ts +315 -0
  189. package/modules/audit/src/cli/commands.json +95 -0
  190. package/modules/audit/src/cli/index.ts +658 -0
  191. package/modules/audit/src/client/DataClassesView.tsrx +420 -0
  192. package/modules/audit/src/client/ExportsView.tsrx +256 -0
  193. package/modules/audit/src/client/HoldsView.tsrx +604 -0
  194. package/modules/audit/src/client/SweepsView.tsrx +251 -0
  195. package/modules/audit/src/client/api.ts +185 -0
  196. package/modules/audit/src/client/contribution.tsrx +52 -0
  197. package/modules/audit/src/client/index.ts +23 -0
  198. package/modules/audit/src/client/navigation.ts +74 -0
  199. package/modules/audit/src/client/presentation.ts +105 -0
  200. package/modules/audit/src/client/state.ts +86 -0
  201. package/modules/audit/src/domain/data-classes.ts +16 -0
  202. package/modules/audit/src/domain/types.ts +339 -0
  203. package/modules/audit/src/index.ts +76 -0
  204. package/modules/audit/src/platform.ts +44 -0
  205. package/modules/audit/src/server/index.ts +177 -0
  206. package/modules/audit/src/server/runtime.ts +303 -0
  207. package/modules/audit/src/services/anchor-key.ts +143 -0
  208. package/modules/audit/src/services/anchor-rotation.ts +147 -0
  209. package/modules/audit/src/services/audit-runners.ts +278 -0
  210. package/modules/audit/src/services/backup-guard.ts +95 -0
  211. package/modules/audit/src/services/database-repository.ts +1946 -0
  212. package/modules/audit/src/services/declared-classes.ts +64 -0
  213. package/modules/audit/src/services/erasure-port.ts +126 -0
  214. package/modules/audit/src/services/erasure-service.ts +770 -0
  215. package/modules/audit/src/services/export-directory.ts +106 -0
  216. package/modules/audit/src/services/export-service.ts +714 -0
  217. package/modules/audit/src/services/hold-service.ts +295 -0
  218. package/modules/audit/src/services/index.ts +17 -0
  219. package/modules/audit/src/services/migration.ts +658 -0
  220. package/modules/audit/src/services/own-classes.ts +318 -0
  221. package/modules/audit/src/services/platform-version.ts +23 -0
  222. package/modules/audit/src/services/repository.ts +495 -0
  223. package/modules/audit/src/services/retention-service.ts +191 -0
  224. package/modules/audit/src/services/seal-service.ts +769 -0
  225. package/modules/audit/src/services/service-error.ts +61 -0
  226. package/modules/audit/src/services/subject-keys.ts +90 -0
  227. package/modules/audit/src/services/sweep-service.ts +298 -0
  228. package/modules/audit/src/services/zip.ts +217 -0
  229. package/modules/audit/src/settings.ts +69 -0
  230. package/modules/audit/translations/en.json +210 -0
  231. package/modules/audit/translations/pl.json +210 -0
  232. package/modules/auth/README.md +77 -29
  233. package/modules/auth/migrations/0016_external_identities.up.sql +16 -0
  234. package/modules/auth/migrations/0017_mfa_key_id.up.sql +8 -0
  235. package/modules/auth/migrations/0018_retire_bundled_module_scopes.up.sql +29 -0
  236. package/modules/auth/migrations/0019_notifications_member_scopes.up.sql +44 -0
  237. package/modules/auth/migrations/0020_identity_providers.up.sql +61 -0
  238. package/modules/auth/migrations/0021_membership_status.up.sql +19 -0
  239. package/modules/auth/migrations/0022_auth_provider_scopes.up.sql +45 -0
  240. package/modules/auth/migrations/0023_enterprise_module_scopes.down.sql +19 -0
  241. package/modules/auth/migrations/0023_enterprise_module_scopes.up.sql +71 -0
  242. package/modules/auth/migrations/0024_approvals_member_scopes.down.sql +22 -0
  243. package/modules/auth/migrations/0024_approvals_member_scopes.up.sql +48 -0
  244. package/modules/auth/migrations/0025_audit_holds_owner_scope.down.sql +21 -0
  245. package/modules/auth/migrations/0025_audit_holds_owner_scope.up.sql +47 -0
  246. package/modules/auth/migrations/0026_auth_export_keyset_indexes.down.sql +6 -0
  247. package/modules/auth/migrations/0026_auth_export_keyset_indexes.up.sql +15 -0
  248. package/modules/auth/migrations/0027_workflow_automation_profile_scopes.down.sql +34 -0
  249. package/modules/auth/migrations/0027_workflow_automation_profile_scopes.up.sql +72 -0
  250. package/modules/auth/migrations/0028_auth_member_search_prefix_indexes.down.sql +6 -0
  251. package/modules/auth/migrations/0028_auth_member_search_prefix_indexes.up.sql +21 -0
  252. package/modules/auth/migrations/0029_reports_exports_access_scopes.down.sql +22 -0
  253. package/modules/auth/migrations/0029_reports_exports_access_scopes.up.sql +56 -0
  254. package/modules/auth/migrations/0030_auth_membership_keyset_index.down.sql +4 -0
  255. package/modules/auth/migrations/0030_auth_membership_keyset_index.up.sql +10 -0
  256. package/modules/auth/migrations/0031_membership_scope_backfills_under_rls.down.sql +4 -0
  257. package/modules/auth/migrations/0031_membership_scope_backfills_under_rls.up.sql +31 -0
  258. package/modules/auth/migrations/0032_audit_actor_service.down.sql +9 -0
  259. package/modules/auth/migrations/0032_audit_actor_service.up.sql +10 -0
  260. package/modules/auth/migrations/0033_auth_account_keyset_indexes.down.sql +5 -0
  261. package/modules/auth/migrations/0033_auth_account_keyset_indexes.up.sql +23 -0
  262. package/modules/auth/module.json +3 -3
  263. package/modules/auth/package.json +2 -1
  264. package/modules/auth/spec/module.yaml +372 -3
  265. package/modules/auth/src/acl/scopes.ts +50 -6
  266. package/modules/auth/src/cli/commands.json +11 -0
  267. package/modules/auth/src/cli/greenfield.ts +2 -2
  268. package/modules/auth/src/cli/index.ts +14 -0
  269. package/modules/auth/src/cli/secrets.ts +114 -0
  270. package/modules/auth/src/client/AuthenticationCore.tsrx +61 -8
  271. package/modules/auth/src/client/api.ts +72 -6
  272. package/modules/auth/src/client/contribution.tsrx +23 -0
  273. package/modules/auth/src/client/index.ts +6 -0
  274. package/modules/auth/src/client/providers/IdentityProviderForm.tsrx +191 -0
  275. package/modules/auth/src/client/providers/IdentityProvidersView.tsrx +358 -0
  276. package/modules/auth/src/client/providers/api.ts +128 -0
  277. package/modules/auth/src/client/providers/provider-columns.tsrx +60 -0
  278. package/modules/auth/src/client/providers/state.ts +35 -0
  279. package/modules/auth/src/client/security/SecurityView.tsrx +9 -1
  280. package/modules/auth/src/client/state.ts +15 -1
  281. package/modules/auth/src/domain/types.ts +55 -0
  282. package/modules/auth/src/index.ts +11 -1
  283. package/modules/auth/src/middleware/authentication.ts +4 -0
  284. package/modules/auth/src/server/endpoints.ts +467 -171
  285. package/modules/auth/src/server/http.ts +3 -2
  286. package/modules/auth/src/server/index.ts +22 -1
  287. package/modules/auth/src/server/membership-endpoints.ts +62 -0
  288. package/modules/auth/src/server/mfa-enforcement.ts +156 -0
  289. package/modules/auth/src/server/oidc.ts +389 -0
  290. package/modules/auth/src/server/provider-endpoints.ts +246 -0
  291. package/modules/auth/src/server/provider-host.ts +77 -0
  292. package/modules/auth/src/server/runtime.ts +231 -55
  293. package/modules/auth/src/services/auth-service-error.ts +7 -2
  294. package/modules/auth/src/services/auth-service.ts +948 -51
  295. package/modules/auth/src/services/data-classes.ts +236 -0
  296. package/modules/auth/src/services/database-repository.ts +853 -71
  297. package/modules/auth/src/services/identity-provider-service.ts +571 -0
  298. package/modules/auth/src/services/mail-delivery.ts +16 -16
  299. package/modules/auth/src/services/mail-message.ts +54 -0
  300. package/modules/auth/src/services/mail-port.ts +24 -0
  301. package/modules/auth/src/services/mail-smtp.ts +85 -0
  302. package/modules/auth/src/services/mfa-rotation.ts +144 -0
  303. package/modules/auth/src/services/migration.ts +810 -0
  304. package/modules/auth/src/services/password.ts +14 -0
  305. package/modules/auth/src/services/provider-secret-rotation.ts +169 -0
  306. package/modules/auth/src/services/provider-secrets.ts +136 -0
  307. package/modules/auth/src/services/repository.ts +321 -5
  308. package/modules/auth/src/services/session-sweep-runner.ts +73 -0
  309. package/modules/auth/src/services/settings-store.ts +10 -83
  310. package/modules/auth/src/services/totp.ts +88 -62
  311. package/modules/auth/src/services/validation.ts +194 -7
  312. package/modules/auth/src/settings.ts +18 -0
  313. package/modules/auth/translations/en.json +84 -1
  314. package/modules/auth/translations/pl.json +84 -1
  315. package/modules/automations/migrations/0005_secret_rotation_inventory.down.sql +1 -0
  316. package/modules/automations/migrations/0005_secret_rotation_inventory.up.sql +6 -0
  317. package/modules/automations/migrations/0006_automations_list_sort_indexes.down.sql +4 -0
  318. package/modules/automations/migrations/0006_automations_list_sort_indexes.up.sql +11 -0
  319. package/modules/automations/module.json +24 -6
  320. package/modules/automations/package.json +4 -1
  321. package/modules/automations/spec/module.yaml +81 -7
  322. package/modules/automations/src/api/endpoints.ts +202 -28
  323. package/modules/automations/src/cli/commands.json +17 -0
  324. package/modules/automations/src/cli/index.ts +114 -0
  325. package/modules/automations/src/client/AutomationScheduleForm.tsrx +77 -19
  326. package/modules/automations/src/client/AutomationSchedulesView.tsrx +144 -40
  327. package/modules/automations/src/client/AutomationTriggersView.tsrx +131 -32
  328. package/modules/automations/src/client/api.ts +62 -19
  329. package/modules/automations/src/client/presentation.ts +20 -2
  330. package/modules/automations/src/client/state.ts +84 -0
  331. package/modules/automations/src/domain/cadence.ts +99 -3
  332. package/modules/automations/src/domain/cron.ts +366 -0
  333. package/modules/automations/src/domain/time-zone.ts +61 -0
  334. package/modules/automations/src/platform.ts +38 -4
  335. package/modules/automations/src/server/index.ts +11 -0
  336. package/modules/automations/src/server/runtime.ts +46 -22
  337. package/modules/{automations-workflows-integration/src/server/adapter.ts → automations/src/server/workflow-target.ts} +13 -14
  338. package/modules/{automations-workflows-integration/src/server/tools.ts → automations/src/server/workflow-tools.ts} +0 -0
  339. package/modules/automations/src/services/data-classes.ts +62 -0
  340. package/modules/automations/src/services/database-repository.ts +152 -38
  341. package/modules/automations/src/services/migration.ts +119 -9
  342. package/modules/automations/src/services/repository.ts +52 -1
  343. package/modules/automations/src/services/schedule-runner.ts +84 -0
  344. package/modules/automations/src/services/schedule-service.ts +152 -26
  345. package/modules/automations/src/services/secret-rotation.ts +176 -0
  346. package/modules/automations/src/services/secret-vault.ts +68 -41
  347. package/modules/automations/src/services/trigger-service.ts +13 -10
  348. package/modules/automations/translations/en.json +15 -2
  349. package/modules/automations/translations/pl.json +15 -2
  350. package/modules/connectors/migrations/0001_connectors_core.down.sql +3 -0
  351. package/modules/connectors/migrations/0001_connectors_core.up.sql +72 -0
  352. package/modules/connectors/migrations/0002_connectors_call_keys.down.sql +3 -0
  353. package/modules/connectors/migrations/0002_connectors_call_keys.up.sql +18 -0
  354. package/modules/connectors/migrations/0003_connectors_rotation_inventory.down.sql +2 -0
  355. package/modules/connectors/migrations/0003_connectors_rotation_inventory.up.sql +19 -0
  356. package/modules/connectors/migrations/README.md +3 -0
  357. package/modules/connectors/module.json +32 -0
  358. package/modules/{automations-workflows-integration → connectors}/package.json +28 -26
  359. package/modules/connectors/spec/module.yaml +448 -0
  360. package/modules/connectors/src/acl/permissions.ts +6 -0
  361. package/modules/connectors/src/agent/tools.ts +180 -0
  362. package/modules/connectors/src/api/endpoints.ts +572 -0
  363. package/modules/connectors/src/cli/commands.json +17 -0
  364. package/modules/connectors/src/cli/index.ts +126 -0
  365. package/modules/connectors/src/client/ConnectorCallsView.tsrx +358 -0
  366. package/modules/connectors/src/client/ConnectorForm.tsrx +424 -0
  367. package/modules/connectors/src/client/ConnectorsView.tsrx +711 -0
  368. package/modules/connectors/src/client/api.ts +281 -0
  369. package/modules/connectors/src/client/consent.ts +48 -0
  370. package/modules/connectors/src/client/contribution.tsrx +37 -0
  371. package/modules/connectors/src/client/index.ts +22 -0
  372. package/modules/connectors/src/client/navigation.ts +42 -0
  373. package/modules/connectors/src/client/presentation.ts +38 -0
  374. package/modules/connectors/src/client/state.ts +175 -0
  375. package/modules/connectors/src/domain/calls.ts +70 -0
  376. package/modules/connectors/src/domain/definitions.ts +190 -0
  377. package/modules/connectors/src/domain/http-json.ts +68 -0
  378. package/modules/connectors/src/domain/types.ts +185 -0
  379. package/modules/connectors/src/index.ts +64 -0
  380. package/modules/connectors/src/platform.ts +56 -0
  381. package/modules/connectors/src/server/index.ts +66 -0
  382. package/modules/connectors/src/server/runtime.ts +163 -0
  383. package/modules/connectors/src/services/call-service.ts +903 -0
  384. package/modules/connectors/src/services/connectors-service.ts +653 -0
  385. package/modules/connectors/src/services/credential-rotation.ts +221 -0
  386. package/modules/connectors/src/services/credential-vault.ts +194 -0
  387. package/modules/connectors/src/services/data-classes.ts +158 -0
  388. package/modules/connectors/src/services/database-repository.ts +897 -0
  389. package/modules/connectors/src/services/egress.ts +261 -0
  390. package/modules/connectors/src/services/index.ts +19 -0
  391. package/modules/connectors/src/services/migration.ts +202 -0
  392. package/modules/connectors/src/services/repository.ts +175 -0
  393. package/modules/connectors/src/services/service-error.ts +46 -0
  394. package/modules/connectors/src/settings.ts +69 -0
  395. package/modules/connectors/translations/en.json +191 -0
  396. package/modules/connectors/translations/pl.json +191 -0
  397. package/modules/directory/migrations/0001_directory_core.down.sql +5 -0
  398. package/modules/directory/migrations/0001_directory_core.up.sql +111 -0
  399. package/modules/directory/migrations/README.md +3 -0
  400. package/modules/directory/module.json +27 -0
  401. package/modules/directory/package.json +46 -0
  402. package/modules/directory/spec/module.yaml +351 -0
  403. package/modules/directory/src/acl/permissions.ts +7 -0
  404. package/modules/directory/src/api/endpoints.ts +478 -0
  405. package/modules/directory/src/api/scim-endpoints.ts +516 -0
  406. package/modules/directory/src/client/GroupMappingsView.tsrx +430 -0
  407. package/modules/directory/src/client/ProvisioningLogView.tsrx +248 -0
  408. package/modules/directory/src/client/ScimTokensView.tsrx +587 -0
  409. package/modules/directory/src/client/api.ts +222 -0
  410. package/modules/directory/src/client/contribution.tsrx +46 -0
  411. package/modules/directory/src/client/index.ts +22 -0
  412. package/modules/directory/src/client/navigation.ts +57 -0
  413. package/modules/directory/src/client/presentation.ts +143 -0
  414. package/modules/directory/src/client/state.ts +173 -0
  415. package/modules/directory/src/domain/scim.ts +346 -0
  416. package/modules/directory/src/domain/types.ts +166 -0
  417. package/modules/directory/src/index.ts +44 -0
  418. package/modules/directory/src/platform.ts +43 -0
  419. package/modules/directory/src/server/index.ts +17 -0
  420. package/modules/directory/src/server/runtime.ts +124 -0
  421. package/modules/directory/src/services/auth-port.ts +127 -0
  422. package/modules/directory/src/services/data-classes.ts +41 -0
  423. package/modules/directory/src/services/database-repository.ts +1067 -0
  424. package/modules/directory/src/services/directory-service.ts +311 -0
  425. package/modules/directory/src/services/index.ts +43 -0
  426. package/modules/directory/src/services/migration.ts +146 -0
  427. package/modules/directory/src/services/provisioning-service.ts +1420 -0
  428. package/modules/directory/src/services/rate-limiter.ts +103 -0
  429. package/modules/directory/src/services/repository.ts +208 -0
  430. package/modules/directory/src/services/service-error.ts +42 -0
  431. package/modules/directory/src/services/token-service.ts +215 -0
  432. package/modules/directory/src/settings.ts +86 -0
  433. package/modules/directory/translations/en.json +185 -0
  434. package/modules/directory/translations/pl.json +185 -0
  435. package/modules/documents/migrations/0001_documents_core.down.sql +1 -0
  436. package/modules/documents/migrations/0001_documents_core.up.sql +35 -0
  437. package/modules/documents/migrations/0002_documents_files_page.down.sql +1 -0
  438. package/modules/documents/migrations/0002_documents_files_page.up.sql +6 -0
  439. package/modules/documents/migrations/0003_documents_rotation_inventory.down.sql +2 -0
  440. package/modules/documents/migrations/0003_documents_rotation_inventory.up.sql +18 -0
  441. package/modules/documents/migrations/README.md +3 -0
  442. package/modules/documents/module.json +32 -0
  443. package/modules/documents/package.json +50 -0
  444. package/modules/documents/spec/module.yaml +248 -0
  445. package/modules/documents/src/acl/permissions.ts +6 -0
  446. package/modules/documents/src/api/endpoints.ts +401 -0
  447. package/modules/documents/src/cli/commands.json +17 -0
  448. package/modules/documents/src/cli/index.ts +145 -0
  449. package/modules/documents/src/client/DocumentUploader.tsrx +148 -0
  450. package/modules/documents/src/client/DocumentsView.tsrx +540 -0
  451. package/modules/documents/src/client/api.ts +209 -0
  452. package/modules/documents/src/client/contribution.tsrx +29 -0
  453. package/modules/documents/src/client/download.ts +70 -0
  454. package/modules/documents/src/client/index.ts +22 -0
  455. package/modules/documents/src/client/navigation.ts +25 -0
  456. package/modules/documents/src/client/presentation.ts +110 -0
  457. package/modules/documents/src/client/state.ts +117 -0
  458. package/modules/documents/src/domain/attachments.ts +84 -0
  459. package/modules/documents/src/domain/types.ts +80 -0
  460. package/modules/documents/src/index.ts +46 -0
  461. package/modules/documents/src/platform.ts +61 -0
  462. package/modules/documents/src/server/index.ts +30 -0
  463. package/modules/documents/src/server/runtime.ts +107 -0
  464. package/modules/documents/src/services/attachments.ts +39 -0
  465. package/modules/documents/src/services/data-classes.ts +25 -0
  466. package/modules/documents/src/services/database-repository.ts +270 -0
  467. package/modules/documents/src/services/documents-service.ts +590 -0
  468. package/modules/documents/src/services/index.ts +18 -0
  469. package/modules/documents/src/services/migration.ts +117 -0
  470. package/modules/documents/src/services/repository.ts +58 -0
  471. package/modules/documents/src/services/storage-rotation.ts +157 -0
  472. package/modules/documents/src/settings.ts +107 -0
  473. package/modules/documents/translations/en.json +111 -0
  474. package/modules/documents/translations/pl.json +111 -0
  475. package/modules/exports/migrations/0001_exports_core.down.sql +2 -0
  476. package/modules/exports/migrations/0001_exports_core.up.sql +28 -0
  477. package/modules/exports/migrations/0002_exports_job_routing_role.down.sql +4 -0
  478. package/modules/exports/migrations/0002_exports_job_routing_role.up.sql +21 -0
  479. package/modules/exports/migrations/0003_exports_rotation_inventory.down.sql +1 -0
  480. package/modules/exports/migrations/0003_exports_rotation_inventory.up.sql +9 -0
  481. package/modules/exports/migrations/README.md +3 -0
  482. package/modules/exports/module.json +32 -0
  483. package/modules/exports/package.json +45 -0
  484. package/modules/exports/spec/module.yaml +230 -0
  485. package/modules/exports/src/acl/permissions.ts +6 -0
  486. package/modules/exports/src/api/endpoints.ts +211 -0
  487. package/modules/exports/src/cli/commands.json +17 -0
  488. package/modules/exports/src/cli/index.ts +145 -0
  489. package/modules/exports/src/client/ExportsView.tsrx +327 -0
  490. package/modules/exports/src/client/api.ts +133 -0
  491. package/modules/exports/src/client/contribution.tsrx +31 -0
  492. package/modules/exports/src/client/index.ts +20 -0
  493. package/modules/exports/src/client/navigation.ts +25 -0
  494. package/modules/exports/src/client/presentation.ts +53 -0
  495. package/modules/exports/src/client/state.ts +56 -0
  496. package/modules/exports/src/domain/lists.ts +29 -0
  497. package/modules/exports/src/domain/types.ts +120 -0
  498. package/modules/exports/src/index.ts +41 -0
  499. package/modules/exports/src/platform.ts +80 -0
  500. package/modules/exports/src/server/index.ts +50 -0
  501. package/modules/exports/src/server/runtime.ts +160 -0
  502. package/modules/exports/src/services/data-classes.ts +59 -0
  503. package/modules/exports/src/services/database-repository.ts +403 -0
  504. package/modules/exports/src/services/export-runner.ts +123 -0
  505. package/modules/exports/src/services/export-service.ts +356 -0
  506. package/modules/exports/src/services/index.ts +6 -0
  507. package/modules/exports/src/services/list-registry.ts +105 -0
  508. package/modules/exports/src/services/migration.ts +116 -0
  509. package/modules/exports/src/services/repository.ts +96 -0
  510. package/modules/exports/src/services/storage-rotation.ts +138 -0
  511. package/modules/exports/src/settings.ts +70 -0
  512. package/modules/exports/translations/en.json +69 -0
  513. package/modules/exports/translations/pl.json +69 -0
  514. package/modules/import/migrations/0001_import_core.down.sql +6 -0
  515. package/modules/import/migrations/0001_import_core.up.sql +61 -0
  516. package/modules/import/migrations/0002_import_job_routing_role.down.sql +4 -0
  517. package/modules/import/migrations/0002_import_job_routing_role.up.sql +20 -0
  518. package/modules/import/migrations/0003_import_jobs_export_index.down.sql +1 -0
  519. package/modules/import/migrations/0003_import_jobs_export_index.up.sql +7 -0
  520. package/modules/import/migrations/0004_import_jobs_traceparent.down.sql +1 -0
  521. package/modules/import/migrations/0004_import_jobs_traceparent.up.sql +7 -0
  522. package/modules/import/migrations/README.md +3 -0
  523. package/modules/import/module.json +37 -0
  524. package/modules/import/package.json +50 -0
  525. package/modules/import/spec/module.yaml +335 -0
  526. package/modules/import/src/acl/permissions.ts +6 -0
  527. package/modules/import/src/api/endpoints.ts +400 -0
  528. package/modules/import/src/client/ImportJobDrawer.tsrx +229 -0
  529. package/modules/import/src/client/ImportsView.tsrx +455 -0
  530. package/modules/import/src/client/NewImportForm.tsrx +274 -0
  531. package/modules/import/src/client/api.ts +243 -0
  532. package/modules/import/src/client/contribution.tsrx +29 -0
  533. package/modules/import/src/client/index.ts +23 -0
  534. package/modules/import/src/client/navigation.ts +25 -0
  535. package/modules/import/src/client/presentation.ts +59 -0
  536. package/modules/import/src/client/state.ts +43 -0
  537. package/modules/import/src/domain/csv.ts +258 -0
  538. package/modules/import/src/domain/ports.ts +157 -0
  539. package/modules/import/src/domain/types.ts +179 -0
  540. package/modules/import/src/index.ts +58 -0
  541. package/modules/import/src/platform.ts +60 -0
  542. package/modules/import/src/server/index.ts +49 -0
  543. package/modules/import/src/server/runtime.ts +158 -0
  544. package/modules/import/src/services/csv-source.ts +121 -0
  545. package/modules/import/src/services/data-classes.ts +63 -0
  546. package/modules/import/src/services/database-repository.ts +780 -0
  547. package/modules/import/src/services/import-runner.ts +127 -0
  548. package/modules/import/src/services/import-service.ts +872 -0
  549. package/modules/import/src/services/index.ts +6 -0
  550. package/modules/import/src/services/migration.ts +156 -0
  551. package/modules/import/src/services/port-registry.ts +158 -0
  552. package/modules/import/src/services/repository.ts +147 -0
  553. package/modules/import/src/settings.ts +70 -0
  554. package/modules/import/translations/en.json +175 -0
  555. package/modules/import/translations/pl.json +175 -0
  556. package/modules/metering/migrations/0001_metering_core.down.sql +6 -0
  557. package/modules/metering/migrations/0001_metering_core.up.sql +119 -0
  558. package/modules/metering/migrations/0002_metering_bucket_export.down.sql +3 -0
  559. package/modules/metering/migrations/0002_metering_bucket_export.up.sql +5 -0
  560. package/modules/metering/migrations/README.md +3 -0
  561. package/modules/metering/module.json +46 -0
  562. package/modules/metering/package.json +50 -0
  563. package/modules/metering/spec/module.yaml +269 -0
  564. package/modules/metering/src/acl/permissions.ts +5 -0
  565. package/modules/metering/src/api/endpoints.ts +104 -0
  566. package/modules/metering/src/cli/commands.json +28 -0
  567. package/modules/metering/src/cli/index.ts +246 -0
  568. package/modules/metering/src/client/LimitsView.tsrx +170 -0
  569. package/modules/metering/src/client/UsageSummaryWidget.tsrx +63 -0
  570. package/modules/metering/src/client/UsageView.tsrx +205 -0
  571. package/modules/metering/src/client/api.ts +91 -0
  572. package/modules/metering/src/client/contribution.tsrx +42 -0
  573. package/modules/metering/src/client/index.ts +26 -0
  574. package/modules/metering/src/client/navigation.ts +54 -0
  575. package/modules/metering/src/client/presentation.ts +63 -0
  576. package/modules/metering/src/client/state.ts +31 -0
  577. package/modules/metering/src/domain/meters.ts +100 -0
  578. package/modules/metering/src/domain/types.ts +71 -0
  579. package/modules/metering/src/index.ts +51 -0
  580. package/modules/metering/src/platform.ts +84 -0
  581. package/modules/metering/src/server/index.ts +40 -0
  582. package/modules/metering/src/server/runtime.ts +165 -0
  583. package/modules/metering/src/services/data-classes.ts +34 -0
  584. package/modules/metering/src/services/database-repository.ts +574 -0
  585. package/modules/metering/src/services/index.ts +9 -0
  586. package/modules/metering/src/services/meter-registry.ts +145 -0
  587. package/modules/metering/src/services/metering-service.ts +441 -0
  588. package/modules/metering/src/services/migration.ts +183 -0
  589. package/modules/metering/src/services/notifications.ts +75 -0
  590. package/modules/metering/src/services/reports.ts +105 -0
  591. package/modules/metering/src/services/repository.ts +132 -0
  592. package/modules/metering/src/services/service-error.ts +46 -0
  593. package/modules/metering/src/settings.ts +47 -0
  594. package/modules/metering/translations/en.json +68 -0
  595. package/modules/metering/translations/pl.json +68 -0
  596. package/modules/notifications/migrations/0001_notifications_core.down.sql +1 -0
  597. package/modules/notifications/migrations/0001_notifications_core.up.sql +26 -0
  598. package/modules/notifications/migrations/0002_notifications_preferences.down.sql +1 -0
  599. package/modules/notifications/migrations/0002_notifications_preferences.up.sql +17 -0
  600. package/modules/notifications/migrations/0003_notifications_webhook_subscriptions.down.sql +1 -0
  601. package/modules/notifications/migrations/0003_notifications_webhook_subscriptions.up.sql +30 -0
  602. package/modules/notifications/migrations/0004_notifications_deliveries.down.sql +1 -0
  603. package/modules/notifications/migrations/0004_notifications_deliveries.up.sql +35 -0
  604. package/modules/notifications/migrations/0005_notifications_delivery_routing_role.down.sql +2 -0
  605. package/modules/notifications/migrations/0005_notifications_delivery_routing_role.up.sql +17 -0
  606. package/modules/notifications/migrations/0006_notifications_delivery_title.down.sql +1 -0
  607. package/modules/notifications/migrations/0006_notifications_delivery_title.up.sql +11 -0
  608. package/modules/notifications/migrations/0007_notifications_secret_rotation_inventory.down.sql +2 -0
  609. package/modules/notifications/migrations/0007_notifications_secret_rotation_inventory.up.sql +19 -0
  610. package/modules/notifications/migrations/0008_notifications_delivery_claim.down.sql +8 -0
  611. package/modules/notifications/migrations/0008_notifications_delivery_claim.up.sql +19 -0
  612. package/modules/notifications/migrations/0009_notifications_kind_approvals.down.sql +16 -0
  613. package/modules/notifications/migrations/0009_notifications_kind_approvals.up.sql +18 -0
  614. package/modules/notifications/migrations/0010_notifications_kind_meter_threshold.down.sql +16 -0
  615. package/modules/notifications/migrations/0010_notifications_kind_meter_threshold.up.sql +18 -0
  616. package/modules/notifications/migrations/0011_notifications_retention_keyset.down.sql +5 -0
  617. package/modules/notifications/migrations/0011_notifications_retention_keyset.up.sql +15 -0
  618. package/modules/notifications/migrations/0012_notifications_email_channel.down.sql +12 -0
  619. package/modules/notifications/migrations/0012_notifications_email_channel.up.sql +38 -0
  620. package/modules/notifications/migrations/0013_notifications_list_pages.down.sql +5 -0
  621. package/modules/notifications/migrations/0013_notifications_list_pages.up.sql +13 -0
  622. package/modules/notifications/migrations/README.md +3 -0
  623. package/modules/notifications/module.json +32 -0
  624. package/modules/notifications/package.json +49 -0
  625. package/modules/notifications/spec/module.yaml +718 -0
  626. package/modules/notifications/src/acl/permissions.ts +11 -0
  627. package/modules/notifications/src/api/endpoints.ts +814 -0
  628. package/modules/notifications/src/cli/commands.json +17 -0
  629. package/modules/notifications/src/cli/index.ts +126 -0
  630. package/modules/notifications/src/client/DeliveriesView.tsrx +483 -0
  631. package/modules/notifications/src/client/FactList.tsrx +24 -0
  632. package/modules/notifications/src/client/NotificationPreferencesView.tsrx +240 -0
  633. package/modules/notifications/src/client/NotificationsInboxView.tsrx +592 -0
  634. package/modules/notifications/src/client/UnreadCountWidget.tsrx +62 -0
  635. package/modules/notifications/src/client/WebhookForm.tsrx +297 -0
  636. package/modules/notifications/src/client/WebhooksView.tsrx +637 -0
  637. package/modules/notifications/src/client/api.ts +382 -0
  638. package/modules/notifications/src/client/contribution.tsrx +83 -0
  639. package/modules/notifications/src/client/inbox.ts +41 -0
  640. package/modules/notifications/src/client/index.ts +29 -0
  641. package/modules/notifications/src/client/navigation.ts +92 -0
  642. package/modules/notifications/src/client/notifications.css +70 -0
  643. package/modules/notifications/src/client/presentation.ts +81 -0
  644. package/modules/notifications/src/client/state.ts +246 -0
  645. package/modules/notifications/src/client/unread-count.ts +26 -0
  646. package/modules/notifications/src/domain/locale.ts +47 -0
  647. package/modules/notifications/src/domain/publish.ts +46 -0
  648. package/modules/notifications/src/domain/types.ts +186 -0
  649. package/modules/notifications/src/index.ts +62 -0
  650. package/modules/notifications/src/platform.ts +85 -0
  651. package/modules/notifications/src/server/index.ts +82 -0
  652. package/modules/notifications/src/server/runtime.ts +251 -0
  653. package/modules/notifications/src/services/data-classes.ts +139 -0
  654. package/modules/notifications/src/services/database-repository.ts +1334 -0
  655. package/modules/notifications/src/services/delivery-payload.ts +93 -0
  656. package/modules/notifications/src/services/delivery-runner.ts +170 -0
  657. package/modules/notifications/src/services/delivery-service.ts +811 -0
  658. package/modules/notifications/src/services/egress.ts +239 -0
  659. package/modules/notifications/src/services/email-channel.ts +93 -0
  660. package/modules/notifications/src/services/index.ts +23 -0
  661. package/modules/notifications/src/services/migration.ts +572 -0
  662. package/modules/notifications/src/services/notifications-service.ts +297 -0
  663. package/modules/notifications/src/services/paging.ts +60 -0
  664. package/modules/notifications/src/services/publish-service.ts +133 -0
  665. package/modules/notifications/src/services/repository.ts +342 -0
  666. package/modules/notifications/src/services/secret-rotation.ts +177 -0
  667. package/modules/notifications/src/services/secret-vault.ts +168 -0
  668. package/modules/notifications/src/services/service-error.ts +67 -0
  669. package/modules/notifications/src/services/signature.ts +81 -0
  670. package/modules/notifications/src/services/webhook-service.ts +307 -0
  671. package/modules/notifications/src/settings.ts +130 -0
  672. package/modules/notifications/translations/en.json +255 -0
  673. package/modules/notifications/translations/pl.json +255 -0
  674. package/modules/profile/module.json +3 -3
  675. package/modules/profile/package.json +1 -1
  676. package/modules/profile/spec/module.yaml +3 -3
  677. package/modules/profile/src/services/database-repository.ts +3 -13
  678. package/modules/reports/module.json +28 -0
  679. package/modules/reports/package.json +42 -0
  680. package/modules/reports/spec/module.yaml +231 -0
  681. package/modules/reports/src/acl/permissions.ts +5 -0
  682. package/modules/reports/src/api/endpoints.ts +72 -0
  683. package/modules/reports/src/client/ReportsSummaryWidget.tsrx +52 -0
  684. package/modules/reports/src/client/ReportsView.tsrx +246 -0
  685. package/modules/reports/src/client/api.ts +65 -0
  686. package/modules/reports/src/client/contribution.tsrx +36 -0
  687. package/modules/reports/src/client/index.ts +18 -0
  688. package/modules/reports/src/client/navigation.ts +39 -0
  689. package/modules/reports/src/client/presentation.ts +123 -0
  690. package/modules/reports/src/client/state.ts +28 -0
  691. package/modules/reports/src/domain/providers.ts +115 -0
  692. package/modules/reports/src/domain/types.ts +44 -0
  693. package/modules/reports/src/index.ts +47 -0
  694. package/modules/reports/src/platform.ts +37 -0
  695. package/modules/reports/src/server/index.ts +21 -0
  696. package/modules/reports/src/server/runtime.ts +40 -0
  697. package/modules/reports/src/services/index.ts +17 -0
  698. package/modules/reports/src/services/provider-registry.ts +144 -0
  699. package/modules/reports/src/services/range.ts +65 -0
  700. package/modules/reports/src/services/reports-service.ts +316 -0
  701. package/modules/reports/src/services/service-error.ts +26 -0
  702. package/modules/reports/src/settings.ts +49 -0
  703. package/modules/reports/translations/en.json +35 -0
  704. package/modules/reports/translations/pl.json +35 -0
  705. package/modules/sandbox/module.json +4 -4
  706. package/modules/sandbox/package.json +1 -1
  707. package/modules/sandbox/spec/module.yaml +3 -3
  708. package/modules/sandbox/src/services/database-repository.ts +14 -23
  709. package/modules/sandbox/src/services/directory.ts +16 -0
  710. package/modules/sandbox/src/services/sandbox-service.ts +13 -11
  711. package/modules/search/migrations/0001_search_core.down.sql +1 -0
  712. package/modules/search/migrations/0001_search_core.up.sql +22 -0
  713. package/modules/search/migrations/0002_search_recent_export.down.sql +3 -0
  714. package/modules/search/migrations/0002_search_recent_export.up.sql +5 -0
  715. package/modules/search/migrations/README.md +3 -0
  716. package/modules/search/module.json +28 -0
  717. package/modules/search/package.json +43 -0
  718. package/modules/search/spec/module.yaml +177 -0
  719. package/modules/search/src/acl/permissions.ts +5 -0
  720. package/modules/search/src/api/endpoints.ts +221 -0
  721. package/modules/search/src/client/SearchView.tsrx +346 -0
  722. package/modules/search/src/client/api.ts +157 -0
  723. package/modules/search/src/client/contribution.tsrx +31 -0
  724. package/modules/search/src/client/index.ts +17 -0
  725. package/modules/search/src/client/navigation.ts +97 -0
  726. package/modules/search/src/client/search.css +56 -0
  727. package/modules/search/src/client/state.ts +113 -0
  728. package/modules/search/src/domain/data-classes.ts +73 -0
  729. package/modules/search/src/domain/providers.ts +88 -0
  730. package/modules/search/src/domain/types.ts +56 -0
  731. package/modules/search/src/index.ts +46 -0
  732. package/modules/search/src/platform.ts +42 -0
  733. package/modules/search/src/server/index.ts +25 -0
  734. package/modules/search/src/server/runtime.ts +123 -0
  735. package/modules/search/src/services/database-repository.ts +163 -0
  736. package/modules/search/src/services/index.ts +21 -0
  737. package/modules/search/src/services/migration.ts +65 -0
  738. package/modules/search/src/services/provider-registry.ts +137 -0
  739. package/modules/search/src/services/repository.ts +43 -0
  740. package/modules/search/src/services/search-service.ts +442 -0
  741. package/modules/search/src/services/service-error.ts +35 -0
  742. package/modules/search/src/settings.ts +68 -0
  743. package/modules/search/translations/en.json +45 -0
  744. package/modules/search/translations/pl.json +45 -0
  745. package/modules/system/module.json +2 -2
  746. package/modules/system/package.json +1 -1
  747. package/modules/system/spec/module.yaml +30 -3
  748. package/modules/system/src/client/FlagsPanel.tsrx +127 -0
  749. package/modules/system/src/client/ModuleSettingRow.tsrx +17 -7
  750. package/modules/system/src/client/ModuleSettingsSection.tsrx +10 -71
  751. package/modules/system/src/client/ModulesView.tsrx +91 -65
  752. package/modules/system/src/client/flags.ts +35 -0
  753. package/modules/system/src/client/index.ts +8 -0
  754. package/modules/system/src/client/navigation.ts +8 -0
  755. package/modules/system/src/client/settings-state.ts +159 -0
  756. package/modules/system/src/client/state.ts +2 -0
  757. package/modules/system/src/domain/time-zone.ts +105 -0
  758. package/modules/system/src/index.ts +12 -0
  759. package/modules/system/src/platform.ts +5 -1
  760. package/modules/system/src/server/endpoints.ts +72 -21
  761. package/modules/system/src/settings.ts +28 -0
  762. package/modules/system/translations/en.json +17 -0
  763. package/modules/system/translations/pl.json +17 -0
  764. package/modules/users/module.json +30 -4
  765. package/modules/users/package.json +4 -1
  766. package/modules/users/spec/module.yaml +290 -7
  767. package/modules/users/src/api/endpoints.ts +228 -15
  768. package/modules/users/src/client/InviteMemberForm.tsrx +2 -2
  769. package/modules/users/src/client/MemberDrawer.tsrx +142 -26
  770. package/modules/users/src/client/UserAccountForm.tsrx +2 -2
  771. package/modules/users/src/client/UsersView.tsrx +432 -71
  772. package/modules/users/src/client/api.ts +106 -12
  773. package/modules/users/src/client/contribution.tsrx +5 -0
  774. package/modules/users/src/client/member-columns.tsrx +22 -9
  775. package/modules/users/src/client/state.ts +172 -7
  776. package/modules/users/src/domain/lists.ts +9 -0
  777. package/modules/users/src/index.ts +11 -0
  778. package/modules/users/src/platform.ts +50 -1
  779. package/modules/users/src/services/member-export.ts +51 -0
  780. package/modules/users/src/services/member-import.ts +249 -0
  781. package/modules/users/src/services/member-search.ts +145 -0
  782. package/modules/users/src/services/users-service.ts +117 -4
  783. package/modules/users/translations/en.json +57 -8
  784. package/modules/users/translations/pl.json +57 -8
  785. package/modules/workflows/migrations/0004_payload_rotation_inventory.up.sql +17 -0
  786. package/modules/workflows/migrations/0005_workflows_human_approval.up.sql +28 -0
  787. package/modules/workflows/migrations/0006_workflows_retention_indexes.up.sql +11 -0
  788. package/modules/workflows/migrations/0007_workflows_erasure_subject_indexes.up.sql +17 -0
  789. package/modules/workflows/migrations/0008_workflows_subject_account.up.sql +24 -0
  790. package/modules/workflows/migrations/0009_workflows_definition_list_indexes.up.sql +9 -0
  791. package/modules/workflows/module.json +34 -6
  792. package/modules/workflows/package.json +2 -1
  793. package/modules/workflows/spec/module.yaml +26 -9
  794. package/modules/workflows/src/api/endpoints.ts +131 -25
  795. package/modules/workflows/src/cli/commands.json +17 -0
  796. package/modules/workflows/src/cli/index.ts +114 -0
  797. package/modules/workflows/src/client/WorkflowExecutionHistory.tsrx +36 -27
  798. package/modules/workflows/src/client/WorkflowInspector.tsrx +116 -0
  799. package/modules/workflows/src/client/WorkflowNodePalette.tsrx +1 -0
  800. package/modules/workflows/src/client/WorkflowsView.tsrx +236 -99
  801. package/modules/workflows/src/client/api.ts +54 -34
  802. package/modules/workflows/src/client/canvas-model.ts +12 -0
  803. package/modules/workflows/src/client/state.ts +95 -0
  804. package/modules/workflows/src/domain/events.ts +25 -11
  805. package/modules/workflows/src/domain/graph.ts +135 -1
  806. package/modules/workflows/src/domain/types.ts +91 -4
  807. package/modules/workflows/src/platform.ts +12 -0
  808. package/modules/workflows/src/server/runtime.ts +78 -5
  809. package/modules/workflows/src/services/approvals.ts +62 -0
  810. package/modules/workflows/src/services/cursors.ts +37 -0
  811. package/modules/workflows/src/services/data-classes.ts +232 -0
  812. package/modules/workflows/src/services/database-repository.ts +660 -171
  813. package/modules/workflows/src/services/migration.ts +240 -0
  814. package/modules/workflows/src/services/notifications.ts +98 -0
  815. package/modules/workflows/src/services/payload-codec.ts +51 -28
  816. package/modules/workflows/src/services/payload-rotation.ts +171 -0
  817. package/modules/workflows/src/services/repository.ts +123 -8
  818. package/modules/workflows/src/services/simulation.ts +7 -0
  819. package/modules/workflows/src/services/worker.ts +446 -25
  820. package/modules/workflows/src/services/workflows-service.ts +264 -103
  821. package/modules/workflows/translations/en.json +12 -4
  822. package/modules/workflows/translations/pl.json +12 -4
  823. package/modules.json +48 -4
  824. package/package.json +64 -6
  825. package/packages/client/package.json +1 -0
  826. package/packages/client/src/ApplicationShell.tsrx +43 -0
  827. package/packages/client/src/contributions.ts +55 -0
  828. package/packages/client/src/i18n/locales/en.json +5 -0
  829. package/packages/client/src/i18n/locales/pl.json +5 -0
  830. package/packages/client/src/index.ts +13 -1
  831. package/packages/client/src/routing.ts +22 -0
  832. package/packages/client/src/shell/CommandPalette.tsrx +223 -11
  833. package/packages/client/src/shell/command-search.ts +126 -0
  834. package/packages/client/src/shell/command.ts +30 -0
  835. package/packages/client/src/shell/navigation.ts +12 -0
  836. package/packages/client/src/shell/palette-keys.ts +27 -0
  837. package/packages/client/src/shell/shell.css +7 -0
  838. package/packages/contracts/schemas/module-spec.schema.json +287 -1
  839. package/packages/contracts/schemas/module.schema.json +25 -0
  840. package/packages/contracts/src/index.ts +144 -1
  841. package/packages/database/src/backup.ts +180 -0
  842. package/packages/database/src/decoders.ts +25 -0
  843. package/packages/database/src/index.ts +17 -0
  844. package/packages/database/src/migrations.ts +7 -0
  845. package/packages/database/src/record-history.ts +5 -14
  846. package/packages/harness/src/index.ts +2 -0
  847. package/packages/harness/src/runtime.ts +378 -2
  848. package/packages/harness/src/tool-adapters.ts +20 -9
  849. package/packages/kernel/src/acl.ts +179 -0
  850. package/packages/kernel/src/approval-grant.ts +310 -0
  851. package/packages/kernel/src/capability-registry.ts +69 -2
  852. package/packages/kernel/src/data-class-registry.ts +354 -0
  853. package/packages/kernel/src/index.ts +85 -4
  854. package/packages/kernel/src/keyring.ts +208 -0
  855. package/packages/kernel/src/module-compatibility.ts +35 -4
  856. package/packages/kernel/src/module-registry.ts +49 -2
  857. package/packages/kernel/src/module-settings.ts +189 -27
  858. package/packages/server/package.json +2 -1
  859. package/packages/server/src/composition.ts +38 -0
  860. package/packages/server/src/endpoint.ts +104 -47
  861. package/packages/server/src/export/csv.ts +34 -0
  862. package/packages/server/src/export/definition.ts +346 -0
  863. package/packages/server/src/export/index.ts +61 -0
  864. package/packages/server/src/export/run.ts +116 -0
  865. package/packages/server/src/index.ts +155 -0
  866. package/packages/server/src/jobs/index.ts +93 -0
  867. package/packages/server/src/jobs/runner.ts +486 -0
  868. package/packages/server/src/log.ts +291 -0
  869. package/packages/server/src/mail/config.ts +184 -0
  870. package/packages/server/src/mail/contracts.ts +251 -0
  871. package/packages/server/src/mail/index.ts +31 -0
  872. package/packages/server/src/mail/port.ts +101 -0
  873. package/packages/server/src/mail/smtp.ts +191 -0
  874. package/packages/server/src/mail/template.ts +105 -0
  875. package/packages/server/src/metrics.ts +447 -0
  876. package/packages/server/src/pagination.ts +246 -0
  877. package/packages/server/src/trace/context.ts +103 -0
  878. package/packages/server/src/trace/egress.ts +66 -0
  879. package/packages/server/src/trace/error-sink.ts +296 -0
  880. package/packages/server/src/trace/exporter.ts +295 -0
  881. package/packages/server/src/trace/index.ts +60 -0
  882. package/packages/server/src/trace/job-sink.ts +172 -0
  883. package/packages/server/src/trace/tracer.ts +338 -0
  884. package/packages/server/src/web.ts +5 -1
  885. package/packages/storage/package.json +40 -0
  886. package/packages/storage/src/config.ts +189 -0
  887. package/packages/storage/src/content-type.ts +124 -0
  888. package/packages/storage/src/contracts.ts +112 -0
  889. package/packages/storage/src/envelope.ts +238 -0
  890. package/packages/storage/src/index.ts +49 -0
  891. package/packages/storage/src/local.ts +75 -0
  892. package/packages/storage/src/port.ts +262 -0
  893. package/packages/storage/src/read-token.ts +130 -0
  894. package/packages/storage/src/reseal.ts +128 -0
  895. package/packages/storage/src/s3.ts +144 -0
  896. package/packages/storage/src/scanner.ts +22 -0
  897. package/packages/storage/src/sigv4.ts +104 -0
  898. package/packages/storage/src/store.ts +13 -0
  899. package/packages/ui/package.json +1 -0
  900. package/packages/ui/src/components/Button.tsrx +3 -0
  901. package/packages/ui/src/components/ConfirmDialog.tsrx +13 -2
  902. package/packages/ui/src/components/DateField.tsrx +92 -0
  903. package/packages/ui/src/components/DatePicker.tsrx +525 -0
  904. package/packages/ui/src/components/DateRangeField.tsrx +93 -0
  905. package/packages/ui/src/components/Drawer.tsrx +10 -1
  906. package/packages/ui/src/components/FileUpload.tsrx +158 -0
  907. package/packages/ui/src/components/Pagination.tsrx +130 -0
  908. package/packages/ui/src/components/Select.tsrx +78 -0
  909. package/packages/ui/src/components/Table.tsrx +498 -81
  910. package/packages/ui/src/components/Tabs.tsrx +53 -0
  911. package/packages/ui/src/components/ToastHost.tsrx +48 -0
  912. package/packages/ui/src/components/calendar.ts +243 -0
  913. package/packages/ui/src/components/date-field.ts +62 -0
  914. package/packages/ui/src/components/file-upload.ts +49 -0
  915. package/packages/ui/src/components/focus-trap.ts +62 -0
  916. package/packages/ui/src/components/pagination.ts +68 -0
  917. package/packages/ui/src/components/table-sorting.ts +49 -0
  918. package/packages/ui/src/components/tabs.ts +61 -0
  919. package/packages/ui/src/components/toast-store.ts +116 -0
  920. package/packages/ui/src/icons/Icon.tsrx +5 -0
  921. package/packages/ui/src/index.ts +45 -0
  922. package/packages/ui/src/styles/components.css +598 -0
  923. package/modules/automations-workflows-integration/module.json +0 -27
  924. package/modules/automations-workflows-integration/spec/module.yaml +0 -93
  925. package/modules/automations-workflows-integration/src/index.ts +0 -14
  926. package/modules/automations-workflows-integration/src/platform.ts +0 -24
  927. package/modules/automations-workflows-integration/src/server/index.ts +0 -11
  928. package/modules/automations-workflows-integration/translations/en.json +0 -21
  929. package/modules/automations-workflows-integration/translations/pl.json +0 -21
  930. package/modules/workflows/src/services/cursor-codec.ts +0 -62
@@ -0,0 +1,809 @@
1
+ schemaVersion: 2
2
+ id: audit.core
3
+ specVersion: 0.2.8
4
+ status: approved
5
+ name: Audit and Data Lifecycle Core
6
+ description: Gives a workspace one place to see what data classes the platform holds, how long each is kept, and to take everything out, through a data class registry every module declares into, one retention sweep with tenant-scoped periods, and a per-tenant export in a documented format.
7
+ profile: full
8
+ capabilities:
9
+ - api
10
+ - database
11
+ - client
12
+ - translations
13
+ - cli
14
+ dependencies:
15
+ - id: system.core
16
+ range: ^0.7.0
17
+ - id: auth.core
18
+ range: ^0.13.0
19
+ provides:
20
+ - audit.erasure.v1
21
+ tenancy: required
22
+ locales:
23
+ - en
24
+ - pl
25
+ invariants:
26
+ - Persistence runs on the shared asynchronous database contract with explicit PostgreSQL SQL; every tenant table enables and forces row-level security with USING and WITH CHECK policies bound to the transaction-local tenant id, and the runtime role holds neither SUPERUSER nor BYPASSRLS.
27
+ - The data class registry is a platform registry handed to every module as context.dataClasses, created by the kernel and sealed by the platform after every composition ran, the same way agent definitions are; a module declares each class it owns with a stable id, a human label, the default retention in days or none, whether the class may be exported, and an owner port with two operations, sweep(tenantId, cutoff, limit) and export(tenantId, sink), executed by the owning module on its own tables. audit.core reads the sealed registry and never reads another module's database; auth.core declares its classes through the same registry handed to its runtime by the platform.
28
+ - A module that declares no classes is listed as holding none; a class declared without a sweep operation is never swept, and a class declared without an export operation is reported in the export manifest as excluded with the declared reason.
29
+ - Retention is a period in days per class per workspace, edited behind audit.retention.manage with the declared default as the initial value and none meaning kept until a person deletes; business records default to none.
30
+ - One retention sweep runs on a fixed platform interval, finds due workspaces and classes on the background role over routing columns alone, re-reads under the workspace, calls the owner sweep operation in bounded batches, and records an audit event naming the class, the cutoff and the count before each batch is removed; a sweep never runs for a class or workspace an active legal hold covers.
31
+ - The retention sweep and the export are refused while the deployment names no backup manifest, so a policy defect can never destroy data no backup holds; the check reads the manifest that database backup writes, named by FD_AUDIT_BACKUP_MANIFEST.
32
+ - An export runs per workspace under that workspace's transaction context so row-level security enforces the boundary, produces a ZIP archive with manifest.json (format version, workspace, generated time, classes, row counts, time ranges, exclusions with reasons, the platform version) and one JSON Lines file per class, decrypts sealed payloads it is allowed to decrypt into the export and excludes secrets and password hashes with a stated reason, and writes an audit event before it starts and when it completes.
33
+ - An export is requested by the operator CLI command, which records an export request for the workspace and waits for it; the running platform process, which holds the sealed registry, performs the export in its poll loop, writes the archive under the deployment's export directory FD_AUDIT_EXPORT_DIRECTORY with owner-only modes, and records the run; the CLI reports the archive path and digest. A workspace administrator sees the registry, the retention periods and the export history in the Administration screens, and requests an export from the UI only once file storage exists.
34
+ - The three background loops (the retention sweep, the export requests and the erasure requests) run on the platform job runner of @flowdular/server, one runner each because their intervals and routing pages differ; the runner owns the interval, the guard against overlapping passes, the bound on the work one pass takes, the isolation of one item from the next and the drain on stop, and audit.core keeps its routing reads, its claim statements with their stale windows, the backup and legal-hold guards, the 24 hour expiry of an unanswered erasure request and every outcome it records. A claimed export or erasure renews its claim on the runner's timer, fenced on the claim the pass holds, and a renewal that matches nothing stops the stage with CLAIM_LOST so the run settles nothing and is left to the process that took it over; the retention sweep claims nothing and is fenced by the sweep stamp its routing row carried.
35
+ - audit.core keeps its own hash-chained event trail per workspace, with a monotonic sequence, the previous hash and the event hash; the sequence the chain already carries is what a segment is cut on, so sealing adds no second ordering.
36
+ - Sealing closes one segment of one workspace's chain. audit seal reads every event after the last anchor's sequence up to the newest in sequence order and bounded pages, writes the segment into the operator directory as JSON Lines with the anchor as its first line, and records the same anchor in the database. The segment hash is a chain over the segment continuing from the previous anchor's hash; the anchor seals the last sequence, the segment hash, the row count, the time range and the previous anchor hash, and carries an HMAC-SHA256 signature under FD_AUDIT_ANCHOR_KEY, with FD_AUDIT_ANCHOR_KEY_PREVIOUS holding the keys a rotation has not finished retiring. Without --apply the command prints the plan and writes neither file nor row.
37
+ - audit verify reads the segment files of a directory, recomputes every event hash from the stored line, recomputes the segment chain from the previous anchor, checks each anchor signature under the keyring and checks that every anchor links to the anchor before it and to the anchors the workspace recorded. It names the first line and the first anchor that do not match rather than answering one boolean, and it reports how many events in the segment are plaintext rows written before 0.2.0.
38
+ - A verification is answerable to the anchors the workspace recorded, not only to the files that are still there. A directory may begin above anchor one, because an operator may verify one holding the newest segments alone; every recorded anchor at or above the oldest anchor the directory does hold must have a segment file, and one that does not fails the verification naming that anchor. A file carrying this workspace's segment name whose anchor names another workspace fails as well, because the name is what selected it to be read and a rewritten anchor is not a foreign file.
39
+ - One verification pass reads the newest 4096 segment files of the directory and the newest 4096 anchors of the workspace, so both windows are the same end of the chain, and the report states that window and whether it was reached. A deployment holding more segments than one window verifies the older ones in a directory of their own.
40
+ - audit secrets-rotate re-signs every anchor whose signature was made under a retired key with the current key. The anchor hash, the segment hash and the chain are untouched, so a re-signed anchor still verifies against segment files already written, and a second run finds nothing to do.
41
+ - A chain is aged only after it is sealed. The retention sweep of audit.core.events removes only events whose sequence is at or below the newest anchor of the workspace; when events older than the cutoff are not yet in a segment file the run is recorded refused with the stable reason SEGMENT_NOT_SEALED and nothing of them is removed, never passed over in silence. Erasure never removes an audit event.
42
+ - A legal hold is a workspace row naming a scope kind (account, workspace, data class or date range), optionally narrowed by an account, a class and a date range together, the reason it was placed, the account that placed it and, once lifted, the account that lifted it and why. Only a principal holding audit.holds.manage places or lifts one, through the API or the Holds screen, and each is written to the audit trail as an event of its own.
43
+ - The retention sweep and erasure refuse for anything an active hold covers, with the stable code HOLD_ACTIVE, and record the refusal. The sweep ledger names the class, the reason and the rows held back where audit.core owns the class and can count them, and leaves the count absent where only the owning module could. The kernel sweep input carries no row predicate, so a hold that names rows rather than a class withholds every class of that workspace it reaches; the over-approximation is deliberate, because a hold that withholds more than it covers is safe and one that withholds less is not, and the precise fix is a row predicate on the kernel sweep input.
44
+ - Erasure of one subject walks the sealed platform data class registry. A module declares the erase operation on the data class it owns, as two optional members of DataClassDeclaration beside sweep and export. erase({ tenantId, subject with its accountId, limit }) answers { removed, redacted?, truncated? }, where removed counts rows that are gone and redacted counts rows the owner kept but stripped of the subject, the run counts both as the batch's progress, an unreadable count ends the class as truncated, and the certificate carries both totals; count?({ tenantId, subject }) answers a number or none. Every class of the registry gets an outcome, and a class that declares no erase is named not-erasable rather than left out. The public capability audit.erasure.v1 stays as a thin adapter carrying the same two operations, for a module that composes after audit.core and prefers to register rather than declare; a declaration always wins over a registration for the same class.
45
+ - An erasure run writes an audit event before and after, runs each class inside the owning module's own transaction, is refused under a hold, and writes a JSON certificate naming the workspace, the subject, every class of the registry with its outcome and its count, the timestamps, the operator label and the newest anchor of the workspace into the operator directory. A class that reports truncated, or whose owner failed, leaves the certificate incomplete and the run recorded partial rather than completed. Without --apply the platform counts through every class and writes nothing but the request row, which expires after 24 hours when no platform answers it.
46
+ - A subject whose audit data key was destroyed never receives a second one. The key row keeps a subject marker that outlives the account it named, so the tombstone is findable after the account is gone; a later event about that subject is written under the marker, and a write that would create a new key for it is refused with SUBJECT_KEY_DESTROYED.
47
+ - Audit events are excluded from erasure on the documented basis that they are the evidence the data lifecycle of a workspace actually happened, and they are bounded by retention instead. From 0.2.0 an audit event that names a person seals the actor identifier, the subject identifier and the details under a per-subject data key held in audit_subject_keys, and the event hash covers the sealed bytes rather than the plaintext, so destroying that key with audit erase --destroy-key makes the fields unreadable for ever while the chain still verifies. Events written before 0.2.0 stay plaintext and verify reports them as such.
48
+ - The operator commands seal, verify, erase, secrets-rotate and holds are process risk, are a dry run without --apply, and run outside a workspace session, so they carry no workspace permission and an erasure that applies also needs --confirm erase-subject.
49
+ - The event hash covers every stored column of the row, including its identifier, the subject key it points at, whether it is sealed and the event format that wrote it, so no stored column can be edited without breaking the chain.
50
+ - An audit event is appended under the workspace's own advisory lock, taken inside the same transaction that reads the newest sequence, so concurrent writers of one workspace take consecutive sequences instead of racing for one and losing an event to the unique constraint. Workspaces never wait for each other.
51
+ - A stored event records the event format that wrote it. verify reports as plaintext only the events that carry no format, which are the ones written before audit.core sealed anything; an event about nobody is not reported as one.
52
+ - One operator directory holds the segments of every workspace. verify reads the files named after the workspace it was asked about, so another workspace's segments and any other file of the directory are never opened, and neither is failed on.
53
+ - audit secrets-rotate verifies the stored signature of an anchor under the keyring before re-signing it. An anchor on a key no ring holds, or one whose signature does not verify, is reported and left untouched, because a new signature would replace evidence with one this deployment vouches for. FD_AUDIT_ANCHOR_KEY_PREVIOUS holds at most the eight retired keys the kernel keyring accepts.
54
+ - A legal hold names the account it covers and the matter behind it, so listing, placing and lifting one all require audit.holds.manage; audit.registry.read alone is refused.
55
+ - audit.core keeps its own three classes for 400 days by default, the chain and both ledgers alike, so a workspace that sets no period still stops carrying them for ever. An export run the platform has not answered is never removed by age.
56
+ - Every tenant table audit.core owns is a declared class of the registry, so the catalogue a workspace reads is the deployment rather than the part of it that is swept. Beside the chain and the two ledgers it declares the legal holds, the erasure history, the chain anchors and the subject data keys. The four are kept until a person deletes them and carry no sweep and no erase, because a hold and an erasure record are the evidence a lifecycle decision was taken, and the anchors and the subject keys are the integrity material the chain is verified and the sealed events are read through. Holds and erasure history are exportable, the anchors and the subject keys are not and state that reason in the export manifest, and the erasure plan counts the holds naming the subject so the certificate says which evidence about them stays. The one tenant table that is not a class is the registry's own projection of the declarations.
57
+ - Reading the registry is a read. A workspace's catalogue rows are written when it holds none and when a composition changed a label, a default or the operations a class carries; a read that finds them current opens no write transaction, and the rows exist so the cross-workspace routing read of the sweep can find a class at all.
58
+ - Migrations 0003, 0004 and 0005 add their constraints inside DO blocks that read pg_constraint by name alone, which a same-named constraint on another schema of the search path would satisfy. Those files are applied and immutable, so the adoption probes, which live in code, prove every one of those constraints against the current schema and by definition where a later migration replaced one under the same name; a schema missing any of them is reported partial and refused rather than adopted.
59
+ permissions:
60
+ - id: audit.registry.read
61
+ description: Read the data class registry, the retention periods and the export history of the active workspace.
62
+ - id: audit.retention.manage
63
+ description: Change the retention period of a data class in the active workspace.
64
+ - id: audit.holds.manage
65
+ description: Place and lift the legal holds of the active workspace; owners only.
66
+ dataOwnership:
67
+ - audit.core owns the data class registry, the per-workspace retention periods, the sweep ledger, the export history, the erasure history, the chain anchors, the legal holds and the per-subject data keys.
68
+ - audit.core declares all of them it holds rows of as its own data classes, namely audit.core.events, audit.core.sweep-runs and audit.core.export-runs for 400 days, and audit.core.legal-holds, audit.core.erasure-runs, audit.core.anchors and audit.core.subject-keys kept until a person deletes them. The last two are excluded from the export as integrity material with the reason on the manifest; none of the seven declares an erase operation.
69
+ - Every declaring module owns the rows of its classes and performs the sweep and the export of them through its own port; auth.core, agents.core, workflows.core, automations.core and notifications.core declare their classes in the same delivery.
70
+ entities:
71
+ - id: data-class
72
+ name: Data class
73
+ description: One class a module declared, as the workspace sees it, with its retention period.
74
+ fields:
75
+ - id: classId
76
+ type: string
77
+ required: true
78
+ unique: tenant
79
+ maxLength: 96
80
+ description: module id plus class key, for example agents.core.runs.
81
+ - id: moduleId
82
+ type: string
83
+ required: true
84
+ maxLength: 64
85
+ - id: label
86
+ type: string
87
+ required: true
88
+ maxLength: 120
89
+ - id: exportable
90
+ type: boolean
91
+ required: true
92
+ - id: sweepable
93
+ type: boolean
94
+ required: true
95
+ - id: defaultRetentionDays
96
+ type: integer
97
+ required: false
98
+ - id: retentionDays
99
+ type: integer
100
+ required: false
101
+ description: The workspace's period; absent means the default, zero is refused, none means kept.
102
+ - id: lastSweptAt
103
+ type: datetime
104
+ required: false
105
+ - id: sweep-run
106
+ name: Sweep run
107
+ description: One retention pass over one class of one workspace.
108
+ fields:
109
+ - id: dataClass
110
+ type: reference
111
+ required: true
112
+ reference: data-class
113
+ - id: cutoff
114
+ type: datetime
115
+ required: true
116
+ - id: removed
117
+ type: integer
118
+ required: true
119
+ - id: status
120
+ type: enum
121
+ required: true
122
+ values:
123
+ - completed
124
+ - partial
125
+ - refused
126
+ - id: reason
127
+ type: string
128
+ required: false
129
+ maxLength: 64
130
+ - id: heldBack
131
+ type: integer
132
+ required: false
133
+ description: Rows an active hold withheld, where audit.core owns the class and can count them; absent when only the owning module could.
134
+ - id: occurredAt
135
+ type: datetime
136
+ required: true
137
+ - id: export-run
138
+ name: Export run
139
+ description: One per-workspace export as recorded in the workspace.
140
+ fields:
141
+ - id: formatVersion
142
+ type: string
143
+ required: true
144
+ maxLength: 16
145
+ - id: status
146
+ type: enum
147
+ required: true
148
+ values:
149
+ - started
150
+ - completed
151
+ - failed
152
+ - id: classes
153
+ type: integer
154
+ required: true
155
+ - id: rows
156
+ type: integer
157
+ required: true
158
+ - id: archiveDigest
159
+ type: string
160
+ required: false
161
+ maxLength: 64
162
+ - id: requestedBy
163
+ type: string
164
+ required: true
165
+ maxLength: 128
166
+ description: The operator label recorded by the CLI.
167
+ - id: reason
168
+ type: string
169
+ required: false
170
+ maxLength: 64
171
+ description: A stable reason when the run failed or was refused.
172
+ - id: dryRun
173
+ type: boolean
174
+ required: true
175
+ description: A plan; the platform counts through every owner and writes no archive.
176
+ - id: outputDirectory
177
+ type: string
178
+ required: false
179
+ maxLength: 512
180
+ description: What the operator asked for, inside FD_AUDIT_EXPORT_DIRECTORY; a deployment path, never the workspace's data.
181
+ - id: archivePath
182
+ type: string
183
+ required: false
184
+ maxLength: 512
185
+ - id: workspaceSlug
186
+ type: string
187
+ required: false
188
+ maxLength: 64
189
+ - id: workspaceName
190
+ type: string
191
+ required: false
192
+ maxLength: 200
193
+ - id: summary
194
+ type: json
195
+ required: false
196
+ description: Classes, counts, time ranges and exclusions, bounded, so the command and the screens read the outcome without opening the archive.
197
+ - id: claimedAt
198
+ type: datetime
199
+ required: false
200
+ description: The lease that keeps two platform processes from writing one archive twice.
201
+ - id: startedAt
202
+ type: datetime
203
+ required: true
204
+ - id: completedAt
205
+ type: datetime
206
+ required: false
207
+ - id: erasure-run
208
+ name: Erasure run
209
+ description: One erasure of one subject as the workspace records it; the operator command writes the request columns and the running platform the result ones.
210
+ fields:
211
+ - id: subject
212
+ type: string
213
+ required: false
214
+ maxLength: 64
215
+ description: The account to erase; kept while the run needs it and blanked when it finishes, so the history names nobody.
216
+ - id: subjectMarker
217
+ type: string
218
+ required: true
219
+ maxLength: 32
220
+ description: The hash the certificate file is named after and the subject key row keeps; it names nobody.
221
+ - id: status
222
+ type: enum
223
+ required: true
224
+ values:
225
+ - requested
226
+ - completed
227
+ - partial
228
+ - failed
229
+ - id: dryRun
230
+ type: boolean
231
+ required: true
232
+ - id: destroyKey
233
+ type: boolean
234
+ required: true
235
+ - id: requestedBy
236
+ type: string
237
+ required: true
238
+ maxLength: 128
239
+ - id: outputDirectory
240
+ type: string
241
+ required: false
242
+ maxLength: 512
243
+ - id: workspaceSlug
244
+ type: string
245
+ required: false
246
+ maxLength: 64
247
+ - id: workspaceName
248
+ type: string
249
+ required: false
250
+ maxLength: 200
251
+ - id: classes
252
+ type: integer
253
+ required: true
254
+ - id: rows
255
+ type: integer
256
+ required: true
257
+ - id: certificatePath
258
+ type: string
259
+ required: false
260
+ maxLength: 512
261
+ - id: outcome
262
+ type: json
263
+ required: false
264
+ description: Every class of the registry with its outcome, its count and whether it was truncated.
265
+ - id: reason
266
+ type: string
267
+ required: false
268
+ maxLength: 64
269
+ - id: claimedAt
270
+ type: datetime
271
+ required: false
272
+ - id: startedAt
273
+ type: datetime
274
+ required: true
275
+ - id: completedAt
276
+ type: datetime
277
+ required: false
278
+ - id: audit-event
279
+ name: Audit event
280
+ description: One hash-chained event of this module's own trail.
281
+ fields:
282
+ - id: sequence
283
+ type: integer
284
+ required: true
285
+ - id: action
286
+ type: string
287
+ required: true
288
+ maxLength: 64
289
+ - id: subject
290
+ type: string
291
+ required: true
292
+ maxLength: 200
293
+ - id: metadata
294
+ type: json
295
+ required: true
296
+ - id: previousHash
297
+ type: string
298
+ required: false
299
+ maxLength: 64
300
+ - id: eventHash
301
+ type: string
302
+ required: true
303
+ maxLength: 64
304
+ - id: sealed
305
+ type: boolean
306
+ required: true
307
+ description: True when the actor, the subject and the details are sealed under a per-subject data key.
308
+ - id: subjectKeyId
309
+ type: string
310
+ required: false
311
+ maxLength: 64
312
+ description: The subject key row that sealed this event; the account it belonged to is not stored on the event.
313
+ - id: sealFormat
314
+ type: string
315
+ required: false
316
+ maxLength: 32
317
+ description: The event format that wrote the row; absent for a row written before audit.core recorded one, which is what verify reports as plaintext.
318
+ - id: occurredAt
319
+ type: datetime
320
+ required: true
321
+ - id: chain-anchor
322
+ name: Chain anchor
323
+ description: One sealed segment of the workspace's audit event chain.
324
+ fields:
325
+ - id: anchorSequence
326
+ type: integer
327
+ required: true
328
+ unique: tenant
329
+ description: Position of the anchor in the workspace's anchor chain, from one.
330
+ - id: fromSequence
331
+ type: integer
332
+ required: true
333
+ - id: toSequence
334
+ type: integer
335
+ required: true
336
+ - id: rowCount
337
+ type: integer
338
+ required: true
339
+ - id: firstOccurredAt
340
+ type: datetime
341
+ required: true
342
+ - id: lastOccurredAt
343
+ type: datetime
344
+ required: true
345
+ - id: segmentHash
346
+ type: string
347
+ required: true
348
+ maxLength: 64
349
+ - id: previousAnchorHash
350
+ type: string
351
+ required: false
352
+ maxLength: 64
353
+ - id: anchorHash
354
+ type: string
355
+ required: true
356
+ maxLength: 64
357
+ - id: signature
358
+ type: string
359
+ required: true
360
+ maxLength: 128
361
+ description: HMAC-SHA256 of the anchor hash under the anchor key.
362
+ - id: keyId
363
+ type: string
364
+ required: true
365
+ maxLength: 32
366
+ - id: segmentFile
367
+ type: string
368
+ required: true
369
+ maxLength: 200
370
+ - id: sealedBy
371
+ type: string
372
+ required: true
373
+ maxLength: 128
374
+ - id: sealedAt
375
+ type: datetime
376
+ required: true
377
+ - id: legal-hold
378
+ name: Legal hold
379
+ description: One standing instruction not to remove the data it covers.
380
+ fields:
381
+ - id: scopeKind
382
+ type: enum
383
+ required: true
384
+ values:
385
+ - account
386
+ - workspace
387
+ - data-class
388
+ - date-range
389
+ - id: accountId
390
+ type: string
391
+ required: false
392
+ maxLength: 64
393
+ - id: classId
394
+ type: string
395
+ required: false
396
+ maxLength: 96
397
+ - id: fromAt
398
+ type: datetime
399
+ required: false
400
+ - id: toAt
401
+ type: datetime
402
+ required: false
403
+ - id: reason
404
+ type: string
405
+ required: true
406
+ maxLength: 400
407
+ - id: status
408
+ type: enum
409
+ required: true
410
+ values:
411
+ - active
412
+ - lifted
413
+ - id: placedBy
414
+ type: string
415
+ required: true
416
+ maxLength: 64
417
+ - id: placedAt
418
+ type: datetime
419
+ required: true
420
+ - id: liftedBy
421
+ type: string
422
+ required: false
423
+ maxLength: 64
424
+ - id: liftReason
425
+ type: string
426
+ required: false
427
+ maxLength: 400
428
+ - id: liftedAt
429
+ type: datetime
430
+ required: false
431
+ states:
432
+ field: status
433
+ values:
434
+ - active
435
+ - lifted
436
+ transitions:
437
+ - from: active
438
+ to: lifted
439
+ permission: audit.holds.manage
440
+ - id: subject-key
441
+ name: Subject key
442
+ description: The data key one subject's audit metadata is sealed under, and its destruction.
443
+ fields:
444
+ - id: subject
445
+ type: string
446
+ required: false
447
+ unique: tenant
448
+ maxLength: 64
449
+ description: The account the key belongs to; cleared with the material when the key is destroyed.
450
+ - id: subjectMarker
451
+ type: string
452
+ required: false
453
+ unique: tenant
454
+ maxLength: 32
455
+ description: The name the subject keeps once its key is gone, so a destroyed key is findable and the subject is never given a second one.
456
+ - id: keyState
457
+ type: enum
458
+ required: true
459
+ values:
460
+ - active
461
+ - destroyed
462
+ - id: sealedAt
463
+ type: datetime
464
+ required: true
465
+ - id: destroyedAt
466
+ type: datetime
467
+ required: false
468
+ screens:
469
+ - id: data-classes
470
+ kind: list
471
+ entity: data-class
472
+ title: Data classes
473
+ columns:
474
+ - classId
475
+ - moduleId
476
+ - label
477
+ - retentionDays
478
+ - defaultRetentionDays
479
+ - exportable
480
+ - lastSweptAt
481
+ filters:
482
+ - moduleId
483
+ navigationGroup: Administration
484
+ - id: sweeps
485
+ kind: list
486
+ entity: sweep-run
487
+ title: Retention sweeps
488
+ columns:
489
+ - occurredAt
490
+ - dataClass
491
+ - cutoff
492
+ - removed
493
+ - status
494
+ - reason
495
+ filters:
496
+ - status
497
+ navigationGroup: Administration
498
+ - id: exports
499
+ kind: list
500
+ entity: export-run
501
+ title: Exports
502
+ columns:
503
+ - startedAt
504
+ - status
505
+ - classes
506
+ - rows
507
+ - archiveDigest
508
+ - requestedBy
509
+ filters:
510
+ - status
511
+ navigationGroup: Administration
512
+ - id: holds
513
+ kind: list
514
+ entity: legal-hold
515
+ title: Legal holds
516
+ columns:
517
+ - placedAt
518
+ - scopeKind
519
+ - accountId
520
+ - classId
521
+ - reason
522
+ - placedBy
523
+ - status
524
+ filters:
525
+ - status
526
+ - scopeKind
527
+ navigationGroup: Administration
528
+ actions:
529
+ - id: set-retention
530
+ entity: data-class
531
+ permission: audit.retention.manage
532
+ kind: update
533
+ risk: workspace-write
534
+ idempotent: true
535
+ description: Set the workspace's retention period for a class in days, or none; refused for a class that cannot be swept and for zero.
536
+ - id: place-hold
537
+ entity: legal-hold
538
+ permission: audit.holds.manage
539
+ kind: create
540
+ risk: workspace-write
541
+ idempotent: false
542
+ description: Place a hold over an account, the workspace, a data class or a date range, with the reason it is placed; the scope fields the kind needs are required and the rest are optional narrowings.
543
+ - id: lift-hold
544
+ entity: legal-hold
545
+ permission: audit.holds.manage
546
+ kind: update
547
+ risk: workspace-write
548
+ idempotent: true
549
+ description: Lift an active hold with the reason it is lifted; lifting one that is already lifted changes nothing and answers the same row.
550
+ widgets: []
551
+ settings:
552
+ - key: sweepIntervalMinutes
553
+ type: integer
554
+ scope: platform
555
+ default: 60
556
+ description: How often the retention sweep looks for due classes; 5 to 1440.
557
+ - key: sweepBatchSize
558
+ type: integer
559
+ scope: platform
560
+ default: 500
561
+ description: Rows removed per owner call per class; 50 to 5000.
562
+ agentTools: []
563
+ outOfScope:
564
+ - Export requested from the UI and stored for download needs file storage (RFC 0002 G3); v1 exports through the operator CLI only.
565
+ - Data residency is a deployment property outside this module.
566
+ - Archiving a sealed segment to S3 or any other object store is out of scope; the operator writes segments into the deployment's own directory and the storage port may carry them later.
567
+ - Sealing, verification and erasure have no screen; they are operator commands, and the Holds screen is the only new surface a workspace administrator sees.
568
+ - A row-level hold predicate on the kernel sweep input is out of scope; a hold that names rows withholds the whole class of that workspace and the sweep ledger says so.
569
+ - Erasing a subject from a class whose declaration carries no erase operation is out of scope; the plan and the certificate name the class as not-erasable rather than pretending it was cleared.
570
+ - Cancelling a recorded erasure request from the command line is out of scope; a request no platform answered within 24 hours is recorded failed with ERASURE_REQUEST_EXPIRED instead.
571
+ - Restarting the retention sweep interval while the platform runs is out of scope; an edited cadence applies at the next start and the setting's description says so.
572
+ decisions:
573
+ - id: D-AUDIT-SCOPE
574
+ question: What is the first version of audit.core?
575
+ answer: The data class registry, tenant-scoped retention with one sweep, and the per-workspace export; archival, hold and erasure follow in the next specification.
576
+ decidedBy: user
577
+ - id: D-AUDIT-RETENTION-DEFAULTS
578
+ question: What are the default retention periods?
579
+ answer: Audit events 400 days, agent runs and workflow payloads 90 days, authentication events 180 days, business records none; each declared by the owning module and editable per workspace.
580
+ decidedBy: user
581
+ - id: D-AUDIT-EXPORT-FORMAT
582
+ question: What does an export look like?
583
+ answer: A ZIP archive with manifest.json and one JSON Lines file per class; sealed payloads decrypted where permitted, secrets and password hashes excluded with a reason.
584
+ decidedBy: user
585
+ - id: D-AUDIT-EXPORT-DELIVERY
586
+ question: How is an export produced?
587
+ answer: An operator CLI command writing to a directory outside the workspace, audited; UI download waits for file storage.
588
+ decidedBy: user
589
+ - id: D-AUDIT-REGISTRY
590
+ question: How do modules join the registry?
591
+ answer: Through the platform registry context.dataClasses at composition, sealed by the platform after every composition, each with its own sweep and export operations; audit.core reads no foreign table, and auth.core declares through the registry the platform hands its runtime.
592
+ decidedBy: default
593
+ - id: D-AUDIT-EXPORT-PROCESS
594
+ question: Which process performs the export?
595
+ answer: The running platform process, because only it holds the sealed registry with every owner port; the CLI records the request, waits and reports the archive.
596
+ decidedBy: default
597
+ - id: D-AUDIT-BACKUP-GUARD
598
+ question: May a sweep run before a backup exists?
599
+ answer: No; the sweep and the export refuse while the deployment has no backup manifest fingerprint, as RFC 0001 orders backup before retention.
600
+ decidedBy: default
601
+ - id: D-AUDIT-PERMISSIONS
602
+ question: Who sees and edits retention?
603
+ answer: Owners hold audit.registry.read and audit.retention.manage; members hold neither.
604
+ decidedBy: default
605
+ - id: D-AUDIT-SEAL
606
+ question: How is the audit event chain archived?
607
+ answer: flowdular audit seal closes the segment from the last anchor to the newest event, writes the rows as JSON Lines into the operator directory with the anchor as the first line of the file, and records the anchor in the database; flowdular audit verify checks a directory of segments and the anchor chain, and the dry run prints the plan.
608
+ decidedBy: user
609
+ - id: D-AUDIT-ANCHOR-KEY
610
+ question: What signs an anchor?
611
+ answer: HMAC-SHA256 under FD_AUDIT_ANCHOR_KEY, with FD_AUDIT_ANCHOR_KEY_PREVIOUS holding retired keys and flowdular audit secrets-rotate re-signing anchors under the current key.
612
+ decidedBy: user
613
+ - id: D-AUDIT-SEAL-ARCHIVE
614
+ question: Does sealing push segments to S3?
615
+ answer: No. The operator directory is the archive for now; the storage port may carry an S3 target later.
616
+ decidedBy: user
617
+ - id: D-AUDIT-SEALED-RETENTION
618
+ question: May retention remove an event that is not in a segment file?
619
+ answer: No. Sealed events stay readable in the database until retention removes them, and an unsealed event is refused with SEGMENT_NOT_SEALED rather than skipped in silence.
620
+ decidedBy: user
621
+ - id: D-AUDIT-HOLD-SCOPE
622
+ question: What may a legal hold cover?
623
+ answer: An account, the whole workspace, one data class or a date range, with an optional combination of account plus class plus range, each with the reason it was placed and the reason it was lifted.
624
+ decidedBy: user
625
+ - id: D-AUDIT-HOLD-PERMISSION
626
+ question: Who places and lifts a hold?
627
+ answer: Owners holding the new permission audit.holds.manage, through the API and the Holds screen in Administration; both acts are audited.
628
+ decidedBy: user
629
+ - id: D-AUDIT-HOLD-PREDICATE
630
+ question: How does a hold reach a module's sweep?
631
+ answer: It does not. audit.core filters at the registry boundary, skipping the classes and workspaces a hold covers and reporting them with HOLD_ACTIVE, because DataClassSweepInput belongs to the kernel and a per-row predicate would make every owning module reimplement hold semantics; a hold that names rows withholds the whole class, which is the safe direction.
632
+ decidedBy: user
633
+ - id: D-AUDIT-ERASURE-OPTION
634
+ question: How is erasure on request delivered?
635
+ answer: Option C now, with option B built into new audit writes. flowdular audit erase deletes the subject's records in every declaring class, and new audit events seal the subject-identifying fields under a per-subject key so a later key destruction is itself an erasure.
636
+ decidedBy: user
637
+ - id: D-AUDIT-ERASURE-PORT
638
+ question: Where does the erase operation live?
639
+ answer: On the platform data class declaration in packages/kernel, as the optional members erase and count beside sweep and export, so a module declares its classes and their erasure in one place and no composition order is involved. audit.erasure.v1 remains a thin adapter over the same two operations for a module that composes after audit.core; the declaration wins where both exist.
640
+ decidedBy: user
641
+ - id: D-AUDIT-ERASURE-EXCLUSION
642
+ question: Are audit events erased with the subject?
643
+ answer: No. They are the evidence the lifecycle happened, are bounded by retention, and their subject-identifying fields are sealed per subject so audit erase --destroy-key makes them unreadable while the chain still verifies.
644
+ decidedBy: user
645
+ - id: D-AUDIT-SEALING-SCOPE
646
+ question: What happens to events written before 0.2.0?
647
+ answer: They stay plaintext and are reported as plaintext by verify; only new writes are sealed, because rewriting a stored row would break every hash after it.
648
+ decidedBy: user
649
+ - id: D-AUDIT-CLI-RISK
650
+ question: How are the new operator commands gated?
651
+ answer: seal, verify, erase, secrets-rotate and holds are operator-only, risk process, a dry run without --apply, and erase also needs --confirm erase-subject.
652
+ decidedBy: user
653
+ acceptanceScenarios:
654
+ - id: AUDIT-REGISTRY-DECLARE
655
+ given: auth.core, agents.core, workflows.core, automations.core and notifications.core compose after audit.core.
656
+ when: A principal holding audit.registry.read lists the data classes.
657
+ then: Every declared class appears with its module, label, default retention, exportability and the workspace period, and a module that declared nothing is listed as holding none.
658
+ - id: AUDIT-RETENTION-SET
659
+ given: A class with a default of 90 days.
660
+ when: A principal holding audit.retention.manage sets 30 days, then none, then zero.
661
+ then: The first two are persisted and audited, the third is refused with a stable error, and a member without the permission is refused before repository access.
662
+ - id: AUDIT-SWEEP
663
+ given: Two workspaces with rows older and newer than their periods in a sweepable class, and a backup manifest present.
664
+ when: The sweep runs.
665
+ then: Only rows older than each workspace's cutoff are removed by the owner module in bounded batches, an audit event precedes each batch, the sweep ledger records the counts per workspace and class, and the other workspace's rows are untouched.
666
+ - id: AUDIT-SWEEP-NO-BACKUP
667
+ given: No backup manifest fingerprint for the deployment.
668
+ when: The sweep or the export runs.
669
+ then: Both are refused with a stable reason recorded in the ledger and nothing is removed or written.
670
+ - id: AUDIT-EXPORT
671
+ given: A workspace with rows in every exportable class and a sealed payload in one of them, and a running platform with an export directory configured.
672
+ when: The operator runs the export command with --apply and the platform loop picks the request up.
673
+ then: A ZIP with manifest.json and one JSON Lines file per class is written under the export directory with owner-only modes, the manifest lists classes, counts, time ranges and exclusions with reasons, the sealed payload appears decrypted and no secret or password hash appears, the export history shows the run with the archive digest, and rows of other workspaces are absent.
674
+ - id: AUDIT-EXPORT-DRY-RUN
675
+ given: A workspace with exportable rows.
676
+ when: The operator runs the export command without --apply.
677
+ then: The plan lists the classes and counts and nothing is written.
678
+ - id: AUDIT-DENY
679
+ given: A principal is unauthenticated or lacks the required permission.
680
+ when: The principal reads the registry or changes a period.
681
+ then: The server denies the operation before repository access, and a mutation without a CSRF proof is refused first.
682
+ - id: AUDIT-TENANT-BOUNDARY
683
+ given: Two workspaces with periods, sweep runs and export runs.
684
+ when: A runtime transaction bound to one workspace reads or writes any of them, or the cross-tenant sweep routing read runs.
685
+ then: Only that workspace's rows are visible or mutable, the routing read sees routing columns alone on the background role, and a row carrying another tenant identifier is rejected by the forced policy.
686
+ - id: AUDIT-SEAL-CHAIN
687
+ given: A workspace whose chain was sealed once and has written more events since.
688
+ when: The operator runs audit seal with --apply a second time into the same directory.
689
+ then: A second segment file holds exactly the events after the first anchor's sequence, its anchor names the first anchor's hash as its previous hash, both anchors are recorded in the workspace, and audit verify over the directory accepts both segments and the chain between them.
690
+ - id: AUDIT-SEAL-TAMPER
691
+ given: A sealed segment file.
692
+ when: One line of the file is edited and audit verify runs over the directory.
693
+ then: Verification fails naming that line, the segment hash mismatch and the anchor it belongs to, and nothing in the workspace is changed.
694
+ - id: AUDIT-SEAL-DRY-RUN
695
+ given: A workspace with unsealed events.
696
+ when: The operator runs audit seal without --apply.
697
+ then: The plan names the sequence range, the row count and the file that would be written, no file exists and no anchor is recorded.
698
+ - id: AUDIT-SEAL-ROTATE
699
+ given: Anchors signed under a key that is now in FD_AUDIT_ANCHOR_KEY_PREVIOUS.
700
+ when: The operator runs audit secrets-rotate with --apply and then verify.
701
+ then: Every anchor carries the current key id and a signature that verifies, the anchor hashes and segment hashes are unchanged, the segment files still verify, and a second run reports nothing stale.
702
+ - id: AUDIT-SWEEP-SEALED
703
+ given: A workspace whose audit events are older than the period and whose newest events are not in any segment file.
704
+ when: The retention sweep runs over audit.core.events.
705
+ then: Only events at or below the newest anchor's sequence are removed, the run is recorded with the stable reason SEGMENT_NOT_SEALED, and no unsealed event is removed.
706
+ - id: AUDIT-HOLD-PLACE
707
+ given: A principal holding audit.holds.manage.
708
+ when: The principal places a hold over one account with a reason and later lifts it with a reason.
709
+ then: Both rows are persisted with who acted and why, both are written to the audit trail as their own events, and a principal without the permission is refused before repository access.
710
+ - id: AUDIT-HOLD-BLOCKS-SWEEP
711
+ given: An active hold covering one data class of a workspace and rows older than the period in it.
712
+ when: The retention sweep runs.
713
+ then: The owner sweep is never called, the ledger records the class refused with HOLD_ACTIVE and the rows held back where audit.core can count them, the other workspace is swept normally, and lifting the hold lets the next pass remove the rows.
714
+ - id: AUDIT-HOLD-BLOCKS-ERASE
715
+ given: An active hold covering the subject of an erasure request.
716
+ when: The operator runs audit erase, with and without --apply.
717
+ then: Both are refused with HOLD_ACTIVE naming the hold, no class erase operation is called, and no certificate is written.
718
+ - id: AUDIT-ERASE-DRY-RUN
719
+ given: A workspace with the subject's records in a declaring class.
720
+ when: The operator runs audit erase without --apply.
721
+ then: The plan lists every module and class with the count it would erase, or states that a class cannot be counted, nothing is removed and no certificate is written.
722
+ - id: AUDIT-ERASE-APPLY
723
+ given: The same workspace and a declaring class that registered an erase operation.
724
+ when: The operator runs audit erase with --apply and --confirm erase-subject.
725
+ then: The subject's rows are gone from that class, an audit event is written before and after, a JSON certificate naming the workspace, the subject, the classes, the counts, the operator and the newest anchor is written to the output directory, and the rows of another workspace and another subject are untouched.
726
+ - id: AUDIT-ERASE-KEY-DESTROYED
727
+ given: Audit events sealed under one subject's data key.
728
+ when: The operator runs audit erase with --destroy-key and --apply, and audit verify runs afterwards.
729
+ then: The actor, the subject and the details of those events read as redacted and can never be opened again, the key row records the destruction and names no account, and verification of the chain and of every sealed segment still passes.
730
+ - id: AUDIT-DENY-HOLDS
731
+ given: A principal is unauthenticated, or holds only audit.registry.read.
732
+ when: The principal lists, places or lifts a hold.
733
+ then: The server denies before repository access, 401 without an identity and 403 without audit.holds.manage on the list as well as on both mutations, the registry, sweep and export reads still answer 200 for that principal, and a mutation without a CSRF proof is refused first.
734
+ - id: AUDIT-TENANT-BOUNDARY-0-2
735
+ given: Two workspaces with holds, anchors and subject keys.
736
+ when: A runtime transaction bound to one workspace reads or writes any of them.
737
+ then: Only that workspace's rows are visible or mutable, and a row carrying another tenant identifier is rejected by the forced policy.
738
+ - id: AUDIT-ERASE-NOT-ERASABLE
739
+ given: A composed module declaring a data class with no erase operation.
740
+ when: The operator runs audit erase with and without --apply.
741
+ then: The plan and the certificate name that class with the outcome not-erasable and no count of its own, the certificate totals say how many classes could not be erased, and the classes that can be erased are unaffected.
742
+ - id: AUDIT-ERASE-PARTIAL
743
+ given: A declaring class whose erase answers truncated, so rows of the subject are left.
744
+ when: The operator runs audit erase with --apply.
745
+ then: The class outcome carries truncated, the certificate is marked incomplete and the run is recorded partial rather than completed.
746
+ - id: AUDIT-ERASE-KEY-TOMBSTONE
747
+ given: A subject whose audit data key an earlier run destroyed.
748
+ when: The operator runs audit erase for the same subject again.
749
+ then: The workspace still holds exactly one key row for that subject, it is the tombstone and names no account, the events of the second run name the subject by its marker, and nothing in the trail reads back as the account.
750
+ - id: AUDIT-ERASE-REQUEST-EXPIRES
751
+ given: An erasure request recorded more than 24 hours ago that no platform answered.
752
+ when: The erasure loop takes its next pass.
753
+ then: The run is recorded failed with ERASURE_REQUEST_EXPIRED, no class erase operation is called, and a request inside the window is performed normally.
754
+ - id: AUDIT-SEAL-SHARED-DIRECTORY
755
+ given: Two workspaces sealed into one operator directory.
756
+ when: audit verify runs for each of them.
757
+ then: Each verification reads its own workspace's segments, accepts them, and neither fails on the other workspace's anchors.
758
+ - id: AUDIT-SEAL-EVENT-FORMAT
759
+ given: A segment holding events this build wrote and one written before audit.core recorded an event format.
760
+ when: audit verify runs over the directory.
761
+ then: Verification passes and reports exactly the one event with no format as plaintext; the events about nobody are not reported.
762
+ - id: AUDIT-SEAL-TAMPER-SEALED
763
+ given: A sealed segment whose sealed line is repointed at another subject key.
764
+ when: audit verify runs over the directory.
765
+ then: Verification fails naming that line and its hash mismatch.
766
+ - id: AUDIT-SEAL-ROTATE-UNVERIFIED
767
+ given: An anchor whose stored signature does not verify under the keyring, or whose key is in no ring.
768
+ when: The operator runs audit secrets-rotate with --apply.
769
+ then: The anchor is reported and not re-signed, its stored signature and key id are unchanged, and the command warns naming the anchor.
770
+ - id: AUDIT-CHAIN-CONCURRENT-APPEND
771
+ given: Several writers appending audit events to one workspace at the same time.
772
+ when: The appends run concurrently.
773
+ then: Every append is recorded with its own consecutive sequence and its own previous hash, none is lost to the unique constraint, and another workspace appends at the same time without waiting.
774
+ - id: AUDIT-LEDGER-RETENTION
775
+ given: Sweep runs and export runs older than 400 days in one workspace and newer ones beside them.
776
+ when: The retention sweep runs over audit.core.sweep-runs and audit.core.export-runs.
777
+ then: Only the older rows are removed, an export run the platform has not answered stays whatever its age, and another workspace's rows are untouched.
778
+ - id: AUDIT-EXPORT-DIRECTORY-LINK
779
+ given: A symbolic link inside FD_AUDIT_EXPORT_DIRECTORY pointing outside it.
780
+ when: An operator command asks to write through that link.
781
+ then: The request is refused with EXPORT_OUTPUT_NOT_ALLOWED, and a link that stays inside the allowed directory is accepted.
782
+ - id: AUDIT-MIGRATION-ADOPTION
783
+ given: A schema that predates the ledger, one missing a column or an index migration 0004 adds, and a ledger entry whose checksum drifted.
784
+ when: The migration runner inspects and applies.
785
+ then: The complete schema is adopted without changing its rows, the incomplete one is reported partial and refused with PARTIAL_MIGRATION, the drifted entry is refused with CHECKSUM_MISMATCH, a dry run writes nothing, and a same-named table in another schema never satisfies an adoption probe.
786
+ - id: AUDIT-SEAL-SEGMENT-MISSING
787
+ given: A workspace whose directory has lost its newest segment file, and one whose oldest segment was rewritten to name another workspace.
788
+ when: audit verify runs over the directory.
789
+ then: Both fail; the first names the recorded anchor the directory holds no segment for, the second names the file and the workspace its anchor claims, and the segments that are still this workspace's own still verify.
790
+ - id: AUDIT-SEAL-VERIFY-WINDOW
791
+ given: A directory holding more segment files of one workspace than a verification pass reads.
792
+ when: audit verify runs over it.
793
+ then: The pass reads the newest files and the newest anchors, accepts them, and the report states the window it read and that more was sealed before it.
794
+ - id: AUDIT-EVENT-HASH-PREIMAGE
795
+ given: A stored audit event of a workspace, sealed under a subject key.
796
+ when: A digest is built independently over the thirteen stored fields in the documented order.
797
+ then: It equals the event hash the row carries, so a field added to, removed from or reordered in the preimage is a change the chain refuses.
798
+ - id: AUDIT-OWN-CLASS-CATALOGUE
799
+ given: A workspace holding a legal hold, an erasure run, chain anchors and subject keys.
800
+ when: The workspace reads the registry and the classes audit.core owns are exported.
801
+ then: Every tenant table audit.core owns is a declared class, the holds and the erasure history export with one workspace's rows alone, the anchors and the subject keys are reported excluded with their reason, and an erasure plan counts the holds naming the subject and erases none of them.
802
+ - id: AUDIT-REGISTRY-READ-ONLY
803
+ given: A workspace that has read the registry once already.
804
+ when: It reads GET /api/audit/data-classes again.
805
+ then: The response carries the same catalogue and the request opens no write transaction; a workspace that holds no rows yet is written once so the sweep can find its classes.
806
+ - id: AUDIT-MIGRATION-CONSTRAINT-PROBE
807
+ given: A schema that lost a constraint migration 0005 adds, and one whose status constraint is still the narrower one migration 0004 created under the same name.
808
+ when: The migration runner inspects for adoption.
809
+ then: Both are reported partial and refused with PARTIAL_MIGRATION rather than adopted, and a complete schema is adopted unchanged.