@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,4 @@
|
|
|
1
|
+
export declare function isInteractiveApprovalTool(toolName: string): boolean;
|
|
2
|
+
export declare function requiresRuntimeUserInput(toolName: string): boolean;
|
|
3
|
+
export declare function isHeadlessAutoAllowTool(toolName: string): boolean;
|
|
4
|
+
//# sourceMappingURL=interactiveToolPolicy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactiveToolPolicy.d.ts","sourceRoot":"","sources":["../src/interactiveToolPolicy.ts"],"names":[],"mappings":"AAaA,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEnE;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAElE;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEjE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface LocalAppServerHandle {
|
|
2
|
+
url: string;
|
|
3
|
+
close(): void;
|
|
4
|
+
}
|
|
5
|
+
export interface StartLocalAppServerOptions {
|
|
6
|
+
listen?: string;
|
|
7
|
+
backend?: string;
|
|
8
|
+
startupTimeoutMs?: number;
|
|
9
|
+
cliPath?: string;
|
|
10
|
+
env?: Record<string, string | undefined>;
|
|
11
|
+
}
|
|
12
|
+
export declare function buildLocalAppServerArgs(cliPath: string, options?: Pick<StartLocalAppServerOptions, "backend" | "listen">): string[];
|
|
13
|
+
/**
|
|
14
|
+
* Spawn an SDK-owned Letta Code app-server on an ephemeral loopback port.
|
|
15
|
+
*/
|
|
16
|
+
export declare function startLocalAppServer(options?: StartLocalAppServerOptions): Promise<LocalAppServerHandle>;
|
|
17
|
+
//# sourceMappingURL=local-app-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-app-server.d.ts","sourceRoot":"","sources":["../src/local-app-server.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,0BAA0B;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC1C;AAeD,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,IAAI,CAAC,0BAA0B,EAAE,SAAS,GAAG,QAAQ,CAAM,GACnE,MAAM,EAAE,CAQV;AAYD;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,oBAAoB,CAAC,CA+E/B"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local protocol type surface consumed by the SDK.
|
|
3
|
+
*
|
|
4
|
+
* @letta-ai/letta-code@0.27.11 publishes these declarations under an internal
|
|
5
|
+
* dist path while its package.json points the public `./protocol` export at a
|
|
6
|
+
* missing file. Keep the SDK's public types self-contained so CI and consumers
|
|
7
|
+
* do not depend on that broken subpath export.
|
|
8
|
+
*/
|
|
9
|
+
export interface MessageEnvelope {
|
|
10
|
+
type: string;
|
|
11
|
+
session_id?: string;
|
|
12
|
+
uuid?: string;
|
|
13
|
+
timestamp?: string;
|
|
14
|
+
event_seq?: number;
|
|
15
|
+
agent_id?: string;
|
|
16
|
+
conversation_id?: string;
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* System prompt preset configuration used by the CLI protocol.
|
|
21
|
+
*/
|
|
22
|
+
export interface SystemPromptPresetConfig {
|
|
23
|
+
type: "preset";
|
|
24
|
+
preset: string;
|
|
25
|
+
append?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Custom memory block definition accepted when creating agents.
|
|
29
|
+
*/
|
|
30
|
+
export interface CreateBlock {
|
|
31
|
+
label: string;
|
|
32
|
+
value: string;
|
|
33
|
+
base_template_id?: string | null;
|
|
34
|
+
deployment_id?: string | null;
|
|
35
|
+
description?: string | null;
|
|
36
|
+
entity_id?: string | null;
|
|
37
|
+
hidden?: boolean | null;
|
|
38
|
+
is_template?: boolean;
|
|
39
|
+
limit?: number;
|
|
40
|
+
metadata?: Record<string, unknown> | null;
|
|
41
|
+
preserve_on_migration?: boolean | null;
|
|
42
|
+
project_id?: string | null;
|
|
43
|
+
read_only?: boolean;
|
|
44
|
+
tags?: string[] | null;
|
|
45
|
+
template_id?: string | null;
|
|
46
|
+
template_name?: string | null;
|
|
47
|
+
}
|
|
48
|
+
export interface SystemInitMessage extends MessageEnvelope {
|
|
49
|
+
type: "system";
|
|
50
|
+
subtype: "init";
|
|
51
|
+
agent_id: string;
|
|
52
|
+
conversation_id: string;
|
|
53
|
+
model: string;
|
|
54
|
+
tools: string[];
|
|
55
|
+
cwd: string;
|
|
56
|
+
mcp_servers: Array<{
|
|
57
|
+
name: string;
|
|
58
|
+
status: string;
|
|
59
|
+
}>;
|
|
60
|
+
permission_mode: string;
|
|
61
|
+
slash_commands: string[];
|
|
62
|
+
memfs_enabled?: boolean;
|
|
63
|
+
skill_sources?: Array<"bundled" | "global" | "agent" | "project">;
|
|
64
|
+
system_info_reminder_enabled?: boolean;
|
|
65
|
+
reflection_trigger?: "off" | "step-count" | "compaction-event";
|
|
66
|
+
reflection_behavior?: "reminder" | "auto-launch";
|
|
67
|
+
reflection_step_count?: number;
|
|
68
|
+
}
|
|
69
|
+
export interface MessageWire extends MessageEnvelope {
|
|
70
|
+
type: "message";
|
|
71
|
+
message_type?: string;
|
|
72
|
+
run_id?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface StreamEvent extends MessageEnvelope {
|
|
75
|
+
type: "stream_event";
|
|
76
|
+
event: unknown;
|
|
77
|
+
}
|
|
78
|
+
export type ResultSubtype = "success" | "interrupted" | "error" | string;
|
|
79
|
+
export interface ResultMessage extends MessageEnvelope {
|
|
80
|
+
type: "result";
|
|
81
|
+
subtype: ResultSubtype;
|
|
82
|
+
agent_id?: string;
|
|
83
|
+
conversation_id: string;
|
|
84
|
+
duration_ms: number;
|
|
85
|
+
duration_api_ms?: number;
|
|
86
|
+
num_turns?: number;
|
|
87
|
+
result?: string | null;
|
|
88
|
+
run_ids?: string[];
|
|
89
|
+
usage?: unknown;
|
|
90
|
+
stop_reason?: string;
|
|
91
|
+
}
|
|
92
|
+
export interface ErrorMessage extends MessageEnvelope {
|
|
93
|
+
type: "error";
|
|
94
|
+
message: string;
|
|
95
|
+
stop_reason: string;
|
|
96
|
+
run_id?: string;
|
|
97
|
+
api_error?: Record<string, unknown>;
|
|
98
|
+
}
|
|
99
|
+
export interface CanUseToolControlRequest {
|
|
100
|
+
subtype: "can_use_tool";
|
|
101
|
+
tool_name: string;
|
|
102
|
+
input: Record<string, unknown>;
|
|
103
|
+
tool_call_id: string;
|
|
104
|
+
permission_suggestions?: unknown[];
|
|
105
|
+
blocked_path?: string | null;
|
|
106
|
+
diffs?: unknown[];
|
|
107
|
+
}
|
|
108
|
+
export interface RegisterExternalToolsRequest {
|
|
109
|
+
subtype: "register_external_tools";
|
|
110
|
+
tools: Array<{
|
|
111
|
+
name: string;
|
|
112
|
+
label?: string;
|
|
113
|
+
description: string;
|
|
114
|
+
parameters: Record<string, unknown>;
|
|
115
|
+
}>;
|
|
116
|
+
}
|
|
117
|
+
export interface BootstrapSessionStateRequest {
|
|
118
|
+
subtype: "bootstrap_session_state";
|
|
119
|
+
limit?: number;
|
|
120
|
+
order?: "asc" | "desc";
|
|
121
|
+
}
|
|
122
|
+
export interface RecoverPendingApprovalsControlRequest {
|
|
123
|
+
subtype: "recover_pending_approvals";
|
|
124
|
+
agent_id?: string;
|
|
125
|
+
conversation_id?: string;
|
|
126
|
+
}
|
|
127
|
+
export interface ListMessagesControlRequest {
|
|
128
|
+
subtype: "list_messages";
|
|
129
|
+
conversation_id?: string;
|
|
130
|
+
agent_id?: string;
|
|
131
|
+
before?: string;
|
|
132
|
+
after?: string;
|
|
133
|
+
order?: "asc" | "desc";
|
|
134
|
+
limit?: number;
|
|
135
|
+
}
|
|
136
|
+
export interface InterruptControlRequest {
|
|
137
|
+
subtype: "interrupt";
|
|
138
|
+
}
|
|
139
|
+
export interface InitializeControlRequest {
|
|
140
|
+
subtype: "initialize";
|
|
141
|
+
}
|
|
142
|
+
export interface ExecuteExternalToolControlRequest {
|
|
143
|
+
subtype: "execute_external_tool";
|
|
144
|
+
tool_call_id: string;
|
|
145
|
+
tool_name: string;
|
|
146
|
+
input: Record<string, unknown>;
|
|
147
|
+
}
|
|
148
|
+
export type ControlRequestBody = InitializeControlRequest | InterruptControlRequest | RegisterExternalToolsRequest | BootstrapSessionStateRequest | RecoverPendingApprovalsControlRequest | ListMessagesControlRequest | CanUseToolControlRequest | ExecuteExternalToolControlRequest | (Record<string, unknown> & {
|
|
149
|
+
subtype: string;
|
|
150
|
+
});
|
|
151
|
+
export interface ControlRequest extends MessageEnvelope {
|
|
152
|
+
type: "control_request";
|
|
153
|
+
request_id: string;
|
|
154
|
+
request: ControlRequestBody;
|
|
155
|
+
}
|
|
156
|
+
export interface CanUseToolResponseAllow {
|
|
157
|
+
behavior: "allow";
|
|
158
|
+
message?: string;
|
|
159
|
+
updatedInput?: Record<string, unknown> | null;
|
|
160
|
+
updatedPermissions?: unknown[];
|
|
161
|
+
}
|
|
162
|
+
export interface CanUseToolResponseDeny {
|
|
163
|
+
behavior: "deny";
|
|
164
|
+
message: string;
|
|
165
|
+
interrupt?: boolean;
|
|
166
|
+
}
|
|
167
|
+
export type CanUseToolResponse = CanUseToolResponseAllow | CanUseToolResponseDeny;
|
|
168
|
+
export interface ExternalToolResultContent {
|
|
169
|
+
type: "text" | "image";
|
|
170
|
+
text?: string;
|
|
171
|
+
data?: string;
|
|
172
|
+
mimeType?: string;
|
|
173
|
+
}
|
|
174
|
+
export interface ExternalToolResultResponse {
|
|
175
|
+
subtype: "external_tool_result";
|
|
176
|
+
request_id: string;
|
|
177
|
+
tool_call_id: string;
|
|
178
|
+
content: ExternalToolResultContent[];
|
|
179
|
+
is_error: boolean;
|
|
180
|
+
}
|
|
181
|
+
export type ControlResponseBody = {
|
|
182
|
+
subtype: "success";
|
|
183
|
+
request_id: string;
|
|
184
|
+
response?: CanUseToolResponse | Record<string, unknown>;
|
|
185
|
+
} | {
|
|
186
|
+
subtype: "error";
|
|
187
|
+
request_id: string;
|
|
188
|
+
error: string;
|
|
189
|
+
} | ExternalToolResultResponse;
|
|
190
|
+
export interface ControlResponse extends MessageEnvelope {
|
|
191
|
+
type: "control_response";
|
|
192
|
+
response: ControlResponseBody;
|
|
193
|
+
}
|
|
194
|
+
export interface RetryMessage extends MessageEnvelope {
|
|
195
|
+
type: "retry";
|
|
196
|
+
reason: string;
|
|
197
|
+
attempt: number;
|
|
198
|
+
max_attempts: number;
|
|
199
|
+
delay_ms: number;
|
|
200
|
+
run_id?: string;
|
|
201
|
+
}
|
|
202
|
+
export type WireMessage = SystemInitMessage | MessageWire | StreamEvent | ResultMessage | ErrorMessage | RetryMessage | ControlRequest | ControlResponse | (MessageEnvelope & {
|
|
203
|
+
type: string;
|
|
204
|
+
});
|
|
205
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,IAAI,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ult, CreateAgentOptions, LettaCodeClientSessionOptions, LettaCodeSession, ListModelsResult, ListMessagesOptions, ListMessagesResult, MessageContentItem, RecoverPendingApprovalsOptions, RecoverPendingApprovalsResult, RunTurnOptions, SDKErrorCode, SDKInitMessage, SDKMessage, SDKProtocolCommand, SDKProtocolMessage, SDKResultMessage, SendCommandOptions, SendMessage, UpdateModelOptions, UpdateModelResult } from "./types.js";
|
|
2
|
+
export type RuntimeScope = {
|
|
3
|
+
agent_id: string;
|
|
4
|
+
conversation_id: string;
|
|
5
|
+
};
|
|
6
|
+
export type ProtocolMessage = Record<string, unknown> & {
|
|
7
|
+
type: string;
|
|
8
|
+
request_id?: string;
|
|
9
|
+
runtime?: RuntimeScope;
|
|
10
|
+
};
|
|
11
|
+
export type RuntimeSessionMode = {
|
|
12
|
+
kind: "create-agent";
|
|
13
|
+
options: CreateAgentOptions;
|
|
14
|
+
} | {
|
|
15
|
+
kind: "session";
|
|
16
|
+
agentId?: string;
|
|
17
|
+
conversationId?: string;
|
|
18
|
+
newConversation?: boolean;
|
|
19
|
+
defaultConversation?: boolean;
|
|
20
|
+
options: LettaCodeClientSessionOptions;
|
|
21
|
+
};
|
|
22
|
+
export type RuntimeTurnResult = {
|
|
23
|
+
runtime: RuntimeScope;
|
|
24
|
+
stopReason: string | null;
|
|
25
|
+
runIds: string[];
|
|
26
|
+
success?: boolean;
|
|
27
|
+
detail?: string;
|
|
28
|
+
errorCode?: SDKErrorCode;
|
|
29
|
+
};
|
|
30
|
+
export type RuntimeSendTurnOptions = {
|
|
31
|
+
clientMessageId: string;
|
|
32
|
+
};
|
|
33
|
+
export type RuntimeRequestOptions = {
|
|
34
|
+
timeoutMs?: number;
|
|
35
|
+
predicate?: (message: ProtocolMessage) => boolean;
|
|
36
|
+
};
|
|
37
|
+
export interface RemoteClientRuntimeController {
|
|
38
|
+
onMessage(handler: (message: ProtocolMessage, channel?: string) => void): () => void;
|
|
39
|
+
send(command: Record<string, unknown>): void;
|
|
40
|
+
sendTurnMessage(runtime: RuntimeScope, message: SendMessage, options: RuntimeSendTurnOptions): void;
|
|
41
|
+
abort(runtime: RuntimeScope): Promise<void>;
|
|
42
|
+
request(type: string, body: Record<string, unknown>, options?: RuntimeRequestOptions): Promise<ProtocolMessage>;
|
|
43
|
+
recoverPendingApprovals(runtime: RuntimeScope, options?: RecoverPendingApprovalsOptions): Promise<RecoverPendingApprovalsResult>;
|
|
44
|
+
listMessages(conversationId: string, options?: ListMessagesOptions): Promise<ListMessagesResult>;
|
|
45
|
+
listModels(): Promise<ListModelsResult>;
|
|
46
|
+
updateModel(runtime: RuntimeScope, payload: {
|
|
47
|
+
model_id?: string;
|
|
48
|
+
model_handle?: string;
|
|
49
|
+
}): Promise<UpdateModelResult>;
|
|
50
|
+
close(): void;
|
|
51
|
+
}
|
|
52
|
+
export type RuntimeSessionInit = {
|
|
53
|
+
controller: RemoteClientRuntimeController;
|
|
54
|
+
runtime: RuntimeScope;
|
|
55
|
+
model?: string | null;
|
|
56
|
+
modelSettings?: Record<string, unknown> | null;
|
|
57
|
+
tools?: string[];
|
|
58
|
+
};
|
|
59
|
+
type RemoteClientSessionCoreConfig = {
|
|
60
|
+
label: string;
|
|
61
|
+
requestTimeoutMs?: number;
|
|
62
|
+
};
|
|
63
|
+
export declare function mapPermissionMode(mode: LettaCodeClientSessionOptions["permissionMode"]): string | undefined;
|
|
64
|
+
export declare function ensureSuccess(message: Record<string, unknown>, fallback: string): void;
|
|
65
|
+
export declare function normalizeSendMessage(message: SendMessage): string | MessageContentItem[];
|
|
66
|
+
export declare abstract class RemoteClientSessionCore implements LettaCodeSession {
|
|
67
|
+
protected readonly mode: RuntimeSessionMode;
|
|
68
|
+
protected controller: RemoteClientRuntimeController | null;
|
|
69
|
+
protected runtime: RuntimeScope | null;
|
|
70
|
+
protected initialized: boolean;
|
|
71
|
+
protected closed: boolean;
|
|
72
|
+
protected activeTurnStartedAt: number;
|
|
73
|
+
protected _agentId: string | null;
|
|
74
|
+
protected _sessionId: string | null;
|
|
75
|
+
protected _conversationId: string | null;
|
|
76
|
+
protected _model: string;
|
|
77
|
+
protected _modelSettings: Record<string, unknown> | null;
|
|
78
|
+
private readonly label;
|
|
79
|
+
private readonly requestTimeoutMs;
|
|
80
|
+
private streamQueue;
|
|
81
|
+
private streamResolvers;
|
|
82
|
+
private removeMessageHandler;
|
|
83
|
+
private activeTurn;
|
|
84
|
+
private pendingTurns;
|
|
85
|
+
private nextTurnId;
|
|
86
|
+
private messageCounter;
|
|
87
|
+
private clientMessageCounter;
|
|
88
|
+
private toolNames;
|
|
89
|
+
protected constructor(mode: RuntimeSessionMode, config: RemoteClientSessionCoreConfig);
|
|
90
|
+
initialize(): Promise<SDKInitMessage>;
|
|
91
|
+
send(message: SendMessage): Promise<void>;
|
|
92
|
+
runTurn(message: SendMessage, _options?: RunTurnOptions): Promise<SDKResultMessage>;
|
|
93
|
+
stream(): AsyncGenerator<SDKMessage>;
|
|
94
|
+
abort(): Promise<void>;
|
|
95
|
+
sendCommand(command: SDKProtocolCommand): Promise<void>;
|
|
96
|
+
sendCommand<TResponse extends SDKProtocolMessage = SDKProtocolMessage>(command: SDKProtocolCommand, options: SendCommandOptions): Promise<TResponse>;
|
|
97
|
+
listModels(): Promise<ListModelsResult>;
|
|
98
|
+
updateModel(update: string | UpdateModelOptions): Promise<UpdateModelResult>;
|
|
99
|
+
recoverPendingApprovals(options?: RecoverPendingApprovalsOptions): Promise<RecoverPendingApprovalsResult>;
|
|
100
|
+
listMessages(options?: ListMessagesOptions): Promise<ListMessagesResult>;
|
|
101
|
+
bootstrapState(options?: BootstrapStateOptions): Promise<BootstrapStateResult>;
|
|
102
|
+
close(): void;
|
|
103
|
+
get agentId(): string | null;
|
|
104
|
+
get sessionId(): string | null;
|
|
105
|
+
get conversationId(): string | null;
|
|
106
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
107
|
+
changeDeviceState(updates: {
|
|
108
|
+
cwd?: string;
|
|
109
|
+
permissionMode?: LettaCodeClientSessionOptions["permissionMode"];
|
|
110
|
+
agentId?: string;
|
|
111
|
+
conversationId?: string;
|
|
112
|
+
}): Promise<void>;
|
|
113
|
+
updateToolset(toolsetPreference: string): Promise<void>;
|
|
114
|
+
protected abstract initializeRuntimeController(): Promise<RuntimeSessionInit>;
|
|
115
|
+
protected afterRuntimeInitialized(): Promise<void>;
|
|
116
|
+
protected beforeTurn(): Promise<void>;
|
|
117
|
+
protected onCoreClose(): void;
|
|
118
|
+
protected currentOptions(): LettaCodeClientSessionOptions | CreateAgentOptions;
|
|
119
|
+
protected shouldEnableMemfs(options: LettaCodeClientSessionOptions | CreateAgentOptions): boolean;
|
|
120
|
+
protected enableMemfsBody(): Record<string, unknown>;
|
|
121
|
+
protected setModel(model: string): void;
|
|
122
|
+
private trackSentTurn;
|
|
123
|
+
private activateTurn;
|
|
124
|
+
private activateNextTurnFromProtocol;
|
|
125
|
+
private removeTrackedTurn;
|
|
126
|
+
private failTurn;
|
|
127
|
+
private completeActiveTurn;
|
|
128
|
+
private resolveUpdateModelPayload;
|
|
129
|
+
protected applyPostInitializeOptions(): Promise<void>;
|
|
130
|
+
private handleProtocolMessage;
|
|
131
|
+
private handleLoopStatusMessage;
|
|
132
|
+
private handleTurnTerminalDelta;
|
|
133
|
+
private transformStreamDelta;
|
|
134
|
+
private resultFromTurn;
|
|
135
|
+
private enqueue;
|
|
136
|
+
private nextMessage;
|
|
137
|
+
private resolveAll;
|
|
138
|
+
}
|
|
139
|
+
export {};
|
|
140
|
+
//# sourceMappingURL=remote-client-session-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-client-session-core.d.ts","sourceRoot":"","sources":["../src/remote-client-session-core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,6BAA6B,EAC7B,gBAAgB,EAEhB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,8BAA8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AAO,CAAC,qBAAqB,CAgC3B;IAEF,OAAO,CAAC,uBAAuB;IA6C/B,OAAO,CAAC,uBAAuB;IAiC/B,OAAO,CAAC,oBAAoB;IA4H5B,OAAO,CAAC,cAAc;IA6BtB,OAAO,CAAC,OAAO;IASf,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,UAAU;CAKnB"}
|
package/dist/remote.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export type RemoteEnvironmentTarget = {
|
|
2
|
+
connectionId: string;
|
|
3
|
+
} | {
|
|
4
|
+
environmentId: string;
|
|
5
|
+
} | {
|
|
6
|
+
deviceId: string;
|
|
7
|
+
} | {
|
|
8
|
+
connectionName: string;
|
|
9
|
+
};
|
|
10
|
+
export interface RemoteEnvironmentClientOptions {
|
|
11
|
+
/** Letta API base URL. Defaults to https://api.letta.com. */
|
|
12
|
+
baseUrl?: string;
|
|
13
|
+
/** Bearer token / API key. Defaults to process.env.LETTA_API_KEY when present. */
|
|
14
|
+
apiKey?: string;
|
|
15
|
+
/** Additional headers, e.g. x-project-id. */
|
|
16
|
+
headers?: Record<string, string>;
|
|
17
|
+
/** Custom fetch implementation for tests or non-standard runtimes. */
|
|
18
|
+
fetch?: typeof fetch;
|
|
19
|
+
}
|
|
20
|
+
export interface RemoteEnvironmentConnection {
|
|
21
|
+
id: string;
|
|
22
|
+
connectionId: string | null;
|
|
23
|
+
deviceId: string;
|
|
24
|
+
connectionName: string;
|
|
25
|
+
organizationId: string;
|
|
26
|
+
userId?: string;
|
|
27
|
+
apiKeyOwner?: string;
|
|
28
|
+
podId: string | null;
|
|
29
|
+
connectedAt: number | null;
|
|
30
|
+
lastHeartbeat: number | null;
|
|
31
|
+
lastSeenAt: number;
|
|
32
|
+
firstSeenAt: number;
|
|
33
|
+
currentMode?: string;
|
|
34
|
+
metadata?: Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
export interface RemoteEnvironmentListResult {
|
|
37
|
+
connections: RemoteEnvironmentConnection[];
|
|
38
|
+
hasNextPage: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface ResolvedRemoteEnvironment {
|
|
41
|
+
connectionId: string;
|
|
42
|
+
environment?: RemoteEnvironmentConnection;
|
|
43
|
+
target: RemoteEnvironmentTarget;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Small Cloud API helper for resolving explicit Letta Code environments.
|
|
47
|
+
*/
|
|
48
|
+
export declare class RemoteEnvironmentClient {
|
|
49
|
+
private readonly options;
|
|
50
|
+
private readonly baseUrl;
|
|
51
|
+
private readonly fetchImpl;
|
|
52
|
+
constructor(options?: RemoteEnvironmentClientOptions);
|
|
53
|
+
listEnvironments(): Promise<RemoteEnvironmentListResult>;
|
|
54
|
+
getEnvironmentByDeviceId(deviceId: string): Promise<RemoteEnvironmentConnection>;
|
|
55
|
+
resolveEnvironment(target: RemoteEnvironmentTarget): Promise<ResolvedRemoteEnvironment>;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=remote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../src/remote.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,uBAAuB,GAC/B;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,GACxB;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GACpB;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/B,MAAM,WAAW,8BAA8B;IAC7C,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,sEAAsE;IACtE,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED,MAAM,WAAW,2BAA2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
|
+
*
|
|
4
|
+
* Represents a conversation session with a Letta agent.
|
|
5
|
+
* Implements the V2 API pattern: send() / receive()
|
|
6
|
+
*/
|
|
7
|
+
import type { InternalSessionOptions, SDKMessage, SDKInitMessage, SDKResultMessage, SendMessage, ListMessagesOptions, ListMessagesResult, ListModelsResult, BootstrapStateOptions, BootstrapStateResult, RunTurnOptions, RecoverPendingApprovalsOptions, RecoverPendingApprovalsResult, SDKProtocolCommand, SDKProtocolMessage, SendCommandOptions, UpdateModelOptions, UpdateModelResult } from "./types.js";
|
|
8
|
+
export declare class Session implements AsyncDisposable {
|
|
9
|
+
private options;
|
|
10
|
+
private transport;
|
|
11
|
+
private _agentId;
|
|
12
|
+
private _sessionId;
|
|
13
|
+
private _conversationId;
|
|
14
|
+
private initialized;
|
|
15
|
+
private externalTools;
|
|
16
|
+
private streamQueue;
|
|
17
|
+
private streamResolvers;
|
|
18
|
+
private pumpPromise;
|
|
19
|
+
private pumpClosed;
|
|
20
|
+
private droppedStreamMessages;
|
|
21
|
+
private sendGeneration;
|
|
22
|
+
private lastCompletedRunIds;
|
|
23
|
+
private controlResponseWaiters;
|
|
24
|
+
constructor(options?: InternalSessionOptions);
|
|
25
|
+
/**
|
|
26
|
+
* Initialize the session (called automatically on first send)
|
|
27
|
+
*/
|
|
28
|
+
initialize(): Promise<SDKInitMessage>;
|
|
29
|
+
/**
|
|
30
|
+
* Send a message to the agent
|
|
31
|
+
*
|
|
32
|
+
* @param message - Text string or multimodal content array
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Simple text
|
|
36
|
+
* await session.send("Hello!");
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // With image
|
|
40
|
+
* await session.send([
|
|
41
|
+
* { type: "text", text: "What's in this image?" },
|
|
42
|
+
* { type: "image", source: { type: "base64", mediaType: "image/png", data: "..." } }
|
|
43
|
+
* ]);
|
|
44
|
+
*/
|
|
45
|
+
send(message: SendMessage): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Run a full turn (send + stream terminal result), with optional bounded
|
|
48
|
+
* SDK-owned approval-conflict recovery.
|
|
49
|
+
*/
|
|
50
|
+
runTurn(message: SendMessage, options?: RunTurnOptions): Promise<SDKResultMessage>;
|
|
51
|
+
/**
|
|
52
|
+
* Ask the CLI to recover pending approvals for the current
|
|
53
|
+
* agent/conversation context.
|
|
54
|
+
*/
|
|
55
|
+
recoverPendingApprovals(options?: RecoverPendingApprovalsOptions): Promise<RecoverPendingApprovalsResult>;
|
|
56
|
+
private resolveMaxApprovalRecoveryAttempts;
|
|
57
|
+
private resolveApprovalRecoveryTimeoutMs;
|
|
58
|
+
private toTerminalApprovalConflictResult;
|
|
59
|
+
private runSingleTurn;
|
|
60
|
+
/**
|
|
61
|
+
* Stream messages from the agent
|
|
62
|
+
*/
|
|
63
|
+
stream(): AsyncGenerator<SDKMessage>;
|
|
64
|
+
private startBackgroundPump;
|
|
65
|
+
private runBackgroundPump;
|
|
66
|
+
private handleControlRequest;
|
|
67
|
+
private enqueueStreamMessage;
|
|
68
|
+
private nextBufferedMessage;
|
|
69
|
+
private resolveAllStreamWaiters;
|
|
70
|
+
private getMessageRunId;
|
|
71
|
+
private updateCompletedRunIds;
|
|
72
|
+
/**
|
|
73
|
+
* Register external tools with the CLI
|
|
74
|
+
*/
|
|
75
|
+
private registerExternalTools;
|
|
76
|
+
/**
|
|
77
|
+
* Convert TypeBox schema to JSON Schema
|
|
78
|
+
*/
|
|
79
|
+
private schemaToJsonSchema;
|
|
80
|
+
/**
|
|
81
|
+
* Handle execute_external_tool control request from CLI
|
|
82
|
+
*/
|
|
83
|
+
private handleExecuteExternalTool;
|
|
84
|
+
/**
|
|
85
|
+
* Handle can_use_tool control request from CLI (Claude SDK compatible format)
|
|
86
|
+
*/
|
|
87
|
+
private handleCanUseTool;
|
|
88
|
+
/**
|
|
89
|
+
* Abort the current operation (interrupt without closing the session)
|
|
90
|
+
*/
|
|
91
|
+
abort(): Promise<void>;
|
|
92
|
+
private requestControlResponse;
|
|
93
|
+
/**
|
|
94
|
+
* Fetch a page of conversation messages via the CLI control protocol.
|
|
95
|
+
*
|
|
96
|
+
* The session must be initialized before calling this method.
|
|
97
|
+
* Safe to call concurrently with an active stream() — the pump routes
|
|
98
|
+
* matching control_response messages to this waiter without touching the
|
|
99
|
+
* stream queue.
|
|
100
|
+
*/
|
|
101
|
+
listMessages(options?: ListMessagesOptions): Promise<ListMessagesResult>;
|
|
102
|
+
listModels(): Promise<ListModelsResult>;
|
|
103
|
+
sendCommand(command: SDKProtocolCommand): Promise<void>;
|
|
104
|
+
sendCommand<TResponse extends SDKProtocolMessage = SDKProtocolMessage>(command: SDKProtocolCommand, options: SendCommandOptions): Promise<TResponse>;
|
|
105
|
+
updateModel(_update: string | UpdateModelOptions): Promise<UpdateModelResult>;
|
|
106
|
+
/**
|
|
107
|
+
* Fetch all data needed to render the initial conversation view in one round-trip.
|
|
108
|
+
*
|
|
109
|
+
* Returns resolved session metadata + initial history page + pending approval flag
|
|
110
|
+
* + optional timing breakdown. This is faster than separate initialize() + listMessages()
|
|
111
|
+
* calls because the CLI collects and returns everything in a single control response.
|
|
112
|
+
*
|
|
113
|
+
* The session must be initialized before calling this method.
|
|
114
|
+
*/
|
|
115
|
+
bootstrapState(options?: BootstrapStateOptions): Promise<BootstrapStateResult>;
|
|
116
|
+
updateToolset(_toolsetPreference: string): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Close the session
|
|
119
|
+
*/
|
|
120
|
+
close(): void;
|
|
121
|
+
/**
|
|
122
|
+
* Get the agent ID (available after initialization)
|
|
123
|
+
*/
|
|
124
|
+
get agentId(): string | null;
|
|
125
|
+
/**
|
|
126
|
+
* Get the session ID (available after initialization)
|
|
127
|
+
*/
|
|
128
|
+
get sessionId(): string | null;
|
|
129
|
+
/**
|
|
130
|
+
* Get the conversation ID (available after initialization)
|
|
131
|
+
*/
|
|
132
|
+
get conversationId(): string | null;
|
|
133
|
+
/**
|
|
134
|
+
* AsyncDisposable implementation for `await using`
|
|
135
|
+
*/
|
|
136
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Transform wire message to SDK message
|
|
139
|
+
*/
|
|
140
|
+
private transformMessage;
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,sBAAsB,EACtB,UAAU,EACV,cAAc,EACd,gBAAgB,EAShB,WAAW,EAGX,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EAEpB,cAAc,EACd,8BAA8B,EAC9B,6BAA6B,EAC7B,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AA+EpB,qBAAa,OAAQ,YAAW,eAAe;IA6B3C,OAAO,CAAC,OAAO;IA5BjB,OAAO,CAAC,SAAS,CAAsB;IACvC,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,eAAe,CAAuB;IAC9C,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,aAAa,CAAwC;IAC7D,OAAO,CAAC,WAAW,CAA+B;IAClD,OAAO,CAAC,eAAe,CAA0D;IACjF,OAAO,CAAC,WAAW,CAA8B;IACjD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,qBAAqB,CAAK;IAKlC,OAAO,CAAC,cAAc,CAAK;IAG3B,OAAO,CAAC,mBAAmB,CAAqB;IAIhD,OAAO,CAAC,sBAAsB,CAG1B;gBAGM,OAAO,GAAE,sBAA2B;IAkB9C;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC;IA6F3C;;;;;;;;;;;;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AAiB,CAAC;IAMnF;;;;;;;;OAQG;IACG,cAAc,CAClB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,oBAAoB,CAAC;IAwD1B,aAAa,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9D;;OAEG;IACH,KAAK,IAAI,IAAI;IAOb;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,GAAG,IAAI,CAE3B;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,GAAG,IAAI,CAE7B;IAED;;OAEG;IACH,IAAI,cAAc,IAAI,MAAM,GAAG,IAAI,CAElC;IAED;;OAEG;IACG,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5C;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAoQzB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SDKStreamEventPayload } from "./types.js";
|
|
2
|
+
export type StreamTextKind = "assistant" | "reasoning";
|
|
3
|
+
export interface StreamTextDelta {
|
|
4
|
+
kind: StreamTextKind;
|
|
5
|
+
text: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Extract appendable assistant/reasoning text from a stream_event payload.
|
|
9
|
+
*
|
|
10
|
+
* Supports both shapes currently emitted by headless mode:
|
|
11
|
+
* 1) content_block style: { type, delta: { text|reasoning } }
|
|
12
|
+
* 2) message chunk style: { message_type: "assistant_message"|"reasoning_message", ... }
|
|
13
|
+
*/
|
|
14
|
+
export declare function extractStreamTextDelta(event: SDKStreamEventPayload): StreamTextDelta | null;
|
|
15
|
+
//# sourceMappingURL=stream-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-events.d.ts","sourceRoot":"","sources":["../src/stream-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,WAAW,CAAC;AAEvD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AAoCD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,qBAAqB,GAAG,eAAe,GAAG,IAAI,CAqC3F"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BootstrapStateOptions, BootstrapStateResult, LettaCodeSession, RecoverPendingApprovalsOptions, RecoverPendingApprovalsResult, SDKInitMessage, SDKResultMessage, SendMessage } from "../types.js";
|
|
2
|
+
export type AdvancedSession = LettaCodeSession & {
|
|
3
|
+
initialize(): Promise<SDKInitMessage>;
|
|
4
|
+
runTurn(message: SendMessage): Promise<SDKResultMessage>;
|
|
5
|
+
recoverPendingApprovals(options?: RecoverPendingApprovalsOptions): Promise<RecoverPendingApprovalsResult>;
|
|
6
|
+
updateToolset(toolsetPreference: string): Promise<void>;
|
|
7
|
+
bootstrapState(options?: BootstrapStateOptions): Promise<BootstrapStateResult>;
|
|
8
|
+
};
|
|
9
|
+
export declare function asAdvanced(session: LettaCodeSession): AdvancedSession;
|
|
10
|
+
//# sourceMappingURL=advanced-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advanced-session.d.ts","sourceRoot":"","sources":["../../src/tests/advanced-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,8BAA8B,EAC9B,6BAA6B,EAC7B,cAAc,EACd,gBAAgB,EAChB,WAAW,EACZ,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG;IAC/C,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;IACtC,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACzD,uBAAuB,CACrB,OAAO,CAAC,EAAE,8BAA8B,GACvC,OAAO,CAAC,6BAA6B,CAAC,CAAC;IAC1C,aAAa,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,cAAc,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAChF,CAAC;AAEF,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe,CAErE"}
|