pinecall 0.11.28 → 0.11.29

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 828249923cb0d1361ca46f2eb0c809922ee3772a91de69cb4f3569f34ecde557
4
- data.tar.gz: 753ec205cc496237fc358070a6573f889acc8b71fc0f947aae5fa2697e79f88f
3
+ metadata.gz: dd070aadaaa648db1194737d2157220c0bbb53665a78bdd355580b7e0c4eb696
4
+ data.tar.gz: 72aa87f88004cdd0e6eb19683ce1d7f249d9976cc2498165190d8cfcaba58db5
5
5
  SHA512:
6
- metadata.gz: a674884bd73dfc14eb03546a7ed775da404a69dc57b2a3a717d046f8c7d22e41c2df7ba13d6fd43ac77ac706d4881eacd0c2b702a888c9347057803c4f83a7ef
7
- data.tar.gz: 3bda349e64764cb678ac7e23335c921a98a6756443481826ac299272115337f905e0b74fee4011c2618715eedd0aea244edbf35130857ff2dbbae8cfa130d25b
6
+ metadata.gz: 5fd2137d5fd875b8f3f64f50b6e97f88939d8bba12a4548a86b4736527775b41c7de6819ae117596f8a3e50a2be43a3849e2ae970ccc00d70c2a37f3ccf4de47
7
+ data.tar.gz: 5ade6aba559807582977768966556fa177ba7382c016c171d36e9a218b6e10371b0005843912850351e518999876f3b0409620b39071df98881495e7e2798e79
data/CHANGELOG.md CHANGED
@@ -4,6 +4,17 @@ Every change a person using this gem would notice. The format is
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); version numbers and tags are the
5
5
  maintainer's call.
6
6
 
7
+ ## [Unreleased]
8
+
9
+ ## [0.11.29] — an agent may bear silence, leave a voicemail, and name its own fallbacks (2026-11-09)
10
+
11
+ - **A class declares the quiet, a machine and its fallbacks:** `silence_timeout`, `idle`, `voicemail`,
12
+ `stt_fallbacks` and `tts_fallbacks`, each over the agent's settings.
13
+ - **Docs: an app is set by its code.** The CLI and the console no longer write a code agent's settings, so the guides declare the voice, the knowledge, the base it searches and the memory policy on the class.
14
+
15
+ - **The wire reads `turn.detection`**: who ends the caller's turn on a spoken call (the ears, livekit's detector or
16
+ Smart Turn), its model, and the least silence it waits. Written once after `call.started`; the gateway's, not folded.
17
+
7
18
  ## [0.11.28] — the wire reads vendor.failed and org.quiet (2026-11-05)
8
19
 
9
20
  - **The wire reads `vendor.failed` and `org.quiet`, and `credits.exhausted` carries `calls`.** A vendor that
@@ -14,14 +14,16 @@ module Pinecall
14
14
 
15
15
  # The settings a class may declare. Must match the TypeScript package's `ENVIRONMENT`.
16
16
  ENVIRONMENT = %i[language voice llm realtime stt judge greeting hangup turn says hears knowledge docs memory record judges
17
- personas widget].freeze
17
+ personas widget idle voicemail stt_fallbacks tts_fallbacks].freeze
18
18
 
19
19
  # The ones written as the wire's own fields, keyword by keyword: `docs base: "…"`, `judges on: [...]`.
20
- AS_KEYWORDS = %i[turn knowledge docs memory judges personas widget].freeze
20
+ AS_KEYWORDS = %i[turn knowledge docs memory judges personas widget idle].freeze
21
21
 
22
22
  NO_VOICE = "a voice the class declares names its vendor and the voice: voice \"<vendor>\", \"<voice id>\""
23
23
 
24
24
  NOT_A_DURATION = "max_duration is the longest a voice call runs: 1 to 60 minutes, or :off for no limit"
