@inferencesh/sdk 0.5.14 → 0.5.16
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/agent/actions.js +9 -3
- package/dist/agent/reducer.js +7 -0
- package/dist/agent/types.d.ts +3 -0
- package/dist/http/client.js +1 -1
- package/dist/types.d.ts +3 -0
- package/package.json +1 -1
package/dist/agent/actions.js
CHANGED
|
@@ -30,7 +30,9 @@ export function createActions(ctx) {
|
|
|
30
30
|
};
|
|
31
31
|
const updateMessage = (message) => {
|
|
32
32
|
const chatId = getChatId();
|
|
33
|
-
|
|
33
|
+
// TODO: remove startsWith once the provider normalizes chatId to full ID after first fetchChat
|
|
34
|
+
// Support short ID matching (URL short IDs are prefixes of full IDs)
|
|
35
|
+
if (chatId && message.chat_id !== chatId && !message.chat_id.startsWith(chatId))
|
|
34
36
|
return;
|
|
35
37
|
dispatch({ type: 'UPDATE_MESSAGE', payload: message });
|
|
36
38
|
// Check for client tool invocations that need execution
|
|
@@ -121,9 +123,13 @@ export function createActions(ctx) {
|
|
|
121
123
|
}
|
|
122
124
|
},
|
|
123
125
|
});
|
|
124
|
-
// Listen for Chat object updates (status changes)
|
|
126
|
+
// Listen for Chat object updates (status changes only — don't replace messages)
|
|
125
127
|
manager.addEventListener('chats', (chatData) => {
|
|
126
|
-
|
|
128
|
+
dispatch({ type: 'UPDATE_CHAT', payload: chatData });
|
|
129
|
+
if (chatData) {
|
|
130
|
+
const status = chatData.status === ChatStatusBusy ? 'streaming' : 'idle';
|
|
131
|
+
callbacks.onStatusChange?.(status);
|
|
132
|
+
}
|
|
127
133
|
});
|
|
128
134
|
// Listen for ChatMessage updates
|
|
129
135
|
manager.addEventListener('chat_messages', (message) => {
|
package/dist/agent/reducer.js
CHANGED
|
@@ -28,6 +28,13 @@ export function chatReducer(state, action) {
|
|
|
28
28
|
const messages = [...(chat.chat_messages || [])].sort((a, b) => a.order - b.order);
|
|
29
29
|
return { ...state, chat, messages };
|
|
30
30
|
}
|
|
31
|
+
case 'UPDATE_CHAT': {
|
|
32
|
+
// Update chat metadata (e.g. status) without replacing messages
|
|
33
|
+
const chat = action.payload;
|
|
34
|
+
if (!chat)
|
|
35
|
+
return state;
|
|
36
|
+
return { ...state, chat };
|
|
37
|
+
}
|
|
31
38
|
case 'SET_MESSAGES':
|
|
32
39
|
return { ...state, messages: action.payload };
|
|
33
40
|
case 'UPDATE_MESSAGE': {
|
package/dist/agent/types.d.ts
CHANGED
package/dist/http/client.js
CHANGED
|
@@ -16,7 +16,7 @@ export class HttpClient {
|
|
|
16
16
|
this.baseUrl = config.baseUrl || 'https://api.inference.sh';
|
|
17
17
|
this.proxyUrl = config.proxyUrl;
|
|
18
18
|
this.getToken = config.getToken;
|
|
19
|
-
this.customHeaders = { '
|
|
19
|
+
this.customHeaders = { 'X-Client-Source': 'inference-sdk-js/0.5.13', ...config.headers };
|
|
20
20
|
this.credentials = config.credentials || 'include';
|
|
21
21
|
this.onError = config.onError;
|
|
22
22
|
this.streamDefault = config.stream ?? true;
|
package/dist/types.d.ts
CHANGED
|
@@ -1339,6 +1339,7 @@ export interface WorkerState extends BaseModel, PermissionModel {
|
|
|
1339
1339
|
index: number;
|
|
1340
1340
|
status: WorkerStatus;
|
|
1341
1341
|
status_updated_at?: string;
|
|
1342
|
+
heartbeat_at?: string;
|
|
1342
1343
|
engine_id: string;
|
|
1343
1344
|
engine?: EngineState;
|
|
1344
1345
|
task_id?: string;
|
|
@@ -1434,6 +1435,7 @@ export interface File extends BaseModel, PermissionModel {
|
|
|
1434
1435
|
content_type: string;
|
|
1435
1436
|
size: number;
|
|
1436
1437
|
filename: string;
|
|
1438
|
+
category: string;
|
|
1437
1439
|
rating: ContentRating;
|
|
1438
1440
|
metadata?: FileMetadata;
|
|
1439
1441
|
}
|
|
@@ -1445,6 +1447,7 @@ export interface FileDTO extends BaseModel, PermissionModelDTO {
|
|
|
1445
1447
|
content_type: string;
|
|
1446
1448
|
size: number;
|
|
1447
1449
|
filename: string;
|
|
1450
|
+
category: string;
|
|
1448
1451
|
rating: ContentRating;
|
|
1449
1452
|
metadata?: FileMetadata;
|
|
1450
1453
|
}
|