@letta-ai/letta-agent-sdk 0.2.7 → 0.3.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/README.md +91 -325
- package/dist/app-server-management.d.ts +28 -0
- package/dist/app-server-management.d.ts.map +1 -0
- package/dist/app-server-session.d.ts +13 -18
- package/dist/app-server-session.d.ts.map +1 -1
- package/dist/client-base.d.ts +61 -0
- package/dist/client-base.d.ts.map +1 -0
- package/dist/client-entry.d.ts +19 -0
- package/dist/client-entry.d.ts.map +1 -0
- package/dist/client-entry.js +9143 -0
- package/dist/client-entry.js.map +25 -0
- package/dist/client.d.ts +8 -49
- package/dist/client.d.ts.map +1 -1
- package/dist/cloud-management.d.ts +25 -0
- package/dist/cloud-management.d.ts.map +1 -0
- package/dist/cloud-session.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8556 -6439
- package/dist/index.js.map +20 -37
- package/dist/interactiveToolPolicy.d.ts +7 -0
- package/dist/interactiveToolPolicy.d.ts.map +1 -1
- package/dist/local-app-server-session.d.ts +4 -0
- package/dist/local-app-server-session.d.ts.map +1 -0
- package/dist/management-types.d.ts +110 -0
- package/dist/management-types.d.ts.map +1 -0
- package/dist/management.d.ts +21 -0
- package/dist/management.d.ts.map +1 -0
- package/dist/remote-client-session-core.d.ts +8 -7
- package/dist/remote-client-session-core.d.ts.map +1 -1
- package/dist/session.d.ts +5 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/tests/advanced-session.d.ts +1 -9
- package/dist/tests/advanced-session.d.ts.map +1 -1
- package/dist/transport.d.ts.map +1 -1
- package/dist/types.d.ts +193 -15
- package/dist/types.d.ts.map +1 -1
- package/dist/websocket.d.ts +9 -0
- package/dist/websocket.d.ts.map +1 -0
- package/package.json +9 -2
- package/dist/dream/agent.d.ts +0 -55
- package/dist/dream/agent.d.ts.map +0 -1
- package/dist/dream/aggregate.d.ts +0 -38
- package/dist/dream/aggregate.d.ts.map +0 -1
- package/dist/dream/batching.d.ts +0 -12
- package/dist/dream/batching.d.ts.map +0 -1
- package/dist/dream/clone.d.ts +0 -14
- package/dist/dream/clone.d.ts.map +0 -1
- package/dist/dream/cursors.d.ts +0 -7
- package/dist/dream/cursors.d.ts.map +0 -1
- package/dist/dream/index.d.ts +0 -67
- package/dist/dream/index.d.ts.map +0 -1
- package/dist/dream/memfs.d.ts +0 -75
- package/dist/dream/memfs.d.ts.map +0 -1
- package/dist/dream/normalize-core.d.ts +0 -67
- package/dist/dream/normalize-core.d.ts.map +0 -1
- package/dist/dream/prompts.d.ts +0 -26
- package/dist/dream/prompts.d.ts.map +0 -1
- package/dist/dream/redact.d.ts +0 -3
- package/dist/dream/redact.d.ts.map +0 -1
- package/dist/dream/reflect.d.ts +0 -49
- package/dist/dream/reflect.d.ts.map +0 -1
- package/dist/dream/registry.d.ts +0 -4
- package/dist/dream/registry.d.ts.map +0 -1
- package/dist/dream/runner.d.ts +0 -30
- package/dist/dream/runner.d.ts.map +0 -1
- package/dist/dream/sdk-messages.d.ts +0 -4
- package/dist/dream/sdk-messages.d.ts.map +0 -1
- package/dist/dream/select.d.ts +0 -6
- package/dist/dream/select.d.ts.map +0 -1
- package/dist/dream/sources/claude-code.d.ts +0 -18
- package/dist/dream/sources/claude-code.d.ts.map +0 -1
- package/dist/dream/sources/codex.d.ts +0 -20
- package/dist/dream/sources/codex.d.ts.map +0 -1
- package/dist/dream/sources/letta.d.ts +0 -3
- package/dist/dream/sources/letta.d.ts.map +0 -1
- package/dist/dream/sources/openhands.d.ts +0 -43
- package/dist/dream/sources/openhands.d.ts.map +0 -1
- package/dist/dream/sources/transcript-file.d.ts +0 -8
- package/dist/dream/sources/transcript-file.d.ts.map +0 -1
- package/dist/dream/store-utils.d.ts +0 -21
- package/dist/dream/store-utils.d.ts.map +0 -1
- package/dist/dream/transcripts.d.ts +0 -27
- package/dist/dream/transcripts.d.ts.map +0 -1
- package/dist/dream/types.d.ts +0 -48
- package/dist/dream/types.d.ts.map +0 -1
- package/dist/dream/workers.d.ts +0 -12
- package/dist/dream/workers.d.ts.map +0 -1
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
import type { CanUseToolContext } from "./types.js";
|
|
1
2
|
export declare function isInteractiveApprovalTool(toolName: string): boolean;
|
|
2
3
|
export declare function requiresRuntimeUserInput(toolName: string): boolean;
|
|
3
4
|
export declare function isHeadlessAutoAllowTool(toolName: string): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Build the {@link CanUseToolContext} passed to canUseTool callbacks from a raw
|
|
7
|
+
* `can_use_tool` control request body. Fields absent from the wire request are
|
|
8
|
+
* left undefined so callbacks can distinguish "not provided" from empty values.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildCanUseToolContext(request: Record<string, unknown>, requestId?: string): CanUseToolContext;
|
|
4
11
|
//# sourceMappingURL=interactiveToolPolicy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactiveToolPolicy.d.ts","sourceRoot":"","sources":["../src/interactiveToolPolicy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"interactiveToolPolicy.d.ts","sourceRoot":"","sources":["../src/interactiveToolPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAkC,MAAM,YAAY,CAAC;AAYpF,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;AAiBD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,CAAC,EAAE,MAAM,GACjB,iBAAiB,CAWnB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AppServerSession, type AppServerSessionMode } from "./app-server-session.js";
|
|
2
|
+
import type { LettaCodeLocalAppServerOptions } from "./types.js";
|
|
3
|
+
export declare function createLocalAppServerSession(options: LettaCodeLocalAppServerOptions | undefined, mode: AppServerSessionMode): AppServerSession;
|
|
4
|
+
//# sourceMappingURL=local-app-server-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-app-server-session.d.ts","sourceRoot":"","sources":["../src/local-app-server-session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,KAAK,oBAAoB,EAE1B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAC;AAEjE,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,8BAA8B,GAAG,SAAS,EACnD,IAAI,EAAE,oBAAoB,GACzB,gBAAgB,CAyBlB"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { ListMessagesResult, ListModelsResult } from "./types.js";
|
|
2
|
+
/** Agent state returned by either the Cloud API or Letta Code app-server. */
|
|
3
|
+
export type LettaAgent = Record<string, unknown> & {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
description?: string | null;
|
|
7
|
+
model?: string | null;
|
|
8
|
+
model_settings?: Record<string, unknown> | null;
|
|
9
|
+
tags?: string[];
|
|
10
|
+
created_at?: string | null;
|
|
11
|
+
updated_at?: string | null;
|
|
12
|
+
};
|
|
13
|
+
/** Conversation state returned by either the Cloud API or Letta Code app-server. */
|
|
14
|
+
export type LettaConversation = Record<string, unknown> & {
|
|
15
|
+
id: string;
|
|
16
|
+
agent_id: string;
|
|
17
|
+
summary?: string | null;
|
|
18
|
+
description?: string | null;
|
|
19
|
+
model?: string | null;
|
|
20
|
+
model_settings?: Record<string, unknown> | null;
|
|
21
|
+
archived?: boolean;
|
|
22
|
+
created_at?: string | null;
|
|
23
|
+
updated_at?: string | null;
|
|
24
|
+
last_message_at?: string | null;
|
|
25
|
+
};
|
|
26
|
+
/** Raw Letta API message returned from conversation history. */
|
|
27
|
+
export type LettaConversationMessage = Record<string, unknown>;
|
|
28
|
+
export interface ListAgentsOptions {
|
|
29
|
+
before?: string;
|
|
30
|
+
after?: string;
|
|
31
|
+
limit?: number;
|
|
32
|
+
order?: "asc" | "desc";
|
|
33
|
+
orderBy?: "createdAt" | "lastRunCompletion";
|
|
34
|
+
/** Search agent names. */
|
|
35
|
+
query?: string;
|
|
36
|
+
/** Match one exact agent name. */
|
|
37
|
+
name?: string;
|
|
38
|
+
tags?: string[];
|
|
39
|
+
matchAllTags?: boolean;
|
|
40
|
+
/** Relationships to hydrate in each returned agent. */
|
|
41
|
+
include?: string[];
|
|
42
|
+
}
|
|
43
|
+
export interface UpdateAgentOptions {
|
|
44
|
+
name?: string | null;
|
|
45
|
+
description?: string | null;
|
|
46
|
+
model?: string | null;
|
|
47
|
+
modelSettings?: Record<string, unknown> | null;
|
|
48
|
+
system?: string | null;
|
|
49
|
+
tags?: string[] | null;
|
|
50
|
+
hidden?: boolean | null;
|
|
51
|
+
contextWindowLimit?: number | null;
|
|
52
|
+
}
|
|
53
|
+
export interface ListConversationsOptions {
|
|
54
|
+
agentId?: string;
|
|
55
|
+
after?: string;
|
|
56
|
+
limit?: number;
|
|
57
|
+
order?: "asc" | "desc";
|
|
58
|
+
orderBy?: "createdAt" | "lastRunCompletion" | "lastMessageAt";
|
|
59
|
+
archiveStatus?: "unarchived" | "archived" | "all";
|
|
60
|
+
summarySearch?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface CreateConversationOptions {
|
|
63
|
+
agentId: string;
|
|
64
|
+
summary?: string | null;
|
|
65
|
+
description?: string | null;
|
|
66
|
+
model?: string | null;
|
|
67
|
+
modelSettings?: Record<string, unknown> | null;
|
|
68
|
+
contextWindowLimit?: number | null;
|
|
69
|
+
hidden?: boolean;
|
|
70
|
+
}
|
|
71
|
+
export interface UpdateConversationOptions {
|
|
72
|
+
summary?: string | null;
|
|
73
|
+
description?: string | null;
|
|
74
|
+
model?: string | null;
|
|
75
|
+
modelSettings?: Record<string, unknown> | null;
|
|
76
|
+
contextWindowLimit?: number | null;
|
|
77
|
+
archived?: boolean | null;
|
|
78
|
+
}
|
|
79
|
+
export interface ConversationMessagesOptions {
|
|
80
|
+
before?: string;
|
|
81
|
+
after?: string;
|
|
82
|
+
order?: "asc" | "desc";
|
|
83
|
+
limit?: number;
|
|
84
|
+
}
|
|
85
|
+
export type ConversationMessagesResult = ListMessagesResult & {
|
|
86
|
+
messages: LettaConversationMessage[];
|
|
87
|
+
};
|
|
88
|
+
export interface AgentsClient {
|
|
89
|
+
list(options?: ListAgentsOptions): Promise<LettaAgent[]>;
|
|
90
|
+
retrieve(agentId: string): Promise<LettaAgent>;
|
|
91
|
+
update(agentId: string, options: UpdateAgentOptions): Promise<LettaAgent>;
|
|
92
|
+
delete(agentId: string): Promise<void>;
|
|
93
|
+
}
|
|
94
|
+
export interface ModelsClient {
|
|
95
|
+
/**
|
|
96
|
+
* List the model catalog without opening a session.
|
|
97
|
+
*
|
|
98
|
+
* Uses the same normalized result shape as `session.listModels()`, including
|
|
99
|
+
* availability and BYOK-alias metadata when the backend provides it.
|
|
100
|
+
*/
|
|
101
|
+
list(): Promise<ListModelsResult>;
|
|
102
|
+
}
|
|
103
|
+
export interface ConversationsClient {
|
|
104
|
+
list(options?: ListConversationsOptions): Promise<LettaConversation[]>;
|
|
105
|
+
retrieve(conversationId: string): Promise<LettaConversation>;
|
|
106
|
+
create(options: CreateConversationOptions): Promise<LettaConversation>;
|
|
107
|
+
update(conversationId: string, options: UpdateConversationOptions): Promise<LettaConversation>;
|
|
108
|
+
listMessages(conversationId: string, options?: ConversationMessagesOptions): Promise<ConversationMessagesResult>;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=management-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"management-types.d.ts","sourceRoot":"","sources":["../src/management-types.ts"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;IAC/C,MAAM,CACJ,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,UAAU,CAAC,CAAC;IACvB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC;AAED,MAAM,WAAW,YAAY;IAC3B;;;;;OAKG;IACH,IAAI,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,CACF,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC7D,MAAM,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACvE,MAAM,CACJ,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC9B,YAAY,CACV,cAAc,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,2BAA2B,GACpC,OAAO,CAAC,0BAA0B,CAAC,CAAC;CACxC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AgentsClient, ConversationsClient, ConversationMessagesResult, LettaAgent, LettaConversation, ModelsClient } from "./management-types.js";
|
|
2
|
+
import type { ListModelsResult } from "./types.js";
|
|
3
|
+
export type ManagementQuery = Record<string, string | number | boolean | string[] | null | undefined>;
|
|
4
|
+
export interface ManagementTransport {
|
|
5
|
+
listAgents(query: ManagementQuery): Promise<LettaAgent[]>;
|
|
6
|
+
retrieveAgent(agentId: string): Promise<LettaAgent>;
|
|
7
|
+
updateAgent(agentId: string, body: Record<string, unknown>): Promise<LettaAgent>;
|
|
8
|
+
deleteAgent(agentId: string): Promise<void>;
|
|
9
|
+
listModels(): Promise<ListModelsResult>;
|
|
10
|
+
listConversations(query: ManagementQuery): Promise<LettaConversation[]>;
|
|
11
|
+
retrieveConversation(conversationId: string): Promise<LettaConversation>;
|
|
12
|
+
createConversation(body: Record<string, unknown>): Promise<LettaConversation>;
|
|
13
|
+
updateConversation(conversationId: string, body: Record<string, unknown>): Promise<LettaConversation>;
|
|
14
|
+
listConversationMessages(conversationId: string, query: ManagementQuery): Promise<ConversationMessagesResult>;
|
|
15
|
+
}
|
|
16
|
+
type TransportProvider = () => ManagementTransport;
|
|
17
|
+
export declare function createAgentsClient(transport: TransportProvider): AgentsClient;
|
|
18
|
+
export declare function createModelsClient(transport: TransportProvider): ModelsClient;
|
|
19
|
+
export declare function createConversationsClient(transport: TransportProvider): ConversationsClient;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=management.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"management.d.ts","sourceRoot":"","sources":["../src/management.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,0BAA0B,EAE1B,UAAU,EACV,iBAAiB,EAGjB,YAAY,EAIb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,MAAM,eAAe,GAAG,MAAM,CAClC,MAAM,EACN,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,CACxD,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAC1D,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACpD,WAAW,CACT,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,UAAU,CAAC,CAAC;IACvB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,UAAU,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACxC,iBAAiB,CACf,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAChC,oBAAoB,CAClB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC9B,kBAAkB,CAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC9B,kBAAkB,CAChB,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC9B,wBAAwB,CACtB,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,0BAA0B,CAAC,CAAC;CACxC;AAED,KAAK,iBAAiB,GAAG,MAAM,mBAAmB,CAAC;AAwGnD,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,iBAAiB,GAC3B,YAAY,CAYd;AAED,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,iBAAiB,GAC3B,YAAY,CAId;AAED,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,iBAAiB,GAC3B,mBAAmB,CAmBrB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BootstrapStateOptions, BootstrapStateResult, CreateAgentOptions, LettaCodeClientSessionOptions, LettaCodeSession, ListModelsResult, ListMessagesOptions, ListMessagesResult, MessageContentItem, RecoverPendingApprovalsOptions, RecoverPendingApprovalsResult, RunTurnOptions, SDKErrorCode, SDKInitMessage, SDKMessage, SDKProtocolCommand, SDKProtocolMessage, SDKResultMessage, SendCommandOptions, SendMessage, SkillSource, UpdateModelOptions, UpdateModelResult } from "./types.js";
|
|
1
|
+
import type { BootstrapStateOptions, BootstrapStateResult, ChangeDeviceStateOptions, CreateAgentOptions, GetDeviceStatusOptions, LettaCodeClientSessionOptions, LettaCodeSession, ListModelsResult, ListMessagesOptions, ListMessagesResult, MessageContentItem, RecoverPendingApprovalsOptions, RecoverPendingApprovalsResult, RemoveQueuedMessageResult, RunTurnOptions, SDKErrorCode, SDKInitMessage, SDKMessage, SDKProtocolCommand, SDKProtocolMessage, SDKResultMessage, SendCommandOptions, SendMessage, SessionDeviceStatus, SkillSource, UpdateModelOptions, UpdateModelResult } from "./types.js";
|
|
2
2
|
export type RuntimeScope = {
|
|
3
3
|
agent_id: string;
|
|
4
4
|
conversation_id: string;
|
|
@@ -91,6 +91,8 @@ export declare abstract class RemoteClientSessionCore implements LettaCodeSessio
|
|
|
91
91
|
private messageCounter;
|
|
92
92
|
private clientMessageCounter;
|
|
93
93
|
private toolNames;
|
|
94
|
+
private deviceStatusListeners;
|
|
95
|
+
private deviceStatusRefreshCancels;
|
|
94
96
|
protected constructor(mode: RuntimeSessionMode, config: RemoteClientSessionCoreConfig);
|
|
95
97
|
initialize(): Promise<SDKInitMessage>;
|
|
96
98
|
send(message: SendMessage): Promise<void>;
|
|
@@ -102,6 +104,10 @@ export declare abstract class RemoteClientSessionCore implements LettaCodeSessio
|
|
|
102
104
|
listModels(): Promise<ListModelsResult>;
|
|
103
105
|
updateModel(update: string | UpdateModelOptions): Promise<UpdateModelResult>;
|
|
104
106
|
recoverPendingApprovals(options?: RecoverPendingApprovalsOptions): Promise<RecoverPendingApprovalsResult>;
|
|
107
|
+
removeQueuedMessage(itemId: string): Promise<RemoveQueuedMessageResult>;
|
|
108
|
+
getDeviceStatus(options?: GetDeviceStatusOptions): Promise<SessionDeviceStatus>;
|
|
109
|
+
onDeviceStatus(listener: (status: SessionDeviceStatus) => void): () => void;
|
|
110
|
+
private refreshDeviceStatus;
|
|
105
111
|
listMessages(options?: ListMessagesOptions): Promise<ListMessagesResult>;
|
|
106
112
|
bootstrapState(options?: BootstrapStateOptions): Promise<BootstrapStateResult>;
|
|
107
113
|
close(): void;
|
|
@@ -109,12 +115,7 @@ export declare abstract class RemoteClientSessionCore implements LettaCodeSessio
|
|
|
109
115
|
get sessionId(): string | null;
|
|
110
116
|
get conversationId(): string | null;
|
|
111
117
|
[Symbol.asyncDispose](): Promise<void>;
|
|
112
|
-
changeDeviceState(updates:
|
|
113
|
-
cwd?: string;
|
|
114
|
-
permissionMode?: LettaCodeClientSessionOptions["permissionMode"];
|
|
115
|
-
agentId?: string;
|
|
116
|
-
conversationId?: string;
|
|
117
|
-
}): Promise<void>;
|
|
118
|
+
changeDeviceState(updates: ChangeDeviceStateOptions): Promise<void>;
|
|
118
119
|
updateToolset(toolsetPreference: string): Promise<void>;
|
|
119
120
|
protected abstract initializeRuntimeController(): Promise<RuntimeSessionInit>;
|
|
120
121
|
protected afterRuntimeInitialized(): Promise<void>;
|
|
@@ -1 +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,8BAA8B,EAC9B,6BAA6B,
|
|
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,wBAAwB,EACxB,kBAAkB,EAClB,sBAAsB,EACtB,6BAA6B,EAC7B,gBAAgB,EAEhB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,8BAA8B,EAC9B,6BAA6B,EAC7B,yBAAyB,EAEzB,cAAc,EACd,YAAY,EACZ,cAAc,EAEd,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAGlB,gBAAgB,EAEhB,kBAAkB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AS,CAAC,cAAc,IAAI,6BAA6B,GAAG,kBAAkB;IAI9E,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,6BAA6B,GAAG,kBAAkB,GAAG,OAAO;IAKjG,SAAS,CAAC,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAKpD,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIvC,OAAO,CAAC,aAAa;IAuBrB,OAAO,CAAC,YAAY;IAYpB,OAAO,CAAC,4BAA4B;IAQpC,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,QAAQ;IAoBhB,OAAO,CAAC,kBAAkB;YAWZ,yBAAyB;cAuEvB,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC;IAqD3D,OAAO,CAAC,qBAAqB,CA8C3B;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/session.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Represents a conversation session with a Letta agent.
|
|
5
5
|
* Implements the V2 API pattern: send() / receive()
|
|
6
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";
|
|
7
|
+
import type { InternalSessionOptions, SDKMessage, SDKInitMessage, SDKResultMessage, SendMessage, ListMessagesOptions, ListMessagesResult, ListModelsResult, BootstrapStateOptions, BootstrapStateResult, ChangeDeviceStateOptions, GetDeviceStatusOptions, SessionDeviceStatus, RunTurnOptions, RecoverPendingApprovalsOptions, RecoverPendingApprovalsResult, RemoveQueuedMessageResult, SDKProtocolCommand, SDKProtocolMessage, SendCommandOptions, UpdateModelOptions, UpdateModelResult } from "./types.js";
|
|
8
8
|
export declare class Session implements AsyncDisposable {
|
|
9
9
|
private options;
|
|
10
10
|
private transport;
|
|
@@ -103,6 +103,10 @@ export declare class Session implements AsyncDisposable {
|
|
|
103
103
|
sendCommand(command: SDKProtocolCommand): Promise<void>;
|
|
104
104
|
sendCommand<TResponse extends SDKProtocolMessage = SDKProtocolMessage>(command: SDKProtocolCommand, options: SendCommandOptions): Promise<TResponse>;
|
|
105
105
|
updateModel(_update: string | UpdateModelOptions): Promise<UpdateModelResult>;
|
|
106
|
+
changeDeviceState(_updates: ChangeDeviceStateOptions): Promise<void>;
|
|
107
|
+
removeQueuedMessage(_itemId: string): Promise<RemoveQueuedMessageResult>;
|
|
108
|
+
getDeviceStatus(_options?: GetDeviceStatusOptions): Promise<SessionDeviceStatus>;
|
|
109
|
+
onDeviceStatus(_listener: (status: SessionDeviceStatus) => void): () => void;
|
|
106
110
|
/**
|
|
107
111
|
* Fetch all data needed to render the initial conversation view in one round-trip.
|
|
108
112
|
*
|
package/dist/session.d.ts.map
CHANGED
|
@@ -1 +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,
|
|
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,m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,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"}
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LettaCodeSession, SDKInitMessage, SDKResultMessage, SendMessage } from "../types.js";
|
|
2
2
|
export type AdvancedSession = LettaCodeSession & {
|
|
3
3
|
initialize(): Promise<SDKInitMessage>;
|
|
4
4
|
runTurn(message: SendMessage): Promise<SDKResultMessage>;
|
|
5
|
-
recoverPendingApprovals(options?: RecoverPendingApprovalsOptions): Promise<RecoverPendingApprovalsResult>;
|
|
6
|
-
changeDeviceState(updates: {
|
|
7
|
-
cwd?: string;
|
|
8
|
-
permissionMode?: "standard" | "acceptEdits" | "unrestricted";
|
|
9
|
-
agentId?: string;
|
|
10
|
-
conversationId?: string;
|
|
11
|
-
}): Promise<void>;
|
|
12
5
|
updateToolset(toolsetPreference: string): Promise<void>;
|
|
13
|
-
bootstrapState(options?: BootstrapStateOptions): Promise<BootstrapStateResult>;
|
|
14
6
|
};
|
|
15
7
|
export declare function asAdvanced(session: LettaCodeSession): AdvancedSession;
|
|
16
8
|
//# sourceMappingURL=advanced-session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"advanced-session.d.ts","sourceRoot":"","sources":["../../src/tests/advanced-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"advanced-session.d.ts","sourceRoot":"","sources":["../../src/tests/advanced-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,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,aAAa,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzD,CAAC;AAEF,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe,CAErE"}
|
package/dist/transport.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAgCtE;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,sBAAsB,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAgCtE;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,sBAAsB,GAAG,MAAM,EAAE,CA4KtE;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"}
|
package/dist/types.d.ts
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export type { WireMessage, SystemInitMessage, MessageWire, ResultMessage, ErrorMessage, StreamEvent, ControlRequest, ControlResponse, CanUseToolControlRequest, CanUseToolResponse, CanUseToolResponseAllow, CanUseToolResponseDeny, SystemPromptPresetConfig, CreateBlock, } from "./protocol.js";
|
|
8
8
|
import type { CreateBlock, CanUseToolResponse } from "./protocol.js";
|
|
9
|
+
import type { PersonalityId } from "@letta-ai/letta-code/agent-presets";
|
|
10
|
+
/** Letta Code personality preset used to seed a new agent. */
|
|
11
|
+
export type LettaCodePersonalityId = PersonalityId;
|
|
9
12
|
export interface LettaCodeSocketLike {
|
|
10
13
|
readyState: number;
|
|
11
14
|
send(data: string): void;
|
|
@@ -20,6 +23,11 @@ export interface LettaCodeSocketOptions {
|
|
|
20
23
|
headers?: Record<string, string>;
|
|
21
24
|
}
|
|
22
25
|
export type LettaCodeSocketConstructor = new (url: string, options?: LettaCodeSocketOptions) => LettaCodeSocketLike;
|
|
26
|
+
/**
|
|
27
|
+
* React Native's WebSocket constructor accepts request headers as its third
|
|
28
|
+
* argument, unlike the Node-style constructor used by the SDK protocol layer.
|
|
29
|
+
*/
|
|
30
|
+
export type LettaCodeReactNativeSocketConstructor = new (url: string, protocols?: string | string[] | null, options?: LettaCodeSocketOptions) => LettaCodeSocketLike;
|
|
23
31
|
/**
|
|
24
32
|
* Text content in a message
|
|
25
33
|
*/
|
|
@@ -168,7 +176,7 @@ export type AnyAgentTool = AgentTool<any, unknown>;
|
|
|
168
176
|
*
|
|
169
177
|
* - local: spawn/manage a local Letta Code app-server over loopback websockets.
|
|
170
178
|
* - remote: connect to a user-managed app-server over websockets.
|
|
171
|
-
* - cloud: use agents hosted on
|
|
179
|
+
* - cloud: use agents hosted on Letta Cloud, with an explicit remote
|
|
172
180
|
* environment or SDK-managed sandbox.
|
|
173
181
|
*/
|
|
174
182
|
export type LettaCodeBackend = "local" | "remote" | "cloud";
|
|
@@ -206,6 +214,8 @@ export interface LettaCodeLocalAppServerOptions {
|
|
|
206
214
|
WebSocket?: LettaCodeSocketConstructor;
|
|
207
215
|
/** Timeout for websocket protocol request/turn correlation. */
|
|
208
216
|
requestTimeoutMs?: number;
|
|
217
|
+
/** Whether agents created through this app-server are added to Letta Code's global pinned-agent list. */
|
|
218
|
+
pinGlobalAgent?: boolean;
|
|
209
219
|
/** Local app-server listen URL when the SDK spawns it. Defaults to ws://127.0.0.1:0. */
|
|
210
220
|
listen?: string;
|
|
211
221
|
/** Timeout waiting for the spawned app-server to print its listening URL. */
|
|
@@ -228,6 +238,8 @@ export interface LettaCodeRemoteClientOptions {
|
|
|
228
238
|
WebSocket?: LettaCodeSocketConstructor;
|
|
229
239
|
/** Timeout for websocket protocol request/turn correlation. */
|
|
230
240
|
requestTimeoutMs?: number;
|
|
241
|
+
/** Whether agents created through this app-server are added to Letta Code's global pinned-agent list. */
|
|
242
|
+
pinGlobalAgent?: boolean;
|
|
231
243
|
}
|
|
232
244
|
export interface LettaCodeCloudSandboxOptions {
|
|
233
245
|
/**
|
|
@@ -271,12 +283,7 @@ export interface LettaCodeCloudClientOptions {
|
|
|
271
283
|
/** Heartbeat interval for the Cloud status websocket. Defaults to 30s. */
|
|
272
284
|
pingIntervalMs?: number;
|
|
273
285
|
/**
|
|
274
|
-
*
|
|
275
|
-
* Omit to let the SDK spawn a bundled local app-server authenticated to Cloud.
|
|
276
|
-
*/
|
|
277
|
-
appServer?: LettaCodeLocalAppServerOptions;
|
|
278
|
-
/**
|
|
279
|
-
* Execution target for Constellation sessions. If omitted, the SDK creates
|
|
286
|
+
* Execution target for Letta Cloud sessions. If omitted, the SDK creates
|
|
280
287
|
* and owns a sandbox for the session.
|
|
281
288
|
*/
|
|
282
289
|
environment?: LettaCodeEnvironment;
|
|
@@ -361,10 +368,45 @@ export interface ListRepositoryVersionsParams {
|
|
|
361
368
|
export interface GetRepositoryVersionParams {
|
|
362
369
|
path: string;
|
|
363
370
|
}
|
|
371
|
+
/**
|
|
372
|
+
* A suggested permission grant attached to a `can_use_tool` approval request.
|
|
373
|
+
* Approval UIs can render these as selectable chips and echo the chosen ids
|
|
374
|
+
* back via `CanUseToolResponseAllow.updatedPermissions`.
|
|
375
|
+
*/
|
|
376
|
+
export interface CanUseToolPermissionSuggestion {
|
|
377
|
+
id: string;
|
|
378
|
+
text: string;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Additional context for a `can_use_tool` approval request, passed as the
|
|
382
|
+
* optional third argument to {@link CanUseToolCallback}.
|
|
383
|
+
*
|
|
384
|
+
* All fields are optional: transports pass through whatever subset the wire
|
|
385
|
+
* protocol provides, leaving absent fields undefined.
|
|
386
|
+
*/
|
|
387
|
+
export interface CanUseToolContext {
|
|
388
|
+
/** Id of the control request carrying this approval (for logging/correlation). */
|
|
389
|
+
requestId?: string;
|
|
390
|
+
/** Tool call id — links the approval to its tool_call card in the message stream. */
|
|
391
|
+
toolCallId?: string;
|
|
392
|
+
/** Suggested permission grants the user can select. */
|
|
393
|
+
permissionSuggestions?: CanUseToolPermissionSuggestion[];
|
|
394
|
+
/** Path that triggered the permission check, when the tool was blocked on a path rule. */
|
|
395
|
+
blockedPath?: string | null;
|
|
396
|
+
/**
|
|
397
|
+
* Diff previews for file-editing tools, passed through verbatim.
|
|
398
|
+
* Shape matches letta-code's `DiffPreview` (mode: "advanced" | "fallback" | "unpreviewable").
|
|
399
|
+
*/
|
|
400
|
+
diffs?: unknown[];
|
|
401
|
+
}
|
|
364
402
|
/**
|
|
365
403
|
* Callback for custom permission handling.
|
|
404
|
+
*
|
|
405
|
+
* The optional third argument carries approval context (tool call id,
|
|
406
|
+
* permission suggestions, diff previews). Two-argument callbacks remain
|
|
407
|
+
* fully supported.
|
|
366
408
|
*/
|
|
367
|
-
export type CanUseToolCallback = (toolName: string, toolInput: Record<string, unknown
|
|
409
|
+
export type CanUseToolCallback = (toolName: string, toolInput: Record<string, unknown>, context?: CanUseToolContext) => Promise<CanUseToolResponse> | CanUseToolResponse;
|
|
368
410
|
/**
|
|
369
411
|
* Internal session options used by Session/Transport classes.
|
|
370
412
|
* Not user-facing - use CreateSessionOptions or CreateAgentOptions instead.
|
|
@@ -391,6 +433,7 @@ export interface InternalSessionOptions {
|
|
|
391
433
|
disallowedTools?: string[];
|
|
392
434
|
permissionMode?: PermissionMode;
|
|
393
435
|
canUseTool?: CanUseToolCallback;
|
|
436
|
+
baseTools?: string[];
|
|
394
437
|
tools?: AnyAgentTool[];
|
|
395
438
|
cwd?: string;
|
|
396
439
|
/** If true, pass --include-partial-messages to CLI for token-level stream_event chunks */
|
|
@@ -407,7 +450,7 @@ export interface InternalSessionOptions {
|
|
|
407
450
|
}
|
|
408
451
|
export type PermissionMode = "standard" | "acceptEdits" | "unrestricted";
|
|
409
452
|
export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
410
|
-
export
|
|
453
|
+
export type LettaCodeModelEntry = Record<string, unknown> & {
|
|
411
454
|
id: string;
|
|
412
455
|
handle: string;
|
|
413
456
|
label: string;
|
|
@@ -416,7 +459,7 @@ export interface LettaCodeModelEntry {
|
|
|
416
459
|
isFeatured?: boolean;
|
|
417
460
|
free?: boolean;
|
|
418
461
|
updateArgs?: Record<string, unknown>;
|
|
419
|
-
}
|
|
462
|
+
};
|
|
420
463
|
export interface ListModelsResult {
|
|
421
464
|
entries: LettaCodeModelEntry[];
|
|
422
465
|
/** Handles available to this user. null means availability lookup failed. */
|
|
@@ -464,7 +507,12 @@ export interface CreateSessionOptions {
|
|
|
464
507
|
reasoningEffort?: ReasoningEffort;
|
|
465
508
|
/** System prompt preset (only presets, no custom strings or append) - updates the agent */
|
|
466
509
|
systemPrompt?: SystemPromptPreset;
|
|
467
|
-
/**
|
|
510
|
+
/**
|
|
511
|
+
* Exact client-side tool allowlist for the session, including custom SDK
|
|
512
|
+
* tools. When omitted, the harness default toolset and registered custom
|
|
513
|
+
* tools apply. Interactive user-input tools (AskUserQuestion) are always
|
|
514
|
+
* excluded for SDK sessions.
|
|
515
|
+
*/
|
|
468
516
|
allowedTools?: string[];
|
|
469
517
|
/** List of disallowed tool names */
|
|
470
518
|
disallowedTools?: string[];
|
|
@@ -538,15 +586,139 @@ export interface LettaCodeSession extends AsyncDisposable {
|
|
|
538
586
|
listMessages(options?: ListMessagesOptions): Promise<ListMessagesResult>;
|
|
539
587
|
listModels(): Promise<ListModelsResult>;
|
|
540
588
|
updateModel(update: string | UpdateModelOptions): Promise<UpdateModelResult>;
|
|
589
|
+
/**
|
|
590
|
+
* Fetch the initial conversation projection used to hydrate or reconcile a
|
|
591
|
+
* resumed session.
|
|
592
|
+
*/
|
|
593
|
+
bootstrapState(options?: BootstrapStateOptions): Promise<BootstrapStateResult>;
|
|
594
|
+
/**
|
|
595
|
+
* Ask the runtime to recover any approval that was pending across a
|
|
596
|
+
* disconnect.
|
|
597
|
+
*/
|
|
598
|
+
recoverPendingApprovals(options?: RecoverPendingApprovalsOptions): Promise<RecoverPendingApprovalsResult>;
|
|
599
|
+
/**
|
|
600
|
+
* Update runtime controls for subsequent work in this conversation.
|
|
601
|
+
*
|
|
602
|
+
* The current app-server protocol does not acknowledge this command. The
|
|
603
|
+
* promise confirms that the command was accepted for transport, not that the
|
|
604
|
+
* runtime has applied it.
|
|
605
|
+
*/
|
|
606
|
+
changeDeviceState(updates: ChangeDeviceStateOptions): Promise<void>;
|
|
607
|
+
/**
|
|
608
|
+
* Remove one queued user message and wait for the runtime acknowledgement.
|
|
609
|
+
*/
|
|
610
|
+
removeQueuedMessage(itemId: string): Promise<RemoveQueuedMessageResult>;
|
|
611
|
+
/**
|
|
612
|
+
* Read the device execution context (online/processing flags, permission
|
|
613
|
+
* mode, working directory, pending approvals).
|
|
614
|
+
*
|
|
615
|
+
* Sends a lightweight, request-correlated `sync` and resolves only after the
|
|
616
|
+
* runtime acknowledges it and pushes a fresh `update_device_status`
|
|
617
|
+
* snapshot for this runtime scope.
|
|
618
|
+
*/
|
|
619
|
+
getDeviceStatus(options?: GetDeviceStatusOptions): Promise<SessionDeviceStatus>;
|
|
620
|
+
/**
|
|
621
|
+
* Subscribe to every incoming device-status update for this session's
|
|
622
|
+
* runtime scope. Returns an unsubscribe function.
|
|
623
|
+
*/
|
|
624
|
+
onDeviceStatus(listener: (status: SessionDeviceStatus) => void): () => void;
|
|
541
625
|
close(): void;
|
|
542
626
|
readonly agentId: string | null;
|
|
543
627
|
readonly sessionId: string | null;
|
|
544
628
|
readonly conversationId: string | null;
|
|
545
629
|
}
|
|
630
|
+
export interface ChangeDeviceStateOptions {
|
|
631
|
+
cwd?: string;
|
|
632
|
+
permissionMode?: PermissionMode;
|
|
633
|
+
}
|
|
634
|
+
export interface RemoveQueuedMessageResult {
|
|
635
|
+
/** Queue item identifier echoed by the runtime. */
|
|
636
|
+
itemId: string;
|
|
637
|
+
/** False when the item was no longer present in the authoritative queue. */
|
|
638
|
+
removed: boolean;
|
|
639
|
+
}
|
|
640
|
+
export interface GetDeviceStatusOptions {
|
|
641
|
+
/**
|
|
642
|
+
* Timeout in milliseconds for the authoritative sync and status replay.
|
|
643
|
+
* Defaults to the session's request timeout.
|
|
644
|
+
*/
|
|
645
|
+
timeoutMs?: number;
|
|
646
|
+
}
|
|
647
|
+
/** A suggested permission grant attached to a pending approval. */
|
|
648
|
+
export interface SessionPermissionSuggestion {
|
|
649
|
+
id: string;
|
|
650
|
+
text: string;
|
|
651
|
+
}
|
|
652
|
+
export interface SessionDiffHunkLine {
|
|
653
|
+
type: "context" | "add" | "remove";
|
|
654
|
+
content: string;
|
|
655
|
+
}
|
|
656
|
+
export interface SessionDiffHunk {
|
|
657
|
+
oldStart: number;
|
|
658
|
+
oldLines: number;
|
|
659
|
+
newStart: number;
|
|
660
|
+
newLines: number;
|
|
661
|
+
lines: SessionDiffHunkLine[];
|
|
662
|
+
}
|
|
663
|
+
/** Portable projection of a file-edit diff preview. */
|
|
664
|
+
export type SessionDiffPreview = {
|
|
665
|
+
mode: "advanced";
|
|
666
|
+
fileName: string;
|
|
667
|
+
hunks: SessionDiffHunk[];
|
|
668
|
+
} | {
|
|
669
|
+
mode: "fallback" | "unpreviewable";
|
|
670
|
+
fileName: string;
|
|
671
|
+
reason: string;
|
|
672
|
+
};
|
|
673
|
+
/** One tool approval the device is still waiting on. */
|
|
674
|
+
export interface SessionPendingControlRequest {
|
|
675
|
+
/**
|
|
676
|
+
* Control request id for correlation only. Approval decisions must still
|
|
677
|
+
* resolve through `recoverPendingApprovals()` and `canUseTool`.
|
|
678
|
+
*/
|
|
679
|
+
requestId: string;
|
|
680
|
+
/** Tool awaiting approval. */
|
|
681
|
+
toolName: string;
|
|
682
|
+
/** Tool call id awaiting approval, when reported. */
|
|
683
|
+
toolCallId?: string;
|
|
684
|
+
/** Tool input awaiting approval, when reported. */
|
|
685
|
+
toolInput?: Record<string, unknown>;
|
|
686
|
+
/** Permission grants offered by the runtime. */
|
|
687
|
+
permissionSuggestions: SessionPermissionSuggestion[];
|
|
688
|
+
/** Path that triggered the permission check, when reported. */
|
|
689
|
+
blockedPath: string | null;
|
|
690
|
+
/** File-edit previews supplied with the approval, when reported. */
|
|
691
|
+
diffs?: SessionDiffPreview[];
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* Typed projection of the wire `update_device_status` payload.
|
|
695
|
+
*
|
|
696
|
+
* `raw` carries the full wire `device_status` object for fields that are not
|
|
697
|
+
* projected (git context, toolsets, background processes, ...).
|
|
698
|
+
*/
|
|
699
|
+
export interface SessionDeviceStatus {
|
|
700
|
+
/** Whether the executing device is connected. */
|
|
701
|
+
isOnline: boolean;
|
|
702
|
+
/** Whether the device is currently processing a turn. */
|
|
703
|
+
isProcessing: boolean;
|
|
704
|
+
/** Permission mode currently applied to this runtime scope. */
|
|
705
|
+
permissionMode: PermissionMode;
|
|
706
|
+
/** Working directory currently applied to this runtime scope. */
|
|
707
|
+
workingDirectory: string | null;
|
|
708
|
+
/** Approvals the device is still waiting on (foreground-resume UI). */
|
|
709
|
+
pendingControlRequests: SessionPendingControlRequest[];
|
|
710
|
+
/** Full wire `device_status` payload as an escape hatch. */
|
|
711
|
+
raw: Record<string, unknown>;
|
|
712
|
+
}
|
|
546
713
|
/**
|
|
547
714
|
* Options for createAgent() - full control over agent creation.
|
|
548
715
|
*/
|
|
549
716
|
export interface CreateAgentOptions {
|
|
717
|
+
/**
|
|
718
|
+
* Letta Code personality preset. Defaults to "memo". The creation payload
|
|
719
|
+
* is built by `@letta-ai/letta-code/agent-presets`, matching Chat/Desktop.
|
|
720
|
+
*/
|
|
721
|
+
personality?: LettaCodePersonalityId;
|
|
550
722
|
/** Model to use (e.g., "claude-sonnet-4-20250514") */
|
|
551
723
|
model?: string;
|
|
552
724
|
/** Embedding model to use (e.g., "text-embedding-ada-002") */
|
|
@@ -583,12 +755,18 @@ export interface CreateAgentOptions {
|
|
|
583
755
|
/** Hide the agent from default listings (worker/subagent semantics). */
|
|
584
756
|
hidden?: boolean;
|
|
585
757
|
/**
|
|
586
|
-
* Server-side tools to attach at creation
|
|
587
|
-
*
|
|
588
|
-
*
|
|
758
|
+
* Server-side tools to attach at creation. When omitted, the harness
|
|
759
|
+
* applies its created-agent defaults (web_search, fetch_webpage). Pass []
|
|
760
|
+
* for none or an explicit list to override. Client-side tools (Bash,
|
|
761
|
+
* Edit, …) are provided by the harness at runtime and are unaffected.
|
|
589
762
|
*/
|
|
590
763
|
baseTools?: string[];
|
|
591
|
-
/**
|
|
764
|
+
/**
|
|
765
|
+
* Exact client-side tool allowlist for the session, including custom SDK
|
|
766
|
+
* tools. When omitted, the harness default toolset and registered custom
|
|
767
|
+
* tools apply. Interactive user-input tools (AskUserQuestion) are always
|
|
768
|
+
* excluded for SDK sessions.
|
|
769
|
+
*/
|
|
592
770
|
allowedTools?: string[];
|
|
593
771
|
/** List of disallowed tool names */
|
|
594
772
|
disallowedTools?: string[];
|