25
+ NOT_A_SILENCE = "silence_timeout is how long a caller's silence ends the call: whole seconds, 5 to 3600"
26
+ NOT_A_MACHINE = "voicemail is the words left on a machine, or true to hang up and leave nothing"
25
27
  NOT_A_TIMEOUT = "llm_timeout is how long a turn waits for the model's first word, in seconds, above 0"
26
28
  LONGEST_MINUTES = 60
27
29
 
@@ -172,6 +174,31 @@ module Pinecall
172
174
  environment[:llm_timeout_s] = seconds.to_f
173
175
  end
174
176
 
177
+ # How long a caller's silence ends a voice call: `silence_timeout 30` (seconds).
178
+ def silence_timeout(seconds = NOTHING)
179
+ return environment[:silence_timeout_s] if seconds.equal?(NOTHING)
180
+ raise DeclarationRefused, NOT_A_SILENCE unless seconds.is_a?(Integer) && seconds.between?(5, 3600)
181
+
182
+ environment[:silence_timeout_s] = seconds
183
+ end
184
+
185
+ # On a call it placed: `voicemail "Call us back"` leaves the words, `voicemail true` leaves nothing.
186
+ def voicemail(given = NOTHING)
187
+ return environment[:voicemail] if given.equal?(NOTHING)
188
+ raise DeclarationRefused, NOT_A_MACHINE unless given == true || (given.is_a?(String) && !given.strip.empty?)
189
+
190
+ environment[:voicemail] = given == true ? {} : { message: given }
191
+ end
192
+
193
+ # Who takes over when the vendor fails, in order: `tts_fallbacks "cartesia", "elevenlabs/flash"`.
194
+ %i[stt_fallbacks tts_fallbacks].each do |field|
195
+ define_method(field) do |*vendors|
196
+ return environment[field] if vendors.empty?
197
+
198
+ environment[field] = vendors.flatten
199
+ end
200
+ end
201
+
175
202
  # The words the ears must know: `hears "Vidal", "Sanitas"`.
176
203
  def hears(*words)
177
204
  return environment[:hears] if words.empty?
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Pinecall
4
4
  # Set by the maintainer at release time.
5
- VERSION = "0.11.28"
5
+ VERSION = "0.11.29"
6
6
  end
@@ -85,6 +85,7 @@ module Pinecall
85
85
  "track.published" => "TrackPublished",
86
86
  "track.unpublished" => "TrackUnpublished",
87
87
  "turn.agent" => "AgentTurnEnded",
88
+ "turn.detection" => "TurnDetection",
88
89
  "turn.user" => "UserTurnEnded",
89
90
  "user.state" => "UserStateChanged",
90
91
  "user.transcript" => "UserTranscript",
@@ -130,7 +131,7 @@ module Pinecall
130
131
  }.freeze
131
132
 
132
133
  # Every event this protocol declares, in the schema's own order.
