feat: add hash routing for pushy agents
Some checks failed
tamq-ci / test (push) Failing after 6s

Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a03397-4d51-7fd1-8ff2-946eb22ea2bc
This commit is contained in:
tegwick 2026-08-25 00:08:57 +02:00
parent 00f04da5f6
commit e284c9f63c
16 changed files with 233 additions and 49 deletions

View file

@ -169,6 +169,7 @@ manual messaging from a managed shell:
@TARGET: MESSAGE...
@ compose with a visible, Tab-selectable recipient
@ MESSAGE... fast reply (ordinary shell quoting applies)
#TARGET: MESSAGE... agent-input alias in a tapped pushy session
tamq inbox [--filter COMMAND]
""",
)
@ -336,6 +337,9 @@ def main(argv: list[str] | None = None) -> int:
if args.no_service and args.mode is not None:
print("tamq: --mode cannot be combined with --no-service", file=sys.stderr)
return 2
tap_enabled = args.tap or (
selected_mode == "pushy" and args.initial_command is not None
)
manager = TmuxManager()
try:
if not args.no_service:
@ -356,7 +360,7 @@ def main(argv: list[str] | None = None) -> int:
print("tamq service failed to start with the required delivery capability; use --no-service to open repos without messaging", file=sys.stderr)
return 1
try:
endpoint = manager.ensure_plan(launch_plan, tap=args.tap)
endpoint = manager.ensure_plan(launch_plan, tap=tap_enabled)
except (TmuxError, OSError) as exc:
print(f"tamq: {exc}", file=sys.stderr)
return 2
@ -393,6 +397,7 @@ def main(argv: list[str] | None = None) -> int:
"service": not args.no_service,
"messaging": registered,
"mode": "none" if args.no_service else ("tap" if args.tap else selected_mode),
"input_observation_requested": tap_enabled,
"delivery_mode": "none" if args.no_service else (
"pane" if args.tap else endpoint_delivery_mode
),

View file

@ -3,7 +3,7 @@ from __future__ import annotations
import re
from dataclasses import dataclass
ADDRESS = re.compile(r"^@([a-z0-9][a-z0-9._-]*):(?:[ \t]*)(.+)$", re.IGNORECASE)
ADDRESS = re.compile(r"^[@#]([a-z0-9][a-z0-9._-]*):(?:[ \t]*)(.+)$", re.IGNORECASE)
@dataclass(frozen=True)

View file

@ -30,9 +30,9 @@ def format_comment(sender: str, body: str, message_id: str) -> str:
def format_pushy_input(sender: str, body: str, message_id: str) -> str:
"""Render one shell-safe input line for explicit pushy delivery."""
"""Render one shell-safe, non-routable line for pushy delivery."""
return (
f"#{terminal_safe(sender)}: {terminal_safe(body)} "
f"# from {terminal_safe(sender)}: {terminal_safe(body)} "
f"[{terminal_safe(message_id)}]"
)

View file

@ -246,7 +246,7 @@ class TmuxManager:
command = (
[
*self.tamq_command,
"tap", "--repo", repo, "--endpoint", endpoint_id, "--", *plan.command,
"tap", "--repo", repo, "--endpoint", instance_id, "--", *plan.command,
]
if tap
else list(plan.command)