supafone-labs 0.6.3 → 0.7.0
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.
- package/README.md +70 -70
- package/dist/cjs/index.d.ts +80 -1
- package/dist/cjs/index.js +51 -6
- package/dist/index.d.ts +80 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +51 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +126 -7
package/src/index.ts
CHANGED
|
@@ -224,9 +224,70 @@ export interface LabsCallStage {
|
|
|
224
224
|
temperature?: number;
|
|
225
225
|
nextStages?: string[];
|
|
226
226
|
next_stages?: string[];
|
|
227
|
+
/** Server-enforced exit gates, independent of conversational exit criteria. */
|
|
228
|
+
requirements?: LabsStageRequirements;
|
|
229
|
+
role?: string;
|
|
230
|
+
specialistId?: string;
|
|
231
|
+
specialist_id?: string;
|
|
227
232
|
metadata?: Record<string, unknown>;
|
|
228
233
|
}
|
|
229
234
|
|
|
235
|
+
export interface LabsStageRequirements {
|
|
236
|
+
requiredFields?: string[];
|
|
237
|
+
required_fields?: string[];
|
|
238
|
+
successfulTools?: string[];
|
|
239
|
+
successful_tools?: string[];
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export interface LabsManagerConfig {
|
|
243
|
+
enabled?: boolean;
|
|
244
|
+
/** Reuse the existing encrypted Supervisor profile, or use managed reasoning. */
|
|
245
|
+
reasoning?: "managed" | "supervisor";
|
|
246
|
+
model?: "supafone-manager" | "supafone-manager-pro";
|
|
247
|
+
maxTasks?: number;
|
|
248
|
+
max_tasks?: number;
|
|
249
|
+
maxParallel?: number;
|
|
250
|
+
max_parallel?: number;
|
|
251
|
+
timeoutSeconds?: number;
|
|
252
|
+
timeout_seconds?: number;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export interface LabsSpecialist {
|
|
256
|
+
id: string;
|
|
257
|
+
role?: string;
|
|
258
|
+
label?: string;
|
|
259
|
+
description?: string;
|
|
260
|
+
instructions?: string;
|
|
261
|
+
enabled?: boolean;
|
|
262
|
+
stageKeys?: string[];
|
|
263
|
+
stage_keys?: string[];
|
|
264
|
+
tools?: string[];
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export interface LabsAgentTeam {
|
|
268
|
+
enabled?: boolean;
|
|
269
|
+
routingMode?: "auto" | "sequential";
|
|
270
|
+
routing_mode?: "auto" | "sequential";
|
|
271
|
+
fallbackMemberId?: string;
|
|
272
|
+
fallback_member_id?: string;
|
|
273
|
+
members?: LabsSpecialist[];
|
|
274
|
+
routingRules?: Array<{ intent: string; member_id: string; priority?: string; action?: string }>;
|
|
275
|
+
routing_rules?: Array<{ intent: string; member_id: string; priority?: string; action?: string }>;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export interface LabsRuntimeRoutingConfig {
|
|
279
|
+
enabled?: boolean;
|
|
280
|
+
allowedModels?: LabsRealtimeSelection[];
|
|
281
|
+
allowed_models?: LabsRealtimeSelection[];
|
|
282
|
+
/** Server-supported range is 1–3 handoffs per call. */
|
|
283
|
+
maxHandoffs?: number;
|
|
284
|
+
max_handoffs?: number;
|
|
285
|
+
recoverOnDisconnect?: boolean;
|
|
286
|
+
recover_on_disconnect?: boolean;
|
|
287
|
+
allowedLanguages?: string[];
|
|
288
|
+
allowed_languages?: string[];
|
|
289
|
+
}
|
|
290
|
+
|
|
230
291
|
export type LabsStageGeneration = "managed" | "template" | "off" | "oracle";
|
|
231
292
|
|
|
232
293
|
export interface LabsCallPlan {
|
|
@@ -692,6 +753,8 @@ export interface LabsEmailConfig {
|
|
|
692
753
|
|
|
693
754
|
export interface LabsRecordingConfig {
|
|
694
755
|
enabled?: boolean;
|
|
756
|
+
/** Request post-call transcription of the recording where configured. */
|
|
757
|
+
transcribe?: boolean;
|
|
695
758
|
recordAudio?: boolean;
|
|
696
759
|
record_audio?: boolean;
|
|
697
760
|
consentRequired?: boolean;
|
|
@@ -1044,6 +1107,17 @@ export interface CreateLabsAgentRequest {
|
|
|
1044
1107
|
presetKey?: string;
|
|
1045
1108
|
preset_key?: string;
|
|
1046
1109
|
realtime?: LabsRealtimeSelection;
|
|
1110
|
+
manager?: boolean | LabsManagerConfig;
|
|
1111
|
+
agentTeam?: LabsAgentTeam;
|
|
1112
|
+
agent_team?: LabsAgentTeam;
|
|
1113
|
+
runtimeRouting?: LabsRuntimeRoutingConfig;
|
|
1114
|
+
runtime_routing?: LabsRuntimeRoutingConfig;
|
|
1115
|
+
captureFields?: string[];
|
|
1116
|
+
capture_fields?: string[];
|
|
1117
|
+
timezone?: string;
|
|
1118
|
+
businessTimezone?: string;
|
|
1119
|
+
timeAwareness?: boolean;
|
|
1120
|
+
time_awareness?: boolean;
|
|
1047
1121
|
runtimeMode?: LabsRuntimeMode;
|
|
1048
1122
|
runtime_mode?: LabsRuntimeMode;
|
|
1049
1123
|
/** Defaults to Supafone's hosted planner; model credentials remain server-side. */
|
|
@@ -1086,7 +1160,7 @@ export interface CreateLabsAgentRequest {
|
|
|
1086
1160
|
customSip?: LabsCustomSipConfig;
|
|
1087
1161
|
custom_sip?: LabsCustomSipConfig;
|
|
1088
1162
|
sip?: LabsCustomSipConfig;
|
|
1089
|
-
recording?: LabsRecordingConfig;
|
|
1163
|
+
recording?: boolean | LabsRecordingConfig;
|
|
1090
1164
|
transcription?: LabsTranscriptionConfig;
|
|
1091
1165
|
artifacts?: LabsArtifactsConfig;
|
|
1092
1166
|
compliance?: Record<string, unknown>;
|
|
@@ -4363,6 +4437,40 @@ function outboundCallModeRequiredCapabilities(payload: Record<string, unknown>):
|
|
|
4363
4437
|
return required;
|
|
4364
4438
|
}
|
|
4365
4439
|
|
|
4440
|
+
function managerPayload(input?: boolean | LabsManagerConfig): boolean | Record<string, unknown> | undefined {
|
|
4441
|
+
if (typeof input !== "object" || input === null) return input;
|
|
4442
|
+
return compact({
|
|
4443
|
+
enabled: input.enabled, reasoning: input.reasoning, model: input.model,
|
|
4444
|
+
max_tasks: input.max_tasks ?? input.maxTasks,
|
|
4445
|
+
max_parallel: input.max_parallel ?? input.maxParallel,
|
|
4446
|
+
timeout_seconds: input.timeout_seconds ?? input.timeoutSeconds,
|
|
4447
|
+
});
|
|
4448
|
+
}
|
|
4449
|
+
|
|
4450
|
+
function agentTeamPayload(input?: LabsAgentTeam): Record<string, unknown> | undefined {
|
|
4451
|
+
if (!input) return undefined;
|
|
4452
|
+
return compact({
|
|
4453
|
+
enabled: input.enabled, routing_mode: input.routing_mode ?? input.routingMode,
|
|
4454
|
+
fallback_member_id: input.fallback_member_id ?? input.fallbackMemberId,
|
|
4455
|
+
routing_rules: input.routing_rules ?? input.routingRules,
|
|
4456
|
+
members: input.members?.map((member) => compact({
|
|
4457
|
+
id: member.id, role: member.role, label: member.label, description: member.description,
|
|
4458
|
+
instructions: member.instructions, enabled: member.enabled, tools: member.tools,
|
|
4459
|
+
stage_keys: member.stage_keys ?? member.stageKeys,
|
|
4460
|
+
})),
|
|
4461
|
+
});
|
|
4462
|
+
}
|
|
4463
|
+
|
|
4464
|
+
function runtimeRoutingPayload(input?: LabsRuntimeRoutingConfig): Record<string, unknown> | undefined {
|
|
4465
|
+
if (!input) return undefined;
|
|
4466
|
+
return compact({
|
|
4467
|
+
enabled: input.enabled, allowed_models: input.allowed_models ?? input.allowedModels,
|
|
4468
|
+
max_handoffs: input.max_handoffs ?? input.maxHandoffs,
|
|
4469
|
+
recover_on_disconnect: input.recover_on_disconnect ?? input.recoverOnDisconnect,
|
|
4470
|
+
allowed_languages: input.allowed_languages ?? input.allowedLanguages,
|
|
4471
|
+
});
|
|
4472
|
+
}
|
|
4473
|
+
|
|
4366
4474
|
function labsAgentMetadataPayload(input: CreateLabsAgentRequest): Record<string, unknown> | undefined {
|
|
4367
4475
|
const metadata = { ...(input.metadata ?? {}) };
|
|
4368
4476
|
const mode = input.outboundCallMode ?? input.outbound_call_mode;
|
|
@@ -4407,6 +4515,12 @@ function labsAgentPayload(input: CreateLabsAgentRequest): Record<string, unknown
|
|
|
4407
4515
|
preset_key: input.preset_key ?? input.presetKey,
|
|
4408
4516
|
runtime_mode: input.runtime_mode ?? input.runtimeMode,
|
|
4409
4517
|
realtime: input.realtime,
|
|
4518
|
+
manager: managerPayload(input.manager),
|
|
4519
|
+
agent_team: agentTeamPayload(input.agent_team ?? input.agentTeam),
|
|
4520
|
+
runtime_routing: runtimeRoutingPayload(input.runtime_routing ?? input.runtimeRouting),
|
|
4521
|
+
capture_fields: input.capture_fields ?? input.captureFields,
|
|
4522
|
+
timezone: input.timezone ?? input.businessTimezone,
|
|
4523
|
+
time_awareness: input.time_awareness ?? input.timeAwareness,
|
|
4410
4524
|
call_stages: callStagesPayload(input),
|
|
4411
4525
|
stage_generation: input.stage_generation ?? input.stageGeneration,
|
|
4412
4526
|
stage_count: input.stage_count ?? input.stageCount,
|
|
@@ -4427,7 +4541,7 @@ function labsAgentPayload(input: CreateLabsAgentRequest): Record<string, unknown
|
|
|
4427
4541
|
byok: input.byok ? byokPayload(input.byok) : undefined,
|
|
4428
4542
|
telephony: input.telephony ? telephonyPayload(input.telephony) : undefined,
|
|
4429
4543
|
custom_sip: customSipPayload(input.custom_sip ?? input.customSip ?? input.sip),
|
|
4430
|
-
recording: input.recording ? recordingPayload(input.recording) : undefined,
|
|
4544
|
+
recording: input.recording !== undefined ? recordingPayload(input.recording) : undefined,
|
|
4431
4545
|
transcription: input.transcription ? transcriptionPayload(input.transcription) : undefined,
|
|
4432
4546
|
artifacts: input.artifacts ? artifactsPayload(input.artifacts) : undefined,
|
|
4433
4547
|
compliance: input.compliance,
|
|
@@ -4575,8 +4689,6 @@ function callStagesPayload(
|
|
|
4575
4689
|
if (explicit === false || auto === false) return false;
|
|
4576
4690
|
if (explicit === "managed" || explicit === "template" || explicit === "off") return explicit;
|
|
4577
4691
|
if (explicit === "oracle") return "managed";
|
|
4578
|
-
// The S2S backend owns its validated intake → booking → confirmation flow.
|
|
4579
|
-
if (input.realtime) return undefined;
|
|
4580
4692
|
// Omitted means the private Supafone API generates and compiles the plan.
|
|
4581
4693
|
return undefined;
|
|
4582
4694
|
}
|
|
@@ -4596,8 +4708,7 @@ function stagePlanPayload(
|
|
|
4596
4708
|
system_prompt: input.system_prompt ?? input.systemPrompt,
|
|
4597
4709
|
tools: input.tools ? toolsPayload(input.tools) : undefined,
|
|
4598
4710
|
call_stages: Array.isArray(input.call_stages ?? input.callStages ?? input.stages)
|
|
4599
|
-
? (input
|
|
4600
|
-
: undefined,
|
|
4711
|
+
? callStagesPayload(input) : undefined,
|
|
4601
4712
|
stage_generation: input.stage_generation ?? input.stageGeneration,
|
|
4602
4713
|
stage_count: input.stage_count ?? input.stageCount,
|
|
4603
4714
|
stage_detail: input.stage_detail ?? input.stageDetail,
|
|
@@ -4614,6 +4725,12 @@ function callStagePayload(input: LabsCallStage): Record<string, unknown> {
|
|
|
4614
4725
|
tools: input.tools,
|
|
4615
4726
|
temperature: input.temperature,
|
|
4616
4727
|
next_stages: input.next_stages ?? input.nextStages,
|
|
4728
|
+
requirements: input.requirements ? compact({
|
|
4729
|
+
required_fields: input.requirements.required_fields ?? input.requirements.requiredFields,
|
|
4730
|
+
successful_tools: input.requirements.successful_tools ?? input.requirements.successfulTools,
|
|
4731
|
+
}) : undefined,
|
|
4732
|
+
role: input.role,
|
|
4733
|
+
specialist_id: input.specialist_id ?? input.specialistId,
|
|
4617
4734
|
metadata: input.metadata,
|
|
4618
4735
|
});
|
|
4619
4736
|
}
|
|
@@ -4856,9 +4973,11 @@ function emailPayload(input: LabsEmailConfig): Record<string, unknown> {
|
|
|
4856
4973
|
});
|
|
4857
4974
|
}
|
|
4858
4975
|
|
|
4859
|
-
function recordingPayload(input: LabsRecordingConfig): Record<string, unknown> {
|
|
4976
|
+
function recordingPayload(input: LabsRecordingConfig | boolean): Record<string, unknown> | boolean {
|
|
4977
|
+
if (typeof input === "boolean") return input;
|
|
4860
4978
|
return compact({
|
|
4861
4979
|
enabled: input.enabled,
|
|
4980
|
+
transcribe: input.transcribe,
|
|
4862
4981
|
record_audio: input.record_audio ?? input.recordAudio,
|
|
4863
4982
|
consent_required: input.consent_required ?? input.consentRequired,
|
|
4864
4983
|
announcement: input.announcement,
|