@letta-ai/letta-code 0.30.15 → 0.30.16

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.15",
5491
+ version: "0.30.16",
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,7 +152619,8 @@ function resolveRuntimeScope(runtime, params) {
152619
152619
  const resolvedConversationId = resolveScopedConversationId(runtime, params);
152620
152620
  return {
152621
152621
  agent_id: resolvedAgentId,
152622
- conversation_id: resolvedConversationId
152622
+ conversation_id: resolvedConversationId,
152623
+ ...params?.super_run_id ? { super_run_id: params.super_run_id } : {}
152623
152624
  };
152624
152625
  }
152625
152626
 
@@ -152754,6 +152755,7 @@ class TurnLifecycle {
152754
152755
  #createId;
152755
152756
  #state = IDLE_STATE;
152756
152757
  #lastStopReason = null;
152758
+ #superRunOwner = null;
152757
152759
  constructor(createId = () => crypto.randomUUID()) {
152758
152760
  this.#createId = createId;
152759
152761
  }
@@ -152775,6 +152777,9 @@ class TurnLifecycle {
152775
152777
  get activeRunId() {
152776
152778
  return this.#state.kind === "active" ? this.#state.runId : null;
152777
152779
  }
152780
+ get superRunId() {
152781
+ return this.#superRunOwner?.superRunId ?? null;
152782
+ }
152778
152783
  get executingToolCallIds() {
152779
152784
  return this.#state.kind === "active" || this.#state.kind === "cancelling" ? this.#state.executingToolCallIds : [];
152780
152785
  }
@@ -152824,6 +152829,10 @@ class TurnLifecycle {
152824
152829
  id: this.#createId(),
152825
152830
  signal: abortController.signal
152826
152831
  });
152832
+ this.#superRunOwner = {
152833
+ leaseId: lease.id,
152834
+ superRunId: options3.superRunId ?? null
152835
+ };
152827
152836
  this.#state = {
152828
152837
  kind: "active",
152829
152838
  origin: options3.origin,
@@ -152850,6 +152859,13 @@ class TurnLifecycle {
152850
152859
  this.#state = { ...this.#state, loopStatus: status };
152851
152860
  return true;
152852
152861
  }
