iii-worker-manager
Skill này làm gì
Thiết lập listener mà các worker dùng để kết nối tới engine iii, và kiểm soát mỗi kết nối được dùng những hàm nào. Dành cho lập trình viên mở engine iii cho worker khác hoặc mạng khác và cần kiểm soát truy cập.
Khi nào nên dùng
- ✓Khi bạn muốn các worker ở mạng khác kết nối tới engine của mình một cách an toàn.
- ✓Khi bạn cần giới hạn các hàm mà một worker đã kết nối có thể gọi.
- ✓Khi bạn muốn ghi log hoặc giới hạn tần suất mọi lệnh gọi đi qua engine.
Liên kết skill
https://github.com/iii-hq/iii/blob/main/engine/src/workers/worker/skills/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Mở engine iii của tôi cho một mạng không tin cậy, với các quy tắc truy cập giới hạn những gì mỗi worker kết nối có thể gọi.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill cấu hình các listener WebSocket trên các cổng riêng, mỗi cổng có quy tắc truy cập riêng. Kiểm tra truy cập chạy cho từng kết nối, và một hàm middleware tùy chọn có thể kiểm toán, giới hạn tần suất hoặc thay đổi mỗi lệnh gọi trước khi nó đến đích.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
Câu hỏi thường gặp
Tôi có nên mở cổng engine trực tiếp ra internet không?
Không. Quy tắc truy cập là bắt buộc với mạng không tin cậy, và một worker proxy riêng là cách được khuyến nghị để thi hành chúng.
Mỗi khách hàng có thể có một namespace riêng không?
Có. Một hàm xác thực có thể thêm tiền tố vào mọi hàm và trigger mà một phiên đăng ký, nhờ đó cô lập từng tenant.
Middleware làm gì?
Nó thấy mọi lần gọi trên listener của nó và quyết định có chuyển tiếp lệnh gọi hay không và trả về gì.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 19k
- Vị trí xếp hạng
- #10490
- Giấy phép
- —
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
iii-sandbox
19kGiúp agent của bạn chạy mã không đáng tin hoặc do AI tạo ra một cách an toàn trong một máy ảo cô lập tạm thời, rồi hủy khi xong việc.
configuration
19kCho phép agent của bạn thiết lập một registry chung gồm các giá trị cấu hình được đặt tên, kiểm tra theo schema, để các worker có thể đọc và phản ứng với thay đổi.
iii
19kDạy agent của bạn cách các worker iii hoạt động, để nó có thể thêm một khả năng bằng cách kiểm tra trước những gì đã có, rồi xây một worker.
iii-observability
19kGiúp agent của bạn thêm tracing, log có cấu trúc, metric và cảnh báo vào engine iii, dùng OpenTelemetry để bạn thấy hệ thống đang làm gì.
Skill tương tự
api-connector-builder
280kGiúp agent của bạn xây dựng kết nối API mới theo đúng mẫu đã có, dùng khi bạn cần thêm một tích hợp mà không tạo cách làm mới.
api-design
280kGiúp agent của bạn thiết kế REST API theo các thực hành tốt nhất, hữu ích để định nghĩa cách API giao tiếp, hiển thị lỗi và tổ chức dữ liệu.
backend-patterns
280kGiúp agent của bạn với các mẫu kiến trúc phía máy chủ và tối ưu cơ sở dữ liệu, hữu ích khi xây dựng hoặc rà soát code chạy trên máy chủ.