@flowdular/sdk 0.2.4 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ai/agents/sandbox/business-manager.md +5 -1
- package/.ai/blueprints/author-spec/README.md +1 -1
- package/.ai/blueprints/author-spec/spec-requirements.yaml +44 -0
- package/.ai/blueprints/author-spec/steps.yaml +5 -5
- package/.ai/blueprints/author-spec/templates/module.yaml +99 -3
- package/.ai/blueprints/edit-module/gates.yaml +4 -0
- package/.ai/blueprints/edit-module/required-files.yaml +9 -0
- package/.ai/blueprints/new-module/gates.yaml +4 -0
- package/.ai/blueprints/new-module/spec-requirements.yaml +2 -2
- package/.ai/blueprints/release/gates.yaml +4 -0
- package/.ai/platform-capabilities.md +128 -0
- package/.ai/policies/capabilities.yaml +130 -3
- package/.ai/policies/path-ownership.yaml +5 -2
- package/.ai/policies/task-budgets.yaml +5 -3
- package/.ai/references/catalog/module.json +4 -4
- package/.ai/references/catalog/package.json +2 -2
- package/.ai/references/catalog/spec/module.yaml +5 -3
- package/.ai/references/catalog/src/platform.ts +2 -0
- package/.ai/references/catalog/src/services/catalog-service.ts +89 -1
- package/.ai/references/catalog/src/services/data-classes.ts +47 -0
- package/.ai/references/catalog/src/services/database-repository.ts +98 -1
- package/.ai/references/catalog/src/services/repository.ts +22 -1
- package/.ai/references/catalog/tests/data-classes.test.ts +157 -0
- package/.ai/references/catalog.provenance.json +12 -10
- package/.ai/skills/README.md +10 -0
- package/.ai/skills/agent-tool-design/SKILL.md +1 -2
- package/.ai/skills/auth-security-review/SKILL.md +1 -1
- package/.ai/skills/business-agent-design/SKILL.md +0 -1
- package/.ai/skills/cli-extension/SKILL.md +1 -1
- package/.ai/skills/deploy-operate/SKILL.md +119 -0
- package/.ai/skills/module-new/SKILL.md +29 -3
- package/.ai/skills/module-update/SKILL.md +9 -3
- package/.ai/skills/perf-audit/SKILL.md +0 -1
- package/.ai/skills/release-eject-pr/SKILL.md +0 -1
- package/.ai/skills/spec-interview/SKILL.md +120 -0
- package/.ai/skills/test-hardening/SKILL.md +1 -0
- package/.ai/skills/ux-design/SKILL.md +34 -3
- package/.ai/skills/variables/SKILL.md +0 -2
- package/.ai/skills/workflow-development/SKILL.md +0 -1
- package/AGENTS.md +4 -0
- package/docs/agent-contract.md +2 -2
- package/docs/design-system.md +185 -31
- package/modules/access/migrations/0001_access_core.down.sql +1 -0
- package/modules/access/migrations/0001_access_core.up.sql +28 -0
- package/modules/access/migrations/README.md +3 -0
- package/modules/access/module.json +33 -0
- package/modules/access/package.json +43 -0
- package/modules/access/spec/module.yaml +225 -0
- package/modules/access/src/acl/permissions.ts +6 -0
- package/modules/access/src/api/endpoints.ts +244 -0
- package/modules/access/src/client/ActivityView.tsrx +245 -0
- package/modules/access/src/client/AttestationsView.tsrx +176 -0
- package/modules/access/src/client/ReviewView.tsrx +586 -0
- package/modules/access/src/client/api.ts +132 -0
- package/modules/access/src/client/contribution.tsrx +41 -0
- package/modules/access/src/client/index.ts +41 -0
- package/modules/access/src/client/navigation.ts +57 -0
- package/modules/access/src/client/presentation.ts +69 -0
- package/modules/access/src/client/state.ts +72 -0
- package/modules/access/src/domain/types.ts +189 -0
- package/modules/access/src/index.ts +38 -0
- package/modules/access/src/platform.ts +60 -0
- package/modules/access/src/server/index.ts +42 -0
- package/modules/access/src/server/runtime.ts +105 -0
- package/modules/access/src/services/access-service.ts +298 -0
- package/modules/access/src/services/audit-window.ts +78 -0
- package/modules/access/src/services/auth-directory.ts +72 -0
- package/modules/access/src/services/changes.ts +91 -0
- package/modules/access/src/services/data-classes.ts +28 -0
- package/modules/access/src/services/database-repository.ts +185 -0
- package/modules/access/src/services/directory.ts +102 -0
- package/modules/access/src/services/index.ts +33 -0
- package/modules/access/src/services/list-exports.ts +150 -0
- package/modules/access/src/services/migration.ts +54 -0
- package/modules/access/src/services/repository.ts +30 -0
- package/modules/access/src/services/review.ts +178 -0
- package/modules/access/translations/en.json +155 -0
- package/modules/access/translations/pl.json +155 -0
- package/modules/agents/migrations/0022_credential_rotation_inventory.down.sql +2 -0
- package/modules/agents/migrations/0022_credential_rotation_inventory.up.sql +7 -0
- package/modules/agents/migrations/0023_agents_retention_indexes.down.sql +2 -0
- package/modules/agents/migrations/0023_agents_retention_indexes.up.sql +9 -0
- package/modules/agents/migrations/0024_agent_meter_refusals.down.sql +3 -0
- package/modules/agents/migrations/0024_agent_meter_refusals.up.sql +22 -0
- package/modules/agents/migrations/0025_agent_list_indexes.down.sql +3 -0
- package/modules/agents/migrations/0025_agent_list_indexes.up.sql +11 -0
- package/modules/agents/module.json +30 -4
- package/modules/agents/package.json +2 -1
- package/modules/agents/spec/module.yaml +63 -5
- package/modules/agents/src/api/endpoints.ts +291 -33
- package/modules/agents/src/cli/commands.json +11 -0
- package/modules/agents/src/cli/index.ts +45 -0
- package/modules/agents/src/client/AgentDashboardWidget.tsrx +19 -11
- package/modules/agents/src/client/AgentDefinitionList.tsrx +53 -10
- package/modules/agents/src/client/AgentPlaygroundView.tsrx +4 -4
- package/modules/agents/src/client/AgentProceduresView.tsrx +2 -2
- package/modules/agents/src/client/AgentRunsView.tsrx +143 -40
- package/modules/agents/src/client/AgentsView.tsrx +109 -33
- package/modules/agents/src/client/api.ts +99 -21
- package/modules/agents/src/client/state.ts +97 -0
- package/modules/agents/src/domain/types.ts +44 -4
- package/modules/agents/src/platform.ts +42 -0
- package/modules/agents/src/server/action-execution.ts +201 -106
- package/modules/agents/src/server/runtime.ts +32 -0
- package/modules/agents/src/services/agent-service.ts +158 -30
- package/modules/agents/src/services/credential-rotation.ts +185 -0
- package/modules/agents/src/services/credential-vault.ts +71 -46
- package/modules/agents/src/services/data-classes.ts +176 -0
- package/modules/agents/src/services/database-repository.ts +393 -101
- package/modules/agents/src/services/metering.ts +111 -0
- package/modules/agents/src/services/migration.ts +109 -0
- package/modules/agents/src/services/module-agent-preflight.ts +17 -9
- package/modules/agents/src/services/notifications.ts +98 -0
- package/modules/agents/src/services/provider-repository.ts +9 -18
- package/modules/agents/src/services/provider-service.ts +1 -9
- package/modules/agents/src/services/reports.ts +107 -0
- package/modules/agents/src/services/repository.ts +86 -6
- package/modules/agents/src/services/usage-service.ts +2 -0
- package/modules/agents/src/services/worker.ts +114 -4
- package/modules/agents/src/settings.ts +14 -3
- package/modules/agents/translations/en.json +14 -4
- package/modules/agents/translations/pl.json +14 -4
- package/modules/approvals/migrations/0001_approvals_core.down.sql +3 -0
- package/modules/approvals/migrations/0001_approvals_core.up.sql +78 -0
- package/modules/approvals/migrations/0002_approvals_expiry_routing_role.down.sql +2 -0
- package/modules/approvals/migrations/0002_approvals_expiry_routing_role.up.sql +19 -0
- package/modules/approvals/migrations/0003_approvals_retention_indexes.down.sql +6 -0
- package/modules/approvals/migrations/0003_approvals_retention_indexes.up.sql +14 -0
- package/modules/approvals/migrations/0004_approvals_inbox_keyset_indexes.down.sql +5 -0
- package/modules/approvals/migrations/0004_approvals_inbox_keyset_indexes.up.sql +12 -0
- package/modules/approvals/migrations/0005_approvals_grant_audit.down.sql +4 -0
- package/modules/approvals/migrations/0005_approvals_grant_audit.up.sql +20 -0
- package/modules/approvals/migrations/README.md +3 -0
- package/modules/approvals/module.json +34 -0
- package/modules/approvals/package.json +43 -0
- package/modules/approvals/spec/module.yaml +327 -0
- package/modules/approvals/src/acl/permissions.ts +7 -0
- package/modules/approvals/src/api/endpoints.ts +457 -0
- package/modules/approvals/src/client/ApprovalRequestDrawer.tsrx +138 -0
- package/modules/approvals/src/client/ApprovalsView.tsrx +562 -0
- package/modules/approvals/src/client/PendingCountWidget.tsrx +52 -0
- package/modules/approvals/src/client/api.ts +203 -0
- package/modules/approvals/src/client/approvals.css +51 -0
- package/modules/approvals/src/client/contribution.tsrx +44 -0
- package/modules/approvals/src/client/index.ts +26 -0
- package/modules/approvals/src/client/navigation.ts +39 -0
- package/modules/approvals/src/client/pending-count.ts +26 -0
- package/modules/approvals/src/client/presentation.ts +52 -0
- package/modules/approvals/src/client/state.ts +141 -0
- package/modules/approvals/src/domain/capability.ts +107 -0
- package/modules/approvals/src/domain/grant.ts +69 -0
- package/modules/approvals/src/domain/types.ts +168 -0
- package/modules/approvals/src/index.ts +61 -0
- package/modules/approvals/src/platform.ts +136 -0
- package/modules/approvals/src/server/index.ts +42 -0
- package/modules/approvals/src/server/runtime.ts +185 -0
- package/modules/approvals/src/services/approvals-service.ts +637 -0
- package/modules/approvals/src/services/callbacks.ts +75 -0
- package/modules/approvals/src/services/data-classes.ts +167 -0
- package/modules/approvals/src/services/database-repository.ts +783 -0
- package/modules/approvals/src/services/eligibility.ts +121 -0
- package/modules/approvals/src/services/expiry-runner.ts +81 -0
- package/modules/approvals/src/services/index.ts +31 -0
- package/modules/approvals/src/services/migration.ts +256 -0
- package/modules/approvals/src/services/notifications.ts +95 -0
- package/modules/approvals/src/services/repository.ts +169 -0
- package/modules/approvals/src/services/service-error.ts +70 -0
- package/modules/approvals/src/settings.ts +102 -0
- package/modules/approvals/translations/en.json +104 -0
- package/modules/approvals/translations/pl.json +104 -0
- package/modules/audit/migrations/0001_audit_core.down.sql +8 -0
- package/modules/audit/migrations/0001_audit_core.up.sql +107 -0
- package/modules/audit/migrations/0002_audit_sweep_routing_role.down.sql +2 -0
- package/modules/audit/migrations/0002_audit_sweep_routing_role.up.sql +21 -0
- package/modules/audit/migrations/0003_audit_export_request.down.sql +12 -0
- package/modules/audit/migrations/0003_audit_export_request.up.sql +40 -0
- package/modules/audit/migrations/0004_audit_hold_seal_erasure.down.sql +17 -0
- package/modules/audit/migrations/0004_audit_hold_seal_erasure.up.sql +192 -0
- package/modules/audit/migrations/0005_audit_event_format.down.sql +17 -0
- package/modules/audit/migrations/0005_audit_event_format.up.sql +60 -0
- package/modules/audit/migrations/0006_audit_own_class_walks.down.sql +3 -0
- package/modules/audit/migrations/0006_audit_own_class_walks.up.sql +14 -0
- package/modules/audit/migrations/README.md +3 -0
- package/modules/audit/module.json +32 -0
- package/modules/audit/package.json +49 -0
- package/modules/audit/spec/module.yaml +809 -0
- package/modules/audit/src/acl/permissions.ts +7 -0
- package/modules/audit/src/api/endpoints.ts +315 -0
- package/modules/audit/src/cli/commands.json +95 -0
- package/modules/audit/src/cli/index.ts +658 -0
- package/modules/audit/src/client/DataClassesView.tsrx +420 -0
- package/modules/audit/src/client/ExportsView.tsrx +256 -0
- package/modules/audit/src/client/HoldsView.tsrx +604 -0
- package/modules/audit/src/client/SweepsView.tsrx +251 -0
- package/modules/audit/src/client/api.ts +185 -0
- package/modules/audit/src/client/contribution.tsrx +52 -0
- package/modules/audit/src/client/index.ts +23 -0
- package/modules/audit/src/client/navigation.ts +74 -0
- package/modules/audit/src/client/presentation.ts +105 -0
- package/modules/audit/src/client/state.ts +86 -0
- package/modules/audit/src/domain/data-classes.ts +16 -0
- package/modules/audit/src/domain/types.ts +339 -0
- package/modules/audit/src/index.ts +76 -0
- package/modules/audit/src/platform.ts +44 -0
- package/modules/audit/src/server/index.ts +177 -0
- package/modules/audit/src/server/runtime.ts +303 -0
- package/modules/audit/src/services/anchor-key.ts +143 -0
- package/modules/audit/src/services/anchor-rotation.ts +147 -0
- package/modules/audit/src/services/audit-runners.ts +278 -0
- package/modules/audit/src/services/backup-guard.ts +95 -0
- package/modules/audit/src/services/database-repository.ts +1946 -0
- package/modules/audit/src/services/declared-classes.ts +64 -0
- package/modules/audit/src/services/erasure-port.ts +126 -0
- package/modules/audit/src/services/erasure-service.ts +770 -0
- package/modules/audit/src/services/export-directory.ts +106 -0
- package/modules/audit/src/services/export-service.ts +714 -0
- package/modules/audit/src/services/hold-service.ts +295 -0
- package/modules/audit/src/services/index.ts +17 -0
- package/modules/audit/src/services/migration.ts +658 -0
- package/modules/audit/src/services/own-classes.ts +318 -0
- package/modules/audit/src/services/platform-version.ts +23 -0
- package/modules/audit/src/services/repository.ts +495 -0
- package/modules/audit/src/services/retention-service.ts +191 -0
- package/modules/audit/src/services/seal-service.ts +769 -0
- package/modules/audit/src/services/service-error.ts +61 -0
- package/modules/audit/src/services/subject-keys.ts +90 -0
- package/modules/audit/src/services/sweep-service.ts +298 -0
- package/modules/audit/src/services/zip.ts +217 -0
- package/modules/audit/src/settings.ts +69 -0
- package/modules/audit/translations/en.json +210 -0
- package/modules/audit/translations/pl.json +210 -0
- package/modules/auth/README.md +77 -29
- package/modules/auth/migrations/0016_external_identities.up.sql +16 -0
- package/modules/auth/migrations/0017_mfa_key_id.up.sql +8 -0
- package/modules/auth/migrations/0018_retire_bundled_module_scopes.up.sql +29 -0
- package/modules/auth/migrations/0019_notifications_member_scopes.up.sql +44 -0
- package/modules/auth/migrations/0020_identity_providers.up.sql +61 -0
- package/modules/auth/migrations/0021_membership_status.up.sql +19 -0
- package/modules/auth/migrations/0022_auth_provider_scopes.up.sql +45 -0
- package/modules/auth/migrations/0023_enterprise_module_scopes.down.sql +19 -0
- package/modules/auth/migrations/0023_enterprise_module_scopes.up.sql +71 -0
- package/modules/auth/migrations/0024_approvals_member_scopes.down.sql +22 -0
- package/modules/auth/migrations/0024_approvals_member_scopes.up.sql +48 -0
- package/modules/auth/migrations/0025_audit_holds_owner_scope.down.sql +21 -0
- package/modules/auth/migrations/0025_audit_holds_owner_scope.up.sql +47 -0
- package/modules/auth/migrations/0026_auth_export_keyset_indexes.down.sql +6 -0
- package/modules/auth/migrations/0026_auth_export_keyset_indexes.up.sql +15 -0
- package/modules/auth/migrations/0027_workflow_automation_profile_scopes.down.sql +34 -0
- package/modules/auth/migrations/0027_workflow_automation_profile_scopes.up.sql +72 -0
- package/modules/auth/migrations/0028_auth_member_search_prefix_indexes.down.sql +6 -0
- package/modules/auth/migrations/0028_auth_member_search_prefix_indexes.up.sql +21 -0
- package/modules/auth/migrations/0029_reports_exports_access_scopes.down.sql +22 -0
- package/modules/auth/migrations/0029_reports_exports_access_scopes.up.sql +56 -0
- package/modules/auth/migrations/0030_auth_membership_keyset_index.down.sql +4 -0
- package/modules/auth/migrations/0030_auth_membership_keyset_index.up.sql +10 -0
- package/modules/auth/migrations/0031_membership_scope_backfills_under_rls.down.sql +4 -0
- package/modules/auth/migrations/0031_membership_scope_backfills_under_rls.up.sql +31 -0
- package/modules/auth/migrations/0032_audit_actor_service.down.sql +9 -0
- package/modules/auth/migrations/0032_audit_actor_service.up.sql +10 -0
- package/modules/auth/migrations/0033_auth_account_keyset_indexes.down.sql +5 -0
- package/modules/auth/migrations/0033_auth_account_keyset_indexes.up.sql +23 -0
- package/modules/auth/module.json +3 -3
- package/modules/auth/package.json +2 -1
- package/modules/auth/spec/module.yaml +372 -3
- package/modules/auth/src/acl/scopes.ts +50 -6
- package/modules/auth/src/cli/commands.json +11 -0
- package/modules/auth/src/cli/greenfield.ts +2 -2
- package/modules/auth/src/cli/index.ts +14 -0
- package/modules/auth/src/cli/secrets.ts +114 -0
- package/modules/auth/src/client/AuthenticationCore.tsrx +61 -8
- package/modules/auth/src/client/api.ts +72 -6
- package/modules/auth/src/client/contribution.tsrx +23 -0
- package/modules/auth/src/client/index.ts +6 -0
- package/modules/auth/src/client/providers/IdentityProviderForm.tsrx +191 -0
- package/modules/auth/src/client/providers/IdentityProvidersView.tsrx +358 -0
- package/modules/auth/src/client/providers/api.ts +128 -0
- package/modules/auth/src/client/providers/provider-columns.tsrx +60 -0
- package/modules/auth/src/client/providers/state.ts +35 -0
- package/modules/auth/src/client/security/SecurityView.tsrx +9 -1
- package/modules/auth/src/client/state.ts +15 -1
- package/modules/auth/src/domain/types.ts +55 -0
- package/modules/auth/src/index.ts +11 -1
- package/modules/auth/src/middleware/authentication.ts +4 -0
- package/modules/auth/src/server/endpoints.ts +467 -171
- package/modules/auth/src/server/http.ts +3 -2
- package/modules/auth/src/server/index.ts +22 -1
- package/modules/auth/src/server/membership-endpoints.ts +62 -0
- package/modules/auth/src/server/mfa-enforcement.ts +156 -0
- package/modules/auth/src/server/oidc.ts +389 -0
- package/modules/auth/src/server/provider-endpoints.ts +246 -0
- package/modules/auth/src/server/provider-host.ts +77 -0
- package/modules/auth/src/server/runtime.ts +231 -55
- package/modules/auth/src/services/auth-service-error.ts +7 -2
- package/modules/auth/src/services/auth-service.ts +948 -51
- package/modules/auth/src/services/data-classes.ts +236 -0
- package/modules/auth/src/services/database-repository.ts +853 -71
- package/modules/auth/src/services/identity-provider-service.ts +571 -0
- package/modules/auth/src/services/mail-delivery.ts +16 -16
- package/modules/auth/src/services/mail-message.ts +54 -0
- package/modules/auth/src/services/mail-port.ts +24 -0
- package/modules/auth/src/services/mail-smtp.ts +85 -0
- package/modules/auth/src/services/mfa-rotation.ts +144 -0
- package/modules/auth/src/services/migration.ts +810 -0
- package/modules/auth/src/services/password.ts +14 -0
- package/modules/auth/src/services/provider-secret-rotation.ts +169 -0
- package/modules/auth/src/services/provider-secrets.ts +136 -0
- package/modules/auth/src/services/repository.ts +321 -5
- package/modules/auth/src/services/session-sweep-runner.ts +73 -0
- package/modules/auth/src/services/settings-store.ts +10 -83
- package/modules/auth/src/services/totp.ts +88 -62
- package/modules/auth/src/services/validation.ts +194 -7
- package/modules/auth/src/settings.ts +18 -0
- package/modules/auth/translations/en.json +84 -1
- package/modules/auth/translations/pl.json +84 -1
- package/modules/automations/migrations/0005_secret_rotation_inventory.down.sql +1 -0
- package/modules/automations/migrations/0005_secret_rotation_inventory.up.sql +6 -0
- package/modules/automations/migrations/0006_automations_list_sort_indexes.down.sql +4 -0
- package/modules/automations/migrations/0006_automations_list_sort_indexes.up.sql +11 -0
- package/modules/automations/module.json +24 -6
- package/modules/automations/package.json +4 -1
- package/modules/automations/spec/module.yaml +81 -7
- package/modules/automations/src/api/endpoints.ts +202 -28
- package/modules/automations/src/cli/commands.json +17 -0
- package/modules/automations/src/cli/index.ts +114 -0
- package/modules/automations/src/client/AutomationScheduleForm.tsrx +77 -19
- package/modules/automations/src/client/AutomationSchedulesView.tsrx +144 -40
- package/modules/automations/src/client/AutomationTriggersView.tsrx +131 -32
- package/modules/automations/src/client/api.ts +62 -19
- package/modules/automations/src/client/presentation.ts +20 -2
- package/modules/automations/src/client/state.ts +84 -0
- package/modules/automations/src/domain/cadence.ts +99 -3
- package/modules/automations/src/domain/cron.ts +366 -0
- package/modules/automations/src/domain/time-zone.ts +61 -0
- package/modules/automations/src/platform.ts +38 -4
- package/modules/automations/src/server/index.ts +11 -0
- package/modules/automations/src/server/runtime.ts +46 -22
- package/modules/{automations-workflows-integration/src/server/adapter.ts → automations/src/server/workflow-target.ts} +13 -14
- package/modules/{automations-workflows-integration/src/server/tools.ts → automations/src/server/workflow-tools.ts} +0 -0
- package/modules/automations/src/services/data-classes.ts +62 -0
- package/modules/automations/src/services/database-repository.ts +152 -38
- package/modules/automations/src/services/migration.ts +119 -9
- package/modules/automations/src/services/repository.ts +52 -1
- package/modules/automations/src/services/schedule-runner.ts +84 -0
- package/modules/automations/src/services/schedule-service.ts +152 -26
- package/modules/automations/src/services/secret-rotation.ts +176 -0
- package/modules/automations/src/services/secret-vault.ts +68 -41
- package/modules/automations/src/services/trigger-service.ts +13 -10
- package/modules/automations/translations/en.json +15 -2
- package/modules/automations/translations/pl.json +15 -2
- package/modules/connectors/migrations/0001_connectors_core.down.sql +3 -0
- package/modules/connectors/migrations/0001_connectors_core.up.sql +72 -0
- package/modules/connectors/migrations/0002_connectors_call_keys.down.sql +3 -0
- package/modules/connectors/migrations/0002_connectors_call_keys.up.sql +18 -0
- package/modules/connectors/migrations/0003_connectors_rotation_inventory.down.sql +2 -0
- package/modules/connectors/migrations/0003_connectors_rotation_inventory.up.sql +19 -0
- package/modules/connectors/migrations/README.md +3 -0
- package/modules/connectors/module.json +32 -0
- package/modules/{automations-workflows-integration → connectors}/package.json +28 -26
- package/modules/connectors/spec/module.yaml +448 -0
- package/modules/connectors/src/acl/permissions.ts +6 -0
- package/modules/connectors/src/agent/tools.ts +180 -0
- package/modules/connectors/src/api/endpoints.ts +572 -0
- package/modules/connectors/src/cli/commands.json +17 -0
- package/modules/connectors/src/cli/index.ts +126 -0
- package/modules/connectors/src/client/ConnectorCallsView.tsrx +358 -0
- package/modules/connectors/src/client/ConnectorForm.tsrx +424 -0
- package/modules/connectors/src/client/ConnectorsView.tsrx +711 -0
- package/modules/connectors/src/client/api.ts +281 -0
- package/modules/connectors/src/client/consent.ts +48 -0
- package/modules/connectors/src/client/contribution.tsrx +37 -0
- package/modules/connectors/src/client/index.ts +22 -0
- package/modules/connectors/src/client/navigation.ts +42 -0
- package/modules/connectors/src/client/presentation.ts +38 -0
- package/modules/connectors/src/client/state.ts +175 -0
- package/modules/connectors/src/domain/calls.ts +70 -0
- package/modules/connectors/src/domain/definitions.ts +190 -0
- package/modules/connectors/src/domain/http-json.ts +68 -0
- package/modules/connectors/src/domain/types.ts +185 -0
- package/modules/connectors/src/index.ts +64 -0
- package/modules/connectors/src/platform.ts +56 -0
- package/modules/connectors/src/server/index.ts +66 -0
- package/modules/connectors/src/server/runtime.ts +163 -0
- package/modules/connectors/src/services/call-service.ts +903 -0
- package/modules/connectors/src/services/connectors-service.ts +653 -0
- package/modules/connectors/src/services/credential-rotation.ts +221 -0
- package/modules/connectors/src/services/credential-vault.ts +194 -0
- package/modules/connectors/src/services/data-classes.ts +158 -0
- package/modules/connectors/src/services/database-repository.ts +897 -0
- package/modules/connectors/src/services/egress.ts +261 -0
- package/modules/connectors/src/services/index.ts +19 -0
- package/modules/connectors/src/services/migration.ts +202 -0
- package/modules/connectors/src/services/repository.ts +175 -0
- package/modules/connectors/src/services/service-error.ts +46 -0
- package/modules/connectors/src/settings.ts +69 -0
- package/modules/connectors/translations/en.json +191 -0
- package/modules/connectors/translations/pl.json +191 -0
- package/modules/directory/migrations/0001_directory_core.down.sql +5 -0
- package/modules/directory/migrations/0001_directory_core.up.sql +111 -0
- package/modules/directory/migrations/README.md +3 -0
- package/modules/directory/module.json +27 -0
- package/modules/directory/package.json +46 -0
- package/modules/directory/spec/module.yaml +351 -0
- package/modules/directory/src/acl/permissions.ts +7 -0
- package/modules/directory/src/api/endpoints.ts +478 -0
- package/modules/directory/src/api/scim-endpoints.ts +516 -0
- package/modules/directory/src/client/GroupMappingsView.tsrx +430 -0
- package/modules/directory/src/client/ProvisioningLogView.tsrx +248 -0
- package/modules/directory/src/client/ScimTokensView.tsrx +587 -0
- package/modules/directory/src/client/api.ts +222 -0
- package/modules/directory/src/client/contribution.tsrx +46 -0
- package/modules/directory/src/client/index.ts +22 -0
- package/modules/directory/src/client/navigation.ts +57 -0
- package/modules/directory/src/client/presentation.ts +143 -0
- package/modules/directory/src/client/state.ts +173 -0
- package/modules/directory/src/domain/scim.ts +346 -0
- package/modules/directory/src/domain/types.ts +166 -0
- package/modules/directory/src/index.ts +44 -0
- package/modules/directory/src/platform.ts +43 -0
- package/modules/directory/src/server/index.ts +17 -0
- package/modules/directory/src/server/runtime.ts +124 -0
- package/modules/directory/src/services/auth-port.ts +127 -0
- package/modules/directory/src/services/data-classes.ts +41 -0
- package/modules/directory/src/services/database-repository.ts +1067 -0
- package/modules/directory/src/services/directory-service.ts +311 -0
- package/modules/directory/src/services/index.ts +43 -0
- package/modules/directory/src/services/migration.ts +146 -0
- package/modules/directory/src/services/provisioning-service.ts +1420 -0
- package/modules/directory/src/services/rate-limiter.ts +103 -0
- package/modules/directory/src/services/repository.ts +208 -0
- package/modules/directory/src/services/service-error.ts +42 -0
- package/modules/directory/src/services/token-service.ts +215 -0
- package/modules/directory/src/settings.ts +86 -0
- package/modules/directory/translations/en.json +185 -0
- package/modules/directory/translations/pl.json +185 -0
- package/modules/documents/migrations/0001_documents_core.down.sql +1 -0
- package/modules/documents/migrations/0001_documents_core.up.sql +35 -0
- package/modules/documents/migrations/0002_documents_files_page.down.sql +1 -0
- package/modules/documents/migrations/0002_documents_files_page.up.sql +6 -0
- package/modules/documents/migrations/0003_documents_rotation_inventory.down.sql +2 -0
- package/modules/documents/migrations/0003_documents_rotation_inventory.up.sql +18 -0
- package/modules/documents/migrations/README.md +3 -0
- package/modules/documents/module.json +32 -0
- package/modules/documents/package.json +50 -0
- package/modules/documents/spec/module.yaml +248 -0
- package/modules/documents/src/acl/permissions.ts +6 -0
- package/modules/documents/src/api/endpoints.ts +401 -0
- package/modules/documents/src/cli/commands.json +17 -0
- package/modules/documents/src/cli/index.ts +145 -0
- package/modules/documents/src/client/DocumentUploader.tsrx +148 -0
- package/modules/documents/src/client/DocumentsView.tsrx +540 -0
- package/modules/documents/src/client/api.ts +209 -0
- package/modules/documents/src/client/contribution.tsrx +29 -0
- package/modules/documents/src/client/download.ts +70 -0
- package/modules/documents/src/client/index.ts +22 -0
- package/modules/documents/src/client/navigation.ts +25 -0
- package/modules/documents/src/client/presentation.ts +110 -0
- package/modules/documents/src/client/state.ts +117 -0
- package/modules/documents/src/domain/attachments.ts +84 -0
- package/modules/documents/src/domain/types.ts +80 -0
- package/modules/documents/src/index.ts +46 -0
- package/modules/documents/src/platform.ts +61 -0
- package/modules/documents/src/server/index.ts +30 -0
- package/modules/documents/src/server/runtime.ts +107 -0
- package/modules/documents/src/services/attachments.ts +39 -0
- package/modules/documents/src/services/data-classes.ts +25 -0
- package/modules/documents/src/services/database-repository.ts +270 -0
- package/modules/documents/src/services/documents-service.ts +590 -0
- package/modules/documents/src/services/index.ts +18 -0
- package/modules/documents/src/services/migration.ts +117 -0
- package/modules/documents/src/services/repository.ts +58 -0
- package/modules/documents/src/services/storage-rotation.ts +157 -0
- package/modules/documents/src/settings.ts +107 -0
- package/modules/documents/translations/en.json +111 -0
- package/modules/documents/translations/pl.json +111 -0
- package/modules/exports/migrations/0001_exports_core.down.sql +2 -0
- package/modules/exports/migrations/0001_exports_core.up.sql +28 -0
- package/modules/exports/migrations/0002_exports_job_routing_role.down.sql +4 -0
- package/modules/exports/migrations/0002_exports_job_routing_role.up.sql +21 -0
- package/modules/exports/migrations/0003_exports_rotation_inventory.down.sql +1 -0
- package/modules/exports/migrations/0003_exports_rotation_inventory.up.sql +9 -0
- package/modules/exports/migrations/README.md +3 -0
- package/modules/exports/module.json +32 -0
- package/modules/exports/package.json +45 -0
- package/modules/exports/spec/module.yaml +230 -0
- package/modules/exports/src/acl/permissions.ts +6 -0
- package/modules/exports/src/api/endpoints.ts +211 -0
- package/modules/exports/src/cli/commands.json +17 -0
- package/modules/exports/src/cli/index.ts +145 -0
- package/modules/exports/src/client/ExportsView.tsrx +327 -0
- package/modules/exports/src/client/api.ts +133 -0
- package/modules/exports/src/client/contribution.tsrx +31 -0
- package/modules/exports/src/client/index.ts +20 -0
- package/modules/exports/src/client/navigation.ts +25 -0
- package/modules/exports/src/client/presentation.ts +53 -0
- package/modules/exports/src/client/state.ts +56 -0
- package/modules/exports/src/domain/lists.ts +29 -0
- package/modules/exports/src/domain/types.ts +120 -0
- package/modules/exports/src/index.ts +41 -0
- package/modules/exports/src/platform.ts +80 -0
- package/modules/exports/src/server/index.ts +50 -0
- package/modules/exports/src/server/runtime.ts +160 -0
- package/modules/exports/src/services/data-classes.ts +59 -0
- package/modules/exports/src/services/database-repository.ts +403 -0
- package/modules/exports/src/services/export-runner.ts +123 -0
- package/modules/exports/src/services/export-service.ts +356 -0
- package/modules/exports/src/services/index.ts +6 -0
- package/modules/exports/src/services/list-registry.ts +105 -0
- package/modules/exports/src/services/migration.ts +116 -0
- package/modules/exports/src/services/repository.ts +96 -0
- package/modules/exports/src/services/storage-rotation.ts +138 -0
- package/modules/exports/src/settings.ts +70 -0
- package/modules/exports/translations/en.json +69 -0
- package/modules/exports/translations/pl.json +69 -0
- package/modules/import/migrations/0001_import_core.down.sql +6 -0
- package/modules/import/migrations/0001_import_core.up.sql +61 -0
- package/modules/import/migrations/0002_import_job_routing_role.down.sql +4 -0
- package/modules/import/migrations/0002_import_job_routing_role.up.sql +20 -0
- package/modules/import/migrations/0003_import_jobs_export_index.down.sql +1 -0
- package/modules/import/migrations/0003_import_jobs_export_index.up.sql +7 -0
- package/modules/import/migrations/0004_import_jobs_traceparent.down.sql +1 -0
- package/modules/import/migrations/0004_import_jobs_traceparent.up.sql +7 -0
- package/modules/import/migrations/README.md +3 -0
- package/modules/import/module.json +37 -0
- package/modules/import/package.json +50 -0
- package/modules/import/spec/module.yaml +335 -0
- package/modules/import/src/acl/permissions.ts +6 -0
- package/modules/import/src/api/endpoints.ts +400 -0
- package/modules/import/src/client/ImportJobDrawer.tsrx +229 -0
- package/modules/import/src/client/ImportsView.tsrx +455 -0
- package/modules/import/src/client/NewImportForm.tsrx +274 -0
- package/modules/import/src/client/api.ts +243 -0
- package/modules/import/src/client/contribution.tsrx +29 -0
- package/modules/import/src/client/index.ts +23 -0
- package/modules/import/src/client/navigation.ts +25 -0
- package/modules/import/src/client/presentation.ts +59 -0
- package/modules/import/src/client/state.ts +43 -0
- package/modules/import/src/domain/csv.ts +258 -0
- package/modules/import/src/domain/ports.ts +157 -0
- package/modules/import/src/domain/types.ts +179 -0
- package/modules/import/src/index.ts +58 -0
- package/modules/import/src/platform.ts +60 -0
- package/modules/import/src/server/index.ts +49 -0
- package/modules/import/src/server/runtime.ts +158 -0
- package/modules/import/src/services/csv-source.ts +121 -0
- package/modules/import/src/services/data-classes.ts +63 -0
- package/modules/import/src/services/database-repository.ts +780 -0
- package/modules/import/src/services/import-runner.ts +127 -0
- package/modules/import/src/services/import-service.ts +872 -0
- package/modules/import/src/services/index.ts +6 -0
- package/modules/import/src/services/migration.ts +156 -0
- package/modules/import/src/services/port-registry.ts +158 -0
- package/modules/import/src/services/repository.ts +147 -0
- package/modules/import/src/settings.ts +70 -0
- package/modules/import/translations/en.json +175 -0
- package/modules/import/translations/pl.json +175 -0
- package/modules/metering/migrations/0001_metering_core.down.sql +6 -0
- package/modules/metering/migrations/0001_metering_core.up.sql +119 -0
- package/modules/metering/migrations/0002_metering_bucket_export.down.sql +3 -0
- package/modules/metering/migrations/0002_metering_bucket_export.up.sql +5 -0
- package/modules/metering/migrations/README.md +3 -0
- package/modules/metering/module.json +46 -0
- package/modules/metering/package.json +50 -0
- package/modules/metering/spec/module.yaml +269 -0
- package/modules/metering/src/acl/permissions.ts +5 -0
- package/modules/metering/src/api/endpoints.ts +104 -0
- package/modules/metering/src/cli/commands.json +28 -0
- package/modules/metering/src/cli/index.ts +246 -0
- package/modules/metering/src/client/LimitsView.tsrx +170 -0
- package/modules/metering/src/client/UsageSummaryWidget.tsrx +63 -0
- package/modules/metering/src/client/UsageView.tsrx +205 -0
- package/modules/metering/src/client/api.ts +91 -0
- package/modules/metering/src/client/contribution.tsrx +42 -0
- package/modules/metering/src/client/index.ts +26 -0
- package/modules/metering/src/client/navigation.ts +54 -0
- package/modules/metering/src/client/presentation.ts +63 -0
- package/modules/metering/src/client/state.ts +31 -0
- package/modules/metering/src/domain/meters.ts +100 -0
- package/modules/metering/src/domain/types.ts +71 -0
- package/modules/metering/src/index.ts +51 -0
- package/modules/metering/src/platform.ts +84 -0
- package/modules/metering/src/server/index.ts +40 -0
- package/modules/metering/src/server/runtime.ts +165 -0
- package/modules/metering/src/services/data-classes.ts +34 -0
- package/modules/metering/src/services/database-repository.ts +574 -0
- package/modules/metering/src/services/index.ts +9 -0
- package/modules/metering/src/services/meter-registry.ts +145 -0
- package/modules/metering/src/services/metering-service.ts +441 -0
- package/modules/metering/src/services/migration.ts +183 -0
- package/modules/metering/src/services/notifications.ts +75 -0
- package/modules/metering/src/services/reports.ts +105 -0
- package/modules/metering/src/services/repository.ts +132 -0
- package/modules/metering/src/services/service-error.ts +46 -0
- package/modules/metering/src/settings.ts +47 -0
- package/modules/metering/translations/en.json +68 -0
- package/modules/metering/translations/pl.json +68 -0
- package/modules/notifications/migrations/0001_notifications_core.down.sql +1 -0
- package/modules/notifications/migrations/0001_notifications_core.up.sql +26 -0
- package/modules/notifications/migrations/0002_notifications_preferences.down.sql +1 -0
- package/modules/notifications/migrations/0002_notifications_preferences.up.sql +17 -0
- package/modules/notifications/migrations/0003_notifications_webhook_subscriptions.down.sql +1 -0
- package/modules/notifications/migrations/0003_notifications_webhook_subscriptions.up.sql +30 -0
- package/modules/notifications/migrations/0004_notifications_deliveries.down.sql +1 -0
- package/modules/notifications/migrations/0004_notifications_deliveries.up.sql +35 -0
- package/modules/notifications/migrations/0005_notifications_delivery_routing_role.down.sql +2 -0
- package/modules/notifications/migrations/0005_notifications_delivery_routing_role.up.sql +17 -0
- package/modules/notifications/migrations/0006_notifications_delivery_title.down.sql +1 -0
- package/modules/notifications/migrations/0006_notifications_delivery_title.up.sql +11 -0
- package/modules/notifications/migrations/0007_notifications_secret_rotation_inventory.down.sql +2 -0
- package/modules/notifications/migrations/0007_notifications_secret_rotation_inventory.up.sql +19 -0
- package/modules/notifications/migrations/0008_notifications_delivery_claim.down.sql +8 -0
- package/modules/notifications/migrations/0008_notifications_delivery_claim.up.sql +19 -0
- package/modules/notifications/migrations/0009_notifications_kind_approvals.down.sql +16 -0
- package/modules/notifications/migrations/0009_notifications_kind_approvals.up.sql +18 -0
- package/modules/notifications/migrations/0010_notifications_kind_meter_threshold.down.sql +16 -0
- package/modules/notifications/migrations/0010_notifications_kind_meter_threshold.up.sql +18 -0
- package/modules/notifications/migrations/0011_notifications_retention_keyset.down.sql +5 -0
- package/modules/notifications/migrations/0011_notifications_retention_keyset.up.sql +15 -0
- package/modules/notifications/migrations/0012_notifications_email_channel.down.sql +12 -0
- package/modules/notifications/migrations/0012_notifications_email_channel.up.sql +38 -0
- package/modules/notifications/migrations/0013_notifications_list_pages.down.sql +5 -0
- package/modules/notifications/migrations/0013_notifications_list_pages.up.sql +13 -0
- package/modules/notifications/migrations/README.md +3 -0
- package/modules/notifications/module.json +32 -0
- package/modules/notifications/package.json +49 -0
- package/modules/notifications/spec/module.yaml +718 -0
- package/modules/notifications/src/acl/permissions.ts +11 -0
- package/modules/notifications/src/api/endpoints.ts +814 -0
- package/modules/notifications/src/cli/commands.json +17 -0
- package/modules/notifications/src/cli/index.ts +126 -0
- package/modules/notifications/src/client/DeliveriesView.tsrx +483 -0
- package/modules/notifications/src/client/FactList.tsrx +24 -0
- package/modules/notifications/src/client/NotificationPreferencesView.tsrx +240 -0
- package/modules/notifications/src/client/NotificationsInboxView.tsrx +592 -0
- package/modules/notifications/src/client/UnreadCountWidget.tsrx +62 -0
- package/modules/notifications/src/client/WebhookForm.tsrx +297 -0
- package/modules/notifications/src/client/WebhooksView.tsrx +637 -0
- package/modules/notifications/src/client/api.ts +382 -0
- package/modules/notifications/src/client/contribution.tsrx +83 -0
- package/modules/notifications/src/client/inbox.ts +41 -0
- package/modules/notifications/src/client/index.ts +29 -0
- package/modules/notifications/src/client/navigation.ts +92 -0
- package/modules/notifications/src/client/notifications.css +70 -0
- package/modules/notifications/src/client/presentation.ts +81 -0
- package/modules/notifications/src/client/state.ts +246 -0
- package/modules/notifications/src/client/unread-count.ts +26 -0
- package/modules/notifications/src/domain/locale.ts +47 -0
- package/modules/notifications/src/domain/publish.ts +46 -0
- package/modules/notifications/src/domain/types.ts +186 -0
- package/modules/notifications/src/index.ts +62 -0
- package/modules/notifications/src/platform.ts +85 -0
- package/modules/notifications/src/server/index.ts +82 -0
- package/modules/notifications/src/server/runtime.ts +251 -0
- package/modules/notifications/src/services/data-classes.ts +139 -0
- package/modules/notifications/src/services/database-repository.ts +1334 -0
- package/modules/notifications/src/services/delivery-payload.ts +93 -0
- package/modules/notifications/src/services/delivery-runner.ts +170 -0
- package/modules/notifications/src/services/delivery-service.ts +811 -0
- package/modules/notifications/src/services/egress.ts +239 -0
- package/modules/notifications/src/services/email-channel.ts +93 -0
- package/modules/notifications/src/services/index.ts +23 -0
- package/modules/notifications/src/services/migration.ts +572 -0
- package/modules/notifications/src/services/notifications-service.ts +297 -0
- package/modules/notifications/src/services/paging.ts +60 -0
- package/modules/notifications/src/services/publish-service.ts +133 -0
- package/modules/notifications/src/services/repository.ts +342 -0
- package/modules/notifications/src/services/secret-rotation.ts +177 -0
- package/modules/notifications/src/services/secret-vault.ts +168 -0
- package/modules/notifications/src/services/service-error.ts +67 -0
- package/modules/notifications/src/services/signature.ts +81 -0
- package/modules/notifications/src/services/webhook-service.ts +307 -0
- package/modules/notifications/src/settings.ts +130 -0
- package/modules/notifications/translations/en.json +255 -0
- package/modules/notifications/translations/pl.json +255 -0
- package/modules/profile/module.json +3 -3
- package/modules/profile/package.json +1 -1
- package/modules/profile/spec/module.yaml +3 -3
- package/modules/profile/src/services/database-repository.ts +3 -13
- package/modules/reports/module.json +28 -0
- package/modules/reports/package.json +42 -0
- package/modules/reports/spec/module.yaml +231 -0
- package/modules/reports/src/acl/permissions.ts +5 -0
- package/modules/reports/src/api/endpoints.ts +72 -0
- package/modules/reports/src/client/ReportsSummaryWidget.tsrx +52 -0
- package/modules/reports/src/client/ReportsView.tsrx +246 -0
- package/modules/reports/src/client/api.ts +65 -0
- package/modules/reports/src/client/contribution.tsrx +36 -0
- package/modules/reports/src/client/index.ts +18 -0
- package/modules/reports/src/client/navigation.ts +39 -0
- package/modules/reports/src/client/presentation.ts +123 -0
- package/modules/reports/src/client/state.ts +28 -0
- package/modules/reports/src/domain/providers.ts +115 -0
- package/modules/reports/src/domain/types.ts +44 -0
- package/modules/reports/src/index.ts +47 -0
- package/modules/reports/src/platform.ts +37 -0
- package/modules/reports/src/server/index.ts +21 -0
- package/modules/reports/src/server/runtime.ts +40 -0
- package/modules/reports/src/services/index.ts +17 -0
- package/modules/reports/src/services/provider-registry.ts +144 -0
- package/modules/reports/src/services/range.ts +65 -0
- package/modules/reports/src/services/reports-service.ts +316 -0
- package/modules/reports/src/services/service-error.ts +26 -0
- package/modules/reports/src/settings.ts +49 -0
- package/modules/reports/translations/en.json +35 -0
- package/modules/reports/translations/pl.json +35 -0
- package/modules/sandbox/module.json +4 -4
- package/modules/sandbox/package.json +1 -1
- package/modules/sandbox/spec/module.yaml +3 -3
- package/modules/sandbox/src/services/database-repository.ts +14 -23
- package/modules/sandbox/src/services/directory.ts +16 -0
- package/modules/sandbox/src/services/sandbox-service.ts +13 -11
- package/modules/search/migrations/0001_search_core.down.sql +1 -0
- package/modules/search/migrations/0001_search_core.up.sql +22 -0
- package/modules/search/migrations/0002_search_recent_export.down.sql +3 -0
- package/modules/search/migrations/0002_search_recent_export.up.sql +5 -0
- package/modules/search/migrations/README.md +3 -0
- package/modules/search/module.json +28 -0
- package/modules/search/package.json +43 -0
- package/modules/search/spec/module.yaml +177 -0
- package/modules/search/src/acl/permissions.ts +5 -0
- package/modules/search/src/api/endpoints.ts +221 -0
- package/modules/search/src/client/SearchView.tsrx +346 -0
- package/modules/search/src/client/api.ts +157 -0
- package/modules/search/src/client/contribution.tsrx +31 -0
- package/modules/search/src/client/index.ts +17 -0
- package/modules/search/src/client/navigation.ts +97 -0
- package/modules/search/src/client/search.css +56 -0
- package/modules/search/src/client/state.ts +113 -0
- package/modules/search/src/domain/data-classes.ts +73 -0
- package/modules/search/src/domain/providers.ts +88 -0
- package/modules/search/src/domain/types.ts +56 -0
- package/modules/search/src/index.ts +46 -0
- package/modules/search/src/platform.ts +42 -0
- package/modules/search/src/server/index.ts +25 -0
- package/modules/search/src/server/runtime.ts +123 -0
- package/modules/search/src/services/database-repository.ts +163 -0
- package/modules/search/src/services/index.ts +21 -0
- package/modules/search/src/services/migration.ts +65 -0
- package/modules/search/src/services/provider-registry.ts +137 -0
- package/modules/search/src/services/repository.ts +43 -0
- package/modules/search/src/services/search-service.ts +442 -0
- package/modules/search/src/services/service-error.ts +35 -0
- package/modules/search/src/settings.ts +68 -0
- package/modules/search/translations/en.json +45 -0
- package/modules/search/translations/pl.json +45 -0
- package/modules/system/module.json +2 -2
- package/modules/system/package.json +1 -1
- package/modules/system/spec/module.yaml +30 -3
- package/modules/system/src/client/FlagsPanel.tsrx +127 -0
- package/modules/system/src/client/ModuleSettingRow.tsrx +17 -7
- package/modules/system/src/client/ModuleSettingsSection.tsrx +10 -71
- package/modules/system/src/client/ModulesView.tsrx +91 -65
- package/modules/system/src/client/flags.ts +35 -0
- package/modules/system/src/client/index.ts +8 -0
- package/modules/system/src/client/navigation.ts +8 -0
- package/modules/system/src/client/settings-state.ts +159 -0
- package/modules/system/src/client/state.ts +2 -0
- package/modules/system/src/domain/time-zone.ts +105 -0
- package/modules/system/src/index.ts +12 -0
- package/modules/system/src/platform.ts +5 -1
- package/modules/system/src/server/endpoints.ts +72 -21
- package/modules/system/src/settings.ts +28 -0
- package/modules/system/translations/en.json +17 -0
- package/modules/system/translations/pl.json +17 -0
- package/modules/users/module.json +30 -4
- package/modules/users/package.json +4 -1
- package/modules/users/spec/module.yaml +290 -7
- package/modules/users/src/api/endpoints.ts +228 -15
- package/modules/users/src/client/InviteMemberForm.tsrx +2 -2
- package/modules/users/src/client/MemberDrawer.tsrx +142 -26
- package/modules/users/src/client/UserAccountForm.tsrx +2 -2
- package/modules/users/src/client/UsersView.tsrx +432 -71
- package/modules/users/src/client/api.ts +106 -12
- package/modules/users/src/client/contribution.tsrx +5 -0
- package/modules/users/src/client/member-columns.tsrx +22 -9
- package/modules/users/src/client/state.ts +172 -7
- package/modules/users/src/domain/lists.ts +9 -0
- package/modules/users/src/index.ts +11 -0
- package/modules/users/src/platform.ts +50 -1
- package/modules/users/src/services/member-export.ts +51 -0
- package/modules/users/src/services/member-import.ts +249 -0
- package/modules/users/src/services/member-search.ts +145 -0
- package/modules/users/src/services/users-service.ts +117 -4
- package/modules/users/translations/en.json +57 -8
- package/modules/users/translations/pl.json +57 -8
- package/modules/workflows/migrations/0004_payload_rotation_inventory.up.sql +17 -0
- package/modules/workflows/migrations/0005_workflows_human_approval.up.sql +28 -0
- package/modules/workflows/migrations/0006_workflows_retention_indexes.up.sql +11 -0
- package/modules/workflows/migrations/0007_workflows_erasure_subject_indexes.up.sql +17 -0
- package/modules/workflows/migrations/0008_workflows_subject_account.up.sql +24 -0
- package/modules/workflows/migrations/0009_workflows_definition_list_indexes.up.sql +9 -0
- package/modules/workflows/module.json +34 -6
- package/modules/workflows/package.json +2 -1
- package/modules/workflows/spec/module.yaml +26 -9
- package/modules/workflows/src/api/endpoints.ts +131 -25
- package/modules/workflows/src/cli/commands.json +17 -0
- package/modules/workflows/src/cli/index.ts +114 -0
- package/modules/workflows/src/client/WorkflowExecutionHistory.tsrx +36 -27
- package/modules/workflows/src/client/WorkflowInspector.tsrx +116 -0
- package/modules/workflows/src/client/WorkflowNodePalette.tsrx +1 -0
- package/modules/workflows/src/client/WorkflowsView.tsrx +236 -99
- package/modules/workflows/src/client/api.ts +54 -34
- package/modules/workflows/src/client/canvas-model.ts +12 -0
- package/modules/workflows/src/client/state.ts +95 -0
- package/modules/workflows/src/domain/events.ts +25 -11
- package/modules/workflows/src/domain/graph.ts +135 -1
- package/modules/workflows/src/domain/types.ts +91 -4
- package/modules/workflows/src/platform.ts +12 -0
- package/modules/workflows/src/server/runtime.ts +78 -5
- package/modules/workflows/src/services/approvals.ts +62 -0
- package/modules/workflows/src/services/cursors.ts +37 -0
- package/modules/workflows/src/services/data-classes.ts +232 -0
- package/modules/workflows/src/services/database-repository.ts +660 -171
- package/modules/workflows/src/services/migration.ts +240 -0
- package/modules/workflows/src/services/notifications.ts +98 -0
- package/modules/workflows/src/services/payload-codec.ts +51 -28
- package/modules/workflows/src/services/payload-rotation.ts +171 -0
- package/modules/workflows/src/services/repository.ts +123 -8
- package/modules/workflows/src/services/simulation.ts +7 -0
- package/modules/workflows/src/services/worker.ts +446 -25
- package/modules/workflows/src/services/workflows-service.ts +264 -103
- package/modules/workflows/translations/en.json +12 -4
- package/modules/workflows/translations/pl.json +12 -4
- package/modules.json +48 -4
- package/package.json +64 -6
- package/packages/client/package.json +1 -0
- package/packages/client/src/ApplicationShell.tsrx +43 -0
- package/packages/client/src/contributions.ts +55 -0
- package/packages/client/src/i18n/locales/en.json +5 -0
- package/packages/client/src/i18n/locales/pl.json +5 -0
- package/packages/client/src/index.ts +13 -1
- package/packages/client/src/routing.ts +22 -0
- package/packages/client/src/shell/CommandPalette.tsrx +223 -11
- package/packages/client/src/shell/command-search.ts +126 -0
- package/packages/client/src/shell/command.ts +30 -0
- package/packages/client/src/shell/navigation.ts +12 -0
- package/packages/client/src/shell/palette-keys.ts +27 -0
- package/packages/client/src/shell/shell.css +7 -0
- package/packages/contracts/schemas/module-spec.schema.json +287 -1
- package/packages/contracts/schemas/module.schema.json +25 -0
- package/packages/contracts/src/index.ts +144 -1
- package/packages/database/src/backup.ts +180 -0
- package/packages/database/src/decoders.ts +25 -0
- package/packages/database/src/index.ts +17 -0
- package/packages/database/src/migrations.ts +7 -0
- package/packages/database/src/record-history.ts +5 -14
- package/packages/harness/src/index.ts +2 -0
- package/packages/harness/src/runtime.ts +378 -2
- package/packages/harness/src/tool-adapters.ts +20 -9
- package/packages/kernel/src/acl.ts +179 -0
- package/packages/kernel/src/approval-grant.ts +310 -0
- package/packages/kernel/src/capability-registry.ts +69 -2
- package/packages/kernel/src/data-class-registry.ts +354 -0
- package/packages/kernel/src/index.ts +85 -4
- package/packages/kernel/src/keyring.ts +208 -0
- package/packages/kernel/src/module-compatibility.ts +35 -4
- package/packages/kernel/src/module-registry.ts +49 -2
- package/packages/kernel/src/module-settings.ts +189 -27
- package/packages/server/package.json +2 -1
- package/packages/server/src/composition.ts +38 -0
- package/packages/server/src/endpoint.ts +104 -47
- package/packages/server/src/export/csv.ts +34 -0
- package/packages/server/src/export/definition.ts +346 -0
- package/packages/server/src/export/index.ts +61 -0
- package/packages/server/src/export/run.ts +116 -0
- package/packages/server/src/index.ts +155 -0
- package/packages/server/src/jobs/index.ts +93 -0
- package/packages/server/src/jobs/runner.ts +486 -0
- package/packages/server/src/log.ts +291 -0
- package/packages/server/src/mail/config.ts +184 -0
- package/packages/server/src/mail/contracts.ts +251 -0
- package/packages/server/src/mail/index.ts +31 -0
- package/packages/server/src/mail/port.ts +101 -0
- package/packages/server/src/mail/smtp.ts +191 -0
- package/packages/server/src/mail/template.ts +105 -0
- package/packages/server/src/metrics.ts +447 -0
- package/packages/server/src/pagination.ts +246 -0
- package/packages/server/src/trace/context.ts +103 -0
- package/packages/server/src/trace/egress.ts +66 -0
- package/packages/server/src/trace/error-sink.ts +296 -0
- package/packages/server/src/trace/exporter.ts +295 -0
- package/packages/server/src/trace/index.ts +60 -0
- package/packages/server/src/trace/job-sink.ts +172 -0
- package/packages/server/src/trace/tracer.ts +338 -0
- package/packages/server/src/web.ts +5 -1
- package/packages/storage/package.json +40 -0
- package/packages/storage/src/config.ts +189 -0
- package/packages/storage/src/content-type.ts +124 -0
- package/packages/storage/src/contracts.ts +112 -0
- package/packages/storage/src/envelope.ts +238 -0
- package/packages/storage/src/index.ts +49 -0
- package/packages/storage/src/local.ts +75 -0
- package/packages/storage/src/port.ts +262 -0
- package/packages/storage/src/read-token.ts +130 -0
- package/packages/storage/src/reseal.ts +128 -0
- package/packages/storage/src/s3.ts +144 -0
- package/packages/storage/src/scanner.ts +22 -0
- package/packages/storage/src/sigv4.ts +104 -0
- package/packages/storage/src/store.ts +13 -0
- package/packages/ui/package.json +1 -0
- package/packages/ui/src/components/Button.tsrx +3 -0
- package/packages/ui/src/components/ConfirmDialog.tsrx +13 -2
- package/packages/ui/src/components/DateField.tsrx +92 -0
- package/packages/ui/src/components/DatePicker.tsrx +525 -0
- package/packages/ui/src/components/DateRangeField.tsrx +93 -0
- package/packages/ui/src/components/Drawer.tsrx +10 -1
- package/packages/ui/src/components/FileUpload.tsrx +158 -0
- package/packages/ui/src/components/Pagination.tsrx +130 -0
- package/packages/ui/src/components/Select.tsrx +78 -0
- package/packages/ui/src/components/Table.tsrx +498 -81
- package/packages/ui/src/components/Tabs.tsrx +53 -0
- package/packages/ui/src/components/ToastHost.tsrx +48 -0
- package/packages/ui/src/components/calendar.ts +243 -0
- package/packages/ui/src/components/date-field.ts +62 -0
- package/packages/ui/src/components/file-upload.ts +49 -0
- package/packages/ui/src/components/focus-trap.ts +62 -0
- package/packages/ui/src/components/pagination.ts +68 -0
- package/packages/ui/src/components/table-sorting.ts +49 -0
- package/packages/ui/src/components/tabs.ts +61 -0
- package/packages/ui/src/components/toast-store.ts +116 -0
- package/packages/ui/src/icons/Icon.tsrx +5 -0
- package/packages/ui/src/index.ts +45 -0
- package/packages/ui/src/styles/components.css +598 -0
- package/modules/automations-workflows-integration/module.json +0 -27
- package/modules/automations-workflows-integration/spec/module.yaml +0 -93
- package/modules/automations-workflows-integration/src/index.ts +0 -14
- package/modules/automations-workflows-integration/src/platform.ts +0 -24
- package/modules/automations-workflows-integration/src/server/index.ts +0 -11
- package/modules/automations-workflows-integration/translations/en.json +0 -21
- package/modules/automations-workflows-integration/translations/pl.json +0 -21
- package/modules/workflows/src/services/cursor-codec.ts +0 -62
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { AgentHarnessError } from './errors.ts';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
APPROVAL_GRANT_MAX_TOKEN_LENGTH,
|
|
5
|
+
approvalGrantKeyringFromEnvironment,
|
|
6
|
+
approvalInputDigest,
|
|
7
|
+
normalizeActor,
|
|
8
|
+
verifyApprovalGrant,
|
|
9
|
+
type Actor,
|
|
10
|
+
type ApprovalGrantKeyring,
|
|
11
|
+
type ApprovalGrantReason,
|
|
12
|
+
type UserActor,
|
|
13
|
+
} from '@flowdular/sdk/kernel';
|
|
4
14
|
import {
|
|
5
15
|
boundToolOutput,
|
|
6
16
|
toolTimeoutMs,
|
|
@@ -49,10 +59,16 @@ export interface AgentExecutionRequest {
|
|
|
49
59
|
readonly definition: AgentExecutionDefinition;
|
|
50
60
|
readonly permissionSnapshot: readonly string[];
|
|
51
61
|
readonly toolGrants: readonly string[];
|
|
62
|
+
/* Signed approval grants (`issueApprovalGrant`) for the external or
|
|
63
|
+
destructive tools this run may call, each bound to one tool id and one
|
|
64
|
+
input digest. Absent means no such tool is offered. */
|
|
65
|
+
readonly grants?: readonly string[];
|
|
52
66
|
/* Absent keeps the v1 text behavior. */
|
|
53
67
|
readonly outputContract?: AgentOutputContract;
|
|
54
68
|
}
|
|
55
69
|
|
|
70
|
+
export const MAX_APPROVAL_GRANTS = 16;
|
|
71
|
+
|
|
56
72
|
export type JsonPrimitive = string | number | boolean | null;
|
|
57
73
|
export type JsonValue =
|
|
58
74
|
| JsonPrimitive
|
|
@@ -106,6 +122,12 @@ export interface AgentToolContext {
|
|
|
106
122
|
refuse when the trusted identity is absent. */
|
|
107
123
|
readonly agentId?: string;
|
|
108
124
|
readonly agentName?: string;
|
|
125
|
+
/* How the tool was reached: a model turn inside an agent run, or a workflow
|
|
126
|
+
node running it as a published action. A tool whose admission differs per
|
|
127
|
+
caller kind reads this instead of assuming one. Optional keeps v1 callers
|
|
128
|
+
and direct module tests source-compatible; absent means an agent run,
|
|
129
|
+
because the workflow action runtime always states it. */
|
|
130
|
+
readonly invocation?: 'agent-run' | 'workflow-action';
|
|
109
131
|
readonly idempotencyKey?: string;
|
|
110
132
|
/* Trusted provenance for record history. Optional preserves v1 direct tool
|
|
111
133
|
callers; harness and workflow executions always provide it. */
|
|
@@ -115,6 +137,28 @@ export interface AgentToolContext {
|
|
|
115
137
|
readonly signal: AbortSignal;
|
|
116
138
|
}
|
|
117
139
|
|
|
140
|
+
export interface AgentToolConsentDecision {
|
|
141
|
+
readonly granted: boolean;
|
|
142
|
+
/** Stable code recorded on the denial event when the gate refuses. */
|
|
143
|
+
readonly reason?: string;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* A module-owned gate asked before every call of a tool that declares one, so
|
|
148
|
+
* a workspace can admit a tool per record (a connector instance an owner
|
|
149
|
+
* consented to) without the tool declaring a risk the harness refuses outright.
|
|
150
|
+
* The answer is computed per call from the already validated input and is never
|
|
151
|
+
* cached; a gate that throws denies.
|
|
152
|
+
*/
|
|
153
|
+
export interface AgentToolConsent {
|
|
154
|
+
/** Stable id of the gate, recorded on the denial event. */
|
|
155
|
+
readonly id: string;
|
|
156
|
+
check(
|
|
157
|
+
input: unknown,
|
|
158
|
+
context: AgentToolContext,
|
|
159
|
+
): Promise<AgentToolConsentDecision> | AgentToolConsentDecision;
|
|
160
|
+
}
|
|
161
|
+
|
|
118
162
|
export interface AgentTool {
|
|
119
163
|
readonly id: string;
|
|
120
164
|
readonly transport: 'api' | 'cli';
|
|
@@ -125,6 +169,13 @@ export interface AgentTool {
|
|
|
125
169
|
readonly contractVersion?: number;
|
|
126
170
|
readonly outputSchema?: Readonly<Record<string, unknown>>;
|
|
127
171
|
readonly risk?: 'read' | 'workspace-write' | 'external' | 'destructive';
|
|
172
|
+
/* A CLI capability the runner admits in development and test only. The
|
|
173
|
+
harness reads FD_ENV or NODE_ENV the way the runner does and refuses it
|
|
174
|
+
elsewhere, grant or not. */
|
|
175
|
+
readonly localOnly?: boolean;
|
|
176
|
+
/* Run-time admission on top of the permission snapshot. A tool declaring one
|
|
177
|
+
is offered to the model as usual and refused per call when the gate says so. */
|
|
178
|
+
readonly consent?: AgentToolConsent;
|
|
128
179
|
readonly idempotency?: 'required';
|
|
129
180
|
/* A mutating tool is executable only when its target persists the key and
|
|
130
181
|
returns the first result on retry. Declaring `required` alone is not that
|
|
@@ -254,6 +305,23 @@ function assertExecutionRequest(request: AgentExecutionRequest): void {
|
|
|
254
305
|
);
|
|
255
306
|
}
|
|
256
307
|
boundedText(request.input, 'input', 1, 100_000);
|
|
308
|
+
if (request.grants !== undefined) {
|
|
309
|
+
if (
|
|
310
|
+
!Array.isArray(request.grants) ||
|
|
311
|
+
request.grants.length > MAX_APPROVAL_GRANTS ||
|
|
312
|
+
request.grants.some(
|
|
313
|
+
(grant) =>
|
|
314
|
+
typeof grant !== 'string' ||
|
|
315
|
+
grant.length < 1 ||
|
|
316
|
+
grant.length > APPROVAL_GRANT_MAX_TOKEN_LENGTH,
|
|
317
|
+
)
|
|
318
|
+
) {
|
|
319
|
+
throw new AgentHarnessError(
|
|
320
|
+
'INVALID_INPUT',
|
|
321
|
+
`grants must be at most ${MAX_APPROVAL_GRANTS} tokens of at most ${APPROVAL_GRANT_MAX_TOKEN_LENGTH} characters.`,
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
257
325
|
boundedText(request.definition.name, 'definition.name', 2, 120);
|
|
258
326
|
boundedText(request.definition.instructions, 'instructions', 8, 40_000);
|
|
259
327
|
providerReference(request.definition.provider);
|
|
@@ -355,15 +423,158 @@ function toolFailure(error: unknown): { code: string; message: string } {
|
|
|
355
423
|
return { code: 'TOOL_EXECUTION_FAILED', message };
|
|
356
424
|
}
|
|
357
425
|
|
|
426
|
+
/**
|
|
427
|
+
* `external` is the ceiling no unattended caller crosses on its own: the CLI
|
|
428
|
+
* runner, `defineCliAgentTool` for a destructive capability, and a hand-built
|
|
429
|
+
* tool object here all run only under a signed approval grant naming the tool
|
|
430
|
+
* and the input, before the model is ever told the tool exists.
|
|
431
|
+
*/
|
|
432
|
+
function requiresApprovalGrant(tool: AgentTool): boolean {
|
|
433
|
+
return (
|
|
434
|
+
tool.risk === 'external' ||
|
|
435
|
+
(tool.risk === 'destructive' && tool.transport === 'cli')
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
type GrantRefusal = ApprovalGrantReason | 'APPROVAL_GRANT_CONSUMED';
|
|
440
|
+
|
|
441
|
+
interface RunApprovalGrants {
|
|
442
|
+
/** Tokens that verify for this tenant, by the tool id they name. */
|
|
443
|
+
readonly byTool: ReadonlyMap<string, readonly string[]>;
|
|
444
|
+
/** Why the first refused token was refused, per tool, for the denial event. */
|
|
445
|
+
readonly refusals: ReadonlyMap<string, GrantRefusal>;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/* The same reading the CLI runner applies to a localOnly capability. */
|
|
449
|
+
function localOnlyRefused(tool: AgentTool): boolean {
|
|
450
|
+
const environment =
|
|
451
|
+
process.env.FD_ENV ?? process.env.NODE_ENV ?? 'development';
|
|
452
|
+
return (
|
|
453
|
+
tool.localOnly === true &&
|
|
454
|
+
environment !== 'development' &&
|
|
455
|
+
environment !== 'test'
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/* Signature, key and tenant are settled once per run; the input digest is
|
|
460
|
+
settled per call, because the model chooses the input. A token that is
|
|
461
|
+
invalid or expired is so for every tool, and is recorded against each. */
|
|
462
|
+
function runApprovalGrants(
|
|
463
|
+
keyring: ApprovalGrantKeyring | undefined,
|
|
464
|
+
request: AgentExecutionRequest,
|
|
465
|
+
tools: ReadonlyMap<string, AgentTool>,
|
|
466
|
+
): RunApprovalGrants {
|
|
467
|
+
const byTool = new Map<string, string[]>();
|
|
468
|
+
const refusals = new Map<string, GrantRefusal>();
|
|
469
|
+
if (!keyring) return { byTool, refusals };
|
|
470
|
+
const gated = [...tools.values()].filter(requiresApprovalGrant);
|
|
471
|
+
for (const token of request.grants ?? []) {
|
|
472
|
+
let reason: ApprovalGrantReason = 'APPROVAL_GRANT_MISMATCH';
|
|
473
|
+
let matched = false;
|
|
474
|
+
for (const tool of gated) {
|
|
475
|
+
const verified = verifyApprovalGrant(keyring, token, {
|
|
476
|
+
tenantId: request.tenantId,
|
|
477
|
+
capabilityId: tool.id,
|
|
478
|
+
});
|
|
479
|
+
if (verified.ok) {
|
|
480
|
+
byTool.set(tool.id, [...(byTool.get(tool.id) ?? []), token]);
|
|
481
|
+
matched = true;
|
|
482
|
+
break;
|
|
483
|
+
}
|
|
484
|
+
reason = verified.reason;
|
|
485
|
+
if (reason !== 'APPROVAL_GRANT_MISMATCH') break;
|
|
486
|
+
}
|
|
487
|
+
/* A token that verifies for no tool is refused for every gated tool: it
|
|
488
|
+
was signed for another tenant or capability, or not by this platform. */
|
|
489
|
+
if (!matched) {
|
|
490
|
+
for (const other of gated) {
|
|
491
|
+
if (!refusals.has(other.id)) refusals.set(other.id, reason);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
return { byTool, refusals };
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/* A refusal code comes from module code, so it is bounded to the shape an
|
|
499
|
+
event metadata field may carry before it is recorded. */
|
|
500
|
+
function consentReason(reason: string | undefined): string {
|
|
501
|
+
return reason !== undefined && /^[A-Z][A-Z0-9_]{2,63}$/.test(reason)
|
|
502
|
+
? reason
|
|
503
|
+
: 'TOOL_CONSENT_REFUSED';
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* The narrow tracing port the harness needs, declared here rather than
|
|
508
|
+
* imported: `@flowdular/sdk/server` is a sibling package, not a dependency of the
|
|
509
|
+
* harness, and its tracer satisfies this shape structurally. The composer that
|
|
510
|
+
* owns both hands one in; without it the harness records nothing and pays one
|
|
511
|
+
* optional call per provider and per tool.
|
|
512
|
+
*/
|
|
513
|
+
export interface AgentTraceContext {
|
|
514
|
+
readonly traceId: string;
|
|
515
|
+
readonly spanId: string;
|
|
516
|
+
readonly sampled: boolean;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
export interface AgentTraceSpan {
|
|
520
|
+
readonly context: AgentTraceContext;
|
|
521
|
+
setAttribute(key: string, value: string | number | boolean): void;
|
|
522
|
+
end(status?: 'unset' | 'ok' | 'error', message?: string): void;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
export interface AgentSpanOptions {
|
|
526
|
+
readonly parent?: AgentTraceContext | null;
|
|
527
|
+
readonly kind?: 'internal' | 'client';
|
|
528
|
+
readonly attributes?: Readonly<Record<string, string | number | boolean>>;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export interface AgentTracer {
|
|
532
|
+
startSpan(name: string, options?: AgentSpanOptions): AgentTraceSpan;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/* Foreign code on the run path: a tracer that throws must cost the run
|
|
536
|
+
nothing, so both ends answer with an absent span instead of raising. */
|
|
537
|
+
function startSpan(
|
|
538
|
+
tracer: AgentTracer | undefined,
|
|
539
|
+
name: string,
|
|
540
|
+
options: AgentSpanOptions,
|
|
541
|
+
): AgentTraceSpan | undefined {
|
|
542
|
+
if (!tracer) return undefined;
|
|
543
|
+
try {
|
|
544
|
+
return tracer.startSpan(name, options);
|
|
545
|
+
} catch {
|
|
546
|
+
return undefined;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function endSpan(
|
|
551
|
+
span: AgentTraceSpan | undefined,
|
|
552
|
+
status: 'ok' | 'error',
|
|
553
|
+
message?: string,
|
|
554
|
+
): void {
|
|
555
|
+
if (!span) return;
|
|
556
|
+
try {
|
|
557
|
+
span.end(status, message);
|
|
558
|
+
} catch {
|
|
559
|
+
/* An observer that throws is the observer's defect, not the run's. */
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
358
563
|
export class AgentHarness {
|
|
359
564
|
readonly #providers: ReadonlyMap<string, AgentProvider>;
|
|
360
565
|
readonly #tools: ReadonlyMap<string, AgentTool>;
|
|
361
566
|
readonly #authorizeToolAccess: AgentToolAccessAuthorizer;
|
|
567
|
+
readonly #tracer: AgentTracer | undefined;
|
|
568
|
+
readonly #approvalGrants: ApprovalGrantKeyring | undefined;
|
|
362
569
|
|
|
363
570
|
constructor(options: {
|
|
364
571
|
readonly providers: readonly AgentProvider[];
|
|
365
572
|
readonly tools?: readonly AgentTool[];
|
|
366
573
|
readonly authorizeToolAccess?: AgentToolAccessAuthorizer;
|
|
574
|
+
readonly tracer?: AgentTracer;
|
|
575
|
+
/* Verifies the approval grants a run carries. Absent reads
|
|
576
|
+
FD_APPROVAL_GRANT_KEY; without either, no external tool ever runs. */
|
|
577
|
+
readonly approvalGrants?: ApprovalGrantKeyring;
|
|
367
578
|
}) {
|
|
368
579
|
const providers = new Map<string, AgentProvider>();
|
|
369
580
|
for (const provider of options.providers) {
|
|
@@ -385,6 +596,9 @@ export class AgentHarness {
|
|
|
385
596
|
`Tool ${id} is already registered.`,
|
|
386
597
|
);
|
|
387
598
|
}
|
|
599
|
+
/* The gate id reaches the denial event, so it is held to the same
|
|
600
|
+
shape as the tool id rather than checked only where it is emitted. */
|
|
601
|
+
if (tool.consent) identifier(tool.consent.id, 'tool.consent.id');
|
|
388
602
|
toolTimeoutMs(tool.timeoutMs);
|
|
389
603
|
tools.set(id, tool);
|
|
390
604
|
}
|
|
@@ -394,6 +608,9 @@ export class AgentHarness {
|
|
|
394
608
|
service actors fail-closed instead of treating a stored snapshot as a
|
|
395
609
|
permanent credential. */
|
|
396
610
|
this.#authorizeToolAccess = options.authorizeToolAccess ?? (() => []);
|
|
611
|
+
this.#tracer = options.tracer;
|
|
612
|
+
this.#approvalGrants =
|
|
613
|
+
options.approvalGrants ?? approvalGrantKeyringFromEnvironment();
|
|
397
614
|
}
|
|
398
615
|
|
|
399
616
|
providers(): readonly string[] {
|
|
@@ -512,8 +729,17 @@ export class AgentHarness {
|
|
|
512
729
|
);
|
|
513
730
|
};
|
|
514
731
|
const initialPermissions = await livePermissions();
|
|
732
|
+
const grantKeyring = this.#approvalGrants;
|
|
733
|
+
const approvals = runApprovalGrants(grantKeyring, request, this.#tools);
|
|
734
|
+
const admissible = (tool: AgentTool): boolean =>
|
|
735
|
+
!localOnlyRefused(tool) &&
|
|
736
|
+
(!requiresApprovalGrant(tool) || approvals.byTool.has(tool.id));
|
|
737
|
+
/* One call per grant: a request approved once admits one invocation of
|
|
738
|
+
the tool it names, however many times the model asks. */
|
|
739
|
+
const consumedGrants = new Set<string>();
|
|
515
740
|
const availableTools = [...this.#tools.values()]
|
|
516
741
|
.filter((tool) => snapshotGrants.has(tool.id))
|
|
742
|
+
.filter(admissible)
|
|
517
743
|
.filter((tool) =>
|
|
518
744
|
tool.requiredPermissions.every((permission) =>
|
|
519
745
|
initialPermissions.has(permission),
|
|
@@ -547,6 +773,8 @@ export class AgentHarness {
|
|
|
547
773
|
model: request.definition.model,
|
|
548
774
|
});
|
|
549
775
|
const grantedIds = new Set(availableTools.map((tool) => tool.id));
|
|
776
|
+
const tracer = this.#tracer;
|
|
777
|
+
let providerSpan: AgentTraceSpan | undefined;
|
|
550
778
|
let toolCallOrdinal = 0;
|
|
551
779
|
const invokeTool = async (
|
|
552
780
|
id: string,
|
|
@@ -555,6 +783,28 @@ export class AgentHarness {
|
|
|
555
783
|
): Promise<unknown> => {
|
|
556
784
|
const ordinal = ++toolCallOrdinal;
|
|
557
785
|
const tool = this.#tools.get(id);
|
|
786
|
+
if (tool && localOnlyRefused(tool)) {
|
|
787
|
+
emit('tool.denied', `Tool ${id} was denied.`, {
|
|
788
|
+
tool: id,
|
|
789
|
+
reason: 'TOOL_LOCAL_ONLY',
|
|
790
|
+
});
|
|
791
|
+
throw new AgentHarnessError(
|
|
792
|
+
'TOOL_LOCAL_ONLY',
|
|
793
|
+
`Tool ${id} is a local-only capability and cannot run in this environment.`,
|
|
794
|
+
);
|
|
795
|
+
}
|
|
796
|
+
if (tool && !admissible(tool)) {
|
|
797
|
+
const refusal = approvals.refusals.get(id);
|
|
798
|
+
emit('tool.denied', `Tool ${id} was denied.`, {
|
|
799
|
+
tool: id,
|
|
800
|
+
reason: 'TOOL_RISK_REFUSED',
|
|
801
|
+
...(refusal ? { grant: refusal } : {}),
|
|
802
|
+
});
|
|
803
|
+
throw new AgentHarnessError(
|
|
804
|
+
'TOOL_RISK_REFUSED',
|
|
805
|
+
`Tool ${id} declares ${tool.risk} risk and runs only under an approval grant.`,
|
|
806
|
+
);
|
|
807
|
+
}
|
|
558
808
|
if (!tool || !grantedIds.has(id)) {
|
|
559
809
|
emit('tool.denied', `Tool ${id} was denied.`, {
|
|
560
810
|
tool: id,
|
|
@@ -623,6 +873,81 @@ export class AgentHarness {
|
|
|
623
873
|
});
|
|
624
874
|
throw error;
|
|
625
875
|
}
|
|
876
|
+
if (requiresApprovalGrant(tool)) {
|
|
877
|
+
const expected = {
|
|
878
|
+
tenantId: request.tenantId,
|
|
879
|
+
capabilityId: id,
|
|
880
|
+
inputDigest: approvalInputDigest(input),
|
|
881
|
+
};
|
|
882
|
+
let refusal: GrantRefusal = 'APPROVAL_GRANT_MISMATCH';
|
|
883
|
+
const admitted =
|
|
884
|
+
grantKeyring !== undefined &&
|
|
885
|
+
(approvals.byTool.get(id) ?? []).some((token) => {
|
|
886
|
+
const verified = verifyApprovalGrant(grantKeyring, token, expected);
|
|
887
|
+
if (!verified.ok) {
|
|
888
|
+
refusal = verified.reason;
|
|
889
|
+
return false;
|
|
890
|
+
}
|
|
891
|
+
if (consumedGrants.has(verified.claims.requestId)) {
|
|
892
|
+
refusal = 'APPROVAL_GRANT_CONSUMED';
|
|
893
|
+
return false;
|
|
894
|
+
}
|
|
895
|
+
consumedGrants.add(verified.claims.requestId);
|
|
896
|
+
return true;
|
|
897
|
+
});
|
|
898
|
+
if (!admitted) {
|
|
899
|
+
emit('tool.denied', `Tool ${id} was denied.`, {
|
|
900
|
+
tool: id,
|
|
901
|
+
reason: 'TOOL_RISK_REFUSED',
|
|
902
|
+
grant: refusal,
|
|
903
|
+
});
|
|
904
|
+
throw new AgentHarnessError(
|
|
905
|
+
'TOOL_RISK_REFUSED',
|
|
906
|
+
`Tool ${id} has no approval grant for this input.`,
|
|
907
|
+
);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
if (tool.consent) {
|
|
911
|
+
/* Foreign code: a throw is a refusal, never a crash. The run deadline
|
|
912
|
+
already bounds it, because the provider call this runs inside races
|
|
913
|
+
the execution timeout. */
|
|
914
|
+
let decision: AgentToolConsentDecision;
|
|
915
|
+
try {
|
|
916
|
+
decision = await tool.consent.check(input, {
|
|
917
|
+
runId: request.runId,
|
|
918
|
+
tenantId: request.tenantId,
|
|
919
|
+
requestedBy: request.requestedBy,
|
|
920
|
+
agentId: request.definition.id,
|
|
921
|
+
agentName: request.definition.name,
|
|
922
|
+
invocation: 'agent-run',
|
|
923
|
+
actor: {
|
|
924
|
+
kind: 'agent',
|
|
925
|
+
id: request.definition.id,
|
|
926
|
+
label: request.definition.name,
|
|
927
|
+
runId: request.runId,
|
|
928
|
+
},
|
|
929
|
+
...(authorizationSubject?.kind === 'user'
|
|
930
|
+
? { authorizationSubject }
|
|
931
|
+
: {}),
|
|
932
|
+
permissions,
|
|
933
|
+
signal: controller.signal,
|
|
934
|
+
});
|
|
935
|
+
} catch {
|
|
936
|
+
decision = { granted: false, reason: 'TOOL_CONSENT_UNAVAILABLE' };
|
|
937
|
+
}
|
|
938
|
+
if (!decision.granted) {
|
|
939
|
+
const reason = consentReason(decision.reason);
|
|
940
|
+
emit('tool.denied', `Tool ${id} was denied.`, {
|
|
941
|
+
tool: id,
|
|
942
|
+
consent: tool.consent.id,
|
|
943
|
+
reason,
|
|
944
|
+
});
|
|
945
|
+
throw new AgentHarnessError(
|
|
946
|
+
reason,
|
|
947
|
+
`Tool ${id} was not consented for this workspace.`,
|
|
948
|
+
);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
626
951
|
emit('tool.started', `Tool ${id} started.`, {
|
|
627
952
|
tool: id,
|
|
628
953
|
ordinal,
|
|
@@ -658,6 +983,7 @@ export class AgentHarness {
|
|
|
658
983
|
requestedBy: request.requestedBy,
|
|
659
984
|
agentId: request.definition.id,
|
|
660
985
|
agentName: request.definition.name,
|
|
986
|
+
invocation: 'agent-run',
|
|
661
987
|
actor: {
|
|
662
988
|
kind: 'agent',
|
|
663
989
|
id: request.definition.id,
|
|
@@ -710,6 +1036,38 @@ export class AgentHarness {
|
|
|
710
1036
|
controller.signal.removeEventListener('abort', abortTool);
|
|
711
1037
|
}
|
|
712
1038
|
};
|
|
1039
|
+
/* Wrapped rather than instrumented inside: the wrapper sees exactly what
|
|
1040
|
+
the provider sees, so a denial before the tool ever runs is a span too.
|
|
1041
|
+
Without a tracer the provider is handed the original function. */
|
|
1042
|
+
const tracedInvokeTool: typeof invokeTool = !tracer
|
|
1043
|
+
? invokeTool
|
|
1044
|
+
: async (id, input, invocation = {}) => {
|
|
1045
|
+
const span = startSpan(tracer, `tool ${id}`, {
|
|
1046
|
+
...(providerSpan ? { parent: providerSpan.context } : {}),
|
|
1047
|
+
kind: 'internal',
|
|
1048
|
+
attributes: {
|
|
1049
|
+
'flowdular.tool': id,
|
|
1050
|
+
...(invocation.providerCallId
|
|
1051
|
+
? {
|
|
1052
|
+
'flowdular.tool.provider_call_id':
|
|
1053
|
+
invocation.providerCallId.slice(0, 128),
|
|
1054
|
+
}
|
|
1055
|
+
: {}),
|
|
1056
|
+
},
|
|
1057
|
+
});
|
|
1058
|
+
try {
|
|
1059
|
+
const output = await invokeTool(id, input, invocation);
|
|
1060
|
+
endSpan(span, 'ok');
|
|
1061
|
+
return output;
|
|
1062
|
+
} catch (error) {
|
|
1063
|
+
endSpan(
|
|
1064
|
+
span,
|
|
1065
|
+
'error',
|
|
1066
|
+
error instanceof AgentHarnessError ? error.code : 'TOOL_FAILED',
|
|
1067
|
+
);
|
|
1068
|
+
throw error;
|
|
1069
|
+
}
|
|
1070
|
+
};
|
|
713
1071
|
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
714
1072
|
let rejectProviderAbort: (() => void) | undefined;
|
|
715
1073
|
try {
|
|
@@ -738,6 +1096,16 @@ export class AgentHarness {
|
|
|
738
1096
|
controller.abort('timeout');
|
|
739
1097
|
}, request.definition.timeoutMs);
|
|
740
1098
|
});
|
|
1099
|
+
providerSpan = startSpan(tracer, `provider ${provider.id}`, {
|
|
1100
|
+
kind: 'client',
|
|
1101
|
+
attributes: {
|
|
1102
|
+
'flowdular.agent.run_id': request.runId,
|
|
1103
|
+
'flowdular.agent.id': request.definition.id,
|
|
1104
|
+
'flowdular.agent.provider': provider.id,
|
|
1105
|
+
'flowdular.agent.model': request.definition.model,
|
|
1106
|
+
'flowdular.agent.trigger': request.trigger,
|
|
1107
|
+
},
|
|
1108
|
+
});
|
|
741
1109
|
const providerResult = await Promise.race([
|
|
742
1110
|
provider.execute({
|
|
743
1111
|
request,
|
|
@@ -752,7 +1120,7 @@ export class AgentHarness {
|
|
|
752
1120
|
additionalProperties: false,
|
|
753
1121
|
},
|
|
754
1122
|
})),
|
|
755
|
-
invokeTool,
|
|
1123
|
+
invokeTool: tracedInvokeTool,
|
|
756
1124
|
emit,
|
|
757
1125
|
}),
|
|
758
1126
|
timeout,
|
|
@@ -779,6 +1147,7 @@ export class AgentHarness {
|
|
|
779
1147
|
emit('provider.completed', `Provider ${provider.id} completed.`, {
|
|
780
1148
|
finishReason: providerResult.finishReason,
|
|
781
1149
|
});
|
|
1150
|
+
endSpan(providerSpan, 'ok', providerResult.finishReason);
|
|
782
1151
|
const completedAt = Date.now();
|
|
783
1152
|
emit('run.completed', 'Harness completed the run.');
|
|
784
1153
|
return {
|
|
@@ -788,6 +1157,13 @@ export class AgentHarness {
|
|
|
788
1157
|
startedAt,
|
|
789
1158
|
completedAt,
|
|
790
1159
|
};
|
|
1160
|
+
} catch (error) {
|
|
1161
|
+
endSpan(
|
|
1162
|
+
providerSpan,
|
|
1163
|
+
'error',
|
|
1164
|
+
error instanceof AgentHarnessError ? error.code : 'PROVIDER_FAILED',
|
|
1165
|
+
);
|
|
1166
|
+
throw error;
|
|
791
1167
|
} finally {
|
|
792
1168
|
acceptingEvents = false;
|
|
793
1169
|
if (timer !== undefined) clearTimeout(timer);
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { CapabilityRisk } from '@flowdular/sdk/contracts';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
AgentTool,
|
|
4
|
+
AgentToolConsent,
|
|
5
|
+
AgentToolContext,
|
|
6
|
+
} from './runtime.ts';
|
|
3
7
|
|
|
4
8
|
interface AgentToolBase {
|
|
5
9
|
readonly id: string;
|
|
@@ -9,6 +13,9 @@ interface AgentToolBase {
|
|
|
9
13
|
readonly contractVersion?: number;
|
|
10
14
|
readonly outputSchema?: Readonly<Record<string, unknown>>;
|
|
11
15
|
readonly risk?: 'read' | 'workspace-write' | 'external' | 'destructive';
|
|
16
|
+
/* Asked per call, after input validation, by every caller that runs the
|
|
17
|
+
tool: the harness and the workflow action runtime. */
|
|
18
|
+
readonly consent?: AgentToolConsent;
|
|
12
19
|
readonly idempotency?: 'required';
|
|
13
20
|
readonly idempotencyProtection?: 'target-ledger';
|
|
14
21
|
readonly cancellation?: 'cooperative' | 'not-supported';
|
|
@@ -23,6 +30,7 @@ export interface CliAgentToolDefinition extends AgentToolBase {
|
|
|
23
30
|
readonly capability: {
|
|
24
31
|
readonly id: string;
|
|
25
32
|
readonly risk: CapabilityRisk;
|
|
33
|
+
readonly localOnly?: boolean;
|
|
26
34
|
};
|
|
27
35
|
}
|
|
28
36
|
|
|
@@ -33,6 +41,8 @@ function dottedIdentifier(value: string, field: string): string {
|
|
|
33
41
|
return value;
|
|
34
42
|
}
|
|
35
43
|
|
|
44
|
+
/* An external tool builds as any other; the harness offers and runs it only
|
|
45
|
+
under an approval grant naming the tool and the input. */
|
|
36
46
|
export function defineApiAgentTool(
|
|
37
47
|
definition: ApiAgentToolDefinition,
|
|
38
48
|
): AgentTool {
|
|
@@ -49,6 +59,9 @@ export function defineApiAgentTool(
|
|
|
49
59
|
? {}
|
|
50
60
|
: { outputSchema: definition.outputSchema }),
|
|
51
61
|
...(definition.risk === undefined ? {} : { risk: definition.risk }),
|
|
62
|
+
...(definition.consent === undefined
|
|
63
|
+
? {}
|
|
64
|
+
: { consent: definition.consent }),
|
|
52
65
|
...(definition.idempotency === undefined
|
|
53
66
|
? {}
|
|
54
67
|
: { idempotency: definition.idempotency }),
|
|
@@ -65,17 +78,11 @@ export function defineApiAgentTool(
|
|
|
65
78
|
});
|
|
66
79
|
}
|
|
67
80
|
|
|
81
|
+
/* An external or destructive capability builds as any other; the harness runs
|
|
82
|
+
the tool only under an approval grant naming the tool and the input. */
|
|
68
83
|
export function defineCliAgentTool(
|
|
69
84
|
definition: CliAgentToolDefinition,
|
|
70
85
|
): AgentTool {
|
|
71
|
-
if (
|
|
72
|
-
definition.capability.risk === 'external' ||
|
|
73
|
-
definition.capability.risk === 'destructive'
|
|
74
|
-
) {
|
|
75
|
-
throw new Error(
|
|
76
|
-
`CLI capability ${definition.capability.id} requires an approval receipt and cannot be registered as an unattended agent tool.`,
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
86
|
return Object.freeze({
|
|
80
87
|
id: dottedIdentifier(definition.id, 'Tool id'),
|
|
81
88
|
transport: 'cli' as const,
|
|
@@ -89,6 +96,10 @@ export function defineCliAgentTool(
|
|
|
89
96
|
? {}
|
|
90
97
|
: { outputSchema: definition.outputSchema }),
|
|
91
98
|
...(definition.risk === undefined ? {} : { risk: definition.risk }),
|
|
99
|
+
...(definition.capability.localOnly === true ? { localOnly: true } : {}),
|
|
100
|
+
...(definition.consent === undefined
|
|
101
|
+
? {}
|
|
102
|
+
: { consent: definition.consent }),
|
|
92
103
|
...(definition.idempotency === undefined
|
|
93
104
|
? {}
|
|
94
105
|
: { idempotency: definition.idempotency }),
|