152862
+ releaseSuperRunId(lease) {
152863
+ if (this.#superRunOwner?.leaseId !== lease.id) {
152864
+ return false;
152865
+ }
152866
+ this.#superRunOwner = null;
152867
+ return true;
152868
+ }
152853
152869
  setRunId(lease, runId) {
152854
152870
  if (this.#state.kind !== "active" || !this.isCurrent(lease)) {
152855
152871
  return false;
@@ -152881,6 +152897,7 @@ class TurnLifecycle {
152881
152897
  if (this.#state.kind !== "idle") {
152882
152898
  return false;
152883
152899
  }
152900
+ this.#superRunOwner = null;
152884
152901
  this.#state = {
152885
152902
  kind: "command",
152886
152903
  loopStatus: "EXECUTING_COMMAND"
@@ -152971,6 +152988,7 @@ class TurnLifecycle {
152971
152988
  }
152972
152989
  reset(stopReason = "cancelled") {
152973
152990
  const state = this.#state;
152991
+ this.#superRunOwner = null;
152974
152992
  if (state.kind === "active" || state.kind === "cancelling") {
152975
152993
  if (!state.abortController.signal.aborted) {
152976
152994
  state.abortController.abort();
@@ -153141,6 +153159,9 @@ function createConversationRuntime(listener, agentId, conversationId) {
153141
153159
  key: runtimeKey,
153142
153160
  agentId: normalizedAgentId,
153143
153161
  conversationId: normalizedConversationId,
153162
+ get superRunId() {
153163
+ return turnLifecycle.superRunId;
153164
+ },
153144
153165
  skillSources: listener.skillSourcesByConversation.get(runtimeKey)?.slice(),
153145
153166
  activeConnectionId: null,
153146
153167
  turnLifecycle,
@@ -157592,7 +157613,8 @@ function getScopeForRuntime(runtime, scope) {
157592
157613
  if (runtime && "listener" in runtime) {
157593
157614
  return {
157594
157615
  agent_id: scope?.agent_id ?? runtime.agentId,
157595
- conversation_id: scope?.conversation_id ?? runtime.conversationId
157616
+ conversation_id: scope?.conversation_id ?? runtime.conversationId,
157617
+ super_run_id: scope?.super_run_id ?? runtime.superRunId ?? undefined
157596
157618
  };
157597
157619
  }
157598
157620
  return scope ?? {};
@@ -157757,7 +157779,7 @@ function emitProtocolV2Message(socket, runtime, message, scope, routing) {
157757
157779
  typeLabel: message.type,
157758
157780
  frameClass,
157759
157781
  ...frameClass === "status" ? {
157760
- coalesceKey: `${message.type}:${runtimeScope.agent_id ?? ""}:${runtimeScope.conversation_id ?? ""}`
157782
+ coalesceKey: `${message.type}:${runtimeScope.agent_id ?? ""}:${runtimeScope.conversation_id ?? ""}:${runtimeScope.super_run_id ?? ""}`
157761
157783
  } : {},
157762
157784
  build: () => {
157763
157785
  const eventSeq = nextListenerConnectionEventSeq(connection, listener);
@@ -158483,11 +158505,13 @@ async function gitRefExists(cwd, ref6) {
158483
158505
  return result.exitCode === 0;
158484
158506
  }
158485
158507
  async function resolveRepoRoot(cwd) {
158486
- return await gitStdout(["rev-parse", "--show-toplevel"], cwd);
158508
+ const repoRoot = await gitStdout(["rev-parse", "--show-toplevel"], cwd);
158509
+ return path16.resolve(repoRoot);
158487
158510
  }
158488
158511
  async function resolvePrimaryWorktreeRoot(repoRoot) {
158489
158512
  const commonDir = await gitStdout(["rev-parse", "--path-format=absolute", "--git-common-dir"], repoRoot);
158490
- return path16.basename(commonDir) === ".git" ? path16.dirname(commonDir) : repoRoot;
158513
+ const primaryRoot = path16.basename(commonDir) === ".git" ? path16.dirname(commonDir) : repoRoot;
158514
+ return path16.resolve(primaryRoot);
158491
158515
  }
158492
158516
  async function resolveDefaultBaseRef(repoRoot) {
158493
158517
  const remoteHead = await runGit2(["symbolic-ref", "--quiet", "--short", "refs/remotes/origin/HEAD"], repoRoot, { allowFailure: true });
@@ -162985,7 +163009,7 @@ var init_monitor_event_stream = __esm(() => {
162985
163009
  });
162986
163010
 
162987
163011
  // src/tools/impl/monitor.ts
162988
- import { appendFileSync as appendFileSync4 } from "node:fs";
163012
+ import { appendFileSync as appendFileSync4, readFileSync as readFileSync9, writeFileSync as writeFileSync8 } from "node:fs";
162989
163013
  import { WebSocket as WebSocket4 } from "ws";
162990
163014
  function buildMonitorResult(taskId, timeoutMs, persistent) {
162991
163015
  const lifetime = persistent ? "persistent — runs until TaskStop or session end" : `timeout ${timeoutMs}ms`;
@@ -163033,11 +163057,10 @@ class MonitorOutputWriter {
163033
163057
  const marker = Buffer.from(`
163034
163058
  [output truncated at ${MONITOR_OUTPUT_FILE_BYTES} bytes]
163035
163059
  `, "utf8");
163036
- const contentBudget = Math.max(0, remaining - marker.length);
163037
- const content = validUtf8Prefix(chunk, contentBudget);
163038
- const markerBudget = remaining - content.length;
163039
- appendFileSync4(this.path, Buffer.concat([content, marker.subarray(0, markerBudget)]));
163040
- this.bytesWritten = MONITOR_OUTPUT_FILE_BYTES;
163060
+ const content = validUtf8Prefix(Buffer.concat([readFileSync9(this.path), chunk]), MONITOR_OUTPUT_FILE_BYTES - marker.length);
163061
+ const truncatedOutput = Buffer.concat([content, marker]);
163062
+ writeFileSync8(this.path, truncatedOutput);
163063
+ this.bytesWritten = truncatedOutput.length;
163041
163064
  this.truncated = true;
163042
163065
  }
163043
163066
  }
@@ -163666,12 +163689,12 @@ __export(exports_image_resize_magick, {
163666
163689
  resizeImageIfNeeded: () => resizeImageIfNeeded
163667
163690
  });
163668
163691
  import { execSync } from "node:child_process";
163669
- import { readFileSync as readFileSync9, unlinkSync as unlinkSync4, writeFileSync as writeFileSync8 } from "node:fs";
163692
+ import { readFileSync as readFileSync10, unlinkSync as unlinkSync4, writeFileSync as writeFileSync9 } from "node:fs";
163670
163693
  import { tmpdir as tmpdir4 } from "node:os";
163671
163694
  import { join as join21 } from "node:path";
163672
163695
  async function getImageDimensions(buffer) {
163673
163696
  const tempInput = join21(tmpdir4(), `image-${Date.now()}-${Math.random().toString(36).slice(2)}.tmp`);
163674
- writeFileSync8(tempInput, buffer);
163697
+ writeFileSync9(tempInput, buffer);
163675
163698
  try {
163676
163699
  const output = execSync(`magick identify -format "%w %h %m" "${tempInput}"`, {
163677
163700
  encoding: "utf-8"
@@ -163702,7 +163725,7 @@ async function compressToFitByteLimit(buffer, currentWidth, currentHeight) {
163702
163725
  return null;
163703
163726
  }
163704
163727
  const tempInput = join21(tmpdir4(), `compress-input-${Date.now()}-${Math.random().toString(36).slice(2)}.tmp`);
163705
- writeFileSync8(tempInput, buffer);
163728
+ writeFileSync9(tempInput, buffer);
163706
163729
  try {
163707
163730
  const qualities = [85, 70, 55, 40];
163708
163731
  for (const quality of qualities) {
@@ -163711,7 +163734,7 @@ async function compressToFitByteLimit(buffer, currentWidth, currentHeight) {
163711
163734
  execSync(`magick "${tempInput}" -quality ${quality} "${tempOutput}"`, {
163712
163735
  stdio: "ignore"
163713
163736
  });
163714
- const compressed = readFileSync9(tempOutput);
163737
+ const compressed = readFileSync10(tempOutput);
163715
163738
  if (compressed.length <= MAX_IMAGE_BYTES) {
163716
163739
  return buildVerifiedResizeResult(compressed, "image/jpeg", true, "compressed image output");
163717
163740
  }
@@ -163730,7 +163753,7 @@ async function compressToFitByteLimit(buffer, currentWidth, currentHeight) {
163730
163753
  execSync(`magick "${tempInput}" -resize ${scaledWidth}x${scaledHeight} -quality 70 "${tempOutput}"`, {
163731
163754
  stdio: "ignore"
163732
163755
  });
163733
- const reduced = readFileSync9(tempOutput);
163756
+ const reduced = readFileSync10(tempOutput);
163734
163757
  if (reduced.length <= MAX_IMAGE_BYTES) {
163735
163758
  return buildVerifiedResizeResult(reduced, "image/jpeg", true, "dimension-reduced image output");
163736
163759
  }
@@ -163757,7 +163780,7 @@ async function resizeImageIfNeeded(buffer, inputMediaType) {
163757
163780
  return buildVerifiedResizeResult(buffer, inputMediaType, false, "passthrough image output");
163758
163781
  }
163759
163782
  const tempInput = join21(tmpdir4(), `resize-input-${Date.now()}-${Math.random().toString(36).slice(2)}.tmp`);
163760
- writeFileSync8(tempInput, buffer);
163783
+ writeFileSync9(tempInput, buffer);
163761
163784
  try {
163762
163785
  if (needsResize) {
163763
163786
  const tempOutput2 = join21(tmpdir4(), `resize-output-${Date.now()}-${Math.random().toString(36).slice(2)}`);
@@ -163767,14 +163790,14 @@ async function resizeImageIfNeeded(buffer, inputMediaType) {
163767
163790
  execSync(`magick "${tempInput}" -resize ${MAX_IMAGE_WIDTH}x${MAX_IMAGE_HEIGHT}> -quality 85 "${tempOutput2}.jpg"`, {
163768
163791
  stdio: "ignore"
163769
163792
  });
163770
- outputBuffer2 = readFileSync9(`${tempOutput2}.jpg`);
163793
+ outputBuffer2 = readFileSync10(`${tempOutput2}.jpg`);
163771
163794
  outputMediaType = "image/jpeg";
163772
163795
  unlinkSync4(`${tempOutput2}.jpg`);
163773
163796
  } else {
163774
163797
  execSync(`magick "${tempInput}" -resize ${MAX_IMAGE_WIDTH}x${MAX_IMAGE_HEIGHT}> "${tempOutput2}.png"`, {
163775
163798
  stdio: "ignore"
163776
163799
  });
163777
- outputBuffer2 = readFileSync9(`${tempOutput2}.png`);
163800
+ outputBuffer2 = readFileSync10(`${tempOutput2}.png`);
163778
163801
  outputMediaType = "image/png";
163779
163802
  unlinkSync4(`${tempOutput2}.png`);
163780
163803
  }
@@ -163789,7 +163812,7 @@ async function resizeImageIfNeeded(buffer, inputMediaType) {
163789
163812
  execSync(`magick "${tempInput}" "${tempOutput}"`, {
163790
163813
  stdio: "ignore"
163791
163814
  });
163792
- const outputBuffer = readFileSync9(tempOutput);
163815
+ const outputBuffer = readFileSync10(tempOutput);
163793
163816
  unlinkSync4(tempOutput);
163794
163817
  const compressed = await compressToFitByteLimit(outputBuffer, width, height);
163795
163818
  if (compressed) {
@@ -179795,7 +179818,7 @@ __export(exports_loader, {
179795
179818
  getUserSettingsPaths: () => getUserSettingsPaths
179796
179819
  });
179797
179820
  import { createHash as createHash3 } from "node:crypto";
179798
- import { readFileSync as readFileSync10, statSync as statSync5, watch as watch2 } from "node:fs";
179821
+ import { readFileSync as readFileSync11, statSync as statSync5, watch as watch2 } from "node:fs";
179799
179822
  import { homedir as homedir17 } from "node:os";
179800
179823
  import { dirname as dirname17, join as join26, resolve as resolve23 } from "node:path";
179801
179824
  function getUserSettingsPaths(options3 = {}) {
@@ -179825,7 +179848,7 @@ function getFileSignature(path30) {
179825
179848
  exists: true,
179826
179849
  mtimeMs: stat10.mtimeMs,
179827
179850
  size: stat10.size,
179828
- hash: createHash3("sha256").update(readFileSync10(path30)).digest("hex")
179851
+ hash: createHash3("sha256").update(readFileSync11(path30)).digest("hex")
179829
179852
  };
179830
179853
  } catch {
179831
179854
  return { exists: false };
@@ -181452,6 +181475,9 @@ async function sendMessageStreamWithBackend(backend, conversationId, messages, o
181452
181475
  if (opts.actingUserId) {
181453
181476
  extraHeaders["X-Letta-Acting-User-Id"] = opts.actingUserId;
181454
181477
  }
181478
+ if (opts.superRunId) {
181479
+ extraHeaders["X-Letta-Super-Run-Id"] = opts.superRunId;
181480
+ }
181455
181481
  const messageSummary = normalizedMessages.map((item) => {
181456
181482
  if (item.type === "approval") {
181457
181483
  return `approval:${item.approvals?.length ?? 0}`;
@@ -184056,7 +184082,7 @@ var init_memory_git_config_lock = __esm(() => {
184056
184082
  });
184057
184083
 
184058
184084
  // src/agent/memory-git-hooks.ts
184059
- import { chmodSync as chmodSync4, existsSync as existsSync21, mkdirSync as mkdirSync14, writeFileSync as writeFileSync9 } from "node:fs";
184085
+ import { chmodSync as chmodSync4, existsSync as existsSync21, mkdirSync as mkdirSync14, writeFileSync as writeFileSync10 } from "node:fs";
184060
184086
  import { join as join29 } from "node:path";
184061
184087
  function installPreCommitHook(dir) {
184062
184088
  const hooksDir = join29(dir, ".git", "hooks");
@@ -184064,7 +184090,7 @@ function installPreCommitHook(dir) {
184064
184090
  if (!existsSync21(hooksDir)) {
184065
184091
  mkdirSync14(hooksDir, { recursive: true });
184066
184092
  }
184067
- writeFileSync9(hookPath, PRE_COMMIT_HOOK_SCRIPT, "utf-8");
184093
+ writeFileSync10(hookPath, PRE_COMMIT_HOOK_SCRIPT, "utf-8");
184068
184094
  chmodSync4(hookPath, 493);
184069
184095
  debugLog("memfs-git", "Installed pre-commit hook");
184070
184096
  }
@@ -184074,7 +184100,7 @@ function installPostCommitHook(dir) {
184074
184100
  if (!existsSync21(hooksDir)) {
184075
184101
  mkdirSync14(hooksDir, { recursive: true });
184076
184102
  }
184077
- writeFileSync9(hookPath, POST_COMMIT_HOOK_SCRIPT, "utf-8");
184103
+ writeFileSync10(hookPath, POST_COMMIT_HOOK_SCRIPT, "utf-8");
184078
184104
  chmodSync4(hookPath, 493);
184079
184105
  debugLog("memfs-git", "Installed post-commit memory-repository hook");
184080
184106
  }
@@ -184295,10 +184321,10 @@ import { execFile as execFileCb2 } from "node:child_process";
184295
184321
  import {
184296
184322
  existsSync as existsSync22,
184297
184323
  mkdirSync as mkdirSync15,
184298
- readFileSync as readFileSync11,
184324
+ readFileSync as readFileSync12,
184299
184325
  renameSync as renameSync3,
184300
184326
  rmSync as rmSync4,
184301
- writeFileSync as writeFileSync10
184327
+ writeFileSync as writeFileSync11
184302
184328
  } from "node:fs";
184303
184329
  import { homedir as homedir20, platform as platform3 } from "node:os";
184304
184330
  import { dirname as dirname19, isAbsolute as isAbsolute20, join as join30 } from "node:path";
@@ -184651,7 +184677,7 @@ async function configureLocalCredentialHelper(dir, token) {
184651
184677
  echo username=letta
184652
184678
  echo password=${token}
184653
184679
  `;
184654
- writeFileSync10(helperScriptPath, batchScript, "utf-8");
184680
+ writeFileSync11(helperScriptPath, batchScript, "utf-8");
184655
184681
  helper = formatGitCredentialHelperPath(helperScriptPath);
184656
184682
  debugLog("memfs-git", `Wrote Windows credential helper script`);
184657
184683
  } else {
@@ -184832,7 +184858,7 @@ function readMemoryRepositoryPushLog(agentId, tailLines = 20) {
184832
184858
  return "";
184833
184859
  }
184834
184860
  try {
184835
- const content = readFileSync11(logPath, "utf-8");
184861
+ const content = readFileSync12(logPath, "utf-8");
184836
184862
  const lines = content.split(`
184837
184863
  `);
184838
184864
  return lines.slice(-tailLines).join(`
@@ -185002,7 +185028,7 @@ function describeMarkdownEncodingIssue(memoryDir, relativePath) {
185002
185028
  if (!existsSync22(filePath)) {
185003
185029
  return null;
185004
185030
  }
185005
- const bytes = readFileSync11(filePath);
185031
+ const bytes = readFileSync12(filePath);
185006
185032
  const utf16Bom = getUtf16Bom(bytes);
185007
185033
  if (utf16Bom) {
185008
185034
  return `${relativePath} has ${utf16Bom} BOM`;
@@ -185080,7 +185106,7 @@ async function initializeLocalMemoryRepo(params) {
185080
185106
  }
185081
185107
  const fullPath = join30(params.memoryDir, relativePath);
185082
185108
  mkdirSync15(dirname19(fullPath), { recursive: true });
185083
- writeFileSync10(fullPath, file3.content, "utf8");
185109
+ writeFileSync11(fullPath, file3.content, "utf8");
185084
185110
  pathspecs.push(relativePath);
185085
185111
  }
185086
185112
  if (pathspecs.length > 0) {
@@ -186179,11 +186205,11 @@ import {
186179
186205
  mkdirSync as mkdirSync16,
186180
186206
  openSync,
186181
186207
  readdirSync as readdirSync9,
186182
- readFileSync as readFileSync12,
186208
+ readFileSync as readFileSync13,
186183
186209
  readSync,
186184
186210
  rmSync as rmSync5,
186185
186211
  statSync as statSync7,
186186
- writeFileSync as writeFileSync11
186212
+ writeFileSync as writeFileSync12
186187
186213
  } from "node:fs";
186188
186214
  import { join as join31 } from "node:path";
186189
186215
  function isStringArray3(value) {
@@ -186363,12 +186389,12 @@ function jsonl(items3) {
186363
186389
  function readJsonFile2(path30) {
186364
186390
  if (!existsSync23(path30))
186365
186391
  return;
186366
- return JSON.parse(readFileSync12(path30, "utf8"));
186392
+ return JSON.parse(readFileSync13(path30, "utf8"));
186367
186393
  }
186368
186394
  function readJsonlFile(path30) {
186369
186395
  if (!existsSync23(path30))
186370
186396
  return [];
186371
- return readFileSync12(path30, "utf8").split(`
186397
+ return readFileSync13(path30, "utf8").split(`
186372
186398
  `).filter((line) => line.trim().length > 0).map((line) => JSON.parse(line));
186373
186399
  }
186374
186400
  function readJsonlFileSuffix(path30, maxBytes) {
@@ -186546,7 +186572,7 @@ function validateLocalTranscriptManifest(conversationDir, storageDir) {
186546
186572
  return manifest;
186547
186573
  }
186548
186574
  function writeLocalTranscriptManifest(conversationDir, manifest = createLocalTranscriptManifest()) {
186549
- writeFileSync11(transcriptManifestPath(conversationDir), `${JSON.stringify(manifest, null, 2)}
186575
+ writeFileSync12(transcriptManifestPath(conversationDir), `${JSON.stringify(manifest, null, 2)}
186550
186576
  `);
186551
186577
  }
186552
186578
  function numericSuffix(value, prefix) {
@@ -187969,7 +187995,7 @@ class LocalStore {
187969
187995
  return;
187970
187996
  const agentsDir = join31(this.storageDir, "agents");
187971
187997
  mkdirSync16(agentsDir, { recursive: true });
187972
- writeFileSync11(join31(agentsDir, `${encodePathSegment(agentId)}.json`), `${JSON.stringify(agent2, null, 2)}
187998
+ writeFileSync12(join31(agentsDir, `${encodePathSegment(agentId)}.json`), `${JSON.stringify(agent2, null, 2)}
187973
187999
  `);
187974
188000
  this.recordAgentRecordMtime(agentId);
187975
188001
  }
@@ -188032,7 +188058,7 @@ class LocalStore {
188032
188058
  return;
188033
188059
  const conversationDir = join31(this.storageDir, "conversations", encodePathSegment(key));
188034
188060
  mkdirSync16(conversationDir, { recursive: true });
188035
- writeFileSync11(join31(conversationDir, "conversation.json"), `${JSON.stringify(conversation, null, 2)}
188061
+ writeFileSync12(join31(conversationDir, "conversation.json"), `${JSON.stringify(conversation, null, 2)}
188036
188062
  `);
188037
188063
  this.recordConversationRecordMtime(key, conversationDir);
188038
188064
  const messagesPath = transcriptMessagesPath(conversationDir);
@@ -188103,7 +188129,7 @@ class LocalStore {
188103
188129
  if (messages.length === 0)
188104
188130
  return;
188105
188131
  const entries = localTranscriptSessionEntries(conversation, messages);
188106
- writeFileSync11(messagesPath, jsonl(entries));
188132
+ writeFileSync12(messagesPath, jsonl(entries));
188107
188133
  this.resetPersistedSessionStateFromEntries(key, entries);
188108
188134
  }
188109
188135
  appendConversationSessionMessageEntry(key, conversation, messagesPath, message) {
@@ -188155,7 +188181,7 @@ class LocalStore {
188155
188181
  ensureConversationTranscriptHeader(conversation, messagesPath) {
188156
188182
  if (existsSync23(messagesPath) && statSync7(messagesPath).size > 0)
188157
188183
  return;
188158
- writeFileSync11(messagesPath, `${JSON.stringify(createLocalTranscriptSessionHeader(conversation))}
188184
+ writeFileSync12(messagesPath, `${JSON.stringify(createLocalTranscriptSessionHeader(conversation))}
188159
188185
  `);
188160
188186
  }
188161
188187
  resetPersistedSessionState(key, messageFormat, transcript) {
@@ -188214,7 +188240,7 @@ class LocalStore {
188214
188240
  return;
188215
188241
  const conversationDir = join31(this.storageDir, "conversations", encodePathSegment(key));
188216
188242
  mkdirSync16(conversationDir, { recursive: true });
188217
- writeFileSync11(join31(conversationDir, "system-prompt.json"), `${JSON.stringify(prompt, null, 2)}
188243
+ writeFileSync12(join31(conversationDir, "system-prompt.json"), `${JSON.stringify(prompt, null, 2)}
188218
188244
  `);
188219
188245
  }
188220
188246
  ensureConversation(conversationId, agentId) {
@@ -195026,7 +195052,7 @@ __export(exports_personality, {
195026
195052
  applyPersonalityToMemory: () => applyPersonalityToMemory
195027
195053
  });
195028
195054
  import { execFile as execFileCb3 } from "node:child_process";
195029
- import { existsSync as existsSync25, mkdirSync as mkdirSync17, readFileSync as readFileSync13, writeFileSync as writeFileSync12 } from "node:fs";
195055
+ import { existsSync as existsSync25, mkdirSync as mkdirSync17, readFileSync as readFileSync14, writeFileSync as writeFileSync13 } from "node:fs";
195030
195056
  import { dirname as dirname21, join as join32 } from "node:path";
195031
195057
  import { promisify as promisify6 } from "node:util";
195032
195058
  function ensureTrailingNewline2(content) {
@@ -195160,7 +195186,7 @@ async function getMemoryCommitAuthor(agentId) {
195160
195186
  function applyPersonalityFiles(filesToUpdate) {
195161
195187
  const changedPaths = [];
195162
195188
  for (const file3 of filesToUpdate) {
195163
- const existingContent = existsSync25(file3.absolutePath) ? readFileSync13(file3.absolutePath, "utf-8") : null;
195189
+ const existingContent = existsSync25(file3.absolutePath) ? readFileSync14(file3.absolutePath, "utf-8") : null;
195164
195190
  const nextContent = existingContent ? replaceBodyPreservingFrontmatter(existingContent, file3.content, {
195165
195191
  description: file3.description
195166
195192
  }) : buildDefaultMemoryFile(file3.templatePromptAssetName, file3.content, file3.description);
@@ -195168,7 +195194,7 @@ function applyPersonalityFiles(filesToUpdate) {
195168
195194
  continue;
195169
195195
  }
195170
195196
  mkdirSync17(dirname21(file3.absolutePath), { recursive: true });
195171
- writeFileSync12(file3.absolutePath, nextContent, "utf-8");
195197
+ writeFileSync13(file3.absolutePath, nextContent, "utf-8");
195172
195198
  changedPaths.push(file3.relativePath);
195173
195199
  }
195174
195200
  return changedPaths;
@@ -232339,7 +232365,7 @@ var init_paste_registry = __esm(() => {
232339
232365
 
232340
232366
  // src/cli/helpers/clipboard.ts
232341
232367
  import { execFileSync as execFileSync3 } from "node:child_process";
232342
- import { existsSync as existsSync27, readFileSync as readFileSync15, statSync as statSync8, unlinkSync as unlinkSync5 } from "node:fs";
232368
+ import { existsSync as existsSync27, readFileSync as readFileSync16, statSync as statSync8, unlinkSync as unlinkSync5 } from "node:fs";
232343
232369
  import { tmpdir as tmpdir6 } from "node:os";
232344
232370
  import { basename as basename9, extname as extname4, isAbsolute as isAbsolute21, join as join33, resolve as resolve28 } from "node:path";
232345
232371
  function countLines(text2) {
@@ -232398,14 +232424,14 @@ function translatePasteForImages(paste) {
232398
232424
  try {
232399
232425
  const stat10 = statSync8(filePath);
232400
232426
  if (stat10.isFile())
232401
- buf = readFileSync15(filePath);
232427
+ buf = readFileSync16(filePath);
232402
232428
  } catch {}
232403
232429
  let clipboardMediaType = null;
232404
232430
  if (!buf && process.platform === "darwin" && /TemporaryItems\/.*screencaptureui/i.test(filePath)) {
232405
232431
  const clipResult = getClipboardImageToTempFile();
232406
232432
  if (clipResult) {
232407
232433
  try {
232408
- buf = readFileSync15(clipResult.tempPath);
232434
+ buf = readFileSync16(clipResult.tempPath);
232409
232435
  clipboardMediaType = UTI_TO_MEDIA_TYPE[clipResult.uti] || null;
232410
232436
  try {
232411
232437
  unlinkSync5(clipResult.tempPath);
@@ -232474,7 +232500,7 @@ async function tryImportClipboardImageMac() {
232474
232500
  return null;
232475
232501
  const { tempPath, uti } = clipboardResult;
232476
232502
  try {
232477
- const buffer = readFileSync15(tempPath);
232503
+ const buffer = readFileSync16(tempPath);
232478
232504
  try {
232479
232505
  unlinkSync5(tempPath);
232480
232506
  } catch {}
@@ -234421,7 +234447,7 @@ var init_local = __esm(() => {
234421
234447
  });
234422
234448
 
234423
234449
  // src/cli/helpers/local-agent-listing.ts
234424
- import { existsSync as existsSync29, readdirSync as readdirSync11, readFileSync as readFileSync16, statSync as statSync10 } from "node:fs";
234450
+ import { existsSync as existsSync29, readdirSync as readdirSync11, readFileSync as readFileSync17, statSync as statSync10 } from "node:fs";
234425
234451
  import { join as join35 } from "node:path";
234426
234452
  function listLocalAgentsFromDisk() {
234427
234453
  const storageDir = getLocalBackendStorageDir();
@@ -234433,7 +234459,7 @@ function listLocalAgentsFromDisk() {
234433
234459
  for (const file3 of files) {
234434
234460
  try {
234435
234461
  const filePath = join35(agentsDir, file3);
234436
- const raw2 = readFileSync16(filePath, "utf8");
234462
+ const raw2 = readFileSync17(filePath, "utf8");
234437
234463
  const record5 = JSON.parse(raw2);
234438
234464
  if (isHiddenLocalAgentRecord(record5))
234439
234465
  continue;
@@ -236291,7 +236317,7 @@ function shouldAcceptSlackInboundBotMessage(params) {
236291
236317
  }
236292
236318
 
236293
236319
  // src/channels/config.ts
236294
- import { existsSync as existsSync30, readFileSync as readFileSync17 } from "node:fs";
236320
+ import { existsSync as existsSync30, readFileSync as readFileSync18 } from "node:fs";
236295
236321
  import { homedir as homedir24 } from "node:os";
236296
236322
  import { join as join36 } from "node:path";
236297
236323
  function parseWhatsAppWaitingBehavior(value) {
@@ -236395,7 +236421,7 @@ function readChannelConfig(channelId) {
236395
236421
  if (!existsSync30(configPath))
236396
236422
  return null;
236397
236423
  try {
236398
- const text2 = readFileSync17(configPath, "utf-8");
236424
+ const text2 = readFileSync18(configPath, "utf-8");
236399
236425
  const parsed = parseSimpleYaml(text2);
236400
236426
  const codec3 = getChannelConfigCodec(channelId);
236401
236427
  if (!codec3)
@@ -236676,7 +236702,7 @@ __export(exports_accounts, {
236676
236702
  __testOverrideLoadChannelAccounts: () => __testOverrideLoadChannelAccounts,
236677
236703
  LEGACY_CHANNEL_ACCOUNT_ID: () => LEGACY_CHANNEL_ACCOUNT_ID
236678
236704
  });
236679
- import { existsSync as existsSync31, mkdirSync as mkdirSync19, readFileSync as readFileSync18, writeFileSync as writeFileSync13 } from "node:fs";
236705
+ import { existsSync as existsSync31, mkdirSync as mkdirSync19, readFileSync as readFileSync19, writeFileSync as writeFileSync14 } from "node:fs";
236680
236706
  function isSecretPlaceholder(value) {
236681
236707
  return value === SECRET_PRESENT_PLACEHOLDER;
236682
236708
  }
@@ -237031,7 +237057,7 @@ function loadChannelAccounts(channelId) {
237031
237057
  const path30 = getChannelAccountsPath(channelId);
237032
237058
  if (existsSync31(path30)) {
237033
237059
  try {
237034
- const text2 = readFileSync18(path30, "utf-8");
237060
+ const text2 = readFileSync19(path30, "utf-8");
237035
237061
  const parsed = JSON.parse(text2);
237036
237062
  stores.set(channelId, {
237037
237063
  accounts: (parsed.accounts ?? []).map((account) => {
@@ -237084,7 +237110,7 @@ function saveChannelAccounts(channelId) {
237084
237110
  }
237085
237111
  const dir = getChannelDir(channelId);
237086
237112
  mkdirSync19(dir, { recursive: true });
237087
- writeFileSync13(getChannelAccountsPath(channelId), `${JSON.stringify({ accounts: writeAccounts }, null, 2)}
237113
+ writeFileSync14(getChannelAccountsPath(channelId), `${JSON.stringify({ accounts: writeAccounts }, null, 2)}
237088
237114
  `, "utf-8");
237089
237115
  }
237090
237116
  async function flushPendingChannelSecretWrites() {
@@ -237241,7 +237267,7 @@ __export(exports_pairing, {
237241
237267
  __testOverrideLoadPairingStore: () => __testOverrideLoadPairingStore
237242
237268
  });
237243
237269
  import { randomInt } from "node:crypto";
237244
- import { existsSync as existsSync32, mkdirSync as mkdirSync20, readFileSync as readFileSync19, writeFileSync as writeFileSync14 } from "node:fs";
237270
+ import { existsSync as existsSync32, mkdirSync as mkdirSync20, readFileSync as readFileSync20, writeFileSync as writeFileSync15 } from "node:fs";
237245
237271
  function normalizeAccountId(accountId) {
237246
237272
  return accountId ?? LEGACY_CHANNEL_ACCOUNT_ID;
237247
237273
  }
@@ -237269,7 +237295,7 @@ function loadPairingStore(channelId) {
237269
237295
  if (!existsSync32(path30))
237270
237296
  return;
237271
237297
  try {
237272
- const text2 = readFileSync19(path30, "utf-8");
237298
+ const text2 = readFileSync20(path30, "utf-8");
237273
237299
  const parsed = JSON.parse(text2);
237274
237300
  stores2.set(channelId, {
237275
237301
  pending: parsed.pending ?? [],
@@ -237288,7 +237314,7 @@ function savePairingStore(channelId) {
237288
237314
  }
237289
237315
  const dir = getChannelDir(channelId);
237290
237316
  mkdirSync20(dir, { recursive: true });
237291
- writeFileSync14(getChannelPairingPath(channelId), `${JSON.stringify(store2, null, 2)}
237317
+ writeFileSync15(getChannelPairingPath(channelId), `${JSON.stringify(store2, null, 2)}
237292
237318
  `, "utf-8");
237293
237319
  }
237294
237320
  function generateCode(length = 6) {
@@ -238664,7 +238690,7 @@ __export(exports_transcription, {
238664
238690
  isTranscriptionConfigured: () => isTranscriptionConfigured
238665
238691
  });
238666
238692
  import { execFileSync as execFileSync4 } from "node:child_process";
238667
- import { mkdtempSync as mkdtempSync2, readFileSync as readFileSync20, rmSync as rmSync7 } from "node:fs";
238693
+ import { mkdtempSync as mkdtempSync2, readFileSync as readFileSync21, rmSync as rmSync7 } from "node:fs";
238668
238694
  import { tmpdir as tmpdir7 } from "node:os";
238669
238695
  import { basename as basename12, extname as extname5, join as join39 } from "node:path";
238670
238696
  function audioMimeTypeForPath(localPath) {
@@ -238731,7 +238757,7 @@ async function transcribeAudioFile(localPath) {
238731
238757
  try {
238732
238758
  const prepared = prepareOpenAiTranscriptionFile(localPath);
238733
238759
  try {
238734
- const buffer = readFileSync20(prepared.localPath);
238760
+ const buffer = readFileSync21(prepared.localPath);
238735
238761
  const filename = basename12(prepared.localPath);
238736
238762
  const formData = new FormData;
238737
238763
  const blob = new Blob([buffer], {
@@ -245835,7 +245861,7 @@ function createSlackMessageActionAdapter(options3 = {}) {
245835
245861
  }
245836
245862
 
245837
245863
  // src/channels/targets.ts
245838
- import { existsSync as existsSync34, mkdirSync as mkdirSync21, readFileSync as readFileSync21, writeFileSync as writeFileSync15 } from "node:fs";
245864
+ import { existsSync as existsSync34, mkdirSync as mkdirSync21, readFileSync as readFileSync22, writeFileSync as writeFileSync16 } from "node:fs";
245839
245865
  function getStore3(channelId) {
245840
245866
  let store2 = stores3.get(channelId);
245841
245867
  if (!store2) {
@@ -245854,7 +245880,7 @@ function loadTargetStore(channelId) {
245854
245880
  return;
245855
245881
  }
245856
245882
  try {
245857
- const text2 = readFileSync21(path30, "utf-8");
245883
+ const text2 = readFileSync22(path30, "utf-8");
245858
245884
  const parsed = JSON.parse(text2);
245859
245885
  stores3.set(channelId, {
245860
245886
  targets: parsed.targets ?? []
@@ -245868,7 +245894,7 @@ function saveTargetStore(channelId) {
245868
245894
  }
245869
245895
  const dir = getChannelDir(channelId);
245870
245896
  mkdirSync21(dir, { recursive: true });
245871
- writeFileSync15(getChannelTargetsPath(channelId), `${JSON.stringify(getStore3(channelId), null, 2)}
245897
+ writeFileSync16(getChannelTargetsPath(channelId), `${JSON.stringify(getStore3(channelId), null, 2)}
245872
245898
  `, "utf-8");
245873
245899
  }
245874
245900
  function listChannelTargets(channelId, accountId) {
@@ -248559,16 +248585,16 @@ import {
248559
248585
  closeSync as closeSync2,
248560
248586
  mkdirSync as mkdirSync23,
248561
248587
  openSync as openSync2,
248562
- readFileSync as readFileSync22,
248588
+ readFileSync as readFileSync23,
248563
248589
  renameSync as renameSync5,
248564
248590
  unlinkSync as unlinkSync6,
248565
- writeFileSync as writeFileSync16
248591
+ writeFileSync as writeFileSync17
248566
248592
  } from "node:fs";
248567
248593
  import { dirname as dirname23, isAbsolute as isAbsolute23 } from "node:path";
248568
248594
  function parseStoreFile(filePath) {
248569
248595
  let rawText;
248570
248596
  try {
248571
- rawText = readFileSync22(filePath, "utf8");
248597
+ rawText = readFileSync23(filePath, "utf8");
248572
248598
  } catch {
248573
248599
  return new Map;
248574
248600
  }
@@ -248655,7 +248681,7 @@ function createLidStore(filePath) {
248655
248681
  let fd = null;
248656
248682
  try {
248657
248683
  fd = openSync2(tmpPath, "wx", 384);
248658
- writeFileSync16(fd, data, "utf8");
248684
+ writeFileSync17(fd, data, "utf8");
248659
248685
  closeSync2(fd);
248660
248686
  fd = null;
248661
248687
  renameSync5(tmpPath, filePath);
@@ -248982,7 +249008,7 @@ var init_state = __esm(() => {
248982
249008
  });
248983
249009
 
248984
249010
  // src/channels/whatsapp/session.ts
248985
- import { mkdirSync as mkdirSync24, readFileSync as readFileSync23, rmSync as rmSync8, writeFileSync as writeFileSync17 } from "node:fs";
249011
+ import { mkdirSync as mkdirSync24, readFileSync as readFileSync24, rmSync as rmSync8, writeFileSync as writeFileSync18 } from "node:fs";
248986
249012
  import { homedir as homedir25 } from "node:os";
248987
249013
  import { join as join44 } from "node:path";
248988
249014
  function shouldDropLine(line) {
@@ -249056,7 +249082,7 @@ function defaultIsProcessAlive(pid) {
249056
249082
  }
249057
249083
  function readLeaseOwner(lockDir) {
249058
249084
  try {
249059
- const owner = JSON.parse(readFileSync23(join44(lockDir, "owner.json"), "utf8"));
249085
+ const owner = JSON.parse(readFileSync24(join44(lockDir, "owner.json"), "utf8"));
249060
249086
  return {
249061
249087
  pid: typeof owner.pid === "number" ? owner.pid : undefined,
249062
249088
  command: typeof owner.command === "string" ? owner.command : undefined
@@ -249076,7 +249102,7 @@ function acquireWhatsAppSessionLease(accountId, options3 = {}) {
249076
249102
  for (let attempt = 0;attempt < 2; attempt += 1) {
249077
249103
  try {
249078
249104
  mkdirSync24(lockDir);
249079
- writeFileSync17(join44(lockDir, "owner.json"), `${JSON.stringify({
249105
+ writeFileSync18(join44(lockDir, "owner.json"), `${JSON.stringify({
249080
249106
  accountId,
249081
249107
  pid,
249082
249108
  command: process.argv.join(" "),
@@ -250681,7 +250707,7 @@ import {
250681
250707
  copyFileSync as copyFileSync2,
250682
250708
  mkdirSync as mkdirSync25,
250683
250709
  readdirSync as readdirSync12,
250684
- readFileSync as readFileSync24,
250710
+ readFileSync as readFileSync25,
250685
250711
  realpathSync as realpathSync6,
250686
250712
  statSync as statSync12
250687
250713
  } from "node:fs";
@@ -250971,7 +250997,7 @@ function copySignalAttachment(params) {
250971
250997
  localPath
250972
250998
  };
250973
250999
  if (kind === "image" && sizeBytes <= MAX_SIGNAL_INLINE_IMAGE_BYTES) {
250974
- attachment.imageDataBase64 = readFileSync24(localPath).toString("base64");
251000
+ attachment.imageDataBase64 = readFileSync25(localPath).toString("base64");
250975
251001
  }
250976
251002
  return attachment;
250977
251003
  }
@@ -252467,7 +252493,7 @@ __export(exports_plugin_registry, {
252467
252493
  getChannelDisplayName: () => getChannelDisplayName,
252468
252494
  __testClearUserChannelPluginCache: () => __testClearUserChannelPluginCache
252469
252495
  });
252470
- import { existsSync as existsSync36, readdirSync as readdirSync13, readFileSync as readFileSync25 } from "node:fs";
252496
+ import { existsSync as existsSync36, readdirSync as readdirSync13, readFileSync as readFileSync26 } from "node:fs";
252471
252497
  import { resolve as resolve30, sep as sep6 } from "node:path";
252472
252498
  import { pathToFileURL as pathToFileURL2 } from "node:url";
252473
252499
  function isValidChannelId(value) {
@@ -252482,7 +252508,7 @@ function readChannelManifest(channelDir) {
252482
252508
  return null;
252483
252509
  }
252484
252510
  try {
252485
- const parsed = JSON.parse(readFileSync25(manifestPath, "utf-8"));
252511
+ const parsed = JSON.parse(readFileSync26(manifestPath, "utf-8"));
252486
252512
  if (!isRecord(parsed)) {
252487
252513
  return null;
252488
252514
  }
@@ -252743,7 +252769,7 @@ __export(exports_routing, {
252743
252769
  __testOverrideSaveRoutes: () => __testOverrideSaveRoutes,
252744
252770
  __testOverrideLoadRoutes: () => __testOverrideLoadRoutes
252745
252771
  });
252746
- import { existsSync as existsSync37, mkdirSync as mkdirSync26, readFileSync as readFileSync26, writeFileSync as writeFileSync18 } from "node:fs";
252772
+ import { existsSync as existsSync37, mkdirSync as mkdirSync26, readFileSync as readFileSync27, writeFileSync as writeFileSync19 } from "node:fs";
252747
252773
  function normalizeAccountId3(accountId) {
252748
252774
  return accountId ?? LEGACY_CHANNEL_ACCOUNT_ID;
252749
252775
  }
@@ -252797,7 +252823,7 @@ function loadRoutes(channelId) {
252797
252823
  if (!existsSync37(path30))
252798
252824
  return;
252799
252825
  try {
252800
- const text2 = readFileSync26(path30, "utf-8");
252826
+ const text2 = readFileSync27(path30, "utf-8");
252801
252827
  const parsed = JSON.parse(text2);
252802
252828
  const routes = parsed.routes ?? [];
252803
252829
  for (const route of routes) {
@@ -252834,7 +252860,7 @@ function saveRoutes(channelId) {
252834
252860
  mkdirSync26(dir, { recursive: true });
252835
252861
  const routes = getRoutesForChannel(channelId);
252836
252862
  const data = { routes };
252837
- writeFileSync18(getChannelRoutingPath(channelId), `${JSON.stringify(data, null, 2)}
252863
+ writeFileSync19(getChannelRoutingPath(channelId), `${JSON.stringify(data, null, 2)}
252838
252864
  `, "utf-8");
252839
252865
  }
252840
252866
  function getRoute(channel, chatId, accountId, threadId) {
@@ -253257,7 +253283,7 @@ var init_registry_commands = __esm(() => {
253257
253283
  });
253258
253284
 
253259
253285
  // src/channels/pending-control-requests.ts
253260
- import { existsSync as existsSync38, mkdirSync as mkdirSync27, readFileSync as readFileSync27, writeFileSync as writeFileSync19 } from "node:fs";
253286
+ import { existsSync as existsSync38, mkdirSync as mkdirSync27, readFileSync as readFileSync28, writeFileSync as writeFileSync20 } from "node:fs";
253261
253287
  import { dirname as dirname24 } from "node:path";
253262
253288
  function cloneEvent(event2) {
253263
253289
  return structuredClone(event2);
@@ -253290,7 +253316,7 @@ function ensureStoreLoaded() {
253290
253316
  return;
253291
253317
  }
253292
253318
  try {
253293
- const text2 = readFileSync27(storePath, "utf-8");
253319
+ const text2 = readFileSync28(storePath, "utf-8");
253294
253320
  const parsed = JSON.parse(text2);
253295
253321
  store2 = {
253296
253322
  requests: Array.isArray(parsed.requests) ? parsed.requests.filter(isChannelControlRequestEvent).map(cloneEvent) : []
@@ -253308,7 +253334,7 @@ function saveStore() {
253308
253334
  }
253309
253335
  const storePath = getPendingChannelControlRequestsPath();
253310
253336
  mkdirSync27(dirname24(storePath), { recursive: true });
253311
- writeFileSync19(storePath, `${JSON.stringify(snapshot, null, 2)}
253337
+ writeFileSync20(storePath, `${JSON.stringify(snapshot, null, 2)}
253312
253338
  `, "utf-8");
253313
253339
  }
253314
253340
  function listPendingControlRequests() {
@@ -265434,8 +265460,8 @@ var require_CronFileParser = __commonJS((exports) => {
265434
265460
  return CronFileParser.#parseContent(data);
265435
265461
  }
265436
265462
  static parseFileSync(filePath) {
265437
- const { readFileSync: readFileSync28 } = __require("fs");
265438
- const data = readFileSync28(filePath, "utf8");
265463
+ const { readFileSync: readFileSync29 } = __require("fs");
265464
+ const data = readFileSync29(filePath, "utf8");
265439
265465
  return CronFileParser.#parseContent(data);
265440
265466
  }
265441
265467
  static #parseContent(data) {
@@ -265777,11 +265803,11 @@ import { randomBytes } from "node:crypto";
265777
265803
  import {
265778
265804
  existsSync as existsSync39,
265779
265805
  mkdirSync as mkdirSync28,
265780
- readFileSync as readFileSync28,
265806
+ readFileSync as readFileSync29,
265781
265807
  renameSync as renameSync6,
265782
265808
  rmSync as rmSync9,
265783
265809
  statSync as statSync13,
265784
- writeFileSync as writeFileSync20
265810
+ writeFileSync as writeFileSync21
265785
265811
  } from "node:fs";
265786
265812
  import { join as join47 } from "node:path";
265787
265813
  function getLettaDir() {
@@ -265826,7 +265852,7 @@ function readCronFile() {
265826
265852
  if (!existsSync39(path31))
265827
265853
  return emptyFile();
265828
265854
  try {
265829
- const raw2 = readFileSync28(path31, "utf-8");
265855
+ const raw2 = readFileSync29(path31, "utf-8");
265830
265856
  const data = JSON.parse(raw2);
265831
265857
  if (data.version !== 1)
265832
265858
  return emptyFile();
@@ -265842,12 +265868,12 @@ function writeCronFile(data) {
265842
265868
  mkdirSync28(dir, { recursive: true });
265843
265869
  }
265844
265870
  const tmp = `${path31}.tmp`;
265845
- writeFileSync20(tmp, JSON.stringify(data, null, 2), { flush: true });
265871
+ writeFileSync21(tmp, JSON.stringify(data, null, 2), { flush: true });
265846
265872
  renameSync6(tmp, path31);
265847
265873
  }
265848
265874
  function readLinuxProcessIdentity(pid) {
265849
265875
  try {
265850
- const stat10 = readFileSync28(`/proc/${pid}/stat`, "utf8");
265876
+ const stat10 = readFileSync29(`/proc/${pid}/stat`, "utf8");
265851
265877
  const endCommand = stat10.lastIndexOf(")");
265852
265878
  if (endCommand === -1) {
265853
265879
  return null;
@@ -265859,7 +265885,7 @@ function readLinuxProcessIdentity(pid) {
265859
265885
  }
265860
265886
  let bootId = null;
265861
265887
  try {
265862
- bootId = readFileSync28("/proc/sys/kernel/random/boot_id", "utf8").trim() || null;
265888
+ bootId = readFileSync29("/proc/sys/kernel/random/boot_id", "utf8").trim() || null;
265863
265889
  } catch {}
265864
265890
  return { startTicks, bootId };
265865
265891
  } catch {
@@ -265900,14 +265926,14 @@ function isProcessAlive(pid, owner) {
265900
265926
  }
265901
265927
  function readLockOwner(lockDir) {
265902
265928
  try {
265903
- const raw2 = readFileSync28(join47(lockDir, LOCK_TOKEN_FILE), "utf-8");
265929
+ const raw2 = readFileSync29(join47(lockDir, LOCK_TOKEN_FILE), "utf-8");
265904
265930
  return JSON.parse(raw2);
265905
265931
  } catch {
265906
265932
  return null;
265907
265933
  }
265908
265934
  }
265909
265935
  function writeLockOwner(lockDir, owner) {
265910
- writeFileSync20(join47(lockDir, LOCK_TOKEN_FILE), JSON.stringify(owner));
265936
+ writeFileSync21(join47(lockDir, LOCK_TOKEN_FILE), JSON.stringify(owner));
265911
265937
  }
265912
265938
  function isLockStale(lockDir) {
265913
265939
  const owner = readLockOwner(lockDir);
@@ -266197,9 +266223,9 @@ import {
266197
266223
  chmodSync as chmodSync6,
266198
266224
  existsSync as existsSync40,
266199
266225
  mkdirSync as mkdirSync29,
266200
- readFileSync as readFileSync29,
266226
+ readFileSync as readFileSync30,
266201
266227
  statSync as statSync14,
266202
- writeFileSync as writeFileSync21
266228
+ writeFileSync as writeFileSync22
266203
266229
  } from "node:fs";
266204
266230
  import path31 from "node:path";
266205
266231
  function assertSafeCronRunLogJobId(jobId) {
@@ -266245,11 +266271,11 @@ function pruneIfNeeded(filePath, opts) {
266245
266271
  if (size <= opts.maxBytes) {
266246
266272
  return;
266247
266273
  }
266248
- const raw2 = readFileSync29(filePath, "utf-8");
266274
+ const raw2 = readFileSync30(filePath, "utf-8");
266249
266275
  const lines = raw2.split(`
266250
266276
  `).map((line) => line.trim()).filter(Boolean);
266251
266277
  const kept = lines.slice(Math.max(0, lines.length - opts.keepLines));
266252
- writeFileSync21(filePath, `${kept.join(`
266278
+ writeFileSync22(filePath, `${kept.join(`
266253
266279
  `)}
266254
266280
  `, { mode: 384 });
266255
266281
  setSecureFileMode(filePath);
@@ -266325,7 +266351,7 @@ function readCronRunLogEntries(filePath, opts) {
266325
266351
  const limit3 = Math.max(1, Math.min(5000, Math.floor(opts?.limit ?? 200)));
266326
266352
  let raw2 = "";
266327
266353
  try {
266328
- raw2 = readFileSync29(path31.resolve(filePath), "utf-8");
266354
+ raw2 = readFileSync30(path31.resolve(filePath), "utf-8");
266329
266355
  } catch {
266330
266356
  return [];
266331
266357
  }
@@ -266753,7 +266779,7 @@ function shouldProcessInboundMessageDirectly(runtime, parsed) {
266753
266779
  });
266754
266780
  return getListenerBlockedReason(runtime.turnLifecycle.snapshot(), activeScope ? getPendingControlRequestCount(runtime.listener, activeScope) : 0) === null;
266755
266781
  }
266756
- function consumeQueuedTurn(runtime) {
266782
+ function consumeQueuedTurn(runtime, options3) {
266757
266783
  const queuedItems = runtime.queueRuntime.peek();
266758
266784
  const firstQueuedItem = queuedItems[0];
266759
266785
  if (!firstQueuedItem || !isCoalescable(firstQueuedItem.kind)) {
@@ -266803,6 +266829,18 @@ function consumeQueuedTurn(runtime) {
266803
266829
  if (!hasMessage && !hasTaskNotification && !hasCronPrompt && !hasModContinue || queueLen === 0) {
266804
266830
  return null;
266805
266831
  }
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
+ }
266806
266844
  const dequeuedBatch = runtime.queueRuntime.consumeItems(queueLen);
266807
266845
  if (!dequeuedBatch) {
266808
266846
  return null;
@@ -276842,11 +276880,11 @@ function resolvePendingApprovalResolver(runtime, response, connectionId) {
276842
276880
  setCommandLoopStatus(runtime, "WAITING_ON_INPUT");
276843
276881
  }
276844
276882
  pending.resolve(response);
276845
- emitLoopStatusIfOpen(runtime.listener, {
276883
+ emitLoopStatusIfOpen(runtime, {
276846
276884
  agent_id: runtime.agentId,
276847
276885
  conversation_id: runtime.conversationId
276848
276886
  });
276849
- emitDeviceStatusIfOpen(runtime.listener, {
276887
+ emitDeviceStatusIfOpen(runtime, {
276850
276888
  agent_id: runtime.agentId,
276851
276889
  conversation_id: runtime.conversationId
276852
276890
  });
@@ -276861,11 +276899,11 @@ function rejectPendingApprovalResolvers(runtime, reason) {
276861
276899
  if (!runtime.isProcessing && !runtime.cancelRequested) {
276862
276900
  setCommandLoopStatus(runtime, "WAITING_ON_INPUT");
276863
276901
  }
276864
- emitLoopStatusIfOpen(runtime.listener, {
276902
+ emitLoopStatusIfOpen(runtime, {
276865
276903
  agent_id: runtime.agentId,
276866
276904
  conversation_id: runtime.conversationId
276867
276905
  });
276868
- emitDeviceStatusIfOpen(runtime.listener, {
276906
+ emitDeviceStatusIfOpen(runtime, {
276869
276907
  agent_id: runtime.agentId,
276870
276908
  conversation_id: runtime.conversationId
276871
276909
  });
@@ -276970,11 +277008,11 @@ function requestApprovalOverWS(runtime, socket, turnLease, requestId, controlReq
276970
277008
  runtime.turnLifecycle.recordStopReason(turnLease, "requires_approval");
276971
277009
  setTurnLoopStatus(runtime, turnLease, "WAITING_ON_APPROVAL");
276972
277010
  emitProtocolV2Message(socket, runtime, controlRequest, scope, TO_SUBSCRIBERS);
276973
- emitLoopStatusIfOpen(runtime.listener, {
277011
+ emitLoopStatusIfOpen(runtime, {
276974
277012
  agent_id: runtime.agentId,
276975
277013
  conversation_id: runtime.conversationId
276976
277014
  });
276977
- emitDeviceStatusIfOpen(runtime.listener, {
277015
+ emitDeviceStatusIfOpen(runtime, {
276978
277016
  agent_id: runtime.agentId,
276979
277017
  conversation_id: runtime.conversationId
276980
277018
  });
@@ -278532,7 +278570,7 @@ __export(exports_memory_scanner, {
278532
278570
  readFileContent: () => readFileContent,
278533
278571
  getFileNodes: () => getFileNodes
278534
278572
  });
278535
- import { readdirSync as readdirSync16, readFileSync as readFileSync30, statSync as statSync16 } from "node:fs";
278573
+ import { readdirSync as readdirSync16, readFileSync as readFileSync31, statSync as statSync16 } from "node:fs";
278536
278574
  import { join as join62, relative as relative9 } from "node:path";
278537
278575
  function scanMemoryFilesystem(memoryRoot) {
278538
278576
  const nodes = [];
@@ -278597,7 +278635,7 @@ function getFileNodes(nodes) {
278597
278635
  }
278598
278636
  function readFileContent(fullPath) {
278599
278637
  try {
278600
- return readFileSync30(fullPath, "utf-8");
278638
+ return readFileSync31(fullPath, "utf-8");
278601
278639
  } catch {
278602
278640
  return "(unable to read file)";
278603
278641
  }
@@ -279339,7 +279377,7 @@ __export(exports_remote_model_catalog, {
279339
279377
  __testResetRemoteModelCatalog: () => __testResetRemoteModelCatalog
279340
279378
  });
279341
279379
  import { createHash as createHash8 } from "node:crypto";
279342
- import { existsSync as existsSync44, mkdirSync as mkdirSync31, readFileSync as readFileSync31, writeFileSync as writeFileSync22 } from "node:fs";
279380
+ import { existsSync as existsSync44, mkdirSync as mkdirSync31, readFileSync as readFileSync32, writeFileSync as writeFileSync23 } from "node:fs";
279343
279381
  import { homedir as homedir37 } from "node:os";
279344
279382
  import { dirname as dirname27, join as join63 } from "node:path";
279345
279383
  function cloneCatalogModels(entries) {
@@ -279431,7 +279469,7 @@ function persistCatalogCache(entries, source2) {
279431
279469
  try {
279432
279470
  const path33 = catalogCachePath();
279433
279471
  mkdirSync31(dirname27(path33), { recursive: true });
279434
- writeFileSync22(path33, JSON.stringify({
279472
+ writeFileSync23(path33, JSON.stringify({
279435
279473
  schemaVersion: CACHE_SCHEMA_VERSION,
279436
279474
  source: source2,
279437
279475
  bundledCatalogFingerprint,
@@ -279450,7 +279488,7 @@ function loadPersistedModelCatalog(source2) {
279450
279488
  if (!existsSync44(path33)) {
279451
279489
  return false;
279452
279490
  }
279453
- const parsed = JSON.parse(readFileSync31(path33, "utf-8"));
279491
+ const parsed = JSON.parse(readFileSync32(path33, "utf-8"));
279454
279492
  if (parsed.schemaVersion !== CACHE_SCHEMA_VERSION || parsed.source !== normalizeCatalogSource(source2) || parsed.bundledCatalogFingerprint !== bundledCatalogFingerprint || !Array.isArray(parsed.models)) {
279455
279493
  return false;
279456
279494
  }
@@ -279872,7 +279910,7 @@ var LETTA_MODS_DIR_ENV = "LETTA_MODS_DIR", LEGACY_LETTA_EXTENSIONS_DIR_ENV = "LE
279872
279910
  var init_paths2 = () => {};
279873
279911
 
279874
279912
  // src/mods/mod-diagnostics-file.ts
279875
- import { mkdirSync as mkdirSync32, writeFileSync as writeFileSync23 } from "node:fs";
279913
+ import { mkdirSync as mkdirSync32, writeFileSync as writeFileSync24 } from "node:fs";
279876
279914
  import { homedir as homedir39 } from "node:os";
279877
279915
  import path34 from "node:path";
279878
279916
  function getDefaultModDiagnosticsRoot(homeDirectory = homedir39()) {
@@ -279891,7 +279929,7 @@ function writeModDiagnosticsLatestFile(diagnostics2, options3 = {}) {
279891
279929
  const file3 = createModDiagnosticsFile(diagnostics2, options3.generatedAt);
279892
279930
  const filePath = getModDiagnosticsLatestFilePath(options3.rootDirectory);
279893
279931
  mkdirSync32(path34.dirname(filePath), { recursive: true });
279894
- writeFileSync23(filePath, `${JSON.stringify(file3, null, 2)}
279932
+ writeFileSync24(filePath, `${JSON.stringify(file3, null, 2)}
279895
279933
  `, "utf-8");
279896
279934
  return file3;
279897
279935
  }
@@ -448636,7 +448674,7 @@ var init_file_extensions = __esm(() => {
448636
448674
  });
448637
448675
 
448638
448676
  // src/mods/package-manifest.ts
448639
- import { readFileSync as readFileSync32 } from "node:fs";
448677
+ import { readFileSync as readFileSync33 } from "node:fs";
448640
448678
  import path35 from "node:path";
448641
448679
  function isRecord9(value) {
448642
448680
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -448846,7 +448884,7 @@ function parseLettaPackageManifest(packageJson) {
448846
448884
  }
448847
448885
  function readLettaPackageManifest(packageJsonPath) {
448848
448886
  try {
448849
- const packageJson = JSON.parse(readFileSync32(packageJsonPath, "utf8"));
448887
+ const packageJson = JSON.parse(readFileSync33(packageJsonPath, "utf8"));
448850
448888
  return parseLettaPackageManifest(packageJson);
448851
448889
  } catch (error54) {
448852
448890
  return {
@@ -448878,9 +448916,9 @@ var init_package_manifest = __esm(() => {
448878
448916
  import {
448879
448917
  existsSync as existsSync46,
448880
448918
  mkdirSync as mkdirSync33,
448881
- readFileSync as readFileSync33,
448919
+ readFileSync as readFileSync34,
448882
448920
  rmSync as rmSync10,
448883
- writeFileSync as writeFileSync24
448921
+ writeFileSync as writeFileSync25
448884
448922
  } from "node:fs";
448885
448923
  import path36 from "node:path";
448886
448924
  function isRecord10(value) {
@@ -448934,7 +448972,7 @@ function parseJsonFile(filePath) {
448934
448972
  try {
448935
448973
  return {
448936
448974
  ok: true,
448937
- value: JSON.parse(readFileSync33(filePath, "utf8"))
448975
+ value: JSON.parse(readFileSync34(filePath, "utf8"))
448938
448976
  };
448939
448977
  } catch (error54) {
448940
448978
  return {
@@ -449375,12 +449413,12 @@ function findPackageIndex(modsRoot, packagesValue, specifier) {
449375
449413
  }
449376
449414
  function writePackageRegistry(registryPath, registry2) {
449377
449415
  mkdirSync33(path36.dirname(registryPath), { recursive: true });
449378
- writeFileSync24(registryPath, `${JSON.stringify(registry2, null, 2)}
449416
+ writeFileSync25(registryPath, `${JSON.stringify(registry2, null, 2)}
449379
449417
  `);
449380
449418
  }
449381
449419
  function validateManagedModPackageRegistryForMutation(modsRoot) {
449382
449420
  const registryPath = getRegistryPath(modsRoot);
449383
- const contents = existsSync46(registryPath) ? readFileSync33(registryPath, "utf8") : null;
449421
+ const contents = existsSync46(registryPath) ? readFileSync34(registryPath, "utf8") : null;
449384
449422
  const registry2 = readMutablePackageRegistry(modsRoot, {
449385
449423
  createIfMissing: true
449386
449424
  });
@@ -449633,6 +449671,41 @@ function getTurnStartCancel(event2) {
449633
449671
  }
449634
449672
  var MAX_TURN_START_CANCEL_REASON_LENGTH = 2000;
449635
449673
 
449674
+ // src/mods/turn-start-input.ts
449675
+ function isTurnStartInput(value) {
449676
+ return Array.isArray(value) && value.every((item) => typeof item === "object" && item !== null);
449677
+ }
449678
+ function cloneTurnStartInput(input) {
449679
+ return input.map((item) => structuredClone(item));
449680
+ }
449681
+ function isApprovalInput(item) {
449682
+ return item.type === "approval";
449683
+ }
449684
+ function preserveApprovalFirstOrdering(wasApprovalContinuation, transformedInput) {
449685
+ if (!wasApprovalContinuation)
449686
+ return transformedInput;
449687
+ let sawNonApproval = false;
449688
+ let needsReorder = false;
449689
+ for (const item of transformedInput) {
449690
+ if (isApprovalInput(item)) {
449691
+ if (sawNonApproval) {
449692
+ needsReorder = true;
449693
+ break;
449694
+ }
449695
+ } else {
449696
+ sawNonApproval = true;
449697
+ }
449698
+ }
449699
+ if (!needsReorder)
449700
+ return transformedInput;
449701
+ const approvals = [];
449702
+ const remaining = [];
449703
+ for (const item of transformedInput) {
449704
+ (isApprovalInput(item) ? approvals : remaining).push(item);
449705
+ }
449706
+ return [...approvals, ...remaining];
449707
+ }
449708
+
449636
449709
  // src/mods/ui-helpers.ts
449637
449710
  function createNoopModPanelHandle() {
449638
449711
  return { close() {}, update() {} };
@@ -449644,10 +449717,10 @@ import {
449644
449717
  existsSync as existsSync48,
449645
449718
  mkdirSync as mkdirSync35,
449646
449719
  readdirSync as readdirSync18,
449647
- readFileSync as readFileSync34,
449720
+ readFileSync as readFileSync35,
449648
449721
  statSync as statSync17,
449649
449722
  unlinkSync as unlinkSync9,
449650
- writeFileSync as writeFileSync25
449723
+ writeFileSync as writeFileSync26
449651
449724
  } from "node:fs";
449652
449725
  import { createRequire as createRequire5 } from "node:module";
449653
449726
  import path39 from "node:path";
@@ -449820,7 +449893,7 @@ function prepareModForImport(modPath, source2) {
449820
449893
  }
449821
449894
  function createImportableModPath(modPath, cacheDirectory, source2) {
449822
449895
  const importCacheDirectory = getManagedPackageImportCacheDirectory(modPath, source2) ?? cacheDirectory;
449823
- const sourceText = readFileSync34(modPath, "utf8");
449896
+ const sourceText = readFileSync35(modPath, "utf8");
449824
449897
  const hash4 = createHash9("sha256").update(sourceText).digest("hex").slice(0, 16);
449825
449898
  const fileExtension = path39.extname(modPath);
449826
449899
  const importableSource = prepareModForImport(modPath, sourceText);
@@ -449832,7 +449905,7 @@ function createImportableModPath(modPath, cacheDirectory, source2) {
449832
449905
  const baseName = path39.basename(modPath, fileExtension).replace(/[^a-zA-Z0-9_-]/g, "-");
449833
449906
  const importPath = path39.join(importCacheDirectory, `.letta-mod-${baseName}-${hash4}.mjs`);
449834
449907
  if (!existsSync48(importPath)) {
449835
- writeFileSync25(importPath, importableSource, "utf8");
449908
+ writeFileSync26(importPath, importableSource, "utf8");
449836
449909
  }
449837
449910
  try {
449838
449911
  for (const entry of readdirSync18(importCacheDirectory)) {
@@ -449901,12 +449974,6 @@ function isTurnStartResultWithCancel(name, result) {
449901
449974
  const cancel = result.cancel;
449902
449975
  return typeof cancel === "object" && cancel !== null && normalizeTurnStartCancelReason(cancel.reason) !== null;
449903
449976
  }
449904
- function isTurnStartInput(value) {
449905
- return Array.isArray(value) && value.every((item) => typeof item === "object" && item !== null);
449906
- }
449907
- function cloneTurnStartInput(input) {
449908
- return input.map((item) => structuredClone(item));
449909
- }
449910
449977
  function isToolStartResultWithArgs(name, result) {
449911
449978
  return name === "tool_start" && typeof result === "object" && result !== null && isToolStartArgs2(result.args);
449912
449979
  }
@@ -450481,7 +450548,7 @@ async function loadLocalMods(options3) {
450481
450548
  }
450482
450549
  try {
450483
450550
  const mtimeMs = statSync17(modPath).mtimeMs;
450484
- const sourceText = readFileSync34(modPath, "utf8");
450551
+ const sourceText = readFileSync35(modPath, "utf8");
450485
450552
  recordDeprecatedContextApiSourceDiagnostics(sourceText, (diagnostic) => {
450486
450553
  recordModDiagnostic(registry2, {
450487
450554
  ...diagnostic,
@@ -450529,6 +450596,7 @@ async function emitLocalModEvent(registry2, name, event2, context3, backend3, on
450529
450596
  const diagnostics2 = [];
450530
450597
  const results = [];
450531
450598
  let turnStartCancel;
450599
+ const turnStartHadApproval = name === "turn_start" && event2.input.some((item) => item.type === "approval");
450532
450600
  for (const registration of registrations) {
450533
450601
  const signal = registration.owner ? registry2.ownerAbortControllers[registration.owner.id]?.signal : undefined;
450534
450602
  if (signal?.aborted)
@@ -450603,6 +450671,7 @@ async function emitLocalModEvent(registry2, name, event2, context3, backend3, on
450603
450671
  }
450604
450672
  if (name === "turn_start") {
450605
450673
  const turnStartEventWithCancel = event2;
450674
+ turnStartEventWithCancel.input = preserveApprovalFirstOrdering(turnStartHadApproval, turnStartEventWithCancel.input);
450606
450675
  if (turnStartCancel) {
450607
450676
  turnStartEventWithCancel.cancel = { ...turnStartCancel };
450608
450677
  } else {
@@ -454459,7 +454528,7 @@ import {
454459
454528
  mkdirSync as mkdirSync37,
454460
454529
  readdirSync as readdirSync19,
454461
454530
  unlinkSync as unlinkSync10,
454462
- writeFileSync as writeFileSync26
454531
+ writeFileSync as writeFileSync27
454463
454532
  } from "node:fs";
454464
454533
  import { homedir as homedir40 } from "node:os";
454465
454534
  import { join as join65 } from "node:path";
@@ -454571,7 +454640,7 @@ class ChunkLog {
454571
454640
  try {
454572
454641
  const content = this.buffer.map((entry) => JSON.stringify(entry)).join(`
454573
454642
  `);
454574
- writeFileSync26(this.logPath, `${content}
454643
+ writeFileSync27(this.logPath, `${content}
454575
454644
  `, "utf8");
454576
454645
  } catch (e2) {
454577
454646
  debugWarn("chunkLog", `Failed to write ${this.logPath}: ${e2 instanceof Error ? e2.message : String(e2)}`);
@@ -455937,7 +456006,8 @@ async function resolveRecoveredApprovalResponse(runtime, socket, response, proce
455937
456006
  const workingDirectory = getConversationWorkingDirectory(runtime.listener, recovered.agentId, recovered.conversationId);
455938
456007
  const scope = {
455939
456008
  agent_id: recovered.agentId,
455940
- conversation_id: recovered.conversationId
456009
+ conversation_id: recovered.conversationId,
456010
+ ...opts?.superRunId ? { super_run_id: opts.superRunId } : {}
455941
456011
  };
455942
456012
  const respondedEntry = recovered.approvalsByRequestId.get(requestId);
455943
456013
  let autoDecisionsToAppend = [];
@@ -455990,7 +456060,8 @@ async function resolveRecoveredApprovalResponse(runtime, socket, response, proce
455990
456060
  const recoveryLease = pendingRequestIdsAfterResponse.length === 0 ? runtime.turnLifecycle.begin({
455991
456061
  origin: "approval_recovery",
455992
456062
  workingDirectory,
455993
- initialStatus: "EXECUTING_CLIENT_SIDE_TOOL"
456063
+ initialStatus: "EXECUTING_CLIENT_SIDE_TOOL",
456064
+ superRunId: opts?.superRunId
455994
456065
  }) : null;
455995
456066
  let continuationFinalized = false;
455996
456067
  try {
@@ -456144,7 +456215,9 @@ async function resolveRecoveredApprovalResponse(runtime, socket, response, proce
456144
456215
  }
456145
456216
  ]);
456146
456217
  let continuationBatchId = `batch-recovered-${crypto.randomUUID()}`;
456147
- const consumedQueuedTurn = consumeQueuedTurn(runtime);
456218
+ const consumedQueuedTurn = consumeQueuedTurn(runtime, {
456219
+ matchActiveSuperRun: true
456220
+ });
456148
456221
  if (consumedQueuedTurn) {
456149
456222
  const { dequeuedBatch, queuedTurn } = consumedQueuedTurn;
456150
456223
  continuationBatchId = dequeuedBatch.batchId;
@@ -456158,6 +456231,7 @@ async function resolveRecoveredApprovalResponse(runtime, socket, response, proce
456158
456231
  type: "message",
456159
456232
  agentId: recovered.agentId,
456160
456233
  conversationId: recovered.conversationId,
456234
+ ...opts?.superRunId ? { superRunId: opts.superRunId } : {},
456161
456235
  messages: continuationInput.messages
456162
456236
  }, socket, runtime, opts?.onStatusChange, opts?.connectionId, continuationBatchId, recoveryLease);
456163
456237
  if (runtime.turnLifecycle.isCurrent(recoveryLease)) {
@@ -456183,17 +456257,21 @@ async function resolveRecoveredApprovalResponse(runtime, socket, response, proce
456183
456257
  recovered.responsesByRequestId.clear();
456184
456258
  }
456185
456259
  const stopReason = recoveryLease.signal.aborted ? "cancelled" : "error";
456186
- finishListenerTurn(runtime, recoveryLease, {
456187
- stopReason,
456188
- socket,
456189
- agentId: recovered.agentId,
456190
- conversationId: recovered.conversationId,
456191
- turnId: `batch-recovered-${requestId}`,
456192
- error: stopReason === "error" ? getTranscriptLoopErrorMessage({
456193
- error: error54,
456194
- message: error54 instanceof Error ? error54.message : String(error54)
456195
- }) : undefined
456196
- });
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
+ }
456197
456275
  throw error54;
456198
456276
  }
456199
456277
  }
@@ -456540,7 +456618,9 @@ async function resolveStaleApprovals(runtime, socket, turnLease, deps = {}) {
456540
456618
  otid: crypto.randomUUID()
456541
456619
  }
456542
456620
  ]);
456543
- const consumedQueuedTurn = consumeQueuedTurn(runtime);
456621
+ const consumedQueuedTurn = consumeQueuedTurn(runtime, {
456622
+ matchActiveSuperRun: true
456623
+ });
456544
456624
  if (consumedQueuedTurn) {
456545
456625
  const { dequeuedBatch, queuedTurn } = consumedQueuedTurn;
456546
456626
  continuationInput = appendQueuedTurnToInput(continuationInput, queuedTurn);
@@ -459313,7 +459393,9 @@ async function handleApprovalStop(params) {
459313
459393
  }
459314
459394
  ]);
459315
459395
  let continuationBatchId = dequeuedBatchId;
459316
- const consumedQueuedTurn = consumeQueuedTurn(runtime);
459396
+ const consumedQueuedTurn = consumeQueuedTurn(runtime, {
459397
+ matchActiveSuperRun: true
459398
+ });
459317
459399
  if (consumedQueuedTurn) {
459318
459400
  const { dequeuedBatch, queuedTurn } = consumedQueuedTurn;
459319
459401
  continuationBatchId = dequeuedBatch.batchId;
@@ -460928,7 +461010,8 @@ async function handleIncomingMessageInner(msg, socket, runtime, onStatusChange,
460928
461010
  let lastNeedsUserInputToolCallIds = [];
460929
461011
  const turnLease = existingTurnLease ?? runtime.turnLifecycle.begin({
460930
461012
  origin: "message",
460931
- workingDirectory: turnWorkingDirectory
461013
+ workingDirectory: turnWorkingDirectory,
461014
+ superRunId: msg.superRunId
460932
461015
  });
460933
461016
  if (connectionId) {
460934
461017
  runtime.activeConnectionId = connectionId;
@@ -461047,6 +461130,7 @@ async function handleIncomingMessageInner(msg, socket, runtime, onStatusChange,
461047
461130
  } : {},
461048
461131
  ...providerFallback.overrideModel ? { overrideModel: providerFallback.overrideModel } : {},
461049
461132
  ...msg.actingUserId ? { actingUserId: msg.actingUserId } : {},
461133
+ ...msg.superRunId ? { superRunId: msg.superRunId } : {},
461050
461134
  ...pendingNormalizationInterruptedToolCallIds.length > 0 ? {
461051
461135
  approvalNormalization: {
461052
461136
  interruptedToolCallIds: pendingNormalizationInterruptedToolCallIds
@@ -461572,6 +461656,7 @@ async function handleIncomingMessageInner(msg, socket, runtime, onStatusChange,
461572
461656
  }
461573
461657
  } finally {
461574
461658
  releaseListenerTurnContext({ runtime, agentId, conversationId });
461659
+ runtime.turnLifecycle.releaseSuperRunId(turnLease);
461575
461660
  }
461576
461661
  evictConversationRuntimeIfIdle(runtime);
461577
461662
  }
@@ -461698,7 +461783,8 @@ async function handleApprovalResponseInput(listener, params, deps = {
461698
461783
  }
461699
461784
  if (await deps.resolveRecoveredApprovalResponse(targetRuntime, params.socket, params.response, handleIncomingMessage, {
461700
461785
  onStatusChange: params.opts.onStatusChange,
461701
- connectionId: params.opts.connectionId
461786
+ connectionId: params.opts.connectionId,
461787
+ ...params.runtime.super_run_id ? { superRunId: params.runtime.super_run_id } : {}
461702
461788
  })) {
461703
461789
  deps.scheduleQueuePump(targetRuntime, params.socket, params.opts, params.processQueuedTurn);
461704
461790
  return true;
@@ -466221,6 +466307,8 @@ function createListenerMessageHandler(params) {
466221
466307
  connectionId,
466222
466308
  agentId: parsed.runtime.agent_id,
466223
466309
  conversationId: parsed.runtime.conversation_id,
466310
+ superRunId: parsed.runtime.super_run_id,
466311
+ noCoalesce: parsed.runtime.super_run_id !== undefined,
466224
466312
  clientToolAllowlist: inputPayload.client_tool_allowlist,
466225
466313
  clientToolset: inputPayload.client_toolset,
466226
466314
  externalToolScopeIds: inputPayload.external_tool_scope_ids,
@@ -470929,14 +471017,14 @@ import {
470929
471017
  existsSync as existsSync52,
470930
471018
  mkdirSync as mkdirSync38,
470931
471019
  readdirSync as readdirSync20,
470932
- readFileSync as readFileSync35,
470933
- writeFileSync as writeFileSync27
471020
+ readFileSync as readFileSync36,
471021
+ writeFileSync as writeFileSync28
470934
471022
  } from "node:fs";
470935
471023
  import { join as join68 } from "node:path";
470936
471024
  function readJsonl(path44) {
470937
471025
  if (!existsSync52(path44))
470938
471026
  return [];
470939
- return readFileSync35(path44, "utf8").split(`
471027
+ return readFileSync36(path44, "utf8").split(`
470940
471028
  `).filter((line) => line.trim().length > 0).map((line) => JSON.parse(line));
470941
471029
  }
470942
471030
  function isLegacyUiMessage(value) {
@@ -470946,7 +471034,7 @@ function isPiLocalMessage(value) {
470946
471034
  return isRecord(value) && typeof value.id === "string" && (value.role === "user" || value.role === "assistant" || value.role === "toolResult") && Object.hasOwn(value, "content");
470947
471035
  }
470948
471036
  function writeJsonl(path44, items3) {
470949
- writeFileSync27(path44, `${items3.map((item) => JSON.stringify(item)).join(`
471037
+ writeFileSync28(path44, `${items3.map((item) => JSON.stringify(item)).join(`
470950
471038
  `)}
470951
471039
  `);
470952
471040
  }
@@ -471231,7 +471319,7 @@ function migrateLocalBackendTranscripts(input) {
471231
471319
  const hasManifest = existsSync52(manifestPath);
471232
471320
  const existingManifest = hasManifest ? (() => {
471233
471321
  try {
471234
- return JSON.parse(readFileSync35(manifestPath, "utf8"));
471322
+ return JSON.parse(readFileSync36(manifestPath, "utf8"));
471235
471323
  } catch {
471236
471324
  return;
471237
471325
  }
@@ -471247,7 +471335,7 @@ function migrateLocalBackendTranscripts(input) {
471247
471335
  result.skipped.push({ conversationDir, reason: "empty" });
471248
471336
  if (!input.dryRun) {
471249
471337
  mkdirSync38(conversationDir, { recursive: true });
471250
- writeFileSync27(manifestPath, `${JSON.stringify(manifest({}), null, 2)}
471338
+ writeFileSync28(manifestPath, `${JSON.stringify(manifest({}), null, 2)}
471251
471339
  `);
471252
471340
  }
471253
471341
  continue;
@@ -471274,7 +471362,7 @@ function migrateLocalBackendTranscripts(input) {
471274
471362
  let conversation;
471275
471363
  if (existsSync52(conversationPath)) {
471276
471364
  try {
471277
- conversation = JSON.parse(readFileSync35(conversationPath, "utf8"));
471365
+ conversation = JSON.parse(readFileSync36(conversationPath, "utf8"));
471278
471366
  } catch {
471279
471367
  conversation = undefined;
471280
471368
  }
@@ -471300,12 +471388,12 @@ function migrateLocalBackendTranscripts(input) {
471300
471388
  }
471301
471389
  }
471302
471390
  conversation.in_context_message_ids = remapped;
471303
- writeFileSync27(conversationPath, `${JSON.stringify(conversation, null, 2)}
471391
+ writeFileSync28(conversationPath, `${JSON.stringify(conversation, null, 2)}
471304
471392
  `);
471305
471393
  }
471306
471394
  } catch {}
471307
471395
  }
471308
- writeFileSync27(manifestPath, `${JSON.stringify(manifest({
471396
+ writeFileSync28(manifestPath, `${JSON.stringify(manifest({
471309
471397
  backupPath,
471310
471398
  migratedFrom: repairVersioned ? hasLegacyUiRows ? "versioned-pi-transcript-with-legacy-ui-message-rows" : "versioned-pi-ai-message-jsonl" : undefined
471311
471399
  }), null, 2)}
@@ -471736,13 +471824,13 @@ var init_memory7 = __esm(() => {
471736
471824
  });
471737
471825
 
471738
471826
  // src/backend/local/transcript-search.ts
471739
- import { existsSync as existsSync54, readdirSync as readdirSync21, readFileSync as readFileSync36, statSync as statSync19 } from "node:fs";
471827
+ import { existsSync as existsSync54, readdirSync as readdirSync21, readFileSync as readFileSync37, statSync as statSync19 } from "node:fs";
471740
471828
  import { join as join70 } from "node:path";
471741
471829
  function readJsonFile3(path44) {
471742
471830
  if (!existsSync54(path44))
471743
471831
  return;
471744
471832
  try {
471745
- return JSON.parse(readFileSync36(path44, "utf8"));
471833
+ return JSON.parse(readFileSync37(path44, "utf8"));
471746
471834
  } catch {
471747
471835
  return;
471748
471836
  }
@@ -471751,7 +471839,7 @@ function readJsonlFile2(path44) {
471751
471839
  if (!existsSync54(path44))
471752
471840
  return [];
471753
471841
  try {
471754
- return readFileSync36(path44, "utf8").split(`
471842
+ return readFileSync37(path44, "utf8").split(`
471755
471843
  `).filter((line) => line.trim().length > 0).map((line) => JSON.parse(line));
471756
471844
  } catch {
471757
471845
  return [];
@@ -472456,10 +472544,10 @@ import {
472456
472544
  mkdirSync as mkdirSync40,
472457
472545
  mkdtempSync as mkdtempSync3,
472458
472546
  readdirSync as readdirSync22,
472459
- readFileSync as readFileSync37,
472547
+ readFileSync as readFileSync38,
472460
472548
  renameSync as renameSync7,
472461
472549
  rmSync as rmSync12,
472462
- writeFileSync as writeFileSync28
472550
+ writeFileSync as writeFileSync29
472463
472551
  } from "node:fs";
472464
472552
  import { tmpdir as tmpdir9 } from "node:os";
472465
472553
  import path44 from "node:path";
@@ -472475,7 +472563,7 @@ function isPathInsideOrEqual2(childPath, parentPath) {
472475
472563
  function readPackageJson(packageJsonPath) {
472476
472564
  let parsed;
472477
472565
  try {
472478
- parsed = JSON.parse(readFileSync37(packageJsonPath, "utf8"));
472566
+ parsed = JSON.parse(readFileSync38(packageJsonPath, "utf8"));
472479
472567
  } catch (error54) {
472480
472568
  throw new Error(`Could not read package.json: ${error54 instanceof Error ? error54.message : String(error54)}`);
472481
472569
  }
@@ -472683,7 +472771,7 @@ function restoreRegistry(registryPath, previousContents) {
472683
472771
  return;
472684
472772
  }
472685
472773
  mkdirSync40(path44.dirname(registryPath), { recursive: true });
472686
- writeFileSync28(registryPath, previousContents);
472774
+ writeFileSync29(registryPath, previousContents);
472687
472775
  }
472688
472776
  function removeIfExists(targetPath) {
472689
472777
  if (!targetPath)
@@ -472804,7 +472892,7 @@ function getNpmInstallArgs(installSpec) {
472804
472892
  ];
472805
472893
  }
472806
472894
  function writeNpmInstallManifest(tempRoot) {
472807
- writeFileSync28(path44.join(tempRoot, "package.json"), `${JSON.stringify({
472895
+ writeFileSync29(path44.join(tempRoot, "package.json"), `${JSON.stringify({
472808
472896
  private: true,
472809
472897
  name: "letta-managed-mod-install"
472810
472898
  }, null, 2)}
@@ -473078,7 +473166,7 @@ function getPackageVersionForGitPackage(params) {
473078
473166
  }
473079
473167
  function writeCompatibilityPackageManifest(params) {
473080
473168
  const packageJsonPath = path44.join(params.packageDirectory, "package.json");
473081
- writeFileSync28(packageJsonPath, `${JSON.stringify({
473169
+ writeFileSync29(packageJsonPath, `${JSON.stringify({
473082
473170
  ...params.packageJson ?? {},
473083
473171
  name: params.packageName,
473084
473172
  version: params.version,
@@ -473316,7 +473404,7 @@ import {
473316
473404
  lstatSync as lstatSync4,
473317
473405
  mkdirSync as mkdirSync41,
473318
473406
  rmSync as rmSync13,
473319
- writeFileSync as writeFileSync29
473407
+ writeFileSync as writeFileSync30
473320
473408
  } from "node:fs";
473321
473409
  import path45 from "node:path";
473322
473410
  function assertValidPackageName(packageName) {
@@ -473419,10 +473507,10 @@ function scaffoldLocalModPackage(options3) {
473419
473507
  try {
473420
473508
  mkdirSync41(targetModsDirectory, { recursive: true });
473421
473509
  copyFileSync5(sourceFile, targetModPath);
473422
- writeFileSync29(packageJsonPath, `${JSON.stringify(createPackageJson(packageName, manifestEntry), null, 2)}
473510
+ writeFileSync30(packageJsonPath, `${JSON.stringify(createPackageJson(packageName, manifestEntry), null, 2)}
473423
473511
  `);
473424
- writeFileSync29(readmePath, createReadme(packageName));
473425
- writeFileSync29(modGuidePath, createModGuide(packageName, manifestEntry));
473512
+ writeFileSync30(readmePath, createReadme(packageName));
473513
+ writeFileSync30(modGuidePath, createModGuide(packageName, manifestEntry));
473426
473514
  } catch (error54) {
473427
473515
  rmSync13(outputDirectory, { force: true, recursive: true });
473428
473516
  throw error54;
@@ -476157,10 +476245,10 @@ import {
476157
476245
  cpSync as cpSync2,
476158
476246
  existsSync as existsSync58,
476159
476247
  mkdtempSync as mkdtempSync4,
476160
- readFileSync as readFileSync38,
476248
+ readFileSync as readFileSync39,
476161
476249
  rmSync as rmSync14,
476162
476250
  statSync as statSync20,
476163
- writeFileSync as writeFileSync30
476251
+ writeFileSync as writeFileSync31
476164
476252
  } from "node:fs";
476165
476253
  import { mkdir as mkdir15, readdir as readdir14 } from "node:fs/promises";
476166
476254
  import { tmpdir as tmpdir10 } from "node:os";
@@ -476522,7 +476610,7 @@ async function downloadDirectSkillFileSource(location, options3 = {}) {
476522
476610
  try {
476523
476611
  const sourceDir = join73(tmpDir, "skill");
476524
476612
  await mkdir15(sourceDir, { recursive: true });
476525
- writeFileSync30(join73(sourceDir, "SKILL.md"), skillText, "utf8");
476613
+ writeFileSync31(join73(sourceDir, "SKILL.md"), skillText, "utf8");
476526
476614
  return { tmpDir, sourceDir };
476527
476615
  } catch (error54) {
476528
476616
  rmSync14(tmpDir, { recursive: true, force: true });
@@ -476574,7 +476662,7 @@ async function downloadClawHubSkillSource(location) {
476574
476662
  if (!response.ok) {
476575
476663
  throw new Error(`ClawHub download failed for ${location.slug}@${version2}: ${response.status}`);
476576
476664
  }
476577
- writeFileSync30(zipPath, Buffer.from(await response.arrayBuffer()));
476665
+ writeFileSync31(zipPath, Buffer.from(await response.arrayBuffer()));
476578
476666
  const { stdout } = await execFile16("unzip", ["-Z1", zipPath], {
476579
476667
  timeout: 30000
476580
476668
  });
@@ -476604,7 +476692,7 @@ function sanitizeSkillName(name) {
476604
476692
  return trimmed;
476605
476693
  }
476606
476694
  function getSkillName(sourceDir) {
476607
- const skillMd = readFileSync38(join73(sourceDir, "SKILL.md"), "utf8");
476695
+ const skillMd = readFileSync39(join73(sourceDir, "SKILL.md"), "utf8");
476608
476696
  const { frontmatter } = parseFrontmatter(skillMd);
476609
476697
  const frontmatterName = frontmatter.name;
476610
476698
  const name = typeof frontmatterName === "string" && frontmatterName.trim() ? frontmatterName : basename28(sourceDir);
@@ -476654,7 +476742,7 @@ async function listSkillDirectories(params) {
476654
476742
  let name = entry.name;
476655
476743
  let description;
476656
476744
  try {
476657
- const skillMd = readFileSync38(skillMdPath, "utf8");
476745
+ const skillMd = readFileSync39(skillMdPath, "utf8");
476658
476746
  const { frontmatter } = parseFrontmatter(skillMd);
476659
476747
  if (typeof frontmatter.name === "string" && frontmatter.name.trim()) {
476660
476748
  name = frontmatter.name.trim();
@@ -480696,7 +480784,7 @@ var init_message_channel_gateway_tool = __esm(() => {
480696
480784
  });
480697
480785
 
480698
480786
  // src/channels/custom/scaffolding.ts
480699
- import { existsSync as existsSync59, mkdirSync as mkdirSync42, rmSync as rmSync15, writeFileSync as writeFileSync31 } from "node:fs";
480787
+ import { existsSync as existsSync59, mkdirSync as mkdirSync42, rmSync as rmSync15, writeFileSync as writeFileSync32 } from "node:fs";
480700
480788
  function removeUserPlugin(channelId) {
480701
480789
  if (FIRST_PARTY_SET.has(channelId)) {
480702
480790
  return;
@@ -482647,7 +482735,7 @@ var exports_bootstrap_tools = {};
482647
482735
  __export(exports_bootstrap_tools, {
482648
482736
  bootstrapBaseToolsIfNeeded: () => bootstrapBaseToolsIfNeeded
482649
482737
  });
482650
- import { existsSync as existsSync60, mkdirSync as mkdirSync43, writeFileSync as writeFileSync32 } from "node:fs";
482738
+ import { existsSync as existsSync60, mkdirSync as mkdirSync43, writeFileSync as writeFileSync33 } from "node:fs";
482651
482739
  import { homedir as homedir42 } from "node:os";
482652
482740
  import { join as join77 } from "node:path";
482653
482741
  async function bootstrapBaseToolsIfNeeded() {
@@ -482658,7 +482746,7 @@ async function bootstrapBaseToolsIfNeeded() {
482658
482746
  const success2 = await addBaseToolsToServer();
482659
482747
  if (success2) {
482660
482748
  mkdirSync43(join77(homedir42(), ".letta"), { recursive: true });
482661
- writeFileSync32(MARKER_PATH, new Date().toISOString(), "utf-8");
482749
+ writeFileSync33(MARKER_PATH, new Date().toISOString(), "utf-8");
482662
482750
  }
482663
482751
  } catch (err) {
482664
482752
  debugWarn("bootstrap", `Failed to bootstrap base tools: ${err instanceof Error ? err.message : String(err)}`);
@@ -494451,7 +494539,7 @@ var init_mcp_client = __esm(() => {
494451
494539
  init_streamableHttp();
494452
494540
  DEFAULT_CLIENT_INFO = {
494453
494541
  name: "letta-code",
494454
- version: "0.30.15"
494542
+ version: "0.30.16"
494455
494543
  };
494456
494544
  });
494457
494545
 
@@ -494873,7 +494961,7 @@ var init_mcp_runtime = __esm(async () => {
494873
494961
  });
494874
494962
 
494875
494963
  // src/skills/builtin/creating-skills/scripts/validate-skill.ts
494876
- import { existsSync as existsSync61, readFileSync as readFileSync39 } from "node:fs";
494964
+ import { existsSync as existsSync61, readFileSync as readFileSync40 } from "node:fs";
494877
494965
  import { basename as basename30, join as join79, resolve as resolve34 } from "node:path";
494878
494966
  import { fileURLToPath as fileURLToPath11 } from "node:url";
494879
494967
  function parseQuotedScalar(value) {
@@ -494975,7 +495063,7 @@ function validateSkill(skillPath) {
494975
495063
  if (!existsSync61(skillMdPath)) {
494976
495064
  return { valid: false, message: "SKILL.md not found" };
494977
495065
  }
494978
- const content = readFileSync39(skillMdPath, "utf-8");
495066
+ const content = readFileSync40(skillMdPath, "utf-8");
494979
495067
  if (!content.startsWith("---")) {
494980
495068
  return { valid: false, message: "No YAML frontmatter found" };
494981
495069
  }
@@ -501397,8 +501485,8 @@ import {
501397
501485
  copyFileSync as copyFileSync6,
501398
501486
  existsSync as existsSync64,
501399
501487
  mkdirSync as mkdirSync45,
501400
- readFileSync as readFileSync41,
501401
- writeFileSync as writeFileSync34
501488
+ readFileSync as readFileSync42,
501489
+ writeFileSync as writeFileSync35
501402
501490
  } from "node:fs";
501403
501491
  import { homedir as homedir47, platform as platform10 } from "node:os";
501404
501492
  import { dirname as dirname35, join as join83 } from "node:path";
@@ -501467,7 +501555,7 @@ function keybindingExists(keybindingsPath) {
501467
501555
  if (!existsSync64(keybindingsPath))
501468
501556
  return false;
501469
501557
  try {
501470
- const content = readFileSync41(keybindingsPath, { encoding: "utf-8" });
501558
+ const content = readFileSync42(keybindingsPath, { encoding: "utf-8" });
501471
501559
  const keybindings = parseKeybindings(content);
501472
501560
  if (!keybindings)
501473
501561
  return false;
@@ -501500,7 +501588,7 @@ function installKeybinding(keybindingsPath) {
501500
501588
  let backupPath = null;
501501
501589
  if (existsSync64(keybindingsPath)) {
501502
501590
  backupPath = createBackup(keybindingsPath);
501503
- const content = readFileSync41(keybindingsPath, { encoding: "utf-8" });
501591
+ const content = readFileSync42(keybindingsPath, { encoding: "utf-8" });
501504
501592
  const parsed = parseKeybindings(content);
501505
501593
  if (parsed === null) {
501506
501594
  return {
@@ -501513,7 +501601,7 @@ function installKeybinding(keybindingsPath) {
501513
501601
  keybindings.push(SHIFT_ENTER_KEYBINDING);
501514
501602
  const newContent = `${JSON.stringify(keybindings, null, 2)}
501515
501603
  `;
501516
- writeFileSync34(keybindingsPath, newContent, { encoding: "utf-8" });
501604
+ writeFileSync35(keybindingsPath, newContent, { encoding: "utf-8" });
501517
501605
  return {
501518
501606
  success: true,
501519
501607
  backupPath: backupPath ?? undefined
@@ -501531,7 +501619,7 @@ function removeKeybinding(keybindingsPath) {
501531
501619
  if (!existsSync64(keybindingsPath)) {
501532
501620
  return { success: true };
501533
501621
  }
501534
- const content = readFileSync41(keybindingsPath, { encoding: "utf-8" });
501622
+ const content = readFileSync42(keybindingsPath, { encoding: "utf-8" });
501535
501623
  const keybindings = parseKeybindings(content);
501536
501624
  if (!keybindings) {
501537
501625
  return {
@@ -501542,7 +501630,7 @@ function removeKeybinding(keybindingsPath) {
501542
501630
  const filtered = keybindings.filter((kb) => !(kb.key?.toLowerCase() === "shift+enter" && kb.command === "workbench.action.terminal.sendSequence" && kb.when?.includes("terminalFocus")));
501543
501631
  const newContent = `${JSON.stringify(filtered, null, 2)}
501544
501632
  `;
501545
- writeFileSync34(keybindingsPath, newContent, { encoding: "utf-8" });
501633
+ writeFileSync35(keybindingsPath, newContent, { encoding: "utf-8" });
501546
501634
  return { success: true };
501547
501635
  } catch (error54) {
501548
501636
  const message = error54 instanceof Error ? error54.message : String(error54);
@@ -501708,7 +501796,7 @@ function wezTermDeleteFixExists(configPath) {
501708
501796
  if (!existsSync64(configPath))
501709
501797
  return false;
501710
501798
  try {
501711
- const content = readFileSync41(configPath, { encoding: "utf-8" });
501799
+ const content = readFileSync42(configPath, { encoding: "utf-8" });
501712
501800
  return content.includes("Letta Code: Fix Delete key") || content.includes("key = 'Delete'") && content.includes("SendString") && content.includes("\\x1b[3~");
501713
501801
  } catch {
501714
501802
  return false;
@@ -501725,14 +501813,14 @@ function installWezTermDeleteFix() {
501725
501813
  if (existsSync64(configPath)) {
501726
501814
  backupPath = `${configPath}.letta-backup`;
501727
501815
  copyFileSync6(configPath, backupPath);
501728
- content = readFileSync41(configPath, { encoding: "utf-8" });
501816
+ content = readFileSync42(configPath, { encoding: "utf-8" });
501729
501817
  }
501730
501818
  content = injectWezTermDeleteFix(content);
501731
501819
  const parentDir = dirname35(configPath);
501732
501820
  if (!existsSync64(parentDir)) {
501733
501821
  mkdirSync45(parentDir, { recursive: true });
501734
501822
  }
501735
- writeFileSync34(configPath, content, { encoding: "utf-8" });
501823
+ writeFileSync35(configPath, content, { encoding: "utf-8" });
501736
501824
  return {
501737
501825
  success: true,
501738
501826
  backupPath: backupPath ?? undefined
@@ -513236,9 +513324,9 @@ import {
513236
513324
  existsSync as existsSync65,
513237
513325
  mkdirSync as mkdirSync46,
513238
513326
  mkdtempSync as mkdtempSync5,
513239
- readFileSync as readFileSync42,
513327
+ readFileSync as readFileSync43,
513240
513328
  rmSync as rmSync16,
513241
- writeFileSync as writeFileSync35
513329
+ writeFileSync as writeFileSync36
513242
513330
  } from "node:fs";
513243
513331
  import { tmpdir as tmpdir11 } from "node:os";
513244
513332
  import { dirname as dirname36, join as join85 } from "node:path";
@@ -513481,12 +513569,12 @@ function writeWorkflow(repoDir, workflowPath, content) {
513481
513569
  const next = `${content.trimEnd()}
513482
513570
  `;
513483
513571
  if (existsSync65(absolutePath)) {
513484
- const previous = readFileSync42(absolutePath, "utf8");
513572
+ const previous = readFileSync43(absolutePath, "utf8");
513485
513573
  if (previous === next) {
513486
513574
  return false;
513487
513575
  }
513488
513576
  }
513489
- writeFileSync35(absolutePath, next, "utf8");
513577
+ writeFileSync36(absolutePath, next, "utf8");
513490
513578
  return true;
513491
513579
  }
513492
513580
  function getDefaultBaseBranch(repoDir) {
@@ -517370,7 +517458,7 @@ __export(exports_generate_memory_viewer, {
517370
517458
  generateAndOpenMemoryViewer: () => generateAndOpenMemoryViewer
517371
517459
  });
517372
517460
  import { execFile as execFileCb7 } from "node:child_process";
517373
- import { chmodSync as chmodSync7, existsSync as existsSync66, mkdirSync as mkdirSync47, writeFileSync as writeFileSync36 } from "node:fs";
517461
+ import { chmodSync as chmodSync7, existsSync as existsSync66, mkdirSync as mkdirSync47, writeFileSync as writeFileSync37 } from "node:fs";
517374
517462
  import { homedir as homedir50 } from "node:os";
517375
517463
  import { join as join86 } from "node:path";
517376
517464
  import { promisify as promisify17 } from "node:util";
@@ -517698,7 +517786,7 @@ async function generateAndOpenMemoryViewer(agentId, options3) {
517698
517786
  chmodSync7(VIEWERS_DIR, 448);
517699
517787
  } catch {}
517700
517788
  const filePath = join86(VIEWERS_DIR, `memory-${encodeURIComponent(agentId)}.html`);
517701
- writeFileSync36(filePath, html5);
517789
+ writeFileSync37(filePath, html5);
517702
517790
  chmodSync7(filePath, 384);
517703
517791
  const skipOpen = Boolean(process.env.TMUX) || Boolean(process.env.SSH_CONNECTION) || Boolean(process.env.SSH_TTY);
517704
517792
  if (!skipOpen) {
@@ -541249,7 +541337,7 @@ __export(exports_generate_diff_viewer, {
541249
541337
  generateAndOpenDiffViewer: () => generateAndOpenDiffViewer
541250
541338
  });
541251
541339
  import { execFile as execFileCb8 } from "node:child_process";
541252
- import { chmodSync as chmodSync8, existsSync as existsSync68, mkdirSync as mkdirSync48, writeFileSync as writeFileSync37 } from "node:fs";
541340
+ import { chmodSync as chmodSync8, existsSync as existsSync68, mkdirSync as mkdirSync48, writeFileSync as writeFileSync38 } from "node:fs";
541253
541341
  import { homedir as homedir52 } from "node:os";
541254
541342
  import { isAbsolute as isAbsolute29, join as join89, resolve as resolve38 } from "node:path";
541255
541343
  import { promisify as promisify18 } from "node:util";
@@ -541477,7 +541565,7 @@ async function generateAndOpenDiffViewer(targetPath) {
541477
541565
  chmodSync8(VIEWERS_DIR2, 448);
541478
541566
  } catch {}
541479
541567
  const filePath = join89(VIEWERS_DIR2, `diff-${encodeURIComponent(worktreePath)}.html`);
541480
- writeFileSync37(filePath, html5);
541568
+ writeFileSync38(filePath, html5);
541481
541569
  chmodSync8(filePath, 384);
541482
541570
  const skipOpen = shouldSkipOpen();
541483
541571
  if (!skipOpen) {
@@ -543535,7 +543623,7 @@ __export(exports_shell_aliases, {
543535
543623
  expandAliases: () => expandAliases,
543536
543624
  clearAliasCache: () => clearAliasCache
543537
543625
  });
543538
- import { existsSync as existsSync69, readFileSync as readFileSync43 } from "node:fs";
543626
+ import { existsSync as existsSync69, readFileSync as readFileSync44 } from "node:fs";
543539
543627
  import { homedir as homedir53 } from "node:os";
543540
543628
  import { join as join90 } from "node:path";
543541
543629
  function parseAliasesFromFile(filePath) {
@@ -543544,7 +543632,7 @@ function parseAliasesFromFile(filePath) {
543544
543632
  return aliases;
543545
543633
  }
543546
543634
  try {
543547
- const content = readFileSync43(filePath, "utf-8");
543635
+ const content = readFileSync44(filePath, "utf-8");
543548
543636
  const lines = content.split(`
543549
543637
  `);
543550
543638
  let inFunction = false;
@@ -551914,7 +552002,7 @@ var init_conversation_switch_alert = __esm(() => {
551914
552002
 
551915
552003
  // src/cli/app/use-submit-handler.ts
551916
552004
  import { randomUUID as randomUUID40 } from "node:crypto";
551917
- import { existsSync as existsSync70, readFileSync as readFileSync44, renameSync as renameSync8, writeFileSync as writeFileSync38 } from "node:fs";
552005
+ import { existsSync as existsSync70, readFileSync as readFileSync45, renameSync as renameSync8, writeFileSync as writeFileSync39 } from "node:fs";
551918
552006
  import { tmpdir as tmpdir12 } from "node:os";
551919
552007
  import { join as join91 } from "node:path";
551920
552008
  async function findCustomCommandByName(commandName) {
@@ -552616,7 +552704,7 @@ ${SYSTEM_REMINDER_CLOSE}`),
552616
552704
  ];
552617
552705
  const personaPath = personaCandidates.find((candidate) => existsSync70(candidate));
552618
552706
  if (personaPath) {
552619
- const personaContent = readFileSync44(personaPath, "utf-8");
552707
+ const personaContent = readFileSync45(personaPath, "utf-8");
552620
552708
  setCurrentPersonalityId(detectPersonalityFromPersonaFile(personaContent));
552621
552709
  } else {
552622
552710
  setCurrentPersonalityId(null);
@@ -553384,7 +553472,7 @@ Tip: Use /clear instead to clear the current message buffer.`;
553384
553472
  fileContent.skills = skills;
553385
553473
  }
553386
553474
  const fileName = exportParams.conversation_id ? `${exportParams.conversation_id}.af` : `${agentId}.af`;
553387
- writeFileSync38(fileName, JSON.stringify(fileContent, null, 2));
553475
+ writeFileSync39(fileName, JSON.stringify(fileContent, null, 2));
553388
553476
  let summary = `AgentFile exported to ${fileName}`;
553389
553477
  if (skills.length > 0) {
553390
553478
  summary += `
@@ -561735,4 +561823,4 @@ function registerBunOAuthFlows() {
561735
561823
  registerBunOAuthFlows();
561736
561824
  await init_src5().then(() => exports_src2);
561737
561825
 
561738
- //# debugId=2F7E57BB5188C34664756E2164756E21
561826
+ //# debugId=036B0E52721A750064756E2164756E21