@letta-ai/letta-code 0.7.2 → 0.7.3

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.
Files changed (2) hide show
  1. package/letta.js +74 -72
  2. package/package.json +2 -2
package/letta.js CHANGED
@@ -3233,7 +3233,7 @@ var package_default;
3233
3233
  var init_package = __esm(() => {
3234
3234
  package_default = {
3235
3235
  name: "@letta-ai/letta-code",
3236
- version: "0.7.2",
3236
+ version: "0.7.3",
3237
3237
  description: "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
3238
3238
  type: "module",
3239
3239
  bin: {
@@ -3286,7 +3286,7 @@ var init_package = __esm(() => {
3286
3286
  dev: "bun --loader:.md=text --loader:.mdx=text --loader:.txt=text run src/index.ts",
3287
3287
  build: "bun run build.js",
3288
3288
  prepare: "bun run build",
3289
- postinstall: "bun scripts/postinstall-patches.js || true"
3289
+ postinstall: "node scripts/postinstall-patches.js"
3290
3290
  },
3291
3291
  "lint-staged": {
3292
3292
  "*.{ts,tsx,js,jsx,json}": [
@@ -4035,17 +4035,6 @@ var init_models2 = __esm(() => {
4035
4035
  max_reasoning_tokens: 31999
4036
4036
  }
4037
4037
  },
4038
- {
4039
- id: "opus-4.1",
4040
- handle: "anthropic/claude-opus-4-1-20250805",
4041
- label: "Claude Opus 4.1",
4042
- description: "Anthropic's previous version of Opus",
4043
- updateArgs: {
4044
- context_window: 180000,
4045
- max_output_tokens: 64000,
4046
- max_reasoning_tokens: 31999
4047
- }
4048
- },
4049
4038
  {
4050
4039
  id: "haiku",
4051
4040
  handle: "anthropic/claude-haiku-4-5-20251001",
@@ -7595,7 +7584,8 @@ async function apply_patch(args) {
7595
7584
  return cached;
7596
7585
  try {
7597
7586
  const buf = await fs.readFile(abs, "utf8");
7598
- return buf;
7587
+ return buf.replace(/\r\n/g, `
7588
+ `);
7599
7589
  } catch (error) {
7600
7590
  const err = error;
7601
7591
  if (err.code === "ENOENT") {
@@ -7987,7 +7977,9 @@ async function edit(args) {
7987
7977
  if (old_string === new_string)
7988
7978
  throw new Error("No changes to make: old_string and new_string are exactly the same.");
7989
7979
  try {
7990
- const content = await fs2.readFile(resolvedPath, "utf-8");
7980
+ const rawContent = await fs2.readFile(resolvedPath, "utf-8");
7981
+ const content = rawContent.replace(/\r\n/g, `
7982
+ `);
7991
7983
  const occurrences = content.split(old_string).length - 1;
7992
7984
  if (occurrences === 0)
7993
7985
  throw new Error(`String to replace not found in file.
@@ -10080,7 +10072,9 @@ async function multi_edit(args) {
10080
10072
  throw new Error(`Edit ${i + 1}: No changes to make: old_string and new_string are exactly the same.`);
10081
10073
  }
10082
10074
  try {
10083
- let content = await fs5.readFile(resolvedPath, "utf-8");
10075
+ const rawContent = await fs5.readFile(resolvedPath, "utf-8");
10076
+ let content = rawContent.replace(/\r\n/g, `
10077
+ `);
10084
10078
  const appliedEdits = [];
10085
10079
  for (let i = 0;i < edits.length; i++) {
10086
10080
  const edit2 = edits[i];
@@ -16084,12 +16078,6 @@ function windowsLaunchers(command) {
16084
16078
  return [];
16085
16079
  const launchers = [];
16086
16080
  const seen = new Set;
16087
- const envComSpecRaw = process.env.ComSpec || process.env.COMSPEC;
16088
- const envComSpec = envComSpecRaw?.trim();
16089
- if (envComSpec) {
16090
- pushUnique(launchers, seen, [envComSpec, "/d", "/s", "/c", trimmed]);
16091
- }
16092
- pushUnique(launchers, seen, ["cmd.exe", "/d", "/s", "/c", trimmed]);
16093
16081
  pushUnique(launchers, seen, [
16094
16082
  "powershell.exe",
16095
16083
  "-NoProfile",
@@ -16097,6 +16085,12 @@ function windowsLaunchers(command) {
16097
16085
  trimmed
16098
16086
  ]);
16099
16087
  pushUnique(launchers, seen, ["pwsh", "-NoProfile", "-Command", trimmed]);
16088
+ const envComSpecRaw = process.env.ComSpec || process.env.COMSPEC;
16089
+ const envComSpec = envComSpecRaw?.trim();
16090
+ if (envComSpec) {
16091
+ pushUnique(launchers, seen, [envComSpec, "/d", "/s", "/c", trimmed]);
16092
+ }
16093
+ pushUnique(launchers, seen, ["cmd.exe", "/d", "/s", "/c", trimmed]);
16100
16094
  return launchers;
16101
16095
  }
16102
16096
  function unixLaunchers(command) {
@@ -45977,7 +45971,7 @@ var init_colors = __esm(() => {
45977
45971
  streaming: brandColors.textDisabled,
45978
45972
  running: brandColors.statusWarning,
45979
45973
  error: brandColors.statusError,
45980
- memoryName: brandColors.orange
45974
+ memoryName: brandColors.primaryAccent
45981
45975
  },
45982
45976
  input: {
45983
45977
  border: brandColors.textDisabled,
@@ -47772,7 +47766,7 @@ var init_cli2 = __esm(() => {
47772
47766
  });
47773
47767
 
47774
47768
  // src/constants.ts
47775
- var DEFAULT_AGENT_NAME = "letta-code-agent";
47769
+ var DEFAULT_AGENT_NAME = "Nameless Agent";
47776
47770
 
47777
47771
  // src/tools/manager.ts
47778
47772
  var exports_manager2 = {};
@@ -48877,6 +48871,7 @@ function markCurrentLineAsFinished(b) {
48877
48871
  } else {}
48878
48872
  }
48879
48873
  function markIncompleteToolsAsCancelled(b) {
48874
+ b.interrupted = true;
48880
48875
  for (const [id, line] of b.byId.entries()) {
48881
48876
  if (line.kind === "tool_call" && line.phase !== "finished") {
48882
48877
  const updatedLine = {
@@ -49208,14 +49203,14 @@ async function drainStream(stream2, buffers, refresh, abortSignal, onFirstMessag
49208
49203
  pendingApprovals.set(toolCall.tool_call_id, existing);
49209
49204
  }
49210
49205
  }
49211
- onChunk(buffers, chunk);
49212
- queueMicrotask(refresh);
49213
49206
  if (abortSignal?.aborted) {
49214
49207
  stopReason = "cancelled";
49215
49208
  markIncompleteToolsAsCancelled(buffers);
49216
49209
  queueMicrotask(refresh);
49217
49210
  break;
49218
49211
  }
49212
+ onChunk(buffers, chunk);
49213
+ queueMicrotask(refresh);
49219
49214
  if (chunk.message_type === "stop_reason") {
49220
49215
  stopReason = chunk.stop_reason;
49221
49216
  }
@@ -58511,16 +58506,21 @@ var init_QueuedMessages = __esm(async () => {
58511
58506
  // src/cli/components/ShimmerText.tsx
58512
58507
  var jsx_dev_runtime22, ShimmerText = ({
58513
58508
  color = colors.status.processing,
58509
+ boldPrefix,
58514
58510
  message,
58515
58511
  shimmerOffset
58516
58512
  }) => {
58517
- const fullText = `${message}…`;
58513
+ const fullText = `${boldPrefix ? `${boldPrefix} ` : ""}${message}…`;
58514
+ const prefixLength = boldPrefix ? boldPrefix.length + 1 : 0;
58518
58515
  const shimmerText = fullText.split("").map((char, i) => {
58519
58516
  const isInShimmer = i >= shimmerOffset && i < shimmerOffset + 3;
58517
+ const isInPrefix = i < prefixLength;
58520
58518
  if (isInShimmer) {
58521
- return source_default.hex(colors.status.processingShimmer)(char);
58519
+ const styledChar2 = source_default.hex(colors.status.processingShimmer)(char);
58520
+ return isInPrefix ? source_default.bold(styledChar2) : styledChar2;
58522
58521
  }
58523
- return source_default.hex(color)(char);
58522
+ const styledChar = source_default.hex(color)(char);
58523
+ return isInPrefix ? source_default.bold(styledChar) : styledChar;
58524
58524
  }).join("");
58525
58525
  return /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Text, {
58526
58526
  children: shimmerText
@@ -58780,13 +58780,14 @@ function Input({
58780
58780
  return;
58781
58781
  const id = setInterval(() => {
58782
58782
  setShimmerOffset((prev) => {
58783
- const len = thinkingMessage.length;
58783
+ const prefixLen = agentName ? agentName.length + 1 : 0;
58784
+ const len = prefixLen + thinkingMessage.length;
58784
58785
  const next = prev + 1;
58785
58786
  return next > len + 3 ? -3 : next;
58786
58787
  });
58787
58788
  }, 120);
58788
58789
  return () => clearInterval(id);
58789
- }, [streaming, thinkingMessage, visible]);
58790
+ }, [streaming, thinkingMessage, visible, agentName]);
58790
58791
  const handleSubmit = async () => {
58791
58792
  if (isAutocompleteActive) {
58792
58793
  return;
@@ -58879,6 +58880,7 @@ function Input({
58879
58880
  flexGrow: 1,
58880
58881
  children: [
58881
58882
  /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(ShimmerText, {
58883
+ boldPrefix: agentName || undefined,
58882
58884
  message: thinkingMessage,
58883
58885
  shimmerOffset
58884
58886
  }, undefined, false, undefined, this),
@@ -64468,13 +64470,12 @@ var init_subagentAggregation = __esm(() => {
64468
64470
  });
64469
64471
 
64470
64472
  // src/cli/helpers/thinkingMessages.ts
64471
- function getRandomThinkingMessage(agentName) {
64473
+ function getRandomVerb() {
64472
64474
  const index = Math.floor(Math.random() * THINKING_VERBS.length);
64473
- const verb = THINKING_VERBS[index] ?? "thinking";
64474
- if (agentName) {
64475
- return `${agentName} is ${verb}`;
64476
- }
64477
- return verb.charAt(0).toUpperCase() + verb.slice(1);
64475
+ return THINKING_VERBS[index] ?? "thinking";
64476
+ }
64477
+ function getRandomThinkingVerb() {
64478
+ return `is ${getRandomVerb()}`;
64478
64479
  }
64479
64480
  var THINKING_VERBS;
64480
64481
  var init_thinkingMessages = __esm(() => {
@@ -64510,7 +64511,16 @@ var init_thinkingMessages = __esm(() => {
64510
64511
  "compiling",
64511
64512
  "rendering",
64512
64513
  "executing",
64513
- "initializing"
64514
+ "initializing",
64515
+ "absolutely right",
64516
+ "thinking about thinking",
64517
+ "metathinking",
64518
+ "learning",
64519
+ "adapting",
64520
+ "evolving",
64521
+ "remembering",
64522
+ "absorbing",
64523
+ "internalizing"
64514
64524
  ];
64515
64525
  });
64516
64526
 
@@ -64877,6 +64887,14 @@ ${gitInfo.status}
64877
64887
  `;
64878
64888
  } else {
64879
64889
  context3 += `- **Git repository**: No
64890
+ `;
64891
+ }
64892
+ if (platform3() === "win32") {
64893
+ context3 += `
64894
+ ## Windows Shell Notes
64895
+ - The Bash tool uses PowerShell or cmd.exe on Windows
64896
+ - HEREDOC syntax (e.g., \`$(cat <<'EOF'...EOF)\`) does NOT work on Windows
64897
+ - For multiline strings (git commits, PR bodies), use simple quoted strings instead
64880
64898
  `;
64881
64899
  }
64882
64900
  context3 += `
@@ -65070,7 +65088,7 @@ function App2({
65070
65088
  const currentModelDisplay = currentModelLabel?.split("/").pop() ?? null;
65071
65089
  const [tokenStreamingEnabled, setTokenStreamingEnabled] = import_react65.useState(tokenStreaming);
65072
65090
  const [tokenCount, setTokenCount] = import_react65.useState(0);
65073
- const [thinkingMessage, setThinkingMessage] = import_react65.useState(getRandomThinkingMessage(agentName));
65091
+ const [thinkingMessage, setThinkingMessage] = import_react65.useState(getRandomThinkingVerb());
65074
65092
  const sessionStatsRef = import_react65.useRef(new SessionStats);
65075
65093
  const [showExitStats, setShowExitStats] = import_react65.useState(false);
65076
65094
  const hasSentSessionContextRef = import_react65.useRef(false);
@@ -65173,7 +65191,9 @@ function App2({
65173
65191
  buffersRef.current.pendingRefresh = true;
65174
65192
  setTimeout(() => {
65175
65193
  buffersRef.current.pendingRefresh = false;
65176
- refreshDerived();
65194
+ if (!buffersRef.current.interrupted) {
65195
+ refreshDerived();
65196
+ }
65177
65197
  }, 16);
65178
65198
  }
65179
65199
  }, [refreshDerived]);
@@ -65288,6 +65308,7 @@ function App2({
65288
65308
  setStreaming(true);
65289
65309
  abortControllerRef.current = new AbortController;
65290
65310
  markIncompleteToolsAsCancelled(buffersRef.current);
65311
+ buffersRef.current.interrupted = false;
65291
65312
  clearCompletedSubagents();
65292
65313
  while (true) {
65293
65314
  if (abortControllerRef.current?.signal.aborted) {
@@ -65523,7 +65544,7 @@ function App2({
65523
65544
  setStreaming(false);
65524
65545
  return;
65525
65546
  }
65526
- setThinkingMessage(getRandomThinkingMessage(agentName));
65547
+ setThinkingMessage(getRandomThinkingVerb());
65527
65548
  refreshDerived();
65528
65549
  await processConversation([
65529
65550
  {
@@ -65642,13 +65663,7 @@ function App2({
65642
65663
  } finally {
65643
65664
  abortControllerRef.current = null;
65644
65665
  }
65645
- }, [
65646
- appendError,
65647
- refreshDerived,
65648
- refreshDerivedThrottled,
65649
- setStreaming,
65650
- agentName
65651
- ]);
65666
+ }, [appendError, refreshDerived, refreshDerivedThrottled, setStreaming]);
65652
65667
  const handleExit = import_react65.useCallback(() => {
65653
65668
  saveLastAgentBeforeExit();
65654
65669
  setShowExitStats(true);
@@ -66842,7 +66857,8 @@ ${gitContext}
66842
66857
  });
66843
66858
  buffersRef.current.order.push(userId);
66844
66859
  buffersRef.current.tokenCount = 0;
66845
- setThinkingMessage(getRandomThinkingMessage(agentName));
66860
+ buffersRef.current.interrupted = false;
66861
+ setThinkingMessage(getRandomThinkingVerb());
66846
66862
  setStreaming(true);
66847
66863
  refreshDerived();
66848
66864
  if (CHECK_PENDING_APPROVALS_BEFORE_SEND && !queuedApprovalResults) {
@@ -67094,6 +67110,7 @@ ${gitContext}
67094
67110
  setAutoHandledResults([]);
67095
67111
  setAutoDeniedApprovals([]);
67096
67112
  setStreaming(true);
67113
+ buffersRef.current.interrupted = false;
67097
67114
  const approvalAbortController = new AbortController;
67098
67115
  toolAbortControllerRef.current = approvalAbortController;
67099
67116
  const allDecisions = [
@@ -67143,7 +67160,7 @@ ${gitContext}
67143
67160
  throw new Error("Approval ID mismatch - refusing to send mismatched IDs");
67144
67161
  }
67145
67162
  }
67146
- setThinkingMessage(getRandomThinkingMessage(agentName));
67163
+ setThinkingMessage(getRandomThinkingVerb());
67147
67164
  refreshDerived();
67148
67165
  const wasAborted = approvalAbortController.signal.aborted;
67149
67166
  const userCancelled = userCancelledRef.current || abortControllerRef.current?.signal.aborted;
@@ -67172,7 +67189,6 @@ ${gitContext}
67172
67189
  processConversation,
67173
67190
  refreshDerived,
67174
67191
  appendError,
67175
- agentName,
67176
67192
  setStreaming
67177
67193
  ]);
67178
67194
  const handleApproveCurrent = import_react65.useCallback(async () => {
@@ -67255,7 +67271,7 @@ ${gitContext}
67255
67271
  reason: reason || "User denied the tool execution"
67256
67272
  };
67257
67273
  if (currentIndex + 1 >= pendingApprovals.length) {
67258
- setThinkingMessage(getRandomThinkingMessage(agentName));
67274
+ setThinkingMessage(getRandomThinkingVerb());
67259
67275
  await sendAllResults(decision);
67260
67276
  } else {
67261
67277
  setApprovalResults((prev) => [...prev, decision]);
@@ -67274,7 +67290,6 @@ ${gitContext}
67274
67290
  sendAllResults,
67275
67291
  appendError,
67276
67292
  isExecutingTool,
67277
- agentName,
67278
67293
  setStreaming
67279
67294
  ]);
67280
67295
  const handleCancelApprovals = import_react65.useCallback(() => {
@@ -67575,7 +67590,7 @@ Consider switching to a different system prompt using /system to match.` : null;
67575
67590
  stdout: toolResult.stdout,
67576
67591
  stderr: toolResult.stderr
67577
67592
  });
67578
- setThinkingMessage(getRandomThinkingMessage(agentName));
67593
+ setThinkingMessage(getRandomThinkingVerb());
67579
67594
  refreshDerived();
67580
67595
  const decision = {
67581
67596
  type: "approve",
@@ -67600,7 +67615,6 @@ Consider switching to a different system prompt using /system to match.` : null;
67600
67615
  sendAllResults,
67601
67616
  appendError,
67602
67617
  refreshDerived,
67603
- agentName,
67604
67618
  setStreaming
67605
67619
  ]);
67606
67620
  const handlePlanKeepPlanning = import_react65.useCallback(async (reason) => {
@@ -67658,7 +67672,7 @@ Consider switching to a different system prompt using /system to match.` : null;
67658
67672
  stdout: null,
67659
67673
  stderr: null
67660
67674
  });
67661
- setThinkingMessage(getRandomThinkingMessage(agentName));
67675
+ setThinkingMessage(getRandomThinkingVerb());
67662
67676
  refreshDerived();
67663
67677
  const decision = {
67664
67678
  type: "approve",
@@ -67671,13 +67685,7 @@ Consider switching to a different system prompt using /system to match.` : null;
67671
67685
  } else {
67672
67686
  setApprovalResults((prev) => [...prev, decision]);
67673
67687
  }
67674
- }, [
67675
- pendingApprovals,
67676
- approvalResults,
67677
- sendAllResults,
67678
- refreshDerived,
67679
- agentName
67680
- ]);
67688
+ }, [pendingApprovals, approvalResults, sendAllResults, refreshDerived]);
67681
67689
  const handleEnterPlanModeApprove = import_react65.useCallback(async () => {
67682
67690
  const currentIndex = approvalResults.length;
67683
67691
  const approval = pendingApprovals[currentIndex];
@@ -67715,7 +67723,7 @@ Plan file path: ${planFilePath}`;
67715
67723
  stdout: null,
67716
67724
  stderr: null
67717
67725
  });
67718
- setThinkingMessage(getRandomThinkingMessage(agentName));
67726
+ setThinkingMessage(getRandomThinkingVerb());
67719
67727
  refreshDerived();
67720
67728
  const decision = {
67721
67729
  type: "approve",
@@ -67728,13 +67736,7 @@ Plan file path: ${planFilePath}`;
67728
67736
  } else {
67729
67737
  setApprovalResults((prev) => [...prev, decision]);
67730
67738
  }
67731
- }, [
67732
- pendingApprovals,
67733
- approvalResults,
67734
- sendAllResults,
67735
- refreshDerived,
67736
- agentName
67737
- ]);
67739
+ }, [pendingApprovals, approvalResults, sendAllResults, refreshDerived]);
67738
67740
  const handleEnterPlanModeReject = import_react65.useCallback(async () => {
67739
67741
  const currentIndex = approvalResults.length;
67740
67742
  const approval = pendingApprovals[currentIndex];
@@ -70149,4 +70151,4 @@ Error during initialization: ${message}`);
70149
70151
  }
70150
70152
  main();
70151
70153
 
70152
- //# debugId=BC905FB4ACB5868664756E2164756E21
70154
+ //# debugId=12E8FDBCD20CD4AE64756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letta-ai/letta-code",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -53,7 +53,7 @@
53
53
  "dev": "bun --loader:.md=text --loader:.mdx=text --loader:.txt=text run src/index.ts",
54
54
  "build": "bun run build.js",
55
55
  "prepare": "bun run build",
56
- "postinstall": "bun scripts/postinstall-patches.js || true"
56
+ "postinstall": "node scripts/postinstall-patches.js"
57
57
  },
58
58
  "lint-staged": {
59
59
  "*.{ts,tsx,js,jsx,json}": [