@letta-ai/letta-code 0.30.16 → 0.30.18

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/letta.js CHANGED
@@ -5488,7 +5488,7 @@ var package_default;
5488
5488
  var init_package = __esm(() => {
5489
5489
  package_default = {
5490
5490
  name: "@letta-ai/letta-code",
5491
- version: "0.30.16",
5491
+ version: "0.30.18",
5492
5492
  description: "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
5493
5493
  type: "module",
5494
5494
  packageManager: "bun@1.3.0",
@@ -152619,8 +152619,7 @@ function resolveRuntimeScope(runtime, params) {
152619
152619
  const resolvedConversationId = resolveScopedConversationId(runtime, params);
152620
152620
  return {
152621
152621
  agent_id: resolvedAgentId,
152622
- conversation_id: resolvedConversationId,
152623
- ...params?.super_run_id ? { super_run_id: params.super_run_id } : {}
152622
+ conversation_id: resolvedConversationId
152624
152623
  };
152625
152624
  }
152626
152625
 
@@ -152755,7 +152754,6 @@ class TurnLifecycle {
152755
152754
  #createId;
152756
152755
  #state = IDLE_STATE;
152757
152756
  #lastStopReason = null;
152758
- #superRunOwner = null;
152759
152757
  constructor(createId = () => crypto.randomUUID()) {
152760
152758
  this.#createId = createId;
152761
152759
  }
@@ -152777,9 +152775,6 @@ class TurnLifecycle {
152777
152775
  get activeRunId() {
152778
152776
  return this.#state.kind === "active" ? this.#state.runId : null;
152779
152777
  }
152780
- get superRunId() {
152781
- return this.#superRunOwner?.superRunId ?? null;
152782
- }
152783
152778
  get executingToolCallIds() {
152784
152779
  return this.#state.kind === "active" || this.#state.kind === "cancelling" ? this.#state.executingToolCallIds : [];
152785
152780
  }
@@ -152829,10 +152824,6 @@ class TurnLifecycle {
152829
152824
  id: this.#createId(),
152830
152825
  signal: abortController.signal
152831
152826
  });
152832
- this.#superRunOwner = {
152833
- leaseId: lease.id,
152834
- superRunId: options3.superRunId ?? null
152835
- };
152836
152827
  this.#state = {
152837
152828
  kind: "active",
152838
152829
  origin: options3.origin,
@@ -152859,13 +152850,6 @@ class TurnLifecycle {
152859
152850
  this.#state = { ...this.#state, loopStatus: status };
152860
152851
  return true;
152861
152852
  }
152862
- releaseSuperRunId(lease) {
152863
- if (this.#superRunOwner?.leaseId !== lease.id) {
152864
- return false;
152865
- }
152866
- this.#superRunOwner = null;
152867
- return true;
152868
- }
152869
152853
  setRunId(lease, runId) {
152870
152854
  if (this.#state.kind !== "active" || !this.isCurrent(lease)) {
152871
152855
  return false;
@@ -152897,7 +152881,6 @@ class TurnLifecycle {
152897
152881
  if (this.#state.kind !== "idle") {
152898
152882
  return false;
152899
152883
  }
152900
- this.#superRunOwner = null;
152901
152884
  this.#state = {
152902
152885
  kind: "command",
152903
152886
  loopStatus: "EXECUTING_COMMAND"
@@ -152988,7 +152971,6 @@ class TurnLifecycle {
152988
152971
  }
152989
152972
  reset(stopReason = "cancelled") {
152990
152973
  const state = this.#state;
152991
- this.#superRunOwner = null;
152992
152974
  if (state.kind === "active" || state.kind === "cancelling") {
152993
152975
  if (!state.abortController.signal.aborted) {
152994
152976
  state.abortController.abort();
@@ -153159,9 +153141,6 @@ function createConversationRuntime(listener, agentId, conversationId) {
153159
153141
  key: runtimeKey,
153160
153142
  agentId: normalizedAgentId,
153161
153143
  conversationId: normalizedConversationId,
153162
- get superRunId() {
153163
- return turnLifecycle.superRunId;
153164
- },
153165
153144
  skillSources: listener.skillSourcesByConversation.get(runtimeKey)?.slice(),
153166
153145
  activeConnectionId: null,
153167
153146
  turnLifecycle,
@@ -157613,8 +157592,7 @@ function getScopeForRuntime(runtime, scope) {
157613
157592
  if (runtime && "listener" in runtime) {
157614
157593
  return {
157615
157594
  agent_id: scope?.agent_id ?? runtime.agentId,
157616
- conversation_id: scope?.conversation_id ?? runtime.conversationId,
157617
- super_run_id: scope?.super_run_id ?? runtime.superRunId ?? undefined
157595
+ conversation_id: scope?.conversation_id ?? runtime.conversationId
157618
157596
  };
157619
157597
  }
157620
157598
  return scope ?? {};
@@ -157779,7 +157757,7 @@ function emitProtocolV2Message(socket, runtime, message, scope, routing) {
157779
157757
  typeLabel: message.type,
157780
157758
  frameClass,
157781
157759
  ...frameClass === "status" ? {
157782
- coalesceKey: `${message.type}:${runtimeScope.agent_id ?? ""}:${runtimeScope.conversation_id ?? ""}:${runtimeScope.super_run_id ?? ""}`
157760
+ coalesceKey: `${message.type}:${runtimeScope.agent_id ?? ""}:${runtimeScope.conversation_id ?? ""}`
157783
157761
  } : {},
157784
157762
  build: () => {
157785
157763
  const eventSeq = nextListenerConnectionEventSeq(connection, listener);
@@ -181475,9 +181453,6 @@ async function sendMessageStreamWithBackend(backend, conversationId, messages, o
181475
181453
  if (opts.actingUserId) {
181476
181454
  extraHeaders["X-Letta-Acting-User-Id"] = opts.actingUserId;
181477
181455
  }
181478
- if (opts.superRunId) {
181479
- extraHeaders["X-Letta-Super-Run-Id"] = opts.superRunId;
181480
- }
181481
181456
  const messageSummary = normalizedMessages.map((item) => {
181482
181457
  if (item.type === "approval") {
181483
181458
  return `approval:${item.approvals?.length ?? 0}`;
@@ -241141,11 +241116,6 @@ function getSlackActionRecord(action3, body3) {
241141
241116
  const actions = asRecord2(body3)?.actions;
241142
241117
  return Array.isArray(actions) ? asRecord2(actions[0]) : null;
241143
241118
  }
241144
- function resolveSlackSelectedModel(action3, body3) {
241145
- const actionRecord = getSlackActionRecord(action3, body3);
241146
- const selectedOption = asRecord2(actionRecord?.selected_option);
241147
- return firstNonEmptyString(selectedOption?.value, actionRecord?.value) ?? null;
241148
- }
241149
241119
  function resolveSlackActionChannelId(body3) {
241150
241120
  const bodyRecord = asRecord2(body3);
241151
241121
  const channel = asRecord2(bodyRecord?.channel);
@@ -241733,6 +241703,11 @@ var init_command_runtime_executor = __esm(() => {
241733
241703
  });
241734
241704
 
241735
241705
  // src/channels/slack/model-picker-blocks.ts
241706
+ function resolveSlackSelectedModel(action3, body3) {
241707
+ const actionRecord = getSlackActionRecord(action3, body3);
241708
+ const selectedOption = asRecord2(actionRecord?.selected_option);
241709
+ return firstNonEmptyString(selectedOption?.value, actionRecord?.value) ?? null;
241710
+ }
241736
241711
  function escapeSlackMrkdwn(text2) {
241737
241712
  return text2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
241738
241713
  }
@@ -241850,6 +241825,7 @@ Handle: ${escapeSlackMrkdwn(params.current.modelHandle)}` : "";
241850
241825
  var SLACK_MODEL_PICKER_OPTION_LIMIT = 100, SLACK_MODEL_OPTION_TEXT_LIMIT = 75, SLACK_MODEL_OPTION_VALUE_LIMIT = 75, SLACK_MODEL_SELECT_ACTION_ID = "letta_channel_model_select";
241851
241826
  var init_model_picker_blocks = __esm(() => {
241852
241827
  init_command_runtime_executor();
241828
+ init_utils6();
241853
241829
  });
241854
241830
 
241855
241831
  // src/channels/slack/agent-thread-tracker.ts
@@ -244541,6 +244517,9 @@ function resolveSlackMessageIngressPolicy(params) {
244541
244517
  }
244542
244518
  const rawText = isNonEmptyString5(message.text) ? message.text : "";
244543
244519
  const wasMentioned = hasSlackMention2(rawText, params.botUserId);
244520
+ if (chatType === "channel" && wasMentioned && params.appMentionEventWillHandleMentions === true) {
244521
+ return { shouldRoute: false, reason: "handled_by_app_mention" };
244522
+ }
244544
244523
  const isAgentThread = params.isAgentThread === true;
244545
244524
  const effectiveMention = isBotAuthoredMessage(message) ? wasMentioned : wasMentioned || isAgentThread;
244546
244525
  return {
@@ -244757,7 +244736,8 @@ function createSlackIngressController(params) {
244757
244736
  }
244758
244737
  const basePolicy = resolveSlackMessageIngressPolicy({
244759
244738
  message: rawMessage,
244760
- botUserId: params.getBotUserId()
244739
+ botUserId: params.getBotUserId(),
244740
+ appMentionEventWillHandleMentions: true
244761
244741
  });
244762
244742
  if (!basePolicy.shouldRoute)
244763
244743
  return;
@@ -244781,7 +244761,8 @@ function createSlackIngressController(params) {
244781
244761
  const policy = resolveSlackMessageIngressPolicy({
244782
244762
  message: rawMessage,
244783
244763
  botUserId: params.getBotUserId(),
244784
- isAgentThread
244764
+ isAgentThread,
244765
+ appMentionEventWillHandleMentions: true
244785
244766
  });
244786
244767
  if (!policy.shouldRoute)
244787
244768
  return;
@@ -266779,7 +266760,7 @@ function shouldProcessInboundMessageDirectly(runtime, parsed) {
266779
266760
  });
266780
266761
  return getListenerBlockedReason(runtime.turnLifecycle.snapshot(), activeScope ? getPendingControlRequestCount(runtime.listener, activeScope) : 0) === null;
266781
266762
  }
266782
- function consumeQueuedTurn(runtime, options3) {
266763
+ function consumeQueuedTurn(runtime) {
266783
266764
  const queuedItems = runtime.queueRuntime.peek();
266784
266765
  const firstQueuedItem = queuedItems[0];
266785
266766
  if (!firstQueuedItem || !isCoalescable(firstQueuedItem.kind)) {
@@ -266829,18 +266810,6 @@ function consumeQueuedTurn(runtime, options3) {
266829
266810
  if (!hasMessage && !hasTaskNotification && !hasCronPrompt && !hasModContinue || queueLen === 0) {
266830
266811
  return null;
266831
266812
  }
266832
- if (options3?.matchActiveSuperRun) {
266833
- const activeSuperRunId = runtime.superRunId;
266834
- const crossesSuperRun = queuedItems.slice(0, queueLen).some((item) => {
266835
- if (item.kind !== "message")
266836
- return false;
266837
- const queuedSuperRunId = runtime.queuedMessagesByItemId.get(item.id)?.superRunId ?? null;
266838
- return queuedSuperRunId !== activeSuperRunId;
266839
- });
266840
- if (crossesSuperRun) {
266841
- return null;
266842
- }
266843
- }
266844
266813
  const dequeuedBatch = runtime.queueRuntime.consumeItems(queueLen);
266845
266814
  if (!dequeuedBatch) {
266846
266815
  return null;
@@ -276880,11 +276849,11 @@ function resolvePendingApprovalResolver(runtime, response, connectionId) {
276880
276849
  setCommandLoopStatus(runtime, "WAITING_ON_INPUT");
276881
276850
  }
276882
276851
  pending.resolve(response);
276883
- emitLoopStatusIfOpen(runtime, {
276852
+ emitLoopStatusIfOpen(runtime.listener, {
276884
276853
  agent_id: runtime.agentId,
276885
276854
  conversation_id: runtime.conversationId
276886
276855
  });
276887
- emitDeviceStatusIfOpen(runtime, {
276856
+ emitDeviceStatusIfOpen(runtime.listener, {
276888
276857
  agent_id: runtime.agentId,
276889
276858
  conversation_id: runtime.conversationId
276890
276859
  });
@@ -276899,11 +276868,11 @@ function rejectPendingApprovalResolvers(runtime, reason) {
276899
276868
  if (!runtime.isProcessing && !runtime.cancelRequested) {
276900
276869
  setCommandLoopStatus(runtime, "WAITING_ON_INPUT");
276901
276870
  }
276902
- emitLoopStatusIfOpen(runtime, {
276871
+ emitLoopStatusIfOpen(runtime.listener, {
276903
276872
  agent_id: runtime.agentId,
276904
276873
  conversation_id: runtime.conversationId
276905
276874
  });
276906
- emitDeviceStatusIfOpen(runtime, {
276875
+ emitDeviceStatusIfOpen(runtime.listener, {
276907
276876
  agent_id: runtime.agentId,
276908
276877
  conversation_id: runtime.conversationId
276909
276878
  });
@@ -277008,11 +276977,11 @@ function requestApprovalOverWS(runtime, socket, turnLease, requestId, controlReq
277008
276977
  runtime.turnLifecycle.recordStopReason(turnLease, "requires_approval");
277009
276978
  setTurnLoopStatus(runtime, turnLease, "WAITING_ON_APPROVAL");
277010
276979
  emitProtocolV2Message(socket, runtime, controlRequest, scope, TO_SUBSCRIBERS);
277011
- emitLoopStatusIfOpen(runtime, {
276980
+ emitLoopStatusIfOpen(runtime.listener, {
277012
276981
  agent_id: runtime.agentId,
277013
276982
  conversation_id: runtime.conversationId
277014
276983
  });
277015
- emitDeviceStatusIfOpen(runtime, {
276984
+ emitDeviceStatusIfOpen(runtime.listener, {
277016
276985
  agent_id: runtime.agentId,
277017
276986
  conversation_id: runtime.conversationId
277018
276987
  });
@@ -456006,8 +455975,7 @@ async function resolveRecoveredApprovalResponse(runtime, socket, response, proce
456006
455975
  const workingDirectory = getConversationWorkingDirectory(runtime.listener, recovered.agentId, recovered.conversationId);
456007
455976
  const scope = {
456008
455977
  agent_id: recovered.agentId,
456009
- conversation_id: recovered.conversationId,
456010
- ...opts?.superRunId ? { super_run_id: opts.superRunId } : {}
455978
+ conversation_id: recovered.conversationId
456011
455979
  };
456012
455980
  const respondedEntry = recovered.approvalsByRequestId.get(requestId);
456013
455981
  let autoDecisionsToAppend = [];
@@ -456060,8 +456028,7 @@ async function resolveRecoveredApprovalResponse(runtime, socket, response, proce
456060
456028
  const recoveryLease = pendingRequestIdsAfterResponse.length === 0 ? runtime.turnLifecycle.begin({
456061
456029
  origin: "approval_recovery",
456062
456030
  workingDirectory,
456063
- initialStatus: "EXECUTING_CLIENT_SIDE_TOOL",
456064
- superRunId: opts?.superRunId
456031
+ initialStatus: "EXECUTING_CLIENT_SIDE_TOOL"
456065
456032
  }) : null;
456066
456033
  let continuationFinalized = false;
456067
456034
  try {
@@ -456215,9 +456182,7 @@ async function resolveRecoveredApprovalResponse(runtime, socket, response, proce
456215
456182
  }
456216
456183
  ]);
456217
456184
  let continuationBatchId = `batch-recovered-${crypto.randomUUID()}`;
456218
- const consumedQueuedTurn = consumeQueuedTurn(runtime, {
456219
- matchActiveSuperRun: true
456220
- });
456185
+ const consumedQueuedTurn = consumeQueuedTurn(runtime);
456221
456186
  if (consumedQueuedTurn) {
456222
456187
  const { dequeuedBatch, queuedTurn } = consumedQueuedTurn;
456223
456188
  continuationBatchId = dequeuedBatch.batchId;
@@ -456231,7 +456196,6 @@ async function resolveRecoveredApprovalResponse(runtime, socket, response, proce
456231
456196
  type: "message",
456232
456197
  agentId: recovered.agentId,
456233
456198
  conversationId: recovered.conversationId,
456234
- ...opts?.superRunId ? { superRunId: opts.superRunId } : {},
456235
456199
  messages: continuationInput.messages
456236
456200
  }, socket, runtime, opts?.onStatusChange, opts?.connectionId, continuationBatchId, recoveryLease);
456237
456201
  if (runtime.turnLifecycle.isCurrent(recoveryLease)) {
@@ -456257,21 +456221,17 @@ async function resolveRecoveredApprovalResponse(runtime, socket, response, proce
456257
456221
  recovered.responsesByRequestId.clear();
456258
456222
  }
456259
456223
  const stopReason = recoveryLease.signal.aborted ? "cancelled" : "error";
456260
- try {
456261
- finishListenerTurn(runtime, recoveryLease, {
456262
- stopReason,
456263
- socket,
456264
- agentId: recovered.agentId,
456265
- conversationId: recovered.conversationId,
456266
- turnId: `batch-recovered-${requestId}`,
456267
- error: stopReason === "error" ? getTranscriptLoopErrorMessage({
456268
- error: error54,
456269
- message: error54 instanceof Error ? error54.message : String(error54)
456270
- }) : undefined
456271
- });
456272
- } finally {
456273
- runtime.turnLifecycle.releaseSuperRunId(recoveryLease);
456274
- }
456224
+ finishListenerTurn(runtime, recoveryLease, {
456225
+ stopReason,
456226
+ socket,
456227
+ agentId: recovered.agentId,
456228
+ conversationId: recovered.conversationId,
456229
+ turnId: `batch-recovered-${requestId}`,
456230
+ error: stopReason === "error" ? getTranscriptLoopErrorMessage({
456231
+ error: error54,
456232
+ message: error54 instanceof Error ? error54.message : String(error54)
456233
+ }) : undefined
456234
+ });
456275
456235
  throw error54;
456276
456236
  }
456277
456237
  }
@@ -456618,9 +456578,7 @@ async function resolveStaleApprovals(runtime, socket, turnLease, deps = {}) {
456618
456578
  otid: crypto.randomUUID()
456619
456579
  }
456620
456580
  ]);
456621
- const consumedQueuedTurn = consumeQueuedTurn(runtime, {
456622
- matchActiveSuperRun: true
456623
- });
456581
+ const consumedQueuedTurn = consumeQueuedTurn(runtime);
456624
456582
  if (consumedQueuedTurn) {
456625
456583
  const { dequeuedBatch, queuedTurn } = consumedQueuedTurn;
456626
456584
  continuationInput = appendQueuedTurnToInput(continuationInput, queuedTurn);
@@ -459393,9 +459351,7 @@ async function handleApprovalStop(params) {
459393
459351
  }
459394
459352
  ]);
459395
459353
  let continuationBatchId = dequeuedBatchId;
459396
- const consumedQueuedTurn = consumeQueuedTurn(runtime, {
459397
- matchActiveSuperRun: true
459398
- });
459354
+ const consumedQueuedTurn = consumeQueuedTurn(runtime);
459399
459355
  if (consumedQueuedTurn) {
459400
459356
  const { dequeuedBatch, queuedTurn } = consumedQueuedTurn;
459401
459357
  continuationBatchId = dequeuedBatch.batchId;
@@ -461010,8 +460966,7 @@ async function handleIncomingMessageInner(msg, socket, runtime, onStatusChange,
461010
460966
  let lastNeedsUserInputToolCallIds = [];
461011
460967
  const turnLease = existingTurnLease ?? runtime.turnLifecycle.begin({
461012
460968
  origin: "message",
461013
- workingDirectory: turnWorkingDirectory,
461014
- superRunId: msg.superRunId
460969
+ workingDirectory: turnWorkingDirectory
461015
460970
  });
461016
460971
  if (connectionId) {
461017
460972
  runtime.activeConnectionId = connectionId;
@@ -461130,7 +461085,6 @@ async function handleIncomingMessageInner(msg, socket, runtime, onStatusChange,
461130
461085
  } : {},
461131
461086
  ...providerFallback.overrideModel ? { overrideModel: providerFallback.overrideModel } : {},
461132
461087
  ...msg.actingUserId ? { actingUserId: msg.actingUserId } : {},
461133
- ...msg.superRunId ? { superRunId: msg.superRunId } : {},
461134
461088
  ...pendingNormalizationInterruptedToolCallIds.length > 0 ? {
461135
461089
  approvalNormalization: {
461136
461090
  interruptedToolCallIds: pendingNormalizationInterruptedToolCallIds
@@ -461656,7 +461610,6 @@ async function handleIncomingMessageInner(msg, socket, runtime, onStatusChange,
461656
461610
  }
461657
461611
  } finally {
461658
461612
  releaseListenerTurnContext({ runtime, agentId, conversationId });
461659
- runtime.turnLifecycle.releaseSuperRunId(turnLease);
461660
461613
  }
461661
461614
  evictConversationRuntimeIfIdle(runtime);
461662
461615
  }
@@ -461783,8 +461736,7 @@ async function handleApprovalResponseInput(listener, params, deps = {
461783
461736
  }
461784
461737
  if (await deps.resolveRecoveredApprovalResponse(targetRuntime, params.socket, params.response, handleIncomingMessage, {
461785
461738
  onStatusChange: params.opts.onStatusChange,
461786
- connectionId: params.opts.connectionId,
461787
- ...params.runtime.super_run_id ? { superRunId: params.runtime.super_run_id } : {}
461739
+ connectionId: params.opts.connectionId
461788
461740
  })) {
461789
461741
  deps.scheduleQueuePump(targetRuntime, params.socket, params.opts, params.processQueuedTurn);
461790
461742
  return true;
@@ -466307,8 +466259,6 @@ function createListenerMessageHandler(params) {
466307
466259
  connectionId,
466308
466260
  agentId: parsed.runtime.agent_id,
466309
466261
  conversationId: parsed.runtime.conversation_id,
466310
- superRunId: parsed.runtime.super_run_id,
466311
- noCoalesce: parsed.runtime.super_run_id !== undefined,
466312
466262
  clientToolAllowlist: inputPayload.client_tool_allowlist,
466313
466263
  clientToolset: inputPayload.client_toolset,
466314
466264
  externalToolScopeIds: inputPayload.external_tool_scope_ids,
@@ -494539,7 +494489,7 @@ var init_mcp_client = __esm(() => {
494539
494489
  init_streamableHttp();
494540
494490
  DEFAULT_CLIENT_INFO = {
494541
494491
  name: "letta-code",
494542
- version: "0.30.16"
494492
+ version: "0.30.18"
494543
494493
  };
494544
494494
  });
494545
494495
 
@@ -561823,4 +561773,4 @@ function registerBunOAuthFlows() {
561823
561773
  registerBunOAuthFlows();
561824
561774
  await init_src5().then(() => exports_src2);
561825
561775
 
561826
- //# debugId=036B0E52721A750064756E2164756E21
561776
+ //# debugId=EFFF93D118B173E664756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letta-ai/letta-code",
3
- "version": "0.30.16",
3
+ "version": "0.30.18",
4
4
  "description": "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
5
5
  "type": "module",
6
6
  "packageManager": "bun@1.3.0",
@@ -46,5 +46,5 @@
46
46
  "src/websocket/listener/lifecycle.ts": 1051,
47
47
  "src/websocket/listener/protocol-inbound.ts": 2264,
48
48
  "src/websocket/listener/protocol-outbound.ts": 1085,
49
- "src/websocket/listener/turn.ts": 1013
49
+ "src/websocket/listener/turn.ts": 1010
50
50
  }