Skip to content

Commit ca6853d

Browse files
committed
improvement(persona): require session token on resume per API contract
1 parent 00c66d4 commit ca6853d

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

apps/sim/tools/persona/resume_inquiry.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,14 @@ export const personaResumeInquiryTool: ToolConfig<
4747
transformResponse: async (response) => {
4848
const data = await parsePersonaResponse(response)
4949
const sessionToken = data.meta?.['session-token']
50+
if (typeof sessionToken !== 'string' || sessionToken.length === 0) {
51+
throw new Error('Persona did not return a session token; check the inquiry status')
52+
}
5053
return {
5154
success: true,
5255
output: {
5356
inquiry: mapInquiry(asResource(data.data)),
54-
sessionToken: typeof sessionToken === 'string' ? sessionToken : null,
57+
sessionToken,
5558
},
5659
}
5760
},
@@ -66,7 +69,6 @@ export const personaResumeInquiryTool: ToolConfig<
6669
type: 'string',
6770
description:
6871
'Session token for the new inquiry session, used to continue the flow in embedded SDKs',
69-
optional: true,
7072
},
7173
},
7274
}

apps/sim/tools/persona/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ export interface PersonaListInquiriesResponse extends ToolResponse {
283283
export interface PersonaResumeInquiryResponse extends ToolResponse {
284284
output: {
285285
inquiry: PersonaInquiry
286-
sessionToken: string | null
286+
sessionToken: string
287287
}
288288
}
289289

0 commit comments

Comments
 (0)