Skip to content
3 changes: 2 additions & 1 deletion docs/design/appserver/management-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ the profile enables account methods. Settings supplies generic
BusinessDocument persistence and the declared sources of
[the settings service](settings-service.md), not approvals, a method contribution or a configuration
namespace; SettingsMethods, which depends on it, owns
`settings.read`/`settings.update`/`settings.sources`/`settings.projects`.
`settings.read`/`settings.update` for declared sources ([SettingsMethods](../plugins/SettingsMethods.md)); a Rust source is
served by its owner's own namespace.
StorageMethods serves `storage.report` through the native binding of the same SQLite owner operation exposed as `sqliteStorage.storageReport({})`.
MCP owns its configuration types in `mcp/config.rs`; the Skills owner supplies
the existing `SkillSettingsHost`. App Server's SkillsCatalog mounts the reusable catalog
Expand Down
6 changes: 3 additions & 3 deletions docs/design/appserver/model-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ aimux's RFC-0023 JSONL (`aimux-core`'s `recording.rs`).

| Owner | Responsibility |
| --- | --- |
| ModelLog, process | Register the `model-log` Settings source, start and stop the recorder, follow its changes |
| Aimux, process | Bind a request to the recorder that is on when the request is built, and close the recording when its stream ends |
| Settings service | Validate and persist `model-log.json`, user scope only |
| ModelLog, process | Register the `model-log` Settings source and answer its `recording` value ([ModelLog](../plugins/ModelLog.md)) |
| Aimux, process | Read the recording value when a request is built and close the recording when its stream ends |
| Settings | Validate and persist `model-log.json`, user scope only |

The switch is user scope only: recordings hold prompts, code and tool output, so
project content must not turn them on.
Expand Down
14 changes: 3 additions & 11 deletions docs/design/appserver/permission-command-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,15 @@ restore and fork neither restore nor widen them.

### 4.1 Language-neutral (ADR 002 D5)

**Session service `commandRules`**, Session scope, no instance key, provided by the profile.

| Method | Mode | Request | Reply |
| --- | --- | --- | --- |
| `read` | async | `{}` | `{rules: CommandRule[]}` |

`CommandRule = {command: string, match: "exact" | "prefix", decision: "allow" | "deny"}`. Errors
are data: `unavailable` (the source could not be read, including an invalid persisted file),
`cancelled` (the caller dropped the call or the provider is unloading).
**Session service `commandRules`** is deleted. Rule consumers call [PermissionRules](../plugins/PermissionRules.md)'s `permissionRules.rules` (`{}` → `{rules}`); `CommandRule = {command: string, match: "exact" | "prefix", decision: "allow" | "deny"}`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem: This deletes the Session service, but the same file still builds it. Section 2 (58-59) shows the CommandRules Session part providing commandRules and reading Settings; 4.2 (163-165) says the dispatcher serves read({}); 4.2 (176) declares Keyed<SettingsService>; and section 8 (307) lists the port as a public addition.

Failure scenario: an implementer follows section 2 or 4.2 and builds a Session part that reads SettingsService::read::<PermissionSettings>; the delivery removes SettingsService and the commandRules wire service, so the part fails to compose or leaves a second read path.

Evidence: those lines; docs/design/plugins/PermissionRules.md:5,64,115.

Fix: update sections 2, 4.2 and 8 to the owner's permissionRules.rules and the ReadCommandRules port binding, as 4.1 already does.


**Management methods**, namespace `permission`, which the process part registers with
`managementMethods` (overview §6.2 rule 9; never served to paired devices).

| Method | Request | Reply | Errors |
| --- | --- | --- | --- |
| `permission.rules` | `{}` | `{revision, commandRules}` | `permission_rules_failed` |
| `permission.set_rules` | `{expectedRevision, commandRules}` | `{revision}` | invalid params (validation), `permission_rules_conflict` (stale revision), `permission_rules_failed` |
| `permission.rules` | `{}` | `{revision, commandRules}` | `permission_rules_failed`, `operation_interrupted` |
| `permission.set_rules` | `{expectedRevision, commandRules}` | `{revision}` | invalid params (validation), `permission_rules_conflict` (stale revision), `permission_rules_failed`, `operation_interrupted` |

