phronomy 0.27.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (475) hide show
  1. checksums.yaml +4 -4
  2. data/.mutant.yml +9 -9
  3. data/CHANGELOG.md +52 -0
  4. data/CONTRIBUTING.md +8 -8
  5. data/README.md +9 -3
  6. data/benchmark/bench_agent_invoke.rb +25 -50
  7. data/benchmark/bench_context_assembler.rb +14 -11
  8. data/benchmark/bench_regression.rb +1 -1
  9. data/benchmark/bench_tool_schema.rb +1 -1
  10. data/docs/architecture/agent-chat-and-state-ownership.md +7 -1
  11. data/docs/architecture/agent-transition-ownership.md +13 -89
  12. data/docs/architecture/backend-groups.md +152 -0
  13. data/docs/architecture/before-llm-input.md +3 -3
  14. data/docs/architecture/context-management.md +1 -1
  15. data/docs/architecture/execution-abstraction-review.md +88 -0
  16. data/docs/architecture/execution-boundaries.md +28 -0
  17. data/docs/architecture/execution-metadata-and-values.md +6 -0
  18. data/docs/architecture/multi-agent-handoff.md +6 -5
  19. data/docs/architecture/persistence.md +27 -9
  20. data/docs/architecture/r8-unit1.md +104 -0
  21. data/docs/architecture/r8-unit10.md +72 -0
  22. data/docs/architecture/r8-unit11.md +71 -0
  23. data/docs/architecture/r8-unit12.md +67 -0
  24. data/docs/architecture/r8-unit13.md +61 -0
  25. data/docs/architecture/r8-unit14.md +72 -0
  26. data/docs/architecture/r8-unit15.md +65 -0
  27. data/docs/architecture/r8-unit16.md +54 -0
  28. data/docs/architecture/r8-unit17.md +73 -0
  29. data/docs/architecture/r8-unit18.md +92 -0
  30. data/docs/architecture/r8-unit19.md +61 -0
  31. data/docs/architecture/r8-unit2.md +55 -0
  32. data/docs/architecture/r8-unit20.md +51 -0
  33. data/docs/architecture/r8-unit21.md +79 -0
  34. data/docs/architecture/r8-unit22.md +74 -0
  35. data/docs/architecture/r8-unit23.md +81 -0
  36. data/docs/architecture/r8-unit3.md +130 -0
  37. data/docs/architecture/r8-unit4.md +79 -0
  38. data/docs/architecture/r8-unit5.md +115 -0
  39. data/docs/architecture/r8-unit6.md +71 -0
  40. data/docs/architecture/r8-unit7.md +70 -0
  41. data/docs/architecture/r8-unit8.md +78 -0
  42. data/docs/architecture/r8-unit9.md +73 -0
  43. data/docs/architecture/refactoring-closure.md +10 -1
  44. data/docs/architecture/remaining-refactoring-plan.md +16 -0
  45. data/docs/architecture/storage-execution-boundaries.md +54 -0
  46. data/docs/architecture/tool-schema-recording-gap.md +6 -0
  47. data/docs/architecture/tracing.md +1 -1
  48. data/docs/architecture/workflow-terminal-ownership-design.md +2 -2
  49. data/docs/architecture.md +24 -11
  50. data/docs/decisions/015-tool-public-facade-and-rbs-boundary.md +3 -3
  51. data/docs/decisions/027-llm-adapter-provider-boundary.md +2 -0
  52. data/docs/decisions/030-agent-handoff-domain-and-durable-responsibility.md +2 -0
  53. data/docs/decisions/031-durable-multi-agent-coordination.md +2 -0
  54. data/docs/decisions/032-storage-backend-composition.md +5 -0
  55. data/docs/decisions/034-handoff-runner-coordination-ownership.md +2 -0
  56. data/docs/decisions/035-tool-executor-capability-ownership.md +1 -1
  57. data/docs/decisions/038-responsibility-based-source-layout.md +14 -0
  58. data/docs/decisions/039-runtime-configuration-lifecycle-ownership.md +8 -0
  59. data/docs/decisions/040-configuration-default-composition.md +12 -1
  60. data/docs/decisions/045-worker-input-restriction-ownership.md +4 -0
  61. data/docs/decisions/051-execution-outcome-worker-ownership.md +2 -0
  62. data/docs/decisions/056-workflow-terminal-policy-ownership.md +1 -1
  63. data/docs/decisions/058-neutral-storage-primitives.md +5 -0
  64. data/docs/decisions/059-backend-contracts-and-async-clients.md +74 -0
  65. data/docs/decisions/060-runtime-settings-and-application-configuration.md +86 -0
  66. data/docs/decisions/061-persistence-failure-contracts.md +89 -0
  67. data/docs/decisions/062-content-store-service.md +52 -0
  68. data/docs/decisions/063-execution-contracts-and-services.md +88 -0
  69. data/docs/decisions/064-agent-execution-and-multi-agent-responsibility.md +36 -0
  70. data/docs/decisions/065-vector-and-embeddings-common-operations.md +38 -0
  71. data/docs/decisions/066-llm-and-tool-operation-contracts.md +20 -0
  72. data/docs/decisions/067-agent-progress-and-engine-connection.md +29 -0
  73. data/docs/decisions/068-agent-tool-child-progress-and-tool-operation.md +36 -0
  74. data/docs/decisions/README.md +18 -1
  75. data/docs/execution-boundaries-preview.md +45 -0
  76. data/docs/features.md +8 -3
  77. data/docs/getting-started.md +9 -6
  78. data/docs/migrations/0.22.md +2 -2
  79. data/docs/migrations/durable-semantic-coordination-v2.md +2 -0
  80. data/docs/migrations/handoff-runner-multi-agent.md +2 -0
  81. data/docs/migrations/persistence-failure-contracts.md +67 -0
  82. data/docs/migrations/r8-unit10.md +36 -0
  83. data/docs/migrations/r8-unit11.md +33 -0
  84. data/docs/migrations/r8-unit12.md +31 -0
  85. data/docs/migrations/r8-unit13.md +36 -0
  86. data/docs/migrations/r8-unit14.md +31 -0
  87. data/docs/migrations/r8-unit15.md +31 -0
  88. data/docs/migrations/r8-unit16.md +26 -0
  89. data/docs/migrations/r8-unit17.md +28 -0
  90. data/docs/migrations/r8-unit18.md +29 -0
  91. data/docs/migrations/r8-unit19.md +28 -0
  92. data/docs/migrations/r8-unit20.md +24 -0
  93. data/docs/migrations/r8-unit21.md +28 -0
  94. data/docs/migrations/r8-unit22.md +29 -0
  95. data/docs/migrations/r8-unit23.md +20 -0
  96. data/docs/migrations/r8-unit4.md +67 -0
  97. data/docs/migrations/r8-unit5.md +75 -0
  98. data/docs/migrations/r8-unit6.md +109 -0
  99. data/docs/migrations/r8-unit7.md +31 -0
  100. data/docs/migrations/r8-unit8.md +33 -0
  101. data/docs/migrations/r8-unit9.md +28 -0
  102. data/docs/migrations/storage-async-client.md +103 -0
  103. data/docs/migrations/vector-async-clients.md +110 -0
  104. data/docs/persistence-backends.md +38 -21
  105. data/docs/runtime-and-concurrency.md +26 -1
  106. data/lib/phronomy/agent/admission.rb +78 -0
  107. data/lib/phronomy/agent/{lifecycle_contract/agent_already_exists_error.rb → agent_already_exists_error.rb} +1 -1
  108. data/lib/phronomy/agent/{lifecycle_contract/agent_busy_error.rb → agent_busy_error.rb} +1 -1
  109. data/lib/phronomy/agent/{lifecycle_contract/agent_purged_error.rb → agent_purged_error.rb} +1 -1
  110. data/lib/phronomy/{recovery → agent/api}/execution_rehydration_required_error.rb +1 -1
  111. data/lib/phronomy/agent/async_event_api.rb +37 -32
  112. data/lib/phronomy/agent/base.rb +74 -72
  113. data/lib/phronomy/agent/before_llm_input.rb +64 -0
  114. data/lib/phronomy/agent/composition/run_once.rb +1 -1
  115. data/lib/phronomy/agent/{context_assembly/context_candidate_resolver.rb → context_candidate_resolver.rb} +2 -2
  116. data/lib/phronomy/agent/{context_assembly/context_assembler.rb → context_preparation.rb} +35 -221
  117. data/lib/phronomy/agent/control_request.rb +21 -0
  118. data/lib/phronomy/agent/execution/agent_execution.rb +1 -1
  119. data/lib/phronomy/agent/execution/agent_invocation.rb +27 -53
  120. data/lib/phronomy/agent/execution/approval_resume_commit.rb +1 -1
  121. data/lib/phronomy/agent/execution/dispatch_preparation.rb +17 -127
  122. data/lib/phronomy/agent/execution/exact_execution.rb +44 -23
  123. data/lib/phronomy/agent/execution/execution_cancellation.rb +8 -4
  124. data/lib/phronomy/agent/execution/execution_coordinator.rb +214 -395
  125. data/lib/phronomy/agent/execution/execution_metadata.rb +1 -0
  126. data/lib/phronomy/agent/execution/execution_outcome_committer.rb +70 -126
  127. data/lib/phronomy/agent/execution/execution_registry.rb +6 -2
  128. data/lib/phronomy/agent/execution/execution_session_runner.rb +22 -27
  129. data/lib/phronomy/agent/execution/initial_preparation.rb +18 -116
  130. data/lib/phronomy/agent/execution/{agent_invocation_session_builder.rb → invocation_actions.rb} +54 -194
  131. data/lib/phronomy/agent/execution/invocation_transitions.rb +39 -1
  132. data/lib/phronomy/agent/execution/runtime_record_encoder.rb +7 -7
  133. data/lib/phronomy/agent/execution_change.rb +161 -0
  134. data/lib/phronomy/agent/execution_environment.rb +36 -0
  135. data/lib/phronomy/agent/execution_extension_state.rb +21 -0
  136. data/lib/phronomy/agent/execution_observation.rb +35 -0
  137. data/lib/phronomy/agent/filterable.rb +182 -0
  138. data/lib/phronomy/agent/handoff/{handoff_context.rb → transfer_context.rb} +4 -4
  139. data/lib/phronomy/agent/handoff/{handoff_projection.rb → transfer_projection.rb} +14 -33
  140. data/lib/phronomy/{llm_contract/transport_error.rb → agent/handoff_error.rb} +1 -1
  141. data/lib/phronomy/agent/journal/journal_projection.rb +1 -1
  142. data/lib/phronomy/agent/knowledge_item.rb +13 -0
  143. data/lib/phronomy/agent/lifecycle/agent_root.rb +1 -1
  144. data/lib/phronomy/agent/lifecycle/ownership_registry.rb +18 -23
  145. data/lib/phronomy/agent/persistence/agent_repository.rb +29 -21
  146. data/lib/phronomy/agent/persistence/cancellation_repository.rb +51 -0
  147. data/lib/phronomy/agent/persistence/codec.rb +1 -21
  148. data/lib/phronomy/agent/persistence/execution_repository.rb +57 -41
  149. data/lib/phronomy/agent/persistence/journal_repository.rb +27 -18
  150. data/lib/phronomy/agent/persistence/records.rb +33 -0
  151. data/lib/phronomy/agent/persistence/retention_repository.rb +70 -0
  152. data/lib/phronomy/agent/persistence/storage_schema.rb +7 -2
  153. data/lib/phronomy/agent/persistence/watermark.rb +13 -11
  154. data/lib/phronomy/agent/recovery/invocation_restorer.rb +13 -21
  155. data/lib/phronomy/agent/recovery/recovery_coordinator/continuation.rb +10 -9
  156. data/lib/phronomy/agent/recovery/recovery_coordinator/installation.rb +27 -27
  157. data/lib/phronomy/agent/recovery/recovery_coordinator/resolution.rb +19 -21
  158. data/lib/phronomy/agent/recovery/recovery_coordinator.rb +23 -16
  159. data/lib/phronomy/agent/recovery/recovery_rules.rb +119 -0
  160. data/lib/phronomy/agent/recovery/recovery_support.rb +8 -11
  161. data/lib/phronomy/agent/reserved_execution.rb +16 -0
  162. data/lib/phronomy/agent/retention.rb +17 -0
  163. data/lib/phronomy/agent/runtime_binding/engine_environment.rb +60 -0
  164. data/lib/phronomy/agent/runtime_binding/engine_session_builder.rb +34 -0
  165. data/lib/phronomy/agent/runtime_binding/phase_machine_builder.rb +64 -0
  166. data/lib/phronomy/agent/runtime_binding/tool_session_builder.rb +34 -0
  167. data/lib/phronomy/agent/{context_assembly/ruby_llm_materializer.rb → runtime_input.rb} +18 -35
  168. data/lib/phronomy/agent/{context_assembly/saved_context_reader.rb → saved_context_reader.rb} +6 -4
  169. data/lib/phronomy/agent/settings.rb +47 -0
  170. data/lib/phronomy/agent/{context_assembly/state_writer.rb → state_writer.rb} +4 -3
  171. data/lib/phronomy/agent/store.rb +253 -0
  172. data/lib/phronomy/agent/{lifecycle_contract/stream_callback_error.rb → stream_callback_error.rb} +1 -1
  173. data/lib/phronomy/agent/tool_execution/tool_binding.rb +4 -64
  174. data/lib/phronomy/agent/tool_execution/tool_invocation.rb +50 -219
  175. data/lib/phronomy/agent/tool_execution/tool_invocation_actions.rb +107 -0
  176. data/lib/phronomy/agent/tool_execution/tool_invocation_transitions.rb +70 -0
  177. data/lib/phronomy/configuration/runtime_settings.rb +49 -0
  178. data/lib/phronomy/content_store/storage_schema.rb +1 -0
  179. data/lib/phronomy/content_store/stored_contents.rb +2 -1
  180. data/lib/phronomy/context/assembly.rb +202 -0
  181. data/lib/phronomy/{llm_contract/context_budget_exceeded_error.rb → context/budget_exceeded_error.rb} +3 -1
  182. data/lib/phronomy/context/candidate.rb +51 -0
  183. data/lib/phronomy/context/constraint.rb +47 -0
  184. data/lib/phronomy/{agent/context_contract → context}/context_plan.rb +1 -1
  185. data/lib/phronomy/{agent/context_contract → context}/context_plan_validator.rb +3 -3
  186. data/lib/phronomy/{agent/context_contract → context}/context_policy.rb +1 -1
  187. data/lib/phronomy/{agent/context_contract → context}/context_policy_input.rb +1 -1
  188. data/lib/phronomy/{agent/context_assembly → context}/context_policy_input_builder.rb +1 -1
  189. data/lib/phronomy/context/default_policy.rb +140 -0
  190. data/lib/phronomy/context/final_budget_validator.rb +33 -0
  191. data/lib/phronomy/{agent/context_contract → context}/llm_input_build_context.rb +1 -1
  192. data/lib/phronomy/{agent/context_contract → context}/llm_input_manifest.rb +19 -19
  193. data/lib/phronomy/{agent/context_contract → context}/llm_input_patch.rb +1 -1
  194. data/lib/phronomy/context/manifest_error.rb +10 -0
  195. data/lib/phronomy/context/prompt_template.rb +98 -0
  196. data/lib/phronomy/{vector_store → documents}/loader/base.rb +1 -1
  197. data/lib/phronomy/{vector_store → documents}/loader/csv_loader.rb +2 -2
  198. data/lib/phronomy/{vector_store → documents}/loader/markdown_loader.rb +3 -3
  199. data/lib/phronomy/{vector_store → documents}/loader/plain_text_loader.rb +2 -2
  200. data/lib/phronomy/{vector_store → documents}/splitter/base.rb +1 -1
  201. data/lib/phronomy/{vector_store → documents}/splitter/fixed_size_splitter.rb +2 -2
  202. data/lib/phronomy/{vector_store → documents}/splitter/recursive_splitter.rb +2 -2
  203. data/lib/phronomy/embeddings/async/async_client.rb +44 -0
  204. data/lib/phronomy/embeddings/backends/ruby_llm_embeddings.rb +48 -0
  205. data/lib/phronomy/embeddings/base.rb +43 -0
  206. data/lib/phronomy/embeddings/invalid_result_error.rb +11 -0
  207. data/lib/phronomy/embeddings/transport_error.rb +11 -0
  208. data/lib/phronomy/engine/concurrency/offload_pool.rb +36 -21
  209. data/lib/phronomy/engine/concurrency/pool_registry.rb +47 -12
  210. data/lib/phronomy/engine/diagnostics.rb +1 -1
  211. data/lib/phronomy/engine/event_loop.rb +7 -7
  212. data/lib/phronomy/engine/execution_binding.rb +23 -0
  213. data/lib/phronomy/engine/execution_receiver_binding.rb +43 -0
  214. data/lib/phronomy/engine/fsm_protocol.rb +1 -6
  215. data/lib/phronomy/engine/fsm_session.rb +3 -3
  216. data/lib/phronomy/engine/metrics.rb +16 -14
  217. data/lib/phronomy/engine/runtime/timer_queue.rb +1 -1
  218. data/lib/phronomy/engine/runtime.rb +25 -12
  219. data/lib/phronomy/engine/terminal_decision.rb +7 -0
  220. data/lib/phronomy/execution/async_operation.rb +41 -0
  221. data/lib/phronomy/{engine → execution}/blocking.rb +2 -2
  222. data/lib/phronomy/{engine → execution}/concurrency/cancellation_token.rb +1 -1
  223. data/lib/phronomy/{engine → execution}/concurrency/deadline.rb +0 -17
  224. data/lib/phronomy/{engine → execution}/concurrency/physical_completion_task.rb +1 -1
  225. data/lib/phronomy/{engine → execution}/concurrency/result_collector.rb +1 -1
  226. data/lib/phronomy/{engine → execution}/concurrency/result_composition.rb +33 -12
  227. data/lib/phronomy/{engine/concurrency/subscriptions.rb → execution/concurrency/result_subscriptions.rb} +14 -18
  228. data/lib/phronomy/execution/concurrency/subscriptions.rb +25 -0
  229. data/lib/phronomy/{engine → execution}/execution.rb +61 -27
  230. data/lib/phronomy/execution/execution_receiver.rb +78 -0
  231. data/lib/phronomy/execution/execution_scope_state.rb +35 -0
  232. data/lib/phronomy/{engine → execution}/invocation_context.rb +0 -15
  233. data/lib/phronomy/execution/invocation_controls.rb +73 -0
  234. data/lib/phronomy/execution/runnable.rb +24 -0
  235. data/lib/phronomy/{engine → execution}/task_result.rb +3 -3
  236. data/lib/phronomy/execution/wait_policy.rb +24 -0
  237. data/lib/phronomy/filter/{contract/filter_block_error.rb → filter_block_error.rb} +1 -1
  238. data/lib/phronomy/generation/generator_verifier/agent_operation.rb +65 -0
  239. data/lib/phronomy/generation/generator_verifier/default_parser.rb +27 -0
  240. data/lib/phronomy/generation/generator_verifier/workflow_builder.rb +2 -2
  241. data/lib/phronomy/generation/generator_verifier.rb +7 -7
  242. data/lib/phronomy/llm_adapter/async/async_client.rb +47 -0
  243. data/lib/phronomy/{llm_contract → llm_adapter}/authentication_error.rb +3 -1
  244. data/lib/phronomy/llm_adapter/backends/ruby_llm.rb +183 -0
  245. data/lib/phronomy/llm_adapter/base.rb +49 -68
  246. data/lib/phronomy/{llm_contract → llm_adapter}/context_length_error.rb +3 -1
  247. data/lib/phronomy/llm_adapter/invalid_result_error.rb +10 -0
  248. data/lib/phronomy/llm_adapter/message.rb +62 -0
  249. data/lib/phronomy/{llm_contract → llm_adapter}/rate_limit_error.rb +3 -1
  250. data/lib/phronomy/llm_adapter/request.rb +79 -0
  251. data/lib/phronomy/llm_adapter/response.rb +36 -0
  252. data/lib/phronomy/llm_adapter/stream_chunk.rb +18 -0
  253. data/lib/phronomy/llm_adapter/token_usage.rb +64 -0
  254. data/lib/phronomy/llm_adapter/transport_error.rb +9 -0
  255. data/lib/phronomy/llm_adapter.rb +3 -16
  256. data/lib/phronomy/multi_agent/admission_registry.rb +1 -8
  257. data/lib/phronomy/multi_agent/durable_subagent_coordinator.rb +108 -84
  258. data/lib/phronomy/multi_agent/execution_environment.rb +29 -0
  259. data/lib/phronomy/{agent/handoff → multi_agent}/handoff.rb +2 -2
  260. data/lib/phronomy/{agent/handoff → multi_agent}/handoff_capability_factory.rb +21 -2
  261. data/lib/phronomy/multi_agent/handoff_participant.rb +79 -0
  262. data/lib/phronomy/{agent/handoff → multi_agent}/handoff_policy.rb +1 -1
  263. data/lib/phronomy/multi_agent/handoff_runner.rb +77 -100
  264. data/lib/phronomy/{agent/handoff → multi_agent}/handoff_state.rb +1 -1
  265. data/lib/phronomy/multi_agent/orchestrator.rb +61 -75
  266. data/lib/phronomy/multi_agent/persistence/codec.rb +20 -0
  267. data/lib/phronomy/multi_agent/persistence/handoff_state_repository.rb +77 -0
  268. data/lib/phronomy/multi_agent/persistence/records.rb +27 -0
  269. data/lib/phronomy/multi_agent/persistence/storage_schema.rb +21 -0
  270. data/lib/phronomy/multi_agent/persistence/team_execution_repository.rb +58 -42
  271. data/lib/phronomy/multi_agent/persistence/team_repository.rb +29 -21
  272. data/lib/phronomy/multi_agent/reserved_child_admission.rb +88 -0
  273. data/lib/phronomy/multi_agent/runtime_binding/engine_environment.rb +35 -0
  274. data/lib/phronomy/multi_agent/shared_state.rb +2 -2
  275. data/lib/phronomy/multi_agent/store.rb +156 -0
  276. data/lib/phronomy/multi_agent/team_coordinator.rb +83 -74
  277. data/lib/phronomy/multi_agent/team_ownership_registry.rb +2 -12
  278. data/lib/phronomy/output_parser/parse_error.rb +7 -0
  279. data/lib/phronomy/persistence/content_repository.rb +26 -0
  280. data/lib/phronomy/persistence/errors.rb +16 -0
  281. data/lib/phronomy/persistence/migration/initial_format_migration.rb +2 -2
  282. data/lib/phronomy/persistence/persistence.rb +23 -0
  283. data/lib/phronomy/persistence/save_outcome.rb +24 -0
  284. data/lib/phronomy/persistence/snapshot_comparison.rb +81 -0
  285. data/lib/phronomy/persistence/storage_boundary.rb +32 -0
  286. data/lib/phronomy/persistence/transaction.rb +86 -0
  287. data/lib/phronomy/persistence_composition/storage_schema.rb +9 -4
  288. data/lib/phronomy/persistence_composition/stores.rb +34 -0
  289. data/lib/phronomy/persistence_composition/unit4_migration.rb +276 -0
  290. data/lib/phronomy/runtime_composition/agent_defaults.rb +5 -1
  291. data/lib/phronomy/runtime_composition/configuration.rb +146 -0
  292. data/lib/phronomy/runtime_composition/evaluation_defaults.rb +7 -0
  293. data/lib/phronomy/runtime_composition/execution_defaults.rb +5 -0
  294. data/lib/phronomy/runtime_composition/generation_defaults.rb +6 -0
  295. data/lib/phronomy/runtime_composition/global_configuration.rb +38 -0
  296. data/lib/phronomy/runtime_composition/multi_agent_defaults.rb +9 -0
  297. data/lib/phronomy/runtime_composition/workflow_defaults.rb +4 -0
  298. data/lib/phronomy/storage/async/async_client.rb +60 -0
  299. data/lib/phronomy/storage/backend.rb +8 -2
  300. data/lib/phronomy/testing/eval/metrics.rb +1 -1
  301. data/lib/phronomy/testing/eval/scorer/llm_judge.rb +19 -3
  302. data/lib/phronomy/testing/persistence_contract/a_content_store.rb +2 -2
  303. data/lib/phronomy/testing/persistence_contract/a_journal_repository.rb +6 -6
  304. data/lib/phronomy/testing/persistence_contract/a_persistence_backend.rb +55 -52
  305. data/lib/phronomy/testing/persistence_contract/a_workflow_state_repository.rb +3 -3
  306. data/lib/phronomy/testing/persistence_contract/an_agent_repository.rb +7 -7
  307. data/lib/phronomy/testing/persistence_contract/an_execution_repository.rb +11 -11
  308. data/lib/phronomy/testing/persistence_contract/coordination_repositories.rb +57 -51
  309. data/lib/phronomy/testing/persistence_contract/neutral_storage_primitives.rb +1 -1
  310. data/lib/phronomy/testing/persistence_contract/storage_transaction_boundaries.rb +23 -22
  311. data/lib/phronomy/tool/authorization.rb +77 -0
  312. data/lib/phronomy/tool/base.rb +549 -9
  313. data/lib/phronomy/tool/call_request.rb +40 -0
  314. data/lib/phronomy/{agent/tool_execution/tool_definition_set.rb → tool/definition_set.rb} +7 -8
  315. data/lib/phronomy/tool/operation.rb +88 -0
  316. data/lib/phronomy/tool/schema.rb +214 -0
  317. data/lib/phronomy/tool/settings.rb +31 -0
  318. data/lib/phronomy/tool/tool_error.rb +7 -0
  319. data/lib/phronomy/tool/tool_executor.rb +58 -0
  320. data/lib/phronomy/tools/agent.rb +22 -90
  321. data/lib/phronomy/tools/mcp.rb +21 -14
  322. data/lib/phronomy/tools/vector_search.rb +4 -4
  323. data/lib/phronomy/tracing/automatic.rb +11 -6
  324. data/lib/phronomy/tracing/base.rb +1 -1
  325. data/lib/phronomy/tracing/observation.rb +37 -0
  326. data/lib/phronomy/tracing/settings.rb +36 -0
  327. data/lib/phronomy/vector_store/{async_backend.rb → async/async_client.rb} +35 -29
  328. data/lib/phronomy/vector_store/{in_memory.rb → backends/in_memory.rb} +12 -10
  329. data/lib/phronomy/vector_store/{pgvector.rb → backends/pgvector.rb} +44 -16
  330. data/lib/phronomy/vector_store/{redis_search.rb → backends/redis_search.rb} +74 -37
  331. data/lib/phronomy/vector_store/base.rb +118 -49
  332. data/lib/phronomy/vector_store/invalid_result_error.rb +12 -0
  333. data/lib/phronomy/vector_store.rb +2 -17
  334. data/lib/phronomy/version.rb +1 -1
  335. data/lib/phronomy/workflow/completion.rb +11 -0
  336. data/lib/phronomy/workflow/execution/workflow.rb +7 -7
  337. data/lib/phronomy/workflow/execution/workflow_action_rules.rb +67 -0
  338. data/lib/phronomy/workflow/execution/workflow_context.rb +2 -2
  339. data/lib/phronomy/workflow/execution/workflow_execution_environment.rb +27 -0
  340. data/lib/phronomy/workflow/execution/workflow_execution_registry.rb +3 -5
  341. data/lib/phronomy/workflow/execution/workflow_runner.rb +58 -79
  342. data/lib/phronomy/workflow/execution/workflow_settings.rb +28 -0
  343. data/lib/phronomy/workflow/persistence/state_repository.rb +28 -22
  344. data/lib/phronomy/workflow/persistence/storage_schema.rb +13 -0
  345. data/lib/phronomy/workflow/runtime_binding/workflow_engine_environment.rb +38 -0
  346. data/lib/phronomy/workflow/runtime_binding/workflow_phase_machine_builder.rb +156 -0
  347. data/lib/phronomy/workflow/{execution → runtime_binding}/workflow_terminal_policy.rb +4 -4
  348. data/lib/phronomy.rb +57 -16
  349. data/scripts/api_snapshot.rb +35 -15
  350. data/sig/_private/phronomy/agent/settings.rbs +19 -0
  351. data/sig/_private/phronomy/configuration/runtime_settings.rbs +20 -0
  352. data/sig/_private/phronomy/llm_adapter/async/async_client.rbs +10 -0
  353. data/sig/_private/phronomy/multi_agent/store.rbs +8 -0
  354. data/sig/_private/phronomy/persistence/storage_boundary.rbs +7 -0
  355. data/sig/_private/phronomy/tool/settings.rbs +13 -0
  356. data/sig/_private/phronomy/tracing/settings.rbs +15 -0
  357. data/sig/_private/phronomy/workflow/execution/workflow_settings.rbs +13 -0
  358. data/sig/phronomy/agent/admission.rbs +19 -0
  359. data/sig/phronomy/agent/execution_contract.rbs +132 -0
  360. data/sig/phronomy/agent/execution_environment.rbs +20 -0
  361. data/sig/phronomy/agent/store.rbs +73 -0
  362. data/sig/phronomy/agent.rbs +14 -138
  363. data/sig/phronomy/common.rbs +7 -0
  364. data/sig/phronomy/content_store/contracts.rbs +13 -0
  365. data/sig/phronomy/context.rbs +152 -0
  366. data/sig/phronomy/embeddings/async/async_client.rbs +9 -0
  367. data/sig/phronomy/embeddings/base.rbs +17 -0
  368. data/sig/phronomy/engine/concurrency/timer_bindings.rbs +22 -0
  369. data/sig/phronomy/engine/control_bindings.rbs +11 -0
  370. data/sig/phronomy/engine/control_protocols.rbs +23 -0
  371. data/sig/phronomy/engine/execution_binding.rbs +6 -0
  372. data/sig/phronomy/engine/execution_receiver.rbs +15 -0
  373. data/sig/phronomy/engine/observability.rbs +13 -0
  374. data/sig/phronomy/execution/async_operation.rbs +7 -0
  375. data/sig/phronomy/execution/blocking.rbs +5 -0
  376. data/sig/phronomy/execution/concurrency/cancellation_token.rbs +13 -0
  377. data/sig/phronomy/execution/concurrency/deadline.rbs +10 -0
  378. data/sig/phronomy/execution/concurrency/result_composition.rbs +7 -0
  379. data/sig/phronomy/execution/control_protocols.rbs +18 -0
  380. data/sig/phronomy/execution/errors.rbs +7 -0
  381. data/sig/phronomy/execution/execution.rbs +41 -0
  382. data/sig/phronomy/execution/execution_receiver.rbs +40 -0
  383. data/sig/phronomy/execution/execution_scope_state.rbs +9 -0
  384. data/sig/phronomy/execution/invocation_context.rbs +18 -0
  385. data/sig/phronomy/execution/invocation_controls.rbs +13 -0
  386. data/sig/phronomy/execution/task_result.rbs +29 -0
  387. data/sig/phronomy/extensions.rbs +0 -21
  388. data/sig/phronomy/handoff.rbs +10 -4
  389. data/sig/phronomy/llm_adapter/backends/ruby_llm.rbs +6 -0
  390. data/sig/phronomy/llm_adapter/base.rbs +14 -0
  391. data/sig/phronomy/llm_adapter/usage.rbs +14 -0
  392. data/sig/phronomy/llm_adapter/values.rbs +43 -0
  393. data/sig/phronomy/llm_context_window.rbs +10 -0
  394. data/sig/phronomy/multi_agent/reserved_child_admission.rbs +8 -0
  395. data/sig/phronomy/multi_agent/store.rbs +54 -0
  396. data/sig/phronomy/multi_agent.rbs +6 -3
  397. data/sig/phronomy/persistence/errors.rbs +18 -0
  398. data/sig/phronomy/persistence/migration.rbs +13 -0
  399. data/sig/phronomy/persistence/transaction.rbs +19 -0
  400. data/sig/phronomy/persistence.rbs +1 -99
  401. data/sig/phronomy/persistence_composition.rbs +19 -0
  402. data/sig/phronomy/runtime_composition/configuration.rbs +36 -0
  403. data/sig/phronomy/storage/async/async_client.rbs +8 -0
  404. data/sig/phronomy/storage/backends/in_memory.rbs +9 -0
  405. data/sig/phronomy/{storage.rbs → storage/contracts.rbs} +2 -16
  406. data/sig/phronomy/tool.rbs +48 -4
  407. data/sig/phronomy/tracing/observation.rbs +7 -0
  408. data/sig/phronomy/vector_store/async/async_client.rbs +13 -0
  409. data/sig/phronomy/vector_store/base.rbs +23 -0
  410. data/sig/phronomy/workflow/execution/workflow_execution_environment.rbs +14 -0
  411. data/sig/phronomy/workflow/runtime_binding/workflow_terminal_policy.rbs +7 -0
  412. data/sig/phronomy/workflow/store.rbs +8 -0
  413. data/sig/phronomy/workflow.rbs +1 -1
  414. data/sig/phronomy.rbs +0 -49
  415. metadata +318 -117
  416. data/lib/phronomy/agent/concerns/before_llm_input.rb +0 -66
  417. data/lib/phronomy/agent/concerns/error_translation.rb +0 -45
  418. data/lib/phronomy/agent/concerns/filterable.rb +0 -184
  419. data/lib/phronomy/agent/context/capability/base.rb +0 -548
  420. data/lib/phronomy/agent/context/capability/tool_executor.rb +0 -62
  421. data/lib/phronomy/agent/context/instruction/prompt_template.rb +0 -102
  422. data/lib/phronomy/agent/context_assembly/runtime_chat_builder.rb +0 -36
  423. data/lib/phronomy/agent/context_assembly/token_budget_resolver.rb +0 -22
  424. data/lib/phronomy/agent/context_parts/validators/final_budget_validator.rb +0 -37
  425. data/lib/phronomy/agent/context_policies/default.rb +0 -142
  426. data/lib/phronomy/agent/execution/phase_machine_builder.rb +0 -101
  427. data/lib/phronomy/agent/execution/provider_call_outcome.rb +0 -106
  428. data/lib/phronomy/agent/handoff/handoff_execution_coordinator.rb +0 -15
  429. data/lib/phronomy/agent/handoff/handoff_outcome_committer.rb +0 -131
  430. data/lib/phronomy/agent/handoff/handoff_request.rb +0 -45
  431. data/lib/phronomy/agent/lifecycle_contract/handoff_error.rb +0 -7
  432. data/lib/phronomy/agent/persistence/handoff_state_repository.rb +0 -58
  433. data/lib/phronomy/agent/persistence/queries.rb +0 -61
  434. data/lib/phronomy/agent/selection/candidate.rb +0 -53
  435. data/lib/phronomy/agent/selection/constraint.rb +0 -49
  436. data/lib/phronomy/agent/tool_execution/tool_call_intercepted.rb +0 -29
  437. data/lib/phronomy/agent/tool_execution/tool_invocation_session_builder.rb +0 -276
  438. data/lib/phronomy/configuration/configuration.rb +0 -68
  439. data/lib/phronomy/configuration/global_configuration.rb +0 -26
  440. data/lib/phronomy/engine/concurrency/cancellation_scope.rb +0 -124
  441. data/lib/phronomy/engine/concurrency/operation_binding.rb +0 -43
  442. data/lib/phronomy/engine/execution_receiver.rb +0 -65
  443. data/lib/phronomy/engine/runnable.rb +0 -54
  444. data/lib/phronomy/llm_adapter/ruby_llm.rb +0 -47
  445. data/lib/phronomy/llm_contract/token_usage.rb +0 -85
  446. data/lib/phronomy/multi_agent/persistence/queries.rb +0 -30
  447. data/lib/phronomy/multi_agent/storage_contract/team_storage_schema.rb +0 -15
  448. data/lib/phronomy/output_parser/contract/parse_error.rb +0 -7
  449. data/lib/phronomy/persistence/api/persistence.rb +0 -140
  450. data/lib/phronomy/persistence_composition/repositories.rb +0 -77
  451. data/lib/phronomy/recovery/recovery.rb +0 -186
  452. data/lib/phronomy/tool/contract/tool_error.rb +0 -7
  453. data/lib/phronomy/vector_store/embeddings/base.rb +0 -44
  454. data/lib/phronomy/vector_store/embeddings/ruby_llm_embeddings.rb +0 -47
  455. data/lib/phronomy/workflow/phase_machine_builder.rb +0 -205
  456. data/lib/phronomy/workflow/storage_contract/workflow_storage_schema.rb +0 -9
  457. data/sig/phronomy/execution_receiver.rbs +0 -34
  458. data/sig/phronomy/llm_adapter.rbs +0 -11
  459. data/sig/phronomy/runtime.rbs +0 -76
  460. /data/lib/phronomy/agent/{context_assembly/context_importer.rb → context_importer.rb} +0 -0
  461. /data/lib/phronomy/{engine → execution}/backpressure_error.rb +0 -0
  462. /data/lib/phronomy/{engine → execution}/cancellation_error.rb +0 -0
  463. /data/lib/phronomy/{engine → execution}/concurrency/worker_input_restricted.rb +0 -0
  464. /data/lib/phronomy/{engine → execution}/event_loop_reentrancy_error.rb +0 -0
  465. /data/lib/phronomy/{engine → execution}/execution_cancellation_error.rb +0 -0
  466. /data/lib/phronomy/{engine → execution}/execution_timeout_error.rb +0 -0
  467. /data/lib/phronomy/{engine → execution}/invalid_async_entry_action_error.rb +0 -0
  468. /data/lib/phronomy/{engine → execution}/invalid_async_transition_action_error.rb +0 -0
  469. /data/lib/phronomy/{engine → execution}/invalid_async_workflow_action_error.rb +0 -0
  470. /data/lib/phronomy/{engine → execution}/pool_shutdown_error.rb +0 -0
  471. /data/lib/phronomy/{engine → execution}/recursion_limit_error.rb +0 -0
  472. /data/lib/phronomy/{engine → execution}/runtime_shutdown_error.rb +0 -0
  473. /data/lib/phronomy/{engine → execution}/runtime_shutdown_reentrancy_error.rb +0 -0
  474. /data/lib/phronomy/{engine → execution}/scheduler_reentrancy_error.rb +0 -0
  475. /data/lib/phronomy/{engine → execution}/timeout_error.rb +0 -0
