跳到正文
Skillpedia
API 与服务器(后端)19k · #10486

configuration

它能做什么

以带模式检查的方式存储命名配置值,使系统中的工作进程从同一位置读取相同的设置。它适用于构建基于 iii 的系统、并需要共享且经过验证的设置的开发者。

适用场景

  • ✓当多个工作进程需要在相同设置上达成一致、而不硬编码文件路径的时候。
  • ✓当你希望配置值在使用前按模式进行检查的时候。
  • ✓当你希望工作进程在设置变化时做出响应、而无需轮询的时候。

技能链接

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

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/iii-hq/iii/blob/main/engine/src/workers/configuration/skills/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请为我的计费服务设置一个共享配置条目,并附上检查其值的模式。”

每周 5 个新技能,1 分钟读完。

工作原理

每个工作进程在启动时注册一次其配置模式,然后发布其值。其他工作进程读取这些值,当某个值发生变化时,绑定的触发器会被触发。默认存储为每个条目保存一个 YAML 文件。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

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

常见问题

这些值存储在哪里?

默认每个条目保存为配置文件夹中的一个 YAML 文件,你也可以直接编辑。

更改可以在不重启的情况下被获取吗?

可以。条目更新时会触发一个触发器,因此工作进程无需轮询即可做出响应。

它会清理旧条目吗?

只有在你启用可选的存活时间设置时才会,该设置会删除不再有订阅者的条目。

详情

作者的原始描述

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

repo: iii-hq/iii

热度

GitHub 星标
19k
排名
#10486
许可证
—
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能