@flowdular/sdk 0.2.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (912) 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 +100 -0
  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/deploy-operate/SKILL.md +114 -0
  30. package/.ai/skills/module-new/SKILL.md +29 -3
  31. package/.ai/skills/module-update/SKILL.md +9 -3
  32. package/.ai/skills/perf-audit/SKILL.md +0 -1
  33. package/.ai/skills/release-eject-pr/SKILL.md +0 -1
  34. package/.ai/skills/spec-interview/SKILL.md +120 -0
  35. package/.ai/skills/test-hardening/SKILL.md +1 -0
  36. package/.ai/skills/ux-design/SKILL.md +34 -3
  37. package/.ai/skills/variables/SKILL.md +0 -2
  38. package/.ai/skills/workflow-development/SKILL.md +0 -1
  39. package/AGENTS.md +4 -0
  40. package/docs/agent-contract.md +2 -2
  41. package/docs/design-system.md +185 -31
  42. package/modules/access/migrations/0001_access_core.down.sql +1 -0
  43. package/modules/access/migrations/0001_access_core.up.sql +28 -0
  44. package/modules/access/migrations/README.md +3 -0
  45. package/modules/access/module.json +33 -0
  46. package/modules/access/package.json +43 -0
  47. package/modules/access/spec/module.yaml +225 -0
  48. package/modules/access/src/acl/permissions.ts +6 -0
  49. package/modules/access/src/api/endpoints.ts +244 -0
  50. package/modules/access/src/client/ActivityView.tsrx +245 -0
  51. package/modules/access/src/client/AttestationsView.tsrx +176 -0
  52. package/modules/access/src/client/ReviewView.tsrx +586 -0
  53. package/modules/access/src/client/api.ts +132 -0
  54. package/modules/access/src/client/contribution.tsrx +41 -0
  55. package/modules/access/src/client/index.ts +41 -0
  56. package/modules/access/src/client/navigation.ts +57 -0
  57. package/modules/access/src/client/presentation.ts +69 -0
  58. package/modules/access/src/client/state.ts +72 -0
  59. package/modules/access/src/domain/types.ts +189 -0
  60. package/modules/access/src/index.ts +38 -0
  61. package/modules/access/src/platform.ts +60 -0
  62. package/modules/access/src/server/index.ts +42 -0
  63. package/modules/access/src/server/runtime.ts +105 -0
  64. package/modules/access/src/services/access-service.ts +298 -0
  65. package/modules/access/src/services/audit-window.ts +78 -0
  66. package/modules/access/src/services/auth-directory.ts +72 -0
  67. package/modules/access/src/services/changes.ts +91 -0
  68. package/modules/access/src/services/data-classes.ts +28 -0
  69. package/modules/access/src/services/database-repository.ts +185 -0
  70. package/modules/access/src/services/directory.ts +102 -0
  71. package/modules/access/src/services/index.ts +33 -0
  72. package/modules/access/src/services/list-exports.ts +150 -0
  73. package/modules/access/src/services/migration.ts +54 -0
  74. package/modules/access/src/services/repository.ts +30 -0
  75. package/modules/access/src/services/review.ts +178 -0
  76. package/modules/access/translations/en.json +155 -0
  77. package/modules/access/translations/pl.json +155 -0
  78. package/modules/agents/migrations/0022_credential_rotation_inventory.down.sql +2 -0
  79. package/modules/agents/migrations/0022_credential_rotation_inventory.up.sql +7 -0
  80. package/modules/agents/migrations/0023_agents_retention_indexes.down.sql +2 -0
  81. package/modules/agents/migrations/0023_agents_retention_indexes.up.sql +9 -0
  82. package/modules/agents/migrations/0024_agent_meter_refusals.down.sql +3 -0
  83. package/modules/agents/migrations/0024_agent_meter_refusals.up.sql +22 -0
  84. package/modules/agents/migrations/0025_agent_list_indexes.down.sql +3 -0
  85. package/modules/agents/migrations/0025_agent_list_indexes.up.sql +11 -0
  86. package/modules/agents/module.json +30 -4
  87. package/modules/agents/package.json +3 -2
  88. package/modules/agents/spec/module.yaml +63 -5
  89. package/modules/agents/src/api/endpoints.ts +291 -33
  90. package/modules/agents/src/cli/commands.json +11 -0
  91. package/modules/agents/src/cli/index.ts +45 -0
  92. package/modules/agents/src/client/AgentDashboardWidget.tsrx +19 -11
  93. package/modules/agents/src/client/AgentDefinitionList.tsrx +53 -10
  94. package/modules/agents/src/client/AgentPlaygroundView.tsrx +4 -4
  95. package/modules/agents/src/client/AgentProceduresView.tsrx +2 -2
  96. package/modules/agents/src/client/AgentRunsView.tsrx +143 -40
  97. package/modules/agents/src/client/AgentsView.tsrx +109 -33
  98. package/modules/agents/src/client/api.ts +99 -21
  99. package/modules/agents/src/client/state.ts +97 -0
  100. package/modules/agents/src/domain/types.ts +44 -4
  101. package/modules/agents/src/platform.ts +42 -0
  102. package/modules/agents/src/server/action-execution.ts +201 -106
  103. package/modules/agents/src/server/runtime.ts +32 -0
  104. package/modules/agents/src/services/agent-service.ts +158 -30
  105. package/modules/agents/src/services/credential-rotation.ts +185 -0
  106. package/modules/agents/src/services/credential-vault.ts +71 -46
  107. package/modules/agents/src/services/data-classes.ts +176 -0
  108. package/modules/agents/src/services/database-repository.ts +393 -101
  109. package/modules/agents/src/services/metering.ts +111 -0
  110. package/modules/agents/src/services/migration.ts +109 -0
  111. package/modules/agents/src/services/module-agent-preflight.ts +17 -9
  112. package/modules/agents/src/services/notifications.ts +98 -0
  113. package/modules/agents/src/services/provider-repository.ts +9 -18
  114. package/modules/agents/src/services/provider-service.ts +1 -9
  115. package/modules/agents/src/services/reports.ts +107 -0
  116. package/modules/agents/src/services/repository.ts +86 -6
  117. package/modules/agents/src/services/usage-service.ts +2 -0
  118. package/modules/agents/src/services/worker.ts +114 -4
  119. package/modules/agents/src/settings.ts +14 -3
  120. package/modules/agents/translations/en.json +14 -4
  121. package/modules/agents/translations/pl.json +14 -4
  122. package/modules/approvals/migrations/0001_approvals_core.down.sql +3 -0
  123. package/modules/approvals/migrations/0001_approvals_core.up.sql +78 -0
  124. package/modules/approvals/migrations/0002_approvals_expiry_routing_role.down.sql +2 -0
  125. package/modules/approvals/migrations/0002_approvals_expiry_routing_role.up.sql +19 -0
  126. package/modules/approvals/migrations/0003_approvals_retention_indexes.down.sql +6 -0
  127. package/modules/approvals/migrations/0003_approvals_retention_indexes.up.sql +14 -0
  128. package/modules/approvals/migrations/0004_approvals_inbox_keyset_indexes.down.sql +5 -0
  129. package/modules/approvals/migrations/0004_approvals_inbox_keyset_indexes.up.sql +12 -0
  130. package/modules/approvals/migrations/README.md +3 -0
  131. package/modules/approvals/module.json +34 -0
  132. package/modules/approvals/package.json +43 -0
  133. package/modules/approvals/spec/module.yaml +318 -0
  134. package/modules/approvals/src/acl/permissions.ts +7 -0
  135. package/modules/approvals/src/api/endpoints.ts +457 -0
  136. package/modules/approvals/src/client/ApprovalRequestDrawer.tsrx +138 -0
  137. package/modules/approvals/src/client/ApprovalsView.tsrx +562 -0
  138. package/modules/approvals/src/client/PendingCountWidget.tsrx +52 -0
  139. package/modules/approvals/src/client/api.ts +203 -0
  140. package/modules/approvals/src/client/approvals.css +51 -0
  141. package/modules/approvals/src/client/contribution.tsrx +44 -0
  142. package/modules/approvals/src/client/index.ts +26 -0
  143. package/modules/approvals/src/client/navigation.ts +39 -0
  144. package/modules/approvals/src/client/pending-count.ts +26 -0
  145. package/modules/approvals/src/client/presentation.ts +52 -0
  146. package/modules/approvals/src/client/state.ts +141 -0
  147. package/modules/approvals/src/domain/capability.ts +95 -0
  148. package/modules/approvals/src/domain/types.ts +154 -0
  149. package/modules/approvals/src/index.ts +52 -0
  150. package/modules/approvals/src/platform.ts +128 -0
  151. package/modules/approvals/src/server/index.ts +42 -0
  152. package/modules/approvals/src/server/runtime.ts +181 -0
  153. package/modules/approvals/src/services/approvals-service.ts +557 -0
  154. package/modules/approvals/src/services/callbacks.ts +75 -0
  155. package/modules/approvals/src/services/data-classes.ts +167 -0
  156. package/modules/approvals/src/services/database-repository.ts +724 -0
  157. package/modules/approvals/src/services/eligibility.ts +121 -0
  158. package/modules/approvals/src/services/expiry-runner.ts +81 -0
  159. package/modules/approvals/src/services/index.ts +31 -0
  160. package/modules/approvals/src/services/migration.ts +222 -0
  161. package/modules/approvals/src/services/notifications.ts +95 -0
  162. package/modules/approvals/src/services/repository.ts +161 -0
  163. package/modules/approvals/src/services/service-error.ts +70 -0
  164. package/modules/approvals/src/settings.ts +102 -0
  165. package/modules/approvals/translations/en.json +104 -0
  166. package/modules/approvals/translations/pl.json +104 -0
  167. package/modules/audit/migrations/0001_audit_core.down.sql +8 -0
  168. package/modules/audit/migrations/0001_audit_core.up.sql +107 -0
  169. package/modules/audit/migrations/0002_audit_sweep_routing_role.down.sql +2 -0
  170. package/modules/audit/migrations/0002_audit_sweep_routing_role.up.sql +21 -0
  171. package/modules/audit/migrations/0003_audit_export_request.down.sql +12 -0
  172. package/modules/audit/migrations/0003_audit_export_request.up.sql +40 -0
  173. package/modules/audit/migrations/0004_audit_hold_seal_erasure.down.sql +17 -0
  174. package/modules/audit/migrations/0004_audit_hold_seal_erasure.up.sql +192 -0
  175. package/modules/audit/migrations/0005_audit_event_format.down.sql +17 -0
  176. package/modules/audit/migrations/0005_audit_event_format.up.sql +60 -0
  177. package/modules/audit/migrations/0006_audit_own_class_walks.down.sql +3 -0
  178. package/modules/audit/migrations/0006_audit_own_class_walks.up.sql +14 -0
  179. package/modules/audit/migrations/README.md +3 -0
  180. package/modules/audit/module.json +32 -0
  181. package/modules/audit/package.json +49 -0
  182. package/modules/audit/spec/module.yaml +809 -0
  183. package/modules/audit/src/acl/permissions.ts +7 -0
  184. package/modules/audit/src/api/endpoints.ts +315 -0
  185. package/modules/audit/src/cli/commands.json +95 -0
  186. package/modules/audit/src/cli/index.ts +658 -0
  187. package/modules/audit/src/client/DataClassesView.tsrx +420 -0
  188. package/modules/audit/src/client/ExportsView.tsrx +256 -0
  189. package/modules/audit/src/client/HoldsView.tsrx +604 -0
  190. package/modules/audit/src/client/SweepsView.tsrx +251 -0
  191. package/modules/audit/src/client/api.ts +185 -0
  192. package/modules/audit/src/client/contribution.tsrx +52 -0
  193. package/modules/audit/src/client/index.ts +23 -0
  194. package/modules/audit/src/client/navigation.ts +74 -0
  195. package/modules/audit/src/client/presentation.ts +105 -0
  196. package/modules/audit/src/client/state.ts +86 -0
  197. package/modules/audit/src/domain/data-classes.ts +16 -0
  198. package/modules/audit/src/domain/types.ts +339 -0
  199. package/modules/audit/src/index.ts +76 -0
  200. package/modules/audit/src/platform.ts +44 -0
  201. package/modules/audit/src/server/index.ts +177 -0
  202. package/modules/audit/src/server/runtime.ts +303 -0
  203. package/modules/audit/src/services/anchor-key.ts +143 -0
  204. package/modules/audit/src/services/anchor-rotation.ts +147 -0
  205. package/modules/audit/src/services/audit-runners.ts +278 -0
  206. package/modules/audit/src/services/backup-guard.ts +95 -0
  207. package/modules/audit/src/services/database-repository.ts +1946 -0
  208. package/modules/audit/src/services/declared-classes.ts +64 -0
  209. package/modules/audit/src/services/erasure-port.ts +126 -0
  210. package/modules/audit/src/services/erasure-service.ts +770 -0
  211. package/modules/audit/src/services/export-directory.ts +106 -0
  212. package/modules/audit/src/services/export-service.ts +714 -0
  213. package/modules/audit/src/services/hold-service.ts +295 -0
  214. package/modules/audit/src/services/index.ts +17 -0
  215. package/modules/audit/src/services/migration.ts +658 -0
  216. package/modules/audit/src/services/own-classes.ts +318 -0
  217. package/modules/audit/src/services/platform-version.ts +23 -0
  218. package/modules/audit/src/services/repository.ts +495 -0
  219. package/modules/audit/src/services/retention-service.ts +191 -0
  220. package/modules/audit/src/services/seal-service.ts +769 -0
  221. package/modules/audit/src/services/service-error.ts +61 -0
  222. package/modules/audit/src/services/subject-keys.ts +90 -0
  223. package/modules/audit/src/services/sweep-service.ts +298 -0
  224. package/modules/audit/src/services/zip.ts +217 -0
  225. package/modules/audit/src/settings.ts +69 -0
  226. package/modules/audit/translations/en.json +210 -0
  227. package/modules/audit/translations/pl.json +210 -0
  228. package/modules/auth/README.md +77 -29
  229. package/modules/auth/migrations/0016_external_identities.up.sql +16 -0
  230. package/modules/auth/migrations/0017_mfa_key_id.up.sql +8 -0
  231. package/modules/auth/migrations/0018_retire_bundled_module_scopes.up.sql +29 -0
  232. package/modules/auth/migrations/0019_notifications_member_scopes.up.sql +44 -0
  233. package/modules/auth/migrations/0020_identity_providers.up.sql +61 -0
  234. package/modules/auth/migrations/0021_membership_status.up.sql +19 -0
  235. package/modules/auth/migrations/0022_auth_provider_scopes.up.sql +45 -0
  236. package/modules/auth/migrations/0023_enterprise_module_scopes.down.sql +19 -0
  237. package/modules/auth/migrations/0023_enterprise_module_scopes.up.sql +71 -0
  238. package/modules/auth/migrations/0024_approvals_member_scopes.down.sql +22 -0
  239. package/modules/auth/migrations/0024_approvals_member_scopes.up.sql +48 -0
  240. package/modules/auth/migrations/0025_audit_holds_owner_scope.down.sql +21 -0
  241. package/modules/auth/migrations/0025_audit_holds_owner_scope.up.sql +47 -0
  242. package/modules/auth/migrations/0026_auth_export_keyset_indexes.down.sql +6 -0
  243. package/modules/auth/migrations/0026_auth_export_keyset_indexes.up.sql +15 -0
  244. package/modules/auth/migrations/0027_workflow_automation_profile_scopes.down.sql +34 -0
  245. package/modules/auth/migrations/0027_workflow_automation_profile_scopes.up.sql +72 -0
  246. package/modules/auth/migrations/0028_auth_member_search_prefix_indexes.down.sql +6 -0
  247. package/modules/auth/migrations/0028_auth_member_search_prefix_indexes.up.sql +21 -0
  248. package/modules/auth/migrations/0029_reports_exports_access_scopes.down.sql +22 -0
  249. package/modules/auth/migrations/0029_reports_exports_access_scopes.up.sql +56 -0
  250. package/modules/auth/migrations/0030_auth_membership_keyset_index.down.sql +4 -0
  251. package/modules/auth/migrations/0030_auth_membership_keyset_index.up.sql +10 -0
  252. package/modules/auth/migrations/0031_membership_scope_backfills_under_rls.down.sql +4 -0
  253. package/modules/auth/migrations/0031_membership_scope_backfills_under_rls.up.sql +31 -0
  254. package/modules/auth/migrations/0032_audit_actor_service.down.sql +9 -0
  255. package/modules/auth/migrations/0032_audit_actor_service.up.sql +10 -0
  256. package/modules/auth/migrations/0033_auth_account_keyset_indexes.down.sql +5 -0
  257. package/modules/auth/migrations/0033_auth_account_keyset_indexes.up.sql +23 -0
  258. package/modules/auth/module.json +3 -3
  259. package/modules/auth/package.json +3 -2
  260. package/modules/auth/spec/module.yaml +372 -3
  261. package/modules/auth/src/acl/scopes.ts +50 -6
  262. package/modules/auth/src/cli/commands.json +11 -0
  263. package/modules/auth/src/cli/greenfield.ts +2 -2
  264. package/modules/auth/src/cli/index.ts +14 -0
  265. package/modules/auth/src/cli/secrets.ts +114 -0
  266. package/modules/auth/src/client/AuthenticationCore.tsrx +61 -8
  267. package/modules/auth/src/client/api.ts +72 -6
  268. package/modules/auth/src/client/contribution.tsrx +23 -0
  269. package/modules/auth/src/client/index.ts +6 -0
  270. package/modules/auth/src/client/providers/IdentityProviderForm.tsrx +191 -0
  271. package/modules/auth/src/client/providers/IdentityProvidersView.tsrx +358 -0
  272. package/modules/auth/src/client/providers/api.ts +128 -0
  273. package/modules/auth/src/client/providers/provider-columns.tsrx +60 -0
  274. package/modules/auth/src/client/providers/state.ts +35 -0
  275. package/modules/auth/src/client/security/SecurityView.tsrx +9 -1
  276. package/modules/auth/src/client/state.ts +15 -1
  277. package/modules/auth/src/domain/types.ts +55 -0
  278. package/modules/auth/src/index.ts +11 -1
  279. package/modules/auth/src/middleware/authentication.ts +4 -0
  280. package/modules/auth/src/server/endpoints.ts +467 -171
  281. package/modules/auth/src/server/http.ts +3 -2
  282. package/modules/auth/src/server/index.ts +22 -1
  283. package/modules/auth/src/server/membership-endpoints.ts +62 -0
  284. package/modules/auth/src/server/mfa-enforcement.ts +156 -0
  285. package/modules/auth/src/server/oidc.ts +389 -0
  286. package/modules/auth/src/server/provider-endpoints.ts +246 -0
  287. package/modules/auth/src/server/provider-host.ts +77 -0
  288. package/modules/auth/src/server/runtime.ts +231 -55
  289. package/modules/auth/src/services/auth-service-error.ts +7 -2
  290. package/modules/auth/src/services/auth-service.ts +948 -51
  291. package/modules/auth/src/services/data-classes.ts +236 -0
  292. package/modules/auth/src/services/database-repository.ts +853 -71
  293. package/modules/auth/src/services/identity-provider-service.ts +571 -0
  294. package/modules/auth/src/services/mail-delivery.ts +16 -16
  295. package/modules/auth/src/services/mail-message.ts +54 -0
  296. package/modules/auth/src/services/mail-port.ts +24 -0
  297. package/modules/auth/src/services/mail-smtp.ts +85 -0
  298. package/modules/auth/src/services/mfa-rotation.ts +144 -0
  299. package/modules/auth/src/services/migration.ts +810 -0
  300. package/modules/auth/src/services/password.ts +14 -0
  301. package/modules/auth/src/services/provider-secret-rotation.ts +169 -0
  302. package/modules/auth/src/services/provider-secrets.ts +136 -0
  303. package/modules/auth/src/services/repository.ts +321 -5
  304. package/modules/auth/src/services/session-sweep-runner.ts +73 -0
  305. package/modules/auth/src/services/settings-store.ts +10 -83
  306. package/modules/auth/src/services/totp.ts +88 -62
  307. package/modules/auth/src/services/validation.ts +194 -7
  308. package/modules/auth/src/settings.ts +18 -0
  309. package/modules/auth/translations/en.json +84 -1
  310. package/modules/auth/translations/pl.json +84 -1
  311. package/modules/automations/migrations/0005_secret_rotation_inventory.down.sql +1 -0
  312. package/modules/automations/migrations/0005_secret_rotation_inventory.up.sql +6 -0
  313. package/modules/automations/migrations/0006_automations_list_sort_indexes.down.sql +4 -0
  314. package/modules/automations/migrations/0006_automations_list_sort_indexes.up.sql +11 -0
  315. package/modules/automations/module.json +24 -6
  316. package/modules/automations/package.json +5 -2
  317. package/modules/automations/spec/module.yaml +81 -7
  318. package/modules/automations/src/api/endpoints.ts +202 -28
  319. package/modules/automations/src/cli/commands.json +17 -0
  320. package/modules/automations/src/cli/index.ts +114 -0
  321. package/modules/automations/src/client/AutomationScheduleForm.tsrx +77 -19
  322. package/modules/automations/src/client/AutomationSchedulesView.tsrx +144 -40
  323. package/modules/automations/src/client/AutomationTriggersView.tsrx +131 -32
  324. package/modules/automations/src/client/api.ts +62 -19
  325. package/modules/automations/src/client/presentation.ts +20 -2
  326. package/modules/automations/src/client/state.ts +84 -0
  327. package/modules/automations/src/domain/cadence.ts +99 -3
  328. package/modules/automations/src/domain/cron.ts +366 -0
  329. package/modules/automations/src/domain/time-zone.ts +61 -0
  330. package/modules/automations/src/platform.ts +38 -4
  331. package/modules/automations/src/server/index.ts +11 -0
  332. package/modules/automations/src/server/runtime.ts +46 -22
  333. package/modules/{automations-workflows-integration/src/server/adapter.ts → automations/src/server/workflow-target.ts} +13 -14
  334. package/modules/{automations-workflows-integration/src/server/tools.ts → automations/src/server/workflow-tools.ts} +0 -0
  335. package/modules/automations/src/services/data-classes.ts +62 -0
  336. package/modules/automations/src/services/database-repository.ts +152 -38
  337. package/modules/automations/src/services/migration.ts +119 -9
  338. package/modules/automations/src/services/repository.ts +52 -1
  339. package/modules/automations/src/services/schedule-runner.ts +84 -0
  340. package/modules/automations/src/services/schedule-service.ts +152 -26
  341. package/modules/automations/src/services/secret-rotation.ts +176 -0
  342. package/modules/automations/src/services/secret-vault.ts +68 -41
  343. package/modules/automations/src/services/trigger-service.ts +13 -10
  344. package/modules/automations/translations/en.json +15 -2
  345. package/modules/automations/translations/pl.json +15 -2
  346. package/modules/connectors/migrations/0001_connectors_core.down.sql +3 -0
  347. package/modules/connectors/migrations/0001_connectors_core.up.sql +72 -0
  348. package/modules/connectors/migrations/0002_connectors_call_keys.down.sql +3 -0
  349. package/modules/connectors/migrations/0002_connectors_call_keys.up.sql +18 -0
  350. package/modules/connectors/migrations/README.md +3 -0
  351. package/modules/connectors/module.json +28 -0
  352. package/modules/{automations-workflows-integration → connectors}/package.json +27 -26
  353. package/modules/connectors/spec/module.yaml +447 -0
  354. package/modules/connectors/src/acl/permissions.ts +6 -0
  355. package/modules/connectors/src/agent/tools.ts +180 -0
  356. package/modules/connectors/src/api/endpoints.ts +572 -0
  357. package/modules/connectors/src/client/ConnectorCallsView.tsrx +358 -0
  358. package/modules/connectors/src/client/ConnectorForm.tsrx +424 -0
  359. package/modules/connectors/src/client/ConnectorsView.tsrx +711 -0
  360. package/modules/connectors/src/client/api.ts +281 -0
  361. package/modules/connectors/src/client/consent.ts +48 -0
  362. package/modules/connectors/src/client/contribution.tsrx +37 -0
  363. package/modules/connectors/src/client/index.ts +22 -0
  364. package/modules/connectors/src/client/navigation.ts +42 -0
  365. package/modules/connectors/src/client/presentation.ts +38 -0
  366. package/modules/connectors/src/client/state.ts +175 -0
  367. package/modules/connectors/src/domain/calls.ts +70 -0
  368. package/modules/connectors/src/domain/definitions.ts +190 -0
  369. package/modules/connectors/src/domain/http-json.ts +68 -0
  370. package/modules/connectors/src/domain/types.ts +185 -0
  371. package/modules/connectors/src/index.ts +64 -0
  372. package/modules/connectors/src/platform.ts +56 -0
  373. package/modules/connectors/src/server/index.ts +66 -0
  374. package/modules/connectors/src/server/runtime.ts +163 -0
  375. package/modules/connectors/src/services/call-service.ts +903 -0
  376. package/modules/connectors/src/services/connectors-service.ts +653 -0
  377. package/modules/connectors/src/services/credential-vault.ts +188 -0
  378. package/modules/connectors/src/services/data-classes.ts +158 -0
  379. package/modules/connectors/src/services/database-repository.ts +897 -0
  380. package/modules/connectors/src/services/egress.ts +261 -0
  381. package/modules/connectors/src/services/index.ts +19 -0
  382. package/modules/connectors/src/services/migration.ts +166 -0
  383. package/modules/connectors/src/services/repository.ts +175 -0
  384. package/modules/connectors/src/services/service-error.ts +46 -0
  385. package/modules/connectors/src/settings.ts +69 -0
  386. package/modules/connectors/translations/en.json +191 -0
  387. package/modules/connectors/translations/pl.json +191 -0
  388. package/modules/directory/migrations/0001_directory_core.down.sql +5 -0
  389. package/modules/directory/migrations/0001_directory_core.up.sql +111 -0
  390. package/modules/directory/migrations/README.md +3 -0
  391. package/modules/directory/module.json +27 -0
  392. package/modules/directory/package.json +46 -0
  393. package/modules/directory/spec/module.yaml +351 -0
  394. package/modules/directory/src/acl/permissions.ts +7 -0
  395. package/modules/directory/src/api/endpoints.ts +478 -0
  396. package/modules/directory/src/api/scim-endpoints.ts +516 -0
  397. package/modules/directory/src/client/GroupMappingsView.tsrx +430 -0
  398. package/modules/directory/src/client/ProvisioningLogView.tsrx +248 -0
  399. package/modules/directory/src/client/ScimTokensView.tsrx +587 -0
  400. package/modules/directory/src/client/api.ts +222 -0
  401. package/modules/directory/src/client/contribution.tsrx +46 -0
  402. package/modules/directory/src/client/index.ts +22 -0
  403. package/modules/directory/src/client/navigation.ts +57 -0
  404. package/modules/directory/src/client/presentation.ts +143 -0
  405. package/modules/directory/src/client/state.ts +173 -0
  406. package/modules/directory/src/domain/scim.ts +346 -0
  407. package/modules/directory/src/domain/types.ts +166 -0
  408. package/modules/directory/src/index.ts +44 -0
  409. package/modules/directory/src/platform.ts +43 -0
  410. package/modules/directory/src/server/index.ts +17 -0
  411. package/modules/directory/src/server/runtime.ts +124 -0
  412. package/modules/directory/src/services/auth-port.ts +127 -0
  413. package/modules/directory/src/services/data-classes.ts +41 -0
  414. package/modules/directory/src/services/database-repository.ts +1067 -0
  415. package/modules/directory/src/services/directory-service.ts +311 -0
  416. package/modules/directory/src/services/index.ts +43 -0
  417. package/modules/directory/src/services/migration.ts +146 -0
  418. package/modules/directory/src/services/provisioning-service.ts +1420 -0
  419. package/modules/directory/src/services/rate-limiter.ts +103 -0
  420. package/modules/directory/src/services/repository.ts +208 -0
  421. package/modules/directory/src/services/service-error.ts +42 -0
  422. package/modules/directory/src/services/token-service.ts +215 -0
  423. package/modules/directory/src/settings.ts +86 -0
  424. package/modules/directory/translations/en.json +185 -0
  425. package/modules/directory/translations/pl.json +185 -0
  426. package/modules/documents/migrations/0001_documents_core.down.sql +1 -0
  427. package/modules/documents/migrations/0001_documents_core.up.sql +35 -0
  428. package/modules/documents/migrations/0002_documents_files_page.down.sql +1 -0
  429. package/modules/documents/migrations/0002_documents_files_page.up.sql +6 -0
  430. package/modules/documents/migrations/README.md +3 -0
  431. package/modules/documents/module.json +28 -0
  432. package/modules/documents/package.json +49 -0
  433. package/modules/documents/spec/module.yaml +247 -0
  434. package/modules/documents/src/acl/permissions.ts +6 -0
  435. package/modules/documents/src/api/endpoints.ts +401 -0
  436. package/modules/documents/src/client/DocumentUploader.tsrx +148 -0
  437. package/modules/documents/src/client/DocumentsView.tsrx +540 -0
  438. package/modules/documents/src/client/api.ts +209 -0
  439. package/modules/documents/src/client/contribution.tsrx +29 -0
  440. package/modules/documents/src/client/download.ts +70 -0
  441. package/modules/documents/src/client/index.ts +22 -0
  442. package/modules/documents/src/client/navigation.ts +25 -0
  443. package/modules/documents/src/client/presentation.ts +110 -0
  444. package/modules/documents/src/client/state.ts +117 -0
  445. package/modules/documents/src/domain/attachments.ts +84 -0
  446. package/modules/documents/src/domain/types.ts +80 -0
  447. package/modules/documents/src/index.ts +46 -0
  448. package/modules/documents/src/platform.ts +61 -0
  449. package/modules/documents/src/server/index.ts +30 -0
  450. package/modules/documents/src/server/runtime.ts +107 -0
  451. package/modules/documents/src/services/attachments.ts +39 -0
  452. package/modules/documents/src/services/data-classes.ts +25 -0
  453. package/modules/documents/src/services/database-repository.ts +259 -0
  454. package/modules/documents/src/services/documents-service.ts +586 -0
  455. package/modules/documents/src/services/index.ts +18 -0
  456. package/modules/documents/src/services/migration.ts +82 -0
  457. package/modules/documents/src/services/repository.ts +48 -0
  458. package/modules/documents/src/settings.ts +107 -0
  459. package/modules/documents/translations/en.json +111 -0
  460. package/modules/documents/translations/pl.json +111 -0
  461. package/modules/exports/migrations/0001_exports_core.down.sql +2 -0
  462. package/modules/exports/migrations/0001_exports_core.up.sql +28 -0
  463. package/modules/exports/migrations/0002_exports_job_routing_role.down.sql +4 -0
  464. package/modules/exports/migrations/0002_exports_job_routing_role.up.sql +21 -0
  465. package/modules/exports/migrations/README.md +3 -0
  466. package/modules/exports/module.json +28 -0
  467. package/modules/exports/package.json +44 -0
  468. package/modules/exports/spec/module.yaml +229 -0
  469. package/modules/exports/src/acl/permissions.ts +6 -0
  470. package/modules/exports/src/api/endpoints.ts +211 -0
  471. package/modules/exports/src/client/ExportsView.tsrx +327 -0
  472. package/modules/exports/src/client/api.ts +133 -0
  473. package/modules/exports/src/client/contribution.tsrx +31 -0
  474. package/modules/exports/src/client/index.ts +20 -0
  475. package/modules/exports/src/client/navigation.ts +25 -0
  476. package/modules/exports/src/client/presentation.ts +53 -0
  477. package/modules/exports/src/client/state.ts +56 -0
  478. package/modules/exports/src/domain/lists.ts +29 -0
  479. package/modules/exports/src/domain/types.ts +120 -0
  480. package/modules/exports/src/index.ts +41 -0
  481. package/modules/exports/src/platform.ts +80 -0
  482. package/modules/exports/src/server/index.ts +51 -0
  483. package/modules/exports/src/server/runtime.ts +160 -0
  484. package/modules/exports/src/services/data-classes.ts +56 -0
  485. package/modules/exports/src/services/database-repository.ts +405 -0
  486. package/modules/exports/src/services/export-runner.ts +123 -0
  487. package/modules/exports/src/services/export-service.ts +356 -0
  488. package/modules/exports/src/services/index.ts +6 -0
  489. package/modules/exports/src/services/list-registry.ts +105 -0
  490. package/modules/exports/src/services/migration.ts +89 -0
  491. package/modules/exports/src/services/repository.ts +97 -0
  492. package/modules/exports/src/settings.ts +70 -0
  493. package/modules/exports/translations/en.json +69 -0
  494. package/modules/exports/translations/pl.json +69 -0
  495. package/modules/import/migrations/0001_import_core.down.sql +6 -0
  496. package/modules/import/migrations/0001_import_core.up.sql +61 -0
  497. package/modules/import/migrations/0002_import_job_routing_role.down.sql +4 -0
  498. package/modules/import/migrations/0002_import_job_routing_role.up.sql +20 -0
  499. package/modules/import/migrations/0003_import_jobs_export_index.down.sql +1 -0
  500. package/modules/import/migrations/0003_import_jobs_export_index.up.sql +7 -0
  501. package/modules/import/migrations/0004_import_jobs_traceparent.down.sql +1 -0
  502. package/modules/import/migrations/0004_import_jobs_traceparent.up.sql +7 -0
  503. package/modules/import/migrations/README.md +3 -0
  504. package/modules/import/module.json +37 -0
  505. package/modules/import/package.json +50 -0
  506. package/modules/import/spec/module.yaml +335 -0
  507. package/modules/import/src/acl/permissions.ts +6 -0
  508. package/modules/import/src/api/endpoints.ts +400 -0
  509. package/modules/import/src/client/ImportJobDrawer.tsrx +229 -0
  510. package/modules/import/src/client/ImportsView.tsrx +455 -0
  511. package/modules/import/src/client/NewImportForm.tsrx +274 -0
  512. package/modules/import/src/client/api.ts +243 -0
  513. package/modules/import/src/client/contribution.tsrx +29 -0
  514. package/modules/import/src/client/index.ts +23 -0
  515. package/modules/import/src/client/navigation.ts +25 -0
  516. package/modules/import/src/client/presentation.ts +59 -0
  517. package/modules/import/src/client/state.ts +43 -0
  518. package/modules/import/src/domain/csv.ts +258 -0
  519. package/modules/import/src/domain/ports.ts +157 -0
  520. package/modules/import/src/domain/types.ts +179 -0
  521. package/modules/import/src/index.ts +58 -0
  522. package/modules/import/src/platform.ts +60 -0
  523. package/modules/import/src/server/index.ts +49 -0
  524. package/modules/import/src/server/runtime.ts +158 -0
  525. package/modules/import/src/services/csv-source.ts +121 -0
  526. package/modules/import/src/services/data-classes.ts +63 -0
  527. package/modules/import/src/services/database-repository.ts +780 -0
  528. package/modules/import/src/services/import-runner.ts +127 -0
  529. package/modules/import/src/services/import-service.ts +872 -0
  530. package/modules/import/src/services/index.ts +6 -0
  531. package/modules/import/src/services/migration.ts +156 -0
  532. package/modules/import/src/services/port-registry.ts +158 -0
  533. package/modules/import/src/services/repository.ts +147 -0
  534. package/modules/import/src/settings.ts +70 -0
  535. package/modules/import/translations/en.json +175 -0
  536. package/modules/import/translations/pl.json +175 -0
  537. package/modules/metering/migrations/0001_metering_core.down.sql +6 -0
  538. package/modules/metering/migrations/0001_metering_core.up.sql +119 -0
  539. package/modules/metering/migrations/0002_metering_bucket_export.down.sql +3 -0
  540. package/modules/metering/migrations/0002_metering_bucket_export.up.sql +5 -0
  541. package/modules/metering/migrations/README.md +3 -0
  542. package/modules/metering/module.json +46 -0
  543. package/modules/metering/package.json +50 -0
  544. package/modules/metering/spec/module.yaml +269 -0
  545. package/modules/metering/src/acl/permissions.ts +5 -0
  546. package/modules/metering/src/api/endpoints.ts +104 -0
  547. package/modules/metering/src/cli/commands.json +28 -0
  548. package/modules/metering/src/cli/index.ts +246 -0
  549. package/modules/metering/src/client/LimitsView.tsrx +170 -0
  550. package/modules/metering/src/client/UsageSummaryWidget.tsrx +63 -0
  551. package/modules/metering/src/client/UsageView.tsrx +205 -0
  552. package/modules/metering/src/client/api.ts +91 -0
  553. package/modules/metering/src/client/contribution.tsrx +42 -0
  554. package/modules/metering/src/client/index.ts +26 -0
  555. package/modules/metering/src/client/navigation.ts +54 -0
  556. package/modules/metering/src/client/presentation.ts +63 -0
  557. package/modules/metering/src/client/state.ts +31 -0
  558. package/modules/metering/src/domain/meters.ts +100 -0
  559. package/modules/metering/src/domain/types.ts +71 -0
  560. package/modules/metering/src/index.ts +51 -0
  561. package/modules/metering/src/platform.ts +84 -0
  562. package/modules/metering/src/server/index.ts +40 -0
  563. package/modules/metering/src/server/runtime.ts +165 -0
  564. package/modules/metering/src/services/data-classes.ts +34 -0
  565. package/modules/metering/src/services/database-repository.ts +574 -0
  566. package/modules/metering/src/services/index.ts +9 -0
  567. package/modules/metering/src/services/meter-registry.ts +145 -0
  568. package/modules/metering/src/services/metering-service.ts +441 -0
  569. package/modules/metering/src/services/migration.ts +183 -0
  570. package/modules/metering/src/services/notifications.ts +75 -0
  571. package/modules/metering/src/services/reports.ts +105 -0
  572. package/modules/metering/src/services/repository.ts +132 -0
  573. package/modules/metering/src/services/service-error.ts +46 -0
  574. package/modules/metering/src/settings.ts +47 -0
  575. package/modules/metering/translations/en.json +68 -0
  576. package/modules/metering/translations/pl.json +68 -0
  577. package/modules/notifications/migrations/0001_notifications_core.down.sql +1 -0
  578. package/modules/notifications/migrations/0001_notifications_core.up.sql +26 -0
  579. package/modules/notifications/migrations/0002_notifications_preferences.down.sql +1 -0
  580. package/modules/notifications/migrations/0002_notifications_preferences.up.sql +17 -0
  581. package/modules/notifications/migrations/0003_notifications_webhook_subscriptions.down.sql +1 -0
  582. package/modules/notifications/migrations/0003_notifications_webhook_subscriptions.up.sql +30 -0
  583. package/modules/notifications/migrations/0004_notifications_deliveries.down.sql +1 -0
  584. package/modules/notifications/migrations/0004_notifications_deliveries.up.sql +35 -0
  585. package/modules/notifications/migrations/0005_notifications_delivery_routing_role.down.sql +2 -0
  586. package/modules/notifications/migrations/0005_notifications_delivery_routing_role.up.sql +17 -0
  587. package/modules/notifications/migrations/0006_notifications_delivery_title.down.sql +1 -0
  588. package/modules/notifications/migrations/0006_notifications_delivery_title.up.sql +11 -0
  589. package/modules/notifications/migrations/0007_notifications_secret_rotation_inventory.down.sql +2 -0
  590. package/modules/notifications/migrations/0007_notifications_secret_rotation_inventory.up.sql +19 -0
  591. package/modules/notifications/migrations/0008_notifications_delivery_claim.down.sql +8 -0
  592. package/modules/notifications/migrations/0008_notifications_delivery_claim.up.sql +19 -0
  593. package/modules/notifications/migrations/0009_notifications_kind_approvals.down.sql +16 -0
  594. package/modules/notifications/migrations/0009_notifications_kind_approvals.up.sql +18 -0
  595. package/modules/notifications/migrations/0010_notifications_kind_meter_threshold.down.sql +16 -0
  596. package/modules/notifications/migrations/0010_notifications_kind_meter_threshold.up.sql +18 -0
  597. package/modules/notifications/migrations/0011_notifications_retention_keyset.down.sql +5 -0
  598. package/modules/notifications/migrations/0011_notifications_retention_keyset.up.sql +15 -0
  599. package/modules/notifications/migrations/0012_notifications_email_channel.down.sql +12 -0
  600. package/modules/notifications/migrations/0012_notifications_email_channel.up.sql +38 -0
  601. package/modules/notifications/migrations/0013_notifications_list_pages.down.sql +5 -0
  602. package/modules/notifications/migrations/0013_notifications_list_pages.up.sql +13 -0
  603. package/modules/notifications/migrations/README.md +3 -0
  604. package/modules/notifications/module.json +32 -0
  605. package/modules/notifications/package.json +49 -0
  606. package/modules/notifications/spec/module.yaml +718 -0
  607. package/modules/notifications/src/acl/permissions.ts +11 -0
  608. package/modules/notifications/src/api/endpoints.ts +814 -0
  609. package/modules/notifications/src/cli/commands.json +17 -0
  610. package/modules/notifications/src/cli/index.ts +126 -0
  611. package/modules/notifications/src/client/DeliveriesView.tsrx +483 -0
  612. package/modules/notifications/src/client/FactList.tsrx +24 -0
  613. package/modules/notifications/src/client/NotificationPreferencesView.tsrx +240 -0
  614. package/modules/notifications/src/client/NotificationsInboxView.tsrx +592 -0
  615. package/modules/notifications/src/client/UnreadCountWidget.tsrx +62 -0
  616. package/modules/notifications/src/client/WebhookForm.tsrx +297 -0
  617. package/modules/notifications/src/client/WebhooksView.tsrx +637 -0
  618. package/modules/notifications/src/client/api.ts +382 -0
  619. package/modules/notifications/src/client/contribution.tsrx +83 -0
  620. package/modules/notifications/src/client/inbox.ts +41 -0
  621. package/modules/notifications/src/client/index.ts +29 -0
  622. package/modules/notifications/src/client/navigation.ts +92 -0
  623. package/modules/notifications/src/client/notifications.css +70 -0
  624. package/modules/notifications/src/client/presentation.ts +81 -0
  625. package/modules/notifications/src/client/state.ts +246 -0
  626. package/modules/notifications/src/client/unread-count.ts +26 -0
  627. package/modules/notifications/src/domain/locale.ts +47 -0
  628. package/modules/notifications/src/domain/publish.ts +46 -0
  629. package/modules/notifications/src/domain/types.ts +186 -0
  630. package/modules/notifications/src/index.ts +62 -0
  631. package/modules/notifications/src/platform.ts +85 -0
  632. package/modules/notifications/src/server/index.ts +82 -0
  633. package/modules/notifications/src/server/runtime.ts +251 -0
  634. package/modules/notifications/src/services/data-classes.ts +139 -0
  635. package/modules/notifications/src/services/database-repository.ts +1334 -0
  636. package/modules/notifications/src/services/delivery-payload.ts +93 -0
  637. package/modules/notifications/src/services/delivery-runner.ts +170 -0
  638. package/modules/notifications/src/services/delivery-service.ts +811 -0
  639. package/modules/notifications/src/services/egress.ts +239 -0
  640. package/modules/notifications/src/services/email-channel.ts +93 -0
  641. package/modules/notifications/src/services/index.ts +23 -0
  642. package/modules/notifications/src/services/migration.ts +572 -0
  643. package/modules/notifications/src/services/notifications-service.ts +297 -0
  644. package/modules/notifications/src/services/paging.ts +60 -0
  645. package/modules/notifications/src/services/publish-service.ts +133 -0
  646. package/modules/notifications/src/services/repository.ts +342 -0
  647. package/modules/notifications/src/services/secret-rotation.ts +177 -0
  648. package/modules/notifications/src/services/secret-vault.ts +168 -0
  649. package/modules/notifications/src/services/service-error.ts +67 -0
  650. package/modules/notifications/src/services/signature.ts +81 -0
  651. package/modules/notifications/src/services/webhook-service.ts +307 -0
  652. package/modules/notifications/src/settings.ts +130 -0
  653. package/modules/notifications/translations/en.json +255 -0
  654. package/modules/notifications/translations/pl.json +255 -0
  655. package/modules/profile/module.json +3 -3
  656. package/modules/profile/package.json +2 -2
  657. package/modules/profile/spec/module.yaml +3 -3
  658. package/modules/profile/src/services/database-repository.ts +3 -13
  659. package/modules/reports/module.json +28 -0
  660. package/modules/reports/package.json +42 -0
  661. package/modules/reports/spec/module.yaml +231 -0
  662. package/modules/reports/src/acl/permissions.ts +5 -0
  663. package/modules/reports/src/api/endpoints.ts +72 -0
  664. package/modules/reports/src/client/ReportsSummaryWidget.tsrx +52 -0
  665. package/modules/reports/src/client/ReportsView.tsrx +246 -0
  666. package/modules/reports/src/client/api.ts +65 -0
  667. package/modules/reports/src/client/contribution.tsrx +36 -0
  668. package/modules/reports/src/client/index.ts +18 -0
  669. package/modules/reports/src/client/navigation.ts +39 -0
  670. package/modules/reports/src/client/presentation.ts +123 -0
  671. package/modules/reports/src/client/state.ts +28 -0
  672. package/modules/reports/src/domain/providers.ts +115 -0
  673. package/modules/reports/src/domain/types.ts +44 -0
  674. package/modules/reports/src/index.ts +47 -0
  675. package/modules/reports/src/platform.ts +37 -0
  676. package/modules/reports/src/server/index.ts +21 -0
  677. package/modules/reports/src/server/runtime.ts +40 -0
  678. package/modules/reports/src/services/index.ts +17 -0
  679. package/modules/reports/src/services/provider-registry.ts +144 -0
  680. package/modules/reports/src/services/range.ts +65 -0
  681. package/modules/reports/src/services/reports-service.ts +316 -0
  682. package/modules/reports/src/services/service-error.ts +26 -0
  683. package/modules/reports/src/settings.ts +49 -0
  684. package/modules/reports/translations/en.json +35 -0
  685. package/modules/reports/translations/pl.json +35 -0
  686. package/modules/sandbox/module.json +4 -4
  687. package/modules/sandbox/package.json +2 -2
  688. package/modules/sandbox/spec/module.yaml +3 -3
  689. package/modules/sandbox/src/services/database-repository.ts +14 -23
  690. package/modules/sandbox/src/services/directory.ts +16 -0
  691. package/modules/sandbox/src/services/sandbox-service.ts +13 -11
  692. package/modules/search/migrations/0001_search_core.down.sql +1 -0
  693. package/modules/search/migrations/0001_search_core.up.sql +22 -0
  694. package/modules/search/migrations/0002_search_recent_export.down.sql +3 -0
  695. package/modules/search/migrations/0002_search_recent_export.up.sql +5 -0
  696. package/modules/search/migrations/README.md +3 -0
  697. package/modules/search/module.json +28 -0
  698. package/modules/search/package.json +43 -0
  699. package/modules/search/spec/module.yaml +177 -0
  700. package/modules/search/src/acl/permissions.ts +5 -0
  701. package/modules/search/src/api/endpoints.ts +221 -0
  702. package/modules/search/src/client/SearchView.tsrx +346 -0
  703. package/modules/search/src/client/api.ts +157 -0
  704. package/modules/search/src/client/contribution.tsrx +31 -0
  705. package/modules/search/src/client/index.ts +17 -0
  706. package/modules/search/src/client/navigation.ts +97 -0
  707. package/modules/search/src/client/search.css +56 -0
  708. package/modules/search/src/client/state.ts +113 -0
  709. package/modules/search/src/domain/data-classes.ts +73 -0
  710. package/modules/search/src/domain/providers.ts +88 -0
  711. package/modules/search/src/domain/types.ts +56 -0
  712. package/modules/search/src/index.ts +46 -0
  713. package/modules/search/src/platform.ts +42 -0
  714. package/modules/search/src/server/index.ts +25 -0
  715. package/modules/search/src/server/runtime.ts +123 -0
  716. package/modules/search/src/services/database-repository.ts +163 -0
  717. package/modules/search/src/services/index.ts +21 -0
  718. package/modules/search/src/services/migration.ts +65 -0
  719. package/modules/search/src/services/provider-registry.ts +137 -0
  720. package/modules/search/src/services/repository.ts +43 -0
  721. package/modules/search/src/services/search-service.ts +442 -0
  722. package/modules/search/src/services/service-error.ts +35 -0
  723. package/modules/search/src/settings.ts +68 -0
  724. package/modules/search/translations/en.json +45 -0
  725. package/modules/search/translations/pl.json +45 -0
  726. package/modules/system/module.json +2 -2
  727. package/modules/system/package.json +2 -2
  728. package/modules/system/spec/module.yaml +30 -3
  729. package/modules/system/src/client/FlagsPanel.tsrx +127 -0
  730. package/modules/system/src/client/ModuleSettingRow.tsrx +17 -7
  731. package/modules/system/src/client/ModuleSettingsSection.tsrx +10 -71
  732. package/modules/system/src/client/ModulesView.tsrx +91 -65
  733. package/modules/system/src/client/flags.ts +35 -0
  734. package/modules/system/src/client/index.ts +8 -0
  735. package/modules/system/src/client/navigation.ts +8 -0
  736. package/modules/system/src/client/settings-state.ts +159 -0
  737. package/modules/system/src/client/state.ts +2 -0
  738. package/modules/system/src/domain/time-zone.ts +105 -0
  739. package/modules/system/src/index.ts +12 -0
  740. package/modules/system/src/platform.ts +5 -1
  741. package/modules/system/src/server/endpoints.ts +72 -21
  742. package/modules/system/src/settings.ts +28 -0
  743. package/modules/system/translations/en.json +17 -0
  744. package/modules/system/translations/pl.json +17 -0
  745. package/modules/users/module.json +30 -4
  746. package/modules/users/package.json +5 -2
  747. package/modules/users/spec/module.yaml +290 -7
  748. package/modules/users/src/api/endpoints.ts +228 -15
  749. package/modules/users/src/client/InviteMemberForm.tsrx +2 -2
  750. package/modules/users/src/client/MemberDrawer.tsrx +142 -26
  751. package/modules/users/src/client/UserAccountForm.tsrx +2 -2
  752. package/modules/users/src/client/UsersView.tsrx +432 -71
  753. package/modules/users/src/client/api.ts +106 -12
  754. package/modules/users/src/client/contribution.tsrx +5 -0
  755. package/modules/users/src/client/member-columns.tsrx +22 -9
  756. package/modules/users/src/client/state.ts +172 -7
  757. package/modules/users/src/domain/lists.ts +9 -0
  758. package/modules/users/src/index.ts +11 -0
  759. package/modules/users/src/platform.ts +50 -1
  760. package/modules/users/src/services/member-export.ts +51 -0
  761. package/modules/users/src/services/member-import.ts +249 -0
  762. package/modules/users/src/services/member-search.ts +145 -0
  763. package/modules/users/src/services/users-service.ts +117 -4
  764. package/modules/users/translations/en.json +57 -8
  765. package/modules/users/translations/pl.json +57 -8
  766. package/modules/workflows/migrations/0004_payload_rotation_inventory.up.sql +17 -0
  767. package/modules/workflows/migrations/0005_workflows_human_approval.up.sql +28 -0
  768. package/modules/workflows/migrations/0006_workflows_retention_indexes.up.sql +11 -0
  769. package/modules/workflows/migrations/0007_workflows_erasure_subject_indexes.up.sql +17 -0
  770. package/modules/workflows/migrations/0008_workflows_subject_account.up.sql +24 -0
  771. package/modules/workflows/migrations/0009_workflows_definition_list_indexes.up.sql +9 -0
  772. package/modules/workflows/module.json +34 -6
  773. package/modules/workflows/package.json +3 -2
  774. package/modules/workflows/spec/module.yaml +26 -9
  775. package/modules/workflows/src/api/endpoints.ts +131 -25
  776. package/modules/workflows/src/cli/commands.json +17 -0
  777. package/modules/workflows/src/cli/index.ts +114 -0
  778. package/modules/workflows/src/client/WorkflowExecutionHistory.tsrx +36 -27
  779. package/modules/workflows/src/client/WorkflowInspector.tsrx +116 -0
  780. package/modules/workflows/src/client/WorkflowNodePalette.tsrx +1 -0
  781. package/modules/workflows/src/client/WorkflowsView.tsrx +236 -99
  782. package/modules/workflows/src/client/api.ts +54 -34
  783. package/modules/workflows/src/client/canvas-model.ts +12 -0
  784. package/modules/workflows/src/client/state.ts +95 -0
  785. package/modules/workflows/src/domain/events.ts +25 -11
  786. package/modules/workflows/src/domain/graph.ts +135 -1
  787. package/modules/workflows/src/domain/types.ts +91 -4
  788. package/modules/workflows/src/platform.ts +12 -0
  789. package/modules/workflows/src/server/runtime.ts +78 -5
  790. package/modules/workflows/src/services/approvals.ts +62 -0
  791. package/modules/workflows/src/services/cursors.ts +37 -0
  792. package/modules/workflows/src/services/data-classes.ts +232 -0
  793. package/modules/workflows/src/services/database-repository.ts +660 -171
  794. package/modules/workflows/src/services/migration.ts +240 -0
  795. package/modules/workflows/src/services/notifications.ts +98 -0
  796. package/modules/workflows/src/services/payload-codec.ts +51 -28
  797. package/modules/workflows/src/services/payload-rotation.ts +171 -0
  798. package/modules/workflows/src/services/repository.ts +123 -8
  799. package/modules/workflows/src/services/simulation.ts +7 -0
  800. package/modules/workflows/src/services/worker.ts +446 -25
  801. package/modules/workflows/src/services/workflows-service.ts +264 -103
  802. package/modules/workflows/translations/en.json +12 -4
  803. package/modules/workflows/translations/pl.json +12 -4
  804. package/modules.json +48 -4
  805. package/package.json +66 -7
  806. package/packages/client/package.json +2 -1
  807. package/packages/client/src/ApplicationShell.tsrx +43 -0
  808. package/packages/client/src/contributions.ts +55 -0
  809. package/packages/client/src/i18n/locales/en.json +5 -0
  810. package/packages/client/src/i18n/locales/pl.json +5 -0
  811. package/packages/client/src/index.ts +13 -1
  812. package/packages/client/src/routing.ts +22 -0
  813. package/packages/client/src/shell/CommandPalette.tsrx +223 -11
  814. package/packages/client/src/shell/command-search.ts +126 -0
  815. package/packages/client/src/shell/command.ts +30 -0
  816. package/packages/client/src/shell/navigation.ts +12 -0
  817. package/packages/client/src/shell/palette-keys.ts +27 -0
  818. package/packages/client/src/shell/shell.css +7 -0
  819. package/packages/contracts/schemas/module-spec.schema.json +287 -1
  820. package/packages/contracts/schemas/module.schema.json +25 -0
  821. package/packages/contracts/src/index.ts +144 -1
  822. package/packages/database/src/backup.ts +179 -0
  823. package/packages/database/src/decoders.ts +25 -0
  824. package/packages/database/src/index.ts +17 -0
  825. package/packages/database/src/record-history.ts +5 -14
  826. package/packages/dev-console/package.json +2 -1
  827. package/packages/dev-console/src/brand.d.mts +8 -0
  828. package/packages/dev-console/src/brand.mjs +33 -0
  829. package/packages/dev-console/src/index.mjs +2 -1
  830. package/packages/harness/src/index.ts +2 -0
  831. package/packages/harness/src/runtime.ts +218 -1
  832. package/packages/harness/src/tool-adapters.ts +19 -1
  833. package/packages/kernel/src/acl.ts +179 -0
  834. package/packages/kernel/src/capability-registry.ts +69 -2
  835. package/packages/kernel/src/data-class-registry.ts +354 -0
  836. package/packages/kernel/src/index.ts +65 -4
  837. package/packages/kernel/src/keyring.ts +208 -0
  838. package/packages/kernel/src/module-compatibility.ts +35 -4
  839. package/packages/kernel/src/module-registry.ts +49 -2
  840. package/packages/kernel/src/module-settings.ts +189 -27
  841. package/packages/server/package.json +2 -1
  842. package/packages/server/src/composition.ts +38 -0
  843. package/packages/server/src/endpoint.ts +104 -47
  844. package/packages/server/src/export/csv.ts +34 -0
  845. package/packages/server/src/export/definition.ts +346 -0
  846. package/packages/server/src/export/index.ts +61 -0
  847. package/packages/server/src/export/run.ts +116 -0
  848. package/packages/server/src/index.ts +155 -0
  849. package/packages/server/src/jobs/index.ts +93 -0
  850. package/packages/server/src/jobs/runner.ts +486 -0
  851. package/packages/server/src/log.ts +291 -0
  852. package/packages/server/src/mail/config.ts +184 -0
  853. package/packages/server/src/mail/contracts.ts +251 -0
  854. package/packages/server/src/mail/index.ts +31 -0
  855. package/packages/server/src/mail/port.ts +101 -0
  856. package/packages/server/src/mail/smtp.ts +191 -0
  857. package/packages/server/src/mail/template.ts +105 -0
  858. package/packages/server/src/metrics.ts +447 -0
  859. package/packages/server/src/pagination.ts +246 -0
  860. package/packages/server/src/trace/context.ts +103 -0
  861. package/packages/server/src/trace/egress.ts +66 -0
  862. package/packages/server/src/trace/error-sink.ts +296 -0
  863. package/packages/server/src/trace/exporter.ts +295 -0
  864. package/packages/server/src/trace/index.ts +60 -0
  865. package/packages/server/src/trace/job-sink.ts +172 -0
  866. package/packages/server/src/trace/tracer.ts +338 -0
  867. package/packages/server/src/web.ts +5 -1
  868. package/packages/storage/package.json +40 -0
  869. package/packages/storage/src/config.ts +189 -0
  870. package/packages/storage/src/content-type.ts +124 -0
  871. package/packages/storage/src/contracts.ts +112 -0
  872. package/packages/storage/src/envelope.ts +189 -0
  873. package/packages/storage/src/index.ts +43 -0
  874. package/packages/storage/src/local.ts +75 -0
  875. package/packages/storage/src/port.ts +251 -0
  876. package/packages/storage/src/read-token.ts +130 -0
  877. package/packages/storage/src/s3.ts +144 -0
  878. package/packages/storage/src/scanner.ts +22 -0
  879. package/packages/storage/src/sigv4.ts +104 -0
  880. package/packages/storage/src/store.ts +13 -0
  881. package/packages/ui/package.json +1 -0
  882. package/packages/ui/src/components/Button.tsrx +3 -0
  883. package/packages/ui/src/components/ConfirmDialog.tsrx +13 -2
  884. package/packages/ui/src/components/DateField.tsrx +92 -0
  885. package/packages/ui/src/components/DatePicker.tsrx +525 -0
  886. package/packages/ui/src/components/DateRangeField.tsrx +93 -0
  887. package/packages/ui/src/components/Drawer.tsrx +10 -1
  888. package/packages/ui/src/components/FileUpload.tsrx +158 -0
  889. package/packages/ui/src/components/Pagination.tsrx +130 -0
  890. package/packages/ui/src/components/Select.tsrx +78 -0
  891. package/packages/ui/src/components/Table.tsrx +498 -81
  892. package/packages/ui/src/components/Tabs.tsrx +53 -0
  893. package/packages/ui/src/components/ToastHost.tsrx +48 -0
  894. package/packages/ui/src/components/calendar.ts +243 -0
  895. package/packages/ui/src/components/date-field.ts +62 -0
  896. package/packages/ui/src/components/file-upload.ts +49 -0
  897. package/packages/ui/src/components/focus-trap.ts +62 -0
  898. package/packages/ui/src/components/pagination.ts +68 -0
  899. package/packages/ui/src/components/table-sorting.ts +49 -0
  900. package/packages/ui/src/components/tabs.ts +61 -0
  901. package/packages/ui/src/components/toast-store.ts +116 -0
  902. package/packages/ui/src/icons/Icon.tsrx +5 -0
  903. package/packages/ui/src/index.ts +45 -0
  904. package/packages/ui/src/styles/components.css +598 -0
  905. package/modules/automations-workflows-integration/module.json +0 -27
  906. package/modules/automations-workflows-integration/spec/module.yaml +0 -93
  907. package/modules/automations-workflows-integration/src/index.ts +0 -14
  908. package/modules/automations-workflows-integration/src/platform.ts +0 -24
  909. package/modules/automations-workflows-integration/src/server/index.ts +0 -11
  910. package/modules/automations-workflows-integration/translations/en.json +0 -21
  911. package/modules/automations-workflows-integration/translations/pl.json +0 -21
  912. package/modules/workflows/src/services/cursor-codec.ts +0 -62
