pinecall-runtime 0.1.6__py3-none-any.whl
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.
- pinecall/__init__.py +0 -0
- pinecall/channels/__init__.py +0 -0
- pinecall/channels/_chooser.py +45 -0
- pinecall/channels/offers.py +219 -0
- pinecall/channels/rooms.py +176 -0
- pinecall/channels/routes.py +275 -0
- pinecall/channels/telephony/__init__.py +0 -0
- pinecall/channels/telephony/_twilio.py +349 -0
- pinecall/channels/telephony/carrier.py +229 -0
- pinecall/channels/telephony/carrier_catalog.py +92 -0
- pinecall/channels/telephony/carriers.csv +41 -0
- pinecall/channels/telephony/dialing.py +419 -0
- pinecall/channels/telephony/firewall.py +58 -0
- pinecall/channels/telephony/hand_over.py +78 -0
- pinecall/channels/telephony/number_path.py +176 -0
- pinecall/channels/telephony/numbers.py +530 -0
- pinecall/channels/telephony/origination.py +77 -0
- pinecall/channels/telephony/sip.py +448 -0
- pinecall/channels/whatsapp.py +413 -0
- pinecall/cli/__init__.py +0 -0
- pinecall/cli/_archive.py +85 -0
- pinecall/cli/_drift.py +38 -0
- pinecall/cli/_facts.py +67 -0
- pinecall/cli/_load.py +433 -0
- pinecall/cli/_operator.py +626 -0
- pinecall/cli/_sessions.py +164 -0
- pinecall/cli/_traceback.py +95 -0
- pinecall/cli/_usage.py +34 -0
- pinecall/cli/main.py +521 -0
- pinecall/domain/__init__.py +0 -0
- pinecall/domain/agent.py +446 -0
- pinecall/domain/call.py +152 -0
- pinecall/domain/country_codes.py +32 -0
- pinecall/domain/errors.py +151 -0
- pinecall/domain/names.py +115 -0
- pinecall/domain/org.py +120 -0
- pinecall/domain/person.py +208 -0
- pinecall/domain/scope.py +21 -0
- pinecall/evals/__init__.py +0 -0
- pinecall/evals/_evidence.py +158 -0
- pinecall/evals/calibration.py +112 -0
- pinecall/evals/callers.py +160 -0
- pinecall/evals/case.py +327 -0
- pinecall/evals/checks.py +437 -0
- pinecall/evals/compliance.py +197 -0
- pinecall/evals/dataset.py +451 -0
- pinecall/evals/goldens.py +331 -0
- pinecall/evals/judges.py +525 -0
- pinecall/evals/runs.py +252 -0
- pinecall/evals/spoken.py +356 -0
- pinecall/fleet/__init__.py +0 -0
- pinecall/fleet/client.py +569 -0
- pinecall/fleet/demand.py +51 -0
- pinecall/fleet/heartbeat.py +194 -0
- pinecall/fleet/measures.py +157 -0
- pinecall/fleet/roster.py +232 -0
- pinecall/fleet/worlds.py +44 -0
- pinecall/gateway/__init__.py +0 -0
- pinecall/gateway/_call_setup.py +53 -0
- pinecall/gateway/_deps.py +556 -0
- pinecall/gateway/_gateway.py +75 -0
- pinecall/gateway/_served.py +396 -0
- pinecall/gateway/_sockets.py +444 -0
- pinecall/gateway/_streams.py +83 -0
- pinecall/gateway/_text_calls.py +182 -0
- pinecall/gateway/api/__init__.py +0 -0
- pinecall/gateway/api/accounts.py +324 -0
- pinecall/gateway/api/agents.py +150 -0
- pinecall/gateway/api/apps.py +478 -0
- pinecall/gateway/api/box.py +658 -0
- pinecall/gateway/api/calibration.py +58 -0
- pinecall/gateway/api/callbacks.py +105 -0
- pinecall/gateway/api/calls.py +655 -0
- pinecall/gateway/api/chat.py +223 -0
- pinecall/gateway/api/dataset.py +163 -0
- pinecall/gateway/api/desk.py +113 -0
- pinecall/gateway/api/entries.py +77 -0
- pinecall/gateway/api/evals.py +647 -0
- pinecall/gateway/api/fleet.py +73 -0
- pinecall/gateway/api/hosting.py +241 -0
- pinecall/gateway/api/judges.py +97 -0
- pinecall/gateway/api/keys.py +110 -0
- pinecall/gateway/api/line.py +142 -0
- pinecall/gateway/api/members.py +197 -0
- pinecall/gateway/api/metrics.py +226 -0
- pinecall/gateway/api/numbers.py +476 -0
- pinecall/gateway/api/ops.py +428 -0
- pinecall/gateway/api/org.py +283 -0
- pinecall/gateway/api/personas.py +157 -0
- pinecall/gateway/api/pipeline.py +206 -0
- pinecall/gateway/api/prompts.py +50 -0
- pinecall/gateway/api/providers.py +240 -0
- pinecall/gateway/api/recordings.py +89 -0
- pinecall/gateway/api/relay.py +169 -0
- pinecall/gateway/api/retrieval.py +403 -0
- pinecall/gateway/api/runner.py +109 -0
- pinecall/gateway/api/sessions.py +102 -0
- pinecall/gateway/api/settings.py +463 -0
- pinecall/gateway/api/signup.py +164 -0
- pinecall/gateway/api/sso_login.py +168 -0
- pinecall/gateway/api/threads.py +187 -0
- pinecall/gateway/api/usage.py +303 -0
- pinecall/gateway/api/visitors.py +222 -0
- pinecall/gateway/api/whatsapp.py +48 -0
- pinecall/gateway/api/widget.py +49 -0
- pinecall/gateway/app.py +504 -0
- pinecall/gateway/calls/__init__.py +0 -0
- pinecall/gateway/calls/binding.py +63 -0
- pinecall/gateway/calls/commands.py +18 -0
- pinecall/gateway/calls/inbox.py +100 -0
- pinecall/gateway/calls/known.py +23 -0
- pinecall/gateway/calls/owners.py +87 -0
- pinecall/gateway/calls/pump.py +33 -0
- pinecall/gateway/calls/serving.py +118 -0
- pinecall/gateway/calls/threads.py +367 -0
- pinecall/gateway/dispatching/__init__.py +0 -0
- pinecall/gateway/dispatching/arrivals.py +58 -0
- pinecall/gateway/dispatching/sweep.py +43 -0
- pinecall/gateway/ending/__init__.py +0 -0
- pinecall/gateway/ending/reaper.py +160 -0
- pinecall/gateway/ending/seal.py +312 -0
- pinecall/gateway/ending/stranded.py +117 -0
- pinecall/log/__init__.py +0 -0
- pinecall/log/_histogram.py +74 -0
- pinecall/log/_relay.py +259 -0
- pinecall/log/_writer.py +454 -0
- pinecall/log/days.py +154 -0
- pinecall/log/drift.py +550 -0
- pinecall/log/facts.py +358 -0
- pinecall/log/inbox.py +169 -0
- pinecall/log/lists.py +155 -0
- pinecall/log/logs.py +581 -0
- pinecall/log/openings.py +71 -0
- pinecall/log/private.py +135 -0
- pinecall/log/queries.py +229 -0
- pinecall/log/readers.py +207 -0
- pinecall/log/reduce.py +659 -0
- pinecall/log/refold.py +217 -0
- pinecall/log/store.py +370 -0
- pinecall/log/usage.py +242 -0
- pinecall/postgres/__init__.py +0 -0
- pinecall/postgres/migrate.py +202 -0
- pinecall/postgres/migrations/0001_schema.sql +591 -0
- pinecall/postgres/migrations/0002_worlds.sql +15 -0
- pinecall/postgres/migrations/0003_lent.sql +4 -0
- pinecall/postgres/migrations/0004_carriers.sql +23 -0
- pinecall/postgres/migrations/0005_retrieved_only.sql +11 -0
- pinecall/postgres/migrations/0006_persona_agents.sql +9 -0
- pinecall/postgres/migrations/0007_money_in_dollars.sql +27 -0
- pinecall/postgres/migrations/0008_lexicon_per_agent.sql +27 -0
- pinecall/postgres/migrations/0009_personas_per_agent.sql +31 -0
- pinecall/postgres/migrations/0010_agent_judges.sql +12 -0
- pinecall/postgres/migrations/0011_erasure.sql +32 -0
- pinecall/postgres/migrations/0012_org_policy.sql +10 -0
- pinecall/postgres/migrations/0013_calling_rules.sql +12 -0
- pinecall/postgres/migrations/0014_consents.sql +24 -0
- pinecall/postgres/migrations/0015_disclosure.sql +7 -0
- pinecall/postgres/migrations/0016_call_records.sql +21 -0
- pinecall/postgres/migrations/0017_reads.sql +17 -0
- pinecall/postgres/migrations/0018_hosting.sql +41 -0
- pinecall/postgres/migrations/0019_hosted_state.sql +10 -0
- pinecall/postgres/migrations/0020_written_once.sql +7 -0
- pinecall/postgres/migrations/0021_hosted_running.sql +21 -0
- pinecall/postgres/migrations/0022_sealed.sql +39 -0
- pinecall/postgres/migrations/0023_usage_totals.sql +158 -0
- pinecall/postgres/migrations/0024_log_key_by_day.sql +8 -0
- pinecall/postgres/migrations/0025_log_before_the_days.sql +15 -0
- pinecall/postgres/migrations/0026_log_before_the_days_validated.sql +4 -0
- pinecall/postgres/migrations/0027_log_by_day.sql +96 -0
- pinecall/postgres/migrations/0030_whatsapp_seen.sql +17 -0
- pinecall/postgres/migrations/0040_reads_widened.sql +15 -0
- pinecall/postgres/migrations/0060_drift.sql +62 -0
- pinecall/postgres/migrations/0061_canaries.sql +24 -0
- pinecall/postgres/migrations/0062_eval_cases.sql +23 -0
- pinecall/postgres/migrations/0063_prompts.sql +16 -0
- pinecall/postgres/migrations/0075_call_private.sql +14 -0
- pinecall/postgres/migrations/0076_recording_keys.sql +13 -0
- pinecall/postgres/migrations/0077_tokens_world.sql +7 -0
- pinecall/postgres/migrations/0078_facts_cost_by_stage.sql +12 -0
- pinecall/postgres/migrations/0079_judge_labels.sql +20 -0
- pinecall/postgres/migrations/0080_call_openings.sql +20 -0
- pinecall/postgres/migrations/0081_seal_lease.sql +7 -0
- pinecall/postgres/migrations/0082_caller_codes.sql +14 -0
- pinecall/postgres/migrations/0083_one_use_words.sql +15 -0
- pinecall/postgres/migrations/0084_knocks_and_run_leases.sql +23 -0
- pinecall/postgres/migrations/0085_seal_lease_holder.sql +8 -0
- pinecall/postgres/migrations/0086_route_origin.sql +17 -0
- pinecall/postgres/migrations/0087_carrier_networks.sql +20 -0
- pinecall/postgres/migrations/0088_route_last_call.sql +3 -0
- pinecall/postgres/migrations/0089_offers.sql +21 -0
- pinecall/postgres/migrations/0090_invitation_purpose.sql +5 -0
- pinecall/postgres/migrations/0091_head_opened_by.sql +6 -0
- pinecall/postgres/migrations/0092_key_parent.sql +6 -0
- pinecall/postgres/migrations/0093_code_tries.sql +10 -0
- pinecall/postgres/migrations/0094_route_approval.sql +12 -0
- pinecall/postgres/migrations/0095_sso_domain_proofs.sql +17 -0
- pinecall/postgres/migrations/0096_row_level_security.sql +38 -0
- pinecall/postgres/migrations/0097_case_status.sql +19 -0
- pinecall/postgres/pool.py +190 -0
- pinecall/process/__init__.py +0 -0
- pinecall/process/_objects.py +97 -0
- pinecall/process/box_settings.py +23 -0
- pinecall/process/connections.py +124 -0
- pinecall/process/metrics.py +127 -0
- pinecall/process/recordings.py +323 -0
- pinecall/process/resolver.py +41 -0
- pinecall/process/sealed_audio.py +173 -0
- pinecall/process/settings.py +534 -0
- pinecall/process/shared.py +158 -0
- pinecall/process/signal.py +416 -0
- pinecall/providers/__init__.py +0 -0
- pinecall/providers/build.py +570 -0
- pinecall/providers/catalog.py +266 -0
- pinecall/providers/credentials.py +230 -0
- pinecall/providers/declared.py +69 -0
- pinecall/providers/prices.py +240 -0
- pinecall/providers/tried.py +104 -0
- pinecall/providers/voices.py +174 -0
- pinecall/public/console/assets/index-BIfKPSgn.js +164 -0
- pinecall/public/console/assets/index-ClOTU-xX.css +1 -0
- pinecall/public/console/favicon.png +0 -0
- pinecall/public/console/index.html +20 -0
- pinecall/public/console/logo-mark.png +0 -0
- pinecall/public/console/pinecall-logo-dark.png +0 -0
- pinecall/public/console/pinecall-logo.png +0 -0
- pinecall/public/console/pinecall-mark.png +0 -0
- pinecall/public/console/sw.js +37 -0
- pinecall/public/widget/pinecall-widget.js +853 -0
- pinecall/py.typed +0 -0
- pinecall/retrieval/__init__.py +0 -0
- pinecall/retrieval/_search.py +186 -0
- pinecall/retrieval/_sections.py +70 -0
- pinecall/retrieval/embed.py +340 -0
- pinecall/retrieval/extraction.py +403 -0
- pinecall/retrieval/knowledge.py +659 -0
- pinecall/retrieval/lookups.py +192 -0
- pinecall/retrieval/memory.py +603 -0
- pinecall/runner/__init__.py +0 -0
- pinecall/runner/_kube.py +459 -0
- pinecall/runner/_plan.py +157 -0
- pinecall/runner/main.py +306 -0
- pinecall/session/__init__.py +0 -0
- pinecall/session/_agent.py +141 -0
- pinecall/session/_hearing.py +101 -0
- pinecall/session/_livekit.py +195 -0
- pinecall/session/_prompt.py +147 -0
- pinecall/session/_recording.py +237 -0
- pinecall/session/call.py +367 -0
- pinecall/session/clock.py +40 -0
- pinecall/session/hold.py +239 -0
- pinecall/session/room.py +626 -0
- pinecall/session/session.py +690 -0
- pinecall/session/text.py +144 -0
- pinecall/session/tools.py +483 -0
- pinecall/session/voice.py +118 -0
- pinecall/session/widget.py +201 -0
- pinecall/tenancy/__init__.py +0 -0
- pinecall/tenancy/admission.py +204 -0
- pinecall/tenancy/agents.py +164 -0
- pinecall/tenancy/canary.py +126 -0
- pinecall/tenancy/carrier_networks.py +156 -0
- pinecall/tenancy/carriers.py +265 -0
- pinecall/tenancy/codes.py +196 -0
- pinecall/tenancy/consents.py +167 -0
- pinecall/tenancy/dial_policy.py +405 -0
- pinecall/tenancy/disclosure.py +41 -0
- pinecall/tenancy/erasure.py +204 -0
- pinecall/tenancy/export.py +167 -0
- pinecall/tenancy/hosted_running.py +166 -0
- pinecall/tenancy/hosting.py +475 -0
- pinecall/tenancy/judges.py +126 -0
- pinecall/tenancy/keys.py +467 -0
- pinecall/tenancy/knocks.py +40 -0
- pinecall/tenancy/letters.py +378 -0
- pinecall/tenancy/mail.py +458 -0
- pinecall/tenancy/org_secrets.py +123 -0
- pinecall/tenancy/orgs.py +78 -0
- pinecall/tenancy/people.py +543 -0
- pinecall/tenancy/personas.py +145 -0
- pinecall/tenancy/policy.py +65 -0
- pinecall/tenancy/prompts.py +48 -0
- pinecall/tenancy/reads.py +73 -0
- pinecall/tenancy/recording_keys.py +41 -0
- pinecall/tenancy/remembered.py +148 -0
- pinecall/tenancy/retention.py +86 -0
- pinecall/tenancy/scopes.py +406 -0
- pinecall/tenancy/signin.py +622 -0
- pinecall/tenancy/spend.py +69 -0
- pinecall/tenancy/sso.py +431 -0
- pinecall/tenancy/sso_domains.py +132 -0
- pinecall/tenancy/throttle.py +88 -0
- pinecall/tenancy/tokens.py +400 -0
- pinecall/tenancy/traceback.py +70 -0
- pinecall/tenancy/usage.py +136 -0
- pinecall/tenancy/vault.py +204 -0
- pinecall/tenancy/words.py +144 -0
- pinecall/wire/__init__.py +0 -0
- pinecall/wire/commands.py +350 -0
- pinecall/wire/events.py +655 -0
- pinecall/wire/frames.py +65 -0
- pinecall/wire/metrics.py +287 -0
- pinecall/wire/parts.py +320 -0
- pinecall/wire/rest/__init__.py +0 -0
- pinecall/wire/rest/accounts.py +512 -0
- pinecall/wire/rest/agents.py +172 -0
- pinecall/wire/rest/calls.py +397 -0
- pinecall/wire/rest/evals.py +453 -0
- pinecall/wire/rest/fleet.py +69 -0
- pinecall/wire/rest/hosting.py +174 -0
- pinecall/wire/rest/numbers.py +280 -0
- pinecall/wire/rest/ops.py +342 -0
- pinecall/wire/rest/providers.py +83 -0
- pinecall/wire/rest/retrieval.py +301 -0
- pinecall/wire/rest/settings.py +184 -0
- pinecall/wire/rest/usage.py +245 -0
- pinecall/wire/room.py +61 -0
- pinecall/wire/scores.py +49 -0
- pinecall/wire/state.py +243 -0
- pinecall/worker/__init__.py +0 -0
- pinecall/worker/_job.py +655 -0
- pinecall/worker/_recorder.py +82 -0
- pinecall/worker/_traces.py +48 -0
- pinecall/worker/main.py +307 -0
- pinecall_runtime-0.1.6.dist-info/METADATA +212 -0
- pinecall_runtime-0.1.6.dist-info/RECORD +328 -0
- pinecall_runtime-0.1.6.dist-info/WHEEL +4 -0
- pinecall_runtime-0.1.6.dist-info/entry_points.txt +2 -0
- pinecall_runtime-0.1.6.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
"""The call doors' bodies: readers, tokens, codes, seats, the worker's writes, threads, erasures."""
|
|
2
|
+
|
|
3
|
+
from typing import Literal
|
|
4
|
+
|
|
5
|
+
from pydantic import Field
|
|
6
|
+
|
|
7
|
+
from pinecall.domain.call import CallContext
|
|
8
|
+
from pinecall.domain.names import Channel, Direction, Env, Json, JsonObject
|
|
9
|
+
from pinecall.wire.frames import Entry, WireModel
|
|
10
|
+
from pinecall.wire.metrics import ModelUsage
|
|
11
|
+
from pinecall.wire.parts import (
|
|
12
|
+
CallStatus,
|
|
13
|
+
Contact,
|
|
14
|
+
Cost,
|
|
15
|
+
EndReason,
|
|
16
|
+
PlatformTool,
|
|
17
|
+
Projection,
|
|
18
|
+
SessionFlag,
|
|
19
|
+
ThreadKind,
|
|
20
|
+
)
|
|
21
|
+
from pinecall.wire.state import AttentionState
|
|
22
|
+
|
|
23
|
+
type ErasureSubject = Literal["call", "contact", "org"]
|
|
24
|
+
|
|
25
|
+
type ReadKind = Literal["log", "recording", "traceback", "listen", "supervise", "export", "memory"]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# Projected entries keep only part of the envelope, so they travel as plain JSON.
|
|
29
|
+
class LogPage(WireModel):
|
|
30
|
+
"""One page of a log: the entries above the cursor, and where the next page starts."""
|
|
31
|
+
|
|
32
|
+
entries: list[JsonObject]
|
|
33
|
+
live: bool
|
|
34
|
+
next: int | None
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class SessionScore(WireModel):
|
|
38
|
+
"""What the judges said of a call, as a list row carries it."""
|
|
39
|
+
|
|
40
|
+
held: int
|
|
41
|
+
judged: int
|
|
42
|
+
passed: bool
|
|
43
|
+
reason: str | None
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class CallRow(WireModel):
|
|
47
|
+
"""One call as a list shows it."""
|
|
48
|
+
|
|
49
|
+
call: str
|
|
50
|
+
agent: str
|
|
51
|
+
live: bool
|
|
52
|
+
last_seq: int
|
|
53
|
+
status: CallStatus
|
|
54
|
+
channel: Channel | None
|
|
55
|
+
direction: Direction | None
|
|
56
|
+
from_: str | None = Field(alias="from")
|
|
57
|
+
to: str | None
|
|
58
|
+
caller: Contact | None
|
|
59
|
+
started_at: float | None
|
|
60
|
+
ended_at: float | None
|
|
61
|
+
end_reason: EndReason | None
|
|
62
|
+
outcome: str | None
|
|
63
|
+
cost: Cost | None
|
|
64
|
+
score: SessionScore | None = None
|
|
65
|
+
flags: list[SessionFlag] | None = None
|
|
66
|
+
attention: AttentionState | None = None
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class CallList(WireModel):
|
|
70
|
+
"""A page of calls, newest first."""
|
|
71
|
+
|
|
72
|
+
calls: list[CallRow]
|
|
73
|
+
total: int | None = None
|
|
74
|
+
next: str | None = None
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class MintTokenRequest(WireModel):
|
|
78
|
+
"""livekit's token request body, and ours beside it."""
|
|
79
|
+
|
|
80
|
+
agent: str | None = None
|
|
81
|
+
scope: str = "talk"
|
|
82
|
+
# An opaque contact id; never a number or a name.
|
|
83
|
+
contact: str | None = None
|
|
84
|
+
# Reaches the worker inside the signed dispatch: the browser reads it, never changes it.
|
|
85
|
+
metadata: JsonObject = Field(default_factory=dict[str, Json])
|
|
86
|
+
ttl_s: int | None = None
|
|
87
|
+
log: Projection = "public"
|
|
88
|
+
participant_identity: str | None = None
|
|
89
|
+
participant_attributes: dict[str, str] = Field(default_factory=dict[str, str])
|
|
90
|
+
room_config: JsonObject | None = None
|
|
91
|
+
# Declared so they are refused with the reason instead of an unknown key.
|
|
92
|
+
room_name: str | None = None
|
|
93
|
+
participant_name: str | None = None
|
|
94
|
+
participant_metadata: str | None = None
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class MintTokenResponse(WireModel):
|
|
98
|
+
"""livekit's token response, the call it opens and a token that reads its log."""
|
|
99
|
+
|
|
100
|
+
server_url: str
|
|
101
|
+
participant_token: str
|
|
102
|
+
call: str
|
|
103
|
+
log_token: str
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class IssueCodeRequest(WireModel):
|
|
107
|
+
"""Four digits a caller keys to tie their call to a page."""
|
|
108
|
+
|
|
109
|
+
agent: str
|
|
110
|
+
ttl_s: int = Field(default=600, ge=60, le=1800)
|
|
111
|
+
log: Projection = "public"
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class IssueCodeResponse(WireModel):
|
|
115
|
+
"""A code issued: the digits, the number to call, and the token its page polls with."""
|
|
116
|
+
|
|
117
|
+
code: str
|
|
118
|
+
number: str
|
|
119
|
+
expires_at: float
|
|
120
|
+
code_token: str
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class CodeStatus(WireModel):
|
|
124
|
+
"""How a code stands; claimed, it names the call and a token that reads it."""
|
|
125
|
+
|
|
126
|
+
code: str
|
|
127
|
+
status: Literal["waiting", "claimed", "expired"]
|
|
128
|
+
expires_at: float
|
|
129
|
+
call: str | None
|
|
130
|
+
log_token: str | None
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
class SeatResponse(WireModel):
|
|
134
|
+
"""A seat in a live call: the server, the token, and who it says the person is."""
|
|
135
|
+
|
|
136
|
+
server_url: str
|
|
137
|
+
participant_token: str
|
|
138
|
+
call: str
|
|
139
|
+
identity: str
|
|
140
|
+
org: str
|
|
141
|
+
subject: str | None
|
|
142
|
+
name: str | None
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
class VerbResponse(WireModel):
|
|
146
|
+
"""A supervise verb queued; the call's log says what it did."""
|
|
147
|
+
|
|
148
|
+
call: str
|
|
149
|
+
verb: str
|
|
150
|
+
seq: int | None
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
class OpenCallRequest(WireModel):
|
|
154
|
+
"""What a worker opens a call with, and says again to a gateway that forgot it."""
|
|
155
|
+
|
|
156
|
+
agent: str
|
|
157
|
+
context: CallContext
|
|
158
|
+
# The app socket that must serve it (a spoken golden run); else the one the call reaches.
|
|
159
|
+
app: str | None = None
|
|
160
|
+
# The Twilio account an inbound leg says it came from (X-Twilio-AccountSid); None from any
|
|
161
|
+
# other carrier, or from a worker of an older release.
|
|
162
|
+
carrier_account: str | None = None
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
class OpenCallResponse(WireModel):
|
|
166
|
+
"""What the org's minutes leave the call (null for no limit), and what it says first."""
|
|
167
|
+
|
|
168
|
+
seconds_left: int | None
|
|
169
|
+
minutes: int | None
|
|
170
|
+
# An outbound call's AI disclosure, and the notice a recorded call says; null for none.
|
|
171
|
+
disclosure: str | None = None
|
|
172
|
+
recording_notice: str | None = None
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
class AppendEntryRequest(WireModel):
|
|
176
|
+
"""One entry a worker writes to its call's log."""
|
|
177
|
+
|
|
178
|
+
type: str
|
|
179
|
+
data: JsonObject
|
|
180
|
+
ephemeral: bool | None = None
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
# `ts` is the worker's clock when the event happened; the gateway never stamps it past its own.
|
|
184
|
+
class BatchedEntry(WireModel):
|
|
185
|
+
"""One entry of a worker's batch: what it is, whether a store keeps it, and when it happened."""
|
|
186
|
+
|
|
187
|
+
type: str
|
|
188
|
+
data: JsonObject
|
|
189
|
+
ephemeral: bool | None = None
|
|
190
|
+
ts: float
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
# `after` makes a retry safe: the log answers a batch it already took with the seqs it gave it.
|
|
194
|
+
class AppendEntriesRequest(WireModel):
|
|
195
|
+
"""A worker's entries of its call, in order, after how many the log already took from it."""
|
|
196
|
+
|
|
197
|
+
after: int = Field(ge=0)
|
|
198
|
+
entries: list[BatchedEntry]
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
class AppendEntriesResponse(WireModel):
|
|
202
|
+
"""A worker's batch as the log numbered it, in the order it was sent."""
|
|
203
|
+
|
|
204
|
+
entries: list[Entry]
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
# On the entries socket, where a refusal is a frame and not a status: the socket stays open.
|
|
208
|
+
class AppendEntriesRefused(WireModel):
|
|
209
|
+
"""A batch the gateway refused, with the sentence and the status a request would get."""
|
|
210
|
+
|
|
211
|
+
refused: str
|
|
212
|
+
status: int
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
# `input` is whole and unread by the wire: what recall and search take is the runtime's shape.
|
|
216
|
+
class LookupRequest(WireModel):
|
|
217
|
+
"""Which platform tool to run for a call's turn, what to run it with, and the turn it joins."""
|
|
218
|
+
|
|
219
|
+
tool: PlatformTool
|
|
220
|
+
input: JsonObject
|
|
221
|
+
speech_id: str | None = None
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
class LookupResponse(WireModel):
|
|
225
|
+
"""What the tool found, as the model reads it, and how long finding it took."""
|
|
226
|
+
|
|
227
|
+
output: JsonObject
|
|
228
|
+
took_ms: float
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
class RememberResponse(WireModel):
|
|
232
|
+
"""How many memory operations a call produced, and how long remembering took."""
|
|
233
|
+
|
|
234
|
+
ops: int
|
|
235
|
+
took_ms: float
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
class RecordingKeyResponse(WireModel):
|
|
239
|
+
"""The key a call's recording is sealed under before it is stored: 32 bytes, base64url."""
|
|
240
|
+
|
|
241
|
+
key: str
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
class SealCallRequest(WireModel):
|
|
245
|
+
"""The end of a call as its worker hands it to the gateway, which prices, judges and seals."""
|
|
246
|
+
|
|
247
|
+
usage: list[ModelUsage]
|
|
248
|
+
outcome: str
|
|
249
|
+
recording: str | None = None
|
|
250
|
+
# The vendors that ran on the box's own key: the operator bills their usage.
|
|
251
|
+
lent: list[str] = Field(default_factory=list[str])
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
class CallbackRequest(WireModel):
|
|
255
|
+
"""Somebody the overflow told to wait for a call back."""
|
|
256
|
+
|
|
257
|
+
agent: str
|
|
258
|
+
channel: Channel
|
|
259
|
+
number: str
|
|
260
|
+
call: str | None = None
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
class CallbackRow(WireModel):
|
|
264
|
+
"""One call back somebody asked for, as the org's list shows it."""
|
|
265
|
+
|
|
266
|
+
position: int
|
|
267
|
+
agent: str
|
|
268
|
+
ts: float
|
|
269
|
+
channel: Channel
|
|
270
|
+
number: str
|
|
271
|
+
via: Literal["overflow", "widget", "agent"]
|
|
272
|
+
call: str | None
|
|
273
|
+
when: str | None = None
|
|
274
|
+
note: str | None = None
|
|
275
|
+
contact: Contact | None = None
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
class CallbackList(WireModel):
|
|
279
|
+
"""A page of the org's callbacks, oldest first, and where the next starts."""
|
|
280
|
+
|
|
281
|
+
requests: list[CallbackRow]
|
|
282
|
+
next: int | None
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
class ThreadLast(WireModel):
|
|
286
|
+
"""The newest thing on a contact's thread."""
|
|
287
|
+
|
|
288
|
+
text: str | None
|
|
289
|
+
at: float
|
|
290
|
+
kind: ThreadKind
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
class ThreadRow(WireModel):
|
|
294
|
+
"""One contact of an agent's inbox: every call of theirs, folded into one line."""
|
|
295
|
+
|
|
296
|
+
contact: str
|
|
297
|
+
name: str | None
|
|
298
|
+
channel_last: Channel
|
|
299
|
+
last: ThreadLast
|
|
300
|
+
unread: int
|
|
301
|
+
calls: int
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
class ThreadList(WireModel):
|
|
305
|
+
"""GET /v1/agents/{slug}/threads: the agent's contacts, the newest thread first."""
|
|
306
|
+
|
|
307
|
+
threads: list[ThreadRow]
|
|
308
|
+
next: str | None
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
class ThreadMessage(WireModel):
|
|
312
|
+
"""One message of a thread, or one spoken call drawn as a pill."""
|
|
313
|
+
|
|
314
|
+
kind: ThreadKind
|
|
315
|
+
text: str | None
|
|
316
|
+
at: float
|
|
317
|
+
call: str
|
|
318
|
+
channel: Channel
|
|
319
|
+
duration_s: float | None = None
|
|
320
|
+
answered: bool | None = None
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
class ThreadResponse(WireModel):
|
|
324
|
+
"""GET /v1/agents/{slug}/threads/{contact}: every call of one contact, merged, oldest first."""
|
|
325
|
+
|
|
326
|
+
contact: str
|
|
327
|
+
name: str | None
|
|
328
|
+
messages: list[ThreadMessage]
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
class ThreadMessageRequest(WireModel):
|
|
332
|
+
"""POST /v1/agents/{slug}/threads/{contact}/messages, the body."""
|
|
333
|
+
|
|
334
|
+
text: str
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
class ThreadMessageResponse(WireModel):
|
|
338
|
+
"""POST /v1/agents/{slug}/threads/{contact}/messages, the answer: the call it was said on."""
|
|
339
|
+
|
|
340
|
+
contact: str
|
|
341
|
+
call: str
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
class Erasure(WireModel):
|
|
345
|
+
"""DELETE /v1/calls/{call}, /v1/contacts/{contact}: what one erasure took, as its trail says."""
|
|
346
|
+
|
|
347
|
+
id: int
|
|
348
|
+
at: float
|
|
349
|
+
what: ErasureSubject
|
|
350
|
+
subject: str
|
|
351
|
+
env: Env | None
|
|
352
|
+
asked_by: str
|
|
353
|
+
calls: int
|
|
354
|
+
entries: int
|
|
355
|
+
memories: int
|
|
356
|
+
recordings: int
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
class ReadRow(WireModel):
|
|
360
|
+
"""One read of the org's data: the call or number, what of it, who, and when."""
|
|
361
|
+
|
|
362
|
+
subject: str
|
|
363
|
+
what: ReadKind
|
|
364
|
+
env: Env | None
|
|
365
|
+
# A person's id, or "operator" for the box's operator.
|
|
366
|
+
reader: str
|
|
367
|
+
at: float
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
class ReadsResponse(WireModel):
|
|
371
|
+
"""GET /v1/org/reads: who read the org's calls, newest first."""
|
|
372
|
+
|
|
373
|
+
reads: list[ReadRow]
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
class ErasureTrail(WireModel):
|
|
377
|
+
"""GET /v1/org/erasures: the org's erasures, newest first."""
|
|
378
|
+
|
|
379
|
+
erasures: list[Erasure]
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
class PromptBlockRow(WireModel):
|
|
383
|
+
"""One block of a call's prompt as its log names it, with the words the org kept of it."""
|
|
384
|
+
|
|
385
|
+
seq: int
|
|
386
|
+
name: str
|
|
387
|
+
hash: str
|
|
388
|
+
chars: int
|
|
389
|
+
# Null for a block no gateway kept the words of (a call from before they were kept).
|
|
390
|
+
text: str | None
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
class CallPromptResponse(WireModel):
|
|
394
|
+
"""GET /v1/calls/{call}/prompt: every block the call was told, in the order it was told."""
|
|
395
|
+
|
|
396
|
+
call: str
|
|
397
|
+
blocks: list[PromptBlockRow]
|