fix(review): align runtime-context diagnostics and docs

This commit is contained in:
NI0317
2026-07-31 15:19:59 +08:00
parent 469dc8ffce
commit 1beb38554e
14 changed files with 39 additions and 24 deletions

View File

@@ -309,6 +309,15 @@ describe('SystemPrompt', () => {
.toBe('Current runtime context. This snapshot supersedes earlier runtime-context snapshots.\n\nMode: read-only.')
})
it('attributes context interpolation failures to the contributing context', () => {
expect(() => renderContextSnapshot({
sections: [],
contexts: [{ name: 'policy', text: 'Mode: {{missing}}.' }],
tools: [],
variables: {},
})).toThrow('unknown prompt variable "{{missing}}" in context "policy"; registered variables: (none)')
})
it('emits system-prompt/change when a tool provider is registered and disposed', async () => {
const ctx = new Context()
await ctx.plugin(SystemPrompt)