@@ -1,6 +1,6 @@
1
1
  schemaVersion: 1
2
2
  id: agents.core
3
- specVersion: 0.9.1
3
+ specVersion: 0.12.9
4
4
  status: approved
5
5
  name: Agentic Core
6
6
  description: Provides tenant-created and module-owned business agent definitions, tenant-scoped provider connections, reusable procedures, durable streamed execution, run history, and the public run queue used by optional automation modules.
@@ -14,15 +14,26 @@ capabilities:
14
14
  - cli
15
15
  dependencies:
16
16
  - id: system.core
17
- range: 0.5.0
17
+ range: ^0.7.0
18
18
  - id: auth.core
19
- range: 0.10.0
19
+ range: ^0.13.0
20
+ - id: metering.core
21
+ range: ^0.1.0
22
+ - id: reports.core
23
+ range: ^0.1.0
24
+ requires:
25
+ - id: notifications.publish.v1
26
+ optional: true
27
+ - id: metering.meters.v1
28
+ - id: reports.v1
29
+ optional: true
20
30
  tenancy: required
21
31
  locales:
22
32
  - en
23
33
  - pl
24
34
  invariants:
25
35
  - Every agent managed by agents.core is a business agent with explicit ownership. A tenant-created definition is owned by one tenant; a module-owned definition is owned by one enabled module and receives a separate tenant-scoped execution binding. Sandbox coding specialists are outside agents.core. Every binding, run, and repository query receives the trusted tenant identifier.
