@letta-ai/letta-agent-sdk 0.2.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/LICENSE +190 -0
- package/README.md +240 -0
- package/dist/app-server-session.d.ts +86 -0
- package/dist/app-server-session.d.ts.map +1 -0
- package/dist/cli-resolver.d.ts +9 -0
- package/dist/cli-resolver.d.ts.map +1 -0
- package/dist/client.d.ts +47 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/cloud-session.d.ts +45 -0
- package/dist/cloud-session.d.ts.map +1 -0
- package/dist/index.d.ts +167 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4994 -0
- package/dist/index.js.map +24 -0
- package/dist/interactiveToolPolicy.d.ts +4 -0
- package/dist/interactiveToolPolicy.d.ts.map +1 -0
- package/dist/local-app-server.d.ts +17 -0
- package/dist/local-app-server.d.ts.map +1 -0
- package/dist/protocol.d.ts +205 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/remote-client-session-core.d.ts +140 -0
- package/dist/remote-client-session-core.d.ts.map +1 -0
- package/dist/remote.d.ts +57 -0
- package/dist/remote.d.ts.map +1 -0
- package/dist/session.d.ts +142 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/stream-events.d.ts +15 -0
- package/dist/stream-events.d.ts.map +1 -0
- package/dist/tests/advanced-session.d.ts +10 -0
- package/dist/tests/advanced-session.d.ts.map +1 -0
- package/dist/tool-helpers.d.ts +47 -0
- package/dist/tool-helpers.d.ts.map +1 -0
- package/dist/transport.d.ts +53 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/types.d.ts +759 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/validation.d.ts +15 -0
- package/dist/validation.d.ts.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Helpers
|
|
3
|
+
*
|
|
4
|
+
* Helper functions for creating tool results and parsing parameters.
|
|
5
|
+
* Matches the API from pi-coding-agent.
|
|
6
|
+
*/
|
|
7
|
+
import type { AgentToolResult } from "./types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Create a JSON tool result
|
|
10
|
+
*/
|
|
11
|
+
export declare function jsonResult(payload: unknown): AgentToolResult<unknown>;
|
|
12
|
+
/**
|
|
13
|
+
* Options for reading string parameters
|
|
14
|
+
*/
|
|
15
|
+
export interface StringParamOptions {
|
|
16
|
+
required?: boolean;
|
|
17
|
+
trim?: boolean;
|
|
18
|
+
label?: string;
|
|
19
|
+
allowEmpty?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Read a string parameter from tool args
|
|
23
|
+
*/
|
|
24
|
+
export declare function readStringParam(params: Record<string, unknown>, key: string, options?: StringParamOptions & {
|
|
25
|
+
required: true;
|
|
26
|
+
}): string;
|
|
27
|
+
export declare function readStringParam(params: Record<string, unknown>, key: string, options?: StringParamOptions): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Read a number parameter from tool args
|
|
30
|
+
*/
|
|
31
|
+
export declare function readNumberParam(params: Record<string, unknown>, key: string, options?: {
|
|
32
|
+
required?: boolean;
|
|
33
|
+
label?: string;
|
|
34
|
+
integer?: boolean;
|
|
35
|
+
}): number | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Read a boolean parameter from tool args
|
|
38
|
+
*/
|
|
39
|
+
export declare function readBooleanParam(params: Record<string, unknown>, key: string, options?: {
|
|
40
|
+
required?: boolean;
|
|
41
|
+
label?: string;
|
|
42
|
+
}): boolean | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Read a string array parameter from tool args
|
|
45
|
+
*/
|
|
46
|
+
export declare function readStringArrayParam(params: Record<string, unknown>, key: string, options?: StringParamOptions): string[] | undefined;
|
|
47
|
+
//# sourceMappingURL=tool-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-helpers.d.ts","sourceRoot":"","sources":["../src/tool-helpers.ts"],"names":[],"m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SAAS,CAarB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,kBAAuB,GAC/B,MAAM,EAAE,GAAG,SAAS,CAwBtB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SubprocessTransport
|
|
3
|
+
*
|
|
4
|
+
* Spawns the Letta Code CLI and communicates via stdin/stdout JSON streams.
|
|
5
|
+
*/
|
|
6
|
+
import type { InternalSessionOptions, WireMessage } from "./types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Build the CLI argument array for a given set of session options.
|
|
9
|
+
*
|
|
10
|
+
* Exported as a pure function for testing — this IS the real production code
|
|
11
|
+
* path. SubprocessTransport.buildArgs() delegates here.
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildCliArgs(options: InternalSessionOptions): string[];
|
|
14
|
+
export declare class SubprocessTransport {
|
|
15
|
+
private options;
|
|
16
|
+
private process;
|
|
17
|
+
private stdout;
|
|
18
|
+
private messageQueue;
|
|
19
|
+
private messageResolvers;
|
|
20
|
+
private closed;
|
|
21
|
+
private agentId?;
|
|
22
|
+
private wireMessageCount;
|
|
23
|
+
private lastMessageAt;
|
|
24
|
+
private stderrLines;
|
|
25
|
+
constructor(options?: InternalSessionOptions);
|
|
26
|
+
/**
|
|
27
|
+
* Start the CLI subprocess
|
|
28
|
+
*/
|
|
29
|
+
connect(): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Send a message to the CLI via stdin
|
|
32
|
+
*/
|
|
33
|
+
write(data: object): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Read the next message from the CLI
|
|
36
|
+
*/
|
|
37
|
+
read(): Promise<WireMessage | null>;
|
|
38
|
+
/**
|
|
39
|
+
* Async iterator for messages
|
|
40
|
+
*/
|
|
41
|
+
messages(): AsyncGenerator<WireMessage>;
|
|
42
|
+
/**
|
|
43
|
+
* Close the transport
|
|
44
|
+
*/
|
|
45
|
+
close(): void;
|
|
46
|
+
get isClosed(): boolean;
|
|
47
|
+
/** Return buffered stderr output from the CLI subprocess. */
|
|
48
|
+
getStderr(): string;
|
|
49
|
+
private handleMessage;
|
|
50
|
+
private buildArgs;
|
|
51
|
+
private findCli;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAgCtE;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,sBAAsB,GAAG,MAAM,EAAE,CAqKtE;AAED,qBAAa,mBAAmB;IAY5B,OAAO,CAAC,OAAO;IAXjB,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,YAAY,CAAqB;IACzC,OAAO,CAAC,gBAAgB,CAAgD;IACxE,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,WAAW,CAAgB;gBAGzB,OAAO,GAAE,sBAA2B;IAG9C;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA+E9B;;OAEG;IACG,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWxC;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAmBzC;;OAEG;IACI,QAAQ,IAAI,cAAc,CAAC,WAAW,CAAC;IAW9C;;OAEG;IACH,KAAK,IAAI,IAAI;IAgBb,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,6DAA6D;IAC7D,SAAS,IAAI,MAAM;IAInB,OAAO,CAAC,aAAa;IAqCrB,OAAO,CAAC,SAAS;YAMH,OAAO;CA4CtB"}
|