133
- EVENT_TYPES = %w[agent.configured agent.detached agent.draining agent.registered agent.state agent.transcript agent.waiting app.failed attention.answered attention.requested call.attached call.claimed call.dialing call.ended call.line call.ringing call.score call.started call.summary call.transferred callback.requested code.claimed code.issued confirm.declined confirm.granted confirm.request credits.exhausted custom dev.request docs.sources dtmf.received error evals.spent event.received fleet.full judge.broke log.caught_up log.gap memory.ops message.taken message.waiting metrics.avatar metrics.eot metrics.eou metrics.interruption metrics.llm metrics.realtime metrics.stt metrics.tts metrics.vad org.quiet participant.joined participant.left participant.speaking pong prompt.changed release.changed room.opened room.sent run.changed spend.unusual state.changed supervisor.ended supervisor.released supervisor.said supervisor.took_over supervisor.transferred supervisor.whispered tool.call tool.failed tool.ran tool.result tools.changed track.published track.unpublished turn.agent turn.user user.state user.transcript vendor.failed vendor.switched worker.changed].freeze
134
+ EVENT_TYPES = %w[agent.configured agent.detached agent.draining agent.registered agent.state agent.transcript agent.waiting app.failed attention.answered attention.requested call.attached call.claimed call.dialing call.ended call.line call.ringing call.score call.started call.summary call.transferred callback.requested code.claimed code.issued confirm.declined confirm.granted confirm.request credits.exhausted custom dev.request docs.sources dtmf.received error evals.spent event.received fleet.full judge.broke log.caught_up log.gap memory.ops message.taken message.waiting metrics.avatar metrics.eot metrics.eou metrics.interruption metrics.llm metrics.realtime metrics.stt metrics.tts metrics.vad org.quiet participant.joined participant.left participant.speaking pong prompt.changed release.changed room.opened room.sent run.changed spend.unusual state.changed supervisor.ended supervisor.released supervisor.said supervisor.took_over supervisor.transferred supervisor.whispered tool.call tool.failed tool.ran tool.result tools.changed track.published track.unpublished turn.agent turn.detection turn.user user.state user.transcript vendor.failed vendor.switched worker.changed].freeze
134
135
 
135
136
  # Every command an app may send.
136
137
  COMMAND_TYPES = %w[agent.configure agent.drain agent.register agent.reply agent.say call.attention call.callback call.claim call.dial call.done call.dtmf call.event call.hangup call.hold call.log call.mute call.opt_out call.transfer call.unhold call.unmute dev.answer participant.mute participant.remove ping prompt.set room.invite room.send session.configure state.set supervisor.verb tool.result tools.set].freeze
@@ -84,7 +84,16 @@ module Pinecall
84
84
  min_interruption_words: { kind: :int },
85
85
  endpointing_ms: { kind: :int },
86
86
  eot_threshold: { kind: :float },
87
- eager_eot_threshold: { kind: :float }
87
+ eager_eot_threshold: { kind: :float },
88
+ min_interruption_ms: { kind: :int }
89
+ }.freeze,
90
+ "IdleConfig" => {
91
+ says: { kind: :list, required: true, items: { kind: :str } },
92
+ after_s: { kind: :float },
93
+ times: { kind: :int }
94
+ }.freeze,
95
+ "VoicemailConfig" => {
96
+ message: { kind: :str }
88
97
  }.freeze,
89
98
  "Pronunciation" => {
90
99
  word: { kind: :str, required: true },
@@ -35,6 +35,11 @@ module Pinecall
35
35
  record: { kind: :bool, default: true },
36
36
  max_duration_s: { kind: :int },
37
37
  llm_timeout_s: { kind: :float },
38
+ silence_timeout_s: { kind: :int },
39
+ idle: { kind: :ref, ref: "IdleConfig" },
40
+ voicemail: { kind: :ref, ref: "VoicemailConfig" },
41
+ stt_fallbacks: { kind: :list, items: { kind: :str } },
42
+ tts_fallbacks: { kind: :list, items: { kind: :str } },
38
43
  tools: { kind: :list, items: { kind: :ref, ref: "ToolSpec" } },
39
44
  uses_knowledge: { kind: :bool, default: false },
40
45
  state_fields: { kind: :list, items: { kind: :ref, ref: "StateFieldSpec" } },
@@ -384,6 +384,11 @@ module Pinecall
384
384
  transcript_confidence: { kind: :float },
385
385
  metrics: { kind: :ref, ref: "UserTurnMetrics", required: true }
386
386
  }.freeze,
387
+ "TurnDetection" => {
388
+ by: { kind: :enum, values: %w[stt livekit smart-turn], required: true },
389
+ model: { kind: :str, required: true },
390
+ min_silence_s: { kind: :float }
391
+ }.freeze,
387
392
  "UserStateChanged" => {
388
393
  state: { kind: :ref, ref: "UserState", required: true }
389
394
  }.freeze,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pinecall
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.28
4
+ version: 0.11.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pinecall