36
+ - agents.core registers the report provider agents.runs through the public capability reports.v1 at composition when reports.core is present, and continues without it when it is not. The provider answers the runs and token totals of the requested range as tiles and runs and tokens per day as series, read from the existing agent run cost rollup inside this module's own tenant transaction; it prices nothing, writes nothing and opens no other module's tables. It names itself, each tile and each line with a key of this module's own translation bundle beside the English literal, and hands the reader's time budget to that transaction so the statement is cancelled when the budget expires.
26
37
  - An enabled module may register immutable business agent behavior during platform composition with defineAgent. Its stable identity is derived from module id and agent key, its positive definition revision is supplied by the module, and malformed or duplicate identities fail platform boot before workers start.
27
38
  - Module-owned instructions, names, maximum tool allowlists, and execution limits are read-only module source. A tenant administrator may bind an available provider and model, pause the binding, and reduce its enabled tool set, but cannot broaden the module allowlist or edit the module behavior in the Agents UI.
28
39
  - An unconfigured module-owned agent is visible as unconfigured but cannot be activated, published in a workflow, or executed until its tenant binding names a usable provider and model.
@@ -67,7 +78,12 @@ invariants:
67
78
  - Business actions exposed to workflows are explicit versioned contracts. Only read and workspace-write risks are eligible, input and output are schema checked, and every invocation is persisted before execution.
