@jambonz/schema 0.4.29 → 0.4.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,60 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://jambonz.org/schema/commands/dialogflow:update",
4
+ "title": "Dialogflow Update Command",
5
+ "description": "Command sent from the application to feature-server over the session websocket, sending input into a running Dialogflow CES session (a `dialogflow` verb with `model: \"ces\"`) without restarting the verb. The same object can be sent over REST as the `dialogflow_update` key of the call-update body. `variables` and `dtmf` are sent at once. An `event` or `text` starts an agent turn; CES silently drops one that arrives while the agent is still replying, so jambonz holds it and sends it when the agent's current turn ends, one per turn, in order. A command sent when no CES dialogflow verb is running is refused and logged by feature-server.",
6
+ "type": "object",
7
+ "required": ["type", "command", "data"],
8
+ "properties": {
9
+ "type": { "const": "command" },
10
+ "command": { "const": "dialogflow:update" },
11
+ "data": {
12
+ "type": "object",
13
+ "description": "The input to send. At least one of `event`, `text`, `dtmf` or `variables` is required, and at most one of `event`, `text` and `dtmf`.",
14
+ "properties": {
15
+ "event": {
16
+ "type": "string",
17
+ "minLength": 1,
18
+ "description": "A CES event name. The CES agent's instructions must say what to do when it receives this event."
19
+ },
20
+ "text": {
21
+ "type": "string",
22
+ "minLength": 1,
23
+ "description": "Text sent as if the caller had said it."
24
+ },
25
+ "dtmf": {
26
+ "type": "string",
27
+ "minLength": 1,
28
+ "description": "Keypad digits."
29
+ },
30
+ "variables": {
31
+ "type": "object",
32
+ "description": "CES session variables. Only variables the CES app declares, and whose instructions reference them as {name}, are used by the agent.",
33
+ "additionalProperties": true
34
+ }
35
+ },
36
+ "additionalProperties": false,
37
+ "minProperties": 1,
38
+ "not": {
39
+ "anyOf": [
40
+ { "required": ["event", "text"] },
41
+ { "required": ["event", "dtmf"] },
42
+ { "required": ["text", "dtmf"] }
43
+ ]
44
+ }
45
+ }
46
+ },
47
+ "additionalProperties": false,
48
+ "examples": [
49
+ {
50
+ "type": "command",
51
+ "command": "dialogflow:update",
52
+ "data": { "event": "payment_approved" }
53
+ },
54
+ {
55
+ "type": "command",
56
+ "command": "dialogflow:update",
57
+ "data": { "variables": { "account_tier": "gold" } }
58
+ }
59
+ ]
60
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://jambonz.org/schema/components/recognizer-paxaOptions",
4
+ "title": "Paxa Recognizer Options",
5
+ "description": "Paxa Labs realtime STT options. Only applies when recognizer vendor is 'paxa'. Paxa detects the end of each turn and produces one final transcript per turn. The recognizer language is sent as a hint (it never filters out other languages); set it to 'any' for automatic detection.",
6
+ "type": "object",
7
+ "properties": {
8
+ "style": {
9
+ "type": "string",
10
+ "enum": ["verbatim", "clean"],
11
+ "description": "verbatim (default) keeps fillers and false starts; clean drops them."
12
+ },
13
+ "convention": {
14
+ "type": "string",
15
+ "enum": ["spoken", "written"],
16
+ "description": "spoken (default) writes numbers as said; written uses digits and units."
17
+ },
18
+ "timestamps": {
19
+ "type": "boolean",
20
+ "description": "Request word-level timestamps."
21
+ }
22
+ },
23
+ "additionalProperties": false
24
+ }
@@ -8,7 +8,7 @@
8
8
  "vendor": {
9
9
  "type": "string",
10
10
  "description": "The STT vendor to use. Must match a vendor configured in the jambonz platform.",
11
- "examples": ["google", "aws", "microsoft", "deepgram", "ibm", "nvidia", "soniox", "xai", "modulate", "zoom", "gradium", "giggy", "mistral", "assemblyai", "speechmatics", "openai", "houndify", "gladia", "elevenlabs", "custom"]
11
+ "examples": ["google", "aws", "microsoft", "deepgram", "ibm", "nvidia", "soniox", "xai", "modulate", "zoom", "gradium", "giggy", "mistral", "paxa", "assemblyai", "speechmatics", "openai", "houndify", "gladia", "elevenlabs", "custom"]
12
12
  },