`set_rules` replaces the whole list. The reply's `revision` is the Settings revision. Settings
emits its existing `settings.changed` event for the write; F2 adds no listener.
Expand Down
77 changes: 19 additions & 58 deletions docs/design/appserver/prompt-overrides.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ adopted.
```text
App Server process row: PromptSettings
registers Settings source "prompts"
provides three ports from the same document
owns one promptSettings service
|
+--------------------------+--------------------------+
| | |
BasePromptSettingsHost SkillsInstructionsSettingsHost SummaryPromptSettingsHost
| | |
PromptSources part Skills part ProductSummaryStrategy part
(dim/base) (dim/skills/instructions) (summary prompt)
+------------------+------------------+
| | |
base() skills() summary()
| | |
PromptSources part Skills part ProductSummaryStrategy part
(dim/base) (dim/skills/instructions) (summary prompt)
\ | /
read once while the Session part applies
```
Expand Down Expand Up @@ -80,13 +80,10 @@ are its normal surface; in the file-backed profile it is `prompts.json` under th

## 3. Host ports and precedence

Each owner declares its own port, so a capability depends only on its own text:

| Owner | Port | Reads |
| --- | --- | --- |
| PromptSources | `BasePromptSettingsHost` | `base` |
| Skills | `SkillsInstructionsSettingsHost` | `skills` |
| ContextCompaction | `SummaryPromptSettingsHost` | `summary` |
Each capability reads only its own text. The owner service is [PromptSettings](../plugins/PromptSettings.md); a
capability outside the App Server depends on the port trait in `dim-agent-capabilities` for its text:
`BasePromptSettings` for PromptSources, `SkillsInstructionsSettings` for Skills and
`SummaryPromptSettings` for ContextCompaction.

- The port is optional (`Option<Key<…>>`): an assembly that does not register the name, such as
the capability tests or a host without Settings, injects nothing and keeps its built-in text.
Expand All @@ -100,30 +97,13 @@ Each owner declares its own port, so a capability depends only on its own text:

### 3.1 Data operations

The same three read ports are available to plugins of any language:

| Service | Async operation | Request | Reply |
| --- | --- | --- | --- |
| `basePromptSettingsHost` | `base` | `{}` | string or `null` |
| `skillsInstructionsSettingsHost` | `instructions` | `{}` | string or `null` |
| `summaryPromptSettingsHost` | `systemPrompt` | `{}` | string or `null` |

Each reply is that port's existing override text; `null` means no user override.
The ports read through the same PromptSettings owner and source. They add no cache,
extra source read, configuration field or change to the precedence above.

Errors are `{code, message}`. The product owner reports `failed` for a settings read
error, including a settings read ended by cancellation, retaining its existing error
text. Malformed wire requests are `invalid_request`. Dropping a wire call cancels
its read token and abandons its reply; this does not introduce a new product error
code. Native callers retain their existing cancellation token and error behavior;
a failed port read does not change the source.
Superseded by [PromptSettings](../plugins/PromptSettings.md): one service `promptSettings` with `base`, `summary` and `skills`, each answering `{text}` or none. The precedence above and the client entry below stay in force.

## 4. Client entry

The settings methods are the primitive: `settings.read` and `settings.update` with
`source: "prompts"`, `scope: "user"`. `settings.sources` publishes the schema, and both methods
are management methods, so only a local connection can edit the texts.
`source: "prompts"`, `scope: "user"`. The client knows the three member names; `settings.sources`
is deleted. Both methods are management methods, so only a local connection can edit the texts.

The native client presents each field as plain text rather than JSON:

Expand Down Expand Up @@ -189,37 +169,18 @@ Rules: [design rules](../../architecture/rust-agent/principles.md) §1 and §4,

