openclaw/src/auto-reply
Sebastian d0a4cce41e feat: add dynamic template variables to messages.responsePrefix (#923)
Adds support for template variables in `messages.responsePrefix` that
resolve dynamically at runtime with the actual model used (including
after fallback).

Supported variables (case-insensitive):
- {model} - short model name (e.g., "claude-opus-4-5", "gpt-4o")
- {modelFull} - full model identifier (e.g., "anthropic/claude-opus-4-5")
- {provider} - provider name (e.g., "anthropic", "openai")
- {thinkingLevel} or {think} - thinking level ("high", "low", "off")
- {identity.name} or {identityName} - agent identity name

Example: "[{model} | think:{thinkingLevel}]" → "[claude-opus-4-5 | think:high]"

Variables show the actual model used after fallback, not the intended
model. Unresolved variables remain as literal text.

Implementation:
- New module: src/auto-reply/reply/response-prefix-template.ts
- Template interpolation in normalize-reply.ts via context provider
- onModelSelected callback in agent-runner-execution.ts
- Updated all 6 provider message handlers (web, signal, discord,
  telegram, slack, imessage)
- 27 unit tests covering all variables and edge cases
- Documentation in docs/gateway/configuration.md and JSDoc

Fixes #923
2026-01-14 23:05:08 -05:00
..
reply feat: add dynamic template variables to messages.responsePrefix (#923) 2026-01-14 23:05:08 -05:00
.DS_Store refactor(src): split oversized modules 2026-01-14 01:17:56 +00:00
chunk.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
chunk.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
command-auth.test.ts fix(whatsapp): normalize user JIDs for group allowlists (#838) 2026-01-14 23:25:42 +00:00
command-auth.ts feat: load channel plugins 2026-01-15 02:42:44 +00:00
command-detection.test.ts fix: normalize telegram command mentions 2026-01-11 21:06:04 +05:30
command-detection.ts fix: normalize telegram command mentions 2026-01-11 21:06:04 +05:30
commands-registry.data.ts feat: add /context prompt breakdown 2026-01-15 01:06:35 +00:00
commands-registry.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
commands-registry.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
commands-registry.types.ts refactor(src): split oversized modules 2026-01-14 01:17:56 +00:00
envelope.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
envelope.ts refactor!: rename chat providers to channels 2026-01-13 08:40:39 +00:00
group-activation.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
heartbeat.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
heartbeat.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
media-note.test.ts style: apply lint fixes 2026-01-08 04:44:15 +00:00
media-note.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
model.test.ts fix: support /models alias for /model 2026-01-09 06:24:40 +01:00
model.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.block-streaming.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.accepts-thinking-xhigh-codex-models.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.applies-inline-reasoning-mixed-messages-acks-immediately.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.defaults-think-low-reasoning-capable-models-no.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.ignores-inline-model-uses-default-model.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.lists-allowlisted-models-model-list.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.prefers-alias-matches-fuzzy-selection-is-ambiguous.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.requires-per-agent-allowlist-addition-global.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.returns-status-alongside-directive-only-acks.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.shows-current-elevated-level-as-off-after.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.shows-current-verbose-level-verbose-has-no.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.supports-fuzzy-model-matches-model-directive.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.directive-behavior.updates-tool-verbose-during-flight-run-toggle.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.directive.parse.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.heartbeat-typing.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.media-note.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.queue.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.raw-body.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.group-intro-prompts.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.allows-activation-from-allowfrom-groups.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.allows-approved-sender-toggle-elevated-mode.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.allows-elevated-off-groups-without-mention.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.filters-usage-summary-current-model-provider.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.handles-inline-commands-strips-it-before-agent.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.ignores-inline-elevated-directive-unapproved-sender.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.includes-error-cause-embedded-agent-throws.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.keeps-inline-status-unauthorized-senders.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.reports-active-auth-profile-key-snippet-status.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.runs-compact-as-gated-command.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.runs-greeting-prompt-bare-reset.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.shows-endpoint-default-model-status-not-configured.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.shows-quick-model-picker-grouped-by-model.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.stages-inbound-media-into-sandbox-workspace.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.triggers.trigger-handling.targets-active-session-native-stop.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
reply.ts refactor(auto-reply): split reply pipeline 2026-01-14 09:11:16 +00:00
send-policy.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
status.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
status.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
templating.ts fix: finalize channels rename cleanup 2026-01-13 08:40:40 +00:00
thinking.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
thinking.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
tokens.ts fix: filter NO_REPLY prefixes 2026-01-09 23:29:05 +00:00
tool-meta.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
tool-meta.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
transcription.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
transcription.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
types.ts feat: add dynamic template variables to messages.responsePrefix (#923) 2026-01-14 23:05:08 -05:00