lumnisai 0.1.0 → 0.1.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/README.md CHANGED
@@ -10,7 +10,6 @@ Official Node.js/TypeScript SDK for the Lumnis AI API. Build AI-powered applicat
10
10
 
11
11
  ## Features
12
12
 
13
- - 🚀 **Full API Coverage** - All 60+ endpoints across 9 resources
14
13
  - 📦 **TypeScript First** - Complete type safety and autocompletion
15
14
  - ⚡ **Modern Architecture** - Built with ES modules and async/await
16
15
  - 📁 **File Management** - Upload, search, and manage files with semantic search
@@ -61,7 +60,6 @@ console.log(response.outputText)
61
60
  const completedResponse = await client.createResponseAndWait(
62
61
  'Explain quantum computing',
63
62
  {
64
- agentEffort: 'high',
65
63
  responseFormat: {
66
64
  type: 'object',
67
65
  properties: {
@@ -80,6 +78,9 @@ console.log(completedResponse.structuredResponse)
80
78
 
81
79
  ```typescript
82
80
  // Simple message
81
+ // Streaming responses with progress updates
82
+ import { displayProgress } from 'lumnisai'
83
+
83
84
  const response = await client.responses.create({
84
85
  messages: [{ role: 'user', content: 'Hello!' }]
85
86
  })
@@ -90,9 +91,7 @@ const response = await client.responses.create({
90
91
  messages: [
91
92
  { role: 'system', content: 'You are a helpful assistant' },
92
93
  { role: 'user', content: 'What can you help me with?' }
93
- ],
94
- agentEffort: 'medium',
95
- costCapUsd: 0.50
94
+ ]
96
95
  })
97
96
 
98
97
  // With structured output
@@ -109,11 +108,50 @@ const response = await client.responses.create({
109
108
  }
110
109
  })
111
110
 
111
+ // Using the invoke method (simpler API)
112
+ const response = await client.invoke(
113
+ 'Explain quantum computing',
114
+ {
115
+ showProgress: true, // Show progress updates in console
116
+ pollIntervalMs: 1000,
117
+ maxWaitMs: 60000
118
+ }
119
+ )
120
+
121
+ const updates: any[] = []
122
+ for await (const update of await client.invoke(
123
+ 'Analyze this data',
124
+ {
125
+ stream: true,
126
+ userId: 'user@example.com',
127
+ agentConfig: {
128
+ plannerModelType: 'SMART_MODEL',
129
+ coordinatorModelType: 'REASONING_MODEL'
130
+ }
131
+ }
132
+ )) {
133
+ displayProgress(update) // Display progress with tool calls
134
+ updates.push(update)
135
+ }
136
+
137
+ // Access final output
138
+ const finalUpdate = updates[updates.length - 1]
139
+ if (finalUpdate.outputText) {
140
+ console.log(finalUpdate.outputText)
141
+ }
142
+
143
+ // With agent mode option
144
+ const response = await client.responses.create({
145
+ messages: [{ role: 'user', content: 'Analyze complex data patterns' }],
146
+ options: {
147
+ agent_mode: 'multi_agent'
148
+ }
149
+ })
150
+
112
151
  // With advanced agent configuration
113
152
  const response = await client.responses.create({
114
153
  messages: [{ role: 'user', content: 'Analyze this data' }],
115
154
  agentConfig: {
116
- planStrategy: 'llm_io',
117
155
  plannerModelType: 'SMART_MODEL',
118
156
  coordinatorModelType: 'REASONING_MODEL',
119
157
  orchestratorModelType: 'SMART_MODEL',
@@ -158,6 +196,67 @@ const completedResponse = await client.createResponseAndWait(
158
196
  const response = await client.responses.get(responseId, { wait: 30 })
159
197
  ```
160
198
 
199
+ ### Progress Display Utilities
200
+
201
+ The SDK provides utilities for displaying progress updates with tool calls:
202
+
203
+ ```typescript
204
+ import { displayProgress, formatProgressEntry, ProgressTracker } from 'lumnisai'
205
+
206
+ // Simple display with automatic tool call formatting
207
+ for await (const update of await client.invoke(task, { stream: true })) {
208
+ displayProgress(update) // Automatically formats message and tool calls
209
+ }
210
+
211
+ // Custom formatting
212
+ for await (const update of await client.invoke(task, { stream: true })) {
213
+ if (update.state === 'tool_update') {
214
+ // Only tool calls are shown for tool_update entries
215
+ displayProgress(update)
216
+ }
217
+ else {
218
+ // Full message with tool calls
219
+ displayProgress(update, ' ') // Custom indentation
220
+ }
221
+ }
222
+
223
+ // Manual formatting
224
+ const formatted = formatProgressEntry(
225
+ 'processing',
226
+ 'Analyzing data',
227
+ [
228
+ { name: 'read_file', args: { path: '/data.csv' } },
229
+ { name: 'calculate_stats', args: { method: 'mean' } }
230
+ ]
231
+ )
232
+ console.log(formatted)
233
+ // Output:
234
+ // PROCESSING: Analyzing data
235
+ // → read_file(path="/data.csv")
236
+ // → calculate_stats(method="mean")
237
+
238
+ // Advanced: Track duplicates
239
+ const tracker = new ProgressTracker()
240
+
241
+ for await (const update of await client.invoke(task, { stream: true })) {
242
+ const newContent = tracker.formatNewEntries(
243
+ update.state,
244
+ update.message,
245
+ update.toolCalls
246
+ )
247
+
248
+ if (newContent) {
249
+ console.log(newContent) // Only new content is displayed
250
+ }
251
+ }
252
+ ```
253
+
254
+ The `displayProgress` function automatically handles:
255
+ - **Regular updates**: Displays message + tool calls with proper formatting
256
+ - **Tool updates**: Shows only new tool calls (when `state === 'tool_update'`)
257
+ - **Completed state**: Shows final message with output text
258
+ - **Compact formatting**: Tool arguments are formatted concisely
259
+
161
260
  ### Managing Threads
162
261
 
163
262
  ```typescript
@@ -439,7 +538,6 @@ The SDK is written in TypeScript and provides comprehensive type definitions:
439
538
  ```typescript
440
539
  import type {
441
540
  AgentConfig,
442
- AgentEffort,
443
541
  FileMetadata,
444
542
  FileScope,
445
543
  Message,
@@ -450,17 +548,6 @@ import type {
450
548
  } from 'lumnisai'
451
549
  ```
452
550
 
453
- ## Best Practices
454
-
455
- 1. **Use Idempotency Keys** - The SDK automatically adds idempotency keys to non-GET requests
456
- 2. **Handle Rate Limits** - Implement exponential backoff when receiving 429 errors
457
- 3. **Poll Efficiently** - Use long polling with the `wait` parameter for real-time updates
458
- 4. **Scope to Users** - Use user-specific operations for multi-tenant applications
459
- 5. **Manage Costs** - Set `costCapUsd` to control spending on expensive operations
460
- 6. **Tag Your Files** - Use tags for better file organization and filtering
461
- 7. **Monitor Processing** - Check file processing status with `files.getStatus()`
462
- 8. **Use Semantic Search** - Leverage `files.search()` for powerful content discovery
463
-
464
551
  ## License
465
552
 
466
553
  [MIT](./LICENSE) License © Lumnis AI
package/dist/index.cjs CHANGED
@@ -917,14 +917,37 @@ class LumnisClient {
917
917
  const response = await this._createResponse(messages, options);
918
918
  console.log(`Response ID: ${response.responseId}`);
919
919
  let lastMessageCount = 0;
920
+ const toolCallCounts = /* @__PURE__ */ new Map();
920
921
  while (true) {
921
922
  const current = await this.responses.get(response.responseId, { wait: LONG_POLL_TIMEOUT_S });
922
923
  const currentMessageCount = current.progress?.length || 0;
923
924
  if (currentMessageCount > lastMessageCount && current.progress) {
924
- for (let i = lastMessageCount; i < currentMessageCount; i++)
925
- yield current.progress[i];
925
+ for (let i = lastMessageCount; i < currentMessageCount; i++) {
926
+ const entry = current.progress[i];
927
+ toolCallCounts.set(i, entry.toolCalls?.length || 0);
928
+ yield entry;
929
+ }
926
930
  lastMessageCount = currentMessageCount;
927
931
  }
932
+ if (current.progress) {
933
+ for (let i = 0; i < Math.min(lastMessageCount, currentMessageCount); i++) {
934
+ const entry = current.progress[i];
935
+ const currentToolCallCount = entry.toolCalls?.length || 0;
936
+ const previousToolCallCount = toolCallCounts.get(i) || 0;
937
+ if (currentToolCallCount > previousToolCallCount) {
938
+ const newToolCalls = entry.toolCalls?.slice(previousToolCallCount) || [];
939
+ const truncatedMessage = entry.message.length > 50 ? `${entry.message.substring(0, 50)}...` : entry.message;
940
+ const toolUpdateEntry = {
941
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
942
+ state: "tool_update",
943
+ message: `[Tool calls for: ${truncatedMessage}]`,
944
+ toolCalls: newToolCalls
945
+ };
946
+ yield toolUpdateEntry;
947
+ toolCallCounts.set(i, currentToolCallCount);
948
+ }
949
+ }
950
+ }
928
951
  if (current.status === "succeeded" || current.status === "failed" || current.status === "cancelled") {
929
952
  if (current.status === "succeeded" && current.outputText) {
930
953
  const progressEntry = {
@@ -937,6 +960,7 @@ class LumnisClient {
937
960
  }
938
961
  break;
939
962
  }
963
+ await new Promise((resolve) => setTimeout(resolve, DEFAULT_POLL_INTERVAL_MS));
940
964
  }
941
965
  }
942
966
  async _invokeAndWait(messages, options, progressCallback) {
@@ -1082,9 +1106,9 @@ class LumnisClient {
1082
1106
  function createSimpleProgressCallback() {
1083
1107
  let lastStatus;
1084
1108
  const seenMessages = /* @__PURE__ */ new Set();
1109
+ const messageToolCalls = /* @__PURE__ */ new Map();
1085
1110
  return (response) => {
1086
1111
  if (response.status !== lastStatus) {
1087
- console.log(`Status: ${response.status}`);
1088
1112
  lastStatus = response.status;
1089
1113
  }
1090
1114
  if (response.progress) {
@@ -1093,18 +1117,135 @@ function createSimpleProgressCallback() {
1093
1117
  if (!seenMessages.has(messageKey)) {
1094
1118
  console.log(`${entry.state.toUpperCase()}: ${entry.message}`);
1095
1119
  seenMessages.add(messageKey);
1120
+ messageToolCalls.set(messageKey, /* @__PURE__ */ new Set());
1121
+ }
1122
+ if (entry.toolCalls && messageToolCalls.has(messageKey)) {
1123
+ const seenToolCalls = messageToolCalls.get(messageKey);
1124
+ for (const toolCall of entry.toolCalls) {
1125
+ const toolName = toolCall.name || "unknown";
1126
+ const toolArgs = toolCall.args || {};
1127
+ const toolKey = `${toolName}:${JSON.stringify(toolArgs)}`;
1128
+ if (!seenToolCalls.has(toolKey)) {
1129
+ process.stdout.write(` \u2192 ${toolName}`);
1130
+ if (Object.keys(toolArgs).length > 0) {
1131
+ const argsStr = Object.entries(toolArgs).map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(", ");
1132
+ console.log(`(${argsStr})`);
1133
+ } else {
1134
+ console.log();
1135
+ }
1136
+ seenToolCalls.add(toolKey);
1137
+ }
1138
+ }
1096
1139
  }
1097
1140
  }
1098
1141
  }
1099
1142
  };
1100
1143
  }
1101
1144
 
1145
+ function displayProgress(update, indent = " ") {
1146
+ if (update.state === "tool_update") {
1147
+ if (update.toolCalls && update.toolCalls.length > 0) {
1148
+ for (const toolCall of update.toolCalls) {
1149
+ const toolName = toolCall.name || "unknown";
1150
+ const toolArgs = toolCall.args || {};
1151
+ process.stdout.write(`${indent}\u2192 ${toolName}`);
1152
+ if (Object.keys(toolArgs).length > 0) {
1153
+ const argsStr = Object.entries(toolArgs).map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(", ");
1154
+ console.log(`(${argsStr})`);
1155
+ } else {
1156
+ console.log();
1157
+ }
1158
+ }
1159
+ }
1160
+ } else {
1161
+ console.log(`${update.state.toUpperCase()} - ${update.message}`);
1162
+ if (update.toolCalls && update.toolCalls.length > 0) {
1163
+ for (const toolCall of update.toolCalls) {
1164
+ const toolName = toolCall.name || "unknown";
1165
+ const toolArgs = toolCall.args || {};
1166
+ process.stdout.write(`${indent}\u2192 ${toolName}`);
1167
+ if (Object.keys(toolArgs).length > 0) {
1168
+ const argsStr = Object.entries(toolArgs).map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(", ");
1169
+ console.log(`(${argsStr})`);
1170
+ } else {
1171
+ console.log();
1172
+ }
1173
+ }
1174
+ }
1175
+ }
1176
+ }
1177
+ function formatProgressEntry(state, message, toolCalls) {
1178
+ const lines = [`${state.toUpperCase()}: ${message}`];
1179
+ if (toolCalls && toolCalls.length > 0) {
1180
+ for (const toolCall of toolCalls) {
1181
+ const toolName = toolCall.name || "unknown";
1182
+ const toolArgs = toolCall.args || {};
1183
+ if (Object.keys(toolArgs).length > 0) {
1184
+ const argsStr = Object.entries(toolArgs).map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(", ");
1185
+ lines.push(` \u2192 ${toolName}(${argsStr})`);
1186
+ } else {
1187
+ lines.push(` \u2192 ${toolName}`);
1188
+ }
1189
+ }
1190
+ }
1191
+ return lines.join("\n");
1192
+ }
1193
+ class ProgressTracker {
1194
+ seenMessages = /* @__PURE__ */ new Set();
1195
+ messageToolCalls = /* @__PURE__ */ new Map();
1196
+ /**
1197
+ * Format new progress entries, returning null if nothing new to display.
1198
+ *
1199
+ * @param state - The state of the progress entry
1200
+ * @param message - The progress message
1201
+ * @param toolCalls - Optional list of tool calls
1202
+ * @returns Formatted string if there are new entries to display, null otherwise
1203
+ */
1204
+ formatNewEntries(state, message, toolCalls) {
1205
+ const messageKey = `${state}:${message}`;
1206
+ const outputLines = [];
1207
+ if (!this.seenMessages.has(messageKey)) {
1208
+ outputLines.push(`${state.toUpperCase()}: ${message}`);
1209
+ this.seenMessages.add(messageKey);
1210
+ this.messageToolCalls.set(messageKey, /* @__PURE__ */ new Set());
1211
+ }
1212
+ if (toolCalls && this.messageToolCalls.has(messageKey)) {
1213
+ const seenToolCalls = this.messageToolCalls.get(messageKey);
1214
+ for (const toolCall of toolCalls) {
1215
+ const toolName = toolCall.name || "unknown";
1216
+ const toolArgs = toolCall.args || {};
1217
+ const toolKey = `${toolName}:${JSON.stringify(toolArgs)}`;
1218
+ if (!seenToolCalls.has(toolKey)) {
1219
+ if (Object.keys(toolArgs).length > 0) {
1220
+ const argsStr = Object.entries(toolArgs).map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(", ");
1221
+ outputLines.push(` \u2192 ${toolName}(${argsStr})`);
1222
+ } else {
1223
+ outputLines.push(` \u2192 ${toolName}`);
1224
+ }
1225
+ seenToolCalls.add(toolKey);
1226
+ }
1227
+ }
1228
+ }
1229
+ return outputLines.length > 0 ? outputLines.join("\n") : null;
1230
+ }
1231
+ /**
1232
+ * Reset the tracker to start fresh.
1233
+ */
1234
+ reset() {
1235
+ this.seenMessages.clear();
1236
+ this.messageToolCalls.clear();
1237
+ }
1238
+ }
1239
+
1102
1240
  exports.AuthenticationError = AuthenticationError;
1103
1241
  exports.InternalServerError = InternalServerError;
1104
1242
  exports.LocalFileNotSupportedError = LocalFileNotSupportedError;
1105
1243
  exports.LumnisClient = LumnisClient;
1106
1244
  exports.LumnisError = LumnisError;
1107
1245
  exports.NotFoundError = NotFoundError;
1246
+ exports.ProgressTracker = ProgressTracker;
1108
1247
  exports.RateLimitError = RateLimitError;
1109
1248
  exports.ValidationError = ValidationError;
1110
1249
  exports.default = LumnisClient;
1250
+ exports.displayProgress = displayProgress;
1251
+ exports.formatProgressEntry = formatProgressEntry;
package/dist/index.d.cts CHANGED
@@ -252,7 +252,6 @@ interface ModelAvailability {
252
252
  }
253
253
 
254
254
  type ResponseStatus = 'queued' | 'in_progress' | 'succeeded' | 'failed' | 'cancelled';
255
- type AgentEffort = 'low' | 'medium' | 'high';
256
255
  interface FileAttachment {
257
256
  name: string;
258
257
  uri: string;
@@ -260,7 +259,6 @@ interface FileAttachment {
260
259
  sizeBytes?: number | null;
261
260
  }
262
261
  interface AgentConfig {
263
- planStrategy?: 'llm_io' | string;
264
262
  plannerModelType?: 'SMART_MODEL' | 'REASONING_MODEL' | string;
265
263
  coordinatorModelType?: 'SMART_MODEL' | 'REASONING_MODEL' | string;
266
264
  orchestratorModelType?: 'SMART_MODEL' | 'REASONING_MODEL' | string | null;
@@ -279,11 +277,8 @@ interface ModelOverrides {
279
277
  interface CreateResponseRequest {
280
278
  threadId?: UUID;
281
279
  messages: Message[];
282
- agentEffort?: AgentEffort;
283
- costCapUsd?: number;
284
280
  files?: FileAttachment[];
285
281
  options?: Record<string, any>;
286
- priority?: number;
287
282
  userId?: string;
288
283
  agentConfig?: AgentConfig;
289
284
  responseFormat?: Record<string, any>;
@@ -313,6 +308,7 @@ interface ResponseObject {
313
308
  inputMessages: Message[];
314
309
  outputText?: string | null;
315
310
  content?: string | null;
311
+ responseTitle?: string | null;
316
312
  structuredResponse?: Record<string, any> | null;
317
313
  artifacts?: ResponseArtifact[] | null;
318
314
  createdAt: string;
@@ -1061,5 +1057,55 @@ declare class LocalFileNotSupportedError extends ValidationError {
1061
1057
  constructor(filePath: string);
1062
1058
  }
1063
1059
 
1060
+ /**
1061
+ * Utility functions for displaying progress updates
1062
+ */
1063
+
1064
+ /**
1065
+ * Display a progress update with optional tool calls.
1066
+ *
1067
+ * Simple one-liner replacement for:
1068
+ * console.log(`${update.state.toUpperCase()} - ${update.message}`)
1069
+ *
1070
+ * Now just use:
1071
+ * displayProgress(update)
1072
+ *
1073
+ * This will display the message and any associated tool calls. The SDK now
1074
+ * yields both new messages and tool call updates (with state="tool_update").
1075
+ *
1076
+ * @param update - A ProgressEntry from streaming
1077
+ * @param indent - Indentation string for tool calls (default: tab)
1078
+ */
1079
+ declare function displayProgress(update: ProgressEntry, indent?: string): void;
1080
+ /**
1081
+ * Format a progress entry with optional tool calls.
1082
+ *
1083
+ * @param state - The state of the progress entry (e.g., 'processing', 'completed')
1084
+ * @param message - The progress message
1085
+ * @param toolCalls - Optional list of tool calls associated with this message
1086
+ * @returns Formatted string with message and indented tool calls
1087
+ */
1088
+ declare function formatProgressEntry(state: string, message: string, toolCalls?: Array<Record<string, any>> | null): string;
1089
+ /**
1090
+ * Track and format progress entries to avoid duplicates.
1091
+ */
1092
+ declare class ProgressTracker {
1093
+ private seenMessages;
1094
+ private messageToolCalls;
1095
+ /**
1096
+ * Format new progress entries, returning null if nothing new to display.
1097
+ *
1098
+ * @param state - The state of the progress entry
1099
+ * @param message - The progress message
1100
+ * @param toolCalls - Optional list of tool calls
1101
+ * @returns Formatted string if there are new entries to display, null otherwise
1102
+ */
1103
+ formatNewEntries(state: string, message: string, toolCalls?: Array<Record<string, any>> | null): string | null;
1104
+ /**
1105
+ * Reset the tracker to start fresh.
1106
+ */
1107
+ reset(): void;
1108
+ }
1109
+
1064
1110
  export = LumnisClient;
1065
- export { type AgentConfig, type AgentEffort, type ApiKeyMode, type ApiKeyModeRequest, type ApiKeyModeResponse, type ApiProvider, type AppEnabledResponse, type AppsListResponse, type ArtifactObject, type ArtifactsListResponse, AuthenticationError, type BaseResource, type BillingStatus, type BulkDeleteRequest, type BulkDeleteResponse, type BulkUploadResponse, type CancelResponseResponse, type ChunkingStrategy, type ConnectionCallbackRequest, type ConnectionCallbackResponse, type ConnectionInfo, type ConnectionStatus, type ConnectionStatusResponse, type ContentType, type CreateResponseRequest, type CreateResponseResponse, type CreateThreadRequest, type DatabaseStatus, type DeleteApiKeyResponse, type DisconnectRequest, type DisconnectResponse, type DuplicateHandling, type Email, type ErrorResponse, ExternalAPIKeysResource, type ExternalApiKeyResponse, type FileAttachment, type FileChunk, type FileContentResponse, type FileListResponse, type FileMetadata, type FileScope, type FileScopeUpdateRequest, type FileSearchRequest, type FileSearchResponse, type FileSearchResult, type FileStatisticsResponse, type FileUploadResponse, FilesResource, type GetToolsRequest, type GetToolsResponse, type InitiateConnectionRequest, type InitiateConnectionResponse, IntegrationsResource, InternalServerError, LocalFileNotSupportedError, LumnisClient, type LumnisClientOptions, LumnisError, type LumnisErrorOptions, type MCPScope, type MCPServerCreateRequest, type MCPServerListResponse, type MCPServerResponse, type MCPServerUpdateRequest, MCPServersResource, type MCPToolListResponse, type MCPToolResponse, type MCPTransport, type Message, type ModelAvailability, type ModelOverrides, type ModelPreferenceCreate, type ModelPreferencesBulkUpdate, ModelPreferencesResource, type ModelProvider, type ModelType, NotFoundError, type PaginationInfo, type PaginationParams, type Plan, type ProcessingStatus, type ProcessingStatusResponse, type ProgressEntry, RateLimitError, type RateLimitErrorOptions, type ResponseArtifact, type ResponseListResponse, type ResponseObject, type ResponseStatus, ResponsesResource, type Scope, type StoreApiKeyRequest, type TenantDetailsResponse, TenantInfoResource, type TenantModelPreference, type TenantModelPreferencesResponse, type TestConnectionResponse, type ThreadListResponse, type ThreadObject, type ThreadResponsesParams, ThreadsResource, type ToolInfo, type UUID, type UpdateAppStatusResponse, type UpdateThreadRequest, type UserConnectionsResponse, type UserCreateRequest, type UserDeleteResponse, type UserIdentifier, type UserListResponse, type UserResponse, type UserUpdateRequest, UsersResource, ValidationError };
1111
+ export { type AgentConfig, type ApiKeyMode, type ApiKeyModeRequest, type ApiKeyModeResponse, type ApiProvider, type AppEnabledResponse, type AppsListResponse, type ArtifactObject, type ArtifactsListResponse, AuthenticationError, type BaseResource, type BillingStatus, type BulkDeleteRequest, type BulkDeleteResponse, type BulkUploadResponse, type CancelResponseResponse, type ChunkingStrategy, type ConnectionCallbackRequest, type ConnectionCallbackResponse, type ConnectionInfo, type ConnectionStatus, type ConnectionStatusResponse, type ContentType, type CreateResponseRequest, type CreateResponseResponse, type CreateThreadRequest, type DatabaseStatus, type DeleteApiKeyResponse, type DisconnectRequest, type DisconnectResponse, type DuplicateHandling, type Email, type ErrorResponse, ExternalAPIKeysResource, type ExternalApiKeyResponse, type FileAttachment, type FileChunk, type FileContentResponse, type FileListResponse, type FileMetadata, type FileScope, type FileScopeUpdateRequest, type FileSearchRequest, type FileSearchResponse, type FileSearchResult, type FileStatisticsResponse, type FileUploadResponse, FilesResource, type GetToolsRequest, type GetToolsResponse, type InitiateConnectionRequest, type InitiateConnectionResponse, IntegrationsResource, InternalServerError, LocalFileNotSupportedError, LumnisClient, type LumnisClientOptions, LumnisError, type LumnisErrorOptions, type MCPScope, type MCPServerCreateRequest, type MCPServerListResponse, type MCPServerResponse, type MCPServerUpdateRequest, MCPServersResource, type MCPToolListResponse, type MCPToolResponse, type MCPTransport, type Message, type ModelAvailability, type ModelOverrides, type ModelPreferenceCreate, type ModelPreferencesBulkUpdate, ModelPreferencesResource, type ModelProvider, type ModelType, NotFoundError, type PaginationInfo, type PaginationParams, type Plan, type ProcessingStatus, type ProcessingStatusResponse, type ProgressEntry, ProgressTracker, RateLimitError, type RateLimitErrorOptions, type ResponseArtifact, type ResponseListResponse, type ResponseObject, type ResponseStatus, ResponsesResource, type Scope, type StoreApiKeyRequest, type TenantDetailsResponse, TenantInfoResource, type TenantModelPreference, type TenantModelPreferencesResponse, type TestConnectionResponse, type ThreadListResponse, type ThreadObject, type ThreadResponsesParams, ThreadsResource, type ToolInfo, type UUID, type UpdateAppStatusResponse, type UpdateThreadRequest, type UserConnectionsResponse, type UserCreateRequest, type UserDeleteResponse, type UserIdentifier, type UserListResponse, type UserResponse, type UserUpdateRequest, UsersResource, ValidationError, displayProgress, formatProgressEntry };
package/dist/index.d.mts CHANGED
@@ -252,7 +252,6 @@ interface ModelAvailability {
252
252
  }
253
253
 
254
254
  type ResponseStatus = 'queued' | 'in_progress' | 'succeeded' | 'failed' | 'cancelled';
255
- type AgentEffort = 'low' | 'medium' | 'high';
256
255
  interface FileAttachment {
257
256
  name: string;
258
257
  uri: string;
@@ -260,7 +259,6 @@ interface FileAttachment {
260
259
  sizeBytes?: number | null;
261
260
  }
262
261
  interface AgentConfig {
263
- planStrategy?: 'llm_io' | string;
264
262
  plannerModelType?: 'SMART_MODEL' | 'REASONING_MODEL' | string;
265
263
  coordinatorModelType?: 'SMART_MODEL' | 'REASONING_MODEL' | string;
266
264
  orchestratorModelType?: 'SMART_MODEL' | 'REASONING_MODEL' | string | null;
@@ -279,11 +277,8 @@ interface ModelOverrides {
279
277
  interface CreateResponseRequest {
280
278
  threadId?: UUID;
281
279
  messages: Message[];
282
- agentEffort?: AgentEffort;
283
- costCapUsd?: number;
284
280
  files?: FileAttachment[];
285
281
  options?: Record<string, any>;
286
- priority?: number;
287
282
  userId?: string;
288
283
  agentConfig?: AgentConfig;
289
284
  responseFormat?: Record<string, any>;
@@ -313,6 +308,7 @@ interface ResponseObject {
313
308
  inputMessages: Message[];
314
309
  outputText?: string | null;
315
310
  content?: string | null;
311
+ responseTitle?: string | null;
316
312
  structuredResponse?: Record<string, any> | null;
317
313
  artifacts?: ResponseArtifact[] | null;
318
314
  createdAt: string;
@@ -1061,4 +1057,54 @@ declare class LocalFileNotSupportedError extends ValidationError {
1061
1057
  constructor(filePath: string);
1062
1058
  }
1063
1059
 
1064
- export { type AgentConfig, type AgentEffort, type ApiKeyMode, type ApiKeyModeRequest, type ApiKeyModeResponse, type ApiProvider, type AppEnabledResponse, type AppsListResponse, type ArtifactObject, type ArtifactsListResponse, AuthenticationError, type BaseResource, type BillingStatus, type BulkDeleteRequest, type BulkDeleteResponse, type BulkUploadResponse, type CancelResponseResponse, type ChunkingStrategy, type ConnectionCallbackRequest, type ConnectionCallbackResponse, type ConnectionInfo, type ConnectionStatus, type ConnectionStatusResponse, type ContentType, type CreateResponseRequest, type CreateResponseResponse, type CreateThreadRequest, type DatabaseStatus, type DeleteApiKeyResponse, type DisconnectRequest, type DisconnectResponse, type DuplicateHandling, type Email, type ErrorResponse, ExternalAPIKeysResource, type ExternalApiKeyResponse, type FileAttachment, type FileChunk, type FileContentResponse, type FileListResponse, type FileMetadata, type FileScope, type FileScopeUpdateRequest, type FileSearchRequest, type FileSearchResponse, type FileSearchResult, type FileStatisticsResponse, type FileUploadResponse, FilesResource, type GetToolsRequest, type GetToolsResponse, type InitiateConnectionRequest, type InitiateConnectionResponse, IntegrationsResource, InternalServerError, LocalFileNotSupportedError, LumnisClient, type LumnisClientOptions, LumnisError, type LumnisErrorOptions, type MCPScope, type MCPServerCreateRequest, type MCPServerListResponse, type MCPServerResponse, type MCPServerUpdateRequest, MCPServersResource, type MCPToolListResponse, type MCPToolResponse, type MCPTransport, type Message, type ModelAvailability, type ModelOverrides, type ModelPreferenceCreate, type ModelPreferencesBulkUpdate, ModelPreferencesResource, type ModelProvider, type ModelType, NotFoundError, type PaginationInfo, type PaginationParams, type Plan, type ProcessingStatus, type ProcessingStatusResponse, type ProgressEntry, RateLimitError, type RateLimitErrorOptions, type ResponseArtifact, type ResponseListResponse, type ResponseObject, type ResponseStatus, ResponsesResource, type Scope, type StoreApiKeyRequest, type TenantDetailsResponse, TenantInfoResource, type TenantModelPreference, type TenantModelPreferencesResponse, type TestConnectionResponse, type ThreadListResponse, type ThreadObject, type ThreadResponsesParams, ThreadsResource, type ToolInfo, type UUID, type UpdateAppStatusResponse, type UpdateThreadRequest, type UserConnectionsResponse, type UserCreateRequest, type UserDeleteResponse, type UserIdentifier, type UserListResponse, type UserResponse, type UserUpdateRequest, UsersResource, ValidationError, LumnisClient as default };
1060
+ /**
1061
+ * Utility functions for displaying progress updates
1062
+ */
1063
+
1064
+ /**
1065
+ * Display a progress update with optional tool calls.
1066
+ *
1067
+ * Simple one-liner replacement for:
1068
+ * console.log(`${update.state.toUpperCase()} - ${update.message}`)
1069
+ *
1070
+ * Now just use:
1071
+ * displayProgress(update)
1072
+ *
1073
+ * This will display the message and any associated tool calls. The SDK now
1074
+ * yields both new messages and tool call updates (with state="tool_update").
1075
+ *
1076
+ * @param update - A ProgressEntry from streaming
1077
+ * @param indent - Indentation string for tool calls (default: tab)
1078
+ */
1079
+ declare function displayProgress(update: ProgressEntry, indent?: string): void;
1080
+ /**
1081
+ * Format a progress entry with optional tool calls.
1082
+ *
1083
+ * @param state - The state of the progress entry (e.g., 'processing', 'completed')
1084
+ * @param message - The progress message
1085
+ * @param toolCalls - Optional list of tool calls associated with this message
1086
+ * @returns Formatted string with message and indented tool calls
1087
+ */
1088
+ declare function formatProgressEntry(state: string, message: string, toolCalls?: Array<Record<string, any>> | null): string;
1089
+ /**
1090
+ * Track and format progress entries to avoid duplicates.
1091
+ */
1092
+ declare class ProgressTracker {
1093
+ private seenMessages;
1094
+ private messageToolCalls;
1095
+ /**
1096
+ * Format new progress entries, returning null if nothing new to display.
1097
+ *
1098
+ * @param state - The state of the progress entry
1099
+ * @param message - The progress message
1100
+ * @param toolCalls - Optional list of tool calls
1101
+ * @returns Formatted string if there are new entries to display, null otherwise
1102
+ */
1103
+ formatNewEntries(state: string, message: string, toolCalls?: Array<Record<string, any>> | null): string | null;
1104
+ /**
1105
+ * Reset the tracker to start fresh.
1106
+ */
1107
+ reset(): void;
1108
+ }
1109
+
1110
+ export { type AgentConfig, type ApiKeyMode, type ApiKeyModeRequest, type ApiKeyModeResponse, type ApiProvider, type AppEnabledResponse, type AppsListResponse, type ArtifactObject, type ArtifactsListResponse, AuthenticationError, type BaseResource, type BillingStatus, type BulkDeleteRequest, type BulkDeleteResponse, type BulkUploadResponse, type CancelResponseResponse, type ChunkingStrategy, type ConnectionCallbackRequest, type ConnectionCallbackResponse, type ConnectionInfo, type ConnectionStatus, type ConnectionStatusResponse, type ContentType, type CreateResponseRequest, type CreateResponseResponse, type CreateThreadRequest, type DatabaseStatus, type DeleteApiKeyResponse, type DisconnectRequest, type DisconnectResponse, type DuplicateHandling, type Email, type ErrorResponse, ExternalAPIKeysResource, type ExternalApiKeyResponse, type FileAttachment, type FileChunk, type FileContentResponse, type FileListResponse, type FileMetadata, type FileScope, type FileScopeUpdateRequest, type FileSearchRequest, type FileSearchResponse, type FileSearchResult, type FileStatisticsResponse, type FileUploadResponse, FilesResource, type GetToolsRequest, type GetToolsResponse, type InitiateConnectionRequest, type InitiateConnectionResponse, IntegrationsResource, InternalServerError, LocalFileNotSupportedError, LumnisClient, type LumnisClientOptions, LumnisError, type LumnisErrorOptions, type MCPScope, type MCPServerCreateRequest, type MCPServerListResponse, type MCPServerResponse, type MCPServerUpdateRequest, MCPServersResource, type MCPToolListResponse, type MCPToolResponse, type MCPTransport, type Message, type ModelAvailability, type ModelOverrides, type ModelPreferenceCreate, type ModelPreferencesBulkUpdate, ModelPreferencesResource, type ModelProvider, type ModelType, NotFoundError, type PaginationInfo, type PaginationParams, type Plan, type ProcessingStatus, type ProcessingStatusResponse, type ProgressEntry, ProgressTracker, RateLimitError, type RateLimitErrorOptions, type ResponseArtifact, type ResponseListResponse, type ResponseObject, type ResponseStatus, ResponsesResource, type Scope, type StoreApiKeyRequest, type TenantDetailsResponse, TenantInfoResource, type TenantModelPreference, type TenantModelPreferencesResponse, type TestConnectionResponse, type ThreadListResponse, type ThreadObject, type ThreadResponsesParams, ThreadsResource, type ToolInfo, type UUID, type UpdateAppStatusResponse, type UpdateThreadRequest, type UserConnectionsResponse, type UserCreateRequest, type UserDeleteResponse, type UserIdentifier, type UserListResponse, type UserResponse, type UserUpdateRequest, UsersResource, ValidationError, LumnisClient as default, displayProgress, formatProgressEntry };
package/dist/index.d.ts CHANGED
@@ -252,7 +252,6 @@ interface ModelAvailability {
252
252
  }
253
253
 
254
254
  type ResponseStatus = 'queued' | 'in_progress' | 'succeeded' | 'failed' | 'cancelled';
255
- type AgentEffort = 'low' | 'medium' | 'high';
256
255
  interface FileAttachment {
257
256
  name: string;
258
257
  uri: string;
@@ -260,7 +259,6 @@ interface FileAttachment {
260
259
  sizeBytes?: number | null;
261
260
  }
262
261
  interface AgentConfig {
263
- planStrategy?: 'llm_io' | string;
264
262
  plannerModelType?: 'SMART_MODEL' | 'REASONING_MODEL' | string;
265
263
  coordinatorModelType?: 'SMART_MODEL' | 'REASONING_MODEL' | string;
266
264
  orchestratorModelType?: 'SMART_MODEL' | 'REASONING_MODEL' | string | null;
@@ -279,11 +277,8 @@ interface ModelOverrides {
279
277
  interface CreateResponseRequest {
280
278
  threadId?: UUID;
281
279
  messages: Message[];
282
- agentEffort?: AgentEffort;
283
- costCapUsd?: number;
284
280
  files?: FileAttachment[];
285
281
  options?: Record<string, any>;
286
- priority?: number;
287
282
  userId?: string;
288
283
  agentConfig?: AgentConfig;
289
284
  responseFormat?: Record<string, any>;
@@ -313,6 +308,7 @@ interface ResponseObject {
313
308
  inputMessages: Message[];
314
309
  outputText?: string | null;
315
310
  content?: string | null;
311
+ responseTitle?: string | null;
316
312
  structuredResponse?: Record<string, any> | null;
317
313
  artifacts?: ResponseArtifact[] | null;
318
314
  createdAt: string;
@@ -1061,5 +1057,55 @@ declare class LocalFileNotSupportedError extends ValidationError {
1061
1057
  constructor(filePath: string);
1062
1058
  }
1063
1059
 
1060
+ /**
1061
+ * Utility functions for displaying progress updates
1062
+ */
1063
+
1064
+ /**
1065
+ * Display a progress update with optional tool calls.
1066
+ *
1067
+ * Simple one-liner replacement for:
1068
+ * console.log(`${update.state.toUpperCase()} - ${update.message}`)
1069
+ *
1070
+ * Now just use:
1071
+ * displayProgress(update)
1072
+ *
1073
+ * This will display the message and any associated tool calls. The SDK now
1074
+ * yields both new messages and tool call updates (with state="tool_update").
1075
+ *
1076
+ * @param update - A ProgressEntry from streaming
1077
+ * @param indent - Indentation string for tool calls (default: tab)
1078
+ */
1079
+ declare function displayProgress(update: ProgressEntry, indent?: string): void;
1080
+ /**
1081
+ * Format a progress entry with optional tool calls.
1082
+ *
1083
+ * @param state - The state of the progress entry (e.g., 'processing', 'completed')
1084
+ * @param message - The progress message
1085
+ * @param toolCalls - Optional list of tool calls associated with this message
1086
+ * @returns Formatted string with message and indented tool calls
1087
+ */
1088
+ declare function formatProgressEntry(state: string, message: string, toolCalls?: Array<Record<string, any>> | null): string;
1089
+ /**
1090
+ * Track and format progress entries to avoid duplicates.
1091
+ */
1092
+ declare class ProgressTracker {
1093
+ private seenMessages;
1094
+ private messageToolCalls;
1095
+ /**
1096
+ * Format new progress entries, returning null if nothing new to display.
1097
+ *
1098
+ * @param state - The state of the progress entry
1099
+ * @param message - The progress message
1100
+ * @param toolCalls - Optional list of tool calls
1101
+ * @returns Formatted string if there are new entries to display, null otherwise
1102
+ */
1103
+ formatNewEntries(state: string, message: string, toolCalls?: Array<Record<string, any>> | null): string | null;
1104
+ /**
1105
+ * Reset the tracker to start fresh.
1106
+ */
1107
+ reset(): void;
1108
+ }
1109
+
1064
1110
  export = LumnisClient;
1065
- export { type AgentConfig, type AgentEffort, type ApiKeyMode, type ApiKeyModeRequest, type ApiKeyModeResponse, type ApiProvider, type AppEnabledResponse, type AppsListResponse, type ArtifactObject, type ArtifactsListResponse, AuthenticationError, type BaseResource, type BillingStatus, type BulkDeleteRequest, type BulkDeleteResponse, type BulkUploadResponse, type CancelResponseResponse, type ChunkingStrategy, type ConnectionCallbackRequest, type ConnectionCallbackResponse, type ConnectionInfo, type ConnectionStatus, type ConnectionStatusResponse, type ContentType, type CreateResponseRequest, type CreateResponseResponse, type CreateThreadRequest, type DatabaseStatus, type DeleteApiKeyResponse, type DisconnectRequest, type DisconnectResponse, type DuplicateHandling, type Email, type ErrorResponse, ExternalAPIKeysResource, type ExternalApiKeyResponse, type FileAttachment, type FileChunk, type FileContentResponse, type FileListResponse, type FileMetadata, type FileScope, type FileScopeUpdateRequest, type FileSearchRequest, type FileSearchResponse, type FileSearchResult, type FileStatisticsResponse, type FileUploadResponse, FilesResource, type GetToolsRequest, type GetToolsResponse, type InitiateConnectionRequest, type InitiateConnectionResponse, IntegrationsResource, InternalServerError, LocalFileNotSupportedError, LumnisClient, type LumnisClientOptions, LumnisError, type LumnisErrorOptions, type MCPScope, type MCPServerCreateRequest, type MCPServerListResponse, type MCPServerResponse, type MCPServerUpdateRequest, MCPServersResource, type MCPToolListResponse, type MCPToolResponse, type MCPTransport, type Message, type ModelAvailability, type ModelOverrides, type ModelPreferenceCreate, type ModelPreferencesBulkUpdate, ModelPreferencesResource, type ModelProvider, type ModelType, NotFoundError, type PaginationInfo, type PaginationParams, type Plan, type ProcessingStatus, type ProcessingStatusResponse, type ProgressEntry, RateLimitError, type RateLimitErrorOptions, type ResponseArtifact, type ResponseListResponse, type ResponseObject, type ResponseStatus, ResponsesResource, type Scope, type StoreApiKeyRequest, type TenantDetailsResponse, TenantInfoResource, type TenantModelPreference, type TenantModelPreferencesResponse, type TestConnectionResponse, type ThreadListResponse, type ThreadObject, type ThreadResponsesParams, ThreadsResource, type ToolInfo, type UUID, type UpdateAppStatusResponse, type UpdateThreadRequest, type UserConnectionsResponse, type UserCreateRequest, type UserDeleteResponse, type UserIdentifier, type UserListResponse, type UserResponse, type UserUpdateRequest, UsersResource, ValidationError };
1111
+ export { type AgentConfig, type ApiKeyMode, type ApiKeyModeRequest, type ApiKeyModeResponse, type ApiProvider, type AppEnabledResponse, type AppsListResponse, type ArtifactObject, type ArtifactsListResponse, AuthenticationError, type BaseResource, type BillingStatus, type BulkDeleteRequest, type BulkDeleteResponse, type BulkUploadResponse, type CancelResponseResponse, type ChunkingStrategy, type ConnectionCallbackRequest, type ConnectionCallbackResponse, type ConnectionInfo, type ConnectionStatus, type ConnectionStatusResponse, type ContentType, type CreateResponseRequest, type CreateResponseResponse, type CreateThreadRequest, type DatabaseStatus, type DeleteApiKeyResponse, type DisconnectRequest, type DisconnectResponse, type DuplicateHandling, type Email, type ErrorResponse, ExternalAPIKeysResource, type ExternalApiKeyResponse, type FileAttachment, type FileChunk, type FileContentResponse, type FileListResponse, type FileMetadata, type FileScope, type FileScopeUpdateRequest, type FileSearchRequest, type FileSearchResponse, type FileSearchResult, type FileStatisticsResponse, type FileUploadResponse, FilesResource, type GetToolsRequest, type GetToolsResponse, type InitiateConnectionRequest, type InitiateConnectionResponse, IntegrationsResource, InternalServerError, LocalFileNotSupportedError, LumnisClient, type LumnisClientOptions, LumnisError, type LumnisErrorOptions, type MCPScope, type MCPServerCreateRequest, type MCPServerListResponse, type MCPServerResponse, type MCPServerUpdateRequest, MCPServersResource, type MCPToolListResponse, type MCPToolResponse, type MCPTransport, type Message, type ModelAvailability, type ModelOverrides, type ModelPreferenceCreate, type ModelPreferencesBulkUpdate, ModelPreferencesResource, type ModelProvider, type ModelType, NotFoundError, type PaginationInfo, type PaginationParams, type Plan, type ProcessingStatus, type ProcessingStatusResponse, type ProgressEntry, ProgressTracker, RateLimitError, type RateLimitErrorOptions, type ResponseArtifact, type ResponseListResponse, type ResponseObject, type ResponseStatus, ResponsesResource, type Scope, type StoreApiKeyRequest, type TenantDetailsResponse, TenantInfoResource, type TenantModelPreference, type TenantModelPreferencesResponse, type TestConnectionResponse, type ThreadListResponse, type ThreadObject, type ThreadResponsesParams, ThreadsResource, type ToolInfo, type UUID, type UpdateAppStatusResponse, type UpdateThreadRequest, type UserConnectionsResponse, type UserCreateRequest, type UserDeleteResponse, type UserIdentifier, type UserListResponse, type UserResponse, type UserUpdateRequest, UsersResource, ValidationError, displayProgress, formatProgressEntry };
package/dist/index.mjs CHANGED
@@ -913,14 +913,37 @@ class LumnisClient {
913
913
  const response = await this._createResponse(messages, options);
914
914
  console.log(`Response ID: ${response.responseId}`);
915
915
  let lastMessageCount = 0;
916
+ const toolCallCounts = /* @__PURE__ */ new Map();
916
917
  while (true) {
917
918
  const current = await this.responses.get(response.responseId, { wait: LONG_POLL_TIMEOUT_S });
918
919
  const currentMessageCount = current.progress?.length || 0;
919
920
  if (currentMessageCount > lastMessageCount && current.progress) {
920
- for (let i = lastMessageCount; i < currentMessageCount; i++)
921
- yield current.progress[i];
921
+ for (let i = lastMessageCount; i < currentMessageCount; i++) {
922
+ const entry = current.progress[i];
923
+ toolCallCounts.set(i, entry.toolCalls?.length || 0);
924
+ yield entry;
925
+ }
922
926
  lastMessageCount = currentMessageCount;
923
927
  }
928
+ if (current.progress) {
929
+ for (let i = 0; i < Math.min(lastMessageCount, currentMessageCount); i++) {
930
+ const entry = current.progress[i];
931
+ const currentToolCallCount = entry.toolCalls?.length || 0;
932
+ const previousToolCallCount = toolCallCounts.get(i) || 0;
933
+ if (currentToolCallCount > previousToolCallCount) {
934
+ const newToolCalls = entry.toolCalls?.slice(previousToolCallCount) || [];
935
+ const truncatedMessage = entry.message.length > 50 ? `${entry.message.substring(0, 50)}...` : entry.message;
936
+ const toolUpdateEntry = {
937
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
938
+ state: "tool_update",
939
+ message: `[Tool calls for: ${truncatedMessage}]`,
940
+ toolCalls: newToolCalls
941
+ };
942
+ yield toolUpdateEntry;
943
+ toolCallCounts.set(i, currentToolCallCount);
944
+ }
945
+ }
946
+ }
924
947
  if (current.status === "succeeded" || current.status === "failed" || current.status === "cancelled") {
925
948
  if (current.status === "succeeded" && current.outputText) {
926
949
  const progressEntry = {
@@ -933,6 +956,7 @@ class LumnisClient {
933
956
  }
934
957
  break;
935
958
  }
959
+ await new Promise((resolve) => setTimeout(resolve, DEFAULT_POLL_INTERVAL_MS));
936
960
  }
937
961
  }
938
962
  async _invokeAndWait(messages, options, progressCallback) {
@@ -1078,9 +1102,9 @@ class LumnisClient {
1078
1102
  function createSimpleProgressCallback() {
1079
1103
  let lastStatus;
1080
1104
  const seenMessages = /* @__PURE__ */ new Set();
1105
+ const messageToolCalls = /* @__PURE__ */ new Map();
1081
1106
  return (response) => {
1082
1107
  if (response.status !== lastStatus) {
1083
- console.log(`Status: ${response.status}`);
1084
1108
  lastStatus = response.status;
1085
1109
  }
1086
1110
  if (response.progress) {
@@ -1089,10 +1113,124 @@ function createSimpleProgressCallback() {
1089
1113
  if (!seenMessages.has(messageKey)) {
1090
1114
  console.log(`${entry.state.toUpperCase()}: ${entry.message}`);
1091
1115
  seenMessages.add(messageKey);
1116
+ messageToolCalls.set(messageKey, /* @__PURE__ */ new Set());
1117
+ }
1118
+ if (entry.toolCalls && messageToolCalls.has(messageKey)) {
1119
+ const seenToolCalls = messageToolCalls.get(messageKey);
1120
+ for (const toolCall of entry.toolCalls) {
1121
+ const toolName = toolCall.name || "unknown";
1122
+ const toolArgs = toolCall.args || {};
1123
+ const toolKey = `${toolName}:${JSON.stringify(toolArgs)}`;
1124
+ if (!seenToolCalls.has(toolKey)) {
1125
+ process.stdout.write(` \u2192 ${toolName}`);
1126
+ if (Object.keys(toolArgs).length > 0) {
1127
+ const argsStr = Object.entries(toolArgs).map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(", ");
1128
+ console.log(`(${argsStr})`);
1129
+ } else {
1130
+ console.log();
1131
+ }
1132
+ seenToolCalls.add(toolKey);
1133
+ }
1134
+ }
1092
1135
  }
1093
1136
  }
1094
1137
  }
1095
1138
  };
1096
1139
  }
1097
1140
 
1098
- export { AuthenticationError, InternalServerError, LocalFileNotSupportedError, LumnisClient, LumnisError, NotFoundError, RateLimitError, ValidationError, LumnisClient as default };
1141
+ function displayProgress(update, indent = " ") {
1142
+ if (update.state === "tool_update") {
1143
+ if (update.toolCalls && update.toolCalls.length > 0) {
1144
+ for (const toolCall of update.toolCalls) {
1145
+ const toolName = toolCall.name || "unknown";
1146
+ const toolArgs = toolCall.args || {};
1147
+ process.stdout.write(`${indent}\u2192 ${toolName}`);
1148
+ if (Object.keys(toolArgs).length > 0) {
1149
+ const argsStr = Object.entries(toolArgs).map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(", ");
1150
+ console.log(`(${argsStr})`);
1151
+ } else {
1152
+ console.log();
1153
+ }
1154
+ }
1155
+ }
1156
+ } else {
1157
+ console.log(`${update.state.toUpperCase()} - ${update.message}`);
1158
+ if (update.toolCalls && update.toolCalls.length > 0) {
1159
+ for (const toolCall of update.toolCalls) {
1160
+ const toolName = toolCall.name || "unknown";
1161
+ const toolArgs = toolCall.args || {};
1162
+ process.stdout.write(`${indent}\u2192 ${toolName}`);
1163
+ if (Object.keys(toolArgs).length > 0) {
1164
+ const argsStr = Object.entries(toolArgs).map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(", ");
1165
+ console.log(`(${argsStr})`);
1166
+ } else {
1167
+ console.log();
1168
+ }
1169
+ }
1170
+ }
1171
+ }
1172
+ }
1173
+ function formatProgressEntry(state, message, toolCalls) {
1174
+ const lines = [`${state.toUpperCase()}: ${message}`];
1175
+ if (toolCalls && toolCalls.length > 0) {
1176
+ for (const toolCall of toolCalls) {
1177
+ const toolName = toolCall.name || "unknown";
1178
+ const toolArgs = toolCall.args || {};
1179
+ if (Object.keys(toolArgs).length > 0) {
1180
+ const argsStr = Object.entries(toolArgs).map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(", ");
1181
+ lines.push(` \u2192 ${toolName}(${argsStr})`);
1182
+ } else {
1183
+ lines.push(` \u2192 ${toolName}`);
1184
+ }
1185
+ }
1186
+ }
1187
+ return lines.join("\n");
1188
+ }
1189
+ class ProgressTracker {
1190
+ seenMessages = /* @__PURE__ */ new Set();
1191
+ messageToolCalls = /* @__PURE__ */ new Map();
1192
+ /**
1193
+ * Format new progress entries, returning null if nothing new to display.
1194
+ *
1195
+ * @param state - The state of the progress entry
1196
+ * @param message - The progress message
1197
+ * @param toolCalls - Optional list of tool calls
1198
+ * @returns Formatted string if there are new entries to display, null otherwise
1199
+ */
1200
+ formatNewEntries(state, message, toolCalls) {
1201
+ const messageKey = `${state}:${message}`;
1202
+ const outputLines = [];
1203
+ if (!this.seenMessages.has(messageKey)) {
1204
+ outputLines.push(`${state.toUpperCase()}: ${message}`);
1205
+ this.seenMessages.add(messageKey);
1206
+ this.messageToolCalls.set(messageKey, /* @__PURE__ */ new Set());
1207
+ }
1208
+ if (toolCalls && this.messageToolCalls.has(messageKey)) {
1209
+ const seenToolCalls = this.messageToolCalls.get(messageKey);
1210
+ for (const toolCall of toolCalls) {
1211
+ const toolName = toolCall.name || "unknown";
1212
+ const toolArgs = toolCall.args || {};
1213
+ const toolKey = `${toolName}:${JSON.stringify(toolArgs)}`;
1214
+ if (!seenToolCalls.has(toolKey)) {
1215
+ if (Object.keys(toolArgs).length > 0) {
1216
+ const argsStr = Object.entries(toolArgs).map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(", ");
1217
+ outputLines.push(` \u2192 ${toolName}(${argsStr})`);
1218
+ } else {
1219
+ outputLines.push(` \u2192 ${toolName}`);
1220
+ }
1221
+ seenToolCalls.add(toolKey);
1222
+ }
1223
+ }
1224
+ }
1225
+ return outputLines.length > 0 ? outputLines.join("\n") : null;
1226
+ }
1227
+ /**
1228
+ * Reset the tracker to start fresh.
1229
+ */
1230
+ reset() {
1231
+ this.seenMessages.clear();
1232
+ this.messageToolCalls.clear();
1233
+ }
1234
+ }
1235
+
1236
+ export { AuthenticationError, InternalServerError, LocalFileNotSupportedError, LumnisClient, LumnisError, NotFoundError, ProgressTracker, RateLimitError, ValidationError, LumnisClient as default, displayProgress, formatProgressEntry };
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "lumnisai",
3
3
  "type": "module",
4
- "version": "0.1.0",
5
- "packageManager": "pnpm@10.6.2",
4
+ "version": "0.1.2",
6
5
  "description": "Official Node.js SDK for the Lumnis AI API",
7
6
  "author": "Lumnis AI",
8
7
  "license": "MIT",
@@ -13,7 +12,14 @@
13
12
  "url": "git+https://github.com/Lumnis-AI/lumnisai-node.git"
14
13
  },
15
14
  "bugs": "https://github.com/Lumnis-AI/lumnisai-node/issues",
16
- "keywords": ["lumnis", "ai", "sdk", "api", "typescript", "node"],
15
+ "keywords": [
16
+ "lumnis",
17
+ "ai",
18
+ "sdk",
19
+ "api",
20
+ "typescript",
21
+ "node"
22
+ ],
17
23
  "sideEffects": false,
18
24
  "exports": {
19
25
  ".": {
@@ -29,39 +35,37 @@
29
35
  "files": [
30
36
  "dist"
31
37
  ],
32
- "scripts": {
33
- "build": "unbuild",
34
- "dev": "unbuild --stub",
35
- "lint": "eslint",
36
- "prepublishOnly": "nr build",
37
- "release": "bumpp && pnpm publish",
38
- "start": "tsx src/index.ts",
39
- "test": "vitest",
40
- "typecheck": "tsc --noEmit",
41
- "prepare": "simple-git-hooks"
42
- },
43
38
  "devDependencies": {
44
- "@antfu/eslint-config": "catalog:cli",
45
- "@antfu/ni": "catalog:cli",
46
- "@antfu/utils": "catalog:inlined",
47
- "@types/node": "catalog:types",
48
- "bumpp": "catalog:cli",
49
- "eslint": "catalog:cli",
50
- "lint-staged": "catalog:cli",
51
- "simple-git-hooks": "catalog:cli",
52
- "tinyexec": "catalog:utils",
53
- "tsx": "catalog:cli",
54
- "typescript": "catalog:cli",
55
- "unbuild": "catalog:cli",
56
- "vite": "catalog:cli",
57
- "vitest": "catalog:testing",
58
- "vitest-package-exports": "catalog:testing",
59
- "yaml": "catalog:testing"
39
+ "@antfu/eslint-config": "^4.10.1",
40
+ "@antfu/ni": "^24.1.0",
41
+ "@antfu/utils": "^9.1.0",
42
+ "@types/node": "^22.13.10",
43
+ "bumpp": "^10.1.0",
44
+ "eslint": "^9.22.0",
45
+ "lint-staged": "^15.5.0",
46
+ "simple-git-hooks": "^2.11.1",
47
+ "tinyexec": "^0.3.2",
48
+ "tsx": "^4.19.3",
49
+ "typescript": "^5.8.2",
50
+ "unbuild": "^3.5.0",
51
+ "vite": "^6.2.1",
52
+ "vitest": "^3.0.8",
53
+ "vitest-package-exports": "^0.1.1",
54
+ "yaml": "^2.7.0"
60
55
  },
61
56
  "simple-git-hooks": {
62
57
  "pre-commit": "pnpm i --frozen-lockfile --ignore-scripts --offline && npx lint-staged"
63
58
  },
64
59
  "lint-staged": {
65
60
  "*": "eslint --fix"
61
+ },
62
+ "scripts": {
63
+ "build": "unbuild",
64
+ "dev": "unbuild --stub",
65
+ "lint": "eslint",
66
+ "release": "bumpp && pnpm publish",
67
+ "start": "tsx src/index.ts",
68
+ "test": "vitest",
69
+ "typecheck": "tsc --noEmit"
66
70
  }
67
- }
71
+ }