iii-worker-manager
できること
ワーカーがiiiエンジンに接続する際の待ち受け口を設定し、各接続が使える機能を制御します。外部ネットワークにエンジンを公開し、アクセス制御が必要な開発者向けです。
使う場面
- ✓ワーカーを別のネットワークから安全に接続させたいとき。
- ✓接続したワーカーが呼び出せる機能を制限したいとき。
- ✓エンジンを通るすべての呼び出しを記録したり、レート制限をかけたりしたいとき。
スキルのリンク
https://github.com/iii-hq/iii/blob/main/engine/src/workers/worker/skills/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“iiiエンジンを信頼できないネットワークに公開し、接続したワーカーが呼び出せる内容をアクセスルールで制限してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このスキルは、ポートごとに別々のアクセスルールを持つWebSocketリスナーを設定します。接続ごとにアクセス確認が行われ、任意のミドルウェア関数が、対象に届く前に各呼び出しを監査、レート制限、または変更できます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
iii-worker-manager
The iii-worker-manager is a mandatory engine worker that opens WebSocket listeners. The base
engine.workers.iii-worker-manager entry sets the main port (49134 by default); #instance
entries open separate listeners with their own RBAC, middleware, and registration hooks. Channels
are mounted on every listener at /ws/channels/{channel_id}.
When to Use
- Exposing the engine to an untrusted network — RBAC is mandatory, never open the engine port itself. Use the standalone
rbac-proxyworker (iii trigger compose::add worker=rbac-proxy), which applies these RBAC rules on its own port out of process. A second#instancelistener with anrbacblock and anauth_function_idis the in-engine alternative. - Restricting which functions a connected worker can invoke — combine
expose_functionsfilters (operator-side) withforbidden_functionsfromAuthResult(per-session, hard deny). - Auditing, rate-limiting, or enriching every invocation — set
middleware_function_idon the listener; the middleware decides whether to call the target and what to return. - Per-tenant or per-session namespace isolation — return
function_registration_prefixfrom the auth function so every function/trigger this session registers is transparently prefixed without the worker code knowing. - Gating dynamic registration — wire
on_function_registration_function_id,on_trigger_registration_function_id, oron_trigger_type_registration_function_idto validate or rewrite registrations.
Boundaries
- The infrastructure carve-out (
engine::channels::create,engine::workers::register,engine::log::*,engine::baggage::*) is always allowed on RBAC listeners regardless ofexpose_functions. Adding one of those IDs toforbidden_functionsdenies it but logs a warning — workers may behave unpredictably (broken setup, lost logs, missing context). - The engine port must remain internal. Only
rbac-proxyor an RBAC-protected#instancelistener may face an external network. - The middleware is not a pre-handler — it must invoke the target function itself (typically via
iii.trigger) and return its result. Returning early without invoking simply skips the call. forbidden_functionsfrom the auth result wins over bothallowed_functionsandexpose_functions. There is no way for a session to override an operator's deny list.- Registration hooks return mapped fields or throw to deny. Omitted result fields keep their original values; returning
{}is a no-op (allow as-is). - Triggers and functions registered through an RBAC session are scoped to that session and cleaned up automatically on disconnect.
Configuration
Two listeners — one internal, one external with in-engine RBAC (the rbac-proxy worker accepts the same rbac block through the configuration worker instead):
engine:
workers:
iii-worker-manager:
port: 49134
"iii-worker-manager#rbac":
host: 0.0.0.0
port: 49135
middleware_function_id: my-project::middleware
rbac:
auth_function_id: my-project::auth
on_function_registration_function_id: my-project::on-fn-reg
on_trigger_registration_function_id: my-project::on-trig-reg
on_trigger_type_registration_function_id: my-project::on-trig-type-reg
expose_functions:
- match("api::*")
- match("*::public")
- metadata:
public: true
Auth function
Receives AuthInput { headers, query_params, ip_address }, returns AuthResult. Throw to reject the connection.
import type { AuthInput, AuthResult } from '@iii-dev/helpers/worker-connection-manager'
iii.registerFunction(
'my-project::auth',
async (input: AuthInput): Promise<AuthResult> => {
const token = input.headers?.['authorization']?.replace(/^Bearer\s+/i, '')
if (!token) throw new Error('Missing credentials')
const user = await validateToken(token)
return {
allowed_functions: [],
forbidden_functions: user.role === 'readonly'
? ['api::users::delete', 'api::users::update']
: [],
allowed_trigger_types: user.role === 'admin' ? ['cron', 'webhook'] : undefined,
allow_trigger_type_registration: user.role === 'admin',
function_registration_prefix: `tenant-${user.tenant_id}`,
context: { user_id: user.id, role: user.role, tenant_id: user.tenant_id },
}
},
)
`A
よくある質問
エンジンのポートをインターネットに直接公開すればよいですか?
いいえ。信頼できないネットワークではアクセスルールが必要で、その強制には別のプロキシワーカーを使うことが推奨されています。
顧客ごとに別々の名前空間を持てますか?
はい。認証関数で、セッションが登録するすべての関数とトリガーに接頭辞を付けられるため、テナントごとに分離できます。
ミドルウェアは何をしますか?
そのリスナーを通るすべての呼び出しを確認し、呼び出しを次に渡すか、何を返すかを決めます。
詳細
作者による元の説明
WebSocket listener that SDK workers connect to. Use to expose the engine to trusted (internal) and untrusted (RBAC-protected) workers, gate function and trigger registration, and audit or transform every invocation through a middleware function. Mounts channel WebSocket endpoints on every listener.
repo: iii-hq/iii
人気
- GitHubのスター
- 19k
- ランキング
- #10490
- ライセンス
- —
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
iii-sandbox
19k信頼できないコードや AI が生成したコードを、一時的に隔離された仮想マシンの中で安全に実行し、終わったら破棄するよう、エージェントを支援します。
configuration
19kスキーマで検証された、名前付きの設定値の共有レジストリを設定し、ワーカーが変更を読んで反応できるよう、エージェントを支援します。
iii
19kiii のワーカーの仕組みを教えます。エージェントは、まず既に存在するものを確認し、そのあとワーカーを作ることで、機能を追加できます。
iii-observability
19kOpenTelemetry を使って、何が起きているかを見られるよう、iii エンジンにトレース、構造化ログ、メトリクス、アラートを追加するよう、エージェントを支援します。
似ているスキル
api-connector-builder
280kエージェントが既存のパターンに従って、新しいAPI連携を構築します。新しい方式を作らずに、もう一つ連携を追加したいときに使います。
api-design
280kエージェントがベストプラクティスに沿ってREST APIを設計できるようにします。APIの通信方法、エラーの表示方法、データの整理方法を決めるのに役立ちます。
backend-patterns
280kエージェントのサーバーサイドのアーキテクチャパターンとデータベースの最適化を支援します。サーバー上で動くコードを作成またはレビューするときに役立ちます。