@@ -0,0 +1,38 @@
1
+ # ADR-065: Vector and Embeddings common operations
2
+
3
+ Status: accepted for the authorized r8 unit 5 implementation. Actual-service
4
+ verification is reported separately from the design decision.
5
+
6
+ This amends ADR-059's vector/embedding extension and namespace provisions.
7
+ Its synchronous backend boundary, separate AsyncClients and no production worker
8
+ Threads rule remain in force. It implements C10/C11 and DP09/DP10 from the agreed
9
+ contract foundation target.
10
+
11
+ VectorStore::Base and Embeddings::Base own the public operation templates,
12
+ validation and cancellation checkpoint. Concrete backends override protected
13
+ perform_* hooks, retaining algorithms, database/SDK adaptation and physical state.
14
+ VectorStore does not require an embedding provider, and Embeddings does not depend
15
+ on VectorStore. Documents groups the existing Loader/Splitter helpers without
16
+ creating another domain Contract.
17
+
18
+ Placement is decided by domain meaning and observable rules, not shared use.
19
+ Generic reusable code does not become a Contract merely because multiple callers
20
+ need it. Database response parsing and SDK/serialization adaptation remain
21
+ implementation responsibilities even when several backends perform similar work.
22
+
23
+ Malformed public inputs fail before backend I/O. Malformed backend results fail
24
+ explicitly. Provider exceptions are adapted at the provider boundary, never by
25
+ rescuing arbitrary application failures in the common framework. No generic retry,
26
+ commit reconciliation or stronger concurrency guarantee is added.
27
+
28
+ Backends must reject malformed external data before converting it to the public
29
+ result. Redis RESP2 fields/counts/distances and Pgvector rows/JSON are decoded
30
+ inside their own backends, with `VectorStore::InvalidResultError` as the public
31
+ failure for invalid data. Legitimate absent metadata and Redis's documented
32
+ expired-document response are distinguished from corruption. The common Base
33
+ then validates the domain result; it contains no external-protocol decoder.
34
+
35
+ Old namespaces and public-template overrides are intentionally replaced without
36
+ compatibility aliases. Runtime API, RBS, contract tests, examples and migration
37
+ guidance move together. See [unit 5](../architecture/r8-unit5.md) and
38
+ [migration](../migrations/r8-unit5.md).
@@ -0,0 +1,20 @@
1
+ # ADR-066: LLM and Tool operation contracts
2
+
3
+ Status: Accepted for the r8 unit 6 candidate; application verification is separate.
4
+
5
+ C09 owns model-turn values, operation invariants, usage and failures. C06 owns Tool
6
+ requests, schemas, validation, authorization and execution rules. Shared usage is
7
+ not a placement criterion. SDK wire parsing/rendering and callback interception
8
+ remain in the RubyLLM backend. Agent owns context, approval, durable execution and
9
+ recovery; AsyncClient submits the complete backend operation to Execution.
10
+
11
+ Tool::Base becomes independent of RubyLLM::Tool. The schema used for advertisement
12
+ is also the validation source for both declaration paths. C09 depends only on C06
13
+ value/schema semantics, never executable Tool instances. Protected hooks allow a
14
+ minimal independent backend; public complete/stream enforce the common contract.
15
+ No forwarding namespace or legacy SDK-shaped adapter SPI is retained.
16
+
17
+ Consequences and compatibility are recorded in
18
+ [unit 6 architecture](../architecture/r8-unit6.md) and
19
+ [unit 6 migration](../migrations/r8-unit6.md). Existing pending execution schema
20
+ comparisons remain strict; deployment must account for changed Tool definitions.
@@ -0,0 +1,29 @@
1
+ # ADR-067: Agent progress owns policy; composition supplies its execution connection
2
+
3
+ Status: accepted for r8 unit 7 candidate. Supersedes the construction ownership
4
+ portion of the Agent transition design; durable guarantees are unchanged.
5
+
6
+ ## Decision
7
+
8
+ Keep progress rules, entry operations, admission, approval and recovery decisions
9
+ inside Agent. Introduce the private ExecutionEnvironment connection and an Engine
10
+ implementation. Bind a live Agent to the environment of its ownership registry.
11
+ Move concrete session/phase-machine construction to agent/runtime_binding.
12
+ Keep state_machines out of InvocationTransitions. Extract the serial receiver
13
+ lifecycle framework to Execution with an Engine-owned channel implementation.
14
+
15
+ ## Why
16
+
17
+ The old session builder mixed domain operations with concrete FSM construction.
18
+ Repeated Runtime.instance lookups made execution connection selection implicit.
19
+ Moving all code into a binding would relocate the same semantic mixture.
20
+ A contract owns executable rules, not just signatures or forwarding methods.
21
+
22
+ ## Consequences
23
+
24
+ The application invoke/stream/approval/recovery API is unchanged. Internal
25
+ AgentInvocationSessionBuilder is removed with no alias. Private receiver
26
+ constructors now accept a channel. Internal embedders must adopt the composition
27
+ port and respect serial mutation, bounded submission, shutdown and session
28
+ incarnation rules. Tool child and other domain FSM decomposition remain separate
29
+ work. See ../architecture/r8-unit7.md for scope and verification.
@@ -0,0 +1,36 @@
1
+ # ADR-068: Agent owns Tool child progress; Tool owns its operation protocol
2
+
3
+ Status: accepted for the r8 unit 8 candidate. Extends
4
+ [067-agent-progress-and-engine-connection](067-agent-progress-and-engine-connection.md)
5
+ to Tool children and refines the operation boundary in
6
+ [066-llm-and-tool-operation-contracts](066-llm-and-tool-operation-contracts.md).
7
+
8
+ ## Decision
9
+
10
+ Keep Tool child transitions, approval waiting, dispatch eligibility, outcome
11
+ application and parent notification in C04. Use one ordered transition definition
12
+ for both concrete FSM construction and source admission. Move FSMSession and
13
+ state_machines construction into Agent runtime_binding. Pass the original Agent
14
+ execution environment explicitly to child authorization and execution.
15
+
16
+ C06 owns standard/custom Tool operation dispatch, execution-mode validity,
17
+ completion protocol and result adaptation. It accepts the C13 submitter protocol
18
+ for standard offloaded work. Agent uses the public operation rather than
19
+ inspecting the implementation owner and calling the private default executor.
20
+ Custom Tool#call_async overrides keep their public signature and own mechanism.
21
+
22
+ ## Reason
23
+
24
+ The previous builder mixed Agent rules with concrete connections and duplicated
25
+ transition definitions. Agent also selected Tool implementation paths in both
26
+ invocation and result binding. Moving whole classes to an adapter or assigning
27
+ all Tool-related progress to C06 would preserve or misplace those responsibilities.
28
+
29
+ ## Consequences
30
+
31
+ The boundary now supports independent Agent policy tests and Engine adaptation
32
+ tests. No concrete Runtime or Agent type enters C06. Existing durable identity,
33
+ approval/recovery, causal revision and physical-quiescence guarantees remain.
34
+ No new exactly-once or in-flight version compatibility is claimed. See
35
+ [the unit 8 scope](../architecture/r8-unit8.md) and
36
+ [migration instructions](../migrations/r8-unit8.md).
@@ -88,7 +88,7 @@ resolved explicitly.
88
88
  | [`037-common-definition-ownership`](037-common-definition-ownership.md) | Amended | Yes | Defines the common responsibility group and initially extracts the shared base exception; [038-responsibility-based-source-layout](038-responsibility-based-source-layout.md) extends the extraction scope while preserving ownership rules and exception contracts. |
