Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .claude/skills/taosmd-a2a/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ python -c "import taosmd; print(taosmd.a2a_setup_guide())"
Follow every step in the guide in order. The guide is the source of truth for
checking for an existing server, starting the bus, creating/joining a channel,
and generating the invite block for the user's other agents.

After joining a channel, set up the hourly bus-check cron so you do not miss
messages when your session ends — follow the **"Durable monitoring"** section
in the guide for idempotent cron/schtasks setup instructions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ include = ["taosmd*"]
# importlib.resources.files("taosmd")). Without this they are omitted from the
# wheel and agent_rules() raises FileNotFoundError on a pip install (#66).
[tool.setuptools.package-data]
taosmd = ["docs/**/*.md", "webui/**/*"]
taosmd = ["docs/**/*.md", "webui/**/*", "skills/**/*"]

[project.scripts]
taosmd = "taosmd.cli:main"
Expand Down
77 changes: 77 additions & 0 deletions scripts/install-client.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# install-client.ps1 — install taOSmd as a remote client pointing at a shared server
#
# Usage:
# .\scripts\install-client.ps1 [-ServerUrl <url>]
#
# Example:
# .\scripts\install-client.ps1 -ServerUrl http://pi.local:7900
#
# What this does:
# 1. Install/upgrade the taosmd Python package.
# 2. Set the remote server URL in %USERPROFILE%\.taosmd\config.json.
# 3. Install the taosmd-a2a Claude skill into %USERPROFILE%\.claude\skills\.
# 4. Verify the server is reachable via GET /health.

param (
[string]$ServerUrl = ""
)

Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"

Write-Host "=== taOSmd client install ===" -ForegroundColor Cyan

# --- Step 1: install taosmd --------------------------------------------------
Write-Host ""
Write-Host "Step 1: Installing taosmd..."
pip install --quiet --upgrade taosmd
Write-Host " taosmd installed."

# --- Step 2: configure the remote server URL ---------------------------------
Write-Host ""
Write-Host "Step 2: Configuring remote server URL..."

if (-not $ServerUrl) {
$ServerUrl = Read-Host " Enter the remote taOSmd server URL (e.g. http://pi.local:7900)"
}

if (-not $ServerUrl) {
Write-Error "error: server URL is required."
exit 1
}

taosmd config set-server $ServerUrl
Write-Host " Remote server URL set: $ServerUrl"

# --- Step 3: install the Claude skill ----------------------------------------
Write-Host ""
Write-Host "Step 3: Installing taosmd-a2a skill..."
try {
taosmd install-skill
} catch {
taosmd install-skill --force
}
Write-Host " Skill installed."

# --- Step 4: health check ----------------------------------------------------
Write-Host ""
Write-Host "Step 4: Checking server health..."
try {
$response = Invoke-RestMethod -Uri "$ServerUrl/health" -TimeoutSec 10 -Method Get
if ($response.status -eq "ok") {
Write-Host " Server is healthy: version $($response.version)"
} else {
Write-Warning " Unexpected health response: $($response | ConvertTo-Json)"
exit 1
}
} catch {
Write-Warning " Warning: server health check failed: $_"
Write-Warning " Check that the server is running and the URL is correct."
exit 1
}

Write-Host ""
Write-Host "=== taOSmd client setup complete ===" -ForegroundColor Green
Write-Host " Server : $ServerUrl"
Write-Host " Run 'taosmd config show' to confirm settings."
Write-Host " Run 'taosmd a2a-poll --channel CHANNEL' to poll the bus."
83 changes: 83 additions & 0 deletions scripts/install-client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/usr/bin/env bash
# install-client.sh — install taOSmd as a remote client pointing at a shared server
#
# Usage:
# ./scripts/install-client.sh [SERVER_URL]
#
# If SERVER_URL is not passed as an argument the script will prompt for it.
# Example:
# ./scripts/install-client.sh http://pi.local:7900
# ./scripts/install-client.sh https://my-device.tailscale.ts.net:7900
#
# What this does:
# 1. Install/upgrade the taosmd Python package.
# 2. Set the remote server URL in ~/.taosmd/config.json.
# 3. Install the taosmd-a2a Claude skill into ~/.claude/skills/.
# 4. Verify the server is reachable via GET /health.

set -euo pipefail

echo "=== taOSmd client install ==="

# --- Step 1: install taosmd ---------------------------------------------------
echo ""
echo "Step 1: Installing taosmd..."
pip install --quiet --upgrade taosmd
echo " taosmd $(taosmd --version 2>/dev/null || python -c "import taosmd; print(taosmd.__version__)") installed."

# --- Step 2: configure the remote server URL ---------------------------------
echo ""
echo "Step 2: Configuring remote server URL..."

