deepstrike 0.2.74__tar.gz → 0.2.76__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.74 → deepstrike-0.2.76}/Cargo.lock +7 -6
- {deepstrike-0.2.74 → deepstrike-0.2.76}/Cargo.toml +3 -3
- {deepstrike-0.2.74 → deepstrike-0.2.76}/PKG-INFO +1 -1
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/context/manager.rs +35 -2
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/context/partitions.rs +23 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/context/renewal.rs +46 -25
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/context/token_engine.rs +72 -5
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/governance/pipeline.rs +21 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/mm/memory.rs +107 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/chain_validator/mod.rs +3 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/observation.rs +8 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/command.rs +24 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/config.rs +57 -8
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/crash_point.rs +2 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/driver/effects.rs +33 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/driver/events.rs +45 -6
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/driver/provider.rs +3 -1
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/driver/syscall.rs +115 -30
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/driver/tests.rs +682 -13
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/driver.rs +84 -17
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/effect.rs +15 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/event.rs +4 -0
- deepstrike-0.2.76/crates/deepstrike-core/src/runtime/kernel/wire/memory_authority.rs +174 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/projection.rs +2 -2
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/root.rs +7 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/scalar.rs +5 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire.rs +1 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/state_machine/mod.rs +88 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/state_machine/tests.rs +29 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-py/src/lib.rs +9 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/__init__.py +2 -1
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/governance.py +26 -38
- deepstrike-0.2.76/deepstrike/memory/authority.py +62 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/anthropic_adapter.py +4 -2
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/base.py +7 -5
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/openai.py +7 -4
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/openai_chat_adapter.py +3 -1
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/openai_responses.py +3 -1
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/qwen.py +5 -4
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/stream.py +3 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/canonical_kernel_step.py +341 -93
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/execution_plane.py +7 -1
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/kernel_journal.py +23 -1
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/kernel_step.py +6 -3
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/mcp_proxy_plane.py +4 -1
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/remote_vpc_plane.py +4 -1
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/replay_provider.py +8 -1
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/runner.py +468 -298
- deepstrike-0.2.76/deepstrike/runtime/tool_arguments.py +66 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/types/agent.py +10 -56
- {deepstrike-0.2.74 → deepstrike-0.2.76}/pyproject.toml +1 -1
- {deepstrike-0.2.74 → deepstrike-0.2.76}/LICENSE +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/README.md +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/Cargo.toml +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/LICENSE +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/benches/kernel_baseline.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/benches/verifiable_baseline.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/benches/wait_index_baseline.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/benchmark/mod.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/bin/deepstrike.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/bin/support/evidence_io.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/context/compression.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/context/config.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/context/execution.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/context/fault.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/context/measurement.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/context/mod.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/context/policy.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/context/pressure.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/context/renderer.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/context/skill_catalog.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/context/summarizer.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/context/task_state.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/context/text.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/context/units.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/context/utility.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/evolution.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/governance/constraint.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/governance/mod.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/governance/permission.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/governance/quota.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/governance/rate_limit.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/governance/repeat_fuse.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/governance/veto.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/harness/eval.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/harness/mod.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/lexical.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/lib.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/memory/curator.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/memory/durable.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/memory/mod.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/mm/handle.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/mm/mod.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/mm/value.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/orchestration/mod.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/orchestration/task_graph.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/orchestration/tournament.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/orchestration/workflow/mod.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/orchestration/workflow/run.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/proc/mod.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/projection_pairs.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/event_log.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/binding.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/checkpoint.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/driver/continuation.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/driver/planning.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/driver/projection.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/envelope.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/fault.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/record.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/restore.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/syscall.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/terminal.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/tests.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/transaction.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/mod.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/repair.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/replay.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/session.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/verifiable.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/budget_grant.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/cross_operation.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/entropy.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/mailbox.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/milestone.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/mod.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/policy.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/rollback.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/runnable.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/state_machine/cancellation.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/state_machine/capability.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/state_machine/eviction.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/state_machine/gate.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/state_machine/milestone_exec.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/state_machine/process.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/state_machine/signal.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/state_machine/workflow.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/tcb.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/scheduler/wait_index.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/signals/attention.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/signals/mod.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/signals/queue.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/signals/router.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/syscall/mod.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/types/agent.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/types/capability.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/types/contract.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/types/durable_content.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/types/error.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/types/message.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/types/milestone.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/types/mod.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/types/policy.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/types/result.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/types/signal.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/types/skill.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/types/task.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-py/Cargo.toml +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-py/LICENSE +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-tokenizer/Cargo.toml +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-tokenizer/LICENSE +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-tokenizer/src/lib.rs +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/agent.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/collaboration/__init__.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/collaboration/contract.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/collaboration/handoff.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/collaboration/harness.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/collaboration/modes.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/collaboration/pool.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/harness/__init__.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/harness/harness.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/harness/judge.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/kernel/__init__.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/kernel/canonical.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/knowledge/__init__.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/knowledge/source.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/memory/__init__.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/memory/agent.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/memory/durable.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/memory/extraction.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/memory/in_memory_store.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/memory/protocols.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/memory/ranking.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/memory/retention.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/memory/working.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/__init__.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/anthropic.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/anthropic_compatible.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/capability_router.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/credentials.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/embedding.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/factories.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/fallback.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/gemini.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/gemini_adapter.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/model_catalog.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/model_registry.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/ollama.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/ollama_adapter.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/prepared_request.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/protocol_adapter.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/protocols.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/provider_error.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/replay.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/replay_validator.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/request_plan.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/runtime_registry.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/stop_reason.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/usage.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/providers/vendor_profiles.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/__init__.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/agent_declaration.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/archive.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/context.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/context_policy.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/credential_vault.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/durable_content.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/eval.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/eval_dataset.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/event_stream.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/evolution.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/execution_evidence.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/facade.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/filtered_plane.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/kernel_event_log.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/loop_driver.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/os_profile.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/os_snapshot.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/output_schema.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/payload_store.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/process_sandbox_plane.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/provider_replay.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/reaction_checkpoint.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/reactive_session.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/reducers.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/reliability.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/replay_fixture.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/replay_sanitize.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/run_group.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/session_log.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/session_repair.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/sub_agent_orchestrator.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/turn_policy.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/verifiable_report.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/workflow_control_flow.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/workflow_replay.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/workflow_store.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/runtime/worktree_plane.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/safety/__init__.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/safety/permissions.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/signals/__init__.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/signals/gateway.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/signals/scheduled.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/signals/types.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/skills/__init__.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/skills/loader.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/skills/registry.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/skills/watcher.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/tools/__init__.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/tools/builtin/__init__.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/tools/builtin/read_file.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/tools/errors.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/tools/execution.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/tools/registry.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/types/__init__.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/types/content.py +0 -0
- {deepstrike-0.2.74 → deepstrike-0.2.76}/deepstrike/types/content_policy.py +0 -0
|
@@ -254,7 +254,7 @@ dependencies = [
|
|
|
254
254
|
|
|
255
255
|
[[package]]
|
|
256
256
|
name = "deepstrike-core"
|
|
257
|
-
version = "0.2.
|
|
257
|
+
version = "0.2.76"
|
|
258
258
|
dependencies = [
|
|
259
259
|
"compact_str",
|
|
260
260
|
"deepstrike-tokenizer",
|
|
@@ -268,7 +268,7 @@ dependencies = [
|
|
|
268
268
|
|
|
269
269
|
[[package]]
|
|
270
270
|
name = "deepstrike-node"
|
|
271
|
-
version = "0.2.
|
|
271
|
+
version = "0.2.76"
|
|
272
272
|
dependencies = [
|
|
273
273
|
"compact_str",
|
|
274
274
|
"deepstrike-core",
|
|
@@ -280,7 +280,7 @@ dependencies = [
|
|
|
280
280
|
|
|
281
281
|
[[package]]
|
|
282
282
|
name = "deepstrike-py"
|
|
283
|
-
version = "0.2.
|
|
283
|
+
version = "0.2.76"
|
|
284
284
|
dependencies = [
|
|
285
285
|
"compact_str",
|
|
286
286
|
"deepstrike-core",
|
|
@@ -291,10 +291,11 @@ dependencies = [
|
|
|
291
291
|
|
|
292
292
|
[[package]]
|
|
293
293
|
name = "deepstrike-sdk"
|
|
294
|
-
version = "0.2.
|
|
294
|
+
version = "0.2.76"
|
|
295
295
|
dependencies = [
|
|
296
296
|
"async-stream",
|
|
297
297
|
"async-trait",
|
|
298
|
+
"base64 0.22.1",
|
|
298
299
|
"bytes",
|
|
299
300
|
"compact_str",
|
|
300
301
|
"deepstrike-core",
|
|
@@ -327,7 +328,7 @@ dependencies = [
|
|
|
327
328
|
|
|
328
329
|
[[package]]
|
|
329
330
|
name = "deepstrike-tokenizer"
|
|
330
|
-
version = "0.2.
|
|
331
|
+
version = "0.2.76"
|
|
331
332
|
dependencies = [
|
|
332
333
|
"pretty_assertions",
|
|
333
334
|
"tiktoken-rs",
|
|
@@ -335,7 +336,7 @@ dependencies = [
|
|
|
335
336
|
|
|
336
337
|
[[package]]
|
|
337
338
|
name = "deepstrike-wasm"
|
|
338
|
-
version = "0.2.
|
|
339
|
+
version = "0.2.76"
|
|
339
340
|
dependencies = [
|
|
340
341
|
"compact_str",
|
|
341
342
|
"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.76"
|
|
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.76" }
|
|
12
|
+
deepstrike-tokenizer = { path = "crates/deepstrike-tokenizer", version = "0.2.76" }
|
|
13
13
|
notify = "6"
|
|
14
14
|
serde = { version = "1", features = ["derive"] }
|
|
15
15
|
serde_json = "1"
|
|
@@ -367,11 +367,14 @@ impl ContextManager {
|
|
|
367
367
|
/// from *this* value, so it must NOT discount paged content (else collapse → rho drops →
|
|
368
368
|
/// un-collapse would oscillate).
|
|
369
369
|
pub fn rho(&self) -> f64 {
|
|
370
|
-
self.pressure.pressure(
|
|
370
|
+
let observed = self.pressure.pressure(
|
|
371
371
|
&self.partitions,
|
|
372
372
|
&self.engine,
|
|
373
373
|
self.last_observed_prompt_tokens,
|
|
374
|
-
)
|
|
374
|
+
);
|
|
375
|
+
// A provider sees a selected projection, not the entire resident history. Its smaller
|
|
376
|
+
// count must not suppress compaction while the unselected history still triggers renewal.
|
|
377
|
+
observed.max(self.pressure.pressure(&self.partitions, &self.engine, None))
|
|
375
378
|
}
|
|
376
379
|
|
|
377
380
|
pub fn set_observed_prompt_tokens(&mut self, tokens: u32) {
|
|
@@ -427,6 +430,10 @@ impl ContextManager {
|
|
|
427
430
|
target_tokens,
|
|
428
431
|
&self.engine,
|
|
429
432
|
);
|
|
433
|
+
if result.0 > 0 || !result.2.is_empty() {
|
|
434
|
+
// The measurement describes the request before this rewrite, not the new context.
|
|
435
|
+
self.last_observed_prompt_tokens = None;
|
|
436
|
+
}
|
|
430
437
|
if let Some(ts) = now_ms {
|
|
431
438
|
self.last_compact_ms = Some(ts);
|
|
432
439
|
}
|
|
@@ -475,6 +482,7 @@ impl ContextManager {
|
|
|
475
482
|
.renewal
|
|
476
483
|
.renew(&self.partitions, self.max_tokens, &self.engine);
|
|
477
484
|
self.sprint += 1;
|
|
485
|
+
self.last_observed_prompt_tokens = None;
|
|
478
486
|
// History was rebuilt wholesale — drop handles anchored to messages it no longer carries,
|
|
479
487
|
// and start a fresh collapse generation (P0-C) since the whole prefix changed.
|
|
480
488
|
self.prune_orphaned_handles();
|
|
@@ -994,6 +1002,17 @@ impl ContextManager {
|
|
|
994
1002
|
.is_none()
|
|
995
1003
|
}
|
|
996
1004
|
|
|
1005
|
+
/// A refused `skill` activation: withdraw the `skill:<name>` knowledge the host staged for it,
|
|
1006
|
+
/// unless the skill is already active under an earlier admission.
|
|
1007
|
+
pub fn retract_refused_skill(&mut self, name: &str) -> bool {
|
|
1008
|
+
if self.active_skills.contains_key(name) {
|
|
1009
|
+
return false;
|
|
1010
|
+
}
|
|
1011
|
+
self.partitions
|
|
1012
|
+
.knowledge
|
|
1013
|
+
.retract_staged(&format!("skill:{name}"))
|
|
1014
|
+
}
|
|
1015
|
+
|
|
997
1016
|
/// K3: deactivate a skill — the toolset re-widens at the next `emit_call_llm` (an epoch event,
|
|
998
1017
|
/// same cache cost class as activation) and the skill's `skill:<name>` knowledge pin is marked
|
|
999
1018
|
/// for the next boundary sweep. Errs-open: not-active is a no-op (returns false).
|
|
@@ -1239,6 +1258,20 @@ mod tests {
|
|
|
1239
1258
|
use crate::types::message::CoreMessage;
|
|
1240
1259
|
use crate::types::skill::SkillMetadata;
|
|
1241
1260
|
|
|
1261
|
+
#[test]
|
|
1262
|
+
fn low_provider_usage_does_not_hide_resident_history_pressure() {
|
|
1263
|
+
let mut mgr = ContextManager::with_config(
|
|
1264
|
+
1_000,
|
|
1265
|
+
ContextConfig::default(),
|
|
1266
|
+
ContextTokenEngine::char_approx(),
|
|
1267
|
+
);
|
|
1268
|
+
mgr.push_history(CoreMessage::user("large history"), 1_100);
|
|
1269
|
+
mgr.set_observed_prompt_tokens(10);
|
|
1270
|
+
assert_eq!(mgr.should_compress(), PressureAction::AutoCompact);
|
|
1271
|
+
mgr.compress(PressureAction::AutoCompact);
|
|
1272
|
+
assert!(!mgr.should_renew());
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1242
1275
|
#[test]
|
|
1243
1276
|
fn preparation_freezes_state_plan_and_render_identity() {
|
|
1244
1277
|
let mut mgr = ContextManager::new(100_000);
|
|
@@ -209,6 +209,29 @@ impl KnowledgePartition {
|
|
|
209
209
|
}))
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
+
/// Withdraw content staged under `key` for something the kernel then refused (a skill whose
|
|
213
|
+
/// activation was rejected). A freshly appended entry has never been rendered, so it is dropped
|
|
214
|
+
/// outright; an existing entry keeps its rendered bytes, loses the staged upsert, and leaves at
|
|
215
|
+
/// the next boundary. Returns whether anything was withdrawn.
|
|
216
|
+
pub fn retract_staged(&mut self, key: &str) -> bool {
|
|
217
|
+
let Some(index) = self
|
|
218
|
+
.entries
|
|
219
|
+
.iter()
|
|
220
|
+
.position(|entry| entry.key.as_deref() == Some(key))
|
|
221
|
+
else {
|
|
222
|
+
return false;
|
|
223
|
+
};
|
|
224
|
+
let entry = &mut self.entries[index];
|
|
225
|
+
if entry.pending.take().is_some() {
|
|
226
|
+
entry.evict_at_boundary = true;
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
let tokens = entry.tokens;
|
|
230
|
+
self.entries.remove(index);
|
|
231
|
+
self.token_count = self.token_count.saturating_sub(tokens);
|
|
232
|
+
true
|
|
233
|
+
}
|
|
234
|
+
|
|
212
235
|
/// Mark the keyed entry for removal at the next boundary. Errs-open: unknown key is a no-op.
|
|
213
236
|
/// Returns whether a matching entry was marked.
|
|
214
237
|
pub fn remove(&mut self, key: &str) -> bool {
|
|
@@ -61,31 +61,25 @@ impl RenewalPolicy {
|
|
|
61
61
|
// History: carry recent turns up to carryover budget.
|
|
62
62
|
let carryover_budget = config.carryover_tokens(max_tokens);
|
|
63
63
|
let mut remaining = carryover_budget;
|
|
64
|
-
let
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
.
|
|
80
|
-
(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
)
|
|
84
|
-
})
|
|
85
|
-
.collect();
|
|
86
|
-
carried.reverse();
|
|
87
|
-
for (msg, t) in carried {
|
|
88
|
-
renewed.history.push(msg, t);
|
|
64
|
+
let messages = &partitions.history.messages;
|
|
65
|
+
let mut start = messages.len();
|
|
66
|
+
// Carry whole conversational transactions, so a budget boundary cannot strand a result
|
|
67
|
+
// without its assistant call (or omit one result of a parallel call batch).
|
|
68
|
+
for unit in super::units::unit_boundaries(messages).into_iter().rev() {
|
|
69
|
+
let tokens = unit.clone().fold(0u32, |sum, index| {
|
|
70
|
+
sum.saturating_add(partitions.history.measured_tokens(index, engine))
|
|
71
|
+
});
|
|
72
|
+
if tokens > remaining {
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
remaining = remaining.saturating_sub(tokens);
|
|
76
|
+
start = unit.start;
|
|
77
|
+
}
|
|
78
|
+
for (index, msg) in messages.iter().enumerate().skip(start) {
|
|
79
|
+
renewed.history.push(
|
|
80
|
+
msg.clone(),
|
|
81
|
+
partitions.history.measured_tokens(index, engine),
|
|
82
|
+
);
|
|
89
83
|
}
|
|
90
84
|
|
|
91
85
|
renewed
|
|
@@ -147,6 +141,33 @@ mod tests {
|
|
|
147
141
|
assert!(renewed.history.token_count <= 100);
|
|
148
142
|
}
|
|
149
143
|
|
|
144
|
+
#[test]
|
|
145
|
+
fn renewal_never_carries_a_tool_result_without_its_call() {
|
|
146
|
+
use crate::types::message::{ContentPart, ToolCall};
|
|
147
|
+
let mut ctx = ContextPartitions::new(&ContextConfig::default());
|
|
148
|
+
ctx.history.push(CoreMessage::user("read"), 10);
|
|
149
|
+
let mut call = CoreMessage::assistant("");
|
|
150
|
+
call.tool_calls.push(ToolCall {
|
|
151
|
+
id: "call-1".into(),
|
|
152
|
+
name: "read".into(),
|
|
153
|
+
arguments: serde_json::json!({}),
|
|
154
|
+
});
|
|
155
|
+
ctx.history.push(call, 80);
|
|
156
|
+
ctx.history.push(
|
|
157
|
+
CoreMessage::tool(vec![ContentPart::ToolResult {
|
|
158
|
+
call_id: "call-1".into(),
|
|
159
|
+
output: "result".into(),
|
|
160
|
+
is_error: false,
|
|
161
|
+
durable_content: None,
|
|
162
|
+
}]),
|
|
163
|
+
40,
|
|
164
|
+
);
|
|
165
|
+
let renewed = make_policy(0.1).renew(&ctx, 1_000, &ContextTokenEngine::char_approx());
|
|
166
|
+
assert!(crate::context::units::strict_tool_pairing_is_valid(
|
|
167
|
+
&renewed.history.messages
|
|
168
|
+
));
|
|
169
|
+
}
|
|
170
|
+
|
|
150
171
|
#[test]
|
|
151
172
|
fn renewal_clears_task_scratchpad_keeps_goal() {
|
|
152
173
|
let cfg = ContextConfig::default();
|
|
@@ -44,7 +44,7 @@ impl TokenCounter for CharApproxCounter {
|
|
|
44
44
|
/// implementation applies the same 0.25 tokens/char divisor to every script). This wraps
|
|
45
45
|
/// `deepstrike-tokenizer`'s real cl100k BPE tokenizer (previously an orphaned crate — not a
|
|
46
46
|
/// workspace member, zero call sites anywhere) and adds a fixed margin on top. That only
|
|
47
|
-
/// guarantees a value above
|
|
47
|
+
/// guarantees a value above its chunked `cl100k_base` estimate; it does not prove that the
|
|
48
48
|
/// result is conservative for every provider model. Native Anthropic/Gemini token counts take
|
|
49
49
|
/// precedence where callers explicitly request them.
|
|
50
50
|
pub struct FallbackEstimator {
|
|
@@ -69,17 +69,54 @@ impl Default for FallbackEstimator {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
/// Bound BPE merge work for long unbroken tool output. Chunk boundaries are UTF-8-safe and
|
|
73
|
+
/// deterministic; boundary merges are deliberately sacrificed by this heuristic estimator.
|
|
74
|
+
fn estimation_chunks(mut text: &str) -> impl Iterator<Item = &str> {
|
|
75
|
+
std::iter::from_fn(move || {
|
|
76
|
+
if text.is_empty() {
|
|
77
|
+
return None;
|
|
78
|
+
}
|
|
79
|
+
let mut end = text.len().min(1_024);
|
|
80
|
+
while !text.is_char_boundary(end) {
|
|
81
|
+
end -= 1;
|
|
82
|
+
}
|
|
83
|
+
let (chunk, rest) = text.split_at(end);
|
|
84
|
+
text = rest;
|
|
85
|
+
Some(chunk)
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
|
|
72
89
|
impl TokenCounter for FallbackEstimator {
|
|
73
90
|
fn count(&self, text: &str) -> u32 {
|
|
74
|
-
let raw =
|
|
75
|
-
|
|
91
|
+
let raw = estimation_chunks(text).fold(0u32, |sum, chunk| {
|
|
92
|
+
sum.saturating_add(self.tokenizer.count(chunk))
|
|
93
|
+
});
|
|
94
|
+
((raw as f64 * self.safety_margin).ceil() as u32).max(1)
|
|
76
95
|
}
|
|
77
96
|
|
|
78
97
|
fn truncate<'a>(&self, text: &'a str, max_tokens: u32) -> &'a str {
|
|
79
98
|
// Budget in *raw* BPE tokens so that, after the margin is applied by `count`, the
|
|
80
99
|
// truncated text's reported count still fits within `max_tokens`.
|
|
81
100
|
let raw_budget = ((max_tokens as f64) / self.safety_margin).floor() as u32;
|
|
82
|
-
|
|
101
|
+
let mut remaining = raw_budget;
|
|
102
|
+
let mut end = 0;
|
|
103
|
+
for chunk in estimation_chunks(text) {
|
|
104
|
+
let tokens = self.tokenizer.count(chunk);
|
|
105
|
+
if tokens <= remaining {
|
|
106
|
+
remaining -= tokens;
|
|
107
|
+
end += chunk.len();
|
|
108
|
+
} else {
|
|
109
|
+
let mut prefix_end = self.tokenizer.truncate(chunk, remaining).len();
|
|
110
|
+
// Retokenizing a prefix can change its last merge. Enforce the same count budget
|
|
111
|
+
// on the returned prefix, without ever processing another unbounded string.
|
|
112
|
+
while prefix_end > 0 && self.tokenizer.count(&chunk[..prefix_end]) > remaining {
|
|
113
|
+
prefix_end = chunk[..prefix_end].char_indices().next_back().unwrap().0;
|
|
114
|
+
}
|
|
115
|
+
end += prefix_end;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
&text[..end]
|
|
83
120
|
}
|
|
84
121
|
}
|
|
85
122
|
|
|
@@ -101,7 +138,12 @@ impl ContextTokenEngine {
|
|
|
101
138
|
/// [`FallbackEstimator`]), replacing the previous `char_approx()` default that
|
|
102
139
|
/// underestimated CJK-heavy text by 40-70%.
|
|
103
140
|
pub fn fallback_estimator() -> Self {
|
|
104
|
-
|
|
141
|
+
static COUNTER: std::sync::OnceLock<Arc<dyn TokenCounter>> = std::sync::OnceLock::new();
|
|
142
|
+
Self(
|
|
143
|
+
COUNTER
|
|
144
|
+
.get_or_init(|| Arc::new(FallbackEstimator::default()))
|
|
145
|
+
.clone(),
|
|
146
|
+
)
|
|
105
147
|
}
|
|
106
148
|
|
|
107
149
|
pub fn count(&self, text: &str) -> u32 {
|
|
@@ -186,6 +228,31 @@ fn modality_estimate_tokens(part: &ContentPart) -> Option<u32> {
|
|
|
186
228
|
#[cfg(test)]
|
|
187
229
|
mod tests {
|
|
188
230
|
use super::*;
|
|
231
|
+
|
|
232
|
+
#[test]
|
|
233
|
+
fn default_engines_share_the_immutable_bpe_tables() {
|
|
234
|
+
let first = ContextTokenEngine::fallback_estimator();
|
|
235
|
+
let second = ContextTokenEngine::fallback_estimator();
|
|
236
|
+
assert!(
|
|
237
|
+
Arc::ptr_eq(&first.0, &second.0),
|
|
238
|
+
"starting or restoring an operation must not reload the tokenizer tables"
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
#[test]
|
|
243
|
+
fn large_unbroken_estimates_are_bounded_and_truncation_remains_utf8_safe() {
|
|
244
|
+
let estimator = FallbackEstimator::default();
|
|
245
|
+
let started = std::time::Instant::now();
|
|
246
|
+
assert!(estimator.count(&"y".repeat(100 * 1024)) > 20_000);
|
|
247
|
+
assert!(
|
|
248
|
+
started.elapsed() < std::time::Duration::from_secs(10),
|
|
249
|
+
"100 KiB of unbroken tool output must not stall the host for tens of seconds"
|
|
250
|
+
);
|
|
251
|
+
let text = "核实需求与运行结果🙂".repeat(2_000);
|
|
252
|
+
let truncated = estimator.truncate(&text, 2_000);
|
|
253
|
+
assert!(text.starts_with(truncated));
|
|
254
|
+
assert!(estimator.count(truncated) <= 2_000);
|
|
255
|
+
}
|
|
189
256
|
use crate::types::message::{ContentPart, CoreMessage};
|
|
190
257
|
|
|
191
258
|
fn engine() -> ContextTokenEngine {
|
|
@@ -14,6 +14,8 @@ pub struct GovernancePipeline {
|
|
|
14
14
|
pub veto: VetoAuthority,
|
|
15
15
|
pub rate_limiter: RateLimiter,
|
|
16
16
|
pub constraints: ConstraintValidator,
|
|
17
|
+
/// Withhold statically denied tools from the provider surface (see [`Self::denies_tool`]).
|
|
18
|
+
pub hide_denied_tools: bool,
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
fn severity(v: &GovernanceVerdict) -> u8 {
|
|
@@ -32,9 +34,28 @@ impl GovernancePipeline {
|
|
|
32
34
|
veto: VetoAuthority::new(),
|
|
33
35
|
rate_limiter: RateLimiter::default(),
|
|
34
36
|
constraints: ConstraintValidator::new(),
|
|
37
|
+
hide_denied_tools: false,
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
|
|
41
|
+
/// Whether every call to `name` is denied regardless of its arguments or timing — a veto or a
|
|
42
|
+
/// `deny` permission. Argument constraints and rate limits are per-call, and `ask_user` is a
|
|
43
|
+
/// runtime decision, so none of them make a tool statically unusable.
|
|
44
|
+
pub fn denies_tool(&self, name: &str) -> bool {
|
|
45
|
+
let probe = ToolCall {
|
|
46
|
+
id: "governance-surface".into(),
|
|
47
|
+
name: name.into(),
|
|
48
|
+
arguments: serde_json::Value::Null,
|
|
49
|
+
};
|
|
50
|
+
matches!(
|
|
51
|
+
self.veto.check(&probe),
|
|
52
|
+
Some(GovernanceVerdict::Deny { .. })
|
|
53
|
+
) || matches!(
|
|
54
|
+
self.permission.check(&probe),
|
|
55
|
+
Some(GovernanceVerdict::Deny { .. })
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
38
59
|
/// Set the current timestamp for rate limiting.
|
|
39
60
|
pub fn set_time(&mut self, now_ms: u64) {
|
|
40
61
|
self.rate_limiter.set_time(now_ms);
|
|
@@ -393,6 +393,65 @@ pub struct MemoryRecallLifecycle {
|
|
|
393
393
|
pub last_recalled_at: u64,
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
+
/// What the host's store holds for one record it just recalled — the only input the recall
|
|
397
|
+
/// lifecycle needs. The store reports state; it never reports the *next* state.
|
|
398
|
+
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
399
|
+
#[serde(deny_unknown_fields)]
|
|
400
|
+
pub struct MemoryRecallPrior {
|
|
401
|
+
pub record_id: String,
|
|
402
|
+
#[serde(default)]
|
|
403
|
+
pub recall_count: u64,
|
|
404
|
+
#[serde(default)]
|
|
405
|
+
pub pinned: bool,
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/// A recalled record whose count crossed the promotion threshold on this recall (M4).
|
|
409
|
+
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
410
|
+
#[serde(deny_unknown_fields)]
|
|
411
|
+
pub struct MemoryPromotion {
|
|
412
|
+
pub record_id: String,
|
|
413
|
+
pub recall_count: u64,
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/// M3/M4 · the one derivation of a recall's lifecycle, shared by the model's `query_memory`
|
|
417
|
+
/// syscall and every host recall route.
|
|
418
|
+
///
|
|
419
|
+
/// Each distinct record counts once per derivation however many hits named it, so a prefetch that
|
|
420
|
+
/// issues several overlapping queries cannot inflate a count. Promotion is edge-triggered — it is
|
|
421
|
+
/// suggested on the recall that crosses the threshold, never again on later ones — and a pinned
|
|
422
|
+
/// record is never suggested, because it is already where a promotion would put it.
|
|
423
|
+
pub fn derive_recall_lifecycle(
|
|
424
|
+
priors: &[MemoryRecallPrior],
|
|
425
|
+
recalled_at: u64,
|
|
426
|
+
promotion_threshold: Option<u64>,
|
|
427
|
+
) -> (Vec<MemoryRecallLifecycle>, Vec<MemoryPromotion>) {
|
|
428
|
+
let mut seen = std::collections::BTreeSet::new();
|
|
429
|
+
let mut recalls = Vec::with_capacity(priors.len());
|
|
430
|
+
let mut promotions = Vec::new();
|
|
431
|
+
for prior in priors {
|
|
432
|
+
if !seen.insert(prior.record_id.as_str()) {
|
|
433
|
+
continue;
|
|
434
|
+
}
|
|
435
|
+
let recall_count = prior.recall_count.saturating_add(1);
|
|
436
|
+
recalls.push(MemoryRecallLifecycle {
|
|
437
|
+
record_id: prior.record_id.clone(),
|
|
438
|
+
recall_count,
|
|
439
|
+
last_recalled_at: recalled_at,
|
|
440
|
+
});
|
|
441
|
+
if let Some(threshold) = promotion_threshold
|
|
442
|
+
&& !prior.pinned
|
|
443
|
+
&& prior.recall_count < threshold
|
|
444
|
+
&& recall_count >= threshold
|
|
445
|
+
{
|
|
446
|
+
promotions.push(MemoryPromotion {
|
|
447
|
+
record_id: prior.record_id.clone(),
|
|
448
|
+
recall_count,
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
(recalls, promotions)
|
|
453
|
+
}
|
|
454
|
+
|
|
396
455
|
/// Memory validation error.
|
|
397
456
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
398
457
|
#[serde(tag = "error_kind", rename_all = "snake_case")]
|
|
@@ -770,4 +829,52 @@ mod tests {
|
|
|
770
829
|
));
|
|
771
830
|
assert_eq!(store.len(), 1);
|
|
772
831
|
}
|
|
832
|
+
|
|
833
|
+
fn prior(record_id: &str, recall_count: u64, pinned: bool) -> MemoryRecallPrior {
|
|
834
|
+
MemoryRecallPrior {
|
|
835
|
+
record_id: record_id.into(),
|
|
836
|
+
recall_count,
|
|
837
|
+
pinned,
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
#[test]
|
|
842
|
+
fn a_recall_counts_each_record_once_and_suggests_promotion_only_on_the_crossing() {
|
|
843
|
+
let (recalls, promotions) = derive_recall_lifecycle(
|
|
844
|
+
&[
|
|
845
|
+
prior("crossing", 2, false),
|
|
846
|
+
prior("crossing", 2, false),
|
|
847
|
+
prior("already_past", 3, false),
|
|
848
|
+
prior("pinned", 2, true),
|
|
849
|
+
prior("fresh", 0, false),
|
|
850
|
+
],
|
|
851
|
+
42,
|
|
852
|
+
Some(3),
|
|
853
|
+
);
|
|
854
|
+
assert_eq!(
|
|
855
|
+
recalls
|
|
856
|
+
.iter()
|
|
857
|
+
.map(|recall| (recall.record_id.as_str(), recall.recall_count))
|
|
858
|
+
.collect::<Vec<_>>(),
|
|
859
|
+
vec![
|
|
860
|
+
("crossing", 3),
|
|
861
|
+
("already_past", 4),
|
|
862
|
+
("pinned", 3),
|
|
863
|
+
("fresh", 1)
|
|
864
|
+
]
|
|
865
|
+
);
|
|
866
|
+
assert!(recalls.iter().all(|recall| recall.last_recalled_at == 42));
|
|
867
|
+
assert_eq!(
|
|
868
|
+
promotions,
|
|
869
|
+
vec![MemoryPromotion {
|
|
870
|
+
record_id: "crossing".into(),
|
|
871
|
+
recall_count: 3
|
|
872
|
+
}]
|
|
873
|
+
);
|
|
874
|
+
assert!(
|
|
875
|
+
derive_recall_lifecycle(&[prior("crossing", 2, false)], 1, None)
|
|
876
|
+
.1
|
|
877
|
+
.is_empty()
|
|
878
|
+
);
|
|
879
|
+
}
|
|
773
880
|
}
|
{deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/chain_validator/mod.rs
RENAMED
|
@@ -2097,6 +2097,8 @@ mod tests {
|
|
|
2097
2097
|
),
|
|
2098
2098
|
tokens: Some(64),
|
|
2099
2099
|
tool_call_id: None,
|
|
2100
|
+
is_error: false,
|
|
2101
|
+
tool_calls: Vec::new(),
|
|
2100
2102
|
})
|
|
2101
2103
|
.collect(),
|
|
2102
2104
|
..InitialContext::default()
|
|
@@ -2184,6 +2186,7 @@ mod tests {
|
|
|
2184
2186
|
Vec::new()
|
|
2185
2187
|
},
|
|
2186
2188
|
tool_call_id: None,
|
|
2189
|
+
is_error: false,
|
|
2187
2190
|
tokens: None,
|
|
2188
2191
|
},
|
|
2189
2192
|
observed_input_tokens: None,
|
{deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/observation.rs
RENAMED
|
@@ -76,6 +76,14 @@ pub enum KernelObservation {
|
|
|
76
76
|
subject: Option<String>,
|
|
77
77
|
reason: String,
|
|
78
78
|
},
|
|
79
|
+
/// A model `skill` syscall the kernel admitted. Hosts pin the skill's content only on this
|
|
80
|
+
/// fact, never on the raw call: activation is a capability mutation the kernel adjudicates.
|
|
81
|
+
SkillAdmitted {
|
|
82
|
+
turn: u32,
|
|
83
|
+
name: String,
|
|
84
|
+
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
85
|
+
expires_at_turn: Option<u32>,
|
|
86
|
+
},
|
|
79
87
|
CapabilityChanged {
|
|
80
88
|
turn: u32,
|
|
81
89
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
{deepstrike-0.2.74 → deepstrike-0.2.76}/crates/deepstrike-core/src/runtime/kernel/wire/command.rs
RENAMED
|
@@ -43,6 +43,12 @@ pub enum HostCommand {
|
|
|
43
43
|
ApplySkillActivation(ApplySkillActivationCommand),
|
|
44
44
|
ApplyPolicyPatch(ApplyPolicyPatchCommand),
|
|
45
45
|
UpdateDeadline(UpdateDeadlineCommand),
|
|
46
|
+
/// §22.13 · a memory write the host authored while this operation runs (a session extract, a
|
|
47
|
+
/// semantic archive summary). The host still performs the I/O; the kernel is the one that says
|
|
48
|
+
/// whether the write may happen, by the same validation rule and the same rolling write quota
|
|
49
|
+
/// the model's `write_memory` syscall answers to. A refusal is journaled as
|
|
50
|
+
/// `memory_validation_failed`; an admitted write journals nothing and the host persists it.
|
|
51
|
+
AdmitMemoryWrite(AdmitMemoryWriteCommand),
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
/// Cancellation. The operation id lives in the envelope and is **not** repeated here: the
|
|
@@ -181,6 +187,16 @@ pub struct SeedKnowledgeCommand {
|
|
|
181
187
|
pub entries: Vec<KnowledgeEntry>,
|
|
182
188
|
}
|
|
183
189
|
|
|
190
|
+
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
|
191
|
+
#[serde(deny_unknown_fields)]
|
|
192
|
+
pub struct AdmitMemoryWriteCommand {
|
|
193
|
+
/// The host's record id, named by the audit fact when the write is refused.
|
|
194
|
+
pub record_id: String,
|
|
195
|
+
pub name: String,
|
|
196
|
+
/// UTF-8 byte length of the content the host intends to persist.
|
|
197
|
+
pub content_bytes: u32,
|
|
198
|
+
}
|
|
199
|
+
|
|
184
200
|
/// §13.2 · skill activation state. Both directions in one command so a swap is atomic.
|
|
185
201
|
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
|
|
186
202
|
#[serde(deny_unknown_fields)]
|
|
@@ -265,6 +281,11 @@ pub struct GovernancePolicy {
|
|
|
265
281
|
pub rate_limits: Vec<RateLimitSpec>,
|
|
266
282
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
|
267
283
|
pub constraints: Vec<ParamConstraint>,
|
|
284
|
+
/// Withhold tools this policy statically denies (veto or `deny` permission) from the provider
|
|
285
|
+
/// surface, and say so once in the knowledge slot. The kernel decides the hidden set with the
|
|
286
|
+
/// same rules that enforce the calls, so the surface and the gate cannot disagree.
|
|
287
|
+
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
288
|
+
pub hide_denied_tools: Option<bool>,
|
|
268
289
|
}
|
|
269
290
|
|
|
270
291
|
/// Per-tool rolling-window rate limit.
|
|
@@ -558,6 +579,9 @@ impl LivePolicyPatch {
|
|
|
558
579
|
next.governance_policy.vetoed_tools = policy.vetoed_tools.clone();
|
|
559
580
|
next.governance_policy.rate_limits = policy.rate_limits.clone();
|
|
560
581
|
next.governance_policy.constraints = policy.constraints.clone();
|
|
582
|
+
next.governance_policy.hide_denied_tools = policy
|
|
583
|
+
.hide_denied_tools
|
|
584
|
+
.unwrap_or(current.governance_policy.hide_denied_tools);
|
|
561
585
|
super::config::validate_governance(
|
|
562
586
|
&next.governance_policy,
|
|
563
587
|
current.kernel_limits.collection_limits.governance_rules,
|