Add dynamic variables support in session management and UI components. Implement validation rules for dynamic variables in metadata, including key format and value constraints. Enhance session start handling to manage dynamic variable errors. Update documentation and tests to reflect new functionality.

This commit is contained in:
Xin Wang
2026-02-27 11:21:37 +08:00
parent f1b60bef22
commit 3272a7a68a
5 changed files with 461 additions and 4 deletions

View File

@@ -65,7 +65,11 @@ Rules:
"mode": "audio"
},
"systemPrompt": "You are concise.",
"greeting": "Hi, how can I help?"
"greeting": "Hi, how can I help?",
"dynamicVariables": {
"customer_name": "Alice",
"plan_tier": "Pro"
}
}
}
```
@@ -74,6 +78,13 @@ Rules:
- Client-side `metadata.services` is ignored.
- Service config (including secrets) is resolved server-side (env/backend).
- Client should pass stable IDs (`appId`, `channel`, `configVersionId`) plus small runtime overrides (e.g. `output`, `bargeIn`, greeting/prompt style hints).
- `metadata.dynamicVariables` is optional and must be an object of string key/value pairs.
- Key pattern: `^[a-zA-Z_][a-zA-Z0-9_]{0,63}$`
- Max entries: 30
- Max value length: 1000 chars
- Placeholder format in `systemPrompt` and `greeting`: `{{variable_name}}`.
- Missing referenced placeholders reject `session.start` with `protocol.dynamic_variables_missing`.
- Invalid `dynamicVariables` payload rejects `session.start` with `protocol.dynamic_variables_invalid`.
Text-only mode:
- Set `metadata.output.mode = "text"`.