68
79
  - Workflow action invocations receive a trusted actor, permission snapshot, idempotency key, and AbortSignal. Secrets, raw input, and raw output never enter audit metadata.
69
80
  - Every request-time read and write runs on a tenant-scoped database handle. The worker recovery polls are the only cross-tenant reads, they run on a separate read-only role, and the module agent catalog is reconciled at boot on the schema-owner lease that runs migrations.
81
+ - Run outcome notifications are an optional integration. When a durable run reaches a terminal state the worker resolves notifications.publish.v1 from the platform capability registry at that moment, never at composition time, and publishes the outcome keyed by the run id. notifications.core is never a declared dependency. An absent capability, a run with no person behind it, and a run a workflow owns publish nothing. A publisher failure is logged once at warning level and never changes the settled run, and a repeated terminal step reports the same outcome instead of a second notification.
70
82
  - Every table that carries tenant data enables and forces row-level security with a policy bound to the transaction-local tenant, including the child tables that hang off a run, a definition or a provider connection. A read by a caller-supplied parent id therefore cannot cross a workspace even when application code forgets the predicate.
83
+ - agents.core declares three data classes to the platform registry while it composes, and performs their operations itself on its own leases under its own tenant transaction. agents.core.runs holds the run record, its steps and the child rows that hang off it, keeps them 90 days by default, sweeps only settled runs in bounded batches so a queued or running run is never taken from its worker, exports one workspace by keyset in bounded pages, and erases the runs one account requested in bounded batches, reporting a full batch as truncated. agents.core.audit-events is exportable and is kept until a person deletes it, because the trail is hash chained and removing its oldest links by age would make the next verification report a break it cannot tell from tampering. agents.core.provider-credentials is workspace configuration, is never swept, and is excluded from the export with a stated reason because the row exists to hold a sealed provider secret. No export carries a credential or a sealed payload.
84
+ - agents.core depends on metering.core and requires the public metering.meters.v1 capability, so the module registry composes metering.core first and refuses a composition that leaves it out or that provides no meter registry. The meters agents.core.run-tokens and agents.core.runs are declared once while agents.core composes; every later use resolves the registry through the capability at the point of use rather than holding the one composition found. A settled run is counted once, keyed by the run id, so a repeated terminal step reports the same fact instead of a second one, and a run that reported no tokens counts the run alone. Counting is advisory and runs after the terminal row commits, so a metering failure never changes a settled run.
85
+ - Before a run is created the module asks metering.meters.v1 about both meters a run costs, on every enqueue path. agents.core.runs is asked for one run first and agents.core.run-tokens for the tokens the run may read and write, so a workspace that has spent either allowance is refused. A refused verdict fails the run start with METER_LIMIT_EXCEEDED naming that meter and creates no run. An allowed or warning verdict starts the run unchanged, and the settled fact replaces the estimate.
86
+ - A refused meter is recorded in this module's own hash-chained trail once per workspace, meter and calendar month, with the meter, the estimate, the month's usage and the limit. The claim that a refusal was already recorded is a row of agents.core's own tenant table, and taking it removes the rows of earlier months, so the workspace holds one row per meter however long it keeps being refused. Every attempt still asks metering.core, so a workspace is refused on what its month holds now and never on a remembered verdict, and the first refusal after the month turns is recorded again.
71
87
  permissions:
