@superatomai/sdk-node 0.0.6-mds → 0.0.7-mds
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/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +36 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2478,9 +2478,11 @@ declare class SuperatomSDK {
|
|
|
2478
2478
|
*/
|
|
2479
2479
|
private handleMessage;
|
|
2480
2480
|
/**
|
|
2481
|
-
* Send a message to the Superatom service
|
|
2481
|
+
* Send a message to the Superatom service.
|
|
2482
|
+
* Returns true if the message was sent, false if the WebSocket is not connected.
|
|
2483
|
+
* Does NOT throw on closed connections — callers can check the return value if needed.
|
|
2482
2484
|
*/
|
|
2483
|
-
send(message: Message):
|
|
2485
|
+
send(message: Message): boolean;
|
|
2484
2486
|
/**
|
|
2485
2487
|
* Register a message handler to receive all messages
|
|
2486
2488
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -2478,9 +2478,11 @@ declare class SuperatomSDK {
|
|
|
2478
2478
|
*/
|
|
2479
2479
|
private handleMessage;
|
|
2480
2480
|
/**
|
|
2481
|
-
* Send a message to the Superatom service
|
|
2481
|
+
* Send a message to the Superatom service.
|
|
2482
|
+
* Returns true if the message was sent, false if the WebSocket is not connected.
|
|
2483
|
+
* Does NOT throw on closed connections — callers can check the return value if needed.
|
|
2482
2484
|
*/
|
|
2483
|
-
send(message: Message):
|
|
2485
|
+
send(message: Message): boolean;
|
|
2484
2486
|
/**
|
|
2485
2487
|
* Register a message handler to receive all messages
|
|
2486
2488
|
*/
|
package/dist/index.js
CHANGED
|
@@ -6834,6 +6834,7 @@ ${formatted}`;
|
|
|
6834
6834
|
Analyze the error and try again with a corrected query.`;
|
|
6835
6835
|
}
|
|
6836
6836
|
};
|
|
6837
|
+
const maxIterations = this.config.maxRetries + 2;
|
|
6837
6838
|
await LLM.streamWithTools(
|
|
6838
6839
|
{ sys: prompts.system, user: prompts.user },
|
|
6839
6840
|
[llmTool],
|
|
@@ -6844,7 +6845,7 @@ Analyze the error and try again with a corrected query.`;
|
|
|
6844
6845
|
temperature: 0,
|
|
6845
6846
|
apiKey: this.config.apiKey
|
|
6846
6847
|
},
|
|
6847
|
-
|
|
6848
|
+
maxIterations
|
|
6848
6849
|
);
|
|
6849
6850
|
const executionTimeMs = Date.now() - startTime;
|
|
6850
6851
|
if (!executedTool) {
|
|
@@ -10227,21 +10228,25 @@ var get_user_request = async (data, components, sendMessage, anthropicApiKey, gr
|
|
|
10227
10228
|
if (responseMode === "text") {
|
|
10228
10229
|
streamCallback = (chunk) => {
|
|
10229
10230
|
accumulatedStreamResponse += chunk;
|
|
10230
|
-
|
|
10231
|
-
|
|
10232
|
-
|
|
10233
|
-
|
|
10234
|
-
|
|
10235
|
-
|
|
10236
|
-
|
|
10237
|
-
|
|
10238
|
-
|
|
10239
|
-
|
|
10240
|
-
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
|
|
10231
|
+
try {
|
|
10232
|
+
const streamMessage = {
|
|
10233
|
+
id: `stream_${existingUiBlockId}`,
|
|
10234
|
+
// Different ID pattern for streaming
|
|
10235
|
+
type: "USER_PROMPT_STREAM",
|
|
10236
|
+
from: { type: "data-agent" },
|
|
10237
|
+
to: {
|
|
10238
|
+
type: "runtime",
|
|
10239
|
+
id: wsId
|
|
10240
|
+
},
|
|
10241
|
+
payload: {
|
|
10242
|
+
uiBlockId: existingUiBlockId,
|
|
10243
|
+
chunk
|
|
10244
|
+
}
|
|
10245
|
+
};
|
|
10246
|
+
sendMessage(streamMessage);
|
|
10247
|
+
} catch (err) {
|
|
10248
|
+
logger.warn(`[UserPromptRequest] Stream send failed (WebSocket may be closed): ${err instanceof Error ? err.message : String(err)}`);
|
|
10249
|
+
}
|
|
10245
10250
|
};
|
|
10246
10251
|
}
|
|
10247
10252
|
const userResponse = await get_agent_user_response(
|
|
@@ -15476,17 +15481,27 @@ var SuperatomSDK = class {
|
|
|
15476
15481
|
}
|
|
15477
15482
|
}
|
|
15478
15483
|
/**
|
|
15479
|
-
* Send a message to the Superatom service
|
|
15484
|
+
* Send a message to the Superatom service.
|
|
15485
|
+
* Returns true if the message was sent, false if the WebSocket is not connected.
|
|
15486
|
+
* Does NOT throw on closed connections — callers can check the return value if needed.
|
|
15480
15487
|
*/
|
|
15481
15488
|
send(message) {
|
|
15482
15489
|
if (!this.ws || !this.connected) {
|
|
15483
|
-
|
|
15490
|
+
logger.warn("WebSocket is not connected, message not sent:", message.type);
|
|
15491
|
+
return false;
|
|
15484
15492
|
}
|
|
15485
15493
|
if (this.ws.readyState !== this.ws.OPEN) {
|
|
15486
|
-
|
|
15494
|
+
logger.warn("WebSocket is not in OPEN state, message not sent:", message.type);
|
|
15495
|
+
return false;
|
|
15496
|
+
}
|
|
15497
|
+
try {
|
|
15498
|
+
const payload = JSON.stringify(message);
|
|
15499
|
+
this.ws.send(payload);
|
|
15500
|
+
return true;
|
|
15501
|
+
} catch (error) {
|
|
15502
|
+
logger.warn(`Failed to send WebSocket message (${message.type}):`, error instanceof Error ? error.message : String(error));
|
|
15503
|
+
return false;
|
|
15487
15504
|
}
|
|
15488
|
-
const payload = JSON.stringify(message);
|
|
15489
|
-
this.ws.send(payload);
|
|
15490
15505
|
}
|
|
15491
15506
|
/**
|
|
15492
15507
|
* Register a message handler to receive all messages
|