deepstrike 0.2.83__tar.gz → 0.2.85__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.
- {deepstrike-0.2.83 → deepstrike-0.2.85}/Cargo.lock +7 -7
- {deepstrike-0.2.83 → deepstrike-0.2.85}/Cargo.toml +3 -3
- {deepstrike-0.2.83 → deepstrike-0.2.85}/PKG-INFO +6 -8
- {deepstrike-0.2.83 → deepstrike-0.2.85}/README.md +5 -7
- deepstrike-0.2.85/crates/deepstrike-core/src/context/archive.rs +119 -0
- deepstrike-0.2.85/crates/deepstrike-core/src/context/authority.rs +205 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/context/cache_ledger.rs +2 -23
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/context/compression.rs +64 -160
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/context/config.rs +11 -60
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/context/item.rs +4 -29
- deepstrike-0.2.85/crates/deepstrike-core/src/context/manager/cache.rs +84 -0
- deepstrike-0.2.85/crates/deepstrike-core/src/context/manager/capabilities.rs +295 -0
- deepstrike-0.2.85/crates/deepstrike-core/src/context/manager/handles.rs +157 -0
- deepstrike-0.2.85/crates/deepstrike-core/src/context/manager/items.rs +616 -0
- deepstrike-0.2.85/crates/deepstrike-core/src/context/manager/knowledge.rs +255 -0
- deepstrike-0.2.85/crates/deepstrike-core/src/context/manager/mod.rs +408 -0
- deepstrike-0.2.85/crates/deepstrike-core/src/context/manager/pressure.rs +230 -0
- deepstrike-0.2.85/crates/deepstrike-core/src/context/manager/report.rs +107 -0
- deepstrike-0.2.85/crates/deepstrike-core/src/context/manager/tests.rs +1321 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/context/mod.rs +3 -3
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/context/notes.rs +74 -79
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/context/partitions.rs +49 -28
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/context/pressure.rs +3 -11
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/context/renderer.rs +22 -481
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/context/renewal.rs +3 -6
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/context/skill_catalog.rs +2 -13
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/context/task_state.rs +8 -130
- deepstrike-0.2.85/crates/deepstrike-core/src/context/voice.rs +733 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/mm/handle.rs +41 -163
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/mm/mod.rs +1 -1
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/orchestration/workflow/mod.rs +5 -5
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/observation.rs +4 -2
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/checkpoint.rs +17 -11
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/command.rs +1 -7
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/config.rs +16 -50
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/driver/effects.rs +18 -22
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/driver/events.rs +10 -3
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/driver/planning.rs +1 -1
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/driver/projection.rs +12 -3
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/driver/provider.rs +35 -11
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/driver/syscall.rs +41 -42
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/driver/tests.rs +395 -18
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/driver.rs +33 -107
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/tests.rs +1 -1
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/session.rs +4 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/entropy.rs +3 -12
- deepstrike-0.2.85/crates/deepstrike-core/src/scheduler/rollback.rs +19 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/state_machine/eviction.rs +7 -33
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/state_machine/gate.rs +24 -17
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/state_machine/milestone_exec.rs +7 -15
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/state_machine/mod.rs +80 -146
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/state_machine/process.rs +5 -7
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/state_machine/signal.rs +5 -12
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/state_machine/tests.rs +12 -64
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/state_machine/workflow.rs +1 -8
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-py/src/lib.rs +1 -13
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/_session_event_registry.py +1 -2
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/canonical_kernel_step.py +11 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/context_policy.py +5 -18
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/dynamic_workflow.py +40 -2
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/kernel_step.py +0 -3
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/runner.py +3 -6
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/session_log.py +3 -8
- {deepstrike-0.2.83 → deepstrike-0.2.85}/pyproject.toml +1 -1
- deepstrike-0.2.83/crates/deepstrike-core/src/context/manager.rs +0 -3681
- deepstrike-0.2.83/crates/deepstrike-core/src/context/policy.rs +0 -139
- deepstrike-0.2.83/crates/deepstrike-core/src/context/summarizer.rs +0 -378
- deepstrike-0.2.83/crates/deepstrike-core/src/context/utility.rs +0 -491
- deepstrike-0.2.83/crates/deepstrike-core/src/scheduler/rollback.rs +0 -71
- {deepstrike-0.2.83 → deepstrike-0.2.85}/LICENSE +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/Cargo.toml +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/LICENSE +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/benches/kernel_baseline.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/benches/wait_index_baseline.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/benchmark/mod.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/context/fault.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/context/graph.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/context/measurement.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/context/text.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/context/token_engine.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/context/units.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/governance/constraint.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/governance/mod.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/governance/permission.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/governance/pipeline.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/governance/quota.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/governance/rate_limit.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/governance/repeat_fuse.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/governance/veto.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/harness/eval.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/harness/mod.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/lexical.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/lib.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/memory/curator.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/memory/durable.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/memory/mod.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/mm/memory.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/mm/memory_candidate.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/mm/value.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/orchestration/mod.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/orchestration/task_graph.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/orchestration/workflow/run.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/proc/mod.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/projection_pairs.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/event_log.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/binding.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/crash_point.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/driver/continuation.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/effect.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/envelope.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/event.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/fault.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/memory_authority.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/projection.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/record.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/restore.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/root.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/scalar.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/syscall.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/terminal.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire/transaction.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel/wire.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/kernel.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/mod.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/repair.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/replay.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/session_registry_tests.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/runtime/session_wire.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/budget_grant.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/cross_operation.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/mailbox.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/milestone.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/mod.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/policy.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/runnable.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/state_machine/cancellation.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/state_machine/capability.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/tcb.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/scheduler/wait_index.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/signals/attention.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/signals/mod.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/signals/queue.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/signals/router.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/syscall/mod.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/types/agent.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/types/capability.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/types/contract.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/types/durable_content.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/types/error.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/types/message.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/types/milestone.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/types/mod.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/types/policy.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/types/result.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/types/signal.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/types/skill.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-core/src/types/task.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-py/Cargo.toml +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-py/LICENSE +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-tokenizer/Cargo.toml +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-tokenizer/LICENSE +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/crates/deepstrike-tokenizer/src/lib.rs +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/__init__.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/agent.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/collaboration/__init__.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/collaboration/contract.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/collaboration/handoff.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/collaboration/harness.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/collaboration/modes.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/collaboration/pool.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/governance.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/harness/__init__.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/harness/harness.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/harness/judge.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/kernel/__init__.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/kernel/canonical.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/knowledge/__init__.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/knowledge/source.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/memory/__init__.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/memory/agent.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/memory/attestation.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/memory/authority.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/memory/candidate_sink.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/memory/durable.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/memory/durable_candidate_sink.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/memory/durable_lifecycle_store.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/memory/in_memory_store.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/memory/lifecycle.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/memory/protocols.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/memory/ranking.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/memory/recall_projection.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/memory/retention.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/memory/runtime_policy.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/memory/working.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/memory/writer.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/__init__.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/anthropic.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/anthropic_adapter.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/anthropic_compaction.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/anthropic_compatible.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/base.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/capability_router.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/credentials.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/embedding.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/factories.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/fallback.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/gemini.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/gemini_adapter.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/model_catalog.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/model_registry.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/ollama.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/ollama_adapter.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/openai.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/openai_chat_adapter.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/openai_responses.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/prepared_request.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/protocol_adapter.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/protocols.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/provider_error.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/qwen.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/replay.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/replay_validator.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/request_plan.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/runtime_registry.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/stop_reason.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/stream.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/text_tool_calls.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/usage.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/providers/vendor_profiles.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/__init__.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/agent_declaration.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/archive.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/credential_vault.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/durable_content.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/eval.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/eval_dataset.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/event_stream.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/execution_evidence.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/execution_plane.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/facade.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/filtered_plane.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/kernel_event_log.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/kernel_journal.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/loop_driver.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/mcp_proxy_plane.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/os_profile.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/os_snapshot.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/output_schema.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/payload_store.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/process_sandbox_plane.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/provider_replay.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/reaction_checkpoint.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/reactive_session.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/reliability.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/remote_vpc_plane.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/replay_fixture.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/replay_provider.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/replay_sanitize.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/run_group.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/session_repair.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/sub_agent_orchestrator.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/tool_arguments.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/turn_policy.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/workflow_replay.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/workflow_store.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/runtime/worktree_plane.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/safety/__init__.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/safety/permissions.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/signals/__init__.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/signals/gateway.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/signals/scheduled.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/signals/types.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/skills/__init__.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/skills/loader.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/skills/registry.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/skills/watcher.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/tools/__init__.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/tools/builtin/__init__.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/tools/builtin/read_file.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/tools/errors.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/tools/execution.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/tools/registry.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/types/__init__.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/types/agent.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/deepstrike/types/content.py +0 -0
- {deepstrike-0.2.83 → deepstrike-0.2.85}/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.
|
|
296
|
+
version = "0.2.85"
|
|
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.
|
|
310
|
+
version = "0.2.85"
|
|
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.
|
|
318
|
+
version = "0.2.85"
|
|
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.
|
|
330
|
+
version = "0.2.85"
|
|
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.
|
|
341
|
+
version = "0.2.85"
|
|
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.
|
|
379
|
+
version = "0.2.85"
|
|
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.
|
|
387
|
+
version = "0.2.85"
|
|
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.
|
|
6
|
+
version = "0.2.85"
|
|
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.
|
|
12
|
-
deepstrike-tokenizer = { path = "crates/deepstrike-tokenizer", version = "0.2.
|
|
11
|
+
deepstrike-core = { path = "crates/deepstrike-core", version = "0.2.85" }
|
|
12
|
+
deepstrike-tokenizer = { path = "crates/deepstrike-tokenizer", version = "0.2.85" }
|
|
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.
|
|
3
|
+
Version: 0.2.85
|
|
4
4
|
Requires-Dist: httpx>=0.27
|
|
5
5
|
Requires-Dist: pyyaml>=6.0
|
|
6
6
|
Requires-Dist: anyio>=4.0
|
|
@@ -13,15 +13,13 @@ License-File: LICENSE
|
|
|
13
13
|
Requires-Python: >=3.10
|
|
14
14
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
15
15
|
|
|
16
|
-
<p align="center">
|
|
17
|
-
<a href="https://github.com/kongusen/deepstrike">
|
|
18
|
-
<img src="https://raw.githubusercontent.com/kongusen/deepstrike/main/docs/public/banner.png" alt="DeepStrike" width="420" />
|
|
19
|
-
</a>
|
|
20
|
-
</p>
|
|
21
|
-
|
|
22
16
|
# DeepStrike Python SDK
|
|
23
17
|
|
|
24
|
-
Build Python
|
|
18
|
+
Build a Python assistant that can recall a project preference in a later session. With a memory store and candidate sink, your application reviews what gets saved and the model can open the full record when needed.
|
|
19
|
+
|
|
20
|
+
[Install](#install) · [Run a tool](#quick-start) · [Add memory](#memory) · [All SDKs and examples](https://github.com/kongusen/deepstrike#run-your-first-agent)
|
|
21
|
+
|
|
22
|
+

|
|
25
23
|
|
|
26
24
|
## Install
|
|
27
25
|
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<a href="https://github.com/kongusen/deepstrike">
|
|
3
|
-
<img src="https://raw.githubusercontent.com/kongusen/deepstrike/main/docs/public/banner.png" alt="DeepStrike" width="420" />
|
|
4
|
-
</a>
|
|
5
|
-
</p>
|
|
6
|
-
|
|
7
1
|
# DeepStrike Python SDK
|
|
8
2
|
|
|
9
|
-
Build Python
|
|
3
|
+
Build a Python assistant that can recall a project preference in a later session. With a memory store and candidate sink, your application reviews what gets saved and the model can open the full record when needed.
|
|
4
|
+
|
|
5
|
+
[Install](#install) · [Run a tool](#quick-start) · [Add memory](#memory) · [All SDKs and examples](https://github.com/kongusen/deepstrike#run-your-first-agent)
|
|
6
|
+
|
|
7
|
+

|
|
10
8
|
|
|
11
9
|
## Install
|
|
12
10
|
|
|
@@ -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
|
|
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::
|
|
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
|
}
|