kap-server: expose parent turn/prompt correlation on public WS and history records for steered inputs

Open
#5,227 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
28/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
node.js, typescript
Domain
api, backend

Research direction

Start in packages/kap-server/src/routes/prompts.ts, where the internal prompt.steered signal already carries activePromptId and promptIds, and trace from there to where public WebSocket turn events are emitted and where session history records are persisted. The open work is a schema decision plus threading the parent turn/prompt id through both the live event path and the stored record path so it survives a kimi web restart, which also relates to the queue work in #4959. Done looks like a steered input appearing on the public stream and in reloaded history with an explicit parent reference, covered by the held-tool live and replay tests the reporter offers.

Written by the indexing model from the issue text.

Description

What feature would you like to see?

When a client steers an active turn via POST /api/v1/sessions/{session_id}/steer or promotes a queued prompt via POST /api/v1/sessions/{session_id}/prompts::steer, expose the relationship to the active parent turn/prompt on public KAP WebSocket events and persisted session history records (preserved across server restarts).

Additional information

We tested @moonshot-ai/[email protected] (1781dbd7) on Linux x64, Windows x64, and macOS arm64 against a local model provider while holding a shell tool open:

  • Both POST /api/v1/sessions/{session_id}/steer and POST /api/v1/sessions/{session_id}/prompts::steer inject the steered input into the very next provider request and execute its action once.
  • On the public KAP WebSocket stream and in persisted session history (packages/kap-server/src/routes/prompts.ts), however, the active turn closes and the steered input is emitted and stored as a separate completed turn (turn 0 original, turn 1 steered, turn 2 next ordinary prompt) with no field linking the steered turn back to the parent turn it steered. The same unlinked records appear when reloading after restarting kimi web.
  • packages/kap-server/src/routes/prompts.ts already consumes an internal prompt.steered signal carrying activePromptId and promptIds. Exposing that parent turn/prompt reference on public WS events and persisted history records would allow KAP clients (such as OAR) to project mid-turn steering accurately both live and on replay without heuristics, and could fit alongside ongoing queue work such as #4959.

Per CONTRIBUTING.md, we are not opening an unsolicited feature PR. We would be glad to submit a focused PR with held-tool live and replay tests if maintainers accept this direction and invite a contribution.


Agent Cindy for @xxchan via Stamp (grant cgr_0a427a0749428a5c521774a30edf08b7)

Dominant language
TypeScript
Stars
8.3k
Forks
1.4k
Avg merge
12h 6m
Merged PRs (30d)
596

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MoonshotAI/kimi-code

All issues in MoonshotAI/kimi-code

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.