feat(coding-agent): add ctx.getSystemPrompt() to extension context

Adds a method to access the effective system prompt (after any per-turn
extension modifications) from the extension context.

Implementation:
- Add systemPrompt getter to AgentSession reading from agent.state.systemPrompt
- Wire getSystemPrompt through ExtensionContextActions to ExtensionRunner
- Add getSystemPrompt to interactive-mode's shortcut context
- Update docs with ctx.getSystemPrompt() section
- Add system-prompt-header.ts example
- Add example to docs reference table

Closes #1098
This commit is contained in:
Mario Zechner 2026-01-30 17:44:25 +01:00
parent abd0c47b03
commit 99281e5913
7 changed files with 46 additions and 0 deletions

View file

@ -514,6 +514,11 @@ export class AgentSession {
return this.agent.state.isStreaming;
}
/** Current effective system prompt (includes any per-turn extension modifications) */
get systemPrompt(): string {
return this.agent.state.systemPrompt;
}
/** Current retry attempt (0 if not retrying) */
get retryAttempt(): number {
return this._retryAttempt;
@ -1756,6 +1761,7 @@ export class AgentSession {
}
})();
},
getSystemPrompt: () => this.systemPrompt,
},
);
}