72
88
  - id: agents.definitions.read
73
89
  description: Read agent definitions in the active tenant.
@@ -96,11 +112,13 @@ dataOwnership:
96
112
  - agents.core owns the per-run cost projection, its per-day and per-agent rollups, and the budget caps declared as module settings.
97
113
  - agents.core owns immutable agent revision snapshots, workflow-bound run output contracts, and durable versioned action invocation state.
98
114
  - Business modules own their records and expose narrowly scoped tools to the harness; agents.core never bypasses their services or ACL rules.
115
+ - metering.core owns meter declarations as recorded, day buckets and limits. agents.core owns the meters it declares, the standing refusal rows that keep one refused meter out of its trail per workspace and month, and the decision about what a refusal means for a run; it never reads or writes metering storage.
116
+ - notifications.core owns inbox items, deliveries, and read state. agents.core owns the run it reports and hands over only the run id, the outcome kind, a bounded English title and outcome summary, and the accountable member; it never writes or reads notification records and never receives them back.
99
117
  acceptanceScenarios:
100
118
  - id: AGENTS-LIST
101
119
  given: Tenant-created business agents and enabled modules with module-owned business agents exist.
102
120
  when: An authorized principal lists agents.
103
- then: The active tenant receives a deterministic catalog with an explicit tenant or module ownership discriminator and no definition from another tenant or disabled module.
121
+ then: The active tenant receives a deterministic catalog with an explicit tenant or module ownership discriminator and no definition from another tenant or disabled module. Tenant definitions arrive as pages of at most 200 rows, 50 by default, sorted by name or updatedAt in either direction with an optional search term, and each page ends in an opaque cursor bound to the tenant, the sort and the filters that a request with a different tenant, sort or filter cannot reuse; the module catalog, providers, tools and procedures are read separately.
104
122
  - id: AGENTS-MODULE-REGISTER
