graphlit-client 1.0.20260226002 → 1.0.20260226004

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;
@@ -207,6 +207,7 @@ export const GetAlert = gql `
207
207
  seed {
208
208
  id
209
209
  }
210
+ size
210
211
  }
211
212
  googleImage {
212
213
  model
@@ -214,6 +215,7 @@ export const GetAlert = gql `
214
215
  seed {
215
216
  id
216
217
  }
218
+ resolution
217
219
  }
218
220
  quiverImage {
219
221
  model
@@ -408,6 +410,7 @@ export const QueryAlerts = gql `
408
410
  seed {
409
411
  id
410
412
  }
413
+ size
411
414
  }
412
415
  googleImage {
413
416
  model
@@ -415,6 +418,7 @@ export const QueryAlerts = gql `
415
418
  seed {
416
419
  id
417
420
  }
421
+ resolution
418
422
  }
419
423
  quiverImage {
420
424
  model
@@ -7681,6 +7681,8 @@ export type GoogleImagePublishingProperties = {
7681
7681
  count?: Maybe<Scalars['Int']['output']>;
7682
7682
  /** The Google Image model. */
7683
7683
  model?: Maybe<GoogleImageModels>;
7684
+ /** The image resolution, optional. Defaults to 1K. */
7685
+ resolution?: Maybe<GoogleImageResolutionTypes>;
7684
7686
  /** The seed image reference to use when generating image(s), optional. */
7685
7687
  seed?: Maybe<EntityReference>;
7686
7688
  };
@@ -7690,9 +7692,22 @@ export type GoogleImagePublishingPropertiesInput = {
7690
7692
  count?: InputMaybe<Scalars['Int']['input']>;
7691
7693
  /** The Google Image model. */
7692
7694
  model?: InputMaybe<GoogleImageModels>;
7695
+ /** The image resolution, optional. Defaults to 1K. */
7696
+ resolution?: InputMaybe<GoogleImageResolutionTypes>;
7693
7697
  /** The seed image reference to use when generating image(s), optional. */
7694
7698
  seed?: InputMaybe<EntityReferenceInput>;
7695
7699
  };
7700
+ /** Google image resolution type */
7701
+ export declare enum GoogleImageResolutionTypes {
7702
+ /** 1K resolution (1024x1024 for 1:1) */
7703
+ Resolution_1K = "RESOLUTION_1_K",
7704
+ /** 2K resolution (2048x2048 for 1:1) */
7705
+ Resolution_2K = "RESOLUTION_2_K",
7706
+ /** 4K resolution (4096x4096 for 1:1) */
7707
+ Resolution_4K = "RESOLUTION_4_K",
7708
+ /** 512px resolution (512x512 for 1:1) */
7709
+ Resolution_512 = "RESOLUTION_512"
7710
+ }
7696
7711
  /** Represents Google model properties. */
7697
7712
  export type GoogleModelProperties = {
7698
7713
  __typename?: 'GoogleModelProperties';
@@ -15412,6 +15427,8 @@ export type OpenAiImagePublishingProperties = {
15412
15427
  model?: Maybe<OpenAiImageModels>;
15413
15428
  /** The seed image reference to use when generating image(s), optional. */
15414
15429
  seed?: Maybe<EntityReference>;
15430
+ /** The image size, optional. Defaults to Square (1024x1024). */
15431
+ size?: Maybe<OpenAiImageSizeTypes>;
15415
15432
  };
15416
15433
  /** Represents the OpenAI Image publishing properties. */
15417
15434
  export type OpenAiImagePublishingPropertiesInput = {
@@ -15421,7 +15438,20 @@ export type OpenAiImagePublishingPropertiesInput = {
15421
15438
  model?: InputMaybe<OpenAiImageModels>;
15422
15439
  /** The seed image reference to use when generating image(s), optional. */
15423
15440
  seed?: InputMaybe<EntityReferenceInput>;
15441
+ /** The image size, optional. Defaults to Square (1024x1024). */
15442
+ size?: InputMaybe<OpenAiImageSizeTypes>;
15424
15443
  };
15444
+ /** OpenAI image size type */
15445
+ export declare enum OpenAiImageSizeTypes {
15446
+ /** Auto (server-selected size) */
15447
+ Auto = "AUTO",
15448
+ /** Landscape (1536x1024) */
15449
+ Landscape = "LANDSCAPE",
15450
+ /** Portrait (1024x1536) */
15451
+ Portrait = "PORTRAIT",
15452
+ /** Square (1024x1024) */
15453
+ Square = "SQUARE"
15454
+ }
15425
15455
  /** Represents OpenAI model properties. */
15426
15456
  export type OpenAiModelProperties = {
15427
15457
  __typename?: 'OpenAIModelProperties';
@@ -22146,6 +22176,7 @@ export type GetAlertQuery = {
22146
22176
  __typename?: 'OpenAIImagePublishingProperties';
22147
22177
  model?: OpenAiImageModels | null;
22148
22178
  count?: number | null;
22179
+ size?: OpenAiImageSizeTypes | null;
22149
22180
  seed?: {
22150
22181
  __typename?: 'EntityReference';
22151
22182
  id: string;
@@ -22155,6 +22186,7 @@ export type GetAlertQuery = {
22155
22186
  __typename?: 'GoogleImagePublishingProperties';
22156
22187
  model?: GoogleImageModels | null;
22157
22188
  count?: number | null;
22189
+ resolution?: GoogleImageResolutionTypes | null;
22158
22190
  seed?: {
22159
22191
  __typename?: 'EntityReference';
22160
22192
  id: string;
@@ -22401,6 +22433,7 @@ export type QueryAlertsQuery = {
22401
22433
  __typename?: 'OpenAIImagePublishingProperties';
22402
22434
  model?: OpenAiImageModels | null;
22403
22435
  count?: number | null;
22436
+ size?: OpenAiImageSizeTypes | null;
22404
22437
  seed?: {
22405
22438
  __typename?: 'EntityReference';
22406
22439
  id: string;
@@ -22410,6 +22443,7 @@ export type QueryAlertsQuery = {
22410
22443
  __typename?: 'GoogleImagePublishingProperties';
22411
22444
  model?: GoogleImageModels | null;
22412
22445
  count?: number | null;
22446
+ resolution?: GoogleImageResolutionTypes | null;
22413
22447
  seed?: {
22414
22448
  __typename?: 'EntityReference';
22415
22449
  id: string;
@@ -1503,6 +1503,18 @@ export var GoogleImageModels;
1503
1503
  /** Gemini 3 Pro Image Preview */
1504
1504
  GoogleImageModels["Gemini_3ProImagePreview"] = "GEMINI_3_PRO_IMAGE_PREVIEW";
1505
1505
  })(GoogleImageModels || (GoogleImageModels = {}));
1506
+ /** Google image resolution type */
1507
+ export var GoogleImageResolutionTypes;
1508
+ (function (GoogleImageResolutionTypes) {
1509
+ /** 1K resolution (1024x1024 for 1:1) */
1510
+ GoogleImageResolutionTypes["Resolution_1K"] = "RESOLUTION_1_K";
1511
+ /** 2K resolution (2048x2048 for 1:1) */
1512
+ GoogleImageResolutionTypes["Resolution_2K"] = "RESOLUTION_2_K";
1513
+ /** 4K resolution (4096x4096 for 1:1) */
1514
+ GoogleImageResolutionTypes["Resolution_4K"] = "RESOLUTION_4_K";
1515
+ /** 512px resolution (512x512 for 1:1) */
1516
+ GoogleImageResolutionTypes["Resolution_512"] = "RESOLUTION_512";
1517
+ })(GoogleImageResolutionTypes || (GoogleImageResolutionTypes = {}));
1506
1518
  /** Google model type */
1507
1519
  export var GoogleModels;
1508
1520
  (function (GoogleModels) {
@@ -2248,6 +2260,18 @@ export var OpenAiImageModels;
2248
2260
  /** GPT Image-1 Mini */
2249
2261
  OpenAiImageModels["GptImage_1Mini"] = "GPT_IMAGE_1_MINI";
2250
2262
  })(OpenAiImageModels || (OpenAiImageModels = {}));
2263
+ /** OpenAI image size type */
2264
+ export var OpenAiImageSizeTypes;
2265
+ (function (OpenAiImageSizeTypes) {
2266
+ /** Auto (server-selected size) */
2267
+ OpenAiImageSizeTypes["Auto"] = "AUTO";
2268
+ /** Landscape (1536x1024) */
2269
+ OpenAiImageSizeTypes["Landscape"] = "LANDSCAPE";
2270
+ /** Portrait (1024x1536) */
2271
+ OpenAiImageSizeTypes["Portrait"] = "PORTRAIT";
2272
+ /** Square (1024x1024) */
2273
+ OpenAiImageSizeTypes["Square"] = "SQUARE";
2274
+ })(OpenAiImageSizeTypes || (OpenAiImageSizeTypes = {}));
2251
2275
  /** OpenAI model type */
2252
2276
  export var OpenAiModels;
2253
2277
  (function (OpenAiModels) {
@@ -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.20260226002",
3
+ "version": "1.0.20260226004",
4
4
  "description": "Graphlit API Client for TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/client.js",