protocore 2.0.0a1__tar.gz

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 (285) hide show
  1. protocore-2.0.0a1/.github/ISSUE_TEMPLATE/bug_report.yml +53 -0
  2. protocore-2.0.0a1/.github/ISSUE_TEMPLATE/config.yml +1 -0
  3. protocore-2.0.0a1/.github/ISSUE_TEMPLATE/feature_request.yml +32 -0
  4. protocore-2.0.0a1/.github/PULL_REQUEST_TEMPLATE.md +20 -0
  5. protocore-2.0.0a1/.github/workflows/ci.yml +66 -0
  6. protocore-2.0.0a1/.gitignore +42 -0
  7. protocore-2.0.0a1/CHANGELOG.md +41 -0
  8. protocore-2.0.0a1/CODE_OF_CONDUCT.md +45 -0
  9. protocore-2.0.0a1/CONTRIBUTING.md +96 -0
  10. protocore-2.0.0a1/LICENSE +373 -0
  11. protocore-2.0.0a1/NOTICE +42 -0
  12. protocore-2.0.0a1/PKG-INFO +199 -0
  13. protocore-2.0.0a1/README.en.md +166 -0
  14. protocore-2.0.0a1/README.md +170 -0
  15. protocore-2.0.0a1/SECURITY.md +61 -0
  16. protocore-2.0.0a1/docs/architecture.md +733 -0
  17. protocore-2.0.0a1/docs/contracts.md +284 -0
  18. protocore-2.0.0a1/docs/extending.md +266 -0
  19. protocore-2.0.0a1/docs/getting-started.md +245 -0
  20. protocore-2.0.0a1/docs/glossary.md +236 -0
  21. protocore-2.0.0a1/docs/index.md +68 -0
  22. protocore-2.0.0a1/docs/ru/architecture.md +1203 -0
  23. protocore-2.0.0a1/docs/ru/contracts.md +294 -0
  24. protocore-2.0.0a1/docs/ru/extending.md +282 -0
  25. protocore-2.0.0a1/docs/ru/getting-started.md +257 -0
  26. protocore-2.0.0a1/docs/ru/glossary.md +248 -0
  27. protocore-2.0.0a1/docs/ru/index.md +73 -0
  28. protocore-2.0.0a1/docs/ru/runtime-constants.md +212 -0
  29. protocore-2.0.0a1/docs/ru/testing.md +112 -0
  30. protocore-2.0.0a1/docs/ru/tools.md +314 -0
  31. protocore-2.0.0a1/docs/runtime-constants.md +191 -0
  32. protocore-2.0.0a1/docs/testing.md +108 -0
  33. protocore-2.0.0a1/docs/tools.md +299 -0
  34. protocore-2.0.0a1/protocore/__init__.py +235 -0
  35. protocore-2.0.0a1/protocore/constants.py +81 -0
  36. protocore-2.0.0a1/protocore/contracts/__init__.py +389 -0
  37. protocore-2.0.0a1/protocore/contracts/agent_dispatch.py +61 -0
  38. protocore-2.0.0a1/protocore/contracts/attempt_ledger.py +364 -0
  39. protocore-2.0.0a1/protocore/contracts/blob.py +91 -0
  40. protocore-2.0.0a1/protocore/contracts/events.py +49 -0
  41. protocore-2.0.0a1/protocore/contracts/hooks.py +139 -0
  42. protocore-2.0.0a1/protocore/contracts/lean_tool_surface.py +352 -0
  43. protocore-2.0.0a1/protocore/contracts/llm.py +413 -0
  44. protocore-2.0.0a1/protocore/contracts/memory.py +706 -0
  45. protocore-2.0.0a1/protocore/contracts/observability.py +66 -0
  46. protocore-2.0.0a1/protocore/contracts/prompts.py +102 -0
  47. protocore-2.0.0a1/protocore/contracts/references.py +223 -0
  48. protocore-2.0.0a1/protocore/contracts/resilience.py +423 -0
  49. protocore-2.0.0a1/protocore/contracts/run.py +93 -0
  50. protocore-2.0.0a1/protocore/contracts/runtime_constants.py +7459 -0
  51. protocore-2.0.0a1/protocore/contracts/search.py +64 -0
  52. protocore-2.0.0a1/protocore/contracts/session.py +53 -0
  53. protocore-2.0.0a1/protocore/contracts/skills.py +212 -0
  54. protocore-2.0.0a1/protocore/contracts/terminal_answer_validation.py +285 -0
  55. protocore-2.0.0a1/protocore/contracts/todo.py +36 -0
  56. protocore-2.0.0a1/protocore/contracts/tool_action_preconditions.py +369 -0
  57. protocore-2.0.0a1/protocore/contracts/tool_chunking.py +80 -0
  58. protocore-2.0.0a1/protocore/contracts/tool_registry.py +167 -0
  59. protocore-2.0.0a1/protocore/contracts/tools.py +148 -0
  60. protocore-2.0.0a1/protocore/contracts/types.py +1328 -0
  61. protocore-2.0.0a1/protocore/contracts/verification.py +1174 -0
  62. protocore-2.0.0a1/protocore/contracts/workspace.py +820 -0
  63. protocore-2.0.0a1/protocore/events.py +201 -0
  64. protocore-2.0.0a1/protocore/hooks/__init__.py +10 -0
  65. protocore-2.0.0a1/protocore/hooks/manager.py +183 -0
  66. protocore-2.0.0a1/protocore/hooks/specs.py +93 -0
  67. protocore-2.0.0a1/protocore/ingress.py +52 -0
  68. protocore-2.0.0a1/protocore/json_utils.py +871 -0
  69. protocore-2.0.0a1/protocore/logging_utils.py +29 -0
  70. protocore-2.0.0a1/protocore/prompts/__init__.py +28 -0
  71. protocore-2.0.0a1/protocore/prompts/jinja_provider.py +262 -0
  72. protocore-2.0.0a1/protocore/prompts/templates/environment_manifest.j2 +63 -0
  73. protocore-2.0.0a1/protocore/prompts/templates/finalization.j2 +9 -0
  74. protocore-2.0.0a1/protocore/prompts/templates/leader_system.j2 +108 -0
  75. protocore-2.0.0a1/protocore/prompts/templates/macros.j2 +74 -0
  76. protocore-2.0.0a1/protocore/prompts/templates/planner.j2 +20 -0
  77. protocore-2.0.0a1/protocore/prompts/templates/subagent_contract.j2 +83 -0
  78. protocore-2.0.0a1/protocore/py.typed +0 -0
  79. protocore-2.0.0a1/protocore/runtime/__init__.py +95 -0
  80. protocore-2.0.0a1/protocore/runtime/adaptive_safety_band.py +323 -0
  81. protocore-2.0.0a1/protocore/runtime/answer_narration.py +252 -0
  82. protocore-2.0.0a1/protocore/runtime/background.py +619 -0
  83. protocore-2.0.0a1/protocore/runtime/candidate_delivery.py +103 -0
  84. protocore-2.0.0a1/protocore/runtime/chain_parser.py +200 -0
  85. protocore-2.0.0a1/protocore/runtime/compact_checkpoint.py +131 -0
  86. protocore-2.0.0a1/protocore/runtime/context/__init__.py +52 -0
  87. protocore-2.0.0a1/protocore/runtime/context/budgets.py +102 -0
  88. protocore-2.0.0a1/protocore/runtime/context/compaction.py +1176 -0
  89. protocore-2.0.0a1/protocore/runtime/context/manager.py +509 -0
  90. protocore-2.0.0a1/protocore/runtime/context/session_memory.py +848 -0
  91. protocore-2.0.0a1/protocore/runtime/correctness_bind.py +86 -0
  92. protocore-2.0.0a1/protocore/runtime/deadline_clock.py +74 -0
  93. protocore-2.0.0a1/protocore/runtime/events/__init__.py +22 -0
  94. protocore-2.0.0a1/protocore/runtime/events/envelope.py +65 -0
  95. protocore-2.0.0a1/protocore/runtime/events/memory.py +35 -0
  96. protocore-2.0.0a1/protocore/runtime/events/types.py +94 -0
  97. protocore-2.0.0a1/protocore/runtime/execution_profile.py +53 -0
  98. protocore-2.0.0a1/protocore/runtime/finalization_contract.py +262 -0
  99. protocore-2.0.0a1/protocore/runtime/finalization_gate.py +416 -0
  100. protocore-2.0.0a1/protocore/runtime/intent.py +112 -0
  101. protocore-2.0.0a1/protocore/runtime/lanes.py +112 -0
  102. protocore-2.0.0a1/protocore/runtime/live_control.py +144 -0
  103. protocore-2.0.0a1/protocore/runtime/llm/__init__.py +17 -0
  104. protocore-2.0.0a1/protocore/runtime/llm/delta_bridge.py +237 -0
  105. protocore-2.0.0a1/protocore/runtime/longfile_convergence.py +872 -0
  106. protocore-2.0.0a1/protocore/runtime/loop_guard.py +150 -0
  107. protocore-2.0.0a1/protocore/runtime/loop_state.py +109 -0
  108. protocore-2.0.0a1/protocore/runtime/loop_strategies.py +979 -0
  109. protocore-2.0.0a1/protocore/runtime/path_policy.py +84 -0
  110. protocore-2.0.0a1/protocore/runtime/pending_reads.py +370 -0
  111. protocore-2.0.0a1/protocore/runtime/permission_widen.py +92 -0
  112. protocore-2.0.0a1/protocore/runtime/prompt_caching.py +187 -0
  113. protocore-2.0.0a1/protocore/runtime/query.py +11016 -0
  114. protocore-2.0.0a1/protocore/runtime/query_engine.py +2373 -0
  115. protocore-2.0.0a1/protocore/runtime/read_dedup_cache.py +443 -0
  116. protocore-2.0.0a1/protocore/runtime/resilience.py +1002 -0
  117. protocore-2.0.0a1/protocore/runtime/result_eviction.py +127 -0
  118. protocore-2.0.0a1/protocore/runtime/rules_activation.py +143 -0
  119. protocore-2.0.0a1/protocore/runtime/run_tool_preconditions.py +166 -0
  120. protocore-2.0.0a1/protocore/runtime/run_work_budget.py +297 -0
  121. protocore-2.0.0a1/protocore/runtime/runtime_constants.py +34 -0
  122. protocore-2.0.0a1/protocore/runtime/session_tree.py +64 -0
  123. protocore-2.0.0a1/protocore/runtime/skill_index.py +105 -0
  124. protocore-2.0.0a1/protocore/runtime/soft_stop.py +341 -0
  125. protocore-2.0.0a1/protocore/runtime/subagent_budget.py +173 -0
  126. protocore-2.0.0a1/protocore/runtime/telemetry.py +54 -0
  127. protocore-2.0.0a1/protocore/runtime/terminal_payload_normalize.py +86 -0
  128. protocore-2.0.0a1/protocore/runtime/token_counting.py +133 -0
  129. protocore-2.0.0a1/protocore/runtime/tool_dispatch.py +2283 -0
  130. protocore-2.0.0a1/protocore/runtime/tool_permission.py +644 -0
  131. protocore-2.0.0a1/protocore/runtime/tool_pool.py +142 -0
  132. protocore-2.0.0a1/protocore/runtime/tool_preconditions.py +355 -0
  133. protocore-2.0.0a1/protocore/runtime/tool_registry.py +371 -0
  134. protocore-2.0.0a1/protocore/runtime/tool_result_split.py +36 -0
  135. protocore-2.0.0a1/protocore/runtime/tool_retrieval.py +330 -0
  136. protocore-2.0.0a1/protocore/runtime/typed_hooks.py +90 -0
  137. protocore-2.0.0a1/protocore/runtime/usage.py +91 -0
  138. protocore-2.0.0a1/protocore/runtime/usage_ledger.py +83 -0
  139. protocore-2.0.0a1/protocore/runtime/wire_format.py +119 -0
  140. protocore-2.0.0a1/protocore/safety/__init__.py +14 -0
  141. protocore-2.0.0a1/protocore/safety/shell.py +260 -0
  142. protocore-2.0.0a1/protocore/testing.py +39 -0
  143. protocore-2.0.0a1/protocore/tests_support/__init__.py +41 -0
  144. protocore-2.0.0a1/protocore/tests_support/adapters.py +1889 -0
  145. protocore-2.0.0a1/protocore/tests_support/runtime.py +88 -0
  146. protocore-2.0.0a1/protocore/tools/__init__.py +51 -0
  147. protocore-2.0.0a1/protocore/tools/ask_user.py +421 -0
  148. protocore-2.0.0a1/protocore/tools/decorator.py +106 -0
  149. protocore-2.0.0a1/protocore/tools/memory.py +956 -0
  150. protocore-2.0.0a1/pyproject.toml +131 -0
  151. protocore-2.0.0a1/tests/__init__.py +0 -0
  152. protocore-2.0.0a1/tests/conftest.py +11 -0
  153. protocore-2.0.0a1/tests/test_constructible.py +67 -0
  154. protocore-2.0.0a1/tests/test_core_import_boundary.py +234 -0
  155. protocore-2.0.0a1/tests/test_runtime_constants_renames.py +51 -0
  156. protocore-2.0.0a1/tests/test_runtime_constants_sse.py +48 -0
  157. protocore-2.0.0a1/tests/unit/__init__.py +0 -0
  158. protocore-2.0.0a1/tests/unit/contracts/__init__.py +0 -0
  159. protocore-2.0.0a1/tests/unit/contracts/test_ask_user_tool.py +582 -0
  160. protocore-2.0.0a1/tests/unit/contracts/test_attempt_ledger.py +449 -0
  161. protocore-2.0.0a1/tests/unit/contracts/test_lean_tool_surface.py +152 -0
  162. protocore-2.0.0a1/tests/unit/contracts/test_memory_contract.py +511 -0
  163. protocore-2.0.0a1/tests/unit/contracts/test_references_normalize.py +373 -0
  164. protocore-2.0.0a1/tests/unit/contracts/test_resilience_contract.py +199 -0
  165. protocore-2.0.0a1/tests/unit/contracts/test_resume_stream_constants.py +32 -0
  166. protocore-2.0.0a1/tests/unit/contracts/test_skill_files_contract.py +219 -0
  167. protocore-2.0.0a1/tests/unit/contracts/test_terminal_answer_validation.py +223 -0
  168. protocore-2.0.0a1/tests/unit/contracts/test_tool_action_preconditions.py +317 -0
  169. protocore-2.0.0a1/tests/unit/contracts/test_tool_chunking.py +66 -0
  170. protocore-2.0.0a1/tests/unit/contracts/test_workspace_contract.py +754 -0
  171. protocore-2.0.0a1/tests/unit/prompts/__init__.py +0 -0
  172. protocore-2.0.0a1/tests/unit/prompts/test_jinja_provider.py +550 -0
  173. protocore-2.0.0a1/tests/unit/prompts/test_leader_system_additive.py +178 -0
  174. protocore-2.0.0a1/tests/unit/prompts/test_leader_system_answer_boundary.py +163 -0
  175. protocore-2.0.0a1/tests/unit/prompts/test_leader_system_workspace_visibility.py +258 -0
  176. protocore-2.0.0a1/tests/unit/prompts/test_mcp_sets_block.py +192 -0
  177. protocore-2.0.0a1/tests/unit/runtime/__init__.py +0 -0
  178. protocore-2.0.0a1/tests/unit/runtime/_tool_fixtures.py +125 -0
  179. protocore-2.0.0a1/tests/unit/runtime/conftest.py +102 -0
  180. protocore-2.0.0a1/tests/unit/runtime/test_adaptive_safety_band.py +294 -0
  181. protocore-2.0.0a1/tests/unit/runtime/test_budgets.py +52 -0
  182. protocore-2.0.0a1/tests/unit/runtime/test_cache_observer_protocol.py +251 -0
  183. protocore-2.0.0a1/tests/unit/runtime/test_candidate_delivery.py +605 -0
  184. protocore-2.0.0a1/tests/unit/runtime/test_circuit_breaker_tool_errors.py +448 -0
  185. protocore-2.0.0a1/tests/unit/runtime/test_compaction.py +1013 -0
  186. protocore-2.0.0a1/tests/unit/runtime/test_compaction_intra_run.py +1181 -0
  187. protocore-2.0.0a1/tests/unit/runtime/test_context_manager.py +384 -0
  188. protocore-2.0.0a1/tests/unit/runtime/test_deep_nesting_guard.py +259 -0
  189. protocore-2.0.0a1/tests/unit/runtime/test_deep_strategy.py +1090 -0
  190. protocore-2.0.0a1/tests/unit/runtime/test_delegated_answer_narration_split.py +447 -0
  191. protocore-2.0.0a1/tests/unit/runtime/test_delta_bridge.py +228 -0
  192. protocore-2.0.0a1/tests/unit/runtime/test_finalization_contract.py +355 -0
  193. protocore-2.0.0a1/tests/unit/runtime/test_finalization_gate.py +215 -0
  194. protocore-2.0.0a1/tests/unit/runtime/test_finalize_terminal_gate.py +1008 -0
  195. protocore-2.0.0a1/tests/unit/runtime/test_history_registry_claims.py +451 -0
  196. protocore-2.0.0a1/tests/unit/runtime/test_history_run_boundary.py +3089 -0
  197. protocore-2.0.0a1/tests/unit/runtime/test_intent_ledger_tree_lanes.py +324 -0
  198. protocore-2.0.0a1/tests/unit/runtime/test_internal_error_classification.py +311 -0
  199. protocore-2.0.0a1/tests/unit/runtime/test_leader_system_prompt.py +573 -0
  200. protocore-2.0.0a1/tests/unit/runtime/test_live_run_guardrails.py +504 -0
  201. protocore-2.0.0a1/tests/unit/runtime/test_long_work_and_context.py +740 -0
  202. protocore-2.0.0a1/tests/unit/runtime/test_longfile_convergence.py +1080 -0
  203. protocore-2.0.0a1/tests/unit/runtime/test_longfile_convergence_loop.py +1378 -0
  204. protocore-2.0.0a1/tests/unit/runtime/test_longfile_forced_tool_choice_surface_gate.py +201 -0
  205. protocore-2.0.0a1/tests/unit/runtime/test_longfile_salvage_cancel_checkpoint.py +284 -0
  206. protocore-2.0.0a1/tests/unit/runtime/test_longfile_salvage_truncated_tail_flag.py +462 -0
  207. protocore-2.0.0a1/tests/unit/runtime/test_loop_state.py +76 -0
  208. protocore-2.0.0a1/tests/unit/runtime/test_metaleak_suppression.py +529 -0
  209. protocore-2.0.0a1/tests/unit/runtime/test_pending_reads.py +335 -0
  210. protocore-2.0.0a1/tests/unit/runtime/test_pending_reads_forced_read_gate.py +397 -0
  211. protocore-2.0.0a1/tests/unit/runtime/test_plain_stop_answer_floor.py +487 -0
  212. protocore-2.0.0a1/tests/unit/runtime/test_pointer_answer_floor.py +978 -0
  213. protocore-2.0.0a1/tests/unit/runtime/test_process_group_runner.py +87 -0
  214. protocore-2.0.0a1/tests/unit/runtime/test_prompt_byte_stability.py +200 -0
  215. protocore-2.0.0a1/tests/unit/runtime/test_prompt_caching.py +305 -0
  216. protocore-2.0.0a1/tests/unit/runtime/test_query_async_gen.py +1190 -0
  217. protocore-2.0.0a1/tests/unit/runtime/test_query_cache_breakpoints_wire.py +162 -0
  218. protocore-2.0.0a1/tests/unit/runtime/test_query_classified_error_payload.py +151 -0
  219. protocore-2.0.0a1/tests/unit/runtime/test_query_engine.py +633 -0
  220. protocore-2.0.0a1/tests/unit/runtime/test_query_engine_evidence_collection.py +325 -0
  221. protocore-2.0.0a1/tests/unit/runtime/test_query_engine_snapshot_offload.py +420 -0
  222. protocore-2.0.0a1/tests/unit/runtime/test_query_evidence_dispatch.py +563 -0
  223. protocore-2.0.0a1/tests/unit/runtime/test_query_finishless_stream_truncation.py +399 -0
  224. protocore-2.0.0a1/tests/unit/runtime/test_query_hardening.py +2855 -0
  225. protocore-2.0.0a1/tests/unit/runtime/test_query_low_severity_fixes.py +882 -0
  226. protocore-2.0.0a1/tests/unit/runtime/test_query_parallel_safe_tools.py +1517 -0
  227. protocore-2.0.0a1/tests/unit/runtime/test_query_parallel_subagents.py +779 -0
  228. protocore-2.0.0a1/tests/unit/runtime/test_query_safety_band.py +74 -0
  229. protocore-2.0.0a1/tests/unit/runtime/test_query_stream_block_segmentation.py +323 -0
  230. protocore-2.0.0a1/tests/unit/runtime/test_query_stream_block_visibility.py +364 -0
  231. protocore-2.0.0a1/tests/unit/runtime/test_query_stream_buffer_accumulation.py +109 -0
  232. protocore-2.0.0a1/tests/unit/runtime/test_query_tool_pairing_repair.py +1422 -0
  233. protocore-2.0.0a1/tests/unit/runtime/test_query_transient_and_empty.py +770 -0
  234. protocore-2.0.0a1/tests/unit/runtime/test_query_wire_turn_id.py +230 -0
  235. protocore-2.0.0a1/tests/unit/runtime/test_query_with_tools.py +1275 -0
  236. protocore-2.0.0a1/tests/unit/runtime/test_read_dedup_cache.py +490 -0
  237. protocore-2.0.0a1/tests/unit/runtime/test_resilience.py +1548 -0
  238. protocore-2.0.0a1/tests/unit/runtime/test_resilience_recovery_loop.py +631 -0
  239. protocore-2.0.0a1/tests/unit/runtime/test_run_modes.py +255 -0
  240. protocore-2.0.0a1/tests/unit/runtime/test_run_outcome_record.py +408 -0
  241. protocore-2.0.0a1/tests/unit/runtime/test_run_tool_preconditions.py +448 -0
  242. protocore-2.0.0a1/tests/unit/runtime/test_run_work_budget.py +517 -0
  243. protocore-2.0.0a1/tests/unit/runtime/test_session_memory.py +584 -0
  244. protocore-2.0.0a1/tests/unit/runtime/test_skill_index.py +145 -0
  245. protocore-2.0.0a1/tests/unit/runtime/test_skill_index_wiring.py +538 -0
  246. protocore-2.0.0a1/tests/unit/runtime/test_soft_stop.py +802 -0
  247. protocore-2.0.0a1/tests/unit/runtime/test_streaming_events.py +96 -0
  248. protocore-2.0.0a1/tests/unit/runtime/test_subagent_tool_allowlist_dispatch.py +158 -0
  249. protocore-2.0.0a1/tests/unit/runtime/test_subagent_tree_budget.py +389 -0
  250. protocore-2.0.0a1/tests/unit/runtime/test_terminal_candidate_preserve.py +594 -0
  251. protocore-2.0.0a1/tests/unit/runtime/test_terminal_finalize.py +1062 -0
  252. protocore-2.0.0a1/tests/unit/runtime/test_terminal_raw_envelope_dispatch.py +197 -0
  253. protocore-2.0.0a1/tests/unit/runtime/test_terminal_tool_nudge.py +764 -0
  254. protocore-2.0.0a1/tests/unit/runtime/test_tool_discovery_resurrection.py +345 -0
  255. protocore-2.0.0a1/tests/unit/runtime/test_tool_dispatch.py +1155 -0
  256. protocore-2.0.0a1/tests/unit/runtime/test_tool_dispatch_cancel.py +247 -0
  257. protocore-2.0.0a1/tests/unit/runtime/test_tool_dispatch_error_cap.py +1862 -0
  258. protocore-2.0.0a1/tests/unit/runtime/test_tool_dispatch_missing_field_cap.py +138 -0
  259. protocore-2.0.0a1/tests/unit/runtime/test_tool_dispatch_preconditions.py +411 -0
  260. protocore-2.0.0a1/tests/unit/runtime/test_tool_dispatch_soft_error_classification.py +276 -0
  261. protocore-2.0.0a1/tests/unit/runtime/test_tool_dispatch_string_type_cap.py +437 -0
  262. protocore-2.0.0a1/tests/unit/runtime/test_tool_permission_gate.py +756 -0
  263. protocore-2.0.0a1/tests/unit/runtime/test_tool_pool.py +222 -0
  264. protocore-2.0.0a1/tests/unit/runtime/test_tool_preconditions.py +597 -0
  265. protocore-2.0.0a1/tests/unit/runtime/test_tool_registry.py +441 -0
  266. protocore-2.0.0a1/tests/unit/runtime/test_tool_surface_forced_pins.py +255 -0
  267. protocore-2.0.0a1/tests/unit/runtime/test_truncation_chunk_recovery.py +1009 -0
  268. protocore-2.0.0a1/tests/unit/runtime/test_verification_contracts.py +1265 -0
  269. protocore-2.0.0a1/tests/unit/test_chain_parser.py +102 -0
  270. protocore-2.0.0a1/tests/unit/test_event_bus.py +130 -0
  271. protocore-2.0.0a1/tests/unit/test_hook_manager.py +300 -0
  272. protocore-2.0.0a1/tests/unit/test_in_memory_adapters.py +624 -0
  273. protocore-2.0.0a1/tests/unit/test_ingress.py +57 -0
  274. protocore-2.0.0a1/tests/unit/test_json_utils.py +558 -0
  275. protocore-2.0.0a1/tests/unit/test_run_status.py +5 -0
  276. protocore-2.0.0a1/tests/unit/test_runtime_constants.py +1260 -0
  277. protocore-2.0.0a1/tests/unit/test_shell_safety.py +851 -0
  278. protocore-2.0.0a1/tests/unit/test_token_counting.py +117 -0
  279. protocore-2.0.0a1/tests/unit/test_tool_decorator.py +74 -0
  280. protocore-2.0.0a1/tests/unit/test_tool_retrieval.py +212 -0
  281. protocore-2.0.0a1/tests/unit/test_types_serialization.py +399 -0
  282. protocore-2.0.0a1/tests/unit/test_wire_format.py +57 -0
  283. protocore-2.0.0a1/tests/unit/tools/__init__.py +0 -0
  284. protocore-2.0.0a1/tests/unit/tools/test_decorator.py +39 -0
  285. protocore-2.0.0a1/tests/unit/tools/test_memory_tools.py +940 -0