SERVER_URL="${1:-}"
if [ -z "$SERVER_URL" ]; then
read -rp " Enter the remote taOSmd server URL (e.g. http://pi.local:7900): " SERVER_URL
fi

if [ -z "$SERVER_URL" ]; then
echo "error: server URL is required." >&2
exit 1
fi

taosmd config set-server "$SERVER_URL"
echo " Remote server URL set: $SERVER_URL"

# --- Step 3: install the Claude skill ----------------------------------------
echo ""
echo "Step 3: Installing taosmd-a2a skill..."
taosmd install-skill || taosmd install-skill --force
echo " Skill installed."

# --- Step 4: health check -----------------------------------------------------
echo ""
echo "Step 4: Checking server health..."
if command -v curl >/dev/null 2>&1; then
HEALTH=$(curl -s --max-time 10 "${SERVER_URL}/health" 2>/dev/null || true)
elif command -v wget >/dev/null 2>&1; then
HEALTH=$(wget -qO- --timeout=10 "${SERVER_URL}/health" 2>/dev/null || true)
else
# Fallback: use Python urllib
HEALTH=$(python -c "
import urllib.request, json
try:
with urllib.request.urlopen('${SERVER_URL}/health', timeout=10) as r:
print(r.read().decode())
except Exception as e:
print('{\"error\": \"' + str(e) + '\"}')
" 2>/dev/null || true)
fi

if echo "$HEALTH" | grep -q '"status": *"ok"'; then
echo " Server is healthy: $HEALTH"
else
echo " Warning: server health check failed or server is unreachable."
echo " Response: $HEALTH"
echo " Check that the server is running and the URL is correct."
exit 1
fi

echo ""
echo "=== taOSmd client setup complete ==="
echo " Server : $SERVER_URL"
echo " Run 'taosmd config show' to confirm settings."
echo " Run 'taosmd a2a-poll --channel CHANNEL' to poll the bus."
81 changes: 81 additions & 0 deletions scripts/install-server.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# install-server.ps1 — install taOSmd and start it as a persistent background service
#
# Usage:
# .\scripts\install-server.ps1 [-Host 0.0.0.0] [-Port 7900]
#
# What this does:
# 1. Install/upgrade the taosmd Python package.
# 2. Install the taosmd serve background service (Windows service via taosmd --install-service).
# 3. Verify the service is reachable on localhost.
# 4. Print Tailscale guidance and token reminder.

param (
[string]$ServerHost = "0.0.0.0",
[int]$Port = 7900
)

Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"

Write-Host "=== taOSmd server install ===" -ForegroundColor Cyan
Write-Host " Host: $ServerHost Port: $Port"

# --- Step 1: install taosmd --------------------------------------------------
Write-Host ""
Write-Host "Step 1: Installing taosmd..."
pip install --quiet --upgrade taosmd
Write-Host " taosmd installed."

# --- Step 2: install the background service ----------------------------------
Write-Host ""
Write-Host "Step 2: Installing background service..."
$dataDir = Join-Path $env:USERPROFILE ".taosmd"
taosmd serve --install-service --host $ServerHost --port $Port --serve-data-dir $dataDir
Write-Host " Service installed."

# --- Step 3: health check ----------------------------------------------------
Write-Host ""
Write-Host "Step 3: Checking server health on localhost:$Port..."
Start-Sleep -Seconds 3 # give the service a moment to start

try {
$health = Invoke-RestMethod -Uri "http://127.0.0.1:$Port/health" -TimeoutSec 10 -Method Get
if ($health.status -eq "ok") {
Write-Host " Server is healthy: version $($health.version)" -ForegroundColor Green
} else {
Write-Warning " Unexpected health response: $($health | ConvertTo-Json)"
}
} catch {
Write-Warning " Health check failed: $_"
Write-Warning " Run 'taosmd serve --service-status' for details."
}

# --- Step 4: guidance --------------------------------------------------------
Write-Host ""
Write-Host "=== Server installation complete ===" -ForegroundColor Green
Write-Host ""
Write-Host "The server is bound to ${ServerHost}:${Port}."
Write-Host ""
Write-Host "--- Tailscale / remote access guidance ---"
Write-Host ""
Write-Host "To reach this server from other machines over Tailscale:"
Write-Host " 1. Install Tailscale: https://tailscale.com/download"
Write-Host " 2. Run 'tailscale up' on both machines."
Write-Host " 3. Find this machine's Tailscale IP: tailscale ip -4"
Write-Host " 4. On each client:"
Write-Host " taosmd config set-server http://<TAILSCALE_IP>:$Port"
Write-Host " or run the client install script:"
Write-Host " .\scripts\install-client.ps1 -ServerUrl http://<TAILSCALE_IP>:$Port"
Write-Host ""
Write-Host "--- Token auth (optional but recommended on shared networks) ---"
Write-Host ""
Write-Host "To require a bearer token:"
Write-Host " On the SERVER:"
Write-Host " taosmd config set-token <your-secret-token>"
Write-Host " taosmd serve --uninstall-service"
Write-Host " taosmd serve --install-service --host $ServerHost --port $Port"
Write-Host " On each CLIENT:"
Write-Host " taosmd config set-token <your-secret-token>"
Write-Host " (Or set TAOSMD_TOKEN=<token> in the environment.)"
Write-Host ""
Write-Host "Never hardcode the token in scripts or commit it to version control."
99 changes: 99 additions & 0 deletions scripts/install-server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#!/usr/bin/env bash
# install-server.sh — install taOSmd and start it as a persistent background service
#
# Usage:
# ./scripts/install-server.sh [--host HOST] [--port PORT]
#
# Defaults: host=0.0.0.0, port=7900
#
# What this does:
# 1. Install/upgrade the taosmd Python package.
# 2. Install and start the taosmd serve background service on 0.0.0.0:7900
# (or the specified host/port) via taosmd serve --install-service.
# 3. Verify the service is reachable on localhost.
# 4. Print Tailscale guidance and token reminder.

set -euo pipefail

HOST="0.0.0.0"
PORT="7900"

while [[ $# -gt 0 ]]; do
case "$1" in
--host) HOST="$2"; shift 2 ;;
--port) PORT="$2"; shift 2 ;;
*) echo "Unknown option: $1" >&2; exit 1 ;;
esac
done

