Repository navigation
docs(design): target contracts for the branch turn chain #2102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c215aa5
3a4801f
5413efd
27d97f3
9c4e4da
5634869
5b2d852
851f531
44e6419
823124c
3b48e12
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,14 +21,14 @@ | |
| | 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`. | | ||
| | Context RPC → target branch | `contextPreparation.compact` and `contextUsage.read`; the owner contracts are [ContextPreparation](../plugins/ContextPreparation.md) and [ContextUsage](../plugins/ContextUsage.md). | | ||
| | 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. | | ||
| | InputQueue and Collaboration approvals → target branch | `inputQueue.submit`, `inputQueue.withdraw` (the queue runs the submit checks for a Steer), and `approval.pending/decide` on the selected branch; see [InputQueue](../plugins/InputQueue.md). | | ||
| | 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. | | ||
| | 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. | | ||
| | 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. | | ||
| | Compaction → `contextPreparation`; stop and activity callers → `agentLoop` | `contextPreparation.compact(..)`; `agentLoop.stopTurn/state/observe`; see [Loop](../plugins/Loop.md) and [ContextPreparation](../plugins/ContextPreparation.md). | | ||
|
|
||
| ### Calls from a Session to a selected branch | ||
|
|
||
|
|
@@ -43,9 +43,9 @@ own methods. | |
|
|
||
| | 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. | | ||
| | Context RPC / PromptSuggestion | `contextUsage.read`; Context RPC's `compactAndWait` is `contextPreparation.compact`, which answers the outcome itself. | | ||
| | 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. | | ||
| | InputQueue management / Collaboration | `inputQueue.withdraw` with the existing command; the queue runs the submit checks for a Steer. `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 | ||
|
|
@@ -58,20 +58,20 @@ substitutes a newer head. | |
|
|
||
| | Caller → owner | New API | | ||
| | --- | --- | | ||
| | ToolBinding, Session language and Agent configuration → `prompt` | `prompt.initialCompletion({}) → void or opening error`; `prompt.configure({sources, model?}) → unchanged, adopted or superseded`. | | ||
| | Prompt and guide adoption → `contextPreparation` | `contextPreparation.publish({adopted, changes, model?, toolAdoption?, inputs}) → sequence or null`; `awaitPublished({sequence}) → sequence`. Publication commits adoption atomically. | | ||
| | ToolBinding, Session language and Agent configuration → `prompt` | `prompt.configure({sources, model?, tools?}) → unchanged, adopted or superseded`; the opening adoption is internal. See [Prompt adoption](../plugins/PromptAdoption.md). | | ||
| | Prompt and guide adoption → `prompt` | publication is `prompt.configure`; see [Prompt adoption](../plugins/PromptAdoption.md). | | ||
| | File read/edit/write tools → branch FileReads | `binding({path}) → TextFileBinding or null`, `writeBinding({path}) → absent, compacted or bound`, `record({path, binding, established}) → void`. The original read supplies the established sequence; file I/O stays on the file node. | | ||
|
|
||
| ### Model preparation, history and tools | ||
|
|
||
| | 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 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. | | ||
| | Loop → RequestSettings | `settings() → settings`; the model profile's defaults before an adoption ([#2093](https://github.com/arcships/dim/pull/2093), target). | | ||
| | ContextPreparation → PrepareContextHost | The model profile's request builder stays the host port `prepare` calls; the owner contract is [ContextPreparation](../plugins/ContextPreparation.md). | | ||
| | Context accounting and compaction → ContextFacts | `describe`, `count`, `contributions`, `estimate`; ContextFacts is the owner ([#2093](https://github.com/arcships/dim/pull/2093), target). | | ||
| | ContextPreparation → SummaryStrategy | `describe(model facts) → {name, replacementSize}`; `compact(input, cancelled) → completed, skipped, failed or cancelled` with StrategyDiagnostics; SummaryStrategy is the owner ([#2093](https://github.com/arcships/dim/pull/2093), target). | | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Problem: This row says SummaryStrategy's Failure scenario: A caller handles a variant that never arrives and misses the error. Evidence: docs/design/contracts/runtime-owner-operations.md:72; #2093 SummaryStrategy.md:72, 82. Fix: Drop |
||
| | Loop and ContextPreparation → ContextProjection | `renderedStream`, `renderedContext`, `snapshot`, `streamCheckpoint`, `snapshotFromCheckpoint`; ContextProjection is the owner ([#2093](https://github.com/arcships/dim/pull/2093), target). | | ||
| | Loop and ModelProvider → ContextPreparation | `prepare({source, projection}, cancelled) → void`, `validate({request}, cancelled) → void`, `compact({}, cancelled) → outcome`; the owner contract is [ContextPreparation](../plugins/ContextPreparation.md). | | ||
| | ContextPreparation and usage readers → ContextUsage | `read({through?}, cancelled) → UsageRead`, `estimate({requestId, through}, cancelled) → Estimate`, `confirm({requestId}) → void`; the owner contract is [ContextUsage](../plugins/ContextUsage.md). | | ||
| | Loop and ToolExecutor → `toolBinding` | `bind({requestId, turnId, through, declared, sources})`, `adopted({requestId}) → {adoption, tools}`, `claim({requestId, calls, context})`, `transfer({from, to})`, `release({requestId})`, `retain_only({requestId})`; settlement follows the line's facts and `retain_only` is the Loop's rebuild step ([#2100](https://github.com/arcships/dim/pull/2100), target). | | ||
| | Nested tool execution → `toolExecutor` | `open({parentCallId, context}, cancelled) → gateId`, `invoke({gateId, call}) → ToolResult`, `close({gateId}) → ToolEffect[]`. Close joins children in order; interruption releases the gate. | | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Compaction row is updated, but lines 69-75 still define
PrepareModelHost,PrepareContextHost,ContextModelHost,CompactionStrategyHostandprepare(...) -> ModelRequest. Loop.md uses RequestSettings, GuideEntries andContextPreparation.prepare; ContextPreparation.md:166 says ContextFacts and SummaryStrategy replace the two hosts;ContextPreparation.preparereturns{}. Failure scenario: two contracts for the same operations and callers wire the old hosts. Fix: update lines 69-75 or state that they stay with #2025 and link the sibling target.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 851f531. runtime-owner-operations.md:69-76 now lists RequestSettings, ContextFacts, SummaryStrategy, ContextProjection and the new ContextPreparation operations; the old PrepareModelHost, ContextModelHost and CompactionStrategyHost rows are gone.