89
89
  | [`038-responsibility-based-source-layout`](038-responsibility-based-source-layout.md) | Amended | Yes | Reserves the direct root for version/namespace loading, groups common definitions and feature implementation/contracts, and preserves canonical constants and lifecycle loading through explicit Zeitwerk roots. ADR-039 separates cross-owner Runtime lifecycle coordination. |
90
90
  | [`039-runtime-configuration-lifecycle-ownership`](039-runtime-configuration-lifecycle-ownership.md) | Amended | Yes | Separates application Runtime reset and configuration replacement into runtime_composition; configuration access and Engine mechanics retain their own ownership and existing API behavior. ADR-040 separates concrete-default selection without changing Runtime reset. |
91
- | [`040-configuration-default-composition`](040-configuration-default-composition.md) | Accepted | Yes | Settings consume internal fresh-instance factories; runtime_composition selects and binds the concrete adapter/tracer defaults. Preserves Configuration.new and the adapter SPI. |
91
+ | [`040-configuration-default-composition`](040-configuration-default-composition.md) | Amended | Yes | Settings consume internal fresh-instance factories; runtime_composition selects and binds the concrete adapter/tracer defaults. Preserves Configuration.new and the adapter SPI. |
92
92
  | [`041-feature-owned-identity-registries`](041-feature-owned-identity-registries.md) | Accepted | Yes | Agent and MultiAgent own identity registries; Runtime retains them through generic lookup, drain/wait, and optional finalization. Preserves product APIs and single-owner lifetime; Execution state is separately assigned by ADR-042. |
