Langsung ke konten
Skillpedia
API & server (backend)19k ยท #10490

iii-worker-manager

Fungsinya

Mengatur listener yang dipakai worker untuk terhubung ke engine iii, dan mengendalikan fungsi apa yang bisa dipakai setiap koneksi. Skill ini untuk pengembang yang membuka engine iii kepada worker lain atau jaringan lain dan membutuhkan kontrol akses.

Kapan dipakai

  • โœ“Saat Anda ingin worker di jaringan lain terhubung ke engine Anda dengan aman.
  • โœ“Saat Anda perlu membatasi fungsi apa yang bisa dipanggil worker yang terhubung.
  • โœ“Saat Anda ingin mencatat atau membatasi laju setiap panggilan yang melewati engine.

Link skill

https://github.com/iii-hq/iii/blob/main/engine/src/workers/worker/skills/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/iii-hq/iii/blob/main/engine/src/workers/worker/skills/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit โ†’

Contoh permintaan ke AI

โ€œBuka engine iii saya ke jaringan yang tidak tepercaya, dengan aturan akses yang membatasi apa yang bisa dipanggil setiap worker yang terhubung.โ€

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Skill mengatur listener WebSocket di port terpisah, masing-masing dengan aturan aksesnya sendiri. Pemeriksaan akses dijalankan untuk setiap koneksi, dan fungsi middleware opsional bisa mengaudit, membatasi laju, atau mengubah setiap panggilan sebelum sampai ke tujuannya.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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-proxy worker (iii trigger compose::add worker=rbac-proxy), which applies these RBAC rules on its own port out of process. A second #instance listener with an rbac block and an auth_function_id is the in-engine alternative.
  • Restricting which functions a connected worker can invoke โ€” combine expose_functions filters (operator-side) with forbidden_functions from AuthResult (per-session, hard deny).
  • Auditing, rate-limiting, or enriching every invocation โ€” set middleware_function_id on the listener; the middleware decides whether to call the target and what to return.
  • Per-tenant or per-session namespace isolation โ€” return function_registration_prefix from 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, or on_trigger_type_registration_function_id to 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 of expose_functions. Adding one of those IDs to forbidden_functions denies it but logs a warning โ€” workers may behave unpredictably (broken setup, lost logs, missing context).
  • The engine port must remain internal. Only rbac-proxy or an RBAC-protected #instance listener 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_functions from the auth result wins over both allowed_functions and expose_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

Pertanyaan umum

Haruskah saya membuka port engine langsung ke internet?

Tidak. Aturan akses wajib untuk jaringan yang tidak tepercaya, dan worker proxy terpisah adalah cara yang disarankan untuk menegakkannya.

Bisakah setiap pelanggan mendapat namespace terpisah?

Bisa. Fungsi auth bisa menambahkan awalan ke setiap fungsi dan pemicu yang didaftarkan sesi, sehingga setiap tenant terisolasi.

Apa yang dilakukan middleware?

Middleware melihat setiap pemanggilan di listener-nya dan memutuskan apakah panggilan diteruskan serta apa yang dikembalikan.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
19k
Peringkat
#10490
Lisensi
โ€”
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • โ€ฆ

Skill lain dari repositori ini

Skill serupa