@deepdesk/deepdesk-sdk 14.2.1-beta.0 → 14.2.1-beta.2

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
@@ -457,9 +457,9 @@ declare class DeepdeskBrokerAPI {
457
457
  closeStream(platformSessionId: string): void;
458
458
  }
459
459
 
460
- type EvaluationOutput = CamelCaseKeys<Server.EvaluationOutput>;
460
+ type EvaluationOutput<T extends Server.ResponseFormat> = CamelCaseKeys<Server.EvaluationOutput<T>>;
461
461
  type State$f = {
462
- outputs: EvaluationOutput[];
462
+ cues: EvaluationOutput<'json-schema:cues'>;
463
463
  fetchState: FetchState;
464
464
  };
465
465
  type Transcript = Array<{
@@ -1008,18 +1008,25 @@ declare namespace Server {
1008
1008
  event: string;
1009
1009
  value: string;
1010
1010
  }
1011
- interface Cue {
1011
+ type ResponseFormat = 'text' | 'json-object' | 'json-schema:cues' | 'json-schema:knowledge-assist';
1012
+ interface LegacyCue {
1012
1013
  text: string;
1013
1014
  title: string;
1014
1015
  rule: Pick<Rule, 'id' | 'name' | 'label' | 'description'>;
1015
1016
  call_to_action?: CallToAction;
1016
1017
  }
1017
- interface EvaluationOutput {
1018
+ type EvaluationOutput<T extends ResponseFormat> = T extends 'text' ? string : T extends 'json-object' ? unknown : T extends 'json-schema:cues' ? Array<{
1018
1019
  code: string;
1019
1020
  name: string;
1020
1021
  response: string;
1021
1022
  call_to_action?: CallToAction;
1022
- }
1023
+ }> : T extends 'json-schema:knowledge-assist' ? Array<{
1024
+ answer: string;
1025
+ sources: {
1026
+ name: string;
1027
+ url: string;
1028
+ };
1029
+ }> : never;
1023
1030
  /**
1024
1031
  * Handling time event data
1025
1032
  */
@@ -1436,7 +1443,7 @@ declare class DeepdeskAPI {
1436
1443
  */
1437
1444
  evaluateRule<Payload = unknown>(label: string, conversationId: string, payload: Payload, opts?: {
1438
1445
  raiseForFailingConditions?: boolean;
1439
- }): Promise<CamelCaseKeys<Server.Cue[]>>;
1446
+ }): Promise<CamelCaseKeys<Server.LegacyCue[]>>;
1440
1447
  /**
1441
1448
  * Temporarily restore getSummary for more controlled rollout
1442
1449
  * @deprecated
@@ -1450,14 +1457,15 @@ declare class DeepdeskAPI {
1450
1457
  agentId?: string;
1451
1458
  externalConversationId?: string;
1452
1459
  }): Promise<CamelCaseKeys<Server.Summary>>;
1453
- evaluateAssistant<TInput = Record<string, unknown>>(assistantCode: string, options: {
1460
+ evaluateAssistant<TOutput extends Server.ResponseFormat = 'text', TInput = Record<string, unknown>>(assistantCode: string, options?: {
1461
+ expectFormat: TOutput;
1454
1462
  input: TInput;
1455
1463
  transcript?: Array<{
1456
1464
  source: string;
1457
1465
  text: string;
1458
1466
  }>;
1459
1467
  conversationId?: string;
1460
- }): Promise<CamelCaseKeys<Server.EvaluationOutput[]> | string>;
1468
+ }): Promise<CamelCaseKeys<Server.EvaluationOutput<TOutput>>>;
1461
1469
  getRules(): Promise<CamelCaseKeys<Server.Rule[]>>;
1462
1470
  translateMessages(params: TranslationRequest): Promise<TranslationResponse>;
1463
1471
  private handleDeepdeskVersionHeaders;
@@ -1672,7 +1680,7 @@ interface State$2 {
1672
1680
  fetchState: FetchState;
1673
1681
  }
1674
1682
 
1675
- type Cue = CamelCaseKeys<Server.Cue>;
1683
+ type Cue = CamelCaseKeys<Server.LegacyCue>;
1676
1684
  type State$1 = {
1677
1685
  cues: Cue[];
1678
1686
  fetchState: FetchState;
@@ -2312,19 +2320,17 @@ declare class DeepdeskSDK {
2312
2320
  evaluateRule(label: string, params?: Record<string, any>, options?: EvaluateRuleOptions): Promise<Cue[]>;
2313
2321
  /**
2314
2322
  * Evaluate assistant
2315
- * By default will show cues in widget
2323
+ * By default will expect cues and show them in the widget.
2324
+ * Disable cues in widget by providing `showCuesInWidget: false`-option.
2325
+ * `expectFormat` could be 'text', 'json-object', 'json-schema:cues' or 'json-schema:knowledge-assist'
2316
2326
  */
2317
- evaluateAssistant(assistantCode: string, options?: {
2327
+ evaluateAssistant<T extends Server.ResponseFormat = 'json-schema:cues'>(assistantCode: string, options?: {
2328
+ expectFormat?: T;
2318
2329
  input?: Record<string, any>;
2319
2330
  transcript?: TranscriptOption;
2320
2331
  includeTags?: boolean;
2321
2332
  showCuesInWidget?: boolean;
2322
- }): Promise<EvaluationOutput[] | string>;
2323
- /**
2324
- * @deprecated in favor of passing `payload` through `options` argument
2325
- * TODO: remove when integrations use first call signature
2326
- */
2327
- evaluateAssistant(assistantCode: string, payload?: Record<string, any>): Promise<EvaluationOutput[] | string>;
2333
+ }): Promise<EvaluationOutput<T> | string>;
2328
2334
  /**
2329
2335
  * Evaluate conversation lifecycle assistant
2330
2336
  * Convenient wrapper around `evaluateAssistant`.
package/dist/index.d.ts CHANGED
@@ -457,9 +457,9 @@ declare class DeepdeskBrokerAPI {
457
457
  closeStream(platformSessionId: string): void;
458
458
  }
459
459
 
460
- type EvaluationOutput = CamelCaseKeys<Server.EvaluationOutput>;
460
+ type EvaluationOutput<T extends Server.ResponseFormat> = CamelCaseKeys<Server.EvaluationOutput<T>>;
461
461
  type State$f = {
462
- outputs: EvaluationOutput[];
462
+ cues: EvaluationOutput<'json-schema:cues'>;
463
463
  fetchState: FetchState;
464
464
  };
465
465
  type Transcript = Array<{
@@ -1008,18 +1008,25 @@ declare namespace Server {
1008
1008
  event: string;
1009
1009
  value: string;
1010
1010
  }
1011
- interface Cue {
1011
+ type ResponseFormat = 'text' | 'json-object' | 'json-schema:cues' | 'json-schema:knowledge-assist';
1012
+ interface LegacyCue {
1012
1013
  text: string;
1013
1014
  title: string;
1014
1015
  rule: Pick<Rule, 'id' | 'name' | 'label' | 'description'>;
1015
1016
  call_to_action?: CallToAction;
1016
1017
  }
1017
- interface EvaluationOutput {
1018
+ type EvaluationOutput<T extends ResponseFormat> = T extends 'text' ? string : T extends 'json-object' ? unknown : T extends 'json-schema:cues' ? Array<{
1018
1019
  code: string;
1019
1020
  name: string;
1020
1021
  response: string;
1021
1022
  call_to_action?: CallToAction;
1022
- }
1023
+ }> : T extends 'json-schema:knowledge-assist' ? Array<{
1024
+ answer: string;
1025
+ sources: {
1026
+ name: string;
1027
+ url: string;
1028
+ };
1029
+ }> : never;
1023
1030
  /**
1024
1031
  * Handling time event data
1025
1032
  */
@@ -1436,7 +1443,7 @@ declare class DeepdeskAPI {
1436
1443
  */
1437
1444
  evaluateRule<Payload = unknown>(label: string, conversationId: string, payload: Payload, opts?: {
1438
1445
  raiseForFailingConditions?: boolean;
1439
- }): Promise<CamelCaseKeys<Server.Cue[]>>;
1446
+ }): Promise<CamelCaseKeys<Server.LegacyCue[]>>;
1440
1447
  /**
1441
1448
  * Temporarily restore getSummary for more controlled rollout
1442
1449
  * @deprecated
@@ -1450,14 +1457,15 @@ declare class DeepdeskAPI {
1450
1457
  agentId?: string;
1451
1458
  externalConversationId?: string;
1452
1459
  }): Promise<CamelCaseKeys<Server.Summary>>;
1453
- evaluateAssistant<TInput = Record<string, unknown>>(assistantCode: string, options: {
1460
+ evaluateAssistant<TOutput extends Server.ResponseFormat = 'text', TInput = Record<string, unknown>>(assistantCode: string, options?: {
1461
+ expectFormat: TOutput;
1454
1462
  input: TInput;
1455
1463
  transcript?: Array<{
1456
1464
  source: string;
1457
1465
  text: string;
1458
1466
  }>;
1459
1467
  conversationId?: string;
1460
- }): Promise<CamelCaseKeys<Server.EvaluationOutput[]> | string>;
1468
+ }): Promise<CamelCaseKeys<Server.EvaluationOutput<TOutput>>>;
1461
1469
  getRules(): Promise<CamelCaseKeys<Server.Rule[]>>;
1462
1470
  translateMessages(params: TranslationRequest): Promise<TranslationResponse>;
1463
1471
  private handleDeepdeskVersionHeaders;
@@ -1672,7 +1680,7 @@ interface State$2 {
1672
1680
  fetchState: FetchState;
1673
1681
  }
1674
1682
 
1675
- type Cue = CamelCaseKeys<Server.Cue>;
1683
+ type Cue = CamelCaseKeys<Server.LegacyCue>;
1676
1684
  type State$1 = {
1677
1685
  cues: Cue[];
1678
1686
  fetchState: FetchState;
@@ -2312,19 +2320,17 @@ declare class DeepdeskSDK {
2312
2320
  evaluateRule(label: string, params?: Record<string, any>, options?: EvaluateRuleOptions): Promise<Cue[]>;
2313
2321
  /**
2314
2322
  * Evaluate assistant
2315
- * By default will show cues in widget
2323
+ * By default will expect cues and show them in the widget.
2324
+ * Disable cues in widget by providing `showCuesInWidget: false`-option.
2325
+ * `expectFormat` could be 'text', 'json-object', 'json-schema:cues' or 'json-schema:knowledge-assist'
2316
2326
  */
2317
- evaluateAssistant(assistantCode: string, options?: {
2327
+ evaluateAssistant<T extends Server.ResponseFormat = 'json-schema:cues'>(assistantCode: string, options?: {
2328
+ expectFormat?: T;
2318
2329
  input?: Record<string, any>;
2319
2330
  transcript?: TranscriptOption;
2320
2331
  includeTags?: boolean;
2321
2332
  showCuesInWidget?: boolean;
2322
- }): Promise<EvaluationOutput[] | string>;
2323
- /**
2324
- * @deprecated in favor of passing `payload` through `options` argument
2325
- * TODO: remove when integrations use first call signature
2326
- */
2327
- evaluateAssistant(assistantCode: string, payload?: Record<string, any>): Promise<EvaluationOutput[] | string>;
2333
+ }): Promise<EvaluationOutput<T> | string>;
2328
2334
  /**
2329
2335
  * Evaluate conversation lifecycle assistant
2330
2336
  * Convenient wrapper around `evaluateAssistant`.