93
93
 
94
94
  | [`042-feature-owned-execution-state`](042-feature-owned-execution-state.md) | Accepted | Yes | Agent/Workflow own execution state; Engine retains generic receiver delivery, synchronization and shutdown boundaries. Single-writer and durable barriers remain. |
@@ -110,6 +110,15 @@ resolved explicitly.
110
110
 
111
111
  | [`058-neutral-storage-primitives`](058-neutral-storage-primitives.md) | Accepted | Yes | Neutral Records/Streams/Blobs SPI 2 and scoped transaction lifecycle; amends 032, 033, 043 and 057. |
112
112
 
113
+ | [`059-backend-contracts-and-async-clients`](059-backend-contracts-and-async-clients.md) | Accepted | Yes | P1/P2 separates synchronous LLM contracts, implementations and internal clients; independent responsibility groups replace numbered layers. VectorStore/Storage migration remains pending. |
114
+ | [`060-runtime-settings-and-application-configuration`](060-runtime-settings-and-application-configuration.md) | Accepted | Yes | Separates neutral Engine settings from typed application Configuration; preserves public settings/lifecycle semantics and requires the complete Ruby + RBS boundary gate without exceptions. |
115
+
116
+ | [`061-persistence-failure-contracts`](061-persistence-failure-contracts.md) | Accepted | Yes | Independent domain failure contracts and explicit raw Storage translation; public rescue-clause migration, preserved transaction/admission/uncertainty semantics. |
117
+ | [`062-content-store-service`](062-content-store-service.md) | Accepted | Yes | Content management over neutral Storage; removes the unnecessary backend subdivision and preserves content/Persistence behavior. |
118
+
119
+ | [`063-execution-contracts-and-services`](063-execution-contracts-and-services.md) | Accepted | Yes | Shared execution contracts and result/call services separated from Engine internals; preserves public APIs and fixes filtered physical completion. |
120
+ | [`068-agent-tool-child-progress-and-tool-operation`](068-agent-tool-child-progress-and-tool-operation.md) | Accepted | Yes | C04 Tool child progress and original environment; C06 operation dispatch/result adaptation; child FSM in runtime_binding. |
121
+
113
122
  ## Legacy duplicate `011`
