graphlit-client 1.0.20250622007 → 1.0.20250627001

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.
@@ -26,6 +26,10 @@ export declare class UIEventAdapter {
26
26
  private chunkQueue;
27
27
  private contextWindowUsage?;
28
28
  private finalMetrics?;
29
+ private reasoningContent;
30
+ private reasoningFormat?;
31
+ private reasoningSignature?;
32
+ private isInReasoning;
29
33
  constructor(onEvent: (event: AgentStreamEvent) => void, conversationId: string, options?: {
30
34
  smoothingEnabled?: boolean;
31
35
  chunkingStrategy?: ChunkingStrategy;
@@ -52,6 +56,9 @@ export declare class UIEventAdapter {
52
56
  private emitMessageUpdate;
53
57
  private emitUIEvent;
54
58
  private handleContextWindow;
59
+ private handleReasoningStart;
60
+ private handleReasoningDelta;
61
+ private handleReasoningEnd;
55
62
  /**
56
63
  * Clean up any pending timers
57
64
  */
@@ -25,6 +25,10 @@ export class UIEventAdapter {
25
25
  chunkQueue = []; // Queue of chunks waiting to be emitted
26
26
  contextWindowUsage;
27
27
  finalMetrics;
28
+ reasoningContent = "";
29
+ reasoningFormat;
30
+ reasoningSignature;
31
+ isInReasoning = false;
28
32
  constructor(onEvent, conversationId, options = {}) {
29
33
  this.onEvent = onEvent;
30
34
  this.conversationId = conversationId;
@@ -71,6 +75,15 @@ export class UIEventAdapter {
71
75
  case "context_window":
72
76
  this.handleContextWindow(event.usage);
73
77
  break;
78
+ case "reasoning_start":
79
+ this.handleReasoningStart(event.format);
80
+ break;
81
+ case "reasoning_delta":
82
+ this.handleReasoningDelta(event.content, event.format);
83
+ break;
84
+ case "reasoning_end":
85
+ this.handleReasoningEnd(event.fullContent, event.signature);
86
+ break;
74
87
  }
75
88
  }
76
89
  handleStart(conversationId) {
@@ -492,6 +505,48 @@ export class UIEventAdapter {
492
505
  timestamp: new Date(),
493
506
  });
494
507
  }
508
+ handleReasoningStart(format) {
509
+ if (process.env.DEBUG_GRAPHLIT_SDK_STREAMING) {
510
+ console.log(`🤔 [UIEventAdapter] Reasoning start - Format: ${format}`);
511
+ }
512
+ this.isInReasoning = true;
513
+ this.reasoningFormat = format;
514
+ this.reasoningContent = "";
515
+ }
516
+ handleReasoningDelta(content, format) {
517
+ if (process.env.DEBUG_GRAPHLIT_SDK_STREAMING) {
518
+ console.log(`🤔 [UIEventAdapter] Reasoning delta - Length: ${content.length}`);
519
+ }
520
+ this.reasoningContent += content;
521
+ this.reasoningFormat = format;
522
+ // Emit reasoning update
523
+ this.emitUIEvent({
524
+ type: "reasoning_update",
525
+ content: this.reasoningContent,
526
+ format: format,
527
+ isComplete: false,
528
+ });
529
+ }
530
+ handleReasoningEnd(fullContent, signature) {
531
+ if (process.env.DEBUG_GRAPHLIT_SDK_STREAMING) {
532
+ console.log(`🤔 [UIEventAdapter] Reasoning end - Final length: ${fullContent.length}, Has signature: ${!!signature}`);
533
+ if (signature) {
534
+ console.log(`🤔 [UIEventAdapter] Reasoning signature: ${signature}`);
535
+ }
536
+ }
537
+ this.isInReasoning = false;
538
+ this.reasoningContent = fullContent;
539
+ this.reasoningSignature = signature;
540
+ // Emit final reasoning update
541
+ if (this.reasoningFormat) {
542
+ this.emitUIEvent({
543
+ type: "reasoning_update",
544
+ content: fullContent,
545
+ format: this.reasoningFormat,
546
+ isComplete: true,
547
+ });
548
+ }
549
+ }
495
550
  /**
496
551
  * Clean up any pending timers
497
552
  */
@@ -57,4 +57,15 @@ export type StreamEvent = {
57
57
  percentage: number;
58
58
  remainingTokens: number;
59
59
  };
60
+ } | {
61
+ type: "reasoning_start";
62
+ format: "thinking_tag" | "markdown" | "custom";
63
+ } | {
64
+ type: "reasoning_delta";
65
+ content: string;
66
+ format: "thinking_tag" | "markdown" | "custom";
67
+ } | {
68
+ type: "reasoning_end";
69
+ fullContent: string;
70
+ signature?: string;
60
71
  };
@@ -3,6 +3,10 @@ import { ConversationMessage, ConversationToolCall } from "../generated/graphql-
3
3
  * Tool execution status for streaming
4
4
  */
5
5
  export type ToolExecutionStatus = "preparing" | "executing" | "ready" | "completed" | "failed";
6
+ /**
7
+ * Reasoning format types
8
+ */
9
+ export type ReasoningFormat = "thinking_tag" | "markdown" | "custom";
6
10
  /**
7
11
  * Context window usage event - emitted at start of agent interaction
8
12
  */
@@ -44,6 +48,11 @@ export type AgentStreamEvent = {
44
48
  status: ToolExecutionStatus;
45
49
  result?: unknown;
46
50
  error?: string;
51
+ } | {
52
+ type: "reasoning_update";
53
+ content: string;
54
+ format: ReasoningFormat;
55
+ isComplete: boolean;
47
56
  } | {
48
57
  type: "conversation_completed";
49
58
  message: ConversationMessage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphlit-client",
3
- "version": "1.0.20250622007",
3
+ "version": "1.0.20250627001",
4
4
  "description": "Graphlit API Client for TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/client.js",