diff --git a/packages/shared/src/app-definitions/speko.json b/packages/shared/src/app-definitions/speko.json index 6f25f776269..8edaad773c0 100644 --- a/packages/shared/src/app-definitions/speko.json +++ b/packages/shared/src/app-definitions/speko.json @@ -25,7 +25,7 @@ "ownershipModes": [ "customer" ], - "whenToUse": "Use browser voice to start and continue work with a selected Paperclip agent.", + "whenToUse": "Use browser voice, agent phone callbacks, and incoming company phone lines to start and continue work with a selected Paperclip agent.", "credentialFields": [ { "key": "apiKey", @@ -44,7 +44,7 @@ "secret": false } ], - "guidanceMd": "Create a dedicated Speko voice persona and choose its voice. Paperclip registers signed session tools and keeps the selected Paperclip agent responsible for task work. Public HTTPS callbacks are required. Review provider recording settings; Speko charges are separate from agent costs. Phone calling is withheld pending live qualification.", + "guidanceMd": "Create a dedicated Speko voice persona and choose its voice. Paperclip registers signed session tools and keeps the selected Paperclip agent responsible for task work. Public HTTPS callbacks are required. Review provider recording settings; Speko charges are separate from agent costs.", "consoleLinks": { "register": "https://platform.speko.ai/agents", "docs": "https://docs.speko.ai/guides/tool-calling" diff --git a/server/src/__tests__/speko-provider.test.ts b/server/src/__tests__/speko-provider.test.ts index 495daa4aa68..bc90276c1c0 100644 --- a/server/src/__tests__/speko-provider.test.ts +++ b/server/src/__tests__/speko-provider.test.ts @@ -93,12 +93,27 @@ describe("Speko hosted provider transport", () => { expect(body.systemPrompt).toContain("answer_question with its exact interaction and question IDs"); expect(body.systemPrompt).toContain("Do not repeatedly poll while pending."); }); - it("uses the hosted phone endpoint with scoped secrets and returns no media or phone number", async () => { + it("falls back to a supported S2S voice only for S2S_VOICE_UNSUPPORTED 400s", async () => { + let calls = 0; + const transport = vi.fn(async () => { + calls += 1; + if (calls === 1) return Response.json({ code: "S2S_VOICE_UNSUPPORTED" }, { status: 400 }); + return Response.json({ id: input.agentId }); + }); + await createSpekoProvider("key", transport).configureVoiceDefaults(input.agentId); + expect(transport).toHaveBeenCalledTimes(2); + expect(JSON.parse(String(transport.mock.calls[1]![1]?.body))).toMatchObject({ runMode: "s2s", voice: "marin", idleRePrompts: { enabled: false } }); + + const unrelated = vi.fn(async () => Response.json({ code: "VALIDATION_ERROR" }, { status: 400 })); + await expect(createSpekoProvider("key", unrelated).configureVoiceDefaults(input.agentId)).rejects.toMatchObject({ httpStatus: 400, providerCode: "VALIDATION_ERROR" }); + expect(unrelated).toHaveBeenCalledOnce(); + }); + it("uses the hosted phone endpoint with scoped secrets, optional firstMessage, and returns no media or phone number", async () => { const transport = vi.fn(async () => Response.json({ sessionId: "phone_test", status: "dialing", to: "+12015551234", callControlId: "private-control" })); - expect(await createSpekoProvider("private-key", transport).createPhoneSession({ ...input, to: "+12015551234" })).toEqual({ sessionId: "phone_test", status: "dialing" }); + expect(await createSpekoProvider("private-key", transport).createPhoneSession({ ...input, to: "+12015551234", firstMessage: "The staging deploy succeeded. Ready to ship?" })).toEqual({ sessionId: "phone_test", status: "dialing" }); expect(transport).toHaveBeenCalledOnce(); expect(transport.mock.calls[0]![0]).toBe("https://api.speko.dev/v1/sessions/phone"); - expect(JSON.parse(String(transport.mock.calls[0]![1]?.body))).toMatchObject({ runMode: "s2s", maxDurationSeconds: 600, toolSecrets: { paperclip_session_token: input.toolToken } }); + expect(JSON.parse(String(transport.mock.calls[0]![1]?.body))).toMatchObject({ runMode: "s2s", maxDurationSeconds: 600, firstMessage: "The staging deploy succeeded. Ready to ship?", toolSecrets: { paperclip_session_token: input.toolToken } }); }); it("validates phone parameters before changing the persona or placing a call", async () => { const transport = vi.fn(); const provider = createSpekoProvider("key", transport); diff --git a/server/src/__tests__/voice-session-store.integration.test.ts b/server/src/__tests__/voice-session-store.integration.test.ts index bc46af63f93..48f2cc4f093 100644 --- a/server/src/__tests__/voice-session-store.integration.test.ts +++ b/server/src/__tests__/voice-session-store.integration.test.ts @@ -24,7 +24,7 @@ import { VOICE_RESULT_NOTIFICATION } from "@paperclipai/shared"; import { createHash, createHmac, randomUUID } from "node:crypto"; import { eq } from "drizzle-orm"; import { afterAll, beforeAll, describe, expect, it, vi } from "vitest"; -import { applyPendingMigrations, chatActions, instanceUserRoles, principalPermissionGrants, environments, chatVoiceInboundCalls, chatVoicePhoneLines, chatVoiceReports, heartbeatRuns, toolProfileBindings, chatVoiceCallbacks, agentWakeupRequests, issueThreadInteractions, issueQuestionResponseDeliveries, issueComments, agents, chatConversations, chatDeliveries, chatEndpoints, chatPublications, chatVoiceReplies, chatVoiceSessions, chatVoiceToolCalls, companies, companyMemberships, companySecrets, connectionGrants, connectionGrantMembers, createDb, EMBEDDED_POSTGRES_TEST_TIMEOUT_MS, issues, toolApplications, toolConnections, toolConnectionInstalls } from "@paperclipai/db"; +import { applyPendingMigrations, chatActions, instanceUserRoles, principalPermissionGrants, environments, chatVoiceInboundCalls, chatVoicePhoneLines, chatVoiceReports, heartbeatRuns, toolCatalogEntries, toolProfileBindings, chatVoiceCallbacks, agentWakeupRequests, issueThreadInteractions, issueQuestionResponseDeliveries, issueComments, agents, chatConversations, chatDeliveries, chatEndpoints, chatPublications, chatVoiceReplies, chatVoiceSessions, chatVoiceToolCalls, companies, companyMemberships, companySecrets, connectionGrants, connectionGrantMembers, createDb, EMBEDDED_POSTGRES_TEST_TIMEOUT_MS, issues, toolApplications, toolConnections, toolConnectionInstalls } from "@paperclipai/db"; import { configureSpekoSessionTools } from "../services/voice/speko-tool-setup.js"; import { instanceSettingsService } from "../services/instance-settings.js"; import { chatChannelService } from "../services/chat-channels.js"; @@ -1716,6 +1716,7 @@ const support = external ? { supported: true } : await getEmbeddedPostgresTestSu expect(comments.map(c => c.body)).toEqual(["Help draft a public inquiry", "Keep it short"]); expect(comments.every(c => !c.authorUserId && c.sourceTrust?.preset === "low_trust_review")).toBe(true); const [task] = await db.select().from(issues).where(eq(issues.id, f.call.intakeIssueId!)); + expect(task.title).toBe("Help draft a public inquiry"); expect(task.executionWorkspaceSettings).toMatchObject({mode: "isolated_workspace", workspaceStrategy: {type: "cloud_sandbox"}}); expect(task.executionPolicy?.authorizationPolicy).toMatchObject({trustBoundary: {issueIds: [task.id], allowedToolClasses: [], allowedSecretBindingIds: []}}); await db.update(chatVoicePhoneLines).set({guestIntake: false}).where(eq(chatVoicePhoneLines.endpointId, f.endpointId)); @@ -2249,17 +2250,80 @@ const support = external ? { supported: true } : await getEmbeddedPostgresTestSu const tools = await f.gateway.listToolsForSession(f.gatewaySession.token); const tool = tools.find(tool => tool.providerType === "paperclip_speko_voice"); expect(tool).toMatchObject({ upstreamToolName: "call_my_phone", connectionId: f.connectionId }); - const call = { sessionToken: f.gatewaySession.token, tool: tool!.name, parameters: {}, idempotencyKey: randomUUID() }; + const message = "The release build is green. Should I deploy to production?"; + const call = { sessionToken: f.gatewaySession.token, tool: tool!.name, parameters: { message }, idempotencyKey: randomUUID() }; const result = await f.gateway.executeTool(call); expect(result).toBeDefined(); expect(f.transport.createPhoneSession).toHaveBeenCalledOnce(); - expect(f.transport.createPhoneSession.mock.calls[0]![0]).toMatchObject({ to: "+12015551234", bindingId: expect.any(String) }); + expect(f.transport.createPhoneSession.mock.calls[0]![0]).toMatchObject({ + to: "+12015551234", + bindingId: expect.any(String), + firstMessage: message, + systemPrompt: expect.stringContaining(message), + }); await f.gateway.executeTool(call); expect(f.transport.createPhoneSession).toHaveBeenCalledOnce(); const sessions = await db.select().from(chatVoiceSessions).where(eq(chatVoiceSessions.endpointId, f.endpointId)); - expect(sessions.filter(s => s.mode === "outbound_phone")).toHaveLength(1); + const outbound = sessions.filter(s => s.mode === "outbound_phone"); + expect(outbound).toHaveLength(1); expect(JSON.stringify(result)).not.toContain("+12015551234"); expect(JSON.stringify(result)).not.toContain("short-lived-media-token"); + + // Verify outbound call transcript is projected onto the bound issue idempotently. + const now = new Date().toISOString(); + await db.update(chatVoiceSessions).set({ state: "ended", endedAt: new Date() }).where(eq(chatVoiceSessions.id, outbound[0]!.id)); + f.transport.callReport.mockImplementation(((async (sessionId: string) => ({ + complete: true, + transcript: sessionId === outbound[0]!.providerSessionId ? [ + { id: "agent-0", index: 0, speaker: "agent", text: message, startedAt: now, endedAt: null, interrupted: false }, + { id: "caller-1", index: 1, speaker: "caller", text: "Yes, go ahead and deploy to prod.", startedAt: now, endedAt: null, interrupted: false }, + ] : [], + costMicroUsd: "80000", + durationSeconds: 18, + providerUpdatedAt: new Date(), + })) as unknown) as never); + await f.service.reconcile(1000); + const docs = documentService(db); + const transcriptDoc = await docs.getIssueDocumentByKey(f.issueId, `voice-transcript-${outbound[0]!.id}`); + expect(transcriptDoc?.title).toBe("Outbound phone call transcript"); + expect(transcriptDoc?.body).toContain(message); + expect(transcriptDoc?.body).toContain("Yes, go ahead and deploy to prod."); + // Reconciling an unchanged report keeps a single revision. + await db.update(chatVoiceReports).set({ nextCheckAt: new Date(0) }).where(eq(chatVoiceReports.sessionId, outbound[0]!.id)); + await f.service.reconcile(1000); + const repeatedDoc = await docs.getIssueDocumentByKey(f.issueId, `voice-transcript-${outbound[0]!.id}`); + expect(repeatedDoc?.latestRevisionId).toBe(transcriptDoc?.latestRevisionId); + }); + + it("redacts sensitive credentials from call_my_phone opening messages and enforces saved catalog schema", async () => { + const f = await phoneToolFixture(); + // An unrefreshed legacy catalog entry with empty schema properties must not accept message. + await db.update(toolCatalogEntries).set({ + inputSchema: { type: "object", properties: {}, additionalProperties: false }, + versionHash: "legacy-empty-schema-hash", + schemaHash: "legacy-empty-schema-hash", + }).where(eq(toolCatalogEntries.connectionId, f.connectionId)); + const legacyTools = await spekoToolsForSession(db, f.gatewaySession); + expect(legacyTools[0]?.parametersSchema).toEqual({ type: "object", properties: {}, additionalProperties: false }); + await expect(executeSpekoVoiceTool(db, f.gatewaySession, f.endpointId, { message: "Should be blocked on legacy schema" }, randomUUID())).rejects.toThrow(); + + // Refresh via owner sync restores the message schema; credentials inside message are redacted before egress. + const [endpoint] = await db.select().from(chatEndpoints).where(eq(chatEndpoints.id, f.endpointId)); + await db.transaction(tx => syncSpekoVoiceTools(tx, endpoint!, f.callerId, true)); + await executeSpekoVoiceTool(db, f.gatewaySession, f.endpointId, { message: "Deploy ready. Do not leak sk-ant-api03-1234567890abcdef1234567890abcdef!" }, randomUUID()); + const sent = f.transport.createPhoneSession.mock.calls[0]![0] as unknown as { firstMessage?: string; systemPrompt: string }; + expect(sent.firstMessage).not.toContain("sk-ant-api03"); + expect(sent.systemPrompt).not.toContain("sk-ant-api03"); + expect(sent.systemPrompt).toContain("Always use answer_question"); + + // A max-length message whose sanitization expands characters (e.g. @here) stays <= 2000 and succeeds cleanly. + const f2 = await phoneToolFixture(); + const expanded = `@here ${"a".repeat(1994)}`; + expect(expanded.length).toBe(2000); + await executeSpekoVoiceTool(db, f2.gatewaySession, f2.endpointId, { message: expanded }, randomUUID()); + const sent2 = f2.transport.createPhoneSession.mock.calls[0]![0] as unknown as { firstMessage?: string }; + expect(sent2.firstMessage).toBeDefined(); + expect(sent2.firstMessage!.length).toBeLessThanOrEqual(2000); }); it("does not restore an agent's removed tool binding when callback settings are saved again", async () => { const f = await phoneToolFixture(); @@ -2320,4 +2384,34 @@ const support = external ? { supported: true } : await getEmbeddedPostgresTestSu } finally { if (previousUrl === undefined) delete process.env.PAPERCLIP_API_URL; else process.env.PAPERCLIP_API_URL = previousUrl; } }); + it("allows finishing verified Speko setup without requiring a browser voice test and rejects unverified drafts", async () => { + const f = await phoneToolFixture(); + const testStartedAt = new Date().toISOString(); + const chat = chatChannelService(db, { + heartbeat: { wakeup: vi.fn(async () => ({ accepted: true })) }, + deferWebhookProcessing: true, + }); + try { + // Missing provider verification (runtimeGeneration 0) must still fail closed. + await db.update(chatEndpoints).set({ + status: "verifying", + providerAccountId: null, + botExternalId: null, + setup: { step: "test", runtimeGeneration: 0, testStartedAt } as never, + }).where(eq(chatEndpoints.id, f.endpointId)); + await expect(chat.finishSlackSetup(f.endpointId, f.callerId)).rejects.toMatchObject({ status: 409 }); + + // Verified provider + runtimeGeneration >= 1 activates cleanly without a browser mic test. + await db.update(chatEndpoints).set({ + status: "verifying", + providerAccountId: `org_${f.companyId}`, + botExternalId: "agent_speko_finish_test", + setup: { step: "test", runtimeGeneration: 1, testStartedAt } as never, + }).where(eq(chatEndpoints.id, f.endpointId)); + const activated = await chat.finishSlackSetup(f.endpointId, f.callerId); + expect(activated.status).toBe("active"); + expect(activated.setup.step).toBe("complete"); + } finally { await chat.shutdown(); } + }); + }); diff --git a/server/src/services/chat-channels/setup-probes.ts b/server/src/services/chat-channels/setup-probes.ts index 31cacdb7ed2..a6e3777a78c 100644 --- a/server/src/services/chat-channels/setup-probes.ts +++ b/server/src/services/chat-channels/setup-probes.ts @@ -125,11 +125,17 @@ export function createSetupProbes(db: Db, options: SetupProbesOptions) { : null; const optionalSlackTest = Boolean(finishOptions?.optionalSlackTestForUser); if (optionalSlackTest) { - if (!["slack", "github"].includes(endpoint.provider) || !endpoint.setup.webhookVerifiedAt || !endpoint.providerAccountId) { - throw conflict("Verify the connection before finishing setup"); + if (endpoint.provider === "speko") { + if (!endpoint.providerAccountId || !endpoint.botExternalId || runtimeGeneration(endpoint.setup) < 1) { + throw conflict("Verify the Speko connection before finishing setup"); + } + } else { + if (!["slack", "github"].includes(endpoint.provider) || !endpoint.setup.webhookVerifiedAt || !endpoint.providerAccountId) { + throw conflict("Verify the connection before finishing setup"); + } + const linked = await findAuthorizedIdentityLink(endpoint, finishOptions!.optionalSlackTestForUser); + if (!linked) throw forbidden("Connect your account before finishing setup"); } - const linked = await findAuthorizedIdentityLink(endpoint, finishOptions!.optionalSlackTestForUser); - if (!linked) throw forbidden("Connect your account before finishing setup"); } if (!optionalSlackTest) { if ( @@ -294,7 +300,7 @@ export function createSetupProbes(db: Db, options: SetupProbesOptions) { const expectedGeneration = runtimeGeneration(endpoint.setup); await db.transaction(async (tx) => { await credentialLease.assertOwned(tx); - if (optionalSlackTest) { + if (optionalSlackTest && endpoint.provider !== "speko") { const linked = await tx.select({ principalId: chatIdentityLinks.principalId }).from(chatIdentityLinks).where(and( eq(chatIdentityLinks.endpointId, endpoint.id), eq(chatIdentityLinks.paperclipUserId, finishOptions!.optionalSlackTestForUser), eq(chatIdentityLinks.status, "linked"), )).limit(1).then((rows) => rows[0]); diff --git a/server/src/services/voice/speko-agent-tools.ts b/server/src/services/voice/speko-agent-tools.ts index 7f0ce74b78f..b38c5dc5125 100644 --- a/server/src/services/voice/speko-agent-tools.ts +++ b/server/src/services/voice/speko-agent-tools.ts @@ -8,9 +8,29 @@ import { chatVoiceCallbacks, instanceUserRoles, companyMemberships } from "@pape import type { VoiceCaller } from "./voice-session-store.js"; import { z } from "zod"; import { instanceSettingsService } from "../instance-settings.js"; -const SPEKO_TOOLS = [{ name: "call_my_phone", description: "Call the responsible person's saved phone number to discuss this task with the assigned Paperclip agent. Requires that person's callback opt-in. Never chooses another recipient, cancels work or grants approvals. Do not redial an uncertain attempt.", inputSchema: { type: "object", properties: {}, additionalProperties: false }, risk: "write", scopes: [] }] as const; +const SPEKO_TOOLS = [{ + name: "call_my_phone", + description: "Call the responsible person's saved, opted-in phone number to tell them something or discuss this task with the assigned Paperclip agent. Pass message with the concise update or question to speak immediately when they answer. Requires that person's callback opt-in. Never chooses another recipient, cancels work or grants approvals. Do not redial an uncertain attempt.", + inputSchema: { + type: "object", + properties: { + message: { + type: "string", + minLength: 1, + maxLength: 2000, + description: "Concise update, announcement, or question to tell the responsible person when they answer the phone.", + }, + }, + additionalProperties: false, + }, + risk: "write", + scopes: [], +}] as const; +const callMyPhoneParametersSchema = z.object({ + message: z.string().trim().min(1).max(2000).optional(), +}).strict(); type SpekoTaskSession = Pick; -interface Binding { companyId: string; endpointId: string; issueId: string; caller: VoiceCaller } +interface Binding { companyId: string; endpointId: string; issueId: string; caller: VoiceCaller; openingMessage?: string } const runtimes = new WeakMap Promise>(); export function registerSpekoVoiceRuntime(db: Db, start: (binding: Binding, invocationId: string) => Promise) { runtimes.set(db, start); @@ -34,10 +54,27 @@ async function resolveAuthority(db: Db, session: SpekoTaskSession, endpointId: s return { endpoint, caller }; } export async function executeSpekoVoiceTool(db: Db, session: SpekoTaskSession, endpointId: string, parameters: unknown, invocationId?: string) { - z.object({}).strict().parse(parameters); if (!invocationId || !z.string().uuid().safeParse(invocationId).success) throw forbidden("A durable invocation is required for phone calls"); const authority = await resolveAuthority(db, session, endpointId); - return runtimes.get(db)!({ companyId: session.companyId, endpointId, issueId: session.issueId!, caller: authority.caller }, invocationId); + const [entry] = await db.select({ inputSchema: toolCatalogEntries.inputSchema }) + .from(toolCatalogEntries) + .where(and( + eq(toolCatalogEntries.companyId, session.companyId), + eq(toolCatalogEntries.connectionId, authority.endpoint.connectionId), + eq(toolCatalogEntries.toolName, "call_my_phone"), + eq(toolCatalogEntries.status, "active"), + isNull(toolCatalogEntries.quarantinedAt), + )) + .limit(1); + if (!entry) throw forbidden("The call_my_phone tool is not active on this Speko connection"); + const schemaProperties = entry.inputSchema && typeof entry.inputSchema === "object" && "properties" in entry.inputSchema + ? (entry.inputSchema as { properties?: Record }).properties + : undefined; + const allowsMessage = Boolean(schemaProperties && typeof schemaProperties === "object" && "message" in schemaProperties); + const parsed = allowsMessage + ? callMyPhoneParametersSchema.parse(parameters ?? {}) + : (z.object({}).strict().parse(parameters ?? {}) as { message?: undefined }); + return runtimes.get(db)!({ companyId: session.companyId, endpointId, issueId: session.issueId!, caller: authority.caller, ...(parsed.message ? { openingMessage: parsed.message } : {}) }, invocationId); } import { chatEndpoints, diff --git a/server/src/services/voice/speko-provider.ts b/server/src/services/voice/speko-provider.ts index 459c0d67ca3..a3934e80c25 100644 --- a/server/src/services/voice/speko-provider.ts +++ b/server/src/services/voice/speko-provider.ts @@ -10,7 +10,12 @@ const mediaUrl = z.string().url().refine((value) => { const url = new URL(value) const sessionSchema = z.object({ sessionId: providerId, transportToken: z.string().min(1).max(32_000), transportUrl: mediaUrl }); export type SpekoBrowserSession = z.infer; export class SpekoProviderError extends Error { - constructor(readonly code: "credentials_rejected" | "insufficient_credits" | "rate_limited" | "provider_unavailable" | "invalid_response", readonly outcomeUnknown: boolean, readonly httpStatus?: number) { + constructor( + readonly code: "credentials_rejected" | "insufficient_credits" | "rate_limited" | "provider_unavailable" | "invalid_response", + readonly outcomeUnknown: boolean, + readonly httpStatus?: number, + readonly providerCode?: string, + ) { super(`Speko ${code}`); } } @@ -30,8 +35,21 @@ export function createSpekoProvider(apiKey: string, transport: typeof fetch = fe } catch { throw new SpekoProviderError("provider_unavailable", body !== undefined); } onResponse?.(response.status); if (!response.ok) { - await response.body?.cancel(); - throw new SpekoProviderError(response.status === 401 || response.status === 403 ? "credentials_rejected" : response.status === 402 ? "insufficient_credits" : response.status === 429 ? "rate_limited" : "provider_unavailable", body !== undefined && response.status >= 500, response.status); + let providerCode: string | undefined; + if (response.status === 400) { + try { + const text = await response.text(); + if (text.length <= 16_384) { + const parsedError = z.object({ code: z.string().regex(/^[A-Z0-9_]{1,64}$/) }).safeParse(JSON.parse(text)); + if (parsedError.success) providerCode = parsedError.data.code; + } + } catch { + // Never expose raw provider error bodies. + } + } else { + await response.body?.cancel(); + } + throw new SpekoProviderError(response.status === 401 || response.status === 403 ? "credentials_rejected" : response.status === 402 ? "insufficient_credits" : response.status === 429 ? "rate_limited" : "provider_unavailable", body !== undefined && response.status >= 500, response.status, providerCode); } try { const reader = response.body?.getReader(); @@ -70,7 +88,18 @@ export function createSpekoProvider(apiKey: string, transport: typeof fetch = fe // Incoming calls inherit realtime mode; browser creation explicitly uses // cascade. Browser sessions do not dispatch pre-call hooks, so the persona // default must keep idle prompts off. Telephone hooks enable them per call. - await request(`/v1/agents/${pathId(agentId)}`, {runMode: "s2s", systemPrompt: PHONE_VOICE_PROMPT, idleRePrompts: {enabled: false}}, "PATCH"); + try { + await request(`/v1/agents/${pathId(agentId)}`, {runMode: "s2s", systemPrompt: PHONE_VOICE_PROMPT, idleRePrompts: {enabled: false}}, "PATCH"); + } catch (error) { + // Personas created with a cascade-only voice reject runMode: "s2s" with S2S_VOICE_UNSUPPORTED. + // Fall back to a supported S2S voice only for that exact provider error code. + if (error instanceof SpekoProviderError && error.httpStatus === 400 && error.providerCode === "S2S_VOICE_UNSUPPORTED") { + logger.info({ event: "voice.setup.s2s_voice_fallback", fallbackVoice: "marin" }, "Speko persona voice unsupported in S2S mode; applying S2S voice fallback"); + await request(`/v1/agents/${pathId(agentId)}`, {runMode: "s2s", voice: "marin", systemPrompt: PHONE_VOICE_PROMPT, idleRePrompts: {enabled: false}}, "PATCH"); + return; + } + throw error; + } }, async createBrowserSession(input: { agentId: string; maxDurationSeconds: number; bindingId: string; toolToken: string; systemPrompt: string }) { const maxDurationSeconds = z.number().int().min(30).max(1800).parse(input.maxDurationSeconds); @@ -85,16 +114,19 @@ export function createSpekoProvider(apiKey: string, transport: typeof fetch = fe if (!parsed.success) throw new SpekoProviderError("invalid_response", true); return parsed.data; }, - async createPhoneSession(input: { agentId: string; maxDurationSeconds: number; bindingId: string; toolToken: string; systemPrompt: string; to: string }) { + async createPhoneSession(input: { agentId: string; maxDurationSeconds: number; bindingId: string; toolToken: string; systemPrompt: string; to: string; firstMessage?: string }) { const agentId = providerId.parse(input.agentId); const to = z.string().regex(/^\+[1-9]\d{6,14}$/).parse(input.to); const maxDurationSeconds = z.number().int().min(30).max(1800).parse(input.maxDurationSeconds); + const firstMessage = input.firstMessage !== undefined + ? z.string().trim().min(1).max(2000).parse(input.firstMessage) + : "Hi, this is your Paperclip agent calling as requested. Is now a good time?"; // Per-call signed pre-call overrides bind automatic reply delivery. Never mutate // the shared persona during dialing: browser sessions use result hints. const result = await request("/v1/sessions/phone", { runMode: "s2s", agentId, to, maxDurationSeconds, - systemPrompt: input.systemPrompt, firstMessage: "Hi, this is your Paperclip agent calling as requested. Is now a good time?", + systemPrompt: input.systemPrompt, firstMessage, metadata: { paperclipVoiceBindingId: input.bindingId }, toolSecrets: { paperclip_session_token: input.toolToken }, telephony: { amd: { mode: "disabled" } }, diff --git a/server/src/services/voice/speko-skill.ts b/server/src/services/voice/speko-skill.ts index 7a37a6012ac..c66933a7eb7 100644 --- a/server/src/services/voice/speko-skill.ts +++ b/server/src/services/voice/speko-skill.ts @@ -25,8 +25,10 @@ ${SPEKO_COMMUNICATION_GUIDANCE} Discover the assigned connection's call_my_phone tool through Paperclip's governed tool catalog. It calls only the responsible person's saved, opted-in number for -the current task. Tool availability and Allowed / Ask first / Off controls still -apply. Never choose another recipient or bypass an approval. If creation has an -uncertain outcome, inspect the existing attempt; never blindly redial. Report -provider failures accurately without promising a callback. +the current task. Always pass the message parameter with the concise update, announcement, or +question you want spoken immediately when they pick up; their spoken response will +be transcribed and recorded on this issue. Tool availability and Allowed / Ask first +/ Off controls still apply. Never choose another recipient or bypass an approval. +If creation has an uncertain outcome, inspect the existing attempt; never blindly redial. +Report provider failures accurately without promising a callback. `; diff --git a/server/src/services/voice/voice-call-reports.ts b/server/src/services/voice/voice-call-reports.ts index 0290554133d..effcfd51e6f 100644 --- a/server/src/services/voice/voice-call-reports.ts +++ b/server/src/services/voice/voice-call-reports.ts @@ -62,20 +62,30 @@ export function voiceCallReports(db: Db, fetchReport: (session: VoiceSessionRow) return { rows: result, complete }; } async function projectTranscript(session: VoiceSessionRow) { - // Keep both actual spoken sides on this public call's own task. This - // does not publish a document or grant access to any other task. - if (session.callerAuthority !== "guest_intake") return; + // Keep both actual spoken sides on the call's bound task for all phone calls + // (outbound callbacks and inbound calls). Never publish to another task. + if (session.callerAuthority !== "guest_intake" && session.mode !== "outbound_phone" && session.mode !== "inbound_phone") return; await db.transaction(async tx => { await tx.execute(sql`select pg_advisory_xact_lock(hashtextextended(${`voice-transcript:${session.id}`}, 0))`); const [retained] = await tx.select().from(chatVoiceReports).where(and(eq(chatVoiceReports.companyId, session.companyId), eq(chatVoiceReports.sessionId, session.id))); if (!retained?.transcript.length) return; - const [task] = await tx.select({sourceTrust: issues.sourceTrust}).from(issues).where(and(eq(issues.companyId, session.companyId), eq(issues.id, session.issueId))); - if (task?.sourceTrust?.preset !== "low_trust_review" || task.sourceTrust.disposition !== "quarantined") return; + const [task] = await tx.select({id: issues.id, sourceTrust: issues.sourceTrust}).from(issues).where(and(eq(issues.companyId, session.companyId), eq(issues.id, session.issueId))); + if (!task) return; + if (session.callerAuthority === "guest_intake" && (task.sourceTrust?.preset !== "low_trust_review" || task.sourceTrust.disposition !== "quarantined")) return; const key = `voice-transcript-${session.id}`; const body = retained.transcript.map(turn => `**${turn.speaker === "caller" ? "Caller" : "Agent"}** · ${turn.startedAt}${turn.interrupted ? " · interrupted" : ""}\n\n${turn.text}`).join("\n\n---\n\n"); const docs = documentService(tx as unknown as Db), previous = await docs.getIssueDocumentByKey(session.issueId, key); if (previous?.body === body) return; - await docs.upsertIssueDocument({issueId: session.issueId, key, baseRevisionId: previous?.latestRevisionId, title: "Phone conversation transcript", format: "markdown", body, sourceTrust: task.sourceTrust, changeSummary: "Speko spoken conversation, including caller and agent turns"}); + await docs.upsertIssueDocument({ + issueId: session.issueId, + key, + baseRevisionId: previous?.latestRevisionId, + title: session.mode === "outbound_phone" ? "Outbound phone call transcript" : "Phone conversation transcript", + format: "markdown", + body, + ...(task.sourceTrust ? { sourceTrust: task.sourceTrust } : {}), + changeSummary: "Speko spoken conversation, including caller and agent turns", + }); await tx.insert(activityLog).values({companyId: session.companyId, actorType: "system", actorId: "speko-report", action: "voice.transcript.updated", entityType: "issue", entityId: session.issueId, details: {sessionId: session.id}}); }); } diff --git a/server/src/services/voice/voice-inbound-service.ts b/server/src/services/voice/voice-inbound-service.ts index 5c781d5a21b..b270e420caf 100644 --- a/server/src/services/voice/voice-inbound-service.ts +++ b/server/src/services/voice/voice-inbound-service.ts @@ -104,7 +104,7 @@ export function voiceInboundService(db: Db, options: { const providerSessionId = event.session_id ?? event.call_id; if (!providerSessionId || event.call_id && event.call_id !== providerSessionId || event.organization_id && event.organization_id !== row.providerAccountId || event.agent_id && event.agent_id !== credentials.agentId) throw forbidden("Invalid voice call identity"); if (event.type === "call.pre_call") { - if (event.direction === "outbound") return {idleRePrompts: {enabled: true, delayMs: 10_000, maxPrompts: 10, messages: ["I'm still working on it."]}}; + if (event.direction === "outbound") return {idleRePrompts: {enabled: true, delayMs: 25_000, maxPrompts: 4, messages: ["Are you still there? Let me know if you have any feedback or next steps."]}}; // Browser sessions use Paperclip result hints. The session-create API // rejects idleRePrompts; pre-call pipeline overrides support this setting. if (event.direction === "web") return {idleRePrompts: {enabled: false}}; @@ -191,7 +191,9 @@ export function voiceInboundService(db: Db, options: { if (!call.sessionId) { const taskId = randomUUID(), conversationId = randomUUID(), threadId = `speko:${conversationId}`; const reviewPreset = {id: LOW_TRUST_REVIEW_PRESET, version: LOW_TRUST_REVIEW_PRESET_VERSION, rawOutputDisposition: LOW_TRUST_REVIEW_RAW_OUTPUT_DISPOSITION}; - const task = await issueSvc.create(row.companyId, {id: taskId, title: "Incoming phone conversation", description: "Conversation with an unverified phone caller. The agent runs under a task-scoped low-trust policy. You are on a live phone call and must attempt to answer as quickly as possible. Immediately post a brief, caller-safe task comment explaining what you are doing, then find the answer and post the result on this task so it can be spoken to the caller. Continue working after the initial update; do not treat it as the final answer. Preserve the task-scoped low-trust policy and ordinary permissions.", status: "todo", priority: "medium", assigneeAgentId: row.assignedAgentId, executionWorkspaceSettings: {mode: "isolated_workspace", workspaceStrategy: {type: "cloud_sandbox"}, ...(line.lowTrustEnvironmentId ? {environmentId: line.lowTrustEnvironmentId} : {})}, originKind: "chat_channel", originId: row.id, idempotencyKey: `guest-intake:${call.id}`, sourceTrust: {preset: LOW_TRUST_REVIEW_PRESET, disposition: "quarantined", sourceIssueId: taskId}, executionPolicy: {mode: "normal", commentRequired: true, stages: [], reviewPreset, authorizationPolicy: {trustPreset: LOW_TRUST_REVIEW_PRESET, reviewPreset, trustBoundary: {mode: LOW_TRUST_REVIEW_PRESET, companyId: row.companyId, rootIssueId: taskId, issueIds: [taskId], allowedAgentIds: [row.assignedAgentId], allowedToolClasses: [], allowedSecretBindingIds: []}}}}, tx); + const sanitizedTitle = envelope.args.text.replace(/@[\w.-]+(?:\[bot\])?/gi, "").replace(/\s+/g, " ").trim(); + const title = (sanitizedTitle || "Incoming phone conversation").slice(0, 90); + const task = await issueSvc.create(row.companyId, {id: taskId, title, description: "Conversation with an unverified phone caller. The agent runs under a task-scoped low-trust policy. You are on a live phone call and must attempt to answer as quickly as possible. Immediately post a brief, caller-safe task comment explaining what you are doing, then find the answer and post the result on this task so it can be spoken to the caller. Continue working after the initial update; do not treat it as the final answer. Preserve the task-scoped low-trust policy and ordinary permissions.", status: "todo", priority: "medium", assigneeAgentId: row.assignedAgentId, executionWorkspaceSettings: {mode: "isolated_workspace", workspaceStrategy: {type: "cloud_sandbox"}, ...(line.lowTrustEnvironmentId ? {environmentId: line.lowTrustEnvironmentId} : {})}, originKind: "chat_channel", originId: row.id, idempotencyKey: `guest-intake:${call.id}`, sourceTrust: {preset: LOW_TRUST_REVIEW_PRESET, disposition: "quarantined", sourceIssueId: taskId}, executionPolicy: {mode: "normal", commentRequired: true, stages: [], reviewPreset, authorizationPolicy: {trustPreset: LOW_TRUST_REVIEW_PRESET, reviewPreset, trustBoundary: {mode: LOW_TRUST_REVIEW_PRESET, companyId: row.companyId, rootIssueId: taskId, issueIds: [taskId], allowedAgentIds: [row.assignedAgentId], allowedToolClasses: [], allowedSecretBindingIds: []}}}}, tx); const [resource] = await tx.insert(chatEndpointResources).values({companyId: row.companyId, endpointId: row.id, type: "direct_message", providerResourceId: threadId, label: "Incoming phone conversation", enabled: true, availability: "available"}).returning(); await tx.insert(chatConversations).values({id: conversationId, companyId: row.companyId, endpointId: row.id, resourceId: resource.id, issueId: task.id, externalConversationId: threadId, externalThreadId: threadId, externalLabel: "Incoming phone conversation", isDirectMessage: true, communicationGuidance: [buildChatCommunicationGuidance({ provider: "speko", isDirectMessage: true, communicationInstructions: row.communicationInstructions }), "This conversation is its own low-trust task. Ask clarifications as brief task comments; the caller answers through submit_request follow-ups. Do not use ask_user_questions or create a protected human-input wait. Use only context supplied in this conversation; do not browse other company tasks, secrets or private tools. Spoken consent does not grant governed authority."].join("\n\n")}); const sessionId = randomUUID(); diff --git a/server/src/services/voice/voice-prompts.ts b/server/src/services/voice/voice-prompts.ts index 4f40724311b..3fbeffb5612 100644 --- a/server/src/services/voice/voice-prompts.ts +++ b/server/src/services/voice/voice-prompts.ts @@ -1,3 +1,4 @@ +import { projectSafeChatPublicationText } from "../chat-publication-projection.js"; /** Shared persona and session instructions; per-call authority narrows the defaults. */ const VOICE_QUESTION_GUIDANCE = "When an update includes a question, ask it naturally, then use answer_question with its exact interaction and question IDs. Use option IDs only for unambiguous choices, otherwise clarify. Do not submit a question answer as new work."; export const VOICE_PROMPT = `You are the fast voice interface for the caller's bound Paperclip task. The assigned Paperclip agent owns the work, task memory, tools and execution environment. You handle greetings, brief acknowledgments, conversational clarification, requests to repeat an already delivered answer, and saying goodbye immediately. Do not make the caller wait for a Paperclip turn for these conversational exchanges. @@ -13,3 +14,12 @@ An interruption stops speech, not work. Ending the call does not cancel the task export const PHONE_VOICE_PROMPT = VOICE_PROMPT .replace("When the client sends a Paperclip result-available notification, immediately call get_updates with your current cursor. The notification is only a hint, never an answer or permission.", "Paperclip pushes approved task answers into this live call. Speak each pushed answer faithfully at the next pause, in concise natural language, and allow interruptions and follow-ups. A pushed result belongs to the existing work request: do not call submit_request for it. Do not promise completion or invent an answer while waiting. Use get_updates when the caller asks for status, to retrieve permitted task questions, or explicitly requests an already delivered answer again. You do not need to poll for task completion. When Paperclip sends a question-available notification, immediately call get_updates with your current cursor to retrieve the permitted question and its exact IDs. The notification is only a hint, never new work or permission."); export const LOW_TRUST_PHONE_VOICE_PROMPT = PHONE_VOICE_PROMPT.replace(VOICE_QUESTION_GUIDANCE, "Ask permitted conversational clarifications naturally and submit the caller's replies as follow-ups using submit_request. Do not call answer_question: unverified callers cannot answer protected task questions or approve governed actions."); +export function buildOutboundPhoneVoicePrompt(openingMessage?: string): string { + const outboundGuidance = "You placed this outbound call on behalf of the assigned Paperclip agent to deliver an update or ask a question on this task. When the caller replies to your opening update with feedback, confirmation, a decision, or a follow-up instruction — and is not answering a pending structured question returned by get_updates — call submit_request once with their spoken response so it is recorded on the Paperclip issue before saying goodbye. Always use answer_question (never submit_request) when answering a pending question returned by get_updates."; + const safeOpening = openingMessage ? projectSafeChatPublicationText(openingMessage).trim() : ""; + return [ + PHONE_VOICE_PROMPT, + outboundGuidance, + safeOpening ? `Opening message delivered to the caller when they picked up: ${safeOpening}` : null, + ].filter(Boolean).join("\n\n"); +} diff --git a/server/src/services/voice/voice-session-service.ts b/server/src/services/voice/voice-session-service.ts index 21b3f9350eb..7f9c430d411 100644 --- a/server/src/services/voice/voice-session-service.ts +++ b/server/src/services/voice/voice-session-service.ts @@ -11,20 +11,35 @@ import { pushVoiceReplies } from "./voice-reply-push.js"; import { voiceInboundService } from "./voice-inbound-service.js"; import { createHash, randomUUID } from "node:crypto"; import { and, desc, eq, inArray, notInArray, or, sql } from "drizzle-orm"; +import { z } from "zod"; import { chatVoiceReports, chatVoiceCallbacks, chatConversations, chatEndpointResources, chatEndpoints, chatVoiceSessions, issues, activityLog, type Db } from "@paperclipai/db"; import { VOICE_RESULT_NOTIFICATION, VOICE_REPEAT_NOTIFICATION, type VoiceSession, type VoiceSessionMedia, type VoiceCallHistoryEntry, type VoiceCallReport } from "@paperclipai/shared"; import { conflict, forbidden, notFound, HttpError } from "../../errors.js"; import { instanceSettingsService } from "../instance-settings.js"; import { buildChatCommunicationGuidance } from "../chat-communication-guidance.js"; +import { projectSafeChatPublicationText } from "../chat-publication-projection.js"; import { issueService } from "../issues.js"; import { createSpekoProvider, SpekoProviderError } from "./speko-provider.js"; import { serializeVoiceSession, voiceSessionStore, type VoiceCaller, type VoiceSessionRow } from "./voice-session-store.js"; import { registerSpekoVoiceRuntime } from "./speko-agent-tools.js"; import { verifySpekoToolRequest } from "./speko-protocol.js"; -import { VOICE_PROMPT, PHONE_VOICE_PROMPT, LOW_TRUST_PHONE_VOICE_PROMPT } from "./voice-prompts.js"; +import { VOICE_PROMPT, PHONE_VOICE_PROMPT, LOW_TRUST_PHONE_VOICE_PROMPT, buildOutboundPhoneVoicePrompt } from "./voice-prompts.js"; const liveStates = ["reserved", "creating", "creation_unknown", "connecting", "active", "ending"] as const; const terminalStates = ["ended", "failed", "expired"] as const; +const MAX_OPENING_MESSAGE_LENGTH = 2000; + +function safeOutboundOpeningMessage(raw?: string): string | undefined { + if (!raw) return undefined; + let safe = projectSafeChatPublicationText(raw).trim(); + if (safe.length > MAX_OPENING_MESSAGE_LENGTH) { + let end = MAX_OPENING_MESSAGE_LENGTH; + // Avoid cutting a UTF-16 surrogate pair in half. + if (end > 0 && safe.charCodeAt(end - 1) >= 0xd800 && safe.charCodeAt(end - 1) <= 0xdbff) end -= 1; + safe = safe.slice(0, end).trim(); + } + return safe || undefined; +} type Endpoint = typeof chatEndpoints.$inferSelect; export function voiceSessionService(db: Db, options: { @@ -51,10 +66,11 @@ export function voiceSessionService(db: Db, options: { return session; }); } - async function start(input: { companyId: string; endpointId: string; issueId?: string; newConversation?: boolean; caller: VoiceCaller; idempotencyKey: string; maxDurationSeconds: number; mode?: "outbound_phone" | "inbound_phone"; phoneNumber?: string; providerSessionId?: string; toolToken?: string }): Promise<{ session: VoiceSession; media?: VoiceSessionMedia }> { + async function start(input: { companyId: string; endpointId: string; issueId?: string; newConversation?: boolean; caller: VoiceCaller; idempotencyKey: string; maxDurationSeconds: number; mode?: "outbound_phone" | "inbound_phone"; phoneNumber?: string; openingMessage?: string; providerSessionId?: string; toolToken?: string }): Promise<{ session: VoiceSession; media?: VoiceSessionMedia }> { if (input.mode === "outbound_phone" && !(await instanceSettingsService(db).getExperimental()).enableChatConnectors) throw forbidden("Voice connections are disabled"); + const safeOpeningMessage = safeOutboundOpeningMessage(input.openingMessage); const endpoint = await endpointFor(input.companyId, input.endpointId); - const requestFingerprint = createHash("sha256").update(JSON.stringify({ endpointId: input.endpointId, issueId: input.issueId ?? null, maxDurationSeconds: input.maxDurationSeconds, ...(input.mode ? { mode: input.mode, phoneNumber: input.phoneNumber, providerSessionId: input.providerSessionId } : {}), ...(input.newConversation ? { newConversation: true } : {}) })).digest("hex"); + const requestFingerprint = createHash("sha256").update(JSON.stringify({ endpointId: input.endpointId, issueId: input.issueId ?? null, maxDurationSeconds: input.maxDurationSeconds, ...(input.mode ? { mode: input.mode, phoneNumber: input.phoneNumber, providerSessionId: input.providerSessionId } : {}), ...(safeOpeningMessage ? { openingMessage: safeOpeningMessage } : {}), ...(input.newConversation ? { newConversation: true } : {}) })).digest("hex"); const reserved = await store.reserve({ ...input, requestFingerprint, prepareBinding: async (tx) => { // One lock per task preserves the existing conversation on concurrent resumes. if (input.issueId) await tx.execute(sql`select pg_advisory_xact_lock(hashtextextended(${`voice-binding:${input.companyId}:${input.endpointId}:${input.issueId}`}, 0))`); @@ -109,10 +125,10 @@ export function voiceSessionService(db: Db, options: { client = provider(credentials.apiKey); const shared = { agentId: credentials.agentId, bindingId: session.id, toolToken: reserved.token, maxDurationSeconds: input.maxDurationSeconds }; created = input.mode === "outbound_phone" - ? await client.createPhoneSession({ ...shared, to: input.phoneNumber!, systemPrompt: PHONE_VOICE_PROMPT }) + ? await client.createPhoneSession({ ...shared, to: input.phoneNumber!, systemPrompt: buildOutboundPhoneVoicePrompt(safeOpeningMessage), ...(safeOpeningMessage ? { firstMessage: safeOpeningMessage } : {}) }) : await client.createBrowserSession({ ...shared, systemPrompt: VOICE_PROMPT }); } catch (error) { - const known = error instanceof SpekoProviderError && !error.outcomeUnknown || error instanceof HttpError && [403, 404].includes(error.status); + const known = error instanceof SpekoProviderError && !error.outcomeUnknown || error instanceof HttpError && [403, 404].includes(error.status) || error instanceof z.ZodError; await withVoiceSessionChange(db, session.id, tx => tx.update(chatVoiceSessions).set({ state: known ? "failed" : "creation_unknown", errorCode: error instanceof SpekoProviderError ? error.code : "provider_unavailable", updatedAt: new Date() }).where(and(eq(chatVoiceSessions.id, session.id), eq(chatVoiceSessions.state, "creating")))); if (error instanceof SpekoProviderError && error.code === "insufficient_credits") throw conflict("Speko needs credits before starting a call. Add credits in Speko, then try again.", {code: "voice_credits_required", sessionId: session.id}); throw conflict(known ? "Speko could not start the call. Check connection status before trying again." : "Speko may have started this call. Inspect this attempt before starting another.", { code: known ? "voice_creation_failed" : "voice_creation_unknown", sessionId: session.id }); diff --git a/tests/runner-e2e/source-sdk-public-inputs.json b/tests/runner-e2e/source-sdk-public-inputs.json index 29c5c2d308a..bfd5b39320d 100644 --- a/tests/runner-e2e/source-sdk-public-inputs.json +++ b/tests/runner-e2e/source-sdk-public-inputs.json @@ -172,7 +172,7 @@ "packages/shared/src/app-definitions/shopify.json": "f6bff7db55083d96060d8bd46a08aa38b33c3080", "packages/shared/src/app-definitions/similarweb.json": "37a912287b7ad323cf783eb32d01b943a93e83fd", "packages/shared/src/app-definitions/slack.json": "0a3e028d0c729f1448be06eaff3a7b51f08b194d", - "packages/shared/src/app-definitions/speko.json": "6f25f776269b435e8cbde3c3249d35d3063156ce", + "packages/shared/src/app-definitions/speko.json": "8edaad773c06372ee8cd9e7ee3e5b03ffe875a5f", "packages/shared/src/app-definitions/stripe.json": "708fb6d3498dbb57902dd5ebc45c8fded5d6b578", "packages/shared/src/app-definitions/supabase.json": "9a92a2f30af01e1c9f4cebdf7d4ba0101353c1c6", "packages/shared/src/app-definitions/superagent.json": "6e1a847cc0c754a326250caa8dc93401b5c823f1", diff --git a/ui/src/pages/apps/chat/ChatEndpointSetup.tsx b/ui/src/pages/apps/chat/ChatEndpointSetup.tsx index a3491ed8ee2..01345d1b541 100644 --- a/ui/src/pages/apps/chat/ChatEndpointSetup.tsx +++ b/ui/src/pages/apps/chat/ChatEndpointSetup.tsx @@ -472,6 +472,19 @@ function ChatSdkEndpointSetup() { tone: "error", }), }); + const finishSpekoWithoutTest = useMutation({ + mutationFn: () => chatEndpointsApi.finishSlackSetup(endpoint!.id), + onSuccess: (next) => { + syncEndpointSnapshot(next); + if (next.status === "active") navigate(`/apps/chat/${next.id}/settings`); + }, + onError: (error) => + pushToast({ + title: "Couldn't finish setup", + body: describeError(error).body, + tone: "error", + }), + }); const testConnection = useMutation({ mutationFn: () => provider === "slack" ? chatEndpointsApi.finishSlackSetup(endpoint!.id) : chatEndpointsApi.test(endpoint!.id), onSuccess: (next) => { @@ -668,7 +681,10 @@ function ChatSdkEndpointSetup() {

Test your Speko voice connection

Ask the agent to do some work, add a spoken follow-up, and listen for its result. Accepted work stays in Paperclip when you end the call.

- navigate("/apps")}> + navigate("/apps")}> + + + )} {endpoint && step === tryStep && provider !== "speko" && (!automaticSlack || automaticSlackComplete) && (