mirror of
https://github.com/MoonshotAI/kimi-code.git
synced 2026-07-31 12:05:17 +00:00
* feat(agent-core-v2): interruption reminder for user-cancelled turns
When the user interrupts a turn with Esc, append a durable
<system-reminder> (origin: injection/interruption) to the agent context
via a new loop aspect watching turn.ended, so the model learns the
previous turn was deliberately cut off. The marker persists to the
wire, replays on resume, stays hidden from transcripts, skips non-user
aborts and steer, and does not stack on repeated cancels.
Two supporting fixes:
- An aborted LLM stream now persists its accumulated partial
text/thinking as content.part loop events instead of dropping every
produced token; gated on the turn signal so retried or
step-cancelled attempts keep their partial output out of the record.
- The turn.cancel wire op carries an optional reason
('user_cancelled' | 'aborted') so cold readers can tell deliberate
interrupts from programmatic aborts. Goal-lifecycle cancels now pass
an explicit programmatic reason to keep that field honest.
* feat(transcript): mark user-cancelled turns with an interruption marker
Project the deliberate user interrupt onto the transcript timeline: the
live projector emits an 'interruption' marker when a turn ends with
interruptReason 'user_cancelled', and the cold fold consumes the
persisted turn.cancel reason into the same marker. Programmatic aborts
keep surfacing through their own outlets (errors, goal/task state), and
queued cancels that left no visible residue are skipped.
* fix(agent-core-v2): make user-turn cancellation idempotent and reconcile interruption reminders on restore
* fix(transcript): dedupe user-cancelled interruption markers by turn in the cold fold
* chore(agent-core-v2): regenerate state manifest after merging main
* refactor(agent-core-v2): split interruptionReminder out of the loop domain
The loop domain owns turn execution mechanics; whether an interrupted turn
should produce a model-visible reminder is a model-context policy. Move it
into its own L4 domain with its own wire model that cross-reduces the
loop's turn.cancel fact, and rename the op to interruptionReminder.recorded.
---------
Signed-off-by: Haozhe <yanghaozhe@moonshot.ai>
Co-authored-by: Haozhe <yanghaozhe@moonshot.ai>
|
||
|---|---|---|
| .. | ||
| lib | ||
| middleware | ||
| openapi | ||
| protocol | ||
| routes | ||
| search | ||
| security | ||
| services | ||
| transport | ||
| contract.ts | ||
| env.d.ts | ||
| envelope.ts | ||
| error-handler.ts | ||
| index.ts | ||
| instanceRegistry.ts | ||
| request-id.ts | ||
| requestLogging.ts | ||
| start.ts | ||
| version.ts | ||