114
123
 
115
124
  The repository intentionally preserves both legacy files:
@@ -203,3 +212,11 @@ Current explanatory architecture starts at
203
212
  segregated under `docs/archive/design/` and are non-normative. Explanatory
204
213
  architecture documents describe the reconciled current system but do not
205
214
  supersede ADRs merely by being newer.
215
+
216
+ - [`064-agent-execution-and-multi-agent-responsibility`](064-agent-execution-and-multi-agent-responsibility.md)
217
+
218
+ - [`065-vector-and-embeddings-common-operations`](065-vector-and-embeddings-common-operations.md) — accepted for r8 unit 5; amends the vector/embedding SPI and namespace provisions of ADR-059.
219
+
220
+ - [`066-llm-and-tool-operation-contracts`](066-llm-and-tool-operation-contracts.md)
221
+
222
+ - [`067-agent-progress-and-engine-connection`](067-agent-progress-and-engine-connection.md) — Agent progress rules and Engine connection ownership.
@@ -0,0 +1,45 @@
1
+ # Execution boundary candidate (unapplied)
2
+
3
+ Base: main 653e255a34fe4062d4beca47530e084fdd3a6ba9.
4
+ This is an unpublished prototype for source-derived architecture review.
5
+
6
+ TaskResult, Outcome, result composition, physical completion and ScopeState
7
+ belong to Execution Results. They depend on Contracts and Common, without
8
+ acquiring Runtime or calling Execution Services. Engine and Services share
9
+ these neutral results. OffloadPool uses an injected timer protocol; its wait
10
+ guard uses WaitPolicy. Services owns operation binding, timer subscriptions,
11
+ worker submission and invocation-control adaptation.
12
+
13
+ Workflow::Completion owns the public DSL finish value `:__finish__`.
14
+ WorkflowPhaseMachineBuilder, beside WorkflowRunner, translates it to the FSM
15
+ terminal state. FSMSession retains terminal detection and persistence gating.
16
+ TerminalDecision is an execution contract, independent of Workflow and FSM
17
+ state vocabulary.
18
+
19
+ ## Intentional compatibility changes
20
+
21
+ * InvocationContext#effective_timeout_token and #effective_cancellation_token
22
+ are removed. Although annotated private, both occurred in the Stable API
23
+ snapshot. This candidate updates those two entries explicitly. Applications
24
+ pass cancellation_token/deadline into InvocationContext; the invoking
25
+ service applies them. Code needing a standalone token constructs
26
+ Concurrency::CancellationToken directly.
27
+ * Deadline#attach_to is removed. Deadline is a time value, not a timer owner.
28
+ Internal Workflow control adaptation moves to InvocationControls.
29
+ * Unused private CancellationScope is removed. Private
30
+ Workflow::PhaseMachineBuilder becomes WorkflowPhaseMachineBuilder in the
31
+ Runner source directory. FSMProtocol::TerminalDecision becomes
32
+ Phronomy::TerminalDecision. Direct requires of moved internal files change.
33
+ * An already expired Workflow deadline now cancels immediately. An explicitly
34
+ supplied token still takes precedence over that deadline, as before.
35
+
36
+ TaskResult/map/flat_map/all_settled and AsyncClient public operations remain.
37
+ WorkerSubmission preserves injected-pool ownership, original result identity,
38
+ operation-time Runtime resolution and synchronous admission errors. Blocking
39
+ continues converting admission errors to failed results. MCP keeps its named
40
+ cleanup pool. Engine connections remain with registries/coordinators/runners.
41
+
42
+ RBS declares scope, timer, receiver and terminal-policy protocols in sig/.
43
+ Validation checks signature consistency, not whole-program type correctness.
44
+ The static diagram includes Ruby and RBS evidence; injected implementations
45
+ and callback behavior also require runtime tests.
data/docs/features.md CHANGED
@@ -46,12 +46,17 @@ rather than implicitly inheriting the parent revision. The Stable
46
46
  |---|---|
