fix(agent-kit): provide full thread context to first-time participating roles

When a role participates for the first time (e.g. committer), it previously
only received the system prompt + last step output, missing the full thread
history. This caused hallucination as the role had to guess what happened.

Changes:
- build-continuation-prompt.ts: detect first-time roles and include all
  steps' meta + content for last 2-3 steps (within quota)
- context.ts: add isFirstVisit detection helper
- types.ts: add isFirstVisit field to AgentContext
- hermes.ts: pass isFirstVisit through to prompt builder

Fixes #473
This commit is contained in:
2026-05-24 15:56:39 +00:00
parent 39f6ae692b
commit c2c849df7e
8 changed files with 394 additions and 44 deletions
+1
View File
@@ -63,6 +63,7 @@ export type StepNodePayload = StepRecord & {
/** JSONata 上下文中的 step — output 被展开 */
export type StepContext = Omit<StepRecord, "output"> & {
output: unknown;
content: string | null;
};
export type ModeratorContext = {