deepstrike 0.2.83__tar.gz → 0.2.84__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 (286) hide show
  1. {deepstrike-0.2.83 → deepstrike-0.2.84}/Cargo.lock +7 -7
  2. {deepstrike-0.2.83 → deepstrike-0.2.84}/Cargo.toml +3 -3
  3. {deepstrike-0.2.83 → deepstrike-0.2.84}/PKG-INFO +1 -1
  4. deepstrike-0.2.84/crates/deepstrike-core/src/context/archive.rs +119 -0
  5. deepstrike-0.2.84/crates/deepstrike-core/src/context/authority.rs +205 -0
  6. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/context/cache_ledger.rs +2 -23
  7. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/context/compression.rs +64 -160
  8. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/context/config.rs +11 -60
  9. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/context/item.rs +4 -29
  10. deepstrike-0.2.84/crates/deepstrike-core/src/context/manager/cache.rs +84 -0
  11. deepstrike-0.2.84/crates/deepstrike-core/src/context/manager/capabilities.rs +295 -0
  12. deepstrike-0.2.84/crates/deepstrike-core/src/context/manager/handles.rs +157 -0
  13. deepstrike-0.2.84/crates/deepstrike-core/src/context/manager/items.rs +616 -0
  14. deepstrike-0.2.84/crates/deepstrike-core/src/context/manager/knowledge.rs +255 -0
  15. deepstrike-0.2.84/crates/deepstrike-core/src/context/manager/mod.rs +408 -0
  16. deepstrike-0.2.84/crates/deepstrike-core/src/context/manager/pressure.rs +230 -0
  17. deepstrike-0.2.84/crates/deepstrike-core/src/context/manager/report.rs +107 -0
  18. deepstrike-0.2.84/crates/deepstrike-core/src/context/manager/tests.rs +1321 -0
  19. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/context/mod.rs +3 -3
  20. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/context/notes.rs +74 -79
  21. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/context/partitions.rs +49 -28
  22. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/context/pressure.rs +3 -11
  23. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/context/renderer.rs +22 -481
  24. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/context/renewal.rs +3 -6
  25. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/context/skill_catalog.rs +2 -13
  26. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/context/task_state.rs +8 -130
  27. deepstrike-0.2.84/crates/deepstrike-core/src/context/voice.rs +733 -0
  28. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/mm/handle.rs +41 -163
  29. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/mm/mod.rs +1 -1
  30. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/orchestration/workflow/mod.rs +5 -5
  31. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/observation.rs +4 -2
  32. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/checkpoint.rs +12 -11
  33. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/command.rs +1 -7
  34. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/config.rs +16 -50
  35. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/driver/effects.rs +18 -22
  36. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/driver/events.rs +10 -3
  37. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/driver/planning.rs +1 -1
  38. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/driver/projection.rs +4 -3
  39. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/driver/provider.rs +35 -11
  40. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/driver/syscall.rs +41 -42
  41. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/driver/tests.rs +323 -18
  42. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/driver.rs +33 -107
  43. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/tests.rs +1 -1
  44. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/session.rs +4 -0
  45. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/entropy.rs +3 -12
  46. deepstrike-0.2.84/crates/deepstrike-core/src/scheduler/rollback.rs +19 -0
  47. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/state_machine/eviction.rs +7 -33
  48. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/state_machine/gate.rs +24 -17
  49. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/state_machine/milestone_exec.rs +7 -15
  50. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/state_machine/mod.rs +80 -146
  51. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/state_machine/process.rs +5 -7
  52. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/state_machine/signal.rs +5 -12
  53. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/state_machine/tests.rs +12 -64
  54. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/state_machine/workflow.rs +1 -8
  55. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-py/src/lib.rs +1 -13
  56. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/_session_event_registry.py +1 -2
  57. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/canonical_kernel_step.py +11 -0
  58. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/context_policy.py +5 -18
  59. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/kernel_step.py +0 -3
  60. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/runner.py +3 -6
  61. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/session_log.py +3 -8
  62. {deepstrike-0.2.83 → deepstrike-0.2.84}/pyproject.toml +1 -1
  63. deepstrike-0.2.83/crates/deepstrike-core/src/context/manager.rs +0 -3681
  64. deepstrike-0.2.83/crates/deepstrike-core/src/context/policy.rs +0 -139
  65. deepstrike-0.2.83/crates/deepstrike-core/src/context/summarizer.rs +0 -378
  66. deepstrike-0.2.83/crates/deepstrike-core/src/context/utility.rs +0 -491
  67. deepstrike-0.2.83/crates/deepstrike-core/src/scheduler/rollback.rs +0 -71
  68. {deepstrike-0.2.83 → deepstrike-0.2.84}/LICENSE +0 -0
  69. {deepstrike-0.2.83 → deepstrike-0.2.84}/README.md +0 -0
  70. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/Cargo.toml +0 -0
  71. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/LICENSE +0 -0
  72. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/benches/kernel_baseline.rs +0 -0
  73. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/benches/wait_index_baseline.rs +0 -0
  74. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/benchmark/mod.rs +0 -0
  75. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/context/fault.rs +0 -0
  76. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/context/graph.rs +0 -0
  77. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/context/measurement.rs +0 -0
  78. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/context/text.rs +0 -0
  79. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/context/token_engine.rs +0 -0
  80. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/context/units.rs +0 -0
  81. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/governance/constraint.rs +0 -0
  82. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/governance/mod.rs +0 -0
  83. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/governance/permission.rs +0 -0
  84. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/governance/pipeline.rs +0 -0
  85. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/governance/quota.rs +0 -0
  86. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/governance/rate_limit.rs +0 -0
  87. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/governance/repeat_fuse.rs +0 -0
  88. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/governance/veto.rs +0 -0
  89. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/harness/eval.rs +0 -0
  90. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/harness/mod.rs +0 -0
  91. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/lexical.rs +0 -0
  92. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/lib.rs +0 -0
  93. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/memory/curator.rs +0 -0
  94. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/memory/durable.rs +0 -0
  95. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/memory/mod.rs +0 -0
  96. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/mm/memory.rs +0 -0
  97. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/mm/memory_candidate.rs +0 -0
  98. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/mm/value.rs +0 -0
  99. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/orchestration/mod.rs +0 -0
  100. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/orchestration/task_graph.rs +0 -0
  101. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/orchestration/workflow/run.rs +0 -0
  102. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/proc/mod.rs +0 -0
  103. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/projection_pairs.rs +0 -0
  104. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/event_log.rs +0 -0
  105. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/binding.rs +0 -0
  106. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/crash_point.rs +0 -0
  107. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/driver/continuation.rs +0 -0
  108. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/effect.rs +0 -0
  109. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/envelope.rs +0 -0
  110. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/event.rs +0 -0
  111. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/fault.rs +0 -0
  112. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/memory_authority.rs +0 -0
  113. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/projection.rs +0 -0
  114. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/record.rs +0 -0
  115. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/restore.rs +0 -0
  116. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/root.rs +0 -0
  117. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/scalar.rs +0 -0
  118. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/syscall.rs +0 -0
  119. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/terminal.rs +0 -0
  120. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire/transaction.rs +0 -0
  121. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel/wire.rs +0 -0
  122. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/kernel.rs +0 -0
  123. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/mod.rs +0 -0
  124. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/repair.rs +0 -0
  125. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/replay.rs +0 -0
  126. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/session_registry_tests.rs +0 -0
  127. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/runtime/session_wire.rs +0 -0
  128. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/budget_grant.rs +0 -0
  129. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/cross_operation.rs +0 -0
  130. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/mailbox.rs +0 -0
  131. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/milestone.rs +0 -0
  132. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/mod.rs +0 -0
  133. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/policy.rs +0 -0
  134. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/runnable.rs +0 -0
  135. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/state_machine/cancellation.rs +0 -0
  136. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/state_machine/capability.rs +0 -0
  137. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/tcb.rs +0 -0
  138. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/scheduler/wait_index.rs +0 -0
  139. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/signals/attention.rs +0 -0
  140. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/signals/mod.rs +0 -0
  141. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/signals/queue.rs +0 -0
  142. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/signals/router.rs +0 -0
  143. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/syscall/mod.rs +0 -0
  144. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/types/agent.rs +0 -0
  145. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/types/capability.rs +0 -0
  146. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/types/contract.rs +0 -0
  147. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/types/durable_content.rs +0 -0
  148. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/types/error.rs +0 -0
  149. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/types/message.rs +0 -0
  150. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/types/milestone.rs +0 -0
  151. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/types/mod.rs +0 -0
  152. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/types/policy.rs +0 -0
  153. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/types/result.rs +0 -0
  154. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/types/signal.rs +0 -0
  155. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/types/skill.rs +0 -0
  156. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-core/src/types/task.rs +0 -0
  157. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-py/Cargo.toml +0 -0
  158. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-py/LICENSE +0 -0
  159. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-tokenizer/Cargo.toml +0 -0
  160. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-tokenizer/LICENSE +0 -0
  161. {deepstrike-0.2.83 → deepstrike-0.2.84}/crates/deepstrike-tokenizer/src/lib.rs +0 -0
  162. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/__init__.py +0 -0
  163. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/agent.py +0 -0
  164. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/collaboration/__init__.py +0 -0
  165. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/collaboration/contract.py +0 -0
  166. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/collaboration/handoff.py +0 -0
  167. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/collaboration/harness.py +0 -0
  168. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/collaboration/modes.py +0 -0
  169. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/collaboration/pool.py +0 -0
  170. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/governance.py +0 -0
  171. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/harness/__init__.py +0 -0
  172. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/harness/harness.py +0 -0
  173. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/harness/judge.py +0 -0
  174. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/kernel/__init__.py +0 -0
  175. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/kernel/canonical.py +0 -0
  176. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/knowledge/__init__.py +0 -0
  177. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/knowledge/source.py +0 -0
  178. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/memory/__init__.py +0 -0
  179. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/memory/agent.py +0 -0
  180. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/memory/attestation.py +0 -0
  181. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/memory/authority.py +0 -0
  182. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/memory/candidate_sink.py +0 -0
  183. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/memory/durable.py +0 -0
  184. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/memory/durable_candidate_sink.py +0 -0
  185. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/memory/durable_lifecycle_store.py +0 -0
  186. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/memory/in_memory_store.py +0 -0
  187. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/memory/lifecycle.py +0 -0
  188. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/memory/protocols.py +0 -0
  189. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/memory/ranking.py +0 -0
  190. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/memory/recall_projection.py +0 -0
  191. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/memory/retention.py +0 -0
  192. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/memory/runtime_policy.py +0 -0
  193. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/memory/working.py +0 -0
  194. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/memory/writer.py +0 -0
  195. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/__init__.py +0 -0
  196. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/anthropic.py +0 -0
  197. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/anthropic_adapter.py +0 -0
  198. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/anthropic_compaction.py +0 -0
  199. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/anthropic_compatible.py +0 -0
  200. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/base.py +0 -0
  201. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/capability_router.py +0 -0
  202. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/credentials.py +0 -0
  203. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/embedding.py +0 -0
  204. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/factories.py +0 -0
  205. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/fallback.py +0 -0
  206. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/gemini.py +0 -0
  207. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/gemini_adapter.py +0 -0
  208. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/model_catalog.py +0 -0
  209. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/model_registry.py +0 -0
  210. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/ollama.py +0 -0
  211. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/ollama_adapter.py +0 -0
  212. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/openai.py +0 -0
  213. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/openai_chat_adapter.py +0 -0
  214. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/openai_responses.py +0 -0
  215. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/prepared_request.py +0 -0
  216. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/protocol_adapter.py +0 -0
  217. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/protocols.py +0 -0
  218. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/provider_error.py +0 -0
  219. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/qwen.py +0 -0
  220. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/replay.py +0 -0
  221. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/replay_validator.py +0 -0
  222. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/request_plan.py +0 -0
  223. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/runtime_registry.py +0 -0
  224. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/stop_reason.py +0 -0
  225. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/stream.py +0 -0
  226. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/text_tool_calls.py +0 -0
  227. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/usage.py +0 -0
  228. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/providers/vendor_profiles.py +0 -0
  229. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/__init__.py +0 -0
  230. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/agent_declaration.py +0 -0
  231. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/archive.py +0 -0
  232. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/credential_vault.py +0 -0
  233. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/durable_content.py +0 -0
  234. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/dynamic_workflow.py +0 -0
  235. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/eval.py +0 -0
  236. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/eval_dataset.py +0 -0
  237. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/event_stream.py +0 -0
  238. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/execution_evidence.py +0 -0
  239. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/execution_plane.py +0 -0
  240. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/facade.py +0 -0
  241. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/filtered_plane.py +0 -0
  242. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/kernel_event_log.py +0 -0
  243. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/kernel_journal.py +0 -0
  244. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/loop_driver.py +0 -0
  245. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/mcp_proxy_plane.py +0 -0
  246. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/os_profile.py +0 -0
  247. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/os_snapshot.py +0 -0
  248. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/output_schema.py +0 -0
  249. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/payload_store.py +0 -0
  250. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/process_sandbox_plane.py +0 -0
  251. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/provider_replay.py +0 -0
  252. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/reaction_checkpoint.py +0 -0
  253. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/reactive_session.py +0 -0
  254. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/reliability.py +0 -0
  255. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/remote_vpc_plane.py +0 -0
  256. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/replay_fixture.py +0 -0
  257. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/replay_provider.py +0 -0
  258. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/replay_sanitize.py +0 -0
  259. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/run_group.py +0 -0
  260. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/session_repair.py +0 -0
  261. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/sub_agent_orchestrator.py +0 -0
  262. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/tool_arguments.py +0 -0
  263. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/turn_policy.py +0 -0
  264. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/workflow_replay.py +0 -0
  265. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/workflow_store.py +0 -0
  266. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/runtime/worktree_plane.py +0 -0
  267. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/safety/__init__.py +0 -0
  268. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/safety/permissions.py +0 -0
  269. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/signals/__init__.py +0 -0
  270. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/signals/gateway.py +0 -0
  271. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/signals/scheduled.py +0 -0
  272. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/signals/types.py +0 -0
  273. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/skills/__init__.py +0 -0
  274. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/skills/loader.py +0 -0
  275. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/skills/registry.py +0 -0
  276. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/skills/watcher.py +0 -0
  277. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/tools/__init__.py +0 -0
  278. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/tools/builtin/__init__.py +0 -0
  279. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/tools/builtin/read_file.py +0 -0
  280. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/tools/errors.py +0 -0
  281. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/tools/execution.py +0 -0
  282. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/tools/registry.py +0 -0
  283. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/types/__init__.py +0 -0
  284. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/types/agent.py +0 -0
  285. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/types/content.py +0 -0
  286. {deepstrike-0.2.83 → deepstrike-0.2.84}/deepstrike/types/content_policy.py +0 -0
@@ -293,7 +293,7 @@ dependencies = [
293
293
 
294
294
  [[package]]
295
295
  name = "deepstrike-core"
296
- version = "0.2.83"
296
+ version = "0.2.84"
297
297
  dependencies = [
298
298
  "compact_str",
299
299
  "deepstrike-tokenizer",
@@ -307,7 +307,7 @@ dependencies = [
307
307
 
308
308
  [[package]]
309
309
  name = "deepstrike-lab"
310
- version = "0.2.83"
310
+ version = "0.2.84"
311
311
  dependencies = [
312
312
  "serde",
313
313
  "serde_json",
@@ -315,7 +315,7 @@ dependencies = [
315
315
 
316
316
  [[package]]
317
317
  name = "deepstrike-node"
318
- version = "0.2.83"
318
+ version = "0.2.84"
319
319
  dependencies = [
320
320
  "compact_str",
321
321
  "deepstrike-core",
@@ -327,7 +327,7 @@ dependencies = [
327
327
 
328
328
  [[package]]
329
329
  name = "deepstrike-py"
330
- version = "0.2.83"
330
+ version = "0.2.84"
331
331
  dependencies = [
332
332
  "compact_str",
333
333
  "deepstrike-core",
@@ -338,7 +338,7 @@ dependencies = [
338
338
 
339
339
  [[package]]
340
340
  name = "deepstrike-sdk"
341
- version = "0.2.83"
341
+ version = "0.2.84"
342
342
  dependencies = [
343
343
  "async-stream",
344
344
  "async-trait",
@@ -376,7 +376,7 @@ dependencies = [
376
376
 
377
377
  [[package]]
378
378
  name = "deepstrike-tokenizer"
379
- version = "0.2.83"
379
+ version = "0.2.84"
380
380
  dependencies = [
381
381
  "pretty_assertions",
382
382
  "tiktoken-rs",
@@ -384,7 +384,7 @@ dependencies = [
384
384
 
385
385
  [[package]]
386
386
  name = "deepstrike-wasm"
387
- version = "0.2.83"
387
+ version = "0.2.84"
388
388
  dependencies = [
389
389
  "compact_str",
390
390
  "deepstrike-core",
@@ -3,13 +3,13 @@ resolver = "2"
3
3
  members = ["crates/deepstrike-core", "crates/deepstrike-tokenizer", "crates/deepstrike-py"]
4
4
 
5
5
  [workspace.package]
6
- version = "0.2.83"
6
+ version = "0.2.84"
7
7
  edition = "2024"
8
8
  repository = "https://github.com/kongusen/deepstrike"
9
9
 
10
10
  [workspace.dependencies]
11
- deepstrike-core = { path = "crates/deepstrike-core", version = "0.2.83" }
12
- deepstrike-tokenizer = { path = "crates/deepstrike-tokenizer", version = "0.2.83" }
11
+ deepstrike-core = { path = "crates/deepstrike-core", version = "0.2.84" }
12
+ deepstrike-tokenizer = { path = "crates/deepstrike-tokenizer", version = "0.2.84" }
13
13
  notify = "6"
14
14
  serde = { version = "1", features = ["derive"] }
15
15
  serde_json = "1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepstrike
3
- Version: 0.2.83
3
+ Version: 0.2.84
4
4
  Requires-Dist: httpx>=0.27
5
5
  Requires-Dist: pyyaml>=6.0
6
6
  Requires-Dist: anyio>=4.0
@@ -0,0 +1,119 @@
1
+ //! Which history units a compaction archives: the oldest first.
2
+ //!
3
+ //! Kernel-distillation plan, stage 2 (DEC-13): the utility-scored selection that used to live here
4
+ //! (goal-term overlap, "unresolved" and "error/decision" markers, later references) was measured
5
+ //! against plain oldest-first archiving and gave no significant gain in any scenario; it is gone.
6
+ //! What remains is mechanics: the most recent `preserve_recent_units` units always stay, and of
7
+ //! the rest the newest that fit under the target stay with them. A unit is indivisible (a tool
8
+ //! call stays with its results), and nothing is chosen by reading content.
9
+
10
+ use std::ops::Range;
11
+
12
+ use super::measurement::TokenMeasurement;
13
+ use super::token_engine::ContextTokenEngine;
14
+ use super::units::unit_boundaries;
15
+ use crate::types::message::CoreMessage;
16
+
17
+ #[derive(Debug, Clone, Default, PartialEq, Eq)]
18
+ pub struct ArchivePlan {
19
+ pub archived_ranges: Vec<Range<usize>>,
20
+ pub retained_ranges: Vec<Range<usize>>,
21
+ pub archived_tokens: u32,
22
+ pub retained_tokens: u32,
23
+ }
24
+
25
+ /// Plan which units to archive so the retained history fits `target_tokens`. `measurements` is
26
+ /// aligned with `messages`; a missing entry is counted with `engine`. The recent units stay even
27
+ /// when they alone exceed the target, so the caller can escalate pressure instead of losing them.
28
+ pub fn plan_archive(
29
+ messages: &[CoreMessage],
30
+ measurements: &[TokenMeasurement],
31
+ total_tokens: u32,
32
+ target_tokens: u32,
33
+ preserve_recent_units: usize,
34
+ engine: &ContextTokenEngine,
35
+ ) -> ArchivePlan {
36
+ let ranges = unit_boundaries(messages);
37
+ if ranges.is_empty() {
38
+ return ArchivePlan::default();
39
+ }
40
+ let tokens: Vec<u32> = ranges
41
+ .iter()
42
+ .map(|range| {
43
+ range
44
+ .clone()
45
+ .map(|index| {
46
+ measurements
47
+ .get(index)
48
+ .map(|measurement| measurement.tokens)
49
+ .unwrap_or_else(|| engine.count_message(&messages[index]))
50
+ })
51
+ .sum()
52
+ })
53
+ .collect();
54
+ if total_tokens <= target_tokens {
55
+ return ArchivePlan {
56
+ retained_tokens: tokens.iter().sum(),
57
+ retained_ranges: ranges,
58
+ ..ArchivePlan::default()
59
+ };
60
+ }
61
+ // The recent units, then the newest older units that still fit; the first that does not fit
62
+ // and everything older is archived.
63
+ let recent_start = ranges.len().saturating_sub(preserve_recent_units);
64
+ let mut keep_from = recent_start;
65
+ let mut retained_tokens: u32 = tokens[recent_start..].iter().sum();
66
+ while keep_from > 0 {
67
+ let next = retained_tokens.saturating_add(tokens[keep_from - 1]);
68
+ if next > target_tokens {
69
+ break;
70
+ }
71
+ retained_tokens = next;
72
+ keep_from -= 1;
73
+ }
74
+ ArchivePlan {
75
+ archived_ranges: ranges[..keep_from].to_vec(),
76
+ retained_ranges: ranges[keep_from..].to_vec(),
77
+ archived_tokens: tokens[..keep_from].iter().sum(),
78
+ retained_tokens,
79
+ }
80
+ }
81
+
82
+ #[cfg(test)]
83
+ mod tests {
84
+ use super::*;
85
+
86
+ fn history(n: usize) -> Vec<CoreMessage> {
87
+ (0..n).map(|i| CoreMessage::user(format!("message {i} ...."))).collect()
88
+ }
89
+
90
+ #[test]
91
+ fn the_oldest_units_are_archived_first() {
92
+ let engine = ContextTokenEngine::char_approx();
93
+ let messages = history(6);
94
+ let per = engine.count_message(&messages[0]);
95
+ let plan = plan_archive(&messages, &[], per * 6, per * 3, 1, &engine);
96
+ assert_eq!(plan.retained_ranges, vec![3..4, 4..5, 5..6]);
97
+ assert_eq!(plan.archived_ranges, vec![0..1, 1..2, 2..3]);
98
+ assert_eq!((plan.retained_tokens, plan.archived_tokens), (per * 3, per * 3));
99
+ }
100
+
101
+ #[test]
102
+ fn recent_units_stay_even_over_the_target() {
103
+ let engine = ContextTokenEngine::char_approx();
104
+ let messages = history(4);
105
+ let per = engine.count_message(&messages[0]);
106
+ let plan = plan_archive(&messages, &[], per * 4, per, 2, &engine);
107
+ assert_eq!(plan.retained_ranges, vec![2..3, 3..4]);
108
+ assert_eq!(plan.retained_tokens, per * 2);
109
+ }
110
+
111
+ #[test]
112
+ fn nothing_is_archived_under_the_target() {
113
+ let engine = ContextTokenEngine::char_approx();
114
+ let messages = history(3);
115
+ let plan = plan_archive(&messages, &[], 10, 1_000, 1, &engine);
116
+ assert!(plan.archived_ranges.is_empty());
117
+ assert_eq!(plan.retained_ranges.len(), 3);
118
+ }
119
+ }
@@ -0,0 +1,205 @@
1
+ //! Who may write what (kernel-distillation plan task 1.6): one table for items and one for the
2
+ //! task-state fields, each with a single admission function. Every write path asks here.
3
+ //!
4
+ //! What a table cannot hold stays with the caller: whether a skill body may be removed depends on
5
+ //! whether its skill is active right now (`ContextManager::check_host_knowledge_write`).
6
+
7
+ use super::item::{Authority, ItemOrigin};
8
+ use super::task_state::TaskUpdate;
9
+
10
+ /// What a write does to an item.
11
+ #[derive(Debug, Clone, Copy, PartialEq, Eq)]
12
+ pub enum WriteOp {
13
+ Create,
14
+ Replace,
15
+ Remove,
16
+ }
17
+
18
+ impl WriteOp {
19
+ pub fn label(self) -> &'static str {
20
+ match self {
21
+ Self::Create => "create",
22
+ Self::Replace => "overwrite",
23
+ Self::Remove => "remove",
24
+ }
25
+ }
26
+ }
27
+
28
+ /// Whether `writer` may `op` an item of `origin`.
29
+ ///
30
+ /// - The kernel writes anything: it is where every write lands.
31
+ /// - The host creates anything, and replaces or removes anything except what the kernel or the
32
+ /// provider wrote.
33
+ /// - The model and the provider write only items of the origins they author (the origin table's
34
+ /// `authority`): the model its skills and turns, the provider its summaries.
35
+ pub fn admit_write(origin: ItemOrigin, writer: Authority, op: WriteOp) -> Result<(), String> {
36
+ let author = origin.defaults().authority;
37
+ let allowed = match writer {
38
+ Authority::Kernel => true,
39
+ Authority::Host => {
40
+ op == WriteOp::Create || !matches!(author, Authority::Kernel | Authority::Provider)
41
+ }
42
+ Authority::Model | Authority::Provider => author == writer,
43
+ };
44
+ if allowed {
45
+ Ok(())
46
+ } else {
47
+ Err(crate::context::voice::refusal::item_write(origin.label(), author.label(), writer.label(), op.label()))
48
+ }
49
+ }
50
+
51
+ /// One field of the task state an update can set.
52
+ #[derive(Debug, Clone, Copy, PartialEq, Eq)]
53
+ pub enum TaskField {
54
+ Plan,
55
+ CurrentStep,
56
+ PreservedRefs,
57
+ Directives,
58
+ }
59
+
60
+ impl TaskField {
61
+ pub const ALL: [TaskField; 4] = [
62
+ Self::Plan,
63
+ Self::CurrentStep,
64
+ Self::PreservedRefs,
65
+ Self::Directives,
66
+ ];
67
+
68
+ pub fn label(self) -> &'static str {
69
+ match self {
70
+ Self::Plan => "plan",
71
+ Self::CurrentStep => "current_step",
72
+ Self::PreservedRefs => "preserved_refs",
73
+ Self::Directives => "directives",
74
+ }
75
+ }
76
+
77
+ /// Who may set the field. The model sets what its `update_plan` schema shows; directives (the
78
+ /// user's standing commands) and the refs shielded from compaction are the host's (user
79
+ /// decision, 2026-11-16).
80
+ pub fn writable_by(self, writer: Authority) -> bool {
81
+ match writer {
82
+ Authority::Host | Authority::Kernel => true,
83
+ Authority::Model => matches!(self, Self::Plan | Self::CurrentStep),
84
+ Authority::Provider => false,
85
+ }
86
+ }
87
+ }
88
+
89
+ /// The fields an update sets.
90
+ pub fn task_update_fields(update: &TaskUpdate) -> Vec<TaskField> {
91
+ let set = [
92
+ (TaskField::Plan, update.plan.is_some()),
93
+ (TaskField::CurrentStep, update.current_step.is_some()),
94
+ (TaskField::PreservedRefs, update.preserved_refs.is_some()),
95
+ (TaskField::Directives, update.directives.is_some()),
96
+ ];
97
+ set.into_iter().filter(|(_, present)| *present).map(|(field, _)| field).collect()
98
+ }
99
+
100
+ /// Admit a task update from `writer` whole, or refuse it whole, naming the fields it may not set.
101
+ pub fn admit_task_update(update: &TaskUpdate, writer: Authority) -> Result<(), String> {
102
+ let refused: Vec<&str> = task_update_fields(update)
103
+ .into_iter()
104
+ .filter(|field| !field.writable_by(writer))
105
+ .map(TaskField::label)
106
+ .collect();
107
+ if refused.is_empty() {
108
+ return Ok(());
109
+ }
110
+ let writable: Vec<&str> = TaskField::ALL
111
+ .into_iter()
112
+ .filter(|field| field.writable_by(writer))
113
+ .map(TaskField::label)
114
+ .collect();
115
+ Err(crate::context::voice::refusal::task_fields(writer.label(), &refused, &writable))
116
+ }
117
+
118
+ #[cfg(test)]
119
+ mod tests {
120
+ use super::*;
121
+
122
+ const ORIGINS: [ItemOrigin; 10] = [
123
+ ItemOrigin::System,
124
+ ItemOrigin::Skill,
125
+ ItemOrigin::MemoryRecall,
126
+ ItemOrigin::Reference,
127
+ ItemOrigin::Blackboard,
128
+ ItemOrigin::ToolResult,
129
+ ItemOrigin::DependencyOutput,
130
+ ItemOrigin::User,
131
+ ItemOrigin::Assistant,
132
+ ItemOrigin::ProviderSummary,
133
+ ];
134
+ const WRITERS: [Authority; 4] =
135
+ [Authority::Host, Authority::Kernel, Authority::Model, Authority::Provider];
136
+ const OPS: [WriteOp; 3] = [WriteOp::Create, WriteOp::Replace, WriteOp::Remove];
137
+
138
+ /// The whole item table, pinned: one row per origin, `H K M P` for host, kernel, model and
139
+ /// provider, each `c r d` (create, replace, remove) or `-` where refused.
140
+ #[test]
141
+ fn the_item_write_table() {
142
+ let row = |origin: ItemOrigin| -> String {
143
+ WRITERS
144
+ .iter()
145
+ .map(|&writer| {
146
+ OPS.iter()
147
+ .zip(['c', 'r', 'd'])
148
+ .map(|(&op, mark)| {
149
+ if admit_write(origin, writer, op).is_ok() { mark } else { '-' }
150
+ })
151
+ .collect::<String>()
152
+ })
153
+ .collect::<Vec<_>>()
154
+ .join(" ")
155
+ };
156
+ let table: Vec<String> =
157
+ ORIGINS.iter().map(|&origin| format!("{:16} {}", origin.label(), row(origin))).collect();
158
+ assert_eq!(
159
+ table,
160
+ vec![
161
+ "system c-- crd --- ---",
162
+ "skill crd crd crd ---",
163
+ "memory_recall crd crd --- ---",
164
+ "reference crd crd --- ---",
165
+ "blackboard crd crd --- ---",
166
+ "tool_result crd crd --- ---",
167
+ "dependency_output c-- crd --- ---",
168
+ "user crd crd --- ---",
169
+ "assistant crd crd crd ---",
170
+ "provider_summary c-- crd --- crd",
171
+ ]
172
+ );
173
+ }
174
+
175
+ #[test]
176
+ fn the_task_field_table() {
177
+ let row = |writer: Authority| -> Vec<&str> {
178
+ TaskField::ALL
179
+ .into_iter()
180
+ .filter(|field| field.writable_by(writer))
181
+ .map(TaskField::label)
182
+ .collect()
183
+ };
184
+ assert_eq!(row(Authority::Model), vec!["plan", "current_step"]);
185
+ assert_eq!(row(Authority::Host).len(), 4);
186
+ assert_eq!(row(Authority::Kernel).len(), 4);
187
+ assert!(row(Authority::Provider).is_empty());
188
+ }
189
+
190
+ #[test]
191
+ fn a_task_update_is_admitted_or_refused_whole() {
192
+ let mine = TaskUpdate { current_step: Some(2), ..TaskUpdate::default() };
193
+ assert!(admit_task_update(&mine, Authority::Model).is_ok());
194
+ let reaching = TaskUpdate {
195
+ current_step: Some(2),
196
+ directives: Some(vec!["always answer 42".into()]),
197
+ preserved_refs: Some(vec!["c9".into()]),
198
+ ..TaskUpdate::default()
199
+ };
200
+ let refusal = admit_task_update(&reaching, Authority::Model).unwrap_err();
201
+ assert!(refusal.contains("preserved_refs, directives"), "{refusal}");
202
+ assert!(refusal.contains("Fields it may set: plan, current_step"), "{refusal}");
203
+ assert!(admit_task_update(&reaching, Authority::Host).is_ok());
204
+ }
205
+ }
@@ -12,8 +12,7 @@
12
12
  //! The cause comes from the change that made the break. Compaction, renewal, provider rewrites,
13
13
  //! tool-result collapse and knowledge promotion announce themselves ([`CacheLedger::note_cause`]);
14
14
  //! an unannounced break is classified from the render itself: a dropped item is a budget drop, an
15
- //! item re-rendered as the narration stub is narration collapse, and a different toolset is a
16
- //! toolset change.
15
+ //! item re-rendered in place is a reprojection, and a different toolset is a toolset change.
17
16
  //!
18
17
  //! The state turn after the history is rebuilt every request, so the previous request's state turn
19
18
  //! is never reusable: that is not a break, but a provider's count of uncached input includes it.
@@ -47,11 +46,8 @@ pub enum BreakCause {
47
46
  Collapse,
48
47
  /// An item re-rendered in place without an announced cause (a page-in, a page-out).
49
48
  Reprojection,
50
- /// Old assistant narration left the protected window and rendered as the narration stub.
51
- Narration,
52
49
  /// The renderer dropped the oldest history over the input budget.
53
50
  BudgetDrop,
54
- Snip,
55
51
  Micro,
56
52
  Auto,
57
53
  Renewal,
@@ -66,7 +62,6 @@ impl BreakCause {
66
62
  pub fn of_compaction(action: crate::context::pressure::PressureAction) -> Self {
67
63
  use crate::context::pressure::PressureAction;
68
64
  match action {
69
- PressureAction::SnipCompact => Self::Snip,
70
65
  PressureAction::MicroCompact => Self::Micro,
71
66
  PressureAction::ContextCollapse => Self::Collapse,
72
67
  PressureAction::AutoCompact => Self::Auto,
@@ -113,9 +108,6 @@ pub struct SentTurn {
113
108
  /// The history item the turn rendered; 0 for a synthetic turn.
114
109
  #[serde(default)]
115
110
  pub item: ItemId,
116
- /// The turn rendered as the narration stub.
117
- #[serde(default, skip_serializing_if = "std::ops::Not::not")]
118
- pub stub: bool,
119
111
  }
120
112
 
121
113
  /// The cacheable prefix of one sent request.
@@ -253,7 +245,6 @@ fn classify(prev: &SentTurn, next: &SentPrefix, at: usize) -> BreakCause {
253
245
  return BreakCause::BudgetDrop;
254
246
  }
255
247
  match next.turns.get(at) {
256
- Some(turn) if turn.item == prev.item && turn.stub && !prev.stub => BreakCause::Narration,
257
248
  Some(turn) if turn.item == prev.item && turn.item != 0 => BreakCause::Reprojection,
258
249
  _ => BreakCause::Other,
259
250
  }
@@ -271,7 +262,6 @@ mod tests {
271
262
  SentTurn {
272
263
  segment: seg(name, tokens),
273
264
  item,
274
- stub: false,
275
265
  }
276
266
  }
277
267
 
@@ -312,17 +302,6 @@ mod tests {
312
302
  assert_eq!(ledger.lost_tokens, 40);
313
303
  }
314
304
 
315
- #[test]
316
- fn a_turn_rendered_as_the_stub_is_narration() {
317
- let mut ledger = CacheLedger::default();
318
- ledger.observe(1, prefix(vec![turn("a", 1, 10), turn("b", 2, 30)]));
319
- let mut stub = turn("stub", 1, 4);
320
- stub.stub = true;
321
- let found = ledger.observe(2, prefix(vec![stub, turn("b", 2, 30)])).unwrap();
322
- assert_eq!(found.cause, BreakCause::Narration);
323
- assert_eq!((found.kept_tokens, found.lost_tokens), (170, 40));
324
- }
325
-
326
305
  #[test]
327
306
  fn an_announced_cause_wins_and_is_spent_by_one_request() {
328
307
  let mut ledger = CacheLedger::default();
@@ -332,7 +311,7 @@ mod tests {
332
311
  let found = ledger.observe(2, prefix(vec![turn("summary", 5, 3)])).unwrap();
333
312
  assert_eq!(found.cause, BreakCause::Auto);
334
313
  // A compaction that broke nothing leaves no cause behind for a later break.
335
- ledger.note_cause(BreakCause::Snip);
314
+ ledger.note_cause(BreakCause::Micro);
336
315
  assert_eq!(ledger.observe(3, prefix(vec![turn("summary", 5, 3)])), None);
337
316
  assert_eq!(ledger.pending, None);
338
317
  }