@letta-ai/letta-agent-sdk 0.8.78 → 0.8.80
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-base.d.ts +14 -2
- package/dist/client-base.d.ts.map +1 -1
- package/dist/client-entry.d.ts.map +1 -1
- package/dist/client-entry.js +149 -35
- package/dist/client-entry.js.map +9 -9
- package/dist/client.d.ts +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/cloud-session.d.ts +8 -1
- package/dist/cloud-session.d.ts.map +1 -1
- package/dist/external-tools.d.ts +6 -2
- package/dist/external-tools.d.ts.map +1 -1
- package/dist/index.js +175 -39
- package/dist/index.js.map +11 -11
- package/dist/local-app-server.d.ts +3 -1
- package/dist/local-app-server.d.ts.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/app-server-session.ts +2 -2
- package/src/client-base.ts +90 -45
- package/src/client-entry.ts +5 -0
- package/src/client.ts +45 -4
- package/src/cloud-session.ts +22 -2
- package/src/external-tools.ts +58 -7
- package/src/local-app-server.ts +9 -1
- package/src/tool-registration.ts +3 -3
- package/src/types.ts +7 -0
package/src/local-app-server.ts
CHANGED
|
@@ -22,6 +22,8 @@ export interface StartLocalAppServerOptions {
|
|
|
22
22
|
env?: Record<string, string | undefined>;
|
|
23
23
|
filesystemConfinement?: "memory";
|
|
24
24
|
agentId?: string;
|
|
25
|
+
/** Register the app-server as a Letta Cloud computer with this name. */
|
|
26
|
+
computerName?: string;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
interface LocalAppServerProcess {
|
|
@@ -95,7 +97,10 @@ function tryExtractListeningUrl(output: string): string | null {
|
|
|
95
97
|
|
|
96
98
|
export function buildLocalAppServerArgs(
|
|
97
99
|
cliPath: string,
|
|
98
|
-
options: Pick<
|
|
100
|
+
options: Pick<
|
|
101
|
+
StartLocalAppServerOptions,
|
|
102
|
+
"backend" | "listen" | "computerName"
|
|
103
|
+
> = {},
|
|
99
104
|
): string[] {
|
|
100
105
|
return [
|
|
101
106
|
cliPath,
|
|
@@ -103,6 +108,9 @@ export function buildLocalAppServerArgs(
|
|
|
103
108
|
"server",
|
|
104
109
|
"--listen",
|
|
105
110
|
options.listen ?? DEFAULT_LISTEN_URL,
|
|
111
|
+
...(options.computerName !== undefined
|
|
112
|
+
? ["--computer-name", options.computerName]
|
|
113
|
+
: []),
|
|
106
114
|
];
|
|
107
115
|
}
|
|
108
116
|
|
package/src/tool-registration.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "@letta-ai/letta-code/app-server-client";
|
|
6
6
|
import type { ConversationRetrieveResponseMessage } from "@letta-ai/letta-code/app-server-protocol";
|
|
7
7
|
import type { AppServerSessionOptions } from "./app-server-session.js";
|
|
8
|
-
import { createExternalToolCallHandler, externalToolGroups } from "./external-tools.js";
|
|
8
|
+
import { createExternalToolCallHandler, externalToolGroups, registerExternalToolCallHandler } from "./external-tools.js";
|
|
9
9
|
import { applyUniqueRequestIds } from "./request-ids.js";
|
|
10
10
|
import {
|
|
11
11
|
runtimeToolPolicy,
|
|
@@ -215,12 +215,12 @@ export class ToolRegistry {
|
|
|
215
215
|
? { requestTimeoutMs: this.options.requestTimeoutMs }
|
|
216
216
|
: {}),
|
|
217
217
|
}));
|
|
218
|
-
client
|
|
218
|
+
registerExternalToolCallHandler(client, async (request, signal) => {
|
|
219
219
|
const runtime = request.runtime;
|
|
220
220
|
const entry = runtime &&
|
|
221
221
|
[...this.entries].find((candidate) => candidate.runtimes.some((r) => runtimeKey(r) === runtimeKey(runtime)));
|
|
222
222
|
if (!entry) throw new Error(`No tools registered for conversation ${runtime?.conversation_id}`);
|
|
223
|
-
return entry.call(request);
|
|
223
|
+
return entry.call(request, signal);
|
|
224
224
|
});
|
|
225
225
|
try {
|
|
226
226
|
await client.connect();
|
package/src/types.ts
CHANGED
|
@@ -433,6 +433,13 @@ export interface LettaCodeCloudClientOptions {
|
|
|
433
433
|
environment?: LettaCodeEnvironment;
|
|
434
434
|
/** Options for SDK-managed sandboxes when no computer is selected. */
|
|
435
435
|
sandbox?: LettaCodeCloudSandboxOptions;
|
|
436
|
+
/**
|
|
437
|
+
* Register this machine as a computer with this name and run the client's
|
|
438
|
+
* sessions on it. The SDK starts a Letta Code app-server here, so tools from
|
|
439
|
+
* `client.registerTools()` run in this process, including on turns Letta
|
|
440
|
+
* Cloud delivers to this computer. Node.js only; excludes `computer`/`sandbox`.
|
|
441
|
+
*/
|
|
442
|
+
registerComputer?: { name: string };
|
|
436
443
|
}
|
|
437
444
|
|
|
438
445
|
export type LettaCodeClientOptions =
|