Files
hermes-agent/scripts
Ben Barclay 1bd13ebac8 feat(scope): the scope names the agent's owner and role; a turn carries its fence
A Scope now says who owns the agent and what the activity may do on it, and a TurnScope says
which claim the turn runs under:

- Scope gains keyword-only owner (Principal for a personal agent, Group for a shared one) and
  role ("owner" | "manager" | "member"). A personal agent is used only by its owner, so its only
  role is "owner"; a group agent's roles are "manager" and "member". can_administer is true for
  owners and managers. A hosted scope must name both; a local scope defaults to the local person
  as owner with role "owner", so every local caller is unchanged.
- TurnScope gains fence: Fence(epoch, generation), the owner epoch and runtime generation the
  admission claim stamped. bind_turn(session, turn, fence) requires it; claim_fence(row) reads it
  off a claimed session_admissions row. The authority's turn path, the owner-side cron run and
  the managed worker bind the real fence.
- Inside a hosted scope a bind must keep tenant, agent, actor, owner and role; changing any of
  them raises ScopeSwitchRefused.
- bind_profile_scope / scope_for_profile drop the unused turn= tuple: a turn is marked only with
  bind_turn, which has the fence.

Tests that executed a never-claimed admission row now claim it first, as the drain does
(tests/gateway/session_claims.py); hand-built cron rows carry the claim's columns.
2026-11-11 09:54:19 -05:00
..