feat(profiler/behave_shell): emit motor.input_modality

BEHAVE-EXTRACTOR.md Phase A Step 2. The first primitive — picked
first because it has the highest discriminative value (HUMAN vs
everyone) and the simplest implementation (paste-event ratio over
total inputs).

* _features/motor.py:input_modality(ctx) emits one Observation
  per session in {typed, pasted, mixed} with confidence 0.75 / 0.70.
* _features/_emit.py centralises the make_observation helper so
  every feature module gets the same Window/source/evidence_ref
  boilerplate without copy-paste.
* Thresholds inherited from the prototype's calibration history
  (MODALITY_PASTED_MIN=0.40, MODALITY_TYPED_MAX=0.05).
* Zero-input session skips emission — registry doesn't admit
  "unknown" here.

Tests: pure-typed → typed, pure-pasted → pasted, mixed → mixed,
output-only session → no observation, full envelope round-trip.
This commit is contained in:
2026-05-03 07:47:38 -04:00
parent c9a81a23c2
commit 879f5e731b
5 changed files with 153 additions and 10 deletions

View File

@@ -3,9 +3,6 @@
Each entry takes a ``SessionContext`` and yields zero or more
``Observation`` instances. Adding a primitive = adding a function in a
sibling module and appending it to ``FEATURES``.
Step 0 ships an empty tuple — extract_session() is wired but emits
nothing until Step 2.
"""
from __future__ import annotations
@@ -14,7 +11,10 @@ from typing import Callable, Iterable
from decnet_behave_core.spec.envelope import Observation
from decnet.profiler.behave_shell._ctx import SessionContext
from decnet.profiler.behave_shell._features.motor import input_modality
FeatureFn = Callable[[SessionContext], Iterable[Observation]]
FEATURES: tuple[FeatureFn, ...] = ()
FEATURES: tuple[FeatureFn, ...] = (
input_modality,
)