| Rule | How this design complies |
| --- | --- |
| §1 Plugins and capabilities bounded | Each text stays in its owner; the App Server owns only the Settings document and the ports |
| §1 Plugins and capabilities bounded | Each text stays in its owner; the App Server owns the document and the one service, and each capability depends on its own port trait |
| §4 rule 4 No business meaning in core | No core type gains a prompt text; the ports are capability-level contracts |
| §4 rule 6 Context from consumed events | The text reaches the model through the existing adopted prompt sources; no new context path |
| §4 rule 7 Public events and services | No new event, client method or Timeline fact; the existing Settings methods and three optional process services are used |
| §4 rule 7 Public events and services | No new event, client method or Timeline fact; the existing Settings methods and one optional process service are used |
| §4 rule 8 Infrastructure unchanged | No change to Timeline, Dispatcher, rutis or the assembly mechanism |
| ADR 002 D1 Scope | The document and ports live at the process scope where the shared configuration is; the texts live in their Session parts |
| ADR 002 D4 Configuration | Business configuration stays with its owner; the document is the App Server's source, as `execution` and `prompt-suggestion` are |
| ADR 007 D5 Owner registration | A dedicated App Server row registers the source; Settings and the assembly declare none |
| ADR 008 D2 No delivery status | This document states the design; the issue tracks delivery |
| ADR 008 D3 Own scope only | The owner documents state their own port; this page states the product setting and the client entry |
| ADR 008 D3 Own scope only | The owner contract states the service and the ports; this page states the product setting and the client entry |

## 7. Binding appendix

```rust
pub trait BasePromptSettings: Send + Sync + 'static {
fn base(&self, cancel: CancellationToken) -> HostFuture<'_, Option<Arc<str>>>;
}
pub struct BasePromptSettingsHost(pub Arc<dyn BasePromptSettings>);

pub trait SkillsInstructionsSettings: Send + Sync + 'static {
fn instructions(&self, cancel: CancellationToken) -> HostFuture<'_, Option<Arc<str>>>;
}
pub struct SkillsInstructionsSettingsHost(pub Arc<dyn SkillsInstructionsSettings>);

pub trait SummaryPromptSettings: Send + Sync + 'static {
fn system_prompt(&self, cancel: CancellationToken) -> HostFuture<'_, Option<Arc<str>>>;
}
pub struct SummaryPromptSettingsHost(pub Arc<dyn SummaryPromptSettings>);
```

The App Server row registers the `prompts` declaration and provides the three hosts from one
`PromptDocument`; each host reads only its field. Each binding is provided at its Rust type key and
`host_key` for its service name. Its dispatcher calls the same owner method; native
callers invoke that method directly without JSON conversion.
Superseded by the binding appendix of [PromptSettings](../plugins/PromptSettings.md); the three
`*SettingsHost` types are deleted.
4 changes: 2 additions & 2 deletions docs/design/appserver/provider-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ with its existing owner; management never writes another owner's state.
| Account namespaces | Account owners provide login, usage and logout. The [ChatGPT plan provider](chatgpt-plan.md) owns `account.chatgpt`. |
| `ProviderConnectionResolver`, `ModelSelectionHost` | Provider implements catalog/route decisions through existing types; no new core port |
| `auxiliaryModel.complete` | Existing caller-selected S4 contract, unchanged |
| `provider` Settings source, user scope (`provider.json`) | The Provider part registers it; it holds `userAgent`, the User-Agent override (§2, Model request identity), so a user's choice is a declared, validated document rather than a request-local input |
| `provider` Settings source, user scope (`provider.json`) | [ProviderSettings](../plugins/ProviderSettings.md) owns it; it holds `userAgent`, the User-Agent override (§2, Model request identity), and publishes it as a value a model request reads |
| Native CLI Provider flows | Migrate discovery, create, update and disconnect together with the new owner methods |

Business logic stays in Provider, not `connection.rs`, `protocol.rs` or a wiring
Expand Down Expand Up @@ -101,7 +101,7 @@ default identity like any other Provider.

| Override | Where | Notes |
| --- | --- | --- |
| `provider` settings source, `userAgent` | `provider.json`, user scope, owned by the Provider part | Replaces the whole User-Agent string; 1–512 printable ASCII characters, refused by the source's schema otherwise. The part serving one App Server holds it, so two Servers in one process keep theirs apart |
| `provider` settings source, `userAgent` | `provider.json`, user scope ([ProviderSettings](../plugins/ProviderSettings.md)) | Replaces the whole User-Agent string; 1–512 printable ASCII characters, refused by the source's schema otherwise. A model request reads the value from ProviderSettings at request time, so two Servers in one process keep theirs apart |
| `DIM_USER_AGENT` | Environment of the process that hosts models | The same validation; wins over the setting. Read once by the App Server command line, beside the other startup inputs, and passed to each Server it builds, so a value a request cannot carry fails that process's startup |

`DIM_USER_AGENT` wins over the setting because it is set for one run of the
Expand Down
Loading