@letta-ai/letta-agent-sdk 0.8.65 → 0.8.66
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-entry.js +46 -1
- package/dist/client-entry.js.map +3 -3
- package/dist/index.js +47 -2
- package/dist/index.js.map +4 -4
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -9543,14 +9543,59 @@ function waitForSocketOpen(socket) {
|
|
|
9543
9543
|
return new Promise((resolve, reject) => {
|
|
9544
9544
|
let detachOpen = () => {};
|
|
9545
9545
|
let detachError = () => {};
|
|
9546
|
+
let detachResponse = () => {};
|
|
9547
|
+
let detachBody = () => {};
|
|
9546
9548
|
const cleanup = () => {
|
|
9547
9549
|
detachOpen();
|
|
9548
9550
|
detachError();
|
|
9551
|
+
detachResponse();
|
|
9552
|
+
detachBody();
|
|
9549
9553
|
};
|
|
9550
9554
|
detachOpen = onceSocketEvent(socket, "open", () => {
|
|
9551
9555
|
cleanup();
|
|
9552
9556
|
resolve();
|
|
9553
9557
|
});
|
|
9558
|
+
if (socket.on) {
|
|
9559
|
+
const onResponse = (_request, response) => {
|
|
9560
|
+
if (!response)
|
|
9561
|
+
return;
|
|
9562
|
+
const request = _request;
|
|
9563
|
+
let body = Buffer.alloc(0);
|
|
9564
|
+
let finished = false;
|
|
9565
|
+
const finish = () => {
|
|
9566
|
+
if (finished)
|
|
9567
|
+
return;
|
|
9568
|
+
detachBody();
|
|
9569
|
+
const detail = body.toString("utf8").trim();
|
|
9570
|
+
reject(new Error(`App-server WebSocket failed to open: HTTP ${response.statusCode}${detail ? `: ${detail}` : ""}`));
|
|
9571
|
+
detachOpen();
|
|
9572
|
+
detachResponse();
|
|
9573
|
+
request.once("close", cleanup);
|
|
9574
|
+
request.abort();
|
|
9575
|
+
};
|
|
9576
|
+
const onData = (chunk) => {
|
|
9577
|
+
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
9578
|
+
body = Buffer.concat([body, bytes.subarray(0, 2048 - body.length)]);
|
|
9579
|
+
if (body.length >= 2048)
|
|
9580
|
+
finish();
|
|
9581
|
+
};
|
|
9582
|
+
const timeout = setTimeout(finish, 1000);
|
|
9583
|
+
detachBody = () => {
|
|
9584
|
+
finished = true;
|
|
9585
|
+
clearTimeout(timeout);
|
|
9586
|
+
response.off("data", onData);
|
|
9587
|
+
response.off("end", finish);
|
|
9588
|
+
response.off("error", finish);
|
|
9589
|
+
response.off("close", finish);
|
|
9590
|
+
};
|
|
9591
|
+
response.on("data", onData);
|
|
9592
|
+
response.on("end", finish);
|
|
9593
|
+
response.on("error", finish);
|
|
9594
|
+
response.on("close", finish);
|
|
9595
|
+
};
|
|
9596
|
+
socket.on("unexpected-response", onResponse);
|
|
9597
|
+
detachResponse = () => socket.off?.("unexpected-response", onResponse);
|
|
9598
|
+
}
|
|
9554
9599
|
detachError = onceSocketEvent(socket, "error", (event) => {
|
|
9555
9600
|
cleanup();
|
|
9556
9601
|
reject(new Error(`App-server WebSocket failed to open: ${String(event)}`));
|
|
@@ -34950,7 +34995,7 @@ class StreamableHTTPClientTransport {
|
|
|
34950
34995
|
}
|
|
34951
34996
|
var DEFAULT_CLIENT_INFO = {
|
|
34952
34997
|
name: "letta-code",
|
|
34953
|
-
version: "0.34.
|
|
34998
|
+
version: "0.34.37"
|
|
34954
34999
|
};
|
|
34955
35000
|
async function connectMcpServer(config2, options = {}) {
|
|
34956
35001
|
let client = new Client(options.clientInfo ?? DEFAULT_CLIENT_INFO);
|
|
@@ -35978,4 +36023,4 @@ export {
|
|
|
35978
36023
|
CloudManagedSandboxExpiredError
|
|
35979
36024
|
};
|
|
35980
36025
|
|
|
35981
|
-
//# debugId=
|
|
36026
|
+
//# debugId=087ED942659E791B64756E2164756E21
|