# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: OpenAB Kiro
spec:
    description: |
        Open Agent Broker — a lightweight Rust harness that bridges Discord and Slack to any ACP-compatible coding CLI (Claude Code, Codex, Gemini, Kiro) over stdio JSON-RPC. This template uses the Kiro CLI as the agent backend.
        Source: https://github.com/openabdev/openab
    coverImage: https://cdn-console.zeabur.com/f/Xp0H6/openab-cover.webp
    icon: https://cdn-console.zeabur.com/f/0Ewi6/openab-icon.webp
    variables:
        - key: DISCORD_BOT_TOKEN
          type: STRING
          name: Discord Bot Token
          description: Token from https://discord.com/developers/applications
        - key: OPENAB_ALLOWED_CHANNELS
          type: STRING
          name: Discord Channel IDs (optional)
          description: 'Optional. Comma-separated Discord channel IDs where the bot listens. Leave empty to allow all channels. Example: 123456789012345678,234567890123456789'
        - key: OPENAB_ALLOWED_USERS
          type: STRING
          name: Discord User IDs (optional)
          description: Optional. Comma-separated Discord user IDs allowed to interact with the bot. Leave empty to allow everyone in the allowed channels.
        - key: OPENAB_TRUSTED_BOT_IDS
          type: STRING
          name: Trusted Bot IDs (optional)
          description: Optional. Comma-separated Discord bot IDs trusted to send messages to this bot. Leave empty to trust all bots (default). Only applies when Allow Bot Messages is set.
        - key: OPENAB_ALLOW_BOT_MESSAGES
          type: STRING
          name: Allow Bot Messages (optional)
          description: Optional. Set to 'on' to allow messages from bots/webhooks to trigger the agent. Leave empty to disable (default).
        - key: KIRO_API_KEY
          type: STRING
          name: Kiro API Key (optional, Pro+)
          description: Optional. API key for Kiro Pro/Pro+/Power subscribers. Leave empty to authenticate via device flow after deployment (free tier).
        - key: SLACK_BOT_TOKEN
          type: STRING
          name: Slack Bot Token (optional)
          description: Optional. Bot User OAuth Token (xoxb-...) from Slack App settings. Leave empty to disable Slack adapter.
        - key: SLACK_APP_TOKEN
          type: STRING
          name: Slack App Token (optional)
          description: Optional. App-Level Token (xapp-...) for Socket Mode. Required when Slack Bot Token is set.
        - key: OPENAB_MAX_SESSIONS
          type: STRING
          name: Max Concurrent Sessions (optional)
          description: 'Optional. Maximum number of concurrent agent sessions (default: 10). Oldest idle session is evicted when the limit is reached.'
        - key: OPENAB_AGENT_COMMAND
          type: STRING
          name: Agent Command (optional)
          description: 'Optional. Override the agent CLI command (default: kiro-cli). Only change if you know what you''re doing.'
        - key: OPENAB_CONFIG_URL
          type: STRING
          name: Config URL (optional)
          description: Optional. URL to a remote config.toml (https://). When set, the local config file is ignored and this URL is used instead.
    tags:
        - AI
        - Developer Tools
        - Discord
        - Slack
    readme: |
        # OpenAB Kiro

        [OpenAB](https://github.com/openabdev/openab) is a lightweight, open-source Rust harness that bridges Discord to any [Agent Client Protocol](https://github.com/anthropics/agent-protocol)-compatible coding CLI over stdio JSON-RPC.

        This template deploys the Kiro variant using the base `openab` image with `kiro-cli` as the agent backend.

        ## Important Notes

        - **Image tag:** This template tracks the floating `beta` channel and auto-updates with each new OpenAB beta release. Switch to `stable` for production use. To pin a specific version, change the image tag in Zeabur Dashboard → Service → Settings. Available tags: [GitHub Packages](https://github.com/openabdev/openab/pkgs/container/openab).
        - **Persistent storage:** `/home/agent` is mounted as a persistent volume. Plugins, settings, config, and credentials survive restarts.

        ## Setup

        ### 1. Get a Discord Bot Token

        1. Go to https://discord.com/developers/applications and click **New Application**
        2. Navigate to **Bot** tab → click **Reset Token** → copy the token
        3. On the same page, scroll down and enable **Message Content Intent** under Privileged Gateway Intents
        4. Go to **OAuth2 → URL Generator** → check scope `bot` → check permissions: Send Messages, Send Messages in Threads, Create Public Threads, Read Message History, Add Reactions, Manage Messages
        5. Copy the generated URL and open it in your browser to invite the bot to your server

        ### 2. Get Discord Channel IDs

        1. Open Discord → go to **User Settings** (gear icon) → **Advanced** → enable **Developer Mode**
        2. Right-click the channel where you want the bot to respond → **Copy Channel ID**
        3. For multiple channels, separate IDs with commas: `123456789012345678,234567890123456789`

        ### 3. Get a Kiro API Key (Pro/Pro+/Power only)

        If you have a paid Kiro subscription, go to [kiro.dev](https://kiro.dev) → Settings → API Keys → create a key and paste it into the `KIRO_API_KEY` variable. This lets the bot authenticate automatically — no post-deploy steps needed.

        Free tier users can leave `KIRO_API_KEY` empty and authenticate after deployment (see step 5).

        ### 4. Deploy

        Fill in the variables and click deploy. The service connects to Discord automatically.

        ### 5. Authenticate Kiro via Device Flow (Free tier only)

        Skip this step if you set `KIRO_API_KEY` in step 3.

        After the service is running, open the service terminal in Zeabur Dashboard and run:

        ```
        runuser -u agent -- kiro-cli login --use-device-flow
        ```

        > ℹ️ `runuser -u agent` runs the login as the `agent` user, so credentials are owned correctly from the start — no chown or restart needed.

        Follow the on-screen URL and code to complete device flow authorization in your browser. New conversations will pick up the new auth automatically — restart only if you need to invalidate existing in-memory sessions.

        ## Slack Setup (Optional)

        OpenAB supports Slack via Socket Mode — no public URL needed.

        1. Go to https://api.slack.com/apps → **Create New App** → **From scratch**
        2. **Socket Mode** → Enable → generate an App-Level Token with scope `connections:write` → copy the `xapp-...` token (`SLACK_APP_TOKEN`)
        3. **Event Subscriptions** → Enable Events → add bot events: `app_mention`, `message.channels`, `message.groups`
        4. **OAuth & Permissions** → Bot Token Scopes → add: `app_mentions:read`, `chat:write`, `channels:history`, `groups:history`, `channels:read`, `groups:read`, `reactions:write`, `files:read`, `users:read`
        5. **Install App** → Install to Workspace → copy the `xoxb-...` token (`SLACK_BOT_TOKEN`)
        6. In each Slack channel you want the bot in, run `/invite @YourAppName`

        Set `SLACK_BOT_TOKEN` and `SLACK_APP_TOKEN` in the template variables before deploying. Both Discord and Slack can run simultaneously.

        ## Add Messaging Platforms (Telegram / LINE / Feishu / Google Chat / MS Teams / WeCom)

        For Telegram, deploy the [OpenAB Telegram template](https://zeabur.com/templates/12LLKI) and switch its image tag to `beta-kiro` with the matching `OPENAB_AGENT_COMMAND`. Other platforms are enabled by environment variables in unified mode (`LINE_CHANNEL_SECRET`, `FEISHU_APP_ID`, `GOOGLE_CHAT_ENABLED=true`, `TEAMS_APP_ID`, `WECOM_CORP_ID`) — see the [OpenAB docs](https://github.com/openabdev/openab/tree/main/docs). Webhook platforms need a public HTTPS domain on the service (port 8080); Feishu connects outbound via WebSocket and needs no domain.

        ## Usage

        - **@mention the bot** in an allowed channel or Slack channel to start a conversation
        - OpenAB creates a **thread** for multi-turn conversations — no @mention needed for follow-ups
        - Each thread maps to a persistent Kiro session (24h TTL)

        ## Customization

        | File | Description |
        |------|-------------|
        | `/home/agent/.config/openab/config.toml` | OpenAB config (sessions, reactions, STT, etc.) |

        `config.toml` is created from a built-in template on first boot. After that, edit the file directly — environment variables are only used for initial setup. To reset to defaults, delete the file and restart: `rm /home/agent/.config/openab/config.toml`

        For config options, see the [OpenAB documentation](https://github.com/openabdev/openab).

        ## Disabling

        Leave `Discord Bot Token` empty. The service sleeps instead of crashing.

        ## Links

        - [OpenAB GitHub](https://github.com/openabdev/openab)
        - [Agent Client Protocol](https://github.com/anthropics/agent-protocol)
    resourceRequirement:
        minConfig:
            cpu: 2
            ram: 4
        recommendedConfig:
            cpu: 4
            ram: 8
    services:
        - name: openab
          icon: https://cdn-console.zeabur.com/f/0Ewi6/openab-icon.webp
          template: PREBUILT_V2
          spec:
            id: openab
            source:
                image: ghcr.io/openabdev/openab:beta-kiro
                command:
                    - /bin/sh
                    - -c
                    - /opt/start-openab.sh
                runAsUserID: 1000
            volumes:
                - id: agent-home
                  dir: /home/agent
            env:
                DISCORD_BOT_TOKEN:
                    default: ${DISCORD_BOT_TOKEN}
                KIRO_API_KEY:
                    default: ""
                OPENAB_AGENT_COMMAND:
                    default: kiro-cli
                OPENAB_ALLOW_BOT_MESSAGES:
                    default: ""
                OPENAB_ALLOWED_CHANNELS:
                    default: ""
                OPENAB_ALLOWED_USERS:
                    default: ""
                OPENAB_CONFIG_URL:
                    default: ""
                OPENAB_MAX_SESSIONS:
                    default: ""
                OPENAB_TRUSTED_BOT_IDS:
                    default: ""
                SLACK_APP_TOKEN:
                    default: ""
                SLACK_BOT_TOKEN:
                    default: ""
            configs:
                - path: /opt/start-openab.sh
                  template: |
                    #!/bin/sh
                    set -e

                    # Initialize shell dotfiles and fix ownership for persistent volume
                    if [ ! -f /home/agent/.bashrc ]; then
                      cp /etc/skel/.bashrc /home/agent/.bashrc 2>/dev/null || true
                      cp /etc/skel/.profile /home/agent/.profile 2>/dev/null || true
                      cp /etc/skel/.bash_logout /home/agent/.bash_logout 2>/dev/null || true
                    fi

                    # Fix ownership for persistent volume when startup runs as root
                    if [ "$(id -u)" = "0" ]; then
                      chown -R agent:agent /home/agent
                      chmod 755 /home/agent/.config 2>/dev/null || true
                    fi

                    if [ -z "$DISCORD_BOT_TOKEN" ] && [ -z "$SLACK_BOT_TOKEN" ]; then
                      echo "openab: neither DISCORD_BOT_TOKEN nor SLACK_BOT_TOKEN set — sleeping"
                      exec sleep infinity
                    fi

                    CONFIG_DIR=/home/agent/.config/openab
                    CONFIG_FILE=$CONFIG_DIR/config.toml
                    mkdir -p "$CONFIG_DIR"

                    # Generate config.toml on first boot only
                    # To regenerate, delete the file and restart
                    if [ ! -f "$CONFIG_FILE" ]; then
                      cp /opt/config.toml.template "$CONFIG_FILE"

                      # Add [discord] section if token provided
                      if [ -n "$DISCORD_BOT_TOKEN" ]; then
                        printf '\n[discord]\nbot_token = "${DISCORD_BOT_TOKEN}"\n' >> "$CONFIG_FILE"
                        if [ -n "$OPENAB_ALLOW_BOT_MESSAGES" ]; then
                          printf 'allow_bot_messages = "%s"\n' "$OPENAB_ALLOW_BOT_MESSAGES" >> "$CONFIG_FILE"
                        fi
                        if [ -n "$OPENAB_ALLOWED_CHANNELS" ]; then
                          IFS=','; channels=""; for id in $OPENAB_ALLOWED_CHANNELS; do
                            id=$(echo "$id" | tr -d ' '); [ -n "$id" ] && channels="${channels}\"${id}\","; done; unset IFS
                          printf 'allowed_channels = [%s]\n' "$(echo "$channels" | sed 's/,$//')" >> "$CONFIG_FILE"
                        fi
                        if [ -n "$OPENAB_ALLOWED_USERS" ]; then
                          IFS=','; users=""; for id in $OPENAB_ALLOWED_USERS; do
                            id=$(echo "$id" | tr -d ' '); [ -n "$id" ] && users="${users}\"${id}\","; done; unset IFS
                          printf 'allowed_users = [%s]\n' "$(echo "$users" | sed 's/,$//')" >> "$CONFIG_FILE"
                        fi
                        if [ -n "$OPENAB_TRUSTED_BOT_IDS" ]; then
                          IFS=','; bots=""; for id in $OPENAB_TRUSTED_BOT_IDS; do
                            id=$(echo "$id" | tr -d ' '); [ -n "$id" ] && bots="${bots}\"${id}\","; done; unset IFS
                          printf 'trusted_bot_ids = [%s]\n' "$(echo "$bots" | sed 's/,$//')" >> "$CONFIG_FILE"
                        fi
                      fi

                      # Add [slack] section if tokens provided
                      if [ -n "$SLACK_BOT_TOKEN" ] && [ -n "$SLACK_APP_TOKEN" ]; then
                        printf '\n[slack]\nbot_token = "${SLACK_BOT_TOKEN}"\napp_token = "${SLACK_APP_TOKEN}"\n' >> "$CONFIG_FILE"
                      fi

                      # Add [pool] section if max_sessions provided
                      if [ -n "$OPENAB_MAX_SESSIONS" ]; then
                        printf '\n[pool]\nmax_sessions = %s\n' "$OPENAB_MAX_SESSIONS" >> "$CONFIG_FILE"
                      fi

                      echo "openab: config.toml generated"
                    else
                      echo "openab: using existing config.toml (delete to regenerate)"
                    fi

                    if [ "$(id -u)" = "0" ]; then
                      chown -R agent:agent "$CONFIG_DIR"
                      exec runuser -u agent --preserve-environment -- openab run --config "${OPENAB_CONFIG_URL:-$CONFIG_FILE}"
                    fi

                    exec openab run --config "${OPENAB_CONFIG_URL:-$CONFIG_FILE}"
                  permission: 493
                  envsubst: null
                - path: /opt/config.toml.template
                  template: |
                    [agent]
                    args = ["acp", "--trust-all-tools"]
                  permission: null
                  envsubst: null
localization:
    es-ES:
        description: |
            Open Agent Broker — un arnés ligero en Rust que conecta Discord y Slack con cualquier CLI de coding compatible con ACP (Claude Code, Codex, Gemini, Kiro) a través de stdio JSON-RPC. Esta plantilla usa Kiro CLI como backend de agente.
            Fuente: https://github.com/openabdev/openab
        variables:
            - key: DISCORD_BOT_TOKEN
              type: STRING
              name: Token del Bot de Discord
              description: Token obtenido de https://discord.com/developers/applications
            - key: KIRO_API_KEY
              type: STRING
              name: Kiro API Key (opcional, plan Pro+)
              description: Opcional. Los suscriptores de Kiro Pro/Pro+/Power pueden ingresar su API Key para omitir el login manual tras el despliegue. Dejar vacío en el plan gratuito y autenticarse con device flow después.
            - key: OPENAB_ALLOWED_CHANNELS
              type: STRING
              name: IDs de Canales de Discord (opcional)
              description: 'Opcional. IDs de canales de Discord donde el bot escucha, separados por comas. Dejar vacío para permitir todos los canales. Ejemplo: 123456789012345678,234567890123456789'
            - key: OPENAB_ALLOWED_USERS
              type: STRING
              name: IDs de Usuarios de Discord (opcional)
              description: Opcional. IDs de usuarios de Discord permitidos para interactuar con el bot, separados por comas. Dejar vacío para permitir a todos en los canales permitidos.
        readme: |
            # OpenAB Kiro

            [OpenAB](https://github.com/openabdev/openab) es un arnés ligero de código abierto en Rust que conecta Discord con cualquier CLI de coding compatible con [Agent Client Protocol](https://github.com/anthropics/agent-protocol) a través de stdio JSON-RPC.

            Esta plantilla despliega la variante Kiro, usando la imagen base `openab` con `kiro-cli` como backend de agente.

            ## Notas Importantes

            - **Etiqueta de imagen:** Esta plantilla rastrea la etiqueta flotante `beta` y se actualiza automáticamente con cada nueva versión beta de OpenAB. Para fijar una versión específica, cambie la etiqueta de imagen en Zeabur Dashboard → Servicio → Configuración. Etiquetas disponibles: [GitHub Packages](https://github.com/openabdev/openab/pkgs/container/openab).
            - **Almacenamiento persistente:** `/home/agent` está montado como volumen persistente. Plugins, configuración y credenciales se conservan entre reinicios.

            ## Configuración

            ### 1. Obtener el Discord Bot Token

            1. Ir a https://discord.com/developers/applications y hacer clic en **New Application**
            2. Ir a la pestaña **Bot** → clic en **Reset Token** → copiar el token
            3. En la misma página, bajar y habilitar **Message Content Intent** en Privileged Gateway Intents
            4. Ir a **OAuth2 → URL Generator** → marcar scope `bot` → marcar permisos: Send Messages, Send Messages in Threads, Create Public Threads, Read Message History, Add Reactions, Manage Messages
            5. Copiar la URL generada y abrirla en el navegador para invitar al Bot al servidor

            ### 2. Obtener IDs de canales de Discord

            1. Abrir Discord → **Ajustes de usuario** (icono de engranaje) → **Avanzado** → activar **Modo desarrollador**
            2. Clic derecho en el canal donde quieres que el Bot responda → **Copiar ID del canal**
            3. Para múltiples canales, separar con comas: `123456789012345678,234567890123456789`

            ### 3. Obtener una Kiro API Key (solo plan Pro/Pro+/Power)

            Si tienes una suscripción de pago de Kiro, ve a [kiro.dev](https://kiro.dev) → Settings → API Keys, crea una key y pégala en la variable `KIRO_API_KEY`. El servicio se autenticará automáticamente sin pasos post-despliegue.

            Los usuarios del plan gratuito pueden dejar `KIRO_API_KEY` vacío y autenticarse después del despliegue en el paso 5.

            ### 4. Desplegar

            Completa las variables y haz clic en desplegar. El servicio se conecta a Discord automáticamente.

            ### 5. Autenticar Kiro con Device Flow (solo plan gratuito)

            Omite este paso si configuraste `KIRO_API_KEY` en el paso 3.

            Después de que el servicio esté ejecutándose, abre la terminal del servicio en Zeabur Dashboard y ejecuta:

            ```
            runuser -u agent -- kiro-cli login --use-device-flow
            ```

            > ℹ️ `runuser -u agent` ejecuta el login como el usuario `agent`, por lo que las credenciales pertenecen al dueño correcto desde el inicio — sin chown ni reinicio necesarios.

            Sigue la URL y el código en pantalla para completar la autorización en tu navegador. Las nuevas conversaciones aplicarán la nueva autenticación automáticamente — solo reinicia si necesitas invalidar las sesiones existentes en memoria.

            ## Configuración de Slack (Opcional)

            OpenAB soporta Slack mediante Socket Mode — no se necesita URL pública.

            1. Ir a https://api.slack.com/apps → **Create New App** → **From scratch**
            2. **Socket Mode** → Habilitar → generar App-Level Token con scope `connections:write` → copiar el token `xapp-...` (`SLACK_APP_TOKEN`)
            3. **Event Subscriptions** → Habilitar → añadir bot events: `app_mention`, `message.channels`, `message.groups`
            4. **OAuth & Permissions** → Bot Token Scopes → añadir: `app_mentions:read`, `chat:write`, `channels:history`, `groups:history`, `channels:read`, `groups:read`, `reactions:write`, `files:read`, `users:read`
            5. **Install App** → Instalar en el workspace → copiar el token `xoxb-...` (`SLACK_BOT_TOKEN`)
            6. En cada canal de Slack donde quieras usar el bot, ejecuta `/invite @YourAppName`

            Rellena `SLACK_BOT_TOKEN` y `SLACK_APP_TOKEN` antes de desplegar. Discord y Slack pueden funcionar simultáneamente.

            ## Añadir plataformas de mensajería (Telegram / LINE / Feishu / Google Chat / MS Teams / WeCom)

            Para Telegram, despliega la [plantilla OpenAB Telegram](https://zeabur.com/templates/12LLKI) y cambia su image tag a `beta-kiro` con el `OPENAB_AGENT_COMMAND` correspondiente. Las demás plataformas se habilitan mediante variables de entorno en modo unified (`LINE_CHANNEL_SECRET`, `FEISHU_APP_ID`, `GOOGLE_CHAT_ENABLED=true`, `TEAMS_APP_ID`, `WECOM_CORP_ID`) — consulta la [documentación de OpenAB](https://github.com/openabdev/openab/tree/main/docs). Las plataformas webhook necesitan un dominio HTTPS público en el servicio (puerto 8080); Feishu se conecta por WebSocket saliente y no necesita dominio.

            ## Uso

            - **@mencionar al bot** en un canal de Discord o Slack permitido para iniciar una conversación
            - OpenAB crea un **thread** para conversaciones de múltiples turnos — no se necesita @mención en los mensajes siguientes
            - Cada thread corresponde a una sesión persistente de Kiro (TTL de 24h por defecto)

            ## Personalización

            | Archivo | Descripción |
            |---------|-------------|
            | `/home/agent/.config/openab/config.toml` | Configuración de OpenAB (sessions, reactions, STT, etc.) |

            `config.toml` se crea a partir de una plantilla integrada en el primer arranque. Después, edite el archivo directamente — las variables de entorno solo se usan para la configuración inicial. Para restablecer los valores predeterminados, elimine y reinicie: `rm /home/agent/.config/openab/config.toml`

            Para opciones de configuración, consulte la [documentación de OpenAB](https://github.com/openabdev/openab).

            ## Desactivar

            Dejar `Discord Bot Token` vacío al desplegar. El servicio entrará en modo sleep sin fallar.

            ## Enlaces

            - [OpenAB GitHub](https://github.com/openabdev/openab)
            - [Agent Client Protocol](https://github.com/anthropics/agent-protocol)
    id-ID:
        description: |
            Open Agent Broker — harness Rust yang ringan untuk menjembatani Discord dan Slack ke CLI coding yang kompatibel dengan ACP (Claude Code, Codex, Gemini, Kiro) melalui stdio JSON-RPC. Template ini menggunakan Kiro CLI sebagai backend agen.
            Sumber: https://github.com/openabdev/openab
        variables:
            - key: DISCORD_BOT_TOKEN
              type: STRING
              name: Token Bot Discord
              description: Token dari https://discord.com/developers/applications
            - key: KIRO_API_KEY
              type: STRING
              name: Kiro API Key (opsional, paket Pro+)
              description: Opsional. Pelanggan Kiro Pro/Pro+/Power dapat memasukkan API Key agar tidak perlu login manual setelah deploy. Kosongkan untuk paket gratis dan autentikasi dengan device flow setelahnya.
            - key: OPENAB_ALLOWED_CHANNELS
              type: STRING
              name: ID Channel Discord (opsional)
              description: 'Opsional. ID channel Discord tempat bot mendengarkan, dipisahkan koma. Kosongkan untuk mengizinkan semua channel. Contoh: 123456789012345678,234567890123456789'
            - key: OPENAB_ALLOWED_USERS
              type: STRING
              name: ID Pengguna Discord (opsional)
              description: Opsional. ID pengguna Discord yang diizinkan berinteraksi dengan bot, dipisahkan koma. Kosongkan untuk mengizinkan semua orang di channel yang diizinkan.
        readme: |
            # OpenAB Kiro

            [OpenAB](https://github.com/openabdev/openab) adalah harness Rust yang ringan dan open-source yang menjembatani Discord ke CLI coding yang kompatibel dengan [Agent Client Protocol](https://github.com/anthropics/agent-protocol) melalui stdio JSON-RPC.

            Template ini men-deploy varian Kiro menggunakan image dasar `openab` dengan `kiro-cli` sebagai backend agen.

            ## Catatan Penting

            - **Tag image:** Template ini mengikuti tag floating `beta` dan otomatis ikut rilis beta OpenAB terbaru. Untuk pin ke versi tertentu, ubah tag image di Zeabur Dashboard → Layanan → Pengaturan. Tag yang tersedia: [GitHub Packages](https://github.com/openabdev/openab/pkgs/container/openab).
            - **Penyimpanan persisten:** `/home/agent` di-mount sebagai volume persisten. Plugin, pengaturan, config, dan kredensial dipertahankan antar restart.

            ## Pengaturan

            ### 1. Dapatkan Discord Bot Token

            1. Buka https://discord.com/developers/applications dan klik **New Application**
            2. Buka tab **Bot** → klik **Reset Token** → salin token
            3. Di halaman yang sama, scroll ke bawah dan aktifkan **Message Content Intent** di Privileged Gateway Intents
            4. Buka **OAuth2 → URL Generator** → centang scope `bot` → centang izin: Send Messages, Send Messages in Threads, Create Public Threads, Read Message History, Add Reactions, Manage Messages
            5. Salin URL yang dihasilkan dan buka di browser untuk mengundang Bot ke server Anda

            ### 2. Dapatkan ID Channel Discord

            1. Buka Discord → **Pengaturan Pengguna** (ikon roda gigi) → **Lanjutan** → aktifkan **Mode Pengembang**
            2. Klik kanan channel tempat Anda ingin Bot merespons → **Salin ID Channel**
            3. Untuk beberapa channel, pisahkan dengan koma: `123456789012345678,234567890123456789`

            ### 3. Dapatkan Kiro API Key (hanya paket Pro/Pro+/Power)

            Jika Anda memiliki langganan Kiro berbayar, buka [kiro.dev](https://kiro.dev) → Settings → API Keys, buat key dan masukkan ke variabel `KIRO_API_KEY`. Layanan akan otentikasi secara otomatis tanpa langkah manual setelah deploy.

            Pengguna paket gratis dapat mengosongkan `KIRO_API_KEY` dan autentikasi setelah deploy di langkah 5.

            ### 4. Deploy

            Isi variabel dan klik deploy. Layanan akan terhubung ke Discord secara otomatis.

            ### 5. Autentikasi Kiro via Device Flow (hanya paket gratis)

            Lewati langkah ini jika Anda mengisi `KIRO_API_KEY` di langkah 3.

            Setelah layanan berjalan, buka terminal layanan di Zeabur Dashboard dan jalankan:

            ```
            runuser -u agent -- kiro-cli login --use-device-flow
            ```

            > ℹ️ `runuser -u agent` menjalankan login sebagai pengguna `agent`, sehingga kredensial dimiliki oleh pemilik yang benar sejak awal — tanpa chown atau restart.

            Ikuti URL dan kode di layar untuk menyelesaikan otorisasi device flow di browser Anda. Percakapan baru akan otomatis menggunakan autentikasi baru — restart hanya diperlukan jika Anda ingin membatalkan sesi yang masih berjalan di memori.

            ## Pengaturan Slack (Opsional)

            OpenAB mendukung Slack melalui Socket Mode — tidak perlu URL publik.

            1. Buka https://api.slack.com/apps → **Create New App** → **From scratch**
            2. **Socket Mode** → Aktifkan → buat App-Level Token dengan scope `connections:write` → salin token `xapp-...` (`SLACK_APP_TOKEN`)
            3. **Event Subscriptions** → Aktifkan → tambahkan bot events: `app_mention`, `message.channels`, `message.groups`
            4. **OAuth & Permissions** → Bot Token Scopes → tambahkan: `app_mentions:read`, `chat:write`, `channels:history`, `groups:history`, `channels:read`, `groups:read`, `reactions:write`, `files:read`, `users:read`
            5. **Install App** → Install ke workspace → salin token `xoxb-...` (`SLACK_BOT_TOKEN`)
            6. Di setiap channel Slack yang ingin menggunakan bot, jalankan `/invite @YourAppName`

            Isi `SLACK_BOT_TOKEN` dan `SLACK_APP_TOKEN` sebelum deploy. Discord dan Slack dapat berjalan bersamaan.

            ## Tambahkan Platform Pesan (Telegram / LINE / Feishu / Google Chat / MS Teams / WeCom)

            Untuk Telegram, deploy [template OpenAB Telegram](https://zeabur.com/templates/12LLKI) dan ganti image tag-nya ke `beta-kiro` dengan `OPENAB_AGENT_COMMAND` yang sesuai. Platform lain diaktifkan lewat variabel lingkungan pada unified mode (`LINE_CHANNEL_SECRET`, `FEISHU_APP_ID`, `GOOGLE_CHAT_ENABLED=true`, `TEAMS_APP_ID`, `WECOM_CORP_ID`) — lihat [dokumentasi OpenAB](https://github.com/openabdev/openab/tree/main/docs). Platform webhook memerlukan domain HTTPS publik pada layanan (port 8080); Feishu terhubung keluar via WebSocket dan tidak butuh domain.

            ## Penggunaan

            - **@mention bot** di channel Discord atau Slack yang diizinkan untuk memulai percakapan
            - OpenAB membuat **thread** untuk percakapan multi-giliran — tidak perlu @mention untuk pesan selanjutnya
            - Setiap thread dipetakan ke sesi Kiro yang persisten (TTL 24 jam secara default)

            ## Kustomisasi

            | File | Deskripsi |
            |------|-----------|
            | `/home/agent/.config/openab/config.toml` | Konfigurasi OpenAB (sessions, reactions, STT, dll.) |

            `config.toml` dibuat dari template bawaan saat boot pertama. Setelah itu, edit file secara langsung — variabel lingkungan hanya digunakan untuk pengaturan awal. Untuk mengembalikan ke default, hapus dan restart: `rm /home/agent/.config/openab/config.toml`

            Untuk opsi konfigurasi, lihat [dokumentasi OpenAB](https://github.com/openabdev/openab).

            ## Menonaktifkan

            Kosongkan `Discord Bot Token` saat deploy. Layanan akan tidur tanpa crash.

            ## Tautan

            - [OpenAB GitHub](https://github.com/openabdev/openab)
            - [Agent Client Protocol](https://github.com/anthropics/agent-protocol)
    ja-JP:
        description: |
            Open Agent Broker — stdio JSON-RPC を通じて Discord と Slack を ACP 対応の coding CLI（Claude Code、Codex、Gemini、Kiro）にブリッジする軽量な Rust ハーネス。このテンプレートは Kiro CLI をエージェントバックエンドとして使用します。
            ソース：https://github.com/openabdev/openab
        variables:
            - key: DISCORD_BOT_TOKEN
              type: STRING
              name: Discord Bot トークン
              description: https://discord.com/developers/applications から取得したトークン
            - key: KIRO_API_KEY
              type: STRING
              name: Kiro API Key（オプション、Pro+ プラン）
              description: オプション。Kiro Pro/Pro+/Power 加入者は API Key を入力することで、デプロイ後の手動ログインが不要になります。無料プランは空にして、デプロイ後に device flow で認証してください。
            - key: OPENAB_ALLOWED_CHANNELS
              type: STRING
              name: Discord チャンネル ID（オプション）
              description: オプション。Bot が監視する Discord チャンネル ID（カンマ区切り）。空の場合、全チャンネルで応答。例：123456789012345678,234567890123456789
            - key: OPENAB_ALLOWED_USERS
              type: STRING
              name: Discord ユーザー ID（オプション）
              description: オプション。Bot と対話できるユーザーの Discord ユーザー ID（カンマ区切り）。空の場合、許可チャンネルの全員が利用可能。
        readme: |
            # OpenAB Kiro

            [OpenAB](https://github.com/openabdev/openab) は、stdio JSON-RPC を通じて Discord を [Agent Client Protocol](https://github.com/anthropics/agent-protocol) 対応の coding CLI にブリッジする軽量なオープンソース Rust ハーネスです。

            このテンプレートは Kiro バリアントをデプロイし、ベース `openab` イメージと `kiro-cli` をエージェントバックエンドとして使用します。

            ## 注意事項

            - **イメージタグ：** このテンプレートは floating `beta` タグを追跡し、OpenAB の新しい beta リリースが公開されると自動的に更新されます。特定のバージョンに pin するには、Zeabur Dashboard → サービス → 設定でイメージタグを変更してください。利用可能なタグ：[GitHub Packages](https://github.com/openabdev/openab/pkgs/container/openab)。
            - **永続ストレージ：** `/home/agent` が永続ボリュームとしてマウントされます。プラグイン、設定、config、認証情報は再起動後も保持されます。

            ## セットアップ

            ### 1. Discord Bot Token の取得

            1. https://discord.com/developers/applications にアクセスし、**New Application** をクリック
            2. **Bot** タブ → **Reset Token** をクリック → token をコピー
            3. 同じページを下にスクロールし、Privileged Gateway Intents の **Message Content Intent** を有効化
            4. **OAuth2 → URL Generator** → scope `bot` にチェック → 権限にチェック：Send Messages、Send Messages in Threads、Create Public Threads、Read Message History、Add Reactions、Manage Messages
            5. 生成された URL をコピーし、ブラウザで開いて Bot をサーバーに招待

            ### 2. Discord チャンネル ID の取得

            1. Discord を開く → **ユーザー設定**（歯車アイコン）→ **詳細設定** → **開発者モード** を有効化
            2. Bot に応答させたいチャンネルを右クリック → **チャンネル ID をコピー**
            3. 複数チャンネルはカンマで区切る：`123456789012345678,234567890123456789`

            ### 3. Kiro API Key の取得（Pro/Pro+/Power プランのみ）

            有料の Kiro サブスクリプションをお持ちの場合、[kiro.dev](https://kiro.dev) → Settings → API Keys で key を作成し、`KIRO_API_KEY` 変数に入力してください。サービスが自動的に認証されるため、デプロイ後の手動操作は不要です。

            無料プランのユーザーは `KIRO_API_KEY` を空のままにし、デプロイ後にステップ 5 で認証してください。

            ### 4. デプロイ

            変数を入力してデプロイをクリック。サービスは自動的に Discord に接続します。

            ### 5. Device Flow で Kiro を認証（無料プランのみ）

            ステップ 3 で `KIRO_API_KEY` を入力した場合はこのステップをスキップしてください。

            サービスが起動した後、Zeabur Dashboard でサービスターミナルを開き、以下を実行：

            ```
            runuser -u agent -- kiro-cli login --use-device-flow
            ```

            > ℹ️ `runuser -u agent` は `agent` ユーザーとしてログインを実行するため、認証ファイルは最初から正しい所有者になります — chown や再起動は不要です。

            画面に表示される URL とコードをブラウザで開いて認証を完了してください。新しい会話は自動的に新しい認証を使用します — メモリ上の既存セッションを無効化したい場合のみ再起動してください。

            ## Slack セットアップ（オプション）

            OpenAB は Socket Mode 経由で Slack をサポートします — 公開 URL は不要です。

            1. https://api.slack.com/apps → **Create New App** → **From scratch**
            2. **Socket Mode** → 有効化 → scope `connections:write` で App-Level Token を生成 → `xapp-...` token をコピー（`SLACK_APP_TOKEN`）
            3. **Event Subscriptions** → 有効化 → bot events を追加：`app_mention`、`message.channels`、`message.groups`
            4. **OAuth & Permissions** → Bot Token Scopes → 追加：`app_mentions:read`、`chat:write`、`channels:history`、`groups:history`、`channels:read`、`groups:read`、`reactions:write`、`files:read`、`users:read`
            5. **Install App** → ワークスペースにインストール → `xoxb-...` token をコピー（`SLACK_BOT_TOKEN`）
            6. Bot を使用したい各 Slack チャンネルで `/invite @YourAppName` を実行

            デプロイ前に `SLACK_BOT_TOKEN` と `SLACK_APP_TOKEN` 変数を入力してください。Discord と Slack は同時に使用できます。

            ## メッセージプラットフォームを追加（Telegram / LINE / Feishu / Google Chat / MS Teams / WeCom）

            Telegram を使う場合は [OpenAB Telegram テンプレート](https://zeabur.com/templates/12LLKI) をデプロイし、image tag を `beta-kiro` に変更して対応する `OPENAB_AGENT_COMMAND` を設定してください。その他のプラットフォームは unified mode で環境変数から直接有効化できます（`LINE_CHANNEL_SECRET`、`FEISHU_APP_ID`、`GOOGLE_CHAT_ENABLED=true`、`TEAMS_APP_ID`、`WECOM_CORP_ID`）。詳細は [OpenAB ドキュメント](https://github.com/openabdev/openab/tree/main/docs) を参照。Webhook 型プラットフォームはサービスに公開 HTTPS ドメイン（port 8080）が必要です。Feishu は WebSocket でアウトバウンド接続するためドメイン不要です。

            ## 使い方

            - 許可された Discord または Slack チャンネルで **Bot を @mention** して会話を開始
            - OpenAB は自動的に **thread** を作成してマルチターン会話を行います — 以降のメッセージでは @mention 不要
            - 各 thread は永続的な Kiro session に対応（デフォルト 24 時間 TTL）

            ## カスタマイズ

            | ファイル | 説明 |
            |---------|------|
            | `/home/agent/.config/openab/config.toml` | OpenAB 設定（sessions、reactions、STT など） |

            `config.toml` は初回起動時に内蔵テンプレートから作成されます。以降の変更はファイルを直接編集してください。環境変数は初期設定時のみ使用されます。デフォルトに戻すにはファイルを削除して再起動：`rm /home/agent/.config/openab/config.toml`

            設定オプションは [OpenAB ドキュメント](https://github.com/openabdev/openab) を参照。

            ## 無効化

            デプロイ時に `Discord Bot Token` を空にしてください。サービスはクラッシュせずスリープ状態になります。

            ## リンク

            - [OpenAB GitHub](https://github.com/openabdev/openab)
            - [Agent Client Protocol](https://github.com/anthropics/agent-protocol)
    zh-CN:
        description: |
            Open Agent Broker — 轻量的 Rust 程序，通过 stdio JSON-RPC 将 Discord 和 Slack 桥接到任何 ACP 兼容的 coding CLI（Claude Code、Codex、Gemini、Kiro）。此模板使用 Kiro CLI 作为 agent 后端。
            来源：https://github.com/openabdev/openab
        variables:
            - key: DISCORD_BOT_TOKEN
              type: STRING
              name: Discord Bot Token
              description: 从 https://discord.com/developers/applications 获取的 Token
            - key: KIRO_API_KEY
              type: STRING
              name: Kiro API Key（选填，Pro+ 方案）
              description: 选填。Kiro Pro/Pro+/Power 订阅者可填入 API Key，部署后无需手动登录。免费方案留空，部署后使用 device flow 认证。
            - key: OPENAB_ALLOWED_CHANNELS
              type: STRING
              name: Discord 频道 ID（选填）
              description: 选填。Bot 监听的 Discord 频道 ID，以逗号分隔。留空则允许所有频道。示例：123456789012345678,234567890123456789
            - key: OPENAB_ALLOWED_USERS
              type: STRING
              name: Discord 用户 ID（选填）
              description: 选填。以逗号分隔的 Discord 用户 ID，限制可与 Bot 互动的用户。留空则允许频道中所有人。
        readme: |
            # OpenAB Kiro

            [OpenAB](https://github.com/openabdev/openab) 是一个轻量的开源 Rust 程序，通过 stdio JSON-RPC 将 Discord 桥接到任何支持 [Agent Client Protocol](https://github.com/anthropics/agent-protocol) 的 coding CLI。

            此模板部署的是 Kiro 变体，使用基础 `openab` 镜像搭配 `kiro-cli` 作为 agent 后端。

            ## 注意事项

            - **镜像标签：** 此模板追踪 floating `beta` 标签，OpenAB 推出新 beta 版时自动更新。若要 pin 至特定版本，请在 Zeabur Dashboard → 服务 → 设置中更改镜像标签。可用标签：[GitHub Packages](https://github.com/openabdev/openab/pkgs/container/openab)。
            - **持久化存储：** `/home/agent` 挂载为持久化磁盘。Plugins、设置、config 和认证数据会在重启后保留。

            ## 设置步骤

            ### 1. 获取 Discord Bot Token

            1. 前往 [Discord Developer Portal](https://discord.com/developers/applications)，点击 **New Application**
            2. 进入 **Bot** 页签 → 点击 **Reset Token** → 复制 token
            3. 同一页面往下滑，在 Privileged Gateway Intents 下启用 **Message Content Intent**
            4. 前往 **OAuth2 → URL Generator** → 勾选 scope `bot` → 勾选权限：Send Messages、Send Messages in Threads、Create Public Threads、Read Message History、Add Reactions、Manage Messages
            5. 复制生成的 URL，在浏览器中打开以邀请 Bot 到你的服务器

            ### 2. 获取 Discord 频道 ID

            1. 打开 Discord → 前往 **用户设置**（齿轮图标）→ **高级** → 启用 **开发者模式**
            2. 右键点击你要 Bot 回应的频道 → **复制频道 ID**
            3. 多个频道用逗号分隔：`123456789012345678,234567890123456789`

            ### 3. 获取 Kiro API Key（仅 Pro/Pro+/Power 方案）

            如果你有付费的 Kiro 订阅，前往 [kiro.dev](https://kiro.dev) → Settings → API Keys 创建 key，填入 `KIRO_API_KEY` 变量。服务将自动认证，无需部署后的手动操作。

            免费方案用户将 `KIRO_API_KEY` 留空，部署后执行步骤 5 认证。

            ### 4. 部署

            填入变量后点击部署即可。服务会自动连接到 Discord。

            ### 5. 通过 Device Flow 认证 Kiro（仅免费方案）

            若步骤 3 已填入 `KIRO_API_KEY`，跳过此步骤。

            服务启动后，在 Zeabur Dashboard 打开服务终端，运行：

            ```
            runuser -u agent -- kiro-cli login --use-device-flow
            ```

            > ℹ️ `runuser -u agent` 直接以 `agent` 身份执行登录，认证文件从一开始就归 `agent` 所有 — 不需要再 chown 或重启。

            按照屏幕显示的 URL 和 code 到浏览器完成授权。新对话会自动采用新认证，无需重启服务（如果要清掉现有 session 才需要重启）。

            ## Slack 设置（可选）

            OpenAB 支持通过 Socket Mode 连接 Slack，无需公开 URL。

            1. 前往 https://api.slack.com/apps → **Create New App** → **From scratch**
            2. **Socket Mode** → 启用 → 生成 App-Level Token，scope 选 `connections:write` → 复制 `xapp-...` token（`SLACK_APP_TOKEN`）
            3. **Event Subscriptions** → 启用 → 添加 bot events：`app_mention`、`message.channels`、`message.groups`
            4. **OAuth & Permissions** → Bot Token Scopes → 添加：`app_mentions:read`、`chat:write`、`channels:history`、`groups:history`、`channels:read`、`groups:read`、`reactions:write`、`files:read`、`users:read`
            5. **Install App** → 安装到工作区 → 复制 `xoxb-...` token（`SLACK_BOT_TOKEN`）
            6. 在每个要使用 Bot 的 Slack 频道执行 `/invite @YourAppName`

            部署前填入 `SLACK_BOT_TOKEN` 和 `SLACK_APP_TOKEN` 变量。Discord 和 Slack 可同时运行。

            ## 添加通讯平台（Telegram / LINE / 飞书 / Google Chat / MS Teams / WeCom）

            若要使用 Telegram，请部署 [OpenAB Telegram 模板](https://zeabur.com/templates/12LLKI)，并把 image tag 换成 `beta-kiro`、设置对应的 `OPENAB_AGENT_COMMAND`。其他平台在 unified mode 下直接以环境变量启用（`LINE_CHANNEL_SECRET`、`FEISHU_APP_ID`、`GOOGLE_CHAT_ENABLED=true`、`TEAMS_APP_ID`、`WECOM_CORP_ID`），详见 [OpenAB 文档](https://github.com/openabdev/openab/tree/main/docs)。Webhook 类平台需要为服务绑定公开 HTTPS 域名（port 8080）；飞书走 WebSocket 对外连接，不需要域名。

            ## 使用方式

            - 在允许的 Discord 或 Slack 频道中 **@mention Bot** 即可开始对话
            - OpenAB 会自动创建 **thread** 进行多轮对话 — 后续消息不需要再 @mention
            - 每个 thread 对应一个持久的 Kiro session（默认 24 小时 TTL）

            ## 自定义设置

            | 文件 | 说明 |
            |------|------|
            | `/home/agent/.config/openab/config.toml` | OpenAB 设置（sessions、reactions、STT 等） |

            `config.toml` 在首次启动时从内建模板创建。之后请直接编辑文件，环境变量仅用于初始设置。要恢复默认值请删除后重启：`rm /home/agent/.config/openab/config.toml`

            设置选项请参阅 [OpenAB 文档](https://github.com/openabdev/openab)。

            ## 停用

            部署时将 `Discord Bot Token` 留空即可。服务会进入 sleep 状态，不会崩溃。

            ## 链接

            - [OpenAB GitHub](https://github.com/openabdev/openab)
            - [Agent Client Protocol](https://github.com/anthropics/agent-protocol)
    zh-TW:
        description: |
            Open Agent Broker — 輕量的 Rust 程式，透過 stdio JSON-RPC 將 Discord 和 Slack 橋接到任何 ACP 相容的 coding CLI（Claude Code、Codex、Gemini、Kiro）。此模板使用 Kiro CLI 作為 agent 後端。
            來源：https://github.com/openabdev/openab
        variables:
            - key: DISCORD_BOT_TOKEN
              type: STRING
              name: Discord Bot Token
              description: 從 https://discord.com/developers/applications 取得的 Token
            - key: KIRO_API_KEY
              type: STRING
              name: Kiro API Key（選填，Pro+ 方案）
              description: 選填。Kiro Pro/Pro+/Power 訂閱者可填入 API Key，部署後無需手動登入。免費方案留空，部署後使用 device flow 認證。
            - key: OPENAB_ALLOWED_CHANNELS
              type: STRING
              name: Discord 頻道 ID（選填）
              description: 選填。Bot 監聽的 Discord 頻道 ID，以逗號分隔。留空則允許所有頻道。範例：123456789012345678,234567890123456789
            - key: OPENAB_ALLOWED_USERS
              type: STRING
              name: Discord 用戶 ID（選填）
              description: 選填。以逗號分隔的 Discord 用戶 ID，限制可與 Bot 互動的用戶。留空則允許頻道中所有人。
        readme: |
            # OpenAB Kiro

            [OpenAB](https://github.com/openabdev/openab) 是一個輕量的開源 Rust 程式，透過 stdio JSON-RPC 將 Discord 橋接到任何支援 [Agent Client Protocol](https://github.com/anthropics/agent-protocol) 的 coding CLI。

            此模板部署的是 Kiro 變體，使用基礎 `openab` 映像搭配 `kiro-cli` 作為 agent 後端。

            ## 注意事項

            - **映像標籤：** 此模板追蹤 floating `beta` 標籤，OpenAB 推出新 beta 版時自動更新。若要 pin 至特定版本，請在 Zeabur Dashboard → 服務 → 設定中更改映像標籤。可用標籤：[GitHub Packages](https://github.com/openabdev/openab/pkgs/container/openab)。
            - **持久化儲存：** `/home/agent` 掛載為持久化磁碟。Plugins、設定、config 和認證資料會在重啟後保留。

            ## 設定步驟

            ### 1. 取得 Discord Bot Token

            1. 前往 [Discord Developer Portal](https://discord.com/developers/applications)，點擊 **New Application**
            2. 進入 **Bot** 頁籤 → 點擊 **Reset Token** → 複製 token
            3. 同一頁面往下滑，在 Privileged Gateway Intents 下啟用 **Message Content Intent**
            4. 前往 **OAuth2 → URL Generator** → 勾選 scope `bot` → 勾選權限：Send Messages、Send Messages in Threads、Create Public Threads、Read Message History、Add Reactions、Manage Messages
            5. 複製產生的 URL，在瀏覽器中開啟以邀請 Bot 到你的伺服器

            ### 2. 取得 Discord 頻道 ID

            1. 開啟 Discord → 前往 **使用者設定**（齒輪圖示）→ **進階** → 啟用 **開發者模式**
            2. 對你要 Bot 回應的頻道按右鍵 → **複製頻道 ID**
            3. 多個頻道用逗號分隔：`123456789012345678,234567890123456789`

            ### 3. 取得 Kiro API Key（僅 Pro/Pro+/Power 方案）

            如果你有付費的 Kiro 訂閱，前往 [kiro.dev](https://kiro.dev) → Settings → API Keys 建立 key，填入 `KIRO_API_KEY` 變數。服務將自動認證，無需部署後的手動操作。

            免費方案用戶將 `KIRO_API_KEY` 留空，部署後執行步驟 5 認證。

            ### 4. 部署

            填入變數後點擊部署即可。服務會自動連線到 Discord。

            ### 5. 透過 Device Flow 認證 Kiro（僅免費方案）

            若步驟 3 已填入 `KIRO_API_KEY`，跳過此步驟。

            服務啟動後，在 Zeabur Dashboard 打開服務終端，執行：

            ```
            runuser -u agent -- kiro-cli login --use-device-flow
            ```

            > ℹ️ `runuser -u agent` 直接以 `agent` 身份執行登入，認證檔從一開始就有正確擁有者 — 不需要再 chown 或重啟。

            依照畫面顯示的 URL 和 code 到瀏覽器完成授權。新對話會自動套用新認證，不需重啟服務（若要清掉現有 session 才需重啟）。

            ## Slack 設定（選用）

            OpenAB 支援透過 Socket Mode 連接 Slack，不需要公開 URL。

            1. 前往 https://api.slack.com/apps → **Create New App** → **From scratch**
            2. **Socket Mode** → 啟用 → 產生 App-Level Token，scope 選 `connections:write` → 複製 `xapp-...` token（`SLACK_APP_TOKEN`）
            3. **Event Subscriptions** → 啟用 → 新增 bot events：`app_mention`、`message.channels`、`message.groups`
            4. **OAuth & Permissions** → Bot Token Scopes → 新增：`app_mentions:read`、`chat:write`、`channels:history`、`groups:history`、`channels:read`、`groups:read`、`reactions:write`、`files:read`、`users:read`
            5. **Install App** → 安裝到工作區 → 複製 `xoxb-...` token（`SLACK_BOT_TOKEN`）
            6. 在每個要使用 Bot 的 Slack 頻道執行 `/invite @YourAppName`

            部署前填入 `SLACK_BOT_TOKEN` 和 `SLACK_APP_TOKEN` 變數。Discord 和 Slack 可同時運作。

            ## 新增通訊平台（Telegram / LINE / Feishu / Google Chat / MS Teams / WeCom）

            若要使用 Telegram，請部署 [OpenAB Telegram 模板](https://zeabur.com/templates/12LLKI)，並把 image tag 換成 `beta-kiro`、設定對應的 `OPENAB_AGENT_COMMAND`。其他平台在 unified mode 下直接以環境變數啟用（`LINE_CHANNEL_SECRET`、`FEISHU_APP_ID`、`GOOGLE_CHAT_ENABLED=true`、`TEAMS_APP_ID`、`WECOM_CORP_ID`），詳見 [OpenAB 文件](https://github.com/openabdev/openab/tree/main/docs)。Webhook 類平台需要為服務綁定公開 HTTPS 網域（port 8080）；Feishu 走 WebSocket 對外連線，不需網域。

            ## 使用方式

            - 在允許的 Discord 或 Slack 頻道中 **@mention Bot** 即可開始對話
            - OpenAB 會自動建立 **thread** 進行多輪對話 — 後續訊息不需要再 @mention
            - 每個 thread 對應一個持久的 Kiro session（預設 24 小時 TTL）

            ## 自訂設定

            | 檔案 | 說明 |
            |------|------|
            | `/home/agent/.config/openab/config.toml` | OpenAB 設定（sessions、reactions、STT 等） |

            `config.toml` 在首次啟動時從內建範本建立。之後請直接編輯檔案，環境變數僅用於初始設定。要恢復預設值請刪除後重啟：`rm /home/agent/.config/openab/config.toml`

            設定選項請參閱 [OpenAB 文件](https://github.com/openabdev/openab)。

            ## 停用

            部署時將 `Discord Bot Token` 留空即可。服務會進入 sleep 狀態，不會崩潰。

            ## 連結

            - [OpenAB GitHub](https://github.com/openabdev/openab)
            - [Agent Client Protocol](https://github.com/anthropics/agent-protocol)