@@ -0,0 +1,53 @@
1
+ name: Bug report
2
+ description: Report a reproducible bug
3
+ title: "[Bug]: "
4
+ labels: ["bug"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for reporting a bug.
10
+ Please provide enough detail to reproduce and debug it.
11
+ - type: input
12
+ id: version
13
+ attributes:
14
+ label: Version
15
+ description: What version are you using?
16
+ placeholder: "e.g. 1.0.0"
17
+ validations:
18
+ required: true
19
+ - type: textarea
20
+ id: environment
21
+ attributes:
22
+ label: Environment
23
+ description: OS, Python version, runtime/backend details
24
+ placeholder: "macOS 15, Python 3.12, vLLM ..."
25
+ validations:
26
+ required: true
27
+ - type: textarea
28
+ id: steps
29
+ attributes:
30
+ label: Steps to reproduce
31
+ placeholder: |
32
+ 1. ...
33
+ 2. ...
34
+ 3. ...
35
+ validations:
36
+ required: true
37
+ - type: textarea
38
+ id: expected
39
+ attributes:
40
+ label: Expected behavior
41
+ validations:
42
+ required: true
43
+ - type: textarea
44
+ id: actual
45
+ attributes:
46
+ label: Actual behavior
47
+ validations:
48
+ required: true
49
+ - type: textarea
50
+ id: logs
51
+ attributes:
52
+ label: Relevant logs/output
53
+ render: shell
@@ -0,0 +1 @@
1
+ blank_issues_enabled: true
@@ -0,0 +1,32 @@
1
+ name: Feature request
2
+ description: Suggest a new feature or improvement
3
+ title: "[Feature]: "
4
+ labels: ["enhancement"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for the idea.
10
+ Please describe the problem first, then the proposed solution.
11
+ - type: textarea
12
+ id: problem
13
+ attributes:
14
+ label: Problem statement
15
+ description: What pain point does this solve?
16
+ validations:
17
+ required: true
18
+ - type: textarea
19
+ id: proposal
20
+ attributes:
21
+ label: Proposed solution
22
+ description: API shape, behavior, compatibility considerations
23
+ validations:
24
+ required: true
25
+ - type: textarea
26
+ id: alternatives
27
+ attributes:
28
+ label: Alternatives considered
29
+ - type: textarea
30
+ id: additional
31
+ attributes:
32
+ label: Additional context
@@ -0,0 +1,20 @@
1
+ ## What changed
2
+
3
+ <!-- What the change does, in a sentence or two. -->
4
+
5
+ ## Why
6
+
7
+ <!-- The reason it needed changing. If it fixes something subtle, what was the
8
+ symptom? -->
9
+
10
+ ## Checklist
11
+
12
+ - [ ] `uv run pytest .` passes (tests plus the 90% coverage floor)
13
+ - [ ] `uv run ruff check .` is clean
14
+ - [ ] `uv run mypy --strict` is clean — no path argument, it replaces the
15
+ configured file list and silently skips the tests
16
+ - [ ] `uv run bandit -r protocore -q -c pyproject.toml` is clean
17
+ - [ ] Behaviour changes have a test that fails without the change
18
+ - [ ] New tunables are `RuntimeConstants` fields with a description, and
19
+ default to the previous behaviour
20
+ - [ ] Docs updated if anything user-facing moved
@@ -0,0 +1,66 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+ - master
9
+
10
+ jobs:
11
+ test-lint-typecheck:
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ python-version: ["3.12", "3.13", "3.14"]
16
+
17
+ steps:
18
+ - name: Checkout
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Setup Python
22
+ uses: actions/setup-python@v5
23
+ with:
24
+ python-version: ${{ matrix.python-version }}
25
+
26
+ - name: Install uv
27
+ run: python -m pip install --upgrade uv
28
+
29
+ - name: Install dependencies
30
+ run: uv sync --extra dev
31
+
32
+ - name: Run contract unit gate
33
+ id: contracts
34
+ run: uv run pytest tests/unit/contracts -q --no-cov
35
+
36
+ - name: Run full test suite
37
+ id: tests
38
+ run: uv run pytest . --cov=protocore --cov-fail-under=90
39
+
40
+ - name: Run lint gate
41
+ id: lint
42
+ run: uv run ruff check .
43
+
44
+ - name: Run strict typing gate
45
+ id: typing
46
+ # No path argument on purpose: a path on the command line REPLACES the
47
+ # configured `files` list, which silently drops the test tree and
48
+ # leaves every test double unchecked.
49
+ run: uv run mypy --strict
50
+
51
+ - name: Run security audit
52
+ id: security
53
+ run: uv run bandit -r protocore -q -c pyproject.toml
54
+
55
+ - name: Publish quality gate summary
56
+ if: always()
57
+ run: |
58
+ {
59
+ echo "## Quality Gate Summary"
60
+ echo ""
61
+ echo "- contract unit tests: ${{ steps.contracts.outcome }}"
62
+ echo "- full test suite: ${{ steps.tests.outcome }}"
63
+ echo "- lint: ${{ steps.lint.outcome }}"
64
+ echo "- strict typing: ${{ steps.typing.outcome }}"
65
+ echo "- security: ${{ steps.security.outcome }}"
66
+ } >> "$GITHUB_STEP_SUMMARY"
@@ -0,0 +1,42 @@
1
+ # --- Python ---
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .eggs/
6
+
7
+ # --- Virtualenvs ---
8
+ .venv/
9
+ venv/
10
+ .python-version
11
+
12
+ # --- Tool caches ---
13
+ .mypy_cache/
14
+ .pytest_cache/
15
+ .ruff_cache/
16
+ .tox/
17
+ .nox/
18
+
19
+ # --- Coverage ---
20
+ .coverage
21
+ .coverage.*
22
+ coverage.xml
23
+ htmlcov/
24
+
25
+ # --- Build output ---
26
+ build/
27
+ dist/
28
+
29
+ # --- Lockfile ---
30
+ # Protocore is a library: pinning a resolution here would push it onto every
31
+ # consumer. The dependency floors in pyproject.toml are the contract.
32
+ uv.lock
33
+
34
+ # --- Editors ---
35
+ .idea/
36
+ .vscode/
37
+ *.iml
38
+ *.swp
39
+
40
+ # --- OS ---
41
+ .DS_Store
42
+ Thumbs.db
@@ -0,0 +1,41 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are recorded here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
5
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [2.0.0a1]
10
+
11
+ First public release.
12
+
13
+ Protocore has existed for some time as the closed core of an agent product.
14
+ This is that core, extracted and published under the MPL — the same code, with
15
+ the parts that only made sense inside one company's repository rewritten to
16
+ describe the boundary rather than the company.
17
+
18
+ ### Added
19
+
20
+ - The protocol boundary: 20 interface `Protocol`s and an `IBlobStore` ABC in
21
+ `protocore/contracts/`, covering the model client, run and session stores,
22
+ the tool registry, memory, workspace, search, blobs, skills, todos, hooks,
23
+ event transport, and subagent dispatch.
24
+ - The ReAct runtime: `QueryEngine` plus `query()`, driving one agent turn at a
25
+ time and emitting typed `TurnEvent`s. Snapshot and resume are first-class.
26
+ - A three-layer tool surface — tenant policy, a lean clipped surface, and
27
+ progressive discovery over BM25 retrieval — with a permission gate ahead of
28
+ dispatch and a shell-safety policy behind a real command-chain parser.
29
+ - Two-tier context compaction, session memory folding, and a token-budget model
30
+ that keeps a long run inside its window.
31
+ - `RuntimeConstants`: 524 per-tenant tunables as a frozen Pydantic snapshot,
32
+ every one of them documented, with new behaviour defaulting off.
33
+ - In-memory adapters (`protocore.tests_support.adapters`) that implement the
34
+ same protocols the real ones do, so a turn runs end to end with no external
35
+ services.
36
+ - Documentation in English and Russian under `docs/`.
37
+ - 2964 tests, a 90% coverage floor, strict typing, lint, and a security scan,
38
+ all gated on Python 3.12, 3.13, and 3.14.
39
+
40
+ [Unreleased]: https://github.com/ascorblack-labs/protocore-community/compare/v2.0.0a1...HEAD
41
+ [2.0.0a1]: https://github.com/ascorblack-labs/protocore-community/releases/tag/v2.0.0a1
@@ -0,0 +1,45 @@
1
+ # Code of Conduct
2
+
3
+ ## Our pledge
4
+
5
+ We want participating in this project to be a straightforwardly good use of
6
+ your time, regardless of your age, body size, disability, ethnicity, sex
7
+ characteristics, gender identity and expression, level of experience,
8
+ education, socio-economic status, nationality, personal appearance, race,
9
+ religion, or sexual identity and orientation.
10
+
11
+ ## Standards
12
+
13
+ Things that make this project work:
14
+
15
+ - Assuming the other person is trying to help.
16
+ - Critiquing the code rather than the person who wrote it.
17
+ - Accepting a "no" gracefully, and giving reasons with your own.
18
+ - Saying when you were wrong.
19
+
20
+ Things that do not:
21
+
22
+ - Harassment, public or private.
23
+ - Insults, or personal or political attacks.
24
+ - Sexualised language or imagery, and unwelcome sexual attention.
25
+ - Publishing someone's private information without their explicit permission.
26
+
27
+ ## Scope
28
+
29
+ This applies in the issue tracker, in pull requests, in discussions, and
30
+ anywhere someone is representing the project in public.
31
+
32
+ ## Enforcement
33
+
34
+ Report a problem to the maintainers privately, through GitHub. Reports are
35
+ handled confidentially and you will get a response.
36
+
37
+ Maintainers may edit or remove contributions that do not fit these standards,
38
+ and may temporarily or permanently ban anyone whose behaviour they judge
39
+ inappropriate. Where a maintainer takes such an action they will say so and
40
+ say why.
41
+
42
+ ## Attribution
43
+
44
+ Adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
45
+ version 2.1.
@@ -0,0 +1,96 @@
1
+ # Contributing to Protocore
2
+
3
+ Thanks for considering it. This document is short because the project has few
4
+ rules — but the ones it has are load-bearing.
5
+
6
+ ## The one rule that is not negotiable
7
+
8
+ **The core never imports upward.** `protocore/` may import from `protocore` and
9
+ from its four runtime dependencies. It may not import any package whose name
10
+ begins `protocore_`, and it may not grow a database driver, an HTTP client, a
11
+ cloud SDK, or a model-provider SDK.
12
+
13
+ If the core needs something from the outside, that need is expressed as a
14
+ `Protocol` in `protocore/contracts/` and injected. `tests/test_core_import_boundary.py`
15
+ enforces this and will fail your pull request rather than argue about it.
16
+
17
+ ## Setup
18
+
19
+ ```bash
20
+ uv sync --extra dev
21
+ ```
22
+
23
+ Python ≥ 3.12. No services, no containers, no fixtures to provision — the whole
24
+ suite runs offline against in-memory doubles and finishes in well under a minute.
25
+
26
+ ## The gates
27
+
28
+ Run all four before you open a pull request. CI runs the same ones on Python
29
+ 3.12, 3.13, and 3.14.
30
+
31
+ ```bash
32
+ uv run pytest . # tests + 90% coverage floor
33
+ uv run ruff check . # lint
34
+ uv run mypy --strict # typing, strict, no path argument
35
+ uv run bandit -r protocore -q -c pyproject.toml # security
36
+ ```
37
+
38
+ Two things people trip over:
39
+
40
+ - **Do not pass a path to `mypy`.** A path on the command line *replaces* the
41
+ configured `files` list, which silently excludes the test tree. Bare
42
+ `mypy --strict` checks the surface `pyproject.toml` declares.
43
+ - **Do not pipe a gate into `tail` or `head`.** A shell pipeline reports the
44
+ *last* command's status, so a failing gate reads as a pass. Redirect to a file
45
+ and read the exit code separately. This is not hypothetical; the security gate
46
+ sat red for a while because of exactly this.
47
+
48
+ ## Conventions
49
+
50
+ - **No magic numbers in the executable path.** A tunable value belongs on
51
+ `RuntimeConstants` as a field with a description, so an operator can change it
52
+ without a deploy. `protocore/constants.py` is only for memory-safety caps that
53
+ are not per-tenant.
54
+ - **New behaviour defaults off**, or to a value that reproduces the previous
55
+ behaviour exactly. A tenant opts in deliberately; an upgrade never changes
56
+ what a running system does.
57
+ - **No module-level mutable state.** No module-level dicts, no locks held as
58
+ module state. Correctness-affecting state lives per-run on the `QueryEngine`
59
+ so the runtime stays safe to scale horizontally.
60
+ - **Log at WARNING or above** on paths that run in production. `logger.info` in
61
+ the hot loop is noise someone else has to pay for.
62
+ - **Docstrings explain why**, not what. The code says what it does. The comment
63
+ is for the reason it does it that way — usually a failure mode that is not
64
+ obvious from the surrounding lines.
65
+
66
+ ## Tests
67
+
68
+ A change to behaviour needs a test that fails without it. The suite is large
69
+ (2964 tests) precisely so that the loop's edge cases stay pinned; adding to it is
70
+ the normal cost of a change, not an extra.
71
+
72
+ Coverage is enforced at 90% and the current margin is thin. If your change adds
73
+ a branch, cover it.
74
+
75
+ ## Commits and pull requests
76
+
77
+ Write the commit message for someone reading `git log` in a year with no other
78
+ context. Say what changed and why it needed changing; if the change fixes
79
+ something subtle, say what the symptom was.
80
+
81
+ Keep a pull request to one concern. A refactor bundled with a behaviour change
82
+ is two reviews wearing one hat, and the behaviour change is the one that gets
83
+ skimmed.
84
+
85
+ ## Reporting bugs
86
+
87
+ Open an issue with a reproduction. A failing test is the ideal form of one.
88
+
89
+ Security problems do **not** go in the issue tracker — see
90
+ [`SECURITY.md`](SECURITY.md).
91
+
92
+ ## License of contributions
93
+
94
+ By contributing you agree that your contribution is licensed under the
95
+ [Mozilla Public License 2.0](LICENSE), the same terms as the rest of the
96
+ project. There is no CLA.