Skip to main content
Glama
00011110

trayfeel

by 00011110

TrayFeel

AIエージェント向けのプラグアンドプレイCD/DVDトレイ感情アクチェエーター。

TrayFeelは、Linuxの光学ドライブを物理的な身体言語チャンネルに変えます。open、close、pulse、wiggleなどの動作と、名前付きの感情カタログを、Pythonライブラリ、CLI、MCPサーバー、任意のHTTPデーモンとして提供します。

Linuxファースト。MITライセンス。Pure-Pythonのioctlパス(ejectバイナリ不要)。

要件

  • Python 3.10+

  • /dev/sr* の光学ドライブを持ち、OPEN_TRAY / CLOSE_TRAYをサポートするLinux

  • cdrom グループへのユーザー参加(Ubuntu/Debianでは一般的)

sudo usermod -aG cdrom "$USER"
# log out and back in, then:
groups   # should list cdrom

インストール

pip install trayfeel
# or from a checkout:
pip install -e ".[dev]"

任意の環境変数(.env.example を参照):

変数

用途

TRAYFEEL_DEVICE

デバイスパスを強制指定(既定: 最初の /dev/sr*)

TRAYFEEL_TOKEN

HTTPデーモン用のBearerトークン

TRAYFEEL_CAMERA

ビジョンフィードバック用の任意の /dev/videoN

TRAYFEEL_HOST / TRAYFEEL_PORT

デーモンのバインド先(既定: 127.0.0.1:8765)

クイックスタート

trayfeel list-drives
trayfeel doctor
trayfeel status
trayfeel pulse
trayfeel emote laugh
trayfeel emote nod_yes --dry-run
trayfeel catalog

Python:

from trayfeel import Tray

with Tray() as tray:
    print(tray.status())
    tray.run("pulse")
    tray.emote("wave")

安全性

TrayFeelは既定では、無謀な動作を拒否します:

  • 排他ロック: デバイスごと(~/.cache/trayfeel/…)

  • レート制限:(既定: 30アクション/分)

  • 最小動作間隔:(既定: 200ms)

  • ディスクガード — ディスクが入っている間は、pulse、wiggle、nod などのスラム動作を拒否(force=True の場合は除く)

  • クールダウン: 何度もの開閉サイクルの後

意図的にリスクを受け入れる場合は、--force / force=True で上書きできます。

注: 日本語の「クールダウン」のExampleは「開閉を繰り返した後」です。正しくは「開閉サイクルを多数繰り返した後」です。

感情

trayfeel/emotions/catalog.yaml に定義された、名前付きのコレオグラフィ:

laugh, giggle, gasp, surprise, shrug, think, ponder, nod_yes, shake_no, applause, sulk, pout, excited, bored, angry, curious, bash, heartbeat, sigh, celebrate, confused, acknowledge, reject, greet, farewell, error, success, idle_breath

trayfeel emote celebrate
trayfeel emote think --dry-run

プリミティブ

open, close, toggle, lock, unlock, status, pulse, wiggle, hold_open, nod, double_tap, spin_up, spin_down, sleep, wait

MCP サーバー

trayfeel mcp
# or: python -m trayfeel mcp

ツール: tray_status, tray_list_drives, tray_primitive, tray_emote, tray_catalog, tray_doctor。

Claude Desktop

claude_desktop_config.json に追加:

{
  "mcpServers": {
    "trayfeel": {
      "command": "trayfeel",
      "args": ["mcp"]
    }
  }
}

Cursor

同じコマンド(trayt MCP または python -m trayfeel mcp)を指すMCPサーバーエントリを追加してください。環境が cdrom グループの権限を持っていることを確認してください。

OpenAI / Claude のファンクションコーリング用のツールスキーマは、examples/openai_tools.json と examples/claude_tools.json にあります。Agent skill ノート: examples/agent_skill.md。

HTTP デーモン

stdio MCP を接続できない LAN 内のエージェント向け:

export TRAYFEEL_TOKEN="$(openssl rand -hex 16)"
trayfeel daemon --host 0.0.0.0 --port 8765

メソッド

パス

ボディ

GET

/health

—

GET

/status

—

GET

/catalog

—

POST

/primitive

{"健名":"pulse","open_ms":300}

POST

/emote

{"name":"wave"}

トークンが設定されている場合は Authorization: Bearer $TRAYFEEL_TOKEN を送信します。

ビジョン(任意)

TRAYFEEL_CAMERA=/dev/video0 が宣言され、ffmpeg がインストールされている場合、trayfeel vision は V4L2 経由でフレームを取り込み、ベストエフォトの明るさ/エッジヒューリスティックを返します。カメラまたは ffmpeg がない場合は ok: false と理由を返します — プロセスをクラッシュさせません。

ライブラリ構成

trayfeel/
  core.py          # Tray, Emoter
  primitives.py    # motion primitives
  safety.py        # flock, rate limits, disc guards
  hardware/linux.py
  emotions/        # catalog.yaml + engine
  mcp_server.py
  daemon.py
  cli.py

ライセンス

MIT — Copyright (c) 2026 TrayFeel contributors

Related MCP Connectors