@inferencesh/sdk 0.22.0 → 0.22.1
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/CHANGELOG.md +6 -0
- package/dist/agent/api.js +8 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.22.1] - 2026-10-10
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- `sendMessage` sends its attachments: it posted only the text after uploading the files, so attachments never reached the agent. It now posts the file refs as `attachments` on POST /chats/{id}/messages. Needs api-v1227+; an older API ignores the field.
|
|
15
|
+
|
|
10
16
|
## [0.22.0] - 2026-10-10
|
|
11
17
|
|
|
12
18
|
Breaking: the server proxy forwards only app runs and agent chats and refuses every other API call with 403 (see Security); `update()` on projects, knowledge, skills, chats, engines and teams sends PATCH and needs an API that answers PATCH (see Changed); the Next.js proxy handler has no `PUT`.
|
package/dist/agent/api.js
CHANGED
|
@@ -21,7 +21,9 @@ async function processFiles(client, files) {
|
|
|
21
21
|
if (isFileRef(file))
|
|
22
22
|
return file;
|
|
23
23
|
try {
|
|
24
|
-
|
|
24
|
+
// The upload answers with the whole file record; the message takes a ref.
|
|
25
|
+
const { id, uri, filename, content_type, size } = await client.files.upload(file);
|
|
26
|
+
return { id, uri, filename, content_type, size };
|
|
25
27
|
}
|
|
26
28
|
catch (error) {
|
|
27
29
|
console.error('[AgentSDK] Failed to upload file:', error);
|
|
@@ -45,9 +47,9 @@ async function createChat(client, config) {
|
|
|
45
47
|
/**
|
|
46
48
|
* Send a message in a chat — POST /chats/{id}/messages
|
|
47
49
|
*/
|
|
48
|
-
async function sendChatMessage(client, chatId, text) {
|
|
50
|
+
async function sendChatMessage(client, chatId, text, attachments) {
|
|
49
51
|
const resp = await client.http.request('post', `/chats/${chatId}/messages`, {
|
|
50
|
-
data: { message: text },
|
|
52
|
+
data: attachments ? { message: text, attachments } : { message: text },
|
|
51
53
|
});
|
|
52
54
|
return {
|
|
53
55
|
chatId,
|
|
@@ -58,14 +60,14 @@ async function sendChatMessage(client, chatId, text) {
|
|
|
58
60
|
* Send a message — creates chat if needed, then sends message
|
|
59
61
|
*/
|
|
60
62
|
export async function sendMessage(client, config, chatId, text, files) {
|
|
61
|
-
await processFiles(client, files);
|
|
63
|
+
const attachments = await processFiles(client, files);
|
|
62
64
|
// Existing chat — just send the message
|
|
63
65
|
if (chatId) {
|
|
64
|
-
return sendChatMessage(client, chatId, text);
|
|
66
|
+
return sendChatMessage(client, chatId, text, attachments);
|
|
65
67
|
}
|
|
66
68
|
// New chat — create it, then send the first message
|
|
67
69
|
const chat = await createChat(client, config);
|
|
68
|
-
return sendChatMessage(client, chat.id, text);
|
|
70
|
+
return sendChatMessage(client, chat.id, text, attachments);
|
|
69
71
|
}
|
|
70
72
|
// =========================================================================
|
|
71
73
|
// Agent info
|