pinecall 0.11.30 → 0.11.32
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 +4 -4
- data/CHANGELOG.md +18 -1
- data/lib/pinecall/agent/config.rb +32 -2
- data/lib/pinecall/agent/tools.rb +2 -1
- data/lib/pinecall/agent.rb +6 -0
- data/lib/pinecall/asking.rb +141 -0
- data/lib/pinecall/blocks.rb +12 -8
- data/lib/pinecall/bridge/passing.rb +94 -0
- data/lib/pinecall/bridge/screened.rb +95 -0
- data/lib/pinecall/bridge.rb +88 -38
- data/lib/pinecall/call_world.rb +49 -0
- data/lib/pinecall/client/app_work.rb +61 -0
- data/lib/pinecall/flow_loop.rb +101 -0
- data/lib/pinecall/flows.rb +182 -0
- data/lib/pinecall/handoff.rb +77 -0
- data/lib/pinecall/screen.rb +106 -0
- data/lib/pinecall/serve/app.rb +108 -0
- data/lib/pinecall/serve/loading.rb +4 -3
- data/lib/pinecall/serve/paged.rb +110 -0
- data/lib/pinecall/serve.rb +29 -3
- data/lib/pinecall/tasks.rb +96 -0
- data/lib/pinecall/version.rb +1 -1
- data/lib/pinecall/voice_app.rb +205 -0
- data/lib/pinecall/wire/registry.rb +2 -1
- data/lib/pinecall/wire/shapes_doors.rb +1 -0
- data/lib/pinecall/wire/shapes_events.rb +7 -0
- data/lib/pinecall.rb +10 -0
- data/sig/pinecall.rbs +90 -3
- metadata +13 -1
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pinecall
|
|
4
|
+
# A voice app: the numbers a project answers, the agent that answers each, and what they share.
|
|
5
|
+
# `line`, `rule`, `silence`, `on` and `page` return the app, so they chain.
|
|
6
|
+
class VoiceApp
|
|
7
|
+
A_NAME = /\A[a-z0-9][a-z0-9-]*\z/
|
|
8
|
+
A_NUMBER = /\A\+[1-9]\d{6,14}\z/
|
|
9
|
+
SECONDS = /\A(\d+)s\z/
|
|
10
|
+
A_ZONE = %r{\A(UTC|[A-Z][A-Za-z_]+(/[A-Za-z0-9_+-]+)+)\z}
|
|
11
|
+
# The type of the entry a line an agent logs is kept as: its own name is inside it.
|
|
12
|
+
A_LOGGED_LINE = "custom"
|
|
13
|
+
|
|
14
|
+
NOT_A_NUMBER = "a line is a phone number with its country code, like +1 415 555 0134"
|
|
15
|
+
NOT_A_PAGE = "a page is the folder its build writes, inside the project: app.page(\"ui/dist\")"
|
|
16
|
+
NOT_A_SILENCE = "silence is after: in seconds (8, or \"8s\") and say: the words to a caller who went quiet"
|
|
17
|
+
|
|
18
|
+
# One number of the app and who answers it.
|
|
19
|
+
Line = Data.define(:number, :answers, :team, :greeting, :chooses)
|
|
20
|
+
# The app's page: the built folder the platform serves, and the agent a visitor reaches.
|
|
21
|
+
Page = Data.define(:dir, :answers)
|
|
22
|
+
# The call an entry belongs to, as a handler is told it; `id` is nil for an entry of no call.
|
|
23
|
+
Heard = Data.define(:id, :agent)
|
|
24
|
+
|
|
25
|
+
# The apps made in this process, in order: the serve entry finds the one `app.rb` made.
|
|
26
|
+
def self.made = @made ||= []
|
|
27
|
+
|
|
28
|
+
attr_reader :name, :timezone, :lines, :rules, :paged
|
|
29
|
+
|
|
30
|
+
def initialize(name, timezone: nil)
|
|
31
|
+
raise DeclarationRefused, "a voice app's name is lowercase letters, digits and dashes, like its project's folder" unless A_NAME.match?(name.to_s)
|
|
32
|
+
# The shape alone: Ruby carries no zone database, and the runtime checks the zone again.
|
|
33
|
+
unless timezone.nil? || A_ZONE.match?(timezone.to_s)
|
|
34
|
+
raise DeclarationRefused, "a voice app's timezone is an IANA zone, like America/Los_Angeles"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
@name = name.to_s
|
|
38
|
+
@timezone = timezone
|
|
39
|
+
@lines = []
|
|
40
|
+
@rules = []
|
|
41
|
+
@paged = nil
|
|
42
|
+
@silence = nil
|
|
43
|
+
@hearing = Hash.new { |all, key| all[key] = [] }
|
|
44
|
+
@starting = Hash.new { |all, key| all[key] = [] }
|
|
45
|
+
VoiceApp.made << self
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Answer `number` with an agent: `app.line("+14155550134", FrontDesk, greeting: "Brightside.")`.
|
|
49
|
+
# `answers` may be a lambda of the call that picks one of `team`, with `fallback` the agent the number is pointed at.
|
|
50
|
+
def line(number, answers, greeting: nil, team: [], fallback: nil)
|
|
51
|
+
dialled = number.to_s.gsub(/[\s().-]/, "")
|
|
52
|
+
raise DeclarationRefused, NOT_A_NUMBER unless A_NUMBER.match?(dialled)
|
|
53
|
+
raise DeclarationRefused, "#{dialled} is a line of #{@name} already" if @lines.any? { |line| line.number == dialled }
|
|
54
|
+
|
|
55
|
+
chooses = agent?(answers) ? nil : answers
|
|
56
|
+
bound = chooses.nil? ? answers : fallback
|
|
57
|
+
raise DeclarationRefused, "a line is answered by an agent class: app.line(number, FrontDesk)" unless chooses.nil? || chooses.respond_to?(:call)
|
|
58
|
+
raise DeclarationRefused, "#{dialled}: a line whose answers is a lambda names its fallback, the agent the number is pointed at" unless agent?(bound)
|
|
59
|
+
raise DeclarationRefused, "the greeting of #{dialled} is the words the call opens with" if !greeting.nil? && greeting.strip.empty?
|
|
60
|
+
|
|
61
|
+
other = @lines.find { |line| line.answers == bound && line.greeting != greeting }
|
|
62
|
+
raise DeclarationRefused, "#{bound} answers #{other.number} and #{dialled}: both lines open with the same greeting, or with none" unless other.nil?
|
|
63
|
+
|
|
64
|
+
team.each do |mate|
|
|
65
|
+
raise DeclarationRefused, "#{mate} is of the team of #{dialled} and says nothing of what it takes: takes \"…\"" if mate.declared_takes.nil?
|
|
66
|
+
end
|
|
67
|
+
raise DeclarationRefused, "#{dialled}: a lambda answers with one of the line's team, and this line names none" if !chooses.nil? && team.empty?
|
|
68
|
+
|
|
69
|
+
@lines << Line.new(number: dialled, answers: bound, team: team.dup.freeze, greeting:, chooses:)
|
|
70
|
+
self
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# A rule every agent of the app keeps: read into each one's prompt, and judged.
|
|
74
|
+
def rule(rule)
|
|
75
|
+
raise DeclarationRefused, "a rule is a sentence every agent of the app keeps" if rule.to_s.strip.empty?
|
|
76
|
+
|
|
77
|
+
@rules << rule.strip
|
|
78
|
+
self
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Run the block (or start the flow) on every entry of that name on a call of the app's agents.
|
|
82
|
+
def on(name, flow = nil, &handler)
|
|
83
|
+
name = name.to_s
|
|
84
|
+
raise DeclarationRefused, "app.on takes the name of an entry, and a block or the flow it starts" if name.strip.empty? || (flow.nil? == handler.nil?)
|
|
85
|
+
|
|
86
|
+
if flow.nil?
|
|
87
|
+
@hearing[name] << handler
|
|
88
|
+
else
|
|
89
|
+
if flows.any? { |one| one.name == flow.name && !one.equal?(flow) }
|
|
90
|
+
raise DeclarationRefused, "two flows of #{@name} are named #{flow.name}: a run is kept by its flow's name"
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
@starting[name] << flow
|
|
94
|
+
end
|
|
95
|
+
self
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# The app's page: `app.page("ui/dist")`, served by the platform at the app's own name.
|
|
99
|
+
def page(dir, answers: nil)
|
|
100
|
+
folder = dir.to_s.delete_prefix("./").chomp("/")
|
|
101
|
+
raise DeclarationRefused, NOT_A_PAGE if folder.empty? || folder.start_with?("/") || folder.split("/").include?("..")
|
|
102
|
+
raise DeclarationRefused, "#{@name} has its page already, #{@paged.dir}: an app has one" unless @paged.nil?
|
|
103
|
+
|
|
104
|
+
reached = answers || @lines.first&.answers
|
|
105
|
+
raise DeclarationRefused, "a page's visitors reach an agent: write a line before the page, or name one with page(dir, answers: FrontDesk)" unless agent?(reached)
|
|
106
|
+
|
|
107
|
+
@paged = Page.new(dir: folder, answers: reached)
|
|
108
|
+
self
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# What every agent of the app says to a caller who went quiet, and after how long.
|
|
112
|
+
def silence(after:, say:, times: nil)
|
|
113
|
+
seconds = seconds_of(after)
|
|
114
|
+
raise DeclarationRefused, NOT_A_SILENCE if seconds.nil? || say.to_s.strip.empty? || (!times.nil? && times < 1)
|
|
115
|
+
|
|
116
|
+
@silence = { says: [say], after_s: seconds, times: }.compact
|
|
117
|
+
self
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Every flow the app starts, once each.
|
|
121
|
+
def flows = @starting.values.flatten.uniq
|
|
122
|
+
|
|
123
|
+
# The flows an entry of that name starts.
|
|
124
|
+
def started_by(name) = @starting.fetch(name.to_s, [])
|
|
125
|
+
|
|
126
|
+
# The name an entry is heard by and what it carries: a logged line by its own name.
|
|
127
|
+
def named(type, data)
|
|
128
|
+
return [type.to_s, data] unless type.to_s == A_LOGGED_LINE
|
|
129
|
+
|
|
130
|
+
[data[:name].to_s, data[:data].is_a?(Hash) ? data[:data] : {}]
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Hand one entry to whoever asked for its name; a handler that raises is told to `failed`.
|
|
134
|
+
def heard(type, call, agent, data, failed)
|
|
135
|
+
name, carried = named(type, data)
|
|
136
|
+
@hearing.fetch(name, []).each do |handler|
|
|
137
|
+
handler.call(Heard.new(id: call, agent:), carried)
|
|
138
|
+
rescue StandardError => e
|
|
139
|
+
failed.call(name, e)
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Every agent class the app names, once each.
|
|
144
|
+
def agents = [*@lines.flat_map { |line| [line.answers, *line.team] }, *@paged&.answers].uniq
|
|
145
|
+
|
|
146
|
+
# The lambda that picks who serves each call of the line `klass` is bound to.
|
|
147
|
+
def choosing(klass) = @lines.find { |line| line.answers == klass && !line.chooses.nil? }&.chooses
|
|
148
|
+
|
|
149
|
+
# The agents a call of `klass` may pass between; empty for an agent of no team.
|
|
150
|
+
def team_of(klass)
|
|
151
|
+
@lines.select { |line| line.team.any? && (line.answers == klass || line.team.include?(klass)) }
|
|
152
|
+
.flat_map { |line| [line.answers, *line.team] }.uniq
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# The numbers `klass` answers.
|
|
156
|
+
def numbers_of(klass) = @lines.select { |line| line.answers == klass }.map(&:number)
|
|
157
|
+
|
|
158
|
+
# What the app adds to one agent's declaration; a setting both declare is refused.
|
|
159
|
+
def declares(klass)
|
|
160
|
+
added = {}
|
|
161
|
+
greeting = @lines.find { |line| line.answers == klass && !line.greeting.nil? }&.greeting
|
|
162
|
+
unless greeting.nil?
|
|
163
|
+
once(klass, :greeting, "its line's greeting")
|
|
164
|
+
added[:greeting] = { say: greeting }
|
|
165
|
+
end
|
|
166
|
+
return added unless agents.include?(klass)
|
|
167
|
+
|
|
168
|
+
added[:timezone] = once(klass, :timezone, "its own timezone") && @timezone unless @timezone.nil?
|
|
169
|
+
added[:judges] = judging(klass) if @rules.any?
|
|
170
|
+
added[:idle] = once(klass, :idle, "app.silence") && @silence unless @silence.nil?
|
|
171
|
+
added
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
private
|
|
175
|
+
|
|
176
|
+
def agent?(given) = given.is_a?(Class) && given < Agent
|
|
177
|
+
|
|
178
|
+
def once(klass, field, app_says)
|
|
179
|
+
return true if klass.environment[field].nil?
|
|
180
|
+
|
|
181
|
+
raise DeclarationRefused, "#{klass} declares #{field} and #{@name} declares #{app_says}: keep one of the two"
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# The class's own judges stay, and each rule adds one: a declared list is the agent's whole list.
|
|
185
|
+
def judging(klass)
|
|
186
|
+
own = klass.environment[:judges] || {}
|
|
187
|
+
asked = @rules.each_with_index.map do |rule, at|
|
|
188
|
+
Pinecall.own_judge(name: "app-rule-#{at + 1}", asks: "Did the agent keep this rule through the whole call: \"#{rule}\"?")
|
|
189
|
+
end
|
|
190
|
+
{ on: own[:on] || [], own: [*own[:own], *asked] }
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
def seconds_of(given)
|
|
194
|
+
return given.to_f if given.is_a?(Numeric) && given.positive?
|
|
195
|
+
|
|
196
|
+
found = SECONDS.match(given.to_s.strip)
|
|
197
|
+
found && found[1].to_f
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
class << self
|
|
202
|
+
# A voice app named as its project: `APP = Pinecall.voice_app("brightside", timezone: "America/Los_Angeles")`.
|
|
203
|
+
def voice_app(name, timezone: nil) = VoiceApp.new(name, timezone:)
|
|
204
|
+
end
|
|
205
|
+
end
|
|
@@ -70,6 +70,7 @@ module Pinecall
|
|
|
70
70
|
"room.sent" => "RoomSent",
|
|
71
71
|
"run.changed" => "RunChanged",
|
|
72
72
|
"spend.unusual" => "SpendUnusual",
|
|
73
|
+
"stage.changed" => "StageChanged",
|
|
73
74
|
"state.changed" => "StateChanged",
|
|
74
75
|
"supervisor.ended" => "SupervisorEnded",
|
|
75
76
|
"supervisor.released" => "SupervisorReleased",
|
|
@@ -131,7 +132,7 @@ module Pinecall
|
|
|
131
132
|
}.freeze
|
|
132
133
|
|
|
133
134
|
# Every event this protocol declares, in the schema's own order.
|
|
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
|
|
135
|
+
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 stage.changed 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
|
|
135
136
|
|
|
136
137
|
# Every command an app may send.
|
|
137
138
|
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
|
|
@@ -23,6 +23,7 @@ module Pinecall
|
|
|
23
23
|
"AgentConfig" => {
|
|
24
24
|
prompt: { kind: :list, items: { kind: :ref, ref: "PromptBlockSpec" } },
|
|
25
25
|
language: { kind: :str },
|
|
26
|
+
timezone: { kind: :str },
|
|
26
27
|
greeting: { kind: :ref, ref: "GreetingConfig" },
|
|
27
28
|
voice: { kind: :ref, ref: "VoiceConfig" },
|
|
28
29
|
llm: { kind: :ref, ref: "ModelConfig" },
|
|
@@ -384,6 +384,13 @@ module Pinecall
|
|
|
384
384
|
transcript_confidence: { kind: :float },
|
|
385
385
|
metrics: { kind: :ref, ref: "UserTurnMetrics", required: true }
|
|
386
386
|
}.freeze,
|
|
387
|
+
"StageChanged" => {
|
|
388
|
+
stage: { kind: :enum, values: %w[llm stt tts], required: true },
|
|
389
|
+
vendor: { kind: :str, required: true },
|
|
390
|
+
model: { kind: :str },
|
|
391
|
+
voice: { kind: :str },
|
|
392
|
+
applied: { kind: :bool }
|
|
393
|
+
}.freeze,
|
|
387
394
|
"TurnDetection" => {
|
|
388
395
|
by: { kind: :enum, values: %w[stt livekit smart-turn], required: true },
|
|
389
396
|
model: { kind: :str, required: true },
|
data/lib/pinecall.rb
CHANGED
|
@@ -6,10 +6,16 @@
|
|
|
6
6
|
# for applications that decide their own answers.
|
|
7
7
|
|
|
8
8
|
require "json"
|
|
9
|
+
require "time"
|
|
10
|
+
require "timeout"
|
|
9
11
|
require "pinecall/wire"
|
|
10
12
|
|
|
11
13
|
require_relative "pinecall/version"
|
|
12
14
|
require_relative "pinecall/errors"
|
|
15
|
+
require_relative "pinecall/tasks"
|
|
16
|
+
require_relative "pinecall/screen"
|
|
17
|
+
require_relative "pinecall/asking"
|
|
18
|
+
require_relative "pinecall/handoff"
|
|
13
19
|
require_relative "pinecall/reading"
|
|
14
20
|
require_relative "pinecall/view"
|
|
15
21
|
require_relative "pinecall/rules"
|
|
@@ -18,6 +24,10 @@ require_relative "pinecall/panel"
|
|
|
18
24
|
require_relative "pinecall/agent"
|
|
19
25
|
require_relative "pinecall/call_world"
|
|
20
26
|
require_relative "pinecall/client"
|
|
27
|
+
require_relative "pinecall/client/app_work"
|
|
28
|
+
require_relative "pinecall/voice_app"
|
|
29
|
+
require_relative "pinecall/flows"
|
|
30
|
+
require_relative "pinecall/flow_loop"
|
|
21
31
|
require_relative "pinecall/bridge"
|
|
22
32
|
require_relative "pinecall/serve"
|
|
23
33
|
|
data/sig/pinecall.rbs
CHANGED
|
@@ -90,6 +90,13 @@ module Pinecall
|
|
|
90
90
|
def self.stt: (?String, ?builds: String?, ?options: Hash[untyped, untyped]?, ?end_of_turn: (String | Symbol)?) -> untyped
|
|
91
91
|
def self.judge: (?String, ?builds: String?, ?options: Hash[untyped, untyped]?) -> untyped
|
|
92
92
|
def self.language: (?String) -> untyped
|
|
93
|
+
def self.timezone: (?String) -> untyped
|
|
94
|
+
def self.takes: (?String) -> String?
|
|
95
|
+
def self.declared_takes: () -> String?
|
|
96
|
+
def self.tasks: (*Task) -> Array[Task]
|
|
97
|
+
def self.declared_tasks: () -> Array[Task]
|
|
98
|
+
def self.scenes: (**String) -> Hash[String, String]
|
|
99
|
+
def self.declared_scenes: () -> Hash[String, String]
|
|
93
100
|
def self.says: (?Array[Hash[Symbol, String]]) -> untyped
|
|
94
101
|
def self.record: (?bool) -> untyped
|
|
95
102
|
def self.max_duration: (?(Integer | Symbol)) -> untyped
|
|
@@ -129,6 +136,8 @@ module Pinecall
|
|
|
129
136
|
def self.source_file: () -> String?
|
|
130
137
|
|
|
131
138
|
def doc: () -> String?
|
|
139
|
+
def ask: (Task) -> untyped
|
|
140
|
+
def screen: () -> untyped
|
|
132
141
|
def tools: () -> Array[spec]
|
|
133
142
|
def visible_tools: () -> Array[spec]
|
|
134
143
|
def run_tool: (String | Symbol, ?Hash[Symbol, untyped], ?String?) -> untyped
|
|
@@ -191,6 +200,14 @@ module Pinecall
|
|
|
191
200
|
end
|
|
192
201
|
|
|
193
202
|
class CallWorld
|
|
203
|
+
attr_accessor scene: String?
|
|
204
|
+
attr_accessor handed: Hash[Symbol, untyped]?
|
|
205
|
+
attr_reader shown: untyped
|
|
206
|
+
attr_reader shared: Hash[untyped, untyped]
|
|
207
|
+
def handoff: (Class, ?Hash[Symbol, untyped]) -> String
|
|
208
|
+
def ask: (Task) -> untyped
|
|
209
|
+
def asking: () -> Asking::Asked?
|
|
210
|
+
def show: (untyped) -> untyped
|
|
194
211
|
LANDS_WITHIN_S: Integer
|
|
195
212
|
TRANSFER_WITHIN_S: Integer
|
|
196
213
|
A_MOMENT_S: Integer
|
|
@@ -374,8 +391,8 @@ module Pinecall
|
|
|
374
391
|
|
|
375
392
|
module Prompt
|
|
376
393
|
FRAMEWORK: Array[block_spec]
|
|
377
|
-
def self?.render: (Agent, ?resumed: bool, ?remembered: Array[String], ?line: line?) -> Blocks
|
|
378
|
-
def self?.identity: (Agent) -> String
|
|
394
|
+
def self?.render: (Agent, ?resumed: bool, ?remembered: Array[String], ?line: line?, ?rules: Array[String]) -> Blocks
|
|
395
|
+
def self?.identity: (Agent, ?Array[String]) -> String
|
|
379
396
|
def self?.tools: (Agent) -> String
|
|
380
397
|
def self?.history: (Agent) -> String
|
|
381
398
|
def self?.collapsed: (Integer) -> String
|
|
@@ -425,7 +442,7 @@ module Pinecall
|
|
|
425
442
|
end
|
|
426
443
|
|
|
427
444
|
module Bridge
|
|
428
|
-
def self?.mount: (Class, client: untyped, ?slug: String?, ?last: untyped, ?takes_unclaimed: bool) -> Mounted
|
|
445
|
+
def self?.mount: (Class, client: untyped, ?slug: String?, ?last: untyped, ?takes_unclaimed: bool, ?declares: Hash[Symbol, untyped], ?team: Hash[Class, String]?, ?rules: Array[String], ?answers: untyped) -> Mounted
|
|
429
446
|
|
|
430
447
|
class Mounted
|
|
431
448
|
attr_reader slug: String
|
|
@@ -476,6 +493,76 @@ module Pinecall
|
|
|
476
493
|
def self?.channel_rules_for: (String | Symbol, String | Symbol) -> String
|
|
477
494
|
end
|
|
478
495
|
|
|
496
|
+
class Task
|
|
497
|
+
attr_reader name: String
|
|
498
|
+
attr_reader asks: String
|
|
499
|
+
attr_reader fields: Hash[String, String]
|
|
500
|
+
attr_reader check: Proc
|
|
501
|
+
attr_reader how: String?
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
GetEmail: Task
|
|
505
|
+
GetPhone: Task
|
|
506
|
+
GetName: Task
|
|
507
|
+
|
|
508
|
+
class Asking
|
|
509
|
+
class Asked
|
|
510
|
+
attr_reader task: String
|
|
511
|
+
attr_reader asks: String
|
|
512
|
+
attr_reader fields: Hash[String, String]
|
|
513
|
+
attr_reader refused: String?
|
|
514
|
+
end
|
|
515
|
+
end
|
|
516
|
+
|
|
517
|
+
module Screen
|
|
518
|
+
class Shown
|
|
519
|
+
attr_reader part: String
|
|
520
|
+
attr_reader props: Hash[Symbol, untyped]
|
|
521
|
+
attr_reader children: Array[untyped]
|
|
522
|
+
end
|
|
523
|
+
|
|
524
|
+
class Part
|
|
525
|
+
attr_reader name: String
|
|
526
|
+
def call: (*untyped, **untyped) -> Shown
|
|
527
|
+
end
|
|
528
|
+
end
|
|
529
|
+
|
|
530
|
+
class VoiceApp
|
|
531
|
+
attr_reader name: String
|
|
532
|
+
attr_reader timezone: String?
|
|
533
|
+
def line: (String, untyped, ?greeting: String?, ?team: Array[Class], ?fallback: Class?) -> VoiceApp
|
|
534
|
+
def rule: (String) -> VoiceApp
|
|
535
|
+
def on: (String | Symbol, ?Flow?) ?{ (untyped, Hash[Symbol, untyped]) -> void } -> VoiceApp
|
|
536
|
+
def page: (String, ?answers: Class?) -> VoiceApp
|
|
537
|
+
def silence: (after: (Numeric | String), say: String, ?times: Integer?) -> VoiceApp
|
|
538
|
+
end
|
|
539
|
+
|
|
540
|
+
class Flow
|
|
541
|
+
attr_reader name: String
|
|
542
|
+
def cancel_on: (String | Symbol) { (Hash[Symbol, untyped], Hash[Symbol, untyped]) -> bool } -> Flow
|
|
543
|
+
|
|
544
|
+
class Called
|
|
545
|
+
attr_reader answered: bool
|
|
546
|
+
attr_reader reason: String?
|
|
547
|
+
attr_reader call: String?
|
|
548
|
+
attr_reader refused: String?
|
|
549
|
+
attr_reader message: String?
|
|
550
|
+
end
|
|
551
|
+
|
|
552
|
+
class Step
|
|
553
|
+
def sleep: (String) -> nil
|
|
554
|
+
def sleep_until: (Time | String, ?before: String?) -> nil
|
|
555
|
+
def call: (String, Class, ?state: Hash[Symbol, untyped]?, ?metadata: Hash[Symbol, untyped]?, ?greeting: String?, ?instruction: String?, ?from: String?) -> Called
|
|
556
|
+
def wait_for: (String, ?match: Hash[Symbol, untyped]?, ?within: String?) -> Hash[Symbol, untyped]?
|
|
557
|
+
def run: [T] () { () -> T } -> T
|
|
558
|
+
def emit: (String, ?Hash[Symbol, untyped]) -> nil
|
|
559
|
+
end
|
|
560
|
+
end
|
|
561
|
+
|
|
562
|
+
def self.voice_app: (String, ?timezone: String?) -> VoiceApp
|
|
563
|
+
def self.flow: (String) { (Hash[Symbol, untyped], Flow::Step) -> untyped } -> Flow
|
|
564
|
+
def self.part: (String | Symbol) -> Screen::Part
|
|
565
|
+
def self.task: (String, asks: String, fields: Hash[Symbol | String, String], ?how: String?) { (Hash[String, String]) -> untyped } -> Task
|
|
479
566
|
def self.own_judge: (**untyped) -> Hash[Symbol, untyped]
|
|
480
567
|
def self.own_persona: (**untyped) -> Hash[Symbol, untyped]
|
|
481
568
|
def self.mount: (Class, client: untyped, **untyped) -> Bridge::Mounted
|
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.
|
|
4
|
+
version: 0.11.32
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pinecall
|
|
@@ -48,13 +48,17 @@ files:
|
|
|
48
48
|
- lib/pinecall/agent/spec.rb
|
|
49
49
|
- lib/pinecall/agent/state.rb
|
|
50
50
|
- lib/pinecall/agent/tools.rb
|
|
51
|
+
- lib/pinecall/asking.rb
|
|
51
52
|
- lib/pinecall/blocks.rb
|
|
52
53
|
- lib/pinecall/bridge.rb
|
|
54
|
+
- lib/pinecall/bridge/passing.rb
|
|
55
|
+
- lib/pinecall/bridge/screened.rb
|
|
53
56
|
- lib/pinecall/call_world.rb
|
|
54
57
|
- lib/pinecall/call_world/answers.rb
|
|
55
58
|
- lib/pinecall/call_world/room.rb
|
|
56
59
|
- lib/pinecall/client.rb
|
|
57
60
|
- lib/pinecall/client/agent.rb
|
|
61
|
+
- lib/pinecall/client/app_work.rb
|
|
58
62
|
- lib/pinecall/client/call.rb
|
|
59
63
|
- lib/pinecall/client/connection.rb
|
|
60
64
|
- lib/pinecall/client/endpoints.rb
|
|
@@ -62,19 +66,27 @@ files:
|
|
|
62
66
|
- lib/pinecall/client/observe.rb
|
|
63
67
|
- lib/pinecall/client/rest.rb
|
|
64
68
|
- lib/pinecall/errors.rb
|
|
69
|
+
- lib/pinecall/flow_loop.rb
|
|
70
|
+
- lib/pinecall/flows.rb
|
|
71
|
+
- lib/pinecall/handoff.rb
|
|
65
72
|
- lib/pinecall/panel.rb
|
|
66
73
|
- lib/pinecall/reading.rb
|
|
67
74
|
- lib/pinecall/rules.rb
|
|
75
|
+
- lib/pinecall/screen.rb
|
|
68
76
|
- lib/pinecall/serve.rb
|
|
77
|
+
- lib/pinecall/serve/app.rb
|
|
69
78
|
- lib/pinecall/serve/declared_docs.rb
|
|
70
79
|
- lib/pinecall/serve/declared_hold.rb
|
|
71
80
|
- lib/pinecall/serve/held.rb
|
|
72
81
|
- lib/pinecall/serve/loading.rb
|
|
73
82
|
- lib/pinecall/serve/masking.rb
|
|
83
|
+
- lib/pinecall/serve/paged.rb
|
|
74
84
|
- lib/pinecall/serve/viewing.rb
|
|
85
|
+
- lib/pinecall/tasks.rb
|
|
75
86
|
- lib/pinecall/testing.rb
|
|
76
87
|
- lib/pinecall/version.rb
|
|
77
88
|
- lib/pinecall/view.rb
|
|
89
|
+
- lib/pinecall/voice_app.rb
|
|
78
90
|
- lib/pinecall/wire.rb
|
|
79
91
|
- lib/pinecall/wire/codec.rb
|
|
80
92
|
- lib/pinecall/wire/enums.rb
|