fix(tui,tool-tasks): finish removing dispose-ness from delivery
The TUI's referenced-prompt snapshot now rides the prompt's own admission transaction instead of a pre-admission inject: while idle, a one-shot prepended agent/prompt-submit wrapper appends the snapshot to the allow decision's additionalContexts, so a blocking hook discards the prompt and its attached context together instead of stranding the snapshot in history for the next unrelated prompt. A prompt discarded before admission releases the wrapper; steering keeps the inject path since it bypasses admission and drains at the same boundary. The session-reference snapshot adapter pinned the old context-before-prompt order; the branch-wide order (prompt first, its contexts after) is now asserted and the fixture re-recorded. tool-tasks drops the last consumer of the removed thrown-disposed contract: completion notices now inject unconditionally, which is well-defined during owner teardown — the loop treats disposal like any cancel, so the notice appends as durable idle context (persisted for resume while the session is attached, dropped with the detached log after). README pair and the owner-disposal tests state the new delivery contract.
This commit is contained in:
@@ -24,10 +24,13 @@ class SnapshotAdapter extends LlmAdapter {
|
||||
|
||||
async * stream(options: GenerateOptions): AsyncIterable<StreamChunk> {
|
||||
this.requests.push(options)
|
||||
const [context, prompt] = options.messages.slice(-2)
|
||||
// The snapshot rides the prompt's admission: the loop appends the
|
||||
// prompt first, then its additional contexts (the branch-wide ordering
|
||||
// for plugin-sourced context).
|
||||
const [prompt, context] = options.messages.slice(-2)
|
||||
if (context?.role !== 'user' || prompt?.role !== 'user'
|
||||
|| prompt.content[0]?.type !== 'text' || prompt.content[0].text !== 'Use @Source session') {
|
||||
throw new Error('session reference context did not precede the direct user message')
|
||||
throw new Error('session reference context did not follow the direct user message')
|
||||
}
|
||||
yield { type: 'block-start', index: 0, blockType: 'text' }
|
||||
yield { type: 'text-delta', index: 0, text: 'Combined reference request accepted.' }
|
||||
|
||||
Reference in New Issue
Block a user