graphlit-client 1.0.20260226003 → 1.0.20260226005

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/client.d.ts CHANGED
@@ -5,7 +5,7 @@ import { AgentOptions, AgentResult, StreamAgentOptions, ToolHandler } from "./ty
5
5
  import { AgentStreamEvent } from "./types/ui-events.js";
6
6
  export type { AgentOptions, AgentResult, ArtifactCollector, ContextStrategy, ContextManagementAction, StreamAgentOptions, ToolCallResult, UsageInfo, AgentError, } from "./types/agent.js";
7
7
  export { TokenBudgetTracker, truncateToolResult, estimateTokens, isAccurateTokenCounting, } from "./helpers/context-management.js";
8
- export type { AgentStreamEvent } from "./types/ui-events.js";
8
+ export type { AgentStreamEvent, ReasoningFormat, ReasoningMetadata, } from "./types/ui-events.js";
9
9
  export interface RetryConfig {
10
10
  /** Maximum number of retry attempts (default: 5) */
11
11
  maxAttempts?: number;
@@ -7663,6 +7663,37 @@ export type GoogleFeedPropertiesUpdateInput = {
7663
7663
  /** Google Cloud storage container prefix. */
7664
7664
  prefix?: InputMaybe<Scalars['String']['input']>;
7665
7665
  };
7666
+ /** Google image aspect ratio type */
7667
+ export declare enum GoogleImageAspectRatioTypes {
7668
+ /** Landscape (3:2) */
7669
+ Landscape_3X2 = "LANDSCAPE_3X2",
7670
+ /** Ultra wide landscape (4:1) */
7671
+ Landscape_4X1 = "LANDSCAPE_4X1",
7672
+ /** Landscape (4:3) */
7673
+ Landscape_4X3 = "LANDSCAPE_4X3",
7674
+ /** Landscape (5:4) */
7675
+ Landscape_5X4 = "LANDSCAPE_5X4",
7676
+ /** Ultra wide landscape (8:1) */
7677
+ Landscape_8X1 = "LANDSCAPE_8X1",
7678
+ /** Widescreen (16:9) */
7679
+ Landscape_16X9 = "LANDSCAPE_16X9",
7680
+ /** Ultrawide cinematic (21:9) */
7681
+ Landscape_21X9 = "LANDSCAPE_21X9",
7682
+ /** Tall portrait (1:4) */
7683
+ Portrait_1X4 = "PORTRAIT_1X4",
7684
+ /** Ultra tall portrait (1:8) */
7685
+ Portrait_1X8 = "PORTRAIT_1X8",
7686
+ /** Portrait (2:3) */
7687
+ Portrait_2X3 = "PORTRAIT_2X3",
7688
+ /** Portrait (3:4) */
7689
+ Portrait_3X4 = "PORTRAIT_3X4",
7690
+ /** Portrait (4:5) */
7691
+ Portrait_4X5 = "PORTRAIT_4X5",
7692
+ /** Vertical video (9:16) */
7693
+ Portrait_9X16 = "PORTRAIT_9X16",
7694
+ /** Square (1:1) */
7695
+ Square_1X1 = "SQUARE_1X1"
7696
+ }
7666
7697
  /** Google Image model type */
7667
7698
  export declare enum GoogleImageModels {
7668
7699
  /** Developer-specified model */
@@ -7677,6 +7708,8 @@ export declare enum GoogleImageModels {
7677
7708
  /** Represents the Google Image publishing properties. */
7678
7709
  export type GoogleImagePublishingProperties = {
7679
7710
  __typename?: 'GoogleImagePublishingProperties';
7711
+ /** The image aspect ratio, optional. Defaults to 1:1 square. */
7712
+ aspectRatio?: Maybe<GoogleImageAspectRatioTypes>;
7680
7713
  /** The number of images to generate, optional. Defaults to 1. */
7681
7714
  count?: Maybe<Scalars['Int']['output']>;
7682
7715
  /** The Google Image model. */
@@ -7688,6 +7721,8 @@ export type GoogleImagePublishingProperties = {
7688
7721
  };
7689
7722
  /** Represents the Google Image publishing properties. */
7690
7723
  export type GoogleImagePublishingPropertiesInput = {
7724
+ /** The image aspect ratio, optional. Defaults to 1:1 square. */
7725
+ aspectRatio?: InputMaybe<GoogleImageAspectRatioTypes>;
7691
7726
  /** The number of images to generate, optional. Defaults to 1. */
7692
7727
  count?: InputMaybe<Scalars['Int']['input']>;
7693
7728
  /** The Google Image model. */
@@ -16469,10 +16504,14 @@ export type Persona = {
16469
16504
  __typename?: 'Persona';
16470
16505
  /** The creation date of the persona. */
16471
16506
  creationDate: Scalars['DateTime']['output'];
16507
+ /** The display name of the persona. */
16508
+ displayName?: Maybe<Scalars['String']['output']>;
16472
16509
  /** The persona memories as fact references. */
16473
16510
  facts?: Maybe<Array<FactReference>>;
16474
16511
  /** The ID of the persona. */
16475
16512
  id: Scalars['ID']['output'];
16513
+ /** The external unique identifier of the persona. */
16514
+ identifier?: Maybe<Scalars['String']['output']>;
16476
16515
  /** The behavioral/communication instructions for this persona context. */
16477
16516
  instructions?: Maybe<Scalars['String']['output']>;
16478
16517
  /** The modified date of the persona. */
@@ -16481,12 +16520,16 @@ export type Persona = {
16481
16520
  name: Scalars['String']['output'];
16482
16521
  /** The owner of the persona. */
16483
16522
  owner: Owner;
16523
+ /** The origin platform of the persona. */
16524
+ platform?: Maybe<Scalars['String']['output']>;
16484
16525
  /** The relevance score of the persona. */
16485
16526
  relevance?: Maybe<Scalars['Float']['output']>;
16486
16527
  /** The contextual role of the persona. */
16487
16528
  role?: Maybe<Scalars['String']['output']>;
16488
16529
  /** The state of the persona (i.e. created, finished). */
16489
16530
  state: EntityState;
16531
+ /** The IANA timezone of the persona. */
16532
+ timezone?: Maybe<Scalars['String']['output']>;
16490
16533
  };
16491
16534
  /** Represents a filter for personas. */
16492
16535
  export type PersonaFilter = {
@@ -16498,6 +16541,8 @@ export type PersonaFilter = {
16498
16541
  direction?: InputMaybe<OrderDirectionTypes>;
16499
16542
  /** Filter persona(s) by their unique ID. */
16500
16543
  id?: InputMaybe<Scalars['ID']['input']>;
16544
+ /** Filter persona(s) by their external identifier. */
16545
+ identifier?: InputMaybe<Scalars['String']['input']>;
16501
16546
  /** Limit the number of persona(s) to be returned. Defaults to 100. */
16502
16547
  limit?: InputMaybe<Scalars['Int']['input']>;
16503
16548
  /** Filter persona(s) by their modified date range. */
@@ -16519,12 +16564,20 @@ export type PersonaFilter = {
16519
16564
  };
16520
16565
  /** Represents a persona. */
16521
16566
  export type PersonaInput = {
16567
+ /** The display name of the persona. */
16568
+ displayName?: InputMaybe<Scalars['String']['input']>;
16569
+ /** The external unique identifier of the persona. */
16570
+ identifier?: InputMaybe<Scalars['String']['input']>;
16522
16571
  /** The behavioral/communication instructions for this persona context. */
16523
16572
  instructions?: InputMaybe<Scalars['String']['input']>;
16524
16573
  /** The name of the persona. */
16525
16574
  name: Scalars['String']['input'];
16575
+ /** The origin platform of the persona. */
16576
+ platform?: InputMaybe<Scalars['String']['input']>;
16526
16577
  /** The contextual role of the persona. */
16527
16578
  role?: InputMaybe<Scalars['String']['input']>;
16579
+ /** The IANA timezone of the persona. */
16580
+ timezone?: InputMaybe<Scalars['String']['input']>;
16528
16581
  };
16529
16582
  /** Represents persona query results. */
16530
16583
  export type PersonaResults = {
@@ -16534,14 +16587,22 @@ export type PersonaResults = {
16534
16587
  };
16535
16588
  /** Represents a persona. */
16536
16589
  export type PersonaUpdateInput = {
16590
+ /** The display name of the persona. */
16591
+ displayName?: InputMaybe<Scalars['String']['input']>;
16537
16592
  /** The ID of the persona to update. */
16538
16593
  id: Scalars['ID']['input'];
16594
+ /** The external unique identifier of the persona. */
16595
+ identifier?: InputMaybe<Scalars['String']['input']>;
16539
16596
  /** The behavioral/communication instructions for this persona context. */
16540
16597
  instructions?: InputMaybe<Scalars['String']['input']>;
16541
16598
  /** The name of the persona. */
16542
16599
  name?: InputMaybe<Scalars['String']['input']>;
16600
+ /** The origin platform of the persona. */
16601
+ platform?: InputMaybe<Scalars['String']['input']>;
16543
16602
  /** The contextual role of the persona. */
16544
16603
  role?: InputMaybe<Scalars['String']['input']>;
16604
+ /** The IANA timezone of the persona. */
16605
+ timezone?: InputMaybe<Scalars['String']['input']>;
16545
16606
  };
16546
16607
  /** Represents a place. */
16547
16608
  export type Place = {
@@ -1491,6 +1491,38 @@ export var GoogleEmailAuthenticationTypes;
1491
1491
  GoogleEmailAuthenticationTypes["Connector"] = "CONNECTOR";
1492
1492
  GoogleEmailAuthenticationTypes["User"] = "USER";
1493
1493
  })(GoogleEmailAuthenticationTypes || (GoogleEmailAuthenticationTypes = {}));
1494
+ /** Google image aspect ratio type */
1495
+ export var GoogleImageAspectRatioTypes;
1496
+ (function (GoogleImageAspectRatioTypes) {
1497
+ /** Landscape (3:2) */
1498
+ GoogleImageAspectRatioTypes["Landscape_3X2"] = "LANDSCAPE_3X2";
1499
+ /** Ultra wide landscape (4:1) */
1500
+ GoogleImageAspectRatioTypes["Landscape_4X1"] = "LANDSCAPE_4X1";
1501
+ /** Landscape (4:3) */
1502
+ GoogleImageAspectRatioTypes["Landscape_4X3"] = "LANDSCAPE_4X3";
1503
+ /** Landscape (5:4) */
1504
+ GoogleImageAspectRatioTypes["Landscape_5X4"] = "LANDSCAPE_5X4";
1505
+ /** Ultra wide landscape (8:1) */
1506
+ GoogleImageAspectRatioTypes["Landscape_8X1"] = "LANDSCAPE_8X1";
1507
+ /** Widescreen (16:9) */
1508
+ GoogleImageAspectRatioTypes["Landscape_16X9"] = "LANDSCAPE_16X9";
1509
+ /** Ultrawide cinematic (21:9) */
1510
+ GoogleImageAspectRatioTypes["Landscape_21X9"] = "LANDSCAPE_21X9";
1511
+ /** Tall portrait (1:4) */
1512
+ GoogleImageAspectRatioTypes["Portrait_1X4"] = "PORTRAIT_1X4";
1513
+ /** Ultra tall portrait (1:8) */
1514
+ GoogleImageAspectRatioTypes["Portrait_1X8"] = "PORTRAIT_1X8";
1515
+ /** Portrait (2:3) */
1516
+ GoogleImageAspectRatioTypes["Portrait_2X3"] = "PORTRAIT_2X3";
1517
+ /** Portrait (3:4) */
1518
+ GoogleImageAspectRatioTypes["Portrait_3X4"] = "PORTRAIT_3X4";
1519
+ /** Portrait (4:5) */
1520
+ GoogleImageAspectRatioTypes["Portrait_4X5"] = "PORTRAIT_4X5";
1521
+ /** Vertical video (9:16) */
1522
+ GoogleImageAspectRatioTypes["Portrait_9X16"] = "PORTRAIT_9X16";
1523
+ /** Square (1:1) */
1524
+ GoogleImageAspectRatioTypes["Square_1X1"] = "SQUARE_1X1";
1525
+ })(GoogleImageAspectRatioTypes || (GoogleImageAspectRatioTypes = {}));
1494
1526
  /** Google Image model type */
1495
1527
  export var GoogleImageModels;
1496
1528
  (function (GoogleImageModels) {
@@ -66,6 +66,11 @@ export declare class UIEventAdapter {
66
66
  private handleReasoningStart;
67
67
  private handleReasoningDelta;
68
68
  private handleReasoningEnd;
69
+ /**
70
+ * Build a ReasoningMetadata object from accumulated reasoning state.
71
+ * Returns undefined when no reasoning content has been captured.
72
+ */
73
+ private buildReasoningMetadata;
69
74
  /**
70
75
  * Clean up any pending timers
71
76
  */
@@ -107,6 +107,11 @@ export class UIEventAdapter {
107
107
  this.lastTokenTime = 0;
108
108
  this.tokenCount = 0;
109
109
  this.tokenDelays = [];
110
+ // Reset reasoning state so stale thinking from a prior round doesn't leak
111
+ this.reasoningContent = "";
112
+ this.reasoningFormat = undefined;
113
+ this.reasoningSignature = undefined;
114
+ this.isInReasoning = false;
110
115
  // Reset tool call tracking flags
111
116
  this.hasToolCallsInProgress = false;
112
117
  this.hadToolCallsBeforeResume = false;
@@ -436,12 +441,21 @@ export class UIEventAdapter {
436
441
  }
437
442
  return; // Exit without emitting conversation_completed
438
443
  }
444
+ // Attach reasoning metadata to the final message
445
+ const reasoning = this.buildReasoningMetadata();
446
+ if (reasoning) {
447
+ finalMessage.isThinking = true;
448
+ finalMessage.thinkingContent = reasoning.content;
449
+ }
439
450
  // Include context window usage if available
440
451
  const event = {
441
452
  type: "conversation_completed",
442
453
  message: finalMessage,
443
454
  metrics: finalMetrics,
444
455
  };
456
+ if (reasoning) {
457
+ event.reasoning = reasoning;
458
+ }
445
459
  if (this.contextWindowUsage) {
446
460
  event.contextWindow = this.contextWindowUsage;
447
461
  }
@@ -599,12 +613,22 @@ export class UIEventAdapter {
599
613
  metrics.streamingThroughput = Math.round((this.currentMessage.length / streamingTime) * 1000);
600
614
  }
601
615
  }
602
- this.emitUIEvent({
616
+ // Attach reasoning metadata to the message and event
617
+ const reasoning = this.buildReasoningMetadata();
618
+ if (reasoning) {
619
+ message.isThinking = true;
620
+ message.thinkingContent = reasoning.content;
621
+ }
622
+ const event = {
603
623
  type: "message_update",
604
624
  message,
605
625
  isStreaming,
606
626
  metrics,
607
- });
627
+ };
628
+ if (reasoning) {
629
+ event.reasoning = reasoning;
630
+ }
631
+ this.emitUIEvent(event);
608
632
  }
609
633
  emitUIEvent(event) {
610
634
  this.onEvent(event);
@@ -674,6 +698,23 @@ export class UIEventAdapter {
674
698
  });
675
699
  }
676
700
  }
701
+ /**
702
+ * Build a ReasoningMetadata object from accumulated reasoning state.
703
+ * Returns undefined when no reasoning content has been captured.
704
+ */
705
+ buildReasoningMetadata() {
706
+ if (!this.reasoningContent || !this.reasoningFormat) {
707
+ return undefined;
708
+ }
709
+ const metadata = {
710
+ content: this.reasoningContent,
711
+ format: this.reasoningFormat,
712
+ };
713
+ if (this.reasoningSignature) {
714
+ metadata.signature = this.reasoningSignature;
715
+ }
716
+ return metadata;
717
+ }
677
718
  /**
678
719
  * Clean up any pending timers
679
720
  */
@@ -21,12 +21,24 @@ export type ContextWindowEvent = {
21
21
  };
22
22
  timestamp: Date;
23
23
  };
24
+ /**
25
+ * Structured reasoning/thinking metadata.
26
+ * Provides a canonical representation across all providers so the UI
27
+ * can decide whether and how to render model reasoning.
28
+ */
29
+ export type ReasoningMetadata = {
30
+ content: string;
31
+ format: ReasoningFormat;
32
+ signature?: string;
33
+ };
24
34
  /**
25
35
  * Extended conversation message with additional streaming metadata
26
36
  */
27
37
  export type StreamingConversationMessage = Partial<ConversationMessage> & {
28
38
  message: string;
29
39
  modelName?: string;
40
+ isThinking?: boolean;
41
+ thinkingContent?: string;
30
42
  };
31
43
  /**
32
44
  * Simplified UI-focused streaming events using GraphQL types
@@ -58,6 +70,7 @@ export type AgentStreamEvent = {
58
70
  type: "message_update";
59
71
  message: StreamingConversationMessage;
60
72
  isStreaming: boolean;
73
+ reasoning?: ReasoningMetadata;
61
74
  metrics?: {
62
75
  ttft?: number;
63
76
  elapsedTime: number;
@@ -80,6 +93,7 @@ export type AgentStreamEvent = {
80
93
  } | {
81
94
  type: "conversation_completed";
82
95
  message: StreamingConversationMessage;
96
+ reasoning?: ReasoningMetadata;
83
97
  metrics?: {
84
98
  ttft?: number;
85
99
  totalTime: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphlit-client",
3
- "version": "1.0.20260226003",
3
+ "version": "1.0.20260226005",
4
4
  "description": "Graphlit API Client for TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/client.js",