Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)19k · #10486

configuration

Skill này làm gì

Lưu các giá trị cấu hình được đặt tên với một schema kiểm tra từng giá trị, để các worker trong hệ thống đọc cùng một bộ thiết lập từ một nơi. Dành cho lập trình viên xây hệ thống dựa trên iii cần thiết lập chung đã được kiểm tra.

Khi nào nên dùng

  • ✓Khi nhiều worker cần thống nhất cùng một thiết lập mà không cần đường dẫn tệp cứng.
  • ✓Khi bạn muốn một giá trị cấu hình được kiểm tra theo schema trước khi dùng.
  • ✓Khi bạn muốn một worker phản ứng với thay đổi thiết lập mà không cần polling.

Liên kết skill

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

Sao 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

Hãy dùng skill này để giúp tôi: https://github.com/iii-hq/iii/blob/main/engine/src/workers/configuration/skills/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Thiết lập một mục cấu hình chung cho dịch vụ thanh toán của tôi, với schema kiểm tra các giá trị của nó.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Mỗi worker đăng ký schema cấu hình của nó một lần khi khởi động, rồi công bố các giá trị của mình. Các worker khác đọc những giá trị đó, và một trigger được gắn sẵn sẽ kích hoạt khi giá trị thay đổi. Lưu trữ mặc định giữ một tệp YAML cho mỗi mục.

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.

configuration

The configuration worker is a server-side registry of named entries. Every entry has an id (e.g. iii-stream, billing-service), a human-readable name and description, a JSON Schema describing the value shape, and a JSON value validated against that schema. Workers call configuration::register once at startup to declare their schema and configuration::set to publish values; consumers call configuration::get / configuration::list to read and bind a configuration trigger to react to changes without polling.

The default fs adapter persists one YAML file per id under ./config and watches the directory for external edits, so manual edits surface as configuration:updated events. The bridge adapter delegates to a remote engine. The worker is engine-owned and may be configured at engine.workers.configuration.

A per-id TTL (off by default) cleans up entries whose last subscriber trigger has unregistered, scoped to the lifecycle of ephemeral workers that come and go without an explicit teardown step.

When to Use

  • A worker needs a typed, observable configuration surface other workers can read and validate against.
  • Two workers need to agree on the same configuration values without one polling the other or hardcoding a path on disk.
  • An operator should be able to edit a single YAML file (or the remote control plane) and have the change propagate to every subscriber without a worker restart.
  • A worker comes and goes (sandboxes, ephemeral consumers) and its configuration should be cleaned up automatically when no one is left subscribing.

Boundaries

  • Not a general-purpose key/value store — every entry must have a registered JSON Schema. Use the standalone state worker for free-form values.
  • No partial-update surface; set always replaces the whole value. Build the new value client-side and ship it in one call.
  • The bridge adapter cannot delete entries on the remote engine; cleanup over the bridge happens via TTL or directly on the source engine.
  • Over the bridge adapter, configuration::ensure is decided by the remote engine (the original candidate is forwarded there), so it requires a remote engine that exposes configuration::ensure; against an older remote it fails closed with ADAPTER_ERROR rather than falling back to an unsafe register.
  • Schemas are not version-checked across re-registrations — re-registering with an incompatible schema simply replaces it. Coordinate schema migrations out-of-band.

Migration and runtime overrides

Compose defaults to <namespace>-<container-key> without a hash (for example, default-harness). Invalid or over-64-character generated names require explicit config_name. Compose migrates only the exact previous namespace/key hash before starting a stopped worker. After hashed migration, only the default namespace adopts the exact bare container key, unless another container explicitly owns it. The bare source wins over an existing destination; configuration::migrate is the single operation, delegated through bridges to the authority. It returns { action, entry } with migrated, preserved (existing destination with absent source, or matching IDs with an existing entry), or missing (both source and destination absent). Before migration, Compose and every bridge hop query the read-only configuration::migration-capabilities and require source_priority_archive_revision: 1. Unknown or unavailable capabilities fail closed before invoking migration; upgrade the authority. It replaces the destination with the raw source entry, then archives the original source as <source>.yaml.bak. The previous destination is not backed up. .yaml.bak, .bak.yaml, and .bkup.yaml files are ignored during loading, watching and legacy directory migration. An existing identical backup permits cleanup recovery; a conflicting backup is never overwritten. Missing source is a no-write no-op. Unsupported adapters fail closed. Stop source consumers before migrating; do not share an fs directory between engine processes.

config_override is delivered through the existing service API. Compose reads the current configuration with configuration::get (raw: true), merges defaults and overrides, then calls configuration::set with flush: false before starting the worker. No snapshot file is delivered. III_CONFIG_NAME identifies the entry. Memory-only updates never write persistent config/<id>.yaml, and no delayed flush is sched

Câu hỏi thường gặp

Các giá trị được lưu ở đâu?

Mặc định mỗi mục được lưu thành một tệp YAML trong thư mục cấu hình, và bạn cũng có thể chỉnh sửa trực tiếp.

Có thể nhận thay đổi mà không cần khởi động lại không?

Có. Một trigger kích hoạt khi một mục được cập nhật, nên các worker có thể phản ứng mà không cần polling.

Nó có dọn các mục cũ không?

Chỉ khi bạn bật cài đặt thời gian sống tùy chọn, cài đặt này xóa các mục không còn người đăng ký.

Chi tiết

Mô tả gốc của tác giả

Schema-validated, reactive registry for named configuration entries — the runtime configuration surface used by engine and Compose workers.

repo: iii-hq/iii

Độ phổ biến

Sao GitHub
19k
Vị trí xếp hạng
#10486
Giấy phép
—
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự