Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
2efa783
docs(design): target contracts for the Session scope and its host ports
eric8810 Nov 23, 2026
0869dd6
docs(design): hold work by callback and settle leases at the row
eric8810 Nov 23, 2026
29563df
docs(design): add line addressing, file access facts and the store sp…
eric8810 Nov 23, 2026
f331fe7
docs(design): add the line-addressed call to the Session surface
eric8810 Nov 23, 2026
d954cd2
docs(design): drop the line call and state the branch handover
eric8810 Nov 23, 2026
c101548
docs(design): apply the round-three review
eric8810 Nov 23, 2026
6038491
docs(design): apply the round-four review
eric8810 Nov 24, 2026
4d03ffb
docs(design): carry the projection and compaction replies as wire types
eric8810 Nov 24, 2026
1148f55
docs(design): state the route answers a Session part receives
eric8810 Nov 24, 2026
faca8be
docs(design): cite the routing mechanism for the route answers
eric8810 Nov 24, 2026
86bb7dd
docs(design): apply the round-six decisions
eric8810 Nov 24, 2026
d23ea2f
docs(design): close the round-three leftovers
eric8810 Nov 24, 2026
17705b2
docs(design): point the Report read at the line read and index the ow…
eric8810 Nov 24, 2026
3d979a7
docs(design): hand the superseded rows to their owners as pointers
eric8810 Nov 24, 2026
2d9e0ed
docs(design): match Supersedes to the pointer edits
eric8810 Nov 24, 2026
9c46f21
docs(design): close the pre-review findings
eric8810 Nov 24, 2026
affab40
docs(design): close the second pre-review
eric8810 Nov 24, 2026
d6ec09b
docs(design): close the sixth-round review
eric8810 Nov 24, 2026
4557d0b
docs(design): give the allowance repair one operation
eric8810 Nov 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/architecture/rust-agent/plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ runtime assembly and scripted model hosts: a newly assembled capability needs it
entry here. Excluded rows can still appear as providers or consumers in the generated blocks. A service
dependency is not necessarily a plugin with the same name.

The Session and branch owner contracts have no page here: they are owner parts of the Session,
branch and process scopes rather than plugins of the local-execution profile. See the design index
for [SessionScope](../../../design/plugins/SessionScope.md), [Request settings](../../../design/plugins/RequestSettings.md),
[Context facts](../../../design/plugins/ContextFacts.md), [Context projection](../../../design/plugins/ContextProjection.md),
[Summary strategy](../../../design/plugins/SummaryStrategy.md) and [File access facts](../../../design/plugins/FileAccessFacts.md) (#2025).

## Index

| Plugin | Process | Session parts | Branch parts |
Expand Down
65 changes: 28 additions & 37 deletions docs/design/contracts/runtime-owner-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,46 @@

| Caller → owner | Final API |
| --- | --- |
| Branch management, input and history callers → `timelineTree` | `create/end/info/input/list/page/query` retain their existing signatures on the single Session tree face. Creation returns the branch ID. |
| Branch management, input and history callers → `timelineTree` | `create`, `end`, `set_default`, `directory`, `line` and `read` on the single Session tree face; creation returns the line id ([TimelineTree](https://github.com/arcships/dim/pull/2092), #2024). `query` is not the tree's: a stored Session's history is `store.query` on the process face ([SessionStore](https://github.com/arcships/dim/pull/2091), #2018). |

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.

P2: this row now says query is not the tree's, but :47 still calls timelineTree.query. #2092 at 3113d18 declares the tree's operations as create, end, set_default, directory, line and read with no query (TimelineTree.md:127-134), and SessionScope.md:219 says history reads go through timelineTree.read. A Report caller following :47 reaches an operation no target owner defines. Change :47 to timelineTree.read. The retained rows at :19,21,22,26 also keep the old directory, inputs, display and timelineTree.input shapes; align them with #2092's directory, line and read targets and the line_owner route while touching this section.

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.

Partially fixed in c8f1812. :47 now calls timelineTree.read with the #2092 {line, through, limit} shape. Remaining in the same section: :19 still gives directory as [{info, head, state, endEvent?}], :21 calls inputs(id, inputs), :22 calls display(id), :25 calls directory({id}) and :26 calls timelineTree.input. #2092 at c80f8e1 declares only create, end, set_default, directory, line and read, with directory answering {default, lines} and a record {line, parent, cut, source, state, head, endEvent?} (TimelineTree.md:127-136). Align these rows or state that #2092's Supersedes replaces them. Noted in the body.

| Language readers → PromptSources | `sessionLanguage.get`. |
| Language updates → App Server | [`session.language.update`](session-access.md) accepts the existing language code or clear action. The owner serializes persistence, live-state replacement and Prompt adoption on main and loaded branches before replying. |
| Prompt → PromptRegistry; guide and tool contributors → their registries | `initialPromptConfiguration.get`, `promptHost.load`, `guideEntries.register`, `toolRegistry.register`, `toolSourcesView.get/observe`. |
| Session and branch parts → their lifecycle; branch fact consumers → Dispatcher | `sessionLifecycle.activated/closing/hold/release`, `branchLifecycle.activated/closing`, `dispatcher.listen/consume/committed`. |
| Session and branch parts → their lifecycle; branch fact consumers → Dispatcher | `sessionScope.activated/closing/hold/release` and its fault operations ([SessionScope](../../../docs/design/plugins/SessionScope.md), #2093); `branchLifecycle.activated/closing`, `dispatcher.listen/consume/committed`. The old `sessionLifecycle` name is superseded. |

## New rutis APIs on existing owners

### Admission and branch control

| Caller → owner | New API |
| --- | --- |
| Branch directory readers → `timelineTree` | `timelineTree.directory({}) → [{info, head, state, endEvent?}]`, including ending and ended branches. |
| Skills content and MCP publication → Session loader | `sessionLoader.create({group, definitionId, instanceData}) → {instanceId}`; `remove({instanceId}) → void`. The Session loader admits groups whose configured parent is the Session group. Registered Session extension definitions must activate their instance rows. Host-added optional groups retain their optional rows. Skills supplies its content definition; MCP supplies its connection definition ID and retains the resolved transport configuration. |
| Goal → timelineTree | `inputs(id, inputs) → committed events`. One validated atomic batch for the Goal record and trigger. |
| Branch-detail RPC → timelineTree | `display(id) → {entry,purpose?,cutMessages?,end?}`. |
| History RPC and line-read tools → timelineTree | `batchEnd(id, sequence) → void`, `pageEnd(id, after, limit, through) → sequence`, and `page` at the same cutoff. Preserve complete batches and the fixed head of ended lines. |
| Context RPC → target branch | `agentLoop.compact` and `contextUsage.read`. |
| Goal and Shell admission → timelineTree | `directory({id})` returns the matching directory entry or the unknown-branch error using a single-branch lookup. Goal reads ended history through `query`; writes retain the ended/unknown errors. |
| InputQueue and Collaboration approvals → target branch | `timelineTree.input`, `inputQueue.withdraw` after submission checks, and `approval.pending/decide` on the selected branch. |
| PromptSuggestion → ContextUsage; Report and Agent configuration → Prompt | `contextUsage.read`, `prompt.adoptedConfiguration({}) → adopted configuration or null`. Report also uses `timelineTree.query` at the selected head for evidence. |
| Branch directory readers → `timelineTree` | `timelineTree.directory({}) → {default, lines}` ([TimelineTree](https://github.com/arcships/dim/pull/2092), #2024). |
| Skills content and MCP publication → Session mounts | `sessionScope.mount({group, definitionId, instanceData}) → {instanceId}`; `unmount({instanceId})`. The owner admits groups whose configured parent is the Session group, waits for the definition's rows and settles a rejected instance. Skills supplies its content definition; MCP supplies its connection definition ID and retains the resolved transport configuration ([SessionScope](../../../docs/design/plugins/SessionScope.md), #2093). |
| Goal → the target line's input owner | `line_owner::<InputQueue>(line).submit(...)`; one validated atomic batch for the Goal record and trigger ([ADR 027](https://github.com/arcships/dim/pull/2029)). |
| Branch-detail RPC → timelineTree | `line({line})` for the record and `read({line, …})` for the facts; there is no `display` operation. |
| History RPC and line-read tools → timelineTree | `read({line, through, …})` at one cutoff, with the complete batches and the fixed head of an ended line; the reply carries the events or the selected fields. |
| Context RPC → target branch | `line_owner::<AgentLoop>(line).compact(...)` and `line_owner::<ContextUsage>(line).read(...)` ([ADR 027](https://github.com/arcships/dim/pull/2029)). |
| Goal and Shell admission → timelineTree | `line({line})` returns the matching record or `unknown` ([TimelineTree](https://github.com/arcships/dim/pull/2092)). Goal reads ended history through `read` at the line's fixed head; writes retain the ended/unknown errors. |
| InputQueue and Collaboration approvals → target branch | `line_owner::<InputQueue>(line)`: `submit(...)` and `withdraw(...)` after submission checks; `line_owner::<Approval>(line)`: `pending` and `decide`. |
| PromptSuggestion → ContextUsage; Report and Agent configuration → Prompt | `line_owner::<ContextUsage>(line).read(...)`, `line_owner::<Prompt>(line).adoptedConfiguration(...)`. Report's own tree reads are [TimelineTree's](https://github.com/arcships/dim/pull/2092), not this row's. |
| Prompt and ToolBinding → `branchLifecycle` | `registerOpening(completion) → void`. Opening waits for admitted completions under its existing deadline and propagates their errors. |
| Fault producers and Session observers → `sessionLifecycle` | `reportFault(error) → void`, `failure({}) → SessionFault or null`, `observeFault(listener) → id`, `release(id) → boolean`. The listener receives the current failure (initially null) and subsequent reports. Caller unload releases the observation. The first fault wins until a storage failure supersedes it; the first storage failure wins. |
| Fault producers and Session observers → `sessionScope` | `reportFault(fault) → void`, `failure() → SessionFault or none`, `observeFault(listener) → id`, `release({leaseId}) → boolean`. The listener receives the current failure (none included) and later reports; the calling row's unload releases the observation. The first fault wins until a storage failure supersedes it ([SessionScope](../../../docs/design/plugins/SessionScope.md), #2093). |
| Check providers and input admission → SubmitChecks | `register(name, check) → void`; `check({entry, branchId, user?, mode}, cancelled) → proceed{blocks, warnings} or block{message}`. Run in name order through the first block. Interrupted checks write nothing. |
| Compaction, stop and activity callers → `agentLoop` | `agentLoop.compact({}) → sequence`, `stopTurn({turnId, reason}) → sequence or null`; `agentLoop.state({}) → {phase, turnId?}`, `observe(listener)` delivers that snapshot. |

### Calls from a Session to a selected branch

Within a branch, inject its owner face directly. For Session callers the existing
`timelineTree` face gains `call({branchId,operation}, cancelled) → operation reply`.
TimelineTree resolves the admitted live branch once using its existing branch lookup and
dispatches on that branch instance. The operation is a tagged union of the calls below;
Direct variants use the owner method's arguments, reply and error. The compact RPC variant below returns the existing settled client result. The Session caller gets data.
Ended and unknown branches retain their original errors. Calls admitted before close stay
with that generation. Tree history, directory and batch input continue to use the tree's
own methods.
Within a branch, inject its owner face directly. A Session part reaches one line's owners by
line id: `line_owner::<T>(line)?.op(..)` resolves the branch-group service at the instance the
runtime built for that line, and the caller calls that owner's typed operation. Any branch-group
data face is reachable this way except registration points and lifecycle services; there is no
generic operation-name dispatch and no `timelineTree.call`. A line that is not live answers
`NoLine`; a Session that is closing answers `SessionClosing`. `NoLine` is final for that line:
the caller takes no hold and does not retry it. `SessionClosing` ends the Session part's work. A
Session part never receives `NoSession`: only a process caller does, and it takes a hold from Agents
before calling again ([#2127](https://github.com/arcships/dim/issues/2127)).

| Session caller | Target operation |
| --- | --- |
| Context RPC / PromptSuggestion | `contextUsage.read`. The `compactAndWait` variant runs the existing compact RPC handler: it calls `agentLoop.compact` and waits for the compaction fact matching that command sequence and returns the existing completed/skipped/failed reply. The committed sequence watch and bounded query run inside the selected branch for that wait. |
| Session language / Agent configuration / Report | `prompt.configure` or `prompt.adoptedConfiguration` with the existing source, model and outcome records. |
| InputQueue management / Collaboration | `inputQueue.withdraw` with the existing command; the caller runs the existing submit checks for steer before writing. `approval.pending` returns the branch's existing pending requests, and `approval.decide` settles the selected request. Collaboration retains its ended response on closed/ended/unknown detail lookup. |

For a live main branch, Report captures its published head once at draft capture (`directory({id:"main"}).head`)
and stores it as `conversationThrough` on that draft. Activity evidence and later opt-in
conversation extraction call `timelineTree.query` with the same explicit `through`,
existing bounded window and `include_publishing: false`. Zero yields an empty window.
A draft without a captured cutoff does not fetch a conversation. Plan generation never
substitutes a newer head.
Report's draft head, its bounded conversation window and the cutoff it keeps are stated by the
[TimelineTree contract](https://github.com/arcships/dim/pull/2092) and Report's own contract; this document keeps neither.

### Prompt, configuration and files

Expand All @@ -66,11 +57,11 @@ substitutes a newer head.

| Caller → owner | New API |
| --- | --- |
| Loop → PrepareModelHost | `prepare({turnId, requestId, history, availableTools}) → ModelSettings`, with pinned tool definitions in order. |
| ContextPreparation → PrepareContextHost | `prepare({request, source:{turnId, requestId, through}}, cancelled) → ModelRequest`. |
| Context accounting and compaction → ContextModelHost | `describe(model facts) → {contextWindow, outputTokens, thresholdTokens, algorithm?}`, `count(request) → tokens`, `contributions({model, fixed?, messages}) → {algorithm, fixed?, messages}`, `estimate({model, algorithm, contribution}) → tokens`. |
| Loop and ContextPreparation → CompactionStrategyHost | `describe(model facts) → {name, replacementSize}`; `compact(input, cancelled) → completed, skipped or failed` with StrategyDiagnostics. Input carries history, checkpoint, request, legal cuts, trigger, budgets, prior diagnostics and model facts. |
| Loop and ContextPreparation → HistoryRenderer | `context({branchId, through}) → ContextHistory`, `renderedContext({branchId, through}) → {context, history: HistoryEntry[]}`, `snapshot({context, retainFrom, anchor}) → RecoverySnapshot`, `streamCheckpoint({branchId, through, retainFrom, batch}) → ProjectionCheckpoint`. |
| Loop → `requestSettings` | `settings() → {providerId, modelId, capabilitySnapshot?, config?, system?, metadata?}`; Loop adds the pinned tools, the guide's system and the turn's ids ([Request settings](../../../docs/design/plugins/RequestSettings.md), #2093). |
| ContextPreparation → no host port | The request transformation has no owner and leaves the catalog; a content change enters only through adopted inputs or tool results (#2093). |
| Context accounting and compaction → `contextFacts` | `describe({model})`, `count({request})`, `contributions({model, fixed?, messages}) → {algorithm, fixed?, messages}`, `estimate({model, algorithm, contribution})` ([Context facts](../../../docs/design/plugins/ContextFacts.md), #2093). |
| Loop and ContextPreparation → `summaryStrategy` | `describe({model}) → {name, replacementSize}`; `compact(input, cancelled) → completed, skipped or failed` with diagnostics. The input carries history, checkpoint, request, legal cuts, trigger, budgets and prior diagnostics, and no model object ([Summary strategy](../../../docs/design/plugins/SummaryStrategy.md), #2093). |
| Loop and ContextPreparation → `contextProjection` | `renderedStream({through, batch})`, `renderedContext({through})`, `snapshot({context, retainFrom, anchor})`, `streamCheckpoint({through, retainFrom, batch})`, `snapshotFromCheckpoint({checkpoint, anchor})`; the fold is the branch's own ([Context projection](../../../docs/design/plugins/ContextProjection.md), #2093). |
| Loop and ModelProvider → ContextPreparation | `prepare({source: ContextPrepareData, projection?}, cancelled) → ModelRequest`, `validate({requestId, request}, cancelled) → void`. Reuse the prepared projection at the original cutoff. |
| ContextPreparation and usage readers → ContextUsage | `read({through?}, cancelled) → {through, contextWindow, outputTokens, thresholdTokens, estimatedInputTokens, baselineSource}`. |
| Loop, ToolExecutor and Code Mode definition readers → `toolBinding` | `bind({requestId, through, tools, toolSources}) → void`, `bindCurrent({requestId, declared?}) → ToolDefinition[]`, `definitions({requestId}) → ToolDefinition[]`, `transfer({from, to}) → void`, `release({requestId}) → void`. ToolBinding retains the pinned handler generation. |
Expand Down
Loading