13
13
  "label": {
14
14
  "type": "string",
@@ -204,6 +204,7 @@
204
204
  "gradiumOptions": { "$ref": "recognizer-gradiumOptions" },
205
205
  "giggyOptions": { "$ref": "recognizer-giggyOptions" },
206
206
  "mistralOptions": { "$ref": "recognizer-mistralOptions" },
207
+ "paxaOptions": { "$ref": "recognizer-paxaOptions" },
207
208
  "assemblyAiOptions": { "$ref": "recognizer-assemblyAiOptions" },
208
209
  "speechmaticsOptions": { "$ref": "recognizer-speechmaticsOptions" },
209
210
  "openaiOptions": { "$ref": "recognizer-openaiOptions" },
@@ -8,7 +8,7 @@
8
8
  "vendor": {
9
9
  "type": "string",
10
10
  "description": "The TTS vendor to use. Must match a vendor configured in the jambonz platform.",
11
- "examples": ["google", "aws", "microsoft", "elevenlabs", "cartesia", "fishaudio", "gradium", "kugelaudio", "mistral", "nineninesix", "speechify", "deepgram", "deepgramflux", "ibm", "nvidia", "wellsaid", "whisper", "custom"]
11
+ "examples": ["google", "aws", "microsoft", "elevenlabs", "cartesia", "fishaudio", "gradium", "kugelaudio", "mistral", "nineninesix", "paxa", "speechify", "deepgram", "deepgramflux", "ibm", "nvidia", "wellsaid", "whisper", "custom"]
12
12
  },
13
13
  "label": {
14
14
  "type": "string",
@@ -255,6 +255,16 @@ session.updateAgent({
255
255
  });
256
256
  ```
257
257
 
258
+ ## Dialogflow Update
259
+
260
+ The `dialogflow:update` command sends input into a running Dialogflow CES session (a `dialogflow` verb with `model: "ces"`) without restarting the verb. Over REST, send the same object as the `dialogflow_update` key of the call-update body. The object holds at most one of `event`, `text` or `dtmf`, plus optional `variables`; at least one field is required.
261
+
262
+ ```json
263
+ {"type": "command", "command": "dialogflow:update", "data": {"event": "payment_approved"}}
264
+ ```
265
+
266
+ An `event` or `text` is held until the agent's current turn ends, since CES drops input that arrives mid-reply. See `docs/verbs/dialogflow.md` for the worked example, including the line the CES agent's instructions need, and for the `input-sent` and `input-dropped` events.
267
+
258
268
  ## LLM Tool Output
259
269
 
260
270
  When using the `agent` verb with a `toolHook`, tool call requests arrive as events. Return results with:
@@ -0,0 +1,69 @@
1
+ ## Overview
2
+
3
+ The dialogflow verb connects the caller to a Google Dialogflow agent (ES, CX, or CES). See the verb schema for all properties.
4
+
5
+ ## Sending input into a CES conversation mid-call
6
+
7
+ With `model: "ces"`, an application can send input into the running conversation without restarting the verb. Updates can be sent via:
8
+ - **WebSocket**: a `dialogflow:update` command: `{"type":"command","command":"dialogflow:update","data":{...}}`
9
+ - **REST API**: the `dialogflow_update` key of the call-update body, with the same object
10
+
11
+ The object holds at most one of `event` (a CES event name), `text` (sent as if the caller said it) or `dtmf` (keypad digits), plus an optional `variables` object. At least one field is required.
12
+
13
+ - `variables` and `dtmf` are sent at once.
14
+ - An `event` or `text` starts an agent turn. CES silently drops one that arrives while the agent is still replying, so jambonz holds it and sends it when the agent's current turn ends: one per turn, in order.
15
+ - Only CES is supported. A command sent when no CES dialogflow verb is running is refused and logged by feature-server.
16
+
17
+ This replaces redirecting to a new `dialogflow` verb with a `welcomeEvent` to tell the agent something mid-call, which restarts the verb.
18
+
19
+ ### Example: take a card payment, then tell the agent
20
+
21
+ The caller is talking to a CES agent. The application takes the card payment on another system and tells the agent when it is approved:
22
+
23
+ ```typescript
24
+ // WebSocket application (@jambonz/sdk)
25
+ session.updateDialogflow({ event: 'payment_approved' });
26
+
27
+ // or from any system that knows the call sid, over REST
28
+ await client.calls.updateDialogflow(callSid, { event: 'payment_approved' });
29
+ ```
30
+
31
+ The raw command is:
32
+
33
+ ```json
34
+ {"type": "command", "command": "dialogflow:update", "data": {"event": "payment_approved"}}
35
+ ```
36
+
37
+ The CES agent only acts on an event its instructions mention. Add a line like this to the agent's instructions in the CES app:
38
+
39
+ ```
40
+ When you receive the event payment_approved, thank the caller, confirm that their payment went through, and ask if there is anything else you can help with.
41
+ ```
42
+
43
+ Without it, the event arrives but the agent has no idea what to do with it.
44
+
45
+ ### Variables
46
+
47
+ `variables` sets CES session variables. A variable must be declared in the CES app and referenced in the agent's instructions as `{name}`, otherwise the agent does not use it.
48
+
49
+ ```json
50
+ {"type": "command", "command": "dialogflow:update", "data": {"variables": {"account_tier": "gold"}}}
51
+ ```
52
+
53
+ ### input-sent and input-dropped events
54
+
55
+ Two eventHook events report what happened to a held `event` or `text` input. They are delivered only if listed in the verb's `events` array (or `events: ["all"]`).
56
+
57
+ | Event | Meaning | Data |
58
+ |-------|---------|------|
59
+ | `input-sent` | A held input went out | `{kind, event, waited_ms}` |
60
+ | `input-dropped` | An input was not delivered, e.g. the session ended first | `{kind, event, reason}` |
61
+
62
+ ```json
63
+ {
64
+ "verb": "dialogflow",
65
+ "model": "ces",
66
+ "eventHook": "/df-event",
67
+ "events": ["input-sent", "input-dropped"]
68
+ }
69
+ ```
package/lib/validator.js CHANGED
@@ -116,6 +116,7 @@ function validateVerb(name, data, logger) {
116
116
  * Commands are the inverse of callbacks: callbacks flow server → app; commands
117
117
  * flow app → server. Currently defined commands:
118
118
  * - llm:tool-output — response to an agent:tool-call event.
119
+ * - dialogflow:update — send input into a running Dialogflow CES session.
119
120
  *
120
121
  * @param {string} name - Command name (e.g. 'llm:tool-output').
121
122
  * @param {object} message - The full command message including `type` and `command`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jambonz/schema",
3
- "version": "0.4.29",
3
+ "version": "0.4.31",
4
4
  "description": "JSON Schema definitions and validation for jambonz verb applications",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -81,7 +81,7 @@
81
81
  "items": {
82
82
  "type": "string"
83
83
  },
84
- "description": "List of event types to receive via the eventHook."
84
+ "description": "List of event types to receive via the eventHook. For CES, the events `input-sent` (an input held by a `dialogflow:update` command was sent; data `{kind, event, waited_ms}`) and `input-dropped` (an input was not delivered, e.g. the session ended first; data `{kind, event, reason}`) are delivered only if listed here (or `all`)."
85
85
  },
86
86
  "welcomeEvent": {
87
87
  "type": "string",