Skip to content
Back to search

agent-swarm

Marketplace for the agent-swarm operator skill

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

Its scripts were only partly scanned.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/desplega-ai/agent-swarm with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/desplega-ai/agent-swarm'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/desplega-ai--agent-swarm/badge.svg)](/listings/desplega-ai--agent-swarm)

HTML

<a href="/listings/desplega-ai--agent-swarm"><img src="/api/listings/desplega-ai--agent-swarm/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

These steps run a script from the network that findsafeskills does not scan.

Give your coding agent the operator skill for Docker Compose or Kubernetes:

npx skills add desplega-ai/agent-swarm

Or install it as a plugin in your harness:

| Harness | Command | |---|---| | Claude Code | `/plugin marketplace add desplega-ai/agent-swarm` then `/plugin install agent-swarm@agent-swarm` | | Codex | `codex plugin marketplace add desplega-ai/agent-swarm && codex plugin add agent-swarm@agent-swarm` (or use `npx skills` above) | | Cursor | `/add-plugin desplega-ai/agent-swarm` | | Gemini CLI | `gemini extensions install https://github.com/desplega-ai/agent-swarm` | | Antigravity / Factory Droid | `droid plugin marketplace add https://github.com/desplega-ai/agent-swarm` then `droid plugin install agent-swarm@agent-swarm` | | OpenCode, pi, Devin, Kimi, others | `npx skills add desplega-ai/agent-swarm` |

The plugin's [privacy](https://www.agent-swarm.dev/privacy) and [terms](https://www.agent-swarm.dev/terms) links describe the Agent Swarm website and Cloud service. The self-hosted software remains covered by the [MIT License](./LICENSE).