47
47
  | **Knowledge** — Journal-backed persistent Agent context registered with `knowledge:` / `add_knowledge`, selected per LLM call by Context Policy | Beta |
48
48
  | **`VectorStore#size`** — Document count for InMemory, RedisSearch, and Pgvector backends | Beta |
49
- | **VectorStore async convenience** — `add_async` / `search_async` / `remove_async` / `clear_async` offload the synchronous Backend SPI through Phronomy and return `TaskResult`; native async override is not part of the current Backend SPI | Beta |
50
- | **Embedding async convenience** — `embed_async` offloads synchronous `embed` through Phronomy and returns `TaskResult` | Beta |
49
+ | **Storage::AsyncClient** — `transaction_async` runs a raw backend transaction on one worker and returns TaskResult; [usage and lifetime rules](migrations/storage-async-client.md) | Beta |
50
+ | **VectorStore::AsyncClient** — `add_async` / `search_async` / `remove_async` / `clear_async` offload the synchronous Backend SPI through Phronomy and return `TaskResult`; native async override is not part of the current Backend SPI | Beta |
51
+ | **VectorStore::Embeddings::AsyncClient** — `embed_async` offloads synchronous `embed` through Phronomy and returns `TaskResult` | Beta |
51
52
  | **Model Context Protocol (MCP) Tool** — `Phronomy::Tools::Mcp` integration through the official `mcp` gem | Beta |
52
53
  | **Agent Tool** — `Phronomy::Tools::Agent.from_agent` exposes a child Agent as a Tool without occupying a worker while waiting | Beta |
53
54
  | **Vector Search Tool** — `Phronomy::Tools::VectorSearch` wraps VectorStore and Embeddings adapters | Beta |
54
55
 
56
+ Applications previously calling async methods on backend objects must
57
+ [move those calls to explicit clients](migrations/vector-async-clients.md).
58
+ Backend authors continue to implement the synchronous SPI only.
59
+
55
60
  ## Execution and reliability
56
61
 
57
62
  | Feature | Stability |
@@ -88,7 +93,7 @@ See the [migration guide](migrations/parallel-tool-chat-removal.md).
88
93
  | Feature | Stability |
89
94
  |---|---|
90
95
  | **Workflow asynchronous pattern** — Start async work, return immediately, and continue through `Workflow#signal` | Beta |
91
- | **Durable Handoff** — `Agent::Handoff` and `MultiAgent::HandoffRunner` persist responsibility, immutable Context and exact Target reservation in one Persistence domain; current graph wiring is required for continuation | Beta |
96
+ | **Durable Handoff** — `MultiAgent::Handoff` and `MultiAgent::HandoffRunner` persist responsibility, immutable Context and exact Target reservation in one Persistence domain; current graph wiring is required for continuation | Beta |
92
97
  | **GeneratorVerifier** — Generator-Verifier loop with injectable prompts/parsers | Beta |
93
98
  | **`Phronomy::MultiAgent::Orchestrator`** — Parallel subagent dispatch, fan-out, and `subagent` DSL | Beta |
94
99
  | **`Phronomy::MultiAgent::TeamCoordinator`** — LLM coordinator with stateful worker Agents | Beta |
@@ -50,7 +50,7 @@ Install only the backend gems required by your application:
50
50
  ## Define a Tool and Agent
51
51
 
52
52
  Use `Phronomy::Tool::Base` as the application-facing authoring API. It is an
53
- exact alias of the existing `Phronomy::Agent::Context::Capability::Base`, so
53
+ exact alias of the existing `Phronomy::Tool::Base`, so
54
54
  existing Tool definitions using the longer namespace remain compatible.
55
55
 
56
56
  ```ruby
@@ -85,7 +85,7 @@ application does not need to pass the previous `messages` array back into every
85
85
  invocation.
86
86
 
87
87
  ```ruby
88
- persistence = Phronomy::Persistence.in_memory
88
+ persistence = Phronomy::PersistenceComposition.agent
89
89
 
