graphlit-client 1.0.20260307002 → 1.0.20260307003

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.js CHANGED
@@ -5377,6 +5377,23 @@ class Graphlit {
5377
5377
  messages.push(messageToAdd);
5378
5378
  }
5379
5379
  }
5380
+ // Inject multimodal image data onto the last user message if provided.
5381
+ // formatConversation doesn't support mimeType/data, so we attach it here
5382
+ // so the LLM formatter (Anthropic, OpenAI, etc.) can build the proper
5383
+ // multimodal content block.
5384
+ if (mimeType && data) {
5385
+ // Find the last user message (the current prompt)
5386
+ for (let i = messages.length - 1; i >= 0; i--) {
5387
+ if (messages[i].role === Types.ConversationRoleTypes.User) {
5388
+ messages[i].mimeType = mimeType;
5389
+ messages[i].data = data;
5390
+ if (process.env.DEBUG_GRAPHLIT_SDK_STREAMING) {
5391
+ console.log(`\nšŸ–¼ļø [Streaming] Injected image data onto last user message: ${mimeType}, ${data.length} chars`);
5392
+ }
5393
+ break;
5394
+ }
5395
+ }
5396
+ }
5380
5397
  }
5381
5398
  else {
5382
5399
  // Fallback to single formatted message (for backward compatibility)
@@ -34,6 +34,7 @@ export declare class UIEventAdapter {
34
34
  private reasoningBuffer?;
35
35
  private reasoningEmitTimer?;
36
36
  private lastReasoningEmitTime;
37
+ private hasEmittedFirstReasoning;
37
38
  private static readonly REASONING_THROTTLE_MS;
38
39
  private usageData?;
39
40
  private hasToolCallsInProgress;
@@ -33,6 +33,7 @@ export class UIEventAdapter {
33
33
  reasoningBuffer;
34
34
  reasoningEmitTimer;
35
35
  lastReasoningEmitTime = 0;
36
+ hasEmittedFirstReasoning = false;
36
37
  static REASONING_THROTTLE_MS = 250;
37
38
  usageData;
38
39
  hasToolCallsInProgress = false;
@@ -120,6 +121,7 @@ export class UIEventAdapter {
120
121
  this.reasoningSignature = undefined;
121
122
  this.isInReasoning = false;
122
123
  this.lastReasoningEmitTime = 0;
124
+ this.hasEmittedFirstReasoning = false;
123
125
  if (this.reasoningEmitTimer) {
124
126
  globalThis.clearTimeout(this.reasoningEmitTimer);
125
127
  this.reasoningEmitTimer = undefined;
@@ -679,6 +681,7 @@ export class UIEventAdapter {
679
681
  this.reasoningFormat = format;
680
682
  this.reasoningContent = "";
681
683
  this.lastReasoningEmitTime = 0;
684
+ this.hasEmittedFirstReasoning = false;
682
685
  // Reset the reasoning buffer for a fresh thinking block
683
686
  if (this.reasoningBuffer) {
684
687
  this.reasoningBuffer.flush();
@@ -695,9 +698,17 @@ export class UIEventAdapter {
695
698
  this.reasoningContent += content;
696
699
  this.reasoningFormat = format;
697
700
  if (this.reasoningBuffer) {
698
- // Feed through sentence-level buffer — only emit when a complete
699
- // sentence is available. No partial-sentence heartbeat: reasoning
700
- // is secondary UI and handleReasoningEnd flushes the remainder.
701
+ // Emit the first delta immediately so the UI can show a "thinking"
702
+ // indicator without waiting for a sentence boundary.
703
+ if (!this.hasEmittedFirstReasoning) {
704
+ this.hasEmittedFirstReasoning = true;
705
+ this.reasoningBuffer.addToken(content);
706
+ this.emitReasoningUpdate();
707
+ return;
708
+ }
709
+ // Subsequent deltas: only emit when a complete sentence is available.
710
+ // No partial-sentence heartbeat — reasoning is secondary UI and
711
+ // handleReasoningEnd flushes the remainder.
701
712
  const sentences = this.reasoningBuffer.addToken(content);
702
713
  if (sentences.length > 0) {
703
714
  this.scheduleReasoningEmission();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphlit-client",
3
- "version": "1.0.20260307002",
3
+ "version": "1.0.20260307003",
4
4
  "description": "Graphlit API Client for TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/client.js",