farna-control 0.3.335__py3-none-any.whl

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 (949) hide show
  1. farna/__init__.py +27 -0
  2. farna/_types.py +14 -0
  3. farna/api/__init__.py +0 -0
  4. farna/api/connector_team_gate.py +93 -0
  5. farna/api/constants.py +44 -0
  6. farna/api/db_error_handling.py +621 -0
  7. farna/api/db_error_reporting.py +74 -0
  8. farna/api/dependencies.py +1672 -0
  9. farna/api/exception_handlers.py +200 -0
  10. farna/api/frontend_url.py +39 -0
  11. farna/api/hitl_answer_validation.py +150 -0
  12. farna/api/main.py +1631 -0
  13. farna/api/mcp_audit.py +365 -0
  14. farna/api/mcp_server.py +4039 -0
  15. farna/api/mcp_tool_registry.py +50 -0
  16. farna/api/mcp_tools/__init__.py +16 -0
  17. farna/api/mcp_tools/_patch_surface.py +401 -0
  18. farna/api/mcp_tools/admin.py +1205 -0
  19. farna/api/mcp_tools/agents.py +483 -0
  20. farna/api/mcp_tools/analytics.py +471 -0
  21. farna/api/mcp_tools/connectors.py +825 -0
  22. farna/api/mcp_tools/evals.py +925 -0
  23. farna/api/mcp_tools/hitl.py +1386 -0
  24. farna/api/mcp_tools/library.py +423 -0
  25. farna/api/mcp_tools/parameters.py +822 -0
  26. farna/api/mcp_tools/pipelines.py +2855 -0
  27. farna/api/mcp_tools/runs.py +998 -0
  28. farna/api/mcp_tools/schema_registry.py +552 -0
  29. farna/api/mcp_tools/secrets_api_keys.py +739 -0
  30. farna/api/mcp_tools/triggers.py +1210 -0
  31. farna/api/middleware/__init__.py +27 -0
  32. farna/api/middleware/catch_all.py +133 -0
  33. farna/api/middleware/correlation_id.py +38 -0
  34. farna/api/middleware/cors_logging.py +49 -0
  35. farna/api/middleware/csrf.py +98 -0
  36. farna/api/middleware/deprecation_headers.py +113 -0
  37. farna/api/middleware/host_origin.py +100 -0
  38. farna/api/middleware/query_guard.py +77 -0
  39. farna/api/middleware/rate_limiter.py +573 -0
  40. farna/api/middleware/request_id.py +11 -0
  41. farna/api/middleware/request_timeout.py +64 -0
  42. farna/api/middleware/security_headers.py +68 -0
  43. farna/api/middleware/sensitive_mask.py +670 -0
  44. farna/api/models/__init__.py +23 -0
  45. farna/api/models/error.py +149 -0
  46. farna/api/models/error_forwarder_config.py +71 -0
  47. farna/api/models/error_notification_rule.py +90 -0
  48. farna/api/models/problem.py +279 -0
  49. farna/api/models/team_visibility.py +24 -0
  50. farna/api/openapi.py +99 -0
  51. farna/api/pagination_params.py +97 -0
  52. farna/api/permission_router.py +59 -0
  53. farna/api/routes/__init__.py +0 -0
  54. farna/api/routes/_connector_team_gate.py +70 -0
  55. farna/api/routes/_org_settings.py +90 -0
  56. farna/api/routes/_trigger_events.py +84 -0
  57. farna/api/routes/activity_reports.py +228 -0
  58. farna/api/routes/admin.py +4865 -0
  59. farna/api/routes/admin_assistant.py +732 -0
  60. farna/api/routes/admin_capacity.py +67 -0
  61. farna/api/routes/admin_dev_mode.py +78 -0
  62. farna/api/routes/admin_email.py +372 -0
  63. farna/api/routes/admin_evidence_retention.py +320 -0
  64. farna/api/routes/admin_feature_flags.py +858 -0
  65. farna/api/routes/admin_housekeeping.py +358 -0
  66. farna/api/routes/admin_license.py +757 -0
  67. farna/api/routes/admin_monitor_config.py +165 -0
  68. farna/api/routes/admin_notifications.py +1428 -0
  69. farna/api/routes/admin_org_feature_flags.py +261 -0
  70. farna/api/routes/admin_org_mcp_authority.py +192 -0
  71. farna/api/routes/admin_orgs.py +1057 -0
  72. farna/api/routes/admin_rate_limits.py +72 -0
  73. farna/api/routes/admin_rotation.py +421 -0
  74. farna/api/routes/admin_run_retention.py +442 -0
  75. farna/api/routes/admin_runtime_config.py +234 -0
  76. farna/api/routes/admin_sso.py +1025 -0
  77. farna/api/routes/admin_system_audit.py +169 -0
  78. farna/api/routes/admin_system_config.py +188 -0
  79. farna/api/routes/admin_tiers.py +87 -0
  80. farna/api/routes/admin_triggers.py +326 -0
  81. farna/api/routes/agents.py +1438 -0
  82. farna/api/routes/air_gap.py +171 -0
  83. farna/api/routes/analytics.py +1107 -0
  84. farna/api/routes/api_keys.py +955 -0
  85. farna/api/routes/assistant.py +1470 -0
  86. farna/api/routes/audit.py +557 -0
  87. farna/api/routes/auth.py +1885 -0
  88. farna/api/routes/compliance.py +183 -0
  89. farna/api/routes/composite_templates.py +777 -0
  90. farna/api/routes/connectors.py +1311 -0
  91. farna/api/routes/contributions.py +370 -0
  92. farna/api/routes/cost_components.py +396 -0
  93. farna/api/routes/costs.py +1457 -0
  94. farna/api/routes/dashboard.py +1050 -0
  95. farna/api/routes/deployment.py +110 -0
  96. farna/api/routes/determination.py +618 -0
  97. farna/api/routes/environment_profiles.py +917 -0
  98. farna/api/routes/error_forwarder_config.py +622 -0
  99. farna/api/routes/error_notification_rules.py +401 -0
  100. farna/api/routes/errors.py +1127 -0
  101. farna/api/routes/evals.py +4273 -0
  102. farna/api/routes/events.py +318 -0
  103. farna/api/routes/evidence.py +898 -0
  104. farna/api/routes/external_agents.py +332 -0
  105. farna/api/routes/feedback.py +1206 -0
  106. farna/api/routes/guardrail_config.py +883 -0
  107. farna/api/routes/health.py +1987 -0
  108. farna/api/routes/hitl.py +2206 -0
  109. farna/api/routes/in_app_notifications.py +786 -0
  110. farna/api/routes/library.py +4707 -0
  111. farna/api/routes/lifecycle_maps.py +1846 -0
  112. farna/api/routes/manifest.py +15 -0
  113. farna/api/routes/mcp_oauth.py +786 -0
  114. farna/api/routes/mcp_servers.py +530 -0
  115. farna/api/routes/mcp_setup.py +173 -0
  116. farna/api/routes/me.py +585 -0
  117. farna/api/routes/metrics.py +223 -0
  118. farna/api/routes/metrics_ingest.py +313 -0
  119. farna/api/routes/model_backends.py +2025 -0
  120. farna/api/routes/node_categories.py +400 -0
  121. farna/api/routes/notifications.py +458 -0
  122. farna/api/routes/oauth_metadata.py +185 -0
  123. farna/api/routes/observability.py +433 -0
  124. farna/api/routes/onboarding.py +573 -0
  125. farna/api/routes/org_login.py +271 -0
  126. farna/api/routes/org_settings.py +141 -0
  127. farna/api/routes/parameter_schemas.py +1129 -0
  128. farna/api/routes/pipeline_folders.py +202 -0
  129. farna/api/routes/pipelines.py +7248 -0
  130. farna/api/routes/plugins.py +109 -0
  131. farna/api/routes/product_analytics.py +348 -0
  132. farna/api/routes/product_analytics_identity.py +438 -0
  133. farna/api/routes/product_analytics_transparency.py +387 -0
  134. farna/api/routes/registry.py +720 -0
  135. farna/api/routes/run_ws.py +236 -0
  136. farna/api/routes/runners.py +439 -0
  137. farna/api/routes/runs.py +5208 -0
  138. farna/api/routes/schema_folders.py +209 -0
  139. farna/api/routes/schemas.py +1693 -0
  140. farna/api/routes/scim.py +1430 -0
  141. farna/api/routes/service_accounts.py +687 -0
  142. farna/api/routes/slack.py +712 -0
  143. farna/api/routes/sso.py +1178 -0
  144. farna/api/routes/stripe_webhook.py +1164 -0
  145. farna/api/routes/system_maps.py +2606 -0
  146. farna/api/routes/teams.py +1258 -0
  147. farna/api/routes/templates.py +441 -0
  148. farna/api/routes/triggers.py +2099 -0
  149. farna/api/routes/variant_batches.py +660 -0
  150. farna/api/routes/variants.py +962 -0
  151. farna/api/routes/viewmodel.py +734 -0
  152. farna/api/routes/webhooks.py +2269 -0
  153. farna/api/run_scope.py +160 -0
  154. farna/api/schemas/system_maps.py +537 -0
  155. farna/api/team_scope.py +671 -0
  156. farna/api/trigger_busy.py +238 -0
  157. farna/api/viewmodel/__init__.py +0 -0
  158. farna/auth/__init__.py +6 -0
  159. farna/auth/api_key.py +759 -0
  160. farna/auth/dependencies.py +557 -0
  161. farna/auth/human_linkage.py +255 -0
  162. farna/auth/jwt.py +421 -0
  163. farna/auth/log_redaction.py +15 -0
  164. farna/auth/oauth.py +1220 -0
  165. farna/auth/oidc_verify.py +327 -0
  166. farna/auth/passwords.py +87 -0
  167. farna/auth/permissions.py +688 -0
  168. farna/auth/saml_handler.py +258 -0
  169. farna/auth/scim_auth.py +125 -0
  170. farna/auth/secret_storage.py +280 -0
  171. farna/auth/sso.py +1682 -0
  172. farna/auth/team_rbac.py +57 -0
  173. farna/auth/ws_token.py +74 -0
  174. farna/cli/__init__.py +64 -0
  175. farna/cli/apply/__init__.py +306 -0
  176. farna/cli/apply/drift.py +428 -0
  177. farna/cli/apply/executor.py +1256 -0
  178. farna/cli/apply/loader.py +61 -0
  179. farna/cli/apply/models.py +1877 -0
  180. farna/cli/apply/pipeline_apply.py +677 -0
  181. farna/cli/apply/plan.py +353 -0
  182. farna/cli/apply/system_map_apply.py +205 -0
  183. farna/cli/apply/trigger_apply.py +313 -0
  184. farna/cli/backfill_model_backend_base_url.py +556 -0
  185. farna/cli/backup.py +3033 -0
  186. farna/cli/break_glass.py +933 -0
  187. farna/cli/evidence.py +245 -0
  188. farna/cli/main.py +816 -0
  189. farna/cli/migrate.py +691 -0
  190. farna/cli/migrate_org.py +662 -0
  191. farna/cli/users.py +508 -0
  192. farna/compliance/__init__.py +46 -0
  193. farna/compliance/artifacts.py +173 -0
  194. farna/compliance/evidence_index.py +766 -0
  195. farna/compliance/mappings/__init__.py +5 -0
  196. farna/compliance/mappings/eu-ai-act.yaml +94 -0
  197. farna/compliance/mappings/iso-42001.yaml +104 -0
  198. farna/compliance/mappings/pack.yaml +34 -0
  199. farna/compliance/mappings/soc2.yaml +164 -0
  200. farna/compliance/pack.py +402 -0
  201. farna/connectors/__init__.py +0 -0
  202. farna/connectors/_ci_test_double.py +90 -0
  203. farna/connectors/_egress.py +56 -0
  204. farna/connectors/_rate_bucket.py +378 -0
  205. farna/connectors/_retry_headers.py +300 -0
  206. farna/connectors/_safe_cursor.py +25 -0
  207. farna/connectors/_safe_datetime.py +30 -0
  208. farna/connectors/_safe_int.py +40 -0
  209. farna/connectors/_safe_page.py +86 -0
  210. farna/connectors/asana/__init__.py +226 -0
  211. farna/connectors/azure_key_vault/__init__.py +264 -0
  212. farna/connectors/azure_pipelines/__init__.py +478 -0
  213. farna/connectors/azure_repos/__init__.py +274 -0
  214. farna/connectors/base.py +1189 -0
  215. farna/connectors/bitbucket/__init__.py +238 -0
  216. farna/connectors/buildkite/__init__.py +385 -0
  217. farna/connectors/ci_runner/__init__.py +13 -0
  218. farna/connectors/ci_runner/base.py +93 -0
  219. farna/connectors/ci_runner/github_actions.py +438 -0
  220. farna/connectors/ci_runner/gitlab_ci.py +301 -0
  221. farna/connectors/ci_runner/woodpecker.py +637 -0
  222. farna/connectors/circleci/__init__.py +333 -0
  223. farna/connectors/codeclimate/__init__.py +193 -0
  224. farna/connectors/confluence/__init__.py +238 -0
  225. farna/connectors/datadog/__init__.py +243 -0
  226. farna/connectors/discord/__init__.py +171 -0
  227. farna/connectors/dropbox_paper/__init__.py +179 -0
  228. farna/connectors/filesystem/__init__.py +107 -0
  229. farna/connectors/gitea/__init__.py +234 -0
  230. farna/connectors/github/__init__.py +1928 -0
  231. farna/connectors/gitlab/__init__.py +1500 -0
  232. farna/connectors/grafana/__init__.py +266 -0
  233. farna/connectors/jenkins/__init__.py +520 -0
  234. farna/connectors/jira/__init__.py +802 -0
  235. farna/connectors/linear/__init__.py +465 -0
  236. farna/connectors/microsoft_teams/__init__.py +257 -0
  237. farna/connectors/monday/__init__.py +315 -0
  238. farna/connectors/n8n/__init__.py +347 -0
  239. farna/connectors/notion/__init__.py +244 -0
  240. farna/connectors/npm/__init__.py +165 -0
  241. farna/connectors/onepassword/__init__.py +244 -0
  242. farna/connectors/opsgenie/__init__.py +346 -0
  243. farna/connectors/pagerduty/__init__.py +336 -0
  244. farna/connectors/plane/__init__.py +388 -0
  245. farna/connectors/pypi/__init__.py +162 -0
  246. farna/connectors/rest/__init__.py +2083 -0
  247. farna/connectors/rest/rest_metrics.py +195 -0
  248. farna/connectors/rest/rest_rollback.py +142 -0
  249. farna/connectors/security.py +363 -0
  250. farna/connectors/sentry/__init__.py +228 -0
  251. farna/connectors/sharepoint/__init__.py +229 -0
  252. farna/connectors/shell/__init__.py +395 -0
  253. farna/connectors/shortcut/__init__.py +194 -0
  254. farna/connectors/slack/__init__.py +591 -0
  255. farna/connectors/snyk/__init__.py +299 -0
  256. farna/connectors/sonarqube/__init__.py +373 -0
  257. farna/connectors/teamcity/__init__.py +324 -0
  258. farna/connectors/ticket_tracker/__init__.py +3 -0
  259. farna/connectors/ticket_tracker/base.py +114 -0
  260. farna/connectors/ticket_tracker/github.py +183 -0
  261. farna/connectors/ticket_tracker/trello.py +326 -0
  262. farna/connectors/trello/__init__.py +210 -0
  263. farna/connectors/youtrack/__init__.py +204 -0
  264. farna/core/__init__.py +5 -0
  265. farna/core/agent_command_sync.py +208 -0
  266. farna/core/agent_event_evidence.py +242 -0
  267. farna/core/agent_return_legacy.py +175 -0
  268. farna/core/air_gap.py +434 -0
  269. farna/core/alert_context.py +153 -0
  270. farna/core/alert_dispatch.py +69 -0
  271. farna/core/analytics/__init__.py +650 -0
  272. farna/core/analytics/builder.py +1143 -0
  273. farna/core/analytics/capacity.py +1151 -0
  274. farna/core/analytics/enforcement_sweep.py +141 -0
  275. farna/core/analytics/facts_window.py +77 -0
  276. farna/core/analytics/guardrails.py +608 -0
  277. farna/core/analytics/maintenance.py +715 -0
  278. farna/core/analytics/metrics.py +132 -0
  279. farna/core/analytics/service.py +1094 -0
  280. farna/core/artifacts/__init__.py +18 -0
  281. farna/core/artifacts/gc.py +81 -0
  282. farna/core/artifacts/store.py +419 -0
  283. farna/core/artifacts/streaming.py +286 -0
  284. farna/core/artifacts/writer.py +182 -0
  285. farna/core/assistant/__init__.py +0 -0
  286. farna/core/assistant/config_service.py +117 -0
  287. farna/core/assistant/context_source_service.py +170 -0
  288. farna/core/assistant/redis_registry.py +20 -0
  289. farna/core/assistant/skill_loader.py +300 -0
  290. farna/core/audit_coverage.py +709 -0
  291. farna/core/audit_logger/__init__.py +726 -0
  292. farna/core/audit_logger/append_only.py +64 -0
  293. farna/core/audit_logger/background.py +424 -0
  294. farna/core/audit_logger/hashing.py +69 -0
  295. farna/core/audit_logger/labels.py +87 -0
  296. farna/core/bundled_runner/__init__.py +25 -0
  297. farna/core/bundled_runner/health_probe.py +574 -0
  298. farna/core/bundled_runner/profile.py +64 -0
  299. farna/core/bundled_runner/runner_dispatch.py +2394 -0
  300. farna/core/bundled_runner/runner_reconciler.py +913 -0
  301. farna/core/capability_scope.py +587 -0
  302. farna/core/capacity_alerts.py +1479 -0
  303. farna/core/capacity_providers/__init__.py +75 -0
  304. farna/core/capacity_providers/fly.py +216 -0
  305. farna/core/cleanup_jobs/__init__.py +5 -0
  306. farna/core/cleanup_jobs/trigger_events_cleanup.py +67 -0
  307. farna/core/cleanup_jobs/webhook_dedup_cleanup.py +102 -0
  308. farna/core/composite_engine/__init__.py +20 -0
  309. farna/core/composite_engine/composite_binding.py +56 -0
  310. farna/core/composite_engine/expander.py +844 -0
  311. farna/core/composite_engine/schema_mapping.py +64 -0
  312. farna/core/connector_hub/__init__.py +1463 -0
  313. farna/core/connector_hub/health_sweep.py +308 -0
  314. farna/core/connector_hub/locking.py +188 -0
  315. farna/core/connector_refs.py +20 -0
  316. farna/core/cost_controller/__init__.py +1222 -0
  317. farna/core/cost_controller/breakdown/__init__.py +71 -0
  318. farna/core/cost_controller/breakdown/aggregate.py +415 -0
  319. farna/core/cost_controller/breakdown/constants.py +96 -0
  320. farna/core/cost_controller/breakdown/formula.py +292 -0
  321. farna/core/cost_controller/breakdown/metrics.py +266 -0
  322. farna/core/cost_controller/breakdown/params.py +664 -0
  323. farna/core/cost_controller/finalize.py +4335 -0
  324. farna/core/cost_controller/org_auto_pause.py +170 -0
  325. farna/core/cost_controller/probe.py +486 -0
  326. farna/core/cost_controller/system_config.py +68 -0
  327. farna/core/cost_settings.py +18 -0
  328. farna/core/credential_issuer.py +283 -0
  329. farna/core/cron_helpers.py +12319 -0
  330. farna/core/crypto/__init__.py +195 -0
  331. farna/core/demo.py +30 -0
  332. farna/core/dispatch.py +926 -0
  333. farna/core/dispatch_phases.py +60 -0
  334. farna/core/documentation_indexer.py +150 -0
  335. farna/core/egress_metrics.py +152 -0
  336. farna/core/email_service.py +213 -0
  337. farna/core/entitlements.py +263 -0
  338. farna/core/error_tracking/__init__.py +1173 -0
  339. farna/core/error_tracking/alert_dispatcher.py +415 -0
  340. farna/core/error_tracking/alerting.py +415 -0
  341. farna/core/error_tracking/forwarders/__init__.py +70 -0
  342. farna/core/error_tracking/forwarders/base.py +24 -0
  343. farna/core/error_tracking/forwarders/datadog.py +91 -0
  344. farna/core/error_tracking/forwarders/loki.py +103 -0
  345. farna/core/error_tracking/forwarders/opsgenie.py +106 -0
  346. farna/core/error_tracking/forwarders/pagerduty.py +102 -0
  347. farna/core/error_tracking/forwarders/rollbar.py +93 -0
  348. farna/core/error_tracking/forwarders/sentry.py +178 -0
  349. farna/core/error_tracking/metrics.py +410 -0
  350. farna/core/error_tracking/saq_hooks.py +432 -0
  351. farna/core/eval/finding_resolver.py +372 -0
  352. farna/core/eval/mute_policy.py +182 -0
  353. farna/core/eval_engine/__init__.py +1144 -0
  354. farna/core/eval_engine/author_warnings.py +427 -0
  355. farna/core/eval_engine/changed_sets.py +427 -0
  356. farna/core/eval_engine/coverage_gap.py +597 -0
  357. farna/core/eval_engine/decision_reconcile.py +227 -0
  358. farna/core/eval_engine/discovery_eval.py +239 -0
  359. farna/core/eval_engine/discovery_judge.py +27 -0
  360. farna/core/eval_engine/eval_definition_write.py +735 -0
  361. farna/core/eval_engine/evidence_layer.py +258 -0
  362. farna/core/eval_engine/execute_suite_run.py +1165 -0
  363. farna/core/eval_engine/human_eval_sets.py +341 -0
  364. farna/core/eval_engine/okr.py +302 -0
  365. farna/core/eval_engine/policy_gate.py +398 -0
  366. farna/core/eval_engine/regression.py +422 -0
  367. farna/core/eval_engine/suite_run.py +1007 -0
  368. farna/core/eval_engine/suite_run_judge.py +175 -0
  369. farna/core/eval_engine/typed_judge/__init__.py +109 -0
  370. farna/core/eval_engine/typed_judge/bridge.py +206 -0
  371. farna/core/eval_engine/typed_judge/config.py +376 -0
  372. farna/core/eval_engine/typed_judge/envelope.py +1055 -0
  373. farna/core/eval_engine/typed_judge/errors.py +98 -0
  374. farna/core/eval_engine/typed_judge/legacy.py +151 -0
  375. farna/core/eval_engine/typed_judge/naming.py +106 -0
  376. farna/core/eval_engine/typed_judge/transport.py +434 -0
  377. farna/core/event_dedup.py +261 -0
  378. farna/core/events/__init__.py +29 -0
  379. farna/core/events/event_bus.py +236 -0
  380. farna/core/events/listeners.py +387 -0
  381. farna/core/events/notification_events.py +90 -0
  382. farna/core/events/redis_broker.py +219 -0
  383. farna/core/events/relay.py +409 -0
  384. farna/core/events/worker_subscription.py +122 -0
  385. farna/core/evidence_pack/__init__.py +55 -0
  386. farna/core/evidence_pack/build.py +102 -0
  387. farna/core/evidence_pack/canonical.py +61 -0
  388. farna/core/evidence_pack/chain.py +148 -0
  389. farna/core/evidence_pack/manifest.py +73 -0
  390. farna/core/evidence_pack/signing.py +129 -0
  391. farna/core/evidence_pack/verify.py +285 -0
  392. farna/core/evidence_redaction.py +210 -0
  393. farna/core/evidence_retention.py +315 -0
  394. farna/core/exceptions.py +146 -0
  395. farna/core/feature_flags.py +1164 -0
  396. farna/core/feedback_manager/__init__.py +869 -0
  397. farna/core/feedback_manager/exceptions.py +32 -0
  398. farna/core/feedback_manager/queries.py +161 -0
  399. farna/core/feedback_manager/single_node_correction.py +347 -0
  400. farna/core/feedback_manager/status.py +100 -0
  401. farna/core/fernet_rotation.py +433 -0
  402. farna/core/graceful_shutdown.py +126 -0
  403. farna/core/graph_validator/__init__.py +3960 -0
  404. farna/core/graph_validator/_types.py +50 -0
  405. farna/core/graph_validator/category_validator.py +141 -0
  406. farna/core/graph_validator/mask_sentinel.py +184 -0
  407. farna/core/guardrails/__init__.py +1976 -0
  408. farna/core/guardrails/compensation.py +395 -0
  409. farna/core/guardrails/config.py +646 -0
  410. farna/core/guardrails/conformance.py +1039 -0
  411. farna/core/guardrails/correction.py +1564 -0
  412. farna/core/guardrails/coverage.py +418 -0
  413. farna/core/guardrails/finding_resolver.py +26 -0
  414. farna/core/guardrails/kill_switch_drill.py +208 -0
  415. farna/core/guardrails/loop_intercept.py +1048 -0
  416. farna/core/guardrails/materialise.py +221 -0
  417. farna/core/guardrails/mute_policy.py +22 -0
  418. farna/core/guardrails/output_intercept.py +187 -0
  419. farna/core/guardrails/packs/__init__.py +13 -0
  420. farna/core/guardrails/packs/soc2.py +222 -0
  421. farna/core/guardrails/policy_pack.py +370 -0
  422. farna/core/guardrails/redaction_mode.py +126 -0
  423. farna/core/guardrails/sandbox_bridge.py +480 -0
  424. farna/core/health_alerts.py +1224 -0
  425. farna/core/hitl_email_alerts.py +477 -0
  426. farna/core/hitl_manager/__init__.py +1581 -0
  427. farna/core/hitl_manager/deadline_warning.py +627 -0
  428. farna/core/hitl_manager/expiry_job.py +327 -0
  429. farna/core/hitl_manager/gate_coalescing.py +353 -0
  430. farna/core/hitl_manager/overdue_warning.py +274 -0
  431. farna/core/hitl_manager/review_expiry.py +244 -0
  432. farna/core/hitl_manager/sweep_alarm.py +318 -0
  433. farna/core/housekeeping.py +1386 -0
  434. farna/core/library/__init__.py +145 -0
  435. farna/core/library/agents/__init__.py +53 -0
  436. farna/core/library/agents/definitions.py +1591 -0
  437. farna/core/library/branch_fixer.py +1049 -0
  438. farna/core/library/complexity_reviewer.py +90 -0
  439. farna/core/library/integrations/__init__.py +53 -0
  440. farna/core/library/integrations/definitions.py +896 -0
  441. farna/core/library/risk_tiered_review.py +1182 -0
  442. farna/core/library/workflows/__init__.py +35 -0
  443. farna/core/library/workflows/definitions.py +792 -0
  444. farna/core/library_service/__init__.py +1065 -0
  445. farna/core/library_service/_seed_data.py +2124 -0
  446. farna/core/library_service/grant.py +74 -0
  447. farna/core/library_service/install.py +2793 -0
  448. farna/core/library_service/primitive_types.py +50 -0
  449. farna/core/library_service/runnability.py +350 -0
  450. farna/core/library_service/uninstall.py +369 -0
  451. farna/core/library_service/upgrade.py +1110 -0
  452. farna/core/licence_gate/__init__.py +119 -0
  453. farna/core/licence_gate/baseline.py +365 -0
  454. farna/core/licence_gate/content.py +269 -0
  455. farna/core/licence_gate/errors.py +35 -0
  456. farna/core/licence_gate/policy.py +223 -0
  457. farna/core/licence_gate/scanner.py +426 -0
  458. farna/core/licence_gate/verdict.py +292 -0
  459. farna/core/license.py +1017 -0
  460. farna/core/license_bootstrap.py +130 -0
  461. farna/core/license_signing.py +267 -0
  462. farna/core/lifecycle_map/__init__.py +0 -0
  463. farna/core/lifecycle_map/advancement.py +763 -0
  464. farna/core/lifecycle_map/import_export.py +351 -0
  465. farna/core/lifecycle_map/journeys.py +444 -0
  466. farna/core/lifecycle_map/reconcile.py +704 -0
  467. farna/core/lifecycle_map/self_report.py +165 -0
  468. farna/core/lifecycle_map/service.py +332 -0
  469. farna/core/lifecycle_map/validation.py +449 -0
  470. farna/core/line_diff.py +82 -0
  471. farna/core/logging_config.py +321 -0
  472. farna/core/manifest.py +92 -0
  473. farna/core/mcp/__init__.py +4 -0
  474. farna/core/mcp/scope_validator.py +921 -0
  475. farna/core/mcp/tool_pinning.py +252 -0
  476. farna/core/mcp_setup_handoff/__init__.py +102 -0
  477. farna/core/model_backend_endpoints.py +200 -0
  478. farna/core/model_backend_hub/__init__.py +1056 -0
  479. farna/core/model_backend_presets.py +70 -0
  480. farna/core/model_class_registry.py +440 -0
  481. farna/core/node_output_split.py +637 -0
  482. farna/core/notifier/__init__.py +1046 -0
  483. farna/core/notifier/event_mapper.py +604 -0
  484. farna/core/path_safety.py +29 -0
  485. farna/core/pipeline_decay_alerts.py +765 -0
  486. farna/core/pipeline_engine/__init__.py +41 -0
  487. farna/core/pipeline_engine/ancestor_refs.py +115 -0
  488. farna/core/pipeline_engine/classify.py +1544 -0
  489. farna/core/pipeline_engine/connector_write_factory.py +57 -0
  490. farna/core/pipeline_engine/decorator.py +361 -0
  491. farna/core/pipeline_engine/egress.py +414 -0
  492. farna/core/pipeline_engine/error_codes.py +1531 -0
  493. farna/core/pipeline_engine/errors.py +53 -0
  494. farna/core/pipeline_engine/eval_persist_order.py +683 -0
  495. farna/core/pipeline_engine/event_broker.py +227 -0
  496. farna/core/pipeline_engine/evidence.py +900 -0
  497. farna/core/pipeline_engine/executor.py +1551 -0
  498. farna/core/pipeline_engine/executor_parts/__init__.py +42 -0
  499. farna/core/pipeline_engine/executor_parts/admission.py +1054 -0
  500. farna/core/pipeline_engine/executor_parts/finalize.py +871 -0
  501. farna/core/pipeline_engine/executor_parts/hitl.py +519 -0
  502. farna/core/pipeline_engine/executor_parts/hubs.py +571 -0
  503. farna/core/pipeline_engine/executor_parts/outcomes.py +591 -0
  504. farna/core/pipeline_engine/executor_parts/run_execute.py +2750 -0
  505. farna/core/pipeline_engine/executor_parts/run_shape.py +983 -0
  506. farna/core/pipeline_engine/executor_parts/streaming.py +753 -0
  507. farna/core/pipeline_engine/executor_parts/support.py +506 -0
  508. farna/core/pipeline_engine/executor_parts/telemetry.py +301 -0
  509. farna/core/pipeline_engine/failure_context.py +182 -0
  510. farna/core/pipeline_engine/git_content.py +873 -0
  511. farna/core/pipeline_engine/graph_cache.py +1955 -0
  512. farna/core/pipeline_engine/hitl_context.py +1019 -0
  513. farna/core/pipeline_engine/idempotency.py +270 -0
  514. farna/core/pipeline_engine/input_truncation.py +28 -0
  515. farna/core/pipeline_engine/jmespath_eval.py +92 -0
  516. farna/core/pipeline_engine/llm_judge.py +587 -0
  517. farna/core/pipeline_engine/model_backend_errors.py +201 -0
  518. farna/core/pipeline_engine/modulo_saver.py +947 -0
  519. farna/core/pipeline_engine/node_runner.py +16566 -0
  520. farna/core/pipeline_engine/output_filter.py +133 -0
  521. farna/core/pipeline_engine/port_resolver.py +271 -0
  522. farna/core/pipeline_engine/publish_review_node.py +291 -0
  523. farna/core/pipeline_engine/recovery.py +864 -0
  524. farna/core/pipeline_engine/retry_compensation.py +740 -0
  525. farna/core/pipeline_engine/retry_policy.py +1239 -0
  526. farna/core/pipeline_engine/runaway_protection.py +117 -0
  527. farna/core/pipeline_engine/runtime_retry.py +655 -0
  528. farna/core/pipeline_engine/sandbox_errors.py +43 -0
  529. farna/core/pipeline_engine/sandbox_mode.py +772 -0
  530. farna/core/pipeline_engine/sandbox_policy.py +1545 -0
  531. farna/core/pipeline_engine/scatter_join.py +456 -0
  532. farna/core/pipeline_engine/schema_enforcement.py +379 -0
  533. farna/core/pipeline_engine/schema_repair.py +663 -0
  534. farna/core/pipeline_engine/terminal_publisher.py +251 -0
  535. farna/core/pipeline_engine/triage_apply_node.py +376 -0
  536. farna/core/pipeline_engine/watchdog_retry.py +656 -0
  537. farna/core/pipeline_engine/workspace_input_audit.py +332 -0
  538. farna/core/pipeline_engine/workspace_input_credentials.py +461 -0
  539. farna/core/pipeline_engine/workspace_input_orchestration.py +759 -0
  540. farna/core/pipeline_engine/workspace_inputs.py +171 -0
  541. farna/core/pipeline_engine/workspace_ssh.py +470 -0
  542. farna/core/pipeline_execution.py +5170 -0
  543. farna/core/pipeline_impact.py +521 -0
  544. farna/core/plugin_registry/__init__.py +492 -0
  545. farna/core/pricing.py +86 -0
  546. farna/core/principals.py +104 -0
  547. farna/core/product_analytics/__init__.py +10 -0
  548. farna/core/product_analytics/consent.py +335 -0
  549. farna/core/product_analytics/constants.py +98 -0
  550. farna/core/product_analytics/hmac_verify.py +114 -0
  551. farna/core/product_analytics/instance_identity.py +106 -0
  552. farna/core/product_analytics/metrics_constants.py +52 -0
  553. farna/core/product_analytics/metrics_dump.py +781 -0
  554. farna/core/product_analytics/vendor_client.py +459 -0
  555. farna/core/prompt_optimizer/__init__.py +262 -0
  556. farna/core/provenance.py +101 -0
  557. farna/core/rate_limiter.py +252 -0
  558. farna/core/registry/__init__.py +753 -0
  559. farna/core/registry/crypto.py +97 -0
  560. farna/core/release_channels.py +112 -0
  561. farna/core/reports/__init__.py +74 -0
  562. farna/core/reports/activity_report.py +543 -0
  563. farna/core/reports/cost_report.py +91 -0
  564. farna/core/reports/email_delivery.py +49 -0
  565. farna/core/reports/quality_report.py +383 -0
  566. farna/core/reports/scheduler.py +1057 -0
  567. farna/core/reports/weekly_digest.py +668 -0
  568. farna/core/retry_budget.py +164 -0
  569. farna/core/review_publish.py +418 -0
  570. farna/core/rollback_thresholds.py +314 -0
  571. farna/core/run_admission.py +1471 -0
  572. farna/core/run_context/__init__.py +47 -0
  573. farna/core/run_context/autonomy.py +384 -0
  574. farna/core/run_context/autonomy_telemetry.py +275 -0
  575. farna/core/run_log_correlation.py +263 -0
  576. farna/core/run_outputs_dualwrite.py +320 -0
  577. farna/core/run_provenance.py +69 -0
  578. farna/core/run_teardown.py +299 -0
  579. farna/core/run_terminal_advance.py +286 -0
  580. farna/core/runner_bindings.py +289 -0
  581. farna/core/runner_capacity.py +1863 -0
  582. farna/core/runtime_config/__init__.py +62 -0
  583. farna/core/runtime_config/key_bridge.py +181 -0
  584. farna/core/runtime_config/mint_budget.py +205 -0
  585. farna/core/runtime_config/org_flags.py +149 -0
  586. farna/core/runtime_config/store.py +293 -0
  587. farna/core/runtime_config/telemetry_bridge.py +83 -0
  588. farna/core/runtime_provider/__init__.py +942 -0
  589. farna/core/runtime_provider/base.py +5 -0
  590. farna/core/runtime_provider/docker.py +844 -0
  591. farna/core/runtime_provider/e2b.py +1092 -0
  592. farna/core/runtime_provider/endpoint_tls.py +150 -0
  593. farna/core/runtime_provider/hub.py +268 -0
  594. farna/core/runtime_provider/k8s.py +1311 -0
  595. farna/core/runtime_provider/local.py +229 -0
  596. farna/core/runtime_provider/local_docker.py +150 -0
  597. farna/core/runtime_provider/log_tail.py +47 -0
  598. farna/core/sanitize_log.py +15 -0
  599. farna/core/saq_worker.py +3272 -0
  600. farna/core/schema_registry/__init__.py +89 -0
  601. farna/core/schema_registry/_common.py +149 -0
  602. farna/core/schema_registry/contract.py +632 -0
  603. farna/core/schema_registry/generation.py +96 -0
  604. farna/core/schema_registry/inference.py +214 -0
  605. farna/core/schema_registry/migration.py +659 -0
  606. farna/core/schema_registry/rendering.py +729 -0
  607. farna/core/schema_registry/sanitize.py +120 -0
  608. farna/core/schema_registry/validation.py +251 -0
  609. farna/core/secret_patterns.py +359 -0
  610. farna/core/secrets_backend/__init__.py +186 -0
  611. farna/core/secrets_backend/aws.py +200 -0
  612. farna/core/secrets_backend/fernet.py +219 -0
  613. farna/core/secrets_backend/references.py +194 -0
  614. farna/core/secrets_backend/vault.py +209 -0
  615. farna/core/seed_data/__init__.py +0 -0
  616. farna/core/seed_data/catalog.py +43 -0
  617. farna/core/seed_data/cost_components.py +141 -0
  618. farna/core/seed_data/demo_data.py +334 -0
  619. farna/core/seed_data/library_schemas.py +690 -0
  620. farna/core/spend_ceiling.py +219 -0
  621. farna/core/sso_presets.py +133 -0
  622. farna/core/ssrf.py +1750 -0
  623. farna/core/stdout_retention.py +85 -0
  624. farna/core/stripe_fulfilment.py +608 -0
  625. farna/core/system_audit_logger.py +86 -0
  626. farna/core/system_map_persistence.py +174 -0
  627. farna/core/system_map_validation.py +55 -0
  628. farna/core/system_maps_ai_discovery.py +291 -0
  629. farna/core/system_maps_discovery.py +236 -0
  630. farna/core/team_visibility.py +468 -0
  631. farna/core/triage.py +613 -0
  632. farna/core/trigger_engine/__init__.py +2604 -0
  633. farna/core/trigger_engine/agent_signal.py +538 -0
  634. farna/core/trigger_engine/polling.py +472 -0
  635. farna/core/trigger_engine/pre_guardrail.py +215 -0
  636. farna/core/trigger_engine/slack_app_mention.py +595 -0
  637. farna/core/trigger_engine/tracker_intake.py +506 -0
  638. farna/core/trigger_engine/work_selector.py +236 -0
  639. farna/core/trigger_secrets.py +108 -0
  640. farna/core/trigger_streak.py +2285 -0
  641. farna/core/trigger_validation.py +123 -0
  642. farna/core/validation_level.py +212 -0
  643. farna/core/watchdog/__init__.py +22 -0
  644. farna/core/watchdog/worker_liveness.py +742 -0
  645. farna/core/work_item_enrichment.py +326 -0
  646. farna/core/worker_handoff.py +829 -0
  647. farna/core/worker_memory.py +187 -0
  648. farna/core/workflow_import_export/__init__.py +2520 -0
  649. farna/core/workspace_labels.py +83 -0
  650. farna/db/__init__.py +11 -0
  651. farna/db/alignment.py +245 -0
  652. farna/db/background.py +158 -0
  653. farna/db/bootstrap.py +179 -0
  654. farna/db/bootstrap_role.py +755 -0
  655. farna/db/bundled_runner_template.py +254 -0
  656. farna/db/capacity.py +454 -0
  657. farna/db/crud/__init__.py +1 -0
  658. farna/db/crud/_gate_advisory_lock.py +83 -0
  659. farna/db/crud/account.py +206 -0
  660. farna/db/crud/activity_report.py +87 -0
  661. farna/db/crud/agent.py +422 -0
  662. farna/db/crud/agent_runner_binding.py +216 -0
  663. farna/db/crud/base.py +55 -0
  664. farna/db/crud/break_glass_deny.py +133 -0
  665. farna/db/crud/composite_template.py +125 -0
  666. farna/db/crud/connector_instance.py +214 -0
  667. farna/db/crud/cost_component.py +179 -0
  668. farna/db/crud/daily_run_count.py +121 -0
  669. farna/db/crud/digest_report.py +58 -0
  670. farna/db/crud/environment_profile.py +304 -0
  671. farna/db/crud/error_tracking.py +353 -0
  672. farna/db/crud/eval_run.py +100 -0
  673. farna/db/crud/external_agent.py +113 -0
  674. farna/db/crud/folder_tree.py +106 -0
  675. farna/db/crud/guardrail_config.py +84 -0
  676. farna/db/crud/hitl_review_config.py +859 -0
  677. farna/db/crud/hitl_review_guard.py +799 -0
  678. farna/db/crud/invitations.py +213 -0
  679. farna/db/crud/last_admin_guard.py +126 -0
  680. farna/db/crud/library_primitive.py +531 -0
  681. farna/db/crud/mcp_server.py +117 -0
  682. farna/db/crud/model_backend.py +375 -0
  683. farna/db/crud/node_category.py +197 -0
  684. farna/db/crud/node_composite.py +42 -0
  685. farna/db/crud/node_observation.py +63 -0
  686. farna/db/crud/notifications.py +744 -0
  687. farna/db/crud/observability.py +69 -0
  688. farna/db/crud/org_deletion.py +770 -0
  689. farna/db/crud/org_membership.py +170 -0
  690. farna/db/crud/organisation.py +974 -0
  691. farna/db/crud/organisation_cost_state.py +104 -0
  692. farna/db/crud/pagination.py +169 -0
  693. farna/db/crud/parameter_schema.py +169 -0
  694. farna/db/crud/parameter_set.py +180 -0
  695. farna/db/crud/pipeline.py +2537 -0
  696. farna/db/crud/pipeline_folder.py +115 -0
  697. farna/db/crud/pipeline_owner.py +148 -0
  698. farna/db/crud/pipeline_snapshot.py +1345 -0
  699. farna/db/crud/pipeline_snapshot_versioning.py +896 -0
  700. farna/db/crud/policy_gate_decision.py +103 -0
  701. farna/db/crud/publisher.py +139 -0
  702. farna/db/crud/rating.py +304 -0
  703. farna/db/crud/row_lock.py +80 -0
  704. farna/db/crud/run.py +5602 -0
  705. farna/db/crud/run_attempts.py +218 -0
  706. farna/db/crud/run_node_outputs.py +1702 -0
  707. farna/db/crud/run_retention.py +1097 -0
  708. farna/db/crud/runner_probe.py +155 -0
  709. farna/db/crud/scheduled_report.py +167 -0
  710. farna/db/crud/schema.py +274 -0
  711. farna/db/crud/schema_folder.py +122 -0
  712. farna/db/crud/scim.py +296 -0
  713. farna/db/crud/spend_anomaly.py +109 -0
  714. farna/db/crud/sso_provider.py +450 -0
  715. farna/db/crud/system_audit_event.py +91 -0
  716. farna/db/crud/system_config.py +138 -0
  717. farna/db/crud/team.py +254 -0
  718. farna/db/crud/team_membership.py +111 -0
  719. farna/db/crud/team_scope.py +379 -0
  720. farna/db/crud/template.py +109 -0
  721. farna/db/crud/tier_catalog.py +50 -0
  722. farna/db/crud/token_family.py +193 -0
  723. farna/db/crud/trigger.py +193 -0
  724. farna/db/crud/user.py +5 -0
  725. farna/db/crud/variant_group.py +1019 -0
  726. farna/db/enums.py +32 -0
  727. farna/db/health_checks.py +95 -0
  728. farna/db/lifecycle_refs.py +322 -0
  729. farna/db/migration_guard.py +154 -0
  730. farna/db/migrations/README.md +81 -0
  731. farna/db/migrations/__init__.py +1 -0
  732. farna/db/migrations/_lock_state.py +31 -0
  733. farna/db/migrations/_rls_ceremony.py +36 -0
  734. farna/db/migrations/env.py +779 -0
  735. farna/db/migrations/script.py.mako +25 -0
  736. farna/db/migrations/versions/0350_baseline_schema.py +10905 -0
  737. farna/db/migrations/versions/0351_baseline_rls.py +2859 -0
  738. farna/db/migrations/versions/0352_baseline_privileges.py +316 -0
  739. farna/db/migrations/versions/0353_baseline_seed_data.py +36 -0
  740. farna/db/migrations/versions/0354_policy_gate_reason.py +17 -0
  741. farna/db/migrations/versions/0355_drop_library_sync_state.py +60 -0
  742. farna/db/migrations/versions/0356_soft_delete_community_library_primitives.py +61 -0
  743. farna/db/migrations/versions/0357_rebrand_library_seed_copy.py +150 -0
  744. farna/db/migrations/versions/0358_community_flag_tiers.py +47 -0
  745. farna/db/migrations/versions/0359_registry_sourced_drop_index.py +31 -0
  746. farna/db/migrations/versions/0360_free_schema_history_retire_pipeline_delete.py +54 -0
  747. farna/db/migrations/versions/0362_rename_legacy_db_objects.py +166 -0
  748. farna/db/migrations/versions/0363_lower_operational_flag_tiers.py +66 -0
  749. farna/db/migrations/versions/0364_rewrite_legacy_persisted_values.py +387 -0
  750. farna/db/migrations/versions/0365_runs_family_owner_team.py +598 -0
  751. farna/db/migrations/versions/0366_onboarding_progress_rls_setting.py +64 -0
  752. farna/db/migrations/versions/0367_scoped_bootstrap_pre_auth_policies.py +110 -0
  753. farna/db/migrations/versions/0368_invitations_quarantine_rls.py +157 -0
  754. farna/db/migrations/versions/0369_pipeline_family_owner_team.py +178 -0
  755. farna/db/migrations/versions/0370_redact_error_detail_tracebacks.py +304 -0
  756. farna/db/migrations/versions/0371_hitl_claims_revision.py +57 -0
  757. farna/db/migrations/versions/0372_collection_install_owner_team.py +72 -0
  758. farna/db/migrations/versions/0373_licence_gate.py +193 -0
  759. farna/db/models/__init__.py +249 -0
  760. farna/db/models/account.py +101 -0
  761. farna/db/models/agent.py +84 -0
  762. farna/db/models/agent_runner_binding.py +38 -0
  763. farna/db/models/api_key.py +67 -0
  764. farna/db/models/assistant_context_source.py +52 -0
  765. farna/db/models/assistant_message.py +42 -0
  766. farna/db/models/assistant_session.py +24 -0
  767. farna/db/models/assistant_skill.py +50 -0
  768. farna/db/models/audit_event.py +72 -0
  769. farna/db/models/base.py +112 -0
  770. farna/db/models/collection_install.py +180 -0
  771. farna/db/models/composite_template.py +40 -0
  772. farna/db/models/connector_instance.py +52 -0
  773. farna/db/models/connector_profile.py +67 -0
  774. farna/db/models/cost_component.py +66 -0
  775. farna/db/models/daily_run_count.py +48 -0
  776. farna/db/models/environment_profile.py +92 -0
  777. farna/db/models/error_event.py +35 -0
  778. farna/db/models/error_forwarder_config.py +26 -0
  779. farna/db/models/error_group.py +32 -0
  780. farna/db/models/error_notification_rule.py +75 -0
  781. farna/db/models/eval.py +95 -0
  782. farna/db/models/eval_dataset.py +164 -0
  783. farna/db/models/eval_result.py +144 -0
  784. farna/db/models/eval_suite.py +94 -0
  785. farna/db/models/eval_suite_run.py +291 -0
  786. farna/db/models/evidence.py +83 -0
  787. farna/db/models/evidence_redaction_rule.py +73 -0
  788. farna/db/models/external_agent.py +66 -0
  789. farna/db/models/feedback_record.py +64 -0
  790. farna/db/models/hitl_claim.py +139 -0
  791. farna/db/models/invitation.py +84 -0
  792. farna/db/models/journey.py +87 -0
  793. farna/db/models/library_primitive.py +149 -0
  794. farna/db/models/licence_gate.py +214 -0
  795. farna/db/models/lifecycle_map.py +53 -0
  796. farna/db/models/lifecycle_map_stage.py +45 -0
  797. farna/db/models/mcp_server.py +94 -0
  798. farna/db/models/mcp_setup_token.py +24 -0
  799. farna/db/models/metrics_staging.py +47 -0
  800. farna/db/models/model_backend.py +47 -0
  801. farna/db/models/node.py +72 -0
  802. farna/db/models/node_category.py +28 -0
  803. farna/db/models/node_observation.py +26 -0
  804. farna/db/models/notification.py +142 -0
  805. farna/db/models/notification_delivery.py +32 -0
  806. farna/db/models/notification_endpoint.py +23 -0
  807. farna/db/models/oauth_client.py +31 -0
  808. farna/db/models/oauth_token.py +147 -0
  809. farna/db/models/onboarding_progress.py +29 -0
  810. farna/db/models/org_membership.py +41 -0
  811. farna/db/models/organisation.py +121 -0
  812. farna/db/models/organisation_cost_state.py +62 -0
  813. farna/db/models/parameter_schema.py +26 -0
  814. farna/db/models/parameter_set.py +28 -0
  815. farna/db/models/pipeline.py +224 -0
  816. farna/db/models/pipeline_edge.py +74 -0
  817. farna/db/models/pipeline_folder.py +23 -0
  818. farna/db/models/pipeline_snapshot.py +134 -0
  819. farna/db/models/policy_gate.py +125 -0
  820. farna/db/models/policy_gate_decision.py +113 -0
  821. farna/db/models/primitive_abuse_report.py +34 -0
  822. farna/db/models/primitive_rating.py +25 -0
  823. farna/db/models/publisher.py +34 -0
  824. farna/db/models/run.py +742 -0
  825. farna/db/models/run_attempt.py +157 -0
  826. farna/db/models/run_daily_facts.py +254 -0
  827. farna/db/models/run_evidence.py +56 -0
  828. farna/db/models/run_node_outputs.py +187 -0
  829. farna/db/models/runner_probe_cache.py +47 -0
  830. farna/db/models/scheduled_report.py +56 -0
  831. farna/db/models/schema.py +64 -0
  832. farna/db/models/secret.py +12 -0
  833. farna/db/models/snapshot_schema_pin.py +31 -0
  834. farna/db/models/spend_anomaly.py +37 -0
  835. farna/db/models/sso_provider.py +39 -0
  836. farna/db/models/system_audit_event.py +72 -0
  837. farna/db/models/system_config.py +23 -0
  838. farna/db/models/system_map.py +405 -0
  839. farna/db/models/team.py +28 -0
  840. farna/db/models/team_membership.py +18 -0
  841. farna/db/models/tier_catalog.py +24 -0
  842. farna/db/models/token_family.py +40 -0
  843. farna/db/models/trigger.py +119 -0
  844. farna/db/models/trigger_event.py +90 -0
  845. farna/db/models/trigger_event_finding.py +71 -0
  846. farna/db/models/variant_batch_state.py +49 -0
  847. farna/db/models/variant_group.py +51 -0
  848. farna/db/models/web_vital_event.py +36 -0
  849. farna/db/models/webhook.py +31 -0
  850. farna/db/pipeline_ownership.py +188 -0
  851. farna/db/plain_dump.py +392 -0
  852. farna/db/repositories/__init__.py +82 -0
  853. farna/db/repositories/base.py +97 -0
  854. farna/db/repositories/evidence.py +8 -0
  855. farna/db/repositories/generic.py +41 -0
  856. farna/db/repositories/locks.py +190 -0
  857. farna/db/repositories/postgres.py +21 -0
  858. farna/db/repositories/system_map.py +2045 -0
  859. farna/db/rls.py +624 -0
  860. farna/db/rls_tripwire.py +214 -0
  861. farna/db/run_ownership.py +58 -0
  862. farna/db/runner_binding_constraints.py +137 -0
  863. farna/db/seed.py +500 -0
  864. farna/db/seed_demo.py +3408 -0
  865. farna/db/session.py +181 -0
  866. farna/db/settings_resolver.py +169 -0
  867. farna/db/soft_delete.py +109 -0
  868. farna/db/sqlstates.py +240 -0
  869. farna/db/tenant_scope.py +408 -0
  870. farna/db/unique_violation.py +28 -0
  871. farna/db/url_utils.py +301 -0
  872. farna/determination/__init__.py +12 -0
  873. farna/determination/comparison.py +535 -0
  874. farna/determination/draft.py +198 -0
  875. farna/determination/inference.py +465 -0
  876. farna/determination/models.py +126 -0
  877. farna/determination/rerun.py +488 -0
  878. farna/determination/review.py +248 -0
  879. farna/determination/scanner.py +205 -0
  880. farna/launcher/__init__.py +10 -0
  881. farna/launcher/config_source.py +427 -0
  882. farna/launcher/doctor.py +2069 -0
  883. farna/launcher/doctor_report.py +92 -0
  884. farna/launcher/entry.py +1154 -0
  885. farna/launcher/env_contract.py +92 -0
  886. farna/launcher/env_safety.py +192 -0
  887. farna/launcher/evidence_key.py +290 -0
  888. farna/launcher/initdb.py +387 -0
  889. farna/launcher/manifest.py +436 -0
  890. farna/launcher/platform.py +89 -0
  891. farna/launcher/policy.py +148 -0
  892. farna/launcher/runtime_config.py +88 -0
  893. farna/launcher/secrets_file.py +184 -0
  894. farna/launcher/service.py +545 -0
  895. farna/launcher/state.py +241 -0
  896. farna/launcher/supervisor.py +2753 -0
  897. farna/launcher/upgrade.py +2668 -0
  898. farna/lifecycle.py +522 -0
  899. farna/model_backends/__init__.py +60 -0
  900. farna/model_backends/ai21/__init__.py +16 -0
  901. farna/model_backends/anthropic/__init__.py +124 -0
  902. farna/model_backends/azure_openai/__init__.py +67 -0
  903. farna/model_backends/base.py +389 -0
  904. farna/model_backends/bedrock/__init__.py +41 -0
  905. farna/model_backends/cohere/__init__.py +62 -0
  906. farna/model_backends/deepseek/__init__.py +14 -0
  907. farna/model_backends/fireworks/__init__.py +16 -0
  908. farna/model_backends/gemini/__init__.py +73 -0
  909. farna/model_backends/grok/__init__.py +14 -0
  910. farna/model_backends/groq/__init__.py +16 -0
  911. farna/model_backends/jan/__init__.py +22 -0
  912. farna/model_backends/llamacpp/__init__.py +22 -0
  913. farna/model_backends/lm_studio/__init__.py +22 -0
  914. farna/model_backends/localai/__init__.py +22 -0
  915. farna/model_backends/mistral/__init__.py +72 -0
  916. farna/model_backends/module.py +170 -0
  917. farna/model_backends/ollama/__init__.py +22 -0
  918. farna/model_backends/openai/__init__.py +3 -0
  919. farna/model_backends/opencode/__init__.py +70 -0
  920. farna/model_backends/openrouter/__init__.py +14 -0
  921. farna/model_backends/perplexity/__init__.py +16 -0
  922. farna/model_backends/qwen/__init__.py +14 -0
  923. farna/model_backends/stub/__init__.py +7 -0
  924. farna/model_backends/stub/backend.py +105 -0
  925. farna/model_backends/tgi/__init__.py +22 -0
  926. farna/model_backends/togetherai/__init__.py +16 -0
  927. farna/model_backends/vertexai/__init__.py +41 -0
  928. farna/model_backends/vllm/__init__.py +22 -0
  929. farna/model_backends/watsonx/__init__.py +43 -0
  930. farna/otel_bridge/__init__.py +53 -0
  931. farna/otel_bridge/export.py +693 -0
  932. farna/otel_bridge/handler.py +655 -0
  933. farna/otel_bridge/trace_id.py +53 -0
  934. farna/settings.py +1880 -0
  935. farna/support/__init__.py +44 -0
  936. farna/support/bundle.py +1650 -0
  937. farna/support/redaction.py +412 -0
  938. farna/tools/__init__.py +1 -0
  939. farna/util/__init__.py +151 -0
  940. farna/util/one_time_token.py +26 -0
  941. farna/util/uuid.py +37 -0
  942. farna/utils/__init__.py +8 -0
  943. farna/utils/uuid.py +5 -0
  944. farna/version.py +76 -0
  945. farna_control-0.3.335.dist-info/METADATA +98 -0
  946. farna_control-0.3.335.dist-info/RECORD +949 -0
  947. farna_control-0.3.335.dist-info/WHEEL +4 -0
  948. farna_control-0.3.335.dist-info/entry_points.txt +2 -0
  949. farna_control-0.3.335.dist-info/licenses/LICENSE +19 -0
