@letta-ai/letta-agent-sdk 0.8.65 → 0.8.67
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 +53 -1
- package/dist/client-entry.js.map +3 -3
- package/dist/index.js +54 -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)}`));
|
|
@@ -9750,6 +9795,13 @@ class AppServerClient {
|
|
|
9750
9795
|
predicate: (message) => message.type === "subagent_message_response"
|
|
9751
9796
|
});
|
|
9752
9797
|
}
|
|
9798
|
+
readSubagentEvents(command, options = {}) {
|
|
9799
|
+
const requestId = command.request_id ?? this.nextRequestId("read-subagent-events");
|
|
9800
|
+
return this.request({ ...command, type: "read_subagent_events", request_id: requestId }, {
|
|
9801
|
+
...options,
|
|
9802
|
+
predicate: (message) => message.type === "read_subagent_events_response" && message.request_id === requestId
|
|
9803
|
+
});
|
|
9804
|
+
}
|
|
9753
9805
|
stopSubagent(command, options = {}) {
|
|
9754
9806
|
return this.request({
|
|
9755
9807
|
...command,
|
|
@@ -34950,7 +35002,7 @@ class StreamableHTTPClientTransport {
|
|
|
34950
35002
|
}
|
|
34951
35003
|
var DEFAULT_CLIENT_INFO = {
|
|
34952
35004
|
name: "letta-code",
|
|
34953
|
-
version: "0.34.
|
|
35005
|
+
version: "0.34.38"
|
|
34954
35006
|
};
|
|
34955
35007
|
async function connectMcpServer(config2, options = {}) {
|
|
34956
35008
|
let client = new Client(options.clientInfo ?? DEFAULT_CLIENT_INFO);
|
|
@@ -35978,4 +36030,4 @@ export {
|
|
|
35978
36030
|
CloudManagedSandboxExpiredError
|
|
35979
36031
|
};
|
|
35980
36032
|
|
|
35981
|
-
//# debugId=
|
|
36033
|
+
//# debugId=C8E2F6B93C8F552D64756E2164756E21
|