adaptorch 0.1.1__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 (369) hide show
  1. adaptorch/__init__.py +399 -0
  2. adaptorch/__main__.py +4 -0
  3. adaptorch/_wilson.py +64 -0
  4. adaptorch/a2a_adapter.py +243 -0
  5. adaptorch/ab_stats.py +1545 -0
  6. adaptorch/accuracy_features.py +148 -0
  7. adaptorch/accuracy_gate.py +43 -0
  8. adaptorch/acquisition/__init__.py +76 -0
  9. adaptorch/acquisition/events.py +451 -0
  10. adaptorch/acquisition/lanes.py +539 -0
  11. adaptorch/acquisition/liveness.py +412 -0
  12. adaptorch/acquisition/receipt.py +269 -0
  13. adaptorch/aeg_te/__init__.py +265 -0
  14. adaptorch/aeg_te/candidate_fixtures.py +364 -0
  15. adaptorch/aeg_te/clustering.py +163 -0
  16. adaptorch/aeg_te/drift.py +98 -0
  17. adaptorch/aeg_te/evidence_dag.py +687 -0
  18. adaptorch/aeg_te/evidence_merge.py +46 -0
  19. adaptorch/aeg_te/hermetic.py +636 -0
  20. adaptorch/aeg_te/hx2.py +2785 -0
  21. adaptorch/aeg_te/issue_repro.py +700 -0
  22. adaptorch/aeg_te/lcb_calibration.py +280 -0
  23. adaptorch/aeg_te/matrix_selector.py +583 -0
  24. adaptorch/aeg_te/models.py +348 -0
  25. adaptorch/aeg_te/pipeline.py +447 -0
  26. adaptorch/aeg_te/product_repro.py +328 -0
  27. adaptorch/aeg_te/repair.py +181 -0
  28. adaptorch/aeg_te/repro_execution.py +444 -0
  29. adaptorch/aeg_te/repro_overfit.py +555 -0
  30. adaptorch/aeg_te/repro_runner.py +528 -0
  31. adaptorch/aeg_te/repro_targeting.py +425 -0
  32. adaptorch/aeg_te/routing.py +201 -0
  33. adaptorch/aeg_te/scoring.py +490 -0
  34. adaptorch/aeg_te/testing.py +424 -0
  35. adaptorch/aeg_te/trace.py +263 -0
  36. adaptorch/agent_adapters.py +817 -0
  37. adaptorch/ai_disclosure.py +144 -0
  38. adaptorch/answer_semantic.py +174 -0
  39. adaptorch/api.py +392 -0
  40. adaptorch/apply_rate_control.py +364 -0
  41. adaptorch/audit_report.py +802 -0
  42. adaptorch/b2c_first_run.py +529 -0
  43. adaptorch/b2c_readiness.py +953 -0
  44. adaptorch/behavioral_ranking.py +118 -0
  45. adaptorch/bench85b/__init__.py +196 -0
  46. adaptorch/bench85b/attestation.py +310 -0
  47. adaptorch/bench85b/backend_tristate.py +320 -0
  48. adaptorch/bench85b/canonical.py +179 -0
  49. adaptorch/bench85b/canonical_status.py +94 -0
  50. adaptorch/bench85b/capability_extraction.py +416 -0
  51. adaptorch/bench85b/capability_signature.py +262 -0
  52. adaptorch/bench85b/classifier.py +215 -0
  53. adaptorch/bench85b/control_plane_ready.py +100 -0
  54. adaptorch/bench85b/decision_receipt.py +127 -0
  55. adaptorch/bench85b/exercise_receipt.py +1733 -0
  56. adaptorch/bench85b/freshness.py +108 -0
  57. adaptorch/bench85b/image_trust.py +255 -0
  58. adaptorch/bench85b/oracle.py +102 -0
  59. adaptorch/bench85b/paired_replay.py +143 -0
  60. adaptorch/bench85b/policy_gates.py +158 -0
  61. adaptorch/bench85b/preflight.py +103 -0
  62. adaptorch/bench85b/repro_contract.py +184 -0
  63. adaptorch/bench85b/roots.py +220 -0
  64. adaptorch/bench85b/run_state.py +89 -0
  65. adaptorch/bench85b/smoke.py +247 -0
  66. adaptorch/bench85b/types_.py +23 -0
  67. adaptorch/bench85b_execution/__init__.py +348 -0
  68. adaptorch/bench85b_execution/attestation_signer.py +305 -0
  69. adaptorch/bench85b_execution/candidate_failure_classifier.py +61 -0
  70. adaptorch/bench85b_execution/canonical_status.py +34 -0
  71. adaptorch/bench85b_execution/clean_host_replay_manifest.py +321 -0
  72. adaptorch/bench85b_execution/clean_host_replay_runner.py +137 -0
  73. adaptorch/bench85b_execution/clock.py +31 -0
  74. adaptorch/bench85b_execution/decision_append_log.py +275 -0
  75. adaptorch/bench85b_execution/dry_run_backend.py +91 -0
  76. adaptorch/bench85b_execution/dry_run_image.py +64 -0
  77. adaptorch/bench85b_execution/dry_run_paired.py +64 -0
  78. adaptorch/bench85b_execution/dry_run_smoke.py +102 -0
  79. adaptorch/bench85b_execution/durable_nonce_evidence.py +432 -0
  80. adaptorch/bench85b_execution/durable_nonce_verifier.py +229 -0
  81. adaptorch/bench85b_execution/engine.py +223 -0
  82. adaptorch/bench85b_execution/errors.py +22 -0
  83. adaptorch/bench85b_execution/evidence_freeze.py +601 -0
  84. adaptorch/bench85b_execution/expansion_gate.py +222 -0
  85. adaptorch/bench85b_execution/expansion_queue.py +857 -0
  86. adaptorch/bench85b_execution/expansion_queue_status.py +277 -0
  87. adaptorch/bench85b_execution/expansion_runner.py +113 -0
  88. adaptorch/bench85b_execution/expansion_scheduler.py +136 -0
  89. adaptorch/bench85b_execution/expansion_worker_adapter.py +159 -0
  90. adaptorch/bench85b_execution/expansion_worker_entrypoint.py +326 -0
  91. adaptorch/bench85b_execution/expansion_worker_loop.py +507 -0
  92. adaptorch/bench85b_execution/freeze_replay_bundle.py +339 -0
  93. adaptorch/bench85b_execution/freeze_verifier.py +293 -0
  94. adaptorch/bench85b_execution/live_backend.py +213 -0
  95. adaptorch/bench85b_execution/merkle.py +118 -0
  96. adaptorch/bench85b_execution/official_evaluator_manifest.py +533 -0
  97. adaptorch/bench85b_execution/oracle_runner.py +385 -0
  98. adaptorch/bench85b_execution/pair_validator.py +119 -0
  99. adaptorch/bench85b_execution/paired_replay_orchestrator.py +332 -0
  100. adaptorch/bench85b_execution/positive_evidence_orchestrator.py +287 -0
  101. adaptorch/bench85b_execution/protocols.py +52 -0
  102. adaptorch/bench85b_execution/release_bound_evidence.py +795 -0
  103. adaptorch/bench85b_execution/release_control_plane.py +769 -0
  104. adaptorch/bench85b_execution/release_decision_planes.py +697 -0
  105. adaptorch/bench85b_execution/release_decision_signatures.py +749 -0
  106. adaptorch/bench85b_execution/release_gate_contract.py +350 -0
  107. adaptorch/bench85b_execution/release_m7_ledger.py +330 -0
  108. adaptorch/bench85b_execution/release_predicate_evidence.py +653 -0
  109. adaptorch/bench85b_execution/release_trust_io.py +539 -0
  110. adaptorch/bench85b_execution/release_trust_manifest.py +1240 -0
  111. adaptorch/bench85b_execution/release_workflow.py +2184 -0
  112. adaptorch/bench85b_execution/replay_runner.py +205 -0
  113. adaptorch/bench85b_execution/runtime_evidence_matrix.py +1195 -0
  114. adaptorch/bench85b_execution/runtime_matrix_axes.py +1389 -0
  115. adaptorch/bench85b_execution/signed_evidence_bundle.py +1005 -0
  116. adaptorch/bench85b_execution/signer_trust_bundle.py +290 -0
  117. adaptorch/bench85b_execution/signer_trust_bundle_parser.py +109 -0
  118. adaptorch/bench85b_execution/signing_keys.py +154 -0
  119. adaptorch/bench85b_execution/substrate_warmup.py +216 -0
  120. adaptorch/bench85b_execution/trust_bootstrap.py +850 -0
  121. adaptorch/bench85b_execution/trust_join.py +585 -0
  122. adaptorch/bench85b_execution/verdict_matrix.py +145 -0
  123. adaptorch/bench85b_live/__init__.py +72 -0
  124. adaptorch/bench85b_live/cosign_image.py +78 -0
  125. adaptorch/bench85b_live/errors.py +22 -0
  126. adaptorch/bench85b_live/http_client.py +73 -0
  127. adaptorch/bench85b_live/oci_availability.py +41 -0
  128. adaptorch/bench85b_live/oci_probe_receipt.py +308 -0
  129. adaptorch/bench85b_live/opt_in.py +58 -0
  130. adaptorch/bench85b_live/paired_side_runner.py +95 -0
  131. adaptorch/bench85b_live/podman_backend.py +139 -0
  132. adaptorch/bench85b_live/podman_smoke.py +330 -0
  133. adaptorch/bench85b_live/process_runner.py +115 -0
  134. adaptorch/benchmark_bundle.py +1242 -0
  135. adaptorch/benchmark_cursor_integrity.py +125 -0
  136. adaptorch/benchmark_direct_arm.py +281 -0
  137. adaptorch/benchmark_harness.py +568 -0
  138. adaptorch/benchmark_progress.py +1655 -0
  139. adaptorch/benchmark_registry.py +560 -0
  140. adaptorch/benchmarking.py +7093 -0
  141. adaptorch/beta_quantile.py +77 -0
  142. adaptorch/brand_report.py +511 -0
  143. adaptorch/budget_router.py +1303 -0
  144. adaptorch/calibration.py +611 -0
  145. adaptorch/cascade_router.py +360 -0
  146. adaptorch/cek/__init__.py +76 -0
  147. adaptorch/cek/_coerce.py +120 -0
  148. adaptorch/cek/adapters/__init__.py +19 -0
  149. adaptorch/cek/adapters/aeg_te_shadow.py +267 -0
  150. adaptorch/cek/constitution_bundle.py +177 -0
  151. adaptorch/cek/constitutional.py +39 -0
  152. adaptorch/cek/constitutional_review.py +406 -0
  153. adaptorch/cek/correctness_wall.py +354 -0
  154. adaptorch/cek/deterministic_gates.py +13 -0
  155. adaptorch/cek/docker_evidence.py +199 -0
  156. adaptorch/cek/evidence_card.py +206 -0
  157. adaptorch/cek/models.py +266 -0
  158. adaptorch/cek/observability.py +158 -0
  159. adaptorch/cek/provenance.py +77 -0
  160. adaptorch/cek/reducer.py +194 -0
  161. adaptorch/cek/shadow_report.py +468 -0
  162. adaptorch/cek/types.py +95 -0
  163. adaptorch/circuit_breaker.py +358 -0
  164. adaptorch/cli.py +1310 -0
  165. adaptorch/cli_subscription_health.py +222 -0
  166. adaptorch/cloud_auth.py +1585 -0
  167. adaptorch/confidence_weighted_vote.py +50 -0
  168. adaptorch/conformal_calibration.py +138 -0
  169. adaptorch/conformal_gate.py +108 -0
  170. adaptorch/consensus_weighting.py +729 -0
  171. adaptorch/contract_error.py +17 -0
  172. adaptorch/control_plane/__init__.py +10340 -0
  173. adaptorch/control_plane/auth.py +501 -0
  174. adaptorch/control_plane/auto_mode.py +91 -0
  175. adaptorch/control_plane/billing.py +40 -0
  176. adaptorch/control_plane/dashboard_projections.py +222 -0
  177. adaptorch/control_plane/env_utils.py +29 -0
  178. adaptorch/control_plane/execution_ensemble.py +328 -0
  179. adaptorch/control_plane/execution_judge.py +149 -0
  180. adaptorch/control_plane/execution_provider.py +308 -0
  181. adaptorch/control_plane/execution_verifier.py +252 -0
  182. adaptorch/control_plane/fingerprint.py +10 -0
  183. adaptorch/control_plane/marketing_api.py +139 -0
  184. adaptorch/control_plane/marketing_email.py +146 -0
  185. adaptorch/control_plane/marketing_sink.py +56 -0
  186. adaptorch/control_plane/marketing_validation.py +219 -0
  187. adaptorch/control_plane/models.py +653 -0
  188. adaptorch/control_plane/ops_router.py +388 -0
  189. adaptorch/control_plane/polar_billing.py +221 -0
  190. adaptorch/control_plane/provenance_backfill.py +129 -0
  191. adaptorch/control_plane/redis_health.py +97 -0
  192. adaptorch/control_plane/request_credential.py +160 -0
  193. adaptorch/control_plane/run_authenticity.py +123 -0
  194. adaptorch/control_plane/shared_backend.py +276 -0
  195. adaptorch/control_plane/storage.py +164 -0
  196. adaptorch/control_plane/supabase_artifact_store.py +494 -0
  197. adaptorch/control_plane/supabase_run_store.py +457 -0
  198. adaptorch/control_plane/time_utils.py +30 -0
  199. adaptorch/control_plane/validation.py +77 -0
  200. adaptorch/control_plane/vera_bridge.py +110 -0
  201. adaptorch/correlation_contract.py +156 -0
  202. adaptorch/correlation_matrix.py +64 -0
  203. adaptorch/correlation_policy.py +242 -0
  204. adaptorch/correlation_support.py +48 -0
  205. adaptorch/cse_estimator.py +194 -0
  206. adaptorch/d1_analysis.py +263 -0
  207. adaptorch/d1_liveness.py +130 -0
  208. adaptorch/d1_mcnemar.py +49 -0
  209. adaptorch/d1_preregistration.py +169 -0
  210. adaptorch/d1_preregistration_types.py +175 -0
  211. adaptorch/dag.py +544 -0
  212. adaptorch/decision_trace.py +697 -0
  213. adaptorch/durable_store.py +108 -0
  214. adaptorch/edgar/__init__.py +9 -0
  215. adaptorch/edgar/expansion.py +192 -0
  216. adaptorch/edgar/groq_expansion_client.py +86 -0
  217. adaptorch/embedding_consistency.py +564 -0
  218. adaptorch/engine.py +2368 -0
  219. adaptorch/ensemble.py +2331 -0
  220. adaptorch/ensemble_judge.py +549 -0
  221. adaptorch/evidence_canonical.py +103 -0
  222. adaptorch/evidence_kernel.py +204 -0
  223. adaptorch/evidence_kernel_store.py +152 -0
  224. adaptorch/evidence_kernel_types.py +171 -0
  225. adaptorch/evidence_receipt.py +228 -0
  226. adaptorch/evidence_seal.py +272 -0
  227. adaptorch/exact_binomial.py +83 -0
  228. adaptorch/executors.py +1105 -0
  229. adaptorch/file_safety.py +377 -0
  230. adaptorch/formulas.py +203 -0
  231. adaptorch/full50_alignment.py +881 -0
  232. adaptorch/full50_attempt_ledger.py +272 -0
  233. adaptorch/full50_attempt_ledger_identity.py +224 -0
  234. adaptorch/full50_attempt_ledger_identity_io.py +133 -0
  235. adaptorch/full50_attempt_ledger_schema.py +247 -0
  236. adaptorch/full50_authorization.py +209 -0
  237. adaptorch/full50_authorization_models.py +209 -0
  238. adaptorch/full50_durable_anchor.py +185 -0
  239. adaptorch/full50_exact50_adapter.py +234 -0
  240. adaptorch/full50_freeze.py +292 -0
  241. adaptorch/full50_input_bundle.py +170 -0
  242. adaptorch/full50_n4_validation.py +219 -0
  243. adaptorch/full50_orchestration.py +399 -0
  244. adaptorch/full50_outcome_denial_lifetime.py +172 -0
  245. adaptorch/full50_outcome_store_policy.py +284 -0
  246. adaptorch/full50_outcome_store_probe_io.py +54 -0
  247. adaptorch/full50_path_policy.py +309 -0
  248. adaptorch/full50_post_run.py +139 -0
  249. adaptorch/full50_postgres_ledger.py +386 -0
  250. adaptorch/full50_quality_reproducibility.py +165 -0
  251. adaptorch/full50_release_models.py +96 -0
  252. adaptorch/full50_release_runner.py +187 -0
  253. adaptorch/full50_renderer.py +621 -0
  254. adaptorch/full50_source_bundle.py +234 -0
  255. adaptorch/gmail_automation/__init__.py +21 -0
  256. adaptorch/gmail_automation/browser.py +122 -0
  257. adaptorch/gmail_automation/creator.py +178 -0
  258. adaptorch/gmail_automation/models.py +52 -0
  259. adaptorch/guardrails.py +443 -0
  260. adaptorch/hard_v3_verifier.py +266 -0
  261. adaptorch/harness_dashboard/__init__.py +11 -0
  262. adaptorch/harness_dashboard/scanner.py +190 -0
  263. adaptorch/higgsfield_graph.py +499 -0
  264. adaptorch/immutable_file.py +86 -0
  265. adaptorch/learned_router.py +1457 -0
  266. adaptorch/lexicons/__init__.py +8 -0
  267. adaptorch/lexicons/en.json +21 -0
  268. adaptorch/live_benchmark_profile.py +682 -0
  269. adaptorch/logprobs_extractor.py +579 -0
  270. adaptorch/mcp_adapter.py +171 -0
  271. adaptorch/mcp_local_backend.py +199 -0
  272. adaptorch/mcp_server.py +2648 -0
  273. adaptorch/measurement_cassette.py +166 -0
  274. adaptorch/measurement_replay.py +302 -0
  275. adaptorch/middleware_connectors.py +745 -0
  276. adaptorch/multiple_testing.py +23 -0
  277. adaptorch/n8n_connector.py +674 -0
  278. adaptorch/native/adaptorch_native.c +334 -0
  279. adaptorch/native_backend.py +180 -0
  280. adaptorch/numeric_answer_verifier.py +332 -0
  281. adaptorch/official_evaluation.py +373 -0
  282. adaptorch/offline_outcome.py +86 -0
  283. adaptorch/online_router.py +1124 -0
  284. adaptorch/oracle_firewall.py +193 -0
  285. adaptorch/orchestration_value.py +260 -0
  286. adaptorch/plan_catalog.py +95 -0
  287. adaptorch/plan_expiry.py +97 -0
  288. adaptorch/policy.py +173 -0
  289. adaptorch/provider_adapter.py +314 -0
  290. adaptorch/providers.py +2923 -0
  291. adaptorch/proxy_matrix/__init__.py +22 -0
  292. adaptorch/proxy_matrix/models.py +78 -0
  293. adaptorch/proxy_matrix/selector.py +175 -0
  294. adaptorch/proxy_matrix/storage.py +310 -0
  295. adaptorch/py.typed +1 -0
  296. adaptorch/quality_signal.py +108 -0
  297. adaptorch/receipt_chain.py +198 -0
  298. adaptorch/receipt_types.py +198 -0
  299. adaptorch/resource_ledger.py +192 -0
  300. adaptorch/risk_coverage.py +142 -0
  301. adaptorch/router.py +404 -0
  302. adaptorch/routing_calibration.py +77 -0
  303. adaptorch/run_manifest.py +93 -0
  304. adaptorch/runtime_action_lattice.py +50 -0
  305. adaptorch/runtime_actuator.py +262 -0
  306. adaptorch/runtime_change_v2.py +63 -0
  307. adaptorch/runtime_channels_v2.py +91 -0
  308. adaptorch/runtime_control.py +948 -0
  309. adaptorch/runtime_controller_v2.py +192 -0
  310. adaptorch/runtime_risk_v2.py +112 -0
  311. adaptorch/runtime_sensor_quality.py +94 -0
  312. adaptorch/runtime_sensors_v2.py +251 -0
  313. adaptorch/runtime_state_filter.py +276 -0
  314. adaptorch/seal_trust.py +101 -0
  315. adaptorch/selection_fusion.py +37 -0
  316. adaptorch/selective_risk.py +217 -0
  317. adaptorch/selective_risk_registry.py +55 -0
  318. adaptorch/self_consistency.py +722 -0
  319. adaptorch/sensors.py +454 -0
  320. adaptorch/session_guard/__init__.py +14 -0
  321. adaptorch/session_guard/guard.py +238 -0
  322. adaptorch/session_guard/models.py +51 -0
  323. adaptorch/shadow_hashes.py +77 -0
  324. adaptorch/shadow_planner.py +239 -0
  325. adaptorch/shadow_types.py +173 -0
  326. adaptorch/source_capture.py +265 -0
  327. adaptorch/source_revision.py +280 -0
  328. adaptorch/surrogate_mix.py +75 -0
  329. adaptorch/synthesis.py +4147 -0
  330. adaptorch/synthesis_ranking.py +548 -0
  331. adaptorch/synthesis_scoring.py +1007 -0
  332. adaptorch/synthesis_tuning.py +395 -0
  333. adaptorch/token_estimation.py +507 -0
  334. adaptorch/tracing.py +137 -0
  335. adaptorch/tuning_corpus.py +304 -0
  336. adaptorch/types.py +732 -0
  337. adaptorch/url_security.py +407 -0
  338. adaptorch/vera_cli.py +200 -0
  339. adaptorch/vera_config.py +280 -0
  340. adaptorch/vera_config_env.py +188 -0
  341. adaptorch/vera_contract_schema.py +266 -0
  342. adaptorch/vera_diagnostics.py +38 -0
  343. adaptorch/vera_engine.py +248 -0
  344. adaptorch/vera_evaluation.py +284 -0
  345. adaptorch/vera_pipeline.py +141 -0
  346. adaptorch/vera_policy.py +211 -0
  347. adaptorch/vera_profile_validation.py +246 -0
  348. adaptorch/vera_receipt_factory.py +44 -0
  349. adaptorch/vera_receipt_store.py +35 -0
  350. adaptorch/vera_record_dedup.py +35 -0
  351. adaptorch/vera_runtime.py +117 -0
  352. adaptorch/vera_types.py +285 -0
  353. adaptorch/verifiability.py +305 -0
  354. adaptorch/verification.py +898 -0
  355. adaptorch/verification_evidence.py +277 -0
  356. adaptorch/verification_posterior.py +268 -0
  357. adaptorch/verification_profiles.py +96 -0
  358. adaptorch/verification_scheduler.py +280 -0
  359. adaptorch/verifier_calibration.py +271 -0
  360. adaptorch/verifier_constitution.py +80 -0
  361. adaptorch/verifier_outcomes.py +144 -0
  362. adaptorch/verifier_registry.py +228 -0
  363. adaptorch-0.1.1.dist-info/METADATA +1078 -0
  364. adaptorch-0.1.1.dist-info/RECORD +369 -0
  365. adaptorch-0.1.1.dist-info/WHEEL +5 -0
  366. adaptorch-0.1.1.dist-info/entry_points.txt +3 -0
  367. adaptorch-0.1.1.dist-info/licenses/LICENSE +201 -0
  368. adaptorch-0.1.1.dist-info/licenses/NOTICE +7 -0
  369. adaptorch-0.1.1.dist-info/top_level.txt +1 -0