farna/__init__.py ADDED
@@ -0,0 +1,27 @@
1
+ """Modulo package root.
2
+
3
+ Exports the package version and build tag for runtime inspection.
4
+ """
5
+
6
+ import os
7
+
8
+ from farna.version import get_version
9
+
10
+ __version__ = get_version()
11
+
12
+ _SHORT_SHA_LENGTH = 7
13
+
14
+
15
+ def get_build_tag() -> str:
16
+ """Return the short build tag derived from ``GIT_SHA``.
17
+
18
+ Uses the first 7 characters when a full SHA is available, otherwise
19
+ falls back to ``"build-local-dev"`` for local development.
20
+ """
21
+ sha = os.environ.get("GIT_SHA", "")
22
+ if len(sha) >= _SHORT_SHA_LENGTH:
23
+ return f"build-{sha[:_SHORT_SHA_LENGTH]}"
24
+ return "build-local-dev"
25
+
26
+
27
+ __build_tag__ = get_build_tag()
farna/_types.py ADDED
@@ -0,0 +1,14 @@
1
+ """Shared lightweight type aliases reused across modulo packages.
2
+
3
+ Centralised so connector and core payload-parsing code does not redeclare the
4
+ same ``dict[str, Any]`` / ``list[dict[str, Any]]`` aliases in every module.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from typing import Any
10
+
11
+ __all__ = ["_DICT_STR_ANY", "_LIST_DICT_STR_ANY"]
12
+
13
+ type _DICT_STR_ANY = dict[str, Any]
14
+ type _LIST_DICT_STR_ANY = list[dict[str, Any]]
farna/api/__init__.py ADDED
File without changes
@@ -0,0 +1,93 @@
1
+ """Shared HTTP connector-team gate for route write paths (FAR-1515, FAR-1618).
2
+
3
+ ``farna.core.team_visibility`` owns the team-visibility predicate and the
4
+ ``ConnectorBindingMissingError`` / mismatch-detail machinery, but it is pure
5
+ logic — it never raises an HTTP error. Every graph-write route that persists
6
+ connector bindings must convert that outcome into the SAME named 409
7
+ ``connector_team_mismatch`` inside its own transaction (FAR-1515 MAJOR 4), so
8
+ the refusal rolls the whole write back instead of leaving half-created
9
+ entities. This module is the single HTTP-level wrapper every one of those
10
+ routes delegates to — pipeline graph saves
11
+ (``routes.pipelines._enforce_connector_team_bindings``), trigger connector
12
+ scope (``routes.triggers._validate_connector_instance_team_scope``), and the
13
+ library/template import gates (``routes.library``, ``routes.templates``) — so
14
+ the conversion cannot drift between them; a widening applied here reaches every
15
+ caller at once. (The MCP graph-write tool maps the same outcome to its own dict
16
+ result and the connector-visibility downgrade recomputes its own mismatches, so
17
+ neither inlines this HTTP conversion.)
18
+
19
+ Only the team-PRIVATE direction is refused: a ``visibility: team`` connector
20
+ may only bind to a pipeline owned by the same team. An org-visibility connector
21
+ is shared across the organisation and binds to ANY pipeline, team-owned or not
22
+ (FAR-1618 removed the reverse direction FAR-1515 had added). A binding the
23
+ team-blind org-scoped read cannot resolve (``ConnectorBindingMissingError``,
24
+ FAR-1515 CRITICAL 1) is the same named 409: a binding the gate cannot validate
25
+ never saves.
26
+ """
27
+
28
+ from __future__ import annotations
29
+
30
+ import uuid
31
+ from typing import Any, Protocol
32
+
33
+ from fastapi import HTTPException, status
34
+ from sqlalchemy.ext.asyncio import AsyncSession
35
+
36
+ from farna.core.team_visibility import (
37
+ ConnectorBindingMissingError,
38
+ ConnectorTeamMismatch,
39
+ connector_team_mismatch_detail,
40
+ )
41
+
42
+
43
+ # ``find_connector_team_mismatches`` returns the cross-team violations; the
44
+ # callers inject their own module-level binding so an existing monkeypatch of
45
+ # ``routes.<module>.find_connector_team_mismatches`` still intercepts the gate.
46
+ class ConnectorTeamMismatchFinder(Protocol):
47
+ async def __call__(
48
+ self,
49
+ session: AsyncSession,
50
+ *,
51
+ org_id: uuid.UUID,
52
+ pipeline_owner_team_id: uuid.UUID | None,
53
+ connector_bindings: list[dict[str, Any]],
54
+ ) -> list[ConnectorTeamMismatch]: ...
55
+
56
+
57
+ async def enforce_connector_team_gate(
58
+ session: AsyncSession,
59
+ *,
60
+ org_id: uuid.UUID,
61
+ owner_team_id: uuid.UUID | None,
62
+ bindings: list[dict[str, Any]],
63
+ find_mismatches: ConnectorTeamMismatchFinder,
64
+ ) -> None:
65
+ """Refuse a graph write that pins another team's private connector.
66
+
67
+ Raises a 409 ``connector_team_mismatch`` for a team-private connector bound
68
+ to a pipeline owned by a different team (or an org pipeline with no owner
69
+ team), and the same named 409 for a binding the team-blind org-scoped read
70
+ cannot resolve. Runs inside the caller's transaction, so the raised error
71
+ rolls the write back. An empty binding list is a no-op — there is nothing
72
+ to judge. ``find_mismatches`` is the caller's
73
+ ``find_connector_team_mismatches`` binding, threaded through so the gate
74
+ keeps a single test seam in the route module that owns it.
75
+ """
76
+ if not bindings:
77
+ return
78
+ try:
79
+ mismatches = await find_mismatches(
80
+ session,
81
+ org_id=org_id,
82
+ pipeline_owner_team_id=owner_team_id,
83
+ connector_bindings=bindings,
84
+ )
85
+ except ConnectorBindingMissingError as exc:
86
+ # FAR-1515 CRITICAL 1: same named 409 as the graph-save paths — an
87
+ # unresolvable binding must not import any more than it must save.
88
+ raise HTTPException(status_code=status.HTTP_409_CONFLICT, detail=str(exc)) from None
89
+ if mismatches:
90
+ raise HTTPException(
91
+ status_code=status.HTTP_409_CONFLICT,
92
+ detail=connector_team_mismatch_detail(mismatches),
93
+ )
farna/api/constants.py ADDED
@@ -0,0 +1,44 @@
1
+ """Shared message constants for the API layer.
2
+
3
+ These strings are duplicated across many route files (python:S1192). Centralising
4
+ them here keeps the literal in one place; route files import the constant instead
5
+ of repeating the string. Values are user-facing HTTPException details / API
6
+ messages -- do not change the text without checking all consumers.
7
+ """
8
+
9
+ MSG_FEATURE_NOT_AVAILABLE = "Feature is not available. Run database migrations to enable it."
10
+ MSG_THIS_FEATURE_NOT_AVAILABLE = "This feature is not available. Run database migrations to enable it."
11
+ MSG_RESOURCE_ALREADY_EXISTS = "A resource with this value already exists"
12
+ MSG_INTERNAL_SERVER_ERROR = "Internal server error"
13
+ MSG_CSRF_FAILED = "CSRF validation failed"
14
+ MSG_UNEXPECTED_ERROR = "An unexpected error occurred."
15
+ MSG_UNEXPECTED_ERROR_NO_PERIOD = "An unexpected error occurred"
16
+ MSG_DB_OPERATION_FAILED = "Database operation failed. Please try again later."
17
+ MSG_DB_ERROR_PLEASE_TRY = "Database error. Please try again."
18
+ MSG_UNEXPECTED_ERROR_PLEASE_TRY = "An unexpected error occurred. Please try again."
19
+ MSG_FEATURE_NOT_AVAILABLE_CONTACT_SUPPORT = "Feature is not available. This feature requires a database update. Please contact support."
20
+ MSG_DATABASE_TEMPORARILY_UNAVAILABLE = "Database temporarily unavailable."
21
+ MSG_DATABASE_TEMPORARILY_UNAVAILABLE_PLEASE = "Database temporarily unavailable. Please try again."
22
+ MSG_DATABASE_ERROR_OCCURRED_PLEASE = "Database error occurred. Please try again later."
23
+ MSG_NO_ORGANISATION = "No organisation"
24
+ MSG_ORGANISATION_NOT_FOUND = "Organisation not found"
25
+ MSG_NOT_FOUND = "Not found"
26
+ MSG_ERROR_TRACKING_NOT_AVAILABLE = "Error tracking is not available. Run database migrations to enable it."
27
+ MSG_ERROR_TRACKING_TEMPORARILY_UNAVAILABLE = "Error tracking is temporarily unavailable. Please try again."
28
+ MSG_UNEXPECTED_ERROR_OCCURRED_WHILE = "An unexpected error occurred while processing your request."
29
+ MSG_TRIGGER_NOT_FOUND = "Trigger not found"
30
+ MSG_TEAM_NAME_ALREADY_EXISTS = "A team with this name already exists in your organisation"
31
+ MSG_TEAM_NOT_FOUND = "Team not found"
32
+ MSG_PIPELINE_NOT_FOUND = "Pipeline not found"
33
+ MSG_RUN_NOT_FOUND = "Run not found"
34
+ MSG_FOLDER_NOT_FOUND = "Folder not found"
35
+ MSG_ENVIRONMENT_PROFILE_NOT_FOUND = "Environment profile not found"
36
+ MSG_PRIMITIVE_NOT_FOUND = "Primitive not found"
37
+
38
+ # Shared permission code (python:S1192): several system-admin routes gate on the
39
+ # same instance-wide permission, so the identity-bearing string lives here once.
40
+ PERM_SYSTEM_CONFIG_MANAGE = "system.config.manage"
41
+
42
+ # Feature-flag names gated by more than one API module: the identity-bearing
43
+ # string lives here once so a rename cannot leave one gate stale.
44
+ SYSTEM_MAPS_FLAG = "system_maps"