From 6b9009e13cf541638d1b766d8ce2b9f678c52b9a Mon Sep 17 00:00:00 2001 From: Or Gershoni Date: Wed, 3 Jun 2026 10:36:47 +0300 Subject: [PATCH] feat(lasso): send source.type=portkey for Used By attribution --- src/plugins/lasso/classify.ts | 9 +++++++++ src/plugins/lasso/lasso.test.ts | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/plugins/lasso/classify.ts b/src/plugins/lasso/classify.ts index 889bde990..d6dce9c81 100644 --- a/src/plugins/lasso/classify.ts +++ b/src/plugins/lasso/classify.ts @@ -48,11 +48,17 @@ enum LassoMessageType { COMPLETION = 'COMPLETION', } +interface LassoSource { + type: string; + [key: string]: unknown; +} + interface LassoV3ClassifyRequest { messages: LassoMessage[]; messageType: LassoMessageType; sessionId?: string; userId?: string; + source?: LassoSource; } interface LassoV3ClassifyResponse { @@ -181,6 +187,9 @@ export const handler: PluginHandler = async ( const payload: LassoV3ClassifyRequest = { messages, messageType, + // Drives the "Used By" badge on Lasso Application API Keys: every call from this + // integration is attributed as "portkey" on the keys list. + source: { type: 'portkey' }, }; // Map conversationId to sessionId diff --git a/src/plugins/lasso/lasso.test.ts b/src/plugins/lasso/lasso.test.ts index 6b5302b2c..fcead5b25 100644 --- a/src/plugins/lasso/lasso.test.ts +++ b/src/plugins/lasso/lasso.test.ts @@ -283,7 +283,10 @@ describe('Lasso Security Deputies API v3', () => { expect(mockedPost).toHaveBeenCalledWith( expect.any(String), - expect.objectContaining({ messageType: 'PROMPT' }), + expect.objectContaining({ + messageType: 'PROMPT', + source: { type: 'portkey' }, + }), expect.any(Object), undefined );