Or self-host. [`docker-compose.example.yml`](https://github.com/desplega-ai/agent-swarm/blob/main/docker-compose.example.yml) is the reference deployment: deploy every agent in it by default (1 lead and 11 workers on the official templates), and remove agents only when you have a reason to.

Plan for at least 4 vCPU, 8 GB RAM and 40 GB of free disk, and prune old Docker images after upgrades. See [Host requirements & disk cleanup](https://docs.agent-swarm.dev/docs/guides/host-requirements).

The one-shot installer checks Docker and Compose v2, installs Bun when missing, runs `agent-swarm onboard --yes --preset full` (every official template; it runs one coder where the example runs two), and prints the dashboard `/setup` link:

curl -fsSL https://agent-swarm.dev/install.sh | bash

The raw GitHub URL (`https://raw.githubusercontent.com/desplega-ai/agent-swarm/main/install.sh`) serves the same script. The API is public through a tunnel by default, protected by the API key. Add `bash -s -- --no-tunnel` to keep it local.

No server yet? Deploy the Railway template in one click:

Or [deploy one](https://docs.agent-swarm.dev/docs/guides/one-click-deploy) on any VPS: paste [`deploy/cloud-init.yaml`](./deploy/cloud-init.yaml) as the user data of a new 4 vCPU / 8 GB Ubuntu server (Hetzner, DigitalOcean, Lightsail, Vultr). It installs Docker and Caddy, serves the API over HTTPS on `<ip>.sslip.io` or your domain, and shows the `/setup` link to root at login. To look first, [try it for an hour on E2B](https://docs.agent-swarm.dev/docs/guides/one-click-deploy#try-it-for-an-hour-on-e2b); that trial deletes its data when the sandboxes stop.

Or use the examples directly:

git clone https://github.com/desplega-ai/agent-swarm.git && cd agent-swarm
cp .env.docker.example .env  # Set API_KEY and the credential for your HARNESS_PROVIDER.
openssl rand -base64 32 > encryption_key
chmod 600 .env encryption_key
docker compose -f docker-compose.example.yml --env-file .env up -d

Agent ID variables are optional. Each container generates a UUID on first boot and keeps it in its personal volume, so identity survives restarts. Pin `*_AGENT_ID` in `.env` only to keep an existing identity or to survive removing volumes.

Read the [Compose checklist](./skills/agent-swarm/references/compose.md) before starting. API: http://localhost:3013, with `/docs` and `/openapi.json`. Next, open the [dashboard](https://app.agent-swarm.dev) and connect it to your API with `API_KEY`. A new install lands on `/setup`, a guided first run that covers providers, agents, memory, integrations, and a first task. Kubernetes: [install the OCI Helm chart](./charts/agent-swarm/README.md).

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 21 lines
  1. {
  2. "name": "agent-swarm",
  3. "description": "Marketplace for the agent-swarm operator skill",
  4. "owner": {
  5. "name": "desplega.sh",
  6. "email": "contact@desplega.sh"
  7. },
  8. "plugins": [
  9. {
  10. "name": "agent-swarm",
  11. "description": "Install, deploy, and operate agent-swarm: Docker Compose, Kubernetes with Helm, HTTPS, agent-fs, integrations, and the API for coding agents",
  12. "version": "2.13.5",
  13. "source": "./",
  14. "author": {
  15. "name": "desplega.sh",
  16. "email": "contact@desplega.sh",
  17. "url": "https://github.com/desplega-ai"
  18. }
  19. }
  20. ]
  21. }
README.md · README · 157 lines · 1 finding marked
  1. <p align="center"><a href="https://github.com/desplega-ai/agent-swarm/stargazers"><img src="https://img.shields.io/github/stars/desplega-ai/agent-swarm?style=flat-square&color=yellow" alt="GitHub Stars"></a> <a href="https://github.com/desplega-ai/agent-swarm/blob/main/LICENSE"><img src="https://img.shields.io/github/license/desplega-ai/agent-swarm?style=flat-square" alt="MIT License"></a> <a href="https://github.com/desplega-ai/agent-swarm/pulls"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen?style=flat-square" alt="PRs Welcome"></a></p>
  2. <p align="center"><b><a href="https://swar.am">Agent Swarm</a> is the open-source, self-hosted AI company operating system built by <a href="https://desplega.sh">Desplega Labs</a>.</b></p>
  3. <!-- It is not OpenAI Swarm, OpenAI's experimental educational library, replaced by the OpenAI Agents SDK. -->
  4. > [!TIP]
  5. > **This repo evolves every single day.** [Watch now →](https://github.com/desplega-ai/agent-swarm/subscription)
  6. <p align="center"><video src="https://github.com/user-attachments/assets/837f385f-403a-4ea7-bd52-8388368a03a3" controls muted playsinline width="720"></video></p>
  7. <p align="center"><sub>▸ <a href="./assets/agent-swarm-every-team.mp4">every team, one swarm</a> · <a href="./assets/agent-swarm.mp4">daily evolution</a> · <a href="./assets/video-source">Making of</a></sub></p>
  8. <p align="center"><a href="https://agent-swarm.dev"><img src="https://img.shields.io/badge/Website-agent--swarm.dev-000?style=for-the-badge" alt="Website"></a> <a href="https://docs.agent-swarm.dev"><img src="https://img.shields.io/badge/Docs-docs.agent--swarm.dev-amber?style=for-the-badge" alt="Docs"></a> <a href="https://app.agent-swarm.dev"><img src="https://img.shields.io/badge/Dashboard-app.agent--swarm.dev-blue?style=for-the-badge" alt="Dashboard"></a> <a href="https://discord.gg/KZgfyyDVZa"><img src="https://img.shields.io/badge/Discord-Join%20Community-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Join Discord"></a> <a href="https://x.com/agent__swarm"><img src="https://img.shields.io/badge/𝕏-@agent____swarm-000?style=for-the-badge&logo=x&logoColor=white" alt="Follow on X"></a> <a href="https://www.linkedin.com/company/desplega-labs/"><img src="https://img.shields.io/badge/LinkedIn-Desplega%20Labs-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white" alt="Desplega Labs on LinkedIn"></a> <a href="https://www.youtube.com/@desplega-labs/videos"><img src="https://img.shields.io/badge/YouTube-Desplega%20Labs-FF0000?style=for-the-badge&logo=youtube&logoColor=white" alt="Desplega Labs on YouTube"></a></p>
  9. agent-swarm.dev is an open-source operating system for AI work. A lead agent delegates goals to workers such as Claude Code or Codex. Isolated containers, shared memory, tools, schedules, and review gates preserve work across sessions.
  10. ## What you get
  11. - A lead agent that receives work from Slack, repositories, issue trackers, email, or the API
  12. - [Schema-validated task results](./MCP.md#send-task) for callers that need structured JSON output
  13. - [Deferred tasks](./MCP.md#defer-task) that wake when all or any watched tasks reach an outcome, or a deadline arrives
  14. - [Inline tool-result images](https://docs.agent-swarm.dev/docs/ui#tool-result-images) in task logs, with previews that open at full size
  15. - [Dashboard file attachments](https://docs.agent-swarm.dev/docs/ui#file-attachments) by paste, drag-and-drop, or file picker
  16. - Workers in isolated Docker containers with development environments
  17. - Memory and identity that persist across sessions, with citation ratings and self-rating hints enabled by default
  18. - Workflows, schedules, scripts, and apps for recurring work
  19. - [Extensions](https://docs.agent-swarm.dev/docs/guides/extensions) for trusted TypeScript hooks, installed as agent-owned inert drafts and activated by a trusted lead, operator, or dashboard user
  20. - [Realtime rooms](./runbooks/realtime-rooms.md) for shared page state, presence, and live channels
  21. - Your choice of harness and models: Claude Code, Codex, pi, opencode, [Cursor](https://docs.agent-swarm.dev/docs/guides/provider-auth/cursor), Amp, [Grok](https://docs.agent-swarm.dev/docs/guides/provider-auth/grok), [fx](https://docs.agent-swarm.dev/docs/guides/provider-auth/fx), Devin, or ACP agents
  22. ```mermaid
  23. flowchart LR
  24. subgraph IN["Tasks come in"]
  25. direction TB
  26. S["Slack"]
  27. G["GitHub / GitLab"]
  28. E["Email"]
  29. A["API / CLI"]
  30. end
  31. LEAD(["Lead Agent<br/>plans &amp; delegates"])
  32. subgraph WORKERS["Workers in Docker"]
  33. direction TB
  34. W1["Worker"]
  35. W2["Worker"]
  36. W3["Worker"]
  37. end
  38. subgraph BRAIN["Persistent brain"]
  39. direction TB
  40. MEM["Memory<br/>(vector search)"]
  41. ID["Identity<br/>(SOUL, CLAUDE.md)"]
  42. end
  43. subgraph OUT["Work ships"]
  44. direction TB
  45. PR["Pull Requests"]
  46. REPLY["Slack replies"]
  47. EMAIL["Email replies"]
  48. end
  49. IN --> LEAD --> WORKERS
  50. WORKERS -->|reads context| BRAIN
  51. WORKERS -->|writes learnings| BRAIN
  52. WORKERS --> OUT
  53. ```
  54. ## Quick Start
  55. Give your coding agent the operator skill for Docker Compose or Kubernetes:
  56. ```bash
  57. npx skills add desplega-ai/agent-swarm
  58. ```
  59. Or install it as a plugin in your harness:
  60. | Harness | Command |
  61. |---|---|
  62. | Claude Code | `/plugin marketplace add desplega-ai/agent-swarm` then `/plugin install agent-swarm@agent-swarm` |
  63. | Codex | `codex plugin marketplace add desplega-ai/agent-swarm && codex plugin add agent-swarm@agent-swarm` (or use `npx skills` above) |
  64. | Cursor | `/add-plugin desplega-ai/agent-swarm` |
  65. | Gemini CLI | `gemini extensions install https://github.com/desplega-ai/agent-swarm` |
  66. | Antigravity / Factory Droid | `droid plugin marketplace add https://github.com/desplega-ai/agent-swarm` then `droid plugin install agent-swarm@agent-swarm` |
  67. | OpenCode, pi, Devin, Kimi, others | `npx skills add desplega-ai/agent-swarm` |
  68. The plugin's [privacy](https://www.agent-swarm.dev/privacy) and
  69. [terms](https://www.agent-swarm.dev/terms) links describe the Agent Swarm website and
  70. Cloud service. The self-hosted software remains covered by the [MIT License](./LICENSE).
  71. Or self-host. [`docker-compose.example.yml`](https://github.com/desplega-ai/agent-swarm/blob/main/docker-compose.example.yml) is the reference deployment: deploy every agent in it by default (1 lead and 11 workers on the official templates), and remove agents only when you have a reason to.
  72. Plan for at least 4 vCPU, 8 GB RAM and 40 GB of free disk, and prune old Docker images after upgrades. See [Host requirements & disk cleanup](https://docs.agent-swarm.dev/docs/guides/host-requirements).
  73. The one-shot installer checks Docker and Compose v2, installs Bun when missing, runs `agent-swarm onboard --yes --preset full` (every official template; it runs one coder where the example runs two), and prints the dashboard `/setup` link:
  74. ```bash
  75. curl -fsSL https://agent-swarm.dev/install.sh | bash
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 95 on GitHub
  76. ```
  77. The raw GitHub URL (`https://raw.githubusercontent.com/desplega-ai/agent-swarm/main/install.sh`) serves the same script. The API is public through a tunnel by default, protected by the API key. Add `bash -s -- --no-tunnel` to keep it local.
  78. No server yet? Deploy the Railway template in one click:
  79. [![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/agent-swarm)
  80. Or [deploy one](https://docs.agent-swarm.dev/docs/guides/one-click-deploy) on any VPS: paste [`deploy/cloud-init.yaml`](./deploy/cloud-init.yaml) as the user data of a new 4 vCPU / 8 GB Ubuntu server (Hetzner, DigitalOcean, Lightsail, Vultr). It installs Docker and Caddy, serves the API over HTTPS on `<ip>.sslip.io` or your domain, and shows the `/setup` link to root at login. To look first, [try it for an hour on E2B](https://docs.agent-swarm.dev/docs/guides/one-click-deploy#try-it-for-an-hour-on-e2b); that trial deletes its data when the sandboxes stop.
  81. Or use the examples directly:
  82. ```bash
  83. git clone https://github.com/desplega-ai/agent-swarm.git && cd agent-swarm
  84. cp .env.docker.example .env # Set API_KEY and the credential for your HARNESS_PROVIDER.
  85. openssl rand -base64 32 > encryption_key
  86. chmod 600 .env encryption_key
  87. docker compose -f docker-compose.example.yml --env-file .env up -d
  88. ```
  89. Agent ID variables are optional. Each container generates a UUID on first boot and keeps it in its personal volume, so identity survives restarts. Pin `*_AGENT_ID` in `.env` only to keep an existing identity or to survive removing volumes.
  90. Read the [Compose checklist](./skills/agent-swarm/references/compose.md) before starting. API: http://localhost:3013, with `/docs` and `/openapi.json`.
  91. Next, open the [dashboard](https://app.agent-swarm.dev) and connect it to your API with `API_KEY`. A new install lands on `/setup`, a guided first run that covers providers, agents, memory, integrations, and a first task.
  92. Kubernetes: [install the OCI Helm chart](./charts/agent-swarm/README.md).
  93. ## Integrations
  94. Slack · GitHub · GitLab · Azure DevOps · Linear · Jira · AgentMail · WhatsApp (Kapso) · Telegram, Teams, Discord and Rocket.Chat ([Chat SDK](https://docs.agent-swarm.dev/docs/integrations/chat-sdk)) · Composio · Sentry · Devin · [Serply search](https://docs.agent-swarm.dev/docs/integrations/serply). [Integration guides](https://docs.agent-swarm.dev/docs/integrations).
  95. AgentMail archives verified inbound deliveries before acknowledging them and retains the archive for 30 days, including mail excluded from task routing. See the [contact inbox triage runbook](runbooks/contact-inbox-triage.md) for retention, coverage limits, and rollout instructions.
  96. ## Learn more
  97. - [Getting started](https://docs.agent-swarm.dev/docs/getting-started) · [Architecture](https://docs.agent-swarm.dev/docs/architecture/overview) · [Playbooks](https://docs.agent-swarm.dev/docs/playbooks) · [CLI](https://docs.agent-swarm.dev/docs/reference/cli) · [API reference](https://docs.agent-swarm.dev/docs/api-reference)
  98. - [Orchestration patterns](./docs/orchestration-patterns.md) — Five patterns for delegating, fanning out, gating on humans, retrying, and persisting multi-step agent work
  99. - [Agent templates](https://templates.agent-swarm.dev)
  100. - [Public ranking](https://docs.agent-swarm.dev/docs/reference/telemetry#public-ranking): opt in with **Get ranked** (Settings → Configuration → Branding) to rank your install by tokens used on [agent-swarm.dev/ranking](https://agent-swarm.dev/ranking). It shows at the next hourly refresh. Token totals are public and exact; telemetry, the organization name and website must be set.
  101. - Help: [contact@desplega.sh](mailto:contact@desplega.sh) · [Discord](https://discord.gg/KZgfyyDVZa)
  102. ## Contributing
  103. Read [CONTRIBUTING.md](./CONTRIBUTING.md), fork the repository, create a branch, and open a PR. Discuss ideas on [Discord](https://discord.gg/KZgfyyDVZa).
  104. > Are you an agent? Run `npx skills add desplega-ai/agent-swarm` or read the [operator skill](./skills/agent-swarm/SKILL.md).
  105. ## Star History
  106. <picture><source media="(prefers-color-scheme: dark)" srcset="https://api.desplega.agent-swarm.dev/p/e3473addceb348c0bed6cb93bd5aa532" /> <source media="(prefers-color-scheme: light)" srcset="https://api.desplega.agent-swarm.dev/p/4b5cdc17c45e4a63845fb0a71ed9609c" /> <img alt="Star History Chart" src="https://api.desplega.agent-swarm.dev/p/4b5cdc17c45e4a63845fb0a71ed9609c" /></picture>
  107. ## License
  108. [MIT](./LICENSE) · 2025-2026 [desplega.sh](https://desplega.sh)
  109. ### Feature defaults
  110. Fresh deployments enable Slack thread renderer v2, queued Slack steering to the lead,
  111. task steering, multi-runtime workers, RBAC, and task-tool preloading. Hybrid memory
  112. search and graph expansion are also enabled. Explicit environment/config overrides
  113. remain supported; see the [environment reference](https://docs.agent-swarm.dev/docs/reference/environment-variables).
  114. When upgrading older workers, keep `MULTI_RUNTIME_ENABLED=false` until they support
  115. runtime identities. Slack delegation rendering remains opt-in, and database retention
  116. continues to default to dry-run.
.claude/internal-skills/onboarding-qa/scripts/inner-turn.sh · Bundled script · 106 lines · 2 findings marked
  1. #!/usr/bin/env bash
  2. # Drive the "user's coding agent" (headless Claude Code) on a QA box, one turn at a time.
  3. #
  4. # inner-turn.sh setup <run> <root|alex> install Claude Code for that user, upload the turn runner
  5. # inner-turn.sh send <run> <message-file> start the next turn on the box (detached, survives SSH drops)
  6. # inner-turn.sh wait <run> [seconds] wait for the running turn (default 540), then fetch + summarize it
  7. # inner-turn.sh turn <run> <message-file> [s] send + wait
  8. #
  9. # Turn 1 creates the session; later turns --resume it. The box user needs
  10. # ~/qa-secrets/CLAUDE_CODE_OAUTH_TOKEN (secrets.sh push). Transcripts land in
  11. # /tmp/onboarding-qa-<run>/turns/<n>.jsonl, summaries in <n>.summary.md.
  12. set -euo pipefail
  13. here="$(cd "$(dirname "$0")" && pwd)"
  14. common="$(git -C "$here" rev-parse --path-format=absolute --git-common-dir)"
  15. ENV_FILE="${ONBOARDING_QA_ENV_FILE:-$(dirname "$common")/.env}"
  16. dir_of() {
  17. local dir="/tmp/onboarding-qa-$1"
  18. [ -f "$dir/ssh_config" ] || { echo "no ssh config at $dir (box.sh up first)" >&2; exit 2; }
  19. echo "$dir"
  20. }
  21. host_of() {
  22. local dir="$1"
  23. [ -f "$dir/inner.env" ] || { echo "run inner-turn.sh setup first" >&2; exit 2; }
  24. grep -E '^HOST=' "$dir/inner.env" | cut -d= -f2
  25. }
  26. cmd_setup() {
  27. local run="$1" who="$2" dir host
  28. dir="$(dir_of "$run")"
  29. case "$who" in root) host=box ;; alex) host=box-user ;; *) echo "user must be root or alex" >&2; exit 2 ;; esac
  30. ssh -F "$dir/ssh_config" "$host" 'command -v claude >/dev/null || [ -x ~/.local/bin/claude ] || curl -fsSL https://claude.ai/install.sh | bash >/dev/null'
  31. ssh -F "$dir/ssh_config" "$host" 'mkdir -p ~/.qa/turns && cat /proc/sys/kernel/random/uuid > ~/.qa/session-id && cat > ~/.qa/turn.sh && chmod +x ~/.qa/turn.sh' <<'RUNNER'
  32. #!/usr/bin/env bash
  33. # One headless turn. Exit code lands in turns/<n>.exit when the turn ends.
  34. set -uo pipefail
  35. n="$1"
  36. q="$HOME/.qa"
  37. export PATH="$HOME/.local/bin:$PATH"
  38. CLAUDE_CODE_OAUTH_TOKEN="$(cat "$HOME/qa-secrets/CLAUDE_CODE_OAUTH_TOKEN")"
  39. export CLAUDE_CODE_OAUTH_TOKEN
  40. # Tags anything the agent runs from this shell (bunx onboard, CLI calls) as QA telemetry.
  41. export DESPLEGA_TELEMETRY_ENV=onboarding-qa
  42. # Claude Code refuses --dangerously-skip-permissions as root unless it is told it runs in a sandbox.
  43. if [ "$(id -u)" = 0 ]; then export IS_SANDBOX=1; fi
  44. sid="$(cat "$q/session-id")"
  45. if [ "$n" = 1 ]; then session=(--session-id "$sid"); else session=(--resume "$sid"); fi
  46. cd "$HOME"
  47. date +%s >"$q/turns/$n.start"
  48. claude -p --output-format stream-json --verbose --dangerously-skip-permissions "${session[@]}" \
  49. <"$q/turns/$n.in" >"$q/turns/$n.jsonl" 2>"$q/turns/$n.err"
  50. echo $? >"$q/turns/$n.exit"
  51. RUNNER
  52. printf 'HOST=%s\nTURN=0\n' "$host" >"$dir/inner.env"
  53. echo "inner agent ready for $who on box ($(ssh -F "$dir/ssh_config" "$host" 'PATH="$HOME/.local/bin:$PATH" claude --version'))"
  54. }
  55. cmd_send() {
  56. local run="$1" msg="$2" dir host n
  57. dir="$(dir_of "$run")"
  58. host="$(host_of "$dir")"
  59. [ -f "$msg" ] || { echo "no message file $msg" >&2; exit 2; }
  60. n=$(($(grep -E '^TURN=' "$dir/inner.env" | cut -d= -f2) + 1))
  61. if [ "$n" -gt 1 ] && ! ssh -F "$dir/ssh_config" "$host" "test -f ~/.qa/turns/$((n - 1)).exit"; then
  62. echo "turn $((n - 1)) is still running: inner-turn.sh wait $run" >&2
  63. exit 1
  64. fi
  65. ssh -F "$dir/ssh_config" "$host" "cat > ~/.qa/turns/$n.in" <"$msg"
  66. cp "$msg" "$dir/turns/$n.in"
  67. ssh -F "$dir/ssh_config" "$host" "setsid nohup ~/.qa/turn.sh $n >/dev/null 2>&1 </dev/null &"
  68. printf 'HOST=%s\nTURN=%s\n' "$host" "$n" >"$dir/inner.env"
  69. echo "turn $n started $(TZ=Europe/Madrid date '+%H:%M:%S') BCN"
  70. }
  71. cmd_wait() {
  72. local run="$1" timeout="${2:-540}" dir host n waited=0
  73. dir="$(dir_of "$run")"
  74. host="$(host_of "$dir")"
  75. n="$(grep -E '^TURN=' "$dir/inner.env" | cut -d= -f2)"
  76. [ "$n" -gt 0 ] || { echo "no turn sent yet" >&2; exit 2; }
  77. until ssh -F "$dir/ssh_config" "$host" "test -f ~/.qa/turns/$n.exit"; do
  78. if [ "$waited" -ge "$timeout" ]; then
  79. echo "turn $n still running after ${waited}s. Call: inner-turn.sh wait $run"
  80. exit 3
  81. fi
  82. sleep 15
  83. waited=$((waited + 15))
  84. done
  85. scp -q -F "$dir/ssh_config" "$host:.qa/turns/$n.jsonl" "$host:.qa/turns/$n.err" "$host:.qa/turns/$n.exit" "$dir/turns/"
  86. # Secrets the install generated (API key, encryption key) are scrubbed too.
  87. ssh -F "$dir/ssh_config" box \
  88. "find /root /home /opt /srv -maxdepth 4 -name .env -not -path '*/node_modules/*' -exec cat {} + 2>/dev/null" \
  89. >"$dir/box.env" || true
  90. chmod 600 "$dir/box.env"
  91. bun "$here/summarize-turn.ts" "$dir/turns/$n.jsonl" --env "$ENV_FILE" --env "$dir/box.env"
  92. }
  93. case "${1:-}" in
  94. setup) cmd_setup "${2:?run id}" "${3:?root|alex}" ;;
  95. send) cmd_send "${2:?run id}" "${3:?message file}" ;;
  96. wait) cmd_wait "${2:?run id}" "${3:-}" ;;
  97. turn) cmd_send "${2:?run id}" "${3:?message file}" && cmd_wait "$2" "${4:-}" ;;
  98. *) sed -n '2,12p' "$0"; exit 2 ;;
  99. esac

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.