105
123
  given: An enabled module registers a valid defineAgent definition during composition.
106
124
  when: The platform finishes composing modules before starting workers.
@@ -133,6 +151,10 @@ acceptanceScenarios:
133
151
  given: An active agent and a principal with execution permission.
134
152
  when: A playground or platform run is requested.
135
153
  then: A queued run is durably persisted and a 202 response is returned before provider execution completes.
154
+ - id: AGENTS-RUNS-LIST
155
+ given: A tenant holds more runs than one page carries.
156
+ when: A principal with agents.runs.read lists runs.
157
+ then: Runs arrive newest first or oldest first by queuedAt in pages of at most 200 rows, 50 by default, narrowed by status, agent, trigger or a search term on the server, and each page ends in an opaque cursor bound to the tenant, the sort and the filters that another tenant, sort or filter cannot reuse; one run with its timeline is read by its id through a separate endpoint.
136
158
  - id: AGENTS-EXECUTE
137
159
  given: A queued run with valid server-side grants and bounded execution settings.
138
160
  when: The harness worker claims the run.
@@ -224,7 +246,7 @@ acceptanceScenarios:
224
246
  - id: AGENTS-AUDIT-READ
225
247
  given: A principal reads the agent audit trail over HTTP.
226
248
  when: The principal lacks agents.runs.read, or holds it and pages with a cursor.
227
- then: The request is denied before any row is read without the scope, and with it only the active tenant's events are returned newest first with a stable occurred-at and sequence cursor and the chain fields.
249
+ then: The request is denied before any row is read without the scope, and with it only the active tenant's events are returned newest first with a stable occurred-at and sequence cursor and the chain fields. A page carries at most 100 events, 50 by default, and the cursor is opaque and bound to the tenant, so a cursor issued to another tenant or edited by a client is refused.
228
250
  - id: AGENTS-AUDIT-VERIFY
229
251
  given: A stored agent audit row is altered after it was written.
230
252
  when: A principal with agents.runs.read verifies the chain over HTTP, reusing the same walk as the audit-verify CLI.
@@ -265,7 +287,43 @@ acceptanceScenarios:
265
287
  given: A schedule, webhook, or other service identity was configured by an authenticated user.
266
288
  when: It initiates workflow agent work or a versioned action.
267
289
  then: Durable state records the service actor and its configuring user so history never presents background work as an anonymous system mutation.
290
+ - id: AGENTS-NOTIFY-RUN
291
+ given: A durable agent run started by a member reaches a terminal state, and the optional notifications module may or may not be composed.
292
+ when: The worker commits the terminal status.
293
+ then: With notifications.core composed, exactly one agent-run-completed or agent-run-failed notification is published after that commit, keyed by the run id, addressed to the member accountable for the run, and carrying no credentials, prompt, or transcript; without it, for a run a workflow owns, or when the publisher fails, the run settles unchanged and nothing is published.
268
294
  - id: AGENT-CHILD-ISOLATION
269
295
  given: Two workspaces each own an agent run with procedure snapshots and a provider connection with model readiness.
270
296
  when: A caller supplies the other workspace's run id or provider id directly.
