fix(web): address the review round on the remaining context forms
- `relay` resolves its sender in `contextBody` like every other form. It was
the one shape whose marker could claim a form the body did not render: an
unreadable sender fell back inside the body while the row still said relay,
contradicting the contract this PR's own note states.
- `recall` requires the retained, omitted, and truncated fields. Completeness
is what the card exists to report, so a reference that cannot state it is
not a readable recall — showing the label alone presents a confident card
over unknown loss.
- The snapshot body states the supersession its producer framing line carries.
That line is the one part of the model-facing text no section contains, and
unlike an instruction context's `<system-reminder>` it states the form's own
semantics rather than wrapping content.
- `GoalMessageSource` is a discriminated pair, so `{ form: 'notice' }` without
its account no longer compiles. The guarantee this PR claims now holds at
that seam too, not only through `ContextFormed` on plugin sources.
- Goal and tool-goal summaries are bounded by a shared `boundContextSummary`,
which tool-tasks now uses as well. A goal objective is unbounded caller text
in exactly the way a task label is.
- The runtime snapshot interpolates once per request: agent-loop renders the
sections and joins them through `joinContextSections`.
- Every form's fallback branch is pinned, not only the notice one.
This commit is contained in:
@@ -104,6 +104,24 @@ export interface MessageSourceMap {
|
||||
tool: ToolMessageSource
|
||||
}
|
||||
|
||||
/**
|
||||
* Bound for a `notice` summary. The account rides a collapsed transcript row
|
||||
* and is committed to the durable log, while its inputs — task labels, goal
|
||||
* objectives, tool arguments — are caller text with no length of their own.
|
||||
*/
|
||||
export const CONTEXT_SUMMARY_MAX_CHARS = 120
|
||||
|
||||
/**
|
||||
* Bound one `notice` summary to {@link CONTEXT_SUMMARY_MAX_CHARS}.
|
||||
* @param summary - the producer's one-line account, of any length.
|
||||
* @returns the account, ellipsized when it exceeds the bound.
|
||||
*/
|
||||
export function boundContextSummary(summary: string): string {
|
||||
return summary.length <= CONTEXT_SUMMARY_MAX_CHARS
|
||||
? summary
|
||||
: `${summary.slice(0, CONTEXT_SUMMARY_MAX_CHARS - 1)}…`
|
||||
}
|
||||
|
||||
/** Any known message source, derived from {@link MessageSourceMap}; switch on `kind` and fall through unknowns (merge-extensible). */
|
||||
export type MessageSource = MessageSourceMap[keyof MessageSourceMap]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user