adaptorch/__init__.py ADDED
@@ -0,0 +1,399 @@
1
+ from importlib.metadata import PackageNotFoundError, version
2
+
3
+ from adaptorch.ab_stats import (
4
+ PairedABReport,
5
+ paired_ab_from_unit_scores,
6
+ paired_ab_report,
7
+ )
8
+ from adaptorch.agent_adapters import (
9
+ AgentAdapterError,
10
+ AgentInvocation,
11
+ SubprocessAgentConfig,
12
+ build_chat_sdk_agent,
13
+ build_claude_code_cli_agent,
14
+ build_cline_cli_agent,
15
+ build_codex_cli_agent,
16
+ build_cursor_cli_agent,
17
+ build_gemini_cli_agent,
18
+ build_google_genai_agent,
19
+ build_grok_openai_compatible_agent,
20
+ build_langchain_runnable_agent,
21
+ build_lovable_cli_agent,
22
+ build_named_cli_agent,
23
+ build_openai_compatible_responses_agent,
24
+ build_openai_responses_agent,
25
+ build_opencode_cli_agent,
26
+ build_rag_agent,
27
+ build_roocode_cli_agent,
28
+ build_subprocess_agent,
29
+ build_windsurf_cli_agent,
30
+ wrap_structured_agent,
31
+ )
32
+ from adaptorch.api import (
33
+ bundle_benchmark,
34
+ detect_provider,
35
+ load_task_payload,
36
+ onepager_benchmark,
37
+ report_benchmark,
38
+ run_benchmark,
39
+ run_task,
40
+ run_task_file,
41
+ summarize_benchmark,
42
+ )
43
+ from adaptorch.benchmark_registry import (
44
+ HARNESS_REGISTRY,
45
+ MODEL_PRESETS,
46
+ HarnessSpec,
47
+ ModelPreset,
48
+ estimate_ensemble_cost,
49
+ list_harness_ids,
50
+ list_model_keys,
51
+ lookup_harness,
52
+ lookup_model,
53
+ )
54
+ from adaptorch.benchmarking import (
55
+ execute_benchmark_run,
56
+ load_benchmark_config,
57
+ report_benchmark_run,
58
+ summarize_benchmark_run,
59
+ )
60
+ from adaptorch.cascade_router import CascadedRoutingDecision, CascadedTopologyRouter
61
+ from adaptorch.circuit_breaker import CircuitBreaker, CircuitBreakerPolicy
62
+ from adaptorch.dag import TaskDAG
63
+ from adaptorch.engine import AdaptOrchEngine
64
+ from adaptorch.ensemble import (
65
+ EMAWeightTracker,
66
+ EnsembleResult,
67
+ ModelProvider,
68
+ ModelResponse,
69
+ ParallelModelExecutor,
70
+ PromptComplexityRouter,
71
+ SelectionStrategy,
72
+ SemanticPromptCache,
73
+ ThompsonSelectionTracker,
74
+ apply_dynamic_relative_culling,
75
+ )
76
+ from adaptorch.formulas import (
77
+ ConvergenceReport,
78
+ DominanceReport,
79
+ RobustConvergenceReport,
80
+ convergence_report,
81
+ dominance_ratio_lower_bound,
82
+ dominance_report,
83
+ epsilon_gap,
84
+ quorum_agreement,
85
+ robust_convergence_report,
86
+ score_dispersion,
87
+ weighted_epsilon_gap,
88
+ )
89
+ from adaptorch.logprobs_extractor import ExtractionResult, LogprobsExtractor
90
+ from adaptorch.mcp_server import (
91
+ AdaptOrchMCPServer,
92
+ MCPServerConfig,
93
+ build_default_mcp_server,
94
+ build_run_resource_uri,
95
+ create_default_mcp_http_app,
96
+ create_mcp_http_app,
97
+ run_http_server,
98
+ )
99
+ from adaptorch.middleware_connectors import (
100
+ AnthropicMiddlewareConnector,
101
+ ClaudeCodeMiddlewareConnector,
102
+ ClineMiddlewareConnector,
103
+ CodexMiddlewareConnector,
104
+ CohereMiddlewareConnector,
105
+ ConnectorRegistry,
106
+ CursorMiddlewareConnector,
107
+ DeepSeekMiddlewareConnector,
108
+ GeminiMiddlewareConnector,
109
+ GoogleGenAIMiddlewareConnector,
110
+ GrokMiddlewareConnector,
111
+ GroqMiddlewareConnector,
112
+ LangChainMiddlewareConnector,
113
+ LangGraphMiddlewareConnector,
114
+ LovableMiddlewareConnector,
115
+ MakeMiddlewareConnector,
116
+ MCPMiddlewareConnector,
117
+ MiddlewareConnectorError,
118
+ MiddlewareDispatchOptions,
119
+ MistralMiddlewareConnector,
120
+ N8nMiddlewareConnector,
121
+ OllamaMiddlewareConnector,
122
+ OpenAIMiddlewareConnector,
123
+ OpenCodeMiddlewareConnector,
124
+ PerplexityMiddlewareConnector,
125
+ PromptMiddlewareConnector,
126
+ RooCodeMiddlewareConnector,
127
+ WebhookMiddlewareConnector,
128
+ WindsurfMiddlewareConnector,
129
+ XAIMiddlewareConnector,
130
+ ZapierMiddlewareConnector,
131
+ build_default_connector_registry,
132
+ )
133
+ from adaptorch.n8n_connector import (
134
+ N8nConnectorConfig,
135
+ N8nConnectorError,
136
+ N8nControlPlaneConnector,
137
+ N8nHttpError,
138
+ N8nRetryPolicy,
139
+ N8nTransportError,
140
+ build_n8n_benchmark_node_output,
141
+ build_n8n_node_output,
142
+ )
143
+ from adaptorch.native_backend import native_backend_available
144
+ from adaptorch.online_router import (
145
+ OnlineRouteDiagnostics,
146
+ OnlineTopologyRouter,
147
+ RoutingObservation,
148
+ )
149
+ from adaptorch.policy import BudgetPolicy, build_budget_policy
150
+ from adaptorch.provider_adapter import (
151
+ ProviderAdapterConfig,
152
+ ProviderModelAdapter,
153
+ build_ensemble_providers,
154
+ )
155
+ from adaptorch.providers import (
156
+ build_recording_provider,
157
+ build_replay_provider,
158
+ build_runtime_agent,
159
+ build_runtime_agent_with_logprobs,
160
+ build_streaming_agent,
161
+ build_synthesis_mode_plan,
162
+ close_all_provider_clients,
163
+ detect_provider_configuration,
164
+ provider_request_hash,
165
+ resolve_provider,
166
+ resolve_synthesis_mode_for_model,
167
+ )
168
+ from adaptorch.router import TopologyRouter
169
+ from adaptorch.runtime_actuator import BoundedRuntimeActuator
170
+ from adaptorch.runtime_controller_v2 import CseNcmhControllerV2
171
+ from adaptorch.runtime_state_filter import RuntimeStateFilter
172
+ from adaptorch.sensors import collect_from_api_response
173
+ from adaptorch.synthesis import adaptive_synthesis, consistency_score
174
+ from adaptorch.synthesis_tuning import (
175
+ TuningCase,
176
+ TuningResult,
177
+ evaluate_config,
178
+ tune_synthesis_config,
179
+ )
180
+ from adaptorch.token_estimation import TokenEstimationCalibrator, estimate_text_tokens
181
+ from adaptorch.tracing import (
182
+ FileTraceSink,
183
+ InMemoryTraceSink,
184
+ NullTraceSink,
185
+ TraceEvent,
186
+ TraceSink,
187
+ TraceSinkSummary,
188
+ )
189
+ from adaptorch.tuning_corpus import (
190
+ CorpusBuildReport,
191
+ CorpusBuildResult,
192
+ build_tuning_cases,
193
+ load_corpus_file,
194
+ )
195
+ from adaptorch.vera_engine import VeraVerificationEngine
196
+ from adaptorch.vera_receipt_store import FileReceiptSink
197
+ from adaptorch.vera_runtime import build_vera_runtime
198
+ from adaptorch.vera_types import (
199
+ VerificationDecision,
200
+ VerificationEvidenceEvent,
201
+ VerificationReceipt,
202
+ VerifierReliabilityProfile,
203
+ )
204
+ from adaptorch.verification import (
205
+ CommandVerifier,
206
+ SandboxLimits,
207
+ VerificationCommandResult,
208
+ VerificationOutcome,
209
+ )
210
+ from adaptorch.verification_posterior import EvidencePosteriorEngine
211
+ from adaptorch.verification_scheduler import SequentialVerificationScheduler
212
+
213
+ try:
214
+ __version__ = version("adaptorch")
215
+ except PackageNotFoundError:
216
+ __version__ = "0.0.0"
217
+
218
+ __all__ = [
219
+ "AdaptOrchEngine",
220
+ "BoundedRuntimeActuator",
221
+ "CseNcmhControllerV2",
222
+ "EvidencePosteriorEngine",
223
+ "FileReceiptSink",
224
+ "RuntimeStateFilter",
225
+ "SequentialVerificationScheduler",
226
+ "VerificationDecision",
227
+ "VerificationEvidenceEvent",
228
+ "VerificationReceipt",
229
+ "VerifierReliabilityProfile",
230
+ "VeraVerificationEngine",
231
+ "build_vera_runtime",
232
+ "AgentAdapterError",
233
+ "AgentInvocation",
234
+ "CircuitBreaker",
235
+ "CircuitBreakerPolicy",
236
+ "ConvergenceReport",
237
+ "OnlineRouteDiagnostics",
238
+ "OnlineTopologyRouter",
239
+ "PairedABReport",
240
+ "RoutingObservation",
241
+ "SelectionStrategy",
242
+ "ThompsonSelectionTracker",
243
+ "TokenEstimationCalibrator",
244
+ "TuningCase",
245
+ "TuningResult",
246
+ "CorpusBuildReport",
247
+ "CorpusBuildResult",
248
+ "DominanceReport",
249
+ "RobustConvergenceReport",
250
+ "EMAWeightTracker",
251
+ "EnsembleResult",
252
+ "ExtractionResult",
253
+ "HARNESS_REGISTRY",
254
+ "HarnessSpec",
255
+ "MODEL_PRESETS",
256
+ "ModelPreset",
257
+ "LogprobsExtractor",
258
+ "ModelProvider",
259
+ "ModelResponse",
260
+ "ParallelModelExecutor",
261
+ "PromptComplexityRouter",
262
+ "ProviderAdapterConfig",
263
+ "ProviderModelAdapter",
264
+ "SandboxLimits",
265
+ "SemanticPromptCache",
266
+ "SubprocessAgentConfig",
267
+ "TaskDAG",
268
+ "TopologyRouter",
269
+ "TraceEvent",
270
+ "TraceSink",
271
+ "CascadedRoutingDecision",
272
+ "CascadedTopologyRouter",
273
+ "CommandVerifier",
274
+ "VerificationCommandResult",
275
+ "VerificationOutcome",
276
+ "BudgetPolicy",
277
+ "AnthropicMiddlewareConnector",
278
+ "ClaudeCodeMiddlewareConnector",
279
+ "CohereMiddlewareConnector",
280
+ "ClineMiddlewareConnector",
281
+ "CodexMiddlewareConnector",
282
+ "ConnectorRegistry",
283
+ "CursorMiddlewareConnector",
284
+ "DeepSeekMiddlewareConnector",
285
+ "GeminiMiddlewareConnector",
286
+ "GoogleGenAIMiddlewareConnector",
287
+ "GrokMiddlewareConnector",
288
+ "GroqMiddlewareConnector",
289
+ "LangChainMiddlewareConnector",
290
+ "LangGraphMiddlewareConnector",
291
+ "LovableMiddlewareConnector",
292
+ "MCPMiddlewareConnector",
293
+ "MCPServerConfig",
294
+ "MakeMiddlewareConnector",
295
+ "MistralMiddlewareConnector",
296
+ "MiddlewareConnectorError",
297
+ "MiddlewareDispatchOptions",
298
+ "N8nConnectorConfig",
299
+ "N8nConnectorError",
300
+ "N8nMiddlewareConnector",
301
+ "N8nControlPlaneConnector",
302
+ "N8nHttpError",
303
+ "N8nRetryPolicy",
304
+ "N8nTransportError",
305
+ "AdaptOrchMCPServer",
306
+ "OllamaMiddlewareConnector",
307
+ "OpenAIMiddlewareConnector",
308
+ "OpenCodeMiddlewareConnector",
309
+ "PerplexityMiddlewareConnector",
310
+ "PromptMiddlewareConnector",
311
+ "RooCodeMiddlewareConnector",
312
+ "WebhookMiddlewareConnector",
313
+ "WindsurfMiddlewareConnector",
314
+ "XAIMiddlewareConnector",
315
+ "ZapierMiddlewareConnector",
316
+ "__version__",
317
+ "adaptive_synthesis",
318
+ "apply_dynamic_relative_culling",
319
+ "paired_ab_from_unit_scores",
320
+ "paired_ab_report",
321
+ "evaluate_config",
322
+ "tune_synthesis_config",
323
+ "build_tuning_cases",
324
+ "estimate_text_tokens",
325
+ "load_corpus_file",
326
+ "convergence_report",
327
+ "consistency_score",
328
+ "build_runtime_agent",
329
+ "build_runtime_agent_with_logprobs",
330
+ "build_streaming_agent",
331
+ "build_ensemble_providers",
332
+ "bundle_benchmark",
333
+ "collect_from_api_response",
334
+ "close_all_provider_clients",
335
+ "build_n8n_benchmark_node_output",
336
+ "build_n8n_node_output",
337
+ "build_budget_policy",
338
+ "build_default_connector_registry",
339
+ "build_default_mcp_server",
340
+ "create_default_mcp_http_app",
341
+ "create_mcp_http_app",
342
+ "build_run_resource_uri",
343
+ "run_http_server",
344
+ "build_recording_provider",
345
+ "build_replay_provider",
346
+ "build_synthesis_mode_plan",
347
+ "detect_provider",
348
+ "detect_provider_configuration",
349
+ "estimate_ensemble_cost",
350
+ "execute_benchmark_run",
351
+ "dominance_ratio_lower_bound",
352
+ "dominance_report",
353
+ "epsilon_gap",
354
+ "quorum_agreement",
355
+ "robust_convergence_report",
356
+ "score_dispersion",
357
+ "weighted_epsilon_gap",
358
+ "build_claude_code_cli_agent",
359
+ "build_chat_sdk_agent",
360
+ "build_cline_cli_agent",
361
+ "build_codex_cli_agent",
362
+ "build_cursor_cli_agent",
363
+ "build_gemini_cli_agent",
364
+ "build_google_genai_agent",
365
+ "build_grok_openai_compatible_agent",
366
+ "build_langchain_runnable_agent",
367
+ "build_lovable_cli_agent",
368
+ "build_named_cli_agent",
369
+ "build_openai_compatible_responses_agent",
370
+ "build_openai_responses_agent",
371
+ "build_opencode_cli_agent",
372
+ "build_rag_agent",
373
+ "build_roocode_cli_agent",
374
+ "build_subprocess_agent",
375
+ "build_windsurf_cli_agent",
376
+ "list_harness_ids",
377
+ "list_model_keys",
378
+ "load_benchmark_config",
379
+ "load_task_payload",
380
+ "lookup_harness",
381
+ "lookup_model",
382
+ "native_backend_available",
383
+ "onepager_benchmark",
384
+ "provider_request_hash",
385
+ "FileTraceSink",
386
+ "InMemoryTraceSink",
387
+ "NullTraceSink",
388
+ "TraceSinkSummary",
389
+ "resolve_provider",
390
+ "resolve_synthesis_mode_for_model",
391
+ "report_benchmark",
392
+ "report_benchmark_run",
393
+ "run_benchmark",
394
+ "run_task",
395
+ "run_task_file",
396
+ "summarize_benchmark",
397
+ "summarize_benchmark_run",
398
+ "wrap_structured_agent",
399
+ ]
adaptorch/__main__.py ADDED
@@ -0,0 +1,4 @@
1
+ from .cli import main
2
+
3
+ if __name__ == "__main__":
4
+ main()
adaptorch/_wilson.py ADDED
@@ -0,0 +1,64 @@
1
+ """Contract-neutral Wilson score interval core (internal).
2
+
3
+ This private module holds the single source of truth for the Wilson score
4
+ interval lower-bound *formula*. It is deliberately **contract-neutral**: it
5
+ performs no input validation, no clamping, no finiteness checks, and takes no
6
+ position on the domain of ``z``. Those policies differ between consumers and
7
+ belong in each consumer's thin adapter, not here.
8
+
9
+ Two callers re-export the formula under their own public ``wilson_lower_bound``
10
+ name while preserving their historical contracts:
11
+
12
+ * :mod:`adaptorch.online_router` — float inputs, keyword-only ``z > 0``,
13
+ raises on non-finite / negative / ``successes > trials`` / ``z <= 0``,
14
+ and clamps the result with ``min(1, max(0, ·))``.
15
+ * :mod:`adaptorch.circuit_breaker` — int inputs, positional ``z >= 0``,
16
+ clamps ``failures`` into ``[0, observations]``, and clamps the result with
17
+ ``max(0, min(1, ·))``.
18
+
19
+ Keeping only the shared formula here removes the drift risk of two copies of
20
+ the same maths while leaving each consumer free to keep its own contract.
21
+ Only :mod:`math` is imported so the module stays free of circular imports.
22
+ """
23
+
24
+ from __future__ import annotations
25
+
26
+ import math
27
+
28
+ __all__ = ["wilson_score_lower_bound"]
29
+
30
+
31
+ def wilson_score_lower_bound(successes: float, trials: float, *, z: float) -> float:
32
+ """Return the raw Wilson score interval lower bound.
33
+
34
+ Computes the pure Wilson lower-bound expression for ``successes`` out of
35
+ ``trials`` at critical value ``z`` and nothing else — inputs are used
36
+ verbatim and the result is returned unclamped.
37
+
38
+ The caller is responsible for every contract concern:
39
+
40
+ * ``trials`` **must** be ``> 0`` (this function divides by ``trials``;
41
+ the empty-sample case is a caller policy, not a formula property);
42
+ * input validation / clamping of ``successes``, ``trials``, and ``z``;
43
+ * clamping the result into ``[0, 1]`` — for well-formed inputs the value
44
+ lies in ``[0, 1]``, but floating-point cancellation at the
45
+ ``successes == 0`` / ``successes == trials`` boundaries can push it a
46
+ hair outside that range.
47
+
48
+ Parameters
49
+ ----------
50
+ successes:
51
+ Observed successes (or failures, for the breaker). Used as given.
52
+ trials:
53
+ Sample size. Must be ``> 0``; not checked here.
54
+ z:
55
+ Standard-normal critical value. Used as given (no domain policy).
56
+ """
57
+ p_hat = successes / trials
58
+ z_squared = z * z
59
+ denominator = 1.0 + z_squared / trials
60
+ centre = p_hat + z_squared / (2.0 * trials)
61
+ margin = z * math.sqrt(
62
+ p_hat * (1.0 - p_hat) / trials + z_squared / (4.0 * trials * trials)
63
+ )
64
+ return (centre - margin) / denominator