271
297
  then: The read returns nothing, because those child tables carry their own workspace and force row-level security rather than relying on their parent.
298
+ - id: AGENTS-DATA-CLASSES
299
+ given: Two workspaces hold agent runs of several ages with their steps, one run still queued, a provider connection with a sealed credential, and the platform has sealed the data class registry.
300
+ when: The platform sweeps, exports and erases the declared classes for one of them.
301
+ then: The sweep removes only that workspace's settled runs strictly older than the cutoff and at most the batch it was given, taking their steps with them while the queued run stays; the export streams that workspace's runs and its audit trail through the sink in keyset pages with the oldest and newest record time, answers no rows and no range for a workspace that holds none, and carries no provider credential; the audit class declares no sweep; and erasing a subject removes the runs that account requested in that workspace alone, reporting a full batch as truncated.
302
+ - id: AGENTS-METER-COUNT
303
+ given: A workspace runs an agent and metering.core is composed, as every deployment of agents.core must compose it.
304
+ when: The platform composes and the run settles.
305
+ then: agents.core.run-tokens and agents.core.runs are declared at composition, the settled run counts one run and its reported tokens against the run id, and a run that reported none counts the run alone.
306
+ - id: AGENTS-METER-REFUSED
307
+ given: A workspace has used its monthly token allowance for agents.core.run-tokens.
308
+ when: A further run is requested through any enqueue path.
309
+ then: The request is refused with METER_LIMIT_EXCEEDED before a run row exists, the refusal is recorded in the agents audit trail with the meter, the estimate, the usage and the limit, the chain still verifies, and nothing is counted for the refused request.
310
+ - id: AGENTS-METERING-REQUIRED
311
+ given: A composition of agents.core with the platform modules it depends on.
312
+ when: The module registry composes it without metering.core, and again with a metering.core that provides no meter registry.
313
+ then: The first is refused with MODULE_DEPENDENCY_MISSING and the second with MODULE_CAPABILITY_MISSING; a complete composition orders metering.core before agents.core.
314
+ - id: AGENTS-METER-RUNS-LIMIT
315
+ given: A workspace that has used its monthly allowance of agents.core.runs while its token allowance is untouched.
316
+ when: A run is requested.
317
+ then: The request is refused with METER_LIMIT_EXCEEDED before a run row exists, the refusal names the runs meter and the amount of one run, and the token allowance is never asked.
318
+ - id: AGENTS-METER-REFUSAL-ONCE
319
+ given: A workspace refused on one meter that retries the request several times inside one month.
320
+ when: Every attempt is made.
321
+ then: Each is refused and asks metering.core again, the trail carries exactly one refusal for that workspace, meter and month, the chain still verifies, and the first attempt in the next month is recorded once more.
322
+ - id: AGENTS-ERASE-RUNNING-RUN
323
+ given: A run a worker of this process is executing, requested by the account an erasure names.
324
+ when: The agents.core.runs erase operation removes it mid-flight.
325
+ then: The worker's lease renewal cannot prove ownership, the execution is aborted as a lost lease, no terminal status and no terminal audit event are written for the run that is gone, and the worker returns to idle.
326
+ - id: AGENTS-REPORT-RUNS
327
+ given: A workspace with runs settled on several days inside the requested range and runs settled outside it.
328
+ when: The reports.core provider agents.runs is read.
329
+ then: It answers the runs and token totals of the range as tiles and runs and tokens per day as two series read from the existing rollup, counting only the days inside the range and writing nothing. It names itself, its tiles and its lines with keys of this module's bundle, and it passes the reader's time budget into its own tenant transaction so an expired budget cancels the statement instead of leaving it running.
@@ -1,9 +1,14 @@
1
+ import { randomBytes } from 'node:crypto';
1
2
  import {
3
+ decodeCursor,
2
4
  defineEndpoint,
5
+ encodeCursor,
3
6
  HttpProblem,
4
7
  jsonResponse,
8
+ pageResponse,
5
9
  problemResponse,
6
10
  readJsonObject,
11
+ readPageQuery,
7
12
  requiredInteger,
8
13
  requiredString,
9
14
  } from '@flowdular/sdk/server';
@@ -14,18 +19,20 @@ import {
14
19
  principalFromContext,
15
20
  sessionMutationDenial,
16
21
  } from '@flowdular/sdk/modules/auth/server';
17
- import type { AgentExecutionEvent } from '@flowdular/sdk/harness';
22
+ import type { AgentExecutionEvent, AgentRunTrigger } from '@flowdular/sdk/harness';
18
23
  import { userActor } from '@flowdular/sdk/kernel';
19
24
  import { AGENT_PERMISSIONS } from '../acl/permissions.ts';