90
90
  agent = ResearchAgent.create(
91
91
  agent_id: "research-session-42",
@@ -250,7 +250,7 @@ end
250
250
  write_draft = ->(state) { state.merge(draft: "Draft content") }
251
251
  review_draft = ->(state) { state.merge(feedback: "Feedback on: #{state.draft}") }
252
252
 
253
- persistence = Phronomy::Persistence.in_memory
253
+ persistence = Phronomy::PersistenceComposition.in_memory.workflow
254
254
 
255
255
  workflow = Phronomy::Workflow.define(
256
256
  ReviewContext,
@@ -274,7 +274,7 @@ final = workflow.send_event(state: state, event: :approve)
274
274
  puts final.approved
275
275
  ```
276
276
 
277
- `Persistence#workflow_states` is the durable Workflow repository. `workflow_instance_id`
277
+ The injected Workflow checkpoint repository supplies `load`, `save`, and `delete`. `workflow_instance_id`
278
278
  identifies the durable Workflow state and remains stable across resume. Each
279
279
  concrete Runtime execution receives a separate internal `fsm_session_id`; the
280
280
  application-level `session_id` remains ordinary caller/tracing metadata. Phronomy
@@ -286,12 +286,15 @@ A global Persistence backend can be configured when Agents and Workflows should
286
286
  share one durable backend:
287
287
 
288
288
  ```ruby
289
+ stores = Phronomy::PersistenceComposition.in_memory
289
290
  Phronomy.configure do |config|
290
- config.persistence = persistence
291
+ config.agent_store = stores.agent
292
+ config.multi_agent_store = stores.multi_agent
293
+ config.workflow_store = stores.workflow
291
294
  end
292
295
  ```
293
296
 
294
- Agent `new`/`create` and Workflow definitions use the global backend when they do
297
+ Agent `new`/`create`, Team construction, and Workflow definitions use their configured store when they do
295
298
  not inject an explicit `persistence:`. Workflow durability is fixed at the
296
299
  application/Workflow-definition boundary; there is no per-invocation backend
297
300
  switch.
@@ -178,8 +178,8 @@ and no ordinary Handoff Tool result is generated.
178
178
 
179
179
  ACS-04 replaces the intermediate Context selection composition API with the
180
180
  final four-category Context Policy SPI. Application-defined policies receive an
181
- immutable `Phronomy::Agent::ContextPolicyInput` and return an immutable
182
- `Phronomy::Agent::ContextPlan`, each organized as `instruction`, `knowledge`,
181
+ immutable `Phronomy::Context::ContextPolicyInput` and return an immutable
182
+ `Phronomy::Context::ContextPlan`, each organized as `instruction`, `knowledge`,
183
183
  `tools`, and grouped `conversation`.
184
184
 
185
185
  Agent classes bind one Application-constructed Policy instance:
@@ -1,5 +1,7 @@
1
1
  # Durable semantic coordination V2 migration
2
2
 
3
+ > r8 unit 4 supersedes the Agent/Handoff ownership and storage portions below. See [the unit 4 migration](../migrations/r8-unit4.md). Earlier statements describe their original change only.
4
+
3
5
  > Runner namespace update (2026-09-18): this document preserves the V2
4
6
  > implementation/migration record. The current Runner is
5
7
  > `Phronomy::MultiAgent::HandoffRunner` under
@@ -1,5 +1,7 @@
1
1
  # HandoffRunner moves to MultiAgent
2
2
 
3
+ > r8 unit 4 supersedes the Agent/Handoff ownership and storage portions below. See [the unit 4 migration](../migrations/r8-unit4.md). Earlier statements describe their original change only.
4
+
3
5
  This change applies to H1 on `refactor/architecture` after core commit
4
6
  `fe2ad7cea6945a240858b18645dc4ae285e8ce64`. The released 0.26.0 gem does not
5
7
  yet provide this new Runner name.
@@ -0,0 +1,67 @@
1
+ # Migrate the domain Persistence failure contract
2
+
3
+ This change intentionally changes the exception classes exposed by domain
4
+ Persistence operations. Apply it together with application rescue-clause updates;
5
+ there is no compatibility alias. Public method arguments, return values and
6
+ backend SPI 2 do not change.
7
+
8
+ ## Application and domain repository callers
9
+
10
+ For calls through `Persistence`, its eight repositories, Agent, Team and Workflow,
11
+ use the upper contract:
12
+
13
+ | Previous category | New category |
14
+ |---|---|
15
+ | `Phronomy::Storage::ConflictError` | `Phronomy::Persistence::ConflictError` |
16
+ | `Phronomy::Storage::NotFoundError` | `Phronomy::Persistence::NotFoundError` |
17
+ | `Phronomy::Storage::SerializationError` | `Phronomy::Persistence::SerializationError` |
18
+ | `Phronomy::Storage::UnsupportedBackendError` | `Phronomy::Persistence::UnsupportedBackendError` |
19
+
20
+ For example:
21
+
22
+ ```ruby
23
+ begin
24
+ root = persistence.agents.load(agent_id)
25
+ rescue Phronomy::Persistence::NotFoundError => error
26
+ # Handle the missing domain object here.
27
+ logger.info(error.message)
28
+ end
29
+ ```
30
+
31
+ `Persistence::StateConflictError < Persistence::ConflictError` identifies state,
32
+ ownership or revision contradictions raised by upper domain operations. Catch
33
+ ConflictError when the application handles both state and backend conflicts.
34
+ This subtype is not an instruction to retry: retain operation-specific retry and
35
+ recovery policies. Repository CAS/precondition rejections expose ConflictError.
36
+
37
+ Translated backend failures retain their original message/backtrace and expose
38
+ the original exception through `error.cause`. Backend constraint/resource details
39
+ remain there. `AgentBusyError` keeps its existing meaning and original cause;
40
+ only the owning active constraint/condition qualifies for that mapping.
41
+
42
+ ## Backend implementations and raw callers
43
+
44
+ Do **not** globally replace Storage exception names in driver implementations or
45
+ raw `Storage::Backend`/View/Records/Streams/Blobs callers. Those interfaces still
46
+ raise Storage errors. The raw `persistence.backend` accessor exposes that same
47
+ backend. Direct `ContentStore::StoredContents` use also retains its raw failure
48
+ surface; `persistence.contents` applies the upper translation boundary.
49
+
50
+ Core domain repository conformance examples now expect Persistence errors. Raw
51
+ Storage conformance examples continue to expect Storage errors. Tests which
52
+ inject failures at the physical backend should still inject Storage exceptions;
53
+ tests mocking an already translated repository should inject Persistence errors.
54
+
55
+ ## Commit uncertainty and saved data
56
+
57
+ Only the four listed categories are translated. Unknown driver/transport errors,
58
+ including IOError, and Storage::TransactionError pass through as the same object.
59
+ ContentStore::IntegrityError and existing domain errors also retain identity.
60
+ Do not classify every Persistence::Error as a known rollback, and do not add a
61
+ retry for a lost commit acknowledgement. Existing admission, transaction scope,
62
+ rollback, nested savepoint and recovery rules continue to apply.
63
+
64
+ No database migration is required. Saved records and content bytes use the same
65
+ formats. Error class names in newly saved diagnostic payloads can use the new
66
+ Persistence names. Old saved class strings remain diagnostic data; they are not
67
+ resolved as live exception constants or rewritten.
@@ -0,0 +1,36 @@
1
+ # Migrating to r8 unit 10
2
+
3
+ Apply after core d961fc742f6c4ea4d06dc89f20eedfeb49d04099 (unit 9).
4
+ This package changes core only. The unit 6 examples at
5
+ ed455c52018338f7c5a4c2948ae0d7db131aa090 require no source changes.
6
+
7
+ Public TeamCoordinator and HandoffRunner arguments and results are unchanged.
8
+ No database migration or application Registry registration is needed.
9
+ The existing registries remain MultiAgent-owned and preserve their rules.
10
+
11
+ | Internal use | Replacement |
12
+ | --- | --- |
13
+ | AdmissionRegistry.for(runtime) | The owning MultiAgent ExecutionEnvironment.admissions |
14
+ | TeamOwnershipRegistry.for(runtime) | The owning environment.ownership |
15
+ | TeamOwnershipRegistry.existing_for(runtime) | The selected environment.existing_ownership for lookup only |
16
+ | Team/Handoff Runtime.instance checks | The captured environment.current? |
17
+ | Team cancellation Execution.submit(runtime: ...) | The captured environment.submit(...) |
18
+ | Team persistence factory in runtime_composition/agent_defaults.rb | runtime_composition/multi_agent_defaults.rb |
19
+
20
+ Registry construction remains side-effect free. Tests of domain rules can use
21
+ Registry.new; tests of Runtime registration use MultiAgent::EngineEnvironment.
22
+ Removed private class methods have no aliases. Internal callers are updated
23
+ together. New connection classes are private APIs; public RBS signatures stay
24
+ unchanged. Ordinary require "phronomy" installs defaults lazily, without creating
25
+ global configuration, stores or a Runtime during loading.
26
+
27
+ The ZIP includes complete changed files, a strict-base applier, expected-tree
28
+ verification, a review patch, test evidence and rollback instructions. Run
29
+ --check, --apply and --verify in a new worktree, then --verify again after commit.
30
+ Use the existing stop/drain procedure when replacing running processes. This
31
+ change does not add in-flight cross-version compatibility or rollback of
32
+ external effects.
33
+
34
+ For examples verification, unset BUNDLE_GEMFILE before entering the examples
35
+ checkout and set PHRONOMY_PATH to the candidate core. Inspect and restore only
36
+ verification-generated lockfile/vendor changes; no examples commit is needed.
@@ -0,0 +1,33 @@
1
+ # Migrating to r8 unit 11
2
+
3
+ Apply after core eaff581cb8806c707d47649bb561b70690fa9e57 (unit 10).
4
+ This package changes core only. The unit 6 examples at
5
+ ed455c52018338f7c5a4c2948ae0d7db131aa090 require no source changes.
6
+
7
+ No application API changes or database migrations are required. Continue to
8
+ load the library with require "phronomy" and use the existing context_policy
9
+ DSL for explicit policies. The boot composition installs DefaultPolicy through
10
+ that same DSL. Reading an unconfigured internal Base now fails explicitly
11
+ instead of selecting a concrete Policy inside Agent.
12
+
13
+ | Private implementation use | Replacement |
14
+ | --- | --- |
15
+ | Agent::Base concrete Policy fallback | runtime_composition/agent_defaults.rb installs the default |
16
+ | InvocationActions constructs LLMAdapter::AsyncClient | Its captured environment.build_llm_client(adapter: ...) |
17
+ | Agent LLM submission resolves the current global Runtime | EngineEnvironment binds the client to its retained Runtime |
18
+ | AsyncClient constructor | Optional submitter: using existing _ExecutionSubmitter; existing arguments still work |
19
+
20
+ Internal custom ExecutionEnvironment implementations must supply the new client
21
+ capability. It is not a supported application extension API. Clients created
22
+ without an injected submitter preserve their default Runtime behavior; explicit
23
+ pool arguments preserve precedence. Changing the global default Runtime does
24
+ not migrate an existing Agent's resources. Follow the existing stop/drain and
25
+ recreate procedure when replacing running processes.
26
+
27
+ The ZIP contains complete changed files, strict-base application and expected-tree
28
+ verification, a review patch, test evidence and recovery instructions. Run
29
+ --check, --apply and --verify in a new worktree, then --verify after commit.
30
+
31
+ For examples verification, unset BUNDLE_GEMFILE before entering the examples
32
+ checkout and set PHRONOMY_PATH to this core. Inspect and restore only generated
33
+ lockfile/vendor changes; no examples commit is needed.
@@ -0,0 +1,31 @@
1
+ # Migrating to r8 unit 12
2
+
3
+ Apply after core 891ddf62da42e5218fd8f80d5a9ec0ac6b58b81d (unit 11).
4
+ This package changes core only. The unit 6 examples at
5
+ ed455c52018338f7c5a4c2948ae0d7db131aa090 require no source changes.
6
+
7
+ Continue to use Orchestrator.subagent and Tools::Agent.from_agent as before.
8
+ No application API or database migration is required. Orchestrator still
9
+ inherits Agent::Base. Its generated Tool is now a direct Tool::Base subclass.
10
+
11
+ | Internal assumption | Current structure |
12
+ | --- | --- |
13
+ | A generated subagent Tool is a Tools::Agent subclass | It implements Tool::Base directly and belongs to MultiAgent |
14
+ | Tools::Agent owns generic asynchronous Tool validation and error handling | Tool::Base supplies private asynchronous operation rules |
15
+ | Generic Tool handling knows Agent recovery errors | Agent-aware callers preserve those outcomes |
16
+
17
+ Code that inspects generated-class ancestry or changes Tools::Agent globally
18
+ to affect Orchestrator-generated Tools relied on the old implementation link.
19
+ Such changes no longer apply to generated subagent operations. Existing Tool
20
+ DSL options on the generated operation retain their semantics. The new private
21
+ helper is not a public asynchronous implementation API.
22
+
23
+ The ZIP includes complete changed files, strict-base application and
24
+ expected-tree verification, a review patch, verification evidence and application
25
+ instructions. Use a new worktree and run --check, --apply and --verify; run
26
+ --verify again after committing. Follow the existing stop/drain procedure when
27
+ replacing running processes. No new cross-version in-flight guarantee is made.
28
+
29
+ For examples verification, unset BUNDLE_GEMFILE and set PHRONOMY_PATH to this
30
+ core. Inspect and restore generated lockfile/vendor changes; no examples commit
31
+ is needed. Live PostgreSQL and provider verification remain environment-specific.
@@ -0,0 +1,36 @@
1
+ # Migrating to r8 unit 13
2
+
3
+ Apply after core 87685e3544901a3b2b2d6e9841a723f8ce05c6f6 (unit 12).
4
+ This package changes core only. Unit 6 examples at
5
+ ed455c52018338f7c5a4c2948ae0d7db131aa090 require no source changes.
6
+
7
+ Workflow.define, invoke, invoke_async, signal, stream and resume retain their
8
+ call signatures and persistence format. No database migration is required.
9
+ Compiled Workflows now retain the execution environment selected at compilation.
10
+ When replacing/resetting the Runtime in a process, drain/stop existing work and
11
+ compile new Workflow objects for the new Runtime. A Workflow whose owner has
12
+ stopped rejects work; it does not implicitly adopt the replacement Runtime.
13
+
14
+ | Internal assumption | Current structure |
15
+ | --- | --- |
16
+ | Runner looks up the global Runtime during each execution step | It retains a private WorkflowExecutionEnvironment |
17
+ | Workflow registry constructs an Engine Event | It supplies an atomic target resolver to the C13 receiver channel |
18
+ | Phase compiler owns callback rules | WorkflowActionRules owns the rules; the binding installs callbacks |
19
+ | Workflow terminal policy belongs to domain execution files | It translates domain outcomes in workflow/runtime_binding |
20
+
21
+ WorkflowPhaseMachineBuilder and WorkflowTerminalPolicy retain their constant
22
+ names but move from workflow/execution to workflow/runtime_binding. They remain
23
+ private; direct internal require paths or private Runner helpers must be updated.
24
+ No application implementation of the environment port is required or supported
25
+ as a new public API. Admission, repository operations and result classification
26
+ remain Workflow-owned.
27
+
28
+ The ZIP contains complete changed files, strict base checks, deletion handling,
29
+ expected-tree verification, a review patch and validation evidence. Apply in a
30
+ new worktree; run --check, --apply and --verify, then --verify after committing.
31
+ For examples, unset BUNDLE_GEMFILE and set PHRONOMY_PATH to the new core. Inspect
32
+ and restore generated lockfile/vendor changes. No examples commit is needed.
33
+
34
+ This change does not introduce durable child execution, cross-version in-flight
35
+ compatibility or external-side-effect rollback. Keep the existing stop/drain and
36
+ recovery procedures when replacing running processes.
@@ -0,0 +1,31 @@
1
+ # r8 unit 14 migration
2
+
3
+ Apply to unit13 core commit `cf659de00b9adc2641e1c68014d756e761ccc8e1` using
4
+ the package applier in a clean checkout. Only core changes; examples source
5
+ remains at unit6 commit `ed455c52018338f7c5a4c2948ae0d7db131aa090`.
6
+
7
+ Public Agent resolution and Workflow APIs are unchanged. There is no data
8
+ migration, persistence format change or new application configuration.
9
+
10
+ Private consumers must replace the removed `Phronomy::Recovery` namespace:
11
+
12
+ | Former member | New private owner |
13
+ | --- | --- |
14
+ | Classification, dispositions, resolution outcomes, missing-material sentinel | `Phronomy::Agent::RecoveryRules` |
15
+ | Subject normalization/identity and resolution material validation | `Phronomy::Agent::RecoveryRules` |
16
+ | Revision and snapshot comparison, value normalization and record access | `Phronomy::Persistence::SnapshotComparison` |
17
+
18
+ The existing public `Phronomy::ExecutionRehydrationRequiredError` keeps its name
19
+ and superclass; its file moves to `agent/api/execution_rehydration_required_error.rb`.
20
+
21
+ The old internal file `lib/phronomy/recovery/recovery.rb` is removed.
22
+ Ordinary `require "phronomy"` loads both replacements. Direct loading of
23
+ internal files remains unsupported; do not treat these private modules as new
24
+ application extension APIs. Existing `Persistence::SaveOutcome` is unchanged.
25
+
26
+ Use the same process stop/drain and deployment procedure as unit13. This unit
27
+ adds no in-flight version interoperability or external side-effect rollback
28
+ guarantee. Retain the unit13 checkout for rollback; revert the applied commit
29
+ if necessary. Package README contains apply, validation and commit instructions.
30
+
31
+ Workflow durable children (F01) are deferred and are not included in this unit.
@@ -0,0 +1,31 @@
1
+ # r8 unit15 migration
2
+
3
+ ## Application impact
4
+
5
+ No public API, data migration or configuration changes are required.
6
+ GeneratorVerifier continues to accept draft/review Agent classes and optional
7
+ result parser callables, with the same JSON parser defaults and fallback values.
8
+ Each supplied Agent is created once and reused, retaining its conversation.
9
+
10
+ Custom Agent classes should implement the public Agent protocol: constructor
11
+ `on_event:`, `invoke_async` returning TaskResult, and approval notifications through
12
+ the constructor-bound listener. Terminal results are observed on the returned
13
+ TaskResult. A test double that emits `:done` but leaves its TaskResult pending is
14
+ not a complete implementation of that protocol and must settle its result.
15
+
16
+ The private `__invoke_async_with_event_sink` method is removed. It was not a
17
+ supported application API. Do not substitute `invoke_async(..., on_event:)`;
18
+ per-invocation listener arguments remain rejected. Register the listener at Agent
19
+ construction and observe each call's result near the call site.
20
+
21
+ `GeneratorVerifier::DefaultParser` and the private AgentOperation are framework
22
+ composition details. Applications continue to use `draft_result_parser:` and
23
+ `review_result_parser:` for custom parsing.
24
+
25
+ ## Operational scope
26
+
27
+ The package applies only to core on top of unit14. Existing unit6 examples need
28
+ verification against the new core but no source migration. Restart using the
29
+ existing stop/drain procedure. Rollback is a revert of the unit15 commit; it does
30
+ not require rewriting stored data. In-flight cross-version behavior is not a new
31
+ guarantee of this refactor.
@@ -0,0 +1,26 @@
1
+ # r8 unit16 migration
2
+
3
+ No application API or persisted-data migration is required.
4
+
5
+ This core-only update moves explicit-cancellation registration lifetime into the
6
+ existing internal `Phronomy::Concurrency::ResultSubscriptions` operation. Team
7
+ and OffloadPool use `explicit_cancellation` and `close`, rather than removing
8
+ CancellationToken callbacks through reflection.
9
+
10
+ `CancellationToken#on_cancel` remains public and returns `self`. Its private
11
+ callback-removal method remains private. The new internal operation is not an
12
+ application configuration option or a public subscription API.
13
+
14
+ Existing cancellation and deadline behavior is preserved. Deadline expiry alone
15
+ does not become a new Team cancellation notification. OffloadPool's existing
16
+ deadline promotion and non-interrupting worker completion behavior remain.
17
+ An already-dispatched cancellation callback can still run after subscription
18
+ cleanup; this refactor does not add a stronger delivery guarantee.
19
+
20
+ Tool cooperative execution and custom `call_async` implementations are unchanged.
21
+ The standard offloaded Tool route benefits from the OffloadPool update without
22
+ requiring Tool-specific registration code. Examples sources are unchanged.
23
+
24
+ Apply from unit15 commit `9aebef9217383cebb7fa3ec8b2d17b5763cd3c5e` in a new
25
+ `refactor/r8-unit16` worktree using the package's checked applier. Follow the
26
+ existing process shutdown/drain procedure when replacing running code.