Skip to content

feat(remote): client mode, token auth, install scripts, install-skill, a2a-poll + durable-cron - #139

Merged
jaylfc merged 1 commit into
masterfrom
feat/remote-and-cron
Jun 7, 2026
Merged

feat(remote): client mode, token auth, install scripts, install-skill, a2a-poll + durable-cron#139
jaylfc merged 1 commit into
masterfrom
feat/remote-and-cron

Conversation

@jaylfc

@jaylfc jaylfc commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Remote client mode — point taOSmd at a Pi/server over Tailscale. TAOSMD_SERVER_URL env or taosmd config set-server <url> transparently routes all service calls (ingest, search, pending, A2A) through RemoteClient (stdlib urllib, async via asyncio.to_thread). Local behavior completely unchanged when no URL is set.
  • Token authtaosmd config set-token / TAOSMD_TOKEN on clients; server_token in server's config.json gates data/A2A endpoints with Authorization: Bearer (401 JSON otherwise). GET /health, /, and static assets always open.
  • Install scriptsscripts/install-client.sh/.ps1 (install → set-server → install-skill → /health check) and scripts/install-server.sh/.ps1 (install → --install-service → Tailscale guidance + token reminder). No hardcoded IPs.
  • taosmd install-skill — copies packaged taosmd/skills/taosmd-a2a/SKILL.md into ~/.claude/skills/taosmd-a2a/, idempotent without --force.
  • taosmd a2a-poll — cron-friendly poller: fetches /a2a/messages, prints only messages with ID > last-seen (state file ~/.taosmd/a2a-poll-state.json), supports --exclude <agent>, updates state on exit.
  • Durable-cron docsdocs/a2a-comms.md gains a "Durable monitoring" section with idempotent create-or-amend crontab snippet (tagged # taosmd-a2a:CHANNEL), Windows schtasks equivalent, and session ritual reminder.
  • Skill updated — both .claude/skills/taosmd-a2a/SKILL.md and the packaged copy tell the agent to set up the hourly cron after joining.

Test plan

  • python3 -m pytest -q → 466 passed, 0 failed
  • tests/test_remote.py — RemoteClient round-trips, config get/set + env-override, service dispatch (remote/local), token auth (401/200/health-open), install-skill idempotent/force
  • tests/test_a2a_poll.py — seed via test server, poll prints only-new, state file updates, --exclude filters + advances state, multi-channel state
  • All prior 434 tests still pass (no regressions)

Summary by CodeRabbit

  • New Features

    • Installation and setup scripts for client and server deployments on Windows and Linux/macOS
    • Remote server configuration with bearer token authentication support
    • Message polling command with persistent state tracking across sessions
    • Claude skill for A2A communications integration
  • Documentation

    • Added durable monitoring guide for hourly scheduled message polling

…ill, a2a-poll + durable-cron docs/skill

- config.py: get/set_server_url (TAOSMD_SERVER_URL env + config.json server_url) and
  get/set_server_token (TAOSMD_TOKEN env + server_token) with same defensive pattern
  as existing get/set_memory_model.

- taosmd/remote.py: RemoteClient(base_url, token, timeout) — stdlib urllib only.
  Async methods via asyncio.to_thread: ingest, search, pending_list,
  pending_resolve, a2a_send, a2a_feed, a2a_channels, a2a_members, stats.
  Non-2xx raises RuntimeError(status+body).

- service.py: _get_remote(data_dir) dispatch at top of every function.
  When data_dir is explicit (http_server path), reads only config.json
  (never TAOSMD_SERVER_URL env) to prevent infinite-loop self-proxying.
  When data_dir is None (CLI/MCP/Python API), full env+file resolution.
  Remote client instances cached by (url, token) tuple.

- http_server.py: optional server-side token auth. If server_token is set
  in the server's own config.json, every data/A2A JSON endpoint requires
  Authorization: Bearer <token> (401 JSON otherwise). GET /health, /,
  /ui, and static assets are always open.

- cli.py: taosmd config set-server <url>/--clear, set-token <token>/--clear,
  config show (prints url + whether token is set, never the token value).
  Global --server URL flag. taosmd install-skill (--force). taosmd a2a-poll
  --channel --exclude --state-file --server.

- taosmd/skills/taosmd-a2a/SKILL.md: packaged copy of skill, added cron step.
  .claude/skills/taosmd-a2a/SKILL.md: updated with cron step.
  pyproject.toml: skills/**/* added to package-data.

- scripts/install-client.sh/.ps1: pip install → set-server → install-skill → /health check.
  scripts/install-server.sh/.ps1: pip install → --install-service → health check →
  Tailscale guidance + token reminder. No hardcoded IPs.

- docs/a2a-comms.md: "Durable monitoring" section with idempotent cron snippet
  (create-or-amend tagged line), schtasks Windows equivalent, inbox format,
  session ritual reminder.

- tests/test_remote.py: RemoteClient round-trips, config get/set + env-override,
  service dispatch goes-remote/stays-local, token auth (no-header 401, correct 200,
  health open), install-skill idempotent/force.
  tests/test_a2a_poll.py: seed via test server, poll prints only-new, state updates,
  --exclude filters + advances state, multiple channels tracked independently.
  466 tests pass.
@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR implements a complete remote client-server architecture for taOSmd, enabling distributed deployments with token-based authentication, durable message polling for A2A bus monitoring, and automated installation scripts for both client and server platforms.

Changes

Remote Client-Server Architecture

Layer / File(s) Summary
Remote client infrastructure and configuration
taosmd/config.py, taosmd/remote.py
RemoteClient performs HTTP requests with optional Bearer-token authentication over blocking urllib wrapped in asyncio.to_thread for async compatibility. Configuration functions manage server URL and token storage in ~/.taosmd/config.json with environment-variable precedence (TAOSMD_SERVER_URL, TAOSMD_TOKEN).
HTTP server token authentication and service routing
taosmd/http_server.py, taosmd/service.py
HTTP handler validates Bearer tokens on protected endpoints while allowing public paths (/health, /ui, /) to bypass auth. Service functions (ingest, search, pending_list, pending_resolve, stats, a2a_send, a2a_feed, a2a_channels, a2a_members) check for configured remote servers and conditionally forward requests instead of using local stores.
CLI configuration and monitoring commands
taosmd/cli.py
Adds config subcommand (set-server, set-token, show), install-skill to deploy taosmd-a2a into ~/.claude/skills/, and a2a-poll for durable cron-friendly message polling with per-channel last-seen state files and optional sender exclusion.
User documentation and skill definition
taosmd/docs/a2a-comms.md, taosmd/skills/taosmd-a2a/SKILL.md, .claude/skills/taosmd-a2a/SKILL.md
Durable monitoring guide documents OS-specific cron (Linux/macOS) and schtasks (Windows) setup; taosmd-a2a skill provides step-by-step setup instructions including post-join monitoring configuration.
Client and server installation scripts
scripts/install-client.ps1, scripts/install-client.sh, scripts/install-server.ps1, scripts/install-server.sh, pyproject.toml
PowerShell and Bash installers for client (pip install taosmd, configure server, install skill, health check) and server (pip install, register service, verify startup, Tailscale/token guidance). Package data updated to include skills directory.
Comprehensive integration tests
tests/test_remote.py, tests/test_a2a_poll.py
Hermetic tests with ephemeral HTTP server, deterministic embedder stub, and in-memory stores validate RemoteClient round-trips, config semantics with env overrides, service dispatch routing, token 401/200 behavior, skill installation, and a2a-poll state persistence across channels and sender filtering.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes


🐰 A server takes flight, clients dance near,
Tokens guard the gates, secure and clear,
A2A polls the hour, durable and wise,
Distributed hopping—the architecture flies!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 68.13% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary changes: remote client mode, token authentication, install scripts (for both client and server), install-skill command, a2a-poll subcommand, and durable-cron setup documentation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/remote-and-cron

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant