@lpextend/node-sdk 1.1.4 → 1.1.6

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/dist/index.d.mts CHANGED
@@ -1480,6 +1480,87 @@ interface CBConsumerQueryMetricsExtendedParams {
1480
1480
  /** Optional progress callback */
1481
1481
  onProgress?: (completed: number, total: number) => void;
1482
1482
  }
1483
+ /**
1484
+ * Request parameters for KB search events API
1485
+ * Used to retrieve actual customer queries and their outcomes
1486
+ */
1487
+ interface CBKbSearchEventsRequest {
1488
+ /** Start time in milliseconds since epoch */
1489
+ startTime: string;
1490
+ /** End time in milliseconds since epoch */
1491
+ endTime: string;
1492
+ /** Page number (1-based) */
1493
+ pageNumber?: number;
1494
+ /** Number of results per page */
1495
+ pageSize?: number;
1496
+ /** Event types to filter by */
1497
+ eventType?: CBConsumerQueryEventType[];
1498
+ /** Optional KB ID to filter by (omit for all KBs) */
1499
+ kbId?: string;
1500
+ }
1501
+ /**
1502
+ * Individual KB search event record
1503
+ * Represents a single customer query to the knowledge base
1504
+ */
1505
+ interface CBKbSearchEvent {
1506
+ /** Document/Article ID that matched (if answered) */
1507
+ documentId: string;
1508
+ /** Event index */
1509
+ eventIndex: number;
1510
+ /** Unique event ID */
1511
+ eventId: string;
1512
+ /** Conversation ID where this query occurred */
1513
+ conversationId: string;
1514
+ /** LP Account ID */
1515
+ accountId: string;
1516
+ /** Knowledge Base ID */
1517
+ kbId: string;
1518
+ /** Knowledge Base name */
1519
+ kbName: string;
1520
+ /** Message ID */
1521
+ messageId: string;
1522
+ /** The actual customer query/question */
1523
+ question: string;
1524
+ /** Search mode used */
1525
+ searchMode: string;
1526
+ /** When the event was generated (timestamp) */
1527
+ eventGeneratedTime: number;
1528
+ /** Client that made the KAI request */
1529
+ kbClient: string;
1530
+ /** Threshold used for the search */
1531
+ requestedThreshold: string;
1532
+ }
1533
+ /**
1534
+ * Pagination info for search events response
1535
+ */
1536
+ interface CBKbSearchEventsPagination {
1537
+ /** Next page number (0 if no more pages) */
1538
+ nextPage: number;
1539
+ /** Current page number */
1540
+ page: number;
1541
+ /** Total number of events */
1542
+ totalSize: number;
1543
+ /** Total number of pages */
1544
+ totalPages: number;
1545
+ /** Number of results on this page */
1546
+ size: number;
1547
+ }
1548
+ /**
1549
+ * Response from KB search events API
1550
+ */
1551
+ interface CBKbSearchEventsResponse {
1552
+ /** Whether the request was successful */
1553
+ success: boolean;
1554
+ /** Success result containing pagination and events */
1555
+ successResult?: {
1556
+ pagination: CBKbSearchEventsPagination;
1557
+ KbSearchEvents: CBKbSearchEvent[];
1558
+ };
1559
+ /** Error result if request failed */
1560
+ errorResult?: {
1561
+ message: string;
1562
+ };
1563
+ }
1483
1564
 
1484
1565
  /**
1485
1566
  * AI Studio Types
@@ -2204,6 +2285,31 @@ interface LPExtendSDKConfig {
2204
2285
  * @default 30000
2205
2286
  */
2206
2287
  timeout?: number;
2288
+ /**
2289
+ * SDK mode controls how scopes are verified:
2290
+ * - 'shell' (default): Verifies scopes with the LP Extend shell backend.
2291
+ * Requires shell connectivity.
2292
+ * - 'local': Skips all shell contact. Grants all requested scopes locally.
2293
+ * Requires `accessToken` to be provided directly (e.g. from LP Login Service API).
2294
+ * Use this for local development when the shell is not running.
2295
+ *
2296
+ * @default 'shell'
2297
+ */
2298
+ mode?: 'shell' | 'local';
2299
+ /**
2300
+ * Skip app registration verification with the shell backend.
2301
+ * When true, the SDK will not call /api/v1/lp/{accountId}/sdk/init to verify
2302
+ * that the app is registered. Instead, it grants all requested scopes locally.
2303
+ *
2304
+ * Use this for local development when your app is not yet registered
2305
+ * for the target account in the LP Extend shell.
2306
+ *
2307
+ * WARNING: Do not enable in production — app registration ensures proper
2308
+ * scope governance and access control.
2309
+ *
2310
+ * @default false
2311
+ */
2312
+ skipRegistration?: boolean;
2207
2313
  }
2208
2314
  /**
2209
2315
  * SDK initialization result
@@ -3627,6 +3733,36 @@ declare class KnowledgeBasesAPI {
3627
3733
  * ```
3628
3734
  */
3629
3735
  getConsumerQueryMetricsExtended(params: CBConsumerQueryMetricsExtendedParams): Promise<CBConsumerQueryMetric[]>;
3736
+ /**
3737
+ * Get KB search events (real customer queries)
3738
+ *
3739
+ * Retrieves actual customer queries made to knowledge bases and their outcomes.
3740
+ * This API returns the raw questions customers asked, whether they were answered,
3741
+ * and which KB/articles were involved.
3742
+ *
3743
+ * @param request - Search events request parameters
3744
+ * @returns Promise resolving to search events with pagination
3745
+ *
3746
+ * @example
3747
+ * ```typescript
3748
+ * // Get unanswered questions from the last 7 days
3749
+ * const events = await sdk.conversationBuilder.knowledgeBases.getSearchEvents({
3750
+ * startTime: String(Date.now() - 7 * 24 * 60 * 60 * 1000),
3751
+ * endTime: String(Date.now()),
3752
+ * eventType: ['EVENT_KB_UN_ANSWERED'],
3753
+ * pageSize: 50,
3754
+ * });
3755
+ *
3756
+ * // Get all events for a specific KB
3757
+ * const kbEvents = await sdk.conversationBuilder.knowledgeBases.getSearchEvents({
3758
+ * startTime: String(Date.now() - 7 * 24 * 60 * 60 * 1000),
3759
+ * endTime: String(Date.now()),
3760
+ * kbId: 'kb-123',
3761
+ * eventType: ['EVENT_KB_ANSWERED', 'EVENT_KB_UN_ANSWERED'],
3762
+ * });
3763
+ * ```
3764
+ */
3765
+ getSearchEvents(request: CBKbSearchEventsRequest): Promise<CBKbSearchEventsResponse>;
3630
3766
  }
3631
3767
  /**
3632
3768
  * Bot Agents API
@@ -4012,6 +4148,41 @@ declare function initializeSDK(config: LPExtendSDKConfig): Promise<LPExtendSDK>;
4012
4148
  * ```
4013
4149
  */
4014
4150
  declare function createSDKFromEnv(extendToken: string): Promise<LPExtendSDK>;
4151
+ /**
4152
+ * Create an SDK in local mode — no shell required
4153
+ *
4154
+ * Convenience wrapper around `createSDK({ mode: 'local', ... })`.
4155
+ * Skips all shell verification and grants the requested scopes locally.
4156
+ *
4157
+ * Use this for local development when the shell is not running.
4158
+ * Obtain the `accessToken` from the LP Login Service API
4159
+ * (POST https://{domain}/api/account/{accountId}/login).
4160
+ *
4161
+ * @param config - SDK config (accessToken is required)
4162
+ * @returns Promise resolving to initialized SDK instance
4163
+ *
4164
+ * @example
4165
+ * ```typescript
4166
+ * import { createLocalSDK, Scopes } from '@lpextend/node-sdk';
4167
+ *
4168
+ * const sdk = await createLocalSDK({
4169
+ * appId: 'my-app',
4170
+ * accountId: '12345678',
4171
+ * accessToken: bearerTokenFromLPLogin,
4172
+ * scopes: [Scopes.SKILLS, Scopes.USERS],
4173
+ * });
4174
+ *
4175
+ * const { data: skills } = await sdk.skills.getAll();
4176
+ * ```
4177
+ */
4178
+ declare function createLocalSDK(config: {
4179
+ appId: string;
4180
+ accountId: string;
4181
+ accessToken: string;
4182
+ scopes?: string[];
4183
+ debug?: boolean;
4184
+ timeout?: number;
4185
+ }): Promise<LPExtendSDK>;
4015
4186
  /**
4016
4187
  * SDK Version
4017
4188
  */
@@ -4106,4 +4277,4 @@ type Scope = (typeof Scopes)[keyof typeof Scopes];
4106
4277
  */
4107
4278
  declare function getShellToken(config: ShellTokenConfig): Promise<ShellTokenResponse>;
4108
4279
 
4109
- export { type CreateConversationRequest$1 as AICreateConversationRequest, AIStudioAPI, type AIStudioCategory, type AIStudioConversation, type AIStudioFlow, type AIStudioMessage, type AIStudioSimulation, type AIStudioSummary, type AIStudioUser, AIStudioUsersAPI, type UpdateConversationRequest as AIUpdateConversationRequest, type APIResponse, type ActivityRecord, type AgentActivity, AgentActivityAPI, type AgentActivityQuery, AgentGroupsAPI, type AgentMetrics, AgentMetricsAPI, type AgentMetricsQuery, type AgentParticipant, type AgentStatus, type ApiKeyAuthResponse, AutomaticMessagesAPI, type BatchSummaryRequest, BotAgentsAPI, BotGroupsAPI, BotsAPI, type CBAddBotAgentRequest, type CBAllBotAgentsStatusQueryParams, type CBApiResponse, type CBAuthCredentials, type CBAuthInfo, type CBBot, type CBBotEnvironment, type CBBotGroup, type CBBotGroupsQueryParams, type CBBotInstanceStatus, type CBBotPlatform, type CBBotUser, type CBBotsByGroupQueryParams, type CBChatBot, type CBChatBotMetrics, type CBChatBotPlatformUser, type CBChatBotSummary, type CBChatBotSummaryList, type CBConsumerQueryEventType, type CBConsumerQueryMetric, type CBConsumerQueryMetricsExtendedParams, type CBConsumerQueryMetricsParams, type CBConsumerQueryMetricsResponse, type CBCredential, type CBDialog, type CBDialogGroup, type CBDialogTemplateSummary, type CBDomainList, type CBDuplicatePhrase, type CBDuplicatePhrases, type CBGlobalFunctions, type CBIntent, type CBInteraction, type CBInteractionContent, type CBInteractionList, type CBKAIOnDemandConfig, type CBKAISearchRequest, type CBKAISearchResponse, type CBKAISearchResultItem, type CBKBArticle, type CBKBArticlesQueryParams, type CBKBContentSource, type CBKBLandingPageMetrics, type CBKnowledgeBase, type CBKnowledgeBaseDetail, type CBKnowledgeBaseList, type CBLPAppCredentials, type CBLPSkill, type CBNLUDomain, type CBPCSBotsStatusQueryParams, type CBPageContext, type CBPaginatedResult, type CBResponder, type CBResponseMatch, type CBSuccessResult, type CBSyncStatusDetails, type CBTileData, CampaignsAPI, CategoriesAPI, type CloseConversationRequest, type CoBrowseSession, ConnectToMessagingAPI, type ConsumerParticipant, type ConsumerProfile, type ContentToRetrieve, ConversationBuilderAPI, type ConversationContext, type ConversationInteraction, type ConversationParticipant, type ConversationQueryParams, type ConversationSummary, type ConversationTransfer, ConversationsAPI, type CreateAIStudioUserRequest, type CreateAgentGroupRequest, type CreateAutomaticMessageRequest, type CreateCampaignRequest, type CreateCategoryRequest, type CreateConversationResponse, type CreateEngagementRequest, type CreateLOBRequest, type CreateLPPromptRequest, type CreatePredefinedContentRequest, type CreateProfileRequest, type CreatePromptRequest, type CreateSimulationRequest, type CreateSkillRequest, type CreateSpecialOccasionRequest, type CreateTranscriptAnalysisRequest, type CreateUserRequest, type CreateWorkingHoursRequest, DialogsAPI, EngagementsAPI, type ErrorCode, ErrorCodes, EvaluatorsAPI, type FileMessage, FlowsAPI, type GeneratedQuestion, type GeneratedRoute, GeneratorsAPI, type GuidedRoute, type GuidedRoutingEvaluationRequest, type GuidedRoutingEvaluationResponse, IntegrationsAPI, InteractionsAPI, type InvokeFlowRequest, type InvokeFlowResponse, type KAIRouteGenerationStatus, type KAIRouteGeneratorRequest, type KAIRouteGeneratorResponse, KnowledgeBasesAPI, type Knowledgebase, type KnowledgebaseHealth, type KnowledgebaseItem, type KnowledgebaseSearchRequest, type KnowledgebaseSearchResult, type KnowledgebaseTextItem, KnowledgebasesAPI, type LLMModel, type LLMProvider, LOBsAPI, type LPAgentGroup, type LPAutomaticMessage, type LPAutomaticMessageData, type LPCampaign, type LPEngagement, LPExtendSDK, type LPExtendSDKConfig, LPExtendSDKError, type LPLLMProviderModels, type LPLLMProviderSubscription, type LPLLMType, type LPLOB, type LPPermission, type LPPredefinedContent, type LPPredefinedContentData, type LPProfile, type LPPrompt, type LPPromptClientConfig, type LPPromptClientType, type LPPromptConfiguration, type LPPromptGenericConfig, type LPPromptStatus, type LPPromptVariable, type LPPromptVariableSourceType, type LPPromptVersionDetail, LPPromptsAPI, type LPPromptsQueryParams, type LPShift, type LPSkill, type LPSkillRoutingConfig, type LPSpecialOccasion, type LPSpecialOccasionEvent, type LPUser, type LPWorkingDay, type LPWorkingHours, type MemberOf, type MessageData, type MessageRecord, MessagingAPI, type MessagingConversation, type CreateConversationRequest as MessagingCreateConversationRequest, MessagingHistoryAPI, type MessagingHistoryQuery, type MessagingHistoryResponse, type MessagingInteraction, MessagingOperationsAPI, NLUDomainsAPI, type OutboundCampaignReport, type OutboundReportQuery, OutboundReportingAPI, type PaginatedResponse, PredefinedContentAPI, ProfilesAPI, type Prompt, PromptLibraryAPI, type PromptVariable, QueryAPI, type QueryGenerateRequest, type QueryGenerateResponse, type QuestionGeneratorRequest, type QuestionGeneratorResponse, type ResolutionEvaluationRequest, type ResolutionEvaluationResponse, type RichContentMessage, type SDEEvent, type SDERecord, type SDKInitResult, type Scope, Scopes, type SendMessageRequest, SentinelAPI, type SentinelAppSetting, type SentinelAppSettings, type SentinelAppUser, type SentinelAuthRequest, type SentinelCCUser, type SentinelDomainsResponse, type SentinelLoginUrlResponse, type SentinelLpToken, type SentinelLpUser, type SentinelManagerOf, type SentinelMemberOf, type SentinelProfile, type SentinelToken, type SentinelTokenExchange, type SentinelUserData, type SentinelUserSkill, type ShellTokenConfig, type ShellTokenResponse, type ShellTokenUser, type SimilarityEvaluationRequest, type SimilarityEvaluationResponse, type SimulationConfig, type SimulationJobResult, type SimulationQueryParams, type SimulationResults, type SimulationTestCase, SimulationsAPI, SkillsAPI, SpecialOccasionsAPI, SummaryAPI, type SummaryRequest, type SurveyRecord, type TextMessage, type TranscriptAnalysis, TranscriptAnalysisAPI, type TranscriptConversation, type TranscriptQuestion, type TransferConversationRequest, type UpdateAIStudioUserModelsRequest, type UpdateAIStudioUserRequest, type UpdateAgentGroupRequest, type UpdateAutomaticMessageRequest, type UpdateCampaignRequest, type UpdateCategoryRequest, type UpdateConversationAttributesRequest, type UpdateEngagementRequest, type UpdateLOBRequest, type UpdateLPPromptRequest, type UpdatePredefinedContentRequest, type UpdateProfileRequest, type UpdatePromptRequest, type UpdateSimulationRequest, type UpdateSkillRequest, type UpdateSpecialOccasionRequest, type UpdateTranscriptAnalysisRequest, type UpdateUserRequest, type UpdateWorkingHoursRequest, UsersAPI, VERSION, WorkingHoursAPI, createSDK, createSDKFromEnv, getShellToken, initializeSDK };
4280
+ export { type CreateConversationRequest$1 as AICreateConversationRequest, AIStudioAPI, type AIStudioCategory, type AIStudioConversation, type AIStudioFlow, type AIStudioMessage, type AIStudioSimulation, type AIStudioSummary, type AIStudioUser, AIStudioUsersAPI, type UpdateConversationRequest as AIUpdateConversationRequest, type APIResponse, type ActivityRecord, type AgentActivity, AgentActivityAPI, type AgentActivityQuery, AgentGroupsAPI, type AgentMetrics, AgentMetricsAPI, type AgentMetricsQuery, type AgentParticipant, type AgentStatus, type ApiKeyAuthResponse, AutomaticMessagesAPI, type BatchSummaryRequest, BotAgentsAPI, BotGroupsAPI, BotsAPI, type CBAddBotAgentRequest, type CBAllBotAgentsStatusQueryParams, type CBApiResponse, type CBAuthCredentials, type CBAuthInfo, type CBBot, type CBBotEnvironment, type CBBotGroup, type CBBotGroupsQueryParams, type CBBotInstanceStatus, type CBBotPlatform, type CBBotUser, type CBBotsByGroupQueryParams, type CBChatBot, type CBChatBotMetrics, type CBChatBotPlatformUser, type CBChatBotSummary, type CBChatBotSummaryList, type CBConsumerQueryEventType, type CBConsumerQueryMetric, type CBConsumerQueryMetricsExtendedParams, type CBConsumerQueryMetricsParams, type CBConsumerQueryMetricsResponse, type CBCredential, type CBDialog, type CBDialogGroup, type CBDialogTemplateSummary, type CBDomainList, type CBDuplicatePhrase, type CBDuplicatePhrases, type CBGlobalFunctions, type CBIntent, type CBInteraction, type CBInteractionContent, type CBInteractionList, type CBKAIOnDemandConfig, type CBKAISearchRequest, type CBKAISearchResponse, type CBKAISearchResultItem, type CBKBArticle, type CBKBArticlesQueryParams, type CBKBContentSource, type CBKBLandingPageMetrics, type CBKnowledgeBase, type CBKnowledgeBaseDetail, type CBKnowledgeBaseList, type CBLPAppCredentials, type CBLPSkill, type CBNLUDomain, type CBPCSBotsStatusQueryParams, type CBPageContext, type CBPaginatedResult, type CBResponder, type CBResponseMatch, type CBSuccessResult, type CBSyncStatusDetails, type CBTileData, CampaignsAPI, CategoriesAPI, type CloseConversationRequest, type CoBrowseSession, ConnectToMessagingAPI, type ConsumerParticipant, type ConsumerProfile, type ContentToRetrieve, ConversationBuilderAPI, type ConversationContext, type ConversationInteraction, type ConversationParticipant, type ConversationQueryParams, type ConversationSummary, type ConversationTransfer, ConversationsAPI, type CreateAIStudioUserRequest, type CreateAgentGroupRequest, type CreateAutomaticMessageRequest, type CreateCampaignRequest, type CreateCategoryRequest, type CreateConversationResponse, type CreateEngagementRequest, type CreateLOBRequest, type CreateLPPromptRequest, type CreatePredefinedContentRequest, type CreateProfileRequest, type CreatePromptRequest, type CreateSimulationRequest, type CreateSkillRequest, type CreateSpecialOccasionRequest, type CreateTranscriptAnalysisRequest, type CreateUserRequest, type CreateWorkingHoursRequest, DialogsAPI, EngagementsAPI, type ErrorCode, ErrorCodes, EvaluatorsAPI, type FileMessage, FlowsAPI, type GeneratedQuestion, type GeneratedRoute, GeneratorsAPI, type GuidedRoute, type GuidedRoutingEvaluationRequest, type GuidedRoutingEvaluationResponse, IntegrationsAPI, InteractionsAPI, type InvokeFlowRequest, type InvokeFlowResponse, type KAIRouteGenerationStatus, type KAIRouteGeneratorRequest, type KAIRouteGeneratorResponse, KnowledgeBasesAPI, type Knowledgebase, type KnowledgebaseHealth, type KnowledgebaseItem, type KnowledgebaseSearchRequest, type KnowledgebaseSearchResult, type KnowledgebaseTextItem, KnowledgebasesAPI, type LLMModel, type LLMProvider, LOBsAPI, type LPAgentGroup, type LPAutomaticMessage, type LPAutomaticMessageData, type LPCampaign, type LPEngagement, LPExtendSDK, type LPExtendSDKConfig, LPExtendSDKError, type LPLLMProviderModels, type LPLLMProviderSubscription, type LPLLMType, type LPLOB, type LPPermission, type LPPredefinedContent, type LPPredefinedContentData, type LPProfile, type LPPrompt, type LPPromptClientConfig, type LPPromptClientType, type LPPromptConfiguration, type LPPromptGenericConfig, type LPPromptStatus, type LPPromptVariable, type LPPromptVariableSourceType, type LPPromptVersionDetail, LPPromptsAPI, type LPPromptsQueryParams, type LPShift, type LPSkill, type LPSkillRoutingConfig, type LPSpecialOccasion, type LPSpecialOccasionEvent, type LPUser, type LPWorkingDay, type LPWorkingHours, type MemberOf, type MessageData, type MessageRecord, MessagingAPI, type MessagingConversation, type CreateConversationRequest as MessagingCreateConversationRequest, MessagingHistoryAPI, type MessagingHistoryQuery, type MessagingHistoryResponse, type MessagingInteraction, MessagingOperationsAPI, NLUDomainsAPI, type OutboundCampaignReport, type OutboundReportQuery, OutboundReportingAPI, type PaginatedResponse, PredefinedContentAPI, ProfilesAPI, type Prompt, PromptLibraryAPI, type PromptVariable, QueryAPI, type QueryGenerateRequest, type QueryGenerateResponse, type QuestionGeneratorRequest, type QuestionGeneratorResponse, type ResolutionEvaluationRequest, type ResolutionEvaluationResponse, type RichContentMessage, type SDEEvent, type SDERecord, type SDKInitResult, type Scope, Scopes, type SendMessageRequest, SentinelAPI, type SentinelAppSetting, type SentinelAppSettings, type SentinelAppUser, type SentinelAuthRequest, type SentinelCCUser, type SentinelDomainsResponse, type SentinelLoginUrlResponse, type SentinelLpToken, type SentinelLpUser, type SentinelManagerOf, type SentinelMemberOf, type SentinelProfile, type SentinelToken, type SentinelTokenExchange, type SentinelUserData, type SentinelUserSkill, type ShellTokenConfig, type ShellTokenResponse, type ShellTokenUser, type SimilarityEvaluationRequest, type SimilarityEvaluationResponse, type SimulationConfig, type SimulationJobResult, type SimulationQueryParams, type SimulationResults, type SimulationTestCase, SimulationsAPI, SkillsAPI, SpecialOccasionsAPI, SummaryAPI, type SummaryRequest, type SurveyRecord, type TextMessage, type TranscriptAnalysis, TranscriptAnalysisAPI, type TranscriptConversation, type TranscriptQuestion, type TransferConversationRequest, type UpdateAIStudioUserModelsRequest, type UpdateAIStudioUserRequest, type UpdateAgentGroupRequest, type UpdateAutomaticMessageRequest, type UpdateCampaignRequest, type UpdateCategoryRequest, type UpdateConversationAttributesRequest, type UpdateEngagementRequest, type UpdateLOBRequest, type UpdateLPPromptRequest, type UpdatePredefinedContentRequest, type UpdateProfileRequest, type UpdatePromptRequest, type UpdateSimulationRequest, type UpdateSkillRequest, type UpdateSpecialOccasionRequest, type UpdateTranscriptAnalysisRequest, type UpdateUserRequest, type UpdateWorkingHoursRequest, UsersAPI, VERSION, WorkingHoursAPI, createLocalSDK, createSDK, createSDKFromEnv, getShellToken, initializeSDK };
package/dist/index.d.ts CHANGED
@@ -1480,6 +1480,87 @@ interface CBConsumerQueryMetricsExtendedParams {
1480
1480
  /** Optional progress callback */
1481
1481
  onProgress?: (completed: number, total: number) => void;
1482
1482
  }
1483
+ /**
1484
+ * Request parameters for KB search events API
1485
+ * Used to retrieve actual customer queries and their outcomes
1486
+ */
1487
+ interface CBKbSearchEventsRequest {
1488
+ /** Start time in milliseconds since epoch */
1489
+ startTime: string;
1490
+ /** End time in milliseconds since epoch */
1491
+ endTime: string;
1492
+ /** Page number (1-based) */
1493
+ pageNumber?: number;
1494
+ /** Number of results per page */
1495
+ pageSize?: number;
1496
+ /** Event types to filter by */
1497
+ eventType?: CBConsumerQueryEventType[];
1498
+ /** Optional KB ID to filter by (omit for all KBs) */
1499
+ kbId?: string;
1500
+ }
1501
+ /**
1502
+ * Individual KB search event record
1503
+ * Represents a single customer query to the knowledge base
1504
+ */
1505
+ interface CBKbSearchEvent {
1506
+ /** Document/Article ID that matched (if answered) */
1507
+ documentId: string;
1508
+ /** Event index */
1509
+ eventIndex: number;
1510
+ /** Unique event ID */
1511
+ eventId: string;
1512
+ /** Conversation ID where this query occurred */
1513
+ conversationId: string;
1514
+ /** LP Account ID */
1515
+ accountId: string;
1516
+ /** Knowledge Base ID */
1517
+ kbId: string;
1518
+ /** Knowledge Base name */
1519
+ kbName: string;
1520
+ /** Message ID */
1521
+ messageId: string;
1522
+ /** The actual customer query/question */
1523
+ question: string;
1524
+ /** Search mode used */
1525
+ searchMode: string;
1526
+ /** When the event was generated (timestamp) */
1527
+ eventGeneratedTime: number;
1528
+ /** Client that made the KAI request */
1529
+ kbClient: string;
1530
+ /** Threshold used for the search */
1531
+ requestedThreshold: string;
1532
+ }
1533
+ /**
1534
+ * Pagination info for search events response
1535
+ */
1536
+ interface CBKbSearchEventsPagination {
1537
+ /** Next page number (0 if no more pages) */
1538
+ nextPage: number;
1539
+ /** Current page number */
1540
+ page: number;
1541
+ /** Total number of events */
1542
+ totalSize: number;
1543
+ /** Total number of pages */
1544
+ totalPages: number;
1545
+ /** Number of results on this page */
1546
+ size: number;
1547
+ }
1548
+ /**
1549
+ * Response from KB search events API
1550
+ */
1551
+ interface CBKbSearchEventsResponse {
1552
+ /** Whether the request was successful */
1553
+ success: boolean;
1554
+ /** Success result containing pagination and events */
1555
+ successResult?: {
1556
+ pagination: CBKbSearchEventsPagination;
1557
+ KbSearchEvents: CBKbSearchEvent[];
1558
+ };
1559
+ /** Error result if request failed */
1560
+ errorResult?: {
1561
+ message: string;
1562
+ };
1563
+ }
1483
1564
 
1484
1565
  /**
1485
1566
  * AI Studio Types
@@ -2204,6 +2285,31 @@ interface LPExtendSDKConfig {
2204
2285
  * @default 30000
2205
2286
  */
2206
2287
  timeout?: number;
2288
+ /**
2289
+ * SDK mode controls how scopes are verified:
2290
+ * - 'shell' (default): Verifies scopes with the LP Extend shell backend.
2291
+ * Requires shell connectivity.
2292
+ * - 'local': Skips all shell contact. Grants all requested scopes locally.
2293
+ * Requires `accessToken` to be provided directly (e.g. from LP Login Service API).
2294
+ * Use this for local development when the shell is not running.
2295
+ *
2296
+ * @default 'shell'
2297
+ */
2298
+ mode?: 'shell' | 'local';
2299
+ /**
2300
+ * Skip app registration verification with the shell backend.
2301
+ * When true, the SDK will not call /api/v1/lp/{accountId}/sdk/init to verify
2302
+ * that the app is registered. Instead, it grants all requested scopes locally.
2303
+ *
2304
+ * Use this for local development when your app is not yet registered
2305
+ * for the target account in the LP Extend shell.
2306
+ *
2307
+ * WARNING: Do not enable in production — app registration ensures proper
2308
+ * scope governance and access control.
2309
+ *
2310
+ * @default false
2311
+ */
2312
+ skipRegistration?: boolean;
2207
2313
  }
2208
2314
  /**
2209
2315
  * SDK initialization result
@@ -3627,6 +3733,36 @@ declare class KnowledgeBasesAPI {
3627
3733
  * ```
3628
3734
  */
3629
3735
  getConsumerQueryMetricsExtended(params: CBConsumerQueryMetricsExtendedParams): Promise<CBConsumerQueryMetric[]>;
3736
+ /**
3737
+ * Get KB search events (real customer queries)
3738
+ *
3739
+ * Retrieves actual customer queries made to knowledge bases and their outcomes.
3740
+ * This API returns the raw questions customers asked, whether they were answered,
3741
+ * and which KB/articles were involved.
3742
+ *
3743
+ * @param request - Search events request parameters
3744
+ * @returns Promise resolving to search events with pagination
3745
+ *
3746
+ * @example
3747
+ * ```typescript
3748
+ * // Get unanswered questions from the last 7 days
3749
+ * const events = await sdk.conversationBuilder.knowledgeBases.getSearchEvents({
3750
+ * startTime: String(Date.now() - 7 * 24 * 60 * 60 * 1000),
3751
+ * endTime: String(Date.now()),
3752
+ * eventType: ['EVENT_KB_UN_ANSWERED'],
3753
+ * pageSize: 50,
3754
+ * });
3755
+ *
3756
+ * // Get all events for a specific KB
3757
+ * const kbEvents = await sdk.conversationBuilder.knowledgeBases.getSearchEvents({
3758
+ * startTime: String(Date.now() - 7 * 24 * 60 * 60 * 1000),
3759
+ * endTime: String(Date.now()),
3760
+ * kbId: 'kb-123',
3761
+ * eventType: ['EVENT_KB_ANSWERED', 'EVENT_KB_UN_ANSWERED'],
3762
+ * });
3763
+ * ```
3764
+ */
3765
+ getSearchEvents(request: CBKbSearchEventsRequest): Promise<CBKbSearchEventsResponse>;
3630
3766
  }
3631
3767
  /**
3632
3768
  * Bot Agents API
@@ -4012,6 +4148,41 @@ declare function initializeSDK(config: LPExtendSDKConfig): Promise<LPExtendSDK>;
4012
4148
  * ```
4013
4149
  */
4014
4150
  declare function createSDKFromEnv(extendToken: string): Promise<LPExtendSDK>;
4151
+ /**
4152
+ * Create an SDK in local mode — no shell required
4153
+ *
4154
+ * Convenience wrapper around `createSDK({ mode: 'local', ... })`.
4155
+ * Skips all shell verification and grants the requested scopes locally.
4156
+ *
4157
+ * Use this for local development when the shell is not running.
4158
+ * Obtain the `accessToken` from the LP Login Service API
4159
+ * (POST https://{domain}/api/account/{accountId}/login).
4160
+ *
4161
+ * @param config - SDK config (accessToken is required)
4162
+ * @returns Promise resolving to initialized SDK instance
4163
+ *
4164
+ * @example
4165
+ * ```typescript
4166
+ * import { createLocalSDK, Scopes } from '@lpextend/node-sdk';
4167
+ *
4168
+ * const sdk = await createLocalSDK({
4169
+ * appId: 'my-app',
4170
+ * accountId: '12345678',
4171
+ * accessToken: bearerTokenFromLPLogin,
4172
+ * scopes: [Scopes.SKILLS, Scopes.USERS],
4173
+ * });
4174
+ *
4175
+ * const { data: skills } = await sdk.skills.getAll();
4176
+ * ```
4177
+ */
4178
+ declare function createLocalSDK(config: {
4179
+ appId: string;
4180
+ accountId: string;
4181
+ accessToken: string;
4182
+ scopes?: string[];
4183
+ debug?: boolean;
4184
+ timeout?: number;
4185
+ }): Promise<LPExtendSDK>;
4015
4186
  /**
4016
4187
  * SDK Version
4017
4188
  */
@@ -4106,4 +4277,4 @@ type Scope = (typeof Scopes)[keyof typeof Scopes];
4106
4277
  */
4107
4278
  declare function getShellToken(config: ShellTokenConfig): Promise<ShellTokenResponse>;
4108
4279
 
4109
- export { type CreateConversationRequest$1 as AICreateConversationRequest, AIStudioAPI, type AIStudioCategory, type AIStudioConversation, type AIStudioFlow, type AIStudioMessage, type AIStudioSimulation, type AIStudioSummary, type AIStudioUser, AIStudioUsersAPI, type UpdateConversationRequest as AIUpdateConversationRequest, type APIResponse, type ActivityRecord, type AgentActivity, AgentActivityAPI, type AgentActivityQuery, AgentGroupsAPI, type AgentMetrics, AgentMetricsAPI, type AgentMetricsQuery, type AgentParticipant, type AgentStatus, type ApiKeyAuthResponse, AutomaticMessagesAPI, type BatchSummaryRequest, BotAgentsAPI, BotGroupsAPI, BotsAPI, type CBAddBotAgentRequest, type CBAllBotAgentsStatusQueryParams, type CBApiResponse, type CBAuthCredentials, type CBAuthInfo, type CBBot, type CBBotEnvironment, type CBBotGroup, type CBBotGroupsQueryParams, type CBBotInstanceStatus, type CBBotPlatform, type CBBotUser, type CBBotsByGroupQueryParams, type CBChatBot, type CBChatBotMetrics, type CBChatBotPlatformUser, type CBChatBotSummary, type CBChatBotSummaryList, type CBConsumerQueryEventType, type CBConsumerQueryMetric, type CBConsumerQueryMetricsExtendedParams, type CBConsumerQueryMetricsParams, type CBConsumerQueryMetricsResponse, type CBCredential, type CBDialog, type CBDialogGroup, type CBDialogTemplateSummary, type CBDomainList, type CBDuplicatePhrase, type CBDuplicatePhrases, type CBGlobalFunctions, type CBIntent, type CBInteraction, type CBInteractionContent, type CBInteractionList, type CBKAIOnDemandConfig, type CBKAISearchRequest, type CBKAISearchResponse, type CBKAISearchResultItem, type CBKBArticle, type CBKBArticlesQueryParams, type CBKBContentSource, type CBKBLandingPageMetrics, type CBKnowledgeBase, type CBKnowledgeBaseDetail, type CBKnowledgeBaseList, type CBLPAppCredentials, type CBLPSkill, type CBNLUDomain, type CBPCSBotsStatusQueryParams, type CBPageContext, type CBPaginatedResult, type CBResponder, type CBResponseMatch, type CBSuccessResult, type CBSyncStatusDetails, type CBTileData, CampaignsAPI, CategoriesAPI, type CloseConversationRequest, type CoBrowseSession, ConnectToMessagingAPI, type ConsumerParticipant, type ConsumerProfile, type ContentToRetrieve, ConversationBuilderAPI, type ConversationContext, type ConversationInteraction, type ConversationParticipant, type ConversationQueryParams, type ConversationSummary, type ConversationTransfer, ConversationsAPI, type CreateAIStudioUserRequest, type CreateAgentGroupRequest, type CreateAutomaticMessageRequest, type CreateCampaignRequest, type CreateCategoryRequest, type CreateConversationResponse, type CreateEngagementRequest, type CreateLOBRequest, type CreateLPPromptRequest, type CreatePredefinedContentRequest, type CreateProfileRequest, type CreatePromptRequest, type CreateSimulationRequest, type CreateSkillRequest, type CreateSpecialOccasionRequest, type CreateTranscriptAnalysisRequest, type CreateUserRequest, type CreateWorkingHoursRequest, DialogsAPI, EngagementsAPI, type ErrorCode, ErrorCodes, EvaluatorsAPI, type FileMessage, FlowsAPI, type GeneratedQuestion, type GeneratedRoute, GeneratorsAPI, type GuidedRoute, type GuidedRoutingEvaluationRequest, type GuidedRoutingEvaluationResponse, IntegrationsAPI, InteractionsAPI, type InvokeFlowRequest, type InvokeFlowResponse, type KAIRouteGenerationStatus, type KAIRouteGeneratorRequest, type KAIRouteGeneratorResponse, KnowledgeBasesAPI, type Knowledgebase, type KnowledgebaseHealth, type KnowledgebaseItem, type KnowledgebaseSearchRequest, type KnowledgebaseSearchResult, type KnowledgebaseTextItem, KnowledgebasesAPI, type LLMModel, type LLMProvider, LOBsAPI, type LPAgentGroup, type LPAutomaticMessage, type LPAutomaticMessageData, type LPCampaign, type LPEngagement, LPExtendSDK, type LPExtendSDKConfig, LPExtendSDKError, type LPLLMProviderModels, type LPLLMProviderSubscription, type LPLLMType, type LPLOB, type LPPermission, type LPPredefinedContent, type LPPredefinedContentData, type LPProfile, type LPPrompt, type LPPromptClientConfig, type LPPromptClientType, type LPPromptConfiguration, type LPPromptGenericConfig, type LPPromptStatus, type LPPromptVariable, type LPPromptVariableSourceType, type LPPromptVersionDetail, LPPromptsAPI, type LPPromptsQueryParams, type LPShift, type LPSkill, type LPSkillRoutingConfig, type LPSpecialOccasion, type LPSpecialOccasionEvent, type LPUser, type LPWorkingDay, type LPWorkingHours, type MemberOf, type MessageData, type MessageRecord, MessagingAPI, type MessagingConversation, type CreateConversationRequest as MessagingCreateConversationRequest, MessagingHistoryAPI, type MessagingHistoryQuery, type MessagingHistoryResponse, type MessagingInteraction, MessagingOperationsAPI, NLUDomainsAPI, type OutboundCampaignReport, type OutboundReportQuery, OutboundReportingAPI, type PaginatedResponse, PredefinedContentAPI, ProfilesAPI, type Prompt, PromptLibraryAPI, type PromptVariable, QueryAPI, type QueryGenerateRequest, type QueryGenerateResponse, type QuestionGeneratorRequest, type QuestionGeneratorResponse, type ResolutionEvaluationRequest, type ResolutionEvaluationResponse, type RichContentMessage, type SDEEvent, type SDERecord, type SDKInitResult, type Scope, Scopes, type SendMessageRequest, SentinelAPI, type SentinelAppSetting, type SentinelAppSettings, type SentinelAppUser, type SentinelAuthRequest, type SentinelCCUser, type SentinelDomainsResponse, type SentinelLoginUrlResponse, type SentinelLpToken, type SentinelLpUser, type SentinelManagerOf, type SentinelMemberOf, type SentinelProfile, type SentinelToken, type SentinelTokenExchange, type SentinelUserData, type SentinelUserSkill, type ShellTokenConfig, type ShellTokenResponse, type ShellTokenUser, type SimilarityEvaluationRequest, type SimilarityEvaluationResponse, type SimulationConfig, type SimulationJobResult, type SimulationQueryParams, type SimulationResults, type SimulationTestCase, SimulationsAPI, SkillsAPI, SpecialOccasionsAPI, SummaryAPI, type SummaryRequest, type SurveyRecord, type TextMessage, type TranscriptAnalysis, TranscriptAnalysisAPI, type TranscriptConversation, type TranscriptQuestion, type TransferConversationRequest, type UpdateAIStudioUserModelsRequest, type UpdateAIStudioUserRequest, type UpdateAgentGroupRequest, type UpdateAutomaticMessageRequest, type UpdateCampaignRequest, type UpdateCategoryRequest, type UpdateConversationAttributesRequest, type UpdateEngagementRequest, type UpdateLOBRequest, type UpdateLPPromptRequest, type UpdatePredefinedContentRequest, type UpdateProfileRequest, type UpdatePromptRequest, type UpdateSimulationRequest, type UpdateSkillRequest, type UpdateSpecialOccasionRequest, type UpdateTranscriptAnalysisRequest, type UpdateUserRequest, type UpdateWorkingHoursRequest, UsersAPI, VERSION, WorkingHoursAPI, createSDK, createSDKFromEnv, getShellToken, initializeSDK };
4280
+ export { type CreateConversationRequest$1 as AICreateConversationRequest, AIStudioAPI, type AIStudioCategory, type AIStudioConversation, type AIStudioFlow, type AIStudioMessage, type AIStudioSimulation, type AIStudioSummary, type AIStudioUser, AIStudioUsersAPI, type UpdateConversationRequest as AIUpdateConversationRequest, type APIResponse, type ActivityRecord, type AgentActivity, AgentActivityAPI, type AgentActivityQuery, AgentGroupsAPI, type AgentMetrics, AgentMetricsAPI, type AgentMetricsQuery, type AgentParticipant, type AgentStatus, type ApiKeyAuthResponse, AutomaticMessagesAPI, type BatchSummaryRequest, BotAgentsAPI, BotGroupsAPI, BotsAPI, type CBAddBotAgentRequest, type CBAllBotAgentsStatusQueryParams, type CBApiResponse, type CBAuthCredentials, type CBAuthInfo, type CBBot, type CBBotEnvironment, type CBBotGroup, type CBBotGroupsQueryParams, type CBBotInstanceStatus, type CBBotPlatform, type CBBotUser, type CBBotsByGroupQueryParams, type CBChatBot, type CBChatBotMetrics, type CBChatBotPlatformUser, type CBChatBotSummary, type CBChatBotSummaryList, type CBConsumerQueryEventType, type CBConsumerQueryMetric, type CBConsumerQueryMetricsExtendedParams, type CBConsumerQueryMetricsParams, type CBConsumerQueryMetricsResponse, type CBCredential, type CBDialog, type CBDialogGroup, type CBDialogTemplateSummary, type CBDomainList, type CBDuplicatePhrase, type CBDuplicatePhrases, type CBGlobalFunctions, type CBIntent, type CBInteraction, type CBInteractionContent, type CBInteractionList, type CBKAIOnDemandConfig, type CBKAISearchRequest, type CBKAISearchResponse, type CBKAISearchResultItem, type CBKBArticle, type CBKBArticlesQueryParams, type CBKBContentSource, type CBKBLandingPageMetrics, type CBKnowledgeBase, type CBKnowledgeBaseDetail, type CBKnowledgeBaseList, type CBLPAppCredentials, type CBLPSkill, type CBNLUDomain, type CBPCSBotsStatusQueryParams, type CBPageContext, type CBPaginatedResult, type CBResponder, type CBResponseMatch, type CBSuccessResult, type CBSyncStatusDetails, type CBTileData, CampaignsAPI, CategoriesAPI, type CloseConversationRequest, type CoBrowseSession, ConnectToMessagingAPI, type ConsumerParticipant, type ConsumerProfile, type ContentToRetrieve, ConversationBuilderAPI, type ConversationContext, type ConversationInteraction, type ConversationParticipant, type ConversationQueryParams, type ConversationSummary, type ConversationTransfer, ConversationsAPI, type CreateAIStudioUserRequest, type CreateAgentGroupRequest, type CreateAutomaticMessageRequest, type CreateCampaignRequest, type CreateCategoryRequest, type CreateConversationResponse, type CreateEngagementRequest, type CreateLOBRequest, type CreateLPPromptRequest, type CreatePredefinedContentRequest, type CreateProfileRequest, type CreatePromptRequest, type CreateSimulationRequest, type CreateSkillRequest, type CreateSpecialOccasionRequest, type CreateTranscriptAnalysisRequest, type CreateUserRequest, type CreateWorkingHoursRequest, DialogsAPI, EngagementsAPI, type ErrorCode, ErrorCodes, EvaluatorsAPI, type FileMessage, FlowsAPI, type GeneratedQuestion, type GeneratedRoute, GeneratorsAPI, type GuidedRoute, type GuidedRoutingEvaluationRequest, type GuidedRoutingEvaluationResponse, IntegrationsAPI, InteractionsAPI, type InvokeFlowRequest, type InvokeFlowResponse, type KAIRouteGenerationStatus, type KAIRouteGeneratorRequest, type KAIRouteGeneratorResponse, KnowledgeBasesAPI, type Knowledgebase, type KnowledgebaseHealth, type KnowledgebaseItem, type KnowledgebaseSearchRequest, type KnowledgebaseSearchResult, type KnowledgebaseTextItem, KnowledgebasesAPI, type LLMModel, type LLMProvider, LOBsAPI, type LPAgentGroup, type LPAutomaticMessage, type LPAutomaticMessageData, type LPCampaign, type LPEngagement, LPExtendSDK, type LPExtendSDKConfig, LPExtendSDKError, type LPLLMProviderModels, type LPLLMProviderSubscription, type LPLLMType, type LPLOB, type LPPermission, type LPPredefinedContent, type LPPredefinedContentData, type LPProfile, type LPPrompt, type LPPromptClientConfig, type LPPromptClientType, type LPPromptConfiguration, type LPPromptGenericConfig, type LPPromptStatus, type LPPromptVariable, type LPPromptVariableSourceType, type LPPromptVersionDetail, LPPromptsAPI, type LPPromptsQueryParams, type LPShift, type LPSkill, type LPSkillRoutingConfig, type LPSpecialOccasion, type LPSpecialOccasionEvent, type LPUser, type LPWorkingDay, type LPWorkingHours, type MemberOf, type MessageData, type MessageRecord, MessagingAPI, type MessagingConversation, type CreateConversationRequest as MessagingCreateConversationRequest, MessagingHistoryAPI, type MessagingHistoryQuery, type MessagingHistoryResponse, type MessagingInteraction, MessagingOperationsAPI, NLUDomainsAPI, type OutboundCampaignReport, type OutboundReportQuery, OutboundReportingAPI, type PaginatedResponse, PredefinedContentAPI, ProfilesAPI, type Prompt, PromptLibraryAPI, type PromptVariable, QueryAPI, type QueryGenerateRequest, type QueryGenerateResponse, type QuestionGeneratorRequest, type QuestionGeneratorResponse, type ResolutionEvaluationRequest, type ResolutionEvaluationResponse, type RichContentMessage, type SDEEvent, type SDERecord, type SDKInitResult, type Scope, Scopes, type SendMessageRequest, SentinelAPI, type SentinelAppSetting, type SentinelAppSettings, type SentinelAppUser, type SentinelAuthRequest, type SentinelCCUser, type SentinelDomainsResponse, type SentinelLoginUrlResponse, type SentinelLpToken, type SentinelLpUser, type SentinelManagerOf, type SentinelMemberOf, type SentinelProfile, type SentinelToken, type SentinelTokenExchange, type SentinelUserData, type SentinelUserSkill, type ShellTokenConfig, type ShellTokenResponse, type ShellTokenUser, type SimilarityEvaluationRequest, type SimilarityEvaluationResponse, type SimulationConfig, type SimulationJobResult, type SimulationQueryParams, type SimulationResults, type SimulationTestCase, SimulationsAPI, SkillsAPI, SpecialOccasionsAPI, SummaryAPI, type SummaryRequest, type SurveyRecord, type TextMessage, type TranscriptAnalysis, TranscriptAnalysisAPI, type TranscriptConversation, type TranscriptQuestion, type TransferConversationRequest, type UpdateAIStudioUserModelsRequest, type UpdateAIStudioUserRequest, type UpdateAgentGroupRequest, type UpdateAutomaticMessageRequest, type UpdateCampaignRequest, type UpdateCategoryRequest, type UpdateConversationAttributesRequest, type UpdateEngagementRequest, type UpdateLOBRequest, type UpdateLPPromptRequest, type UpdatePredefinedContentRequest, type UpdateProfileRequest, type UpdatePromptRequest, type UpdateSimulationRequest, type UpdateSkillRequest, type UpdateSpecialOccasionRequest, type UpdateTranscriptAnalysisRequest, type UpdateUserRequest, type UpdateWorkingHoursRequest, UsersAPI, VERSION, WorkingHoursAPI, createLocalSDK, createSDK, createSDKFromEnv, getShellToken, initializeSDK };
package/dist/index.js CHANGED
@@ -2149,6 +2149,57 @@ var KnowledgeBasesAPI = class {
2149
2149
  });
2150
2150
  return uniqueMetrics;
2151
2151
  }
2152
+ /**
2153
+ * Get KB search events (real customer queries)
2154
+ *
2155
+ * Retrieves actual customer queries made to knowledge bases and their outcomes.
2156
+ * This API returns the raw questions customers asked, whether they were answered,
2157
+ * and which KB/articles were involved.
2158
+ *
2159
+ * @param request - Search events request parameters
2160
+ * @returns Promise resolving to search events with pagination
2161
+ *
2162
+ * @example
2163
+ * ```typescript
2164
+ * // Get unanswered questions from the last 7 days
2165
+ * const events = await sdk.conversationBuilder.knowledgeBases.getSearchEvents({
2166
+ * startTime: String(Date.now() - 7 * 24 * 60 * 60 * 1000),
2167
+ * endTime: String(Date.now()),
2168
+ * eventType: ['EVENT_KB_UN_ANSWERED'],
2169
+ * pageSize: 50,
2170
+ * });
2171
+ *
2172
+ * // Get all events for a specific KB
2173
+ * const kbEvents = await sdk.conversationBuilder.knowledgeBases.getSearchEvents({
2174
+ * startTime: String(Date.now() - 7 * 24 * 60 * 60 * 1000),
2175
+ * endTime: String(Date.now()),
2176
+ * kbId: 'kb-123',
2177
+ * eventType: ['EVENT_KB_ANSWERED', 'EVENT_KB_UN_ANSWERED'],
2178
+ * });
2179
+ * ```
2180
+ */
2181
+ async getSearchEvents(request) {
2182
+ const body = {
2183
+ startTime: request.startTime,
2184
+ endTime: request.endTime
2185
+ };
2186
+ if (request.pageNumber !== void 0) {
2187
+ body.pageNumber = request.pageNumber;
2188
+ }
2189
+ if (request.pageSize !== void 0) {
2190
+ body.pageSize = request.pageSize;
2191
+ }
2192
+ if (request.eventType !== void 0) {
2193
+ body.eventType = request.eventType;
2194
+ }
2195
+ if (request.kbId !== void 0) {
2196
+ body.kbId = request.kbId;
2197
+ }
2198
+ return this.cb.request("cbKb", "/kb/searchEvents", {
2199
+ method: "POST",
2200
+ body
2201
+ });
2202
+ }
2152
2203
  };
2153
2204
  var BotAgentsAPI = class {
2154
2205
  constructor(cb) {
@@ -2347,6 +2398,26 @@ async function createSDK(config) {
2347
2398
  }
2348
2399
  }
2349
2400
  let accessToken = config.accessToken;
2401
+ if (config.mode === "local") {
2402
+ if (!accessToken) {
2403
+ throw new LPExtendSDKError(
2404
+ "Local mode requires accessToken to be provided directly. Use the LP Login Service API to obtain a bearer token.",
2405
+ ErrorCodes.INVALID_CONFIG
2406
+ );
2407
+ }
2408
+ if (debug) {
2409
+ console.log("[LP-Extend-SDK] Local mode \u2014 skipping shell verification");
2410
+ console.log("[LP-Extend-SDK] Granting scopes locally:", config.scopes || ["*"]);
2411
+ }
2412
+ const initResult = {
2413
+ appId: config.appId,
2414
+ accountId: config.accountId,
2415
+ grantedScopes: config.scopes || ["*"],
2416
+ appName: config.appId,
2417
+ version: "1.0.0"
2418
+ };
2419
+ return new LPExtendSDK({ ...config, accessToken }, initResult);
2420
+ }
2350
2421
  if (!accessToken && config.apiKey && config.extendToken) {
2351
2422
  const verifyUrl = `${shellBaseUrl}/api/v1/apps/verify`;
2352
2423
  if (debug) {
@@ -2585,6 +2656,20 @@ async function createSDK(config) {
2585
2656
  );
2586
2657
  }
2587
2658
  }
2659
+ if (config.skipRegistration) {
2660
+ if (debug) {
2661
+ console.log("[LP-Extend-SDK] skipRegistration=true \u2014 bypassing shell app verification");
2662
+ console.log("[LP-Extend-SDK] Granting scopes locally:", config.scopes || ["*"]);
2663
+ }
2664
+ const initResult = {
2665
+ appId: config.appId,
2666
+ accountId: config.accountId,
2667
+ grantedScopes: config.scopes || ["*"],
2668
+ appName: config.appId,
2669
+ version: "1.0.0"
2670
+ };
2671
+ return new LPExtendSDK({ ...config, accessToken }, initResult);
2672
+ }
2588
2673
  if (debug) {
2589
2674
  console.log("[LP-Extend-SDK] Verifying scopes with shell:", shellBaseUrl);
2590
2675
  }
@@ -2707,6 +2792,9 @@ async function createSDKFromEnv(extendToken) {
2707
2792
  debug
2708
2793
  });
2709
2794
  }
2795
+ async function createLocalSDK(config) {
2796
+ return createSDK({ ...config, mode: "local" });
2797
+ }
2710
2798
  var VERSION = "1.0.0";
2711
2799
  var Scopes = {
2712
2800
  // Account Configuration
@@ -2869,6 +2957,7 @@ exports.TranscriptAnalysisAPI = TranscriptAnalysisAPI;
2869
2957
  exports.UsersAPI = UsersAPI;
2870
2958
  exports.VERSION = VERSION;
2871
2959
  exports.WorkingHoursAPI = WorkingHoursAPI;
2960
+ exports.createLocalSDK = createLocalSDK;
2872
2961
  exports.createSDK = createSDK;
2873
2962
  exports.createSDKFromEnv = createSDKFromEnv;
2874
2963
  exports.getShellToken = getShellToken;