@letta-ai/letta-agent-sdk 0.6.0 → 0.6.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 CHANGED
@@ -53,7 +53,6 @@ An agent is the persistent entity with memory. A conversation is a thread on tha
53
53
  - `createSession(agentId)` starts a new conversation.
54
54
  - `resumeSession(conversationId)` resumes a saved conversation.
55
55
  - `resumeSession(agentId)` resumes the agent's default conversation.
56
- - `prompt(message, agentId)` runs a one-shot prompt in a new conversation.
57
56
 
58
57
  Portable sessions also expose the stateful controls needed by interactive
59
58
  clients:
@@ -45,7 +45,10 @@ export declare class LettaAgentClientBase {
45
45
  * Letta Cloud sessions. Remote app-server URLs already select the runtime.
46
46
  */
47
47
  resumeSession(id: string, options?: LettaCodeClientSessionOptions): LettaCodeSession;
48
- /** One-shot prompt convenience helper using a new conversation. */
48
+ /**
49
+ * One-shot convenience for scripts, smoke tests, and evals.
50
+ * Applications should use a session when they need interactive turn state.
51
+ */
49
52
  prompt(message: SendMessage, agentId: string, options?: LettaCodeClientSessionOptions): Promise<SDKResultMessage>;
50
53
  private assertSessionBackend;
51
54
  protected createLocalAgent(_options: CreateAgentOptions): Promise<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"client-base.d.ts","sourceRoot":"","sources":["../src/client-base.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAevD,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAEV,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,kBAAkB,EAElB,gBAAgB,EAChB,sBAAsB,EACtB,6BAA6B,EAC7B,oBAAoB,EAIpB,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACZ,MAAM,YAAY,CAAC;AAmDpB;;;;;;;;;GASG;AACH,qBAAa,oBAAoB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H,IAAI,YAAY,IAAI,kBAAkB,CAErC;IAEK,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC;IAwBpE;;;;OAIG;IACH,aAAa,CACX,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,6BAAkC,GAC1C,gBAAgB;IA+BnB;;;;;OAKG;IACH,aAAa,CACX,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,6BAAkC,GAC1C,gBAAgB;IA8CnB;;;OAGG;IACG,MAAM,CACV,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,gBAAgB,CAAC;IAU5B,OAAO,CAAC,oBAAoB;IA4E5B,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzE,SAAS,CAAC,kBAAkB,CAC1B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,6BAA6B,GACtC,gBAAgB;IAInB,SAAS,CAAC,kBAAkB,CAC1B,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,6BAA6B,GACtC,gBAAgB;IAInB,SAAS,CAAC,4BAA4B,IAAI,KAAK;IAM/C,SAAS,CAAC,8BAA8B,IAAI,mBAAmB;IAI/D,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,uBAAuB;IAI/B,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,0BAA0B;IAYlC,OAAO,CAAC,2BAA2B;IAQnC,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,sBAAsB;IAgB9B,OAAO,CAAC,YAAY;CAMrB"}
@@ -9573,7 +9573,7 @@ class RemoteClientSessionCore {
9573
9573
  throw error;
9574
9574
  }
9575
9575
  }
9576
- async runTurn(message, _options = {}) {
9576
+ async sendAndWaitForResult(message) {
9577
9577
  if (this.turns.hasInFlightTurn()) {
9578
9578
  throw new Error(`A turn is already in flight for this ${this.label} session. Use send() and stream() to let the listener queue messages.`);
9579
9579
  }
@@ -10649,6 +10649,16 @@ function cloudModelEntry(raw) {
10649
10649
  function isNotFound(error) {
10650
10650
  return error instanceof APIError && error.status === 404;
10651
10651
  }
10652
+ function toOrderRelativeCursors(query) {
10653
+ if ((query.order ?? "desc") !== "desc")
10654
+ return query;
10655
+ const { before, after, ...rest } = query;
10656
+ return {
10657
+ ...rest,
10658
+ ...after != null ? { before: after } : {},
10659
+ ...before != null ? { after: before } : {}
10660
+ };
10661
+ }
10652
10662
 
10653
10663
  class CloudManagementTransport {
10654
10664
  client;
@@ -10724,7 +10734,7 @@ class CloudManagementTransport {
10724
10734
  return this.client.conversations.update(conversationId, body);
10725
10735
  }
10726
10736
  async listConversationMessages(conversationId, query) {
10727
- const page = await this.client.conversations.messages.list(conversationId, query);
10737
+ const page = await this.client.conversations.messages.list(conversationId, toOrderRelativeCursors(query));
10728
10738
  return { messages: page.items };
10729
10739
  }
10730
10740
  }
@@ -11808,14 +11818,6 @@ function getBlockLabels(memory) {
11808
11818
  return null;
11809
11819
  }).filter((label) => label !== null);
11810
11820
  }
11811
- function validateApprovalRecoveryOptions(options) {
11812
- if (options.maxApprovalRecoveryAttempts !== undefined && (!Number.isInteger(options.maxApprovalRecoveryAttempts) || options.maxApprovalRecoveryAttempts < 0)) {
11813
- throw new Error("Invalid maxApprovalRecoveryAttempts. Expected a non-negative integer.");
11814
- }
11815
- if (options.approvalRecoveryTimeoutMs !== undefined && (!Number.isInteger(options.approvalRecoveryTimeoutMs) || options.approvalRecoveryTimeoutMs <= 0)) {
11816
- throw new Error("Invalid approvalRecoveryTimeoutMs. Expected a positive integer.");
11817
- }
11818
- }
11819
11821
  function validateRemovedSessionOptions(options) {
11820
11822
  const removedOptions = options;
11821
11823
  if (removedOptions.systemPrompt !== undefined) {
@@ -11928,7 +11930,6 @@ function validateCreateSessionOptions(options) {
11928
11930
  validateMcpServers(options.mcpServers);
11929
11931
  validateReasoningEffort(options.reasoningEffort);
11930
11932
  validateDreamingOptions(options.dreaming);
11931
- validateApprovalRecoveryOptions(options);
11932
11933
  validateRemovedSessionOptions(options);
11933
11934
  }
11934
11935
  function validateCreateAgentOptions(options) {
@@ -12136,7 +12137,7 @@ class LettaAgentClientBase {
12136
12137
  async prompt(message, agentId, options = {}) {
12137
12138
  const session = this.createSession(agentId, options);
12138
12139
  try {
12139
- return await session.runTurn(message);
12140
+ return await session.sendAndWaitForResult(message);
12140
12141
  } finally {
12141
12142
  session.close();
12142
12143
  }
@@ -12354,4 +12355,4 @@ export {
12354
12355
  CloudManagedSandboxExpiredError
12355
12356
  };
12356
12357
 
12357
- //# debugId=FE3D4D568E602DA664756E2164756E21
12358
+ //# debugId=F422AB0A96BFDBF164756E2164756E21