@letta-ai/letta-agent-sdk 0.3.0 → 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 +29 -1
- package/dist/app-server-management.d.ts +3 -1
- package/dist/app-server-management.d.ts.map +1 -1
- package/dist/app-server-session.d.ts +2 -4
- package/dist/app-server-session.d.ts.map +1 -1
- package/dist/client-base.d.ts +2 -1
- package/dist/client-base.d.ts.map +1 -1
- package/dist/client-entry.js +344 -7
- package/dist/client-entry.js.map +9 -9
- package/dist/cloud-management.d.ts +3 -1
- package/dist/cloud-management.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +353 -9
- package/dist/index.js.map +12 -12
- package/dist/interactiveToolPolicy.d.ts +7 -0
- package/dist/interactiveToolPolicy.d.ts.map +1 -1
- package/dist/local-app-server-session.d.ts.map +1 -1
- package/dist/management-types.d.ts +11 -1
- package/dist/management-types.d.ts.map +1 -1
- package/dist/management.d.ts +5 -1
- package/dist/management.d.ts.map +1 -1
- package/dist/remote-client-session-core.d.ts +6 -1
- package/dist/remote-client-session-core.d.ts.map +1 -1
- package/dist/session.d.ts +3 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/types.d.ts +129 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { ManagementQuery, ManagementTransport } from "./management.js";
|
|
2
2
|
import type { ConversationMessagesResult, LettaAgent, LettaConversation } from "./management-types.js";
|
|
3
|
-
import type { LettaCodeCloudClientOptions } from "./types.js";
|
|
3
|
+
import type { LettaCodeCloudClientOptions, ListModelsResult } from "./types.js";
|
|
4
4
|
export declare class CloudManagementTransport implements ManagementTransport {
|
|
5
5
|
private readonly options;
|
|
6
6
|
constructor(options: LettaCodeCloudClientOptions);
|
|
7
7
|
listAgents(query: ManagementQuery): Promise<LettaAgent[]>;
|
|
8
8
|
retrieveAgent(agentId: string): Promise<LettaAgent>;
|
|
9
9
|
updateAgent(agentId: string, body: Record<string, unknown>): Promise<LettaAgent>;
|
|
10
|
+
deleteAgent(agentId: string): Promise<void>;
|
|
11
|
+
listModels(): Promise<ListModelsResult>;
|
|
10
12
|
listConversations(query: ManagementQuery): Promise<LettaConversation[]>;
|
|
11
13
|
retrieveConversation(conversationId: string): Promise<LettaConversation>;
|
|
12
14
|
createConversation(body: Record<string, unknown>): Promise<LettaConversation>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-management.d.ts","sourceRoot":"","sources":["../src/cloud-management.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,0BAA0B,EAC1B,UAAU,EACV,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"cloud-management.d.ts","sourceRoot":"","sources":["../src/cloud-management.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,0BAA0B,EAC1B,UAAU,EACV,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,2BAA2B,EAE3B,gBAAgB,EACjB,MAAM,YAAY,CAAC;AA2IpB,qBAAa,wBAAyB,YAAW,mBAAmB;IACtD,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,2BAA2B;IAEjE,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAIzD,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAQnD,WAAW,CACT,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,UAAU,CAAC;IAShB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY3C,UAAU,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAoB7C,iBAAiB,CACf,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAQ/B,oBAAoB,CAClB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,iBAAiB,CAAC;IAQ7B,kBAAkB,CAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,iBAAiB,CAAC;IAe7B,kBAAkB,CAChB,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,iBAAiB,CAAC;IASvB,wBAAwB,CAC5B,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,0BAA0B,CAAC;YASxB,QAAQ;YASR,SAAS;IASvB,OAAO,CAAC,GAAG;IAUX,OAAO,CAAC,aAAa;YAcP,gBAAgB;YAYhB,UAAU;IA8BxB,OAAO,CAAC,GAAG;CAGZ"}
|
package/dist/index.d.ts
CHANGED
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
34
|
import type { CreateSessionOptions, CreateAgentOptions, LettaCodeSession, SDKResultMessage } from "./types.js";
|
|
35
|
-
export type { CreateSessionOptions, CreateAgentOptions, LettaCodePersonalityId, LettaCodeBackend, LettaCodeEnvironment, LettaCodeLocalClientOptions, LettaCodeLocalAppServerOptions, LettaCodeRemoteClientOptions, LettaCodeCloudClientOptions, LettaCodeClientOptions, LettaCodeClientSessionOptions, LettaCodeSession, LettaCodeSocketLike, LettaCodeSocketConstructor, LettaCodeReactNativeSocketConstructor, SDKMessage, SDKInitMessage, SDKAssistantMessage, SDKToolCallMessage, SDKToolResultMessage, SDKReasoningMessage, SDKResultMessage, SDKErrorCode, SDKStreamEventMessage, SDKStreamEventPayload, SDKStreamEventDeltaPayload, SDKStreamEventMessagePayload, SDKUnknownStreamEventPayload, SDKErrorMessage, SDKRetryMessage, SDKQueueItem, SDKQueueUpdateMessage, SDKLoopStatusMessage, SDKProtocolMessage, SDKProtocolCommand, SendCommandOptions, RunTurnOptions, RecoverPendingApprovalsOptions, RecoverPendingApprovalsResult, ChangeDeviceStateOptions, RemoveQueuedMessageResult, SkillSource, DreamingOptions, DreamingTrigger, DreamingBehavior, EffectiveDreamingSettings, PermissionMode, ReasoningEffort, CanUseToolCallback, CanUseToolResponse, CanUseToolResponseAllow, CanUseToolResponseDeny, TextContent, ImageContent, MessageContentItem, SendMessage, ListMessagesOptions, ListMessagesResult, ListModelsResult, LettaCodeModelEntry, UpdateModelOptions, UpdateModelResult, Repository, CreateRepositoryParams, ListRepositoriesParams, ListRepositoriesResult, RepositoryResource, RepositoryFileEntry, ListRepositoryFilesParams, ListRepositoryFilesResult, CreateRepositoryFileParams, RepositoryFile, UpdateRepositoryFileParams, RepositoryFileMutationResult, DeleteRepositoryFileParams, DeleteRepositoryFileResult, RepositoryVersion, ListRepositoryVersionsParams, GetRepositoryVersionParams, BootstrapStateOptions, BootstrapStateResult, AgentTool, AgentToolResult, AgentToolResultContent, AgentToolUpdateCallback, AnyAgentTool, } from "./types.js";
|
|
36
|
-
export type { AgentsClient, ConversationsClient, LettaAgent, LettaConversation, LettaConversationMessage, ListAgentsOptions, UpdateAgentOptions, ListConversationsOptions, CreateConversationOptions, UpdateConversationOptions, ConversationMessagesOptions, ConversationMessagesResult, } from "./management-types.js";
|
|
35
|
+
export type { CreateSessionOptions, CreateAgentOptions, LettaCodePersonalityId, LettaCodeBackend, LettaCodeEnvironment, LettaCodeLocalClientOptions, LettaCodeLocalAppServerOptions, LettaCodeRemoteClientOptions, LettaCodeCloudClientOptions, LettaCodeClientOptions, LettaCodeClientSessionOptions, LettaCodeSession, LettaCodeSocketLike, LettaCodeSocketConstructor, LettaCodeReactNativeSocketConstructor, SDKMessage, SDKInitMessage, SDKAssistantMessage, SDKToolCallMessage, SDKToolResultMessage, SDKReasoningMessage, SDKResultMessage, SDKErrorCode, SDKStreamEventMessage, SDKStreamEventPayload, SDKStreamEventDeltaPayload, SDKStreamEventMessagePayload, SDKUnknownStreamEventPayload, SDKErrorMessage, SDKRetryMessage, SDKQueueItem, SDKQueueUpdateMessage, SDKLoopStatusMessage, SDKProtocolMessage, SDKProtocolCommand, SendCommandOptions, RunTurnOptions, RecoverPendingApprovalsOptions, RecoverPendingApprovalsResult, ChangeDeviceStateOptions, RemoveQueuedMessageResult, GetDeviceStatusOptions, SessionDeviceStatus, SessionPendingControlRequest, SessionPermissionSuggestion, SessionDiffHunkLine, SessionDiffHunk, SessionDiffPreview, SkillSource, DreamingOptions, DreamingTrigger, DreamingBehavior, EffectiveDreamingSettings, PermissionMode, ReasoningEffort, CanUseToolCallback, CanUseToolContext, CanUseToolPermissionSuggestion, CanUseToolResponse, CanUseToolResponseAllow, CanUseToolResponseDeny, TextContent, ImageContent, MessageContentItem, SendMessage, ListMessagesOptions, ListMessagesResult, ListModelsResult, LettaCodeModelEntry, UpdateModelOptions, UpdateModelResult, Repository, CreateRepositoryParams, ListRepositoriesParams, ListRepositoriesResult, RepositoryResource, RepositoryFileEntry, ListRepositoryFilesParams, ListRepositoryFilesResult, CreateRepositoryFileParams, RepositoryFile, UpdateRepositoryFileParams, RepositoryFileMutationResult, DeleteRepositoryFileParams, DeleteRepositoryFileResult, RepositoryVersion, ListRepositoryVersionsParams, GetRepositoryVersionParams, BootstrapStateOptions, BootstrapStateResult, AgentTool, AgentToolResult, AgentToolResultContent, AgentToolUpdateCallback, AnyAgentTool, } from "./types.js";
|
|
36
|
+
export type { AgentsClient, ConversationsClient, LettaAgent, LettaConversation, LettaConversationMessage, ModelsClient, ListAgentsOptions, UpdateAgentOptions, ListConversationsOptions, CreateConversationOptions, UpdateConversationOptions, ConversationMessagesOptions, ConversationMessagesResult, } from "./management-types.js";
|
|
37
37
|
export { Session } from "./session.js";
|
|
38
38
|
export { RepositoriesClient } from "./repositories.js";
|
|
39
39
|
export { LettaAgentClient } from "./client.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAIH,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAEhB,gBAAgB,EAEjB,MAAM,YAAY,CAAC;AAIpB,YAAY,EACV,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,2BAA2B,EAC3B,8BAA8B,EAC9B,4BAA4B,EAC5B,2BAA2B,EAC3B,sBAAsB,EACtB,6BAA6B,EAC7B,gBAAgB,EAChB,mBAAmB,EACnB,0BAA0B,EAC1B,qCAAqC,EACrC,UAAU,EACV,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,4BAA4B,EAC5B,4BAA4B,EAC5B,eAAe,EACf,eAAe,EACf,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,8BAA8B,EAC9B,6BAA6B,EAC7B,wBAAwB,EACxB,yBAAyB,EACzB,WAAW,EACX,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,yBAAyB,EACzB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EAEtB,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,WAAW,EAEX,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,k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G;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,kBAAkB,CAAC,CAY7B;AAOD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAa5D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,UAAU,GAAE,YAAY,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAe,GAC7D,YAAY,CAKd;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAqBrE"}
|
package/dist/index.js
CHANGED
|
@@ -708,6 +708,32 @@ function ensureResponse(response, value, fallback) {
|
|
|
708
708
|
}
|
|
709
709
|
return value;
|
|
710
710
|
}
|
|
711
|
+
function modelEntries(value) {
|
|
712
|
+
if (!Array.isArray(value))
|
|
713
|
+
return [];
|
|
714
|
+
return value.flatMap((entry) => {
|
|
715
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry))
|
|
716
|
+
return [];
|
|
717
|
+
const record = entry;
|
|
718
|
+
if (typeof record.id !== "string" || typeof record.handle !== "string" || typeof record.label !== "string" || typeof record.description !== "string") {
|
|
719
|
+
return [];
|
|
720
|
+
}
|
|
721
|
+
return [{
|
|
722
|
+
...record,
|
|
723
|
+
id: record.id,
|
|
724
|
+
handle: record.handle,
|
|
725
|
+
label: record.label,
|
|
726
|
+
description: record.description
|
|
727
|
+
}];
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
function stringRecord(value) {
|
|
731
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
const entries = Object.entries(value).filter((entry) => typeof entry[1] === "string");
|
|
735
|
+
return entries.length > 0 ? Object.fromEntries(entries) : undefined;
|
|
736
|
+
}
|
|
711
737
|
|
|
712
738
|
class AppServerManagementTransport {
|
|
713
739
|
options;
|
|
@@ -729,6 +755,30 @@ class AppServerManagementTransport {
|
|
|
729
755
|
const response = await this.request("agent_update", { agent_id: agentId, body }, "agent_update_response");
|
|
730
756
|
return ensureResponse(response, response.agent, `Failed to update agent ${agentId}.`);
|
|
731
757
|
}
|
|
758
|
+
async deleteAgent(agentId) {
|
|
759
|
+
const response = await this.request("agent_delete", { agent_id: agentId }, "agent_delete_response");
|
|
760
|
+
if (!response.success) {
|
|
761
|
+
throw new Error(response.error ?? `Failed to delete agent ${agentId}.`);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
async listModels() {
|
|
765
|
+
const response = await this.request("list_models", {}, "list_models_response");
|
|
766
|
+
if (!response.success) {
|
|
767
|
+
throw new Error(response.error ?? "Failed to list models.");
|
|
768
|
+
}
|
|
769
|
+
const result = {
|
|
770
|
+
entries: modelEntries(response.entries)
|
|
771
|
+
};
|
|
772
|
+
if (response.available_handles === null) {
|
|
773
|
+
result.availableHandles = null;
|
|
774
|
+
} else if (Array.isArray(response.available_handles)) {
|
|
775
|
+
result.availableHandles = response.available_handles.filter((handle) => typeof handle === "string");
|
|
776
|
+
}
|
|
777
|
+
const aliases = stringRecord(response.byok_provider_aliases);
|
|
778
|
+
if (aliases)
|
|
779
|
+
result.byokProviderAliases = aliases;
|
|
780
|
+
return result;
|
|
781
|
+
}
|
|
732
782
|
async listConversations(query) {
|
|
733
783
|
const response = await this.request("conversation_list", { query }, "conversation_list_response");
|
|
734
784
|
if (!response.success) {
|
|
@@ -5424,6 +5474,36 @@ function requiresRuntimeUserInput(toolName) {
|
|
|
5424
5474
|
function isHeadlessAutoAllowTool(toolName) {
|
|
5425
5475
|
return HEADLESS_AUTO_ALLOW_TOOLS.has(toolName);
|
|
5426
5476
|
}
|
|
5477
|
+
function normalizePermissionSuggestions(value) {
|
|
5478
|
+
if (!Array.isArray(value))
|
|
5479
|
+
return;
|
|
5480
|
+
const suggestions = [];
|
|
5481
|
+
for (const entry of value) {
|
|
5482
|
+
if (!entry || typeof entry !== "object")
|
|
5483
|
+
continue;
|
|
5484
|
+
const record = entry;
|
|
5485
|
+
if (typeof record.id === "string" && typeof record.text === "string") {
|
|
5486
|
+
suggestions.push({ id: record.id, text: record.text });
|
|
5487
|
+
}
|
|
5488
|
+
}
|
|
5489
|
+
return suggestions;
|
|
5490
|
+
}
|
|
5491
|
+
function buildCanUseToolContext(request, requestId) {
|
|
5492
|
+
const context = {};
|
|
5493
|
+
if (typeof requestId === "string")
|
|
5494
|
+
context.requestId = requestId;
|
|
5495
|
+
if (typeof request.tool_call_id === "string")
|
|
5496
|
+
context.toolCallId = request.tool_call_id;
|
|
5497
|
+
const suggestions = normalizePermissionSuggestions(request.permission_suggestions);
|
|
5498
|
+
if (suggestions !== undefined)
|
|
5499
|
+
context.permissionSuggestions = suggestions;
|
|
5500
|
+
if (typeof request.blocked_path === "string" || request.blocked_path === null) {
|
|
5501
|
+
context.blockedPath = request.blocked_path;
|
|
5502
|
+
}
|
|
5503
|
+
if (Array.isArray(request.diffs))
|
|
5504
|
+
context.diffs = request.diffs;
|
|
5505
|
+
return context;
|
|
5506
|
+
}
|
|
5427
5507
|
|
|
5428
5508
|
// src/remote-client-session-core.ts
|
|
5429
5509
|
var FAILURE_STOP_REASONS = new Set([
|
|
@@ -5701,6 +5781,121 @@ function queueItems(message) {
|
|
|
5701
5781
|
];
|
|
5702
5782
|
});
|
|
5703
5783
|
}
|
|
5784
|
+
function deviceStatusRecord(message) {
|
|
5785
|
+
if (message.type !== "update_device_status")
|
|
5786
|
+
return null;
|
|
5787
|
+
const status = message.device_status;
|
|
5788
|
+
return status && typeof status === "object" && !Array.isArray(status) ? status : null;
|
|
5789
|
+
}
|
|
5790
|
+
function pendingControlRequests(status) {
|
|
5791
|
+
const pending = status.pending_control_requests;
|
|
5792
|
+
if (!Array.isArray(pending))
|
|
5793
|
+
return [];
|
|
5794
|
+
return pending.flatMap((item) => {
|
|
5795
|
+
if (!item || typeof item !== "object" || Array.isArray(item))
|
|
5796
|
+
return [];
|
|
5797
|
+
const record = item;
|
|
5798
|
+
if (typeof record.request_id !== "string")
|
|
5799
|
+
return [];
|
|
5800
|
+
const request = record.request && typeof record.request === "object" && !Array.isArray(record.request) ? record.request : null;
|
|
5801
|
+
if (!request || typeof request.tool_name !== "string")
|
|
5802
|
+
return [];
|
|
5803
|
+
const entry = {
|
|
5804
|
+
requestId: record.request_id,
|
|
5805
|
+
toolName: request.tool_name,
|
|
5806
|
+
permissionSuggestions: permissionSuggestions(request.permission_suggestions),
|
|
5807
|
+
blockedPath: typeof request.blocked_path === "string" || request.blocked_path === null ? request.blocked_path : null
|
|
5808
|
+
};
|
|
5809
|
+
if (typeof request.tool_call_id === "string")
|
|
5810
|
+
entry.toolCallId = request.tool_call_id;
|
|
5811
|
+
if (request.input && typeof request.input === "object" && !Array.isArray(request.input)) {
|
|
5812
|
+
entry.toolInput = request.input;
|
|
5813
|
+
}
|
|
5814
|
+
const previews = diffPreviews(request.diffs);
|
|
5815
|
+
if (previews !== undefined)
|
|
5816
|
+
entry.diffs = previews;
|
|
5817
|
+
return [entry];
|
|
5818
|
+
});
|
|
5819
|
+
}
|
|
5820
|
+
function permissionSuggestions(value) {
|
|
5821
|
+
if (!Array.isArray(value))
|
|
5822
|
+
return [];
|
|
5823
|
+
return value.flatMap((item) => {
|
|
5824
|
+
if (!item || typeof item !== "object" || Array.isArray(item))
|
|
5825
|
+
return [];
|
|
5826
|
+
const record = item;
|
|
5827
|
+
return typeof record.id === "string" && typeof record.text === "string" ? [{ id: record.id, text: record.text }] : [];
|
|
5828
|
+
});
|
|
5829
|
+
}
|
|
5830
|
+
function diffPreviews(value) {
|
|
5831
|
+
if (!Array.isArray(value))
|
|
5832
|
+
return;
|
|
5833
|
+
return value.flatMap((item) => {
|
|
5834
|
+
if (!item || typeof item !== "object" || Array.isArray(item))
|
|
5835
|
+
return [];
|
|
5836
|
+
const record = item;
|
|
5837
|
+
if (record.mode === "advanced" && typeof record.fileName === "string" && Array.isArray(record.hunks)) {
|
|
5838
|
+
return [{
|
|
5839
|
+
mode: "advanced",
|
|
5840
|
+
fileName: record.fileName,
|
|
5841
|
+
hunks: diffHunks(record.hunks)
|
|
5842
|
+
}];
|
|
5843
|
+
}
|
|
5844
|
+
if ((record.mode === "fallback" || record.mode === "unpreviewable") && typeof record.fileName === "string" && typeof record.reason === "string") {
|
|
5845
|
+
return [{
|
|
5846
|
+
mode: record.mode,
|
|
5847
|
+
fileName: record.fileName,
|
|
5848
|
+
reason: record.reason
|
|
5849
|
+
}];
|
|
5850
|
+
}
|
|
5851
|
+
return [];
|
|
5852
|
+
});
|
|
5853
|
+
}
|
|
5854
|
+
function diffHunks(value) {
|
|
5855
|
+
return value.flatMap((item) => {
|
|
5856
|
+
if (!item || typeof item !== "object" || Array.isArray(item))
|
|
5857
|
+
return [];
|
|
5858
|
+
const record = item;
|
|
5859
|
+
if (typeof record.oldStart !== "number" || typeof record.oldLines !== "number" || typeof record.newStart !== "number" || typeof record.newLines !== "number" || !Array.isArray(record.lines)) {
|
|
5860
|
+
return [];
|
|
5861
|
+
}
|
|
5862
|
+
const lines = [];
|
|
5863
|
+
for (const line of record.lines) {
|
|
5864
|
+
if (!line || typeof line !== "object" || Array.isArray(line))
|
|
5865
|
+
continue;
|
|
5866
|
+
const lineRecord = line;
|
|
5867
|
+
const type = lineRecord.type;
|
|
5868
|
+
if (type !== "context" && type !== "add" && type !== "remove" || typeof lineRecord.content !== "string") {
|
|
5869
|
+
continue;
|
|
5870
|
+
}
|
|
5871
|
+
lines.push({
|
|
5872
|
+
type,
|
|
5873
|
+
content: lineRecord.content
|
|
5874
|
+
});
|
|
5875
|
+
}
|
|
5876
|
+
return [{
|
|
5877
|
+
oldStart: record.oldStart,
|
|
5878
|
+
oldLines: record.oldLines,
|
|
5879
|
+
newStart: record.newStart,
|
|
5880
|
+
newLines: record.newLines,
|
|
5881
|
+
lines
|
|
5882
|
+
}];
|
|
5883
|
+
});
|
|
5884
|
+
}
|
|
5885
|
+
function toSessionDeviceStatus(status) {
|
|
5886
|
+
const permissionMode = normalizePermissionMode(status.current_permission_mode);
|
|
5887
|
+
if (typeof status.is_online !== "boolean" || typeof status.is_processing !== "boolean" || permissionMode === undefined || !(typeof status.current_working_directory === "string" || status.current_working_directory === null)) {
|
|
5888
|
+
return null;
|
|
5889
|
+
}
|
|
5890
|
+
return {
|
|
5891
|
+
isOnline: status.is_online,
|
|
5892
|
+
isProcessing: status.is_processing,
|
|
5893
|
+
permissionMode,
|
|
5894
|
+
workingDirectory: status.current_working_directory,
|
|
5895
|
+
pendingControlRequests: pendingControlRequests(status),
|
|
5896
|
+
raw: { ...status }
|
|
5897
|
+
};
|
|
5898
|
+
}
|
|
5704
5899
|
function normalizeSendMessage(message) {
|
|
5705
5900
|
return message;
|
|
5706
5901
|
}
|
|
@@ -5728,6 +5923,8 @@ class RemoteClientSessionCore {
|
|
|
5728
5923
|
messageCounter = 0;
|
|
5729
5924
|
clientMessageCounter = 0;
|
|
5730
5925
|
toolNames;
|
|
5926
|
+
deviceStatusListeners = new Set;
|
|
5927
|
+
deviceStatusRefreshCancels = new Set;
|
|
5731
5928
|
constructor(mode, config) {
|
|
5732
5929
|
this.mode = mode;
|
|
5733
5930
|
this.label = config.label;
|
|
@@ -5918,6 +6115,86 @@ class RemoteClientSessionCore {
|
|
|
5918
6115
|
removed: response.success
|
|
5919
6116
|
};
|
|
5920
6117
|
}
|
|
6118
|
+
async getDeviceStatus(options = {}) {
|
|
6119
|
+
if (!this.initialized) {
|
|
6120
|
+
await this.initialize();
|
|
6121
|
+
}
|
|
6122
|
+
if (!this.controller || !this.runtime) {
|
|
6123
|
+
throw new Error("Session is not initialized");
|
|
6124
|
+
}
|
|
6125
|
+
const timeoutMs = options.timeoutMs ?? this.requestTimeoutMs ?? 30000;
|
|
6126
|
+
if (!Number.isInteger(timeoutMs) || timeoutMs <= 0) {
|
|
6127
|
+
throw new Error("Invalid device status timeout. Expected a positive integer.");
|
|
6128
|
+
}
|
|
6129
|
+
return this.refreshDeviceStatus(timeoutMs);
|
|
6130
|
+
}
|
|
6131
|
+
onDeviceStatus(listener) {
|
|
6132
|
+
if (typeof listener !== "function") {
|
|
6133
|
+
throw new Error("Invalid device status listener. Expected a function.");
|
|
6134
|
+
}
|
|
6135
|
+
this.deviceStatusListeners.add(listener);
|
|
6136
|
+
return () => {
|
|
6137
|
+
this.deviceStatusListeners.delete(listener);
|
|
6138
|
+
};
|
|
6139
|
+
}
|
|
6140
|
+
refreshDeviceStatus(timeoutMs) {
|
|
6141
|
+
const controller = this.controller;
|
|
6142
|
+
const runtime = this.runtime;
|
|
6143
|
+
if (!controller || !runtime) {
|
|
6144
|
+
return Promise.reject(new Error("Session is not initialized"));
|
|
6145
|
+
}
|
|
6146
|
+
return new Promise((resolve, reject) => {
|
|
6147
|
+
let status = null;
|
|
6148
|
+
let syncAcknowledged = false;
|
|
6149
|
+
let settled = false;
|
|
6150
|
+
const cleanup = () => {
|
|
6151
|
+
clearTimeout(timer);
|
|
6152
|
+
unsubscribe();
|
|
6153
|
+
this.deviceStatusRefreshCancels.delete(cancel);
|
|
6154
|
+
};
|
|
6155
|
+
const rejectOnce = (error) => {
|
|
6156
|
+
if (settled)
|
|
6157
|
+
return;
|
|
6158
|
+
settled = true;
|
|
6159
|
+
cleanup();
|
|
6160
|
+
reject(error);
|
|
6161
|
+
};
|
|
6162
|
+
const resolveIfComplete = () => {
|
|
6163
|
+
if (settled || !syncAcknowledged || !status)
|
|
6164
|
+
return;
|
|
6165
|
+
settled = true;
|
|
6166
|
+
cleanup();
|
|
6167
|
+
resolve(status);
|
|
6168
|
+
};
|
|
6169
|
+
const cancel = (error) => rejectOnce(error);
|
|
6170
|
+
const timer = setTimeout(() => {
|
|
6171
|
+
rejectOnce(new Error(`Timed out waiting for ${this.label} device status`));
|
|
6172
|
+
}, timeoutMs);
|
|
6173
|
+
timer.unref?.();
|
|
6174
|
+
const unsubscribe = this.onDeviceStatus((nextStatus) => {
|
|
6175
|
+
status = nextStatus;
|
|
6176
|
+
resolveIfComplete();
|
|
6177
|
+
});
|
|
6178
|
+
this.deviceStatusRefreshCancels.add(cancel);
|
|
6179
|
+
controller.request("sync", {
|
|
6180
|
+
runtime,
|
|
6181
|
+
recover_approvals: false,
|
|
6182
|
+
force_device_status: true
|
|
6183
|
+
}, {
|
|
6184
|
+
timeoutMs,
|
|
6185
|
+
predicate: (message) => message.type === "sync_response"
|
|
6186
|
+
}).then((response) => {
|
|
6187
|
+
if (response.success === false) {
|
|
6188
|
+
rejectOnce(new Error(typeof response.error === "string" ? response.error : `Failed to refresh ${this.label} device status`));
|
|
6189
|
+
return;
|
|
6190
|
+
}
|
|
6191
|
+
syncAcknowledged = true;
|
|
6192
|
+
resolveIfComplete();
|
|
6193
|
+
}, (error) => {
|
|
6194
|
+
rejectOnce(error instanceof Error ? error : new Error(String(error)));
|
|
6195
|
+
});
|
|
6196
|
+
});
|
|
6197
|
+
}
|
|
5921
6198
|
async listMessages(options = {}) {
|
|
5922
6199
|
if (!this.initialized) {
|
|
5923
6200
|
await this.initialize();
|
|
@@ -5970,6 +6247,11 @@ class RemoteClientSessionCore {
|
|
|
5970
6247
|
}
|
|
5971
6248
|
this.activeTurn = null;
|
|
5972
6249
|
this.pendingTurns.length = 0;
|
|
6250
|
+
for (const cancel of [...this.deviceStatusRefreshCancels]) {
|
|
6251
|
+
cancel(new Error(`Session closed while waiting for ${this.label} device status`));
|
|
6252
|
+
}
|
|
6253
|
+
this.deviceStatusRefreshCancels.clear();
|
|
6254
|
+
this.deviceStatusListeners.clear();
|
|
5973
6255
|
this.controller?.close();
|
|
5974
6256
|
this.controller = null;
|
|
5975
6257
|
this.onCoreClose();
|
|
@@ -6207,6 +6489,18 @@ class RemoteClientSessionCore {
|
|
|
6207
6489
|
handleProtocolMessage = (message) => {
|
|
6208
6490
|
if (!this.runtime || !sameRuntime2(message, this.runtime))
|
|
6209
6491
|
return;
|
|
6492
|
+
const deviceStatus = deviceStatusRecord(message);
|
|
6493
|
+
if (deviceStatus) {
|
|
6494
|
+
const status = toSessionDeviceStatus(deviceStatus);
|
|
6495
|
+
if (!status)
|
|
6496
|
+
return;
|
|
6497
|
+
for (const listener of [...this.deviceStatusListeners]) {
|
|
6498
|
+
try {
|
|
6499
|
+
listener(status);
|
|
6500
|
+
} catch {}
|
|
6501
|
+
}
|
|
6502
|
+
return;
|
|
6503
|
+
}
|
|
6210
6504
|
if (message.type === "update_queue") {
|
|
6211
6505
|
const sdkMessage2 = {
|
|
6212
6506
|
type: "queue_update",
|
|
@@ -6636,7 +6930,7 @@ function createExternalToolCallHandler(externalTools) {
|
|
|
6636
6930
|
};
|
|
6637
6931
|
};
|
|
6638
6932
|
}
|
|
6639
|
-
async function resolveAppServerToolApproval(options, toolName, toolInput) {
|
|
6933
|
+
async function resolveAppServerToolApproval(options, toolName, toolInput, context) {
|
|
6640
6934
|
const hasCallback = typeof options.canUseTool === "function";
|
|
6641
6935
|
const toolNeedsRuntimeUserInput = requiresRuntimeUserInput(toolName);
|
|
6642
6936
|
if (toolNeedsRuntimeUserInput && !hasCallback) {
|
|
@@ -6651,7 +6945,7 @@ async function resolveAppServerToolApproval(options, toolName, toolInput) {
|
|
|
6651
6945
|
}
|
|
6652
6946
|
if (hasCallback) {
|
|
6653
6947
|
try {
|
|
6654
|
-
const result = await options.canUseTool(toolName, toolInput);
|
|
6948
|
+
const result = await options.canUseTool(toolName, toolInput, context);
|
|
6655
6949
|
if (result.behavior === "allow") {
|
|
6656
6950
|
return {
|
|
6657
6951
|
behavior: "allow",
|
|
@@ -6711,7 +7005,7 @@ function toAppServerApprovalDecision(decision) {
|
|
|
6711
7005
|
selected_permission_suggestion_ids: selectedPermissionSuggestionIds
|
|
6712
7006
|
};
|
|
6713
7007
|
}
|
|
6714
|
-
function
|
|
7008
|
+
function stringRecord2(value) {
|
|
6715
7009
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
6716
7010
|
return;
|
|
6717
7011
|
const record = {};
|
|
@@ -6757,7 +7051,7 @@ function normalizeListModelsResponse(response) {
|
|
|
6757
7051
|
} else if (Array.isArray(response.available_handles)) {
|
|
6758
7052
|
result.availableHandles = response.available_handles.filter((handle) => typeof handle === "string");
|
|
6759
7053
|
}
|
|
6760
|
-
const aliases =
|
|
7054
|
+
const aliases = stringRecord2(response.byok_provider_aliases);
|
|
6761
7055
|
if (aliases)
|
|
6762
7056
|
result.byokProviderAliases = aliases;
|
|
6763
7057
|
return result;
|
|
@@ -6812,7 +7106,7 @@ async function respondToAppServerControlRequest(config, message) {
|
|
|
6812
7106
|
return;
|
|
6813
7107
|
const toolName = typeof requestRecord.tool_name === "string" ? requestRecord.tool_name : "unknown";
|
|
6814
7108
|
const toolInput = requestRecord.input && typeof requestRecord.input === "object" && !Array.isArray(requestRecord.input) ? requestRecord.input : {};
|
|
6815
|
-
const decision = await resolveAppServerToolApproval(config.getOptions(), toolName, toolInput);
|
|
7109
|
+
const decision = await resolveAppServerToolApproval(config.getOptions(), toolName, toolInput, buildCanUseToolContext(requestRecord, requestId));
|
|
6816
7110
|
config.client.input({
|
|
6817
7111
|
runtime,
|
|
6818
7112
|
payload: {
|
|
@@ -7155,6 +7449,19 @@ function asArray(body, action) {
|
|
|
7155
7449
|
}
|
|
7156
7450
|
return body;
|
|
7157
7451
|
}
|
|
7452
|
+
function cloudModelEntry(raw) {
|
|
7453
|
+
if (typeof raw.handle !== "string" || raw.handle.length === 0) {
|
|
7454
|
+
return null;
|
|
7455
|
+
}
|
|
7456
|
+
const label = typeof raw.display_name === "string" ? raw.display_name : typeof raw.name === "string" ? raw.name : raw.handle;
|
|
7457
|
+
return {
|
|
7458
|
+
...raw,
|
|
7459
|
+
id: typeof raw.id === "string" && raw.id.length > 0 ? raw.id : raw.handle,
|
|
7460
|
+
handle: raw.handle,
|
|
7461
|
+
label,
|
|
7462
|
+
description: typeof raw.description === "string" ? raw.description : ""
|
|
7463
|
+
};
|
|
7464
|
+
}
|
|
7158
7465
|
|
|
7159
7466
|
class CloudManagementTransport {
|
|
7160
7467
|
options;
|
|
@@ -7170,6 +7477,20 @@ class CloudManagementTransport {
|
|
|
7170
7477
|
updateAgent(agentId, body) {
|
|
7171
7478
|
return this.requestObject(`/v1/agents/${encodeURIComponent(agentId)}`, "PATCH", body, "Cloud update agent");
|
|
7172
7479
|
}
|
|
7480
|
+
async deleteAgent(agentId) {
|
|
7481
|
+
await this.requestUrl(this.url(`/v1/agents/${encodeURIComponent(agentId)}`), "DELETE", undefined, "Cloud delete agent");
|
|
7482
|
+
}
|
|
7483
|
+
async listModels() {
|
|
7484
|
+
const entries = await this.getArray("/v1/models", {}, "Cloud list models");
|
|
7485
|
+
const normalized = entries.flatMap((entry) => {
|
|
7486
|
+
const model = cloudModelEntry(entry);
|
|
7487
|
+
return model ? [model] : [];
|
|
7488
|
+
});
|
|
7489
|
+
return {
|
|
7490
|
+
entries: normalized,
|
|
7491
|
+
availableHandles: normalized.map((entry) => entry.handle)
|
|
7492
|
+
};
|
|
7493
|
+
}
|
|
7173
7494
|
listConversations(query) {
|
|
7174
7495
|
return this.getArray("/v1/conversations/", query, "Cloud list conversations");
|
|
7175
7496
|
}
|
|
@@ -8254,6 +8575,11 @@ class CloudEnvironmentSession extends RemoteClientSessionCore {
|
|
|
8254
8575
|
function definedEntries(values) {
|
|
8255
8576
|
return Object.fromEntries(Object.entries(values).filter(([, value]) => value !== undefined));
|
|
8256
8577
|
}
|
|
8578
|
+
function assertNonEmptyId(value, name) {
|
|
8579
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
8580
|
+
throw new Error(`Invalid ${name}. Expected a non-empty string.`);
|
|
8581
|
+
}
|
|
8582
|
+
}
|
|
8257
8583
|
function agentListQuery(options) {
|
|
8258
8584
|
const orderBy = options.orderBy?.replace(/[A-Z]/g, (character) => `_${character.toLowerCase()}`);
|
|
8259
8585
|
return {
|
|
@@ -8326,7 +8652,16 @@ function createAgentsClient(transport) {
|
|
|
8326
8652
|
return {
|
|
8327
8653
|
list: (options = {}) => transport().listAgents(agentListQuery(options)),
|
|
8328
8654
|
retrieve: (agentId) => transport().retrieveAgent(agentId),
|
|
8329
|
-
update: (agentId, options) => transport().updateAgent(agentId, agentUpdateBody(options))
|
|
8655
|
+
update: (agentId, options) => transport().updateAgent(agentId, agentUpdateBody(options)),
|
|
8656
|
+
delete: async (agentId) => {
|
|
8657
|
+
assertNonEmptyId(agentId, "agent id");
|
|
8658
|
+
await transport().deleteAgent(agentId);
|
|
8659
|
+
}
|
|
8660
|
+
};
|
|
8661
|
+
}
|
|
8662
|
+
function createModelsClient(transport) {
|
|
8663
|
+
return {
|
|
8664
|
+
list: () => transport().listModels()
|
|
8330
8665
|
};
|
|
8331
8666
|
}
|
|
8332
8667
|
function createConversationsClient(transport) {
|
|
@@ -8497,6 +8832,7 @@ class LettaAgentClientBase {
|
|
|
8497
8832
|
environment;
|
|
8498
8833
|
agents;
|
|
8499
8834
|
conversations;
|
|
8835
|
+
models;
|
|
8500
8836
|
options;
|
|
8501
8837
|
repositoriesClient = null;
|
|
8502
8838
|
managementTransport = null;
|
|
@@ -8510,6 +8846,7 @@ class LettaAgentClientBase {
|
|
|
8510
8846
|
this.options = options;
|
|
8511
8847
|
this.agents = createAgentsClient(() => this.getManagementTransport());
|
|
8512
8848
|
this.conversations = createConversationsClient(() => this.getManagementTransport());
|
|
8849
|
+
this.models = createModelsClient(() => this.getManagementTransport());
|
|
8513
8850
|
if (this.backend === "local" && this.environment !== undefined) {
|
|
8514
8851
|
throw new Error('LettaAgentClient environment is only valid with backend: "cloud".');
|
|
8515
8852
|
}
|
|
@@ -8876,7 +9213,8 @@ function createLocalAppServerSession(options, mode) {
|
|
|
8876
9213
|
})
|
|
8877
9214
|
},
|
|
8878
9215
|
...appServer.WebSocket !== undefined ? { WebSocket: appServer.WebSocket } : {},
|
|
8879
|
-
...appServer.requestTimeoutMs !== undefined ? { requestTimeoutMs: appServer.requestTimeoutMs } : {}
|
|
9216
|
+
...appServer.requestTimeoutMs !== undefined ? { requestTimeoutMs: appServer.requestTimeoutMs } : {},
|
|
9217
|
+
...appServer.pinGlobalAgent !== undefined ? { pinGlobalAgent: appServer.pinGlobalAgent } : {}
|
|
8880
9218
|
};
|
|
8881
9219
|
return new AppServerSession(sessionOptions, mode);
|
|
8882
9220
|
}
|
|
@@ -9861,7 +10199,7 @@ ${stderr}` : "";
|
|
|
9861
10199
|
};
|
|
9862
10200
|
} else if (hasCallback) {
|
|
9863
10201
|
try {
|
|
9864
|
-
const result = await this.options.canUseTool(toolName, req.input);
|
|
10202
|
+
const result = await this.options.canUseTool(toolName, req.input, buildCanUseToolContext(req, requestId));
|
|
9865
10203
|
if (result.behavior === "allow") {
|
|
9866
10204
|
response = {
|
|
9867
10205
|
behavior: "allow",
|
|
@@ -9993,6 +10331,12 @@ ${stderr}` : "";
|
|
|
9993
10331
|
async removeQueuedMessage(_itemId) {
|
|
9994
10332
|
throw new Error("removeQueuedMessage() is not supported by the legacy stdio transport. Use a Cloud, Remote, or local app-server session.");
|
|
9995
10333
|
}
|
|
10334
|
+
async getDeviceStatus(_options) {
|
|
10335
|
+
throw new Error("getDeviceStatus() is not supported by the legacy stdio transport. Use a Cloud, Remote, or local app-server session.");
|
|
10336
|
+
}
|
|
10337
|
+
onDeviceStatus(_listener) {
|
|
10338
|
+
throw new Error("onDeviceStatus() is not supported by the legacy stdio transport. Use a Cloud, Remote, or local app-server session.");
|
|
10339
|
+
}
|
|
9996
10340
|
async bootstrapState(options = {}) {
|
|
9997
10341
|
if (!this.initialized) {
|
|
9998
10342
|
throw new Error("Session must be initialized before calling bootstrapState()");
|
|
@@ -10544,4 +10888,4 @@ export {
|
|
|
10544
10888
|
CloudManagedSandboxExpiredError
|
|
10545
10889
|
};
|
|
10546
10890
|
|
|
10547
|
-
//# debugId=
|
|
10891
|
+
//# debugId=D44861B7D6BE1C4C64756E2164756E21
|