20
25
  import type {
21
- AgentDefinition,
26
+ AgentListSort,
22
27
  AgentProcedure,
23
28
  AgentProcedureSnapshot,
24
29
  AgentProviderKind,
25
30
  AgentProviderModelConfiguration,
26
31
  AgentRunDetail,
32
+ AgentRunStatus,
27
33
  AgentProcedureStatus,
28
34
  AgentStatus,
35
+ ListDirection,
29
36
  CreateAgentInput,
30
37
  CreateAgentProviderInput,
31
38
  CreateAgentProcedureInput,
@@ -39,6 +46,30 @@ import { AgentServiceError } from '../services/agent-service.ts';
39
46
  import { AgentProviderServiceError } from '../services/provider-service.ts';
40
47
  import type { AgentRuntime } from '../server/runtime.ts';
41
48
 
49
+ /** The default page of every list here, and the ceiling of the audit trail. */
50
+ const LIST_PAGE_LIMIT = 50;
51
+ const AUDIT_PAGE_LIMIT = 100;
52
+ const SEARCH_LIMIT = 200;
53
+ const AGENT_SORTS: readonly AgentListSort[] = ['name', 'updatedAt'];
54
+ const AGENT_SORT_DIRECTIONS: Readonly<Record<AgentListSort, ListDirection>> = {
55
+ name: 'asc',
56
+ updatedAt: 'desc',
57
+ };
58
+ const RUN_SORTS = ['queuedAt'] as const;
59
+ const RUN_STATUSES: readonly AgentRunStatus[] = [
60
+ 'queued',
61
+ 'running',
62
+ 'succeeded',
63
+ 'failed',
64
+ 'cancelled',
65
+ ];
66
+ const RUN_TRIGGERS: readonly AgentRunTrigger[] = [
67
+ 'playground',
68
+ 'workflow',
69
+ 'service',
70
+ 'schedule',
71
+ ];
72
+
42
73
  function failure(error: unknown): Response {
43
74
  if (
44
75
  error instanceof AgentServiceError ||
@@ -196,6 +227,77 @@ function agentInput(value: Record<string, unknown>): CreateAgentInput {
196
227
  };
197
228
  }
198
229
 
230
+ function invalid(message: string): HttpProblem {
231
+ return new HttpProblem('INVALID_INPUT', message, 400);
232
+ }
233
+
234
+ function queryValue(url: URL, key: string, maximum: number): string | null {
235
+ const raw = url.searchParams.get(key);
236
+ if (raw === null) return null;
237
+ const value = raw.trim();
238
+ if (value === '') return null;
239
+ if (value.length > maximum) throw invalid(`${key} is too long.`);
240
+ return value;
241
+ }
242
+
243
+ function queryChoice<Choice extends string>(
244
+ url: URL,
245
+ key: string,
246
+ choices: readonly Choice[],
247
+ ): Choice | null {
248
+ const value = queryValue(url, key, 32);
249
+ if (value === null) return null;
250
+ const chosen = choices.find((choice) => choice === value);
251
+ if (chosen === undefined) {
252
+ throw invalid(`${key} must be one of ${choices.join(', ')}.`);
253
+ }
254
+ return chosen;
255
+ }
256
+
257
+ interface ListOrder<Sort extends string> {
258
+ readonly sort: Sort;
259
+ readonly direction: ListDirection;
260
+ }
261
+
262
+ function listOrder<Sort extends string>(
263
+ url: URL,
264
+ sorts: readonly Sort[],
265
+ defaults: Readonly<Record<Sort, ListDirection>>,
266
+ ): ListOrder<Sort> {
267
+ const sort = queryChoice(url, 'sort', sorts) ?? sorts[0]!;
268
+ const direction = queryChoice(url, 'direction', ['asc', 'desc'] as const);
269
+ return { sort, direction: direction ?? defaults[sort] };
270
+ }
271
+
272
+ type CursorScope = Readonly<Record<string, string | number>> & {
273
+ readonly list: 'definitions' | 'runs' | 'audit';
274
+ };
275
+
276
+ /* A cursor answers one request: the list, tenant, order and filters it was
277
+ signed with are compared to the request's, and its keyset fields must carry
278
+ the type the statement binds, so a cursor of another list of the same
279
+ workspace is refused rather than moved onto a result set it never described. */
280
+ function boundCursor(
281
+ raw: string | null,
282
+ secret: Uint8Array,
283
+ scope: CursorScope,
284
+ keys: Readonly<Record<string, 'string' | 'number'>>,
285
+ ): Record<string, string | number> | null {
286
+ if (raw === null) return null;
287
+ const cursor = decodeCursor(raw, secret);
288
+ const refused = () =>
289
+ new HttpProblem('CURSOR_INVALID', 'The page cursor is not valid.', 400);
290
+ for (const [key, value] of Object.entries(scope)) {
291
+ if (cursor[key] !== value) throw refused();
292
+ }
293
+ for (const [key, type] of Object.entries(keys)) {
294
+ const value = cursor[key];
295
+ if (typeof value !== type) throw refused();
296
+ if (type === 'number' && !Number.isSafeInteger(value)) throw refused();
297
+ }
298
+ return cursor;
299
+ }
300
+
199
301
  /* A tenant agent and a run carry the deprecated projection beside the canonical
200
302
  field, so a client on either contract reads the same configuration and the
201
303
  same retained evidence. */
@@ -332,6 +434,10 @@ async function runEventStream(
332
434
  }
333
435
 
334
436
  export function createAgentRoutes(auth: AuthRuntime, runtime: AgentRuntime) {
437
+ /* Module-owned and never stored: a cursor names a position in one
438
+ workspace's own list, so a restart invalidating one costs a client the
439
+ first page. */
440
+ const cursorSecret = randomBytes(32);
335
441
  const listAgents = defineEndpoint({
336
442
  id: 'agents.definitions.list',
337
443
  path: '/api/agents',
@@ -341,17 +447,84 @@ export function createAgentRoutes(auth: AuthRuntime, runtime: AgentRuntime) {
341
447
  permission: AGENT_PERMISSIONS.definitionsRead,
342
448
  },
343
449
  resolveIdentity: endpointIdentityFromContext,
450
+ handler: async ({ octane }) => {
451
+ try {
452
+ const principal = principalFromContext(octane)!;
453
+ const url = new URL(octane.request.url);
454
+ const page = readPageQuery(url, { defaultLimit: LIST_PAGE_LIMIT });
455
+ const order = listOrder(url, AGENT_SORTS, AGENT_SORT_DIRECTIONS);
456
+ const search = queryValue(url, 'q', SEARCH_LIMIT);
457
+ const scope = {
458
+ list: 'definitions' as const,
459
+ tenant: principal.tenantId,
460
+ sort: order.sort,
461
+ direction: order.direction,
462
+ q: search ?? '',
463
+ };
464
+ const cursor = boundCursor(page.cursor, cursorSecret, scope, {
465
+ key: order.sort === 'name' ? 'string' : 'number',
466
+ id: 'string',
467
+ });
468
+ const result = await (
469
+ await runtime.service()
470
+ ).listAgentsPage(principal.tenantId, {
471
+ sort: order.sort,
472
+ direction: order.direction,
473
+ search,
474
+ limit: page.limit,
475
+ after:
476
+ cursor === null
477
+ ? null
478
+ : {
479
+ sortValue:
480
+ order.sort === 'name'
481
+ ? String(cursor.key)
482
+ : Number(cursor.key),
483
+ id: String(cursor.id),
484
+ },
485
+ });
486
+ return pageResponse({
487
+ items: result.agents.map((agent) =>
488
+ withDeprecatedProcedureFields<TenantAgentView>({
489
+ ...agent,
490
+ ownership: { kind: 'tenant' },
491
+ }),
492
+ ),
493
+ limit: page.limit,
494
+ nextCursor:
495
+ result.last && result.agents.length === page.limit
496
+ ? encodeCursor(
497
+ {
498
+ ...scope,
499
+ key:
500
+ order.sort === 'name'
501
+ ? result.last.nameKey
502
+ : result.last.updatedAt,
503
+ id: result.last.id,
504
+ },
505
+ cursorSecret,
506
+ )
507
+ : null,
508
+ });
509
+ } catch (error) {
510
+ return failure(error);
511
+ }
512
+ },
513
+ });
514
+ /* What the definitions screen needs beside its page: the module catalog,
515
+ the providers, the registered tools and the procedures. */
516
+ const agentContext = defineEndpoint({
517
+ id: 'agents.definitions.context',
518
+ path: '/api/agents/context',
519
+ methods: ['GET'],
520
+ access: {
521
+ kind: 'permission',
522
+ permission: AGENT_PERMISSIONS.definitionsRead,
523
+ },
524
+ resolveIdentity: endpointIdentityFromContext,
344
525
  handler: async ({ octane }) => {
345
526
  const principal = principalFromContext(octane)!;
346
527
  return jsonResponse({
347
- agents: (
348
- await (await runtime.service()).listAgents(principal.tenantId)
349
- ).map((agent: AgentDefinition) =>
350
- withDeprecatedProcedureFields<TenantAgentView>({
351
- ...agent,
352
- ownership: { kind: 'tenant' },
353
- }),
354
- ),
355
528
  moduleAgents: await (
356
529
  await runtime.service()
357
530
  ).listModuleAgents(principal.tenantId),
@@ -711,18 +884,72 @@ export function createAgentRoutes(auth: AuthRuntime, runtime: AgentRuntime) {
711
884
  try {
712
885
  const principal = principalFromContext(octane)!;
713
886
  const url = new URL(octane.request.url);
714
- const runId = url.searchParams.get('id');
715
- return runId
716
- ? jsonResponse({
717
- run: await (
718
- await runtime.service()
719
- ).getRunTimeline(principal.tenantId, runId),
720
- })
721
- : jsonResponse({
722
- runs: (
723
- await (await runtime.service()).listRuns(principal.tenantId)
724
- ).map(withDeprecatedRunFields),
725
- });
887
+ const page = readPageQuery(url, { defaultLimit: LIST_PAGE_LIMIT });
888
+ const order = listOrder(url, RUN_SORTS, { queuedAt: 'desc' });
889
+ const filters = {
890
+ status: queryChoice(url, 'status', RUN_STATUSES),
891
+ agentId: queryValue(url, 'agentId', 128),
892
+ trigger: queryChoice(url, 'trigger', RUN_TRIGGERS),
893
+ search: queryValue(url, 'q', SEARCH_LIMIT),
894
+ };
895
+ const scope = {
896
+ list: 'runs' as const,
897
+ tenant: principal.tenantId,
898
+ sort: order.sort,
899
+ direction: order.direction,
900
+ status: filters.status ?? '',
901
+ agentId: filters.agentId ?? '',
902
+ trigger: filters.trigger ?? '',
903
+ q: filters.search ?? '',
904
+ };
905
+ const cursor = boundCursor(page.cursor, cursorSecret, scope, {
906
+ queuedAt: 'number',
907
+ id: 'string',
908
+ });
909
+ const runs = await (
910
+ await runtime.service()
911
+ ).listRuns(principal.tenantId, {
912
+ ...filters,
913
+ direction: order.direction,
914
+ limit: page.limit,
915
+ after:
916
+ cursor === null
917
+ ? null
918
+ : { queuedAt: Number(cursor.queuedAt), id: String(cursor.id) },
919
+ });
920
+ const last = runs.at(-1);
921
+ return pageResponse({
922
+ items: runs.map(withDeprecatedRunFields),
923
+ limit: page.limit,
924
+ nextCursor:
925
+ last && runs.length === page.limit
926
+ ? encodeCursor(
927
+ { ...scope, queuedAt: last.queuedAt, id: last.id },
928
+ cursorSecret,
929
+ )
930
+ : null,
931
+ });
932
+ } catch (error) {
933
+ return failure(error);
934
+ }
935
+ },
936
+ });
937
+ const getRun = defineEndpoint({
938
+ id: 'agents.runs.get',
939
+ path: '/api/agent-runs/get',
940
+ methods: ['GET'],
941
+ access: { kind: 'permission', permission: AGENT_PERMISSIONS.runsRead },
942
+ resolveIdentity: endpointIdentityFromContext,
943
+ handler: async ({ octane }) => {
944
+ try {
945
+ const principal = principalFromContext(octane)!;
946
+ const runId = queryValue(new URL(octane.request.url), 'id', 128);
947
+ if (runId === null) throw invalid('id is required.');
948
+ return jsonResponse({
949
+ run: await (
950
+ await runtime.service()
951
+ ).getRunTimeline(principal.tenantId, runId),
952
+ });
726
953
  } catch (error) {
727
954
  return failure(error);
728
955
  }
@@ -857,17 +1084,44 @@ export function createAgentRoutes(auth: AuthRuntime, runtime: AgentRuntime) {
857
1084
  handler: async ({ octane }) => {
858
1085
  try {
859
1086
  const principal = principalFromContext(octane)!;
860
- const url = new URL(octane.request.url);
861
- const limit = Number(url.searchParams.get('limit') ?? '50');
862
- return jsonResponse(
863
- await (
864
- await runtime.service()
865
- ).pageAuditEvents(
866
- principal.tenantId,
867
- url.searchParams.get('cursor'),
868
- limit,
869
- ),
870
- );
1087
+ const page = readPageQuery(new URL(octane.request.url), {
1088
+ maxLimit: AUDIT_PAGE_LIMIT,
1089
+ defaultLimit: LIST_PAGE_LIMIT,
1090
+ });
1091
+ const scope = { list: 'audit' as const, tenant: principal.tenantId };
1092
+ const cursor = boundCursor(page.cursor, cursorSecret, scope, {
1093
+ occurredAt: 'number',
1094
+ sequence: 'number',
1095
+ });
1096
+ const events = await (
1097
+ await runtime.service()
1098
+ ).pageAuditEvents(principal.tenantId, {
1099
+ limit: page.limit,
1100
+ after:
1101
+ cursor === null
1102
+ ? null
1103
+ : {
1104
+ occurredAt: Number(cursor.occurredAt),
1105
+ sequence: Number(cursor.sequence),
1106
+ },
1107
+ });
1108
+ const last = events.at(-1);
1109
+ /* The body keeps `events` and `nextCursor`: auth.core's audit screen
1110
+ reads this trail beside the platform one through that shape. */
1111
+ return jsonResponse({
1112
+ events,
1113
+ nextCursor:
1114
+ last && events.length === page.limit
1115
+ ? encodeCursor(
1116
+ {
1117
+ ...scope,
1118
+ occurredAt: last.occurredAt,
1119
+ sequence: last.sequence,
1120
+ },
1121
+ cursorSecret,
1122
+ )
1123
+ : null,
1124
+ });
871
1125
  } catch (error) {
872
1126
  return failure(error);
873
1127
  }
@@ -1062,6 +1316,7 @@ export function createAgentRoutes(auth: AuthRuntime, runtime: AgentRuntime) {
1062
1316
  });
1063
1317
  return [
1064
1318
  listAgents.serverRoute,
1319
+ agentContext.serverRoute,
1065
1320
  updateModuleAgentBinding.serverRoute,
1066
1321
  createAgent.serverRoute,
1067
1322
  updateAgent.serverRoute,
@@ -1076,6 +1331,7 @@ export function createAgentRoutes(auth: AuthRuntime, runtime: AgentRuntime) {
1076
1331
  archiveSkill.serverRoute,
1077
1332
  deleteSkill.serverRoute,
1078
1333
  listRuns.serverRoute,
1334
+ getRun.serverRoute,
1079
1335
  enqueueRun.serverRoute,
1080
1336
  cancelRun.serverRoute,
1081
1337
  workerStatus.serverRoute,
@@ -1093,6 +1349,7 @@ export function createAgentRoutes(auth: AuthRuntime, runtime: AgentRuntime) {
1093
1349
 
1094
1350
  export const endpoints = [
1095
1351
  'agents.definitions.list',
1352
+ 'agents.definitions.context',
1096
1353
  'agents.module-bindings.update',
1097
1354
  'agents.definitions.create',
1098
1355
  'agents.definitions.update',
@@ -1107,6 +1364,7 @@ export const endpoints = [
1107
1364
  'agents.skills.archive',
1108
1365
  'agents.skills.delete',
1109
1366
  'agents.runs.list',
1367
+ 'agents.runs.get',
1110
1368
  'agents.runs.enqueue',
1111
1369
  'agents.runs.cancel',
1112
1370
  'agents.runs.worker',
@@ -13,6 +13,17 @@
13
13
  "supportsDryRun": false
14
14
  }
15
15
  },
16
+ {
17
+ "path": ["agents", "secrets-rotate"],
18
+ "capability": {
19
+ "id": "agents.secrets.rotate",
20
+ "version": 1,
21
+ "summary": "Re-seal stored provider credentials with the current encryption key.",
22
+ "risk": "process",
23
+ "requiresApprovedSpec": false,
24
+ "supportsDryRun": true
25
+ }
26
+ },
16
27
  {
17
28
  "path": ["agents", "audit-verify"],
18
29
  "capability": {
@@ -9,6 +9,8 @@ import {
9
9
  } from '@flowdular/sdk/database';
10
10
  import { AI_PROVIDER_KINDS } from '@flowdular/sdk/harness/catalog';
11
11
  import { agentRuntimeOptionsFromEnvironment } from '../server/runtime.ts';
12
+ import { rotateProviderCredentials } from '../services/credential-rotation.ts';
13
+ import { credentialVaultFromEnvironment } from '../services/credential-vault.ts';
12
14
  import { DatabaseProviderRepository } from '../services/provider-repository.ts';
13
15
  import {
14
16
  DatabaseAgentRepository,
@@ -24,6 +26,16 @@ const statusCapability = {
24
26
  supportsDryRun: false,
25
27
  };
26
28
 
29
+ const rotateCapability = {
30
+ id: 'agents.secrets.rotate',
31
+ version: 1,
32
+ summary:
33
+ 'Re-seal stored provider credentials with the current encryption key.',
34
+ risk: 'process' as const,
35
+ requiresApprovedSpec: false,
36
+ supportsDryRun: true,
37
+ };
38
+
27
39
  const auditCapability = {
28
40
  id: 'agents.audit.verify',
29
41
  version: 1,
@@ -127,6 +139,39 @@ export const cliExtension = defineCliExtension({
127
139
  }
128
140
  },
129
141
  },
142
+ {
143
+ path: ['agents', 'secrets-rotate'],
144
+ capability: rotateCapability,
145
+ execute: async (context) => {
146
+ /* The report names key ids and row counts only; a credential never
147
+ reaches the command output. */
148
+ const vault = credentialVaultFromEnvironment(
149
+ process.env,
150
+ context.workspaceRoot,
151
+ );
152
+ const opened = await open(context);
153
+ try {
154
+ const report = await rotateProviderCredentials({
155
+ runtime: opened.runtime.database,
156
+ background: opened.background.database,
157
+ vault,
158
+ apply: context.apply,
159
+ });
160
+ return {
161
+ data: { moduleId: 'agents.core', ...report },
162
+ evidence: ['modules/agents/spec/module.yaml', 'docs/operations.md'],
163
+ warnings:
164
+ report.skipped > 0
165
+ ? [
166
+ `${report.skipped} rows were rewritten by the application while this ran and keep their own envelope. Run the command again.`,
167
+ ]
168
+ : [],
169
+ };
170
+ } finally {
171
+ await close(opened);
172
+ }
173
+ },
174
+ },
130
175
  {
131
176
  path: ['agents', 'audit-verify'],
132
177
  capability: auditCapability,