-
Notifications
You must be signed in to change notification settings - Fork 1
User Settings
Edge adaptation of the upstream namespace-based settings system.
Upstream reference: User Settings
The settings system organizes configuration by namespace. Each plugin registers a schemastery schema via ctx.settings.register(), getting a SettingsScope handle for get/watch/update/replace. Values resolve through three layers: schema defaults → composition base → user overrides. The abstract SettingsProvider seam (ctx.settings) handles document persistence; the settings service handles namespace registration, schema validation, and change events.
The upstream settings service (ctx.settings) is used as-is. Namespace registration, three-layer resolution, get()/watch()/update()/replace(), and change events (settings/document-updated, settings/updated) are entirely upstream code.
DurableObjectSettingsProvider extends the upstream SettingsProvider abstract class. Persists the entire settings document as a single DO KV entry at dsh-edge:settings-document. Implements load() (read from KV on startup) and persist() (write to KV on change). Reports writable: true and hasDocument based on whether a stored document exists.
- Namespace registration and schema validation
- Three-layer resolution (defaults → base → user)
- Serialized write ordering within namespaces
- Change event semantics (
settings/document-updatedvssettings/updated) - Settings RPC (describe/update/replace/mutate) — handled by apiproxy
- Secret role handling — secret values never appear in responses
The settings document is loaded once at DO initialization and cached in memory. Reads are O(1) from cache. Writes serialize the full document to a single storage.put() call. Since settings changes are infrequent (user-initiated via the UI), the single-document approach has no practical performance concern.
| Component | Category | Edge Code |
|---|---|---|
| Settings service | Reuse | Upstream — namespace registration, resolution, events |
| DurableObjectSettingsProvider | Replace | ~30 lines — extends SettingsProvider, persists to DO KV |
Key observation: The settings provider is a textbook minimal replacement — extends the upstream abstract class, implements two methods (
loadandpersist), and delegates everything else to upstream. The entire settings UI, namespace system, and validation are upstream.
- Home
- Architecture
- Core & Scope
- Session & Persistence
- Model & Context
-
Execution & Tools
- Tools
- Bash
- Subprocess 🚫
- PTY Session 🚫
- Background Jobs 🚫
- Filesystem
- LSP Navigation 🚫
- Code Runtime 🚫
-
Web Access
⚠️ -
Skills
⚠️ - Workflow 🚫
- Subagent 🚫
-
Policy & Interaction
- Goal
- Approval 🚫
- Permission Presets 🚫
-
Sandbox
⚠️ - Plan Mode 🚫
- User Interaction 🚫
- Commands 🚫
- Schedule 🚫
- Message Feedback 🚫
- Platform & Access
- Development
- 首页
- 架构
- 核心与作用域
- 会话与持久化
- 模型与上下文
- 执行与工具
- 策略与交互
- 平台与接入
- 开发