echo "=== taOSmd server install ==="
echo " Host: $HOST Port: $PORT"

# --- Step 1: install taosmd --------------------------------------------------
echo ""
echo "Step 1: Installing taosmd..."
pip install --quiet --upgrade taosmd
echo " taosmd $(taosmd --version 2>/dev/null || python -c "import taosmd; print(taosmd.__version__)") installed."

# --- Step 2: install and start the background service -----------------------
echo ""
echo "Step 2: Installing background service (systemd / LaunchAgent)..."
taosmd serve --install-service --host "$HOST" --port "$PORT" --serve-data-dir ~/.taosmd
echo " Service installed."

# --- Step 3: health check ----------------------------------------------------
echo ""
echo "Step 3: Checking server health on localhost:$PORT..."
sleep 2 # give the service a moment to start

if command -v curl >/dev/null 2>&1; then
HEALTH=$(curl -s --max-time 10 "http://127.0.0.1:${PORT}/health" 2>/dev/null || true)
else
HEALTH=$(python -c "
import urllib.request
try:
with urllib.request.urlopen('http://127.0.0.1:${PORT}/health', timeout=10) as r:
print(r.read().decode())
except Exception as e:
print('{\"error\": \"' + str(e) + '\"}')
" 2>/dev/null || true)
fi

if echo "$HEALTH" | grep -q '"status": *"ok"'; then
echo " Server is healthy: $HEALTH"
else
echo " Warning: health check did not confirm 'ok'. Response: $HEALTH"
echo " Check 'taosmd serve --service-status' for details."
fi

# --- Step 4: guidance --------------------------------------------------------
echo ""
echo "=== Server installation complete ==="
echo ""
echo "The server is bound to $HOST:$PORT."
echo ""
echo "--- Tailscale / remote access guidance ---"
echo ""
echo "To reach this server from other machines over Tailscale:"
echo " 1. Install Tailscale on both machines: https://tailscale.com/download"
echo " 2. Run 'tailscale up' on this machine and on the client machines."
echo " 3. Find this machine's Tailscale IP or MagicDNS name:"
echo " tailscale ip -4"
echo " tailscale status"
echo " 4. On each client run:"
echo " taosmd config set-server http://<TAILSCALE_IP_OR_HOSTNAME>:$PORT"
echo " or run the client install script:"
echo " ./scripts/install-client.sh http://<TAILSCALE_IP_OR_HOSTNAME>:$PORT"
echo ""
echo "--- Token auth (optional but recommended on shared networks) ---"
echo ""
echo "To require a bearer token:"
echo " On the SERVER:"
echo " taosmd config set-token <your-secret-token>"
echo " taosmd serve --uninstall-service # stop"
echo " taosmd serve --install-service --host $HOST --port $PORT # restart"
echo " On each CLIENT:"
echo " taosmd config set-token <your-secret-token>"
echo " (Or set TAOSMD_TOKEN=<token> in both environments.)"
echo ""
echo "Never hardcode the token in scripts or commit it to version control."
Loading